summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp
diff options
context:
space:
mode:
authorStephen Gildea <stepheng+emacs@gildea.com>2025-01-12 20:39:02 -0800
committerStephen Gildea <stepheng+emacs@gildea.com>2025-01-12 20:39:02 -0800
commite6591b549f35af1be31f5bf3547e1170b7604a99 (patch)
tree969e66d3edea44732376d40595d20d184695660b /lisp/emacs-lisp
parentc98d9e8bf58c75e3ed6c7d2f9c5e63fc17bf9cf7 (diff)
downloademacs-e6591b549f35af1be31f5bf3547e1170b7604a99.tar.gz
emacs-e6591b549f35af1be31f5bf3547e1170b7604a99.tar.bz2
emacs-e6591b549f35af1be31f5bf3547e1170b7604a99.zip
New symbol property 'definition-type' used by 'find-function'.
* lisp/emacs-lisp/find-func.el (find-function-search-for-symbol): Look for new property 'definition-type' on the symbol. * doc/lispref/symbols.texi (Standard Properties): Add 'Definition-type'. * doc/lispref/functions.texi (Defining Functions): * doc/lispref/tips.texi (Coding Conventions): * doc/misc/ert.texi (How to Write Tests): Add cross reference to new property 'definition-type'. * etc/NEWS: Announce new symbol property 'definition-type'. Thanks to Eli Zaretskii for reviewing this change.
Diffstat (limited to 'lisp/emacs-lisp')
-rw-r--r--lisp/emacs-lisp/find-func.el11
1 files changed, 8 insertions, 3 deletions
diff --git a/lisp/emacs-lisp/find-func.el b/lisp/emacs-lisp/find-func.el
index 0837b37023e..643b6aba2a6 100644
--- a/lisp/emacs-lisp/find-func.el
+++ b/lisp/emacs-lisp/find-func.el
@@ -400,9 +400,12 @@ See `find-library' for more details."
Visit the library in a buffer, and return a cons cell (BUFFER . POSITION),
or just (BUFFER . nil) if the definition can't be found in the file.
-If TYPE is nil, look for a function definition.
-Otherwise, TYPE specifies the kind of definition,
-and it is interpreted via `find-function-regexp-alist'.
+If TYPE is nil, look for a function definition,
+otherwise, TYPE specifies the kind of definition.
+If SYMBOL has a property `definition-type',
+the property value is used instead of TYPE.
+TYPE is interpreted via `find-function-regexp-alist'.
+
The search is done in the source for library LIBRARY."
(if (null library)
(error "Don't know where `%s' is defined" symbol))
@@ -410,6 +413,8 @@ The search is done in the source for library LIBRARY."
;; that defines something else.
(while (and (symbolp symbol) (get symbol 'definition-name))
(setq symbol (get symbol 'definition-name)))
+ (setq type (or (get symbol 'definition-type)
+ type))
(if (string-match "\\`src/\\(.*\\.\\(c\\|m\\)\\)\\'" library)
(find-function-C-source symbol (match-string 1 library) type)
(when (string-match "\\.el\\(c\\)\\'" library)