From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Ulrich Mueller <ulm@gentoo.org>
Cc: emacs-pretest-bug@gnu.org, 1797@emacsbugs.donarmstrong.com
Subject: bug#1797: 23.0.60; completing-read breaks backwards compatibility
Date: Mon, 05 Jan 2009 23:24:54 -0500 [thread overview]
Message-ID: <jwvfxjxgjm0.fsf-monnier+emacsbugreports@gnu.org> (raw)
In-Reply-To: <18786.40315.242106.507079@a1ihome1.kph.uni-mainz.de> (Ulrich Mueller's message of "Tue, 6 Jan 2009 00:53:31 +0100")
>> 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
next prev parent reply other threads:[~2009-01-06 4:24 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-01-05 23:53 bug#1797: 23.0.60; completing-read breaks backwards compatibility Ulrich Mueller
2009-01-06 4:24 ` Stefan Monnier [this message]
2009-01-06 9:34 ` Ulrich Mueller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=jwvfxjxgjm0.fsf-monnier+emacsbugreports@gnu.org \
--to=monnier@iro.umontreal.ca \
--cc=1797@emacsbugs.donarmstrong.com \
--cc=emacs-pretest-bug@gnu.org \
--cc=ulm@gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.