From: NeilBrown Date: Thu, 1 Jun 2023 05:40:58 +0000 (+1000) Subject: notmuch: reply to first VISIBLE text part X-Git-Url: http://git.neil.brown.name/?a=commitdiff_plain;h=ef7f083087ca533a1841f43d0fb9d25fc83eb624;p=edlib.git notmuch: reply to first VISIBLE text part Instead of choosing first text part, choose first visible text part for interpolating into reply. Signed-off-by: NeilBrown --- diff --git a/DOC/TODO.md b/DOC/TODO.md index f615d12f..af85751a 100644 --- a/DOC/TODO.md +++ b/DOC/TODO.md @@ -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 diff --git a/python/module-notmuch.py b/python/module-notmuch.py index ac738262..db178651 100644 --- a/python/module-notmuch.py +++ b/python/module-notmuch.py @@ -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')