Return-Path: X-Original-To: notmuch@notmuchmail.org Delivered-To: notmuch@notmuchmail.org Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id CAE59429E25 for ; Mon, 23 May 2011 08:29:47 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -0.799 X-Spam-Level: X-Spam-Status: No, score=-0.799 tagged_above=-999 required=5 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Xu5YgacyxH18 for ; Mon, 23 May 2011 08:29:47 -0700 (PDT) Received: from mail-fx0-f53.google.com (mail-fx0-f53.google.com [209.85.161.53]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id 40338431FB6 for ; Mon, 23 May 2011 08:29:47 -0700 (PDT) Received: by fxm8 with SMTP id 8so4335597fxm.26 for ; Mon, 23 May 2011 08:29:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:from:to:cc:subject:date:message-id:x-mailer :in-reply-to:references; bh=mn/UCAlrRmeq0ow4hsKnw1kF6gjUy/fIFuKwpHuVL2A=; b=EgFSsZvYpgYrMTjPV9z5XoxKFm+AQA3/gWtM5vZbTgNU8ChcAKdyrrImU0KfUaz/fX KshLAAZ4naRpQborMvFH5yotIo/G7SDlRDdNXqfZQNd8bq1L4EOzPiGMq7QKGMBuBRXw 9zKTQzGW6YL6Hh5b44ibyZbFmjepUiBnCtwX4= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; b=jk86nTwElELcmyFCT/aTk/TTSG80UUzqzG4+03ZdokWZsNA9sGy73PP0Wsm4FOwI85 pSZRIXVS00VPFzY8uqx22EeDEdHhp+JGamQDLkSxOxGXONZBG1BQywmOipQeyB44rXed AC1J2DPQX+OW3VJ3N6pksOqOt7lGDXgrzGm7c= Received: by 10.223.14.139 with SMTP id g11mr2544421faa.103.1306164585668; Mon, 23 May 2011 08:29:45 -0700 (PDT) Received: from localhost ([91.144.186.21]) by mx.google.com with ESMTPS id f14sm2395995fai.41.2011.05.23.08.29.44 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 23 May 2011 08:29:44 -0700 (PDT) From: Dmitry Kurochkin To: notmuch@notmuchmail.org Subject: [PATCH] Save and restore point explicitly in `notmuch-wash-toggle-invisible-action'. Date: Mon, 23 May 2011 19:29:46 +0400 Message-Id: <1306164587-20326-1-git-send-email-dmitry.kurochkin@gmail.com> X-Mailer: git-send-email 1.7.5.1 In-Reply-To: <1306090675-26982-1-git-send-email-dmitry.kurochkin@gmail.com> References: <1306090675-26982-1-git-send-email-dmitry.kurochkin@gmail.com> X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 May 2011 15:29:48 -0000 Before the change, save-excursion was used to save the point. But the restored position is affected by buffer modifications, which results in jumping cursor. The patch saves and restores point explicitly by using a variable instead of save-excursion. --- emacs/notmuch-wash.el | 13 +++++++------ 1 files changed, 7 insertions(+), 6 deletions(-) diff --git a/emacs/notmuch-wash.el b/emacs/notmuch-wash.el index 863459e..b6d791f 100644 --- a/emacs/notmuch-wash.el +++ b/emacs/notmuch-wash.el @@ -82,13 +82,14 @@ collapse the remaining lines into a button.") (let* ((new-start (button-start cite-button)) (overlay (button-get cite-button 'overlay)) (button-label (notmuch-wash-button-label overlay)) + (old-point (point)) (inhibit-read-only t)) - (save-excursion - (goto-char new-start) - (insert button-label) - (let ((old-end (button-end cite-button))) - (move-overlay cite-button new-start (point)) - (delete-region (point) old-end)))) + (goto-char new-start) + (insert button-label) + (let ((old-end (button-end cite-button))) + (move-overlay cite-button new-start (point)) + (delete-region (point) old-end)) + (goto-char old-point)) (force-window-update) (redisplay t)) -- 1.7.5.1