unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Eric Abrahamsen <eric@ericabrahamsen.net>
To: emacs-devel@gnu.org
Subject: Re: [elpa] externals/ebdb 9e7a96f: Add experimental ebdb-completion-at-point-function
Date: Fri, 23 Mar 2018 20:11:57 +0800	[thread overview]
Message-ID: <87tvt756uq.fsf@ericabrahamsen.net> (raw)
In-Reply-To: 877eq3732w.fsf@ericabrahamsen.net

Eric Abrahamsen <eric@ericabrahamsen.net> writes:

> Stefan Monnier <monnier@IRO.UMontreal.CA> writes:
>
>>> +;; 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.

[...]

> My only reservation is that BBDB/EBDB mail completion first completes a
> contact mail address, and subsequently cycles through that contact's
> other addresses. Is this something that the standard mechanisms can
> replicate?

Never mind, obviously the completion functions can do whatever they like
with the string to be completed.




  parent reply	other threads:[~2018-03-23 12:11 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   ` [elpa] externals/ebdb 9e7a96f: Add experimental ebdb-completion-at-point-function Stefan Monnier
2018-03-23  5:50     ` Eric Abrahamsen
2018-03-23 10:54       ` Thomas Fitzsimmons
2018-03-23 12:10         ` Eric Abrahamsen
2018-03-23 12:11       ` Eric Abrahamsen [this message]
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=87tvt756uq.fsf@ericabrahamsen.net \
    --to=eric@ericabrahamsen.net \
    --cc=emacs-devel@gnu.org \
    /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).