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 18B08431FB6
\r
6 for <notmuch@notmuchmail.org>; Tue, 24 May 2011 16:27:32 -0700 (PDT)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\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 qcEJF6Sh+M+9 for <notmuch@notmuchmail.org>;
\r
17 Tue, 24 May 2011 16:27:30 -0700 (PDT)
\r
18 Received: from mail-fx0-f53.google.com (mail-fx0-f53.google.com
\r
19 [209.85.161.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 D9DAA431FD0
\r
22 for <notmuch@notmuchmail.org>; Tue, 24 May 2011 16:27:29 -0700 (PDT)
\r
23 Received: by fxm8 with SMTP id 8so5375718fxm.26
\r
24 for <notmuch@notmuchmail.org>; Tue, 24 May 2011 16:27:28 -0700 (PDT)
\r
25 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;
\r
26 h=domainkey-signature:from:to:cc:subject:in-reply-to:references
\r
27 :user-agent:date:message-id:mime-version:content-type;
\r
28 bh=n8rt4SkIfFX77y8mj/vMo6+D3zpuqEpziGNcWarkNwA=;
\r
29 b=DGSkjXpXiuGaZBtPwW8KURLq+ta9ucWsbCmwmpERTXe+Sxjrto7o4UQfxvmtYQZxDH
\r
30 uWl+9W3M9liO2UwVIRpmKgEUP3WLGNTWPOaeN70/NNU9PzjuLE0jdR3o8e7KKPa8+BUD
\r
31 Pbqf4j4GppncGCEhkJnLoEAe8QPChYO4r2SbQ=
\r
32 DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma;
\r
33 h=from:to:cc:subject:in-reply-to:references:user-agent:date
\r
34 :message-id:mime-version:content-type;
\r
35 b=nNc/KtbhFlsal0CP56jfuNqcMr+Fj0rbloaYWtouwg8PxGmm6mEH2chkX/OhuF4sJN
\r
36 kiWFCa2qyjirR4+7NSJZEzX1/cS9vImugdF2uqzNrRxCEjxW+6f1btqxU04TvjxyZNrI
\r
37 2zVMhNgg2/PxPmb/PuJc+A1cGUpQOcTNGK+nE=
\r
38 Received: by 10.223.98.5 with SMTP id o5mr4298702fan.33.1306279648595;
\r
39 Tue, 24 May 2011 16:27:28 -0700 (PDT)
\r
40 Received: from localhost ([91.144.186.21])
\r
41 by mx.google.com with ESMTPS id o1sm925fah.4.2011.05.24.16.27.27
\r
42 (version=TLSv1/SSLv3 cipher=OTHER);
\r
43 Tue, 24 May 2011 16:27:28 -0700 (PDT)
\r
44 From: Dmitry Kurochkin <dmitry.kurochkin@gmail.com>
\r
45 To: Carl Worth <cworth@cworth.org>, Austin Clements <amdragon@mit.edu>
\r
46 Subject: Re: [PATCH] Save and restore point explicitly in
\r
47 `notmuch-wash-toggle-invisible-action'.
\r
48 In-Reply-To: <87d3j7bs8t.fsf@yoom.home.cworth.org>
\r
49 References: <1306090675-26982-1-git-send-email-dmitry.kurochkin@gmail.com>
\r
50 <1306164587-20326-1-git-send-email-dmitry.kurochkin@gmail.com>
\r
51 <87oc2rlujb.fsf@yoom.home.cworth.org> <8762ozrfrr.fsf@gmail.com>
\r
52 <87oc2rvjvj.fsf@yoom.home.cworth.org> <871uznrbh5.fsf@gmail.com>
\r
53 <BANLkTi=_PszwPDRbRxVpVhkT=YRAi5dGDQ@mail.gmail.com>
\r
54 <87d3j7bs8t.fsf@yoom.home.cworth.org>
\r
55 User-Agent: Notmuch/0.5-216-g0104e23 (http://notmuchmail.org) Emacs/23.3.1
\r
56 (x86_64-pc-linux-gnu)
\r
57 Date: Wed, 25 May 2011 03:27:51 +0400
\r
58 Message-ID: <87vcwzptl4.fsf@gmail.com>
\r
60 Content-Type: text/plain; charset=us-ascii
\r
61 Cc: notmuch@notmuchmail.org
\r
62 X-BeenThere: notmuch@notmuchmail.org
\r
63 X-Mailman-Version: 2.1.13
\r
65 List-Id: "Use and development of the notmuch mail system."
\r
66 <notmuch.notmuchmail.org>
\r
67 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
68 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
69 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
70 List-Post: <mailto:notmuch@notmuchmail.org>
\r
71 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
72 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
73 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
74 X-List-Received-Date: Tue, 24 May 2011 23:27:32 -0000
\r
76 On Tue, 24 May 2011 16:20:34 -0700, Carl Worth <cworth@cworth.org> wrote:
\r
77 > On Tue, 24 May 2011 18:43:41 -0400, Austin Clements <amdragon@mit.edu> wrote:
\r
78 > > Saving point this way is a bit dangerous, though. For example, if
\r
79 > > you're near the end of the buffer and shorten the label, attempting to
\r
80 > > restore the point could result in an error (or, a more benign example:
\r
81 > > the cursor could wind up outside the label so pressing RET repeatedly
\r
82 > > won't toggle it).
\r
84 > > Unfortunately, I don't know of a clean solution to this, but I think I
\r
85 > > would rather the cursor move, but stay within the label (probably
\r
86 > > moving to the beginning), than have problems like the above.
\r
88 > Here's my fix. Let me know what you think.
\r
91 (button-end cite-button) would move the point outside the button - to
\r
92 the next character after it.
\r
99 > From a32e02bf0d2b57d51695f7d4ea6cdda9acb21322 Mon Sep 17 00:00:00 2001
\r
100 > From: Carl Worth <cworth@cworth.org>
\r
101 > Date: Mon, 23 May 2011 19:29:46 +0400
\r
102 > Subject: [PATCH] Carefully preverse point when changing button text in
\r
103 > `notmuch-wash-toggle-invisible-action'.
\r
105 > Previously, save-excursion was used to attempt to save the point, but
\r
106 > this was unreliable since the region containing the marker saved by
\r
107 > save-excursion was deleted. Instead, we save an integer position
\r
108 > indicating the offset of point within the old button. Then, we restore
\r
109 > point to the same offset within the new button, (but cap the offset to
\r
110 > avoid leaving the button entirely).
\r
112 > emacs/notmuch-wash.el | 13 +++++++------
\r
113 > 1 files changed, 7 insertions(+), 6 deletions(-)
\r
115 > diff --git a/emacs/notmuch-wash.el b/emacs/notmuch-wash.el
\r
116 > index 8455eee..3dceb8b 100644
\r
117 > --- a/emacs/notmuch-wash.el
\r
118 > +++ b/emacs/notmuch-wash.el
\r
119 > @@ -82,13 +82,14 @@ collapse the remaining lines into a button.")
\r
120 > (let* ((new-start (button-start cite-button))
\r
121 > (overlay (button-get cite-button 'overlay))
\r
122 > (button-label (notmuch-wash-button-label overlay))
\r
123 > + (button-offset (- (point) new-start))
\r
124 > (inhibit-read-only t))
\r
125 > - (save-excursion
\r
126 > - (goto-char new-start)
\r
127 > - (insert button-label)
\r
128 > - (let ((old-end (button-end cite-button)))
\r
129 > - (move-overlay cite-button new-start (point))
\r
130 > - (delete-region (point) old-end))))
\r
131 > + (goto-char new-start)
\r
132 > + (insert button-label)
\r
133 > + (let ((old-end (button-end cite-button)))
\r
134 > + (move-overlay cite-button new-start (point))
\r
135 > + (delete-region (point) old-end))
\r
136 > + (goto-char (min (button-end cite-button) (+ new-start button-offset))))
\r
137 > (force-window-update)
\r
143 Non-text part: application/pgp-signature
\r