emacs-devel
[Top][All Lists]
Advanced

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

Re: [elpa] externals/ebdb 9e7a96f: Add experimental ebdb-completion-at-p


From: Stefan Monnier
Subject: Re: [elpa] externals/ebdb 9e7a96f: Add experimental ebdb-completion-at-point-function
Date: Fri, 23 Mar 2018 01:18:51 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

> +;; Experimental completion-at-point function.  I'm not sure this is a
> +;; good idea yet -- with a large enough EBDB database, nearly any
> +;; string is completable, meaning the other completion-at-point
> +;; functions will rarely get a chance.
> +(defun ebdb-completion-at-point-function ()
[...]
> +    (when completions
> +      (list start (point)
> +         (mapcar
> +          (lambda (str)
> +            ;; Gross.
> +            (if (string-match-p "@" str)
> +                str
> +              (capitalize str)))
> +          completions)
> +         '(:exclusive no)))))

Completion-at-point-functions are expected to be cheap/fast (it's normal
to call it in post-command-hook) and in order to work correctly the
completion table it returns should ideally not depend on the text
between START and END (i.e. it's OK to look at the text between
START..END in order to choose between an email completion table and
a file completion table, but it shouldn't throw away emails just
because they don't seem to match the text between START..END).

Also in order to be effective, you want them to be selective, e.g. only
match when we're pretty sure that the completion-table we return is
relevant (e.g. we're on a "To:" line in a message-mode buffer), so it
usually depends on the major mode in which it's used.

EBDB might elect not to provide a completion-at-point-function but
instead to provide only a completion-table (or a bunch of completion
tables).  Then message-mode could use that completion-table when it
determines that we're completing an email address.


        Stefan



reply via email to

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