changeset 111841:25e3c2636c1f

* lisp/gnus/message.el: Use completion-at-point. (message-completion-function): New fun, extracted from message-tab. (message-mode): Use it for completion-at-point-functions. (message-tab): Use it and completion-at-point.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Mon, 06 Dec 2010 21:01:00 -0500
parents b050075901af
children 265c545c8f48
files lisp/gnus/ChangeLog lisp/gnus/message.el
diffstat 2 files changed, 24 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/gnus/ChangeLog	Tue Dec 07 01:21:09 2010 +0000
+++ b/lisp/gnus/ChangeLog	Mon Dec 06 21:01:00 2010 -0500
@@ -1,3 +1,10 @@
+2010-12-07  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* message.el: Use completion-at-point.
+	(message-completion-function): New fun, extracted from message-tab.
+	(message-mode): Use it for completion-at-point-functions.
+	(message-tab): Use it and completion-at-point.
+
 2010-12-07  Katsumi Yamaoka  <yamaoka@jpl.org>
 
 	* shr.el (shr-find-fill-point): Don't break a line after a kinsoku-bol
--- a/lisp/gnus/message.el	Tue Dec 07 01:21:09 2010 +0000
+++ b/lisp/gnus/message.el	Mon Dec 06 21:01:00 2010 -0500
@@ -277,7 +277,7 @@
 		 regexp))
 
 (defcustom message-ignored-mail-headers
-  "^[GF]cc:\\|^Resent-Fcc:\\|^Xref:\\|^X-Draft-From:\\|^X-Gnus-Agent-Meta-Information:"
+  "^\\([GF]cc\\|Resent-Fcc\\|Xref\\|X-Draft-From\\|X-Gnus-Agent-Meta-Information\\):"
   "*Regexp of headers to be removed unconditionally before mailing."
   :group 'message-mail
   :group 'message-headers
@@ -2914,6 +2914,7 @@
 	  (mail-aliases-setup))))
    ((message-mail-alias-type-p 'ecomplete)
     (ecomplete-setup)))
+  (add-hook 'completion-at-point-functions 'message-completion-function nil t)
   (unless buffer-file-name
     (message-set-auto-save-file-name))
   (unless (buffer-base-buffer)
@@ -7743,7 +7744,7 @@
   :type '(alist :key-type regexp :value-type function))
 
 (defcustom message-expand-name-databases
-  (list 'bbdb 'eudc)
+  '(bbdb eudc)
   "List of databases to try for name completion (`message-expand-name').
 Each element is a symbol and can be `bbdb' or `eudc'."
   :group 'message
@@ -7765,15 +7766,25 @@
 Execute function specified by `message-tab-body-function' when not in
 those headers."
   (interactive)
+  (cond
+   ((if (and (boundp 'completion-fail-discreetly)
+             (fboundp 'completion-at-point))
+        (let ((completion-fail-discreetly t)) (completion-at-point))
+      (funcall (or (message-completion-function) #'ignore)))
+    ;; Completion was performed; nothing else to do.
+    nil)
+   (message-tab-body-function (funcall message-tab-body-function))
+   (t (funcall (or (lookup-key text-mode-map "\t")
+                   (lookup-key global-map "\t")
+                   'indent-relative)))))
+
+(defun message-completion-function ()
   (let ((alist message-completion-alist))
     (while (and alist
 		(let ((mail-abbrev-mode-regexp (caar alist)))
 		  (not (mail-abbrev-in-expansion-header-p))))
       (setq alist (cdr alist)))
-    (funcall (or (cdar alist) message-tab-body-function
-		 (lookup-key text-mode-map "\t")
-		 (lookup-key global-map "\t")
-		 'indent-relative))))
+    (cdar alist)))
 
 (eval-and-compile
   (condition-case nil