unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [cjm@pobox.com: Case-insensitive partial-completion bug]
@ 2006-11-13 20:15 Richard Stallman
  2006-11-13 20:44 ` Markus Triska
  0 siblings, 1 reply; 10+ messages in thread
From: Richard Stallman @ 2006-11-13 20:15 UTC (permalink / raw)


Would someone please DTRT and ack?

------- Start of forwarded message -------
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
From: "Christopher J. Madsen" <cjm@pobox.com>
To: emacs-pretest-bug@gnu.org
Date: Thu, 09 Nov 2006 10:47:45 -0600 (CST)
Subject: Case-insensitive partial-completion bug
X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=failed 
	version=3.0.4

Please describe exactly what actions triggered the bug
and the precise symptoms of the bug:

In a shell, create a new directory and cd there.
> touch Foo Foobar
> emacs -Q

In the *scratch* buffer, type:
(setq read-file-name-completion-ignore-case t) C-j

M-x partial-completion-mode <return>

C-x C-f foo <tab>


I expected it to change "foo" to "Foo", because all possible
completions begin with "Foo".  That's what it does if you don't enable
partial-completion-mode.  But with partial-completion-mode enabled, it
stays "foo" and Emacs displays the list of possible completions.

If you type "b <tab>", it will change "foob" to "Foobar" (as expected).

This used to work in Emacs 21.3.1 (although there the variable is
completion-ignore-case instead).  I first noticed the bug a couple
months ago, but it's still present in the CVS HEAD version I compiled
yesterday.


In GNU Emacs 22.0.90.1 (i686-pc-linux-gnu, GTK+ Version 2.8.19)
 of 2006-11-08 on bit
X server distributor `The X.Org Foundation', version 11.0.70101000
configured using `configure '--prefix=/usr' '--host=i686-pc-linux-gnu' '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--datadir=/usr/share' '--sysconfdir=/etc' '--localstatedir=/var/lib' '--program-suffix=.emacs-22.0.90' '--without-carbon' '--with-x' '--with-xpm' '--with-toolkit-scroll-bars' '--with-jpeg' '--with-tiff' '--with-gif' '--with-png' '--with-x-toolkit=gtk' '--build=i686-pc-linux-gnu' 'CFLAGS=-O2' 'build_alias=i686-pc-linux-gnu' 'host_alias=i686-pc-linux-gnu''

Important settings:
  value of $LC_ALL: en_US
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: nil
  locale-coding-system: iso-8859-1
  default-enable-multibyte-characters: t

Major mode: Lisp Interaction

Minor modes in effect:
  partial-completion-mode: t
  tooltip-mode: t
  tool-bar-mode: t
  mouse-wheel-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  unify-8859-on-encoding-mode: t
  utf-translate-cjk-mode: t
  auto-compression-mode: t
  line-number-mode: t

Recent input:
( s e t q SPC r e a d - f i l e <escape> <tab> - c
<escape> <tab> SPC t ) C-j M-x p a r t <tab> <return>
C-x C-f f o o <tab> C-g M-x r e p o r t <tab> <return>

Recent messages:
(emacs -Q)
For information about the GNU Project and its goals, type C-h C-p.
Loading complete...
Loading advice...done
Loading complete...done
Partial-Completion mode enabled
Quit
Loading emacsbug...
Loading regexp-opt...done
Loading emacsbug...done



_______________________________________________
emacs-pretest-bug mailing list
emacs-pretest-bug@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-pretest-bug
------- End of forwarded message -------

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

* Re: [cjm@pobox.com: Case-insensitive partial-completion bug]
  2006-11-13 20:15 [cjm@pobox.com: Case-insensitive partial-completion bug] Richard Stallman
@ 2006-11-13 20:44 ` Markus Triska
  2006-11-15  3:14   ` Richard Stallman
  0 siblings, 1 reply; 10+ messages in thread
From: Markus Triska @ 2006-11-13 20:44 UTC (permalink / raw)
  Cc: emacs-devel

Richard Stallman <rms@gnu.org> writes:

> Would someone please DTRT and ack?

Intentional feature:

revision 1.54
date: 2006-06-23 15:05:03 +0200;  author: eliz;  state: Exp;  lines: +50 -20
(PC-do-completion): Retain capitalization of user input, when possible, even
if completion-ignore-case is set.

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

* Re: [cjm@pobox.com: Case-insensitive partial-completion bug]
  2006-11-13 20:44 ` Markus Triska
