mu4e: make mu4e-compose-type a public variable
Replace mu4e~compose-type so it can be used in pre-hooks and the like.
This commit is contained in:
@ -173,7 +173,8 @@ We have the following choices:
|
|||||||
"Hook run just *before* message composition starts.
|
"Hook run just *before* message composition starts.
|
||||||
If the compose-type is either 'reply' or 'forward', the variable
|
If the compose-type is either 'reply' or 'forward', the variable
|
||||||
`mu4e-compose-parent-message' points to the message replied to /
|
`mu4e-compose-parent-message' points to the message replied to /
|
||||||
being forwarded / edited.
|
being forwarded / edited, and `mu4e-compose-type' contains the
|
||||||
|
type of message to be composed.
|
||||||
|
|
||||||
Note that there is no draft message yet when this hook runs, it
|
Note that there is no draft message yet when this hook runs, it
|
||||||
is meant for influencing the how mu4e constructs the draft
|
is meant for influencing the how mu4e constructs the draft
|
||||||
@ -183,6 +184,10 @@ place to do that."
|
|||||||
:type 'hook
|
:type 'hook
|
||||||
:group 'mu4e-compose)
|
:group 'mu4e-compose)
|
||||||
|
|
||||||
|
(defvar mu4e-compose-type nil
|
||||||
|
"The compose-type for this buffer, which is a symbol, `new',
|
||||||
|
`forward', `reply' or `edit'.")
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
|
|
||||||
@ -455,7 +460,7 @@ buffers; lets remap its faces so it uses the ones for mu4e."
|
|||||||
(add-hook 'message-send-hook
|
(add-hook 'message-send-hook
|
||||||
(lambda () ;; mu4e~compose-save-before-sending
|
(lambda () ;; mu4e~compose-save-before-sending
|
||||||
;; when in-reply-to was removed, remove references as well.
|
;; when in-reply-to was removed, remove references as well.
|
||||||
(when (eq mu4e~compose-type 'reply)
|
(when (eq mu4e-compose-type 'reply)
|
||||||
(mu4e~remove-refs-maybe))
|
(mu4e~remove-refs-maybe))
|
||||||
(when use-hard-newlines
|
(when use-hard-newlines
|
||||||
(mu4e-send-harden-newlines))
|
(mu4e-send-harden-newlines))
|
||||||
@ -483,8 +488,6 @@ buffers; lets remap its faces so it uses the ones for mu4e."
|
|||||||
(defconst mu4e~compose-buffer-max-name-length 30
|
(defconst mu4e~compose-buffer-max-name-length 30
|
||||||
"Maximum length of the mu4e-send-buffer-name.")
|
"Maximum length of the mu4e-send-buffer-name.")
|
||||||
|
|
||||||
(defvar mu4e~compose-type nil
|
|
||||||
"Compose-type for this buffer.")
|
|
||||||
|
|
||||||
(defun mu4e~compose-set-friendly-buffer-name (&optional compose-type)
|
(defun mu4e~compose-set-friendly-buffer-name (&optional compose-type)
|
||||||
"Set some user-friendly buffer name based on the compose type."
|
"Set some user-friendly buffer name based on the compose type."
|
||||||
@ -508,10 +511,7 @@ automatically encrypt that reply."
|
|||||||
(case mu4e-compose-crypto-reply-policy
|
(case mu4e-compose-crypto-reply-policy
|
||||||
(sign (mml-secure-message-sign))
|
(sign (mml-secure-message-sign))
|
||||||
(encrypt (mml-secure-message-encrypt))
|
(encrypt (mml-secure-message-encrypt))
|
||||||
(sign-and-encrypt (mml-secure-message-sign-encrypt))
|
(sign-and-encrypt (mml-secure-message-sign-encrypt)))))
|
||||||
(message "Do nothing"))))
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
(defun* mu4e~compose-handler (compose-type &optional original-msg includes)
|
(defun* mu4e~compose-handler (compose-type &optional original-msg includes)
|
||||||
"Create a new draft message, or open an existing one.
|
"Create a new draft message, or open an existing one.
|
||||||
@ -572,8 +572,8 @@ tempfile)."
|
|||||||
(set (make-local-variable 'mu4e-compose-parent-message) original-msg)
|
(set (make-local-variable 'mu4e-compose-parent-message) original-msg)
|
||||||
(put 'mu4e-compose-parent-message 'permanent-local t)
|
(put 'mu4e-compose-parent-message 'permanent-local t)
|
||||||
;; remember the compose-type
|
;; remember the compose-type
|
||||||
(set (make-local-variable 'mu4e~compose-type) compose-type)
|
(set (make-local-variable 'mu4e-compose-type) compose-type)
|
||||||
(put 'mu4e~compose-type 'permanent-local t)
|
(put 'mu4e-compose-type 'permanent-local t)
|
||||||
|
|
||||||
;; hide some headers
|
;; hide some headers
|
||||||
(mu4e~compose-hide-headers)
|
(mu4e~compose-hide-headers)
|
||||||
|
|||||||
Reference in New Issue
Block a user