emacs

gunnar 2025-09-08T06:12:19.857829Z

Good morning! One thing in Emacs that I've never really gotten the hang of: jumping back and forth (in history, cursor movement and editing). I've been using IntelliJ for two decades, and there it works quite intuitively with a a single set of actions. How are you all doing this in Emacs?

➕ 1
djm 2025-09-09T07:31:25.515929Z

@jr0cket what is ' ' bound to?

practicalli-johnny 2025-09-09T13:37:26.846879Z

@djm_uk its bound to evil-goto-mark-line which is part of evil-motion-state-map (using Spacemacs config for Emacs)

1
Ed 2025-09-09T19:58:44.292309Z

I've not used BM, but I do use the default bookmarks functionality https://www.gnu.org/software/emacs/manual/html_node/emacs/Bookmarks.html

lassemaatta 2025-09-08T06:19:12.196969Z

As an Emacs beginner I've wondered about this too and tried a couple of solutions. At the moment I'm using xref when editing code with LSP; xref-find-definitions to jump from call-site to function declaration, xref-go-[forward,back] to navigate the history. So far it has seem to work better than various 3rd party packages I've tried, which include stuff like following the cursor history.

karol.adamiec 2025-09-08T06:35:02.983039Z

set-mark-command or ctrl-u ctrl-space on mine is jumping back to where mark is. most command set mark when moving cursor. xref or xref like go to gef and step out of def work in this narrow scenario, and i do use them when navigating around definitions. but for general "i wanna go back" i use the former.

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-@ to jump to a mark popped off the global
mark ring (see pop-global-mark).

practicalli-johnny 2025-09-08T06:44:42.573639Z

' and ' jumps back to the previous edit location which covers most of my general workflow. I believe this jumps ba Or I use @ and a letter to set specific marks, e.g. @ a sets a mark called a which is jumped to by ' a https://practical.li/spacemacs/navigating-code/markers/ Note: i use evil mode, but vanilla Emacs should have equivalent key bindings I use projectile to switch between the associated source and test file. https://practical.li/spacemacs/spacemacs-basics/working-with-projects/projectile/#toggling-between-test-and-code-files

2025-10-21T16:05:10.678119Z

Ya I miss that as well. It sounds like there's no reliable equivalent sad 😢

gunnar 2025-10-21T18:42:35.597369Z

The functionality in IntelliJ is really good. You jump intuitively across buffers, and likewise if you hit undo and the next undo location is offscreen, then instead of undoing the change and jumping there, IntelliJ just jumps there so that you can witness what is about to be undone. I can of course just buckle down and create this functionality myself (it's emacs after all 😁), but I've just been hoping that "somebody else" would make this, haha

oyakushev 2025-09-08T07:15:12.142209Z

I use the following: • goto-last-change (with a binding of course) • https://github.com/emacsorphanage/git-gutter has git-gutter:next-hunk and git-gutter:prev-hunk to jump between regions in the buffer that have uncommited changes. Quite often, this is precisely what I need to navigate. • https://github.com/joodland/bm to set explicit bookmarks. I often forget about it, but after scrolling somewhere manually 20 times in a row I finally reach for its functionality.

Gent Krasniqi 2025-09-08T07:35:05.708979Z

I mostly just use M-. , M-, and C-M-, which I just confirmed to be the commands @lasse.olavi.maatta recommended, which I found out about in the elisp tutorial I think. They work very well with elisp and cider, not sure if M-. works with other stuff. (in fact I appreciate that with a mostly vanilla setup I can have almost the exact same workflow with elisp and clojure, since cider defines bindings for C-M-x and C-x C-e for eval and some other default stuff used with elisp)

gunnar 2025-09-08T07:59:00.030199Z

Thanks for the great info everbody! I'm also relying heavily on M-., M-, and C-M-, like mentioned here. But sometimes I get lost and have to navigate through the buffer list and then search to find the line again which can be a little bit frustrating. Didn't know about bm, I'll check that out!

hkjels 2025-09-08T08:00:56.379959Z

I've remapped M-. to embark-act. That means I have to use one extra key RET to go to definition, but it also means I can quickly also go to references with r or appropos with a and so forth.

gunnar 2025-09-08T08:01:18.689329Z

Nice!

Sam 2025-09-08T13:07:14.221309Z

I use this ALL THE TIME:

(defun pop-local-or-global-mark ()
  "Pop to local mark if it exists or to the global mark if it does not."
  (interactive)
  (if (mark t)
      (pop-to-mark-command)
      (pop-global-mark)))

Sam 2025-09-08T13:07:16.878359Z

With meow

gunnar 2025-09-08T13:44:24.328569Z

That's great! I'll use that :)