emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 2e92f90: Save position in mark ring before jumping to definition


From: Lars Ingebrigtsen
Subject: master 2e92f90: Save position in mark ring before jumping to definition
Date: Fri, 1 Oct 2021 03:11:48 -0400 (EDT)

branch: master
commit 2e92f90a5d38f92f5d4a8a01e28e49f648ef07b4
Author: Ihor Radchenko <yantar92@gmail.com>
Commit: Lars Ingebrigtsen <larsi@gnus.org>

    Save position in mark ring before jumping to definition
    
    * lisp/help-mode.el (help-function-def--button-function): Current
    point is saved in the mark ring before jumping to definition.
---
 etc/NEWS          | 7 +++++++
 lisp/help-mode.el | 4 ++++
 2 files changed, 11 insertions(+)

diff --git a/etc/NEWS b/etc/NEWS
index d0e41ba..04b6908 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -30,6 +30,13 @@ applies, and please also update docstrings as needed.
 
 * Changes in Emacs 29.1
 
+** Help
+
+---
+*** Jumping to function/variable source now saves mark before moving point.
+Jumping to source from "*Help*" buffer moves the point when the source
+buffer is already open.  Now, the old point is pushed to mark ring.
+
 
 * Editing Changes in Emacs 29.1
 
diff --git a/lisp/help-mode.el b/lisp/help-mode.el
index 0b404fe..d61b1bd 100644
--- a/lisp/help-mode.el
+++ b/lisp/help-mode.el
@@ -273,6 +273,10 @@ The format is (FUNCTION ARGS...).")
             (when (or (< position (point-min))
                       (> position (point-max)))
               (widen))
+            ;; Save mark for the old location, unless the point is not
+            ;; actually going to move.
+            (unless (= (point) position)
+              (push-mark nil t))
             (goto-char position))
         (message "Unable to find location in file")))))
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]