all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [bojohan+news@dd.chalmers.se: change to try-completion behavior]
@ 2007-03-05  2:56 Richard Stallman
  2007-03-06  3:22 ` Chong Yidong
  0 siblings, 1 reply; 3+ messages in thread
From: Richard Stallman @ 2007-03-05  2:56 UTC (permalink / raw)
  To: emacs-devel

Would someone please try to debug this?
Please ack if you have worked on this.

------- Start of forwarded message -------
Mail-Followup-To: emacs-devel@gnu.org
To: emacs-devel@gnu.org
From: bojohan+news@dd.chalmers.se (Johan =?utf-8?Q?Bockg=C3=A5rd?=)
Date: Thu, 22 Feb 2007 19:33:08 +0100
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8
Mail-Copies-To: never
Subject: change to try-completion behavior
X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=failed 
	version=3.0.4

There was an old thread in gnu.emacs.help (see below) about the change
in behavior of try-completion in CVS.

This code

  (let ((completion-ignore-case t))
       (try-completion "w" '(("W") ("Write") ("w"))))

returns "W" in Emacs 22. In Emacs 21 is used to return "w", that is
the best match _including_ case.

I should have said in that discussion that I think that this is a
bug/regression. Ftry_completion contains this comment:

  /* If there is more than one exact match ignoring case, and one of
     them is exact including case, prefer that one. */

The new short-circuiting behavior means that this note is not true in
general.



http://article.gmane.org/gmane.emacs.help/32010


From: Johan Bockgård <bojohan+news <at> dd.chalmers.se>
Subject: Re: change to try-completion behavior in 21.3?
Newsgroups: gmane.emacs.help
Date: 2005-12-17 06:49:54 GMT

Stefan Monnier <monnier <at> iro.umontreal.ca> writes:

>> Why should it ever return the capital letter W?
>
> Because in your completion table, you have "W".

"w" was also in the table.

This change

  revision 1.237
  date: 2002-04-09 19:28:42 +0000;  author: monnier;  state: Exp; lines: +89 -47 [...]
  (Ftry_completion): Allow lambda forms and lists of strings for
  `alist'.
  Short-circuit the search as soon as it "failed". [...]

added this piece of code (approximately)

  if (matchsize <= SCHARS (string)
      && matchcount > 1)
    /* No need to look any further.  */
    break;

When completion-ignore-case is t this doesn't necessarily find the
best match _including case_ (AFAICS).


- -- 
Johan Bockgård



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

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

* Re: [bojohan+news@dd.chalmers.se: change to try-completion behavior]
  2007-03-05  2:56 [bojohan+news@dd.chalmers.se: change to try-completion behavior] Richard Stallman
@ 2007-03-06  3:22 ` Chong Yidong
  2007-03-06 14:50   ` Stefan Monnier
  0 siblings, 1 reply; 3+ messages in thread
From: Chong Yidong @ 2007-03-06  3:22 UTC (permalink / raw)
  To: Johan Bockgård; +Cc: rms, emacs-devel

> There was an old thread in gnu.emacs.help (see below) about the change
> in behavior of try-completion in CVS.
>
> This code
>
>   (let ((completion-ignore-case t))
>        (try-completion "w" '(("W") ("Write") ("w"))))
>
> returns "W" in Emacs 22. In Emacs 21 is used to return "w", that is
> the best match _including_ case.
>
> I should have said in that discussion that I think that this is a
> bug/regression. Ftry_completion contains this comment:
>
>   /* If there is more than one exact match ignoring case, and one of
>      them is exact including case, prefer that one. */
>
> The new short-circuiting behavior means that this note is not true in
> general.
>
> http://article.gmane.org/gmane.emacs.help/32010

The thread you cited suggested the following patch.  Does it work
satisfactorily?

*** emacs/src/minibuf.c.~1.326.~	2007-02-23 11:24:42.000000000 -0500
--- emacs/src/minibuf.c	2007-03-05 22:20:35.000000000 -0500
***************
*** 1483,1488 ****
--- 1483,1489 ----
  		matchcount++;
  	      bestmatchsize = matchsize;
  	      if (matchsize <= SCHARS (string)
+ 		  && !completion_ignore_case
  		  && matchcount > 1)
  		/* No need to look any further.  */
  		break;

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

* Re: [bojohan+news@dd.chalmers.se: change to try-completion behavior]
  2007-03-06  3:22 ` Chong Yidong
@ 2007-03-06 14:50   ` Stefan Monnier
  0 siblings, 0 replies; 3+ messages in thread
From: Stefan Monnier @ 2007-03-06 14:50 UTC (permalink / raw)
  To: Chong Yidong; +Cc: emacs-devel, rms, Johan Bockgård

> *** emacs/src/minibuf.c.~1.326.~	2007-02-23 11:24:42.000000000 -0500
> --- emacs/src/minibuf.c	2007-03-05 22:20:35.000000000 -0500
> ***************
> *** 1483,1488 ****
> --- 1483,1489 ----
>   		matchcount++;
>   	      bestmatchsize = matchsize;
>   	      if (matchsize <= SCHARS (string)
> + 		  && !completion_ignore_case
>   		  && matchcount > 1)
>   		/* No need to look any further.  */
>   		break;

Looks correct, but deserves a comment.


        Stefan

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

end of thread, other threads:[~2007-03-06 14:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-03-05  2:56 [bojohan+news@dd.chalmers.se: change to try-completion behavior] Richard Stallman
2007-03-06  3:22 ` Chong Yidong
2007-03-06 14:50   ` Stefan Monnier

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.