From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 14090431FDB for ; Mon, 21 Apr 2014 11:38:09 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -0.7 X-Spam-Level: X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5 tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id y4JtoyugfJSW for ; Mon, 21 Apr 2014 11:38:04 -0700 (PDT) Received: from dmz-mailsec-scanner-1.mit.edu (dmz-mailsec-scanner-1.mit.edu [18.9.25.12]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id F0BA0431FBD for ; Mon, 21 Apr 2014 11:37:58 -0700 (PDT) X-AuditID: 1209190c-f794a6d000000c27-5b-5355658534ec Received: from mailhub-auth-4.mit.edu ( [18.7.62.39]) (using TLS with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by dmz-mailsec-scanner-1.mit.edu (Symantec Messaging Gateway) with SMTP id 7F.C9.03111.58565535; Mon, 21 Apr 2014 14:37:57 -0400 (EDT) Received: from outgoing.mit.edu (outgoing-auth-1.mit.edu [18.9.28.11]) by mailhub-auth-4.mit.edu (8.13.8/8.9.2) with ESMTP id s3LIbupp022316; Mon, 21 Apr 2014 14:37:56 -0400 Received: from drake.dyndns.org (216-15-114-40.c3-0.arl-ubr1.sbo-arl.ma.cable.rcn.com [216.15.114.40]) (authenticated bits=0) (User authenticated as amdragon@ATHENA.MIT.EDU) by outgoing.mit.edu (8.13.8/8.12.4) with ESMTP id s3LIbs7B029708 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT); Mon, 21 Apr 2014 14:37:56 -0400 Received: from amthrax by drake.dyndns.org with local (Exim 4.77) (envelope-from ) id 1WcJ6I-0003ks-AL; Mon, 21 Apr 2014 14:37:54 -0400 From: Austin Clements 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 Message-Id: <1398105468-14317-2-git-send-email-amdragon@mit.edu> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1398105468-14317-1-git-send-email-amdragon@mit.edu> References: <1398105468-14317-1-git-send-email-amdragon@mit.edu> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrMIsWRmVeSWpSXmKPExsUixG6nrtuaGhpsMO2JlcX1mzOZHRg9nq26 xRzAGMVlk5Kak1mWWqRvl8CV8W3yIbaCy7IVb64fY25gvCHRxcjJISFgInF7+nMWCFtM4sK9 9WxdjFwcQgKzmSRezjnPDuFsZJSY/voPM4Rzh0mi88VcFghnLqNEy6HHjCD9bAIaEtv2Lwez RQSkJXbenc3axcjBwSygJvGnSwUkLCyQIHH9QgsziM0ioCpxfe1csHJeAQeJ1eePMkKcISdx 8thkVhCbU8BRom31S3YQWwioZsPeNUwTGPkXMDKsYpRNya3SzU3MzClOTdYtTk7My0st0jXU y80s0UtNKd3ECAobTkmeHYxvDiodYhTgYFTi4ZUwCA0WYk0sK67MPcQoycGkJMr7KgooxJeU n1KZkVicEV9UmpNafIhRgoNZSYR3vSZQjjclsbIqtSgfJiXNwaIkzvvW2ipYSCA9sSQ1OzW1 ILUIJivDwaEkwWuXAtQoWJSanlqRlplTgpBm4uAEGc4DNDwKpIa3uCAxtzgzHSJ/ilFRSpyX MRkoIQCSyCjNg+uFxfUrRnGgV4R53UHaeYApAa77FdBgJqDBT7aEgAwuSURISTUwTjmqO7VO 4ckJ3iTuzQu7dS/xRrxe7bO41H6ZzMW7W+VqM6WZ5jgcj4gTuXzUeILCaTVWC+8ky8ueN7mj rb833dZ8xrZdsbKdRZSp6t9Sq5RNXAtsX06/f7nx4jaFOxvt6zzWRJSUCng7fJ23qEDk8lRR 16M/9b8KHvGcdEtQXN22YL7qGR0bJZbijERDLeai4kQAdDgMBsYCAAA= X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Apr 2014 18:38:09 -0000 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