From df63571e0b7f56b285cdd33747b330ee8260b787 Mon Sep 17 00:00:00 2001 From: Dmitry Kurochkin Date: Mon, 13 Feb 2012 14:51:17 +0400 Subject: [PATCH] Re: [PATCH] emacs: make `notmuch-show-open-or-close-all' toggle visibility --- 4b/836598ca0570fc9af95a3d1a69ab944f35ee0c | 152 ++++++++++++++++++++++ 1 file changed, 152 insertions(+) create mode 100644 4b/836598ca0570fc9af95a3d1a69ab944f35ee0c diff --git a/4b/836598ca0570fc9af95a3d1a69ab944f35ee0c b/4b/836598ca0570fc9af95a3d1a69ab944f35ee0c new file mode 100644 index 000000000..cd8d072d1 --- /dev/null +++ b/4b/836598ca0570fc9af95a3d1a69ab944f35ee0c @@ -0,0 +1,152 @@ +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 1EA95431FBD + for ; Mon, 13 Feb 2012 02:52:42 -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 4M8gGjiDVyFK for ; + Mon, 13 Feb 2012 02:52:39 -0800 (PST) +Received: from mail-bk0-f53.google.com (mail-bk0-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 8A5F7431FBC + for ; Mon, 13 Feb 2012 02:52:39 -0800 (PST) +Received: by bkcit16 with SMTP id it16so271893bkc.26 + for ; Mon, 13 Feb 2012 02:52:38 -0800 (PST) +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; + h=from:to:subject:in-reply-to:references:user-agent:date:message-id + :mime-version:content-type; + bh=P+xCyWJ+x9BbiCYD+NRnxMHD8Fq4kTBR8B+UD41x348=; + b=QRDR0nI1Tyfltvqg4jYz7kcDm1gE6ozKuXWtrBndlHLfUSNdppXU08g+gXlE/JFqHe + K51vmCElQyefcbbtZj/kOt9hVKFYtvfs25nX+4OQd42yOg8JA+7yJJOW0o0Wy2JIKIOd + Qr9HHlV/CoRZqdU5/wHJMUkQ7MAoUUTqa83Bw= +Received: by 10.204.13.82 with SMTP id b18mr7063809bka.88.1329130357949; + Mon, 13 Feb 2012 02:52:37 -0800 (PST) +Received: from localhost ([91.144.186.21]) + by mx.google.com with ESMTPS id ez5sm44914307bkc.15.2012.02.13.02.52.35 + (version=TLSv1/SSLv3 cipher=OTHER); + Mon, 13 Feb 2012 02:52:35 -0800 (PST) +From: Dmitry Kurochkin +To: Pieter Praet , Notmuch Mail +Subject: Re: [PATCH] emacs: make `notmuch-show-open-or-close-all' toggle + visibility +In-Reply-To: <1327469139-1968-1-git-send-email-pieter@praet.org> +References: <1327469139-1968-1-git-send-email-pieter@praet.org> +User-Agent: Notmuch/0.11.1+167~g6e72434 (http://notmuchmail.org) Emacs/23.3.1 + (x86_64-pc-linux-gnu) +Date: Mon, 13 Feb 2012 14:51:17 +0400 +Message-ID: <87wr7r80re.fsf@gmail.com> +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: Mon, 13 Feb 2012 10:52:42 -0000 + +Hi Pieter. + +On Wed, 25 Jan 2012 06:25:39 +0100, Pieter Praet wrote: +> * emacs/notmuch-show.el (notmuch-show-open-or-close-all): +> Rename to `notmuch-show-toggle-all-messages', and make it toggle +> visibility of all messages based on the visibility of the current +> message, instead of setting visibility based on whether or not a +> prefix arg was supplied. +> +> Same functionality, less effort (reaching for 'C-u' is a pain)... +> +> --- +> emacs/notmuch-show.el | 22 ++++++++++++---------- +> 1 files changed, 12 insertions(+), 10 deletions(-) +> +> diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el +> index e6a5b31..2d17f74 100644 +> --- a/emacs/notmuch-show.el +> +++ b/emacs/notmuch-show.el +> @@ -1050,8 +1050,8 @@ thread id. If a prefix is given, crypto processing is toggled." +> (define-key map "p" 'notmuch-show-previous-open-message) +> (define-key map (kbd "DEL") 'notmuch-show-rewind) +> (define-key map " " 'notmuch-show-advance-and-archive) +> - (define-key map (kbd "M-RET") 'notmuch-show-open-or-close-all) +> (define-key map (kbd "RET") 'notmuch-show-toggle-message) +> + (define-key map (kbd "M-RET") 'notmuch-show-toggle-all-messages) + +Should the function name include "visible" or "visibility" to make it +clear what is toggled? E.g. `notmuch-show-toggle-visibility-all'. + +Also, consider changing "all-messages" to just "all" or "thread". That +seems to be more consistent with other functions. + +> (define-key map "#" 'notmuch-show-print-message) +> map) +> "Keymap for \"notmuch show\" buffers.") +> @@ -1502,16 +1502,18 @@ the result." +> (not (plist-get props :message-visible)))) +> (force-window-update)) +> +> -(defun notmuch-show-open-or-close-all () +> - "Set the visibility all of the messages in the current thread. +> -By default make all of the messages visible. With a prefix +> -argument, hide all of the messages." +> +(defun notmuch-show-toggle-all-messages () +> + "Toggle the visibility of all messages in the current thread. +> +If the current message is visible, hide all messages -- and vice versa." +> (interactive) +> - (save-excursion +> - (goto-char (point-min)) +> - (loop do (notmuch-show-message-visible (notmuch-show-get-message-properties) +> - (not current-prefix-arg)) +> - until (not (notmuch-show-goto-message-next)))) +> + (let ((toggle (notmuch-show-message-visible-p))) + +Please rename "toggle" to "visible-p". That would make it more clear +what the variable means, and is consistent with +`notmuch-show-message-visible-p'. + +> + (save-excursion +> + (goto-char (point-min)) +> + (loop do (notmuch-show-message-visible +> + (notmuch-show-get-message-properties) +> + (not toggle)) +> + until (not (notmuch-show-goto-message-next))))) + +A new `notmuch-show-mapc' function was introduced in a recent commit. +Please use it here instead of a custom loop. + +> + (recenter-top-bottom 1) + +There was no `recenter-top-bottom' call before. Why is it needed now? +It seems like an independent change and, if it is needed, would be +better as a separate patch. At the very least, it's worth mentioning in +the preamble and perhaps in a comment. + +Regards, + Dmitry + +> (force-window-update)) +> +> (defun notmuch-show-next-button () +> -- +> 1.7.8.1 +> +> _______________________________________________ +> notmuch mailing list +> notmuch@notmuchmail.org +> http://notmuchmail.org/mailman/listinfo/notmuch -- 2.26.2