unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#22583: 25.1.50; find-function-search-for-symbol don't call find-function-after-hook
@ 2016-02-07 15:18 Tino Calancha
  2016-02-08  5:01 ` Dmitry Gutov
  2016-02-18  0:52 ` bug#22583: 25.1.50; find-library " Tino Calancha
  0 siblings, 2 replies; 10+ messages in thread
From: Tino Calancha @ 2016-02-07 15:18 UTC (permalink / raw)
  To: 22583

[-- Attachment #1: Type: text/plain, Size: 672 bytes --]


Hi emacs,

when calling find-function or find-variable
find-function-after-hook is run.
In the ther hand, find-function-search-for-symbol
don't run this hook.

For example,
I set find-function-after-hook to always visit source code
in a read-only buffer. This work for find-function/variable.

But sometimes, you call describe-function/describe-variable,
and, after reading the doc. string you decide to take a look
in the implementation. In that cases the buffer may not be
in read-only mode because find-function-after-hook is not called.


In GNU Emacs 25.1.50.1 (x86_64-pc-linux-gnu, GTK+ Version 2.24.29)
Repository revision: 90c647b97f0e62ca8bc2fc1d27f0170136277fb7

[-- Attachment #2: Type: text/plain, Size: 1207 bytes --]

diff --git a/find-func.el b/find-func.el
index 0575ce4..e05f75c 100644
--- a/find-func.el
+++ b/find-func.el
@@ -302,7 +302,10 @@ The search is done in the source for library LIBRARY."
   (while (and (symbolp symbol) (get symbol 'definition-name))
     (setq symbol (get symbol 'definition-name)))
   (if (string-match "\\`src/\\(.*\\.\\(c\\|m\\)\\)\\'" library)
-      (find-function-C-source symbol (match-string 1 library) type)
+      (let* ((buf-pos (find-function-C-source symbol (match-string 1 library) type))
+             (buf     (car buf-pos)))
+        (when buf (with-current-buffer buf
+                    (run-hooks 'find-function-after-hook))) buf-pos)
     (when (string-match "\\.el\\(c\\)\\'" library)
       (setq library (substring library 0 (match-beginning 1))))
     ;; Strip extension from .emacs.el to make sure symbol is searched in
@@ -340,6 +343,7 @@ The search is done in the source for library LIBRARY."
                                "\\_>")
                        nil t)))
 		(progn
+                  (run-hooks 'find-function-after-hook)
 		  (beginning-of-line)
 		  (cons (current-buffer) (point)))
 	      (cons (current-buffer) nil))))))))

^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2016-04-25 17:27 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-07 15:18 bug#22583: 25.1.50; find-function-search-for-symbol don't call find-function-after-hook Tino Calancha
2016-02-08  5:01 ` Dmitry Gutov
2016-02-08 12:50   ` Tino Calancha
2016-02-18  0:52 ` bug#22583: 25.1.50; find-library " Tino Calancha
2016-02-21 23:27   ` Dmitry Gutov
2016-02-22  0:00     ` John Wiegley
2016-02-22  0:04       ` Dmitry Gutov
2016-02-22 17:01         ` John Wiegley
2016-02-22 17:19     ` Tino Calancha
2016-04-25 17:27       ` Lars Magne Ingebrigtsen

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).