@ 2006-11-15  3:14   ` Richard Stallman
  2006-11-20 14:21     ` Michael Ernst
  0 siblings, 1 reply; 10+ messages in thread
From: Richard Stallman @ 2006-11-15  3:14 UTC (permalink / raw)
  Cc: emacs-devel

The complaint was:

    I expected it to change "foo" to "Foo", because all possible
    completions begin with "Foo".  That's what it does if you don't enable
    partial-completion-mode.  But with partial-completion-mode enabled, it
    stays "foo" and Emacs displays the list of possible completions.

Michael Ernst wrote the patch which implemented this behavior.

Michael, why is it desirable for partial-completion mode to handle
this case differently from ordinary completion?

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

* Re: [cjm@pobox.com: Case-insensitive partial-completion bug]
  2006-11-15  3:14   ` Richard Stallman
@ 2006-11-20 14:21     ` Michael Ernst
  2006-11-21  7:47       ` Richard Stallman
  2007-03-02  1:18       ` Johan Bockgård
  0 siblings, 2 replies; 10+ messages in thread
From: Michael Ernst @ 2006-11-20 14:21 UTC (permalink / raw)
  Cc: Markus Triska, eliz, emacs-devel

> The complaint was:
> 
>     I expected it to change "foo" to "Foo", because all possible
>     completions begin with "Foo".  That's what it does if you don't enable
>     partial-completion-mode.  But with partial-completion-mode enabled, it
>     stays "foo" and Emacs displays the list of possible completions.
> 
> Michael Ernst wrote the patch which implemented this behavior.
> 
> Michael, why is it desirable for partial-completion mode to handle
> this case differently from ordinary completion?

Thanks for forwarding the bug report.  I'm aware of this problem, and I
agree it should be fixed, but I haven't yet found time to correct it
(though it remains on my to-do list).  I have noticed it once in the 6
months I have been using the new code, and the new code corrects problems
that I noticed much more frequently.

My notes state that the problem is near the "same char (modulo case); no
action" comment, and near

		  ;; Retain capitalization of user input even if
		  ;; completion-ignore-case is set.

If the list `poss' has many possibilities with different capitalization,
then we want to retain the capitalization as input by the user.  However,
if they are all the same, we want to adjust the capitalization.

Below my signature is a test case that illustrates the problem in a
reproducible way.

                    -Michael Ernst
                     mernst@alum.mit.edu



(defun completion-test-4 (initial-input &optional ignore-case)
  (let ((completion-ignore-case ignore-case))
    (completing-read "Input: "
                     '(("getMillis" . 1)
                       ("getMillisToDecideToPopup" . 2)
                       ("getMillisToPopup" . 3)
                       ("getMillisecond" . 4))
                     nil                ; no predicate, all answers acceptable
                     t                  ; require match
                     initial-input
                     )))

(partial-completion-mode 1)
(setq PC-meta-flag t)

(completion-test-4 "getmilli" t)
;; user types:  M-TAB    [normal completion]
;; result:  getMillis    [chooses the element that matches modulo case]
;; user types:  RET      [partial completion]
;; result:  getmillis    [problem:  all lower-case, second RET doesn't select]

;; Actually, it seems like a problem that normal completion chooses the
;; matching element immediately rather than giving a list of all
;; possibilities.  Is this a bug in normal completion?

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

* Re: [cjm@pobox.com: Case-insensitive partial-completion bug]
  2006-11-20 14:21     ` Michael Ernst
