[PATCH] Buttonize citation expander.

classic Classic list List threaded Threaded
1 message Options
Alexander Botero-Lowry Alexander Botero-Lowry
Reply | Threaded
Open this post in threaded view
|

[PATCH] Buttonize citation expander.

Currently the button has no action or special handling at all.
---
 notmuch.el |   15 +++++++++++----
 1 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/notmuch.el b/notmuch.el
index 1fc54c3..6a34282 100644
--- a/notmuch.el
+++ b/notmuch.el
@@ -453,10 +453,17 @@ which this thread was originally shown."
       (forward-line))
     (let ((overlay (make-overlay beg-sub (point))))
       (overlay-put overlay 'invisible 'notmuch-show-citation)
-      (overlay-put overlay 'before-string
-   (concat indent
-   "[" (number-to-string (count-lines beg-sub (point)))
-   "-line citation. Press 'c' to show.]\n")))))
+              (let (
+                    (p (point))
+                    (cite-button-text (concat "[" (number-to-string (count-lines beg-sub (point)))
+                                              "-line citation. Press 'c' to show.]"))
+                    )
+                (goto-char (- beg-sub 1))
+                (insert (concat "\n" indent))
+                (insert-button cite-button-text)
+                (insert "\n")
+                (goto-char (+ (length cite-button-text) p))
+              ))))
       (move-to-column depth)
       (if (looking-at notmuch-show-signature-regexp)
   (let ((sig-lines (- (count-lines beg-sub end) 1)))
--
1.6.5.2