Re: Questions on completion

"Roland Winkler" <[email protected]>
Newsgroups gmane.emacs.bbdb.user
Message-ID <[email protected]>
On Mon Oct 30 2017 Basil L. Contovounesios wrote:
> I keep records with full names (titles, middle names, etc.)
> in multiple scripts (Latin and Greek), but in emails I
> prefer to use abbreviated Latinised names, as they both are
> more universal and look better in my MUA.  I found the
> mail-name xfield to be a convenient place to store these.

Thank you, I see your point.  (I might do a similar thing in your
situation.)

> and advise bbdb-complete-mail to first pass the candidates it
> offers through bbdb-mua-summary-unify.

How does this go?  Is there a hook I overlooked?

(bbdb-complete-mail is not the most userfriendly piece of code if
you want to achieve something that is not yet implemented as an
option.)

> The only missing aspect of this approach is offering Latinised
> mail-names as completion candidates.

This can be implemented:

mail-name becomes another element of bbdb-completion-list.
Then these mail names must be hashed in bbdb-hashtable so that they
become available for completion.

(Please give me some time.)

> AFAICT, Emacs now provides two standard, high-level and
> configurable interfaces to arbitrary completion: in-buffer
> completion via completion-at-point/completion-in-region and
> minibuffer completion via completing-read.
> 
> At first glance, bbdb-complete-mail seems to emulate some of
> the work completion-at-point/completion-in-region
> could/should be doing, e.g. managing the *Completions*
> buffer.  Though I am not particularly familiar with the
> code, I have a feeling that bbdb-complete-mail could be
> simplified if it were refactored to use one of these
> built-in functions instead.

The general problem I see is that bbdb-complete-mail (and likewise
bbdb-completing-read-mails) is not performing ordinary completion.
In that sense, you could call these function names misnomers.  You
can type "Joh" to get John Smith's email address in BBDB
"[email protected]".  So what you type and what you get in the end can
be very different stories.  Also, bbdb-complete-mail provides
"cycling":  if you already have "[email protected]" and you run
bbdb-cmplete-mail again (because John Smith has multiple email
addresses in his BBDB record), you may get "[email protected]".

I am not aware of other emacs functions providing such behavior, nor
am I aware of other scenarios where such a behavior would be useful,
nor do I know how such behavior could be combined with other
completion frontends.  (I do not know anything about the frontends
you mentioned.)

Roland
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.