From 5efd2ef977e846f2a0b9280017a5fe020e762b79 Mon Sep 17 00:00:00 2001 From: Tomi Ollila Date: Mon, 26 Aug 2013 23:21:57 +0300 Subject: [PATCH] [PATCH 1/1] emacs: removed 3 duplicate functions from notmuch-show.el --- 03/d25f14ccaebe1248c1874b774313b27aa3e531 | 110 ++++++++++++++++++++++ 1 file changed, 110 insertions(+) create mode 100644 03/d25f14ccaebe1248c1874b774313b27aa3e531 diff --git a/03/d25f14ccaebe1248c1874b774313b27aa3e531 b/03/d25f14ccaebe1248c1874b774313b27aa3e531 new file mode 100644 index 000000000..8a09ccaa8 --- /dev/null +++ b/03/d25f14ccaebe1248c1874b774313b27aa3e531 @@ -0,0 +1,110 @@ +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 7AAB3431FD4 + for ; Mon, 26 Aug 2013 13:22:10 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: 0 +X-Spam-Level: +X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none] + 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 nHom1Y2skqxT for ; + Mon, 26 Aug 2013 13:22:05 -0700 (PDT) +Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34]) + by olra.theworths.org (Postfix) with ESMTP id 98213431FAF + for ; Mon, 26 Aug 2013 13:22:05 -0700 (PDT) +Received: by guru.guru-group.fi (Postfix, from userid 501) + id 6A0E51000F4; Mon, 26 Aug 2013 23:21:59 +0300 (EEST) +From: Tomi Ollila +To: notmuch@notmuchmail.org +Subject: [PATCH 1/1] emacs: removed 3 duplicate functions from notmuch-show.el +Date: Mon, 26 Aug 2013 23:21:57 +0300 +Message-Id: <1377548517-17130-1-git-send-email-tomi.ollila@iki.fi> +X-Mailer: git-send-email 1.8.0 +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 20:22:10 -0000 + +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 + -- 2.26.2