[TxMt] Re: jump back to previous location
Eduardo Francos
efrancos at efrancos.com
Mon Sep 22 20:05:04 UTC 2014
On 22 sept. 2014, at 18:50, Allan Odgaard <mailinglist at textmate.org> wrote:
> On 22 Sep 2014, at 18:30, Eduardo Francos wrote:
>
>> I developed a bundle I called "Navigator" for TM 1.5 that does that.
>> Actually it does a lot more. Among others it implements a position stack with push/pop position, navigation within the stack
>
> Sounds like this could be tackled by extended the current bookmark system with a “go back to last bookmark added and remove it (and make it work accross files)”-action, and we would have this push/pop system.
I agree. As long as you have a push/pop type of mechanism you have the functionality.
However, current bookmarks are document based so if the document has been closed then the pop cannot work as is. Positioning bookmarks need to be kept available all the time. I use a file to keep the stack information between bundle calls.
I guess this information could be managed more efficiently inside TM.
The "push" could be done automatically to save the extra keystroke but as mentioned by others it's not easy to determine when a push must be done.
For what it's worth, when I tried to implement automatic pushes I decided on two relatively simplistic conditions:
1) Whenever you edit a line its position is pushed. Previous pushed positions are poped and discarded while they are located within a number of lines of the current one. This in order to avoid the pain of going back to each one of them separately.
2) Whenever the caret stays on the same line or group of lines for longer than a given number of seconds the position is pushed. I translate this as "the position is interesting".
>
>> […] TMTOOLS is not supported anymore and I used it for precise positioning when documents have changed since the position was saved.
>
> Curious, how was TMTOOLS able to help with that?
It's related to the issue of files being modified after the position has been pushed so the stored position is not exactly right. After determining the file and position to jump to, and telling TM (via mate) to open the file at the position, I then use TMTOOLS to call a bundle command that would check that the line is still there. If it's not then search a (configurable) number of lines up and down to try to find it. This gives me precise positioning almost always.
In a more general way I use TMTOOLS to be able to call back into TM and continue a logic that is dependent on TM doing something in between.
It would be nice if the command line "mate" could do that type of things... but that's a different story :p
>
> _______________________________________________
> textmate mailing list
> textmate at lists.macromates.com
> http://lists.macromates.com/listinfo/textmate
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 495 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://lists.macromates.com/textmate/attachments/20140922/2cce6ec5/attachment.asc>
More information about the textmate
mailing list