branch: externals/ement
commit 3a9ad23103ef5fedd7d6b0485fccb3179ba541da
Author: Phil Sainty <p...@catalyst.net.nz>
Commit: Phil Sainty <p...@catalyst.net.nz>

    Add: (ement-room-compose-buffer-window-dedicated) New value `delete'
    
    This value enforces the deletion of the compose buffer's window when
    the buffer is finished with, without the window being dedicated while
    it's in use.
    
    Also provide reference to `switch-to-buffer-in-dedicated-window'.
---
 ement-room.el | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/ement-room.el b/ement-room.el
index dc442d0b43..85839d0c6e 100644
--- a/ement-room.el
+++ b/ement-room.el
@@ -523,9 +523,15 @@ the option `ement-room-compose-buffer-window-auto-height' 
is
 enabled (this option generally keeps the windows too small to
 usefully display other buffers).
 
-See also `set-window-dedicated-p'."
+The value `delete' means that windows will not be dedicated, but
+they will still be deleted once the message is sent or aborted
+\(even when they have also been used to display other buffers).
+
+See also `set-window-dedicated-p' and
+`switch-to-buffer-in-dedicated-window'."
   :type '(radio (const :tag "Always" t)
                 (const :tag "Never" nil)
+                (const :tag "Never (but always delete window)" delete)
                 (const :tag "Newly-created windows" created)
                 (const :tag "When auto-height enabled" auto-height)))
 
@@ -4587,6 +4593,7 @@ See also 
`ement-room-compose-buffer-window-state-change-handler'."
         (when (cl-case ement-room-compose-buffer-window-dedicated
                 (created createdp)
                 (auto-height ement-room-compose-buffer-window-auto-height)
+                (delete nil)
                 (t ement-room-compose-buffer-window-dedicated))
           (set-window-dedicated-p win t))))))
 
@@ -4601,6 +4608,9 @@ A non-dedicated window which has displayed another buffer 
at any
 point will not be deleted."
   ;; N.b. This function exists primarily for documentation purposes,
   ;; to clarify the side-effect of using a dedicated window.
+  (when (eq ement-room-compose-buffer-window-dedicated 'delete)
+    ;; `quit-restore-window' always deletes a dedicated window.
+    (set-window-dedicated-p nil t))
   (quit-restore-window nil 'kill))
 
 (declare-function dabbrev--select-buffers "dabbrev")

Reply via email to