Author Topic: Attention to documentation  (Read 1159 times)

heckstein

  • Junior Community Member
  • Posts: 5
  • Hero Points: 0
Attention to documentation
« on: July 16, 2023, 11:32:49 PM »
I've only very rarely had to program my own SE macros, over many years.  I was very disappointed when the SE macro documentation presented no simple and straightforward answer to my question, how to restore the cursor to its starting column after at the end of a relatively simple keystroke macro.  I found the simple solution of saving and restoring p_col after more than two hours, first failing to find a suitable function or pair of functions (I was unable to get _save and _restore _pos2() to work), then studying various areas of SE macro documentation and finally turning to the SE forum. 

I ultimately found a mention of p_line and p_col in code posted in the forum.  I wonder if SE's macro documentation should be reviewed and possibly enhanced.  Is it presumptuous of me to have trusted that I could find my answer more quickly and more readily?

Thanks, of course, for SE, over these decades.

Dan

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 2903
  • Hero Points: 153
Re: Attention to documentation
« Reply #1 on: July 17, 2023, 12:09:16 PM »
Sorry you had a hard time with this.  What happens if you wrapper the macro with something like this:

save_pos(auto p);
// your macro here
restore_pos(p);

_save_pos2 and _restore_pos2 us a selection to save and restore the position.  This might or might not be a better choice, depending on what you're doing that you need to restore the cursor position from.

If you bring up the help, under Contents on the left, there is a Slick-C Macro Programming Guide section that is probably more than you want to read to find something like that, but it has examples and save_pos() or p_col is used in one pretty early on I'm sure.

Asking here generally works pretty well too.