Re: [PATCH] emacs: make `notmuch-show-open-or-close-all' toggle visibility
authorDmitry Kurochkin <dmitry.kurochkin@gmail.com>
Mon, 13 Feb 2012 10:51:17 +0000 (14:51 +0400)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:44:26 +0000 (09:44 -0800)
4b/836598ca0570fc9af95a3d1a69ab944f35ee0c [new file with mode: 0644]

diff --git a/4b/836598ca0570fc9af95a3d1a69ab944f35ee0c b/4b/836598ca0570fc9af95a3d1a69ab944f35ee0c
new file mode 100644 (file)
index 0000000..cd8d072
--- /dev/null
@@ -0,0 +1,152 @@
+Return-Path: <dmitry.kurochkin@gmail.com>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+       by olra.theworths.org (Postfix) with ESMTP id 1EA95431FBD\r
+       for <notmuch@notmuchmail.org>; Mon, 13 Feb 2012 02:52:42 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.799\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.799 tagged_above=-999 required=5\r
+       tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,\r
+       FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+       by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+       with ESMTP id 4M8gGjiDVyFK for <notmuch@notmuchmail.org>;\r
+       Mon, 13 Feb 2012 02:52:39 -0800 (PST)\r
+Received: from mail-bk0-f53.google.com (mail-bk0-f53.google.com\r
+       [209.85.214.53]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
+       (No client certificate requested)\r
+       by olra.theworths.org (Postfix) with ESMTPS id 8A5F7431FBC\r
+       for <notmuch@notmuchmail.org>; Mon, 13 Feb 2012 02:52:39 -0800 (PST)\r
+Received: by bkcit16 with SMTP id it16so271893bkc.26\r
+       for <notmuch@notmuchmail.org>; Mon, 13 Feb 2012 02:52:38 -0800 (PST)\r
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;\r
+       h=from:to:subject:in-reply-to:references:user-agent:date:message-id\r
+       :mime-version:content-type;\r
+       bh=P+xCyWJ+x9BbiCYD+NRnxMHD8Fq4kTBR8B+UD41x348=;\r
+       b=QRDR0nI1Tyfltvqg4jYz7kcDm1gE6ozKuXWtrBndlHLfUSNdppXU08g+gXlE/JFqHe\r
+       K51vmCElQyefcbbtZj/kOt9hVKFYtvfs25nX+4OQd42yOg8JA+7yJJOW0o0Wy2JIKIOd\r
+       Qr9HHlV/CoRZqdU5/wHJMUkQ7MAoUUTqa83Bw=\r
+Received: by 10.204.13.82 with SMTP id b18mr7063809bka.88.1329130357949;\r
+       Mon, 13 Feb 2012 02:52:37 -0800 (PST)\r
+Received: from localhost ([91.144.186.21])\r
+       by mx.google.com with ESMTPS id ez5sm44914307bkc.15.2012.02.13.02.52.35\r
+       (version=TLSv1/SSLv3 cipher=OTHER);\r
+       Mon, 13 Feb 2012 02:52:35 -0800 (PST)\r
+From: Dmitry Kurochkin <dmitry.kurochkin@gmail.com>\r
+To: Pieter Praet <pieter@praet.org>, Notmuch Mail <notmuch@notmuchmail.org>\r
+Subject: Re: [PATCH] emacs: make `notmuch-show-open-or-close-all' toggle\r
+       visibility\r
+In-Reply-To: <1327469139-1968-1-git-send-email-pieter@praet.org>\r
+References: <1327469139-1968-1-git-send-email-pieter@praet.org>\r
+User-Agent: Notmuch/0.11.1+167~g6e72434 (http://notmuchmail.org) Emacs/23.3.1\r
+       (x86_64-pc-linux-gnu)\r
+Date: Mon, 13 Feb 2012 14:51:17 +0400\r
+Message-ID: <87wr7r80re.fsf@gmail.com>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain; charset=us-ascii\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+       <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Mon, 13 Feb 2012 10:52:42 -0000\r
+\r
+Hi Pieter.\r
+\r
+On Wed, 25 Jan 2012 06:25:39 +0100, Pieter Praet <pieter@praet.org> wrote:\r
+> * emacs/notmuch-show.el (notmuch-show-open-or-close-all):\r
+>   Rename to `notmuch-show-toggle-all-messages', and make it toggle\r
+>   visibility of all messages based on the visibility of the current\r
+>   message, instead of setting visibility based on whether or not a\r
+>   prefix arg was supplied.\r
+> \r
+> Same functionality, less effort (reaching for 'C-u' is a pain)...\r
+> \r
+> ---\r
+>  emacs/notmuch-show.el |   22 ++++++++++++----------\r
+>  1 files changed, 12 insertions(+), 10 deletions(-)\r
+> \r
+> diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el\r
+> index e6a5b31..2d17f74 100644\r
+> --- a/emacs/notmuch-show.el\r
+> +++ b/emacs/notmuch-show.el\r
+> @@ -1050,8 +1050,8 @@ thread id.  If a prefix is given, crypto processing is toggled."\r
+>      (define-key map "p" 'notmuch-show-previous-open-message)\r
+>      (define-key map (kbd "DEL") 'notmuch-show-rewind)\r
+>      (define-key map " " 'notmuch-show-advance-and-archive)\r
+> -    (define-key map (kbd "M-RET") 'notmuch-show-open-or-close-all)\r
+>      (define-key map (kbd "RET") 'notmuch-show-toggle-message)\r
+> +    (define-key map (kbd "M-RET") 'notmuch-show-toggle-all-messages)\r
+\r
+Should the function name include "visible" or "visibility" to make it\r
+clear what is toggled?  E.g. `notmuch-show-toggle-visibility-all'.\r
+\r
+Also, consider changing "all-messages" to just "all" or "thread".  That\r
+seems to be more consistent with other functions.\r
+\r
+>      (define-key map "#" 'notmuch-show-print-message)\r
+>      map)\r
+>        "Keymap for \"notmuch show\" buffers.")\r
+> @@ -1502,16 +1502,18 @@ the result."\r
+>       (not (plist-get props :message-visible))))\r
+>    (force-window-update))\r
+>  \r
+> -(defun notmuch-show-open-or-close-all ()\r
+> -  "Set the visibility all of the messages in the current thread.\r
+> -By default make all of the messages visible. With a prefix\r
+> -argument, hide all of the messages."\r
+> +(defun notmuch-show-toggle-all-messages ()\r
+> +  "Toggle the visibility of all messages in the current thread.\r
+> +If the current message is visible, hide all messages -- and vice versa."\r
+>    (interactive)\r
+> -  (save-excursion\r
+> -    (goto-char (point-min))\r
+> -    (loop do (notmuch-show-message-visible (notmuch-show-get-message-properties)\r
+> -                                       (not current-prefix-arg))\r
+> -      until (not (notmuch-show-goto-message-next))))\r
+> +  (let ((toggle (notmuch-show-message-visible-p)))\r
+\r
+Please rename "toggle" to "visible-p".  That would make it more clear\r
+what the variable means, and is consistent with\r
+`notmuch-show-message-visible-p'.\r
+\r
+> +    (save-excursion\r
+> +      (goto-char (point-min))\r
+> +      (loop do (notmuch-show-message-visible\r
+> +            (notmuch-show-get-message-properties)\r
+> +            (not toggle))\r
+> +        until (not (notmuch-show-goto-message-next)))))\r
+\r
+A new `notmuch-show-mapc' function was introduced in a recent commit.\r
+Please use it here instead of a custom loop.\r
+\r
+> +  (recenter-top-bottom 1)\r
+\r
+There was no `recenter-top-bottom' call before.  Why is it needed now?\r
+It seems like an independent change and, if it is needed, would be\r
+better as a separate patch.  At the very least, it's worth mentioning in\r
+the preamble and perhaps in a comment.\r
+\r
+Regards,\r
+  Dmitry\r
+\r
+>    (force-window-update))\r
+>  \r
+>  (defun notmuch-show-next-button ()\r
+> -- \r
+> 1.7.8.1\r
+> \r
+> _______________________________________________\r
+> notmuch mailing list\r
+> notmuch@notmuchmail.org\r
+> http://notmuchmail.org/mailman/listinfo/notmuch\r