annotate lisp/net/newst-backend.el @ 109635:fc7a8c411aa3

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