unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@IRO.UMontreal.CA>
To: emacs-devel@gnu.org
Cc: Eric Abrahamsen <eric@ericabrahamsen.net>
Subject: Re: [elpa] externals/ebdb 9e7a96f: Add experimental ebdb-completion-at-point-function
Date: Fri, 23 Mar 2018 01:18:51 -0400	[thread overview]
Message-ID: <jwv605njs69.fsf-monnier+emacsdiffs@gnu.org> (raw)
In-Reply-To: <20180323044823.1A70C20BDE@vcs0.savannah.gnu.org> (Eric Abrahamsen's message of "Fri, 23 Mar 2018 00:48:22 -0400 (EDT)")

> +;; 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	other threads:[~2018-03-23  5:18 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20180323044822.32467.63948@vcs0.savannah.gnu.org>
     [not found] ` <20180323044823.1A70C20BDE@vcs0.savannah.gnu.org>
2018-03-23  5:18   ` Stefan Monnier [this message]
2018-03-23  5:50     ` [elpa] externals/ebdb 9e7a96f: Add experimental ebdb-completion-at-point-function Eric Abrahamsen
2018-03-23 10:54       ` Thomas Fitzsimmons
2018-03-23 12:10         ` Eric Abrahamsen
2018-03-23 12:11       ` Eric Abrahamsen
2018-03-23 12:23       ` Stefan Monnier
2018-04-14  1:02         ` Completion functions in message-mode (was: [elpa] externals/ebdb 9e7a96f: Add experimental ebdb-completion-at-point-function) Eric Abrahamsen
2018-04-14  1:17           ` Completion functions in message-mode Stefan Monnier
2018-04-14  2:33             ` Eric Abrahamsen
2018-04-14 17:37               ` Stefan Monnier
2018-04-25 19:24                 ` Eric Abrahamsen
2018-06-06 21:09                   ` Eric Abrahamsen
2018-04-14 12:59           ` Lars Ingebrigtsen
2018-04-14 16:17             ` Eric Abrahamsen

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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jwv605njs69.fsf-monnier+emacsdiffs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=emacs-devel@gnu.org \
    --cc=eric@ericabrahamsen.net \
    /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 public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).