[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: completion discrepancy between default completion and helm/ivy compl

From: Alan Schmitt
Subject: Re: completion discrepancy between default completion and helm/ivy completions
Date: Mon, 14 Nov 2016 14:22:54 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (darwin)

On 2016-11-13 10:38, Stefan Monnier <address@hidden> 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

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.



OpenPGP Key ID : 040D0A3B4ED2E5C7
Monthly Athmospheric CO₂, Mauna Loa Obs. 2016-10: 401.57, 2015-10: 398.29

Attachment: signature.asc
Description: PGP signature

reply via email to

[Prev in Thread] Current Thread [Next in Thread]