emacs-devel
[Top][All Lists]
Advanced

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

Re: Patch proposal: display symbol source code in help buffers


From: Ihor Radchenko
Subject: Re: Patch proposal: display symbol source code in help buffers
Date: Tue, 21 Sep 2021 14:59:05 +0800

Lars Ingebrigtsen <larsi@gnus.org> writes:

> Ihor Radchenko <yantar92@gmail.com> writes:
>
>> That would make sense. Yet, even without narrowing, I personally do not
>> like that the point moves from the defun I am working on to other
>> function definition.
>
> Yes, that is pretty annoying.  Perhaps
> `help-function-def--button-function' should push-mark before going to
> the position?  Then `C-x C-x' would bring you back to where you were...

I like this idea. Maybe we can simply change the default value of
find-function-after-hook like in the attached patch?

Best,
Ihor

>From 31f841b1e3921f7b2039656ed8f409b3b715741f Mon Sep 17 00:00:00 2001
Message-Id: 
<31f841b1e3921f7b2039656ed8f409b3b715741f.1632207397.git.yantar92@gmail.com>
From: Ihor Radchenko <yantar92@gmail.com>
Date: Tue, 21 Sep 2021 14:50:52 +0800
Subject: [PATCH] Save position in mark ring before jumping to definition

* lisp/emacs-lisp/find-func.el (find-function-after-hook): `push-mark'
is added to default value of the hook.

Following up:
https://lists.gnu.org/archive/html/emacs-devel/2021-09/msg01561.html
---
 etc/NEWS                     | 3 +++
 lisp/emacs-lisp/find-func.el | 2 +-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/etc/NEWS b/etc/NEWS
index 2bdcb6434b..2132e8babc 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -648,7 +648,10 @@ clicking the "X" icon in the tool bar.
 
 ---
 *** 'g' ('revert-buffer') in 'help-mode' no longer requires confirmation.
+*** 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.
 
+---
 ** File Locks
 
 +++
diff --git a/lisp/emacs-lisp/find-func.el b/lisp/emacs-lisp/find-func.el
index 303039d653..b984fb3870 100644
--- a/lisp/emacs-lisp/find-func.el
+++ b/lisp/emacs-lisp/find-func.el
@@ -165,7 +165,7 @@ find-function-recenter-line
   :group 'find-function
   :version "20.3")
 
-(defcustom find-function-after-hook nil
+(defcustom find-function-after-hook '(push-mark)
   "Hook run after finding symbol definition.
 
 See the functions `find-function' and `find-variable'."
-- 
2.32.0


reply via email to

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