[notmuch] [PATCH 1/3] notmuch.el: Add keybinding to toggle display of message body and headers.

Kan-Ru Chen kanru at kanru.info
Mon Nov 30 22:13:51 PST 2009


I really missed this feature. Added notmuch-show-toggle-current-body and
notmuch-show-toggle-current-header and bind them to 'b' and 'h'.

Signed-off-by: Kan-Ru Chen <kanru at kanru.info>
---
 notmuch.el |   22 ++++++++++++++++++++++
 1 files changed, 22 insertions(+), 0 deletions(-)

diff --git a/notmuch.el b/notmuch.el
index 65473ba..2526020 100644
--- a/notmuch.el
+++ b/notmuch.el
@@ -62,7 +62,9 @@
     ; overlays-at to query and manipulate the current overlay.
     (define-key map "a" 'notmuch-show-archive-thread)
     (define-key map "A" 'notmuch-show-mark-read-then-archive-thread)
+    (define-key map "b" 'notmuch-show-toggle-current-body)
     (define-key map "f" 'notmuch-show-forward-current)
+    (define-key map "h" 'notmuch-show-toggle-current-header)
     (define-key map "m" 'message-mail)
     (define-key map "n" 'notmuch-show-next-message)
     (define-key map "N" 'notmuch-show-mark-read-then-next-open-message)
@@ -560,6 +562,26 @@ which this thread was originally shown."
   (force-window-update)
   (redisplay t))
 
+(defun notmuch-show-toggle-current-body ()
+  "Toggle the current message body."
+  (interactive)
+  (save-excursion
+    (notmuch-show-move-to-current-message-summary-line)
+    (unless (button-at (point))
+      (notmuch-show-next-button))
+    (push-button))
+  )
+
+(defun notmuch-show-toggle-current-header ()
+  (interactive)
+  (save-excursion
+    (notmuch-show-move-to-current-message-summary-line)
+    (next-line)
+    (unless (button-at (point))
+      (notmuch-show-next-button))
+    (push-button))
+  )
+
 (define-button-type 'notmuch-button-invisibility-toggle-type 'action 'notmuch-toggle-invisible-action 'follow-link t)
 (define-button-type 'notmuch-button-citation-toggle-type 'help-echo "mouse-1, RET: Show citation"
   :supertype 'notmuch-button-invisibility-toggle-type)
-- 
1.6.5.3



More information about the notmuch mailing list