@ 2006-11-21  7:47       ` Richard Stallman
  2006-11-21 14:20         ` Michael Ernst
  2007-03-02  1:18       ` Johan Bockgård
  1 sibling, 1 reply; 10+ messages in thread
From: Richard Stallman @ 2006-11-21  7:47 UTC (permalink / raw)
  Cc: triska, eliz, emacs-devel

We are going to release Emacs 22 soon.  Would you please make time to
fix this bug?

I hope you'll respond to this message with a fix.

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

* Re: [cjm@pobox.com: Case-insensitive partial-completion bug]
  2006-11-21  7:47       ` Richard Stallman
@ 2006-11-21 14:20         ` Michael Ernst
  2006-11-22 13:16           ` Richard Stallman
  0 siblings, 1 reply; 10+ messages in thread
From: Michael Ernst @ 2006-11-21 14:20 UTC (permalink / raw)
  Cc: triska, eliz, emacs-devel

> We are going to release Emacs 22 soon.  Would you please make time to
> fix this bug?

I will try to find the time.  (The code is undocumented and poorly
structured, so it is tricky to make changes without negative effects.)

I'm glad that Emacs 22 will be released soon.

                    -Michael Ernst
                     mernst@alum.mit.edu

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

* Re: [cjm@pobox.com: Case-insensitive partial-completion bug]
  2006-11-21 14:20         ` Michael Ernst
@ 2006-11-22 13:16           ` Richard Stallman
  0 siblings, 0 replies; 10+ messages in thread
From: Richard Stallman @ 2006-11-22 13:16 UTC (permalink / raw)
  Cc: triska, eliz, emacs-devel

    I will try to find the time.  (The code is undocumented and poorly
    structured, so it is tricky to make changes without negative effects.)

How about first adding some comments?

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

* Re: [cjm@pobox.com: Case-insensitive partial-completion bug]
  2006-11-20 14:21     ` Michael Ernst
  2006-11-21  7:47       ` Richard Stallman
@ 2007-03-02  1:18       ` Johan Bockgård
  2007-03-03 22:13         ` Richard Stallman
  1 sibling, 1 reply; 10+ messages in thread
From: Johan Bockgård @ 2007-03-02  1:18 UTC (permalink / raw)
  To: emacs-devel


