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