* ecomplete.el (ecomplete-display-matches): Allow automatic
authorLars Magne Ingebrigtsen <larsi@gnus.org>
Fri, 14 Apr 2006 10:23:45 +0000 (10:23 +0000)
committerLars Magne Ingebrigtsen <larsi@gnus.org>
Fri, 14 Apr 2006 10:23:45 +0000 (10:23 +0000)
display.

* message.el (message-strip-forbidden-properties): Display
abbrevs.
(message-display-abbrev): Get automatic display right.

lisp/ChangeLog
lisp/ecomplete.el
lisp/message.el

index 3c455f0..3aa0a2d 100644 (file)
@@ -1,5 +1,12 @@
 2006-04-14  Lars Magne Ingebrigtsen  <larsi@gnus.org>
 
+       * ecomplete.el (ecomplete-display-matches): Allow automatic
+       display. 
+
+       * message.el (message-strip-forbidden-properties): Display
+       abbrevs. 
+       (message-display-abbrev): Get automatic display right.
+
        * ecomplete.el (ecomplete-display-matches): Use M-n/M-p
        keystrokes. 
 
index 862a7a2..e9eef9d 100644 (file)
@@ -97,7 +97,7 @@
                             'face 'isearch))
        (buffer-string)))))
 
-(defun ecomplete-display-matches (type word)
+(defun ecomplete-display-matches (type word &optional choose)
   (let* ((matches (ecomplete-get-matches type word))
         (line 0)
         (max-lines (when matches (- (length (split-string matches "\n")) 2)))
          (message "No ecomplete matches")
          nil)
       (setq highlight (ecomplete-highlight-match-line matches line))
-      (while (not (memq (setq command (read-event highlight)) '(? return)))
-       (cond
-        ((eq command (aref (kbd "M-n") 0))
-         (setq line (min (1+ line) max-lines)))
-        ((eq command (aref (kbd "M-p") 0))
-         (setq line (max (1- line) 0))))
-       (setq highlight (ecomplete-highlight-match-line matches line)))
-      (when (eq command 'return)
-       (nth line (split-string matches "\n"))))))
+      (if (not choose)
+         (progn
+           (message highlight)
+           nil)
+       (while (not (memq (setq command (read-event highlight)) '(? return)))
+         (cond
+          ((eq command (aref (kbd "M-n") 0))
+           (setq line (min (1+ line) max-lines)))
+          ((eq command (aref (kbd "M-p") 0))
+           (setq line (max (1- line) 0))))
+         (setq highlight (ecomplete-highlight-match-line matches line)))
+       (when (eq command 'return)
+         (nth line (split-string matches "\n")))))))
 
 (defun ecomplete-highlight-match-line (matches line)
   (with-temp-buffer
index 452f60f..bde3bba 100644 (file)
@@ -2517,6 +2517,8 @@ These properties are essential to work, so we should never strip them."
   "Strip forbidden properties between BEGIN and END, ignoring the third arg.
 This function is intended to be called from `after-change-functions'.
 See also `message-forbidden-properties'."
+  (when (eq message-mail-alias-type 'ecomplete)
+    (message-display-abbrev))
   (when (and message-strip-special-text-properties
             (message-tamago-not-in-use-p begin))
     (let ((buffer-read-only nil)
@@ -7177,9 +7179,9 @@ From headers in the original article."
                            string))))
   (ecomplete-save))
 
-(defun message-display-abbrev ()
+(defun message-display-abbrev (&optional choose)
   "Display the next possible abbrev for the text before point."
-  (interactive)
+  (interactive (list t))
   (when (and (message-point-in-header-p)
             (save-excursion
               (save-restriction
@@ -7188,11 +7190,13 @@ From headers in the original article."
                 (looking-at "To\\|Cc"))))
     (let* ((end (point))
           (start (save-excursion
-                   (re-search-backward "[\n\t ]" nil t)
-                   (1+ (point))))
-          (word (buffer-substring start end))
-          (match (ecomplete-display-matches 'mail word)))
-      (when match
+                   (and (re-search-backward "[\n\t ]" nil t)
+                        (1+ (point)))))
+          (word (when start (buffer-substring start end)))
+          (match (when (and word
+                            (not (zerop (length word))))
+                   (ecomplete-display-matches 'mail word choose))))
+      (when (and choose match)
        (delete-region start end)
        (insert match)))))