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