GNU bug report logs -
#78323
Regression in case-insensitive filename completion
Previous Next
To reply to this bug, email your comments to 78323 AT debbugs.gnu.org.
There is no need to reopen the bug first.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#78323
; Package
emacs
.
(Thu, 08 May 2025 22:41:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Daniel Colascione <dancol <at> dancol.org>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Thu, 08 May 2025 22:41:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
With read-file-name-completion-ignore-case true, commit
509cbe1c35b3dd005a53ac041f9c87ee53b8e115 breaks existing completion
behavior. Suppose we have file named fooBarQux. Previously, if I'd
typed "foobar" and TAB while reading a filename, then the completion
would be "fooBarQux". Now, it completes as "foobarQux", which is wrong
and breaks, among other things, vc.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#78323
; Package
emacs
.
(Fri, 09 May 2025 06:29:02 GMT)
Full text and
rfc822 format available.
Message #8 received at 78323 <at> debbugs.gnu.org (full text, mbox):
> From: Daniel Colascione <dancol <at> dancol.org>
> Date: Thu, 08 May 2025 15:40:16 -0700
>
> With read-file-name-completion-ignore-case true, commit
> 509cbe1c35b3dd005a53ac041f9c87ee53b8e115 breaks existing completion
> behavior. Suppose we have file named fooBarQux. Previously, if I'd
> typed "foobar" and TAB while reading a filename, then the completion
> would be "fooBarQux". Now, it completes as "foobarQux", which is wrong
> and breaks, among other things, vc.
Spencer, could you please look into fixing this regression?
Merged 78323 78325.
Request was from
Eli Zaretskii <eliz <at> gnu.org>
to
control <at> debbugs.gnu.org
.
(Fri, 09 May 2025 06:41:02 GMT)
Full text and
rfc822 format available.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#78323
; Package
emacs
.
(Mon, 12 May 2025 03:25:01 GMT)
Full text and
rfc822 format available.
Message #15 received at 78323 <at> debbugs.gnu.org (full text, mbox):
Eli Zaretskii <eliz <at> gnu.org> writes:
>> From: Daniel Colascione <dancol <at> dancol.org>
>> Date: Thu, 08 May 2025 15:40:16 -0700
>>
>> With read-file-name-completion-ignore-case true, commit
>> 509cbe1c35b3dd005a53ac041f9c87ee53b8e115 breaks existing completion
>> behavior. Suppose we have file named fooBarQux. Previously, if I'd
>> typed "foobar" and TAB while reading a filename, then the completion
>> would be "fooBarQux". Now, it completes as "foobarQux", which is wrong
>> and breaks, among other things, vc.
>
> Spencer, could you please look into fixing this regression?
What do you think of reverting this change while Spencer finds the cause
of the problem?
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#78323
; Package
emacs
.
(Mon, 12 May 2025 11:41:01 GMT)
Full text and
rfc822 format available.
Message #18 received at 78323 <at> debbugs.gnu.org (full text, mbox):
> From: Daniel Colascione <dancol <at> dancol.org>
> Cc: Spencer Baugh <sbaugh <at> janestreet.com>, Stefan Monnier
> <monnier <at> iro.umontreal.ca>, 78323 <at> debbugs.gnu.org
> Date: Sun, 11 May 2025 20:24:46 -0700
>
> Eli Zaretskii <eliz <at> gnu.org> writes:
>
> >> From: Daniel Colascione <dancol <at> dancol.org>
> >> Date: Thu, 08 May 2025 15:40:16 -0700
> >>
> >> With read-file-name-completion-ignore-case true, commit
> >> 509cbe1c35b3dd005a53ac041f9c87ee53b8e115 breaks existing completion
> >> behavior. Suppose we have file named fooBarQux. Previously, if I'd
> >> typed "foobar" and TAB while reading a filename, then the completion
> >> would be "fooBarQux". Now, it completes as "foobarQux", which is wrong
> >> and breaks, among other things, vc.
> >
> > Spencer, could you please look into fixing this regression?
>
> What do you think of reverting this change while Spencer finds the cause
> of the problem?
I wouldn't mind, but then I don't use these features. Let's hear
Stefan's opinion first.
Stefan?
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#78323
; Package
emacs
.
(Mon, 12 May 2025 14:43:01 GMT)
Full text and
rfc822 format available.
Message #21 received at 78323 <at> debbugs.gnu.org (full text, mbox):
>> >> With read-file-name-completion-ignore-case true, commit
>> >> 509cbe1c35b3dd005a53ac041f9c87ee53b8e115 breaks existing completion
>> >> behavior. Suppose we have file named fooBarQux. Previously, if I'd
>> >> typed "foobar" and TAB while reading a filename, then the completion
>> >> would be "fooBarQux". Now, it completes as "foobarQux", which is wrong
>> >> and breaks, among other things, vc.
>> > Spencer, could you please look into fixing this regression?
>> What do you think of reverting this change while Spencer finds the cause
>> of the problem?
> I wouldn't mind, but then I don't use these features. Let's hear
> Stefan's opinion first.
I'd first like to hear Spencer's opinion on how quickly he might be able to
fix it or if it indeed breaks his assumptions too hard (so we'd need
a different approach, in which case we may as well revert the change first).
Stefan
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#78323
; Package
emacs
.
(Mon, 12 May 2025 14:58:01 GMT)
Full text and
rfc822 format available.
Message #24 received at 78323 <at> debbugs.gnu.org (full text, mbox):
> From: Stefan Monnier <monnier <at> iro.umontreal.ca>
> Cc: Daniel Colascione <dancol <at> dancol.org>, sbaugh <at> janestreet.com,
> 78323 <at> debbugs.gnu.org
> Date: Mon, 12 May 2025 10:42:47 -0400
>
> >> >> With read-file-name-completion-ignore-case true, commit
> >> >> 509cbe1c35b3dd005a53ac041f9c87ee53b8e115 breaks existing completion
> >> >> behavior. Suppose we have file named fooBarQux. Previously, if I'd
> >> >> typed "foobar" and TAB while reading a filename, then the completion
> >> >> would be "fooBarQux". Now, it completes as "foobarQux", which is wrong
> >> >> and breaks, among other things, vc.
> >> > Spencer, could you please look into fixing this regression?
> >> What do you think of reverting this change while Spencer finds the cause
> >> of the problem?
> > I wouldn't mind, but then I don't use these features. Let's hear
> > Stefan's opinion first.
>
> I'd first like to hear Spencer's opinion on how quickly he might be able to
> fix it or if it indeed breaks his assumptions too hard (so we'd need
> a different approach, in which case we may as well revert the change first).
So, Spencer, the eyes of all the world are upon you.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#78323
; Package
emacs
.
(Tue, 13 May 2025 16:24:02 GMT)
Full text and
rfc822 format available.
Message #27 received at 78323 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Eli Zaretskii <eliz <at> gnu.org> writes:
>> From: Stefan Monnier <monnier <at> iro.umontreal.ca>
>> Cc: Daniel Colascione <dancol <at> dancol.org>, sbaugh <at> janestreet.com,
>> 78323 <at> debbugs.gnu.org
>> Date: Mon, 12 May 2025 10:42:47 -0400
>>
>> >> >> With read-file-name-completion-ignore-case true, commit
>> >> >> 509cbe1c35b3dd005a53ac041f9c87ee53b8e115 breaks existing completion
>> >> >> behavior. Suppose we have file named fooBarQux. Previously, if I'd
>> >> >> typed "foobar" and TAB while reading a filename, then the completion
>> >> >> would be "fooBarQux". Now, it completes as "foobarQux", which is wrong
>> >> >> and breaks, among other things, vc.
>> >> > Spencer, could you please look into fixing this regression?
>> >> What do you think of reverting this change while Spencer finds the cause
>> >> of the problem?
>> > I wouldn't mind, but then I don't use these features. Let's hear
>> > Stefan's opinion first.
>>
>> I'd first like to hear Spencer's opinion on how quickly he might be able to
>> fix it or if it indeed breaks his assumptions too hard (so we'd need
>> a different approach, in which case we may as well revert the change first).
>
> So, Spencer, the eyes of all the world are upon you.
Sorry for the delay, I was away this weekend. Thanks for your patience.
The attached patch should fix the issue; it's what I have installed at
my site.
[0001-Fix-completion-ignore-case-with-completion-file-name.patch (text/x-patch, inline)]
From 2418e67a71494396e8dbfd7fd5eabfb52a87198b Mon Sep 17 00:00:00 2001
From: Spencer Baugh <sbaugh <at> janestreet.com>
Date: Thu, 1 May 2025 13:56:37 -0400
Subject: [PATCH] Fix completion-ignore-case with completion--file-name-table
509cbe1c35b3d "Improve env var handling in read-file-name"
caused try-completion and all-completion operations with
completion--file-name-table to no longer update the case of text
which was already present in the input string. That is,
completions would be returned ignoring case, but the completions
would have letter-casing which matched the input string rather
than matching the actual file names.
Fix this by always using text from the file name completions
whenever it might have changed case. Also, fix a related bug
where mixing completion-ignore-case and expanding environment
variables would cause `read-file-name' to return the wrong
result; do this by suppressing completion-ignore-case in the
problematic case.
* lisp/minibuffer.el (completion--file-name-table): Use text
from the completions, not the input string. (bug#78323)
* test/lisp/minibuffer-tests.el (completion-table-test-quoting):
Test with completion-ignore-case as well.
---
lisp/minibuffer.el | 28 +++++++++++++++++++---------
test/lisp/minibuffer-tests.el | 16 +++++++++++++++-
2 files changed, 34 insertions(+), 10 deletions(-)
diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el
index 7b2b986aa1d..6f9e6c67541 100644
--- a/lisp/minibuffer.el
+++ b/lisp/minibuffer.el
@@ -3597,6 +3597,16 @@ completion--file-name-table
(if (eq (car-safe action) 'boundaries)
(cons 'boundaries (completion--sifn-boundaries orig table pred (cdr action)))
(let* ((sifned (substitute-in-file-name orig))
+ (orig-start (car (completion--sifn-boundaries orig table pred "")))
+ (sifned-start (car (completion-boundaries sifned table pred "")))
+ (orig-in-bounds (substring orig orig-start))
+ (sifned-in-bounds (substring sifned sifned-start))
+ (only-need-double-dollars
+ ;; If true, sifn only un-doubled $s in ORIG, so we can fix a
+ ;; completion to match ORIG by just doubling $s again. This
+ ;; preserves more text from the completion, behaving better with
+ ;; non-nil `completion-ignore-case'.
+ (string-equal orig-in-bounds (minibuffer--double-dollars sifned-in-bounds)))
(result
(let ((completion-regexp-list
;; Regexps are matched against the real file names after
@@ -3611,21 +3621,21 @@ completion--file-name-table
(if (stringp result)
;; Extract the newly added text, quote any dollar signs, and
;; append it to ORIG.
- (let ((new-text (substring result (length sifned))))
- (concat orig (minibuffer--double-dollars new-text)))
+ (if only-need-double-dollars
+ (concat (substring orig nil orig-start)
+ (minibuffer--double-dollars (substring result sifned-start)))
+ (let ((new-text (substring result (length sifned))))
+ (concat orig (minibuffer--double-dollars new-text))))
result))
((eq action t) ; all-completions
(mapcar
- (let ((orig-prefix
- (substring orig (car (completion--sifn-boundaries orig table pred ""))))
- (sifned-prefix-length
- (- (length sifned)
- (car (completion-boundaries sifned table pred "")))))
+ (if only-need-double-dollars
+ #'minibuffer--double-dollars
;; Extract the newly added text, quote any dollar signs, and append
;; it to the part of ORIG inside the completion boundaries.
(lambda (compl)
- (let ((new-text (substring compl sifned-prefix-length)))
- (concat orig-prefix (minibuffer--double-dollars new-text)))))
+ (let ((new-text (substring compl (length sifned-in-bounds))))
+ (concat orig-in-bounds (minibuffer--double-dollars new-text)))))
result))
(t result))))))
diff --git a/test/lisp/minibuffer-tests.el b/test/lisp/minibuffer-tests.el
index bed797bdb14..111335a2b5e 100644
--- a/test/lisp/minibuffer-tests.el
+++ b/test/lisp/minibuffer-tests.el
@@ -108,7 +108,21 @@ completion-table-test-quoting
(should (equal (completion-try-completion input
#'completion--file-name-table
nil (length input))
- (cons output (length output)))))))
+ (cons output (length output)))))
+ ;; Everything also works with `completion-ignore-case'.
+ (let ((completion-ignore-case t))
+ (pcase-dolist (`(,input ,output)
+ '(
+ ("data/M-CTTQ" "data/minibuffer-test-cttq$$tion")
+ ("data/M-CTTQ$$t" "data/minibuffer-test-cttq$$tion")
+ ("lisp/c${CTTQ1}et/SE-U" "lisp/c${CTTQ1}et/semantic-utest")
+ ("lisp/ced${CTTQ2}SE-U" "lisp/ced${CTTQ2}SEmantic-utest")
+ ("lis/c${CTTQ1}/SE-U" "lisp/c${CTTQ1}et/semantic-utest")
+ ))
+ (should (equal (car (completion-try-completion input
+ #'completion--file-name-table
+ nil (length input)))
+ output))))))
(ert-deftest completion--insert-strings-faces ()
(with-temp-buffer
--
2.39.3
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#78323
; Package
emacs
.
(Wed, 14 May 2025 11:19:02 GMT)
Full text and
rfc822 format available.
Message #30 received at 78323 <at> debbugs.gnu.org (full text, mbox):
> From: Spencer Baugh <sbaugh <at> janestreet.com>
> Cc: Stefan Monnier <monnier <at> iro.umontreal.ca>, dancol <at> dancol.org,
> 78323 <at> debbugs.gnu.org
> Date: Tue, 13 May 2025 12:23:36 -0400
>
> Eli Zaretskii <eliz <at> gnu.org> writes:
>
> >> From: Stefan Monnier <monnier <at> iro.umontreal.ca>
> >> Cc: Daniel Colascione <dancol <at> dancol.org>, sbaugh <at> janestreet.com,
> >> 78323 <at> debbugs.gnu.org
> >> Date: Mon, 12 May 2025 10:42:47 -0400
> >>
> >> >> >> With read-file-name-completion-ignore-case true, commit
> >> >> >> 509cbe1c35b3dd005a53ac041f9c87ee53b8e115 breaks existing completion
> >> >> >> behavior. Suppose we have file named fooBarQux. Previously, if I'd
> >> >> >> typed "foobar" and TAB while reading a filename, then the completion
> >> >> >> would be "fooBarQux". Now, it completes as "foobarQux", which is wrong
> >> >> >> and breaks, among other things, vc.
> >> >> > Spencer, could you please look into fixing this regression?
> >> >> What do you think of reverting this change while Spencer finds the cause
> >> >> of the problem?
> >> > I wouldn't mind, but then I don't use these features. Let's hear
> >> > Stefan's opinion first.
> >>
> >> I'd first like to hear Spencer's opinion on how quickly he might be able to
> >> fix it or if it indeed breaks his assumptions too hard (so we'd need
> >> a different approach, in which case we may as well revert the change first).
> >
> > So, Spencer, the eyes of all the world are upon you.
>
> Sorry for the delay, I was away this weekend. Thanks for your patience.
>
> The attached patch should fix the issue; it's what I have installed at
> my site.
Thanks.
Daniel, Dieter, and Aaron, could you please see whether this fixes
your problems as well?
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#78323
; Package
emacs
.
(Wed, 14 May 2025 11:38:02 GMT)
Full text and
rfc822 format available.
Message #33 received at 78323 <at> debbugs.gnu.org (full text, mbox):
Eli Zaretskii <eliz <at> gnu.org> writes:
>> From: Spencer Baugh <sbaugh <at> janestreet.com>
>> Cc: Stefan Monnier <monnier <at> iro.umontreal.ca>, dancol <at> dancol.org,
>> 78323 <at> debbugs.gnu.org
>> Date: Tue, 13 May 2025 12:23:36 -0400
>>
>> Eli Zaretskii <eliz <at> gnu.org> writes:
>>
>> >> From: Stefan Monnier <monnier <at> iro.umontreal.ca>
>> >> Cc: Daniel Colascione <dancol <at> dancol.org>, sbaugh <at> janestreet.com,
>> >> 78323 <at> debbugs.gnu.org
>> >> Date: Mon, 12 May 2025 10:42:47 -0400
>> >>
>> >> >> >> With read-file-name-completion-ignore-case true, commit
>> >> >> >> 509cbe1c35b3dd005a53ac041f9c87ee53b8e115 breaks existing completion
>> >> >> >> behavior. Suppose we have file named fooBarQux. Previously, if I'd
>> >> >> >> typed "foobar" and TAB while reading a filename, then the completion
>> >> >> >> would be "fooBarQux". Now, it completes as "foobarQux", which is wrong
>> >> >> >> and breaks, among other things, vc.
>> >> >> > Spencer, could you please look into fixing this regression?
>> >> >> What do you think of reverting this change while Spencer finds the cause
>> >> >> of the problem?
>> >> > I wouldn't mind, but then I don't use these features. Let's hear
>> >> > Stefan's opinion first.
>> >>
>> >> I'd first like to hear Spencer's opinion on how quickly he might be able to
>> >> fix it or if it indeed breaks his assumptions too hard (so we'd need
>> >> a different approach, in which case we may as well revert the change first).
>> >
>> > So, Spencer, the eyes of all the world are upon you.
>>
>> Sorry for the delay, I was away this weekend. Thanks for your patience.
>>
>> The attached patch should fix the issue; it's what I have installed at
>> my site.
>
> Thanks.
>
> Daniel, Dieter, and Aaron, could you please see whether this fixes
> your problems as well?
Yes, it works for me now. Thanks!
--
Dieter Deyke
mailto:dieter.deyke <at> gmail.com
Get my Gnupg key:
gpg --keyserver keys.gnupg.net --recv-keys B116EA20
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#78323
; Package
emacs
.
(Wed, 14 May 2025 16:11:02 GMT)
Full text and
rfc822 format available.
Message #36 received at 78323 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
It work for me as well, thank you.
Aaron
On Wed, May 14, 2025 at 4:37 AM, Dieter Deyke < dieter.deyke <at> gmail.com > wrote:
>
>
>
> Eli Zaretskii < eliz@ gnu. org ( eliz <at> gnu.org ) > writes:
>
>
>>
>>>
>>>
>>> From: Spencer Baugh < sbaugh@ janestreet. com ( sbaugh <at> janestreet.com ) >
>>> Cc: Stefan Monnier < monnier@ iro. umontreal. ca ( monnier <at> iro.umontreal.ca
>>> ) >, dancol@ dancol. org ( dancol <at> dancol.org ) , 78323@ debbugs. gnu. org (
>>> 78323 <at> debbugs.gnu.org )
>>> Date: Tue , 13 May 2025 12:23:36 -0400
>>>
>>>
>>>
>>> Eli Zaretskii < eliz@ gnu. org ( eliz <at> gnu.org ) > writes:
>>>
>>>
>>>>
>>>>>
>>>>>
>>>>> From: Stefan Monnier < monnier@ iro. umontreal. ca (
>>>>> monnier <at> iro.umontreal.ca ) > Cc: Daniel Colascione < dancol@ dancol. org (
>>>>> dancol <at> dancol.org ) >, sbaugh@ janestreet. com ( sbaugh <at> janestreet.com ) ,
>>>>> 78323@ debbugs. gnu. org ( 78323 <at> debbugs.gnu.org )
>>>>> Date: Mon , 12 May 2025 10:42:47 -0400
>>>>>
>>>>>
>>>>>>
>>>>>>>
>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> With read-file-name-completion-ignore-case true, commit
>>>>>>>>> 509cbe1c35b3dd005a53ac041f9c87ee53b8e115 breaks existing completion
>>>>>>>>> behavior. Suppose we have file named fooBarQux. Previously, if I'd typed
>>>>>>>>> "foobar" and TAB while reading a filename, then the completion would be
>>>>>>>>> "fooBarQux". Now, it completes as "foobarQux", which is wrong and breaks,
>>>>>>>>> among other things, vc.
>>>>>>>>>
>>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> Spencer, could you please look into fixing this regression?
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> What do you think of reverting this change while Spencer finds the cause
>>>>>>> of the problem?
>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> I wouldn't mind, but then I don't use these features. Let's hear Stefan's
>>>>>> opinion first.
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>> I'd first like to hear Spencer's opinion on how quickly he might be able
>>>>> to fix it or if it indeed breaks his assumptions too hard (so we'd need a
>>>>> different approach, in which case we may as well revert the change first).
>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>>
>>>> So, Spencer, the eyes of all the world are upon you.
>>>>
>>>>
>>>
>>>
>>>
>>> Sorry for the delay, I was away this weekend. Thanks for your patience.
>>>
>>>
>>>
>>> The attached patch should fix the issue; it's what I have installed at my
>>> site.
>>>
>>>
>>
>>
>>
>> Thanks.
>>
>>
>>
>> Daniel, Dieter, and Aaron, could you please see whether this fixes your
>> problems as well?
>>
>>
>
>
>
> Yes, it works for me now. Thanks!
>
>
>
> --
> Dieter Deyke
> mailto: dieter. deyke@ gmail. com ( dieter.deyke <at> gmail.com )
> Get my Gnupg key:
> gpg --keyserver keys. gnupg. net ( http://keys.gnupg.net/ ) --recv-keys
> B116EA20
>
>
>
[Message part 2 (text/html, inline)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#78323
; Package
emacs
.
(Wed, 14 May 2025 22:20:03 GMT)
Full text and
rfc822 format available.
Message #39 received at 78323 <at> debbugs.gnu.org (full text, mbox):
Eli Zaretskii <eliz <at> gnu.org> writes:
>> From: Spencer Baugh <sbaugh <at> janestreet.com>
>> Cc: Stefan Monnier <monnier <at> iro.umontreal.ca>, dancol <at> dancol.org,
>> 78323 <at> debbugs.gnu.org
>> Date: Tue, 13 May 2025 12:23:36 -0400
>>
>> Eli Zaretskii <eliz <at> gnu.org> writes:
>>
>> >> From: Stefan Monnier <monnier <at> iro.umontreal.ca>
>> >> Cc: Daniel Colascione <dancol <at> dancol.org>, sbaugh <at> janestreet.com,
>> >> 78323 <at> debbugs.gnu.org
>> >> Date: Mon, 12 May 2025 10:42:47 -0400
>> >>
>> >> >> >> With read-file-name-completion-ignore-case true, commit
>> >> >> >> 509cbe1c35b3dd005a53ac041f9c87ee53b8e115 breaks existing completion
>> >> >> >> behavior. Suppose we have file named fooBarQux. Previously, if I'd
>> >> >> >> typed "foobar" and TAB while reading a filename, then the completion
>> >> >> >> would be "fooBarQux". Now, it completes as "foobarQux", which is wrong
>> >> >> >> and breaks, among other things, vc.
>> >> >> > Spencer, could you please look into fixing this regression?
>> >> >> What do you think of reverting this change while Spencer finds the cause
>> >> >> of the problem?
>> >> > I wouldn't mind, but then I don't use these features. Let's hear
>> >> > Stefan's opinion first.
>> >>
>> >> I'd first like to hear Spencer's opinion on how quickly he might be able to
>> >> fix it or if it indeed breaks his assumptions too hard (so we'd need
>> >> a different approach, in which case we may as well revert the change first).
>> >
>> > So, Spencer, the eyes of all the world are upon you.
>>
>> Sorry for the delay, I was away this weekend. Thanks for your patience.
>>
>> The attached patch should fix the issue; it's what I have installed at
>> my site.
>
> Thanks.
>
> Daniel, Dieter, and Aaron, could you please see whether this fixes
> your problems as well?
BTW, the patch I posted has the wrong commit message but is otherwise
correct. Assuming there's review feedback, I'll correct the commit
message in the next version.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#78323
; Package
emacs
.
(Sat, 17 May 2025 09:40:02 GMT)
Full text and
rfc822 format available.
Message #42 received at 78323 <at> debbugs.gnu.org (full text, mbox):
> From: Spencer Baugh <sbaugh <at> janestreet.com>
> Cc: dancol <at> dancol.org, Dieter Deyke <dieter.deyke <at> gmail.com>, Aaron Jensen
> <aaronjensen <at> gmail.com>, monnier <at> iro.umontreal.ca, 78323 <at> debbugs.gnu.org
> Date: Wed, 14 May 2025 18:19:11 -0400
>
> Eli Zaretskii <eliz <at> gnu.org> writes:
> >> From: Spencer Baugh <sbaugh <at> janestreet.com>
> >> Cc: Stefan Monnier <monnier <at> iro.umontreal.ca>, dancol <at> dancol.org,
> >> 78323 <at> debbugs.gnu.org
> >> Date: Tue, 13 May 2025 12:23:36 -0400
> >>
> >> Eli Zaretskii <eliz <at> gnu.org> writes:
> >>
> >> >> From: Stefan Monnier <monnier <at> iro.umontreal.ca>
> >> >> Cc: Daniel Colascione <dancol <at> dancol.org>, sbaugh <at> janestreet.com,
> >> >> 78323 <at> debbugs.gnu.org
> >> >> Date: Mon, 12 May 2025 10:42:47 -0400
> >> >>
> >> >> >> >> With read-file-name-completion-ignore-case true, commit
> >> >> >> >> 509cbe1c35b3dd005a53ac041f9c87ee53b8e115 breaks existing completion
> >> >> >> >> behavior. Suppose we have file named fooBarQux. Previously, if I'd
> >> >> >> >> typed "foobar" and TAB while reading a filename, then the completion
> >> >> >> >> would be "fooBarQux". Now, it completes as "foobarQux", which is wrong
> >> >> >> >> and breaks, among other things, vc.
> >> >> >> > Spencer, could you please look into fixing this regression?
> >> >> >> What do you think of reverting this change while Spencer finds the cause
> >> >> >> of the problem?
> >> >> > I wouldn't mind, but then I don't use these features. Let's hear
> >> >> > Stefan's opinion first.
> >> >>
> >> >> I'd first like to hear Spencer's opinion on how quickly he might be able to
> >> >> fix it or if it indeed breaks his assumptions too hard (so we'd need
> >> >> a different approach, in which case we may as well revert the change first).
> >> >
> >> > So, Spencer, the eyes of all the world are upon you.
> >>
> >> Sorry for the delay, I was away this weekend. Thanks for your patience.
> >>
> >> The attached patch should fix the issue; it's what I have installed at
> >> my site.
> >
> > Thanks.
> >
> > Daniel, Dieter, and Aaron, could you please see whether this fixes
> > your problems as well?
>
> BTW, the patch I posted has the wrong commit message but is otherwise
> correct. Assuming there's review feedback, I'll correct the commit
> message in the next version.
Please do submit a correct patch, so we could resolve this regression.
Thanks.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#78323
; Package
emacs
.
(Mon, 19 May 2025 14:59:01 GMT)
Full text and
rfc822 format available.
Message #45 received at 78323 <at> debbugs.gnu.org (full text, mbox):
Eli Zaretskii <eliz <at> gnu.org> writes:
>> From: Spencer Baugh <sbaugh <at> janestreet.com>
>> Cc: dancol <at> dancol.org, Dieter Deyke <dieter.deyke <at> gmail.com>, Aaron Jensen
>> <aaronjensen <at> gmail.com>, monnier <at> iro.umontreal.ca, 78323 <at> debbugs.gnu.org
>> Date: Wed, 14 May 2025 18:19:11 -0400
>>
>> Eli Zaretskii <eliz <at> gnu.org> writes:
>> >> From: Spencer Baugh <sbaugh <at> janestreet.com>
>> >> Cc: Stefan Monnier <monnier <at> iro.umontreal.ca>, dancol <at> dancol.org,
>> >> 78323 <at> debbugs.gnu.org
>> >> Date: Tue, 13 May 2025 12:23:36 -0400
>> >>
>> >> Eli Zaretskii <eliz <at> gnu.org> writes:
>> >>
>> >> >> From: Stefan Monnier <monnier <at> iro.umontreal.ca>
>> >> >> Cc: Daniel Colascione <dancol <at> dancol.org>, sbaugh <at> janestreet.com,
>> >> >> 78323 <at> debbugs.gnu.org
>> >> >> Date: Mon, 12 May 2025 10:42:47 -0400
>> >> >>
>> >> >> >> >> With read-file-name-completion-ignore-case true, commit
>> >> >> >> >> 509cbe1c35b3dd005a53ac041f9c87ee53b8e115 breaks existing completion
>> >> >> >> >> behavior. Suppose we have file named fooBarQux. Previously, if I'd
>> >> >> >> >> typed "foobar" and TAB while reading a filename, then the completion
>> >> >> >> >> would be "fooBarQux". Now, it completes as "foobarQux", which is wrong
>> >> >> >> >> and breaks, among other things, vc.
>> >> >> >> > Spencer, could you please look into fixing this regression?
>> >> >> >> What do you think of reverting this change while Spencer finds the cause
>> >> >> >> of the problem?
>> >> >> > I wouldn't mind, but then I don't use these features. Let's hear
>> >> >> > Stefan's opinion first.
>> >> >>
>> >> >> I'd first like to hear Spencer's opinion on how quickly he might be able to
>> >> >> fix it or if it indeed breaks his assumptions too hard (so we'd need
>> >> >> a different approach, in which case we may as well revert the change first).
>> >> >
>> >> > So, Spencer, the eyes of all the world are upon you.
>> >>
>> >> Sorry for the delay, I was away this weekend. Thanks for your patience.
>> >>
>> >> The attached patch should fix the issue; it's what I have installed at
>> >> my site.
>> >
>> > Thanks.
>> >
>> > Daniel, Dieter, and Aaron, could you please see whether this fixes
>> > your problems as well?
>>
>> BTW, the patch I posted has the wrong commit message but is otherwise
>> correct. Assuming there's review feedback, I'll correct the commit
>> message in the next version.
>
> Please do submit a correct patch, so we could resolve this regression.
>
> Thanks.
Works fine for me too, FWIW.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#78323
; Package
emacs
.
(Mon, 19 May 2025 15:48:01 GMT)
Full text and
rfc822 format available.
Message #48 received at 78323 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Eli Zaretskii <eliz <at> gnu.org> writes:
>> From: Spencer Baugh <sbaugh <at> janestreet.com>
>> BTW, the patch I posted has the wrong commit message but is otherwise
>> correct. Assuming there's review feedback, I'll correct the commit
>> message in the next version.
>
> Please do submit a correct patch, so we could resolve this regression.
>
> Thanks.
Here is the version with a correct commit message. (I also added some
comments in the test)
[0001-Fix-completion-ignore-case-with-completion-file-name.patch (text/x-patch, inline)]
From d3d61cfe7699078c3f6405f2dd7a7a5f61d5985a Mon Sep 17 00:00:00 2001
From: Spencer Baugh <sbaugh <at> janestreet.com>
Date: Mon, 19 May 2025 11:35:38 -0400
Subject: [PATCH] Fix completion-ignore-case with completion--file-name-table
509cbe1c35b3d "Improve env var handling in read-file-name"
caused try-completion and all-completion operations with
completion--file-name-table to no longer update the case of text
which was already present in the input string. That is,
completions would be returned ignoring case, but the completions
would have letter-casing which matched the input string rather
than matching the actual file names.
This was caused by unnecessarily replacing text in the returned
file name completions with text from the input string ORIG,
which in turn was caused by the desire to preserve text from
ORIG even after substitute-in-file-name changed it. Fix this by
detecting when ORIG was not substantially changed by
substitute-in-file-name; in that case, the returned file name
completions also don't need substantial changes.
* lisp/minibuffer.el (completion--file-name-table): Use text
from the completions, not the input string. (bug#78323)
* test/lisp/minibuffer-tests.el (completion-table-test-quoting):
Test with completion-ignore-case as well.
---
lisp/minibuffer.el | 28 +++++++++++++++++++---------
test/lisp/minibuffer-tests.el | 21 ++++++++++++++++++++-
2 files changed, 39 insertions(+), 10 deletions(-)
diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el
index 7b2b986aa1d..6f9e6c67541 100644
--- a/lisp/minibuffer.el
+++ b/lisp/minibuffer.el
@@ -3597,6 +3597,16 @@ completion--file-name-table
(if (eq (car-safe action) 'boundaries)
(cons 'boundaries (completion--sifn-boundaries orig table pred (cdr action)))
(let* ((sifned (substitute-in-file-name orig))
+ (orig-start (car (completion--sifn-boundaries orig table pred "")))
+ (sifned-start (car (completion-boundaries sifned table pred "")))
+ (orig-in-bounds (substring orig orig-start))
+ (sifned-in-bounds (substring sifned sifned-start))
+ (only-need-double-dollars
+ ;; If true, sifn only un-doubled $s in ORIG, so we can fix a
+ ;; completion to match ORIG by just doubling $s again. This
+ ;; preserves more text from the completion, behaving better with
+ ;; non-nil `completion-ignore-case'.
+ (string-equal orig-in-bounds (minibuffer--double-dollars sifned-in-bounds)))
(result
(let ((completion-regexp-list
;; Regexps are matched against the real file names after
@@ -3611,21 +3621,21 @@ completion--file-name-table
(if (stringp result)
;; Extract the newly added text, quote any dollar signs, and
;; append it to ORIG.
- (let ((new-text (substring result (length sifned))))
- (concat orig (minibuffer--double-dollars new-text)))
+ (if only-need-double-dollars
+ (concat (substring orig nil orig-start)
+ (minibuffer--double-dollars (substring result sifned-start)))
+ (let ((new-text (substring result (length sifned))))
+ (concat orig (minibuffer--double-dollars new-text))))
result))
((eq action t) ; all-completions
(mapcar
- (let ((orig-prefix
- (substring orig (car (completion--sifn-boundaries orig table pred ""))))
- (sifned-prefix-length
- (- (length sifned)
- (car (completion-boundaries sifned table pred "")))))
+ (if only-need-double-dollars
+ #'minibuffer--double-dollars
;; Extract the newly added text, quote any dollar signs, and append
;; it to the part of ORIG inside the completion boundaries.
(lambda (compl)
- (let ((new-text (substring compl sifned-prefix-length)))
- (concat orig-prefix (minibuffer--double-dollars new-text)))))
+ (let ((new-text (substring compl (length sifned-in-bounds))))
+ (concat orig-in-bounds (minibuffer--double-dollars new-text)))))
result))
(t result))))))
diff --git a/test/lisp/minibuffer-tests.el b/test/lisp/minibuffer-tests.el
index bed797bdb14..f9a26d17e58 100644
--- a/test/lisp/minibuffer-tests.el
+++ b/test/lisp/minibuffer-tests.el
@@ -108,7 +108,26 @@ completion-table-test-quoting
(should (equal (completion-try-completion input
#'completion--file-name-table
nil (length input))
- (cons output (length output)))))))
+ (cons output (length output)))))
+ ;; Everything also works with `completion-ignore-case'.
+ (let ((completion-ignore-case t))
+ (pcase-dolist (`(,input ,output)
+ '(
+ ("data/M-CTTQ" "data/minibuffer-test-cttq$$tion")
+ ("data/M-CTTQ$$t" "data/minibuffer-test-cttq$$tion")
+ ;; When an env var is in the completion bounds, try-completion
+ ;; won't change letter case.
+ ("lisp/c${CTTQ1}E" "lisp/c${CTTQ1}Et/")
+ ("lisp/ced${CTTQ2}SE-U" "lisp/ced${CTTQ2}SEmantic-utest")
+ ;; If the env var is before the completion bounds, try-completion
+ ;; *will* change letter case.
+ ("lisp/c${CTTQ1}et/SE-U" "lisp/c${CTTQ1}et/semantic-utest")
+ ("lis/c${CTTQ1}/SE-U" "lisp/c${CTTQ1}et/semantic-utest")
+ ))
+ (should (equal (car (completion-try-completion input
+ #'completion--file-name-table
+ nil (length input)))
+ output))))))
(ert-deftest completion--insert-strings-faces ()
(with-temp-buffer
--
2.39.3
Reply sent
to
Eli Zaretskii <eliz <at> gnu.org>
:
You have taken responsibility.
(Mon, 19 May 2025 17:06:01 GMT)
Full text and
rfc822 format available.
Notification sent
to
Daniel Colascione <dancol <at> dancol.org>
:
bug acknowledged by developer.
(Mon, 19 May 2025 17:06:02 GMT)
Full text and
rfc822 format available.
Message #53 received at 78323-done <at> debbugs.gnu.org (full text, mbox):
> From: Spencer Baugh <sbaugh <at> janestreet.com>
> Cc: dieter.deyke <at> gmail.com, dancol <at> dancol.org, 78323 <at> debbugs.gnu.org,
> monnier <at> iro.umontreal.ca, aaronjensen <at> gmail.com
> Date: Mon, 19 May 2025 11:46:57 -0400
>
> Eli Zaretskii <eliz <at> gnu.org> writes:
> >> From: Spencer Baugh <sbaugh <at> janestreet.com>
> >> BTW, the patch I posted has the wrong commit message but is otherwise
> >> correct. Assuming there's review feedback, I'll correct the commit
> >> message in the next version.
> >
> > Please do submit a correct patch, so we could resolve this regression.
> >
> > Thanks.
>
> Here is the version with a correct commit message. (I also added some
> comments in the test)
Thanks, installed on master, and closing the bug.
Reply sent
to
Eli Zaretskii <eliz <at> gnu.org>
:
You have taken responsibility.
(Mon, 19 May 2025 17:06:02 GMT)
Full text and
rfc822 format available.
Notification sent
to
Aaron Jensen <aaronjensen <at> gmail.com>
:
bug acknowledged by developer.
(Mon, 19 May 2025 17:06:02 GMT)
Full text and
rfc822 format available.
Reply sent
to
Eli Zaretskii <eliz <at> gnu.org>
:
You have taken responsibility.
(Mon, 19 May 2025 17:06:02 GMT)
Full text and
rfc822 format available.
Notification sent
to
Dieter Deyke <dieter.deyke <at> gmail.com>
:
bug acknowledged by developer.
(Mon, 19 May 2025 17:06:02 GMT)
Full text and
rfc822 format available.
This bug report was last modified 26 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.