branch: externals/ebdb
commit 1bcfaa1e07ba913c94cb467c58f5723b54e7e157
Author: Eric Abrahamsen <[email protected]>
Commit: Eric Abrahamsen <[email protected]>
Remove EBDB-Message buffer after killing or postponing message
* ebdb-message.el (ebdb-message-quit-ebdb): New function that finds
and quits the EBDB-Message window.
(ebdb-insinuate-message): Add this function using
`message-add-action'.
---
ebdb-message.el | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/ebdb-message.el b/ebdb-message.el
index 95a1e18..2d1d44a 100644
--- a/ebdb-message.el
+++ b/ebdb-message.el
@@ -101,6 +101,13 @@ See Gnus' manual for details."
"Call `ebdb-complete-mail-cleanup' after capf completion."
(ebdb-complete-mail-cleanup str pos))
+(defun ebdb-message-quit-ebdb ()
+ "Remove the EBDB window if the user kills the message buffer.
+Also fires when postponing a draft."
+ (let ((buf (get-buffer (ebdb-message-buffer-name))))
+ (when (and (bufferp buf) (buffer-live-p buf))
+ (quit-window nil (get-buffer-window buf)))))
+
(defun ebdb-insinuate-message ()
;; We don't currently bind the `ebdb-mua-keymap'.
(pcase ebdb-complete-mail
@@ -118,6 +125,8 @@ See Gnus' manual for details."
(cl-pushnew
'("^\\(Resent-\\)?\\(To\\|B?Cc\\|Reply-To\\|From\\|Mail-Followup-To\\|Mail-Copies-To\\):"
. ebdb-complete-mail)
message-completion-alist
:test #'equal)))
+ (message-add-action
+ #'ebdb-message-quit-ebdb 'exit 'postpone 'kill)
;; Other MUAs clear the EBDB buffer before displaying (in
;; `ebdb-mua-auto-update', the call to `ebdb-display-records' does
;; not pass the "append" flag). Displaying in message-mode does