unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* [PATCH] emacs: show: lazy part bugfix
@ 2013-08-23  8:34 Mark Walters
  2013-09-01 16:18 ` Jameson Graef Rollins
  2013-09-04  7:30 ` [PATCH v2] " Mark Walters
  0 siblings, 2 replies; 10+ messages in thread
From: Mark Walters @ 2013-08-23  8:34 UTC (permalink / raw)
  To: notmuch, amdragon

The lazy part handling had a subtle bug. Notmuch stores the part
information as a text property with the displayed part so attachment
handling (saving viewing etc work).

Now, some mime parts have subparts and to avoid overwriting the
sub-part data notmuch checks and if part data is already recorded it
does not overwrite it.

Now with lazy part handling this could fail: there is already part
data stored. In the common case it works as the part type information
was stored when the lazy-part button was inserted. However, this fails
if the lazy part has sub-parts: notmuch had no idea these existed
until the lazy part insertion.

We fix this by removing any existing part-information from the
relevant region before doing the lazy insertion.
---
This was shown up by Istvan's patch in id:m3r4dtgz9k.fsf@zsu.kismala.com and 
the bug found by Jamie in id:87fvu4fl25.fsf@servo.finestructure.net

I think this is essentially the right patch: I am not certain about
the +1 in the removing the property. It seems to be needed but maybe
something with front/back sticky would be better.

Also this definitely needs more testing before going into master: this
code is definitely fragile.

Best wishes 

Mark

 emacs/notmuch-show.el |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index 20844f0..a31b6dc 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -853,6 +853,9 @@ message at DEPTH in the current thread."
   ;; character of the button by adding a newline and finish by
   ;; removing the extra newline from the end of the part.
   (save-excursion
+    ;; Remove part-information from lazy part-region
+    (put-text-property (button-start button) (1+ (button-end button)) :notmuch-part nil)
+
     (goto-char (button-end button))
     (insert "\n")
     (let* ((inhibit-read-only t)
-- 
1.7.9.1

^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2013-09-10 11:14 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-08-23  8:34 [PATCH] emacs: show: lazy part bugfix Mark Walters
2013-09-01 16:18 ` Jameson Graef Rollins
2013-09-04  7:30 ` [PATCH v2] " Mark Walters
2013-09-04 14:56   ` Austin Clements
2013-09-04 15:50     ` Jameson Graef Rollins
2013-09-04 16:16       ` Austin Clements
2013-09-05 18:46         ` Mark Walters
2013-09-06 23:28           ` [PATCH] emacs: show: lazy part handling bugfix Mark Walters
2013-09-09 13:56             ` Austin Clements
2013-09-10 11:14             ` David Bremner

Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).