unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: David Bremner <david@tethera.net>
To: notmuch@notmuchmail.org
Subject: [PATCH 4/5] emacs: factor out calculation of mm-inline-override-types
Date: Sat, 19 Mar 2022 07:07:53 -0300	[thread overview]
Message-ID: <20220319100754.1670462-5-david@tethera.net> (raw)
In-Reply-To: <20220319100754.1670462-1-david@tethera.net>

The intended use case of this new function is to make reply behaviour
track that of show with respect to attachments.

Also fix the glob (which worked by fluke) into the documented regexp.
---
 emacs/notmuch-lib.el  |  8 ++++++++
 emacs/notmuch-show.el | 10 ++--------
 2 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el
index 6fc71cc7..1cc7e9c4 100644
--- a/emacs/notmuch-lib.el
+++ b/emacs/notmuch-lib.el
@@ -1037,6 +1037,14 @@ region if the region is active, or both `point' otherwise."
   'notmuch-interactive-region
   "notmuch 0.29")
 
+(defun notmuch--inline-override-types ()
+  "Override mm-inline-override-types to stop application/*
+parts from being displayed unless the user has customized
+it themselves."
+  (if (equal mm-inline-override-types
+	     (eval (car (get 'mm-inline-override-types 'standard-value))))
+      (cons "application/.*" mm-inline-override-types)
+    mm-inline-override-types))
 ;;; _
 
 (provide 'notmuch-lib)
diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index 7c1f02c9..69f6c845 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -1264,14 +1264,8 @@ matched."
   (let ((buffer-name (generate-new-buffer-name
 		      (or buffer-name
 			  (concat "*notmuch-" thread-id "*"))))
-	;; We override mm-inline-override-types to stop application/*
-	;; parts from being displayed unless the user has customized
-	;; it themselves.
-	(mm-inline-override-types
-	 (if (equal mm-inline-override-types
-		    (eval (car (get 'mm-inline-override-types 'standard-value))))
-	     (cons "application/*" mm-inline-override-types)
-	   mm-inline-override-types)))
+	(mm-inline-override-types (notmuch--inline-override-types)))
+
     (pop-to-buffer-same-window (get-buffer-create buffer-name))
     ;; No need to track undo information for this buffer.
     (setq buffer-undo-list t)
-- 
2.35.1

  parent reply	other threads:[~2022-03-19 10:08 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-19 10:07 do not inline application/* in replies David Bremner
2022-03-19 10:07 ` [PATCH 1/5] test: start corpus for attachments David Bremner
2022-03-19 10:07 ` [PATCH 2/5] test/emacs: add regression test for display of tar attachments David Bremner
2022-03-19 10:07 ` [PATCH 3/5] test: add known broken test for inlining in emacs/reply David Bremner
2022-03-19 10:07 ` David Bremner [this message]
2022-03-19 10:07 ` [PATCH 5/5] emacs/reply: restrict what mime types are inlined by default David Bremner
2022-05-16 10:22 ` do not inline application/* in replies 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=20220319100754.1670462-5-david@tethera.net \
    --to=david@tethera.net \
    --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).