unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Mark Walters <markwalters1009@gmail.com>
To: notmuch@notmuchmail.org
Subject: [PATCH v2] emacs: show: lazy part bugfix
Date: Wed,  4 Sep 2013 08:30:35 +0100	[thread overview]
Message-ID: <1378279835-28288-1-git-send-email-markwalters1009@gmail.com> (raw)
In-Reply-To: <1377246875-7784-1-git-send-email-markwalters1009@gmail.com>

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 is the same as the previous patch
id:1377246875-7784-1-git-send-email-markwalters1009@gmail.com except I
have added a substantial comment. I now believe the +1 in the remove
part information is genuinely correct for the reason detailed in the comment.
 
This does seem to fix an actual bug (see parent message and links there).

Best wishes

Mark


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

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index 20844f0..58ef4df 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -852,7 +852,20 @@ message at DEPTH in the current thread."
   ;; from a message header etc) so instead we start from the last
   ;; character of the button by adding a newline and finish by
   ;; removing the extra newline from the end of the part.
+  ;;
+  ;; Essentially, this function wants text properties to be
+  ;; front-nonsticky (where most of the other functions need
+  ;; front-sticky so that is what they actually are) and this is a way
+  ;; of faking the front-nonsticky for this one function.
+  ;;
+  ;; For exactly this reason we also remove existing part-information
+  ;; from one extra character: this extra character is the newline
+  ;; that we delete at the end.
+
   (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

  parent reply	other threads:[~2013-09-04  7:30 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 ` Mark Walters [this message]
2013-09-04 14:56   ` [PATCH v2] " 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1378279835-28288-1-git-send-email-markwalters1009@gmail.com \
    --to=markwalters1009@gmail.com \
    --cc=notmuch@notmuchmail.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).