From 9424950a684e479419d4cb9d2bc4c11faf9ac172 Mon Sep 17 00:00:00 2001 From: Mark Walters Date: Mon, 26 Aug 2013 22:27:57 +0100 Subject: [PATCH] Re: [PATCH 1/1] emacs: removed 3 duplicate functions from notmuch-show.el --- b2/5289b86a00101b71b31757e2608d0e4af04554 | 148 ++++++++++++++++++++++ 1 file changed, 148 insertions(+) create mode 100644 b2/5289b86a00101b71b31757e2608d0e4af04554 diff --git a/b2/5289b86a00101b71b31757e2608d0e4af04554 b/b2/5289b86a00101b71b31757e2608d0e4af04554 new file mode 100644 index 000000000..99089fc66 --- /dev/null +++ b/b2/5289b86a00101b71b31757e2608d0e4af04554 @@ -0,0 +1,148 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by olra.theworths.org (Postfix) with ESMTP id 3F369431FD4 + for ; Mon, 26 Aug 2013 14:28:22 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: -1.098 +X-Spam-Level: +X-Spam-Status: No, score=-1.098 tagged_above=-999 required=5 + tests=[DKIM_ADSP_CUSTOM_MED=0.001, FREEMAIL_FROM=0.001, + NML_ADSP_CUSTOM_MED=1.2, RCVD_IN_DNSWL_MED=-2.3] 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 V6rTTRrlsv3B for ; + Mon, 26 Aug 2013 14:28:06 -0700 (PDT) +Received: from mail2.qmul.ac.uk (mail2.qmul.ac.uk [138.37.6.6]) + (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id 25F5D431FAF + for ; Mon, 26 Aug 2013 14:28:06 -0700 (PDT) +Received: from smtp.qmul.ac.uk ([138.37.6.40]) + by mail2.qmul.ac.uk with esmtp (Exim 4.71) + (envelope-from ) + id 1VE4KO-0002OR-6P; Mon, 26 Aug 2013 22:28:02 +0100 +Received: from 93-97-24-31.zone5.bethere.co.uk ([93.97.24.31] helo=localhost) + by smtp.qmul.ac.uk with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.71) + (envelope-from ) + id 1VE4KN-0006LQ-TZ; Mon, 26 Aug 2013 22:28:00 +0100 +From: Mark Walters +To: Tomi Ollila , notmuch@notmuchmail.org +Subject: Re: [PATCH 1/1] emacs: removed 3 duplicate functions from + notmuch-show.el +In-Reply-To: <1377548517-17130-1-git-send-email-tomi.ollila@iki.fi> +References: <1377548517-17130-1-git-send-email-tomi.ollila@iki.fi> +User-Agent: Notmuch/0.15.2+269~g01f5508 (http://notmuchmail.org) Emacs/23.4.1 + (x86_64-pc-linux-gnu) +Date: Mon, 26 Aug 2013 22:27:57 +0100 +Message-ID: <87mwo4dtwi.fsf@qmul.ac.uk> +MIME-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +X-Sender-Host-Address: 93.97.24.31 +X-QM-SPAM-Info: Sender has good ham record. :) +X-QM-Body-MD5: 38821d11b1f0d5101fb0fe214ad2739d (of first 20000 bytes) +X-SpamAssassin-Score: 0.0 +X-SpamAssassin-SpamBar: / +X-SpamAssassin-Report: The QM spam filters have analysed this message to + determine if it is + spam. We require at least 5.0 points to mark a message as spam. + This message scored 0.0 points. Summary of the scoring: + * 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail + provider * (markwalters1009[at]gmail.com) + * 0.0 AWL AWL: From: address is in the auto white-list +X-QM-Scan-Virus: ClamAV says the message is clean +Cc: tomi.ollila@iki.fi +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, 26 Aug 2013 21:28:22 -0000 + + +This LGTM +1 + +Mark + +On Mon, 26 Aug 2013, Tomi Ollila 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 -- 2.26.2