emacs-devel
[Top][All Lists]
Advanced

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

Re: Documentation about the completion framework


From: Daniele Nicolodi
Subject: Re: Documentation about the completion framework
Date: Mon, 21 Jan 2019 19:02:47 -0700
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:60.0) Gecko/20100101 Thunderbird/60.4.0

Hi Stefan,

On 21/01/2019 14:17, Stefan Monnier wrote:
> Yes: don't collect candidates when that function is called.
> Instead, the function should return a completion table which will
> compute the candidates only if it's called.  E.g.:
> 
>     (defun my-completion-at-point-function ()
>       (when (relevant)
>         (let (candidates
>               (candidates-computed nil)
>               (start ...)
>               (end ...)
>               (completion-table
>                (lambda (string pred action)
>                  (unless candidates-computed
>                    (setq candidates-computed t)
>                    (setq candidates (my-collect-candidates)))
>                  (complete-with-action action candidates string pred))))
>           (list start end completion-table))))

Trying to understand this code: how is this different from computing
candidates directly in my-completion-at-point-function and passing it down?

I must be missing something.

Thank you!

Cheers,
Dan



reply via email to

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