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.
Full log
View this message in rfc822 format
>> 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
This bug report was last modified 16 years and 183 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.