From: Alan Schmitt <alan.schmitt@polytechnique.org>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: emacs-devel@gnu.org
Subject: Re: completion discrepancy between default completion and helm/ivy completions
Date: Mon, 14 Nov 2016 14:22:54 +0100 [thread overview]
Message-ID: <m2vavqxkk1.fsf@polytechnique.org> (raw)
In-Reply-To: <jwv7f87e6j4.fsf-monnier+gmane.emacs.devel@gnu.org> (Stefan Monnier's message of "Sun, 13 Nov 2016 10:38:35 -0500")
[-- Attachment #1: Type: text/plain, Size: 2129 bytes --]
On 2016-11-13 10:38, Stefan Monnier <monnier@iro.umontreal.ca> writes:
>> Is it correct to register as a completion something that returns a
>> string?
>
> I don't understand the question: register where? return a string in
> which case?
Thank you for bearing with me, here are the details.
org-contacts adds completions hooks to message mode:
(when (and org-contacts-enable-completion
(boundp 'completion-at-point-functions))
(add-hook 'message-mode-hook 'org-contacts-setup-completion-at-point))
which does
(defun org-contacts-setup-completion-at-point ()
"Add `org-contacts-message-complete-function' as a new function
to complete the thing at point."
(add-to-list 'completion-at-point-functions
'org-contacts-message-complete-function))
That function basically checks if this is a place where completion
should happen (To field, for instance), then calls all the
org-contacts-complete-functions until one succeeds. One such function is
org-contacts-complete-group that, in some case, returns a function
taking unused arguments and returning the completion as a string. To
summarize, is it okay for a function in completion-at-point-functions to
return such a function? The docstring seems to say it's OK (except the
function returned should not have any argument), but discouraged. I
guess I should try to return something of the form (start end collection
. props) instead, with collection being a singleton…
>> Because it is what org-contacts does, but although it works with
>> the default completion code, it breaks ivy or helm style completions.
>
> AFAIK those frameworks probably don't handle well completion tables
> which use completion-boundaries, so I'd lean towards saying it's a bug
> or a known limitation of those frameworks. But I haven't looked at them
> in a long while, so maybe this isn't true any more.
Thank you for your help, I'm starting to understand what is going on.
I'll keep digging.
Best,
Alan
--
OpenPGP Key ID : 040D0A3B4ED2E5C7
Monthly Athmospheric CO₂, Mauna Loa Obs. 2016-10: 401.57, 2015-10: 398.29
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 454 bytes --]
next prev parent reply other threads:[~2016-11-14 13:22 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-10 11:22 completion discrepancy between default completion and helm/ivy completions Alan Schmitt
2016-11-10 20:35 ` Stefan Monnier
2016-11-13 13:05 ` Alan Schmitt
2016-11-13 15:38 ` Stefan Monnier
2016-11-14 13:22 ` Alan Schmitt [this message]
2016-11-14 14:20 ` Stefan Monnier
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=m2vavqxkk1.fsf@polytechnique.org \
--to=alan.schmitt@polytechnique.org \
--cc=emacs-devel@gnu.org \
--cc=monnier@iro.umontreal.ca \
/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.