> Looks like you added that FIXME! If you outline how you think this ought > to look, I can take a stab at patching message.el. At what level should > these functions be intervening? One of the main issue is preserving backward compatibility with existing functions the user may have set in message-completion-alist. I have already some local patches to try and do some of that, so see patch below (I hand-edited it to remove irrelevant other cosmetic changes, so don't try to pass it to `patch`). > 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? You can get cycling via completion-cycle-threshold, yes. Stefan diff --git a/lisp/gnus/message.el b/lisp/gnus/message.el index e452c80e26..c99708845d 100644 --- a/lisp/gnus/message.el +++ b/lisp/gnus/message.el @@ -7930,6 +7936,8 @@ message-tab (defvar mail-abbrev-mode-regexp) +(defvar message--old-style-completion-functions nil) + (defun message-completion-function () (let ((alist message-completion-alist)) (while (and alist @@ -7938,9 +7946,21 @@ message-completion-function (setq alist (cdr alist))) (when (cdar alist) (let ((fun (cdar alist))) - ;; Even if completion fails, return a non-nil value, so as to avoid - ;; falling back to message-tab-body-function. - (lambda () (funcall fun) 'completion-attempted))))) + (if (member fun message--old-style-completion-functions) + ;; Even if completion fails, return a non-nil value, so as to avoid + ;; falling back to message-tab-body-function. + (lambda () (funcall fun) 'completion-attempted) + (let ((ticks-before (buffer-chars-modified-tick)) + (data (funcall fun))) + (if (and (eq ticks-before (buffer-chars-modified-tick)) + (or (null data) + (integerp (car-safe data)))) + data + (push fun message--old-style-completion-functions) + ;; Completion was already performed, so just return a dummy + ;; function that prevents trying any further. + (lambda () 'completion-attempted)))))))) + (defun message-expand-group () "Expand the group name under point." @@ -7966,7 +8083,9 @@ message-expand-group group) collection)) gnus-active-hashtb)) - (completion-in-region b e collection))) + ;; FIXME: Add `category' metadata to the collection, so we can use + ;; substring matching on it. + (list b e collection))) (defun message-expand-name () (cond ((and (memq 'eudc message-expand-name-databases)
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4