Author Topic: xretrace, xxutils and a few other things  (Read 3068 times)

Graeme

  • Senior Community Member
  • Posts: 2422
  • Hero Points: 320
xretrace, xxutils and a few other things
« on: October 22, 2018, 05:23:08 am »
I've combined xretrace, xxutils and a few other things into a single zip file.  Backup your current configuration folder then unzip to your config folder so that you have a sub-folder called xretrace that has the macro files and bitmaps needed.

Have a read of the info towards the end of the xload-macros.e source file.
If you want to try this out before changing your normal config folder then create a new empty temporary config folder - start slick with vs.exe +new -sc some-empty-folder   - then import all your settings and load all the files below.

The xload_macros command prompts if you want to force the macro source to be re-compiled.  Normally you should say "yes" to this.

  >>>>>>  from xload-macros.e
  1) Unzip all files into a sub-folder of your configuration folder called "xretrace"
  2) Read the notes below and customize the paths if you want
  3) Backup your configuration folder
  4) Load this module xload-macros.e then run the command xload_macros.
     You will be prompted for which modules you want to load.
     dlinklist.e is needed by other modules  - no harm to load it.
     xretrace-whatever  - load all three or none
     xtemp-file-manager is needed by xxutils but it's sort of inactive until you enable it
     xnotepad  -  is needed by xxutils
     xblock-selection-editor - is optional

xretrace now includes a kind of vertical scrollbar.  It creates a bunch of text files - if you don't want these then stick with the old xretrace (link below) and skip loading the three xretrace modules listed above.  xretrace.e has some detail at the start about how to use it.
  https://community.slickedit.com/index.php/topic,4693.msg36784.html#msg36784
 
The old version of xxutils.e is here
https://community.slickedit.com/index.php/topic,11186.msg57320.html#msg57320

If you want to use the temporary file handler then it's best to create an environment variable called xtemp_files_path to specify where you want the temp files to go - more info in xload-macros.e.  The file xtemp-file-manager has some detail at the start about what it's doing.

Please let me know if there are any problems.

[EDIT Nov 11, 2018]
Uploaded some updated files to fix a couple of things.  There's a new option in the xretrace options dialog  -  "capture retrace data to disk".  It's off by default.  If you want xretrace-scrollbar to show anything useful it needs to be enabled.
« Last Edit: November 11, 2018, 09:23:19 am by Graeme »

rowbearto

  • Senior Community Member
  • Posts: 1598
  • Hero Points: 116
Re: xretrace, xxutils and a few other things
« Reply #1 on: December 08, 2019, 04:26:12 pm »
Hi Graeme:

Is this the latest version of your tools? I want to try it out but when I search the forum there is more than 1 post, so not sure which one to use.

Maybe you can make a github for it? This way there is one central place to get it and you can even have contributors.

rowbearto

  • Senior Community Member
  • Posts: 1598
  • Hero Points: 116
Re: xretrace, xxutils and a few other things
« Reply #2 on: December 08, 2019, 05:51:48 pm »
Also, is there a reason why the macros need to be in a subfolder of the config folder? I usually have my macros in a dedicated folder outside of the config.

Graeme

  • Senior Community Member
  • Posts: 2422
  • Hero Points: 320
Re: xretrace, xxutils and a few other things
« Reply #3 on: December 08, 2019, 09:09:44 pm »
Hi Rob
This thread is the latest version but I haven't had time to switch to V24 yet and I'm fairly sure that xretrace doesn't work correctly with V24 and it crashes slickedit on Linux.  I should get time to look at it in a couple of weeks.

I have macros in a sub-folder so that when I upgrade to a new config folder, the macros get copied and re-built with the new version.  It allows me to keep using an older version if I want  - the .ex file isn't portable between versions.

I agree that there should be a common git repo for macros - the wiki would be useful too.  jporkkahtc posted a link to his git repo for his macros a while ago but I would prefer that the repo was owned by SlickEdit Inc and publicised on this forum.

I also have to set up an easier way to load my macros using the hotfix mechanism - I started doing it after a suggestion from Dennis but ran into problems and lack of time.
 


rowbearto

  • Senior Community Member
  • Posts: 1598
  • Hero Points: 116
Re: xretrace, xxutils and a few other things
« Reply #4 on: December 08, 2019, 09:20:28 pm »
I tried to use xretrace with v24 on Linux before your post.

It is not crashing v24,  xretrace_cursor and xtrace_modified_line seem to work.

However when I do xretrace_modified_line_steps or xretrace_cursor_steps, the popup window comes up but then instantly disappears. I set the below:

Code: [Select]
#define  XRETRACE_DATA_PATH  "/tmp/xretrace"
//#define  XRETRACE_USE_SUBFOLDER YES

But I don't see any files created in there when I move the cursor around or start modifying lines.

xretrace seems like it can be really useful so I don't mind debugging it on v24 if you have any pointers for where I should look?

I started a private github repo for my changes but I can easily make it public, if you are interested.

Graeme

  • Senior Community Member
  • Posts: 2422
  • Hero Points: 320
Re: xretrace, xxutils and a few other things
« Reply #5 on: December 08, 2019, 10:16:50 pm »
If the popup window is disappearing instantly then maybe the retrace_steps_event_loop2 function is exiting immediately.  You could find the "return" statements in that function and see if you can figure out why it is exiting early?  When the event loop is running you should be able to show and hide the popup window using "F5".

There are some "xretrace_dump" commands that output the current xretrace list  e.g.  xretrace_dump_retrace_cursor_list  -  can be used to check if the cursor position is being added to the list correctly  - and xretrace_dump_modified_lines_list.

