unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Austin Clements <aclements@csail.mit.edu>
To: Mark Walters <markwalters1009@gmail.com>
Cc: notmuch@notmuchmail.org
Subject: Re: [PATCH v3 3/5] emacs: show: pass button to create-overlays
Date: Fri, 31 May 2013 19:12:39 -0400	[thread overview]
Message-ID: <20130531231239.GD5999@mit.edu> (raw)
In-Reply-To: <87vc5yg329.fsf@qmul.ac.uk>

Quoth Mark Walters on Jun 01 at 12:08 am:
> 
> > On Fri, 31 May 2013, Mark Walters <markwalters1009@gmail.com> wrote:
> >> Now that the bodypart code has the button we can pass that to
> >> create-overlays and simplify that.
> >> ---
> >>  emacs/notmuch-show.el |   26 ++++++++++++--------------
> >>  1 file changed, 12 insertions(+), 14 deletions(-)
> >>
> >> diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
> >> index be3aeac..66cc3a5 100644
> >> --- a/emacs/notmuch-show.el
> >> +++ b/emacs/notmuch-show.el
> >> @@ -851,21 +851,19 @@ message at DEPTH in the current thread."
> >>        (setq handlers (cdr handlers))))
> >>    t)
> >>  
> >> -(defun notmuch-show-create-part-overlays (msg beg end hide)
> >> +(defun notmuch-show-create-part-overlays (button beg end hide)
> >>    "Add an overlay to the part between BEG and END"
> >> -  (let* ((button (button-at beg))
> >> -	 (part-beg (and button (1+ (button-end button)))))
> >> -
> >> -    ;; If the part contains no text we do not make it toggleable. We
> >> -    ;; also need to check that the button is a genuine part button not
> >> -    ;; a notmuch-wash button.
> >> -    (when (and button (/= part-beg end) (button-get button :base-label))
> >> -      (button-put button 'overlay (make-overlay part-beg end))
> >> -      ;; We toggle the button for hidden parts as that gets the
> >> +
> >> +  ;; If there is no button (i.e., the part is text/plain and the first
> >> +  ;; part) or if the part has no content then we don't make the part
> >> +  ;; toggleable.
> >> +  (when (and button (/= beg end))
> >> +    (button-put button 'overlay (make-overlay beg end))
> >> +    ;; We toggle the button for hidden parts as that gets the
> >>        ;; button label right.
> >>        (save-excursion
> >>  	(when hide
> >> -	  (notmuch-show-toggle-part-invisibility button))))))
> >> +	  (notmuch-show-toggle-part-invisibility button)))))
> >
> > I might just be mis-following the diff here, but shouldn't the above get
> > re-indented?
> 
> I think you are right: it got a bit messed up when I tried to split up
> the patch. I don't think it matters much as these lines get deleted in
> the next patch. Incidentally is there a good git work flow for fixing up
> something like this where you just want to change the midpoint of a
> series?

Yeah, I just came across that.  If you want to fix it up, personally I
would use git rebase -i and mark this patch as "edit", then amend this
commit to fix the indentation, continue the rebase, and clean up the
inevitable rebase conflict when it replays the next patch.

> >
> >>  
> >>  (defun notmuch-show-insert-bodypart (msg part depth &optional hide)
> >>    "Insert the body part PART at depth DEPTH in the current thread.
> >> @@ -879,10 +877,10 @@ If HIDE is non-nil then initially hide this part."
> >>  			     "text/x-diff")
> >>  			content-type))
> >>  	 (nth (plist-get part :id))
> >> -	 (beg (point))
> >>  	 ;; We omit the part button for the first (or only) part if this is text/plain.
> >>  	 (button (unless (and (string= mime-type "text/plain") (<= nth 1))
> >> -		   (notmuch-show-insert-part-header nth mime-type content-type (plist-get part :filename)))))
> >> +		   (notmuch-show-insert-part-header nth mime-type content-type (plist-get part :filename))))
> >> +	 (beg (point)))
> >
> > Was this swap necessary?
> 
> This is needed: inserting a part header moves point and this means that
> point is at the start of the part content rather than the start of the
> part button.

Ah, okay.

> Best wishes
> 
> Mark
> 
> >
> >>  
> >>      (notmuch-show-insert-bodypart-internal msg part mime-type nth depth button)
> >>      ;; Some of the body part handlers leave point somewhere up in the
> >> @@ -891,7 +889,7 @@ If HIDE is non-nil then initially hide this part."
> >>      ;; Ensure that the part ends with a carriage return.
> >>      (unless (bolp)
> >>        (insert "\n"))
> >> -    (notmuch-show-create-part-overlays msg beg (point) hide)))
> >> +    (notmuch-show-create-part-overlays button beg (point) hide)))
> >>  
> >>  (defun notmuch-show-insert-body (msg body depth)
> >>    "Insert the body BODY at depth DEPTH in the current thread."

  reply	other threads:[~2013-05-31 23:12 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-31 18:26 [PATCH v3 0/5] emacs: show: lazy handling of hidden parts Mark Walters
2013-05-31 18:26 ` [PATCH v3 1/5] emacs: show: fake wash parts are handled at insert-bodypart level Mark Walters
2013-05-31 18:26 ` [PATCH v3 2/5] emacs: show: move the insertion of the header button to the top level Mark Walters
2013-05-31 18:26 ` [PATCH v3 3/5] emacs: show: pass button to create-overlays Mark Walters
2013-05-31 22:59   ` Austin Clements
2013-05-31 23:08     ` Mark Walters
2013-05-31 23:12       ` Austin Clements [this message]
2013-05-31 18:26 ` [PATCH v3 4/5] emacs: show: modify the way hidden state is recorded Mark Walters
2013-05-31 23:09   ` Austin Clements
2013-05-31 18:26 ` [PATCH v3 5/5] emacs: show: implement lazy hidden part handling Mark Walters
2013-05-31 23:33 ` [PATCH v3 0/5] emacs: show: lazy handling of hidden parts Austin Clements

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=20130531231239.GD5999@mit.edu \
    --to=aclements@csail.mit.edu \
    --cc=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).