]> git.eshelyaron.com Git - emacs.git/commitdiff
Improve file name completion in file and directory widgets (Bug#7779)
authorMauro Aranda <maurooaranda@gmail.com>
Wed, 28 Aug 2019 11:29:57 +0000 (08:29 -0300)
committerNoam Postavsky <npostavs@gmail.com>
Fri, 6 Sep 2019 21:02:08 +0000 (17:02 -0400)
* lisp/wid-edit.el (widget 'file, widget 'directory): Respect the option
read-file-name-completion-ignore-case.
(widget 'directory): Filter the file names, to only perform directory name
completion.

lisp/wid-edit.el

index fdc16299c88203ceb4e045549c3f31b12aef00b0..9bc7a076eeccf11489721ddd85ded88e950a2aba 100644 (file)
@@ -3083,7 +3083,9 @@ as the value."
 (define-widget 'file 'string
   "A file widget.
 It reads a file name from an editable text field."
-  :completions #'completion-file-name-table
+  :completions (completion-table-case-fold
+                #'completion-file-name-table
+                (not read-file-name-completion-ignore-case))
   :prompt-value 'widget-file-prompt-value
   :format "%{%t%}: %v"
   ;; Doesn't work well with terminating newline.
@@ -3118,6 +3120,11 @@ It reads a file name from an editable text field."
 (define-widget 'directory 'file
   "A directory widget.
 It reads a directory name from an editable text field."
+  :completions (apply-partially #'completion-table-with-predicate
+                                (completion-table-case-fold
+                                 #'completion-file-name-table
+                                 (not read-file-name-completion-ignore-case))
+                                #'directory-name-p 'strict)
   :tag "Directory")
 
 (defvar widget-symbol-prompt-value-history nil