Re: [PATCH 01/11] emacs: Remove redundant NTH argument from `notmuch-get-bodypart-content'.
Austin Clements amdra...@mit.edu writes: 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 patch seem ready to go, independant of the rest of the series. d ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch
[PATCH 01/11] 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. --- 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
[PATCH 01/11] 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. --- 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 ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch