[PATCH 4/5] emacs: factor out calculation of mm-inline-override-types

Subject: [PATCH 4/5] emacs: factor out calculation of mm-inline-override-types

Date: Sat, 19 Mar 2022 07:07:53 -0300

To: notmuch@notmuchmail.org

Cc:

From: David Bremner


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

_______________________________________________
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-leave@notmuchmail.org

Thread: