changeset 106083:df266edf1b2b

(newsticker--treeview-list-update-faces): Preserve point in the list buffer. (Bug#4939) Use point-at-eol. (newsticker--treeview-list-update-highlight) (newsticker--treeview-tree-update-highlight): Use point-at-bol/eol.
author Glenn Morris <rgm@gnu.org>
date Tue, 17 Nov 2009 04:41:15 +0000
parents 2df31b09d293
children f03048d6d95a
files lisp/ChangeLog lisp/net/newst-treeview.el
diffstat 2 files changed, 34 insertions(+), 30 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Tue Nov 17 04:35:33 2009 +0000
+++ b/lisp/ChangeLog	Tue Nov 17 04:41:15 2009 +0000
@@ -2,6 +2,12 @@
 
 	* vc-svn.el (vc-svn-print-log): Fix typo in previous.
 
+	* net/newst-treeview.el (newsticker--treeview-list-update-faces):
+	Preserve point in the list buffer.  (Bug#4939)
+	Use point-at-eol.
+	(newsticker--treeview-list-update-highlight)
+	(newsticker--treeview-tree-update-highlight): Use point-at-bol/eol.
+
 2009-11-16  Jay Belanger  <jay.p.belanger@gmail.com>
 
 	* calc/calc-bin.el (math-symclip, calcFunc-symclip, calc-symclip):
--- a/lisp/net/newst-treeview.el	Tue Nov 17 04:35:33 2009 +0000
+++ b/lisp/net/newst-treeview.el	Tue Nov 17 04:41:15 2009 +0000
@@ -548,31 +548,32 @@
   "Update faces in the treeview list buffer."
   (let (pos-sel)
     (with-current-buffer (newsticker--treeview-list-buffer)
-      (let ((inhibit-read-only t))
-        (goto-char (point-min))
-        (while (not (eobp))
-          (let* ((pos (save-excursion (end-of-line) (point)))
-                 (item (get-text-property (point) :nt-item))
-                 (age (newsticker--age item))
-                 (selected (get-text-property (point) :nt-selected))
-                 (face (cond ((eq age 'new)
-                              'newsticker-treeview-new-face)
-                             ((eq age 'old)
-                              'newsticker-treeview-old-face)
-                             ((eq age 'immortal)
-                              'newsticker-treeview-immortal-face)
-                             ((eq age 'obsolete)
-                              'newsticker-treeview-obsolete-face)
-                             (t
-                              'bold))))
-            (put-text-property (point) pos 'face face)
-            (if selected
-                (move-overlay newsticker--selection-overlay (point)
-                              (1+ pos) ;include newline
-                              (current-buffer)))
-            (if selected (setq pos-sel (point)))
-            (forward-line 1)
-            (beginning-of-line))))) ;; FIXME!?
+      (save-excursion
+        (let ((inhibit-read-only t))
+          (goto-char (point-min))
+          (while (not (eobp))
+            (let* ((pos (point-at-eol))
+                   (item (get-text-property (point) :nt-item))
+                   (age (newsticker--age item))
+                   (selected (get-text-property (point) :nt-selected))
+                   (face (cond ((eq age 'new)
+                                'newsticker-treeview-new-face)
+                               ((eq age 'old)
+                                'newsticker-treeview-old-face)
+                               ((eq age 'immortal)
+                                'newsticker-treeview-immortal-face)
+                               ((eq age 'obsolete)
+                                'newsticker-treeview-obsolete-face)
+                               (t
+                                'bold))))
+              (put-text-property (point) pos 'face face)
+              (if selected
+                  (move-overlay newsticker--selection-overlay (point)
+                                (1+ pos) ;include newline
+                                (current-buffer)))
+              (if selected (setq pos-sel (point)))
+              (forward-line 1)
+              (beginning-of-line)))))) ;; FIXME!?
     (when pos-sel
       (if (window-live-p (newsticker--treeview-list-window))
           (set-window-point (newsticker--treeview-list-window) pos-sel)))))
@@ -590,9 +591,7 @@
     (let (pos num-lines)
       (with-current-buffer (newsticker--treeview-list-buffer)
         (let ((inhibit-read-only t))
-          (put-text-property (save-excursion (beginning-of-line) (point))
-                             (save-excursion (end-of-line) (point))
-                             :nt-selected t))
+          (put-text-property (point-at-bol) (point-at-eol) :nt-selected t))
         (newsticker--treeview-list-update-faces))))
 
 (defun newsticker--treeview-list-highlight-start ()
@@ -1039,8 +1038,7 @@
       (with-current-buffer (newsticker--treeview-tree-buffer)
         (goto-char pos)
         (move-overlay newsticker--tree-selection-overlay
-                      (save-excursion (beginning-of-line) (point))
-                      (save-excursion (end-of-line) (1+ (point)))
+                      (point-at-bol) (1+ (point-at-eol))
                       (current-buffer)))
       (if (window-live-p (newsticker--treeview-tree-window))
           (set-window-point (newsticker--treeview-tree-window) pos)))))