[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
completion-regexp-list and case-fold-search
From: |
Luc Teirlinck |
Subject: |
completion-regexp-list and case-fold-search |
Date: |
Wed, 31 Dec 2003 21:17:04 -0600 (CST) |
The case sensitivity of regex matching in the use of
`completion-regexp-list' by the basic completion functions is
determined by `case-fold-search' and _not_ by
`completion-ignore-case'. Whether something is a valid completion for
the minibuffer completion functions has nothing to do with whether the
user prefers _interactive regexp searches_ to be case-sensitive or
not. Hence, `case-fold-search' should be bound around all calls to
`{try,test}-completion' and `all-completions'. If `partial-completion-mode'
is enabled, that is the case: `case-fold-search' is bound to the
value of `completion-ignore-case' around all calls. That seems to
make sense and is correct for the one single use of
`completion-regexp-list' in the Emacs source code (`customize-mode').
With `partial-completion-mode' set to nil (the default) this is not the
case however. This is a bug.
Two solutions:
1. Make all the basic minibuffer completion functions bind
`case-fold-search' to the value of `completion-ignore-case' around
all calls to `{try,test}-completion' and `all-completions', as
`partial-completion-mode' already does.
2. More radically, make `{try,test}-completion' and `all-completions'
_themselves_ bind `case-fold-search' to the value of
`completion-ignore-case', thereby effectively making the
case-sensitivity of `completion-regexp-list' entirely determined
by `completion-ignore-case'.
I have implemented (1) in my private Emacs and it seems to work
perfectly.
(2) would be simpler and very intuitive and would necessitate less
extra documentation. On the other hand, it _would_ take away the
possibility of considering case significant in completion, but not in
using `completion-regexp-list' to eliminate some of the found
completions.
Do we want to go for (1) or (2)? With (1) we are absolutely certain
that we do not break any code that was not already broken. (Because
all we do is make both values of `partial-completion-mode' consistent.)
There is no such certainty with (2), but I do not believe that it
would not break any code currently included with the Emacs distribution.
Sincerely,
Luc.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- completion-regexp-list and case-fold-search,
Luc Teirlinck <=