GNU bug report logs -
#1797
23.0.60; completing-read breaks backwards compatibility
Previous Next
Reported by: Ulrich Mueller <ulm <at> gentoo.org>
Date: Tue, 6 Jan 2009 00:00:02 UTC
Severity: normal
Done: Chong Yidong <cyd <at> stupidchicken.com>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 1797 in the body.
You can then email your comments to 1797 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>
:
bug#1797
; Package
emacs
.
(Tue, 06 Jan 2009 00:00:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Ulrich Mueller <ulm <at> gentoo.org>
:
New bug report received and forwarded. Copy sent to
Emacs Bugs <bug-gnu-emacs <at> gnu.org>
.
(Tue, 06 Jan 2009 00:00:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> emacsbugs.donarmstrong.com (full text, mbox):
>>>>> On Mon, 05 Jan 2009, Stefan Monnier wrote:
>> Also, the different behaviour of `completing-read' breaks backwards
>> compatibility. In fact, I stumbled across this because of some lisp
>> code doing "programmed completion", which doesn't work properly
>> with Emacs 23 anymore (because it accounts only for nil, t, and
>> `lambda').
> The intention is for it to 100% backwards compatible. So please
> report this bug.
Here we go.
To reproduce the problem, eval the following code:
(defvar my-keywords '("foo" "bar" "baz" "quux" "quuux"))
(defun my-complete (s pred mode)
(string-match "^\\(.*\\s-\\)?\\(.*\\)$" s)
(let* ((s1 (match-string 1 s))
(s2 (match-string 2 s))
(c2 (funcall
(cond ((null mode) 'try-completion)
((eq mode t) 'all-completions)
((eq mode 'lambda)
(if (fboundp 'test-completion)
'test-completion
;; XEmacs doesn't have test-completion
(lambda (&rest args)
(eq (apply 'try-completion args) t))))
(t 'ignore))
s2
(mapcar (lambda (x) (list (concat x " ")))
my-keywords)
pred)))
(if (stringp c2) (concat s1 c2) c2)))
(completing-read "Type some keywords: " 'my-complete)
Now type at the minibuffer prompt:
f TAB b TAB TAB
Emacs 21/22 (and XEmacs) behaviour:
Minibuffer: "Type some keywords: foo ba"
*Completions* buffer offers "bar" and "baz" as completions.
Emacs 23.0.60 behaviour:
Minibuffer: "Type some keywords: foo ba [No completions]"
(and no *Completions* buffer appears)
Information forwarded
to
bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>
:
bug#1797
; Package
emacs
.
(Tue, 06 Jan 2009 04:30:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Stefan Monnier <monnier <at> iro.umontreal.ca>
:
Extra info received and forwarded to list. Copy sent to
Emacs Bugs <bug-gnu-emacs <at> gnu.org>
.
(Tue, 06 Jan 2009 04:30:02 GMT)
Full text and
rfc822 format available.
Message #10 received at submit <at> emacsbugs.donarmstrong.com (full text, mbox):
>> The intention is for it to 100% backwards compatible. So please
>> report this bug.
> Here we go.
> To reproduce the problem, eval the following code:
Thanks. I installed a change which I believe should fix this bug.
Note that your completion function is a prime example of a completion
table that needs completion-boundaries in order to work right.
E.g. with the function as it is defined, the *Completions* buffer has
several bugs: clicking on "bar" will replace "foo ba" with "bar" rather
than with "foo bar", and the completions-common-part hilighting
is incorrect.
If you add the code below:
> (defun my-complete (s pred mode)
> (string-match "^\\(.*\\s-\\)?\\(.*\\)$" s)
> (let* ((s1 (match-string 1 s))
> (s2 (match-string 2 s))
> (c2 (funcall
> (cond ((null mode) 'try-completion)
> ((eq mode t) 'all-completions)
> ((eq mode 'lambda)
> (if (fboundp 'test-completion)
> 'test-completion
> ;; XEmacs doesn't have test-completion
> (lambda (&rest args)
> (eq (apply 'try-completion args) t))))
((eq (car-safe mode) 'boundaries)
(lexical-let* ((suffix (cdr mode))
(start (or (match-end 1) 0))
(end (string-match "\\s-" suffix)))
(lambda (s table pred)
`(boundaries ,start . ,end))))
> (t 'ignore))
> s2
> (mapcar (lambda (x) (list (concat x " ")))
> my-keywords)
> pred)))
> (if (stringp c2) (concat s1 c2) c2)))
You'll see that the completions-common-part highlighting is correct, and
you can even complete "fo ba" to "foo ba" if point is after "fo" when
you hit TAB.
Stefan
Information forwarded
to
bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>
:
bug#1797
; Package
emacs
.
(Tue, 06 Jan 2009 04:30:03 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Stefan Monnier <monnier <at> iro.umontreal.ca>
:
Extra info received and forwarded to list. Copy sent to
Emacs Bugs <bug-gnu-emacs <at> gnu.org>
.
(Tue, 06 Jan 2009 04:30:04 GMT)
Full text and
rfc822 format available.
Information forwarded
to
bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>
:
bug#1797
; Package
emacs
.
(Tue, 06 Jan 2009 09:45:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Ulrich Mueller <ulm <at> gentoo.org>
:
Extra info received and forwarded to list. Copy sent to
Emacs Bugs <bug-gnu-emacs <at> gnu.org>
.
(Tue, 06 Jan 2009 09:45:03 GMT)
Full text and
rfc822 format available.
Message #20 received at submit <at> emacsbugs.donarmstrong.com (full text, mbox):
>>>>> On Mon, 05 Jan 2009, Stefan Monnier wrote:
> Thanks. I installed a change which I believe should fix this bug.
I confirm that today's CVS trunk is working as expected.
> Note that your completion function is a prime example of a completion
> table that needs completion-boundaries in order to work right.
> ((eq (car-safe mode) 'boundaries)
> (lexical-let* ((suffix (cdr mode))
> (start (or (match-end 1) 0))
> (end (string-match "\\s-" suffix)))
> (lambda (s table pred)
> `(boundaries ,start . ,end))))
Hey, I had already come to a very similar solution: ;-)
(defun my-complete (s pred mode)
(string-match "^\\(.*\\s-\\)?\\(.*\\)$" s)
+ (if (eq (car-safe mode) 'boundaries) ; GNU Emacs 23
+ (cons 'boundaries
+ (cons (match-beginning 2)
+ (string-match "\\s-" (cdr mode))))
(let* ((s1 (match-string 1 s))
(s2 (match-string 2 s))
It cost me quite some time to get this right, because of the missing
documentation.
Ulrich
Information forwarded
to
bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>
:
bug#1797
; Package
emacs
.
(Tue, 06 Jan 2009 09:45:04 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Ulrich Mueller <ulm <at> gentoo.org>
:
Extra info received and forwarded to list. Copy sent to
Emacs Bugs <bug-gnu-emacs <at> gnu.org>
.
(Tue, 06 Jan 2009 09:45:04 GMT)
Full text and
rfc822 format available.
bug closed, send any further explanations to Ulrich Mueller <ulm <at> gentoo.org>
Request was from
Chong Yidong <cyd <at> stupidchicken.com>
to
control <at> emacsbugs.donarmstrong.com
.
(Tue, 13 Jan 2009 14:25:04 GMT)
Full text and
rfc822 format available.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> emacsbugs.donarmstrong.com
.
(Tue, 10 Feb 2009 15:24:09 GMT)
Full text and
rfc822 format available.
This bug report was last modified 16 years and 174 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.