Author Topic: Alias expansion with maco call  (Read 723 times)

vandermyer

  • Community Member
  • Posts: 46
  • Hero Points: 2
Alias expansion with maco call
« on: October 24, 2024, 12:59:34 PM »
Hello All,

I would like to create an alias that (amongst other things) includes the file name (using sequence %\fn) but translated to upper case. I have tried various options like this: %\m upcase %\fn%, but cannot make it work. Inserting the file name works, it's the upper case bit that doesn't.

Is this possible, and if so how? Thanks.

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 7041
  • Hero Points: 535
Re: Alias expansion with maco call
« Reply #1 on: October 24, 2024, 02:39:46 PM »
That won't work for multiple reasons. There is a global scope built-in upcase() function but %\m doesn't support calling global built-in functions (design flaw in Slick-C). Also, the first % will terminate the function call. "%\m upcase %" is what gets parsed and no arguments are passed to upcase.

Put the following code in a .e file and load it. Maybe call the file "insert_upcase_bufname.e".

_str insert_upcase_bufname() {
   return upcase(p_buf_name);
}

Then %\m insert-upcase-bufname% will insert the buffer name in upper case.

vandermyer

  • Community Member
  • Posts: 46
  • Hero Points: 2
Re: Alias expansion with maco call
« Reply #2 on: October 25, 2024, 08:19:35 AM »
Thanks Clarke. Work nicely!