[WIP 1/3] util: move chomp_newline to string-util.h
[notmuch-archives.git] / 4b / 836598ca0570fc9af95a3d1a69ab944f35ee0c
1 Return-Path: <dmitry.kurochkin@gmail.com>\r
2 X-Original-To: notmuch@notmuchmail.org\r
3 Delivered-To: notmuch@notmuchmail.org\r
4 Received: from localhost (localhost [127.0.0.1])\r
5         by olra.theworths.org (Postfix) with ESMTP id 1EA95431FBD\r
6         for <notmuch@notmuchmail.org>; Mon, 13 Feb 2012 02:52:42 -0800 (PST)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: -0.799\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-0.799 tagged_above=-999 required=5\r
12         tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,\r
13         FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
14 Received: from olra.theworths.org ([127.0.0.1])\r
15         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
16         with ESMTP id 4M8gGjiDVyFK for <notmuch@notmuchmail.org>;\r
17         Mon, 13 Feb 2012 02:52:39 -0800 (PST)\r
18 Received: from mail-bk0-f53.google.com (mail-bk0-f53.google.com\r
19         [209.85.214.53]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
20         (No client certificate requested)\r
21         by olra.theworths.org (Postfix) with ESMTPS id 8A5F7431FBC\r
22         for <notmuch@notmuchmail.org>; Mon, 13 Feb 2012 02:52:39 -0800 (PST)\r
23 Received: by bkcit16 with SMTP id it16so271893bkc.26\r
24         for <notmuch@notmuchmail.org>; Mon, 13 Feb 2012 02:52:38 -0800 (PST)\r
25 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;\r
26         h=from:to:subject:in-reply-to:references:user-agent:date:message-id\r
27         :mime-version:content-type;\r
28         bh=P+xCyWJ+x9BbiCYD+NRnxMHD8Fq4kTBR8B+UD41x348=;\r
29         b=QRDR0nI1Tyfltvqg4jYz7kcDm1gE6ozKuXWtrBndlHLfUSNdppXU08g+gXlE/JFqHe\r
30         K51vmCElQyefcbbtZj/kOt9hVKFYtvfs25nX+4OQd42yOg8JA+7yJJOW0o0Wy2JIKIOd\r
31         Qr9HHlV/CoRZqdU5/wHJMUkQ7MAoUUTqa83Bw=\r
32 Received: by 10.204.13.82 with SMTP id b18mr7063809bka.88.1329130357949;\r
33         Mon, 13 Feb 2012 02:52:37 -0800 (PST)\r
34 Received: from localhost ([91.144.186.21])\r
35         by mx.google.com with ESMTPS id ez5sm44914307bkc.15.2012.02.13.02.52.35\r
36         (version=TLSv1/SSLv3 cipher=OTHER);\r
37         Mon, 13 Feb 2012 02:52:35 -0800 (PST)\r
38 From: Dmitry Kurochkin <dmitry.kurochkin@gmail.com>\r
39 To: Pieter Praet <pieter@praet.org>, Notmuch Mail <notmuch@notmuchmail.org>\r
40 Subject: Re: [PATCH] emacs: make `notmuch-show-open-or-close-all' toggle\r
41         visibility\r
42 In-Reply-To: <1327469139-1968-1-git-send-email-pieter@praet.org>\r
43 References: <1327469139-1968-1-git-send-email-pieter@praet.org>\r
44 User-Agent: Notmuch/0.11.1+167~g6e72434 (http://notmuchmail.org) Emacs/23.3.1\r
45         (x86_64-pc-linux-gnu)\r
46 Date: Mon, 13 Feb 2012 14:51:17 +0400\r
47 Message-ID: <87wr7r80re.fsf@gmail.com>\r
48 MIME-Version: 1.0\r
49 Content-Type: text/plain; charset=us-ascii\r
50 X-BeenThere: notmuch@notmuchmail.org\r
51 X-Mailman-Version: 2.1.13\r
52 Precedence: list\r
53 List-Id: "Use and development of the notmuch mail system."\r
54         <notmuch.notmuchmail.org>\r
55 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
56         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
57 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
58 List-Post: <mailto:notmuch@notmuchmail.org>\r
59 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
60 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
61         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
62 X-List-Received-Date: Mon, 13 Feb 2012 10:52:42 -0000\r
63 \r
64 Hi Pieter.\r
65 \r
66 On Wed, 25 Jan 2012 06:25:39 +0100, Pieter Praet <pieter@praet.org> wrote:\r
67 > * emacs/notmuch-show.el (notmuch-show-open-or-close-all):\r
68 >   Rename to `notmuch-show-toggle-all-messages', and make it toggle\r
69 >   visibility of all messages based on the visibility of the current\r
70 >   message, instead of setting visibility based on whether or not a\r
71 >   prefix arg was supplied.\r
72\r
73 > Same functionality, less effort (reaching for 'C-u' is a pain)...\r
74\r
75 > ---\r
76 >  emacs/notmuch-show.el |   22 ++++++++++++----------\r
77 >  1 files changed, 12 insertions(+), 10 deletions(-)\r
78\r
79 > diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el\r
80 > index e6a5b31..2d17f74 100644\r
81 > --- a/emacs/notmuch-show.el\r
82 > +++ b/emacs/notmuch-show.el\r
83 > @@ -1050,8 +1050,8 @@ thread id.  If a prefix is given, crypto processing is toggled."\r
84 >       (define-key map "p" 'notmuch-show-previous-open-message)\r
85 >       (define-key map (kbd "DEL") 'notmuch-show-rewind)\r
86 >       (define-key map " " 'notmuch-show-advance-and-archive)\r
87 > -     (define-key map (kbd "M-RET") 'notmuch-show-open-or-close-all)\r
88 >       (define-key map (kbd "RET") 'notmuch-show-toggle-message)\r
89 > +     (define-key map (kbd "M-RET") 'notmuch-show-toggle-all-messages)\r
90 \r
91 Should the function name include "visible" or "visibility" to make it\r
92 clear what is toggled?  E.g. `notmuch-show-toggle-visibility-all'.\r
93 \r
94 Also, consider changing "all-messages" to just "all" or "thread".  That\r
95 seems to be more consistent with other functions.\r
96 \r
97 >       (define-key map "#" 'notmuch-show-print-message)\r
98 >       map)\r
99 >        "Keymap for \"notmuch show\" buffers.")\r
100 > @@ -1502,16 +1502,18 @@ the result."\r
101 >       (not (plist-get props :message-visible))))\r
102 >    (force-window-update))\r
103 >  \r
104 > -(defun notmuch-show-open-or-close-all ()\r
105 > -  "Set the visibility all of the messages in the current thread.\r
106 > -By default make all of the messages visible. With a prefix\r
107 > -argument, hide all of the messages."\r
108 > +(defun notmuch-show-toggle-all-messages ()\r
109 > +  "Toggle the visibility of all messages in the current thread.\r
110 > +If the current message is visible, hide all messages -- and vice versa."\r
111 >    (interactive)\r
112 > -  (save-excursion\r
113 > -    (goto-char (point-min))\r
114 > -    (loop do (notmuch-show-message-visible (notmuch-show-get-message-properties)\r
115 > -                                        (not current-prefix-arg))\r
116 > -       until (not (notmuch-show-goto-message-next))))\r
117 > +  (let ((toggle (notmuch-show-message-visible-p)))\r
118 \r
119 Please rename "toggle" to "visible-p".  That would make it more clear\r
120 what the variable means, and is consistent with\r
121 `notmuch-show-message-visible-p'.\r
122 \r
123 > +    (save-excursion\r
124 > +      (goto-char (point-min))\r
125 > +      (loop do (notmuch-show-message-visible\r
126 > +             (notmuch-show-get-message-properties)\r
127 > +             (not toggle))\r
128 > +         until (not (notmuch-show-goto-message-next)))))\r
129 \r
130 A new `notmuch-show-mapc' function was introduced in a recent commit.\r
131 Please use it here instead of a custom loop.\r
132 \r
133 > +  (recenter-top-bottom 1)\r
134 \r
135 There was no `recenter-top-bottom' call before.  Why is it needed now?\r
136 It seems like an independent change and, if it is needed, would be\r
137 better as a separate patch.  At the very least, it's worth mentioning in\r
138 the preamble and perhaps in a comment.\r
139 \r
140 Regards,\r
141   Dmitry\r
142 \r
143 >    (force-window-update))\r
144 >  \r
145 >  (defun notmuch-show-next-button ()\r
146 > -- \r
147 > 1.7.8.1\r
148\r
149 > _______________________________________________\r
150 > notmuch mailing list\r
151 > notmuch@notmuchmail.org\r
152 > http://notmuchmail.org/mailman/listinfo/notmuch\r