开发者

can the point have a longer history

I often find myself in the following situation. Say I was editing a file with this contents

\begin{itemize}
\item
\end{itemize}

I really like http://stackoverflow.com !

And say the point was after the word \item. What I want to do is select http://stackoverflow.com , C-w it, and go back to \item, and yank it there. What I would do is C-s htt and that would bring the point to the 2nd t of http, and from there I would go backwards, C-SPC on h, then select the rest of the word. Now, I would like to use something like C-x C-x to bring me back to \item, but it will instead bring me back to the h of http. Is there a command like C-x C-x which brings the point back through its h开发者_开发技巧istory of location?

Thanks,


I generally use C-u C-SPC to cycle back through the (local) mark ring. Here's the relevant docs for set-mark-command (C-SPC):

With prefix argument (e.g., C-u C-SPC), jump to the mark, and set the mark from position popped off the local mark ring (this does not affect the global mark ring). Use C-x C-SPC to jump to a mark popped off the global mark ring (see `pop-global-mark').

Note: I changed the doc string to use C-SPC instead of C-@.

The relevant info page is "The Mark Ring", which points out if you have this setting:

(setq set-mark-command-repeat-pop t)

then the second/third/fourth... invocation of C-SPC doesn't need a C-u to repeat the popping action - which is very nice.


I used to use C-u C-SPC a lot, but nowadays I use goto-last-change.el, which uses buffer's undo information to track changes (vs the mark ring). I like it a little better, YMMV.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