]> git.notmuchmail.org Git - notmuch/blobdiff - emacs/notmuch-wash.el
Carefully manage save/restore of point in `notmuch-wash-toggle-invisible-action'.
[notmuch] / emacs / notmuch-wash.el
index 8455eee0998f05e6e22bd2b81ee050cdcc29f698..e8134bf77c5002d16b590ad00590c3d915006232 100644 (file)
@@ -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 (min old-point (1- (button-end cite-button)))))
   (force-window-update)
   (redisplay t))