Try to avoid having point move around by not using save-window-excursion.
authorLars Magne Ingebrigtsen <larsi@gnus.org>
Mon, 31 Jan 2011 04:21:20 +0000 (20:21 -0800)
committerLars Magne Ingebrigtsen <larsi@gnus.org>
Mon, 31 Jan 2011 04:21:20 +0000 (20:21 -0800)
It seems to work...

lisp/ChangeLog
lisp/gnus-art.el

index 3d3f79f..aea00e8 100644 (file)
@@ -1,3 +1,8 @@
+2011-01-31  Lars Ingebrigtsen  <larsi@gnus.org>
+
+       * gnus-art.el (article-update-date-lapsed): Try to avoid having point
+       move around by not using save-window-excursion.  It seems to work...
+
 2011-01-31  Katsumi Yamaoka  <yamaoka@jpl.org>
 
        * gnus-art.el (article-make-date-line): Work for user-defined format.
index 71e9e18..0fdd6bd 100644 (file)
@@ -3646,31 +3646,31 @@ function and want to see what the date was before converting."
 (defun article-update-date-lapsed ()
   "Function to be run from a timer to update the lapsed time line."
   (save-match-data
-    (let (deactivate-mark)
-      (save-window-excursion
-       (ignore-errors
-        (walk-windows
-         (lambda (w)
-           (set-buffer (window-buffer w))
-           (when (eq major-mode 'gnus-article-mode)
-             (let ((old-line (count-lines (point-min) (point)))
-                   (old-column (current-column)))
-               (goto-char (point-min))
-               (while (re-search-forward "^Date:" nil t)
-                 (let ((type (get-text-property (match-beginning 0) 'gnus-date-type)))
-                   (when (memq type '(lapsed combined-lapsed user-format))
-                     (save-excursion
-                       (article-date-ut type t (match-beginning 0)))
-                     (forward-line 1))))
-               (goto-char (point-min))
-               (when (> old-column 0)
-                 (setq old-line (1- old-line)))
-               (forward-line old-line)
-               (end-of-line)
-               (when (> (current-column) old-column)
-                 (beginning-of-line)
-                 (forward-char old-column)))))
-         nil 'visible))))))
+    (let ((buffer (current-buffer)))
+      (ignore-errors
+       (walk-windows
+        (lambda (w)
+          (set-buffer (window-buffer w))
+          (when (eq major-mode 'gnus-article-mode)
+            (let ((old-line (count-lines (point-min) (point)))
+                  (old-column (current-column)))
+              (goto-char (point-min))
+              (while (re-search-forward "^Date:" nil t)
+                (let ((type (get-text-property (match-beginning 0) 'gnus-date-type)))
+                  (when (memq type '(lapsed combined-lapsed user-format))
+                    (save-excursion
+                      (article-date-ut type t (match-beginning 0)))
+                    (forward-line 1))))
+              (goto-char (point-min))
+              (when (> old-column 0)
+                (setq old-line (1- old-line)))
+              (forward-line old-line)
+              (end-of-line)
+              (when (> (current-column) old-column)
+                (beginning-of-line)
+                (forward-char old-column)))))
+        nil 'visible))
+      (set-buffer buffer))))
 
 (defun gnus-start-date-timer (&optional n)
   "Start a timer to update the Date headers in the article buffers.