changeset 106235:4e5a706e62fa

(mail-abbrev-complete-alias): Use completion-in-region.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Wed, 25 Nov 2009 06:02:01 +0000
parents e5945bbfa5b1
children 4436585c0829
files lisp/ChangeLog lisp/mail/mailabbrev.el
diffstat 2 files changed, 9 insertions(+), 21 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Wed Nov 25 05:31:05 2009 +0000
+++ b/lisp/ChangeLog	Wed Nov 25 06:02:01 2009 +0000
@@ -1,5 +1,8 @@
 2009-11-25  Stefan Monnier  <monnier@iro.umontreal.ca>
 
+	* mail/mailabbrev.el (mail-abbrev-complete-alias):
+	Use completion-in-region.
+
 	* dabbrev.el (dabbrev--minibuffer-origin): Use minibuffer-selected-window.
 	(dabbrev-completion): Use completion-in-region.
 	(dabbrev--abbrev-at-point): Simplify regexp.
--- a/lisp/mail/mailabbrev.el	Wed Nov 25 05:31:05 2009 +0000
+++ b/lisp/mail/mailabbrev.el	Wed Nov 25 06:02:01 2009 +0000
@@ -569,27 +569,12 @@
   ;; Based on lisp.el:lisp-complete-symbol
   (interactive)
   (mail-abbrev-make-syntax-table)
-  (let* ((end (point))
-	 (beg (with-syntax-table mail-abbrev-syntax-table
-                (save-excursion
-                  (backward-word 1)
-                  (point))))
-         (alias (buffer-substring beg end))
-	 (completion (try-completion alias mail-abbrevs)))
-    (cond ((eq completion t)
-	   (message "%s" alias))	; confirm
-	  ((null completion)
-	   (error "[Can't complete \"%s\"]" alias)) ; (message ...) (ding)
-	  ((not (string= completion alias))
-	   (delete-region beg end)
-	   (insert completion))
-	  (t (with-output-to-temp-buffer "*Completions*"
-	       (display-completion-list
-		(prog2
-		    (message "Making completion list...")
-		    (all-completions alias mail-abbrevs)
-		  (message "Making completion list...done"))
-		alias))))))
+  (let ((end (point))
+        (beg (with-syntax-table mail-abbrev-syntax-table
+               (save-excursion
+                 (backward-word 1)
+                 (point)))))
+    (completion-in-region beg end mail-abbrevs)))
 
 (defun mail-abbrev-next-line (&optional arg)
   "Expand a mail abbrev before point, then move vertically down ARG lines.