Commit a8c98868 authored by Ulf Jasper's avatar Ulf Jasper

newsticker: fixed bug#1569

parent 537ab246
2009-01-19 Ulf Jasper <ulf.jasper@web.de>
* net/newst-treeview.el
(newsticker-treeview-next-new-or-immortal-item): New optional arg
current-item-counts. Move to next feed if necessary. (Bug#1569)
(newsticker-treeview-prev-new-or-immortal-item): Move to previous
feed if necessary. (Bug#1569)
(newsticker-treeview-next-feed)
(newsticker-treeview-prev-feed): New optional arg
stay-in-tree. Don't activate node nil. (Bug#1569)
2009-01-22 Adrian Robert <Adrian.B.Robert@gmail.com> 2009-01-22 Adrian Robert <Adrian.B.Robert@gmail.com>
* term/ns-win.el (ns-show-manual): Fix node name. * term/ns-win.el (ns-show-manual): Fix node name.
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
;; URL: http://www.nongnu.org/newsticker ;; URL: http://www.nongnu.org/newsticker
;; Created: 2007 ;; Created: 2007
;; Keywords: News, RSS, Atom ;; Keywords: News, RSS, Atom
;; Time-stamp: "18. Dezember 2008, 11:26:54 (ulf)" ;; Time-stamp: "22. Januar 2009, 20:41:31 (ulf)"
;; ====================================================================== ;; ======================================================================
...@@ -1313,42 +1313,57 @@ Note: does not update the layout." ...@@ -1313,42 +1313,57 @@ Note: does not update the layout."
(forward-line -1)) (forward-line -1))
(newsticker-treeview-show-item)) (newsticker-treeview-show-item))
(defun newsticker-treeview-next-new-or-immortal-item () (defun newsticker-treeview-next-new-or-immortal-item (&optional
"Move to next new or immortal item." current-item-counts)
"Move to next new or immortal item.
Will move to next feed until an item is found. Will not move if
optional argument CURRENT-ITEM-COUNTS is t and current item is
new or immortal."
(interactive) (interactive)
(newsticker--treeview-restore-layout) (newsticker--treeview-restore-layout)
(newsticker--treeview-list-clear-highlight) (newsticker--treeview-list-clear-highlight)
(catch 'found (unless (catch 'found
(let ((index (newsticker-treeview-next-item))) (let ((move (not current-item-counts)))
(while t (while t
(save-current-buffer (save-current-buffer
(set-buffer (newsticker--treeview-list-buffer)) (set-buffer (newsticker--treeview-list-buffer))
(forward-line 1) (when move (forward-line 1)
(when (eobp) (when (eobp)
(forward-line -1) (forward-line -1)
(throw 'found nil))) (throw 'found nil))))
(when (memq (newsticker--age (when (memq (newsticker--age
(newsticker--treeview-get-selected-item)) '(new immortal)) (newsticker--treeview-get-selected-item))
(newsticker-treeview-show-item) '(new immortal))
(throw 'found t)))))) (newsticker-treeview-show-item)
(throw 'found t))
(setq move t))))
(when (newsticker-treeview-next-feed t)
(newsticker-treeview-next-new-or-immortal-item t))))
(defun newsticker-treeview-prev-new-or-immortal-item () (defun newsticker-treeview-prev-new-or-immortal-item ()
"Move to previous new or immortal item." "Move to previous new or immortal item.
Will move to previous feed until an item is found."
(interactive) (interactive)
(newsticker--treeview-restore-layout) (newsticker--treeview-restore-layout)
(newsticker--treeview-list-clear-highlight) (newsticker--treeview-list-clear-highlight)
(catch 'found (unless (catch 'found
(let ((index (newsticker-treeview-next-item))) (while t
(while t (save-current-buffer
(save-current-buffer (set-buffer (newsticker--treeview-list-buffer))
(set-buffer (newsticker--treeview-list-buffer)) (when (bobp)
(forward-line -1) (throw 'found nil))
(when (bobp) (forward-line -1))
(throw 'found nil))) (when (memq (newsticker--age
(when (memq (newsticker--age (newsticker--treeview-get-selected-item))
(newsticker--treeview-get-selected-item)) '(new immortal)) '(new immortal))
(newsticker-treeview-show-item) (newsticker-treeview-show-item)
(throw 'found t)))))) (throw 'found t))
(when (bobp)
(throw 'found nil))))
(when (newsticker-treeview-prev-feed t)
(set-buffer (newsticker--treeview-list-buffer))
(goto-char (point-max))
(newsticker-treeview-prev-new-or-immortal-item))))
(defun newsticker--treeview-get-selected-item () (defun newsticker--treeview-get-selected-item ()
"Return item that is currently selected in list buffer." "Return item that is currently selected in list buffer."
...@@ -1527,38 +1542,62 @@ is activated." ...@@ -1527,38 +1542,62 @@ is activated."
(node (node
(widget-apply-action node))))) (widget-apply-action node)))))
(defun newsticker-treeview-next-feed () (defun newsticker-treeview-next-feed (&optional stay-in-tree)
"Move to next feed." "Move to next feed.
Optional argument STAY-IN-TREE prevents moving from real feed
tree to virtual feed tree or vice versa.
Return t if a new feed was activated, nil otherwise."
(interactive) (interactive)
(newsticker--treeview-restore-layout) (newsticker--treeview-restore-layout)
(let ((cur (newsticker--treeview-get-current-node))) (let ((cur (newsticker--treeview-get-current-node))
;;(message "newsticker-treeview-next-feed from %s" (new nil))
;; (widget-get cur :tag)) (message "newsticker-treeview-next-feed from %s"
(widget-get cur :tag))
(if cur (if cur
(let ((new (or (newsticker--treeview-get-next-sibling cur) (progn
(newsticker--treeview-get-next-uncle cur) (setq new
(newsticker--treeview-get-other-tree)))) (if cur
(newsticker--treeview-activate-node new)) (or (newsticker--treeview-get-next-sibling cur)
(newsticker--treeview-activate-node (newsticker--treeview-get-next-uncle cur)
(car (widget-get newsticker--treeview-feed-tree :children))))) (and (not stay-in-tree)
(newsticker--treeview-tree-update-highlight)) (newsticker--treeview-get-other-tree)))
(car (widget-get newsticker--treeview-feed-tree :children))))
(if new
(progn
(newsticker--treeview-activate-node new)
(newsticker--treeview-tree-update-highlight)
(not (eq new cur)))
nil))
nil)))
(defun newsticker-treeview-prev-feed () (defun newsticker-treeview-prev-feed (&optional stay-in-tree)
"Move to previous feed." "Move to previous feed.
Optional argument STAY-IN-TREE prevents moving from real feed
tree to virtual feed tree or vice versa.
Return t if a new feed was activated, nil otherwise."
(interactive) (interactive)
(newsticker--treeview-restore-layout) (newsticker--treeview-restore-layout)
(let ((cur (newsticker--treeview-get-current-node))) (let ((cur (newsticker--treeview-get-current-node))
(new nil))
(message "newsticker-treeview-prev-feed from %s" (message "newsticker-treeview-prev-feed from %s"
(widget-get cur :tag)) (widget-get cur :tag))
(if cur (if cur
(let ((new (or (newsticker--treeview-get-prev-sibling cur) (progn
(newsticker--treeview-get-prev-uncle cur) (setq new
(newsticker--treeview-get-other-tree)))) (if cur
(newsticker--treeview-activate-node new t)) (or (newsticker--treeview-get-prev-sibling cur)
(newsticker--treeview-activate-node (newsticker--treeview-get-prev-uncle cur)
(car (widget-get newsticker--treeview-feed-tree :children)) t))) (and (not stay-in-tree)
(newsticker--treeview-tree-update-highlight)) (newsticker--treeview-get-other-tree)))
(car (widget-get newsticker--treeview-feed-tree :children))))
(if new
(progn
(newsticker--treeview-activate-node new t)
(newsticker--treeview-tree-update-highlight)
(not (eq new cur)))
nil))
nil)))
(defun newsticker-treeview-next-page () (defun newsticker-treeview-next-page ()
"Scroll item buffer." "Scroll item buffer."
(interactive) (interactive)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment