From f666246e92d8b93167e3faf75a5fe29ed97b6f7d Mon Sep 17 00:00:00 2001 From: Mark Walters Date: Sat, 7 Jun 2014 10:51:08 +0100 Subject: [PATCH] [PATCH] emacs: tree/show remove duplicate function --- 92/910afd6a817d0addfb00ddd4f19af94259678d | 138 ++++++++++++++++++++++ 1 file changed, 138 insertions(+) create mode 100644 92/910afd6a817d0addfb00ddd4f19af94259678d diff --git a/92/910afd6a817d0addfb00ddd4f19af94259678d b/92/910afd6a817d0addfb00ddd4f19af94259678d new file mode 100644 index 000000000..e6a3e0e39 --- /dev/null +++ b/92/910afd6a817d0addfb00ddd4f19af94259678d @@ -0,0 +1,138 @@ +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 BC0B640D1DF + for ; Sat, 7 Jun 2014 02:51:28 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: 0.201 +X-Spam-Level: +X-Spam-Status: No, score=0.201 tagged_above=-999 required=5 + tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, + FREEMAIL_ENVFROM_END_DIGIT=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 ReuFuJTc7pUq for ; + Sat, 7 Jun 2014 02:51:23 -0700 (PDT) +Received: from mail-wg0-f51.google.com (mail-wg0-f51.google.com + [74.125.82.51]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client + certificate requested) by olra.theworths.org (Postfix) with ESMTPS id + 09D9A40D1DE for ; Sat, 7 Jun 2014 02:51:22 -0700 + (PDT) +Received: by mail-wg0-f51.google.com with SMTP id x12so1176633wgg.22 + for ; Sat, 07 Jun 2014 02:51:20 -0700 (PDT) +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; + h=from:to:cc:subject:date:message-id; + bh=xH35iDnSwFF2+kuxNRC0svRFJPkFExufAhX2ns117h8=; + b=rxaVR/XCcGdvKOhx/nx216zleTfyl6ngNtqHimNlqSsHvMJbuNHFf8Dljclbkxoili + kHyVwJ3Rno01MYwKe9Tfbrwi6qmYi7K6OUJI9PEbe71OB2xsbCeRPb0a9D7p3wAToj16 + nsP1r0V2tMqJzf+Q5WuQ20EHM5+nz52F1O89q5aoBoSgXTJQ1HbcBfSUGeN6uf8IRaM4 + aHf5369t++FtifJLt2azYGXdaAYtscZnA5P/0yB2irRmxtIWXtpybwSX3nnClmJ9rR5H + U48M0KlKnvk/jQuhu9v4xFvSASiFOIgaggCB4+mm9pu+xbPydXmyAWjqS2NqX6fvrejX + Iscw== +X-Received: by 10.180.38.38 with SMTP id d6mr12756650wik.12.1402134680650; + Sat, 07 Jun 2014 02:51:20 -0700 (PDT) +Received: from localhost (5751dfa2.skybroadband.com. [87.81.223.162]) + by mx.google.com with ESMTPSA id + ht5sm15762417wjb.49.2014.06.07.02.51.19 for + (version=TLSv1.2 cipher=RC4-SHA bits=128/128); + Sat, 07 Jun 2014 02:51:20 -0700 (PDT) +From: Mark Walters +To: notmuch@notmuchmail.org +Subject: [PATCH] emacs: tree/show remove duplicate function +Date: Sat, 7 Jun 2014 10:51:08 +0100 +Message-Id: <1402134668-18587-1-git-send-email-markwalters1009@gmail.com> +X-Mailer: git-send-email 1.7.10.4 +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: Sat, 07 Jun 2014 09:51:29 -0000 + +tree overrides notmuch-show-get-prop so that it can use many of the +utility function directly. Now that tree is in mainline the version +from tree can be moved to show and the original overridden show +version dropped. +--- +I should have done this ages ago but forgot about it. + +Best wishes + +Mark + + + emacs/notmuch-show.el | 12 +++++++++++- + emacs/notmuch-tree.el | 16 ---------------- + 2 files changed, 11 insertions(+), 17 deletions(-) + +diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el +index 10fc872..b922a38 100644 +--- a/emacs/notmuch-show.el ++++ b/emacs/notmuch-show.el +@@ -46,6 +46,7 @@ + (declare-function notmuch-save-attachments "notmuch" (mm-handle &optional queryp)) + (declare-function notmuch-tree "notmuch-tree" + (&optional query query-context target buffer-name open-target)) ++(declare-function notmuch-tree-get-message-properties "notmuch-tree" nil) + + (defcustom notmuch-message-headers '("Subject" "To" "Cc" "Date") + "Headers that should be shown in a message, in this order. +@@ -1459,8 +1460,17 @@ (defun notmuch-show-set-prop (prop val &optional props) + (notmuch-show-set-message-properties props))) + + (defun notmuch-show-get-prop (prop &optional props) ++ "Get property PROP from current message in show or tree mode. ++ ++It gets property PROP from PROPS or, if PROPS is nil, the current ++message in either tree or show. This means that several utility ++functions in notmuch-show can be used directly by notmuch-tree as ++they just need the correct message properties." + (let ((props (or props +- (notmuch-show-get-message-properties)))) ++ (cond ((eq major-mode 'notmuch-show-mode) ++ (notmuch-show-get-message-properties)) ++ ((eq major-mode 'notmuch-tree-mode) ++ (notmuch-tree-get-message-properties)))))) + (plist-get props prop))) + + (defun notmuch-show-get-message-id (&optional bare) +diff --git a/emacs/notmuch-tree.el b/emacs/notmuch-tree.el +index 7d5f475..88f92f2 100644 +--- a/emacs/notmuch-tree.el ++++ b/emacs/notmuch-tree.el +@@ -290,22 +290,6 @@ (defun notmuch-tree-get-message-properties () + (beginning-of-line) + (get-text-property (point) :notmuch-message-properties))) + +-;; XXX This should really be a lib function but we are trying to +-;; reduce impact on the code base. +-(defun notmuch-show-get-prop (prop &optional props) +- "This is a tree view overridden version of notmuch-show-get-prop +- +-It gets property PROP from PROPS or, if PROPS is nil, the current +-message in either tree or show. This means that several functions +-in notmuch-show now work unchanged in tree as they just need the +-correct message properties." +- (let ((props (or props +- (cond ((eq major-mode 'notmuch-show-mode) +- (notmuch-show-get-message-properties)) +- ((eq major-mode 'notmuch-tree-mode) +- (notmuch-tree-get-message-properties)))))) +- (plist-get props prop))) +- + (defun notmuch-tree-set-message-properties (props) + (save-excursion + (beginning-of-line) +-- +1.7.10.4 + -- 2.26.2