diff options
author | Lars Ingebrigtsen <larsi@gnus.org> | 2019-08-27 09:46:28 +0200 |
---|---|---|
committer | Lars Ingebrigtsen <larsi@gnus.org> | 2019-08-27 09:46:28 +0200 |
commit | ed44217d3245ddc8f2cf75c9499d5bb37848cfd7 (patch) | |
tree | d20b65cbb894a4107defee41a26b6a8538e13a00 /lisp/emacs-lisp | |
parent | d9e4d52a10a198b06333eb6523561cccc1a078c1 (diff) | |
download | emacs-ed44217d3245ddc8f2cf75c9499d5bb37848cfd7.tar.gz emacs-ed44217d3245ddc8f2cf75c9499d5bb37848cfd7.tar.bz2 emacs-ed44217d3245ddc8f2cf75c9499d5bb37848cfd7.zip |
Fix completion in `read-library-name'
* lisp/emacs-lisp/find-func.el (read-library-name): Only list
.el/.el.gz files when completing (bug#36945).
Diffstat (limited to 'lisp/emacs-lisp')
-rw-r--r-- | lisp/emacs-lisp/find-func.el | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/lisp/emacs-lisp/find-func.el b/lisp/emacs-lisp/find-func.el index 9fc7e4a797d..142c99edd43 100644 --- a/lisp/emacs-lisp/find-func.el +++ b/lisp/emacs-lisp/find-func.el @@ -285,10 +285,19 @@ 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* ((dirs (or find-function-source-path load-path)) - (suffixes (find-library-suffixes)) - (table (apply-partially 'locate-file-completion-table - dirs suffixes)) + (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) + when (file-readable-p dir) + append (mapcar + (lambda (file) + (replace-regexp-in-string suffix-regexp + "" file)) + (directory-files dir nil + suffix-regexp)))) (def (if (eq (function-called-at-point) 'require) ;; `function-called-at-point' may return 'require ;; with `point' anywhere on this line. So wrap the |