]> git.notmuchmail.org Git - notmuch/blobdiff - notmuch.el
make headers locally expandable/collapsable
[notmuch] / notmuch.el
index fa6e7de4068a2598eb9997efaa1776a0c45a8f7a..8aee2864047ef455ff3e7eb1e83693ee9e557829 100644 (file)
@@ -605,7 +605,8 @@ which this thread was originally shown."
     (end-of-line)
     ; Inverse video for subject
     (overlay-put (make-overlay beg (point)) 'face '(:inverse-video t))
-    (forward-line 2)
+    (forward-line 1)
+    (end-of-line)
     (let ((beg-hidden (point-marker)))
       (re-search-forward notmuch-show-header-end-regexp)
       (beginning-of-line)
@@ -619,8 +620,19 @@ which this thread was originally shown."
           (forward-line)
           )
        (indent-rigidly beg end depth)
-       (overlay-put (make-overlay beg-hidden end)
-                    'invisible 'notmuch-show-header)
+        (let ((invis-spec (make-symbol "notmuch-show-header")))
+          (add-to-invisibility-spec (cons invis-spec t))
+          (overlay-put (make-overlay beg-hidden end)
+                       'invisible invis-spec)
+          (goto-char beg)
+          (forward-line)
+          (let ((header-button (make-button (line-beginning-position) (line-end-position))))
+            (button-put header-button 'invisibility-spec (cons invis-spec t))
+            (button-put header-button 'action 'notmuch-toggle-invisible-action)
+            (button-put header-button 'follow-link t)
+            (button-put header-button 'help-echo
+                        "mouse-1, RET: Show headers")
+          ))
         (goto-char end)
         (insert "\n")
        (set-marker beg nil)