Subject: Re: bug#22583: 25.1.50; find-library don't call find-function-after-hook

From: Tino Calancha <[email-masked]>
Date: Tue, 23 Feb 2016 02:19:05 +0900 (JST)

> Tino, could you resend these as one patch, using 'git format-patch' as 
> described in CONTRIBUTE, with an appropriate commit message (which means 
> using ChangeLog-style description, as also described in CONTRIBUTE).
Attached the requested patch.

From de28333e8797c5693876d8321c7c9f3255a13965 Mon Sep 17 00:00:00 2001
From: Tino Calancha <[email-masked]>
Date: Tue, 23 Feb 2016 01:52:00 +0900
Subject: [PATCH] ; Run find-function-after-hook after find a symbol

Run the hook when visiting the source code with find-library,
 describe-variable and describe-function (Bug#22583).
* lisp/emacs-lisp/find-func.el (find-library):
* lisp/help-mode.el (help-function-def, help-variable-def):
Run the hook inside the help-function of the buttons.
---
 lisp/emacs-lisp/find-func.el | 6 +++++-
 lisp/help-mode.el            | 2 ++
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/lisp/emacs-lisp/find-func.el b/lisp/emacs-lisp/find-func.el
index 0575ce4..b04a9d2 100644
--- a/lisp/emacs-lisp/find-func.el
+++ b/lisp/emacs-lisp/find-func.el
@@ -283,7 +283,11 @@ find-library
 			 "Library name: ")
 		       table nil nil nil nil def))))
   (let ((buf (find-file-noselect (find-library-name library))))
-    (condition-case nil (switch-to-buffer buf) (error (pop-to-buffer buf)))))
+    (condition-case nil
+        (prog1
+            (switch-to-buffer buf)
+          (run-hooks 'find-function-after-hook))
+      (error (pop-to-buffer buf)))))
 
 ;;;###autoload
 (defun find-function-search-for-symbol (symbol type library)
diff --git a/lisp/help-mode.el b/lisp/help-mode.el
index e0f3351..f66fbb7 100644
--- a/lisp/help-mode.el
+++ b/lisp/help-mode.el
@@ -202,6 +202,7 @@ 'help-function-def
 		   (let ((location
 			  (find-function-search-for-symbol fun type file)))
 		     (pop-to-buffer (car location))
+			 (run-hooks 'find-function-after-hook)
 		     (if (cdr location)
 			 (goto-char (cdr location))
 		       (message "Unable to find location in file"))))
@@ -231,6 +232,7 @@ 'help-variable-def
 		     (setq file (help-C-file-name var 'var)))
 		   (let ((location (find-variable-noselect var file)))
 		     (pop-to-buffer (car location))
+		     (run-hooks 'find-function-after-hook)
 		     (if (cdr location)
 		       (goto-char (cdr location))
 		       (message "Unable to find location in file"))))
-- 
2.7.0