'face 'completions-annotations)))))
libraries)))
+(defvar read-library-name-history nil
+ "Minibuffer history for `read-library-name'.")
+
;;;###autoload
(defun read-library-name (&optional prompt)
"Read and return a library name, defaulting to the one near point.
Optional argument PROMPT is the minibuffer prompt to use, when nil or
omitted it defaults to \"Library name\"."
(let* ((prompt (or prompt "Library name"))
- (files (read-library-name--find-files
- (or find-library-source-path load-path)
- (find-library-suffixes)))
+ (files (seq-filter
+ (lambda (library)
+ ;; Filter out spurious non-libraries.
+ (not (or (string= library ".dir-locals")
+ (string-suffix-p "-pkg" library))))
+ (read-library-name--find-files
+ (or find-library-source-path load-path)
+ (find-library-suffixes))))
(def (thing-at-point 'symbol))
(def (and (member def files) def)))
(completing-read (format-prompt prompt def)
,@(when completions-detailed
'((affixation-function
. read-library-name-affixation)))))
- nil t nil nil def)))
+ nil t nil 'read-library-name-history def)))
(defun read-library-name--find-files (dirs suffixes)
"Return a list of all files in DIRS that match SUFFIXES."
(symbol-help (styles . (basic shorthand substring)))
(multiple-choice (styles . (basic substring)) (sort-function . identity))
(calendar-month (sort-function . identity))
- (keybinding (sort-function . minibuffer-sort-alphabetically)))
+ (keybinding (sort-function . minibuffer-sort-alphabetically))
+ (library (sort-function . minibuffer-sort-alphabetically)))
"Default settings for specific completion categories.
Each entry has the shape (CATEGORY . ALIST) where ALIST is