Re: Error with contrib/notmuch-pick
[notmuch-archives.git] / 7a / cd723a6c3689c45fdb63cddecefca16f76e819
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 54628429E26\r
6         for <notmuch@notmuchmail.org>; Tue, 24 May 2011 13:43:00 -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 WXDkfDUyErvb for <notmuch@notmuchmail.org>;\r
17         Tue, 24 May 2011 13:42:59 -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 896BD431FB6\r
22         for <notmuch@notmuchmail.org>; Tue, 24 May 2011 13:42:59 -0700 (PDT)\r
23 Received: by fxm8 with SMTP id 8so5300738fxm.26\r
24         for <notmuch@notmuchmail.org>; Tue, 24 May 2011 13:42:58 -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:subject:in-reply-to:references\r
27         :user-agent:date:message-id:mime-version:content-type;\r
28         bh=R5AAhaTUwY28OJfNclZ6kyektfQw+fWlyzbP945VCFY=;\r
29         b=iQQZY8g+bV0tmWVw+yawGC+YT0DXoTF6yRssMVEoOZoRIthUgGQCWREhitgyIpGapx\r
30         ut8/NS7iQpa40oJD/Wz/zAqI7ciFVsooujc277GQwFPlL2Hy/lJD8e8zJHig+aeLrRMF\r
31         7C9y/iDVfS4jdwyH+yAlWMNChi0JRa75CBBkw=\r
32 DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma;\r
33         h=from:to:subject:in-reply-to:references:user-agent:date:message-id\r
34         :mime-version:content-type;\r
35         b=gEzfVKvqp392lAmUImBOtTPMZeNCeHs0WHtG/qtKkuqAcnNjSH9y6T+Ft96QTX08+Q\r
36         t7DL8Ghwr5nTu2HnbcQkxvDK5V69wh4TGkdP4jQjeao0sII+i5vnAu72UHPZhamh9beh\r
37         z+7e8oCGTiAGKe/PlO1lP5sN6a1ouhyQ2SoCU=\r
38 Received: by 10.223.145.24 with SMTP id b24mr4191071fav.10.1306269778116;\r
39         Tue, 24 May 2011 13:42:58 -0700 (PDT)\r
40 Received: from localhost ([91.144.186.21])\r
41         by mx.google.com with ESMTPS id t15sm2859623fau.24.2011.05.24.13.42.56\r
42         (version=TLSv1/SSLv3 cipher=OTHER);\r
43         Tue, 24 May 2011 13:42:56 -0700 (PDT)\r
44 From: Dmitry Kurochkin <dmitry.kurochkin@gmail.com>\r
45 To: Carl Worth <cworth@cworth.org>, notmuch@notmuchmail.org\r
46 Subject: Re: [PATCH] Save and restore point explicitly in\r
47         `notmuch-wash-toggle-invisible-action'.\r
48 In-Reply-To: <87oc2rlujb.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>\r
52 User-Agent: Notmuch/0.5-216-g0104e23 (http://notmuchmail.org) Emacs/23.3.1\r
53         (x86_64-pc-linux-gnu)\r
54 Date: Wed, 25 May 2011 00:43:20 +0400\r
55 Message-ID: <8762ozrfrr.fsf@gmail.com>\r
56 MIME-Version: 1.0\r
57 Content-Type: text/plain; charset=us-ascii\r
58 X-BeenThere: notmuch@notmuchmail.org\r
59 X-Mailman-Version: 2.1.13\r
60 Precedence: list\r
61 List-Id: "Use and development of the notmuch mail system."\r
62         <notmuch.notmuchmail.org>\r
63 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
64         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
65 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
66 List-Post: <mailto:notmuch@notmuchmail.org>\r
67 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
68 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
69         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
70 X-List-Received-Date: Tue, 24 May 2011 20:43:00 -0000\r
71 \r
72 Hi Carl.\r
73 \r
74 On Tue, 24 May 2011 13:20:56 -0700, Carl Worth <cworth@cworth.org> wrote:\r
75 > On Mon, 23 May 2011 19:29:46 +0400, Dmitry Kurochkin <dmitry.kurochkin@gmail.com> wrote:\r
76 > > Before the change, save-excursion was used to save the point.\r
77 > > But the restored position is affected by buffer modifications,\r
78 > > which results in jumping cursor.  The patch saves and restores\r
79 > > point explicitly by using a variable instead of save-excursion.\r
80\r
81 > Dmitry,\r
82\r
83 > Thanks so much for the improvement to the button text! This will be a\r
84 > nice thing to add.\r
85\r
86 > But this patch confuses me. I can understand how a buffer-position\r
87 > variable can cause the cursor to jump. That's usually the kind of thing\r
88 > that can be fixed by switching from an integer position to a marker\r
89 > instead, (since markers are updated when the corresponding text is\r
90 > updated).\r
91\r
92 \r
93 So we need to switch from marker to an integer position, right?\r
94 \r
95 > But in this case, I don't see how:\r
96\r
97 >       (let ((old-point (point)))\r
98 >               ... code here ...\r
99 >         (goto-char old-point))\r
100\r
101 > is distinct from:\r
102\r
103 >       (save-excursion\r
104 >               ... code here ...\r
105 >        )\r
106\r
107 > except that save-excursion actually does the right thing in the case of\r
108 > abnormal exit (throw or error).\r
109\r
110 > Can you help me understand what I'm missing here?\r
111\r
112 \r
113 Unfortunately, I am not an Emacs lisp expert.  I just noticed that the\r
114 cursor jumps and did the first thing that came to mind.  And it worked.\r
115 \r
116 Now, looking at Emacs source code, save_excursion_save() uses\r
117 point_marker() to save the point.  As you said above, markers are\r
118 updated when the corresponding text is updated.  That explains why the\r
119 cursor jumps when using `save-excursion'.\r
120 \r
121 On the other hand, `point' returns position as an integer.  Which is\r
122 just what we need.\r
123 \r
124 Regards,\r
125   Dmitry\r
126 \r
127 > -Carl\r
128\r
129 > -- \r
130 > carl.d.worth@intel.com\r
131 Non-text part: application/pgp-signature\r