Switch to original buffer after chasing tags in Emacs

后端 未结 3 627
无人共我
无人共我 2021-01-22 14:33

I use M-. to jump to definitions of class/functions. Sometimes there are multiple classes with the same tag, so I need to use C-u M-. to jump to multip

相关标签:
3条回答
  • 2021-01-22 15:01

    Icicles multi-command icicle-find-tag, bound to M-. in Icicle mode, combines all of what vanilla Emacs commands M-. (find-tag), M-, (tags-loop-continue), tags-apropos, and list-tags do. And it does more.

    You can complete against any tags, cycle (in different orders) among a subset of tags matching an additional pattern, and so on, visiting multiple tags in a single command invocation. You choose the tags you want to visit, in any order --- you need not visit each one in sequence.

    1. You first enter (using RET) a regexp that all tags you are interested in must match (it could be vacuous, to get all tags).

    2. After that, you can type a pattern that a subset of the tags and or their source files must match.

      That is, by default you can complete against multi-completion candidates that are composed of the tag itself and its source file name.

    3. You can choose candidates to visit using C-mouse-2 in *Completions* or by cycling among their names using down and up and then using C-RET to visit.

    4. You can return to your original location using M-* (icicle-pop-tag-mark). You can also return to it by just using C-g to finish your M-. invocation.

    More information here.

    0 讨论(0)
  • 2021-01-22 15:24

    I use winner-mode for this (and other similar situations).

    Add (winner-mode 1) to your init file, and then when you wish to return to the window configuration that you were in before jumping to the tags, you just type:

    C-c<left> to call winner-undo (repeating as many times as necessary)

    If you had visited multiple tags in another buffer, this will get you back to your original buffer (or the previous buffer, at any rate) in a single step, rather than stepping back through the individual tags one by one.

    If the tags have taken you through multiple buffers, then you'll need to type C-c<left> once for each buffer (or C-c<left>C-xzzz... if you'd gone on quite a long detour :)

    0 讨论(0)
  • 2021-01-22 15:28

    I believe that M-. calls find-tag by default. You should be able to go back up the stack of locations with M-* (pop-tag-mark).

    From C-h f find-tag:

    A marker representing the point when this command is invoked is pushed onto a ring and may be popped back to with M-*. Contrast this with the ring of marks gone to by the command.

    0 讨论(0)
提交回复
热议问题