Mercurial > emacs
annotate lisp/net/newst-backend.el @ 110407:e9bd1f306e02
Add xml.o dependencies to deps.mk.
deps.mk (xml.o): Add dependencies.
author | Eli Zaretskii <eliz@gnu.org> |
---|---|
date | Sat, 18 Sep 2010 16:09:40 +0200 |
parents | 280c8ae2476d |
children | 417b1e4d63cd |
rev | line source |
---|---|
95901
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1 ;;; newst-backend.el --- Retrieval backend for newsticker. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2 |
106815 | 3 ;; Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 |
95901
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
4 ;; Free Software Foundation, Inc. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
5 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
6 ;; Author: Ulf Jasper <ulf.jasper@web.de> |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
7 ;; Filename: newst-backend.el |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
8 ;; URL: http://www.nongnu.org/newsticker |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
9 ;; Keywords: News, RSS, Atom |
106460 | 10 ;; Time-stamp: "6. Dezember 2009, 19:15:32 (ulf)" |
110015
280c8ae2476d
Add "Package:" file headers to denote built-in packages.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
11 ;; Package: newsticker |
95901
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 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
15 ;; This file is part of GNU Emacs. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
16 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
17 ;; 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
|
18 ;; 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
|
19 ;; 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
|
20 ;; (at your option) any later version. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
21 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
22 ;; 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
|
23 ;; 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
|
24 ;; 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
|
25 ;; GNU General Public License for more details. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
26 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
27 ;; 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
|
28 ;; 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
|
29 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
30 ;; ====================================================================== |
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 ;;; Commentary: |
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 ;; See newsticker.el |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
35 |
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 ;;; Code: |
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 (require 'derived) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
40 (require 'xml) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
41 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
42 ;; Silence warnings |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
43 (defvar w3-mode-map) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
44 (defvar w3m-minor-mode-map) |
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 (defvar newsticker--retrieval-timer-list nil |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
48 "List of timers for news retrieval. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
49 This is an alist, each element consisting of (feed-name . timer).") |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
50 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
51 (defvar newsticker--download-logos nil |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
52 "If non-nil download feed logos if available.") |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
53 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
54 (defvar newsticker--sentinel-callback nil |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
55 "Function called at end of `newsticker--sentinel'.") |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
56 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
57 ;;;###autoload |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
58 (defun newsticker-running-p () |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
59 "Check whether newsticker is running. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
60 Return t if newsticker is running, nil otherwise. Newsticker is |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
61 considered to be running if the newsticker timer list is not empty." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
62 (> (length newsticker--retrieval-timer-list) 0)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
63 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
64 ;; ====================================================================== |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
65 ;;; Customization |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
66 ;; ====================================================================== |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
67 (defgroup newsticker nil |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
68 "Aggregator for RSS and Atom feeds." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
69 :group 'applications) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
70 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
71 (defconst newsticker--raw-url-list-defaults |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
72 '(("CNET News.com" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
73 "http://export.cnet.com/export/feeds/news/rss/1,11176,,00.xml") |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
74 ("Debian Security Advisories" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
75 "http://www.debian.org/security/dsa.en.rdf") |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
76 ("Debian Security Advisories - Long format" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
77 "http://www.debian.org/security/dsa-long.en.rdf") |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
78 ("Emacs Wiki" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
79 "http://www.emacswiki.org/cgi-bin/wiki.pl?action=rss" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
80 nil |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
81 3600) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
82 ("Freshmeat.net" |
104136
a951b4e69c77
* net/newst-backend.el (newsticker--raw-url-list-defaults): Update
Chong Yidong <cyd@stupidchicken.com>
parents:
104029
diff
changeset
|
83 "http://freshmeat.net/index.atom") |
95901
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
84 ("Kuro5hin.org" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
85 "http://www.kuro5hin.org/backend.rdf") |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
86 ("LWN (Linux Weekly News)" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
87 "http://lwn.net/headlines/rss") |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
88 ("NY Times: Technology" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
89 "http://partners.userland.com/nytRss/technology.xml") |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
90 ("NY Times" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
91 "http://partners.userland.com/nytRss/nytHomepage.xml") |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
92 ("Quote of the day" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
93 "http://www.quotationspage.com/data/qotd.rss" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
94 "07:00" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
95 86400) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
96 ("The Register" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
97 "http://www.theregister.co.uk/tonys/slashdot.rdf") |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
98 ("slashdot" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
99 "http://slashdot.org/index.rss" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
100 nil |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
101 3600) ;/. will ban you if under 3600 seconds! |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
102 ("Wired News" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
103 "http://www.wired.com/news_drop/netcenter/netcenter.rdf") |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
104 ("Heise News (german)" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
105 "http://www.heise.de/newsticker/heise.rdf") |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
106 ("Tagesschau (german)" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
107 "http://www.tagesschau.de/newsticker.rdf" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
108 nil |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
109 1800) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
110 ("Telepolis (german)" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
111 "http://www.heise.de/tp/news.rdf")) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
112 "Default URL list in raw form. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
113 This list is fed into defcustom via `newsticker--splicer'.") |
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 (defun newsticker--splicer (item) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
116 "Convert ITEM for splicing into `newsticker-url-list-defaults'." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
117 (let ((result (list 'list :tag (nth 0 item) (list 'const (nth 0 item)))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
118 (element (cdr item))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
119 (while element |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
120 (setq result (append result (list (list 'const (car element))))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
121 (setq element (cdr element))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
122 result)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
123 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
124 (defun newsticker--set-customvar-retrieval (symbol value) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
125 "Set retrieval related newsticker-variable SYMBOL value to VALUE. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
126 Calls all actions which are necessary in order to make the new |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
127 value effective." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
128 (if (or (not (boundp symbol)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
129 (equal (symbol-value symbol) value)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
130 (set symbol value) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
131 ;; something must have changed |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
132 (let ((need-restart nil) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
133 (new-or-changed-feeds nil) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
134 (removed-feeds)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
135 (cond ((eq symbol 'newsticker-retrieval-interval) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
136 (setq need-restart t)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
137 ((memq symbol '(newsticker-url-list-defaults newsticker-url-list)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
138 (dolist (elt value) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
139 (unless (member elt (symbol-value symbol)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
140 (setq new-or-changed-feeds (cons elt new-or-changed-feeds)))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
141 (dolist (elt (symbol-value symbol)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
142 (unless (member elt value) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
143 (setq removed-feeds (cons elt removed-feeds)))))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
144 (cond (need-restart |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
145 (set symbol value) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
146 (when (newsticker-running-p) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
147 (message "Restarting newsticker") |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
148 (newsticker-stop) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
149 (newsticker-start))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
150 (t |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
151 (dolist (feed removed-feeds) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
152 (message "Stopping feed `%s'" (car feed)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
153 (newsticker--stop-feed (car feed))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
154 (dolist (feed new-or-changed-feeds) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
155 (message "Starting feed `%s'" (car feed)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
156 (newsticker--stop-feed (car feed)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
157 (newsticker--start-feed feed)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
158 (unless new-or-changed-feeds |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
159 (when newsticker--sentinel-callback |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
160 (funcall newsticker--sentinel-callback))))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
161 (set symbol value)))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
162 |
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 ;; retrieval |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
165 (defgroup newsticker-retrieval nil |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
166 "Settings for news retrieval." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
167 :group 'newsticker) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
168 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
169 (defcustom newsticker-url-list-defaults |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
170 '(("Emacs Wiki" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
171 "http://www.emacswiki.org/cgi-bin/wiki.pl?action=rss" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
172 nil |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
173 3600)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
174 "A customizable list of news feeds to select from. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
175 These were mostly extracted from the Radio Community Server at |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
176 http://subhonker6.userland.com/rcsPublic/rssHotlist. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
177 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
178 You may add other entries in `newsticker-url-list'." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
179 :type `(set ,@(mapcar `newsticker--splicer |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
180 newsticker--raw-url-list-defaults)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
181 :set 'newsticker--set-customvar-retrieval |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
182 :group 'newsticker-retrieval) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
183 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
184 (defcustom newsticker-url-list nil |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
185 "The news feeds which you like to watch. |
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 This alist will be used in addition to selection made customizing |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
188 `newsticker-url-list-defaults'. |
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 This is an alist. Each element consists of two items: a LABEL and a URL, |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
191 optionally followed by a START-TIME, INTERVAL specifier and WGET-ARGUMENTS. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
192 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
193 The LABEL gives the name of the news feed. It can be an arbitrary string. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
194 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
195 The URL gives the location of the news feed. It must point to a valid |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
196 RSS or Atom file. The file is retrieved by calling wget, or whatever you |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
197 specify as `newsticker-wget-name'. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
198 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
199 URL may also be a function which returns news data. In this case |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
200 `newsticker-retrieval-method' etc. are ignored for this feed. |
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 The START-TIME can be either a string, or nil. If it is a string it |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
203 specifies a fixed time at which this feed shall be retrieved for the |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
204 first time. (Examples: \"11:00pm\", \"23:00\".) If it is nil (or |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
205 unspecified), this feed will be retrieved immediately after calling |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
206 `newsticker-start'. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
207 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
208 The INTERVAL specifies the time between retrievals for this feed. If it |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
209 is nil (or unspecified) the default interval value as set in |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
210 `newsticker-retrieval-interval' is used. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
211 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
212 \(newsticker.el calls `run-at-time'. The newsticker-parameters START-TIME |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
213 and INTERVAL correspond to the `run-at-time'-parameters TIME and REPEAT.) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
214 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
215 WGET-ARGUMENTS specifies arguments for wget (see `newsticker-wget-name') |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
216 which apply for this feed only, overriding the value of |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
217 `newsticker-wget-arguments'." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
218 :type '(repeat (list :tag "News feed" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
219 (string :tag "Label") |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
220 (choice :tag "URI" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
221 (string :tag "String") |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
222 (function :tag "Function")) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
223 (choice :tag "Start" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
224 (const :tag "Default" nil) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
225 (string :tag "Fixed Time")) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
226 (choice :tag "Interval" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
227 (const :tag "Default" nil) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
228 (const :tag "Hourly" 3600) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
229 (const :tag "Daily" 86400) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
230 (const :tag "Weekly" 604800) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
231 (integer :tag "Interval")) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
232 (choice :tag "Wget Arguments" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
233 (const :tag "Default arguments" nil) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
234 (repeat :tag "Special arguments" string)))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
235 :set 'newsticker--set-customvar-retrieval |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
236 :group 'newsticker-retrieval) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
237 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
238 (defcustom newsticker-retrieval-method |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
239 'intern |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
240 "Method for retrieving news from the web, either `intern' or `extern'. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
241 Default value `intern' uses Emacs' built-in asynchronous download |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
242 capabilities ('url-retrieve'). If set to `extern' the external |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
243 program wget is used, see `newsticker-wget-name'." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
244 :type '(choice :tag "Method" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
245 (const :tag "Intern" intern) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
246 (const :tag "Extern" extern)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
247 :group 'newsticker-retrieval) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
248 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
249 (defcustom newsticker-wget-name |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
250 "wget" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
251 "Name of the program which is called to retrieve news from the web. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
252 The canonical choice is wget but you may take any other program which is |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
253 able to return the contents of a news feed file on stdout." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
254 :type 'string |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
255 :group 'newsticker-retrieval) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
256 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
257 (defcustom newsticker-wget-arguments |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
258 '("-q" "-O" "-") |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
259 "Arguments which are passed to wget. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
260 There is probably no reason to change the default settings, unless you |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
261 are living behind a firewall." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
262 :type '(repeat (string :tag "Argument")) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
263 :group 'newsticker-retrieval) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
264 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
265 (defcustom newsticker-retrieval-interval |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
266 3600 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
267 "Time interval for retrieving new news items (seconds). |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
268 If this value is not positive (i.e. less than or equal to 0) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
269 items are retrieved only once! |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
270 Please note that some feeds, e.g. Slashdot, will ban you if you |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
271 make it less than 1800 seconds (30 minutes)!" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
272 :type '(choice :tag "Interval" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
273 (const :tag "No automatic retrieval" 0) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
274 (const :tag "Hourly" 3600) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
275 (const :tag "Daily" 86400) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
276 (const :tag "Weekly" 604800) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
277 (integer :tag "Interval")) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
278 :set 'newsticker--set-customvar-retrieval |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
279 :group 'newsticker-retrieval) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
280 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
281 (defcustom newsticker-desc-comp-max |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
282 100 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
283 "Relevant length of headline descriptions. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
284 This value gives the maximum number of characters which will be |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
285 taken into account when newsticker compares two headline |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
286 descriptions." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
287 :type 'integer |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
288 :group 'newsticker-retrieval) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
289 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
290 ;; ====================================================================== |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
291 ;; headline processing |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
292 (defgroup newsticker-headline-processing nil |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
293 "Settings for the automatic processing of headlines." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
294 :group 'newsticker) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
295 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
296 (defcustom newsticker-automatically-mark-items-as-old |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
297 t |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
298 "Decides whether to automatically mark items as old. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
299 If t a new item is considered as new only after its first retrieval. As |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
300 soon as it is retrieved a second time, it becomes old. If not t all |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
301 items stay new until you mark them as old. This is done in the |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
302 *newsticker* buffer." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
303 :type 'boolean |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
304 :group 'newsticker-headline-processing) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
305 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
306 (defcustom newsticker-automatically-mark-visited-items-as-old |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
307 t |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
308 "Decides whether to automatically mark visited items as old. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
309 If t an item is marked as old as soon as the associated link is |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
310 visited, i.e. after pressing RET or mouse2 on the item's |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
311 headline." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
312 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
313 :type 'boolean |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
314 :group 'newsticker-headline-processing) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
315 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
316 (defcustom newsticker-keep-obsolete-items |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
317 t |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
318 "Decides whether to keep unread items which have been removed from feed. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
319 If t a new item, which has been removed from the feed, is kept in |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
320 the cache until it is marked as read." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
321 :type 'boolean |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
322 :group 'newsticker-headline-processing) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
323 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
324 (defcustom newsticker-obsolete-item-max-age |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
325 (* 60 60 24) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
326 "Maximal age of obsolete items, in seconds. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
327 Obsolete items which are older than this value will be silently |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
328 deleted at the next retrieval." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
329 :type 'integer |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
330 :group 'newsticker-headline-processing) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
331 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
332 (defcustom newsticker-auto-mark-filter-list |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
333 nil |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
334 "A list of filters for automatically marking headlines. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
335 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
336 This is an alist of the form (FEED-NAME PATTERN-LIST). I.e. each |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
337 element consists of a FEED-NAME a PATTERN-LIST. Each element of |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
338 the pattern-list has the form (AGE TITLE-OR-DESCRIPTION REGEXP). |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
339 AGE must be one of the symbols 'old or 'immortal. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
340 TITLE-OR-DESCRIPTION must be on of the symbols 'title, |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
341 'description, or 'all. REGEXP is a regular expression, i.e. a |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
342 string. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
343 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
344 This filter is checked after a new headline has been retrieved. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
345 If FEED-NAME matches the name of the corresponding news feed, the |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
346 pattern-list is checked: The new headline will be marked as AGE |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
347 if REGEXP matches the headline's TITLE-OR-DESCRIPTION. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
348 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
349 If, for example, `newsticker-auto-mark-filter-list' looks like |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
350 \((slashdot ('old 'title \"^Forget me!$\") ('immortal 'title \"Read me\") |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
351 \('immortal 'all \"important\")))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
352 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
353 then all articles from slashdot are marked as old if they have |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
354 the title \"Forget me!\". All articles with a title containing |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
355 the string \"Read me\" are marked as immortal. All articles which |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
356 contain the string \"important\" in their title or their |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
357 description are marked as immortal." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
358 :type '(repeat (list :tag "Auto mark filter" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
359 (string :tag "Feed name") |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
360 (repeat |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
361 (list :tag "Filter element" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
362 (choice |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
363 :tag "Auto-assigned age" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
364 (const :tag "Old" old) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
365 (const :tag "Immortal" immortal)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
366 (choice |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
367 :tag "Title/Description" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
368 (const :tag "Title" title) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
369 (const :tag "Description" description) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
370 (const :tag "All" all)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
371 (string :tag "Regexp"))))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
372 :group 'newsticker-headline-processing) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
373 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
374 ;; ====================================================================== |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
375 ;; hooks |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
376 (defgroup newsticker-hooks nil |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
377 "Settings for newsticker hooks." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
378 :group 'newsticker) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
379 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
380 (defcustom newsticker-start-hook |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
381 nil |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
382 "Hook run when starting newsticker. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
383 This hook is run at the very end of `newsticker-start'." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
384 :options '(newsticker-start-ticker) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
385 :type 'hook |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
386 :group 'newsticker-hooks) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
387 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
388 (defcustom newsticker-stop-hook |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
389 nil |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
390 "Hook run when stopping newsticker. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
391 This hook is run at the very end of `newsticker-stop'." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
392 :options nil |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
393 :type 'hook |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
394 :group 'newsticker-hooks) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
395 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
396 (defcustom newsticker-new-item-functions |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
397 nil |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
398 "List of functions run after a new headline has been retrieved. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
399 Each function is called with the following three arguments: |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
400 FEED the name of the corresponding news feed, |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
401 TITLE the title of the headline, |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
402 DESC the decoded description of the headline. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
403 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
404 See `newsticker-download-images', and |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
405 `newsticker-download-enclosures' for sample functions. |
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 Please note that these functions are called only once for a |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
408 headline after it has been retrieved for the first time." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
409 :type 'hook |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
410 :options '(newsticker-download-images |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
411 newsticker-download-enclosures) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
412 :group 'newsticker-hooks) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
413 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
414 ;; ====================================================================== |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
415 ;; miscellaneous |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
416 (defgroup newsticker-miscellaneous nil |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
417 "Miscellaneous newsticker settings." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
418 :group 'newsticker) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
419 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
420 (defcustom newsticker-cache-filename |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
421 "~/.newsticker-cache" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
422 "Name of the newsticker cache file." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
423 :type 'string |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
424 :group 'newsticker-miscellaneous) |
104395
df3d3d6c4426
* net/newst-treeview.el (newsticker-groups-filename):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
104136
diff
changeset
|
425 (make-obsolete 'newsticker-cache-filename 'newsticker-dir "23.1") |
95901
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
426 |
99885
7161bac8c5a8
newsticker: cache file redesign.
Ulf Jasper <ulf.jasper@web.de>
parents:
99287
diff
changeset
|
427 (defcustom newsticker-dir |
100492
afc7ba4fff7a
newsticker: fixed problem with missing group definition
Ulf Jasper <ulf.jasper@web.de>
parents:
99885
diff
changeset
|
428 (locate-user-emacs-file "newsticker/" ".newsticker/") |
afc7ba4fff7a
newsticker: fixed problem with missing group definition
Ulf Jasper <ulf.jasper@web.de>
parents:
99885
diff
changeset
|
429 "Directory where newsticker saves data." |
afc7ba4fff7a
newsticker: fixed problem with missing group definition
Ulf Jasper <ulf.jasper@web.de>
parents:
99885
diff
changeset
|
430 :type 'directory |
95901
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
431 :group 'newsticker-miscellaneous) |
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 ;; debugging |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
434 (defcustom newsticker-debug |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
435 nil |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
436 "Enables some features needed for debugging newsticker.el. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
437 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
438 If set to t newsticker.el will print lots of debugging messages, and the |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
439 buffers *newsticker-wget-<feed>* will not be closed." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
440 :type 'boolean |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
441 :group 'newsticker-miscellaneous) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
442 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
443 ;; ====================================================================== |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
444 ;;; Compatibility section, XEmacs, Emacs |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
445 ;; ====================================================================== |
104797
cfe03355665f
(time-add): Suppress warnings from compat function.
Glenn Morris <rgm@gnu.org>
parents:
104395
diff
changeset
|
446 |
cfe03355665f
(time-add): Suppress warnings from compat function.
Glenn Morris <rgm@gnu.org>
parents:
104395
diff
changeset
|
447 ;; FIXME It is bad practice to define compat functions with such generic names. |
cfe03355665f
(time-add): Suppress warnings from compat function.
Glenn Morris <rgm@gnu.org>
parents:
104395
diff
changeset
|
448 |
cfe03355665f
(time-add): Suppress warnings from compat function.
Glenn Morris <rgm@gnu.org>
parents:
104395
diff
changeset
|
449 ;; This is not needed in Emacs >= 22.1. |
95901
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
450 (unless (fboundp 'time-add) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
451 (require 'time-date);;FIXME |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
452 (defun time-add (t1 t2) |
104797
cfe03355665f
(time-add): Suppress warnings from compat function.
Glenn Morris <rgm@gnu.org>
parents:
104395
diff
changeset
|
453 (with-no-warnings ; don't warn about obsolete time-to-seconds in 23.2 |
cfe03355665f
(time-add): Suppress warnings from compat function.
Glenn Morris <rgm@gnu.org>
parents:
104395
diff
changeset
|
454 (seconds-to-time (+ (time-to-seconds t1) (time-to-seconds t2)))))) |
95901
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
455 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
456 (unless (fboundp 'match-string-no-properties) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
457 (defalias 'match-string-no-properties 'match-string)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
458 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
459 (when (featurep 'xemacs) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
460 (unless (fboundp 'replace-regexp-in-string) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
461 (defun replace-regexp-in-string (re rp st) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
462 (save-match-data ;; apparently XEmacs needs save-match-data |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
463 (replace-in-string st re rp))))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
464 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
465 ;; copied from subr.el |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
466 (unless (fboundp 'add-to-invisibility-spec) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
467 (defun add-to-invisibility-spec (arg) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
468 "Add elements to `buffer-invisibility-spec'. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
469 See documentation for `buffer-invisibility-spec' for the kind of elements |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
470 that can be added." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
471 (if (eq buffer-invisibility-spec t) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
472 (setq buffer-invisibility-spec (list t))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
473 (setq buffer-invisibility-spec |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
474 (cons arg buffer-invisibility-spec)))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
475 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
476 ;; copied from subr.el |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
477 (unless (fboundp 'remove-from-invisibility-spec) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
478 (defun remove-from-invisibility-spec (arg) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
479 "Remove elements from `buffer-invisibility-spec'." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
480 (if (consp buffer-invisibility-spec) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
481 (setq buffer-invisibility-spec |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
482 (delete arg buffer-invisibility-spec))))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
483 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
484 ;; ====================================================================== |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
485 ;;; Internal variables |
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 (defvar newsticker--item-list nil |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
488 "List of newsticker items.") |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
489 (defvar newsticker--item-position 0 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
490 "Actual position in list of newsticker items.") |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
491 (defvar newsticker--prev-message "There was no previous message yet!" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
492 "Last message that the newsticker displayed.") |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
493 (defvar newsticker--scrollable-text "" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
494 "The text which is scrolled smoothly in the echo area.") |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
495 (defvar newsticker--buffer-uptodate-p nil |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
496 "Tells whether the newsticker buffer is up to date.") |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
497 (defvar newsticker--latest-update-time (current-time) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
498 "The time at which the latest news arrived.") |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
499 (defvar newsticker--process-ids nil |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
500 "List of PIDs of active newsticker processes.") |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
501 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
502 (defvar newsticker--cache nil "Cached newsticker data. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
503 This is a list of the form |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
504 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
505 ((label1 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
506 (title description link time age index preformatted-contents |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
507 preformatted-title extra-elements) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
508 ...) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
509 (label2 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
510 (title description link time age index preformatted-contents |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
511 preformatted-title extra-elements) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
512 ...) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
513 ...) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
514 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
515 where LABEL is a symbol. TITLE, DESCRIPTION, and LINK are |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
516 strings. TIME is a time value as returned by `current-time'. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
517 AGE is a symbol: 'new, 'old, 'immortal, and 'obsolete denote |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
518 ordinary news items, whereas 'feed denotes an item which is not a |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
519 headline but describes the feed itself. INDEX denotes the |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
520 original position of the item -- used for restoring the original |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
521 order. PREFORMATTED-CONTENTS and PREFORMATTED-TITLE hold the |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
522 formatted contents of the item's description and title. This |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
523 speeds things up if HTML rendering is used, which is rather |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
524 slow. EXTRA-ELEMENTS is an alist containing additional elements.") |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
525 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
526 (defvar newsticker--auto-narrow-to-feed nil |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
527 "Automatically narrow to current news feed. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
528 If non-nil only the items of the current news feed are visible.") |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
529 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
530 (defvar newsticker--auto-narrow-to-item nil |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
531 "Automatically narrow to current news item. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
532 If non-nil only the current headline is visible.") |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
533 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
534 (defconst newsticker--error-headline |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
535 "[COULD NOT DOWNLOAD HEADLINES!]" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
536 "Title of error headline which will be inserted if news retrieval fails.") |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
537 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
538 ;; ====================================================================== |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
539 ;;; Shortcuts |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
540 ;; ====================================================================== |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
541 (defsubst newsticker--title (item) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
542 "Return title of ITEM." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
543 (nth 0 item)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
544 (defsubst newsticker--desc (item) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
545 "Return description of ITEM." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
546 (nth 1 item)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
547 (defsubst newsticker--link (item) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
548 "Return link of ITEM." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
549 (nth 2 item)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
550 (defsubst newsticker--time (item) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
551 "Return time of ITEM." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
552 (nth 3 item)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
553 (defsubst newsticker--age (item) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
554 "Return age of ITEM." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
555 (nth 4 item)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
556 (defsubst newsticker--pos (item) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
557 "Return position/index of ITEM." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
558 (nth 5 item)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
559 (defsubst newsticker--preformatted-contents (item) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
560 "Return pre-formatted text of ITEM." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
561 (nth 6 item)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
562 (defsubst newsticker--preformatted-title (item) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
563 "Return pre-formatted title of ITEM." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
564 (nth 7 item)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
565 (defsubst newsticker--extra (item) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
566 "Return extra attributes of ITEM." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
567 (nth 8 item)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
568 (defsubst newsticker--guid-to-string (guid) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
569 "Return string representation of GUID." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
570 (if (stringp guid) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
571 guid |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
572 (car (xml-node-children guid)))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
573 (defsubst newsticker--guid (item) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
574 "Return guid of ITEM." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
575 (newsticker--guid-to-string (assoc 'guid (newsticker--extra item)))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
576 (defsubst newsticker--enclosure (item) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
577 "Return enclosure element of ITEM in the form \(...FIXME...\) or nil." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
578 (let ((enclosure (assoc 'enclosure (newsticker--extra item)))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
579 (if enclosure |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
580 (xml-node-attributes enclosure)))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
581 (defun newsticker--real-feed-name (feed) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
582 "Return real name of FEED." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
583 (catch 'name |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
584 (mapc (lambda (item) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
585 (if (eq (newsticker--age item) 'feed) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
586 (throw 'name (newsticker--title item)))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
587 (cdr (newsticker--cache-get-feed feed))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
588 (symbol-name feed))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
589 |
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 ;; ====================================================================== |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
592 ;;; User fun |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
593 ;; ====================================================================== |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
594 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
595 (defun newsticker--start-feed (feed &optional do-not-complain-if-running) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
596 "Start retrieval timer for FEED. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
597 If timer is running already a warning message is printed unless |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
598 DO-NOT-COMPLAIN-IF-RUNNING is not nil. Add the started |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
599 name/timer pair to `newsticker--retrieval-timer-list'." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
600 (let* ((feed-name (car feed)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
601 (start-time (nth 2 feed)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
602 (interval (or (nth 3 feed) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
603 newsticker-retrieval-interval)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
604 (timer (assoc (car feed) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
605 newsticker--retrieval-timer-list))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
606 (if timer |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
607 (or do-not-complain-if-running |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
608 (message "Timer for %s is running already!" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
609 feed-name)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
610 (newsticker--debug-msg "Starting timer for %s: %s, %d" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
611 feed-name start-time interval) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
612 ;; do not repeat retrieval if interval not positive |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
613 (if (<= interval 0) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
614 (setq interval nil)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
615 ;; Suddenly XEmacs doesn't like start-time 0 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
616 (if (or (not start-time) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
617 (and (numberp start-time) (= start-time 0))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
618 (setq start-time 1)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
619 ;; (message "start-time %s" start-time) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
620 (setq timer (run-at-time start-time interval |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
621 'newsticker-get-news feed-name)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
622 (if interval |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
623 (add-to-list 'newsticker--retrieval-timer-list |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
624 (cons feed-name timer)))))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
625 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
626 ;;;###autoload |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
627 (defun newsticker-start (&optional do-not-complain-if-running) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
628 "Start the newsticker. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
629 Start the timers for display and retrieval. If the newsticker, i.e. the |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
630 timers, are running already a warning message is printed unless |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
631 DO-NOT-COMPLAIN-IF-RUNNING is not nil. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
632 Run `newsticker-start-hook' if newsticker was not running already." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
633 (interactive) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
634 (let ((running (newsticker-running-p))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
635 ;; read old cache if it exists and newsticker is not running |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
636 (unless running |
99885
7161bac8c5a8
newsticker: cache file redesign.
Ulf Jasper <ulf.jasper@web.de>
parents:
99287
diff
changeset
|
637 (newsticker--cache-read)) |
95901
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
638 ;; start retrieval timers -- one timer for each feed |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
639 (dolist (feed (append newsticker-url-list-defaults newsticker-url-list)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
640 (newsticker--start-feed feed)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
641 (unless running |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
642 (run-hooks 'newsticker-start-hook) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
643 (message "Newsticker started!")))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
644 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
645 (defun newsticker--stop-feed (feed-name) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
646 "Stop retrieval for feed FEED-NAME. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
647 Delete the stopped name/timer pair from `newsticker--retrieval-timer-list'." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
648 (let ((name-and-timer (assoc feed-name newsticker--retrieval-timer-list))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
649 (when name-and-timer |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
650 (cancel-timer (cdr name-and-timer)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
651 (setq newsticker--retrieval-timer-list |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
652 (delete name-and-timer newsticker--retrieval-timer-list))))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
653 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
654 (defun newsticker-stop () |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
655 "Stop the newsticker and the newsticker-ticker. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
656 Cancel the timers for display and retrieval. Run `newsticker-stop-hook' |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
657 if newsticker has been running." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
658 (interactive) |
99885
7161bac8c5a8
newsticker: cache file redesign.
Ulf Jasper <ulf.jasper@web.de>
parents:
99287
diff
changeset
|
659 (newsticker--cache-save) |
95901
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
660 (when (fboundp 'newsticker-stop-ticker) ; silence compiler warnings |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
661 (newsticker-stop-ticker)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
662 (when (newsticker-running-p) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
663 (mapc (lambda (name-and-timer) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
664 (newsticker--stop-feed (car name-and-timer))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
665 newsticker--retrieval-timer-list) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
666 (setq newsticker--retrieval-timer-list nil) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
667 (run-hooks 'newsticker-stop-hook) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
668 (message "Newsticker stopped!"))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
669 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
670 (defun newsticker-get-all-news () |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
671 "Launch retrieval of news from all configured newsticker sites. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
672 This does NOT start the retrieval timers." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
673 (interactive) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
674 ;; launch retrieval of news |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
675 (mapc (lambda (item) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
676 (newsticker-get-news (car item))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
677 (append newsticker-url-list-defaults newsticker-url-list))) |
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-save-item (feed item) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
680 "Save FEED ITEM." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
681 (interactive) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
682 (let ((filename (read-string "Filename: " |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
683 (concat feed ":_" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
684 (replace-regexp-in-string |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
685 " " "_" (newsticker--title item)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
686 ".html")))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
687 (with-temp-buffer |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
688 (insert (newsticker--desc item)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
689 (write-file filename t)))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
690 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
691 (defun newsticker-add-url (url name) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
692 "Add given URL under given NAME to `newsticker-url-list'. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
693 If URL is nil it is searched at point." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
694 (interactive |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
695 (list |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
696 (read-string "URL: " |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
697 (save-excursion |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
698 (end-of-line) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
699 (and |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
700 (re-search-backward |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
701 "http://" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
702 (if (> (point) (+ (point-min) 100)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
703 (- (point) 100) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
704 (point-min)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
705 t) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
706 (re-search-forward |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
707 "http://[-a-zA-Z0-9&/_.]*" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
708 (if (< (point) (- (point-max) 200)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
709 (+ (point) 200) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
710 (point-max)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
711 t) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
712 (buffer-substring-no-properties (match-beginning 0) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
713 (match-end 0))))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
714 (read-string "Name: "))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
715 (add-to-list 'newsticker-url-list (list name url nil nil nil) t) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
716 (customize-variable 'newsticker-url-list)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
717 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
718 (defun newsticker-customize () |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
719 "Open the newsticker customization group." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
720 (interactive) |
106408
53d1b718f76a
Newsticker fixes/changes.
Ulf Jasper <ulf.jasper@web.de>
parents:
105813
diff
changeset
|
721 (delete-other-windows) |
95901
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
722 (customize-group "newsticker")) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
723 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
724 ;; ====================================================================== |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
725 ;;; Local stuff |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
726 ;; ====================================================================== |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
727 (defun newsticker--get-news-by-funcall (feed-name function) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
728 "Get news for the site FEED-NAME by calling FUNCTION. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
729 See `newsticker-get-news'." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
730 (let ((buffername (concat " *newsticker-funcall-" feed-name "*"))) |
105813
df4934f25eef
* textmodes/two-column.el (2C-split):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
105074
diff
changeset
|
731 (with-current-buffer (get-buffer-create buffername) |
95901
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
732 (erase-buffer) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
733 (insert (string-to-multibyte (funcall function feed-name))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
734 (newsticker--sentinel-work nil t feed-name function |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
735 (current-buffer))))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
736 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
737 (defun newsticker--get-news-by-url (feed-name url) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
738 "Get news for the site FEED-NAME from address URL using `url-retrieve'. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
739 See `newsticker-get-news'." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
740 (let ((coding-system-for-read 'no-conversion)) |
96542
4b75a9224462
newsticker: handle url-retrieve errors.
Ulf Jasper <ulf.jasper@web.de>
parents:
95901
diff
changeset
|
741 (condition-case error-data |
99885
7161bac8c5a8
newsticker: cache file redesign.
Ulf Jasper <ulf.jasper@web.de>
parents:
99287
diff
changeset
|
742 (url-retrieve url 'newsticker--get-news-by-url-callback |
96542
4b75a9224462
newsticker: handle url-retrieve errors.
Ulf Jasper <ulf.jasper@web.de>
parents:
95901
diff
changeset
|
743 (list feed-name)) |
4b75a9224462
newsticker: handle url-retrieve errors.
Ulf Jasper <ulf.jasper@web.de>
parents:
95901
diff
changeset
|
744 (error (message "Error retrieving news from %s: %s" feed-name |
4b75a9224462
newsticker: handle url-retrieve errors.
Ulf Jasper <ulf.jasper@web.de>
parents:
95901
diff
changeset
|
745 error-data)))) |
95901
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
746 (force-mode-line-update)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
747 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
748 (defun newsticker--get-news-by-url-callback (status feed-name) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
749 "Callback function for `newsticker--get-news-by-url'. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
750 STATUS is the return status as delivered by `url-retrieve', and |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
751 FEED-NAME is the name of the feed that the news were retrieved |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
752 from." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
753 (let ((buf (get-buffer-create (concat " *newsticker-url-" feed-name "*"))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
754 (result (string-to-multibyte (buffer-string)))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
755 (set-buffer buf) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
756 (erase-buffer) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
757 (insert result) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
758 ;; remove MIME header |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
759 (goto-char (point-min)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
760 (search-forward "\n\n") |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
761 (delete-region (point-min) (point)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
762 ;; read the rss/atom contents |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
763 (newsticker--sentinel-work nil t feed-name "url-retrieve" (current-buffer)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
764 (when status |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
765 (let ((status-type (car status)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
766 (status-details (cdr status))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
767 (cond ((eq status-type :redirect) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
768 ;; don't care about redirects |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
769 ) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
770 ((eq status-type :error) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
771 (message "%s: Error while retrieving news from %s: %s: \"%s\"" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
772 (format-time-string "%A, %H:%M" (current-time)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
773 feed-name |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
774 (car status-details) (cdr status-details)))))))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
775 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
776 (defun newsticker--get-news-by-wget (feed-name url wget-arguments) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
777 "Get news for the site FEED-NAME from address URL using wget. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
778 WGET-ARGUMENTS is a list of arguments for wget. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
779 See `newsticker-get-news'." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
780 (let ((buffername (concat " *newsticker-wget-" feed-name "*"))) |
105813
df4934f25eef
* textmodes/two-column.el (2C-split):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
105074
diff
changeset
|
781 (with-current-buffer (get-buffer-create buffername) |
95901
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
782 (erase-buffer) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
783 ;; throw an error if there is an old wget-process around |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
784 (if (get-process feed-name) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
785 (error "Another wget-process is running for %s" feed-name)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
786 ;; start wget |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
787 (let* ((args (append wget-arguments (list url))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
788 (proc (apply 'start-process feed-name buffername |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
789 newsticker-wget-name args))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
790 (set-process-coding-system proc 'no-conversion 'no-conversion) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
791 (set-process-sentinel proc 'newsticker--sentinel) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
792 (setq newsticker--process-ids (cons (process-id proc) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
793 newsticker--process-ids)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
794 (force-mode-line-update))))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
795 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
796 (defun newsticker-get-news (feed-name) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
797 "Get news from the site FEED-NAME and load feed logo. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
798 FEED-NAME must be a string which occurs as the label (i.e. the first element) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
799 in an element of `newsticker-url-list' or `newsticker-url-list-defaults'." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
800 (newsticker--debug-msg "%s: Getting news for %s" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
801 (format-time-string "%A, %H:%M" (current-time)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
802 feed-name) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
803 (let* ((item (or (assoc feed-name newsticker-url-list) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
804 (assoc feed-name newsticker-url-list-defaults) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
805 (error |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
806 "Cannot get news for %s: Check newsticker-url-list" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
807 feed-name))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
808 (url (cadr item)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
809 (wget-arguments (or (car (cdr (cdr (cdr (cdr item))))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
810 newsticker-wget-arguments))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
811 (if (functionp url) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
812 (newsticker--get-news-by-funcall feed-name url) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
813 (if (eq newsticker-retrieval-method 'intern) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
814 (newsticker--get-news-by-url feed-name url) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
815 (newsticker--get-news-by-wget feed-name url wget-arguments))))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
816 |
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 ;; Parsing |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
819 ;; ====================================================================== |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
820 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
821 (defun newsticker--sentinel (process event) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
822 "Sentinel for extracting news titles from an RDF buffer. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
823 Argument PROCESS is the process which has just changed its state. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
824 Argument EVENT tells what has happened to the process." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
825 (let ((p-status (process-status process)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
826 (exit-status (process-exit-status process)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
827 (name (process-name process)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
828 (command (process-command process)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
829 (buffer (process-buffer process))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
830 (newsticker--sentinel-work event |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
831 (and (eq p-status 'exit) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
832 (= exit-status 0)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
833 name command buffer))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
834 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
835 (defun newsticker--sentinel-work (event status-ok name command buffer) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
836 "Actually do the sentinel work. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
837 Argument EVENT tells what has happened to the retrieval process. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
838 Argument STATUS-OK is the final status of the retrieval process, |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
839 non-nil meaning retrieval was successful. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
840 Argument NAME is the name of the retrieval process. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
841 Argument COMMAND is the command of the retrieval process. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
842 Argument BUFFER is the buffer of the retrieval process." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
843 (let ((time (current-time)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
844 (name-symbol (intern name)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
845 (something-was-added nil)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
846 ;; catch known errors (zombie processes, rubbish-xml etc. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
847 ;; if an error occurs the news feed is not updated! |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
848 (catch 'oops |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
849 (unless status-ok |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
850 (setq newsticker--cache |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
851 (newsticker--cache-add |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
852 newsticker--cache |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
853 name-symbol |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
854 newsticker--error-headline |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
855 (format |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
856 (concat "%s: Newsticker could not retrieve news from %s.\n" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
857 "Return status: `%s'\n" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
858 "Command was `%s'") |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
859 (format-time-string "%A, %H:%M" (current-time)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
860 name event command) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
861 "" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
862 (current-time) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
863 'new |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
864 0 nil)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
865 (message "%s: Error while retrieving news from %s" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
866 (format-time-string "%A, %H:%M" (current-time)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
867 name) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
868 (throw 'oops nil)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
869 (let* ((coding-system 'utf-8) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
870 (node-list |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
871 (save-current-buffer |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
872 (set-buffer buffer) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
873 ;; a very very dirty workaround to overcome the |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
874 ;; problems with the newest (20030621) xml.el: |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
875 ;; remove all unnecessary whitespace |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
876 (goto-char (point-min)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
877 (while (re-search-forward ">[ \t\r\n]+<" nil t) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
878 (replace-match "><" nil t)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
879 ;; and another brutal workaround (20031105)! For some |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
880 ;; reason the xml parser does not like the colon in the |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
881 ;; doctype name "rdf:RDF" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
882 (goto-char (point-min)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
883 (if (re-search-forward "<!DOCTYPE[ \t\n]+rdf:RDF" nil t) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
884 (replace-match "<!DOCTYPE rdfColonRDF" nil t)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
885 ;; finally.... ~##^°!!!!! |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
886 (goto-char (point-min)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
887 (while (search-forward "\r\n" nil t) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
888 (replace-match "\n" nil t)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
889 ;; still more brutal workarounds (20040309)! The xml |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
890 ;; parser does not like doctype rss |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
891 (goto-char (point-min)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
892 (if (re-search-forward "<!DOCTYPE[ \t\n]+rss[ \t\n]*>" nil t) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
893 (replace-match "" nil t)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
894 ;; And another one (20050618)! (Fixed in GNU Emacs 22.0.50.18) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
895 ;; Remove comments to avoid this xml-parsing bug: |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
896 ;; "XML files can have only one toplevel tag" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
897 (goto-char (point-min)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
898 (while (search-forward "<!--" nil t) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
899 (let ((start (match-beginning 0))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
900 (unless (search-forward "-->" nil t) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
901 (error "Can't find end of comment")) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
902 (delete-region start (point)))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
903 ;; And another one (20050702)! If description is HTML |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
904 ;; encoded and starts with a `<', wrap the whole |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
905 ;; description in a CDATA expression. This happened for |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
906 ;; http://www.thefreedictionary.com/_/WoD/rss.aspx?type=quote |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
907 (goto-char (point-min)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
908 (while (re-search-forward |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
909 "<description>\\(<img.*?\\)</description>" nil t) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
910 (replace-match |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
911 "<description><![CDATA[ \\1 ]]></description>")) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
912 ;; And another one (20051123)! XML parser does not |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
913 ;; like this: <yweather:location city="Frankfurt/Main" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
914 ;; region="" country="GM" /> |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
915 ;; try to "fix" empty attributes |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
916 ;; This happened for |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
917 ;; http://xml.weather.yahoo.com/forecastrss?p=GMXX0040&u=f |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
918 (goto-char (point-min)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
919 (while (re-search-forward "\\(<[^>]*\\)=\"\"" nil t) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
920 (replace-match "\\1=\" \"")) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
921 ;; |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
922 (set-buffer-modified-p nil) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
923 ;; check coding system |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
924 (goto-char (point-min)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
925 (if (re-search-forward "encoding=\"\\([^\"]+\\)\"" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
926 nil t) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
927 (setq coding-system (intern (downcase (match-string 1)))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
928 (setq coding-system |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
929 (condition-case nil |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
930 (check-coding-system coding-system) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
931 (coding-system-error |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
932 (message |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
933 "newsticker.el: ignoring coding system %s for %s" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
934 coding-system name) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
935 nil)))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
936 ;; Decode if possible |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
937 (when coding-system |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
938 (decode-coding-region (point-min) (point-max) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
939 coding-system)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
940 (condition-case errordata |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
941 ;; The xml parser might fail |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
942 ;; or the xml might be bugged |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
943 (xml-parse-region (point-min) (point-max)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
944 (error (message "Could not parse %s: %s" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
945 (buffer-name) (cadr errordata)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
946 (throw 'oops nil))))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
947 (topnode (car node-list)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
948 (channelnode (car (xml-get-children topnode 'channel))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
949 (imageurl nil)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
950 ;; mark all items as obsolete |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
951 (newsticker--cache-replace-age newsticker--cache |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
952 name-symbol |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
953 'new 'obsolete-new) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
954 (newsticker--cache-replace-age newsticker--cache |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
955 name-symbol |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
956 'old 'obsolete-old) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
957 (newsticker--cache-replace-age newsticker--cache |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
958 name-symbol |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
959 'feed 'obsolete-old) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
960 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
961 ;; check Atom/RSS version and call corresponding parser |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
962 (condition-case error-data |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
963 (if (cond |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
964 ;; RSS 0.91 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
965 ((and (eq 'rss (xml-node-name topnode)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
966 (string= "0.91" (xml-get-attribute topnode 'version))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
967 (setq imageurl (newsticker--get-logo-url-rss-0.91 topnode)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
968 (newsticker--parse-rss-0.91 name time topnode)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
969 ;; RSS 0.92 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
970 ((and (eq 'rss (xml-node-name topnode)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
971 (string= "0.92" (xml-get-attribute topnode 'version))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
972 (setq imageurl (newsticker--get-logo-url-rss-0.92 topnode)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
973 (newsticker--parse-rss-0.92 name time topnode)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
974 ;; RSS 1.0 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
975 ((eq 'rdf:RDF (xml-node-name topnode)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
976 (setq imageurl (newsticker--get-logo-url-rss-1.0 topnode)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
977 (newsticker--parse-rss-1.0 name time topnode)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
978 ;; RSS 2.0 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
979 ((and (eq 'rss (xml-node-name topnode)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
980 (string= "2.0" (xml-get-attribute topnode 'version))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
981 (setq imageurl (newsticker--get-logo-url-rss-2.0 topnode)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
982 (newsticker--parse-rss-2.0 name time topnode)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
983 ;; Atom 0.3 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
984 ((and (eq 'feed (xml-node-name topnode)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
985 (string= "http://purl.org/atom/ns#" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
986 (xml-get-attribute topnode 'xmlns))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
987 (setq imageurl (newsticker--get-logo-url-atom-0.3 topnode)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
988 (newsticker--parse-atom-0.3 name time topnode)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
989 ;; Atom 1.0 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
990 ((and (eq 'feed (xml-node-name topnode)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
991 (string= "http://www.w3.org/2005/Atom" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
992 (xml-get-attribute topnode 'xmlns))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
993 (setq imageurl (newsticker--get-logo-url-atom-1.0 topnode)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
994 (newsticker--parse-atom-1.0 name time topnode)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
995 ;; unknown feed type |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
996 (t |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
997 (newsticker--debug-msg "Feed type unknown: %s: %s" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
998 (xml-node-name topnode) name) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
999 nil)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1000 (setq something-was-added t)) |
96542
4b75a9224462
newsticker: handle url-retrieve errors.
Ulf Jasper <ulf.jasper@web.de>
parents:
95901
diff
changeset
|
1001 (error (message "sentinelerror in %s: %s" name error-data))) |
95901
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1002 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1003 ;; Remove those old items from cache which have been removed from |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1004 ;; the feed |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1005 (newsticker--cache-replace-age newsticker--cache |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1006 name-symbol 'obsolete-old 'deleteme) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1007 (newsticker--cache-remove newsticker--cache name-symbol |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1008 'deleteme) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1009 ;; Remove those new items from cache which have been removed from |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1010 ;; the feed. Or keep them as `obsolete' |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1011 (if (not newsticker-keep-obsolete-items) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1012 (newsticker--cache-remove newsticker--cache |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1013 name-symbol 'obsolete-new) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1014 (setq newsticker--cache |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1015 (newsticker--cache-mark-expired |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1016 newsticker--cache name-symbol 'obsolete 'obsolete-expired |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1017 newsticker-obsolete-item-max-age)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1018 (newsticker--cache-remove newsticker--cache |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1019 name-symbol 'obsolete-expired) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1020 (newsticker--cache-replace-age newsticker--cache |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1021 name-symbol 'obsolete-new |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1022 'obsolete)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1023 (newsticker--update-process-ids) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1024 ;; setup scrollable text |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1025 (when (= 0 (length newsticker--process-ids)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1026 (when (fboundp 'newsticker--ticker-text-setup) ;silence |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1027 ;compiler |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1028 ;warnings |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1029 (newsticker--ticker-text-setup))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1030 (setq newsticker--latest-update-time (current-time)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1031 (when something-was-added |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1032 ;; FIXME: should we care about removed items as well? |
99885
7161bac8c5a8
newsticker: cache file redesign.
Ulf Jasper <ulf.jasper@web.de>
parents:
99287
diff
changeset
|
1033 (newsticker--cache-save-feed |
7161bac8c5a8
newsticker: cache file redesign.
Ulf Jasper <ulf.jasper@web.de>
parents:
99287
diff
changeset
|
1034 (newsticker--cache-get-feed name-symbol)) |
95901
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1035 (when (fboundp 'newsticker--buffer-set-uptodate) ;silence |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1036 ;compiler |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1037 ;warnings |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1038 (newsticker--buffer-set-uptodate nil))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1039 ;; kill the process buffer if wanted |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1040 (unless newsticker-debug |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1041 (kill-buffer buffer)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1042 ;; launch retrieval of image |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1043 (when (and imageurl newsticker--download-logos) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1044 (newsticker--image-get name imageurl))))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1045 (when newsticker--sentinel-callback |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1046 (funcall newsticker--sentinel-callback))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1047 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1048 (defun newsticker--get-logo-url-atom-1.0 (node) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1049 "Return logo URL from atom 1.0 data in NODE." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1050 (car (xml-node-children |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1051 (car (xml-get-children node 'logo))))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1052 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1053 (defun newsticker--get-logo-url-atom-0.3 (node) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1054 "Return logo URL from atom 0.3 data in NODE." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1055 (car (xml-node-children |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1056 (car (xml-get-children (car (xml-get-children node 'image)) 'url))))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1057 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1058 (defun newsticker--get-logo-url-rss-2.0 (node) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1059 "Return logo URL from RSS 2.0 data in NODE." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1060 (car (xml-node-children |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1061 (car (xml-get-children |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1062 (car (xml-get-children |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1063 (car (xml-get-children node 'channel)) 'image)) 'url))))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1064 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1065 (defun newsticker--get-logo-url-rss-1.0 (node) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1066 "Return logo URL from RSS 1.0 data in NODE." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1067 (car (xml-node-children |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1068 (car (xml-get-children (car (xml-get-children node 'image)) 'url))))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1069 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1070 (defun newsticker--get-logo-url-rss-0.92 (node) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1071 "Return logo URL from RSS 0.92 data in NODE." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1072 (car (xml-node-children |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1073 (car (xml-get-children (car (xml-get-children node 'image)) 'url))))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1074 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1075 (defun newsticker--get-logo-url-rss-0.91 (node) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1076 "Return logo URL from RSS 0.91 data in NODE." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1077 (car (xml-node-children |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1078 (car (xml-get-children (car (xml-get-children node 'image)) 'url))))) |
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 (defun newsticker--parse-atom-0.3 (name time topnode) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1081 "Parse Atom 0.3 data. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1082 Return value as well as arguments NAME, TIME, and TOPNODE are the |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1083 same as in `newsticker--parse-atom-1.0'." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1084 (newsticker--debug-msg "Parsing Atom 0.3 feed %s" name) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1085 (let (new-feed new-item) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1086 (setq new-feed (newsticker--parse-generic-feed |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1087 name time |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1088 ;; title |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1089 (car (xml-node-children |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1090 (car (xml-get-children topnode 'title)))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1091 ;; desc |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1092 (car (xml-node-children |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1093 (car (xml-get-children topnode 'content)))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1094 ;; link |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1095 (xml-get-attribute |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1096 (car (xml-get-children topnode 'link)) 'href) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1097 ;; extra-elements |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1098 (xml-node-children topnode))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1099 (setq new-item (newsticker--parse-generic-items |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1100 name time (xml-get-children topnode 'entry) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1101 ;; title-fn |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1102 (lambda (node) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1103 (car (xml-node-children |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1104 (car (xml-get-children node 'title))))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1105 ;; desc-fn |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1106 (lambda (node) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1107 (or (car (xml-node-children |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1108 (car (xml-get-children node 'content)))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1109 (car (xml-node-children |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1110 (car (xml-get-children node 'summary)))))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1111 ;; link-fn |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1112 (lambda (node) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1113 (xml-get-attribute |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1114 (car (xml-get-children node 'link)) 'href)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1115 ;; time-fn |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1116 (lambda (node) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1117 (newsticker--decode-rfc822-date |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1118 (car (xml-node-children |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1119 (car (xml-get-children node 'modified)))))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1120 ;; guid-fn |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1121 (lambda (node) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1122 (newsticker--guid-to-string |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1123 (assoc 'guid (xml-node-children node)))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1124 ;; extra-fn |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1125 (lambda (node) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1126 (xml-node-children node)))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1127 (or new-item new-feed))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1128 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1129 (defun newsticker--parse-atom-1.0 (name time topnode) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1130 "Parse Atom 1.0 data. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1131 Argument NAME gives the name of a news feed. TIME gives the |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1132 system time at which the data have been retrieved. TOPNODE |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1133 contains the feed data as returned by the xml parser. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1134 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1135 For the Atom 1.0 specification see |
104029
55ba5af4bf3a
Kevin Ryde <user42 at zip.com.au>
Glenn Morris <rgm@gnu.org>
parents:
101409
diff
changeset
|
1136 URL `http://www.atompub.org/2005/08/17/draft-ietf-atompub-format-11.html'" |
95901
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1137 (newsticker--debug-msg "Parsing Atom 1.0 feed %s" name) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1138 (let (new-feed new-item) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1139 (setq new-feed (newsticker--parse-generic-feed |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1140 name time |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1141 ;; title |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1142 (car (xml-node-children |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1143 (car (xml-get-children topnode 'title)))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1144 ;; desc |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1145 (car (xml-node-children |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1146 (car (xml-get-children topnode 'subtitle)))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1147 ;; link |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1148 (lambda (node) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1149 (xml-get-attribute |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1150 (car (xml-get-children node 'link)) 'href)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1151 ;; extra-elements |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1152 (xml-node-children topnode))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1153 (setq new-item (newsticker--parse-generic-items |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1154 name time (xml-get-children topnode 'entry) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1155 ;; title-fn |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1156 (lambda (node) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1157 (car (xml-node-children |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1158 (car (xml-get-children node 'title))))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1159 ;; desc-fn |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1160 (lambda (node) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1161 (or (car (xml-node-children |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1162 (car (xml-get-children node 'content)))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1163 (car (xml-node-children |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1164 (car (xml-get-children node 'summary)))))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1165 ;; link-fn |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1166 (lambda (node) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1167 (xml-get-attribute |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1168 (car (xml-get-children node 'link)) 'href)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1169 ;; time-fn |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1170 (lambda (node) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1171 (newsticker--decode-iso8601-date |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1172 (or (car (xml-node-children |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1173 (car (xml-get-children node 'updated)))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1174 (car (xml-node-children |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1175 (car (xml-get-children node 'published))))))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1176 ;; guid-fn |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1177 (lambda (node) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1178 (car (xml-node-children |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1179 (car (xml-get-children node 'id))))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1180 ;; extra-fn |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1181 (lambda (node) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1182 (xml-node-children node)))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1183 (or new-item new-feed))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1184 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1185 (defun newsticker--parse-rss-0.91 (name time topnode) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1186 "Parse RSS 0.91 data. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1187 Return value as well as arguments NAME, TIME, and TOPNODE are the |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1188 same as in `newsticker--parse-atom-1.0'. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1189 |
104029
55ba5af4bf3a
Kevin Ryde <user42 at zip.com.au>
Glenn Morris <rgm@gnu.org>
parents:
101409
diff
changeset
|
1190 For the RSS 0.91 specification see URL `http://backend.userland.com/rss091' |
55ba5af4bf3a
Kevin Ryde <user42 at zip.com.au>
Glenn Morris <rgm@gnu.org>
parents:
101409
diff
changeset
|
1191 or URL `http://my.netscape.com/publish/formats/rss-spec-0.91.html'." |
95901
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1192 (newsticker--debug-msg "Parsing RSS 0.91 feed %s" name) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1193 (let* ((channelnode (car (xml-get-children topnode 'channel))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1194 (pub-date (newsticker--decode-rfc822-date |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1195 (car (xml-node-children |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1196 (car (xml-get-children channelnode 'pubDate)))))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1197 is-new-feed has-new-items) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1198 (setq is-new-feed (newsticker--parse-generic-feed |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1199 name time |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1200 ;; title |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1201 (car (xml-node-children |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1202 (car (xml-get-children channelnode 'title)))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1203 ;; desc |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1204 (car (xml-node-children |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1205 (car (xml-get-children channelnode |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1206 'description)))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1207 ;; link |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1208 (car (xml-node-children |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1209 (car (xml-get-children channelnode 'link)))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1210 ;; extra-elements |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1211 (xml-node-children channelnode))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1212 (setq has-new-items (newsticker--parse-generic-items |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1213 name time (xml-get-children channelnode 'item) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1214 ;; title-fn |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1215 (lambda (node) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1216 (car (xml-node-children |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1217 (car (xml-get-children node 'title))))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1218 ;; desc-fn |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1219 (lambda (node) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1220 (car (xml-node-children |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1221 (car (xml-get-children node 'description))))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1222 ;; link-fn |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1223 (lambda (node) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1224 (car (xml-node-children |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1225 (car (xml-get-children node 'link))))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1226 ;; time-fn |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1227 (lambda (node) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1228 (newsticker--decode-rfc822-date |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1229 (car (xml-node-children |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1230 (car (xml-get-children node 'pubDate)))))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1231 ;; guid-fn |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1232 (lambda (node) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1233 nil) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1234 ;; extra-fn |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1235 (lambda (node) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1236 (xml-node-children node)))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1237 (or has-new-items is-new-feed))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1238 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1239 (defun newsticker--parse-rss-0.92 (name time topnode) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1240 "Parse RSS 0.92 data. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1241 Return value as well as arguments NAME, TIME, and TOPNODE are the |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1242 same as in `newsticker--parse-atom-1.0'. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1243 |
104029
55ba5af4bf3a
Kevin Ryde <user42 at zip.com.au>
Glenn Morris <rgm@gnu.org>
parents:
101409
diff
changeset
|
1244 For the RSS 0.92 specification see URL `http://backend.userland.com/rss092'." |
95901
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1245 (newsticker--debug-msg "Parsing RSS 0.92 feed %s" name) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1246 (let* ((channelnode (car (xml-get-children topnode 'channel))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1247 (pub-date (newsticker--decode-rfc822-date |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1248 (car (xml-node-children |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1249 (car (xml-get-children channelnode 'pubDate)))))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1250 is-new-feed has-new-items) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1251 (setq is-new-feed (newsticker--parse-generic-feed |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1252 name time |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1253 ;; title |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1254 (car (xml-node-children |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1255 (car (xml-get-children channelnode 'title)))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1256 ;; desc |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1257 (car (xml-node-children |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1258 (car (xml-get-children channelnode |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1259 'description)))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1260 ;; link |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1261 (car (xml-node-children |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1262 (car (xml-get-children channelnode 'link)))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1263 ;; extra-elements |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1264 (xml-node-children channelnode))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1265 (setq has-new-items (newsticker--parse-generic-items |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1266 name time (xml-get-children channelnode 'item) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1267 ;; title-fn |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1268 (lambda (node) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1269 (car (xml-node-children |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1270 (car (xml-get-children node 'title))))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1271 ;; desc-fn |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1272 (lambda (node) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1273 (car (xml-node-children |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1274 (car (xml-get-children node 'description))))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1275 ;; link-fn |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1276 (lambda (node) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1277 (car (xml-node-children |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1278 (car (xml-get-children node 'link))))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1279 ;; time-fn |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1280 (lambda (node) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1281 (newsticker--decode-rfc822-date |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1282 (car (xml-node-children |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1283 (car (xml-get-children node 'pubDate)))))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1284 ;; guid-fn |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1285 (lambda (node) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1286 nil) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1287 ;; extra-fn |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1288 (lambda (node) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1289 (xml-node-children node)))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1290 (or has-new-items is-new-feed))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1291 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1292 (defun newsticker--parse-rss-1.0 (name time topnode) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1293 "Parse RSS 1.0 data. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1294 Return value as well as arguments NAME, TIME, and TOPNODE are the |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1295 same as in `newsticker--parse-atom-1.0'. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1296 |
104029
55ba5af4bf3a
Kevin Ryde <user42 at zip.com.au>
Glenn Morris <rgm@gnu.org>
parents:
101409
diff
changeset
|
1297 For the RSS 1.0 specification see URL `http://web.resource.org/rss/1.0/spec'." |
95901
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1298 (newsticker--debug-msg "Parsing RSS 1.0 feed %s" name) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1299 (let* ((channelnode (car (xml-get-children topnode 'channel))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1300 is-new-feed has-new-items) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1301 (setq is-new-feed (newsticker--parse-generic-feed |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1302 name time |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1303 ;; title |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1304 (car (xml-node-children |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1305 (car (xml-get-children channelnode 'title)))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1306 ;; desc |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1307 (car (xml-node-children |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1308 (car (xml-get-children channelnode |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1309 'description)))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1310 ;; link |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1311 (car (xml-node-children |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1312 (car (xml-get-children channelnode 'link)))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1313 ;; extra-elements |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1314 (xml-node-children channelnode))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1315 (setq has-new-items (newsticker--parse-generic-items |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1316 name time (xml-get-children topnode 'item) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1317 ;; title-fn |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1318 (lambda (node) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1319 (car (xml-node-children |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1320 (car (xml-get-children node 'title))))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1321 ;; desc-fn |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1322 (lambda (node) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1323 (car (xml-node-children |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1324 (car (xml-get-children node |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1325 'description))))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1326 ;; link-fn |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1327 (lambda (node) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1328 (car (xml-node-children |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1329 (car (xml-get-children node 'link))))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1330 ;; time-fn |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1331 (lambda (node) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1332 (newsticker--decode-iso8601-date |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1333 (car (xml-node-children |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1334 (car (xml-get-children node 'dc:date)))))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1335 ;; guid-fn |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1336 (lambda (node) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1337 nil) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1338 ;; extra-fn |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1339 (lambda (node) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1340 (xml-node-children node)))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1341 (or has-new-items is-new-feed))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1342 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1343 (defun newsticker--parse-rss-2.0 (name time topnode) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1344 "Parse RSS 2.0 data. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1345 Return value as well as arguments NAME, TIME, and TOPNODE are the |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1346 same as in `newsticker--parse-atom-1.0'. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1347 |
104029
55ba5af4bf3a
Kevin Ryde <user42 at zip.com.au>
Glenn Morris <rgm@gnu.org>
parents:
101409
diff
changeset
|
1348 For the RSS 2.0 specification see URL `http://blogs.law.harvard.edu/tech/rss'." |
95901
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1349 (newsticker--debug-msg "Parsing RSS 2.0 feed %s" name) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1350 (let* ((channelnode (car (xml-get-children topnode 'channel))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1351 is-new-feed has-new-items) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1352 (setq is-new-feed (newsticker--parse-generic-feed |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1353 name time |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1354 ;; title |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1355 (car (xml-node-children |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1356 (car (xml-get-children channelnode 'title)))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1357 ;; desc |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1358 (car (xml-node-children |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1359 (car (xml-get-children channelnode |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1360 'description)))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1361 ;; link |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1362 (car (xml-node-children |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1363 (car (xml-get-children channelnode 'link)))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1364 ;; extra-elements |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1365 (xml-node-children channelnode))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1366 (setq has-new-items (newsticker--parse-generic-items |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1367 name time (xml-get-children channelnode 'item) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1368 ;; title-fn |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1369 (lambda (node) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1370 (car (xml-node-children |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1371 (car (xml-get-children node 'title))))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1372 ;; desc-fn |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1373 (lambda (node) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1374 (or (car (xml-node-children |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1375 (car (xml-get-children node |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1376 'content:encoded)))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1377 (car (xml-node-children |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1378 (car (xml-get-children node |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1379 'description)))))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1380 ;; link-fn |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1381 (lambda (node) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1382 (car (xml-node-children |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1383 (car (xml-get-children node 'link))))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1384 ;; time-fn |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1385 (lambda (node) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1386 (newsticker--decode-rfc822-date |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1387 (car (xml-node-children |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1388 (car (xml-get-children node 'pubDate)))))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1389 ;; guid-fn |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1390 (lambda (node) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1391 (newsticker--guid-to-string |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1392 (assoc 'guid (xml-node-children node)))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1393 ;; extra-fn |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1394 (lambda (node) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1395 (xml-node-children node)))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1396 (or has-new-items is-new-feed))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1397 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1398 (defun newsticker--parse-generic-feed (name time title desc link |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1399 extra-elements) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1400 "Parse generic news feed data. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1401 Argument NAME gives the name of a news feed. TIME gives the |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1402 system time at which the data have been retrieved. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1403 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1404 The arguments TITLE, DESC, LINK, and EXTRA-ELEMENTS give the feed's title, |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1405 description, link, and extra elements resp." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1406 (let ((title (or title "[untitled]")) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1407 (link (or link "")) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1408 (old-item nil) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1409 (position 0) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1410 (something-was-added nil)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1411 ;; decode numeric entities |
106458 | 1412 (setq title (xml-substitute-numeric-entities title)) |
1413 (setq desc (xml-substitute-numeric-entities desc)) | |
1414 (setq link (xml-substitute-numeric-entities link)) | |
95901
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1415 ;; remove whitespace from title, desc, and link |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1416 (setq title (newsticker--remove-whitespace title)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1417 (setq desc (newsticker--remove-whitespace desc)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1418 (setq link (newsticker--remove-whitespace link)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1419 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1420 ;; handle the feed itself |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1421 (unless (newsticker--cache-contains newsticker--cache |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1422 (intern name) title |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1423 desc link 'feed) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1424 (setq something-was-added t)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1425 (setq newsticker--cache |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1426 (newsticker--cache-add newsticker--cache (intern name) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1427 title desc link time 'feed position |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1428 extra-elements time 'feed)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1429 something-was-added)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1430 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1431 (defun newsticker--parse-generic-items (name time itemlist |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1432 title-fn desc-fn |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1433 link-fn time-fn |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1434 guid-fn extra-fn) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1435 "Parse generic news feed data. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1436 Argument NAME gives the name of a news feed. TIME gives the |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1437 system time at which the data have been retrieved. ITEMLIST |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1438 contains the news items returned by the xml parser. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1439 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1440 The arguments TITLE-FN, DESC-FN, LINK-FN, TIME-FN, GUID-FN, and |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1441 EXTRA-FN give functions for extracting title, description, link, |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1442 time, guid, and extra-elements resp. They are called with one |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1443 argument, which is one of the items in ITEMLIST." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1444 (let (title desc link |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1445 (old-item nil) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1446 (position 0) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1447 (something-was-added nil)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1448 ;; gather all items for this feed |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1449 (mapc (lambda (node) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1450 (setq position (1+ position)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1451 (setq title (or (funcall title-fn node) "[untitled]")) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1452 (setq desc (funcall desc-fn node)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1453 (setq link (or (funcall link-fn node) "")) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1454 (setq time (or (funcall time-fn node) time)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1455 ;; It happened that the title or description |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1456 ;; contained evil HTML code that confused the |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1457 ;; xml parser. Therefore: |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1458 (unless (stringp title) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1459 (setq title (prin1-to-string title))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1460 (unless (or (stringp desc) (not desc)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1461 (setq desc (prin1-to-string desc))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1462 ;; ignore items with empty title AND empty desc |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1463 (when (or (> (length title) 0) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1464 (> (length desc) 0)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1465 ;; decode numeric entities |
106458 | 1466 (setq title (xml-substitute-numeric-entities title)) |
95901
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1467 (when desc |
106458 | 1468 (setq desc (xml-substitute-numeric-entities desc))) |
1469 (setq link (xml-substitute-numeric-entities link)) | |
95901
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1470 ;; remove whitespace from title, desc, and link |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1471 (setq title (newsticker--remove-whitespace title)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1472 (setq desc (newsticker--remove-whitespace desc)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1473 (setq link (newsticker--remove-whitespace link)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1474 ;; add data to cache |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1475 ;; do we have this item already? |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1476 (let* ((guid (funcall guid-fn node))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1477 ;;(message "guid=%s" guid) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1478 (setq old-item |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1479 (newsticker--cache-contains newsticker--cache |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1480 (intern name) title |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1481 desc link nil guid))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1482 ;; add this item, or mark it as old, or do nothing |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1483 (let ((age1 'new) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1484 (age2 'old) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1485 (item-new-p nil)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1486 (if old-item |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1487 (let ((prev-age (newsticker--age old-item))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1488 (unless newsticker-automatically-mark-items-as-old |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1489 ;; Some feeds deliver items multiply, the |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1490 ;; first time we find an 'obsolete-old one the |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1491 ;; cache, the following times we find an 'old |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1492 ;; one |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1493 (if (memq prev-age '(obsolete-old old)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1494 (setq age2 'old) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1495 (setq age2 'new))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1496 (if (eq prev-age 'immortal) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1497 (setq age2 'immortal)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1498 (setq time (newsticker--time old-item))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1499 ;; item was not there |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1500 (setq item-new-p t) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1501 (setq something-was-added t)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1502 (setq newsticker--cache |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1503 (newsticker--cache-add |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1504 newsticker--cache (intern name) title desc link |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1505 time age1 position (funcall extra-fn node) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1506 time age2)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1507 (when item-new-p |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1508 (let ((item (newsticker--cache-contains |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1509 newsticker--cache (intern name) title |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1510 desc link nil))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1511 (if newsticker-auto-mark-filter-list |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1512 (newsticker--run-auto-mark-filter name item)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1513 (run-hook-with-args |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1514 'newsticker-new-item-functions name item)))))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1515 itemlist) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1516 something-was-added)) |
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 ;; ====================================================================== |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1519 ;;; Misc |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1520 ;; ====================================================================== |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1521 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1522 (defun newsticker--remove-whitespace (string) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1523 "Remove leading and trailing whitespace from STRING." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1524 ;; we must have ...+ but not ...* in the regexps otherwise xemacs loops |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1525 ;; endlessly... |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1526 (when (and string (stringp string)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1527 (replace-regexp-in-string |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1528 "[ \t\r\n]+$" "" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1529 (replace-regexp-in-string "^[ \t\r\n]+" "" string)))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1530 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1531 (defun newsticker--do-forget-preformatted (item) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1532 "Forget pre-formatted data for ITEM. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1533 Remove the pre-formatted from `newsticker--cache'." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1534 (if (nthcdr 7 item) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1535 (setcar (nthcdr 7 item) nil)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1536 (if (nthcdr 6 item) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1537 (setcar (nthcdr 6 item) nil))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1538 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1539 (defun newsticker--forget-preformatted () |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1540 "Forget all cached pre-formatted data. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1541 Remove the pre-formatted from `newsticker--cache'." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1542 (mapc (lambda (feed) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1543 (mapc 'newsticker--do-forget-preformatted |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1544 (cdr feed))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1545 newsticker--cache) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1546 (when (fboundp 'newsticker--buffer-set-uptodate) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1547 (newsticker--buffer-set-uptodate nil))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1548 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1549 (defun newsticker--debug-msg (string &rest args) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1550 "Print newsticker debug messages. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1551 This function calls `message' with arguments STRING and ARGS, if |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1552 `newsticker-debug' is non-nil." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1553 (and newsticker-debug |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1554 ;;(not (active-minibuffer-window)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1555 ;;(not (current-message)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1556 (apply 'message string args))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1557 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1558 (defun newsticker--decode-iso8601-date (iso8601-string) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1559 "Return ISO8601-STRING in format like `decode-time'. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1560 Converts from ISO-8601 to Emacs representation. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1561 Examples: |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1562 2004-09-17T05:09:49.001+00:00 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1563 2004-09-17T05:09:49+00:00 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1564 2004-09-17T05:09+00:00 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1565 2004-09-17T05:09:49 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1566 2004-09-17T05:09 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1567 2004-09-17 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1568 2004-09 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1569 2004" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1570 (if iso8601-string |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1571 (when (string-match |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1572 (concat |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1573 "^ *\\([0-9]\\{4\\}\\)" ;year |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1574 "\\(-\\([0-9]\\{2\\}\\)" ;month |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1575 "\\(-\\([0-9]\\{2\\}\\)" ;day |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1576 "\\(T" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1577 "\\([0-9]\\{2\\}\\):\\([0-9]\\{2\\}\\)" ;hour:minute |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1578 "\\(:\\([0-9]\\{2\\}\\)\\(\\.[0-9]+\\)?\\)?" ;second |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1579 ;timezone |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1580 "\\(\\([-+Z]\\)\\(\\([0-9]\\{2\\}\\):\\([0-9]\\{2\\}\\)\\)?\\)?" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1581 "\\)?\\)?\\)? *$") |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1582 iso8601-string) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1583 (let ((year (read (match-string 1 iso8601-string))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1584 (month (read (or (match-string 3 iso8601-string) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1585 "1"))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1586 (day (read (or (match-string 5 iso8601-string) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1587 "1"))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1588 (hour (read (or (match-string 7 iso8601-string) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1589 "0"))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1590 (minute (read (or (match-string 8 iso8601-string) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1591 "0"))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1592 (second (read (or (match-string 10 iso8601-string) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1593 "0"))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1594 (sign (match-string 13 iso8601-string)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1595 (offset-hour (read (or (match-string 15 iso8601-string) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1596 "0"))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1597 (offset-minute (read (or (match-string 16 iso8601-string) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1598 "0")))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1599 (cond ((string= sign "+") |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1600 (setq hour (- hour offset-hour)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1601 (setq minute (- minute offset-minute))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1602 ((string= sign "-") |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1603 (setq hour (+ hour offset-hour)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1604 (setq minute (+ minute offset-minute)))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1605 ;; if UTC subtract current-time-zone offset |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1606 ;;(setq second (+ (car (current-time-zone)) second))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1607 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1608 (condition-case nil |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1609 (encode-time second minute hour day month year t) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1610 (error |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1611 (message "Cannot decode \"%s\"" iso8601-string) |
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 nil)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1614 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1615 (defun newsticker--decode-rfc822-date (rfc822-string) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1616 "Return RFC822-STRING in format like `decode-time'. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1617 Converts from RFC822 to Emacs representation. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1618 Examples: |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1619 Sat, 07 September 2002 00:00:01 +0100 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1620 Sat, 07 September 2002 00:00:01 MET |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1621 Sat, 07 Sep 2002 00:00:01 GMT |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1622 07 Sep 2002 00:00:01 GMT |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1623 07 Sep 2002" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1624 (if (and rfc822-string (stringp rfc822-string)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1625 (when (string-match |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1626 (concat |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1627 "\\s-*" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1628 ;; week day |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1629 "\\(\\(Mon\\|Tue\\|Wed\\|Thu\\|Fri\\|Sat\\|Sun\\)\\s-*,?\\)?\\s-*" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1630 ;; day |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1631 "\\([0-9]\\{1,2\\}\\)\\s-+" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1632 ;; month |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1633 "\\(Jan\\|Feb\\|Mar\\|Apr\\|May\\|Jun\\|" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1634 "Jul\\|Aug\\|Sep\\|Oct\\|Nov\\|Dec\\).*?\\s-+" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1635 ;; year |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1636 "\\([0-9]\\{2,4\\}\\)" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1637 ;; time may be missing |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1638 "\\(\\s-+" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1639 ;; hour |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1640 "\\([0-9]\\{2\\}\\)" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1641 ;; minute |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1642 ":\\([0-9]\\{2\\}\\)" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1643 ;; second |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1644 "\\(:\\([0-9]\\{2\\}\\)\\)?" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1645 ;; zone -- fixme |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1646 "\\(\\s-+\\(" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1647 "UT\\|GMT\\|EST\\|EDT\\|CST\\|CDT\\|MST\\|MDT\\|PST\\|PDT" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1648 "\\|\\([-+]\\)\\([0-9]\\{2\\}\\)\\([0-9]\\{2\\}\\)" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1649 "\\)\\)?" |
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 rfc822-string) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1652 (let ((day (read (match-string 3 rfc822-string))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1653 (month-name (match-string 4 rfc822-string)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1654 (month 0) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1655 (year (read (match-string 5 rfc822-string))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1656 (hour (read (or (match-string 7 rfc822-string) "0"))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1657 (minute (read (or (match-string 8 rfc822-string) "0"))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1658 (second (read (or (match-string 10 rfc822-string) "0"))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1659 (zone (match-string 12 rfc822-string)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1660 (sign (match-string 13 rfc822-string)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1661 (offset-hour (read (or (match-string 14 rfc822-string) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1662 "0"))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1663 (offset-minute (read (or (match-string 15 rfc822-string) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1664 "0"))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1665 ;;FIXME |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1666 ) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1667 (when zone |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1668 (cond ((string= sign "+") |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1669 (setq hour (- hour offset-hour)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1670 (setq minute (- minute offset-minute))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1671 ((string= sign "-") |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1672 (setq hour (+ hour offset-hour)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1673 (setq minute (+ minute offset-minute))))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1674 (condition-case error-data |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1675 (let ((i 1)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1676 (mapc (lambda (m) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1677 (if (string= month-name m) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1678 (setq month i)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1679 (setq i (1+ i))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1680 '("Jan" "Feb" "Mar" "Apr" "May" "Jun" "Jul" "Aug" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1681 "Sep" "Oct" "Nov" "Dec")) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1682 (encode-time second minute hour day month year t)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1683 (error |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1684 (message "Cannot decode \"%s\": %s %s" rfc822-string |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1685 (car error-data) (cdr error-data)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1686 nil)))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1687 nil)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1688 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1689 (defun newsticker--lists-intersect-p (list1 list2) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1690 "Return t if LIST1 and LIST2 share elements." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1691 (let ((result nil)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1692 (mapc (lambda (elt) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1693 (if (memq elt list2) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1694 (setq result t))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1695 list1) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1696 result)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1697 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1698 (defun newsticker--update-process-ids () |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1699 "Update list of ids of active newsticker processes. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1700 Checks list of active processes against list of newsticker processes." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1701 (let ((active-procs (process-list)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1702 (new-list nil)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1703 (mapc (lambda (proc) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1704 (let ((id (process-id proc))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1705 (if (memq id newsticker--process-ids) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1706 (setq new-list (cons id new-list))))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1707 active-procs) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1708 (setq newsticker--process-ids new-list)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1709 (force-mode-line-update)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1710 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1711 ;; ====================================================================== |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1712 ;;; Images |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1713 ;; ====================================================================== |
99885
7161bac8c5a8
newsticker: cache file redesign.
Ulf Jasper <ulf.jasper@web.de>
parents:
99287
diff
changeset
|
1714 (defun newsticker--images-dir () |
7161bac8c5a8
newsticker: cache file redesign.
Ulf Jasper <ulf.jasper@web.de>
parents:
99287
diff
changeset
|
1715 "Return directory where feed images are saved." |
7161bac8c5a8
newsticker: cache file redesign.
Ulf Jasper <ulf.jasper@web.de>
parents:
99287
diff
changeset
|
1716 (concat newsticker-dir "/images")) |
7161bac8c5a8
newsticker: cache file redesign.
Ulf Jasper <ulf.jasper@web.de>
parents:
99287
diff
changeset
|
1717 |
95901
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1718 (defun newsticker--image-get (feed-name url) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1719 "Get image of the news site FEED-NAME from URL. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1720 If the image has been downloaded in the last 24h do nothing." |
99885
7161bac8c5a8
newsticker: cache file redesign.
Ulf Jasper <ulf.jasper@web.de>
parents:
99287
diff
changeset
|
1721 (let ((image-name (concat (newsticker--images-dir) feed-name))) |
95901
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1722 (if (and (file-exists-p image-name) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1723 (time-less-p (current-time) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1724 (time-add (nth 5 (file-attributes image-name)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1725 (seconds-to-time 86400)))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1726 (newsticker--debug-msg "%s: Getting image for %s skipped" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1727 (format-time-string "%A, %H:%M" (current-time)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1728 feed-name) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1729 ;; download |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1730 (newsticker--debug-msg "%s: Getting image for %s" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1731 (format-time-string "%A, %H:%M" (current-time)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1732 feed-name) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1733 (let* ((buffername (concat " *newsticker-wget-image-" feed-name "*")) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1734 (item (or (assoc feed-name newsticker-url-list) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1735 (assoc feed-name newsticker-url-list-defaults) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1736 (error |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1737 "Cannot get news for %s: Check newsticker-url-list" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1738 feed-name))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1739 (wget-arguments (or (car (cdr (cdr (cdr (cdr item))))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1740 newsticker-wget-arguments))) |
105813
df4934f25eef
* textmodes/two-column.el (2C-split):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
105074
diff
changeset
|
1741 (with-current-buffer (get-buffer-create buffername) |
95901
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1742 (erase-buffer) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1743 ;; throw an error if there is an old wget-process around |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1744 (if (get-process feed-name) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1745 (error "Another wget-process is running for image %s" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1746 feed-name)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1747 ;; start wget |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1748 (let* ((args (append wget-arguments (list url))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1749 (proc (apply 'start-process feed-name buffername |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1750 newsticker-wget-name args))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1751 (set-process-coding-system proc 'no-conversion 'no-conversion) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1752 (set-process-sentinel proc 'newsticker--image-sentinel))))))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1753 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1754 (defun newsticker--image-sentinel (process event) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1755 "Sentinel for image-retrieving PROCESS caused by EVENT." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1756 (let* ((p-status (process-status process)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1757 (exit-status (process-exit-status process)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1758 (feed-name (process-name process))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1759 ;; catch known errors (zombie processes, rubbish-xml, etc.) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1760 ;; if an error occurs the news feed is not updated! |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1761 (catch 'oops |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1762 (unless (and (eq p-status 'exit) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1763 (= exit-status 0)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1764 (message "%s: Error while retrieving image from %s" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1765 (format-time-string "%A, %H:%M" (current-time)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1766 feed-name) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1767 (throw 'oops nil)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1768 (let (image-name) |
105813
df4934f25eef
* textmodes/two-column.el (2C-split):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
105074
diff
changeset
|
1769 (with-current-buffer (process-buffer process) |
99885
7161bac8c5a8
newsticker: cache file redesign.
Ulf Jasper <ulf.jasper@web.de>
parents:
99287
diff
changeset
|
1770 (setq image-name (concat (newsticker--images-dir) feed-name)) |
95901
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1771 (set-buffer-file-coding-system 'no-conversion) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1772 ;; make sure the cache dir exists |
99885
7161bac8c5a8
newsticker: cache file redesign.
Ulf Jasper <ulf.jasper@web.de>
parents:
99287
diff
changeset
|
1773 (unless (file-directory-p (newsticker--images-dir)) |
7161bac8c5a8
newsticker: cache file redesign.
Ulf Jasper <ulf.jasper@web.de>
parents:
99287
diff
changeset
|
1774 (make-directory (newsticker--images-dir))) |
95901
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1775 ;; write and close buffer |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1776 (let ((require-final-newline nil) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1777 (backup-inhibited t) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1778 (coding-system-for-write 'no-conversion)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1779 (write-region nil nil image-name nil 'quiet)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1780 (set-buffer-modified-p nil) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1781 (kill-buffer (current-buffer))))))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1782 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1783 (defun newsticker--insert-image (img string) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1784 "Insert IMG with STRING at point." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1785 (insert-image img string)) |
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 ;;; HTML rendering |
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-htmlr-render (pos1 pos2) ; |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1791 "Replacement for `htmlr-render'. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1792 Renders the HTML code in the region POS1 to POS2 using htmlr." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1793 (let ((str (buffer-substring-no-properties pos1 pos2))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1794 (delete-region pos1 pos2) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1795 (insert |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1796 (with-temp-buffer |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1797 (insert str) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1798 (goto-char (point-min)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1799 ;; begin original htmlr-render |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1800 (when (fboundp 'htmlr-reset) (htmlr-reset)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1801 ;; something omitted here... |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1802 (when (fboundp 'htmlr-step) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1803 (while (< (point) (point-max)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1804 (htmlr-step))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1805 ;; end original htmlr-render |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1806 (newsticker--remove-whitespace (buffer-string)))))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1807 |
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 ;;; Manipulation of cached data |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1810 ;; ====================================================================== |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1811 (defun newsticker--cache-set-preformatted-contents (item contents) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1812 "Set preformatted contents of ITEM to CONTENTS." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1813 (if (nthcdr 6 item) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1814 (setcar (nthcdr 6 item) contents) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1815 (setcdr (nthcdr 5 item) (list contents)))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1816 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1817 (defun newsticker--cache-set-preformatted-title (item title) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1818 "Set preformatted title of ITEM to TITLE." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1819 (if (nthcdr 7 item) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1820 (setcar (nthcdr 7 item) title) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1821 (setcdr (nthcdr 6 item) title))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1822 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1823 (defun newsticker--cache-replace-age (data feed old-age new-age) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1824 "Mark all items in DATA in FEED which carry age OLD-AGE with NEW-AGE. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1825 If FEED is 'any it applies to all feeds. If OLD-AGE is 'any, |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1826 all marks are replaced by NEW-AGE. Removes all pre-formatted contents." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1827 (mapc (lambda (a-feed) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1828 (when (or (eq feed 'any) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1829 (eq (car a-feed) feed)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1830 (let ((items (cdr a-feed))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1831 (mapc (lambda (item) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1832 (when (or (eq old-age 'any) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1833 (eq (newsticker--age item) old-age)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1834 (setcar (nthcdr 4 item) new-age) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1835 (newsticker--do-forget-preformatted item))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1836 items)))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1837 data) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1838 data) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1839 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1840 (defun newsticker--cache-mark-expired (data feed old-age new-age time) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1841 "Mark all expired entries. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1842 This function sets the age entries in DATA in the feed FEED. If |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1843 an item's age is OLD-AGE it is set to NEW-AGE if the item is |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1844 older than TIME." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1845 (mapc |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1846 (lambda (a-feed) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1847 (when (or (eq feed 'any) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1848 (eq (car a-feed) feed)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1849 (let ((items (cdr a-feed))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1850 (mapc |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1851 (lambda (item) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1852 (when (eq (newsticker--age item) old-age) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1853 (let ((exp-time (time-add (newsticker--time item) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1854 (seconds-to-time time)))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1855 (when (time-less-p exp-time (current-time)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1856 (newsticker--debug-msg |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1857 "Item `%s' from %s has expired on %s" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1858 (newsticker--title item) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1859 (format-time-string "%Y-%02m-%d, %H:%M" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1860 (newsticker--time item)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1861 (format-time-string "%Y-%02m-%d, %H:%M" exp-time)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1862 (setcar (nthcdr 4 item) new-age))))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1863 items)))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1864 data) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1865 data) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1866 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1867 (defun newsticker--cache-contains (data feed title desc link age |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1868 &optional guid) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1869 "Check DATA whether FEED contains an item with the given properties. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1870 This function returns the contained item or nil if it is not |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1871 contained. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1872 The properties which are checked are TITLE, DESC, LINK, AGE, and |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1873 GUID. In general all properties must match in order to return a |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1874 certain item, except for the following cases. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1875 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1876 If AGE equals 'feed the TITLE, DESCription and LINK do not |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1877 matter. If DESC is nil it is ignored as well. If |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1878 `newsticker-desc-comp-max' is non-nil, only the first |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1879 `newsticker-desc-comp-max' characters of DESC are taken into |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1880 account. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1881 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1882 If GUID is non-nil it is sufficient to match this value, and the |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1883 other properties are ignored." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1884 ;;(newsticker--debug-msg "Looking for %s guid=%s" title guid) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1885 (condition-case nil |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1886 (catch 'found |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1887 (when (and desc newsticker-desc-comp-max |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1888 (> (length desc) newsticker-desc-comp-max)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1889 (setq desc (substring desc 0 newsticker-desc-comp-max))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1890 (mapc |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1891 (lambda (this-feed) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1892 (when (eq (car this-feed) feed) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1893 (mapc (lambda (anitem) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1894 (when (cond (guid |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1895 ;; global unique id can match |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1896 (string= guid (newsticker--guid anitem))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1897 (t;;FIXME? |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1898 (or |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1899 ;; or title, desc, etc. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1900 (and |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1901 ;;(or (not (eq age 'feed)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1902 ;; (eq (newsticker--age anitem) 'feed)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1903 (string= (newsticker--title anitem) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1904 title) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1905 (or (not link) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1906 (string= (newsticker--link anitem) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1907 link)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1908 (or (not desc) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1909 (if (and desc newsticker-desc-comp-max |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1910 (> (length (newsticker--desc |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1911 anitem)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1912 newsticker-desc-comp-max)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1913 (string= (substring |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1914 (newsticker--desc anitem) |
99885
7161bac8c5a8
newsticker: cache file redesign.
Ulf Jasper <ulf.jasper@web.de>
parents:
99287
diff
changeset
|
1915 0 |
95901
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1916 newsticker-desc-comp-max) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1917 desc) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1918 (string= (newsticker--desc anitem) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1919 desc))))))) |
99885
7161bac8c5a8
newsticker: cache file redesign.
Ulf Jasper <ulf.jasper@web.de>
parents:
99287
diff
changeset
|
1920 ;;(newsticker--debug-msg "Found %s guid=%s" |
95901
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1921 ;; (newsticker--title anitem) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1922 ;; (newsticker--guid anitem)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1923 (throw 'found anitem))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1924 (cdr this-feed)))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1925 data) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1926 ;;(newsticker--debug-msg "Found nothing") |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1927 nil) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1928 (error nil))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1929 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1930 (defun newsticker--cache-add (data feed-name-symbol title desc link time age |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1931 position extra-elements |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1932 &optional updated-time updated-age |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1933 preformatted-contents |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1934 preformatted-title) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1935 "Add another item to cache data. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1936 Add to DATA in the FEED-NAME-SYMBOL an item with TITLE, DESC, |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1937 LINK, TIME, AGE, POSITION, and EXTRA-ELEMENTS. If this item is |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1938 contained already, its time is set to UPDATED-TIME, its mark is |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1939 set to UPDATED-AGE, and its pre-formatted contents is set to |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1940 PREFORMATTED-CONTENTS and PREFORMATTED-TITLE. Returns the age |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1941 which the item got." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1942 (let* ((guid (newsticker--guid-to-string (assoc 'guid extra-elements))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1943 (item (newsticker--cache-contains data feed-name-symbol title desc link |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1944 age guid))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1945 ;;(message "guid=%s" guid) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1946 (if item |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1947 ;; does exist already -- change age, update time and position |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1948 (progn |
99885
7161bac8c5a8
newsticker: cache file redesign.
Ulf Jasper <ulf.jasper@web.de>
parents:
99287
diff
changeset
|
1949 ;;(newsticker--debug-msg "Updating item %s %s %s %s %s -> %s %s |
95901
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1950 ;; (guid %s -> %s)" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1951 ;; feed-name-symbol title link time age |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1952 ;; updated-time updated-age |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1953 ;; guid (newsticker--guid item)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1954 (if (nthcdr 5 item) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1955 (setcar (nthcdr 5 item) position) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1956 (setcdr (nthcdr 4 item) (list position))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1957 (setcar (nthcdr 4 item) updated-age) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1958 (if updated-time |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1959 (setcar (nthcdr 3 item) updated-time)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1960 ;; replace cached pre-formatted contents |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1961 (newsticker--cache-set-preformatted-contents |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1962 item preformatted-contents) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1963 (newsticker--cache-set-preformatted-title |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1964 item preformatted-title)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1965 ;; did not exist or age equals 'feed-name-symbol |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1966 (setq item (list title desc link time age position preformatted-contents |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1967 preformatted-title extra-elements)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1968 ;;(newsticker--debug-msg "Adding item %s" item) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1969 (catch 'found |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1970 (mapc (lambda (this-feed) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1971 (when (eq (car this-feed) feed-name-symbol) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1972 (setcdr this-feed (nconc (cdr this-feed) (list item))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1973 (throw 'found this-feed))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1974 data) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1975 ;; the feed is not contained |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1976 (add-to-list 'data (list feed-name-symbol item) t)))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1977 data) |
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--cache-remove (data feed-symbol age) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1980 "Remove all entries from DATA in the feed FEED-SYMBOL with AGE. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1981 FEED-SYMBOL may be 'any. Entries from old feeds, which are no longer in |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1982 `newsticker-url-list' or `newsticker-url-list-defaults', are removed as |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1983 well." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1984 (let* ((pos data) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1985 (feed (car pos)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1986 (last-pos nil)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1987 (while feed |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1988 (if (or (assoc (symbol-name (car feed)) newsticker-url-list) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1989 (assoc (symbol-name (car feed)) newsticker-url-list-defaults)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1990 ;; feed is still valid=active |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1991 ;; (message "Keeping feed %s" (car feed)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1992 (if (or (eq feed-symbol 'any) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1993 (eq feed-symbol (car feed))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1994 (let* ((item-pos (cdr feed)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1995 (item (car item-pos)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1996 (prev-pos nil)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1997 (while item |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1998 ;;(message "%s" (car item)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
1999 (if (eq age (newsticker--age item)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2000 ;; remove this item |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2001 (progn |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2002 ;;(message "Removing item %s" (car item)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2003 (if prev-pos |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2004 (setcdr prev-pos (cdr item-pos)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2005 (setcdr feed (cdr item-pos)))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2006 ;;(message "Keeping item %s" (car item)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2007 (setq prev-pos item-pos)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2008 (setq item-pos (cdr item-pos)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2009 (setq item (car item-pos))))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2010 ;; feed is not active anymore |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2011 ;; (message "Removing feed %s" (car feed)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2012 (if last-pos |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2013 (setcdr last-pos (cdr pos)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2014 (setq data (cdr pos)))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2015 (setq last-pos pos) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2016 (setq pos (cdr pos)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2017 (setq feed (car pos))))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2018 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2019 ;; ====================================================================== |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2020 ;;; Sorting |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2021 ;; ====================================================================== |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2022 (defun newsticker--cache-item-compare-by-time (item1 item2) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2023 "Compare two news items ITEM1 and ITEM2 by comparing their time values." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2024 (catch 'result |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2025 (let ((age1 (newsticker--age item1)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2026 (age2 (newsticker--age item2))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2027 (if (not (eq age1 age2)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2028 (cond ((eq age1 'obsolete) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2029 (throw 'result nil)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2030 ((eq age2 'obsolete) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2031 (throw 'result t))))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2032 (let* ((time1 (newsticker--time item1)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2033 (time2 (newsticker--time item2))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2034 (cond ((< (nth 0 time1) (nth 0 time2)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2035 nil) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2036 ((> (nth 0 time1) (nth 0 time2)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2037 t) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2038 ((< (nth 1 time1) (nth 1 time2)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2039 nil) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2040 ((> (nth 1 time1) (nth 1 time2)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2041 t) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2042 ((< (or (nth 2 time1) 0) (or (nth 2 time2) 0)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2043 nil) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2044 ((> (or (nth 2 time1) 0) (or (nth 2 time2) 0)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2045 t) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2046 (t |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2047 nil))))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2048 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2049 (defun newsticker--cache-item-compare-by-title (item1 item2) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2050 "Compare ITEM1 and ITEM2 by comparing their titles." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2051 (catch 'result |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2052 (let ((age1 (newsticker--age item1)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2053 (age2 (newsticker--age item2))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2054 (if (not (eq age1 age2)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2055 (cond ((eq age1 'obsolete) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2056 (throw 'result nil)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2057 ((eq age2 'obsolete) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2058 (throw 'result t))))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2059 (string< (newsticker--title item1) (newsticker--title item2)))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2060 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2061 (defun newsticker--cache-item-compare-by-position (item1 item2) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2062 "Compare ITEM1 and ITEM2 by comparing their original positions." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2063 (catch 'result |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2064 (let ((age1 (newsticker--age item1)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2065 (age2 (newsticker--age item2))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2066 (if (not (eq age1 age2)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2067 (cond ((eq age1 'obsolete) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2068 (throw 'result nil)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2069 ((eq age2 'obsolete) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2070 (throw 'result t))))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2071 (< (or (newsticker--pos item1) 0) (or (newsticker--pos item2) 0)))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2072 |
99885
7161bac8c5a8
newsticker: cache file redesign.
Ulf Jasper <ulf.jasper@web.de>
parents:
99287
diff
changeset
|
2073 (defun newsticker--cache-save-version1 () |
95901
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2074 "Update and save newsticker cache file." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2075 (interactive) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2076 (newsticker--cache-update t)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2077 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2078 (defun newsticker--cache-update (&optional save) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2079 "Update newsticker cache file. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2080 If optional argument SAVE is not nil the cache file is saved to disk." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2081 (save-excursion |
99885
7161bac8c5a8
newsticker: cache file redesign.
Ulf Jasper <ulf.jasper@web.de>
parents:
99287
diff
changeset
|
2082 (unless (file-directory-p newsticker-dir) |
7161bac8c5a8
newsticker: cache file redesign.
Ulf Jasper <ulf.jasper@web.de>
parents:
99287
diff
changeset
|
2083 (make-directory newsticker-dir t)) |
99287
80eabff1490b
newsticker fixes: cachefile, layout changes.
Ulf Jasper <ulf.jasper@web.de>
parents:
96542
diff
changeset
|
2084 (let ((coding-system-for-write 'utf-8) |
80eabff1490b
newsticker fixes: cachefile, layout changes.
Ulf Jasper <ulf.jasper@web.de>
parents:
96542
diff
changeset
|
2085 (buf (find-file-noselect newsticker-cache-filename))) |
80eabff1490b
newsticker fixes: cachefile, layout changes.
Ulf Jasper <ulf.jasper@web.de>
parents:
96542
diff
changeset
|
2086 (when buf |
80eabff1490b
newsticker fixes: cachefile, layout changes.
Ulf Jasper <ulf.jasper@web.de>
parents:
96542
diff
changeset
|
2087 (set-buffer buf) |
95901
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2088 (setq buffer-undo-list t) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2089 (erase-buffer) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2090 (insert ";; -*- coding: utf-8 -*-\n") |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2091 (insert (prin1-to-string newsticker--cache)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2092 (when save |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2093 (save-buffer)))))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2094 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2095 (defun newsticker--cache-get-feed (feed) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2096 "Return the cached data for the feed FEED. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2097 FEED is a symbol!" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2098 (assoc feed newsticker--cache)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2099 |
99885
7161bac8c5a8
newsticker: cache file redesign.
Ulf Jasper <ulf.jasper@web.de>
parents:
99287
diff
changeset
|
2100 (defun newsticker--cache-dir () |
7161bac8c5a8
newsticker: cache file redesign.
Ulf Jasper <ulf.jasper@web.de>
parents:
99287
diff
changeset
|
2101 "Return directory for saving cache data." |
7161bac8c5a8
newsticker: cache file redesign.
Ulf Jasper <ulf.jasper@web.de>
parents:
99287
diff
changeset
|
2102 (concat newsticker-dir "/feeds")) |
7161bac8c5a8
newsticker: cache file redesign.
Ulf Jasper <ulf.jasper@web.de>
parents:
99287
diff
changeset
|
2103 |
7161bac8c5a8
newsticker: cache file redesign.
Ulf Jasper <ulf.jasper@web.de>
parents:
99287
diff
changeset
|
2104 (defun newsticker--cache-save () |
7161bac8c5a8
newsticker: cache file redesign.
Ulf Jasper <ulf.jasper@web.de>
parents:
99287
diff
changeset
|
2105 "Save cache data for all feeds." |
7161bac8c5a8
newsticker: cache file redesign.
Ulf Jasper <ulf.jasper@web.de>
parents:
99287
diff
changeset
|
2106 (unless (file-directory-p newsticker-dir) |
7161bac8c5a8
newsticker: cache file redesign.
Ulf Jasper <ulf.jasper@web.de>
parents:
99287
diff
changeset
|
2107 (make-directory newsticker-dir t)) |
7161bac8c5a8
newsticker: cache file redesign.
Ulf Jasper <ulf.jasper@web.de>
parents:
99287
diff
changeset
|
2108 (mapc 'newsticker--cache-save-feed newsticker--cache) |
7161bac8c5a8
newsticker: cache file redesign.
Ulf Jasper <ulf.jasper@web.de>
parents:
99287
diff
changeset
|
2109 nil) |
7161bac8c5a8
newsticker: cache file redesign.
Ulf Jasper <ulf.jasper@web.de>
parents:
99287
diff
changeset
|
2110 |
7161bac8c5a8
newsticker: cache file redesign.
Ulf Jasper <ulf.jasper@web.de>
parents:
99287
diff
changeset
|
2111 (defun newsticker--cache-save-feed (feed) |
7161bac8c5a8
newsticker: cache file redesign.
Ulf Jasper <ulf.jasper@web.de>
parents:
99287
diff
changeset
|
2112 "Save cache data for FEED." |
7161bac8c5a8
newsticker: cache file redesign.
Ulf Jasper <ulf.jasper@web.de>
parents:
99287
diff
changeset
|
2113 (let ((dir (concat (newsticker--cache-dir) "/" (symbol-name (car feed))))) |
7161bac8c5a8
newsticker: cache file redesign.
Ulf Jasper <ulf.jasper@web.de>
parents:
99287
diff
changeset
|
2114 (unless (file-directory-p dir) |
7161bac8c5a8
newsticker: cache file redesign.
Ulf Jasper <ulf.jasper@web.de>
parents:
99287
diff
changeset
|
2115 (make-directory dir t)) |
7161bac8c5a8
newsticker: cache file redesign.
Ulf Jasper <ulf.jasper@web.de>
parents:
99287
diff
changeset
|
2116 (let ((coding-system-for-write 'utf-8)) |
7161bac8c5a8
newsticker: cache file redesign.
Ulf Jasper <ulf.jasper@web.de>
parents:
99287
diff
changeset
|
2117 (with-temp-file (concat dir "/data") |
7161bac8c5a8
newsticker: cache file redesign.
Ulf Jasper <ulf.jasper@web.de>
parents:
99287
diff
changeset
|
2118 (insert ";; -*- coding: utf-8 -*-\n") |
7161bac8c5a8
newsticker: cache file redesign.
Ulf Jasper <ulf.jasper@web.de>
parents:
99287
diff
changeset
|
2119 (insert (prin1-to-string (cdr feed))))))) |
7161bac8c5a8
newsticker: cache file redesign.
Ulf Jasper <ulf.jasper@web.de>
parents:
99287
diff
changeset
|
2120 |
7161bac8c5a8
newsticker: cache file redesign.
Ulf Jasper <ulf.jasper@web.de>
parents:
99287
diff
changeset
|
2121 (defun newsticker--cache-read-version1 () |
7161bac8c5a8
newsticker: cache file redesign.
Ulf Jasper <ulf.jasper@web.de>
parents:
99287
diff
changeset
|
2122 "Read version1 cache data." |
7161bac8c5a8
newsticker: cache file redesign.
Ulf Jasper <ulf.jasper@web.de>
parents:
99287
diff
changeset
|
2123 (let ((coding-system-for-read 'utf-8)) |
7161bac8c5a8
newsticker: cache file redesign.
Ulf Jasper <ulf.jasper@web.de>
parents:
99287
diff
changeset
|
2124 (when (file-exists-p newsticker-cache-filename) |
7161bac8c5a8
newsticker: cache file redesign.
Ulf Jasper <ulf.jasper@web.de>
parents:
99287
diff
changeset
|
2125 (with-temp-buffer |
7161bac8c5a8
newsticker: cache file redesign.
Ulf Jasper <ulf.jasper@web.de>
parents:
99287
diff
changeset
|
2126 (insert-file-contents newsticker-cache-filename) |
7161bac8c5a8
newsticker: cache file redesign.
Ulf Jasper <ulf.jasper@web.de>
parents:
99287
diff
changeset
|
2127 (goto-char (point-min)) |
7161bac8c5a8
newsticker: cache file redesign.
Ulf Jasper <ulf.jasper@web.de>
parents:
99287
diff
changeset
|
2128 (condition-case nil |
7161bac8c5a8
newsticker: cache file redesign.
Ulf Jasper <ulf.jasper@web.de>
parents:
99287
diff
changeset
|
2129 (setq newsticker--cache (read (current-buffer))) |
7161bac8c5a8
newsticker: cache file redesign.
Ulf Jasper <ulf.jasper@web.de>
parents:
99287
diff
changeset
|
2130 (error |
7161bac8c5a8
newsticker: cache file redesign.
Ulf Jasper <ulf.jasper@web.de>
parents:
99287
diff
changeset
|
2131 (message "Error while reading newsticker cache file!") |
7161bac8c5a8
newsticker: cache file redesign.
Ulf Jasper <ulf.jasper@web.de>
parents:
99287
diff
changeset
|
2132 (setq newsticker--cache nil))))))) |
7161bac8c5a8
newsticker: cache file redesign.
Ulf Jasper <ulf.jasper@web.de>
parents:
99287
diff
changeset
|
2133 |
7161bac8c5a8
newsticker: cache file redesign.
Ulf Jasper <ulf.jasper@web.de>
parents:
99287
diff
changeset
|
2134 (defun newsticker--cache-read () |
7161bac8c5a8
newsticker: cache file redesign.
Ulf Jasper <ulf.jasper@web.de>
parents:
99287
diff
changeset
|
2135 "Read cache data." |
7161bac8c5a8
newsticker: cache file redesign.
Ulf Jasper <ulf.jasper@web.de>
parents:
99287
diff
changeset
|
2136 (setq newsticker--cache nil) |
7161bac8c5a8
newsticker: cache file redesign.
Ulf Jasper <ulf.jasper@web.de>
parents:
99287
diff
changeset
|
2137 (if (file-exists-p newsticker-cache-filename) |
7161bac8c5a8
newsticker: cache file redesign.
Ulf Jasper <ulf.jasper@web.de>
parents:
99287
diff
changeset
|
2138 (progn |
7161bac8c5a8
newsticker: cache file redesign.
Ulf Jasper <ulf.jasper@web.de>
parents:
99287
diff
changeset
|
2139 (when (y-or-n-p "Old newsticker cache file exists. Read it? ") |
7161bac8c5a8
newsticker: cache file redesign.
Ulf Jasper <ulf.jasper@web.de>
parents:
99287
diff
changeset
|
2140 (newsticker--cache-read-version1)) |
101409
fcf22206598b
newsticker: fixed bug#1710
Ulf Jasper <ulf.jasper@web.de>
parents:
100908
diff
changeset
|
2141 (when (y-or-n-p (format "Delete old newsticker cache file? ")) |
fcf22206598b
newsticker: fixed bug#1710
Ulf Jasper <ulf.jasper@web.de>
parents:
100908
diff
changeset
|
2142 (delete-file newsticker-cache-filename))) |
99885
7161bac8c5a8
newsticker: cache file redesign.
Ulf Jasper <ulf.jasper@web.de>
parents:
99287
diff
changeset
|
2143 (mapc (lambda (f) |
7161bac8c5a8
newsticker: cache file redesign.
Ulf Jasper <ulf.jasper@web.de>
parents:
99287
diff
changeset
|
2144 (newsticker--cache-read-feed (car f))) |
7161bac8c5a8
newsticker: cache file redesign.
Ulf Jasper <ulf.jasper@web.de>
parents:
99287
diff
changeset
|
2145 (append newsticker-url-list-defaults newsticker-url-list)))) |
7161bac8c5a8
newsticker: cache file redesign.
Ulf Jasper <ulf.jasper@web.de>
parents:
99287
diff
changeset
|
2146 |
7161bac8c5a8
newsticker: cache file redesign.
Ulf Jasper <ulf.jasper@web.de>
parents:
99287
diff
changeset
|
2147 (defun newsticker--cache-read-feed (feed-name) |
7161bac8c5a8
newsticker: cache file redesign.
Ulf Jasper <ulf.jasper@web.de>
parents:
99287
diff
changeset
|
2148 "Read cache data for feed named FEED-NAME." |
7161bac8c5a8
newsticker: cache file redesign.
Ulf Jasper <ulf.jasper@web.de>
parents:
99287
diff
changeset
|
2149 (let ((file-name (concat (newsticker--cache-dir) "/" feed-name "/data")) |
7161bac8c5a8
newsticker: cache file redesign.
Ulf Jasper <ulf.jasper@web.de>
parents:
99287
diff
changeset
|
2150 (coding-system-for-read 'utf-8)) |
7161bac8c5a8
newsticker: cache file redesign.
Ulf Jasper <ulf.jasper@web.de>
parents:
99287
diff
changeset
|
2151 (when (file-exists-p file-name) |
7161bac8c5a8
newsticker: cache file redesign.
Ulf Jasper <ulf.jasper@web.de>
parents:
99287
diff
changeset
|
2152 (with-temp-buffer |
7161bac8c5a8
newsticker: cache file redesign.
Ulf Jasper <ulf.jasper@web.de>
parents:
99287
diff
changeset
|
2153 (insert-file-contents file-name) |
7161bac8c5a8
newsticker: cache file redesign.
Ulf Jasper <ulf.jasper@web.de>
parents:
99287
diff
changeset
|
2154 (goto-char (point-min)) |
7161bac8c5a8
newsticker: cache file redesign.
Ulf Jasper <ulf.jasper@web.de>
parents:
99287
diff
changeset
|
2155 (condition-case nil |
7161bac8c5a8
newsticker: cache file redesign.
Ulf Jasper <ulf.jasper@web.de>
parents:
99287
diff
changeset
|
2156 (add-to-list 'newsticker--cache (cons (intern feed-name) |
7161bac8c5a8
newsticker: cache file redesign.
Ulf Jasper <ulf.jasper@web.de>
parents:
99287
diff
changeset
|
2157 (read (current-buffer)))) |
7161bac8c5a8
newsticker: cache file redesign.
Ulf Jasper <ulf.jasper@web.de>
parents:
99287
diff
changeset
|
2158 (error |
7161bac8c5a8
newsticker: cache file redesign.
Ulf Jasper <ulf.jasper@web.de>
parents:
99287
diff
changeset
|
2159 (message "Error while reading newsticker cache file %s!" |
105074
45b5d5aae703
Fix typos in condition-case handlers.
Glenn Morris <rgm@gnu.org>
parents:
104797
diff
changeset
|
2160 file-name) |
45b5d5aae703
Fix typos in condition-case handlers.
Glenn Morris <rgm@gnu.org>
parents:
104797
diff
changeset
|
2161 (setq newsticker--cache nil))))))) |
99885
7161bac8c5a8
newsticker: cache file redesign.
Ulf Jasper <ulf.jasper@web.de>
parents:
99287
diff
changeset
|
2162 |
95901
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2163 ;; ====================================================================== |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2164 ;;; Statistics |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2165 ;; ====================================================================== |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2166 (defun newsticker--stat-num-items (feed &rest ages) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2167 "Return number of items in the given FEED which have one of the given AGES. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2168 If AGES is nil, the total number of items is returned." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2169 (let ((items (cdr (newsticker--cache-get-feed feed))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2170 (num 0)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2171 (while items |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2172 (if ages |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2173 (if (memq (newsticker--age (car items)) ages) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2174 (setq num (1+ num))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2175 (if (memq (newsticker--age (car items)) '(new old immortal obsolete)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2176 (setq num (1+ num)))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2177 (setq items (cdr items))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2178 num)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2179 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2180 (defun newsticker--stat-num-items-total (&optional age) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2181 "Return total number of items in all feeds which have the given AGE. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2182 If AGE is nil, the total number of items is returned." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2183 (apply '+ |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2184 (mapcar (lambda (feed) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2185 (if age |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2186 (newsticker--stat-num-items (intern (car feed)) age) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2187 (newsticker--stat-num-items (intern (car feed))))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2188 (append newsticker-url-list-defaults newsticker-url-list)))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2189 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2190 ;; ====================================================================== |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2191 ;;; OPML |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2192 ;; ====================================================================== |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2193 (defun newsticker-opml-export () |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2194 "OPML subscription export. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2195 Export subscriptions to a buffer in OPML Format." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2196 (interactive) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2197 (with-current-buffer (get-buffer-create "*OPML Export*") |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2198 (set-buffer-file-coding-system 'utf-8) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2199 (insert (concat |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2200 "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2201 "<!-- OPML generated by Emacs newsticker.el -->\n" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2202 "<opml version=\"1.0\">\n" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2203 " <head>\n" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2204 " <title>mySubscriptions</title>\n" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2205 " <dateCreated>" (format-time-string "%a, %d %b %Y %T %z") |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2206 "</dateCreated>\n" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2207 " <ownerEmail>" user-mail-address "</ownerEmail>\n" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2208 " <ownerName>" (user-full-name) "</ownerName>\n" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2209 " </head>\n" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2210 " <body>\n")) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2211 (mapc (lambda (sub) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2212 (insert " <outline text=\"") |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2213 (insert (newsticker--title sub)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2214 (insert "\" xmlUrl=\"") |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2215 (insert (cadr sub)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2216 (insert "\"/>\n")) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2217 (append newsticker-url-list newsticker-url-list-defaults)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2218 (insert " </body>\n</opml>\n")) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2219 (pop-to-buffer "*OPML Export*") |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2220 (when (fboundp 'sgml-mode) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2221 (sgml-mode))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2222 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2223 (defun newsticker--opml-import-outlines (outlines) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2224 "Recursively import OUTLINES from OPML data. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2225 Note that nested outlines are currently flattened -- i.e. grouping is |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2226 removed." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2227 (mapc (lambda (outline) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2228 (let ((name (xml-get-attribute outline 'text)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2229 (url (xml-get-attribute outline 'xmlUrl)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2230 (children (xml-get-children outline 'outline))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2231 (unless (string= "" url) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2232 (add-to-list 'newsticker-url-list |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2233 (list name url nil nil nil) t)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2234 (if children |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2235 (newsticker--opml-import-outlines children)))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2236 outlines)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2237 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2238 (defun newsticker-opml-import (filename) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2239 "Import OPML data from FILENAME." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2240 (interactive "fOPML file: ") |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2241 (set-buffer (find-file-noselect filename)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2242 (goto-char (point-min)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2243 (let* ((node-list (xml-parse-region (point-min) (point-max))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2244 (body (car (xml-get-children (car node-list) 'body))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2245 (outlines (xml-get-children body 'outline))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2246 (newsticker--opml-import-outlines outlines)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2247 (customize-variable 'newsticker-url-list)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2248 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2249 ;; ====================================================================== |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2250 ;;; Auto marking |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2251 ;; ====================================================================== |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2252 (defun newsticker--run-auto-mark-filter (feed item) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2253 "Automatically mark an item as old or immortal. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2254 This function checks the variable `newsticker-auto-mark-filter-list' |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2255 for an entry that matches FEED and ITEM." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2256 (let ((case-fold-search t)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2257 (mapc (lambda (filter) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2258 (let ((filter-feed (car filter)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2259 (pattern-list (cadr filter))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2260 (when (string-match filter-feed feed) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2261 (newsticker--do-run-auto-mark-filter item pattern-list)))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2262 newsticker-auto-mark-filter-list))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2263 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2264 (defun newsticker--do-run-auto-mark-filter (item list) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2265 "Actually compare ITEM against the pattern-LIST. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2266 LIST must be an element of `newsticker-auto-mark-filter-list'." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2267 (mapc (lambda (pattern) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2268 (let ((age (nth 0 pattern)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2269 (place (nth 1 pattern)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2270 (regexp (nth 2 pattern)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2271 (title (newsticker--title item)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2272 (desc (newsticker--desc item))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2273 (when (or (eq place 'title) (eq place 'all)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2274 (when (and title (string-match regexp title)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2275 (newsticker--debug-msg "Auto-marking as %s: `%s'" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2276 age (newsticker--title item)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2277 (setcar (nthcdr 4 item) age))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2278 (when (or (eq place 'description) (eq place 'all)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2279 (when (and desc (string-match regexp desc)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2280 (newsticker--debug-msg "Auto-marking as %s: `%s'" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2281 age (newsticker--title item)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2282 (setcar (nthcdr 4 item) age))))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2283 list)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2284 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2285 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2286 ;; ====================================================================== |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2287 ;;; Hook samples |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2288 ;; ====================================================================== |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2289 (defun newsticker-new-item-functions-sample (feed item) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2290 "Demonstrate the use of the `newsticker-new-item-functions' hook. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2291 This function just prints out the values of the FEED and title of the ITEM." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2292 (message (concat "newsticker-new-item-functions-sample: feed=`%s', " |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2293 "title=`%s'") |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2294 feed (newsticker--title item))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2295 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2296 (defun newsticker-download-images (feed item) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2297 "Download the first image. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2298 If FEED equals \"imagefeed\" download the first image URL found |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2299 in the description=contents of ITEM to the directory |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2300 \"~/tmp/newsticker/FEED/TITLE\" where TITLE is the title of the item." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2301 (when (string= feed "imagefeed") |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2302 (let ((title (newsticker--title item)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2303 (desc (newsticker--desc item))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2304 (when (string-match "<img src=\"\\(http://[^ \"]+\\)\"" desc) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2305 (let ((url (substring desc (match-beginning 1) (match-end 1))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2306 (temp-dir (concat "~/tmp/newsticker/" feed "/" title)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2307 (org-dir default-directory)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2308 (unless (file-directory-p temp-dir) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2309 (make-directory temp-dir t)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2310 (cd temp-dir) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2311 (message "Getting image %s" url) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2312 (apply 'start-process "wget-image" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2313 " *newsticker-wget-download-images*" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2314 newsticker-wget-name |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2315 (list url)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2316 (cd org-dir)))))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2317 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2318 (defun newsticker-download-enclosures (feed item) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2319 "In all FEEDs download the enclosed object of the news ITEM. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2320 The object is saved to the directory \"~/tmp/newsticker/FEED/TITLE\", which |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2321 is created if it does not exist. TITLE is the title of the news |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2322 item. Argument FEED is ignored. |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2323 This function is suited for adding it to `newsticker-new-item-functions'." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2324 (let ((title (newsticker--title item)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2325 (enclosure (newsticker--enclosure item))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2326 (when enclosure |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2327 (let ((url (cdr (assoc 'url enclosure))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2328 (temp-dir (concat "~/tmp/newsticker/" feed "/" title)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2329 (org-dir default-directory)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2330 (unless (file-directory-p temp-dir) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2331 (make-directory temp-dir t)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2332 (cd temp-dir) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2333 (message "Getting enclosure %s" url) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2334 (apply 'start-process "wget-enclosure" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2335 " *newsticker-wget-download-enclosures*" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2336 newsticker-wget-name |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2337 (list url)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2338 (cd org-dir))))) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2339 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2340 ;; ====================================================================== |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2341 ;;; Retrieve samples |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2342 ;; ====================================================================== |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2343 (defun newsticker-retrieve-random-message (feed-name) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2344 "Return an artificial RSS string under the name FEED-NAME." |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2345 (concat "<?xml version=\"1.0\" encoding=\"iso-8859-1\" ?><rss version=\"0.91\">" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2346 "<channel>" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2347 "<title>newsticker-retrieve-random-message</title>" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2348 "<description>Sample retrieval function</description>" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2349 "<pubDate>FIXME Sat, 07 Sep 2005 00:00:01 GMT</pubDate>" |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2350 "<item><title>" (format "Your lucky number is %d" (random 10000)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2351 "</title><description>" (format "Or maybe it is %d" (random 10000)) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2352 "</description></item></channel></rss>")) |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2353 |
106460 | 2354 (provide 'newst-backend) |
95901
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2355 |
b4bd9957663d
Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff
changeset
|
2356 ;; arch-tag: 0e37b658-56e9-49ab-90f9-f2df57e1a659 |
99885
7161bac8c5a8
newsticker: cache file redesign.
Ulf Jasper <ulf.jasper@web.de>
parents:
99287
diff
changeset
|
2357 ;;; newst-backend.el ends here |