[gnus git] branch master updated: =1= Ensure that point stays at the "same place" even if point is on the line being replaced.

Lars Magne Ingebrigtsen <[email protected]>
Newsgroups gmane.emacs.gnus.cvs
Message-ID <[email protected]>
       via  ab577a732d12f8d80ea12ae7d60b62fc451334c0 (commit)
      from  b45aca7c770b410e86cdd2840abd31bdb56620a4 (commit)


- Log -----------------------------------------------------------------
commit ab577a732d12f8d80ea12ae7d60b62fc451334c0
Author: Lars Magne Ingebrigtsen <[email protected]>
Date:   Thu Jan 27 15:04:14 2011 -0800

    Ensure that point stays at the "same place" even if point is on the line being replaced.

diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 37fe099..9842acd 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,8 @@
+2011-01-27  Lars Ingebrigtsen  <[email protected]>
+
+	* gnus-art.el (article-update-date-lapsed): Ensure that point stays at
+	the "same place" even if point is on the line being replaced.
+
 2011-01-27  Julien Danjou  <[email protected]>
 
 	* mml2015.el (mml2015-epg-sign): Add and use mml2015-sign-with-sender.
diff --git a/lisp/gnus-art.el b/lisp/gnus-art.el
index 327250e..c72c2fe 100644
--- a/lisp/gnus-art.el
+++ b/lisp/gnus-art.el
@@ -3674,19 +3674,27 @@ function and want to see what the date was before converting."
   "Function to be run from a timer to update the lapsed time line."
   (save-match-data
     (let (deactivate-mark)
-      (save-excursion
+      (save-window-excursion
 	(ignore-errors
 	 (walk-windows
 	  (lambda (w)
 	    (set-buffer (window-buffer w))
 	    (when (eq major-mode 'gnus-article-mode)
-	      (let ((mark (point-marker)))
+	      (let ((mark (point-marker))
+		    (old-point (point)))
 		(goto-char (point-min))
 		(when (re-search-forward "^X-Sent:\\|^Date:" nil t)
+		  ;; If the point is on the Date line, then use that
+		  ;; absolute position.  Otherwise, use the mark.
+		  ;; This will ensure that point stays at the "same
+		  ;; place".
+		  (when (or (< old-point (match-beginning 0))
+			    (> old-point (line-end-position)))
+		    (setq old-point nil))
 		  (if gnus-treat-date-combined-lapsed
 		      (article-date-combined-lapsed t)
 		    (article-date-lapsed t)))
-		(goto-char (marker-position mark))
+		(goto-char (or old-point (marker-position mark)))
 		(move-marker mark nil))))
 	  nil 'visible))))))
 

-----------------------------------------------------------------------
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we listed those
revisions in full, above.

Summary of changes:
 lisp/ChangeLog   |    5 +++++
 lisp/gnus-art.el |   14 +++++++++++---
 2 files changed, 16 insertions(+), 3 deletions(-)

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Gnus Project".

The branch, master has been updated


hooks/post-receive
-- 
Gnus Project
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.