Re: [PATCH] emacs: wash: make word-wrap bound message width
[notmuch-archives.git] / 9a / b947381863bdb8600583d8bc444ba80729898f
1 Return-Path: <amdragon@mit.edu>\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 672DA431FDA\r
6         for <notmuch@notmuchmail.org>; Tue,  3 Sep 2013 14:45:52 -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.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 yTAopbGEJZ1b for <notmuch@notmuchmail.org>;\r
16         Tue,  3 Sep 2013 14:45:44 -0700 (PDT)\r
17 Received: from dmz-mailsec-scanner-6.mit.edu (dmz-mailsec-scanner-6.mit.edu\r
18         [18.7.68.35])\r
19         by olra.theworths.org (Postfix) with ESMTP id 891E3431FDD\r
20         for <notmuch@notmuchmail.org>; Tue,  3 Sep 2013 14:45:33 -0700 (PDT)\r
21 X-AuditID: 12074423-b7f168e00000095a-8e-5226587c2075\r
22 Received: from mailhub-auth-4.mit.edu ( [18.7.62.39])\r
23         by dmz-mailsec-scanner-6.mit.edu (Symantec Messaging Gateway) with SMTP\r
24         id 92.0E.02394.C7856225; Tue,  3 Sep 2013 17:45:32 -0400 (EDT)\r
25 Received: from outgoing.mit.edu (outgoing-auth-1.mit.edu [18.9.28.11])\r
26         by mailhub-auth-4.mit.edu (8.13.8/8.9.2) with ESMTP id r83LjUoU025405; \r
27         Tue, 3 Sep 2013 17:45:31 -0400\r
28 Received: from drake.dyndns.org (26-4-182.dynamic.csail.mit.edu [18.26.4.182])\r
29         (authenticated bits=0)\r
30         (User authenticated as amdragon@ATHENA.MIT.EDU)\r
31         by outgoing.mit.edu (8.13.8/8.12.4) with ESMTP id r83LjRUv026853\r
32         (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT);\r
33         Tue, 3 Sep 2013 17:45:28 -0400\r
34 Received: from amthrax by drake.dyndns.org with local (Exim 4.77)\r
35         (envelope-from <amdragon@mit.edu>)\r
36         id 1VGyPe-0004xm-Rn; Tue, 03 Sep 2013 17:45:26 -0400\r
37 From: Austin Clements <amdragon@MIT.EDU>\r
38 To: notmuch@notmuchmail.org\r
39 Subject: [PATCH v2 0/9] emacs: Unify common key bindings and lots more\r
40 Date: Tue,  3 Sep 2013 17:45:16 -0400\r
41 Message-Id: <1378244725-18846-1-git-send-email-amdragon@mit.edu>\r
42 X-Mailer: git-send-email 1.7.10.4\r
43 X-Brightmail-Tracker:\r
44  H4sIAAAAAAAAA+NgFlrDIsWRmVeSWpSXmKPExsUixG6nrlsToRZk0P2cw6JpurPF6rk8Ftdv\r
45         zmR2YPbYOesuu8et+6/ZPZ6tusUcwBzFZZOSmpNZllqkb5fAlXFw8wnmgi7xii9TNRsY7wh1\r
46         MXJySAiYSFxtXswIYYtJXLi3nq2LkYtDSGAfo8TG58dYIJwNjBKXlvaxQjiHmSSmHXgJlZnL\r
47         KPGw7RoTSD+bgIbEtv3LwWaJCEhL7Lw7mxXEZhbQk9jycDOQzcEhLOAm0bahDCTMIqAq8aJx\r
48         Flgrr4CDRPu3fywQZyhKdD+bwDaBkXcBI8MqRtmU3Crd3MTMnOLUZN3i5MS8vNQiXTO93MwS\r
49         vdSU0k2M4EBxUd7B+Oeg0iFGAQ5GJR5ehkeqQUKsiWXFlbmHGCU5mJREeY+EqgUJ8SXlp1Rm\r
50         JBZnxBeV5qQWH2KU4GBWEuFN8AHK8aYkVlalFuXDpKQ5WJTEeZ89PRsoJJCeWJKanZpakFoE\r
51         k5Xh4FCS4C0PB2oULEpNT61Iy8wpQUgzcXCCDOcBGr4GpIa3uCAxtzgzHSJ/ilFRSpw3HSQh\r
52         AJLIKM2D64VF8itGcaBXhHl7QKp4gEkArvsV0GAmoMFpn1VBBpckIqSkGhhbBFh96yYavBFe\r
53         d+Ua27yWtRK3pabmvVlwSrncw/nOWdmGv+d79xhOkKt853zn1Jr0a7EfDndILGRcX/zzSpj5\r
54         updSDYdfp4a87M7Y8d3Lndf7n+Cre+lPGwP8Lu01zNgwaXe8abKVr4Nm0cveF5b9VzkOCTsK\r
55         MS1Ssf3g/2KbXF7dL0mOydFKLMUZiYZazEXFiQAgHo8EvwIAAA==\r
56 X-BeenThere: notmuch@notmuchmail.org\r
57 X-Mailman-Version: 2.1.13\r
58 Precedence: list\r
59 List-Id: "Use and development of the notmuch mail system."\r
60         <notmuch.notmuchmail.org>\r
61 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
62         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
63 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
64 List-Post: <mailto:notmuch@notmuchmail.org>\r
65 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
66 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
67         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
68 X-List-Received-Date: Tue, 03 Sep 2013 21:45:52 -0000\r
69 \r
70 This is v2 of id:1377793557-28878-1-git-send-email-amdragon@mit.edu.\r
71 This fixes a problem found by Jani where notmuch-hello would reset\r
72 point placement when refreshing in Emacs 24.  It also inverts the\r
73 sense of notmuch-hello-auto-refresh and makes it a defcustom\r
74 (originally I'd intended notmuch-hello-inhibit-auto-refresh for\r
75 internal use only, but both Mark and Jani expressed interest in\r
76 setting it).\r
77 \r
78 The diff from v1 follows\r
79 \r
80 diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el\r
81 index 1d6c3a2..55c416a 100644\r
82 --- a/emacs/notmuch-hello.el\r
83 +++ b/emacs/notmuch-hello.el\r
84 @@ -232,6 +232,11 @@ supported for \"Customized queries section\" items."\r
85             notmuch-hello-query-section\r
86             (function :tag "Custom section"))))\r
87  \r
88 +(defcustom notmuch-hello-auto-refresh t\r
89 +  "Automatically refresh when returning to the notmuch-hello buffer."\r
90 +  :group 'notmuch-hello\r
91 +  :type 'boolean)\r
92 +\r
93  (defvar notmuch-hello-hidden-sections nil\r
94    "List of sections titles whose contents are hidden")\r
95  \r
96 @@ -478,9 +483,6 @@ Such a list can be computed with `notmuch-hello-query-counts'."\r
97    ;; Lazy - rebuild everything.\r
98    (notmuch-hello no-display))\r
99  \r
100 -(defvar notmuch-hello-inhibit-auto-refresh nil\r
101 -  "Don't refresh notmuch-hello on window configuration changes.")\r
102 -\r
103  (defun notmuch-hello-window-configuration-change ()\r
104    "Hook function to update the hello buffer when it is switched to."\r
105    (let ((hello-buf (get-buffer "*notmuch-hello*"))\r
106 @@ -501,8 +503,11 @@ Such a list can be computed with `notmuch-hello-query-counts'."\r
107             ;; is currently visible, was not visible on the last\r
108             ;; configuration change, and this is not a new window)\r
109             (setq do-refresh t)))))\r
110 -    (when (and do-refresh (not notmuch-hello-inhibit-auto-refresh))\r
111 -      (notmuch-hello t))\r
112 +    (when (and do-refresh notmuch-hello-auto-refresh)\r
113 +      ;; Refresh hello as soon as we get back to redisplay.  On Emacs\r
114 +      ;; 24, we can't do it right here because something in this\r
115 +      ;; hook's call stack overrides hello's point placement.\r
116 +      (run-at-time nil nil #'notmuch-hello t))\r
117      (when (null hello-buf)\r
118        ;; Clean up hook\r
119        (remove-hook 'window-configuration-change-hook\r
120 @@ -785,14 +790,15 @@ following:\r
121  \r
122    ;; This may cause a window configuration change, so if the\r
123    ;; auto-refresh hook is already installed, avoid recursive refresh.\r
124 -  (let ((notmuch-hello-inhibit-auto-refresh t))\r
125 +  (let ((notmuch-hello-auto-refresh nil))\r
126      (if no-display\r
127         (set-buffer "*notmuch-hello*")\r
128        (switch-to-buffer "*notmuch-hello*")))\r
129  \r
130    ;; Install auto-refresh hook\r
131 -  (add-hook 'window-configuration-change-hook\r
132 -           #'notmuch-hello-window-configuration-change)\r
133 +  (when notmuch-hello-auto-refresh\r
134 +    (add-hook 'window-configuration-change-hook\r
135 +             #'notmuch-hello-window-configuration-change))\r
136  \r
137    (let ((target-line (line-number-at-pos))\r
138         (target-column (current-column))\r
139 \r