Nuke arch-tags.
[emacs.git] / lisp / net / newsticker.el
blob0e807cca303a4810a34a9408d8e4851e8de19a4a
1 ;;; newsticker.el --- A Newsticker for Emacs.
3 ;; Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
4 ;; Free Software Foundation, Inc.
6 ;; Author: Ulf Jasper <ulf.jasper@web.de>
7 ;; Filename: newsticker.el
8 ;; URL: http://www.nongnu.org/newsticker
9 ;; Created: 17. June 2003
10 ;; Keywords: News, RSS, Atom
11 ;; Time-stamp: "6. Dezember 2009, 19:15:18 (ulf)"
12 ;; Version: 1.99
14 ;; ======================================================================
16 ;; This file is part of GNU Emacs.
18 ;; GNU Emacs is free software: you can redistribute it and/or modify
19 ;; it under the terms of the GNU General Public License as published by
20 ;; the Free Software Foundation, either version 3 of the License, or
21 ;; (at your option) any later version.
23 ;; GNU Emacs is distributed in the hope that it will be useful,
24 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
25 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26 ;; GNU General Public License for more details.
28 ;; You should have received a copy of the GNU General Public License
29 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
31 (defconst newsticker-version "1.99" "Version number of newsticker.el.")
33 ;; ======================================================================
34 ;;; Commentary:
36 ;; Overview
37 ;; --------
39 ;; Newsticker provides a newsticker for Emacs. A newsticker is a thing
40 ;; that asynchronously retrieves headlines from a list of news sites,
41 ;; prepares these headlines for reading, and allows for loading the
42 ;; corresponding articles in a web browser.
44 ;; Headlines consist of a title and (possibly) a small description. They
45 ;; are contained in "RSS" (RDF Site Summary) or "Atom" files. Newsticker
46 ;; should work with the following RSS formats:
47 ;; * RSS 0.91
48 ;; (see http://backend.userland.com/rss091 or
49 ;; http://my.netscape.com/publish/formats/rss-spec-0.91.html)
50 ;; * RSS 0.92
51 ;; (see http://backend.userland.com/rss092)
52 ;; * RSS 1.0
53 ;; (see http://purl.org/rss/1.0/spec)
54 ;; * RSS 2.0
55 ;; (see http://blogs.law.harvard.edu/tech/rss)
56 ;; as well as the following Atom formats:
57 ;; * Atom 0.3
58 ;; * Atom 1.0
59 ;; (see http://www.ietf.org/internet-drafts/draft-ietf-atompub-format-11.txt)
60 ;; That makes Newsticker.el an "Atom aggregator, "RSS reader", "RSS
61 ;; aggregator", and "Feed Reader".
63 ;; Newsticker provides several commands for reading headlines, navigating
64 ;; through them, marking them as read/unread, hiding old headlines
65 ;; etc. Headlines can be displayed as plain text or as rendered HTML.
67 ;; Headlines can be displayed in the echo area, either scrolling like
68 ;; messages in a stock-quote ticker, or just changing.
70 ;; Newsticker allows for automatic processing of headlines by providing
71 ;; hooks and (sample) functions for automatically downloading images and
72 ;; enclosed files (as delivered by podcasts, e.g.).
74 ;; Requirements
75 ;; ------------
76 ;; Newsticker can be used with GNU Emacs version 21.1 or later as well as
77 ;; XEmacs. It requires an XML-parser (`xml.el') which is part of GNU
78 ;; Emacs. If you are using XEmacs you want to get the `net-utils' package
79 ;; which contains `xml.el' for XEmacs.
81 ;; Newsticker requires a program which can retrieve files via http and
82 ;; prints them to stdout. By default Newsticker will use wget for this
83 ;; task.
85 ;; Installation
86 ;; ------------
88 ;; If you are using Newsticker as part of GNU Emacs there is no need to
89 ;; perform any installation steps in order to use Newsticker. Otherwise
90 ;; place Newsticker in a directory where Emacs can find it. Add the
91 ;; following line to your Emacs startup file (`~/.emacs').
92 ;; (add-to-list 'load-path "/path/to/newsticker/")
93 ;; (autoload 'newsticker-start "newsticker" "Emacs Newsticker" t)
94 ;; (autoload 'newsticker-show-news "newsticker" "Emacs Newsticker" t)
96 ;; If you are using `imenu', which allows for navigating with the help of a
97 ;; menu, you should add the following to your Emacs startup file
98 ;; (`~/.emacs').
99 ;; (add-hook 'newsticker-mode-hook 'imenu-add-menubar-index)
101 ;; That's it.
103 ;; Usage
104 ;; -----
105 ;; The command newsticker-show-news will display all available headlines in
106 ;; a special buffer, called `*newsticker*'. It will also start the
107 ;; asynchronous download of headlines. The modeline in the `*newsticker*'
108 ;; buffer informs whenever new headlines have arrived. Clicking
109 ;; mouse-button 2 or pressing RET in this buffer on a headline will call
110 ;; browse-url to load the corresponding news story in your favourite web
111 ;; browser.
113 ;; The scrolling, or flashing of headlines in the echo area, can be started
114 ;; with the command newsticker-start-ticker. It can be stopped with
115 ;; newsticker-stop-ticker.
117 ;; If you just want to start the periodic download of headlines use the
118 ;; command newsticker-start. Calling newsticker-stop will stop the
119 ;; periodic download, but will call newsticker-stop-ticker as well.
121 ;; Configuration
122 ;; -------------
123 ;; All Newsticker options are customizable, i.e. they can be changed with
124 ;; Emacs customization methods: Call the command customize-group and enter
125 ;; `newsticker' for the customization group.
127 ;; All Newsticker options have reasonable default values, so that in most
128 ;; cases it is not necessary to customize settings before starting
129 ;; Newsticker for the first time.
131 ;; Newsticker options are organized in the following groups.
133 ;; * newsticker-feed contains options that define which news
134 ;; feeds are retrieved and how this is done.
135 ;; o newsticker-url-list defines the list of headlines which are
136 ;; retrieved.
137 ;; o newsticker-retrieval-interval defines how often headlines are
138 ;; retrieved.
139 ;; * newsticker-headline-processing contains options that define how the
140 ;; retrieved headlines are processed.
141 ;; o newsticker-keep-obsolete-items decides whether unread headlines that
142 ;; have been removed from the feed are kept in the Newsticker cache.
143 ;; * newsticker-layout contains options that define how the buffer for
144 ;; reading news headlines is formatted.
145 ;; o newsticker-item-format defines how the title of a headline is
146 ;; formatted.
147 ;; * newsticker-ticker contains options that define how headlines are shown
148 ;; in the echo area.
149 ;; o newsticker-display-interval and newsticker-scroll-smoothly define
150 ;; how headlines are shown in the echo area.
151 ;; * newsticker-hooks contains options for hooking other Emacs commands to
152 ;; newsticker functions.
153 ;; o newsticker-new-item-functions allows for automatic processing of
154 ;; headlines. See `newsticker-download-images', and
155 ;; `newsticker-download-enclosures' for sample functions.
156 ;; * newsticker-miscellaneous contains other Newsticker options.
158 ;; Please have a look at the customization buffers for the complete list of
159 ;; options.
161 ;; Remarks
162 ;; -------
163 ;; This newsticker is designed do its job silently in the background
164 ;; without disturbing you. However, it is probably impossible to prevent
165 ;; such a tool from slightly attenuating your Editor's responsiveness every
166 ;; once in a while.
168 ;; Byte-compiling newsticker.el is recommended.
170 ;; ======================================================================
171 ;;; History:
173 ;; 1.99
174 ;; * Lots! of changes.
176 ;; 1.10x
177 ;; * Support for download via url. Setting the new variable
178 ;; `newsticker-download-method' to 'intern will make newsticker
179 ;; use the url-package instead of the external program
180 ;; wget. Default value is 'extern.
181 ;; * Re-enabled `newsticker-default-face'.
182 ;; * Workaround for broken extra-data.
184 ;; 1.10 (2007-01-29)
185 ;; * Bugfixes mostly: `newsticker--decode-iso8601-date',
186 ;; `newsticker--sentinel', and others.
187 ;; * Renamed `newsticker--retrieval-timer-list' to
188 ;; `newsticker-retrieval-timer-list'. Removed
189 ;; `newsticker-running-p' -- check newsticker-retrieval-timer-list
190 ;; to find out whether newsticker is running. Removed
191 ;; `newsticker-ticker-running-p'.
192 ;; * Try to cache images in w3m-rendered HTML text.
193 ;; * Other minor changes.
195 ;; 1.9 (2005-11-01)
196 ;; * Rewrote feed parsing part. Newsticker now supports RSS 0.91,
197 ;; 0.92, 1.0, 2.0 as well as Atom 0.3 and 1.0 -- thanks to Thien-Thi
198 ;; Nguyen.
199 ;; * Changed auto-marking mechanism: Replaced variable
200 ;; `newsticker-auto-mark-filter' with new variable
201 ;; `newsticker-auto-mark-filter-list', which allows for looking not
202 ;; only at the title but also at the description of a headline.
203 ;; * Call `newsticker--ticker-text-setup' only after all pending
204 ;; downloads processes have finished.
205 ;; * Improved handling of coding systems.
206 ;; * Added magic autoload comments.
207 ;; * Bugfixes:
208 ;; - `hide-entry' was hiding too much when called for the last
209 ;; headline,
210 ;; - update mode-line and menu-bar when necessary,
211 ;; - repaired `newsticker--imenu-goto',
212 ;; - other minor things.
214 ;; 1.8 (2005-08-26)
215 ;; * Added commands `newsticker-show-extra' and `newsticker-hide-extra'
216 ;; to show and hide extra RSS elements, bound to "sx" and "hx"
217 ;; resp. Changed default value of `newsticker-show-all-rss-elements'
218 ;; to nil.
219 ;; * mode-line: Introduced special mode-line-format for newsticker.
220 ;; * Get feed logos only once every 24 h.
221 ;; * Default faces changed.
222 ;; * Minor fixes.
224 ;; 1.7 (2005-06-25)
225 ;; * Tool-bar support: most important commands can be called from
226 ;; tool-bar buttons.
227 ;; * Auto-Narrowing introduced: *newsticker* buffer can be narrowed to
228 ;; a single item (bound to key `xi') or a single feed (bound to
229 ;; `xf').
230 ;; * Enclosure support: enclosed items are shown (see
231 ;; `newsticker-enclosure-face') and can be (automatically) downloaded
232 ;; (see below). For those of you who read "podcasts".
233 ;; * Added variable `newsticker-auto-mark-filter' for automatically
234 ;; marking items as immortal or old.
235 ;; * Added hook variable `newsticker-new-item-functions' for handling
236 ;; new items. Added sample functions `newsticker-download-images',
237 ;; and `newsticker-download-enclosures'.
238 ;; * Added hook variable `newsticker-select-item-hook' which is run
239 ;; after `newsticker-(next|previous)-(new-)?-item'.
240 ;; * Added hook variable `newsticker-select-feed-hook' which is run
241 ;; after `newsticker-(next|previous)-feed'.
242 ;; * Added hook variable `newsticker-buffer-change-hook' which is run
243 ;; after the contents or visibility of the newsticker buffer has
244 ;; changed, e.g. after `newsticker-buffer-update' or
245 ;; `newsticker-show-feed-desc'.
246 ;; * Added command `newsticker-handle-url' for interactively launching
247 ;; arbitrary programs for URLs, bound to `C-RET'.
248 ;; * URLs in extra elements are clickable.
249 ;; * Better support for w3, added command
250 ;; `newsticker-w3m-show-inline-images' for displaying all inline
251 ;; images.
252 ;; * Insert an artificial headline which notifies about failed
253 ;; retrievals.
254 ;; * Use pubDate element (RSS 2.0) instead of retrieval time when
255 ;; available.
256 ;; * Customizable options grouped.
257 ;; * Bugfixes: `newsticker--imenu-create-index'; strip whitespace
258 ;; from links; apply coding-system to extra-elements; time-comparison
259 ;; for obsolete items; and others which I have forgotten.
260 ;; * Workaround for another bug in xml-parse-region -- thanks to
261 ;; anonymous for sending patch.
262 ;; * Renamed invisible buffers ` *wget-newsticker-<feed>*' to
263 ;; ` *newsticker-wget-<feed>*'.
264 ;; * Tested with GNU Emacs versions 21.3 and 22.0 and XEmacs
265 ;; 21.something.
267 ;; 1.6 * Support for (some) optional RSS elements: guid, dc:date. See
268 ;; `newsticker-show-all-rss-elements' `newsticker-extra-face'.
269 ;; * Better support for w3m -- `newsticker-default-face' is obsolete
270 ;; now, removed `newsticker-w3m-toggle-inline-image'.
271 ;; * Added `newsticker-desc-comp-max' -- comparison of item
272 ;; descriptions can take quite some time.
273 ;; * Added `newsticker--buffer-make-item-completely-visible' to
274 ;; ensure that the current item is fully visible.
275 ;; * Allow for non-positive retrieval-interval, which make newsticker
276 ;; get news only once.
277 ;; * Use :set for customizable variables.
278 ;; * Added `newsticker-buffer-force-update', bound to key `U'.
279 ;; * Added concept of obsolete items, see
280 ;; `newsticker-keep-obsolete-items', `newsticker-obsolete-item-face',
281 ;; `newsticker-obsolete-item-max-age'.
282 ;; * Added `newsticker-add-url'.
283 ;; * OPML export.
284 ;; * Save pre-formatted titles => even better performance!!
285 ;; * `newsticker-*-new-item' wraps at beginning/end of buffer.
286 ;; * Always sort obsolete items to end of item list.
287 ;; * Bugfixes:
288 ;; - newsticker-hide-entry,
289 ;; - changes of feed-titles led to duplicate feed items,
290 ;; - faces for rendered HTML texts,
291 ;; - length of ticker-text (for "exotic"/multibyte texts),
292 ;; Thanks to Hiroshi Maruyama.
293 ;; - suppress items with empty title and description
294 ;; - newsticker-sort-method was ignored!
295 ;; - prevent call of fill-region on HTML-rendered descriptions.
297 ;; 1.5 * Rewrote the visibility stuff. newsticker does not inherit
298 ;; outline anymore. Now you have complete freedom for
299 ;; `newsticker-*-format'.
300 ;; * Save pre-formatted descriptions => incredible performance boost!!
301 ;; * Introduced `newsticker-(start|stop)-ticker'.
302 ;; * Introduced statistics for heading-format and
303 ;; `newsticker-statistics-face'.
304 ;; * Introduced `newsticker-enable-logo-manipulations'.
305 ;; * Compare link of items (as well as title and desc).
306 ;; * Added `newsticker-start-hook' and `newsticker-stop-hook', thanks
307 ;; to mace.
308 ;; * Bugfixes -- thanks to Ryan Yeske, Jari Aalto, Bruce Ingalls.
309 ;; * Tested with Emacs 21.3.50, 21.3.1, 21.2, 21.1; XEmacs 21.4.15
311 ;; 1.4 * Enabled HTML rendering, added `newsticker-html-renderer' to
312 ;; choose a HTML rendering engine, thanks to Greg Scott for testing
313 ;; * New Outline handling using text properties instead of "**"
314 ;; prefixes.
315 ;; * Added possibility to mark single item as old (bound to key
316 ;; `o' (`newsticker-mark-item-at-point-as-read').
317 ;; * Added possibility to mark single item as immortal (bound to key
318 ;; `i' (`newsticker-mark-item-at-point-as-immortal').
319 ;; * Added possibility to display feed logos.
320 ;; * Added `newsticker-heading-format', `newsticker-item-format'.
321 ;; * Added `newsticker-date-format'.
322 ;; * Added `newsticker-justification'.
323 ;; * Added `newsticker-automatically-mark-visited-items-as-old'.
324 ;; * Added `newsticker-w3m-toggle-inline-image' which calls
325 ;; `w3m-toggle-inline-image' if `newsticker-html-renderer' is
326 ;; `w3m-region'. Exists for convenience only (bound to key
327 ;; `RET').
329 ;; 1.3 * Compare title AND desc to check whether item is old, except
330 ;; for feed desc
331 ;; * Mark as not-up-to-date only after new items have arrived.
332 ;; * Added XEmacs compatibility code, tested with XEmacs 21.4.13.
333 ;; * Tested with Emacs 21.3.50 and Emacs 21.2.something.
334 ;; * Bugfix: Apply coding-systems to feed title and description,
335 ;; thanks to OHASHI Akira
336 ;; * Bugfix: xml-parser-workaround did not work for japanese texts,
337 ;; thanks to OHASHI Akira
338 ;; * Kill wget-buffers unless newsticker-debug is not nil.
339 ;; * Bugfix: xml-parser-workaround for "DOCTYPE rdf:RDF"
341 ;; 1.2 Peter S Galbraith <psg@debian.org>
342 ;; * Added `newsticker-url-list-defaults', splitting the URLs into
343 ;; a customizable selection list, and a user add-on list.
344 ;; * Minor checkdoc fixes.
346 ;; 1.1 * Introduced optional feed-specific wget-arguments.
347 ;; * Keep order of feeds as given in `newsticker-url-list' in
348 ;; *newsticker* buffer.
349 ;; * Ignore unsupported coding systems.
351 ;; 1.0 * Introduced feed-specific retrieval-timers.
352 ;; * Removed dependency on 'cl (cddddr).
353 ;; * Thanks to Kevin Rodgers and T.V. Raman for their help.
354 ;; * Use utf-8 for reading and writing cache data.
355 ;; * Reported to work with Emacs 21.3.50.
357 ;; 0.99 * Minor tweaks.
358 ;; * Tested with Emacs 21.3.2
360 ;; 0.98 * Check exit status of wget processes. Keep cache data if
361 ;; something went wrong. Throw error when old wget-processes
362 ;; are hanging around.
363 ;; * Introduced newsticker-specific faces.
364 ;; * Added `newsticker-show-descriptions-of-new-items'.
365 ;; * Added `newsticker-hide-old-items-in-newsticker-buffer'.
366 ;; * Added `newsticker-(hide|show)-old-items'.
368 ;; 0.97 * Minor tweaks.
370 ;; 0.96 * Added caching.
371 ;; * newsticker-mode inherits outline-mode.
372 ;; * newsticker-mode supports imenu.
373 ;; * Easy buffer-navigation with newsticker-mode's keymap.
374 ;; * Some bugs fixed.
375 ;; * Thanks to Moritz Epple for documentation tips.
377 ;; 0.95 * Added newsticker-mode -- Thanks to T.V. Raman.
378 ;; * Catch xml-parser errors -- Thanks to T.V. Raman.
379 ;; * Remove stupid newlines in titles (headlines) -- Thanks to
380 ;; Jeff Rancier.
382 ;; 0.94 * Added clickerability and description for channel headings.
383 ;; * Made it work for (at least some) rss 0.9<something> feeds.
385 ;; 0.93 * Added some more sites.
386 ;; * Do not flood the *Messages* buffer.
387 ;; * First attempt at handling coding systems.
389 ;; 0.92 * Added `newsticker-wget-name'.
390 ;; * Try to display message only if minibuffer and echo area are
391 ;; not in use already.
392 ;; * Dirty workaround for newer versions of xml.el: Remove
393 ;; whitespace in rdf.
394 ;; * Tested with Emacs 21.3.2 and CVS-snapshot of 2003-06-21.
396 ;; 0.91 * First bugfix: *newsticker* is read-only.
398 ;; 0.9 * First release.
399 ;; * Tested with Emacs 21.3.2 and wget 1.8.2.
401 ;; ======================================================================
402 ;;; Code:
404 (require 'newst-backend)
405 (require 'newst-ticker)
406 (require 'newst-reader)
407 (require 'newst-plainview)
408 (require 'newst-treeview)
410 (provide 'newsticker)
412 ;;; newsticker.el ends here