Carlo Baldassi wrote: > I just realized that the "keepjumps!" patch I sent is not working correctly > under some circumstances. > A single backup list is not sufficient, it really needs to keep a stack of > them in order to work properly. > I'll make a new patch in a short while (unless I'm told it has zero chance > of getting in...) > Sorry for the annoyance.
Looking at this again, I wonder what the problem is that we are solving. In general, it appears we want to prevent new jumps being added to the jumplist. Thus commands (and called functions) can move around without changing what CTRL-O jumps to. A save and restore using a local variable won't work, because when lines are inserted or deleted we do want the existing jumps to end up at the correct line. We need to somehow update the marks inside the saved list, which requires it to be internal to Vim. Another problem is when a function or script terminates early because of an error. If there would be a lock and unlock then the unlock doesn't happen and the user is stuck with a locked jumplist. What was also mentioned, is a bunch of nested functions is used, somehwere further down the code might depend on a mark or jumplist entry to work, E.g. by jumping to some line and then using CTRL-O to jump back. Thus locking possibly breaks code that isn't aware of jumps being locked. What appears to be the best solution: - Do not lock the jumplist but restore it. - Make it work recursively, thus every save results in another copy to be created. - Do update for inserted/deleted lines in the jumplist that is restored. In case a restore command is missed, we could have the list of saved jumplists grow. To prevent that a command modifier is better, then we can always restore when the command finishes, even when it fails. The idea mentioned to use ":keepjumps!", I think that would be OK. This is not so easy to implement, but it's possible. -- Marriage isn't a word. It's a sentence. /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org /// -- -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
