mirror of https://github.com/djcb/mu.git
mu4e: factor out mu4e~decrypt-p
Factor out defun to get decryption decision, so we can use it from elsewhere.
This commit is contained in:
parent
84afa94fb2
commit
bef3113c09
|
@ -1644,15 +1644,24 @@ _not_ refresh the last search with the new setting for threading."
|
||||||
(setq mu4e~headers-loading-buf
|
(setq mu4e~headers-loading-buf
|
||||||
(get-buffer-create " *mu4e-loading*")))
|
(get-buffer-create " *mu4e-loading*")))
|
||||||
(with-current-buffer mu4e~headers-loading-buf
|
(with-current-buffer mu4e~headers-loading-buf
|
||||||
(let ((inhibit-read-only t))
|
(read-only-mode)
|
||||||
(erase-buffer)
|
(let ((inhibit-read-only t))
|
||||||
(local-set-key (kbd "q") (if (eq mu4e-split-view 'single-window)
|
(erase-buffer)
|
||||||
'kill-buffer
|
(local-set-key (kbd "q")
|
||||||
'kill-buffer-and-window))
|
(if (eq mu4e-split-view 'single-window)
|
||||||
(insert (propertize "Waiting for message..."
|
'kill-buffer
|
||||||
'face 'mu4e-system-face 'intangible t))))
|
'kill-buffer-and-window))
|
||||||
|
(insert (propertize "Waiting for message..."
|
||||||
|
'face 'mu4e-system-face 'intangible t))))
|
||||||
mu4e~headers-loading-buf)
|
mu4e~headers-loading-buf)
|
||||||
|
|
||||||
|
(defun mu4e~decrypt-p (msg)
|
||||||
|
"Should we decrypt this message?"
|
||||||
|
(and (member 'encrypted (mu4e-message-field msg :flags))
|
||||||
|
(if (eq mu4e-decryption-policy 'ask)
|
||||||
|
(yes-or-no-p (mu4e-format "Decrypt message?"))
|
||||||
|
mu4e-decryption-policy)))
|
||||||
|
|
||||||
(defun mu4e-headers-view-message ()
|
(defun mu4e-headers-view-message ()
|
||||||
"View message at point.
|
"View message at point.
|
||||||
If there's an existing window for the view, re-use that one. If
|
If there's an existing window for the view, re-use that one. If
|
||||||
|
@ -1666,12 +1675,7 @@ window. "
|
||||||
(let* ((msg (mu4e-message-at-point))
|
(let* ((msg (mu4e-message-at-point))
|
||||||
(docid (or (mu4e-message-field msg :docid)
|
(docid (or (mu4e-message-field msg :docid)
|
||||||
(mu4e-warn "No message at point")))
|
(mu4e-warn "No message at point")))
|
||||||
;; decrypt (or not), based on `mu4e-decryption-policy'.
|
(decrypt (mu4e~decrypt-p msg))
|
||||||
(decrypt
|
|
||||||
(and (member 'encrypted (mu4e-message-field msg :flags))
|
|
||||||
(if (eq mu4e-decryption-policy 'ask)
|
|
||||||
(yes-or-no-p (mu4e-format "Decrypt message?"))
|
|
||||||
mu4e-decryption-policy)))
|
|
||||||
(viewwin (mu4e~headers-redraw-get-view-window)))
|
(viewwin (mu4e~headers-redraw-get-view-window)))
|
||||||
(unless (window-live-p viewwin)
|
(unless (window-live-p viewwin)
|
||||||
(mu4e-error "Cannot get a message view"))
|
(mu4e-error "Cannot get a message view"))
|
||||||
|
|
Loading…
Reference in New Issue