aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Ingebrigtsen2021-09-14 13:44:15 +0200
committerLars Ingebrigtsen2021-09-14 13:44:20 +0200
commit159dbd5eb211e36d98e200781f2eae93f0973aeb (patch)
tree3d752adbdee89eb4bee99a838450dac7eb2b8f56
parent56254fb98c3369392dc2bd4383b7ff2ea24f2dc4 (diff)
downloademacs-159dbd5eb211e36d98e200781f2eae93f0973aeb.tar.gz
emacs-159dbd5eb211e36d98e200781f2eae93f0973aeb.zip
Make `find-function-source-path' into obsolete alias
* lisp/finder.el (finder-commentary): Adjust usage. * lisp/emacs-lisp/find-func.el (find-function-source-path): Made into obsolete alias (bug#50508). (find-library-source-path): New name. (find-library-name, find-library, find-function-noselect) (find-variable-noselect, find-definition-noselect): Adjust usage and update doc strings.
-rw-r--r--etc/NEWS13
-rw-r--r--lisp/emacs-lisp/find-func.el50
-rw-r--r--lisp/finder.el2
3 files changed, 34 insertions, 31 deletions
diff --git a/etc/NEWS b/etc/NEWS
index 279bb17bbb5..5809716868a 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -3384,6 +3384,19 @@ In Emacs 24.3, the variable 'dbus-event-error-hooks' was renamed to
3384The old names, which were kept as obsolete aliases of the new names, 3384The old names, which were kept as obsolete aliases of the new names,
3385have now been removed. 3385have now been removed.
3386 3386
3387---
3388** 'find-function-source-path' renamed and re-documented.
3389The 'find-function' command (and various related commands) were
3390documented to respect 'find-function-source-path', and to search for
3391objects in files specified by that variable. It's unclear when this
3392actually changed, but at some point (perhaps decades ago) these
3393commands started using 'load-history' to determine where symbols had
3394been defined (which is much faster). The doc strings of all the
3395affected function has been updated. 'find-function-source-path' was
3396still being used by 'find-library' and related commands, so the
3397variable has been renamed to 'find-library-source-path', and
3398'find-function-source-path' is now an obsolete variable alias.
3399
3387 3400
3388* Lisp Changes in Emacs 28.1 3401* Lisp Changes in Emacs 28.1
3389 3402
diff --git a/lisp/emacs-lisp/find-func.el b/lisp/emacs-lisp/find-func.el
index 4bbcf453569..303039d6534 100644
--- a/lisp/emacs-lisp/find-func.el
+++ b/lisp/emacs-lisp/find-func.el
@@ -145,13 +145,16 @@ in which case the function is called with one argument (the object
145we're looking for) and it should search for it.") 145we're looking for) and it should search for it.")
146(put 'find-function-regexp-alist 'risky-local-variable t) 146(put 'find-function-regexp-alist 'risky-local-variable t)
147 147
148(defcustom find-function-source-path nil 148(define-obsolete-variable-alias 'find-function-source-path
149 "The default list of directories where `find-function' searches. 149 'find-library-source-path "28.1")
150(defcustom find-library-source-path nil
151 "The default list of directories where `find-library' searches.
150 152
151If this variable is nil then `find-function' searches `load-path' by 153If this variable is nil then `find-library' searches `load-path' by
152default." 154default."
153 :type '(repeat directory) 155 :type '(repeat directory)
154 :group 'find-function) 156 :group 'find-function
157 :version "28.1")
155 158
156(defcustom find-function-recenter-line 1 159(defcustom find-function-recenter-line 1
157 "The window line-number from which to start displaying a symbol definition. 160 "The window line-number from which to start displaying a symbol definition.
@@ -200,20 +203,20 @@ LIBRARY should be a string (the name of the library)."
200 (setq library (gethash (file-name-nondirectory library) comp-eln-to-el-h)))) 203 (setq library (gethash (file-name-nondirectory library) comp-eln-to-el-h))))
201 (or 204 (or
202 (locate-file library 205 (locate-file library
203 (or find-function-source-path load-path) 206 (or find-library-source-path load-path)
204 (find-library-suffixes)) 207 (find-library-suffixes))
205 (locate-file library 208 (locate-file library
206 (or find-function-source-path load-path) 209 (or find-library-source-path load-path)
207 load-file-rep-suffixes) 210 load-file-rep-suffixes)
208 (when (file-name-absolute-p library) 211 (when (file-name-absolute-p library)
209 (let ((rel (find-library--load-name library))) 212 (let ((rel (find-library--load-name library)))
210 (when rel 213 (when rel
211 (or 214 (or
212 (locate-file rel 215 (locate-file rel
213 (or find-function-source-path load-path) 216 (or find-library-source-path load-path)
214 (find-library-suffixes)) 217 (find-library-suffixes))
215 (locate-file rel 218 (locate-file rel
216 (or find-function-source-path load-path) 219 (or find-library-source-path load-path)
217 load-file-rep-suffixes))))) 220 load-file-rep-suffixes)))))
218 (find-library--from-load-history library) 221 (find-library--from-load-history library)
219 (signal 'file-error (list "Can't find library" library)))) 222 (signal 'file-error (list "Can't find library" library))))
@@ -286,7 +289,10 @@ TYPE should be nil to find a function, or `defvar' to find a variable."
286(defun find-library (library) 289(defun find-library (library)
287 "Find the Emacs Lisp source of LIBRARY. 290 "Find the Emacs Lisp source of LIBRARY.
288 291
289Interactively, prompt for LIBRARY using the one at or near point." 292Interactively, prompt for LIBRARY using the one at or near point.
293
294This function searches `find-library-source-path' if non-nil, and
295`load-path' otherwise."
290 (interactive (list (read-library-name))) 296 (interactive (list (read-library-name)))
291 (prog1 297 (prog1
292 (switch-to-buffer (find-file-noselect (find-library-name library))) 298 (switch-to-buffer (find-file-noselect (find-library-name library)))
@@ -297,9 +303,9 @@ Interactively, prompt for LIBRARY using the one at or near point."
297 "Read and return a library name, defaulting to the one near point. 303 "Read and return a library name, defaulting to the one near point.
298 304
299A library name is the filename of an Emacs Lisp library located 305A library name is the filename of an Emacs Lisp library located
300in a directory under `load-path' (or `find-function-source-path', 306in a directory under `load-path' (or `find-library-source-path',
301if non-nil)." 307if non-nil)."
302 (let* ((dirs (or find-function-source-path load-path)) 308 (let* ((dirs (or find-library-source-path load-path))
303 (suffixes (find-library-suffixes)) 309 (suffixes (find-library-suffixes))
304 (table (apply-partially 'locate-file-completion-table 310 (table (apply-partially 'locate-file-completion-table
305 dirs suffixes)) 311 dirs suffixes))
@@ -521,11 +527,7 @@ the buffer, returns (BUFFER).
521 527
522If FUNCTION is a built-in function, this function normally 528If FUNCTION is a built-in function, this function normally
523attempts to find it in the Emacs C sources; however, if LISP-ONLY 529attempts to find it in the Emacs C sources; however, if LISP-ONLY
524is non-nil, signal an error instead. 530is non-nil, signal an error instead."
525
526If the file where FUNCTION is defined is not known, then it is
527searched for in `find-function-source-path' if non-nil, otherwise
528in `load-path'."
529 (if (not function) 531 (if (not function)
530 (error "You didn't specify a function")) 532 (error "You didn't specify a function"))
531 (let ((func-lib (find-function-library function lisp-only t))) 533 (let ((func-lib (find-function-library function lisp-only t)))
@@ -589,8 +591,6 @@ near point (selected by `function-called-at-point') in a buffer and
589places point before the definition. 591places point before the definition.
590Set mark before moving, if the buffer already existed. 592Set mark before moving, if the buffer already existed.
591 593
592The library where FUNCTION is defined is searched for in
593`find-function-source-path', if non-nil, otherwise in `load-path'.
594See also `find-function-recenter-line' and `find-function-after-hook'." 594See also `find-function-recenter-line' and `find-function-after-hook'."
595 (interactive (find-function-read)) 595 (interactive (find-function-read))
596 (find-function-do-it function nil 'switch-to-buffer)) 596 (find-function-do-it function nil 'switch-to-buffer))
@@ -617,10 +617,7 @@ See `find-function' for more details."
617 617
618Finds the library containing the definition of VARIABLE in a buffer and 618Finds the library containing the definition of VARIABLE in a buffer and
619the point of the definition. The buffer is not selected. 619the point of the definition. The buffer is not selected.
620If the variable's definition can't be found in the buffer, return (BUFFER). 620If the variable's definition can't be found in the buffer, return (BUFFER)."
621
622The library where VARIABLE is defined is searched for in FILE or
623`find-function-source-path', if non-nil, otherwise in `load-path'."
624 (if (not variable) 621 (if (not variable)
625 (error "You didn't specify a variable") 622 (error "You didn't specify a variable")
626 (let ((library (or file 623 (let ((library (or file
@@ -638,8 +635,6 @@ places point before the definition.
638 635
639Set mark before moving, if the buffer already existed. 636Set mark before moving, if the buffer already existed.
640 637
641The library where VARIABLE is defined is searched for in
642`find-function-source-path', if non-nil, otherwise in `load-path'.
643See also `find-function-recenter-line' and `find-function-after-hook'." 638See also `find-function-recenter-line' and `find-function-after-hook'."
644 (interactive (find-function-read 'defvar)) 639 (interactive (find-function-read 'defvar))
645 (find-function-do-it variable 'defvar 'switch-to-buffer)) 640 (find-function-do-it variable 'defvar 'switch-to-buffer))
@@ -666,10 +661,7 @@ See `find-variable' for more details."
666If the definition can't be found in the buffer, return (BUFFER). 661If the definition can't be found in the buffer, return (BUFFER).
667TYPE says what type of definition: nil for a function, `defvar' for a 662TYPE says what type of definition: nil for a function, `defvar' for a
668variable, `defface' for a face. This function does not switch to the 663variable, `defface' for a face. This function does not switch to the
669buffer nor display it. 664buffer nor display it."
670
671The library where SYMBOL is defined is searched for in FILE or
672`find-function-source-path', if non-nil, otherwise in `load-path'."
673 (cond 665 (cond
674 ((not symbol) 666 ((not symbol)
675 (error "You didn't specify a symbol")) 667 (error "You didn't specify a symbol"))
@@ -693,8 +685,6 @@ places point before the definition.
693 685
694Set mark before moving, if the buffer already existed. 686Set mark before moving, if the buffer already existed.
695 687
696The library where FACE is defined is searched for in
697`find-function-source-path', if non-nil, otherwise in `load-path'.
698See also `find-function-recenter-line' and `find-function-after-hook'." 688See also `find-function-recenter-line' and `find-function-after-hook'."
699 (interactive (find-function-read 'defface)) 689 (interactive (find-function-read 'defface))
700 (find-function-do-it face 'defface 'switch-to-buffer)) 690 (find-function-do-it face 'defface 'switch-to-buffer))
diff --git a/lisp/finder.el b/lisp/finder.el
index 555506db22f..c2b9a6d0ef9 100644
--- a/lisp/finder.el
+++ b/lisp/finder.el
@@ -379,7 +379,7 @@ FILE should be in a form suitable for passing to `locate-library'."
379 (list 379 (list
380 (completing-read "Library name: " 380 (completing-read "Library name: "
381 (apply-partially 'locate-file-completion-table 381 (apply-partially 'locate-file-completion-table
382 (or find-function-source-path load-path) 382 (or find-library-source-path load-path)
383 (find-library-suffixes))))) 383 (find-library-suffixes)))))
384 (let ((str (lm-commentary (find-library-name file)))) 384 (let ((str (lm-commentary (find-library-name file))))
385 (or str (error "Can't find any Commentary section")) 385 (or str (error "Can't find any Commentary section"))