unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Lars Ingebrigtsen <larsi@gnus.org>
To: Harald Hanche-Olsen <hanche@math.ntnu.no>
Cc: 14340@debbugs.gnu.org
Subject: bug#14340: 24.3.50; Case insensitivity with read-file-name
Date: Thu, 15 Jul 2021 08:23:21 +0200	[thread overview]
Message-ID: <87k0lsnlie.fsf@gnus.org> (raw)
In-Reply-To: <20130503.081837.977303885239716743.hanche@math.ntnu.no> (Harald Hanche-Olsen's message of "Fri, 03 May 2013 08:18:37 +0200 (CEST)")

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





  parent reply	other threads:[~2021-07-15  6:23 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-03  6:18 bug#14340: 24.3.50; Case insensitivity with read-file-name Harald Hanche-Olsen
     [not found] ` <handler.14340.B.136756196815016.ack@debbugs.gnu.org>
2013-05-03  7:49   ` bug#14340: Acknowledgement (24.3.50; Case insensitivity with read-file-name) Harald Hanche-Olsen
2013-05-03 12:23     ` bug#14340: 24.3.50; Case insensitivity with read-file-name Harald Hanche-Olsen
2021-07-15  6:23 ` Lars Ingebrigtsen [this message]
2021-07-30 11:53   ` Lars Ingebrigtsen

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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87k0lsnlie.fsf@gnus.org \
    --to=larsi@gnus.org \
    --cc=14340@debbugs.gnu.org \
    --cc=hanche@math.ntnu.no \
    /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 public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).