Re: [PATCH] emacs: wash: make word-wrap bound message width
[notmuch-archives.git] / d9 / 74e5c4584caf1516e37ea3c4e42b0a6deabd6b
1 Return-Path: <markwalters1009@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 1B793431FAF\r
6         for <notmuch@notmuchmail.org>; Sun, 13 Oct 2013 00:39:39 -0700 (PDT)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: 2.7\r
10 X-Spam-Level: **\r
11 X-Spam-Status: No, score=2.7 tagged_above=-999 required=5\r
12         tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,\r
13         FREEMAIL_ENVFROM_END_DIGIT=1, FREEMAIL_FROM=0.001,\r
14         FREEMAIL_REPLY=2.499, RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
15 Received: from olra.theworths.org ([127.0.0.1])\r
16         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
17         with ESMTP id bSK2La6b8A-U for <notmuch@notmuchmail.org>;\r
18         Sun, 13 Oct 2013 00:39:31 -0700 (PDT)\r
19 Received: from mail-wi0-f173.google.com (mail-wi0-f173.google.com\r
20         [209.85.212.173]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
21         (No client certificate requested)\r
22         by olra.theworths.org (Postfix) with ESMTPS id 54AC5431FAE\r
23         for <notmuch@notmuchmail.org>; Sun, 13 Oct 2013 00:39:31 -0700 (PDT)\r
24 Received: by mail-wi0-f173.google.com with SMTP id h11so866021wiv.12\r
25         for <notmuch@notmuchmail.org>; Sun, 13 Oct 2013 00:39:30 -0700 (PDT)\r
26 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;\r
27         h=from:to:cc:subject:date:message-id;\r
28         bh=YqxiVOPYFrqRla8MpM1bOzYLWxXwRaC5ibFxhjr3Bdo=;\r
29         b=0sbkoYSak20hea9264b1bxxM3fBSKwI57Hcyhv38LWqROa9AUm7CFfKIA/ZtadihmZ\r
30         YiIZCXVqEMqhH1ivb1LwOpb+5stJP/UJjH2G6275D5u+OnoFMj/qdPl6OIXEZtmbpMJe\r
31         oe9gQJOBqkxH4ohLIZeRCI2KRiW3wuk5NP0oLc2roCyOTKp/9y7GcUCL8y/8/LfpjMPl\r
32         tc00/0IUlaAwPGKZ5x389E8iMBDNw9KjeTbl4V1BxVjwAUcwks/52ybSspgb28mPJZph\r
33         URyYLGUr1EXPq7HtsKEObBx62mFtqYnoz+afi//MPCMiKXTFQlTfYcZOQue3pLaqF1qJ\r
34         dM9A==\r
35 X-Received: by 10.180.160.212 with SMTP id xm20mr9723888wib.23.1381649969892; \r
36         Sun, 13 Oct 2013 00:39:29 -0700 (PDT)\r
37 Received: from localhost (93-97-24-31.zone5.bethere.co.uk. [93.97.24.31])\r
38         by mx.google.com with ESMTPSA id i8sm21922217wiy.6.1969.12.31.16.00.00\r
39         (version=TLSv1.2 cipher=RC4-SHA bits=128/128);\r
40         Sun, 13 Oct 2013 00:39:29 -0700 (PDT)\r
41 From: Mark Walters <markwalters1009@gmail.com>\r
42 To: notmuch@notmuchmail.org\r
43 Subject: [PATCH v2] emacs: show: use interactive instead of current-prefix-arg\r
44 Date: Sun, 13 Oct 2013 08:39:12 +0100\r
45 Message-Id: <1381649952-23122-1-git-send-email-markwalters1009@gmail.com>\r
46 X-Mailer: git-send-email 1.7.9.1\r
47 X-BeenThere: notmuch@notmuchmail.org\r
48 X-Mailman-Version: 2.1.13\r
49 Precedence: list\r
50 List-Id: "Use and development of the notmuch mail system."\r
51         <notmuch.notmuchmail.org>\r
52 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
53         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
54 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
55 List-Post: <mailto:notmuch@notmuchmail.org>\r
56 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
57 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
58         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
59 X-List-Received-Date: Sun, 13 Oct 2013 07:39:39 -0000\r
60 \r
61 Currently notmuch-show looks at the prefix-arg directly via\r
62 current-prefix-arg. This changes it to use the interactive\r
63 specification.\r
64 \r
65 One test (for elide-toggle functionality) set the prefix arg\r
66 directly. Update this test to set the new argument directly.\r
67 ---\r
68 \r
69 This is version 2 of the patches at\r
70 id:1381348886-5673-1-git-send-email-markwalters1009@gmail.com The\r
71 changes are in fixes in response to Austin's review\r
72 id:20131013033157.GE10539@mit.edu and his comments on irc.\r
73 \r
74 Specifically, this updates the doc string for elide-toggle in\r
75 notmuch-show and folds the test fix in (so the tests should always\r
76 pass)\r
77 \r
78 I can also confirm that C-u RET on an id:-button link does work as\r
79 expected (and as currently): opening the appropriate message with\r
80 inverted elide behaviour.\r
81 \r
82 Best wishes \r
83 \r
84 Mark\r
85 \r
86 \r
87 \r
88  emacs/notmuch-show.el |   12 +++++++-----\r
89  emacs/notmuch.el      |    5 +++--\r
90  test/emacs-show       |    3 +--\r
91  3 files changed, 11 insertions(+), 9 deletions(-)\r
92 \r
93 diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el\r
94 index 5d7e24b..3189dda 100644\r
95 --- a/emacs/notmuch-show.el\r
96 +++ b/emacs/notmuch-show.el\r
97 @@ -1080,15 +1080,17 @@ buttons for a corresponding notmuch search."\r
98         (make-text-button (first link) (second link)\r
99                           :type 'notmuch-button-type\r
100                           'action `(lambda (arg)\r
101 -                                    (notmuch-show ,(third link)))\r
102 +                                    (notmuch-show ,(third link) current-prefix-arg))\r
103                           'follow-link t\r
104                           'help-echo "Mouse-1, RET: search for this message"\r
105                           'face goto-address-mail-face)))))\r
106  \r
107  ;;;###autoload\r
108 -(defun notmuch-show (thread-id &optional parent-buffer query-context buffer-name)\r
109 +(defun notmuch-show (thread-id &optional elide-toggle parent-buffer query-context buffer-name)\r
110    "Run \"notmuch show\" with the given thread ID and display results.\r
111  \r
112 +ELIDE-TOGGLE, if non-nil, inverts the default elide behavior.\r
113 +\r
114  The optional PARENT-BUFFER is the notmuch-search buffer from\r
115  which this notmuch-show command was executed, (so that the\r
116  next thread from that buffer can be show when done with this\r
117 @@ -1102,7 +1104,7 @@ The optional BUFFER-NAME provides the name of the buffer in\r
118  which the message thread is shown. If it is nil (which occurs\r
119  when the command is called interactively) the argument to the\r
120  function is used."\r
121 -  (interactive "sNotmuch show: ")\r
122 +  (interactive "sNotmuch show: \nP")\r
123    (let ((buffer-name (generate-new-buffer-name\r
124                       (or buffer-name\r
125                           (concat "*notmuch-" thread-id "*")))))\r
126 @@ -1112,9 +1114,9 @@ function is used."\r
127      (setq notmuch-show-process-crypto notmuch-crypto-process-mime)\r
128      ;; Set the default value for\r
129      ;; `notmuch-show-elide-non-matching-messages' in this buffer. If\r
130 -    ;; there is a prefix argument, invert the default.\r
131 +    ;; elide-toggle is set, invert the default.\r
132      (setq notmuch-show-elide-non-matching-messages notmuch-show-only-matching-messages)\r
133 -    (if current-prefix-arg\r
134 +    (if elide-toggle\r
135         (setq notmuch-show-elide-non-matching-messages (not notmuch-show-elide-non-matching-messages)))\r
136  \r
137      (setq notmuch-show-thread-id thread-id\r
138 diff --git a/emacs/notmuch.el b/emacs/notmuch.el\r
139 index 0ff248b..7124d0a 100644\r
140 --- a/emacs/notmuch.el\r
141 +++ b/emacs/notmuch.el\r
142 @@ -486,13 +486,14 @@ If BARE is set then do not prefix with \"thread:\""\r
143    "Return a list of authors for the current region"\r
144    (notmuch-search-properties-in-region :subject beg end))\r
145  \r
146 -(defun notmuch-search-show-thread ()\r
147 +(defun notmuch-search-show-thread (&optional elide-toggle)\r
148    "Display the currently selected thread."\r
149 -  (interactive)\r
150 +  (interactive "P")\r
151    (let ((thread-id (notmuch-search-find-thread-id))\r
152         (subject (notmuch-search-find-subject)))\r
153      (if (> (length thread-id) 0)\r
154         (notmuch-show thread-id\r
155 +                     elide-toggle\r
156                       (current-buffer)\r
157                       notmuch-search-query-string\r
158                       ;; Name the buffer based on the subject.\r
159 diff --git a/test/emacs-show b/test/emacs-show\r
160 index ae70053..fb23db4 100755\r
161 --- a/test/emacs-show\r
162 +++ b/test/emacs-show\r
163 @@ -91,8 +91,7 @@ test_begin_subtest "notmuch-show: elide non-matching messages (w/ prefix arg to\r
164  test_emacs '(let ((notmuch-show-only-matching-messages nil))\r
165         (notmuch-search "from:lars@seas.harvard.edu and subject:\"Maildir storage\"")\r
166         (notmuch-test-wait)\r
167 -       (let ((current-prefix-arg t))\r
168 -         (notmuch-search-show-thread))\r
169 +       (notmuch-search-show-thread t)\r
170         (notmuch-test-wait)\r
171         (test-visible-output))'\r
172  test_expect_equal_file OUTPUT $EXPECTED/notmuch-show-elide-non-matching-messages-on\r
173 -- \r
174 1.7.9.1\r
175 \r