[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Completion with (:exclusive 'no) is called twice, and doesn't pass o
From: |
Stefan Monnier |
Subject: |
Re: Completion with (:exclusive 'no) is called twice, and doesn't pass over on sole completion. |
Date: |
Fri, 16 Mar 2012 13:20:19 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.0.94 (gnu/linux) |
> The completion in Emacs 24 is called twice. For example
> (defun foo-completion ()
> (when (save-excursion (re-search-backward "\\<\\w*" (point-at-bol) t))
> (let ((token (match-string-no-properties 0))
> (beg (match-beginning 0))
> (end (match-end 0)))
> (message "%s:" token)
> (when (= end (point))
> (list beg end (list "aaaa" "aaaaaaa" "bbbb" "truncat") :exclusive
> 'no)))))
> (add-to-list 'completion-at-point-functions 'foo-completion)
> ;; it is now (foo-completion lisp-completion-at-point t)
> Place your point at the end of 'aaaa and you try to complete. I am
> getting
> aaa:
> aaaa:
> in my message buffer. Which means the completion is called twice.
Not sure why, but not terribly problematic either.
> I hope this is not an intended behavior, as it might seriously
> interfere with custom completion. For example I might want to have
> a different behavior on the second consequent invocation of the
> completion (give a message, modify the candidates etc).
No, completion-at-point-functions should return completion data and
can't know what that data will be used for. Could be for TAB
completion, for on-the-fly popup completion à la auto-complete, for
display of the *Completions* buffer, or to decide whether we're still in
the same completion field (so as to pop-down the *Completions* buffer
when we leave that field), ...
> Second problem is that if the completion is sole, the handling is not
> passed over.
That's expected: completion is only passed over if the text doesn't
match any candidate.
Stefan
- Completion with (:exclusive 'no) is called twice, and doesn't pass over on sole completion., Vitalie Spinu, 2012/03/16
- Re: Completion with (:exclusive 'no) is called twice, and doesn't pass over on sole completion., Vitalie Spinu, 2012/03/16
- Re: Completion with (:exclusive 'no) is called twice, and doesn't pass over on sole completion.,
Stefan Monnier <=
- Re: Completion with (:exclusive 'no) is called twice, and doesn't pass over on sole completion., Vitalie Spinu, 2012/03/17
- Re: Completion with (:exclusive 'no) is called twice, and doesn't pass over on sole completion., Stefan Monnier, 2012/03/17
- Re: Completion with (:exclusive 'no) is called twice, and doesn't pass over on sole completion., Lennart Borgman, 2012/03/17
- Re: Completion with (:exclusive 'no) is called twice, and doesn't pass over on sole completion., Vitalie Spinu, 2012/03/17
- Re: Completion with (:exclusive 'no) is called twice, and doesn't pass over on sole completion., Stefan Monnier, 2012/03/17
- Re: Completion with (:exclusive 'no) is called twice, and doesn't pass over on sole completion., Vitalie Spinu, 2012/03/18
- Re: Completion with (:exclusive 'no) is called twice, and doesn't pass over on sole completion., Stefan Monnier, 2012/03/18
- Re: Completion with (:exclusive 'no) is called twice, and doesn't pass over on sole completion., Vitalie Spinu, 2012/03/18
- Re: Completion with (:exclusive 'no) is called twice, and doesn't pass over on sole completion., Stefan Monnier, 2012/03/18
- Re: Completion with (:exclusive 'no) is called twice, and doesn't pass over on sole completion., Vitalie Spinu, 2012/03/19