]> git.neil.brown.name Git - edlib.git/commitdiff
notmuch: reply to first VISIBLE text part
authorNeilBrown <neil@brown.name>
Thu, 1 Jun 2023 05:40:58 +0000 (15:40 +1000)
committerNeilBrown <neil@brown.name>
Thu, 8 Jun 2023 10:38:58 +0000 (20:38 +1000)
Instead of choosing first text part, choose first visible text part for
interpolating into reply.

Signed-off-by: NeilBrown <neil@brown.name>
DOC/TODO.md
python/module-notmuch.py

index f615d12faf8c905de48f040985118cb0a71e86d9..af85751a64ec5d64dbb1b4d3ddf458e42ed5e10e 100644 (file)
@@ -14,7 +14,7 @@ the file.
 
 - [X] ->replace_pane, ->replace_popup can be deleted (Abort) but we
       don't catch it...
-- [ ] notmuch reply should interpolate the first *visible* text part
+- [X] notmuch reply should interpolate the first *visible* text part
 - [ ] ncurses - don't block in nc_external_viewer - at least abort after
       30 seconds, but preferrably switch to a mode which leaves
       everything else running.
@@ -482,7 +482,7 @@ Module features
 - [ ] "%d quoted lines" still not quite right.  Moving 'down' past it
       jumps to end of line.
 - [ ] Don't wrap email header lines when cursor isn't on the line - too noisy
-- [ ] notmuch reply should interpolate the first *visible* text part
+- [X] notmuch reply should interpolate the first *visible* text part
 - [ ] word-wrap subject (only) in email summary line
 - [ ] check for Efail errors from doc:open
 - [ ] make it practical for 'text' documents to contain non-utf8 so that
index ac73826217f3c61c730a347bfc4f8cbb44942f45..db1786514328bc38ff1ed0623524651ede01ea94 100644 (file)
@@ -2202,7 +2202,7 @@ class notmuch_master_view(edlib.Pane):
         if v:
             v.call("compose-email:copy-headers", self.message_pane, hdr_mode)
             if quote_mode == "inline":
-                # find first text part and copy it
+                # find first visible text part and copy it
                 msg = self.message_pane
                 m = edlib.Mark(msg)
                 while True:
@@ -2214,6 +2214,10 @@ class notmuch_master_view(edlib.Pane):
                         break
                     if which != "spacer":
                         continue
+                    vis = msg.call("doc:get-attr", "email:visible", m,
+                                   ret = 'str')
+                    if not vis or vis == 'none':
+                        continue
                     type = msg.call("doc:get-attr",
                                     "multipart-prev:email:content-type",
                                     m, ret='str')