[PATCH v1] emacs: Add `notmuch-show-toggle-citation-visibility', bound to '>'

David Edmondson dme at dme.org
Tue May 20 08:56:09 PDT 2014


Add a function and key-binding to toggle the collapsing of citations
within the current message.
---
 emacs/notmuch-show.el | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index 10fc872..e4b56c7 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -1036,6 +1036,22 @@ useful for quoting in replies)."
 	     "Content is not indented."))
   (notmuch-show-refresh-view))
 
+(defun notmuch-show-toggle-citation-visibility ()
+  "Toggle the visibility of the citations in the current message."
+  (interactive)
+  (let ((beg (notmuch-show-message-top))
+	(end (notmuch-show-message-bottom))
+	button)
+    (save-excursion
+      (goto-char beg)
+      (while (and (setq button (next-button (point)))
+		  (< (goto-char (button-start button))
+		     end))
+	(let ((overlay (button-get button 'overlay)))
+	  (when (and overlay
+		     (string= (overlay-get overlay 'type) "citation"))
+	    (push-button (point))))))))
+
 (defun notmuch-show-insert-tree (tree depth)
   "Insert the message tree TREE at depth DEPTH in the current thread."
   (let ((msg (car tree))
@@ -1311,6 +1327,7 @@ reset based on the original query."
 	(define-key map "!" 'notmuch-show-toggle-elide-non-matching)
 	(define-key map "$" 'notmuch-show-toggle-process-crypto)
 	(define-key map "<" 'notmuch-show-toggle-thread-indentation)
+	(define-key map ">" 'notmuch-show-toggle-citation-visibility)
 	(define-key map "t" 'toggle-truncate-lines)
 	(define-key map "." 'notmuch-show-part-map)
 	map)
-- 
2.0.0.rc0



More information about the notmuch mailing list