1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-24 14:30:43 -08:00

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.
This commit is contained in:
Stephen Gildea 2025-01-12 20:39:02 -08:00
parent c98d9e8bf5
commit e6591b549f
6 changed files with 90 additions and 15 deletions

View file

@ -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)