display.
* message.el (message-strip-forbidden-properties): Display
abbrevs.
(message-display-abbrev): Get automatic display right.
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.
'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
"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)
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
(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)))))