Re: [PATCH 9/9] add has: query prefix to search for specific properties
[notmuch-archives.git] / 76 / 16025502b52ae58edf78c19538223b8ebf7059
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 7980A431FD2\r
6         for <notmuch@notmuchmail.org>; Tue, 24 Jan 2012 21:27:45 -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 EPdqheCmEeRn for <notmuch@notmuchmail.org>;\r
16         Tue, 24 Jan 2012 21:27:45 -0800 (PST)\r
17 Received: from mail-ww0-f41.google.com (mail-ww0-f41.google.com\r
18  [74.125.82.41])        (using TLSv1 with cipher RC4-SHA (128/128 bits))        (No client\r
19  certificate requested) by olra.theworths.org (Postfix) with ESMTPS id\r
20  BA32A431FB6    for <notmuch@notmuchmail.org>; Tue, 24 Jan 2012 21:27:44 -0800\r
21  (PST)\r
22 Received: by wgbdt11 with SMTP id dt11so1055193wgb.2\r
23         for <notmuch@notmuchmail.org>; Tue, 24 Jan 2012 21:27:42 -0800 (PST)\r
24 MIME-Version: 1.0\r
25 Received: by 10.180.95.199 with SMTP id dm7mr25749162wib.9.1327469262062;\r
26         Tue, 24 Jan 2012 21:27:42 -0800 (PST)\r
27 Received: from localhost ([109.131.95.182])\r
28         by mx.google.com with ESMTPS id hc10sm19102884wib.8.2012.01.24.21.27.40\r
29         (version=TLSv1/SSLv3 cipher=OTHER);\r
30         Tue, 24 Jan 2012 21:27:41 -0800 (PST)\r
31 From: Pieter Praet <pieter@praet.org>\r
32 To: Notmuch Mail <notmuch@notmuchmail.org>\r
33 Subject: [PATCH] emacs: make `notmuch-show-open-or-close-all' toggle\r
34  visibility\r
35 Date: Wed, 25 Jan 2012 06:25:39 +0100\r
36 Message-Id: <1327469139-1968-1-git-send-email-pieter@praet.org>\r
37 X-Mailer: git-send-email 1.7.8.1\r
38 X-Gm-Message-State:\r
39  ALoCoQmq1RLEmGPcGQcCLsKl07tMMQrVwZg5l3hFVPhPfexcYrgc3FgMhxoYKdPG2YypuYfdJgJs\r
40 X-BeenThere: notmuch@notmuchmail.org\r
41 X-Mailman-Version: 2.1.13\r
42 Precedence: list\r
43 List-Id: "Use and development of the notmuch mail system."\r
44         <notmuch.notmuchmail.org>\r
45 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
46         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
47 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
48 List-Post: <mailto:notmuch@notmuchmail.org>\r
49 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
50 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
51         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
52 X-List-Received-Date: Wed, 25 Jan 2012 05:27:45 -0000\r
53 \r
54 * emacs/notmuch-show.el (notmuch-show-open-or-close-all):\r
55   Rename to `notmuch-show-toggle-all-messages', and make it toggle\r
56   visibility of all messages based on the visibility of the current\r
57   message, instead of setting visibility based on whether or not a\r
58   prefix arg was supplied.\r
59 \r
60 Same functionality, less effort (reaching for 'C-u' is a pain)...\r
61 \r
62 ---\r
63  emacs/notmuch-show.el |   22 ++++++++++++----------\r
64  1 files changed, 12 insertions(+), 10 deletions(-)\r
65 \r
66 diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el\r
67 index e6a5b31..2d17f74 100644\r
68 --- a/emacs/notmuch-show.el\r
69 +++ b/emacs/notmuch-show.el\r
70 @@ -1050,8 +1050,8 @@ thread id.  If a prefix is given, crypto processing is toggled."\r
71         (define-key map "p" 'notmuch-show-previous-open-message)\r
72         (define-key map (kbd "DEL") 'notmuch-show-rewind)\r
73         (define-key map " " 'notmuch-show-advance-and-archive)\r
74 -       (define-key map (kbd "M-RET") 'notmuch-show-open-or-close-all)\r
75         (define-key map (kbd "RET") 'notmuch-show-toggle-message)\r
76 +       (define-key map (kbd "M-RET") 'notmuch-show-toggle-all-messages)\r
77         (define-key map "#" 'notmuch-show-print-message)\r
78         map)\r
79        "Keymap for \"notmuch show\" buffers.")\r
80 @@ -1502,16 +1502,18 @@ the result."\r
81       (not (plist-get props :message-visible))))\r
82    (force-window-update))\r
83  \r
84 -(defun notmuch-show-open-or-close-all ()\r
85 -  "Set the visibility all of the messages in the current thread.\r
86 -By default make all of the messages visible. With a prefix\r
87 -argument, hide all of the messages."\r
88 +(defun notmuch-show-toggle-all-messages ()\r
89 +  "Toggle the visibility of all messages in the current thread.\r
90 +If the current message is visible, hide all messages -- and vice versa."\r
91    (interactive)\r
92 -  (save-excursion\r
93 -    (goto-char (point-min))\r
94 -    (loop do (notmuch-show-message-visible (notmuch-show-get-message-properties)\r
95 -                                          (not current-prefix-arg))\r
96 -         until (not (notmuch-show-goto-message-next))))\r
97 +  (let ((toggle (notmuch-show-message-visible-p)))\r
98 +    (save-excursion\r
99 +      (goto-char (point-min))\r
100 +      (loop do (notmuch-show-message-visible\r
101 +               (notmuch-show-get-message-properties)\r
102 +               (not toggle))\r
103 +           until (not (notmuch-show-goto-message-next)))))\r
104 +  (recenter-top-bottom 1)\r
105    (force-window-update))\r
106  \r
107  (defun notmuch-show-next-button ()\r
108 -- \r
109 1.7.8.1\r
110 \r