unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Austin Clements <amdragon@MIT.EDU>
To: notmuch@notmuchmail.org
Subject: [PATCH 01/11] emacs: Remove redundant NTH argument from `notmuch-get-bodypart-content'.
Date: Mon, 21 Apr 2014 14:37:38 -0400	[thread overview]
Message-ID: <1398105468-14317-2-git-send-email-amdragon@mit.edu> (raw)
In-Reply-To: <1398105468-14317-1-git-send-email-amdragon@mit.edu>

This can be derived from the PART argument (which is arguably
canonical), so there's no sense in giving the caller an extra foot
gun.
---
 emacs/notmuch-lib.el  | 9 +++++----
 emacs/notmuch-show.el | 6 +++---
 2 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el
index 2941da3..35b9065 100644
--- a/emacs/notmuch-lib.el
+++ b/emacs/notmuch-lib.el
@@ -518,9 +518,10 @@ (defun notmuch-get-bodypart-internal (query part-number process-crypto)
 	  (apply 'call-process (append (list notmuch-command nil (list t nil) nil) args))
 	  (buffer-string))))))
 
-(defun notmuch-get-bodypart-content (msg part nth process-crypto)
+(defun notmuch-get-bodypart-content (msg part process-crypto)
   (or (plist-get part :content)
-      (notmuch-get-bodypart-internal (notmuch-id-to-query (plist-get msg :id)) nth process-crypto)))
+      (notmuch-get-bodypart-internal (notmuch-id-to-query (plist-get msg :id))
+				     (plist-get part :id) process-crypto)))
 
 ;; Workaround: The call to `mm-display-part' below triggers a bug in
 ;; Emacs 24 if it attempts to use the shr renderer to display an HTML
@@ -536,7 +537,7 @@ (defun notmuch-get-bodypart-content (msg part nth process-crypto)
       (ad-disable-advice 'mm-shr 'before 'load-gnus-arts)
       (ad-activate 'mm-shr)))
 
-(defun notmuch-mm-display-part-inline (msg part nth content-type process-crypto)
+(defun notmuch-mm-display-part-inline (msg part content-type process-crypto)
   "Use the mm-decode/mm-view functions to display a part in the
 current buffer, if possible."
   (let ((display-buffer (current-buffer)))
@@ -552,7 +553,7 @@ (defun notmuch-mm-display-part-inline (msg part nth content-type process-crypto)
 	;; test whether we are able to inline it (which includes both
 	;; capability and suitability tests).
 	(when (mm-inlined-p handle)
-	  (insert (notmuch-get-bodypart-content msg part nth process-crypto))
+	  (insert (notmuch-get-bodypart-content msg part process-crypto))
 	  (when (mm-inlinable-p handle)
 	    (set-buffer display-buffer)
 	    (mm-display-part handle)
diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index df10d4b..949ac09 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -695,7 +695,7 @@ (defun notmuch-show-insert-part-text/plain (msg part content-type nth depth butt
   (let ((start (if button
 		   (button-start button)
 		 (point))))
-    (insert (notmuch-get-bodypart-content msg part nth notmuch-show-process-crypto))
+    (insert (notmuch-get-bodypart-content msg part notmuch-show-process-crypto))
     (save-excursion
       (save-restriction
 	(narrow-to-region start (point-max))
@@ -704,7 +704,7 @@ (defun notmuch-show-insert-part-text/plain (msg part content-type nth depth butt
 
 (defun notmuch-show-insert-part-text/calendar (msg part content-type nth depth button)
   (insert (with-temp-buffer
-	    (insert (notmuch-get-bodypart-content msg part nth notmuch-show-process-crypto))
+	    (insert (notmuch-get-bodypart-content msg part notmuch-show-process-crypto))
 	    ;; notmuch-get-bodypart-content provides "raw", non-converted
 	    ;; data. Replace CRLF with LF before icalendar can use it.
 	    (goto-char (point-min))
@@ -756,7 +756,7 @@ (defun notmuch-show-insert-part-text/html (msg part content-type nth depth butto
 
 (defun notmuch-show-insert-part-*/* (msg part content-type nth depth button)
   ;; This handler _must_ succeed - it is the handler of last resort.
-  (notmuch-mm-display-part-inline msg part nth content-type notmuch-show-process-crypto)
+  (notmuch-mm-display-part-inline msg part content-type notmuch-show-process-crypto)
   t)
 
 ;; Functions for determining how to handle MIME parts.
-- 
1.9.1

  reply	other threads:[~2014-04-21 18:38 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-21 18:37 [PATCH 00/11] Improve charset and cid: handling Austin Clements
2014-04-21 18:37 ` Austin Clements [this message]
2014-07-10  9:46   ` [PATCH 01/11] emacs: Remove redundant NTH argument from `notmuch-get-bodypart-content' David Bremner
2014-04-21 18:37 ` [PATCH 02/11] test: New tests for Emacs charset handling Austin Clements
2014-04-24 14:38   ` Mark Walters
2014-04-24 18:29     ` Austin Clements
2014-04-25  6:18       ` Mark Walters
2014-04-25 13:57       ` Tomi Ollila
2014-04-21 18:37 ` [PATCH 03/11] emacs: Fix coding system in `notmuch-show-view-raw-message' Austin Clements
2014-07-10  9:48   ` David Bremner
2014-09-23 17:59   ` David Bremner
2014-04-21 18:37 ` [PATCH 04/11] emacs: Track full message and part descriptor in w3m CID store Austin Clements
2014-07-10  9:52   ` David Bremner
2015-01-24 16:45     ` Austin Clements
2014-04-21 18:37 ` [PATCH 05/11] emacs: Create an API for fetching parts as undecoded binary Austin Clements
2014-04-21 18:37 ` [PATCH 06/11] emacs: Remove broken `notmuch-get-bodypart-content' API Austin Clements
2014-07-11 11:48   ` David Bremner
2015-01-24 17:10     ` Austin Clements
2014-04-21 18:37 ` [PATCH 07/11] emacs: Return unibyte strings for binary part data Austin Clements
2014-04-21 18:37 ` [PATCH 08/11] emacs: Support caching in notmuch-get-bodypart-{binary, text} Austin Clements
2014-04-24 10:46   ` Mark Walters
2014-04-24 18:12     ` Austin Clements
2014-04-25  6:42       ` Mark Walters
2015-01-24 18:06         ` Austin Clements
2014-04-21 18:37 ` [PATCH 09/11] emacs: Use generalized content caching in w3m CID code Austin Clements
2014-04-21 18:37 ` [PATCH 10/11] emacs: Rewrite content ID handling Austin Clements
2014-04-21 18:37 ` [PATCH 11/11] emacs: Support cid: references with shr renderer Austin Clements
2014-05-01  9:20   ` David Edmondson
2015-01-24 17:12     ` Austin Clements
2014-04-21 20:26 ` [PATCH 00/11] Improve charset and cid: handling Tomi Ollila
2014-04-26 10:50 ` Mark Walters
2015-01-24 17:29   ` Austin Clements

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=1398105468-14317-2-git-send-email-amdragon@mit.edu \
    --to=amdragon@mit.edu \
    --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).