From: Mauro Aranda <maurooaranda@gmail.com>
To: 7779@debbugs.gnu.org
Cc: lennart.borgman@gmail.com
Subject: bug#7779: Miserable widget completion for type 'directory on w32
Date: Wed, 28 Aug 2019 12:47:50 -0300 [thread overview]
Message-ID: <CABczVwco5aW65gPgx-y7ZN7-whEHHgLiTziLPMS0p9D5=j+ZpQ@mail.gmail.com> (raw)
In-Reply-To: <AANLkTinGGTbp4ub5jchzDDew_uFEY_oPxhvGocjo-_2G@mail.gmail.com>
[-- Attachment #1.1: Type: text/plain, Size: 666 bytes --]
I can reproduce the bug in the latest master. On a Windows machine,
and starting with emacs -Q, I do:
M-x customize-option RET tutorial-directory
and try to complete with C-M-i inside the editable-field, with different
names,
and different cases.
It doesn't work, because the completion is made case sensitive, even though
read-file-name-completion-ignore-case is t.
Also, the completion is made not only for directory names,
but also for file names. This also happens on a GNU/Linux machine.
Since the 'file widget suffers from the first mentioned bug as well,
the attached patch tries to improve the completion for both of these
widgets.
Best regards,
Mauro.
[-- Attachment #1.2: Type: text/html, Size: 879 bytes --]
[-- Attachment #2: 0001-Improve-file-name-completion-in-file-and-directory-w.patch --]
[-- Type: text/x-patch, Size: 1686 bytes --]
From 24be0bc9760e16af80747b4bc06fd953e050be4f Mon Sep 17 00:00:00 2001
From: Mauro Aranda <maurooaranda@gmail.com>
Date: Wed, 28 Aug 2019 08:29:57 -0300
Subject: [PATCH] Improve file name completion in file and directory widgets
(Bug#7779)
* 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 | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/lisp/wid-edit.el b/lisp/wid-edit.el
index 1ddc461..ad65ca6 100644
--- a/lisp/wid-edit.el
+++ b/lisp/wid-edit.el
@@ -3083,7 +3083,9 @@ widget-regexp-validate
(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 @@ widget-file-prompt-value
(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
--
2.7.4
next prev parent reply other threads:[~2019-08-28 15:47 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-01-03 21:00 bug#7779: Miserable widget completion for type 'directory on w32 Lennart Borgman
2011-07-03 18:44 ` Juanma Barranquero
2011-07-03 18:48 ` Lennart Borgman
2011-07-03 18:52 ` Juanma Barranquero
2011-07-03 22:31 ` Lennart Borgman
2011-07-03 22:42 ` Juanma Barranquero
2011-07-03 22:56 ` Lennart Borgman
2011-07-03 23:04 ` Juanma Barranquero
2011-07-03 23:23 ` Lennart Borgman
2011-07-03 23:31 ` Juanma Barranquero
2011-07-04 1:35 ` Lennart Borgman
2011-07-04 2:59 ` Juanma Barranquero
2019-08-28 15:47 ` Mauro Aranda [this message]
2019-09-06 21:16 ` Noam Postavsky
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CABczVwco5aW65gPgx-y7ZN7-whEHHgLiTziLPMS0p9D5=j+ZpQ@mail.gmail.com' \
--to=maurooaranda@gmail.com \
--cc=7779@debbugs.gnu.org \
--cc=lennart.borgman@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.