bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#14340: 24.3.50; Case insensitivity with read-file-name


From: Lars Ingebrigtsen
Subject: bug#14340: 24.3.50; Case insensitivity with read-file-name
Date: Thu, 15 Jul 2021 08:23:21 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

Harald Hanche-Olsen <hanche@math.ntnu.no> writes:

>>From emacs -Q, evaluate the following in the *scratch* buffer,
> one by one:
>
> (setq read-file-name-completion-ignore-case t)
> (read-file-name "file: ")
> ;;; confirm that filename completion is case insensitive
> (setq-local completion-ignore-case t)
> (read-file-name "file: ")
> ;;; notice that filename completion is case sensitive,
> ;;; contrary to expectation

The following patch fixes the test case (as Harald said in a later
email -- the problem is that the let binding of completion-ignore-case
happens in the wrong buffer (when that's a buffer-local variable)).

It fixes the test case, but I'm not sure whether this would have other
unintended side effects?  Anybody?

diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el
index 813ce14c59..566e1998bc 100644
--- a/lisp/minibuffer.el
+++ b/lisp/minibuffer.el
@@ -3078,7 +3078,7 @@ read-file-name-default
                     (minibuffer-maybe-quote-filename dir)))
                  (initial (cons (minibuffer-maybe-quote-filename initial) 
0)))))
 
-    (let ((completion-ignore-case read-file-name-completion-ignore-case)
+    (let ((ignore-case read-file-name-completion-ignore-case)
           (minibuffer-completing-file-name t)
           (pred (or predicate 'file-exists-p))
           (add-to-history nil))
@@ -3106,6 +3106,7 @@ read-file-name-default
                                            minibuffer-default))
                             (setq minibuffer-default
                                   (cdr-safe minibuffer-default)))
+                          (setq-local completion-ignore-case ignore-case)
                           ;; On the first request on `M-n' fill
                           ;; `minibuffer-default' with a list of defaults
                           ;; relevant for file-name reading.


-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





reply via email to

[Prev in Thread] Current Thread [Next in Thread]