summaryrefslogtreecommitdiff
path: root/lisp/minibuffer.el
diff options
context:
space:
mode:
authorStephen Leake <stephen_leake@stephe-leake.org>2019-04-25 16:29:36 -0700
committerStephen Leake <stephen_leake@stephe-leake.org>2019-04-25 16:29:36 -0700
commitd2a5283a065fd03d6dc606cc7ec29822e544dffb (patch)
tree275e0ea3a813d77fd9319832b3b87d66b14ca6d4 /lisp/minibuffer.el
parent1486eadf7c9469f873fcd04beafd03f21564d580 (diff)
downloademacs-d2a5283a065fd03d6dc606cc7ec29822e544dffb.tar.gz
Add new file completion tables, change project.el to allow using themscratch/project-uniquify-files
* lisp/file-complete-root-relative.el: New file. * lisp/uniquify-files.el: New file. * test/lisp/progmodes/uniquify-files-resources/: New directory containing files for testing uniquify-files. * test/lisp/progmodes/uniquify-files-test.el: New file; test uniquify-files. * lisp/files.el (path-files): New function; useful with new completion tables. * lisp/progmodes/project.el (project-file-completion-table): Use file-complete-root-relative completion table. (project-find-file): Add optional FILENAME parameter. (project--completing-read-strict): Rewrite to just use the given completion table; extracting the common directory is now done by file-complete-root-relative. This also allows using the new uniquify-files completion table. * lisp/minibuffer.el (completion-category-defaults): Add uniquify-file. (completing-read-default): Add final step to call completion table with 'alist action if supported.
Diffstat (limited to 'lisp/minibuffer.el')
-rw-r--r--lisp/minibuffer.el8
1 files changed, 8 insertions, 0 deletions
diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el
index dbd24dfa0a3..969f82aa0d5 100644
--- a/lisp/minibuffer.el
+++ b/lisp/minibuffer.el
@@ -846,6 +846,7 @@ styles for specific categories, such as files, buffers, etc."
(defvar completion-category-defaults
'((buffer (styles . (basic substring)))
(unicode-name (styles . (basic substring)))
+ (uniquify-file (styles . (uniquify-file)))
(project-file (styles . (substring)))
(info-menu (styles . (basic substring))))
"Default settings for specific completion categories.
@@ -3582,6 +3583,13 @@ See `completing-read' for the meaning of the arguments."
nil hist def inherit-input-method)))
(when (and (equal result "") def)
(setq result (if (consp def) (car def) def)))
+
+ (when (completion-metadata-get (completion-metadata "" collection nil) 'alist)
+ (setq result (funcall collection result nil 'alist)))
+
+ ;; If collection is itself an alist, we could also fetch that
+ ;; result here, but that would not be backward compatible.
+
result))
;; Miscellaneous