annotate lisp/net/newst-treeview.el @ 95956:d2bcf235d764

Moved some faces from newst-plainview to newst-reader.
author Ulf Jasper <ulf.jasper@web.de>
date Sun, 15 Jun 2008 08:04:13 +0000
parents 594d82b81559
children f104cdfcb450
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
95901
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1 ;;; newst-treeview.el --- Treeview frontend for newsticker.
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
2
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
3 ;; Copyright (C) 2008 Free Software Foundation, Inc.
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
4
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
5 ;; Author: Ulf Jasper <ulf.jasper@web.de>
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
6 ;; Filename: newst-treeview.el
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
7 ;; URL: http://www.nongnu.org/newsticker
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
8 ;; Created: 2007
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
9 ;; Keywords: News, RSS, Atom
95904
594d82b81559 Renamed newsticker-*.el to newst-*.el. Fixed (require).
Ulf Jasper <ulf.jasper@web.de>
parents: 95901
diff changeset
10 ;; Time-stamp: "13. Juni 2008, 19:29:03 (ulf)"
95901
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
11
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
12 ;; ======================================================================
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
13
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
14 ;; This file is part of GNU Emacs.
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
15
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
16 ;; GNU Emacs is free software: you can redistribute it and/or modify
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
17 ;; it under the terms of the GNU General Public License as published by
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
18 ;; the Free Software Foundation, either version 3 of the License, or
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
19 ;; (at your option) any later version.
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
20
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
21 ;; GNU Emacs is distributed in the hope that it will be useful,
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
22 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
23 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
24 ;; GNU General Public License for more details.
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
25
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
26 ;; You should have received a copy of the GNU General Public License
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
27 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
28
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
29 ;; ======================================================================
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
30 ;;; Commentary:
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
31
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
32 ;; See newsticker.el
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
33
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
34 ;; ======================================================================
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
35 ;;; History:
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
36 ;;
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
37
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
38
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
39 ;; ======================================================================
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
40 ;;; Code:
95904
594d82b81559 Renamed newsticker-*.el to newst-*.el. Fixed (require).
Ulf Jasper <ulf.jasper@web.de>
parents: 95901
diff changeset
41 (require 'newsticker-reader "newst-reader")
95901
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
42 (require 'widget)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
43 (require 'tree-widget)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
44 (require 'wid-edit)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
45
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
46 ;; ======================================================================
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
47 ;;; Customization
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
48 ;; ======================================================================
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
49 (defgroup newsticker-treeview nil
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
50 "Settings for the tree view reader."
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
51 :group 'newsticker-reader)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
52
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
53 (defface newsticker-treeview-face
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
54 '((((class color) (background dark))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
55 (:family "helvetica" :foreground "misty rose" :bold nil))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
56 (((class color) (background light))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
57 (:family "helvetica" :foreground "black" :bold nil)))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
58 "Face for newsticker tree."
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
59 :group 'newsticker-treeview)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
60
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
61 (defface newsticker-treeview-new-face
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
62 '((((class color) (background dark))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
63 (:inherit newsticker-treeview-face :bold t))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
64 (((class color) (background light))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
65 (:inherit newsticker-treeview-face :bold t)))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
66 "Face for newsticker tree."
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
67 :group 'newsticker-treeview)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
68
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
69 (defface newsticker-treeview-old-face
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
70 '((((class color) (background dark))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
71 (:inherit newsticker-treeview-face))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
72 (((class color) (background light))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
73 (:inherit newsticker-treeview-face)))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
74 "Face for newsticker tree."
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
75 :group 'newsticker-treeview)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
76
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
77 (defface newsticker-treeview-immortal-face
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
78 '((((class color) (background dark))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
79 (:inherit newsticker-treeview-face :foreground "orange" :italic t))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
80 (((class color) (background light))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
81 (:inherit newsticker-treeview-face :foreground "blue" :italic t)))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
82 "Face for newsticker tree."
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
83 :group 'newsticker-treeview)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
84
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
85 (defface newsticker-treeview-obsolete-face
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
86 '((((class color) (background dark))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
87 (:inherit newsticker-treeview-face :strike-through t))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
88 (((class color) (background light))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
89 (:inherit newsticker-treeview-face :strike-through t)))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
90 "Face for newsticker tree."
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
91 :group 'newsticker-treeview)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
92
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
93 (defface newsticker-treeview-selection-face
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
94 '((((class color) (background dark))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
95 (:background "#bbbbff"))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
96 (((class color) (background light))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
97 (:background "#bbbbff")))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
98 "Face for newsticker selection."
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
99 :group 'newsticker-treeview)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
100
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
101 (defcustom newsticker-treeview-own-frame
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
102 t
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
103 "Decides whether newsticker creates and uses its own frame."
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
104 :type 'boolean
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
105 :group 'newsticker-treeview)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
106
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
107 (defcustom newsticker-treeview-automatically-mark-displayed-items-as-old
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
108 t
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
109 "Decides whether to automatically mark displayed items as old.
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
110 If t an item is marked as old as soon as it is displayed. This
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
111 applies to newsticker only."
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
112 :type 'boolean
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
113 :group 'newsticker-treeview)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
114
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
115 (defvar newsticker-groups
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
116 '("Feeds")
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
117 "List of feed groups, used in the treeview frontend.
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
118 Each element must be a list consisting of strings. The first
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
119 element gives the title of the group, the following elements the
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
120 names of feeds that belong to the group.
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
121 FIXME")
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
122
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
123 (defcustom newsticker-groups-filename
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
124 "~/.newsticker-groups"
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
125 "Name of the newsticker groups settings file."
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
126 :type 'string
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
127 :group 'newsticker-treeview)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
128
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
129 ;; ======================================================================
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
130 ;;; internal variables
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
131 ;; ======================================================================
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
132 (defvar newsticker--treeview-windows nil)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
133 (defvar newsticker--treeview-buffers nil)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
134 (defvar newsticker--treeview-current-feed nil)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
135 (defvar newsticker--treeview-current-vfeed nil)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
136 (defvar newsticker--treeview-list-show-feed nil)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
137 (defvar newsticker--saved-window-config nil)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
138 (defvar newsticker--window-config nil)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
139 ;; (makunbound 'newsticker--selection-overlay) ;; FIXME
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
140 (defvar newsticker--selection-overlay nil
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
141 "Highlight the selected tree node.")
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
142 ;;(makunbound 'newsticker--tree-selection-overlay) ;; FIXME
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
143 (defvar newsticker--tree-selection-overlay nil
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
144 "Highlight the selected list item.")
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
145 ;;(makunbound 'newsticker--frame);; FIXME
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
146 (defvar newsticker--frame nil "Special frame for newsticker windows.")
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
147 (defvar newsticker--treeview-list-sort-order 'sort-by-time)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
148 (defvar newsticker--treeview-current-node-id nil)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
149 (defvar newsticker--treeview-current-tree nil)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
150 (defvar newsticker--treeview-feed-tree nil)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
151 (defvar newsticker--treeview-vfeed-tree nil)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
152
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
153 ;; maps for the clickable portions
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
154 (defvar newsticker--treeview-url-keymap
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
155 (let ((map (make-sparse-keymap 'newsticker--treeview-url-keymap)))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
156 (define-key map [mouse-1] 'newsticker-treeview-mouse-browse-url)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
157 (define-key map [mouse-2] 'newsticker-treeview-mouse-browse-url)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
158 (define-key map "\n" 'newsticker-treeview-browse-url)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
159 (define-key map "\C-m" 'newsticker-treeview-browse-url)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
160 (define-key map [(control return)] 'newsticker-handle-url)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
161 map)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
162 "Key map for click-able headings in the newsticker treeview buffers.")
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
163
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
164
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
165 ;; ======================================================================
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
166 ;;; short cuts
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
167 ;; ======================================================================
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
168 (defsubst newsticker--treeview-tree-buffer ()
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
169 "Return the tree buffer of the newsticker treeview."
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
170 (nth 0 newsticker--treeview-buffers))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
171 (defsubst newsticker--treeview-list-buffer ()
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
172 "Return the list buffer of the newsticker treeview."
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
173 (nth 1 newsticker--treeview-buffers))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
174 (defsubst newsticker--treeview-item-buffer ()
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
175 "Return the item buffer of the newsticker treeview."
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
176 (nth 2 newsticker--treeview-buffers))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
177 (defsubst newsticker--treeview-tree-window ()
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
178 "Return the tree window of the newsticker treeview."
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
179 (nth 0 newsticker--treeview-windows))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
180 (defsubst newsticker--treeview-list-window ()
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
181 "Return the list window of the newsticker treeview."
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
182 (nth 1 newsticker--treeview-windows))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
183 (defsubst newsticker--treeview-item-window ()
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
184 "Return the item window of the newsticker treeview."
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
185 (nth 2 newsticker--treeview-windows))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
186
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
187 ;; ======================================================================
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
188 ;;; utility functions
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
189 ;; ======================================================================
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
190 (defun newsticker--treeview-get-id (parent i)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
191 "Create an id for a newsticker treeview node.
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
192 PARENT is the node's parent, I is an integer."
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
193 ;;(message "newsticker--treeview-get-id %s"
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
194 ;; (format "%s-%d" (widget-get parent :nt-id) i))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
195 (format "%s-%d" (widget-get parent :nt-id) i))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
196
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
197 (defun newsticker--treeview-ids-eq (id1 id2)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
198 "Return non-nil if ids ID1 and ID2 are equal."
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
199 ;;(message "%s/%s" (or id1 -1) (or id2 -1))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
200 (and id1 id2 (string= id1 id2)))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
201
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
202 (defun newsticker--treeview-nodes-eq (node1 node2)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
203 "Compare treeview nodes NODE1 and NODE2 for equality.
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
204 Nodes are equal if the have the same newsticker-id. Note that
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
205 during re-tagging and collapsing/expanding nodes change, while
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
206 their id stays constant."
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
207 (let ((id1 (widget-get node1 :nt-id))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
208 (id2 (widget-get node2 :nt-id)))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
209 ;;(message "%s/%s %s/%s" (widget-get node1 :tag) (widget-get node2 :tag)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
210 ;; (or id1 -1) (or id2 -1))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
211 (or (newsticker--treeview-ids-eq id1 id2)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
212 (string= (widget-get node1 :tag) (widget-get node2 :tag)))))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
213
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
214 (defun newsticker--treeview-do-get-node-of-feed (feed-name startnode)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
215 "Recursivly search node for feed FEED-NAME starting from STARTNODE."
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
216 ;;(message "%s/%s" feed-name (widget-get startnode :nt-feed))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
217 (if (string= feed-name (or (widget-get startnode :nt-feed)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
218 (widget-get startnode :nt-vfeed)))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
219 (throw 'found startnode)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
220 (let ((children (widget-get startnode :children)))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
221 (dolist (w children)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
222 (newsticker--treeview-do-get-node-of-feed feed-name w)))))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
223
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
224 (defun newsticker--treeview-get-node-of-feed (feed-name)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
225 "Return node for feed FEED-NAME in newsticker treeview tree."
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
226 (catch 'found
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
227 (newsticker--treeview-do-get-node-of-feed feed-name
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
228 newsticker--treeview-feed-tree)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
229 (newsticker--treeview-do-get-node-of-feed feed-name
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
230 newsticker--treeview-vfeed-tree)))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
231
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
232 (defun newsticker--treeview-do-get-node (id startnode)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
233 "Recursivly search node with ID starting from STARTNODE."
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
234 (if (newsticker--treeview-ids-eq id (widget-get startnode :nt-id))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
235 (throw 'found startnode)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
236 (let ((children (widget-get startnode :children)))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
237 (dolist (w children)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
238 (newsticker--treeview-do-get-node id w)))))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
239
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
240 (defun newsticker--treeview-get-node (id)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
241 "Return node with ID in newsticker treeview tree."
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
242 (catch 'found
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
243 (newsticker--treeview-do-get-node id newsticker--treeview-feed-tree)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
244 (newsticker--treeview-do-get-node id newsticker--treeview-vfeed-tree)))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
245
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
246 (defun newsticker--treeview-get-current-node ()
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
247 "Return current node in newsticker treeview tree."
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
248 (newsticker--treeview-get-node newsticker--treeview-current-node-id))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
249
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
250 ;; ======================================================================
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
251
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
252 (declare-function w3m-toggle-inline-images "ext:w3m" (&optional force no-cache))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
253
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
254 (defun newsticker--treeview-render-text (start end)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
255 "Render text between markers START and END."
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
256 (if newsticker-html-renderer
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
257 (condition-case error-data
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
258 (save-excursion
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
259 (set-marker-insertion-type end t)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
260 ;; check whether it is necessary to call html renderer
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
261 ;; (regexp inspired by htmlr.el)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
262 (goto-char start)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
263 (when (re-search-forward
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
264 "</?[A-Za-z1-6]*\\|&#?[A-Za-z0-9]+;" end t)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
265 ;; (message "%s" (newsticker--title item))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
266 (let ((w3m-fill-column (if newsticker-use-full-width
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
267 -1 fill-column))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
268 (w3-maximum-line-length
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
269 (if newsticker-use-full-width nil fill-column)))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
270 (save-excursion
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
271 (funcall newsticker-html-renderer start end)))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
272 ;;(cond ((eq newsticker-html-renderer 'w3m-region)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
273 ;; (add-text-properties start end (list 'keymap
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
274 ;; w3m-minor-mode-map)))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
275 ;;((eq newsticker-html-renderer 'w3-region)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
276 ;;(add-text-properties start end (list 'keymap w3-mode-map))))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
277 (if (eq newsticker-html-renderer 'w3m-region)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
278 (w3m-toggle-inline-images t))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
279 t))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
280 (error
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
281 (message "Error: HTML rendering failed: %s, %s"
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
282 (car error-data) (cdr error-data))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
283 nil))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
284 nil))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
285
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
286 ;; ======================================================================
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
287 ;;; List window
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
288 ;; ======================================================================
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
289 (defun newsticker--treeview-list-add-item (item feed &optional show-feed)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
290 "Add news ITEM for FEED to newsticker treeview list window.
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
291 If string SHOW-FEED is non-nil it is shown in the item string."
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
292 (setq newsticker--treeview-list-show-feed show-feed)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
293 (save-excursion
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
294 (set-buffer (newsticker--treeview-list-buffer))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
295 (let* ((inhibit-read-only t)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
296 pos1 pos2)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
297 (goto-char (point-max))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
298 (setq pos1 (point-marker))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
299 (insert " ")
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
300 (insert (propertize " " 'display '(space :align-to 2)))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
301 (insert (if show-feed
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
302 (concat
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
303 (substring
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
304 (format "%-10s" (newsticker--real-feed-name
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
305 feed))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
306 0 10)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
307 (propertize " " 'display '(space :align-to 12)))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
308 ""))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
309 (insert (format-time-string "%d.%m.%y, %H:%M"
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
310 (newsticker--time item)))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
311 (insert (propertize " " 'display
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
312 (list 'space :align-to (if show-feed 28 18))))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
313 (setq pos2 (point-marker))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
314 (insert (newsticker--title item))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
315 (insert "\n")
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
316 (newsticker--treeview-render-text pos2 (point-marker))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
317 (goto-char pos2)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
318 (while (search-forward "\n" nil t)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
319 (replace-match " "))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
320 (let ((map (make-sparse-keymap)))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
321 (define-key map [mouse-1] 'newsticker-treeview-tree-click)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
322 (define-key map "\n" 'newsticker-treeview-show-item)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
323 (define-key map "\C-m" 'newsticker-treeview-show-item)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
324 (add-text-properties pos1 (point-max)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
325 (list :nt-item item
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
326 :nt-feed feed
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
327 :nt-link (newsticker--link item)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
328 'mouse-face 'highlight
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
329 'keymap map
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
330 'help-echo "Show item")))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
331 (insert "\n"))))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
332
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
333 (defun newsticker--treeview-list-clear ()
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
334 "Clear the newsticker treeview list window."
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
335 (save-excursion
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
336 (set-buffer (newsticker--treeview-list-buffer))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
337 (let ((inhibit-read-only t))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
338 (erase-buffer)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
339 (kill-all-local-variables)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
340 (remove-overlays))))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
341
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
342 (defun newsticker--treeview-list-items-with-age-callback (widget
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
343 changed-widget
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
344 &rest ages)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
345 "Fill newsticker treeview list window with items of certain age.
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
346 This is a callback function for the treeview nodes.
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
347 Argument WIDGET is the calling treeview widget.
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
348 Argument CHANGED-WIDGET is the widget that actually has changed.
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
349 Optional argument AGES is the list of ages that are to be shown."
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
350 (newsticker--treeview-list-clear)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
351 (widget-put widget :nt-selected t)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
352 (apply 'newsticker--treeview-list-items-with-age ages))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
353
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
354 (defun newsticker--treeview-list-items-with-age (&rest ages)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
355 "Actually fill newsticker treeview list window with items of certain age.
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
356 AGES is the list of ages that are to be shown."
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
357 (mapc (lambda (feed)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
358 (let ((feed-name-symbol (intern (car feed))))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
359 (mapc (lambda (item)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
360 (when (memq (newsticker--age item) ages)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
361 (newsticker--treeview-list-add-item
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
362 item feed-name-symbol t)))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
363 (newsticker--treeview-list-sort-items
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
364 (cdr (newsticker--cache-get-feed feed-name-symbol))))))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
365 (append newsticker-url-list-defaults newsticker-url-list))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
366 (newsticker--treeview-list-update nil))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
367
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
368 (defun newsticker--treeview-list-new-items (widget changed-widget
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
369 &optional event)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
370 "Fill newsticker treeview list window with new items.
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
371 This is a callback function for the treeview nodes.
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
372 Argument WIDGET FIXME.
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
373 Argument CHANGED-WIDGET FIXME.
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
374 Optional argument EVENT FIXME."
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
375 (newsticker--treeview-list-items-with-age-callback widget changed-widget
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
376 'new)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
377 (newsticker--treeview-item-show-text
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
378 "New items"
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
379 "This is a virtual feed containing all new items"))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
380
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
381 (defun newsticker--treeview-list-immortal-items (widget changed-widget
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
382 &optional event)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
383 "Fill newsticker treeview list window with immortal items.
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
384 This is a callback function for the treeview nodes.
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
385 Argument WIDGET FIXME.
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
386 Argument CHANGED-WIDGET FIXME.
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
387 Optional argument EVENT FIXME."
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
388 (newsticker--treeview-list-items-with-age-callback widget changed-widget
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
389 'immortal)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
390 (newsticker--treeview-item-show-text
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
391 "Immortal items"
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
392 "This is a virtual feed containing all immortal items."))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
393
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
394 (defun newsticker--treeview-list-obsolete-items (widget changed-widget
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
395 &optional event)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
396 "Fill newsticker treeview list window with obsolete items.
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
397 This is a callback function for the treeview nodes.
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
398 Argument WIDGET FIXME.
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
399 Argument CHANGED-WIDGET FIXME.
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
400 Optional argument EVENT FIXME."
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
401 (newsticker--treeview-list-items-with-age-callback widget changed-widget
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
402 'obsolete)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
403 (newsticker--treeview-item-show-text
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
404 "Obsolete items"
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
405 "This is a virtual feed containing all obsolete items."))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
406
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
407 (defun newsticker--treeview-list-all-items (widget changed-widget
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
408 &optional event)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
409 "Fill newsticker treeview list window with all items.
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
410 This is a callback function for the treeview nodes.
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
411 Argument WIDGET FIXME.
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
412 Argument CHANGED-WIDGET FIXME.
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
413 Optional argument EVENT FIXME."
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
414 (newsticker--treeview-list-items-with-age-callback widget changed-widget
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
415 event 'new 'old
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
416 'obsolete 'immortal)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
417 (newsticker--treeview-item-show-text
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
418 "All items"
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
419 "This is a virtual feed containing all items."))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
420
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
421 (defun newsticker--treeview-list-items-v (vfeed-name)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
422 "List items for virtual feed VFEED-NAME."
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
423 (when vfeed-name
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
424 (cond ((string-match "\\*new\\*" vfeed-name)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
425 (newsticker--treeview-list-items-with-age 'new))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
426 ((string-match "\\*immortal\\*" vfeed-name)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
427 (newsticker--treeview-list-items-with-age 'immortal))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
428 ((string-match "\\*old\\*" vfeed-name)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
429 (newsticker--treeview-list-items-with-age 'old nil)))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
430 (newsticker--treeview-list-update nil)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
431 ))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
432
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
433 (defun newsticker--treeview-list-items (feed-name)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
434 "List items for feed FEED-NAME."
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
435 (when feed-name
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
436 (if (newsticker--treeview-virtual-feed-p feed-name)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
437 (newsticker--treeview-list-items-v feed-name)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
438 (mapc (lambda (item)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
439 (if (eq (newsticker--age item) 'feed)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
440 (newsticker--treeview-item-show item (intern feed-name))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
441 (newsticker--treeview-list-add-item item
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
442 (intern feed-name))))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
443 (newsticker--treeview-list-sort-items
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
444 (cdr (newsticker--cache-get-feed (intern feed-name)))))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
445 (newsticker--treeview-list-update nil))))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
446
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
447 (defun newsticker--treeview-list-feed-items (widget changed-widget
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
448 &optional event)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
449 "Callback function for listing feed items.
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
450 Argument WIDGET FIXME.
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
451 Argument CHANGED-WIDGET FIXME.
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
452 Optional argument EVENT FIXME."
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
453 (newsticker--treeview-list-clear)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
454 (widget-put widget :nt-selected t)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
455 (let ((feed-name (widget-get widget :nt-feed))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
456 (vfeed-name (widget-get widget :nt-vfeed)))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
457 (if feed-name
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
458 (newsticker--treeview-list-items feed-name)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
459 (newsticker--treeview-list-items-v vfeed-name))))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
460
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
461 (defun newsticker--treeview-list-compare-item-by-age (item1 item2)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
462 "Compare two news items ITEM1 and ITEM2 wrt age."
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
463 (catch 'result
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
464 (let ((age1 (newsticker--age item1))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
465 (age2 (newsticker--age item2)))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
466 (cond ((eq age1 'new)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
467 t)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
468 ((eq age1 'immortal)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
469 (cond ((eq age2 'new)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
470 t)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
471 ((eq age2 'immortal)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
472 t)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
473 (t
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
474 nil)))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
475 ((eq age1 'old)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
476 (cond ((eq age2 'new)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
477 nil)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
478 ((eq age2 'immortal)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
479 nil)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
480 ((eq age2 'old)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
481 nil)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
482 (t
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
483 t)))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
484 (t
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
485 nil)))))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
486
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
487 (defun newsticker--treeview-list-compare-item-by-age-reverse (item1 item2)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
488 "Compare two news items ITEM1 and ITEM2 wrt age in reverse order."
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
489 (newsticker--treeview-list-compare-item-by-age item2 item1))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
490
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
491 (defun newsticker--treeview-list-compare-item-by-time (item1 item2)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
492 "Compare two news items ITEM1 and ITEM2 wrt time values."
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
493 (newsticker--cache-item-compare-by-time item1 item2))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
494
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
495 (defun newsticker--treeview-list-compare-item-by-time-reverse (item1 item2)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
496 "Compare two news items ITEM1 and ITEM2 wrt time values in reverse order."
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
497 (newsticker--cache-item-compare-by-time item2 item1))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
498
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
499 (defun newsticker--treeview-list-compare-item-by-title (item1 item2)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
500 "Compare two news items ITEM1 and ITEM2 wrt title."
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
501 (newsticker--cache-item-compare-by-title item1 item2))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
502
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
503 (defun newsticker--treeview-list-compare-item-by-title-reverse (item1 item2)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
504 "Compare two news items ITEM1 and ITEM2 wrt title in reverse order."
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
505 (newsticker--cache-item-compare-by-title item2 item1))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
506
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
507 (defun newsticker--treeview-list-sort-items (items)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
508 "Return sorted copy of list ITEMS.
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
509 The sort function is chosen according to the value of
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
510 `newsticker--treeview-list-sort-order'."
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
511 (let ((sort-fun
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
512 (cond ((eq newsticker--treeview-list-sort-order 'sort-by-age)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
513 'newsticker--treeview-list-compare-item-by-age)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
514 ((eq newsticker--treeview-list-sort-order
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
515 'sort-by-age-reverse)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
516 'newsticker--treeview-list-compare-item-by-age-reverse)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
517 ((eq newsticker--treeview-list-sort-order 'sort-by-time)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
518 'newsticker--treeview-list-compare-item-by-time)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
519 ((eq newsticker--treeview-list-sort-order
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
520 'sort-by-time-reverse)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
521 'newsticker--treeview-list-compare-item-by-time-reverse)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
522 ((eq newsticker--treeview-list-sort-order 'sort-by-title)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
523 'newsticker--treeview-list-compare-item-by-title)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
524 ((eq newsticker--treeview-list-sort-order
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
525 'sort-by-title-reverse)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
526 'newsticker--treeview-list-compare-item-by-title-reverse)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
527 (t
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
528 'newsticker--treeview-list-compare-item-by-title))))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
529 (sort (copy-sequence items) sort-fun)))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
530
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
531 (defun newsticker--treeview-list-update-faces ()
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
532 "Update faces in the treeview list buffer."
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
533 (let (pos-sel)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
534 (save-excursion
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
535 (set-buffer (newsticker--treeview-list-buffer))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
536 (let ((inhibit-read-only t))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
537 (goto-char (point-min))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
538 (while (not (eobp))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
539 (let* ((pos (save-excursion (end-of-line) (point)))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
540 (item (get-text-property (point) :nt-item))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
541 (age (newsticker--age item))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
542 (selected (get-text-property (point) :nt-selected))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
543 (face (cond ((eq age 'new)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
544 'newsticker-treeview-new-face)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
545 ((eq age 'old)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
546 'newsticker-treeview-old-face)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
547 ((eq age 'immortal)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
548 'newsticker-treeview-immortal-face)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
549 ((eq age 'obsolete)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
550 'newsticker-treeview-obsolete-face)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
551 (t
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
552 'bold))))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
553 (put-text-property (point) pos 'face face)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
554 (if selected
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
555 (move-overlay newsticker--selection-overlay (point)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
556 (1+ pos) ;include newline
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
557 (current-buffer)))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
558 (if selected (setq pos-sel (point)))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
559 (forward-line 1)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
560 (beginning-of-line))))) ;; FIXME!?
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
561 (when pos-sel
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
562 (set-window-point (newsticker--treeview-list-window) pos-sel))))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
563
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
564 (defun newsticker--treeview-list-clear-highlight ()
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
565 "Clear the highlight in the treeview list buffer."
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
566 (save-excursion
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
567 (set-buffer (newsticker--treeview-list-buffer))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
568 (let ((inhibit-read-only t))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
569 (put-text-property (point-min) (point-max) :nt-selected nil))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
570 (newsticker--treeview-list-update-faces)))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
571
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
572 (defun newsticker--treeview-list-update-highlight ()
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
573 "Update the highlight in the treeview list buffer."
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
574 (newsticker--treeview-list-clear-highlight)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
575 (let (pos num-lines)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
576 (save-excursion
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
577 (set-buffer (newsticker--treeview-list-buffer))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
578 (let ((inhibit-read-only t))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
579 (put-text-property (save-excursion (beginning-of-line) (point))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
580 (save-excursion (end-of-line) (point))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
581 :nt-selected t))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
582 (newsticker--treeview-list-update-faces))))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
583
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
584 (defun newsticker--treeview-list-highlight-start ()
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
585 "Return position of selection in treeview list buffer."
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
586 (save-excursion
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
587 (set-buffer (newsticker--treeview-list-buffer))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
588 (goto-char (point-min))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
589 (next-single-property-change (point) :nt-selected)))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
590
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
591 (defun newsticker--treeview-list-update (clear-buffer)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
592 "Update the faces and highlight in the treeview list buffer.
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
593 If CLEAR-BUFFER is non-nil the list buffer is completely erased."
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
594 (save-excursion
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
595 (set-window-buffer (newsticker--treeview-list-window)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
596 (newsticker--treeview-list-buffer))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
597 (if newsticker-treeview-own-frame
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
598 (set-window-dedicated-p (newsticker--treeview-list-window) t))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
599 (set-buffer (newsticker--treeview-list-buffer))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
600 (if clear-buffer
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
601 (let ((inhibit-read-only t))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
602 (erase-buffer)))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
603 (newsticker-treeview-list-mode)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
604 (newsticker--treeview-list-update-faces)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
605 (goto-char (point-min))))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
606
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
607 ;;(makunbound 'newsticker-treeview-list-sort-button-map);; FIXME
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
608 (defvar newsticker-treeview-list-sort-button-map
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
609 (let ((map (make-sparse-keymap)))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
610 (define-key map [header-line mouse-1]
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
611 'newsticker--treeview-list-sort-by-column)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
612 (define-key map [header-line mouse-2]
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
613 'newsticker--treeview-list-sort-by-column)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
614 map)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
615 "Local keymap for newsticker treeview list window sort buttons.")
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
616
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
617 (defun newsticker--treeview-list-sort-by-column (&optional e)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
618 "Sort the newsticker list window buffer by the column clicked on.
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
619 Optional argument E FIXME."
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
620 (interactive (list last-input-event))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
621 (if e (mouse-select-window e))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
622 (let* ((pos (event-start e))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
623 (obj (posn-object pos))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
624 (sort-order (if obj
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
625 (get-text-property (cdr obj) 'sort-order (car obj))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
626 (get-text-property (posn-point pos) 'sort-order))))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
627 (setq newsticker--treeview-list-sort-order
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
628 (cond ((eq sort-order 'sort-by-age)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
629 (if (eq newsticker--treeview-list-sort-order 'sort-by-age)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
630 'sort-by-age-reverse
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
631 'sort-by-age))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
632 ((eq sort-order 'sort-by-time)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
633 (if (eq newsticker--treeview-list-sort-order 'sort-by-time)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
634 'sort-by-time-reverse
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
635 'sort-by-time))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
636 ((eq sort-order 'sort-by-title)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
637 (if (eq newsticker--treeview-list-sort-order 'sort-by-title)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
638 'sort-by-title-reverse
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
639 'sort-by-title))))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
640 (newsticker-treeview-update)))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
641
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
642 (defun newsticker-treeview-list-make-sort-button (name sort-order)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
643 "Create propertized string for headerline button.
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
644 NAME is the button text, SORT-ORDER is the associated sort order
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
645 for the button."
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
646 (let ((face (if (string-match (symbol-name sort-order)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
647 (symbol-name
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
648 newsticker--treeview-list-sort-order))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
649 'bold
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
650 'header-line)))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
651 (propertize name
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
652 'sort-order sort-order
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
653 'help-echo (concat "Sort by " name)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
654 'mouse-face 'highlight
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
655 'face face
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
656 'keymap newsticker-treeview-list-sort-button-map)))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
657
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
658 ;; ======================================================================
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
659 ;;; item window
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
660 ;; ======================================================================
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
661 (defun newsticker--treeview-item-show-text (title description)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
662 "Show text in treeview item buffer consisting of TITLE and DESCRIPTION."
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
663 (save-excursion
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
664 (set-buffer (newsticker--treeview-item-buffer))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
665 (when (fboundp 'w3m-process-stop)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
666 (w3m-process-stop (current-buffer)))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
667 (let ((inhibit-read-only t))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
668 (erase-buffer)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
669 (kill-all-local-variables)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
670 (remove-overlays)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
671 (insert title)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
672 (put-text-property (point-min) (point) 'face 'newsticker-feed-face)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
673 (insert "\n\n" description)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
674 (when newsticker-justification
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
675 (fill-region (point-min) (point-max) newsticker-justification))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
676 (newsticker-treeview-mode)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
677 (goto-char (point-min)))))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
678
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
679 (defun newsticker--treeview-item-show (item feed)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
680 "Show news ITEM coming from FEED in treeview item buffer."
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
681 (save-excursion
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
682 (set-buffer (newsticker--treeview-item-buffer))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
683 (when (fboundp 'w3m-process-stop)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
684 (w3m-process-stop (current-buffer)))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
685 (let ((inhibit-read-only t)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
686 (is-rendered-HTML nil)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
687 pos
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
688 (marker1 (make-marker))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
689 (marker2 (make-marker)))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
690 (erase-buffer)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
691 (kill-all-local-variables)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
692 (remove-overlays)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
693
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
694 (when (and item feed)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
695 (let ((wwidth (1- (window-width (newsticker--treeview-item-window)))))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
696 (if newsticker-use-full-width
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
697 (set (make-local-variable 'fill-column) wwidth))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
698 (set (make-local-variable 'fill-column) (min fill-column
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
699 wwidth)))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
700 (let ((desc (newsticker--desc item)))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
701 (insert "\n" (or desc "[No Description]")))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
702 (set-marker marker1 (1+ (point-min)))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
703 (set-marker marker2 (point-max))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
704 (setq is-rendered-HTML (newsticker--treeview-render-text marker1
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
705 marker2))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
706 (when (and newsticker-justification
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
707 (not is-rendered-HTML))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
708 (fill-region marker1 marker2 newsticker-justification))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
709
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
710 (newsticker-treeview-mode)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
711 (goto-char (point-min))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
712 ;; insert logo at top
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
713 (let* ((newsticker-enable-logo-manipulations nil)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
714 (img (newsticker--image-read feed nil)))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
715 (if (and (display-images-p) img)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
716 (newsticker--insert-image img (car item))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
717 (insert (newsticker--real-feed-name feed))))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
718 (add-text-properties (point-min) (point)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
719 (list 'face 'newsticker-feed-face
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
720 'mouse-face 'highlight
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
721 'help-echo "Visit in web browser."
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
722 :nt-link (newsticker--link item)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
723 'keymap newsticker--treeview-url-keymap))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
724 (setq pos (point))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
725
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
726 (insert "\n\n")
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
727 ;; insert title
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
728 (setq pos (point))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
729 (insert (newsticker--title item) "\n")
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
730 (set-marker marker1 pos)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
731 (set-marker marker2 (point))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
732 (newsticker--treeview-render-text marker1 marker2)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
733 (put-text-property pos (point) 'face 'newsticker-treeview-new-face)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
734 (goto-char marker2)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
735 (delete-char -1)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
736 (insert "\n")
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
737 (put-text-property marker2 (point) 'face 'newsticker-treeview-face)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
738 (set-marker marker2 (point))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
739 (when newsticker-justification
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
740 (fill-region marker1 marker2 newsticker-justification))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
741 (goto-char marker2)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
742 (add-text-properties marker1 (1- (point))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
743 (list 'mouse-face 'highlight
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
744 'help-echo "Visit in web browser."
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
745 :nt-link (newsticker--link item)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
746 'keymap newsticker--treeview-url-keymap))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
747 (insert (format-time-string newsticker-date-format
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
748 (newsticker--time item)))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
749 (insert "\n")
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
750 (setq pos (point))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
751 (insert "\n")
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
752 ;; insert enclosures and rest at bottom
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
753 (goto-char (point-max))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
754 (insert "\n\n")
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
755 (setq pos (point))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
756 (newsticker--insert-enclosure item newsticker--treeview-url-keymap)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
757 (put-text-property pos (point) 'face 'newsticker-enclosure-face)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
758 (setq pos (point))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
759 (insert "\n")
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
760 (newsticker--print-extra-elements item newsticker--treeview-url-keymap)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
761 (put-text-property pos (point) 'face 'newsticker-extra-face)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
762 (goto-char (point-min)))))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
763 (if (and newsticker-treeview-automatically-mark-displayed-items-as-old
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
764 item
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
765 (memq (newsticker--age item) '(new obsolete)))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
766 (let ((newsticker-treeview-automatically-mark-displayed-items-as-old nil))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
767 (newsticker-treeview-mark-item-old t)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
768 (newsticker--treeview-list-update-faces)))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
769 (set-window-point (newsticker--treeview-item-window) 1))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
770
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
771 (defun newsticker--treeview-item-update ()
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
772 "Update the treeview item buffer and window."
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
773 (save-excursion
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
774 (set-window-buffer (newsticker--treeview-item-window)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
775 (newsticker--treeview-item-buffer))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
776 (if newsticker-treeview-own-frame
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
777 (set-window-dedicated-p (newsticker--treeview-item-window) t))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
778 (set-buffer (newsticker--treeview-item-buffer))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
779 (let ((inhibit-read-only t))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
780 (erase-buffer))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
781 (newsticker-treeview-mode)))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
782
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
783 ;; ======================================================================
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
784 ;;; Tree window
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
785 ;; ======================================================================
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
786 (defun newsticker--treeview-tree-expand (tree)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
787 "Expand TREE.
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
788 Callback function for tree widget that adds nodes for feeds and subgroups."
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
789 (newsticker--group-manage-orphan-feeds)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
790 (tree-widget-set-theme "folder")
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
791 (let ((group (widget-get tree :nt-group))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
792 (i 0)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
793 (nt-id ""))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
794 (mapcar (lambda (g)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
795 (setq nt-id (newsticker--treeview-get-id tree i))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
796 (setq i (1+ i))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
797 (if (listp g)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
798 (let* ((g-name (car g)))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
799 `(tree-widget
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
800 :tag ,(newsticker--treeview-tree-get-tag g-name nil nt-id)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
801 :expander newsticker--treeview-tree-expand
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
802 :expander-p (lambda (&rest ignore) t)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
803 :nt-group ,(cdr g)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
804 :nt-feed ,g-name
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
805 :nt-id ,nt-id
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
806 :keep (:nt-feed :num-new :nt-id :open);; :nt-group
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
807 :open nil))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
808 (let ((tag (newsticker--treeview-tree-get-tag g nil nt-id)))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
809 `(item :tag ,tag
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
810 :leaf-icon newsticker--tree-widget-leaf-icon
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
811 :nt-feed ,g
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
812 :action newsticker--treeview-list-feed-items
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
813 :nt-id ,nt-id
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
814 :keep (:nt-id)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
815 :open t))))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
816 group)))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
817
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
818 (defun newsticker--treeview-tree-expand-status (tree &optional changed-widget
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
819 event)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
820 "Expand the vfeed TREE.
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
821 Optional arguments CHANGED-WIDGET and EVENT are ignored."
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
822 (tree-widget-set-theme "folder")
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
823 (list `(item :tag ,(newsticker--treeview-tree-get-tag nil "new")
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
824 :nt-vfeed "new"
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
825 :action newsticker--treeview-list-new-items
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
826 :nt-id ,(newsticker--treeview-get-id tree 0)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
827 :keep (:nt-id))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
828 `(item :tag ,(newsticker--treeview-tree-get-tag nil "immortal")
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
829 :nt-vfeed "immortal"
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
830 :action newsticker--treeview-list-immortal-items
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
831 :nt-id ,(newsticker--treeview-get-id tree 1)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
832 :keep (:nt-id))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
833 `(item :tag ,(newsticker--treeview-tree-get-tag nil "obsolete")
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
834 :nt-vfeed "obsolete"
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
835 :action newsticker--treeview-list-obsolete-items
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
836 :nt-id ,(newsticker--treeview-get-id tree 2)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
837 :keep (:nt-id))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
838 `(item :tag ,(newsticker--treeview-tree-get-tag nil "all")
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
839 :nt-vfeed "all"
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
840 :action newsticker--treeview-list-all-items
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
841 :nt-id ,(newsticker--treeview-get-id tree 3)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
842 :keep (:nt-id))))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
843
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
844 (defun newsticker--treeview-virtual-feed-p (feed-name)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
845 "Return non-nil if FEED-NAME is a virtual feed."
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
846 (string-match "\\*.*\\*" feed-name))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
847
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
848 (define-widget 'newsticker--tree-widget-leaf-icon 'tree-widget-icon
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
849 "Icon for a tree-widget leaf node."
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
850 :tag "O"
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
851 :glyph-name "leaf"
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
852 :button-face 'default)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
853
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
854 (defun newsticker--treeview-tree-update ()
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
855 "Update treeview tree buffer and window."
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
856 (save-excursion
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
857 (set-window-buffer (newsticker--treeview-tree-window)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
858 (newsticker--treeview-tree-buffer))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
859 (if newsticker-treeview-own-frame
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
860 (set-window-dedicated-p (newsticker--treeview-tree-window) t))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
861 (set-buffer (newsticker--treeview-tree-buffer))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
862 (kill-all-local-variables)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
863 (let ((inhibit-read-only t))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
864 (erase-buffer)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
865 (tree-widget-set-theme "folder")
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
866 (setq newsticker--treeview-feed-tree
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
867 (widget-create 'tree-widget
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
868 :tag (newsticker--treeview-propertize-tag
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
869 "Feeds" 0 "feeds")
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
870 :expander 'newsticker--treeview-tree-expand
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
871 :expander-p (lambda (&rest ignore) t)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
872 :leaf-icon 'newsticker--tree-widget-leaf-icon
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
873 :nt-group (cdr newsticker-groups)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
874 :nt-id "feeds"
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
875 :keep '(:nt-id)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
876 :open t))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
877 (setq newsticker--treeview-vfeed-tree
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
878 (widget-create 'tree-widget
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
879 :tag (newsticker--treeview-propertize-tag
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
880 "Virtual Feeds" 0 "vfeeds")
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
881 :expander 'newsticker--treeview-tree-expand-status
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
882 :expander-p (lambda (&rest ignore) t)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
883 :leaf-icon 'newsticker--tree-widget-leaf-icon
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
884 :nt-id "vfeeds"
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
885 :keep '(:nt-id)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
886 :open t))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
887 (use-local-map widget-keymap)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
888 (widget-setup))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
889 (newsticker-treeview-mode)))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
890
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
891 (defun newsticker--treeview-propertize-tag (tag &optional num-new nt-id feed
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
892 vfeed)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
893 "Return propertized copy of string TAG.
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
894 Optional argument NUM-NEW is used for choosing face, other
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
895 arguments NT-ID, FEED, and VFEED are added as properties."
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
896 ;;(message "newsticker--treeview-propertize-tag '%s' %s" feed nt-id)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
897 (let ((face 'newsticker-treeview-face)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
898 (map (make-sparse-keymap)))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
899 (if (and num-new (> num-new 0))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
900 (setq face 'newsticker-treeview-new-face))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
901 (define-key map [mouse-1] 'newsticker-treeview-tree-click)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
902 (define-key map "\n" 'newsticker-treeview-tree-do-click)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
903 (define-key map "\C-m" 'newsticker-treeview-tree-do-click)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
904 (propertize tag 'face face 'keymap map
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
905 :nt-id nt-id
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
906 :nt-feed feed
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
907 :nt-vfeed vfeed
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
908 'help-echo "Clickme!"
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
909 'mouse-face 'highlight)))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
910
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
911 (defun newsticker--treeview-tree-get-tag (feed-name vfeed-name
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
912 &optional nt-id)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
913 "Return a tag string for either FEED-NAME or, if it is nil, for VFEED-NAME.
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
914 Optional argument NT-ID is added to the tag's properties."
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
915 (let (tag (num-new 0))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
916 (cond (vfeed-name
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
917 (cond ((string= vfeed-name "new")
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
918 (setq num-new (newsticker--stat-num-items-total 'new))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
919 (setq tag (format "New items (%d)" num-new)))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
920 ((string= vfeed-name "immortal")
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
921 (setq num-new (newsticker--stat-num-items-total 'immortal))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
922 (setq tag (format "Immortal items (%d)" num-new)))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
923 ((string= vfeed-name "obsolete")
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
924 (setq num-new (newsticker--stat-num-items-total 'obsolete))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
925 (setq tag (format "Obsolete items (%d)" num-new)))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
926 ((string= vfeed-name "all")
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
927 (setq num-new (newsticker--stat-num-items-total))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
928 (setq tag (format "All items (%d)" num-new)))))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
929 (feed-name
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
930 (setq num-new (newsticker--stat-num-items-for-group
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
931 (intern feed-name) 'new 'immortal))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
932 (setq tag
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
933 (format "%s (%d)"
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
934 (newsticker--real-feed-name (intern feed-name))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
935 num-new))))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
936 (if tag
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
937 (newsticker--treeview-propertize-tag tag num-new
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
938 nt-id
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
939 feed-name vfeed-name))))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
940
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
941 (defun newsticker--stat-num-items-for-group (feed-name-symbol &rest ages)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
942 "Count number of items in feed FEED-NAME-SYMBOL that have an age matching AGES."
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
943 ;;(message "newsticker--stat-num-items-for-group %s %s" feed-name-symbol ages)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
944 (let ((result (apply 'newsticker--stat-num-items feed-name-symbol ages)))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
945 (mapc (lambda (f-n)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
946 (setq result (+ result
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
947 (apply 'newsticker--stat-num-items (intern f-n)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
948 ages))))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
949 (newsticker--group-get-feeds
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
950 (newsticker--group-get-group (symbol-name feed-name-symbol)) t))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
951 result))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
952
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
953 (defun newsticker--treeview-count-node-items (feed &optional isvirtual)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
954 "Count number of relevant items for a treeview node.
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
955 FEED gives the name of the feed or group. If ISVIRTUAL is non-nil
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
956 the feed is a virtual feed."
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
957 (let* ((num-new 0))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
958 (if feed
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
959 (if isvirtual
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
960 (cond ((string= feed "new")
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
961 (setq num-new (newsticker--stat-num-items-total 'new)))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
962 ((string= feed "immortal")
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
963 (setq num-new (newsticker--stat-num-items-total 'immortal)))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
964 ((string= feed "obsolete")
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
965 (setq num-new (newsticker--stat-num-items-total 'obsolete)))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
966 ((string= feed "all")
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
967 (setq num-new (newsticker--stat-num-items-total))))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
968 (setq num-new (newsticker--stat-num-items-for-group
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
969 (intern feed) 'new 'immortal))))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
970 num-new))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
971
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
972 (defun newsticker--treeview-tree-update-tag (w &optional recursive
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
973 &rest ignore)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
974 "Update tag for tree widget W.
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
975 If RECURSIVE is non-nil recursively update parent widgets as
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
976 well. Argument IGNORE is ignored. Note that this function, if
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
977 called recursively, makes w invalid. You should keep w's nt-id in
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
978 that case."
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
979 ;;(message "newsticker--treeview-tree-update-tag %s, %s" (widget-get w :tag)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
980 ;; (widget-type w))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
981 (let* ((parent (widget-get w :parent))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
982 (feed (or (widget-get w :nt-feed) (widget-get parent :nt-feed)))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
983 (vfeed (or (widget-get w :nt-vfeed) (widget-get parent :nt-vfeed)))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
984 (nt-id (or (widget-get w :nt-id) (widget-get parent :nt-id)))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
985 (num-new (newsticker--treeview-count-node-items (or feed vfeed)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
986 vfeed))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
987 (tag (newsticker--treeview-tree-get-tag feed vfeed nt-id))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
988 (n (widget-get w :node)))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
989 (if parent
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
990 (if recursive
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
991 (newsticker--treeview-tree-update-tag parent)))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
992 (when tag
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
993 (when n
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
994 (widget-put n :tag tag))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
995 (widget-put w :num-new num-new)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
996 (widget-put w :tag tag)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
997 (when (marker-position (widget-get w :from))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
998 (let ((p (point))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
999 (notify (widget-get w :notify)))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1000 ;; FIXME: This moves point!!!!
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1001 (save-excursion
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1002 (set-buffer (newsticker--treeview-tree-buffer))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1003 (widget-value-set w (widget-value w)))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1004 (goto-char p))))))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1005
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1006 (defun newsticker--treeview-tree-do-update-tags (widget)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1007 "Actually recursively update tags for WIDGET."
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1008 (save-excursion
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1009 (let ((children (widget-get widget :children)))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1010 (dolist (w children)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1011 (newsticker--treeview-tree-do-update-tags w))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1012 (newsticker--treeview-tree-update-tag widget))))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1013
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1014 (defun newsticker--treeview-tree-update-tags (&rest ignore)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1015 "Update all tags of all trees.
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1016 Arguments IGNORE are ignored."
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1017 (save-current-buffer
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1018 (set-buffer (newsticker--treeview-tree-buffer))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1019 (let ((inhibit-read-only t))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1020 (newsticker--treeview-tree-do-update-tags
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1021 newsticker--treeview-feed-tree)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1022 (newsticker--treeview-tree-do-update-tags
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1023 newsticker--treeview-vfeed-tree))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1024 (tree-widget-set-theme "folder")))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1025
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1026 (defun newsticker--treeview-tree-update-highlight ()
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1027 "Update highlight in tree buffer."
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1028 (let ((pos (widget-get (newsticker--treeview-get-current-node) :from)))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1029 (unless (or (integerp pos) (and (markerp pos) (marker-position pos)))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1030 (setq pos (widget-get (widget-get
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1031 (newsticker--treeview-get-current-node)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1032 :parent) :from)))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1033 (when (or (integerp pos) (and (markerp pos) (marker-position pos)))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1034 (save-excursion
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1035 (set-buffer (newsticker--treeview-tree-buffer))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1036 (goto-char pos)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1037 (move-overlay newsticker--tree-selection-overlay
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1038 (save-excursion (beginning-of-line) (point))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1039 (save-excursion (end-of-line) (1+ (point)))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1040 (current-buffer)))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1041 (set-window-point (newsticker--treeview-tree-window) pos))))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1042
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1043 ;; ======================================================================
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1044 ;;; Toolbar
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1045 ;; ======================================================================
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1046 ;;(makunbound 'newsticker-treeview-tool-bar-map)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1047 (defvar newsticker-treeview-tool-bar-map
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1048 (if (featurep 'xemacs)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1049 nil
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1050 (if (boundp 'tool-bar-map)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1051 (let ((tool-bar-map (make-sparse-keymap)))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1052 (define-key tool-bar-map [newsticker-sep-1]
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1053 (list 'menu-item "--double-line"))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1054 (define-key tool-bar-map [newsticker-browse-url]
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1055 (list 'menu-item "newsticker-browse-url"
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1056 'newsticker-browse-url
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1057 :visible t
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1058 :help "Browse URL for item at point"
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1059 :image newsticker--browse-image))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1060 (define-key tool-bar-map [newsticker-buffer-force-update]
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1061 (list 'menu-item "newsticker-treeview-update"
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1062 'newsticker-treeview-update
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1063 :visible t
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1064 :help "Update newsticker buffer"
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1065 :image newsticker--update-image
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1066 :enable t))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1067 (define-key tool-bar-map [newsticker-get-all-news]
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1068 (list 'menu-item "newsticker-get-all-news" 'newsticker-get-all-news
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1069 :visible t
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1070 :help "Get news for all feeds"
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1071 :image newsticker--get-all-image))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1072 (define-key tool-bar-map [newsticker-mark-item-at-point-as-read]
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1073 (list 'menu-item "newsticker-treeview-mark-item-old"
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1074 'newsticker-treeview-mark-item-old
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1075 :visible t
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1076 :image newsticker--mark-read-image
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1077 :help "Mark current item as read"
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1078 ;;:enable '(newsticker-item-not-old-p) FIXME
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1079 ))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1080 (define-key tool-bar-map [newsticker-mark-item-at-point-as-immortal]
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1081 (list 'menu-item "newsticker-treeview-toggle-item-immortal"
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1082 'newsticker-treeview-toggle-item-immortal
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1083 :visible t
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1084 :image newsticker--mark-immortal-image
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1085 :help "Toggle current item as immortal"
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1086 :enable t
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1087 ;;'(newsticker-item-not-immortal-p) FIXME
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1088 ))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1089 (define-key tool-bar-map [newsticker-next-feed]
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1090 (list 'menu-item "newsticker-treeview-next-feed"
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1091 'newsticker-treeview-next-feed
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1092 :visible t
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1093 :help "Go to next feed"
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1094 :image newsticker--next-feed-image
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1095 :enable t
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1096 ;;'(newsticker-next-feed-available-p) FIXME
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1097 ))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1098 (define-key tool-bar-map [newsticker-treeview-next-item]
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1099 (list 'menu-item "newsticker-treeview-next-item"
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1100 'newsticker-treeview-next-item
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1101 :visible t
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1102 :help "Go to next item"
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1103 :image newsticker--next-item-image
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1104 :enable t
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1105 ;;'(newsticker-next-item-available-p) FIXME
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1106 ))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1107 (define-key tool-bar-map [newsticker-treeview-prev-item]
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1108 (list 'menu-item "newsticker-treeview-prev-item"
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1109 'newsticker-treeview-prev-item
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1110 :visible t
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1111 :help "Go to previous item"
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1112 :image newsticker--previous-item-image
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1113 :enable t
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1114 ;;'(newsticker-previous-item-available-p) FIXME
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1115 ))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1116 (define-key tool-bar-map [newsticker-treeview-prev-feed]
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1117 (list 'menu-item "newsticker-treeview-prev-feed"
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1118 'newsticker-treeview-prev-feed
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1119 :visible t
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1120 :help "Go to previous feed"
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1121 :image newsticker--previous-feed-image
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1122 :enable t
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1123 ;;'(newsticker-previous-feed-available-p) FIXME
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1124 ))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1125 ;; standard icons / actions
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1126 (tool-bar-add-item "close"
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1127 'newsticker-treeview-quit
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1128 'newsticker-treeview-quit
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1129 :help "Close newsticker")
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1130 (tool-bar-add-item "preferences"
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1131 'newsticker-customize
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1132 'newsticker-customize
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1133 :help "Customize newsticker")
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1134 tool-bar-map))))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1135
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1136 ;; ======================================================================
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1137 ;;; actions
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1138 ;; ======================================================================
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1139
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1140 (defun newsticker-treeview-mouse-browse-url (event)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1141 "Call `browse-url' for the link of the item at which the EVENT occurred."
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1142 (interactive "e")
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1143 (save-excursion
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1144 (switch-to-buffer (window-buffer (posn-window (event-end event))))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1145 (let ((url (get-text-property (posn-point (event-end event))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1146 :nt-link)))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1147 (when url
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1148 (browse-url url)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1149 (if newsticker-automatically-mark-visited-items-as-old
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1150 (newsticker-treeview-mark-item-old))))))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1151
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1152 (defun newsticker-treeview-browse-url ()
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1153 "Call `browse-url' for the link of the item at point."
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1154 (interactive)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1155 (save-excursion
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1156 (set-buffer (newsticker--treeview-list-buffer))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1157 (let ((url (get-text-property (point) :nt-link)))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1158 (when url
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1159 (browse-url url)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1160 (if newsticker-automatically-mark-visited-items-as-old
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1161 (newsticker-treeview-mark-item-old))))))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1162
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1163 (defun newsticker--treeview-buffer-init ()
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1164 "Initialize all treeview buffers."
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1165 (setq newsticker--treeview-buffers nil)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1166 (add-to-list 'newsticker--treeview-buffers
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1167 (get-buffer-create "*Newsticker Tree*") t)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1168 (add-to-list 'newsticker--treeview-buffers
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1169 (get-buffer-create "*Newsticker List*") t)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1170 (add-to-list 'newsticker--treeview-buffers
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1171 (get-buffer-create "*Newsticker Item*") t)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1172
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1173 (unless newsticker--selection-overlay
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1174 (save-excursion
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1175 (set-buffer (newsticker--treeview-list-buffer))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1176 (setq newsticker--selection-overlay (make-overlay (point-min)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1177 (point-max)))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1178 (overlay-put newsticker--selection-overlay 'face
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1179 'newsticker-treeview-selection-face)))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1180 (unless newsticker--tree-selection-overlay
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1181 (save-excursion
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1182 (set-buffer (newsticker--treeview-tree-buffer))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1183 (setq newsticker--tree-selection-overlay (make-overlay (point-min)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1184 (point-max)))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1185 (overlay-put newsticker--tree-selection-overlay 'face
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1186 'newsticker-treeview-selection-face)))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1187
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1188 (newsticker--treeview-tree-update)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1189 (newsticker--treeview-list-update t)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1190 (newsticker--treeview-item-update))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1191
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1192 (defun newsticker-treeview-update ()
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1193 "Update all treeview buffers and windows."
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1194 (interactive)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1195 (newsticker--cache-update)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1196 (newsticker--group-manage-orphan-feeds)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1197 (newsticker--treeview-list-update t)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1198 (newsticker--treeview-item-update)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1199 (newsticker--treeview-tree-update-tags)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1200 (cond (newsticker--treeview-current-feed
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1201 (newsticker--treeview-list-items newsticker--treeview-current-feed))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1202 (newsticker--treeview-current-vfeed
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1203 (newsticker--treeview-list-items-with-age
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1204 (intern newsticker--treeview-current-vfeed))))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1205 (newsticker--treeview-tree-update-highlight)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1206 (newsticker--treeview-list-update-highlight))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1207
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1208 (defun newsticker-treeview-quit ()
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1209 "Quit newsticker treeview."
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1210 (interactive)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1211 (newsticker-treeview-save)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1212 (setq newsticker--sentinel-callback nil)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1213 (setq newsticker--window-config (current-window-configuration))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1214 (bury-buffer "*Newsticker Tree*")
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1215 (bury-buffer "*Newsticker List*")
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1216 (bury-buffer "*Newsticker Item*")
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1217 (set-window-configuration newsticker--saved-window-config)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1218 (when newsticker--frame
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1219 (if (frame-live-p newsticker--frame)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1220 (delete-frame newsticker--frame))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1221 (setq newsticker--frame nil)))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1222
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1223 (defun newsticker-treeview-save ()
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1224 "Save newsticker data including treeview settings."
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1225 (interactive)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1226 (newsticker--cache-save)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1227 (save-excursion
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1228 (let ((coding-system-for-write 'utf-8)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1229 (buf (find-file-noselect newsticker-groups-filename)))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1230 (when buf
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1231 (set-buffer buf)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1232 (setq buffer-undo-list t)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1233 (erase-buffer)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1234 (insert ";; -*- coding: utf-8 -*-\n")
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1235 (insert (prin1-to-string newsticker-groups))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1236 (save-buffer)))))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1237
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1238 (defun newsticker--treeview-load ()
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1239 "Load treeview settings."
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1240 (let* ((coding-system-for-read 'utf-8)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1241 (buf (and (file-exists-p newsticker-groups-filename)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1242 (find-file-noselect newsticker-groups-filename))))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1243 (when buf
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1244 (set-buffer buf)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1245 (goto-char (point-min))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1246 (condition-case nil
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1247 (setq newsticker-groups (read buf))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1248 (error
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1249 (message "Error while reading newsticker groups file!")
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1250 (setq newsticker-groups nil))))))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1251
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1252
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1253 (defun newsticker-treeview-scroll-item ()
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1254 "Scroll current item."
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1255 (interactive)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1256 (save-selected-window
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1257 (select-window (newsticker--treeview-item-window) t)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1258 (scroll-up 1)))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1259
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1260 (defun newsticker-treeview-show-item ()
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1261 "Show current item."
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1262 (interactive)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1263 (newsticker--treeview-list-update-highlight)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1264 (save-excursion
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1265 (set-buffer (newsticker--treeview-list-buffer))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1266 (beginning-of-line)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1267 (let ((item (get-text-property (point) :nt-item))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1268 (feed (get-text-property (point) :nt-feed)))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1269 (newsticker--treeview-item-show item feed)))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1270 (newsticker--treeview-tree-update-tag
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1271 (newsticker--treeview-get-current-node) t)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1272 (newsticker--treeview-tree-update-highlight))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1273
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1274 (defun newsticker-treeview-next-item ()
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1275 "Move to next item."
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1276 (interactive)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1277 (newsticker--treeview-restore-buffers)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1278 (save-current-buffer
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1279 (set-buffer (newsticker--treeview-list-buffer))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1280 (if (newsticker--treeview-list-highlight-start)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1281 (forward-line 1))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1282 (if (eobp)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1283 (forward-line -1)))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1284 (newsticker-treeview-show-item))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1285
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1286 (defun newsticker-treeview-prev-item ()
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1287 "Move to previous item."
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1288 (interactive)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1289 (newsticker--treeview-restore-buffers)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1290 (save-current-buffer
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1291 (set-buffer (newsticker--treeview-list-buffer))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1292 (forward-line -1))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1293 (newsticker-treeview-show-item))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1294
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1295 (defun newsticker-treeview-next-new-or-immortal-item ()
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1296 "Move to next new or immortal item."
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1297 (interactive)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1298 (newsticker--treeview-restore-buffers)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1299 (newsticker--treeview-list-clear-highlight)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1300 (catch 'found
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1301 (let ((index (newsticker-treeview-next-item)))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1302 (while t
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1303 (save-current-buffer
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1304 (set-buffer (newsticker--treeview-list-buffer))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1305 (forward-line 1)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1306 (when (eobp)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1307 (forward-line -1)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1308 (throw 'found nil)))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1309 (when (memq (newsticker--age
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1310 (newsticker--treeview-get-selected-item)) '(new immortal))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1311 (newsticker-treeview-show-item)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1312 (throw 'found t))))))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1313
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1314 (defun newsticker-treeview-prev-new-or-immortal-item ()
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1315 "Move to previous new or immortal item."
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1316 (interactive)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1317 (newsticker--treeview-restore-buffers)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1318 (newsticker--treeview-list-clear-highlight)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1319 (catch 'found
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1320 (let ((index (newsticker-treeview-next-item)))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1321 (while t
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1322 (save-current-buffer
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1323 (set-buffer (newsticker--treeview-list-buffer))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1324 (forward-line -1)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1325 (when (bobp)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1326 (throw 'found nil)))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1327 (when (memq (newsticker--age
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1328 (newsticker--treeview-get-selected-item)) '(new immortal))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1329 (newsticker-treeview-show-item)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1330 (throw 'found t))))))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1331
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1332 (defun newsticker--treeview-get-selected-item ()
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1333 "Return item that is currently selected in list buffer."
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1334 (save-excursion
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1335 (set-buffer (newsticker--treeview-list-buffer))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1336 (beginning-of-line)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1337 (get-text-property (point) :nt-item)))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1338
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1339 (defun newsticker-treeview-mark-item-old (&optional dont-proceed)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1340 "Mark current item as old unless it is obsolete.
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1341 Move to next item unless DONT-PROCEED is non-nil."
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1342 (interactive)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1343 (let ((item (newsticker--treeview-get-selected-item)))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1344 (unless (eq (newsticker--age item) 'obsolete)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1345 (newsticker--treeview-mark-item item 'old)))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1346 (unless dont-proceed
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1347 (newsticker-treeview-next-item)))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1348
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1349 (defun newsticker-treeview-toggle-item-immortal ()
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1350 "Toggle immortality of current item."
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1351 (interactive)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1352 (let* ((item (newsticker--treeview-get-selected-item))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1353 (new-age (if (eq (newsticker--age item) 'immortal)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1354 'old
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1355 'immortal)))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1356 (newsticker--treeview-mark-item item new-age)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1357 (newsticker-treeview-next-item)))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1358
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1359 (defun newsticker--treeview-mark-item (item new-age)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1360 "Mark ITEM with NEW-AGE."
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1361 (when item
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1362 (setcar (nthcdr 4 item) new-age)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1363 ;; clean up ticker FIXME
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1364 ))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1365
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1366 (defun newsticker-treeview-mark-list-items-old ()
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1367 "Mark all listed items as old."
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1368 (interactive)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1369 (let ((current-feed (or newsticker--treeview-current-feed
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1370 newsticker--treeview-current-vfeed)))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1371 (save-excursion
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1372 (set-buffer (newsticker--treeview-list-buffer))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1373 (goto-char (point-min))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1374 (while (not (eobp))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1375 (let ((item (get-text-property (point) :nt-item)))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1376 (unless (memq (newsticker--age item) '(immortal obsolete))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1377 (newsticker--treeview-mark-item item 'old)))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1378 (forward-line 1)))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1379 (newsticker--treeview-tree-update-tags)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1380 (if current-feed
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1381 (newsticker-treeview-jump current-feed))))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1382
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1383 (defun newsticker-treeview-save-item ()
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1384 "Save current item."
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1385 (interactive)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1386 (newsticker-save-item (or newsticker--treeview-current-feed
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1387 newsticker--treeview-current-vfeed)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1388 (newsticker--treeview-get-selected-item)))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1389
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1390 (defun newsticker--treeview-set-current-node (node)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1391 "Make NODE the current node."
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1392 (save-excursion
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1393 (set-buffer (newsticker--treeview-tree-buffer))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1394 (setq newsticker--treeview-current-node-id
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1395 (widget-get node :nt-id))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1396 (setq newsticker--treeview-current-feed (widget-get node :nt-feed))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1397 (setq newsticker--treeview-current-vfeed (widget-get node :nt-vfeed))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1398 ;;(message "newsticker--treeview-set-current-node %s/%s" (widget-get node :tag)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1399 ;; (widget-get node :nt-id))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1400 ;; node)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1401 (newsticker--treeview-tree-update-highlight)))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1402
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1403 (defun newsticker--treeview-get-first-child (node)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1404 "Get first child of NODE."
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1405 (let ((children (widget-get node :children)))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1406 (if children
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1407 (car children)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1408 nil)))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1409
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1410 (defun newsticker--treeview-get-second-child (node)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1411 "Get scond child of NODE."
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1412 (let ((children (widget-get node :children)))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1413 (if children
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1414 (car (cdr children))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1415 nil)))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1416
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1417 (defun newsticker--treeview-get-last-child (node)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1418 "Get last child of NODE."
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1419 ;;(message "newsticker--treeview-get-last-child %s" (widget-get node :tag))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1420 (let ((children (widget-get node :children)))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1421 (if children
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1422 (car (reverse children))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1423 nil)))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1424
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1425 (defun newsticker--treeview-get-feed-vfeed (node)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1426 "Get (virtual) feed of NODE."
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1427 (or (widget-get node :nt-feed) (widget-get node :nt-vfeed)))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1428
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1429 (defun newsticker--treeview-get-next-sibling (node)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1430 "Get next sibling of NODE."
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1431 (let ((parent (widget-get node :parent)))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1432 (catch 'found
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1433 (let ((children (widget-get parent :children)))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1434 (while children
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1435 (if (newsticker--treeview-nodes-eq (car children) node)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1436 (throw 'found (car (cdr children))))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1437 (setq children (cdr children)))))))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1438
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1439 (defun newsticker--treeview-get-prev-sibling (node)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1440 "Get previous sibling of NODE."
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1441 (let ((parent (widget-get node :parent)))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1442 (catch 'found
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1443 (let ((children (widget-get parent :children))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1444 (prev nil))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1445 (while children
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1446 (if (and (newsticker--treeview-nodes-eq (car children) node)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1447 (widget-get prev :nt-id))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1448 (throw 'found prev))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1449 (setq prev (car children))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1450 (setq children (cdr children)))))))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1451
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1452 (defun newsticker--treeview-get-next-uncle (node)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1453 "Get next uncle of NODE, i.e. parent's next sibling."
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1454 (let* ((parent (widget-get node :parent))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1455 (grand-parent (widget-get parent :parent)))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1456 (catch 'found
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1457 (let ((uncles (widget-get grand-parent :children)))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1458 (while uncles
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1459 (if (newsticker--treeview-nodes-eq (car uncles) parent)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1460 (throw 'found (car (cdr uncles))))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1461 (setq uncles (cdr uncles)))))))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1462
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1463 (defun newsticker--treeview-get-prev-uncle (node)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1464 "Get previous uncle of NODE, i.e. parent's previous sibling."
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1465 (let* ((parent (widget-get node :parent))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1466 (grand-parent (widget-get parent :parent)))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1467 (catch 'found
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1468 (let ((uncles (widget-get grand-parent :children))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1469 (prev nil))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1470 (while uncles
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1471 (if (newsticker--treeview-nodes-eq (car uncles) parent)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1472 (throw 'found prev))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1473 (setq prev (car uncles))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1474 (setq uncles (cdr uncles)))))))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1475
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1476 (defun newsticker--treeview-get-other-tree ()
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1477 "Get other tree."
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1478 (if (and (newsticker--treeview-get-current-node)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1479 (widget-get (newsticker--treeview-get-current-node) :nt-feed))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1480 newsticker--treeview-vfeed-tree
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1481 newsticker--treeview-feed-tree))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1482
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1483 (defun newsticker--treeview-activate-node (node &optional backward)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1484 "Activate NODE.
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1485 If NODE is a tree widget the node's first subnode is activated.
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1486 If BACKWARD is non-nil the last subnode of the previous sibling
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1487 is activated."
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1488 (newsticker--treeview-set-current-node node)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1489 (save-current-buffer
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1490 (set-buffer (newsticker--treeview-tree-buffer))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1491 (cond ((eq (widget-type node) 'tree-widget)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1492 (unless (widget-get node :open)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1493 (widget-put node :open nil)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1494 (widget-apply-action node))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1495 (newsticker--treeview-activate-node
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1496 (if backward
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1497 (newsticker--treeview-get-last-child node)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1498 (newsticker--treeview-get-second-child node))))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1499 (node
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1500 (widget-apply-action node)))))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1501
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1502 (defun newsticker-treeview-next-feed ()
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1503 "Move to next feed."
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1504 (interactive)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1505 (newsticker--treeview-restore-buffers)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1506 (let ((cur (newsticker--treeview-get-current-node)))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1507 ;;(message "newsticker-treeview-next-feed from %s"
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1508 ;; (widget-get cur :tag))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1509 (if cur
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1510 (let ((new (or (newsticker--treeview-get-next-sibling cur)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1511 (newsticker--treeview-get-next-uncle cur)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1512 (newsticker--treeview-get-other-tree))))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1513 (newsticker--treeview-activate-node new))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1514 (newsticker--treeview-activate-node
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1515 (car (widget-get newsticker--treeview-feed-tree :children)))))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1516 (newsticker--treeview-tree-update-highlight))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1517
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1518 (defun newsticker-treeview-prev-feed ()
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1519 "Move to previous feed."
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1520 (interactive)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1521 (newsticker--treeview-restore-buffers)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1522 (let ((cur (newsticker--treeview-get-current-node)))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1523 (message "newsticker-treeview-prev-feed from %s"
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1524 (widget-get cur :tag))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1525 (if cur
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1526 (let ((new (or (newsticker--treeview-get-prev-sibling cur)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1527 (newsticker--treeview-get-prev-uncle cur)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1528 (newsticker--treeview-get-other-tree))))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1529 (newsticker--treeview-activate-node new t))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1530 (newsticker--treeview-activate-node
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1531 (car (widget-get newsticker--treeview-feed-tree :children)) t)))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1532 (newsticker--treeview-tree-update-highlight))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1533
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1534 (defun newsticker-treeview-next-page ()
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1535 "Scroll item buffer."
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1536 (interactive)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1537 (save-selected-window
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1538 (select-window (newsticker--treeview-item-window) t)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1539 (condition-case nil
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1540 (scroll-up nil)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1541 (error
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1542 (goto-char (point-min))))))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1543
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1544
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1545 (defun newsticker--treeview-unfold-node (feed-name)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1546 "Recursively show subtree above the node that represents FEED-NAME."
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1547 (let ((node (newsticker--treeview-get-node-of-feed feed-name)))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1548 (unless node
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1549 (let* ((group-name (or (car (newsticker--group-find-group-for-feed
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1550 feed-name))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1551 (newsticker--group-get-parent-group
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1552 feed-name))))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1553 (newsticker--treeview-unfold-node group-name))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1554 (setq node (newsticker--treeview-get-node-of-feed feed-name)))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1555 (when node
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1556 (save-excursion
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1557 (set-buffer (newsticker--treeview-tree-buffer))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1558 (widget-put node :nt-selected t)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1559 (widget-apply-action node)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1560 (newsticker--treeview-set-current-node node)))))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1561
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1562 (defun newsticker-treeview-jump (feed-name)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1563 "Jump to feed FEED-NAME in newsticker treeview."
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1564 (interactive
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1565 (list (let ((completion-ignore-case t))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1566 (if newsticker-treeview-own-frame
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1567 (set-window-dedicated-p (newsticker--treeview-item-window) nil))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1568 (completing-read
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1569 "Jump to feed: "
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1570 (mapcar 'car (append newsticker-url-list
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1571 newsticker-url-list-defaults))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1572 nil t))))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1573 (if newsticker-treeview-own-frame
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1574 (set-window-dedicated-p (newsticker--treeview-item-window) t))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1575 (newsticker--treeview-unfold-node feed-name))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1576
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1577 ;; ======================================================================
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1578 ;;; Groups
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1579 ;; ======================================================================
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1580 (defun newsticker--group-do-find-group-for-feed (feed-name node)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1581 "Recursively find FEED-NAME in NODE."
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1582 (if (member feed-name (cdr node))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1583 (throw 'found node)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1584 (mapc (lambda (n)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1585 (if (listp n)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1586 (newsticker--group-do-find-group-for-feed feed-name n)))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1587 (cdr node))))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1588
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1589 (defun newsticker--group-find-group-for-feed (feed-name)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1590 "Find group containing FEED-NAME."
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1591 (catch 'found
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1592 (newsticker--group-do-find-group-for-feed feed-name
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1593 newsticker-groups)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1594 nil))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1595
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1596 (defun newsticker--group-do-get-group (name node)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1597 "Recursively find group with NAME below NODE."
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1598 (if (string= name (car node))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1599 (throw 'found node)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1600 (mapc (lambda (n)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1601 (if (listp n)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1602 (newsticker--group-do-get-group name n)))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1603 (cdr node))))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1604
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1605 (defun newsticker--group-get-group (name)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1606 "Find group with NAME."
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1607 (catch 'found
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1608 (mapc (lambda (n)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1609 (if (listp n)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1610 (newsticker--group-do-get-group name n)))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1611 newsticker-groups)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1612 nil))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1613
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1614 (defun newsticker--group-do-get-parent-group (name node parent)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1615 "Recursively find parent group for NAME from NODE which is a child of PARENT."
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1616 (if (string= name (car node))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1617 (throw 'found parent)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1618 (mapc (lambda (n)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1619 (if (listp n)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1620 (newsticker--group-do-get-parent-group name n (car node))))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1621 (cdr node))))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1622
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1623 (defun newsticker--group-get-parent-group (name)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1624 "Find parent group for group named NAME."
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1625 (catch 'found
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1626 (mapc (lambda (n)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1627 (if (listp n)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1628 (newsticker--group-do-get-parent-group
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1629 name n (car newsticker-groups))))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1630 newsticker-groups)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1631 nil))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1632
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1633
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1634 (defun newsticker--group-get-subgroups (group &optional recursive)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1635 "Return list of subgroups for GROUP.
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1636 If RECURSIVE is non-nil recursively get subgroups and return a nested list."
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1637 (let ((result nil))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1638 (mapc (lambda (n)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1639 (when (listp n)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1640 (setq result (cons (car n) result))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1641 (let ((subgroups (newsticker--group-get-subgroups n recursive)))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1642 (when subgroups
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1643 (setq result (append subgroups result))))))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1644 group)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1645 result))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1646
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1647 (defun newsticker--group-all-groups ()
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1648 "Return nested list of all groups."
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1649 (newsticker--group-get-subgroups newsticker-groups t))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1650
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1651 (defun newsticker--group-get-feeds (group &optional recursive)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1652 "Return list of all feeds in GROUP.
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1653 If RECURSIVE is non-nil recursively get feeds of subgroups and
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1654 return a nested list."
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1655 (let ((result nil))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1656 (mapc (lambda (n)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1657 (if (not (listp n))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1658 (setq result (cons n result))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1659 (if recursive
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1660 (let ((subfeeds (newsticker--group-get-feeds n t)))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1661 (when subfeeds
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1662 (setq result (append subfeeds result)))))))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1663 group)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1664 result))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1665
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1666 (defun newsticker-group-add-group (name parent)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1667 "Add group NAME to group PARENT."
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1668 (interactive
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1669 (list (read-string "Group Name: ")
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1670 (let ((completion-ignore-case t))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1671 (if newsticker-treeview-own-frame
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1672 (set-window-dedicated-p (newsticker--treeview-item-window) nil))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1673 (completing-read "Parent Group: " (newsticker--group-all-groups)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1674 nil t))))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1675 (if newsticker-treeview-own-frame
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1676 (set-window-dedicated-p (newsticker--treeview-item-window) t))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1677 (if (newsticker--group-get-group name)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1678 (error "Group %s exists already" name))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1679 (let ((p (if (and parent (not (string= parent "")))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1680 (newsticker--group-get-group parent)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1681 newsticker-groups)))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1682 (unless p
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1683 (error "Parent %s does not exist" parent))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1684 (setcdr p (cons (list name) (cdr p))))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1685 (newsticker--treeview-tree-update))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1686
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1687 (defun newsticker-group-move-feed (name group-name &optional no-update)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1688 "Move feed NAME to group GROUP-NAME.
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1689 Update teeview afterwards unless NO-UPDATE is non-nil."
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1690 (interactive
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1691 (let ((completion-ignore-case t))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1692 (if newsticker-treeview-own-frame
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1693 (set-window-dedicated-p (newsticker--treeview-item-window) nil))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1694 (list (completing-read "Feed Name: "
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1695 (mapcar 'car newsticker-url-list)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1696 nil t newsticker--treeview-current-feed)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1697 (completing-read "Group Name: " (newsticker--group-all-groups)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1698 nil t))))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1699 (if newsticker-treeview-own-frame
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1700 (set-window-dedicated-p (newsticker--treeview-item-window) t))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1701 (let ((group (if (and group-name (not (string= group-name "")))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1702 (newsticker--group-get-group group-name)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1703 newsticker-groups)))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1704 (unless group
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1705 (error "Group %s does not exist" group-name))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1706 (while (let ((old-group
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1707 (newsticker--group-find-group-for-feed name)))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1708 (when old-group
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1709 (delete name old-group))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1710 old-group))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1711 (setcdr group (cons name (cdr group)))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1712 (unless no-update
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1713 (newsticker--treeview-tree-update)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1714 (newsticker-treeview-update))))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1715
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1716 (defun newsticker-group-delete-group (name)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1717 "Remove group NAME."
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1718 (interactive
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1719 (let ((completion-ignore-case t))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1720 (if newsticker-treeview-own-frame
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1721 (set-window-dedicated-p (newsticker--treeview-item-window) nil))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1722 (list (completing-read "Group Name: " (newsticker--group-all-groups)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1723 nil t))))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1724 (if newsticker-treeview-own-frame
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1725 (set-window-dedicated-p (newsticker--treeview-item-window) t))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1726 (let* ((g (newsticker--group-get-group name))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1727 (p (or (newsticker--group-get-parent-group name)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1728 newsticker-groups)))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1729 (unless g
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1730 (error "Group %s does not exist" name))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1731 (delete g p))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1732 (newsticker--treeview-tree-update))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1733
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1734 (defun newsticker--count-groups (group)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1735 "Recursively count number of subgroups of GROUP."
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1736 (let ((result 1))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1737 (mapc (lambda (g)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1738 (if (listp g)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1739 (setq result (+ result (newsticker--count-groups g)))))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1740 (cdr group))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1741 result))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1742
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1743 (defun newsticker--count-grouped-feeds (group)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1744 "Recursively count number of feeds in GROUP and its subgroups."
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1745 (let ((result 0))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1746 (mapc (lambda (g)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1747 (if (listp g)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1748 (setq result (+ result (newsticker--count-grouped-feeds g)))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1749 (setq result (1+ result))))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1750 (cdr group))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1751 result))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1752
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1753 (defun newsticker--group-remove-obsolete-feeds (group)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1754 "Recursively remove obselete feeds from GROUP."
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1755 (let ((result nil)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1756 (urls (append newsticker-url-list newsticker-url-list-defaults)))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1757 (mapc (lambda (g)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1758 (if (listp g)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1759 (let ((sub-groups
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1760 (newsticker--group-remove-obsolete-feeds g)))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1761 (if sub-groups
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1762 (setq result (cons sub-groups result))))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1763 (if (assoc g urls)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1764 (setq result (cons g result)))))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1765 (cdr group))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1766 (if result
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1767 (cons (car group) (reverse result))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1768 result)))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1769
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1770 (defun newsticker--group-manage-orphan-feeds ()
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1771 "Put unmanaged feeds into `newsticker-groups'.
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1772 Remove obsolete feeds as well."
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1773 (let ((new-feed nil)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1774 (grouped-feeds (newsticker--count-grouped-feeds newsticker-groups)))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1775 (mapc (lambda (f)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1776 (unless (newsticker--group-find-group-for-feed (car f))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1777 (setq new-feed t)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1778 (newsticker-group-move-feed (car f) nil t)))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1779 (append newsticker-url-list-defaults newsticker-url-list))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1780 (setq newsticker-groups
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1781 (newsticker--group-remove-obsolete-feeds newsticker-groups))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1782 (if (or new-feed
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1783 (not (= grouped-feeds
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1784 (newsticker--count-grouped-feeds newsticker-groups))))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1785 (newsticker--treeview-tree-update))))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1786
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1787 ;; ======================================================================
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1788 ;;; Modes
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1789 ;; ======================================================================
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1790 (defun newsticker--treeview-create-groups-menu (group-list
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1791 excluded-group)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1792 "Create menu for GROUP-LIST omitting EXCLUDED-GROUP."
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1793 (let ((menu (make-sparse-keymap (if (stringp (car group-list))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1794 (car group-list)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1795 "Move to group..."))))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1796 (mapc (lambda (g)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1797 (when (listp g)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1798 (let ((title (if (stringp (car g))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1799 (car g)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1800 "Move to group...")))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1801 (unless (eq g excluded-group)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1802 (define-key menu (vector (intern title))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1803 (list 'menu-item title
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1804 (newsticker--treeview-create-groups-menu
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1805 (cdr g) excluded-group)))))))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1806 (reverse group-list))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1807 menu))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1808
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1809 (defun newsticker--treeview-create-tree-menu (feed-name)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1810 "Create tree menu for FEED-NAME."
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1811 (let ((menu (make-sparse-keymap feed-name)))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1812 (define-key menu [newsticker-treeview-mark-list-items-old]
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1813 (list 'menu-item "Mark all items old"
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1814 'newsticker-treeview-mark-list-items-old))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1815 (define-key menu [move]
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1816 (list 'menu-item "Move to group..."
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1817 (newsticker--treeview-create-groups-menu
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1818 newsticker-groups
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1819 (newsticker--group-get-group feed-name))))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1820 menu))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1821
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1822 ;;(makunbound 'newsticker-treeview-list-menu) ;FIXME
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1823 (defvar newsticker-treeview-list-menu
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1824 (let ((menu (make-sparse-keymap "Newsticker List")))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1825 (define-key menu [newsticker-treeview-mark-list-items-old]
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1826 (list 'menu-item "Mark all items old"
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1827 'newsticker-treeview-mark-list-items-old))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1828 menu)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1829 "Map for newsticker tree menu.")
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1830
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1831 ;;(makunbound 'newsticker-treeview-mode-map) ;FIXME
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1832 (defvar newsticker-treeview-mode-map
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1833 (let ((map (make-sparse-keymap 'newsticker-treeview-mode-map)))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1834 (define-key map " " 'newsticker-treeview-next-page)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1835 (define-key map "a" 'newsticker-add-url)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1836 (define-key map "F" 'newsticker-treeview-prev-feed)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1837 (define-key map "f" 'newsticker-treeview-next-feed)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1838 (define-key map "g" 'newsticker-treeview-get-news)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1839 (define-key map "G" 'newsticker-get-all-news)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1840 (define-key map "i" 'newsticker-treeview-toggle-item-immortal)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1841 (define-key map "j" 'newsticker-treeview-jump)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1842 (define-key map "n" 'newsticker-treeview-next-item)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1843 (define-key map "N" 'newsticker-treeview-next-new-or-immortal-item)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1844 (define-key map "O" 'newsticker-treeview-mark-list-items-old)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1845 (define-key map "o" 'newsticker-treeview-mark-item-old)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1846 (define-key map "p" 'newsticker-treeview-prev-item)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1847 (define-key map "P" 'newsticker-treeview-prev-new-or-immortal-item)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1848 (define-key map "q" 'newsticker-treeview-quit)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1849 (define-key map "S" 'newsticker-treeview-save-item)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1850 (define-key map "s" 'newsticker-treeview-save)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1851 (define-key map "u" 'newsticker-treeview-update)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1852 (define-key map "v" 'newsticker-treeview-browse-url)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1853 ;;(define-key map "\n" 'newsticker-treeview-scroll-item)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1854 ;;(define-key map "\C-m" 'newsticker-treeview-scroll-item)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1855 (define-key map "\M-m" 'newsticker-group-move-feed)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1856 (define-key map "\M-a" 'newsticker-group-add-group)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1857 map)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1858 "Mode map for newsticker treeview.")
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1859
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1860 (defun newsticker-treeview-mode ()
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1861 "Major mode for Newsticker Treeview.
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1862 \\{newsticker-treeview-mode-map}"
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1863 (kill-all-local-variables)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1864 (use-local-map newsticker-treeview-mode-map)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1865 (setq major-mode 'newsticker-treeview-mode)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1866 (setq mode-name "Newsticker TV")
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1867 (if (boundp 'tool-bar-map)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1868 (set (make-local-variable 'tool-bar-map)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1869 newsticker-treeview-tool-bar-map))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1870 (setq buffer-read-only t
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1871 truncate-lines t))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1872
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1873 ;;(makunbound 'newsticker-treeview-list-mode-map);FIXME
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1874 (define-derived-mode newsticker-treeview-list-mode newsticker-treeview-mode
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1875 "Item List"
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1876 (let ((header (concat
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1877 (propertize " " 'display '(space :align-to 0))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1878 (newsticker-treeview-list-make-sort-button "*" 'sort-by-age)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1879 (propertize " " 'display '(space :align-to 2))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1880 (if newsticker--treeview-list-show-feed
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1881 (concat "Feed"
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1882 (propertize " " 'display '(space :align-to 12)))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1883 "")
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1884 (newsticker-treeview-list-make-sort-button "Date"
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1885 'sort-by-time)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1886 (if newsticker--treeview-list-show-feed
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1887 (propertize " " 'display '(space :align-to 28))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1888 (propertize " " 'display '(space :align-to 18)))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1889 (newsticker-treeview-list-make-sort-button "Title"
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1890 'sort-by-title))))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1891 (setq header-line-format header))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1892 (define-key newsticker-treeview-list-mode-map [down-mouse-3]
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1893 newsticker-treeview-list-menu))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1894
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1895 (defun newsticker-treeview-tree-click (event)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1896 "Handle click EVENT on a tag in the newsticker tree."
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1897 (interactive "e")
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1898 (save-excursion
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1899 (switch-to-buffer (window-buffer (posn-window (event-end event))))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1900 (newsticker-treeview-tree-do-click (posn-point (event-end event)))))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1901
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1902 (defun newsticker-treeview-tree-do-click (&optional pos event)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1903 "Actually handle click event.
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1904 POS gives the position where EVENT occurred."
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1905 (interactive)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1906 (unless pos (setq pos (point)))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1907 (let ((pos (or pos (point)))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1908 (nt-id (get-text-property pos :nt-id))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1909 (item (get-text-property pos :nt-item)))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1910 (cond (item
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1911 ;; click in list buffer
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1912 (newsticker-treeview-show-item))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1913 (t
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1914 ;; click in tree buffer
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1915 (let ((w (newsticker--treeview-get-node nt-id)))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1916 (when w
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1917 (newsticker--treeview-tree-update-tag w t t)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1918 (setq w (newsticker--treeview-get-node nt-id))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1919 (widget-put w :nt-selected t)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1920 (widget-apply w :action event)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1921 (newsticker--treeview-set-current-node w))))))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1922 (newsticker--treeview-tree-update-highlight))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1923
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1924 (defun newsticker--treeview-restore-buffers ()
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1925 "Restore treeview buffers."
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1926 (catch 'error
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1927 (dotimes (i 3)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1928 (let ((win (nth i newsticker--treeview-windows))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1929 (buf (nth i newsticker--treeview-buffers)))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1930 (unless (window-live-p win)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1931 (newsticker--treeview-window-init)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1932 (newsticker--treeview-buffer-init)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1933 (throw 'error t))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1934 (unless (eq (window-buffer win) buf)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1935 (set-window-buffer win buf t))))))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1936
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1937 (defun newsticker--treeview-frame-init ()
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1938 "Initialize treeview frame."
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1939 (when newsticker-treeview-own-frame
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1940 (unless (and newsticker--frame (frame-live-p newsticker--frame))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1941 (setq newsticker--frame (make-frame '((name . "Newsticker")))))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1942 (select-frame-set-input-focus newsticker--frame)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1943 (raise-frame newsticker--frame)))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1944
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1945 (defun newsticker--treeview-window-init ()
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1946 "Initialize treeview windows."
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1947 (setq newsticker--saved-window-config (current-window-configuration))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1948 (setq newsticker--treeview-windows nil)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1949 (setq newsticker--treeview-buffers nil)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1950 (delete-other-windows)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1951 (split-window-horizontally 25)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1952 (add-to-list 'newsticker--treeview-windows (selected-window) t)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1953 (other-window 1)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1954 (split-window-vertically 10)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1955 (add-to-list 'newsticker--treeview-windows (selected-window) t)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1956 (other-window 1)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1957 (add-to-list 'newsticker--treeview-windows (selected-window) t)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1958 (other-window 1))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1959
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1960 ;;;###autoload
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1961 (defun newsticker-treeview ()
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1962 "Start newsticker treeview."
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1963 (interactive)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1964 (newsticker--treeview-load)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1965 (setq newsticker--sentinel-callback 'newsticker-treeview-update)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1966 (newsticker--treeview-frame-init)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1967 (newsticker--treeview-window-init)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1968 (newsticker--treeview-buffer-init)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1969 (newsticker--group-manage-orphan-feeds)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1970 (if newsticker--window-config
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1971 (set-window-configuration newsticker--window-config))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1972 (newsticker--treeview-set-current-node newsticker--treeview-feed-tree)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1973 (newsticker-start t) ;; will start only if not running
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1974 (newsticker-treeview-update)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1975 (newsticker--treeview-item-show-text
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1976 "Newsticker"
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1977 "Welcome to newsticker!"))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1978
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1979 (defun newsticker-treeview-get-news ()
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1980 "Get news for current feed."
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1981 (interactive)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1982 (when newsticker--treeview-current-feed
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1983 (newsticker-get-news newsticker--treeview-current-feed)))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1984
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1985 (provide 'newsticker-treeview)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1986
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1987 ;; arch-tag: 5dbaff48-1f3e-4fc6-8ebd-e966fc90d2d4
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1988 ;;; newst-treeview.el ends here