emacs: Split wide window vertically for tree mode message pane

classic Classic list List threaded Threaded
1 message Options
Prof Jayanth R Varma Prof Jayanth R Varma
Reply | Threaded
Open this post in threaded view
|

emacs: Split wide window vertically for tree mode message pane

This patch modifies the function notmuch-tree-show-message-in in
notmuch-tree.el to split the window vertically while creating a
message pane in tree-mode if the window is wider than 160 (so that
after splitting, the message pane can show the standard 76
character plain text email lines without wrapping).

>From e4829e484ffe3aab564f112d677fb72e9a400144 Mon Sep 17 00:00:00 2001
From: Jayanth Varma <[hidden email]>
Date: Wed, 3 Jan 2018 14:44:31 +0530
Subject: [PATCH] Split wide window vertically for tree-mode message pane in
 emacs

---
 NEWS                  | 4 ++++
 emacs/notmuch-tree.el | 9 ++++++++-
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/NEWS b/NEWS
index 47b62d73..d2808df1 100644
--- a/NEWS
+++ b/NEWS
@@ -151,6 +151,10 @@ Extend mitigation (disabling handling x-display in text/enriched) for
 Emacs bug #28350 to Emacs versions before 24.4 (i.e. without
 `advice-add`).
 
+When opening message pane in tree-mode, split window vertically if
+window is wider than 160 (message pane after splitting is wider than
+80).
+
 Command Line Interface
 ----------------------
 
diff --git a/emacs/notmuch-tree.el b/emacs/notmuch-tree.el
index c00315e8..082bcfa5 100644
--- a/emacs/notmuch-tree.el
+++ b/emacs/notmuch-tree.el
@@ -469,7 +469,14 @@ NOT change the database."
       ;; this might cause flickering but seems ok.
       (notmuch-tree-close-message-window)
       (setq notmuch-tree-message-window
-    (split-window-vertically (/ (window-height) 4)))
+    ;; Split message pane vertically in wide windows (width > 160)
+    ;; Under RFC 2045 line length is 76 characters so plain text emails
+    ;; will be displayed properly in 80 character wide pane
+    ;; HTML mail will anyway reformat to pane width
+    ;; In narrow windows, split pane horizontally 1:3
+    (if (> (window-total-width) 160)
+ (split-window-horizontally)
+      (split-window-vertically (/ (window-height) 4))))
       (with-selected-window notmuch-tree-message-window
  ;; Since we are only displaying one message do not indent.
  (let ((notmuch-show-indent-messages-width 0)
--
2.15.1


_______________________________________________
notmuch mailing list
[hidden email]
https://notmuchmail.org/mailman/listinfo/notmuch