emacs: Avoid infinite loop when marking up citations.
authorCarl Worth <cworth@cworth.org>
Fri, 11 Dec 2009 23:25:55 +0000 (15:25 -0800)
committerCarl Worth <cworth@cworth.org>
Fri, 11 Dec 2009 23:54:45 +0000 (15:54 -0800)
Thanks to Dirk Hohndel for reporting the bug. The infinite loop was first
noticed in the following message (available from the Linux kernel mailing list):

alpine.LFD.2.00.0912081304070.3560@localhost.localdomain

Note that the bug does not show up when viewing the message in
isolation---the bug was triggered only when viewing this file indented
to a depth of at least 13.

The fix is simply to use a marker rather than an integer position when
recording a point we plan to move back to later, (since inserting the
indented button causes the buffer position of the desired marker to
change).

notmuch.el

index 31e9d585fdd98a8880f7755c0060a53e22f15926..9ec89ca0068ec2126e54d5a18c26300c265348b8 100644 (file)
@@ -608,7 +608,7 @@ which this thread was originally shown."
                   (invis-spec (make-symbol "notmuch-citation-region")))
               (add-to-invisibility-spec invis-spec)
              (overlay-put overlay 'invisible invis-spec)
                   (invis-spec (make-symbol "notmuch-citation-region")))
               (add-to-invisibility-spec invis-spec)
              (overlay-put overlay 'invisible invis-spec)
-              (let ((p (point))
+              (let ((p (point-marker))
                     (cite-button-text
                      (concat "["  (number-to-string (count-lines beg-sub (point)))
                              "-line citation.]")))
                     (cite-button-text
                      (concat "["  (number-to-string (count-lines beg-sub (point)))
                              "-line citation.]")))
@@ -633,7 +633,7 @@ which this thread was originally shown."
                     (goto-char (- beg-sub 1))
                     (insert (concat "\n" indent))
                     (let ((sig-button-text (concat "[" (number-to-string sig-lines)
                     (goto-char (- beg-sub 1))
                     (insert (concat "\n" indent))
                     (let ((sig-button-text (concat "[" (number-to-string sig-lines)
-                                                   "-line signature.]")))
+                                                   "-line signature. Click/Enter to show.]")))
                       (insert-button sig-button-text 'invisibility-spec invis-spec
                                      :type 'notmuch-button-signature-toggle-type)
                      )
                       (insert-button sig-button-text 'invisibility-spec invis-spec
                                      :type 'notmuch-button-signature-toggle-type)
                      )