From 07b0c97fab3c84067aa29c887a6e8c89e421ebf1 Mon Sep 17 00:00:00 2001 From: Tomi Ollila Date: Thu, 12 Apr 2012 22:10:10 +0300 Subject: [PATCH] Re: [PATCH] emacs-show: open excluded matches if no other matches --- 3c/9640ac761beb520b5741b9fec46847ae911e16 | 108 ++++++++++++++++++++++ 1 file changed, 108 insertions(+) create mode 100644 3c/9640ac761beb520b5741b9fec46847ae911e16 diff --git a/3c/9640ac761beb520b5741b9fec46847ae911e16 b/3c/9640ac761beb520b5741b9fec46847ae911e16 new file mode 100644 index 000000000..600e9734a --- /dev/null +++ b/3c/9640ac761beb520b5741b9fec46847ae911e16 @@ -0,0 +1,108 @@ +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 68BCE431FAF + for ; Thu, 12 Apr 2012 12:10:13 -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 TAvH5VIIoMtq for ; + Thu, 12 Apr 2012 12:10:13 -0700 (PDT) +Received: from guru.guru-group.fi (guru-group.fi [87.108.86.66]) + by olra.theworths.org (Postfix) with ESMTP id BB7F1431FAE + for ; Thu, 12 Apr 2012 12:10:12 -0700 (PDT) +Received: by guru.guru-group.fi (Postfix, from userid 501) + id 077A968055; Thu, 12 Apr 2012 22:10:10 +0300 (EEST) +From: Tomi Ollila +To: Mark Walters , notmuch@notmuchmail.org +Subject: Re: [PATCH] emacs-show: open excluded matches if no other matches +In-Reply-To: <1331836090-30560-1-git-send-email-markwalters1009@gmail.com> +References: <1331836090-30560-1-git-send-email-markwalters1009@gmail.com> +User-Agent: Notmuch/0.12+104~gf9ad237 (http://notmuchmail.org) Emacs/23.3.1 + (x86_64-unknown-linux-gnu) +X-Face: HhBM'cA~ +MIME-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +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: Thu, 12 Apr 2012 19:10:13 -0000 + +On Thu, Mar 15 2012, Mark Walters wrote: + +> Currently emacs show does not open matching but excluded +> messages. This is normally the desired behaviour but is probably not +> ideal if only excluded messages match. This patch opens all the +> matching (necessarily excluded) messages in this case and goes to the +> first one. +> --- + +I don't (yet) fully understand this exclude stuff, but the +implementation looks ok. + ++1 + +Tomi + +> emacs/notmuch-show.el | 14 ++++++++++++-- +> 1 files changed, 12 insertions(+), 2 deletions(-) +> +> diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el +> index 4a60631..bd4ba0f 100644 +> --- a/emacs/notmuch-show.el +> +++ b/emacs/notmuch-show.el +> @@ -1608,6 +1608,11 @@ to show, nil otherwise." +> (notmuch-show-message-adjust)) +> (goto-char (point-max))))) +> +> +(defun notmuch-show-open-if-matched () +> + "Open a message if it is matched (whether or not excluded)." +> + (let ((props (notmuch-show-get-message-properties))) +> + (notmuch-show-message-visible props (plist-get props :match)))) +> + +> (defun notmuch-show-goto-first-wanted-message () +> "Move to the first open message and mark it read" +> (goto-char (point-min)) +> @@ -1615,9 +1620,14 @@ to show, nil otherwise." +> (notmuch-show-mark-read) +> (notmuch-show-next-open-message)) +> (when (eobp) +> + ;; There are no matched non-excluded messages so open all matched +> + ;; (necessarily excluded) messages and go to the first. +> + (notmuch-show-mapc 'notmuch-show-open-if-matched) +> + (force-window-update) +> (goto-char (point-min)) +> - (unless (notmuch-show-get-prop :match) +> - (notmuch-show-next-matching-message)))) +> + (if (notmuch-show-message-visible-p) +> + (notmuch-show-mark-read) +> + (notmuch-show-next-open-message)))) +> +> (defun notmuch-show-previous-open-message () +> "Show the previous open message." +> -- +> 1.7.9.1 +> +> _______________________________________________ +> notmuch mailing list +> notmuch@notmuchmail.org +> http://notmuchmail.org/mailman/listinfo/notmuch -- 2.26.2