I hope the bug below will get fixed. I run into it quite frequently
when reading Info:

  emacs -Q -f partial-completion-mode -f info-emacs-manual

  `g mark RET' doesn't select and exit minibuffer.


On Mon, Nov 20 2006, Michael Ernst wrote:

>> The complaint was:
>> 
>>     I expected it to change "foo" to "Foo", because all possible
>>     completions begin with "Foo".  That's what it does if you don't enable
>>     partial-completion-mode.  But with partial-completion-mode enabled, it
>>     stays "foo" and Emacs displays the list of possible completions.
>> 
>> Michael Ernst wrote the patch which implemented this behavior.
>> 
>> Michael, why is it desirable for partial-completion mode to handle
>> this case differently from ordinary completion?
>
> Thanks for forwarding the bug report.  I'm aware of this problem, and I
> agree it should be fixed, but I haven't yet found time to correct it
> (though it remains on my to-do list).  I have noticed it once in the 6
> months I have been using the new code, and the new code corrects problems
> that I noticed much more frequently.
>
> My notes state that the problem is near the "same char (modulo case); no
> action" comment, and near
>
> 		  ;; Retain capitalization of user input even if
> 		  ;; completion-ignore-case is set.
>
> If the list `poss' has many possibilities with different capitalization,
> then we want to retain the capitalization as input by the user.  However,
> if they are all the same, we want to adjust the capitalization.
>
> Below my signature is a test case that illustrates the problem in a
> reproducible way.
>
>                     -Michael Ernst
>                      mernst@alum.mit.edu
>
>
>
> (defun completion-test-4 (initial-input &optional ignore-case)
>   (let ((completion-ignore-case ignore-case))
>     (completing-read "Input: "
>                      '(("getMillis" . 1)
>                        ("getMillisToDecideToPopup" . 2)
>                        ("getMillisToPopup" . 3)
>                        ("getMillisecond" . 4))
>                      nil                ; no predicate, all answers acceptable
>                      t                  ; require match
>                      initial-input
>                      )))
>
> (partial-completion-mode 1)
> (setq PC-meta-flag t)
>
> (completion-test-4 "getmilli" t)
> ;; user types:  M-TAB    [normal completion]
> ;; result:  getMillis    [chooses the element that matches modulo case]
> ;; user types:  RET      [partial completion]
> ;; result:  getmillis    [problem:  all lower-case, second RET doesn't select]
>
> ;; Actually, it seems like a problem that normal completion chooses the
> ;; matching element immediately rather than giving a list of all
> ;; possibilities.  Is this a bug in normal completion?

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

* Re: [cjm@pobox.com: Case-insensitive partial-completion bug]
  2007-03-02  1:18       ` Johan Bockgård
@ 2007-03-03 22:13         ` Richard Stallman
  2007-03-04 18:30           ` Chong Yidong
  0 siblings, 1 reply; 10+ messages in thread
From: Richard Stallman @ 2007-03-03 22:13 UTC (permalink / raw)
  To: Johan Bockgård; +Cc: emacs-devel

    I hope the bug below will get fixed. I run into it quite frequently
    when reading Info:

      emacs -Q -f partial-completion-mode -f info-emacs-manual

      `g mark RET' doesn't select and exit minibuffer.

I don't use Partial Completion mode.  Is this a bug in it?
It looks that way, but I can't be sure.

If it is, does anyone want to fix it?

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

* Re: [cjm@pobox.com: Case-insensitive partial-completion bug]
  2007-03-03 22:13         ` Richard Stallman
@ 2007-03-04 18:30           ` Chong Yidong
  0 siblings, 0 replies; 10+ messages in thread
From: Chong Yidong @ 2007-03-04 18:30 UTC (permalink / raw)
  To: rms; +Cc: emacs-devel, Johan Bockgård

Richard Stallman <rms@gnu.org> writes:

>     I hope the bug below will get fixed. I run into it quite frequently
>     when reading Info:
>
>       emacs -Q -f partial-completion-mode -f info-emacs-manual
>
>       `g mark RET' doesn't select and exit minibuffer.
>
> I don't use Partial Completion mode.  Is this a bug in it?
> It looks that way, but I can't be sure.
>
> If it is, does anyone want to fix it?

I think this is an oversight in the logic of `PC-do-completion'.  The
following patch should fix it.

*** emacs/lisp/complete.el.~1.59.~	2007-01-21 08:38:26.000000000 -0500
--- emacs/lisp/complete.el	2007-03-04 13:28:25.000000000 -0500
***************
*** 404,411 ****
  
      ;; Check if buffer contents can already be considered complete
      (if (and (eq mode 'exit)
! 	     (test-completion-ignore-case str table pred))
! 	'complete
  
        ;; Do substitutions in directory names
        (and filename
--- 404,418 ----
  
      ;; Check if buffer contents can already be considered complete
      (if (and (eq mode 'exit)
! 	     (test-completion str table pred))
! 	(progn
! 	  ;; If completion-ignore-case is non-nil, insert the
! 	  ;; completion string since that may have a different case.
! 	  (when completion-ignore-case
! 	    (setq str (try-completion str table pred))
! 	    (delete-region beg end)
! 	    (insert str))
! 	  'complete)
  
        ;; Do substitutions in directory names
        (and filename

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

end of thread, other threads:[~2007-03-04 18:30 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-11-13 20:15 [cjm@pobox.com: Case-insensitive partial-completion bug] Richard Stallman
2006-11-13 20:44 ` Markus Triska
2006-11-15  3:14   ` Richard Stallman
2006-11-20 14:21     ` Michael Ernst
2006-11-21  7:47       ` Richard Stallman
2006-11-21 14:20         ` Michael Ernst
2006-11-22 13:16           ` Richard Stallman
2007-03-02  1:18       ` Johan Bockgård
2007-03-03 22:13         ` Richard Stallman
2007-03-04 18:30           ` Chong Yidong

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