summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp/find-func.el
diff options
context:
space:
mode:
authorLars Ingebrigtsen <larsi@gnus.org>2020-09-14 13:26:17 +0200
committerLars Ingebrigtsen <larsi@gnus.org>2020-09-14 13:26:17 +0200
commit7629aa74091d43370da751d86b0584ba3516ea75 (patch)
tree6b825417437e820ee39b234610c82af4c33098c9 /lisp/emacs-lisp/find-func.el
parent7cc161433832e6a518701d2b47fef7b298dc4a0a (diff)
downloademacs-7629aa74091d43370da751d86b0584ba3516ea75.tar.gz
emacs-7629aa74091d43370da751d86b0584ba3516ea75.tar.bz2
emacs-7629aa74091d43370da751d86b0584ba3516ea75.zip
Revert "Fix completion in `read-library-name'"
This reverts commit ed44217d3245ddc8f2cf75c9499d5bb37848cfd7. This commit broke the use case of `M-x load-library RET o/or TAB' to expand to org/org.
Diffstat (limited to 'lisp/emacs-lisp/find-func.el')
-rw-r--r--lisp/emacs-lisp/find-func.el18
1 files changed, 4 insertions, 14 deletions
diff --git a/lisp/emacs-lisp/find-func.el b/lisp/emacs-lisp/find-func.el
index 9e252d8c529..f3f3944a7f8 100644
--- a/lisp/emacs-lisp/find-func.el
+++ b/lisp/emacs-lisp/find-func.el
@@ -286,20 +286,10 @@ Interactively, prompt for LIBRARY using the one at or near point."
A library name is the filename of an Emacs Lisp library located
in a directory under `load-path' (or `find-function-source-path',
if non-nil)."
- (let* ((suffix-regexp (mapconcat
- (lambda (suffix)
- (concat (regexp-quote suffix) "\\'"))
- (find-library-suffixes)
- "\\|"))
- (table (cl-loop for dir in (or find-function-source-path load-path)
- for dir-or-default = (or dir default-directory)
- when (file-readable-p dir-or-default)
- append (mapcar
- (lambda (file)
- (replace-regexp-in-string suffix-regexp
- "" file))
- (directory-files dir-or-default nil
- suffix-regexp))))
+ (let* ((dirs (or find-function-source-path load-path))
+ (suffixes (find-library-suffixes))
+ (table (apply-partially 'locate-file-completion-table
+ dirs suffixes))
(def (if (eq (function-called-at-point) 'require)
;; `function-called-at-point' may return 'require
;; with `point' anywhere on this line. So wrap the