unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* [PATCH v4 0/7] emacs: Improve the cited message included in replies
@ 2015-11-07 11:04 Mark Walters
  2015-11-07 11:04 ` [PATCH v4 1/7] emacs/show: Re-arrange determination if a part header is necessary Mark Walters
                   ` (7 more replies)
  0 siblings, 8 replies; 18+ messages in thread
From: Mark Walters @ 2015-11-07 11:04 UTC (permalink / raw)
  To: notmuch

This is a rebase and somewhat tweaked version of dme's series from last year
id:1399897769-26809-1-git-send-email-dme@dme.org

One particular motivation for this series is that it fixes a long
standing bug we have that replying to a message with an rfc822 part
completely omits that part. It also fixes the bug whereby we don't
include application/octet-stream parts which are actually text/plain
(and thus are displayed in show mode).

This series makes the reply code use the same code as the show code so
everything works as expected: the reply buffer looks essentially the
same as the show buffer.

There is one slight difference: the user might want different part
headers displayed when replying; both because the audience is
different (a non-notmuch using recipient) and because the buttons
don't "work" (you can't click on them to show or view a part).

Dme and I disagree on which of these we would like to see so make that
customisable.

The key change is patch 3 which switches how reply works. Also note
that patch 2 is almost all whitespace change as the changes modify the
indentation.

Best wishes

Mark


David Edmondson (6):
  emacs/show: Re-arrange determination if a part header is necessary
  emacs/show: Accommodate the lack of part header buttons
  emacs/mua: Generate improved cited text for replies
  emacs/show: Remove the 'no-buttons option of
    `notmuch-show-insert-bodypart'
  emacs/show: Make the insertion of part headers overridable.
  emacs/mua: Let user specify which parts get a header in citations.

Mark Walters (1):
  test: fix the tests for the new reply code

 emacs/notmuch-mua.el  |  60 ++++++++++-----------
 emacs/notmuch-show.el | 141 +++++++++++++++++++++++++++++++-------------------
 test/T310-emacs.sh    |  32 ++++++++++++
 test/test-lib.el      |   4 ++
 4 files changed, 155 insertions(+), 82 deletions(-)

-- 
2.1.4

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [PATCH v4 1/7] emacs/show: Re-arrange determination if a part header is necessary
  2015-11-07 11:04 [PATCH v4 0/7] emacs: Improve the cited message included in replies Mark Walters
@ 2015-11-07 11:04 ` Mark Walters
  2016-02-09 20:28   ` David Edmondson
  2015-11-07 11:04 ` [PATCH v4 2/7] emacs/show: Accommodate the lack of part header buttons Mark Walters
                   ` (6 subsequent siblings)
  7 siblings, 1 reply; 18+ messages in thread
From: Mark Walters @ 2015-11-07 11:04 UTC (permalink / raw)
  To: notmuch

From: David Edmondson <dme@dme.org>

Move the determination of whether a part header is required to a
distinct function.
---
 emacs/notmuch-show.el | 25 ++++++++++++++++++-------
 1 file changed, 18 insertions(+), 7 deletions(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index 49fd198..47a02e5 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -929,6 +929,21 @@ (defun notmuch-show-lazy-part (part-args button)
       ;; showable this returns nil.
       (notmuch-show-create-part-overlays button part-beg part-end))))
 
+(defun notmuch-show-mime-type (part)
+  "Return the correct mime-type to use for PART."
+  (let ((content-type (downcase (plist-get part :content-type))))
+    (or (and (string= content-type "application/octet-stream")
+	     (notmuch-show-get-mime-type-of-application/octet-stream part))
+	(and (string= content-type "inline patch")
+	     "text/x-diff")
+	content-type)))
+
+(defun notmuch-show-insert-header-p (part hide)
+  "Return non-NIL if a header button should be inserted for this part."
+  (let ((mime-type (notmuch-show-mime-type part)))
+    (not (and (string= mime-type "text/plain")
+	      (<= (plist-get part :id) 1)))))
+
 (defun notmuch-show-insert-bodypart (msg part depth &optional hide)
   "Insert the body part PART at depth DEPTH in the current thread.
 
@@ -939,11 +954,7 @@ (defun notmuch-show-insert-bodypart (msg part depth &optional hide)
 useful for quoting in replies)."
 
   (let* ((content-type (downcase (plist-get part :content-type)))
-	 (mime-type (or (and (string= content-type "application/octet-stream")
-			     (notmuch-show-get-mime-type-of-application/octet-stream part))
-			(and (string= content-type "inline patch")
-			     "text/x-diff")
-			content-type))
+	 (mime-type (notmuch-show-mime-type part))
 	 (nth (plist-get part :id))
 	 (long (and (notmuch-match-content-type mime-type "text/*")
 		    (> notmuch-show-max-text-part-size 0)
@@ -951,8 +962,8 @@ (defun notmuch-show-insert-bodypart (msg part depth &optional hide)
 	 (beg (point))
 	 ;; We omit the part button for the first (or only) part if
 	 ;; this is text/plain, or HIDE is 'no-buttons.
-	 (button (unless (or (equal hide 'no-buttons)
-			     (and (string= mime-type "text/plain") (<= nth 1)))
+	 (button (when (and (not (equal hide 'no-buttons))
+			    (notmuch-show-insert-header-p part hide))
 		   (notmuch-show-insert-part-header nth mime-type content-type (plist-get part :filename))))
 	 ;; Hide the part initially if HIDE is t, or if it is too long
 	 ;; and we have a button to allow toggling (thus reply which
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH v4 2/7] emacs/show: Accommodate the lack of part header buttons
  2015-11-07 11:04 [PATCH v4 0/7] emacs: Improve the cited message included in replies Mark Walters
  2015-11-07 11:04 ` [PATCH v4 1/7] emacs/show: Re-arrange determination if a part header is necessary Mark Walters
@ 2015-11-07 11:04 ` Mark Walters
  2016-02-09 20:29   ` David Edmondson
  2015-11-07 11:04 ` [PATCH v4 3/7] emacs/mua: Generate improved cited text for replies Mark Walters
                   ` (5 subsequent siblings)
  7 siblings, 1 reply; 18+ messages in thread
From: Mark Walters @ 2015-11-07 11:04 UTC (permalink / raw)
  To: notmuch

From: David Edmondson <dme@dme.org>

