Wilfred / elisp-def

Find Emacs Lisp definitions
63 stars 6 forks source link

Push current cursor position to general Emacs mark ring before moving to definition. #14

Closed slamko closed 2 years ago

slamko commented 2 years ago

Currently elisp-def pushes current position to xref-marker-stack which is mostly used to implement goto definition behaviour. However in Emacs for functions that do not operate on symbols but do modify the cursor position (like goto-line, end-of-buffer) it is also a common practice to put the previous position to Emacs' buffer local mark-ring.

Actually this is exactly what lsp-mode does (in addition to pushing xref-marker-stack).

I believe that it would be great to maintain consistency and compatibility with lsp-mode which most Emacs users use. Also I believe that many users do rely on a mark-ring with it's great counsel-mark-ring extension to move around in the Emacs buffer. So this patch basically pushes current cursor position with Emacs' standard push-mark before moving to definition.

Wilfred commented 2 years ago

Makes sense, thanks!