* mu4e-compose: some improvement for emacs23 handling / address completion
This commit is contained in:
@ -84,7 +84,7 @@ replying to messages."
|
|||||||
|
|
||||||
(defcustom mu4e-compose-cycle-threshold 5
|
(defcustom mu4e-compose-cycle-threshold 5
|
||||||
"Number of completion matches below which you can cycle through
|
"Number of completion matches below which you can cycle through
|
||||||
them; see `completion-cycle-threshold'."
|
them; see `completion-cycle-threshold' (emacs24)."
|
||||||
:type 'list
|
:type 'list
|
||||||
:group 'mu4e-compose)
|
:group 'mu4e-compose)
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
@ -453,18 +453,21 @@ needed, set the Fcc header, and register the handler function."
|
|||||||
"^X-Draft-From:" "^User-agent:")
|
"^X-Draft-From:" "^User-agent:")
|
||||||
"Hidden headers when composing.")
|
"Hidden headers when composing.")
|
||||||
|
|
||||||
|
(defconst mu4e~compose-address-fields-regexp
|
||||||
|
"^\\(To\\|B?Cc\\|Reply-To\\|From\\):")
|
||||||
|
|
||||||
(defun mu4e~compose-setup-completion ()
|
(defun mu4e~compose-setup-completion ()
|
||||||
"Set up autocompletion of addresses."
|
"Set up autocompletion of addresses."
|
||||||
|
(when (boundp 'completion-cycle-threshold) ;; emacs24 only
|
||||||
|
(make-local-variable 'completion-cycle-threshold)
|
||||||
|
completion-cycle-threshold) mu4e-compose-cycle-threshold
|
||||||
(make-local-variable 'completion-styles)
|
(make-local-variable 'completion-styles)
|
||||||
(make-local-variable 'completion-cycle-threshold)
|
(setq completion-styles mu4e-compose-completion-styles)
|
||||||
(setq
|
|
||||||
completion-cycle-threshold mu4e-compose-cycle-threshold
|
|
||||||
completion-styles mu4e-compose-completion-styles)
|
|
||||||
(add-to-list 'completion-at-point-functions 'mu4e~compose-complete-contact)
|
(add-to-list 'completion-at-point-functions 'mu4e~compose-complete-contact)
|
||||||
;; this seems to be needed for emacs23:
|
;; this seems to be needed for emacs23:
|
||||||
(make-local-variable 'message-completion-alist)
|
(make-local-variable 'message-completion-alist)
|
||||||
(add-to-list 'message-completion-alist
|
(add-to-list 'message-completion-alist
|
||||||
'("^\\(To\\|Cc\\|Bcc\\):" . completion-at-point)))
|
mu4e~compose-address-fields-regexp . completion-at-point))
|
||||||
|
|
||||||
(define-derived-mode mu4e-compose-mode message-mode "mu4e:compose"
|
(define-derived-mode mu4e-compose-mode message-mode "mu4e:compose"
|
||||||
"Major mode for the mu4e message composition, derived from `message-mode'.
|
"Major mode for the mu4e message composition, derived from `message-mode'.
|
||||||
@ -520,7 +523,7 @@ needed, set the Fcc header, and register the handler function."
|
|||||||
|
|
||||||
(defconst mu4e~compose-hidden-headers
|
(defconst mu4e~compose-hidden-headers
|
||||||
'("^References:" "^Face:" "^X-Face:" "^X-Draft-From:"
|
'("^References:" "^Face:" "^X-Face:" "^X-Draft-From:"
|
||||||
"^User-Agent:")
|
"^User-Agent:" "^In-Reply-To:")
|
||||||
"List of regexps with message headers that are to be hidden.")
|
"List of regexps with message headers that are to be hidden.")
|
||||||
|
|
||||||
(defun mu4e~compose-handler (compose-type &optional original-msg includes)
|
(defun mu4e~compose-handler (compose-type &optional original-msg includes)
|
||||||
@ -712,11 +715,7 @@ message."
|
|||||||
"Complete the text at START with a contact (ie. either 'name
|
"Complete the text at START with a contact (ie. either 'name
|
||||||
<email>' or 'email')."
|
<email>' or 'email')."
|
||||||
(interactive)
|
(interactive)
|
||||||
(let ((mail-abbrev-mode-regexp
|
(let ((mail-abbrev-mode-regexp mu4e~compose-address-fields-regexp)
|
||||||
(concat
|
|
||||||
"^\\(Resent-To\\|To\\|B?Cc\\|Reply-To\\|From"
|
|
||||||
"\\|Mail-Followup-To\\|Mail-Copies-To"
|
|
||||||
"\\|Disposition-Notification-To\\|Return-Receipt-To\\):"))
|
|
||||||
(eoh ;; end-of-headers
|
(eoh ;; end-of-headers
|
||||||
(save-excursion
|
(save-excursion
|
||||||
(goto-char (point-min))
|
(goto-char (point-min))
|
||||||
|
|||||||
Reference in New Issue
Block a user