[PATCH] lib: provide _notmuch_database_log_append
[notmuch-archives.git] / 3f / e6b1ad88b7ef26860bea6bee63e8d4b4069c61
1 Return-Path: <pieter@praet.org>\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 3319B431FB6\r
6         for <notmuch@notmuchmail.org>; Wed, 22 Feb 2012 10:46:14 -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.7\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5\r
12         tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
13 Received: from olra.theworths.org ([127.0.0.1])\r
14         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
15         with ESMTP id ZkkXxzZBlZ3l for <notmuch@notmuchmail.org>;\r
16         Wed, 22 Feb 2012 10:46:12 -0800 (PST)\r
17 Received: from mail-wi0-f181.google.com (mail-wi0-f181.google.com\r
18         [209.85.212.181]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
19         (No client certificate requested)\r
20         by olra.theworths.org (Postfix) with ESMTPS id 7E902431FD2\r
21         for <notmuch@notmuchmail.org>; Wed, 22 Feb 2012 10:45:59 -0800 (PST)\r
22 Received: by mail-wi0-f181.google.com with SMTP id hi8so270670wib.26\r
23         for <notmuch@notmuchmail.org>; Wed, 22 Feb 2012 10:45:59 -0800 (PST)\r
24 Received-SPF: pass (google.com: domain of pieter@praet.org designates\r
25         10.180.24.202 as permitted sender) client-ip=10.180.24.202; \r
26 Authentication-Results: mr.google.com;\r
27         spf=pass (google.com: domain of pieter@praet.org\r
28         designates 10.180.24.202 as permitted sender)\r
29         smtp.mail=pieter@praet.org\r
30 Received: from mr.google.com ([10.180.24.202])\r
31         by 10.180.24.202 with SMTP id w10mr37952116wif.9.1329936359244\r
32         (num_hops = 1); Wed, 22 Feb 2012 10:45:59 -0800 (PST)\r
33 MIME-Version: 1.0\r
34 Received: by 10.180.24.202 with SMTP id w10mr31404498wif.9.1329936359162;\r
35         Wed, 22 Feb 2012 10:45:59 -0800 (PST)\r
36 Received: from localhost ([109.131.181.26])\r
37         by mx.google.com with ESMTPS id hs6sm40609002wib.2.2012.02.22.10.45.58\r
38         (version=TLSv1/SSLv3 cipher=OTHER);\r
39         Wed, 22 Feb 2012 10:45:58 -0800 (PST)\r
40 From: Pieter Praet <pieter@praet.org>\r
41 To: Notmuch Mail <notmuch@notmuchmail.org>\r
42 Subject: [PATCH v2 6/7] emacs: make `notmuch-show-toggle-visibility-messages'\r
43         live up to its new name\r
44 Date: Wed, 22 Feb 2012 19:43:33 +0100\r
45 Message-Id: <1329936214-30959-6-git-send-email-pieter@praet.org>\r
46 X-Mailer: git-send-email 1.7.8.1\r
47 In-Reply-To: <1327469139-1968-1-git-send-email-pieter@praet.org>\r
48 References: <1327469139-1968-1-git-send-email-pieter@praet.org>\r
49 X-Gm-Message-State:\r
50  ALoCoQkaA5ifvHffQjlGAqknyHBr56wpptXbG+nSmxTH03vyQJ2OrsVNEN982g+AQzQYjTYfi6G8\r
51 X-BeenThere: notmuch@notmuchmail.org\r
52 X-Mailman-Version: 2.1.13\r
53 Precedence: list\r
54 List-Id: "Use and development of the notmuch mail system."\r
55         <notmuch.notmuchmail.org>\r
56 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
57         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
58 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
59 List-Post: <mailto:notmuch@notmuchmail.org>\r
60 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
61 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
62         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
63 X-List-Received-Date: Wed, 22 Feb 2012 18:46:14 -0000\r
64 \r
65 * emacs/notmuch-show.el (notmuch-show-toggle-visibility-messages):\r
66   Toggle visibility of all messages in current thread based on visibility\r
67   of the current message, instead of setting visibility based on whether\r
68   or not a prefix arg was supplied.\r
69 \r
70   Also move current buffer line to the 2nd window line so the current\r
71   message is put properly into focus, whilst making the presence of\r
72   previous messages in the thread obvious.\r
73 \r
74 Same functionality, less effort (reaching for 'C-u' is a pain)...\r
75 ---\r
76  emacs/notmuch-show.el |   20 ++++++++++++--------\r
77  test/emacs            |    6 +++---\r
78  2 files changed, 15 insertions(+), 11 deletions(-)\r
79 \r
80 diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el\r
81 index e4d1f9c..82d4265 100644\r
82 --- a/emacs/notmuch-show.el\r
83 +++ b/emacs/notmuch-show.el\r
84 @@ -1669,15 +1669,19 @@ (defun notmuch-show-toggle-visibility-message ()\r
85    (force-window-update))\r
86  \r
87  (defun notmuch-show-toggle-visibility-messages ()\r
88 -  "Set the visibility all of the messages in the current thread.\r
89 -By default make all of the messages visible. With a prefix\r
90 -argument, hide all of the messages."\r
91 +  "Toggle the visibility of all messages in the current thread.\r
92 +If the current message is visible, hide all messages -- and vice versa."\r
93    (interactive)\r
94 -  (save-excursion\r
95 -    (goto-char (point-min))\r
96 -    (loop do (notmuch-show-message-visible (notmuch-show-get-message-properties)\r
97 -                                          (not current-prefix-arg))\r
98 -         until (not (notmuch-show-goto-message-next))))\r
99 +  (let ((visible-p (notmuch-show-message-visible-p)))\r
100 +    (notmuch-show-mapc\r
101 +     (lambda () (notmuch-show-message-visible\r
102 +                (notmuch-show-get-message-properties)\r
103 +                (not visible-p)))))\r
104 +\r
105 +  ;; Put the current message properly into focus, but don't\r
106 +  ;; obscure the presence of previous messages in the thread.\r
107 +  (recenter-top-bottom 1)\r
108 +\r
109    (force-window-update))\r
110  \r
111  (defun notmuch-show-next-button ()\r
112 diff --git a/test/emacs b/test/emacs\r
113 index 29fdec0..5c61743 100755\r
114 --- a/test/emacs\r
115 +++ b/test/emacs\r
116 @@ -410,14 +410,14 @@ test_expect_equal_file OUTPUT $EXPECTED/notmuch-show-message-with-headers-hidden\r
117  \r
118  test_begin_subtest "notmuch-show: collapse all messages in thread"\r
119  test_emacs '(notmuch-show "id:f35dbb950911171435ieecd458o853c873e35f4be95@mail.gmail.com")\r
120 -       (let ((current-prefix-arg t))\r
121 -         (notmuch-show-toggle-visibility-messages)\r
122 -         (test-visible-output))'\r
123 +       (notmuch-show-toggle-visibility-messages)\r
124 +       (test-visible-output)'\r
125  test_expect_equal_file OUTPUT $EXPECTED/notmuch-show-thread-with-all-messages-collapsed\r
126  \r
127  test_begin_subtest "notmuch-show: uncollapse all messages in thread"\r
128  test_emacs '(notmuch-show "id:f35dbb950911171435ieecd458o853c873e35f4be95@mail.gmail.com")\r
129         (notmuch-show-toggle-visibility-messages)\r
130 +       (notmuch-show-toggle-visibility-messages)\r
131         (test-visible-output)'\r
132  test_expect_equal_file OUTPUT $EXPECTED/notmuch-show-thread-with-all-messages-uncollapsed\r
133  \r
134 -- \r
135 1.7.8.1\r
136 \r