mu4e-draft: make compose frame config buffer-local

This should help when multiple compose windows are present, such as in
issue #2912.
This commit is contained in:
Dirk-Jan C. Binnema
2026-04-01 17:32:19 +03:00
committed by Seth Ladygo
parent 1cf07a7e9f
commit 695da3e1ed

View File

@ -1,6 +1,6 @@
;;; mu4e-draft.el --- Helpers for m4e-compose -*- lexical-binding: t -*- ;;; mu4e-draft.el --- Helpers for m4e-compose -*- lexical-binding: t -*-
;; Copyright (C) 2024-2025 Dirk-Jan C. Binnema ;; Copyright (C) 2024-2026 Dirk-Jan C. Binnema
;; Author: Dirk-Jan C. Binnema <djcb@djcbsoftware.nl> ;; Author: Dirk-Jan C. Binnema <djcb@djcbsoftware.nl>
;; Maintainer: Dirk-Jan C. Binnema <djcb@djcbsoftware.nl> ;; Maintainer: Dirk-Jan C. Binnema <djcb@djcbsoftware.nl>
@ -694,8 +694,8 @@ Used internally for mu4e-compose-post-kill-frame.")
"Function that might kill the composition frame. "Function that might kill the composition frame.
This is for use in `mu4e-compose-post-hook'." This is for use in `mu4e-compose-post-hook'."
(let ((msgframe (selected-frame))) (let ((msgframe (selected-frame)))
;;(message "kill frame? %s %s" mu4e--draft-activation-frame msgframe) (when (and mu4e--draft-activation-frame
(when (and (frame-live-p msgframe) (frame-live-p msgframe)
(not (eq mu4e--draft-activation-frame msgframe))) (not (eq mu4e--draft-activation-frame msgframe)))
(delete-frame msgframe)))) (delete-frame msgframe))))
@ -722,8 +722,10 @@ Set up some message actions. In particular, handle closing frames
when we created it. OLDFRAME is the frame from which the when we created it. OLDFRAME is the frame from which the
message-composition was triggered. OLDWINDCONF is the current message-composition was triggered. OLDWINDCONF is the current
window configuration." window configuration."
;; remember current frame & window conf ;; remember current frame & window configuration; make these buffer-local so
(setq mu4e--draft-activation-frame oldframe ;; each composition buffer tracks its *own* activation context, which is
;; needed when multiple compositions exist simultaneously.
(setq-local mu4e--draft-activation-frame oldframe
mu4e--before-draft-window-config oldwindconf) mu4e--before-draft-window-config oldwindconf)
;; make message's "post" hooks local, and multiplex them ;; make message's "post" hooks local, and multiplex them