unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#14340: 24.3.50; Case insensitivity with read-file-name
@ 2013-05-03  6:18 Harald Hanche-Olsen
       [not found] ` <handler.14340.B.136756196815016.ack@debbugs.gnu.org>
  2021-07-15  6:23 ` Lars Ingebrigtsen
  0 siblings, 2 replies; 5+ messages in thread
From: Harald Hanche-Olsen @ 2013-05-03  6:18 UTC (permalink / raw)
  To: 14340

This concerns what seems like wrong handling of a buffer local
variable which is let bound. To reproduce:

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

My configuration is below (emacs compiled from trunk on the day
indicated, abot three weeks ago); however, note that on the
emacs-devel list, Michael Heerdegen reports that he could reproduce
this on GNU/Linux.

In GNU Emacs 24.3.50.1 (x86_64-apple-darwin12.3.0, NS apple-appkit-1187.37)
 of 2013-04-11 on airy
Windowing system distributor `Apple', version 10.3.1187
Configured using:
 `configure --with-ns'

Important settings:
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix
  default enable-multibyte-characters: t

- Harald





^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#14340: Acknowledgement (24.3.50; Case insensitivity with read-file-name)
       [not found] ` <handler.14340.B.136756196815016.ack@debbugs.gnu.org>
@ 2013-05-03  7:49   ` Harald Hanche-Olsen
  2013-05-03 12:23     ` bug#14340: 24.3.50; Case insensitivity with read-file-name Harald Hanche-Olsen
  0 siblings, 1 reply; 5+ messages in thread
From: Harald Hanche-Olsen @ 2013-05-03  7:49 UTC (permalink / raw)
  To: 14340

Upon further reflection (in the bath), I think I understand the nature
of the bug, if not its resolution:

read-file-name-default let binds completion-ignore-case to the value of
read-file-name-completion-ignore-case before doing a pile of setup
work and calling completing-read.

When completion-ignore-case is buffer local, let overrides the buffer
local binding and not the global binding. But because completing-read
evaluates the variable in the minibuffer, it gets the global value
instead, i.e., nil.

(I may be wrong about some details in this, but I but this is the gist
of the problem.)

- Harald





^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#14340: 24.3.50; Case insensitivity with read-file-name
  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     ` Harald Hanche-Olsen
  0 siblings, 0 replies; 5+ messages in thread
From: Harald Hanche-Olsen @ 2013-05-03 12:23 UTC (permalink / raw)
  To: 14340

I had already forgotten(!) about a similar bug I reported about half a
year ago, namely #12615: It was a similar issue with completion of
unicode names in insert-char.

There is quite a bit of discussion about the general problem on that
thread. The issue seems to be both thorny and pervasive.

- Harald





^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#14340: 24.3.50; Case insensitivity with read-file-name
  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>
@ 2021-07-15  6:23 ` Lars Ingebrigtsen
  2021-07-30 11:53   ` Lars Ingebrigtsen
  1 sibling, 1 reply; 5+ messages in thread
From: Lars Ingebrigtsen @ 2021-07-15  6:23 UTC (permalink / raw)
  To: Harald Hanche-Olsen; +Cc: 14340

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





^ permalink raw reply related	[flat|nested] 5+ messages in thread

* bug#14340: 24.3.50; Case insensitivity with read-file-name
  2021-07-15  6:23 ` Lars Ingebrigtsen
@ 2021-07-30 11:53   ` Lars Ingebrigtsen
  0 siblings, 0 replies; 5+ messages in thread
From: Lars Ingebrigtsen @ 2021-07-30 11:53 UTC (permalink / raw)
  To: Harald Hanche-Olsen; +Cc: 14340

Lars Ingebrigtsen <larsi@gnus.org> writes:

> 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?

There were no comments in two weeks, so I'm now pushing the change.  (It
doesn't lead to any test regressions, at least.)

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





^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-07-30 11:53 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
2021-07-30 11:53   ` Lars Ingebrigtsen

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).