* [PATCH 1/1] emacs: removed 3 duplicate functions from notmuch-show.el
@ 2013-08-26 20:21 Tomi Ollila
2013-08-26 21:27 ` Mark Walters
2013-08-27 11:03 ` David Bremner
0 siblings, 2 replies; 3+ messages in thread
From: Tomi Ollila @ 2013-08-26 20:21 UTC (permalink / raw)
To: notmuch; +Cc: tomi.ollila
notmuch-show.el and notmuch.el had 3 duplicate, identical functions:
notmuch-foreach-mime-part, notmuch-count-attachments and
notmuch-save-attachments. Now these functions in notmuch-show.el
are replaced with declare-functions pointing to "notmuch"(.el).
---
emacs/notmuch-show.el | 39 +++------------------------------------
1 file changed, 3 insertions(+), 36 deletions(-)
diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index 82b70ba..2896aae 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -41,6 +41,9 @@
(declare-function notmuch-search-next-thread "notmuch" nil)
(declare-function notmuch-search-previous-thread "notmuch" nil)
(declare-function notmuch-search-show-thread "notmuch" nil)
+(declare-function notmuch-foreach-mime-part "notmuch" (function mm-handle))
+(declare-function notmuch-count-attachments "notmuch" (mm-handle))
+(declare-function notmuch-save-attachments "notmuch" (mm-handle &optional queryp))
(defcustom notmuch-message-headers '("Subject" "To" "Cc" "Date")
"Headers that should be shown in a message, in this order.
@@ -237,42 +240,6 @@ For example, if you wanted to remove an \"unread\" tag and add a
)))
(mm-display-parts (mm-dissect-buffer)))))
-(defun notmuch-foreach-mime-part (function mm-handle)
- (cond ((stringp (car mm-handle))
- (dolist (part (cdr mm-handle))
- (notmuch-foreach-mime-part function part)))
- ((bufferp (car mm-handle))
- (funcall function mm-handle))
- (t (dolist (part mm-handle)
- (notmuch-foreach-mime-part function part)))))
-
-(defun notmuch-count-attachments (mm-handle)
- (let ((count 0))
- (notmuch-foreach-mime-part
- (lambda (p)
- (let ((disposition (mm-handle-disposition p)))
- (and (listp disposition)
- (or (equal (car disposition) "attachment")
- (and (equal (car disposition) "inline")
- (assq 'filename disposition)))
- (incf count))))
- mm-handle)
- count))
-
-(defun notmuch-save-attachments (mm-handle &optional queryp)
- (notmuch-foreach-mime-part
- (lambda (p)
- (let ((disposition (mm-handle-disposition p)))
- (and (listp disposition)
- (or (equal (car disposition) "attachment")
- (and (equal (car disposition) "inline")
- (assq 'filename disposition)))
- (or (not queryp)
- (y-or-n-p
- (concat "Save '" (cdr (assq 'filename disposition)) "' ")))
- (mm-save-part p))))
- mm-handle))
-
(defun notmuch-show-save-attachments ()
"Save all attachments from the current message."
(interactive)
--
1.8.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 1/1] emacs: removed 3 duplicate functions from notmuch-show.el
2013-08-26 20:21 [PATCH 1/1] emacs: removed 3 duplicate functions from notmuch-show.el Tomi Ollila
@ 2013-08-26 21:27 ` Mark Walters
2013-08-27 11:03 ` David Bremner
1 sibling, 0 replies; 3+ messages in thread
From: Mark Walters @ 2013-08-26 21:27 UTC (permalink / raw)
To: Tomi Ollila, notmuch; +Cc: tomi.ollila
This LGTM +1
Mark
On Mon, 26 Aug 2013, Tomi Ollila <tomi.ollila@iki.fi> wrote:
> notmuch-show.el and notmuch.el had 3 duplicate, identical functions:
> notmuch-foreach-mime-part, notmuch-count-attachments and
> notmuch-save-attachments. Now these functions in notmuch-show.el
> are replaced with declare-functions pointing to "notmuch"(.el).
> ---
> emacs/notmuch-show.el | 39 +++------------------------------------
> 1 file changed, 3 insertions(+), 36 deletions(-)
>
> diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
> index 82b70ba..2896aae 100644
> --- a/emacs/notmuch-show.el
> +++ b/emacs/notmuch-show.el
> @@ -41,6 +41,9 @@
> (declare-function notmuch-search-next-thread "notmuch" nil)
> (declare-function notmuch-search-previous-thread "notmuch" nil)
> (declare-function notmuch-search-show-thread "notmuch" nil)
> +(declare-function notmuch-foreach-mime-part "notmuch" (function mm-handle))
> +(declare-function notmuch-count-attachments "notmuch" (mm-handle))
> +(declare-function notmuch-save-attachments "notmuch" (mm-handle &optional queryp))
>
> (defcustom notmuch-message-headers '("Subject" "To" "Cc" "Date")
> "Headers that should be shown in a message, in this order.
> @@ -237,42 +240,6 @@ For example, if you wanted to remove an \"unread\" tag and add a
> )))
> (mm-display-parts (mm-dissect-buffer)))))
>
> -(defun notmuch-foreach-mime-part (function mm-handle)
> - (cond ((stringp (car mm-handle))
> - (dolist (part (cdr mm-handle))
> - (notmuch-foreach-mime-part function part)))
> - ((bufferp (car mm-handle))
> - (funcall function mm-handle))
> - (t (dolist (part mm-handle)
> - (notmuch-foreach-mime-part function part)))))
> -
> -(defun notmuch-count-attachments (mm-handle)
> - (let ((count 0))
> - (notmuch-foreach-mime-part
> - (lambda (p)
> - (let ((disposition (mm-handle-disposition p)))
> - (and (listp disposition)
> - (or (equal (car disposition) "attachment")
> - (and (equal (car disposition) "inline")
> - (assq 'filename disposition)))
> - (incf count))))
> - mm-handle)
> - count))
> -
> -(defun notmuch-save-attachments (mm-handle &optional queryp)
> - (notmuch-foreach-mime-part
> - (lambda (p)
> - (let ((disposition (mm-handle-disposition p)))
> - (and (listp disposition)
> - (or (equal (car disposition) "attachment")
> - (and (equal (car disposition) "inline")
> - (assq 'filename disposition)))
> - (or (not queryp)
> - (y-or-n-p
> - (concat "Save '" (cdr (assq 'filename disposition)) "' ")))
> - (mm-save-part p))))
> - mm-handle))
> -
> (defun notmuch-show-save-attachments ()
> "Save all attachments from the current message."
> (interactive)
> --
> 1.8.0
>
> _______________________________________________
> notmuch mailing list
> notmuch@notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 1/1] emacs: removed 3 duplicate functions from notmuch-show.el
2013-08-26 20:21 [PATCH 1/1] emacs: removed 3 duplicate functions from notmuch-show.el Tomi Ollila
2013-08-26 21:27 ` Mark Walters
@ 2013-08-27 11:03 ` David Bremner
1 sibling, 0 replies; 3+ messages in thread
From: David Bremner @ 2013-08-27 11:03 UTC (permalink / raw)
To: Tomi Ollila, notmuch; +Cc: tomi.ollila
Tomi Ollila <tomi.ollila@iki.fi> writes:
> notmuch-show.el and notmuch.el had 3 duplicate, identical functions:
> notmuch-foreach-mime-part, notmuch-count-attachments and
> notmuch-save-attachments. Now these functions in notmuch-show.el
> are replaced with declare-functions pointing to "notmuch"(.el).
pushed,
d
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-08-27 11:03 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-08-26 20:21 [PATCH 1/1] emacs: removed 3 duplicate functions from notmuch-show.el Tomi Ollila
2013-08-26 21:27 ` Mark Walters
2013-08-27 11:03 ` David Bremner
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).