Re: [PATCH] emacs: wash: make word-wrap bound message width
[notmuch-archives.git] / a2 / 6c24e6821c62623be65face362c8ee30f08733
1 Return-Path: <dmitry.kurochkin@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 E57FA421189\r
6         for <notmuch@notmuchmail.org>; Tue, 28 Jun 2011 18:49:08 -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.799\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-0.799 tagged_above=-999 required=5\r
12         tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,\r
13         FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
14 Received: from olra.theworths.org ([127.0.0.1])\r
15         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
16         with ESMTP id Ig0hKTaHgc+o for <notmuch@notmuchmail.org>;\r
17         Tue, 28 Jun 2011 18:49:07 -0700 (PDT)\r
18 Received: from mail-bw0-f53.google.com (mail-bw0-f53.google.com\r
19         [209.85.214.53]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
20         (No client certificate requested)\r
21         by olra.theworths.org (Postfix) with ESMTPS id 9D35442116B\r
22         for <notmuch@notmuchmail.org>; Tue, 28 Jun 2011 18:49:04 -0700 (PDT)\r
23 Received: by mail-bw0-f53.google.com with SMTP id 12so712327bwg.26\r
24         for <notmuch@notmuchmail.org>; Tue, 28 Jun 2011 18:49:04 -0700 (PDT)\r
25 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;\r
26         h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references;\r
27         bh=zrHA+ifthfgHP+Ej3ABOoqO+3pgC7SAtL5YSWWNUxmo=;\r
28         b=B4bi/OEhDJy0tprJKWfE7LQR71WJbJqASVXjZBRE73C2LwXadtQJjAfev+N7IJVCgK\r
29         htzwGEF5Yg3g9ZcC+Ez0MqFAW1gtT2lpIJAIxmUZkR0B/MDGgARn9yENE+75z1X9JJsd\r
30         vhWc76bLCbH71dSZip+uqbOoHXBMmwNCn7VfE=\r
31 Received: by 10.204.233.14 with SMTP id jw14mr197991bkb.40.1309312144295;\r
32         Tue, 28 Jun 2011 18:49:04 -0700 (PDT)\r
33 Received: from localhost ([91.144.186.21])\r
34         by mx.google.com with ESMTPS id l24sm693494bkw.3.2011.06.28.18.49.02\r
35         (version=TLSv1/SSLv3 cipher=OTHER);\r
36         Tue, 28 Jun 2011 18:49:03 -0700 (PDT)\r
37 From: Dmitry Kurochkin <dmitry.kurochkin@gmail.com>\r
38 To: notmuch@notmuchmail.org\r
39 Subject: [PATCH 2/3] emacs: improve hidden signatures handling in\r
40         notmuch-show-advance-and-archive\r
41 Date: Wed, 29 Jun 2011 05:48:51 +0400\r
42 Message-Id: <1309312132-14564-2-git-send-email-dmitry.kurochkin@gmail.com>\r
43 X-Mailer: git-send-email 1.7.5.4\r
44 In-Reply-To: <1309312132-14564-1-git-send-email-dmitry.kurochkin@gmail.com>\r
45 References: <1309312132-14564-1-git-send-email-dmitry.kurochkin@gmail.com>\r
46 X-BeenThere: notmuch@notmuchmail.org\r
47 X-Mailman-Version: 2.1.13\r
48 Precedence: list\r
49 List-Id: "Use and development of the notmuch mail system."\r
50         <notmuch.notmuchmail.org>\r
51 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
52         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
53 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
54 List-Post: <mailto:notmuch@notmuchmail.org>\r
55 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
56 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
57         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
58 X-List-Received-Date: Wed, 29 Jun 2011 01:49:09 -0000\r
59 \r
60 Use `previous-single-char-property-change' instead of going\r
61 through each character by hand and testing it's visibility.  This\r
62 fixes `notmuch-show-advance-and-archive' to work for the last\r
63 message in thread with hidden signature.\r
64 ---\r
65  emacs/notmuch-show.el |   17 +++++++++--------\r
66  1 files changed, 9 insertions(+), 8 deletions(-)\r
67 \r
68 diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el\r
69 index 6685717..ad3cc7b 100644\r
70 --- a/emacs/notmuch-show.el\r
71 +++ b/emacs/notmuch-show.el\r
72 @@ -1113,17 +1113,18 @@ thread, (remove the \"inbox\" tag from each message). Also kill\r
73  this buffer, and display the next thread from the search from\r
74  which this thread was originally shown."\r
75    (interactive)\r
76 -  (let ((end-of-this-message (notmuch-show-message-bottom)))\r
77 +  (let* ((end-of-this-message (notmuch-show-message-bottom))\r
78 +        (visible-end-of-this-message (1- end-of-this-message)))\r
79 +    (while (invisible-p visible-end-of-this-message)\r
80 +      (setq visible-end-of-this-message\r
81 +           (previous-single-char-property-change visible-end-of-this-message\r
82 +                                                 'invisible)))\r
83      (cond\r
84       ;; Ideally we would test `end-of-this-message' against the result\r
85       ;; of `window-end', but that doesn't account for the fact that\r
86 -     ;; the end of the message might be hidden, so we have to actually\r
87 -     ;; go to the end, walk back over invisible text and then see if\r
88 -     ;; point is visible.\r
89 -     ((save-excursion\r
90 -       (goto-char (- end-of-this-message 1))\r
91 -       (notmuch-show-move-past-invisible-backward)\r
92 -       (> (point) (window-end)))\r
93 +     ;; the end of the message might be hidden.\r
94 +     ((and visible-end-of-this-message\r
95 +          (> visible-end-of-this-message (window-end)))\r
96        ;; The bottom of this message is not visible - scroll.\r
97        (scroll-up nil))\r
98  \r
99 -- \r
100 1.7.5.4\r
101 \r