aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEli Zaretskii2023-01-07 19:57:30 +0200
committerEli Zaretskii2023-01-07 19:57:30 +0200
commit0cb686ffb6bbc017d3b71acbf40ed3e5c1a32863 (patch)
tree101436bb61ce4ad76c042efbdcde3581a6c7c2ea
parent7f855b5297b2806fa508e73de98cb8cecc6e7d8d (diff)
downloademacs-0cb686ffb6bbc017d3b71acbf40ed3e5c1a32863.tar.gz
emacs-0cb686ffb6bbc017d3b71acbf40ed3e5c1a32863.zip
Document the 'definition-name' property.
* doc/lispref/symbols.texi (Standard Properties): Document 'definition-name'. * doc/lispref/functions.texi (Defining Functions): Describe how to use 'definition-name' when generating function definitions at run time. (Bug#60568)
-rw-r--r--doc/lispref/functions.texi14
-rw-r--r--doc/lispref/symbols.texi17
2 files changed, 31 insertions, 0 deletions
diff --git a/doc/lispref/functions.texi b/doc/lispref/functions.texi
index 3a8eddb93ea..f5572e447d3 100644
--- a/doc/lispref/functions.texi
+++ b/doc/lispref/functions.texi
@@ -685,6 +685,20 @@ Here are some examples:
685@end group 685@end group
686@end example 686@end example
687 687
688@cindex defining functions dynamically
689Most Emacs functions are part of the source code of Lisp programs, and
690are defined when the Emacs Lisp reader reads the program source before
691executing it. However, you can also define functions dynamically at
692run time, e.g., by generating @code{defun} calls when your program's
693code is executed. If you do this, be aware that Emacs's Help
694commands, such as @kbd{C-h f}, which present in the @file{*Help*}
695buffer a button to jump to the function's definition, might be unable
696to find the source code because generating a function dynamically
697usually looks very different from the usual static calls to
698@code{defun}. You can make the job of finding the code which
699generates such functions easier by using the @code{definition-name}
700property, @pxref{Standard Properties}.
701
688@cindex override existing functions 702@cindex override existing functions
689@cindex redefine existing functions 703@cindex redefine existing functions
690Be careful not to redefine existing functions unintentionally. 704Be careful not to redefine existing functions unintentionally.
diff --git a/doc/lispref/symbols.texi b/doc/lispref/symbols.texi
index 183367c0cda..5b53cbe310a 100644
--- a/doc/lispref/symbols.texi
+++ b/doc/lispref/symbols.texi
@@ -555,6 +555,23 @@ value, saved value, customized-but-unsaved value, and themed values.
555Do not set them directly; they are managed by @code{defcustom} and 555Do not set them directly; they are managed by @code{defcustom} and
556related functions. @xref{Variable Definitions}. 556related functions. @xref{Variable Definitions}.
557 557
558@item definition-name
559This property is used to find the definition of a symbol in the source
560code, when it might be hard to find the definition by textual search
561of the source file. For example, a @code{define-derived-mode}
562(@pxref{Derived Modes}) might define a mode-specific function or a
563variable implicitly; or your Lisp program might generate a run-time
564call to @code{defun} to define a function (@pxref{Defining
565Functions}). In these and similar cases, the @code{definition-name}
566property of the symbol should be another symbol whose definition can
567be found by textual search and whose code defines the original symbol.
568In the example with @code{define-derived-mode}, the value of this
569property of the functions and variables it defines should be the mode
570symbol. The Emacs Help commands such as @kbd{C-h f} (@pxref{Help,,,
571emacs, The GNU Emacs Manual}) use this property to show the definition
572of a symbol via a button in the @file{*Help*} buffer where the
573symbol's documentation is shown.
574
558@item disabled 575@item disabled
559If the value is non-@code{nil}, the named function is disabled as a 576If the value is non-@code{nil}, the named function is disabled as a
560command. @xref{Disabling Commands}. 577command. @xref{Disabling Commands}.