[PATCH 1/2] emacs: remove some code duplication in notmuch-show
authorDmitry Kurochkin <dmitry.kurochkin@gmail.com>
Fri, 25 Nov 2011 22:23:30 +0000 (02:23 +0400)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:40:24 +0000 (09:40 -0800)
77/4b7be3a0c94072d31a5fdd5315edb4186421c5 [new file with mode: 0644]

diff --git a/77/4b7be3a0c94072d31a5fdd5315edb4186421c5 b/77/4b7be3a0c94072d31a5fdd5315edb4186421c5
new file mode 100644 (file)
index 0000000..206a7c3
--- /dev/null
@@ -0,0 +1,102 @@
+Return-Path: <dmitry.kurochkin@gmail.com>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+       by olra.theworths.org (Postfix) with ESMTP id 543FC429E21\r
+       for <notmuch@notmuchmail.org>; Fri, 25 Nov 2011 14:23:54 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.799\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.799 tagged_above=-999 required=5\r
+       tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,\r
+       FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+       by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+       with ESMTP id I9h7bUy0d3S1 for <notmuch@notmuchmail.org>;\r
+       Fri, 25 Nov 2011 14:23:53 -0800 (PST)\r
+Received: from mail-bw0-f53.google.com (mail-bw0-f53.google.com\r
+       [209.85.214.53]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
+       (No client certificate requested)\r
+       by olra.theworths.org (Postfix) with ESMTPS id AE040431FB6\r
+       for <notmuch@notmuchmail.org>; Fri, 25 Nov 2011 14:23:53 -0800 (PST)\r
+Received: by bkaq10 with SMTP id q10so5375723bka.26\r
+       for <notmuch@notmuchmail.org>; Fri, 25 Nov 2011 14:23:52 -0800 (PST)\r
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;\r
+       h=from:to:subject:date:message-id:x-mailer;\r
+       bh=IkSGewtB/f2twH3DulvDsVOL9lvF59tlzGAFhV5qICE=;\r
+       b=mpn5ziqd1dIW2JjAsh96D7tRZzEPbwQw7CsBZAjNOYyZLlR6ecuBcvNV3S1Tsjt+tc\r
+       xYv5lnPcBIBTyTCboprZCQ+eodTwuwLezzMy9FJUCQmHeDDaTvFJRGGZC96NO1r035DQ\r
+       h9VnrjAm8sqyUtlN5iPpC1AKSdX8+ufUh0MBQ=\r
+Received: by 10.204.128.208 with SMTP id l16mr16383999bks.14.1322259832313;\r
+       Fri, 25 Nov 2011 14:23:52 -0800 (PST)\r
+Received: from localhost ([91.144.186.21])\r
+       by mx.google.com with ESMTPS id fa8sm11909829bkc.14.2011.11.25.14.23.50\r
+       (version=TLSv1/SSLv3 cipher=OTHER);\r
+       Fri, 25 Nov 2011 14:23:51 -0800 (PST)\r
+From: Dmitry Kurochkin <dmitry.kurochkin@gmail.com>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH 1/2] emacs: remove some code duplication in notmuch-show\r
+Date: Sat, 26 Nov 2011 02:23:30 +0400\r
+Message-Id: <1322259811-10834-1-git-send-email-dmitry.kurochkin@gmail.com>\r
+X-Mailer: git-send-email 1.7.7.3\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+       <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Fri, 25 Nov 2011 22:23:54 -0000\r
+\r
+Add optional props argument to `notmuch-show-get-header'.  Use it to\r
+get headers in `notmuch-show-insert-part-multipart/signed' and\r
+`notmuch-show-insert-part-multipart/encrypted'.\r
+---\r
+ emacs/notmuch-show.el |   10 ++++------\r
+ 1 files changed, 4 insertions(+), 6 deletions(-)\r
+\r
+diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el\r
+index 7be88f8..bcc436f 100644\r
+--- a/emacs/notmuch-show.el\r
++++ b/emacs/notmuch-show.el\r
+@@ -450,8 +450,7 @@ current buffer, if possible."\r
+     (button-put button 'face '(:foreground "blue"))\r
+     ;; add signature status button if sigstatus provided\r
+     (if (plist-member part :sigstatus)\r
+-      (let* ((headers (plist-get msg :headers))\r
+-             (from (plist-get headers :From))\r
++      (let* ((from (notmuch-show-get-header :From msg))\r
+              (sigstatus (car (plist-get part :sigstatus))))\r
+         (notmuch-crypto-insert-sigstatus-button sigstatus from))\r
+       ;; if we're not adding sigstatus, tell the user how they can get it\r
+@@ -477,8 +476,7 @@ current buffer, if possible."\r
+         (notmuch-crypto-insert-encstatus-button encstatus)\r
+         ;; add signature status button if sigstatus specified\r
+         (if (plist-member part :sigstatus)\r
+-            (let* ((headers (plist-get msg :headers))\r
+-                   (from (plist-get headers :From))\r
++            (let* ((from (notmuch-show-get-header :From msg))\r
+                    (sigstatus (car (plist-get part :sigstatus))))\r
+               (notmuch-crypto-insert-sigstatus-button sigstatus from))))\r
+       ;; if we're not adding encstatus, tell the user how they can get it\r
+@@ -1079,9 +1077,9 @@ All currently available key bindings:\r
+   "Return the filename of the current message."\r
+   (notmuch-show-get-prop :filename))\r
\r
+-(defun notmuch-show-get-header (header)\r
++(defun notmuch-show-get-header (header &optional props)\r
+   "Return the named header of the current message, if any."\r
+-  (plist-get (notmuch-show-get-prop :headers) header))\r
++  (plist-get (notmuch-show-get-prop :headers props) header))\r
\r
+ (defun notmuch-show-get-cc ()\r
+   (notmuch-show-get-header :Cc))\r
+-- \r
+1.7.7.3\r
+\r