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