-;;; newst-treeview.el --- Treeview frontend for newsticker.
+;;; newst-treeview.el --- Treeview frontend for newsticker. -*- lexical-binding:t -*-
;; Copyright (C) 2008-2015 Free Software Foundation, Inc.
;; Author: Ulf Jasper <ulf.jasper@web.de>
;; Filename: newst-treeview.el
-;; URL: http://www.nongnu.org/newsticker
;; Created: 2007
;; Keywords: News, RSS, Atom
;; Package: newsticker
;; ======================================================================
-(unless (fboundp 'declare-function) (defmacro declare-function (&rest r)))
+(unless (fboundp 'declare-function) (defmacro declare-function (&rest _)))
(declare-function w3m-toggle-inline-images "ext:w3m" (&optional force no-cache))
+(defvar w3m-fill-column)
+(defvar w3-maximum-line-length)
(defun newsticker--treeview-render-text (start end)
"Render text between markers START and END."
(remove-overlays))))
(defun newsticker--treeview-list-items-with-age-callback (widget
- changed-widget
+ _changed-widget
&rest ages)
"Fill newsticker treeview list window with items of certain age.
This is a callback function for the treeview nodes.
Optional argument AGES is the list of ages that are to be shown."
(newsticker--treeview-list-clear)
(widget-put widget :nt-selected t)
- (apply 'newsticker--treeview-list-items-with-age ages))
+ (apply #'newsticker--treeview-list-items-with-age ages))
(defun newsticker--treeview-list-items-with-age (&rest ages)
"Actually fill newsticker treeview list window with items of certain age.
(newsticker--treeview-list-update nil))
(defun newsticker--treeview-list-new-items (widget changed-widget
- &optional event)
+ &optional _event)
"Fill newsticker treeview list window with new items.
This is a callback function for the treeview nodes.
Argument WIDGET is the calling treeview widget.
"This is a virtual feed containing all new items"))
(defun newsticker--treeview-list-immortal-items (widget changed-widget
- &optional event)
+ &optional _event)
"Fill newsticker treeview list window with immortal items.
This is a callback function for the treeview nodes.
Argument WIDGET is the calling treeview widget.
"This is a virtual feed containing all immortal items."))
(defun newsticker--treeview-list-obsolete-items (widget changed-widget
- &optional event)
+ &optional _event)
"Fill newsticker treeview list window with obsolete items.
This is a callback function for the treeview nodes.
Argument WIDGET is the calling treeview widget.
(cdr (newsticker--cache-get-feed (intern feed-name)))))
(newsticker--treeview-list-update nil))))
-(defun newsticker--treeview-list-feed-items (widget changed-widget
- &optional event)
+(defun newsticker--treeview-list-feed-items (widget _changed-widget
+ &optional _event)
"Callback function for listing feed items.
Argument WIDGET is the calling treeview widget.
Argument CHANGED-WIDGET is the widget that actually has changed.
(defun newsticker--treeview-list-update-highlight ()
"Update the highlight in the treeview list buffer."
(newsticker--treeview-list-clear-highlight)
- (let (pos num-lines)
- (with-current-buffer (newsticker--treeview-list-buffer)
- (let ((inhibit-read-only t))
- (put-text-property (point-at-bol) (point-at-eol) :nt-selected t))
- (newsticker--treeview-list-update-faces))))
+ (with-current-buffer (newsticker--treeview-list-buffer)
+ (let ((inhibit-read-only t))
+ (put-text-property (point-at-bol) (point-at-eol) :nt-selected t))
+ (newsticker--treeview-list-update-faces)))
(defun newsticker--treeview-list-highlight-start ()
"Return position of selection in treeview list buffer."
(defun newsticker--treeview-list-select (item)
"Select ITEM in treeview's list buffer."
(newsticker--treeview-list-clear-highlight)
- (let (pos num-lines)
- (save-current-buffer
- (set-buffer (newsticker--treeview-list-buffer))
- (goto-char (point-min))
- (catch 'found
- (while t
- (let ((it (get-text-property (point) :nt-item)))
- (when (eq it item)
- (newsticker--treeview-list-update-highlight)
- (newsticker--treeview-list-update-faces)
- (newsticker--treeview-item-show
- item (get-text-property (point) :nt-feed))
- (throw 'found t)))
- (forward-line 1)
- (when (eobp)
- (goto-char (point-min))
- (throw 'found nil)))))))
+ (save-current-buffer
+ (set-buffer (newsticker--treeview-list-buffer))
+ (goto-char (point-min))
+ (catch 'found
+ (while t
+ (let ((it (get-text-property (point) :nt-item)))
+ (when (eq it item)
+ (newsticker--treeview-list-update-highlight)
+ (newsticker--treeview-list-update-faces)
+ (newsticker--treeview-item-show
+ item (get-text-property (point) :nt-feed))
+ (throw 'found t)))
+ (forward-line 1)
+ (when (eobp)
+ (goto-char (point-min))
+ (throw 'found nil))))))
;; ======================================================================
;;; item window
(widget-put icon :leaf-icon 'tree-widget-leaf-icon)
(tree-widget-icon-create icon))))
-(defun newsticker--treeview-tree-expand-status (tree &optional changed-widget
- event)
+(defun newsticker--treeview-tree-expand-status (tree &optional _changed-widget
+ _event)
"Expand the vfeed TREE.
Optional arguments CHANGED-WIDGET and EVENT are ignored."
(tree-widget-set-theme "folder")
:tag (newsticker--treeview-propertize-tag
"Feeds" 0 "feeds")
:expander 'newsticker--treeview-tree-expand
- :expander-p (lambda (&rest ignore) t)
+ :expander-p (lambda (&rest _) t)
:leaf-icon 'newsticker--tree-widget-leaf-icon
:nt-group (cdr newsticker-groups)
:nt-id "feeds"
:tag (newsticker--treeview-propertize-tag
"Virtual Feeds" 0 "vfeeds")
:expander 'newsticker--treeview-tree-expand-status
- :expander-p (lambda (&rest ignore) t)
+ :expander-p (lambda (&rest _) t)
:leaf-icon 'newsticker--tree-widget-leaf-icon
:nt-id "vfeeds"
:keep '(:nt-id)
(defun newsticker--stat-num-items-for-group (feed-name-symbol &rest ages)
"Count number of items in feed FEED-NAME-SYMBOL that have an age matching AGES."
;;(message "newsticker--stat-num-items-for-group %s %s" feed-name-symbol ages)
- (let ((result (apply 'newsticker--stat-num-items feed-name-symbol ages)))
+ (let ((result (apply #'newsticker--stat-num-items feed-name-symbol ages)))
(mapc (lambda (f-n)
(setq result (+ result
- (apply 'newsticker--stat-num-items (intern f-n)
+ (apply #'newsticker--stat-num-items (intern f-n)
ages))))
(newsticker--group-get-feeds
(newsticker--group-get-group (symbol-name feed-name-symbol)) t))
num-new))
(defun newsticker--treeview-tree-update-tag (w &optional recursive
- &rest ignore)
+ &rest _ignore)
"Update tag for tree widget W.
If RECURSIVE is non-nil recursively update parent widgets as
well. Argument IGNORE is ignored. Note that this function, if
(widget-put w :num-new num-new)
(widget-put w :tag tag)
(when (marker-position (widget-get w :from))
- (let ((p (point))
- (notify (widget-get w :notify)))
+ (let ((p (point)))
;; FIXME: This moves point!!!!
(with-current-buffer (newsticker--treeview-tree-buffer)
(widget-value-set w (widget-value w)))
(newsticker--treeview-tree-do-update-tags w))
(newsticker--treeview-tree-update-tag widget))))
-(defun newsticker--treeview-tree-update-tags (&rest ignore)
+(defun newsticker--treeview-tree-update-tags (&rest _ignore)
"Update all tags of all trees.
-Arguments IGNORE are ignored."
+Arguments are ignored."
(save-current-buffer
(set-buffer (newsticker--treeview-tree-buffer))
(let ((inhibit-read-only t))
(completing-read
"Jump to feed: "
(append '("new" "obsolete" "immortal" "all")
- (mapcar 'car (append newsticker-url-list
- newsticker-url-list-defaults)))
+ (mapcar #'car (append newsticker-url-list
+ newsticker-url-list-defaults)))
nil t))))
(newsticker--treeview-unfold-node feed-name))
(string= old-name (car elt)))
(cons new-name (cdr elt)))
(t
- elt))) parent-group)))
+ elt)))
+ parent-group)))
(defun newsticker-group-rename-group (old-name new-name)
"Rename group OLD-NAME to NEW-NAME."
(defun newsticker--get-group-names (lst)
"Do get the group names from LST."
(delete nil (cons (car lst)
- (apply 'append
+ (apply #'append
(mapcar (lambda (e)
(cond ((listp e)
(newsticker--get-group-names e))
(interactive
(let ((completion-ignore-case t))
(list (completing-read "Name of feed or group to move: "
- (append (mapcar 'car newsticker-url-list)
+ (append (mapcar #'car newsticker-url-list)
(newsticker--group-names))
nil t newsticker--treeview-current-feed)
(completing-read "Name of new parent group: " (newsticker--group-names)