Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Good key chords matter.

Here are some of mine:

M-. jump to source

M-, pop back to previous source

C-x f r Find References

C-x f i Find Implementations

C-x f t Find Type

C-x r v Rename Variable

C-x c a Code Actions

And a bunch more. I'd like to have an analogue to jump back with my C-x stuff like I do with M-. and M-, - any emacs people have suggestions on how to do that?

I don't know how fast you are with the mouse, but I've watched my co-workers jump into source and they can be so slow. I believe that I can answer questions I have regarding the codebase faster than they can, I don't have to rely on my memory for trivialities.



> I'd like to have an analogue to jump back with my C-x stuff like I do with M-. and M-, - any emacs people have suggestions on how to do that?

If you use Xref UI for "Find References/Implementations/Type", M-, should work in those cases too.

There is a more general question: how to "jump forward" again, without re-invoking the previous navigation command with the exact arguments. IDEA, already mentioned in comments, has key bindings for that.

There are several third-party packages which attempt to solve it as well. I'm using this one:

https://github.com/tcw165/history

You can also add "jump back" to your other navigation commands, even if they don't use the Xref UI.


Jumping "forward" is sort of built into Emacs with C-x C-SPC, pop-global-mark.

The objective and this command are fairly but not completely aligned, so it may require multiple presses of C-x C-SPC. To be clear, you only need to press C-SPC after the first invocation to repeat the command.


"sort of" and "not completely aligned" are just right: IMO, the mark navigation feature is just clunky/broken compared to the alternatives.

You don't want to iterate between the marks in the current buffer in a loop, or somehow keep track of whether each of the last three navigations changed the buffer or not (which would affect which one of the mark rings you'll have to use to go back or forward).


I don't find them particularly good. All these \C-x that emacs forces on you introduce extensive risks of RSI, especially if your Control key is still at the bottom left of your keyboard.

Better chords would be simple shortcuts for actions you do often (for example, "Go to symbol" in IDEA is \C-b).


I'm not sure there's a surefire way of jumping back with your C-x commands that's built into Emacs, but here are two options:

C-x C-SPC will pop the global mark which, depending on what you've done in the buffer you're visiting, can pop you right back to where you started, functioning as the equivalent of M-,.

C-x b RET (C-x b with no input) should take you back to the most recently used buffer, which will usually be the buffer you started from.

Not built in: It's also fairly trivial to write some defadvice that stores your point (pre-jump) to a register, so you can jump back to the register with one key.


> jump back with my C-x stuff like I do with M-. and M-, - any emacs people have suggestions on how to do that?

Using builtin commands, `C-x <left>` will switch to the previous buffer if you've jumped to another file, or `C-u C-SPC` (popping the mark) should work if you're in the same file. Not sure if this is sufficient for you, but it's a simple option to try.


C-x C-SPC (pop-global-mark) will work across buffers.


> I'd like to have an analogue to jump back with my C-x stuff like I do with M-. and M-

Use IntelliJ, it's trivial to do that with `Cmd+B` (on Mac).




Consider applying for YC's Fall 2026 batch! Applications are open till July 27.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: