emacs: Remove redundant NTH argument from `notmuch-get-bodypart-content'.

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.
This commit is contained in:
Austin Clements 2014-04-21 14:37:38 -04:00 committed by David Bremner
parent b489267701
commit 0b94dd7fd3
2 changed files with 8 additions and 7 deletions

View file

@ -539,9 +539,10 @@ the given type."
(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
@ -557,7 +558,7 @@ the given type."
(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)))
@ -573,7 +574,7 @@ current buffer, if possible."
;; 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)

View file

@ -711,7 +711,7 @@ message at DEPTH in the current thread."
(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))
@ -720,7 +720,7 @@ message at DEPTH in the current thread."
(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))
@ -772,7 +772,7 @@ message at DEPTH in the current thread."
(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.