Regarding the repo  -jporkkahtc made his public too.  I'll see if SlickEdit support have any comment about it.  Ideally there should be just one repo for all user macros I think.


rowbearto

  • Senior Community Member
  • Posts: 1598
  • Hero Points: 116
Re: xretrace, xxutils and a few other things
« Reply #6 on: December 08, 2019, 10:20:41 pm »
Graeme: With the addition of many dsay() statements, I found that the popup for xretrace-cursor-steps is disappearing right away because it thinks that "ESC" was hit. My dsay in the below case for 'ESC' is printing out so that is how I know.

Code: [Select]
      _str key = get_event('N');   // refresh screen and get a key
      _str keyt = event2name(key);
      switch (keyt) {
...
         case 'ESC' :
            // exit back where we started
            edit('+Q +BI ' :+ start_buf_id);
            message('');  // clear
            _mdi.p_child.p_line = startline;
            _mdi.p_child.p_col = startcol;
            center_line();
            dsay("Event loop ESC return");
            return;

Any ideas as to why it thinks ESC was hit?

At first I was issuing the 'xretrace-cursor-steps' by pressing esc and typing the command.

But then if I bind it to a key so I don't have to hit ESC, it still exits due to thinking ESC was hit.

rowbearto

  • Senior Community Member
  • Posts: 1598
  • Hero Points: 116
Re: xretrace, xxutils and a few other things
« Reply #7 on: December 08, 2019, 10:22:32 pm »
Regarding github, I've also had a public github repo for a macro that I took over from chrisant:

https://github.com/rbresalier/sync_project_with_scm

Graeme

  • Senior Community Member
  • Posts: 2422
  • Hero Points: 320
Re: xretrace, xxutils and a few other things
« Reply #8 on: December 08, 2019, 10:22:43 pm »
Sorry, missed your question about xretrace_data_path  - there's not much difference in the code regarding this so I would expect it to work.

Maybe you have data capture disabled - from a higher up post I wrote this
Quote
There's a new option in the xretrace options dialog  -  "capture retrace data to disk".  It's off by default.  If you want xretrace-scrollbar to show anything useful it needs to be enabled.


rowbearto

  • Senior Community Member
  • Posts: 1598
  • Hero Points: 116
Re: xretrace, xxutils and a few other things
« Reply #9 on: December 08, 2019, 10:29:07 pm »
So I modified the event loop code so that the first ESC is ignored, and only the 2nd ESC is looked at.

When I do this it works! The popup is there and I can navigate the cursor changes.

rowbearto

  • Senior Community Member
  • Posts: 1598
  • Hero Points: 116
Re: xretrace, xxutils and a few other things
« Reply #10 on: December 08, 2019, 10:32:25 pm »
For xretrace github repo, I think it would be nice to have it on its own and not be in a repo with everyone elses macros.

The reason that I think this is so that I can cd to my SE config dir and do a git clone xretrace and it will automatically be in the config/24.0.0/xretrace directory.

This is how I made my private repo.

Graeme

  • Senior Community Member
  • Posts: 2422
  • Hero Points: 320
Re: xretrace, xxutils and a few other things
« Reply #11 on: December 08, 2019, 10:32:45 pm »
ok, thanks.  I'll check with slickedit support about it, also Clark offered to help me get xretrace working on V24.

I wonder if it's something to do with the numeric keypad stuff I added because of this.
https://community.slickedit.com/index.php/topic,16592.msg63985.html#msg63985

Graeme

  • Senior Community Member
  • Posts: 2422
  • Hero Points: 320
Re: xretrace, xxutils and a few other things
« Reply #12 on: December 08, 2019, 10:34:38 pm »
regarding the repo - ok, I'll give it some thought.

rowbearto

  • Senior Community Member
  • Posts: 1598
  • Hero Points: 116
Re: xretrace, xxutils and a few other things
« Reply #13 on: December 08, 2019, 10:48:32 pm »
It seems like a possible issue with SlickEdit to me and not related to that post. For some reason after running xretrace_cursor_steps macro, the first time one tries to get a key (using code below) it is always ESC. Is xretrace somehow "pressing"/inserting this key?

Code: [Select]
_str key = get_event('N');   // refresh screen and get a key
_str keyt = event2name(key)

UPDATE: I modified the code to remove the numeric keypad stuff as below, it still thinks ESC is pressed and I need to ignore the first ESC, so that is not the problem.

Code: [Select]
      // make numpad keys work properly
      //int orig_auto_map_pad_keys=_default_option(VSOPTION_AUTO_MAP_PAD_KEYS);
      //_default_option(VSOPTION_AUTO_MAP_PAD_KEYS,0);
      _str key = get_event('N');   // refresh screen and get a key
      _str keyt = event2name(key);
      //_default_option(VSOPTION_AUTO_MAP_PAD_KEYS,orig_auto_map_pad_keys);
« Last Edit: December 08, 2019, 10:55:23 pm by rowbearto »

rowbearto

  • Senior Community Member
  • Posts: 1598
  • Hero Points: 116
Re: xretrace, xxutils and a few other things
« Reply #14 on: December 08, 2019, 11:11:48 pm »
After removing my debug prints it seems I now need to ignore the first 2 ESC keypresses and not just the first one.

Something seems strange.

UPDATE: I modified my local xretrace.e to ignore any ESC character within the first 500msec from when the event loop starts, this seems to work. But would be nice to understand why this is needed.
« Last Edit: December 09, 2019, 02:52:57 am by rowbearto »