unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* completion-regexp-list and case-fold-search
@ 2004-01-01  3:17 Luc Teirlinck
  2004-01-05  3:41 ` Richard Stallman
  0 siblings, 1 reply; 3+ messages in thread
From: Luc Teirlinck @ 2004-01-01  3:17 UTC (permalink / raw)


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.

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

* Re: completion-regexp-list and case-fold-search
  2004-01-01  3:17 completion-regexp-list and case-fold-search Luc Teirlinck
@ 2004-01-05  3:41 ` Richard Stallman
  2004-01-05  4:17   ` Luc Teirlinck
  0 siblings, 1 reply; 3+ messages in thread
From: Richard Stallman @ 2004-01-05  3:41 UTC (permalink / raw)
  Cc: emacs-devel

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

I agree.

    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 think that is the correct fix.

    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.

That would be incorrect, since it would distort the behavior
of many user commands in the minibuffer.

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

Are you saying that partial-completion-mode does something analogous
to #1?  If so, I think that is a bug, and we should replace that
with something analogous to #2.

Would you like to do that?

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

* Re: completion-regexp-list and case-fold-search
  2004-01-05  3:41 ` Richard Stallman
@ 2004-01-05  4:17   ` Luc Teirlinck
  0 siblings, 0 replies; 3+ messages in thread
From: Luc Teirlinck @ 2004-01-05  4:17 UTC (permalink / raw)
  Cc: emacs-devel

Richard Stallman wrote:

       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.

   That would be incorrect, since it would distort the behavior
   of many user commands in the minibuffer.

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

   Are you saying that partial-completion-mode does something analogous
   to #1?  If so, I think that is a bug, and we should replace that
   with something analogous to #2.

I believe you misunderstood both proposal (1) and the behavior of
partial-completion-mode.   They bind `case-fold-search' _only_
immediately around the calls to the basic completion functions.
During the recursive edit, the user customized value of
`case-fold-search' is in effect, in the minibuffer as elsewhere.

Nevertheless, I believe that proposal (2) is more intuitive, much
easier to document, and less prone to all kinds of bugs.  So I will
implement proposal (2).

Sincerely,

Luc.

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

end of thread, other threads:[~2004-01-05  4:17 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-01-01  3:17 completion-regexp-list and case-fold-search Luc Teirlinck
2004-01-05  3:41 ` Richard Stallman
2004-01-05  4:17   ` Luc Teirlinck

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