[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[O] Re: Completing with anything
From: |
Julien Danjou |
Subject: |
[O] Re: Completing with anything |
Date: |
Mon, 21 Mar 2011 12:23:09 +0100 |
User-agent: |
Gnus/5.110016 (No Gnus v0.16) Emacs/24.0.50 (gnu/linux) |
On Fri, Mar 18 2011, Stefan Monnier wrote:
> There's a misunderstanding: AFAIK the patch sent by Tassilo does not
> make the completion-at-point-function return a "function that performs
> completion" but does properly return completion data (i.e. region start,
> region end, and completion table), part of which happens to be
> represented by a function.
> I.e. this is not one of the discouraged cases.
You're right, indeed!
But I do not see anywhere the fact that the completion collection can be
a function.
I only found the sentence:
"It would be consistent and clean for completion functions to allow
lambda expressions (lists that are functions) as well as function
symbols as COLLECTION, but this is impossible."
in (elisp) Programmed Completion.
Not sure it's really related to completion-at-point-functions, but well,
it's not making things clearer for me anyhow.
>> - Make completing code allows to replace the region being completed with
>> somethig that does not match at all.
>
> AFAIK that's already the case, tho it depends on lots of factors, such
> as what you mean by "completing code".
I meant the code in minibuffer.el
To be clear, the things that disturbs me is that this simple test case
does not work as I would like it to:
#+begin_src emacs-lisp
(defun jd:completion-at-point-test ()
(list (point-at-bol) (point) '("Steve" "John")))
(add-to-list 'completion-at-point-functions 'jd:completion-at-point-test)
#+end_src
If you run that code into a buffer, and then type in this same buffer:
L
And try to complete that "L" with M-x completion-at-point, it will say
"No match."
But if you do:
#+begin_src emacs-lisp
(defun jd:completion-at-point-test ()
(list (point-at-bol) (point) '("Lionel" "Steve" "John")))
(add-to-list 'completion-at-point-functions 'jd:completion-at-point-test)
#+end_src
And try to complete a "L", it will complete to Lionel. Just because
completion-at-point is trying to be smarter than my function,
re-guessing which items from the collection are good candidates.
Something my function already does (well, not in this example, but in
real life).
This is why I'm (kindly) finger pointing the "completing code in
minibuffer.el", but I might be wrong (and hope to be! :-)).
--
Julien Danjou
❱ http://julien.danjou.info
pgp5M1p4rzrDe.pgp
Description: PGP signature
- [O] Completing with anything (was: [Orgmode] Re: Announcing org-contacts, a bbdb-like contact manager for Org), Julien Danjou, 2011/03/18
- [O] Re: Completing with anything, Stefan Monnier, 2011/03/18
- [O] Re: Completing with anything,
Julien Danjou <=
- [O] Re: Completing with anything, Tassilo Horn, 2011/03/21
- [O] Re: Completing with anything, Julien Danjou, 2011/03/21
- [O] Re: Completing with anything, Tassilo Horn, 2011/03/21
- [O] Re: Completing with anything, Stefan Monnier, 2011/03/21
- [O] Re: Completing with anything, Julien Danjou, 2011/03/21
- [O] Re: Completing with anything, Stefan Monnier, 2011/03/21
- [O] Re: Completing with anything, Eric Abrahamsen, 2011/03/21
- Re: [O] Re: Completing with anything, Eric S Fraga, 2011/03/22
- [O] Re: Completing with anything, Eric Abrahamsen, 2011/03/22
- Re: [O] Re: Completing with anything, Julien Danjou, 2011/03/23