aboutsummaryrefslogtreecommitdiff
path: root/emacs
diff options
context:
space:
mode:
authorAurelien Rouene <aurelien@rouene.fr>2026-03-05 23:33:55 +0100
committerDavid Bremner <david@tethera.net>2026-03-15 07:47:01 +0900
commit094744b3f6f5c6831b6555d1fe75709abf1d1279 (patch)
treec907979e036c4ee404c9f67d50d7a27595d4d428 /emacs
parent076d597308bef11bd0a13977c1d5516beed2ed4c (diff)
emacs: Switch mode before pop-to-buffer
When showing an email using notmuch-show-mode, set the mode "notmuch-show-mode" before using "pop-to-buffer-same-window", to be able to match on the major-mode with an entry in "display-buffer-alist". Using the major mode is the the only mean to set display rules, because the buffer title is set to the title of the email and is not fixed. Signed-off-by: Aurelien Rouene <aurelien@rouene.fr>
Diffstat (limited to 'emacs')
-rw-r--r--emacs/notmuch-show.el14
1 files changed, 8 insertions, 6 deletions
diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index 9547c6e6..eeaa93a5 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -1400,15 +1400,17 @@ function is used.
Returns the buffer containing the messages, or NIL if no messages
matched."
(interactive "sNotmuch show: \nP")
- (let ((buffer-name (generate-new-buffer-name
- (or buffer-name
- (concat "*notmuch-" thread-id "*"))))
- (mm-inline-override-types (notmuch--inline-override-types)))
+ (let* ((buffer-name (generate-new-buffer-name
+ (or buffer-name
+ (concat "*notmuch-" thread-id "*"))))
+ (buffer (get-buffer-create buffer-name))
+ (mm-inline-override-types (notmuch--inline-override-types)))
- (pop-to-buffer-same-window (get-buffer-create buffer-name))
+ (with-current-buffer buffer
+ (notmuch-show-mode))
+ (pop-to-buffer-same-window buffer)
;; No need to track undo information for this buffer.
(setq buffer-undo-list t)
- (notmuch-show-mode)
;; Set various buffer local variables to their appropriate initial
;; state. Do this after enabling `notmuch-show-mode' so that they
;; aren't wiped out.