Various pieces of code assumed (reasonably) that part header buttons
are present. Modify them to avoid problems if no part headers were
inserted.
---
 emacs/notmuch-show.el | 88 ++++++++++++++++++++++++++++-----------------------
 1 file changed, 48 insertions(+), 40 deletions(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index 47a02e5..9fc79e0 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -509,36 +509,37 @@ (defun notmuch-show-insert-part-header (nth content-type declared-type &optional
 
 (defun notmuch-show-toggle-part-invisibility (&optional button)
   (interactive)
-  (let* ((button (or button (button-at (point))))
-	 (overlay (button-get button 'overlay))
-	 (lazy-part (button-get button :notmuch-lazy-part)))
-    ;; We have a part to toggle if there is an overlay or if there is a lazy part.
-    ;; If neither is present we cannot toggle the part so we just return nil.
-    (when (or overlay lazy-part)
-      (let* ((show (button-get button :notmuch-part-hidden))
-	     (new-start (button-start button))
-	     (button-label (button-get button :base-label))
-	     (old-point (point))
-	     (properties (text-properties-at (button-start button)))
-	     (inhibit-read-only t))
-	;; Toggle the button itself.
-	(button-put button :notmuch-part-hidden (not show))
-	(goto-char new-start)
-	(insert "[ " button-label (if show " ]" " (hidden) ]"))
-	(set-text-properties new-start (point) properties)
-	(let ((old-end (button-end button)))
-	  (move-overlay button new-start (point))
-	  (delete-region (point) old-end))
-	(goto-char (min old-point (1- (button-end button))))
-	;; Return nil if there is a lazy-part, it is empty, and we are
-	;; trying to show it.  In all other cases return t.
-	(if lazy-part
-	    (when show
-	      (button-put button :notmuch-lazy-part nil)
-	      (notmuch-show-lazy-part lazy-part button))
-	  ;; else there must be an overlay.
-	  (overlay-put overlay 'invisible (not show))
-	  t)))))
+  (let ((button (or button (button-at (point)))))
+    (when button
+      (let ((overlay (button-get button 'overlay))
+	    (lazy-part (button-get button :notmuch-lazy-part)))
+	;; We have a part to toggle if there is an overlay or if there is a lazy part.
+	;; If neither is present we cannot toggle the part so we just return nil.
+	(when (or overlay lazy-part)
+	  (let* ((show (button-get button :notmuch-part-hidden))
+		 (new-start (button-start button))
+		 (button-label (button-get button :base-label))
+		 (old-point (point))
+		 (properties (text-properties-at (button-start button)))
+		 (inhibit-read-only t))
+	    ;; Toggle the button itself.
+	    (button-put button :notmuch-part-hidden (not show))
+	    (goto-char new-start)
+	    (insert "[ " button-label (if show " ]" " (hidden) ]"))
+	    (set-text-properties new-start (point) properties)
+	    (let ((old-end (button-end button)))
+	      (move-overlay button new-start (point))
+	      (delete-region (point) old-end))
+	    (goto-char (min old-point (1- (button-end button))))
+	    ;; Return nil if there is a lazy-part, it is empty, and we are
+	    ;; trying to show it.  In all other cases return t.
+	    (if lazy-part
+		(when show
+		  (button-put button :notmuch-lazy-part nil)
+		  (notmuch-show-lazy-part lazy-part button))
+	      ;; else there must be an overlay.
+	      (overlay-put overlay 'invisible (not show))
+	      t)))))))
 
 ;; Part content ID handling
 
@@ -647,14 +648,17 @@ (defun notmuch-show-insert-part-multipart/related (msg part content-type nth dep
   t)
 
 (defun notmuch-show-insert-part-multipart/signed (msg part content-type nth depth button)
-  (button-put button 'face 'notmuch-crypto-part-header)
-  ;; add signature status button if sigstatus provided
+  (when button
+    (button-put button 'face 'notmuch-crypto-part-header))
+  ;; Add signature status button if sigstatus provided.
   (if (plist-member part :sigstatus)
       (let* ((from (notmuch-show-get-header :From msg))
 	     (sigstatus (car (plist-get part :sigstatus))))
 	(notmuch-crypto-insert-sigstatus-button sigstatus from))
-    ;; if we're not adding sigstatus, tell the user how they can get it
-    (button-put button 'help-echo "Set notmuch-crypto-process-mime to process cryptographic MIME parts."))
+    ;; If we're not adding the signature status, tell the user how
+    ;; they can get it.
+    (when button
+      (button-put button 'help-echo "Set notmuch-crypto-process-mime to process cryptographic MIME parts.")))
 
   (let ((inner-parts (plist-get part :content))
 	(start (point)))
@@ -668,17 +672,20 @@ (defun notmuch-show-insert-part-multipart/signed (msg part content-type nth dept
   t)
 
 (defun notmuch-show-insert-part-multipart/encrypted (msg part content-type nth depth button)
-  (button-put button 'face 'notmuch-crypto-part-header)
-  ;; add encryption status button if encstatus specified
+  (when button
+    (button-put button 'face 'notmuch-crypto-part-header))
+  ;; Add encryption status button if encryption status is specified.
   (if (plist-member part :encstatus)
       (let ((encstatus (car (plist-get part :encstatus))))
 	(notmuch-crypto-insert-encstatus-button encstatus)
-	;; add signature status button if sigstatus specified
+	;; Add signature status button if signature status is
+	;; specified.
 	(if (plist-member part :sigstatus)
 	    (let* ((from (notmuch-show-get-header :From msg))
 		   (sigstatus (car (plist-get part :sigstatus))))
 	      (notmuch-crypto-insert-sigstatus-button sigstatus from))))
-    ;; if we're not adding encstatus, tell the user how they can get it
+    ;; If we're not adding the encryption status, tell the user how
+    ;; they can get it.
     (button-put button 'help-echo "Set notmuch-crypto-process-mime to process cryptographic MIME parts."))
 
   (let ((inner-parts (plist-get part :content))
@@ -977,8 +984,9 @@ (defun notmuch-show-insert-bodypart (msg part depth &optional hide)
 
     (if show-part
         (notmuch-show-insert-bodypart-internal msg part mime-type nth depth button)
-      (button-put button :notmuch-lazy-part
-                  (list msg part mime-type nth depth button)))
+      (when button
+	(button-put button :notmuch-lazy-part
+		    (list msg part mime-type nth depth button))))
 
     ;; Some of the body part handlers leave point somewhere up in the
     ;; part, so we make sure that we're down at the end.
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH v4 3/7] emacs/mua: Generate improved cited text for replies
  2015-11-07 11:04 [PATCH v4 0/7] emacs: Improve the cited message included in replies Mark Walters
  2015-11-07 11:04 ` [PATCH v4 1/7] emacs/show: Re-arrange determination if a part header is necessary Mark Walters
  2015-11-07 11:04 ` [PATCH v4 2/7] emacs/show: Accommodate the lack of part header buttons Mark Walters
@ 2015-11-07 11:04 ` Mark Walters
  2016-02-09 20:30   ` David Edmondson
  2015-11-07 11:04 ` [PATCH v4 4/7] emacs/show: Remove the 'no-buttons option of `notmuch-show-insert-bodypart' Mark Walters
                   ` (4 subsequent siblings)
  7 siblings, 1 reply; 18+ messages in thread
From: Mark Walters @ 2015-11-07 11:04 UTC (permalink / raw)
  To: notmuch

From: David Edmondson <dme@dme.org>

Use the message display code to generate message text to cite in
replies.
---
 emacs/notmuch-mua.el | 38 ++++++++------------------------------
 1 file changed, 8 insertions(+), 30 deletions(-)

diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el
index fd98ea4..2f7abb0 100644
--- a/emacs/notmuch-mua.el
+++ b/emacs/notmuch-mua.el
@@ -28,7 +28,7 @@
 
 (eval-when-compile (require 'cl))
 
-(declare-function notmuch-show-insert-bodypart "notmuch-show" (msg part depth &optional hide))
+(declare-function notmuch-show-insert-body "notmuch-show" (msg body depth))
 
 ;;
 
@@ -142,31 +142,6 @@ (defun notmuch-mua-reply-crypto (parts)
 	else if (notmuch-match-content-type (plist-get part :content-type) "multipart/*")
 	  do (notmuch-mua-reply-crypto (plist-get part :content))))
 
-(defun notmuch-mua-get-quotable-parts (parts)
-  (loop for part in parts
-	if (notmuch-match-content-type (plist-get part :content-type) "multipart/alternative")
-	  collect (let* ((subparts (plist-get part :content))
-			(types (mapcar (lambda (part) (plist-get part :content-type)) subparts))
-			(chosen-type (car (notmuch-multipart/alternative-choose types))))
-		   (loop for part in (reverse subparts)
-			 if (notmuch-match-content-type (plist-get part :content-type) chosen-type)
-			 return part))
-	else if (notmuch-match-content-type (plist-get part :content-type) "multipart/*")
-	  append (notmuch-mua-get-quotable-parts (plist-get part :content))
-	else if (notmuch-match-content-type (plist-get part :content-type) "text/*")
-	  collect part))
-
-(defun notmuch-mua-insert-quotable-part (message part)
-  ;; We don't want text properties leaking from the show renderer into
-  ;; the reply so we use a temp buffer. Also we don't want hooks, such
-  ;; as notmuch-wash-*, to be run on the quotable part so we set
-  ;; notmuch-show-insert-text/plain-hook to nil.
-  (insert (with-temp-buffer
-	    (let ((notmuch-show-insert-text/plain-hook nil))
-	      ;; Show the part but do not add buttons.
-	      (notmuch-show-insert-bodypart message part 0 'no-buttons))
-	    (buffer-substring-no-properties (point-min) (point-max)))))
-
 ;; There is a bug in emacs 23's message.el that results in a newline
 ;; not being inserted after the References header, so the next header
 ;; is concatenated to the end of it. This function fixes the problem,
@@ -245,10 +220,13 @@ (defun notmuch-mua-reply (query-string &optional sender reply-all)
 	(insert "From: " from "\n")
 	(insert "Date: " date "\n\n")
 
-	;; Get the parts of the original message that should be quoted; this includes
-	;; all the text parts, except the non-preferred ones in a multipart/alternative.
-	(let ((quotable-parts (notmuch-mua-get-quotable-parts (plist-get original :body))))
-	  (mapc (apply-partially 'notmuch-mua-insert-quotable-part original) quotable-parts))
+	(insert (with-temp-buffer
+		  ;; Don't attempt to clean up messages, excerpt
+		  ;; citations, etc. in the original message before
+		  ;; quoting.
+		  (let ((notmuch-show-insert-text/plain-hook nil))
+		    (notmuch-show-insert-body original (plist-get original :body) 0)
+		    (buffer-substring-no-properties (point-min) (point-max)))))
 
 	(set-mark (point))
 	(goto-char start)
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH v4 4/7] emacs/show: Remove the 'no-buttons option of `notmuch-show-insert-bodypart'
  2015-11-07 11:04 [PATCH v4 0/7] emacs: Improve the cited message included in replies Mark Walters
                   ` (2 preceding siblings ...)
  2015-11-07 11:04 ` [PATCH v4 3/7] emacs/mua: Generate improved cited text for replies Mark Walters
@ 2015-11-07 11:04 ` Mark Walters
  2016-02-09 20:31   ` David Edmondson
  2015-11-07 11:04 ` [PATCH v4 5/7] emacs/show: Make the insertion of part headers overridable Mark Walters
                   ` (3 subsequent siblings)
  7 siblings, 1 reply; 18+ messages in thread
From: Mark Walters @ 2015-11-07 11:04 UTC (permalink / raw)
  To: notmuch

From: David Edmondson <dme@dme.org>

No code uses the 'no-buttons argument to
`notmuch-show-insert-bodypart', so remove it.
---
 emacs/notmuch-show.el | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index 9fc79e0..f8184e2 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -956,9 +956,7 @@ (defun notmuch-show-insert-bodypart (msg part depth &optional hide)
 
 HIDE determines whether to show or hide the part and the button
 as follows: If HIDE is nil, show the part and the button. If HIDE
-is t, hide the part initially and show the button. If HIDE is
-'no-buttons, show the part but do not add any buttons (this is
-useful for quoting in replies)."
+is t, hide the part initially and show the button."
 
   (let* ((content-type (downcase (plist-get part :content-type)))
 	 (mime-type (notmuch-show-mime-type part))
@@ -969,8 +967,7 @@ (defun notmuch-show-insert-bodypart (msg part depth &optional hide)
 	 (beg (point))
 	 ;; We omit the part button for the first (or only) part if
 	 ;; this is text/plain, or HIDE is 'no-buttons.
-	 (button (when (and (not (equal hide 'no-buttons))
-			    (notmuch-show-insert-header-p part hide))
+	 (button (when (notmuch-show-insert-header-p part hide)
 		   (notmuch-show-insert-part-header nth mime-type content-type (plist-get part :filename))))
 	 ;; Hide the part initially if HIDE is t, or if it is too long
 	 ;; and we have a button to allow toggling (thus reply which
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH v4 5/7] emacs/show: Make the insertion of part headers overridable.
  2015-11-07 11:04 [PATCH v4 0/7] emacs: Improve the cited message included in replies Mark Walters
                   ` (3 preceding siblings ...)
  2015-11-07 11:04 ` [PATCH v4 4/7] emacs/show: Remove the 'no-buttons option of `notmuch-show-insert-bodypart' Mark Walters
@ 2015-11-07 11:04 ` Mark Walters
  2016-02-09 20:32   ` David Edmondson
  2015-11-07 11:04 ` [PATCH v4 6/7] emacs/mua: Let user specify which parts get a header in citations Mark Walters
                   ` (2 subsequent siblings)
  7 siblings, 1 reply; 18+ messages in thread
From: Mark Walters @ 2015-11-07 11:04 UTC (permalink / raw)
  To: notmuch

From: David Edmondson <dme@dme.org>

This allows callers of notmuch-show-insert-bodypart to use a `let'
binding to override the default function for specifying when part
headers should be inserted.
---
 emacs/notmuch-show.el | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index f8184e2..f4a65cc 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -945,8 +945,16 @@ (defun notmuch-show-mime-type (part)
 	     "text/x-diff")
 	content-type)))
 
+;; The following variable can be overridden by let bindings.
+(defvar notmuch-show-insert-header-p-function 'notmuch-show-insert-header-p
+  "Specify which function decides which part headers get inserted.
+
+The function should take two parameters, PART and HIDE, and
+should return non-NIL if a header button should be inserted for
+this part.")
+
 (defun notmuch-show-insert-header-p (part hide)
-  "Return non-NIL if a header button should be inserted for this part."
+  ;; Show all part buttons except for the first part if it is text/plain.
   (let ((mime-type (notmuch-show-mime-type part)))
     (not (and (string= mime-type "text/plain")
 	      (<= (plist-get part :id) 1)))))
@@ -965,9 +973,9 @@ (defun notmuch-show-insert-bodypart (msg part depth &optional hide)
 		    (> notmuch-show-max-text-part-size 0)
 		    (> (length (plist-get part :content)) notmuch-show-max-text-part-size)))
 	 (beg (point))
-	 ;; We omit the part button for the first (or only) part if
-	 ;; this is text/plain, or HIDE is 'no-buttons.
-	 (button (when (notmuch-show-insert-header-p part hide)
+	 ;; This default header-p function omits the part button for
+	 ;; the first (or only) part if this is text/plain.
+	 (button (when (funcall notmuch-show-insert-header-p-function part hide)
 		   (notmuch-show-insert-part-header nth mime-type content-type (plist-get part :filename))))
 	 ;; Hide the part initially if HIDE is t, or if it is too long
 	 ;; and we have a button to allow toggling (thus reply which
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH v4 6/7] emacs/mua: Let user specify which parts get a header in citations.
  2015-11-07 11:04 [PATCH v4 0/7] emacs: Improve the cited message included in replies Mark Walters
                   ` (4 preceding siblings ...)
  2015-11-07 11:04 ` [PATCH v4 5/7] emacs/show: Make the insertion of part headers overridable Mark Walters
@ 2015-11-07 11:04 ` Mark Walters
  2016-02-09 20:34   ` David Edmondson
  2015-11-07 11:04 ` [PATCH v4 7/7] test: fix the tests for the new reply code Mark Walters
  2016-02-08 17:11 ` [PATCH v4 0/7] emacs: Improve the cited message included in replies David Edmondson
  7 siblings, 1 reply; 18+ messages in thread
From: Mark Walters @ 2015-11-07 11:04 UTC (permalink / raw)
  To: notmuch

From: David Edmondson <dme@dme.org>

Add a customizable function specifying which parts get a header when
replying, and give some sensible possiblities. These are,

1) all parts except multipart/*. (Subparts of a multipart part do
receive a header button.)

2) only included text/* parts.

3) Exactly as in the show buffer.

4) None at all. This means the reply contains a mish-mash of all the
original message's parts.
---
 emacs/notmuch-mua.el  | 30 ++++++++++++++++++++++++++----
 emacs/notmuch-show.el | 13 +++++++++++++
 2 files changed, 39 insertions(+), 4 deletions(-)

diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el
index 2f7abb0..a675f47 100644
--- a/emacs/notmuch-mua.el
+++ b/emacs/notmuch-mua.el
@@ -91,6 +91,23 @@ (defcustom notmuch-mua-cite-function 'message-cite-original
   :link '(custom-manual "(message)Insertion Variables")
   :group 'notmuch-reply)
 
+(defcustom notmuch-mua-reply-insert-header-p-function
+  'notmuch-show-reply-insert-header-p-trimmed
+  "Function to decide which parts get a header when replying.
+
+This function specifies which parts of a mime message with
+mutiple parts get a header."
+  :type '(radio (const :tag "All except multipart/* and hidden parts"
+			       notmuch-show-reply-insert-header-p-trimmed)
+		(const :tag "Only for included text parts"
+			       notmuch-show-reply-insert-header-p-minimal)
+		(const :tag "Exactly as in show view"
+			       notmuch-show-insert-header-p)
+		(const :tag "No part headers"
+			       notmuch-show-reply-insert-header-p-never)
+		(function :tag "Other"))
+  :group 'notmuch-reply)
+
 ;;
 
 (defun notmuch-mua-get-switch-function ()
@@ -221,10 +238,15 @@ (defun notmuch-mua-reply (query-string &optional sender reply-all)
 	(insert "Date: " date "\n\n")
 
 	(insert (with-temp-buffer
-		  ;; Don't attempt to clean up messages, excerpt
-		  ;; citations, etc. in the original message before
-		  ;; quoting.
-		  (let ((notmuch-show-insert-text/plain-hook nil))
+		  (let
+		      ;; Don't attempt to clean up messages, excerpt
+		      ;; citations, etc. in the original message before
+		      ;; quoting.
+		      ((notmuch-show-insert-text/plain-hook nil)
+		       ;; Don't omit long parts.
+		       (notmuch-show-max-text-part-size 0)
+		       ;; Insert headers for parts as appropriate for replying.
+		       (notmuch-show-insert-header-p-function notmuch-mua-reply-insert-header-p-function))
 		    (notmuch-show-insert-body original (plist-get original :body) 0)
 		    (buffer-substring-no-properties (point-min) (point-max)))))
 
diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index f4a65cc..7ff9ed5 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -959,6 +959,19 @@ (defun notmuch-show-insert-header-p (part hide)
     (not (and (string= mime-type "text/plain")
 	      (<= (plist-get part :id) 1)))))
 
+(defun notmuch-show-reply-insert-header-p-never (part hide)
+  nil)
+
+(defun notmuch-show-reply-insert-header-p-trimmed (part hide)
+  (let ((mime-type (notmuch-show-mime-type part)))
+    (and (not (notmuch-match-content-type mime-type "multipart/*"))
+	 (not hide))))
+
+(defun notmuch-show-reply-insert-header-p-minimal (part hide)
+  (let ((mime-type (notmuch-show-mime-type part)))
+    (and (notmuch-match-content-type mime-type "text/*")
+	 (not hide))))
+
 (defun notmuch-show-insert-bodypart (msg part depth &optional hide)
   "Insert the body part PART at depth DEPTH in the current thread.
 
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH v4 7/7] test: fix the tests for the new reply code
  2015-11-07 11:04 [PATCH v4 0/7] emacs: Improve the cited message included in replies Mark Walters
                   ` (5 preceding siblings ...)
  2015-11-07 11:04 ` [PATCH v4 6/7] emacs/mua: Let user specify which parts get a header in citations Mark Walters
@ 2015-11-07 11:04 ` Mark Walters
  2016-02-09 20:34   ` David Edmondson
  2016-02-08 17:11 ` [PATCH v4 0/7] emacs: Improve the cited message included in replies David Edmondson
  7 siblings, 1 reply; 18+ messages in thread
From: Mark Walters @ 2015-11-07 11:04 UTC (permalink / raw)
  To: notmuch

This sets the part-insertion code to never insert part headers (as we
didn't before).

With that change there is only one failing test: this test has a text
part (an email message) listed as application/octet-stream. Notmuch
show displays this part, but the reply code omitted it as it had type
application/octet-stream. The new code correctly includes it. Thus
update the expected output to match.
---
 test/T310-emacs.sh | 32 ++++++++++++++++++++++++++++++++
 test/test-lib.el   |  4 ++++
 2 files changed, 36 insertions(+)

diff --git a/test/T310-emacs.sh b/test/T310-emacs.sh
index 61bc369..22ca71c 100755
--- a/test/T310-emacs.sh
+++ b/test/T310-emacs.sh
@@ -473,6 +473,38 @@ Alex Botero-Lowry <alex.boterolowry@gmail.com> writes:
 > and http://mail-index.netbsd.org/pkgsrc-bugs/2006/06/07/msg016808.htmlspecifically
 > uses 64 as the
 > buffer size.
+> From e3bc4bbd7b9d0d086816ab5f8f2d6ffea1dd3ea4 Mon Sep 17 00:00:00 2001
+> From: Alexander Botero-Lowry <alex.boterolowry@gmail.com>
+> Date: Tue, 17 Nov 2009 11:30:39 -0800
+> Subject: [PATCH] Deal with situation where sysconf(_SC_GETPW_R_SIZE_MAX) returns -1
+>
+> ---
+>  notmuch-config.c |    2 ++
+>  1 files changed, 2 insertions(+), 0 deletions(-)
+>
+> diff --git a/notmuch-config.c b/notmuch-config.c
+> index 248149c..e7220d8 100644
+> --- a/notmuch-config.c
+> +++ b/notmuch-config.c
+> @@ -77,6 +77,7 @@ static char *
+>  get_name_from_passwd_file (void *ctx)
+>  {
+>      long pw_buf_size = sysconf(_SC_GETPW_R_SIZE_MAX);
+> +    if (pw_buf_size == -1) pw_buf_size = 64;
+>      char *pw_buf = talloc_zero_size (ctx, pw_buf_size);
+>      struct passwd passwd, *ignored;
+>      char *name;
+> @@ -101,6 +102,7 @@ static char *
+>  get_username_from_passwd_file (void *ctx)
+>  {
+>      long pw_buf_size = sysconf(_SC_GETPW_R_SIZE_MAX);
+> +    if (pw_buf_size == -1) pw_buf_size = 64;
+>      char *pw_buf = talloc_zero_size (ctx, pw_buf_size);
+>      struct passwd passwd, *ignored;
+>      char *name;
+> -- 
+> 1.6.5.2
+>
 > _______________________________________________
 > notmuch mailing list
 > notmuch@notmuchmail.org
diff --git a/test/test-lib.el b/test/test-lib.el
index 04c8d63..6e1689a 100644
--- a/test/test-lib.el
+++ b/test/test-lib.el
@@ -184,6 +184,10 @@ (defmacro notmuch-test-progn (&rest body)
 (setq notmuch-tag-deleted-formats
       '((".*" nil)))
 
+;; For historical reasonse we don't print part headers when replying
+;; in the tests suite
+(setq notmuch-mua-reply-insert-header-p-function 'notmuch-show-reply-insert-header-p-never)
+
 ;; force a common html renderer, to avoid test variations between
 ;; environments
 
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* Re: [PATCH v4 0/7] emacs: Improve the cited message included in replies
  2015-11-07 11:04 [PATCH v4 0/7] emacs: Improve the cited message included in replies Mark Walters
                   ` (6 preceding siblings ...)
  2015-11-07 11:04 ` [PATCH v4 7/7] test: fix the tests for the new reply code Mark Walters
@ 2016-02-08 17:11 ` David Edmondson
  7 siblings, 0 replies; 18+ messages in thread
From: David Edmondson @ 2016-02-08 17:11 UTC (permalink / raw)
  To: notmuch

On Sat, Nov 07 2015, Mark Walters wrote:
> This is a rebase and somewhat tweaked version of dme's series from last year
> id:1399897769-26809-1-git-send-email-dme@dme.org

I'm a bad person to review these changes, having written some of
them. Could someone else take a look?

> One particular motivation for this series is that it fixes a long
> standing bug we have that replying to a message with an rfc822 part
> completely omits that part. It also fixes the bug whereby we don't
> include application/octet-stream parts which are actually text/plain
> (and thus are displayed in show mode).
>
> This series makes the reply code use the same code as the show code so
> everything works as expected: the reply buffer looks essentially the
> same as the show buffer.
>
> There is one slight difference: the user might want different part
> headers displayed when replying; both because the audience is
> different (a non-notmuch using recipient) and because the buttons
> don't "work" (you can't click on them to show or view a part).
>
> Dme and I disagree on which of these we would like to see so make that
> customisable.
>
> The key change is patch 3 which switches how reply works. Also note
> that patch 2 is almost all whitespace change as the changes modify the
> indentation.
>
> Best wishes
>
> Mark
>
>
> David Edmondson (6):
>   emacs/show: Re-arrange determination if a part header is necessary
>   emacs/show: Accommodate the lack of part header buttons
>   emacs/mua: Generate improved cited text for replies
>   emacs/show: Remove the 'no-buttons option of
>     `notmuch-show-insert-bodypart'
>   emacs/show: Make the insertion of part headers overridable.
>   emacs/mua: Let user specify which parts get a header in citations.
>
> Mark Walters (1):
>   test: fix the tests for the new reply code
>
>  emacs/notmuch-mua.el  |  60 ++++++++++-----------
>  emacs/notmuch-show.el | 141 +++++++++++++++++++++++++++++++-------------------
>  test/T310-emacs.sh    |  32 ++++++++++++
>  test/test-lib.el      |   4 ++
>  4 files changed, 155 insertions(+), 82 deletions(-)
>
> -- 
> 2.1.4
>
> _______________________________________________
> notmuch mailing list
> notmuch@notmuchmail.org
> https://notmuchmail.org/mailman/listinfo/notmuch

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH v4 1/7] emacs/show: Re-arrange determination if a part header is necessary
  2015-11-07 11:04 ` [PATCH v4 1/7] emacs/show: Re-arrange determination if a part header is necessary Mark Walters
@ 2016-02-09 20:28   ` David Edmondson
  0 siblings, 0 replies; 18+ messages in thread
From: David Edmondson @ 2016-02-09 20:28 UTC (permalink / raw)
  To: Mark Walters, notmuch

On Sat, Nov 07 2015, Mark Walters wrote:
> From: David Edmondson <dme@dme.org>
>
> Move the determination of whether a part header is required to a
> distinct function.
> ---
>  emacs/notmuch-show.el | 25 ++++++++++++++++++-------
>  1 file changed, 18 insertions(+), 7 deletions(-)
>
> diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
> index 49fd198..47a02e5 100644
> --- a/emacs/notmuch-show.el
> +++ b/emacs/notmuch-show.el
> @@ -929,6 +929,21 @@ (defun notmuch-show-lazy-part (part-args button)
>        ;; showable this returns nil.
>        (notmuch-show-create-part-overlays button part-beg part-end))))
>  
> +(defun notmuch-show-mime-type (part)
> +  "Return the correct mime-type to use for PART."
> +  (let ((content-type (downcase (plist-get part :content-type))))
> +    (or (and (string= content-type "application/octet-stream")
> +	     (notmuch-show-get-mime-type-of-application/octet-stream part))
> +	(and (string= content-type "inline patch")
> +	     "text/x-diff")
> +	content-type)))
> +
> +(defun notmuch-show-insert-header-p (part hide)
> +  "Return non-NIL if a header button should be inserted for this part."
> +  (let ((mime-type (notmuch-show-mime-type part)))
> +    (not (and (string= mime-type "text/plain")
> +	      (<= (plist-get part :id) 1)))))

It would be nice to have a comment here that explained the logic being
applied (i.e. parts get a header unless they are text/plain and the
first part). (It actually took me a minute to figure out what the logic
was...)

> +
>  (defun notmuch-show-insert-bodypart (msg part depth &optional hide)
>    "Insert the body part PART at depth DEPTH in the current thread.
>  
> @@ -939,11 +954,7 @@ (defun notmuch-show-insert-bodypart (msg part depth &optional hide)
>  useful for quoting in replies)."
>  
>    (let* ((content-type (downcase (plist-get part :content-type)))
> -	 (mime-type (or (and (string= content-type "application/octet-stream")
> -			     (notmuch-show-get-mime-type-of-application/octet-stream part))
> -			(and (string= content-type "inline patch")
> -			     "text/x-diff")
> -			content-type))
> +	 (mime-type (notmuch-show-mime-type part))
>  	 (nth (plist-get part :id))
>  	 (long (and (notmuch-match-content-type mime-type "text/*")
>  		    (> notmuch-show-max-text-part-size 0)
> @@ -951,8 +962,8 @@ (defun notmuch-show-insert-bodypart (msg part depth &optional hide)
>  	 (beg (point))
>  	 ;; We omit the part button for the first (or only) part if
>  	 ;; this is text/plain, or HIDE is 'no-buttons.

Part of this comment now belongs up above.

> -	 (button (unless (or (equal hide 'no-buttons)
> -			     (and (string= mime-type "text/plain") (<= nth 1)))
> +	 (button (when (and (not (equal hide 'no-buttons))
> +			    (notmuch-show-insert-header-p part hide))
>  		   (notmuch-show-insert-part-header nth mime-type content-type (plist-get part :filename))))
>  	 ;; Hide the part initially if HIDE is t, or if it is too long
>  	 ;; and we have a button to allow toggling (thus reply which
> -- 
> 2.1.4

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH v4 2/7] emacs/show: Accommodate the lack of part header buttons
  2015-11-07 11:04 ` [PATCH v4 2/7] emacs/show: Accommodate the lack of part header buttons Mark Walters
@ 2016-02-09 20:29   ` David Edmondson
  0 siblings, 0 replies; 18+ messages in thread
From: David Edmondson @ 2016-02-09 20:29 UTC (permalink / raw)
  To: Mark Walters, notmuch

On Sat, Nov 07 2015, Mark Walters wrote:
> From: David Edmondson <dme@dme.org>
>
> Various pieces of code assumed (reasonably) that part header buttons
> are present. Modify them to avoid problems if no part headers were
> inserted.

This looks fine.

> ---
>  emacs/notmuch-show.el | 88 ++++++++++++++++++++++++++++-----------------------
>  1 file changed, 48 insertions(+), 40 deletions(-)
>
> diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
> index 47a02e5..9fc79e0 100644
> --- a/emacs/notmuch-show.el
> +++ b/emacs/notmuch-show.el
> @@ -509,36 +509,37 @@ (defun notmuch-show-insert-part-header (nth content-type declared-type &optional
>  
>  (defun notmuch-show-toggle-part-invisibility (&optional button)
>    (interactive)
> -  (let* ((button (or button (button-at (point))))
> -	 (overlay (button-get button 'overlay))
> -	 (lazy-part (button-get button :notmuch-lazy-part)))
> -    ;; We have a part to toggle if there is an overlay or if there is a lazy part.
> -    ;; If neither is present we cannot toggle the part so we just return nil.
> -    (when (or overlay lazy-part)
> -      (let* ((show (button-get button :notmuch-part-hidden))
> -	     (new-start (button-start button))
> -	     (button-label (button-get button :base-label))
> -	     (old-point (point))
> -	     (properties (text-properties-at (button-start button)))
> -	     (inhibit-read-only t))
> -	;; Toggle the button itself.
> -	(button-put button :notmuch-part-hidden (not show))
> -	(goto-char new-start)
> -	(insert "[ " button-label (if show " ]" " (hidden) ]"))
> -	(set-text-properties new-start (point) properties)
> -	(let ((old-end (button-end button)))
> -	  (move-overlay button new-start (point))
> -	  (delete-region (point) old-end))
> -	(goto-char (min old-point (1- (button-end button))))
> -	;; Return nil if there is a lazy-part, it is empty, and we are
> -	;; trying to show it.  In all other cases return t.
> -	(if lazy-part
> -	    (when show
> -	      (button-put button :notmuch-lazy-part nil)
> -	      (notmuch-show-lazy-part lazy-part button))
> -	  ;; else there must be an overlay.
> -	  (overlay-put overlay 'invisible (not show))
> -	  t)))))
> +  (let ((button (or button (button-at (point)))))
> +    (when button
> +      (let ((overlay (button-get button 'overlay))
> +	    (lazy-part (button-get button :notmuch-lazy-part)))
> +	;; We have a part to toggle if there is an overlay or if there is a lazy part.
> +	;; If neither is present we cannot toggle the part so we just return nil.
> +	(when (or overlay lazy-part)
> +	  (let* ((show (button-get button :notmuch-part-hidden))
> +		 (new-start (button-start button))
> +		 (button-label (button-get button :base-label))
> +		 (old-point (point))
> +		 (properties (text-properties-at (button-start button)))
> +		 (inhibit-read-only t))
> +	    ;; Toggle the button itself.
> +	    (button-put button :notmuch-part-hidden (not show))
> +	    (goto-char new-start)
> +	    (insert "[ " button-label (if show " ]" " (hidden) ]"))
> +	    (set-text-properties new-start (point) properties)
> +	    (let ((old-end (button-end button)))
> +	      (move-overlay button new-start (point))
> +	      (delete-region (point) old-end))
> +	    (goto-char (min old-point (1- (button-end button))))
> +	    ;; Return nil if there is a lazy-part, it is empty, and we are
> +	    ;; trying to show it.  In all other cases return t.
> +	    (if lazy-part
> +		(when show
> +		  (button-put button :notmuch-lazy-part nil)
> +		  (notmuch-show-lazy-part lazy-part button))
> +	      ;; else there must be an overlay.
> +	      (overlay-put overlay 'invisible (not show))
> +	      t)))))))
>  
>  ;; Part content ID handling
>  
> @@ -647,14 +648,17 @@ (defun notmuch-show-insert-part-multipart/related (msg part content-type nth dep
>    t)
>  
>  (defun notmuch-show-insert-part-multipart/signed (msg part content-type nth depth button)
> -  (button-put button 'face 'notmuch-crypto-part-header)
> -  ;; add signature status button if sigstatus provided
> +  (when button
> +    (button-put button 'face 'notmuch-crypto-part-header))
> +  ;; Add signature status button if sigstatus provided.
>    (if (plist-member part :sigstatus)
>        (let* ((from (notmuch-show-get-header :From msg))
>  	     (sigstatus (car (plist-get part :sigstatus))))
>  	(notmuch-crypto-insert-sigstatus-button sigstatus from))
> -    ;; if we're not adding sigstatus, tell the user how they can get it
> -    (button-put button 'help-echo "Set notmuch-crypto-process-mime to process cryptographic MIME parts."))
> +    ;; If we're not adding the signature status, tell the user how
> +    ;; they can get it.
> +    (when button
> +      (button-put button 'help-echo "Set notmuch-crypto-process-mime to process cryptographic MIME parts.")))
>  
>    (let ((inner-parts (plist-get part :content))
>  	(start (point)))
> @@ -668,17 +672,20 @@ (defun notmuch-show-insert-part-multipart/signed (msg part content-type nth dept
>    t)
>  
>  (defun notmuch-show-insert-part-multipart/encrypted (msg part content-type nth depth button)
> -  (button-put button 'face 'notmuch-crypto-part-header)
> -  ;; add encryption status button if encstatus specified
> +  (when button
> +    (button-put button 'face 'notmuch-crypto-part-header))
> +  ;; Add encryption status button if encryption status is specified.
>    (if (plist-member part :encstatus)
>        (let ((encstatus (car (plist-get part :encstatus))))
>  	(notmuch-crypto-insert-encstatus-button encstatus)
> -	;; add signature status button if sigstatus specified
> +	;; Add signature status button if signature status is
> +	;; specified.
>  	(if (plist-member part :sigstatus)
>  	    (let* ((from (notmuch-show-get-header :From msg))
>  		   (sigstatus (car (plist-get part :sigstatus))))
>  	      (notmuch-crypto-insert-sigstatus-button sigstatus from))))
> -    ;; if we're not adding encstatus, tell the user how they can get it
> +    ;; If we're not adding the encryption status, tell the user how
> +    ;; they can get it.
>      (button-put button 'help-echo "Set notmuch-crypto-process-mime to process cryptographic MIME parts."))
>  
>    (let ((inner-parts (plist-get part :content))
> @@ -977,8 +984,9 @@ (defun notmuch-show-insert-bodypart (msg part depth &optional hide)
>  
>      (if show-part
>          (notmuch-show-insert-bodypart-internal msg part mime-type nth depth button)
> -      (button-put button :notmuch-lazy-part
> -                  (list msg part mime-type nth depth button)))
> +      (when button
> +	(button-put button :notmuch-lazy-part
> +		    (list msg part mime-type nth depth button))))
>  
>      ;; Some of the body part handlers leave point somewhere up in the
>      ;; part, so we make sure that we're down at the end.
> -- 
> 2.1.4

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH v4 3/7] emacs/mua: Generate improved cited text for replies
  2015-11-07 11:04 ` [PATCH v4 3/7] emacs/mua: Generate improved cited text for replies Mark Walters
@ 2016-02-09 20:30   ` David Edmondson
  0 siblings, 0 replies; 18+ messages in thread
From: David Edmondson @ 2016-02-09 20:30 UTC (permalink / raw)
  To: Mark Walters, notmuch

On Sat, Nov 07 2015, Mark Walters wrote:
> From: David Edmondson <dme@dme.org>
>
> Use the message display code to generate message text to cite in
> replies.

Looks fine.

> ---
>  emacs/notmuch-mua.el | 38 ++++++++------------------------------
>  1 file changed, 8 insertions(+), 30 deletions(-)
>
> diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el
> index fd98ea4..2f7abb0 100644
> --- a/emacs/notmuch-mua.el
> +++ b/emacs/notmuch-mua.el
> @@ -28,7 +28,7 @@
>  
>  (eval-when-compile (require 'cl))
>  
> -(declare-function notmuch-show-insert-bodypart "notmuch-show" (msg part depth &optional hide))
> +(declare-function notmuch-show-insert-body "notmuch-show" (msg body depth))
>  
>  ;;
>  
> @@ -142,31 +142,6 @@ (defun notmuch-mua-reply-crypto (parts)
>  	else if (notmuch-match-content-type (plist-get part :content-type) "multipart/*")
>  	  do (notmuch-mua-reply-crypto (plist-get part :content))))
>  
> -(defun notmuch-mua-get-quotable-parts (parts)
> -  (loop for part in parts
> -	if (notmuch-match-content-type (plist-get part :content-type) "multipart/alternative")
> -	  collect (let* ((subparts (plist-get part :content))
> -			(types (mapcar (lambda (part) (plist-get part :content-type)) subparts))
> -			(chosen-type (car (notmuch-multipart/alternative-choose types))))
> -		   (loop for part in (reverse subparts)
> -			 if (notmuch-match-content-type (plist-get part :content-type) chosen-type)
> -			 return part))
> -	else if (notmuch-match-content-type (plist-get part :content-type) "multipart/*")
> -	  append (notmuch-mua-get-quotable-parts (plist-get part :content))
> -	else if (notmuch-match-content-type (plist-get part :content-type) "text/*")
> -	  collect part))
> -
> -(defun notmuch-mua-insert-quotable-part (message part)
> -  ;; We don't want text properties leaking from the show renderer into
> -  ;; the reply so we use a temp buffer. Also we don't want hooks, such
> -  ;; as notmuch-wash-*, to be run on the quotable part so we set
> -  ;; notmuch-show-insert-text/plain-hook to nil.
> -  (insert (with-temp-buffer
> -	    (let ((notmuch-show-insert-text/plain-hook nil))
> -	      ;; Show the part but do not add buttons.
> -	      (notmuch-show-insert-bodypart message part 0 'no-buttons))
> -	    (buffer-substring-no-properties (point-min) (point-max)))))
> -
>  ;; There is a bug in emacs 23's message.el that results in a newline
>  ;; not being inserted after the References header, so the next header
>  ;; is concatenated to the end of it. This function fixes the problem,
> @@ -245,10 +220,13 @@ (defun notmuch-mua-reply (query-string &optional sender reply-all)
>  	(insert "From: " from "\n")
>  	(insert "Date: " date "\n\n")
>  
> -	;; Get the parts of the original message that should be quoted; this includes
> -	;; all the text parts, except the non-preferred ones in a multipart/alternative.
> -	(let ((quotable-parts (notmuch-mua-get-quotable-parts (plist-get original :body))))
> -	  (mapc (apply-partially 'notmuch-mua-insert-quotable-part original) quotable-parts))
> +	(insert (with-temp-buffer
> +		  ;; Don't attempt to clean up messages, excerpt
> +		  ;; citations, etc. in the original message before
> +		  ;; quoting.
> +		  (let ((notmuch-show-insert-text/plain-hook nil))
> +		    (notmuch-show-insert-body original (plist-get original :body) 0)
> +		    (buffer-substring-no-properties (point-min) (point-max)))))
>  
>  	(set-mark (point))
>  	(goto-char start)
> -- 
> 2.1.4

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH v4 4/7] emacs/show: Remove the 'no-buttons option of `notmuch-show-insert-bodypart'
  2015-11-07 11:04 ` [PATCH v4 4/7] emacs/show: Remove the 'no-buttons option of `notmuch-show-insert-bodypart' Mark Walters
@ 2016-02-09 20:31   ` David Edmondson
  0 siblings, 0 replies; 18+ messages in thread
From: David Edmondson @ 2016-02-09 20:31 UTC (permalink / raw)
  To: Mark Walters, notmuch

On Sat, Nov 07 2015, Mark Walters wrote:
> From: David Edmondson <dme@dme.org>
>
> No code uses the 'no-buttons argument to
> `notmuch-show-insert-bodypart', so remove it.

Looks fine.
> ---
>  emacs/notmuch-show.el | 7 ++-----
>  1 file changed, 2 insertions(+), 5 deletions(-)
>
> diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
> index 9fc79e0..f8184e2 100644
> --- a/emacs/notmuch-show.el
> +++ b/emacs/notmuch-show.el
> @@ -956,9 +956,7 @@ (defun notmuch-show-insert-bodypart (msg part depth &optional hide)
>  
>  HIDE determines whether to show or hide the part and the button
>  as follows: If HIDE is nil, show the part and the button. If HIDE
> -is t, hide the part initially and show the button. If HIDE is
> -'no-buttons, show the part but do not add any buttons (this is
> -useful for quoting in replies)."
> +is t, hide the part initially and show the button."
>  
>    (let* ((content-type (downcase (plist-get part :content-type)))
>  	 (mime-type (notmuch-show-mime-type part))
> @@ -969,8 +967,7 @@ (defun notmuch-show-insert-bodypart (msg part depth &optional hide)
>  	 (beg (point))
>  	 ;; We omit the part button for the first (or only) part if
>  	 ;; this is text/plain, or HIDE is 'no-buttons.
> -	 (button (when (and (not (equal hide 'no-buttons))
> -			    (notmuch-show-insert-header-p part hide))
> +	 (button (when (notmuch-show-insert-header-p part hide)
>  		   (notmuch-show-insert-part-header nth mime-type content-type (plist-get part :filename))))
>  	 ;; Hide the part initially if HIDE is t, or if it is too long
>  	 ;; and we have a button to allow toggling (thus reply which
> -- 
> 2.1.4

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH v4 5/7] emacs/show: Make the insertion of part headers overridable.
  2015-11-07 11:04 ` [PATCH v4 5/7] emacs/show: Make the insertion of part headers overridable Mark Walters
@ 2016-02-09 20:32   ` David Edmondson
  0 siblings, 0 replies; 18+ messages in thread
From: David Edmondson @ 2016-02-09 20:32 UTC (permalink / raw)
  To: Mark Walters, notmuch

On Sat, Nov 07 2015, Mark Walters wrote:
> From: David Edmondson <dme@dme.org>
>
> This allows callers of notmuch-show-insert-bodypart to use a `let'
> binding to override the default function for specifying when part
> headers should be inserted.

Looks fine.

> ---
>  emacs/notmuch-show.el | 16 ++++++++++++----
>  1 file changed, 12 insertions(+), 4 deletions(-)
>
> diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
> index f8184e2..f4a65cc 100644
> --- a/emacs/notmuch-show.el
> +++ b/emacs/notmuch-show.el
> @@ -945,8 +945,16 @@ (defun notmuch-show-mime-type (part)
>  	     "text/x-diff")
>  	content-type)))
>  
> +;; The following variable can be overridden by let bindings.
> +(defvar notmuch-show-insert-header-p-function 'notmuch-show-insert-header-p
> +  "Specify which function decides which part headers get inserted.
> +
> +The function should take two parameters, PART and HIDE, and
> +should return non-NIL if a header button should be inserted for
> +this part.")
> +
>  (defun notmuch-show-insert-header-p (part hide)
> -  "Return non-NIL if a header button should be inserted for this part."
> +  ;; Show all part buttons except for the first part if it is text/plain.
>    (let ((mime-type (notmuch-show-mime-type part)))
>      (not (and (string= mime-type "text/plain")
>  	      (<= (plist-get part :id) 1)))))
> @@ -965,9 +973,9 @@ (defun notmuch-show-insert-bodypart (msg part depth &optional hide)
>  		    (> notmuch-show-max-text-part-size 0)
>  		    (> (length (plist-get part :content)) notmuch-show-max-text-part-size)))
>  	 (beg (point))
> -	 ;; We omit the part button for the first (or only) part if
> -	 ;; this is text/plain, or HIDE is 'no-buttons.
> -	 (button (when (notmuch-show-insert-header-p part hide)
> +	 ;; This default header-p function omits the part button for
> +	 ;; the first (or only) part if this is text/plain.
> +	 (button (when (funcall notmuch-show-insert-header-p-function part hide)
>  		   (notmuch-show-insert-part-header nth mime-type content-type (plist-get part :filename))))
>  	 ;; Hide the part initially if HIDE is t, or if it is too long
>  	 ;; and we have a button to allow toggling (thus reply which
> -- 
> 2.1.4

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH v4 6/7] emacs/mua: Let user specify which parts get a header in citations.
  2015-11-07 11:04 ` [PATCH v4 6/7] emacs/mua: Let user specify which parts get a header in citations Mark Walters
@ 2016-02-09 20:34   ` David Edmondson
  2016-02-09 22:35     ` Mark Walters
  0 siblings, 1 reply; 18+ messages in thread
From: David Edmondson @ 2016-02-09 20:34 UTC (permalink / raw)
  To: Mark Walters, notmuch

On Sat, Nov 07 2015, Mark Walters wrote:
> From: David Edmondson <dme@dme.org>
>
> Add a customizable function specifying which parts get a header when
> replying, and give some sensible possiblities. These are,
>
> 1) all parts except multipart/*. (Subparts of a multipart part do
> receive a header button.)
>
> 2) only included text/* parts.
>
> 3) Exactly as in the show buffer.
>
> 4) None at all. This means the reply contains a mish-mash of all the
> original message's parts.
> ---
>  emacs/notmuch-mua.el  | 30 ++++++++++++++++++++++++++----
>  emacs/notmuch-show.el | 13 +++++++++++++
>  2 files changed, 39 insertions(+), 4 deletions(-)
>
> diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el
> index 2f7abb0..a675f47 100644
> --- a/emacs/notmuch-mua.el
> +++ b/emacs/notmuch-mua.el
> @@ -91,6 +91,23 @@ (defcustom notmuch-mua-cite-function 'message-cite-original
>    :link '(custom-manual "(message)Insertion Variables")
>    :group 'notmuch-reply)
>  
> +(defcustom notmuch-mua-reply-insert-header-p-function
> +  'notmuch-show-reply-insert-header-p-trimmed
> +  "Function to decide which parts get a header when replying.
> +
> +This function specifies which parts of a mime message with
> +mutiple parts get a header."
> +  :type '(radio (const :tag "All except multipart/* and hidden parts"
> +			       notmuch-show-reply-insert-header-p-trimmed)
> +		(const :tag "Only for included text parts"
> +			       notmuch-show-reply-insert-header-p-minimal)
> +		(const :tag "Exactly as in show view"
> +			       notmuch-show-insert-header-p)
> +		(const :tag "No part headers"
> +			       notmuch-show-reply-insert-header-p-never)
> +		(function :tag "Other"))
> +  :group 'notmuch-reply)
> +

These are all functions - should we be `declare-function'ing them, given
that they come from elsewhere? Presumably the compiler is not clever
enough to complain if we don't.

>  ;;
>  
>  (defun notmuch-mua-get-switch-function ()
> @@ -221,10 +238,15 @@ (defun notmuch-mua-reply (query-string &optional sender reply-all)
>  	(insert "Date: " date "\n\n")
>  
>  	(insert (with-temp-buffer
> -		  ;; Don't attempt to clean up messages, excerpt
> -		  ;; citations, etc. in the original message before
> -		  ;; quoting.
> -		  (let ((notmuch-show-insert-text/plain-hook nil))
> +		  (let
> +		      ;; Don't attempt to clean up messages, excerpt
> +		      ;; citations, etc. in the original message before
> +		      ;; quoting.
> +		      ((notmuch-show-insert-text/plain-hook nil)
> +		       ;; Don't omit long parts.
> +		       (notmuch-show-max-text-part-size 0)
> +		       ;; Insert headers for parts as appropriate for replying.
> +		       (notmuch-show-insert-header-p-function notmuch-mua-reply-insert-header-p-function))
>  		    (notmuch-show-insert-body original (plist-get original :body) 0)
>  		    (buffer-substring-no-properties (point-min) (point-max)))))
>  
> diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
> index f4a65cc..7ff9ed5 100644
> --- a/emacs/notmuch-show.el
> +++ b/emacs/notmuch-show.el
> @@ -959,6 +959,19 @@ (defun notmuch-show-insert-header-p (part hide)
>      (not (and (string= mime-type "text/plain")
>  	      (<= (plist-get part :id) 1)))))
>  
> +(defun notmuch-show-reply-insert-header-p-never (part hide)
> +  nil)
> +
> +(defun notmuch-show-reply-insert-header-p-trimmed (part hide)
> +  (let ((mime-type (notmuch-show-mime-type part)))
> +    (and (not (notmuch-match-content-type mime-type "multipart/*"))
> +	 (not hide))))
> +
> +(defun notmuch-show-reply-insert-header-p-minimal (part hide)
> +  (let ((mime-type (notmuch-show-mime-type part)))
> +    (and (notmuch-match-content-type mime-type "text/*")
> +	 (not hide))))
> +
>  (defun notmuch-show-insert-bodypart (msg part depth &optional hide)
>    "Insert the body part PART at depth DEPTH in the current thread.
>  
> -- 
> 2.1.4

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH v4 7/7] test: fix the tests for the new reply code
  2015-11-07 11:04 ` [PATCH v4 7/7] test: fix the tests for the new reply code Mark Walters
@ 2016-02-09 20:34   ` David Edmondson
  0 siblings, 0 replies; 18+ messages in thread
From: David Edmondson @ 2016-02-09 20:34 UTC (permalink / raw)
  To: Mark Walters, notmuch

On Sat, Nov 07 2015, Mark Walters wrote:
> This sets the part-insertion code to never insert part headers (as we
> didn't before).
>
> With that change there is only one failing test: this test has a text
> part (an email message) listed as application/octet-stream. Notmuch
> show displays this part, but the reply code omitted it as it had type
> application/octet-stream. The new code correctly includes it. Thus
> update the expected output to match.

Looks fine.

> ---
>  test/T310-emacs.sh | 32 ++++++++++++++++++++++++++++++++
>  test/test-lib.el   |  4 ++++
>  2 files changed, 36 insertions(+)
>
> diff --git a/test/T310-emacs.sh b/test/T310-emacs.sh
> index 61bc369..22ca71c 100755
> --- a/test/T310-emacs.sh
> +++ b/test/T310-emacs.sh
> @@ -473,6 +473,38 @@ Alex Botero-Lowry <alex.boterolowry@gmail.com> writes:
>  > and http://mail-index.netbsd.org/pkgsrc-bugs/2006/06/07/msg016808.htmlspecifically
>  > uses 64 as the
>  > buffer size.
> +> From e3bc4bbd7b9d0d086816ab5f8f2d6ffea1dd3ea4 Mon Sep 17 00:00:00 2001
> +> From: Alexander Botero-Lowry <alex.boterolowry@gmail.com>
> +> Date: Tue, 17 Nov 2009 11:30:39 -0800
> +> Subject: [PATCH] Deal with situation where sysconf(_SC_GETPW_R_SIZE_MAX) returns -1
> +>
> +> ---
> +>  notmuch-config.c |    2 ++
> +>  1 files changed, 2 insertions(+), 0 deletions(-)
> +>
> +> diff --git a/notmuch-config.c b/notmuch-config.c
> +> index 248149c..e7220d8 100644
> +> --- a/notmuch-config.c
> +> +++ b/notmuch-config.c
> +> @@ -77,6 +77,7 @@ static char *
> +>  get_name_from_passwd_file (void *ctx)
> +>  {
> +>      long pw_buf_size = sysconf(_SC_GETPW_R_SIZE_MAX);
> +> +    if (pw_buf_size == -1) pw_buf_size = 64;
> +>      char *pw_buf = talloc_zero_size (ctx, pw_buf_size);
> +>      struct passwd passwd, *ignored;
> +>      char *name;
> +> @@ -101,6 +102,7 @@ static char *
> +>  get_username_from_passwd_file (void *ctx)
> +>  {
> +>      long pw_buf_size = sysconf(_SC_GETPW_R_SIZE_MAX);
> +> +    if (pw_buf_size == -1) pw_buf_size = 64;
> +>      char *pw_buf = talloc_zero_size (ctx, pw_buf_size);
> +>      struct passwd passwd, *ignored;
> +>      char *name;
> +> -- 
> +> 1.6.5.2
> +>
>  > _______________________________________________
>  > notmuch mailing list
>  > notmuch@notmuchmail.org
> diff --git a/test/test-lib.el b/test/test-lib.el
> index 04c8d63..6e1689a 100644
> --- a/test/test-lib.el
> +++ b/test/test-lib.el
> @@ -184,6 +184,10 @@ (defmacro notmuch-test-progn (&rest body)
>  (setq notmuch-tag-deleted-formats
>        '((".*" nil)))
>  
> +;; For historical reasonse we don't print part headers when replying
> +;; in the tests suite
> +(setq notmuch-mua-reply-insert-header-p-function 'notmuch-show-reply-insert-header-p-never)
> +
>  ;; force a common html renderer, to avoid test variations between
>  ;; environments
>  
> -- 
> 2.1.4
>
> _______________________________________________
> notmuch mailing list
> notmuch@notmuchmail.org
> https://notmuchmail.org/mailman/listinfo/notmuch

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH v4 6/7] emacs/mua: Let user specify which parts get a header in citations.
  2016-02-09 20:34   ` David Edmondson
@ 2016-02-09 22:35     ` Mark Walters
  2016-02-10  8:07       ` David Edmondson
  0 siblings, 1 reply; 18+ messages in thread
From: Mark Walters @ 2016-02-09 22:35 UTC (permalink / raw)
  To: David Edmondson, notmuch


On Tue, 09 Feb 2016, David Edmondson <dme@dme.org> wrote:
> On Sat, Nov 07 2015, Mark Walters wrote:
>> From: David Edmondson <dme@dme.org>
>>
>> Add a customizable function specifying which parts get a header when
>> replying, and give some sensible possiblities. These are,
>>
>> 1) all parts except multipart/*. (Subparts of a multipart part do
>> receive a header button.)
>>
>> 2) only included text/* parts.
>>
>> 3) Exactly as in the show buffer.
>>
>> 4) None at all. This means the reply contains a mish-mash of all the
>> original message's parts.
>> ---
>>  emacs/notmuch-mua.el  | 30 ++++++++++++++++++++++++++----
>>  emacs/notmuch-show.el | 13 +++++++++++++
>>  2 files changed, 39 insertions(+), 4 deletions(-)
>>
>> diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el
>> index 2f7abb0..a675f47 100644
>> --- a/emacs/notmuch-mua.el
>> +++ b/emacs/notmuch-mua.el
>> @@ -91,6 +91,23 @@ (defcustom notmuch-mua-cite-function 'message-cite-original
>>    :link '(custom-manual "(message)Insertion Variables")
>>    :group 'notmuch-reply)
>>  
>> +(defcustom notmuch-mua-reply-insert-header-p-function
>> +  'notmuch-show-reply-insert-header-p-trimmed
>> +  "Function to decide which parts get a header when replying.
>> +
>> +This function specifies which parts of a mime message with
>> +mutiple parts get a header."
>> +  :type '(radio (const :tag "All except multipart/* and hidden parts"
>> +			       notmuch-show-reply-insert-header-p-trimmed)
>> +		(const :tag "Only for included text parts"
>> +			       notmuch-show-reply-insert-header-p-minimal)
>> +		(const :tag "Exactly as in show view"
>> +			       notmuch-show-insert-header-p)
>> +		(const :tag "No part headers"
>> +			       notmuch-show-reply-insert-header-p-never)
>> +		(function :tag "Other"))
>> +  :group 'notmuch-reply)
>> +
>
> These are all functions - should we be `declare-function'ing them, given
> that they come from elsewhere? Presumably the compiler is not clever
> enough to complain if we don't.

Hi,

The compiler doesn't seem to complain. But I don't know if we should
have the declare functions anyway? Any thoughts?

Best wishes

Mark

>
>>  ;;
>>  
>>  (defun notmuch-mua-get-switch-function ()
>> @@ -221,10 +238,15 @@ (defun notmuch-mua-reply (query-string &optional sender reply-all)
>>  	(insert "Date: " date "\n\n")
>>  
>>  	(insert (with-temp-buffer
>> -		  ;; Don't attempt to clean up messages, excerpt
>> -		  ;; citations, etc. in the original message before
>> -		  ;; quoting.
>> -		  (let ((notmuch-show-insert-text/plain-hook nil))
>> +		  (let
>> +		      ;; Don't attempt to clean up messages, excerpt
>> +		      ;; citations, etc. in the original message before
>> +		      ;; quoting.
>> +		      ((notmuch-show-insert-text/plain-hook nil)
>> +		       ;; Don't omit long parts.
>> +		       (notmuch-show-max-text-part-size 0)
>> +		       ;; Insert headers for parts as appropriate for replying.
>> +		       (notmuch-show-insert-header-p-function notmuch-mua-reply-insert-header-p-function))
>>  		    (notmuch-show-insert-body original (plist-get original :body) 0)
>>  		    (buffer-substring-no-properties (point-min) (point-max)))))
>>  
>> diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
>> index f4a65cc..7ff9ed5 100644
>> --- a/emacs/notmuch-show.el
>> +++ b/emacs/notmuch-show.el
>> @@ -959,6 +959,19 @@ (defun notmuch-show-insert-header-p (part hide)
>>      (not (and (string= mime-type "text/plain")
>>  	      (<= (plist-get part :id) 1)))))
>>  
>> +(defun notmuch-show-reply-insert-header-p-never (part hide)
>> +  nil)
>> +
>> +(defun notmuch-show-reply-insert-header-p-trimmed (part hide)
>> +  (let ((mime-type (notmuch-show-mime-type part)))
>> +    (and (not (notmuch-match-content-type mime-type "multipart/*"))
>> +	 (not hide))))
>> +
>> +(defun notmuch-show-reply-insert-header-p-minimal (part hide)
>> +  (let ((mime-type (notmuch-show-mime-type part)))
>> +    (and (notmuch-match-content-type mime-type "text/*")
>> +	 (not hide))))
>> +
>>  (defun notmuch-show-insert-bodypart (msg part depth &optional hide)
>>    "Insert the body part PART at depth DEPTH in the current thread.
>>  
>> -- 
>> 2.1.4

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH v4 6/7] emacs/mua: Let user specify which parts get a header in citations.
  2016-02-09 22:35     ` Mark Walters
@ 2016-02-10  8:07       ` David Edmondson
  0 siblings, 0 replies; 18+ messages in thread
From: David Edmondson @ 2016-02-10  8:07 UTC (permalink / raw)
  To: Mark Walters, notmuch

On Tue, Feb 09 2016, Mark Walters wrote:
> On Tue, 09 Feb 2016, David Edmondson <dme@dme.org> wrote:
>> On Sat, Nov 07 2015, Mark Walters wrote:
>>> From: David Edmondson <dme@dme.org>
>>>
>>> Add a customizable function specifying which parts get a header when
>>> replying, and give some sensible possiblities. These are,
>>>
>>> 1) all parts except multipart/*. (Subparts of a multipart part do
>>> receive a header button.)
>>>
>>> 2) only included text/* parts.
>>>
>>> 3) Exactly as in the show buffer.
>>>
>>> 4) None at all. This means the reply contains a mish-mash of all the
>>> original message's parts.
>>> ---
>>>  emacs/notmuch-mua.el  | 30 ++++++++++++++++++++++++++----
>>>  emacs/notmuch-show.el | 13 +++++++++++++
>>>  2 files changed, 39 insertions(+), 4 deletions(-)
>>>
>>> diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el
>>> index 2f7abb0..a675f47 100644
>>> --- a/emacs/notmuch-mua.el
>>> +++ b/emacs/notmuch-mua.el
>>> @@ -91,6 +91,23 @@ (defcustom notmuch-mua-cite-function 'message-cite-original
>>>    :link '(custom-manual "(message)Insertion Variables")
>>>    :group 'notmuch-reply)
>>>  
>>> +(defcustom notmuch-mua-reply-insert-header-p-function
>>> +  'notmuch-show-reply-insert-header-p-trimmed
>>> +  "Function to decide which parts get a header when replying.
>>> +
>>> +This function specifies which parts of a mime message with
>>> +mutiple parts get a header."
>>> +  :type '(radio (const :tag "All except multipart/* and hidden parts"
>>> +			       notmuch-show-reply-insert-header-p-trimmed)
>>> +		(const :tag "Only for included text parts"
>>> +			       notmuch-show-reply-insert-header-p-minimal)
>>> +		(const :tag "Exactly as in show view"
>>> +			       notmuch-show-insert-header-p)
>>> +		(const :tag "No part headers"
>>> +			       notmuch-show-reply-insert-header-p-never)
>>> +		(function :tag "Other"))
>>> +  :group 'notmuch-reply)
>>> +
>>
>> These are all functions - should we be `declare-function'ing them, given
>> that they come from elsewhere? Presumably the compiler is not clever
>> enough to complain if we don't.
>
> The compiler doesn't seem to complain. But I don't know if we should
> have the declare functions anyway? Any thoughts?

It doesn't seem to be common, so let's leave it alone.

> Best wishes
>
> Mark
>
>>
>>>  ;;
>>>  
>>>  (defun notmuch-mua-get-switch-function ()
>>> @@ -221,10 +238,15 @@ (defun notmuch-mua-reply (query-string &optional sender reply-all)
>>>  	(insert "Date: " date "\n\n")
>>>  
>>>  	(insert (with-temp-buffer
>>> -		  ;; Don't attempt to clean up messages, excerpt
>>> -		  ;; citations, etc. in the original message before
>>> -		  ;; quoting.
>>> -		  (let ((notmuch-show-insert-text/plain-hook nil))
>>> +		  (let
>>> +		      ;; Don't attempt to clean up messages, excerpt
>>> +		      ;; citations, etc. in the original message before
>>> +		      ;; quoting.
>>> +		      ((notmuch-show-insert-text/plain-hook nil)
>>> +		       ;; Don't omit long parts.
>>> +		       (notmuch-show-max-text-part-size 0)
>>> +		       ;; Insert headers for parts as appropriate for replying.
>>> +		       (notmuch-show-insert-header-p-function notmuch-mua-reply-insert-header-p-function))
>>>  		    (notmuch-show-insert-body original (plist-get original :body) 0)
>>>  		    (buffer-substring-no-properties (point-min) (point-max)))))
>>>  
>>> diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
>>> index f4a65cc..7ff9ed5 100644
>>> --- a/emacs/notmuch-show.el
>>> +++ b/emacs/notmuch-show.el
>>> @@ -959,6 +959,19 @@ (defun notmuch-show-insert-header-p (part hide)
>>>      (not (and (string= mime-type "text/plain")
>>>  	      (<= (plist-get part :id) 1)))))
>>>  
>>> +(defun notmuch-show-reply-insert-header-p-never (part hide)
>>> +  nil)
>>> +
>>> +(defun notmuch-show-reply-insert-header-p-trimmed (part hide)
>>> +  (let ((mime-type (notmuch-show-mime-type part)))
>>> +    (and (not (notmuch-match-content-type mime-type "multipart/*"))
>>> +	 (not hide))))
>>> +
>>> +(defun notmuch-show-reply-insert-header-p-minimal (part hide)
>>> +  (let ((mime-type (notmuch-show-mime-type part)))
>>> +    (and (notmuch-match-content-type mime-type "text/*")
>>> +	 (not hide))))
>>> +
>>>  (defun notmuch-show-insert-bodypart (msg part depth &optional hide)
>>>    "Insert the body part PART at depth DEPTH in the current thread.
>>>  
>>> -- 
>>> 2.1.4

^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2016-02-10  8:07 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-11-07 11:04 [PATCH v4 0/7] emacs: Improve the cited message included in replies Mark Walters
2015-11-07 11:04 ` [PATCH v4 1/7] emacs/show: Re-arrange determination if a part header is necessary Mark Walters
2016-02-09 20:28   ` David Edmondson
2015-11-07 11:04 ` [PATCH v4 2/7] emacs/show: Accommodate the lack of part header buttons Mark Walters
2016-02-09 20:29   ` David Edmondson
2015-11-07 11:04 ` [PATCH v4 3/7] emacs/mua: Generate improved cited text for replies Mark Walters
2016-02-09 20:30   ` David Edmondson
2015-11-07 11:04 ` [PATCH v4 4/7] emacs/show: Remove the 'no-buttons option of `notmuch-show-insert-bodypart' Mark Walters
2016-02-09 20:31   ` David Edmondson
2015-11-07 11:04 ` [PATCH v4 5/7] emacs/show: Make the insertion of part headers overridable Mark Walters
2016-02-09 20:32   ` David Edmondson
2015-11-07 11:04 ` [PATCH v4 6/7] emacs/mua: Let user specify which parts get a header in citations Mark Walters
2016-02-09 20:34   ` David Edmondson
2016-02-09 22:35     ` Mark Walters
2016-02-10  8:07       ` David Edmondson
2015-11-07 11:04 ` [PATCH v4 7/7] test: fix the tests for the new reply code Mark Walters
2016-02-09 20:34   ` David Edmondson
2016-02-08 17:11 ` [PATCH v4 0/7] emacs: Improve the cited message included in replies David Edmondson

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).