From 5b1b7e693a1a8308d944c88c9f789d2041c9a1ab Mon Sep 17 00:00:00 2001 From: Tomi Ollila Date: Sat, 7 Jun 2014 16:42:46 +0300 Subject: [PATCH] Re: [PATCH] emacs: tree/show remove duplicate function --- f8/0c41f16c29b49dbfd16074accd0633ad6442c7 | 144 ++++++++++++++++++++++ 1 file changed, 144 insertions(+) create mode 100644 f8/0c41f16c29b49dbfd16074accd0633ad6442c7 diff --git a/f8/0c41f16c29b49dbfd16074accd0633ad6442c7 b/f8/0c41f16c29b49dbfd16074accd0633ad6442c7 new file mode 100644 index 000000000..70396614f --- /dev/null +++ b/f8/0c41f16c29b49dbfd16074accd0633ad6442c7 @@ -0,0 +1,144 @@ +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 208B240A92F + for ; Sat, 7 Jun 2014 06:43:03 -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 O06gPyUvXLzB for ; + Sat, 7 Jun 2014 06:42:54 -0700 (PDT) +Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34]) + by olra.theworths.org (Postfix) with ESMTP id 92F1640A92E + for ; Sat, 7 Jun 2014 06:42:54 -0700 (PDT) +Received: from guru.guru-group.fi (localhost [IPv6:::1]) + by guru.guru-group.fi (Postfix) with ESMTP id 3C3611000B3; + Sat, 7 Jun 2014 16:42:46 +0300 (EEST) +From: Tomi Ollila +To: Mark Walters , notmuch@notmuchmail.org +Subject: Re: [PATCH] emacs: tree/show remove duplicate function +In-Reply-To: <1402134668-18587-1-git-send-email-markwalters1009@gmail.com> +References: <1402134668-18587-1-git-send-email-markwalters1009@gmail.com> +User-Agent: Notmuch/0.18+28~gcecaba1 (http://notmuchmail.org) Emacs/24.3.1 + (x86_64-unknown-linux-gnu) +X-Face: HhBM'cA~ +MIME-Version: 1.0 +Content-Type: text/plain +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 13:43:03 -0000 + +On Sat, Jun 07 2014, Mark Walters wrote: + +> 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. + +LGTM, and + +https://github.com/domo141/nottoomuch/blob/master/make-one-notmuch-el.pl + +no longer complains about duplicate function :D + +> +> Best wishes +> +> Mark + +Tomi + + +> +> +> 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 +> +> _______________________________________________ +> notmuch mailing list +> notmuch@notmuchmail.org +> http://notmuchmail.org/mailman/listinfo/notmuch -- 2.26.2