[PATCH] Save and restore point explicitly in `notmuch-wash-toggle-invisible-action'.

Dmitry Kurochkin dmitry.kurochkin at gmail.com
Mon May 23 08:29:46 PDT 2011


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



More information about the notmuch mailing list