From: Arash Esbati <arash@gnu.org>
To: Julien Cubizolles <j.cubizolles@free.fr>
Cc: ding@gnus.org, Thomas Fitzsimmons <fitzsim@fitzsim.org>
Subject: Re: completion no more working with latest HEADs (emacs and bbdb)
Date: Mon, 23 Jan 2023 15:05:20 +0100 [thread overview]
Message-ID: <867cxdny73.fsf@gnu.org> (raw)
In-Reply-To: <87ilgx8uh1.fsf@free.fr> (Julien Cubizolles's message of "Mon, 23 Jan 2023 10:34:50 +0100")
Julien Cubizolles <j.cubizolles@free.fr> writes:
> It's not working in GNU Emacs 30.0.50 in emacs -Q with this setup and
> your recipe:
>
> (setq eudc-server-hotlist '(("localhost" . bbdb)))
>
> (add-hook 'message-mode-hook
> (lambda ()
> (setq-local completion-at-point-functions
> (delq 'message-completion-function
> completion-at-point-functions))))
>
> Pressing TAB after typing the beginning of a name in the To: field only
> inserts a tabulation, whereas (bbdb-complete-mail) finds several
> matches.
Thanks for reminding me; I can confirm this behavior and didn't look at
it again back then. FTR, I have an entry for `eudc-capf-complete' in my
`completion-at-point-functions' in message-mode. `eudc-capf-complete'
calls `eudc-capf-message-expand-name' which is defined like this:
--8<---------------cut here---------------start------------->8---
(defun eudc-capf-message-expand-name ()
"Email address completion function for `message-completion-alist'.
[...]"
(if (or eudc-server eudc-server-hotlist)
(progn
(let* ((beg (save-excursion
(re-search-backward "\\([:,]\\|^\\)[ \t]*")
(match-end 0)))
;; ^^^^^^^^
(end (point))
(prefix (save-excursion (buffer-substring-no-properties beg end))))
(let ((result
(eudc-query-with-words (split-string prefix "[ \t]+") t)))
(when result
(list beg end
(completion-table-with-cache
(lambda (_) result) t))))))))
--8<---------------cut here---------------end--------------->8---
While searching back, it picks up the `match-end' which will not work
for the case where you the beginning of the name in your BBDB database.
A change like this should fix it:
--8<---------------cut here---------------start------------->8---
(defun eudc-capf-message-expand-name ()
"Email address completion function for `message-completion-alist'.
[...]"
(if (or eudc-server eudc-server-hotlist)
(progn
(let* ((beg (save-excursion
;; change follows:
(if (member (char-before) '(?, ?: ?\s))
(progn
(re-search-backward "\\([:,]\\|\\^\\)[ \t]*")
(match-end 0))
(skip-chars-backward "[:alnum:]"
(line-beginning-position))
(point))))
(end (point))
(prefix (buffer-substring-no-properties beg end)))
(let ((result
(eudc-query-with-words (split-string prefix "[ \t]+") t)))
(when result
(list beg end
(completion-table-with-cache
(lambda (_) result) t))))))))
--8<---------------cut here---------------end--------------->8---
@Thomas: Can you please have a look at this issue? I think this is
still related to bug#59314. TIA.
Best, Arash
next prev parent reply other threads:[~2023-01-23 14:07 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-15 13:29 Peter Münster
2022-11-15 17:04 ` Peter Münster
2022-11-15 21:31 ` Eric Abrahamsen
2022-11-16 7:48 ` Arash Esbati
2022-11-16 8:46 ` Peter Münster
2022-11-16 8:58 ` Arash Esbati
2022-11-16 10:05 ` Peter Münster
2022-11-16 11:43 ` Arash Esbati
2022-11-16 16:17 ` Eric Abrahamsen
2023-01-23 9:34 ` Julien Cubizolles
2023-01-23 14:05 ` Arash Esbati [this message]
2023-01-23 15:22 ` Arash Esbati
2023-01-23 23:14 ` Julien Cubizolles
2023-01-24 12:37 ` Arash Esbati
2023-01-25 21:09 ` Julien Cubizolles
2023-01-27 8:42 ` Arash Esbati
2023-01-27 18:45 ` Eric Abrahamsen
2023-01-31 12:46 ` Julien Cubizolles
2023-02-02 9:48 ` Arash Esbati
2023-02-03 5:31 ` Julien Cubizolles
2023-02-03 11:04 ` Arash Esbati
2023-02-13 17:29 ` Julien Cubizolles
2023-01-24 8:32 ` Julien Cubizolles
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=867cxdny73.fsf@gnu.org \
--to=arash@gnu.org \
--cc=ding@gnus.org \
--cc=fitzsim@fitzsim.org \
--cc=j.cubizolles@free.fr \
/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.
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 NNTP newsgroup(s).