Re: [PATCH] emacs: wash: make word-wrap bound message width
[notmuch-archives.git] / 2c / 495fddb45da536c14d1dd2b3599ea77916991a
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 68DEF431FB6\r
6         for <notmuch@notmuchmail.org>; Mon, 23 Sep 2013 12:53:21 -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: 0.201\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=0.201 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         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 ne7fBCma2b-0 for <notmuch@notmuchmail.org>;\r
18         Mon, 23 Sep 2013 12:53:13 -0700 (PDT)\r
19 Received: from mail-wg0-f51.google.com (mail-wg0-f51.google.com\r
20  [74.125.82.51])        (using TLSv1 with cipher RC4-SHA (128/128 bits))        (No client\r
21  certificate requested) by olra.theworths.org (Postfix) with ESMTPS id\r
22  830A5431FBD    for <notmuch@notmuchmail.org>; Mon, 23 Sep 2013 12:53:08 -0700\r
23  (PDT)\r
24 Received: by mail-wg0-f51.google.com with SMTP id c11so3491517wgh.18\r
25         for <notmuch@notmuchmail.org>; Mon, 23 Sep 2013 12:53:06 -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:in-reply-to:references;\r
28         bh=HgxN6x1qQdjHI6qc8bjwEmxrPk7c6RCeqYp/D2R8M7k=;\r
29         b=QpVd0/5XMROzgkUBpGhUa9W5sTO4KmZz7a3fPy0rcbMEho164R5QnYSHIVzvSQisXK\r
30         oSfqyah0znrr2deNiX+3G0WNT87V6LurZ4mVmaJfkZcGk8bVaaGar8A1qD/2NeUbD+0X\r
31         7mThx1dGirDLmiSITxA/bdNZgI1yHnD/koZ1DSvdVu9IHBY2uAaP/BWvyIZ1hnE8rhlg\r
32         LRy6UruC3Cb3Y8iduE/Z7E7FAAoA2siEVcznXz2OKnn3Av3nsEcx07VLou3vT5wSv7Ea\r
33         B4JHc4mHYRWMJAwVA2yhp5IGHpnh/8GKJ29rVU8oX6bXxCL7KNAL99d+18g5v38t/HEA\r
34         LbWQ==\r
35 X-Received: by 10.180.76.171 with SMTP id l11mr14907596wiw.39.1379965985973;\r
36         Mon, 23 Sep 2013 12:53:05 -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 d11sm722825wic.4.1969.12.31.16.00.00\r
39         (version=TLSv1.2 cipher=RC4-SHA bits=128/128);\r
40         Mon, 23 Sep 2013 12:53:05 -0700 (PDT)\r
41 From: Mark Walters <markwalters1009@gmail.com>\r
42 To: notmuch@notmuchmail.org\r
43 Subject: [PATCH 1/2] contrib: pick: move M-RET to prefix-arg RET\r
44 Date: Mon, 23 Sep 2013 20:52:58 +0100\r
45 Message-Id: <1379965979-14752-2-git-send-email-markwalters1009@gmail.com>\r
46 X-Mailer: git-send-email 1.7.9.1\r
47 In-Reply-To: <1379965979-14752-1-git-send-email-markwalters1009@gmail.com>\r
48 References: <1379965979-14752-1-git-send-email-markwalters1009@gmail.com>\r
49 X-BeenThere: notmuch@notmuchmail.org\r
50 X-Mailman-Version: 2.1.13\r
51 Precedence: list\r
52 List-Id: "Use and development of the notmuch mail system."\r
53         <notmuch.notmuchmail.org>\r
54 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
55         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
56 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
57 List-Post: <mailto:notmuch@notmuchmail.org>\r
58 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
59 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
60         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
61 X-List-Received-Date: Mon, 23 Sep 2013 19:53:21 -0000\r
62 \r
63 In pick the user has the option of showing the selected message in a\r
64 subpane (the message pane) or in the full frame. This is customisable\r
65 using the variable notmuch-pick-show-out. At the moment RET is bound\r
66 to the default option and M-RET the other option. This is\r
67 messy and involves tricks to make sure the keymap is setup at the\r
68 right time.\r
69 \r
70 This changes this to prefix-arg RET for the other option which\r
71 simplifies the code and makes things cleaner.\r
72 ---\r
73  contrib/notmuch-pick/notmuch-pick.el |   51 +++++++++++++--------------------\r
74  1 files changed, 20 insertions(+), 31 deletions(-)\r
75 \r
76 diff --git a/contrib/notmuch-pick/notmuch-pick.el b/contrib/notmuch-pick/notmuch-pick.el\r
77 index 054762b..3afdea4 100644\r
78 --- a/contrib/notmuch-pick/notmuch-pick.el\r
79 +++ b/contrib/notmuch-pick/notmuch-pick.el\r
80 @@ -50,17 +50,10 @@\r
81    "Showing message and thread structure."\r
82    :group 'notmuch)\r
83  \r
84 -;; This is ugly. We can't run setup-show-out until it has been defined\r
85 -;; which needs the keymap to be defined. So we defer setting up to\r
86 -;; notmuch-pick-init.\r
87  (defcustom notmuch-pick-show-out nil\r
88    "View selected messages in new window rather than split-pane."\r
89    :type 'boolean\r
90 -  :group 'notmuch-pick\r
91 -  :set (lambda (symbol value)\r
92 -        (set-default symbol value)\r
93 -        (when (fboundp 'notmuch-pick-setup-show-out)\r
94 -          (notmuch-pick-setup-show-out))))\r
95 +  :group 'notmuch-pick)\r
96  \r
97  (defcustom notmuch-pick-result-format\r
98    `(("date" . "%12s  ")\r
99 @@ -241,7 +234,6 @@ FUNC."\r
100      ;; Override because we want to close message pane first.\r
101      (define-key map "m" (notmuch-pick-close-message-pane-and #'notmuch-mua-new-mail))\r
102  \r
103 -    (define-key map [mouse-1] 'notmuch-pick-show-message)\r
104      ;; these use notmuch-show functions directly\r
105      (define-key map "|" 'notmuch-show-pipe-message)\r
106      (define-key map "w" 'notmuch-show-save-attachments)\r
107 @@ -261,6 +253,8 @@ FUNC."\r
108      (define-key map "V" (notmuch-pick-close-message-pane-and #'notmuch-show-view-raw-message))\r
109  \r
110      ;; The main pick bindings\r
111 +    (define-key map (kbd "RET") 'notmuch-pick-show-message)\r
112 +    (define-key map [mouse-1] 'notmuch-pick-show-message)\r
113      (define-key map "x" 'notmuch-pick-quit)\r
114      (define-key map "A" 'notmuch-pick-archive-thread)\r
115      (define-key map "a" 'notmuch-pick-archive-message-then-next)\r
116 @@ -280,21 +274,6 @@ FUNC."\r
117      map))\r
118  (fset 'notmuch-pick-mode-map notmuch-pick-mode-map)\r
119  \r
120 -(defun notmuch-pick-setup-show-out ()\r
121 -  "Set up the keymap for showing a thread\r
122 -\r
123 -This uses the value of the defcustom notmuch-pick-show-out to\r
124 -decide whether to show a message in the message pane or in the\r
125 -whole window."\r
126 -  (let ((map notmuch-pick-mode-map))\r
127 -    (if notmuch-pick-show-out\r
128 -       (progn\r
129 -         (define-key map (kbd "M-RET") 'notmuch-pick-show-message)\r
130 -         (define-key map (kbd "RET") 'notmuch-pick-show-message-out))\r
131 -      (progn\r
132 -       (define-key map (kbd "RET") 'notmuch-pick-show-message)\r
133 -       (define-key map (kbd "M-RET") 'notmuch-pick-show-message-out)))))\r
134 -\r
135  (defun notmuch-pick-get-message-properties ()\r
136    "Return the properties of the current message as a plist.\r
137  \r
138 @@ -466,7 +445,7 @@ Does NOT change the database."\r
139        (ignore-errors\r
140         (delete-window notmuch-pick-message-window)))))\r
141  \r
142 -(defun notmuch-pick-show-message ()\r
143 +(defun notmuch-pick-show-message-in ()\r
144    "Show the current message (in split-pane)."\r
145    (interactive)\r
146    (let ((id (notmuch-pick-get-message-id))\r
147 @@ -503,6 +482,17 @@ Does NOT change the database."\r
148        (notmuch-pick-close-message-window)\r
149        (notmuch-show id nil nil nil))))\r
150  \r
151 +(defun notmuch-pick-show-message (arg)\r
152 +  "Show the current message.\r
153 +\r
154 +Shows in split pane or whole window according to value of\r
155 +`notmuch-pick-show-out'. A prefix argument reverses the choice."\r
156 +  (interactive "P")\r
157 +  (if (or (and notmuch-pick-show-out  (not arg))\r
158 +         (and (not notmuch-pick-show-out) arg))\r
159 +      (notmuch-pick-show-message-out)\r
160 +    (notmuch-pick-show-message-in)))\r
161 +\r
162  (defun notmuch-pick-scroll-message-window ()\r
163    "Scroll the message window (if it exists)"\r
164    (interactive)\r
165 @@ -566,14 +556,14 @@ message will be \"unarchived\", i.e. the tag changes in\r
166    (interactive)\r
167    (forward-line)\r
168    (when (window-live-p notmuch-pick-message-window)\r
169 -    (notmuch-pick-show-message)))\r
170 +    (notmuch-pick-show-message-in)))\r
171  \r
172  (defun notmuch-pick-prev-message ()\r
173    "Move to previous message."\r
174    (interactive)\r
175    (forward-line -1)\r
176    (when (window-live-p notmuch-pick-message-window)\r
177 -    (notmuch-pick-show-message)))\r
178 +    (notmuch-pick-show-message-in)))\r
179  \r
180  (defun notmuch-pick-prev-matching-message ()\r
181    "Move to previous matching message."\r
182 @@ -582,7 +572,7 @@ message will be \"unarchived\", i.e. the tag changes in\r
183    (while (and (not (bobp)) (not (notmuch-pick-get-match)))\r
184      (forward-line -1))\r
185    (when (window-live-p notmuch-pick-message-window)\r
186 -    (notmuch-pick-show-message)))\r
187 +    (notmuch-pick-show-message-in)))\r
188  \r
189  (defun notmuch-pick-next-matching-message ()\r
190    "Move to next matching message."\r
191 @@ -591,7 +581,7 @@ message will be \"unarchived\", i.e. the tag changes in\r
192    (while (and (not (eobp)) (not (notmuch-pick-get-match)))\r
193      (forward-line))\r
194    (when (window-live-p notmuch-pick-message-window)\r
195 -    (notmuch-pick-show-message)))\r
196 +    (notmuch-pick-show-message-in)))\r
197  \r
198  (defun notmuch-pick-refresh-view ()\r
199    "Refresh view."\r
200 @@ -763,7 +753,7 @@ unchanged ADDRESS if parsing fails."\r
201        (goto-char (point-max))\r
202        (forward-line -1)\r
203        (when notmuch-pick-open-target\r
204 -       (notmuch-pick-show-message)))))\r
205 +       (notmuch-pick-show-message-in)))))\r
206  \r
207  (defun notmuch-pick-insert-tree (tree depth tree-status first last)\r
208    "Insert the message tree TREE at depth DEPTH in the current thread.\r
209 @@ -952,7 +942,6 @@ The arguments are:\r
210  (define-key notmuch-search-mode-map "Z" 'notmuch-pick-from-search-current-query)\r
211  (define-key notmuch-search-mode-map (kbd "M-RET") 'notmuch-pick-from-search-thread)\r
212  (define-key notmuch-show-mode-map "Z" 'notmuch-pick-from-show-current-query)\r
213 -(notmuch-pick-setup-show-out)\r
214  (message "Initialised notmuch-pick")\r
215  \r
216  (provide 'notmuch-pick)\r
217 -- \r
218 1.7.9.1\r
219 \r