Add "Package:" file headers to denote built-in packages.
[bpt/emacs.git] / lisp / net / newst-reader.el
CommitLineData
2900b2d8 1;;; newst-reader.el --- Generic RSS reader functions.
2415d4c6 2
114f9c96 3;; Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
931b2f31 4;; Free Software Foundation, Inc.
2415d4c6 5
2415d4c6 6;; Author: Ulf Jasper <ulf.jasper@web.de>
2900b2d8 7;; Filename: newst-reader.el
2415d4c6 8;; URL: http://www.nongnu.org/newsticker
8e39154d 9;; Time-stamp: "6. Dezember 2009, 19:16:38 (ulf)"
bd78fa1d 10;; Package: newsticker
2415d4c6
UJ
11
12;; ======================================================================
13
faeb9c70
GM
14;; This file is part of GNU Emacs.
15
2415d4c6
UJ
16;; GNU Emacs is free software: you can redistribute it and/or modify
17;; it under the terms of the GNU General Public License as published by
18;; the Free Software Foundation, either version 3 of the License, or
19;; (at your option) any later version.
20
21;; GNU Emacs is distributed in the hope that it will be useful,
22;; but WITHOUT ANY WARRANTY; without even the implied warranty of
23;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24;; GNU General Public License for more details.
25
26;; You should have received a copy of the GNU General Public License
27;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
28
29;; ======================================================================
30;;; Commentary:
31
32;; See newsticker.el
33
34;; ======================================================================
35;;; Code:
36
8e39154d 37(require 'newst-backend)
2415d4c6
UJ
38
39;; ======================================================================
40;;; Customization
41;; ======================================================================
42(defun newsticker--set-customvar-formatting (symbol value)
43 "Set newsticker-variable SYMBOL value to VALUE.
44Calls all actions which are necessary in order to make the new
45value effective."
46 (if (or (not (boundp symbol))
47 (equal (symbol-value symbol) value))
48 (set symbol value)
49 ;; something must have changed
50 (set symbol value)
51 (when (fboundp 'newsticker--forget-preformatted)
52 (newsticker--forget-preformatted))))
53
54;; ======================================================================
55;; reader
56(defgroup newsticker-reader nil
57 "Settings for the feed reader."
58 :group 'newsticker)
59
60(defcustom newsticker-frontend
61 'newsticker-treeview
62 "Newsticker frontend for reading news.
63This must be one of the functions `newsticker-plainview' or
64`newsticker-treeview'."
65 :type '(choice :tag "Frontend"
66 (const :tag "Single buffer (plainview)" newsticker-plainview)
67 (const :tag "Tree view (treeview)" newsticker-treeview))
68 :group 'newsticker-reader)
69
70;; image related things
71(defcustom newsticker-enable-logo-manipulations
72 t
73 "If non-nil newsticker manipulates logo images.
74This enables the following image properties: heuristic mask for all
75logos, and laplace-conversion for images without new items."
76 :type 'boolean
77 :group 'newsticker-reader)
78
79(defcustom newsticker-justification
80 'left
81 "How to fill item descriptions.
82If non-nil newsticker calls `fill-region' to wrap long lines in
83item descriptions. However, if an item description contains HTML
84text and `newsticker-html-renderer' is non-nil, filling is not
85done."
86 :type '(choice :tag "Justification"
87 (const :tag "No filling" nil)
88 (const :tag "Left" left)
89 (const :tag "Right" right)
90 (const :tag "Center" center)
91 (const :tag "Full" full))
92 :set 'newsticker--set-customvar-formatting
93 :group 'newsticker-reader)
94
95(defcustom newsticker-use-full-width
96 t
97 "Decides whether to use the full window width when filling.
98If non-nil newsticker sets `fill-column' so that the whole
99window is used when filling. See also `newsticker-justification'."
100 :type 'boolean
101 :set 'newsticker--set-customvar-formatting
102 :group 'newsticker-reader)
103
104(defcustom newsticker-html-renderer
105 nil
106 "Function for rendering HTML contents.
107If non-nil, newsticker.el will call this function whenever it finds
108HTML-like tags in item descriptions. Possible functions are, for
109example, `w3m-region', `w3-region', and (if you have htmlr.el installed)
110`newsticker-htmlr-render'.
111
112In order to make sure that the HTML renderer is loaded when you
113run newsticker, you should add one of the following statements to
114your .emacs. If you use w3m,
115
116 (autoload 'w3m-region \"w3m\"
117 \"Render region in current buffer and replace with result.\" t)
118
119 (autoload 'w3m-toggle-inline-image \"w3m\"
120 \"Toggle the visibility of an image under point.\" t)
121
122or, if you use w3,
123
124 (require 'w3-auto)
125
126or, if you use htmlr
127
128 (require 'htmlr)"
129 :type '(choice :tag "Function"
130 (const :tag "None" nil)
131 (const :tag "w3" w3-region)
132 (const :tag "w3m" w3m-region)
133 (const :tag "htmlr" newsticker-htmlr-render))
134 :set 'newsticker--set-customvar-formatting
135 :group 'newsticker-reader)
136
137(defcustom newsticker-date-format
138 "(%A, %H:%M)"
139 "Format for the date part in item and feed lines.
140See `format-time-string' for a list of valid specifiers."
141 :type 'string
142 :set 'newsticker--set-customvar-formatting
143 :group 'newsticker-reader)
144
0d00764a
UJ
145(defgroup newsticker-faces nil
146 "Settings for the faces of the feed reader."
147 :group 'newsticker-reader)
148
149(defface newsticker-feed-face
150 '((((class color) (background dark))
151 (:family "helvetica" :bold t :height 1.2 :foreground "misty rose"))
152 (((class color) (background light))
153 (:family "helvetica" :bold t :height 1.2 :foreground "black")))
154 "Face for news feeds."
155 :group 'newsticker-faces)
156
157(defface newsticker-extra-face
158 '((((class color) (background dark))
159 (:italic t :foreground "gray50" :height 0.8))
160 (((class color) (background light))
161 (:italic t :foreground "gray50" :height 0.8)))
162 "Face for newsticker dates."
163 :group 'newsticker-faces)
164
165(defface newsticker-enclosure-face
166 '((((class color) (background dark))
167 (:bold t :background "orange"))
168 (((class color) (background light))
169 (:bold t :background "orange")))
170 "Face for enclosed elements."
171 :group 'newsticker-faces)
172
2415d4c6
UJ
173;; ======================================================================
174;;; Utility functions
175;; ======================================================================
176(defun newsticker--insert-enclosure (item keymap)
177 "Insert enclosure element of a news ITEM into the current buffer.
178KEYMAP will be applied."
179 (let ((enclosure (newsticker--enclosure item))
180 (beg (point)))
181 (when enclosure
182 (let ((url (cdr (assoc 'url enclosure)))
183 (length (string-to-number (or (cdr (assoc 'length enclosure))
184 "-1")))
185 (type (cdr (assoc 'type enclosure))))
186 (cond ((> length 1048576)
187 (insert (format "Enclosed file (%s, %1.2f MBytes)" type
188 (/ length 1048576))))
189 ((> length 1024)
190 (insert (format "Enclosed file (%s, %1.2f KBytes)" type
191 (/ length 1024))))
192 ((> length 0)
193 (insert (format "Enclosed file (%s, %1.2f Bytes)" type
194 length)))
195 (t
196 (insert (format "Enclosed file (%s, unknown size)" type))))
197 (add-text-properties beg (point)
198 (list 'mouse-face 'highlight
199 'nt-link url
200 'help-echo (format
201 "mouse-2: visit (%s)" url)
202 'keymap keymap
203 'nt-face 'enclosure
204 'nt-type 'desc))
205 (insert "\n")))))
206
207(defun newsticker--print-extra-elements (item keymap)
208 "Insert extra-elements of ITEM in a pretty form into the current buffer.
209KEYMAP is applied."
210 (let ((ignored-elements '(items link title description content
211 content:encoded dc:subject
212 dc:date entry item guid pubDate
213 published updated
214 enclosure))
215 (left-column-width 1))
216 (mapc (lambda (extra-element)
217 (when (listp extra-element) ;; take care of broken xml
218 ;; data, 2007-05-25
219 (unless (memq (car extra-element) ignored-elements)
220 (setq left-column-width (max left-column-width
221 (length (symbol-name
222 (car extra-element))))))))
223 (newsticker--extra item))
224 (mapc (lambda (extra-element)
225 (when (listp extra-element) ;; take care of broken xml
226 ;; data, 2007-05-25
227 (unless (memq (car extra-element) ignored-elements)
228 (newsticker--do-print-extra-element extra-element
229 left-column-width
230 keymap))))
231 (newsticker--extra item))))
232
233(defun newsticker--do-print-extra-element (extra-element width keymap)
234 "Actually print an EXTRA-ELEMENT using the given WIDTH.
235KEYMAP is applied."
236 (let ((name (symbol-name (car extra-element))))
237 (insert (format "%s: " name))
238 (insert (make-string (- width (length name)) ? )))
239 (let (;;(attributes (cadr extra-element)) ;FIXME!!!!
240 (contents (cddr extra-element)))
241 (cond ((listp contents)
242 (mapc (lambda (i)
243 (if (and (stringp i)
244 (string-match "^http://.*" i))
245 (let ((pos (point)))
246 (insert i " ") ; avoid self-reference from the
247 ; nt-link thing
248 (add-text-properties
249 pos (point)
250 (list 'mouse-face 'highlight
251 'nt-link i
252 'help-echo
253 (format "mouse-2: visit (%s)" i)
254 'keymap keymap)))
255 (insert (format "%s" i))))
256 contents))
257 (t
258 (insert (format "%s" contents))))
259 (insert "\n")))
260
261(defun newsticker--image-read (feed-name-symbol disabled)
262 "Read the cached image for FEED-NAME-SYMBOL from disk.
263If DISABLED is non-nil the image will be converted to a disabled look
264\(unless `newsticker-enable-logo-manipulations' is not t\).
265Return the image."
a59c6c51 266 (let ((image-name (concat (newsticker--images-dir)
2415d4c6
UJ
267 (symbol-name feed-name-symbol)))
268 (img nil))
269 (when (file-exists-p image-name)
270 (condition-case error-data
271 (setq img (create-image
272 image-name nil nil
273 :conversion (and newsticker-enable-logo-manipulations
274 disabled
275 'disabled)
276 :mask (and newsticker-enable-logo-manipulations
277 'heuristic)
278 :ascent 70))
279 (error
280 (message "Error: cannot create image for %s: %s"
281 feed-name-symbol error-data))))
282 img))
283
284;; the functions we need for retrieval and display
285;;;###autoload
286(defun newsticker-show-news ()
287 "Start reading news. You may want to bind this to a key."
288 (interactive)
289 (newsticker-start t) ;; will start only if not running
290 (funcall newsticker-frontend))
291
292;; ======================================================================
293;;; Toolbar
294;; ======================================================================
295(defconst newsticker--next-item-image
bee1c0fe
GM
296 (and (fboundp 'image-type-available-p)
297 (image-type-available-p 'xpm)
298 (create-image "/* XPM */
2415d4c6
UJ
299static char * next_xpm[] = {
300\"24 24 42 1\",
301\" c None\",
302\". c #000000\",
303\"+ c #7EB6DE\",
304\"@ c #82BBE2\",
305\"# c #85BEE4\",
306\"$ c #88C1E7\",
307\"% c #8AC3E8\",
308\"& c #87C1E6\",
309\"* c #8AC4E9\",
310\"= c #8CC6EA\",
311\"- c #8CC6EB\",
312\"; c #88C2E7\",
313\"> c #8BC5E9\",
314\", c #8DC7EB\",
315\"' c #87C0E6\",
316\") c #8AC4E8\",
317\"! c #8BC5EA\",
318\"~ c #8BC4E9\",
319\"{ c #88C1E6\",
320\"] c #89C3E8\",
321\"^ c #86BFE5\",
322\"/ c #83BBE2\",
323\"( c #82BBE1\",
324\"_ c #86C0E5\",
325\": c #87C0E5\",
326\"< c #83BCE2\",
327\"[ c #81B9E0\",
328\"} c #81BAE1\",
329\"| c #78B0D9\",
330\"1 c #7BB3DB\",
331\"2 c #7DB5DD\",
332\"3 c #7DB6DD\",
333\"4 c #72A9D4\",
334\"5 c #75ACD6\",
335\"6 c #76AED7\",
336\"7 c #77AFD8\",
337\"8 c #6BA1CD\",
338\"9 c #6EA4CF\",
339\"0 c #6FA6D1\",
340\"a c #6298C6\",
341\"b c #659BC8\",
342\"c c #5C91C0\",
343\" \",
344\" \",
345\" . \",
346\" .. \",
347\" .+. \",
348\" .@#. \",
349\" .#$%. \",
350\" .&*=-. \",
351\" .;>,,,. \",
352\" .;>,,,=. \",
353\" .')!==~;. \",
354\" .#{]*%;^/. \",
355\" .(#_':#<. \",
356\" .+[@</}. \",
357\" .|1232. \",
358\" .4567. \",
359\" .890. \",
360\" .ab. \",
361\" .c. \",
362\" .. \",
363\" . \",
364\" \",
365\" \",
366\" \"};
367"
bee1c0fe
GM
368 'xpm t))
369 "Image for the next item button.")
2415d4c6
UJ
370
371(defconst newsticker--previous-item-image
bee1c0fe
GM
372 (and (fboundp 'image-type-available-p)
373 (image-type-available-p 'xpm)
374 (create-image "/* XPM */
2415d4c6
UJ
375static char * previous_xpm[] = {
376\"24 24 39 1\",
377\" c None\",
378\". c #000000\",
379\"+ c #7BB3DB\",
380\"@ c #83BCE2\",
381\"# c #7FB8DF\",
382\"$ c #89C2E7\",
383\"% c #86BFE5\",
384\"& c #83BBE2\",
385\"* c #8CC6EA\",
386\"= c #8BC4E9\",
387\"- c #88C2E7\",
388\"; c #85BEE4\",
389\"> c #8DC7EB\",
390\", c #89C3E8\",
391\"' c #8AC4E8\",
392\") c #8BC5EA\",
393\"! c #88C1E6\",
394\"~ c #8AC4E9\",
395\"{ c #8AC3E8\",
396\"] c #86C0E5\",
397\"^ c #87C0E6\",
398\"/ c #87C0E5\",
399\"( c #82BBE2\",
400\"_ c #81BAE1\",
401\": c #7FB7DF\",
402\"< c #7DB6DD\",
403\"[ c #7DB5DD\",
404\"} c #7CB4DC\",
405\"| c #79B1DA\",
406\"1 c #76ADD7\",
407\"2 c #77AFD8\",
408\"3 c #73AAD4\",
409\"4 c #70A7D1\",
410\"5 c #6EA5D0\",
411\"6 c #6CA2CE\",
412\"7 c #689ECB\",
413\"8 c #6399C7\",
414\"9 c #6095C4\",
415\"0 c #5C90C0\",
416\" \",
417\" \",
418\" . \",
419\" .. \",
420\" .+. \",
421\" .@#. \",
422\" .$%&. \",
423\" .*=-;. \",
424\" .>>*,%. \",
425\" .>>>*,%. \",
426\" .')**=-;. \",
427\" .;!,~{-%&. \",
428\" .;]^/;@#. \",
429\" .(@&_:+. \",
430\" .<[}|1. \",
431\" .2134. \",
432\" .567. \",
433\" .89. \",
434\" .0. \",
435\" .. \",
436\" . \",
437\" \",
438\" \",
439\" \"};
440"
bee1c0fe
GM
441 'xpm t))
442 "Image for the previous item button.")
2415d4c6
UJ
443
444(defconst newsticker--previous-feed-image
bee1c0fe
GM
445 (and (fboundp 'image-type-available-p)
446 (image-type-available-p 'xpm)
447 (create-image "/* XPM */
2415d4c6
UJ
448static char * prev_feed_xpm[] = {
449\"24 24 52 1\",
450\" c None\",
451\". c #000000\",
452\"+ c #70A7D2\",
453\"@ c #75ADD6\",
454\"# c #71A8D3\",
455\"$ c #79B1DA\",
456\"% c #7BB3DB\",
457\"& c #7DB5DD\",
458\"* c #83BBE2\",
459\"= c #7EB6DE\",
460\"- c #78B0D9\",
461\"; c #7FB7DE\",
462\"> c #88C2E7\",
463\", c #85BEE4\",
464\"' c #80B9E0\",
465\") c #80B8DF\",
466\"! c #8CC6EA\",
467\"~ c #89C3E8\",
468\"{ c #86BFE5\",
469\"] c #81BAE1\",
470\"^ c #7CB4DC\",
471\"/ c #7FB8DF\",
472\"( c #8DC7EB\",
473\"_ c #7BB3DC\",
474\": c #7EB7DE\",
475\"< c #8BC4E9\",
476\"[ c #8AC4E9\",
477\"} c #8AC3E8\",
478\"| c #87C0E6\",
479\"1 c #87C0E5\",
480\"2 c #83BCE2\",
481\"3 c #75ACD6\",
482\"4 c #7FB7DF\",
483\"5 c #77AED8\",
484\"6 c #71A8D2\",
485\"7 c #70A7D1\",
486\"8 c #76ADD7\",
487\"9 c #6CA2CE\",
488\"0 c #699FCC\",
489\"a c #73AAD4\",
490\"b c #6BA1CD\",
491\"c c #669CC9\",
492\"d c #6298C5\",
493\"e c #689ECB\",
494\"f c #6499C7\",
495\"g c #6095C3\",
496\"h c #5C91C0\",
497\"i c #5E93C2\",
498\"j c #5B90C0\",
499\"k c #588CBC\",
500\"l c #578CBC\",
501\"m c #5589BA\",
502\" \",
503\" \",
504\" ... . \",
505\" .+. .. \",
506\" .@. .#. \",
507\" .$. .%@. \",
508\" .&. .*=-. \",
509\" .;. .>,'%. \",
510\" .). .!~{]^. \",
511\" ./. .(!~{]_. \",
512\" .:. .!!<>,'%. \",
513\" .&. .~[}>{*=-. \",
514\" .$. .|1,2/%@. \",
515\" .3. .*]4%56. \",
516\" .7. .^$8#9. \",
517\" .0. .a7bc. \",
518\" .d. .efg. \",
519\" .h. .ij. \",
520\" .k. .l. \",
521\" .m. .. \",
522\" ... . \",
523\" \",
524\" \",
525\" \"};
526"
bee1c0fe
GM
527 'xpm t))
528 "Image for the previous feed button.")
2415d4c6
UJ
529
530(defconst newsticker--next-feed-image
bee1c0fe
GM
531 (and (fboundp 'image-type-available-p)
532 (image-type-available-p 'xpm)
533 (create-image "/* XPM */
2415d4c6
UJ
534static char * next_feed_xpm[] = {
535\"24 24 57 1\",
536\" c None\",
537\". c #000000\",
538\"+ c #6CA2CE\",
539\"@ c #75ADD6\",
540\"# c #71A8D3\",
541\"$ c #79B1DA\",
542\"% c #7EB7DE\",
543\"& c #7DB5DD\",
544\"* c #81BAE1\",
545\"= c #85BEE4\",
546\"- c #78B0D9\",
547\"; c #7FB7DE\",
548\"> c #83BCE3\",
549\", c #87C1E6\",
550\"' c #8AC4E9\",
551\") c #7BB3DB\",
552\"! c #80B8DF\",
553\"~ c #88C2E7\",
554\"{ c #8BC5E9\",
555\"] c #8DC7EB\",
556\"^ c #7CB4DC\",
557\"/ c #7FB8DF\",
558\"( c #84BDE3\",
559\"_ c #7BB3DC\",
560\": c #83BCE2\",
561\"< c #87C0E6\",
562\"[ c #8AC4E8\",
563\"} c #8BC5EA\",
564\"| c #8CC6EA\",
565\"1 c #88C1E6\",
566\"2 c #89C3E8\",
567\"3 c #8AC3E8\",
568\"4 c #7EB6DE\",
569\"5 c #82BBE1\",
570\"6 c #86C0E5\",
571\"7 c #87C0E5\",
572\"8 c #75ACD6\",
573\"9 c #7AB2DA\",
574\"0 c #81B9E0\",
575\"a c #82BBE2\",
576\"b c #71A8D2\",
577\"c c #70A7D1\",
578\"d c #74ACD6\",
579\"e c #699FCC\",
580\"f c #6EA5D0\",
581\"g c #72A9D4\",
582\"h c #669CC9\",
583\"i c #6298C5\",
584\"j c #679DCA\",
585\"k c #6BA1CD\",
586\"l c #6095C3\",
587\"m c #5C91C0\",
588\"n c #5F94C2\",
589\"o c #5B90C0\",
590\"p c #588CBC\",
591\"q c #578CBC\",
592\"r c #5589BA\",
593\" \",
594\" \",
595\" . ... \",
596\" .. .+. \",
597\" .@. .#. \",
598\" .$%. .@. \",
599\" .&*=. .-. \",
600\" .;>,'. .). \",
601\" .!=~{]. .^. \",
602\" ./(~{]]. ._. \",
603\" .%:<[}||. .). \",
604\" .&*=12'3~. .-. \",
605\" .$45=6<7. .@. \",
606\" .8940a:. .b. \",
607\" .cd-)&. .+. \",
608\" .efg8. .h. \",
609\" .ijk. .l. \",
610\" .mn. .o. \",
611\" .p. .q. \",
612\" .. .r. \",
613\" . ... \",
614\" \",
615\" \",
616\" \"};
617"
bee1c0fe
GM
618 'xpm t))
619 "Image for the next feed button.")
2415d4c6
UJ
620
621(defconst newsticker--mark-read-image
bee1c0fe
GM
622 (and (fboundp 'image-type-available-p)
623 (image-type-available-p 'xpm)
624 (create-image "/* XPM */
2415d4c6
UJ
625static char * mark_read_xpm[] = {
626\"24 24 44 1\",
627\" c None\",
628\". c #C20000\",
629\"+ c #BE0000\",
630\"@ c #C70000\",
631\"# c #CE0000\",
632\"$ c #C90000\",
633\"% c #BD0000\",
634\"& c #CB0000\",
635\"* c #D10000\",
636\"= c #D70000\",
637\"- c #D30000\",
638\"; c #CD0000\",
639\"> c #C60000\",
640\", c #D40000\",
641\"' c #DA0000\",
642\") c #DE0000\",
643\"! c #DB0000\",
644\"~ c #D60000\",
645\"{ c #D00000\",
646\"] c #DC0000\",
647\"^ c #E00000\",
648\"/ c #E40000\",
649\"( c #E10000\",
650\"_ c #DD0000\",
651\": c #D80000\",
652\"< c #E50000\",
653\"[ c #E70000\",
654\"} c #E60000\",
655\"| c #E20000\",
656\"1 c #E90000\",
657\"2 c #E80000\",
658\"3 c #E30000\",
659\"4 c #DF0000\",
660\"5 c #D90000\",
661\"6 c #CC0000\",
662\"7 c #C10000\",
663\"8 c #C30000\",
664\"9 c #BF0000\",
665\"0 c #B90000\",
666\"a c #BC0000\",
667\"b c #BB0000\",
668\"c c #B80000\",
669\"d c #B50000\",
670\"e c #B70000\",
671\" \",
672\" \",
673\" \",
674\" . + \",
675\" +@# $.% \",
676\" &*= -;> \",
677\" ,') !~{ \",
678\" ]^/ (_: \",
679\" (<[ }|) \",
680\" <[1 2<| \",
681\" }222[< \",
682\" }}}< \",
683\" 333| \",
684\" _4^4)] \",
685\" ~:' 5=- \",
686\" 6{- *#$ \",
687\" 7>$ @89 \",
688\" 0a+ %bc \",
689\" ddc edd \",
690\" ddd ddd \",
691\" d d \",
692\" \",
693\" \",
694\" \"};
695"
bee1c0fe
GM
696 'xpm t))
697 "Image for the mark read button.")
2415d4c6
UJ
698
699(defconst newsticker--mark-immortal-image
bee1c0fe
GM
700 (and (fboundp 'image-type-available-p)
701 (image-type-available-p 'xpm)
702 (create-image "/* XPM */
2415d4c6
UJ
703static char * mark_immortal_xpm[] = {
704\"24 24 93 2\",
705\" c None\",
706\". c #171717\",
707\"+ c #030303\",
708\"@ c #000000\",
709\"# c #181818\",
710\"$ c #090909\",
711\"% c #FFC960\",
712\"& c #FFCB61\",
713\"* c #FFCB62\",
714\"= c #FFC961\",
715\"- c #FFC75F\",
716\"; c #FFC65E\",
717\"> c #FFCA61\",
718\", c #FFCD63\",
719\"' c #FFCF65\",
720\") c #FFD065\",
721\"! c #FFCE64\",
722\"~ c #FFC35C\",
723\"{ c #FFC45D\",
724\"] c #FFD166\",
725\"^ c #FFD267\",
726\"/ c #FFD368\",
727\"( c #FFD167\",
728\"_ c #FFC05A\",
729\": c #010101\",
730\"< c #040404\",
731\"[ c #FFCC62\",
732\"} c #FFD569\",
733\"| c #FFD56A\",
734\"1 c #FFC860\",
735\"2 c #FFC25B\",
736\"3 c #FFBB56\",
737\"4 c #020202\",
738\"5 c #060606\",
739\"6 c #FFC15B\",
740\"7 c #FFC85F\",
741\"8 c #FFD469\",
742\"9 c #FFD66A\",
743\"0 c #FFBC57\",
744\"a c #1B1B1B\",
745\"b c #070707\",
746\"c c #FFBA55\",
747\"d c #FFB451\",
748\"e c #FFB954\",
749\"f c #FFB350\",
750\"g c #FFB652\",
751\"h c #FFBE58\",
752\"i c #FFCD64\",
753\"j c #FFD066\",
754\"k c #FFC059\",
755\"l c #FFB14E\",
756\"m c #0B0B0B\",
757\"n c #FFBB55\",
758\"o c #FFC15A\",
759\"p c #FFB552\",
760\"q c #FFAD4B\",
761\"r c #080808\",
762\"s c #FFAF4C\",
763\"t c #FFB853\",
764\"u c #FFA948\",
765\"v c #050505\",
766\"w c #FFB04E\",
767\"x c #FFB753\",
768\"y c #FFBC56\",
769\"z c #FFC55D\",
770\"A c #FFC55E\",
771\"B c #FFC45C\",
772\"C c #FFBD57\",
773\"D c #FFB854\",
774\"E c #FFB34F\",
775\"F c #FFAB4A\",
776\"G c #FFA545\",
777\"H c #FFAA49\",
778\"I c #FFB04D\",
779\"J c #FFB551\",
780\"K c #FFBF58\",
781\"L c #FFB24F\",
782\"M c #FFAC4A\",
783\"N c #FFA646\",
784\"O c #FFA344\",
785\"P c #FFA848\",
786\"Q c #FFB14F\",
787\"R c #FFAF4D\",
788\"S c #FFA546\",
789\"T c #FFA243\",
790\"U c #FFA445\",
791\"V c #FFAE4C\",
792\"W c #FFA444\",
793\"X c #FFA142\",
794\"Y c #FF9F41\",
795\"Z c #0A0A0A\",
796\"` c #FF9E40\",
797\" . c #FF9F40\",
798\" \",
799\" \",
800\" \",
801\" . + @ @ + # \",
802\" $ @ % & * * = - + + \",
803\" @ ; > , ' ) ' ! * - ~ @ \",
804\" @ { > ! ] ^ / / ( ' * ; _ : \",
805\" < _ ; [ ) / } | } / ] , 1 2 3 4 \",
806\" 5 6 7 , ] 8 9 9 9 } ^ ! = ~ 0 a \",
807\" b c 6 - , ] 8 9 9 9 } ^ ! % ~ 0 d 5 \",
808\" : e _ ; * ) / 8 } } / ] , 1 2 3 f 5 \",
809\" : g h { = i j ^ / ^ ] ! * ; k e l m \",
810\" : f n o ; > , ' ) ' ! * - 2 0 p q r \",
811\" : s g 0 6 ; % > * * = - ~ h t l u r \",
812\" v u w x y k ~ z A z B o C D E F G b \",
813\" 5 H I J e 0 h K h C c x L M N . \",
814\" 4 O P q Q d g x g J L R H S T < \",
815\" @ T U P F q V q M H N W X + \",
816\" @ Y T O W G G W O X Y @ \",
817\" 4 Z ` Y Y Y .` 4 4 \",
818\" 5 : : @ @ Z \",
819\" \",
820\" \",
821\" \"};
822"
bee1c0fe
GM
823 'xpm t))
824 "Image for the mark immortal button.")
2415d4c6
UJ
825
826(defconst newsticker--narrow-image
bee1c0fe
GM
827 (and (fboundp 'image-type-available-p)
828 (image-type-available-p 'xpm)
829 (create-image "/* XPM */
2415d4c6
UJ
830static char * narrow_xpm[] = {
831\"24 24 48 1\",
832\" c None\",
833\". c #000000\",
834\"+ c #969696\",
835\"@ c #9E9E9E\",
836\"# c #A4A4A4\",
837\"$ c #AAAAAA\",
838\"% c #AEAEAE\",
839\"& c #B1B1B1\",
840\"* c #B3B3B3\",
841\"= c #B4B4B4\",
842\"- c #B2B2B2\",
843\"; c #AFAFAF\",
844\"> c #ABABAB\",
845\", c #A6A6A6\",
846\"' c #A0A0A0\",
847\") c #989898\",
848\"! c #909090\",
849\"~ c #73AAD4\",
850\"{ c #7AB2DA\",
851\"] c #7FB8DF\",
852\"^ c #84BDE3\",
853\"/ c #88C2E7\",
854\"( c #8BC5E9\",
855\"_ c #8DC7EB\",
856\": c #8CC6EA\",
857\"< c #89C3E8\",
858\"[ c #86BFE5\",
859\"} c #81BAE1\",
860\"| c #7BB3DC\",
861\"1 c #75ACD6\",
862\"2 c #6DA4CF\",
863\"3 c #979797\",
864\"4 c #A3A3A3\",
865\"5 c #A8A8A8\",
866\"6 c #ADADAD\",
867\"7 c #ACACAC\",
868\"8 c #A9A9A9\",
869\"9 c #A5A5A5\",
870\"0 c #9A9A9A\",
871\"a c #929292\",
872\"b c #8C8C8C\",
873\"c c #808080\",
874\"d c #818181\",
875\"e c #838383\",
876\"f c #848484\",
877\"g c #858585\",
878\"h c #868686\",
879\"i c #828282\",
880\" \",
881\" \",
882\" \",
883\" .................. \",
884\" .+@#$%&*=*-;>,')!. \",
885\" .................. \",
886\" \",
887\" \",
888\" .................. \",
889\" .~{]^/(___:<[}|12. \",
890\" .................. \",
891\" \",
892\" \",
893\" .................. \",
894\" .!3@45>666789'0ab. \",
895\" .................. \",
896\" \",
897\" \",
898\" .................. \",
899\" .cccdefghhgficccc. \",
900\" .................. \",
901\" \",
902\" \",
903\" \"};
904"
bee1c0fe
GM
905 'xpm t))
906 "Image for the narrow image button.")
2415d4c6
UJ
907
908(defconst newsticker--get-all-image
bee1c0fe
GM
909 (and (fboundp 'image-type-available-p)
910 (image-type-available-p 'xpm)
911 (create-image "/* XPM */
2415d4c6
UJ
912static char * get_all_xpm[] = {
913\"24 24 70 1\",
914\" c None\",
915\". c #000000\",
916\"+ c #F3DA00\",
917\"@ c #F5DF00\",
918\"# c #F7E300\",
919\"$ c #F9E700\",
920\"% c #FAEA00\",
921\"& c #FBEC00\",
922\"* c #FBED00\",
923\"= c #FCEE00\",
924\"- c #FAEB00\",
925\"; c #F9E800\",
926\"> c #F8E500\",
927\", c #F6E000\",
928\"' c #F4DB00\",
929\") c #F1D500\",
930\"! c #EFD000\",
931\"~ c #B7CA00\",
932\"{ c #BFD100\",
933\"] c #C5D700\",
934\"^ c #CBDB00\",
935\"/ c #CFDF00\",
936\"( c #D2E200\",
937\"_ c #D4E400\",
938\": c #D3E300\",
939\"< c #D0E000\",
940\"[ c #CCDD00\",
941\"} c #C7D800\",
942\"| c #C1D300\",
943\"1 c #BACC00\",
944\"2 c #B1C500\",
945\"3 c #A8BC00\",
946\"4 c #20A900\",
947\"5 c #22AF00\",
948\"6 c #24B500\",
949\"7 c #26B900\",
950\"8 c #27BC00\",
951\"9 c #27BE00\",
952\"0 c #28BF00\",
953\"a c #27BD00\",
954\"b c #26BA00\",
955\"c c #25B600\",
956\"d c #23B100\",
957\"e c #21AB00\",
958\"f c #1FA400\",
959\"g c #1C9B00\",
960\"h c #21AA00\",
961\"i c #24B300\",
962\"j c #25B800\",
963\"k c #25B700\",
964\"l c #24B400\",
965\"m c #23B000\",
966\"n c #1FA500\",
967\"o c #1D9E00\",
968\"p c #20A800\",
969\"q c #21AC00\",
970\"r c #23B200\",
971\"s c #22AD00\",
972\"t c #1D9F00\",
973\"u c #20A700\",
974\"v c #1EA100\",
975\"w c #1C9C00\",
976\"x c #1DA000\",
977\"y c #1B9800\",
978\"z c #1A9600\",
979\"A c #1A9700\",
980\"B c #1A9500\",
981\"C c #199200\",
982\"D c #189100\",
983\"E c #178C00\",
984\" \",
985\" \",
986\" \",
987\" \",
988\" ................... \",
989\" .+@#$%&*=*&-;>,')!. \",
990\" ................... \",
991\" \",
992\" ................... \",
993\" .~{]^/(___:<[}|123. \",
994\" ................... \",
995\" \",
996\" ................... \",
997\" .45678909abcdefg. \",
998\" .h5icj7jklmeno. \",
999\" .pq5drrmshft. \",
1000\" .fu4h4pnvw. \",
1001\" .oxvxtwy. \",
1002\" .zAAzB. \",
1003\" .CCD. \",
1004\" .E. \",
1005\" . \",
1006\" \",
1007\" \"};
1008"
bee1c0fe
GM
1009 'xpm t))
1010 "Image for the get all image button.")
2415d4c6
UJ
1011
1012(defconst newsticker--update-image
bee1c0fe
GM
1013 (and (fboundp 'image-type-available-p)
1014 (image-type-available-p 'xpm)
1015 (create-image "/* XPM */
2415d4c6
UJ
1016static char * update_xpm[] = {
1017\"24 24 37 1\",
1018\" c None\",
1019\". c #076D00\",
1020\"+ c #0A8600\",
1021\"@ c #0A8800\",
1022\"# c #098400\",
1023\"$ c #087200\",
1024\"% c #087900\",
1025\"& c #098500\",
1026\"* c #098100\",
1027\"= c #087600\",
1028\"- c #097E00\",
1029\"; c #097F00\",
1030\"> c #0A8700\",
1031\", c #0A8C00\",
1032\"' c #097C00\",
1033\") c #098300\",
1034\"! c #0A8900\",
1035\"~ c #0A8E00\",
1036\"{ c #0B9200\",
1037\"] c #087700\",
1038\"^ c #076E00\",
1039\"/ c #076C00\",
1040\"( c #076B00\",
1041\"_ c #076A00\",
1042\": c #076900\",
1043\"< c #076800\",
1044\"[ c #066700\",
1045\"} c #066500\",
1046\"| c #066400\",
1047\"1 c #066300\",
1048\"2 c #066600\",
1049\"3 c #066200\",
1050\"4 c #076700\",
1051\"5 c #065E00\",
1052\"6 c #066100\",
1053\"7 c #065F00\",
1054\"8 c #066000\",
1055\" \",
1056\" \",
1057\" \",
1058\" . +@@@+# \",
1059\" $% &@ +* \",
1060\" =-# ; \",
1061\" %*>, ' \",
1062\" ')!~{ = \",
1063\" ]$ \",
1064\" ^ ^ \",
1065\" . . \",
1066\" / ( \",
1067\" _ : \",
1068\" < [ \",
1069\" } | \",
1070\" [[ \",
1071\" 1 $.:23 \",
1072\" 3 4}35 \",
1073\" 6 655 \",
1074\" 76 85 55 \",
1075\" 5555555 5 \",
1076\" \",
1077\" \",
1078\" \"};
1079"
bee1c0fe
GM
1080 'xpm t))
1081 "Image for the update button.")
2415d4c6
UJ
1082
1083(defconst newsticker--browse-image
bee1c0fe
GM
1084 (and (fboundp 'image-type-available-p)
1085 (image-type-available-p 'xpm)
1086 (create-image "/* XPM */
2415d4c6
UJ
1087static char * visit_xpm[] = {
1088\"24 24 39 1\",
1089\" c None\",
1090\". c #000000\",
1091\"+ c #FFFFFF\",
1092\"@ c #00E63D\",
1093\"# c #00E83E\",
1094\"$ c #00E73D\",
1095\"% c #00E93E\",
1096\"& c #00E63C\",
1097\"* c #00E53C\",
1098\"= c #00E23B\",
1099\"- c #00E33B\",
1100\"; c #00E83D\",
1101\"> c #00E13A\",
1102\", c #00DD38\",
1103\"' c #00DE38\",
1104\") c #00E23A\",
1105\"! c #00E43C\",
1106\"~ c #00DF39\",
1107\"{ c #00DB37\",
1108\"] c #00D634\",
1109\"^ c #00D734\",
1110\"/ c #00E039\",
1111\"( c #00DC37\",
1112\"_ c #00D835\",
1113\": c #00D332\",
1114\"< c #00CD2F\",
1115\"[ c #00DB36\",
1116\"} c #00D433\",
1117\"| c #00CF30\",
1118\"1 c #00DA36\",
1119\"2 c #00D936\",
1120\"3 c #00D533\",
1121\"4 c #00D131\",
1122\"5 c #00CE2F\",
1123\"6 c #00CC2F\",
1124\"7 c #00CA2D\",
1125\"8 c #00C62B\",
1126\"9 c #00C52A\",
1127\"0 c #00BE27\",
1128\" \",
1129\" \",
1130\" . \",
1131\" .+. \",
1132\" .+++. \",
1133\" .++.++. \",
1134\" .++.@.++. \",
1135\" .++.##$.++. \",
1136\" .++.%%%#&.++. \",
1137\" .++.$%%%#*=.++. \",
1138\" .++.-@;##$*>,.++. \",
1139\" .++.')!&@@*=~{].++. \",
1140\" .++.^{~>---)/(_:<.++. \",
1141\" .++.^[,~/~'(_}|.++. \",
1142\" .++.]_1[12^:|.++. \",
1143\" .++.:}33:45.++. \",
1144\" .++.<5567.++. \",
1145\" .++.889.++. \",
1146\" .++.0.++. \",
1147\" .++.++. \",
1148\" .+++. \",
1149\" .+. \",
1150\" . \",
1151\" \"};
1152"
bee1c0fe
GM
1153 'xpm t))
1154 "Image for the browse button.")
2415d4c6 1155
62c4fff6
UJ
1156(defun newsticker-browse-url-item (feed item)
1157 "Convert FEED ITEM to html and call `browse-url' on result."
1158 (interactive)
1159 (let ((t-file (make-temp-file "newsticker")))
1160 (with-temp-file t-file
1161 (insert "<?xml version=\"1.0\" encoding=\"utf-8\"?>
1162 <!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\"
1163 \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">
1164 <html xmlns=\"http://www.w3.org/1999/xhtml\">
1165 <body>")
1166 (insert "<h1>" feed ": " (newsticker--title item) "</h1>")
1167 (insert (format-time-string newsticker-date-format
1168 (newsticker--time item)))
1169 (insert "<br/>")
1170 (insert (or (newsticker--desc item) "[No Description]"))
1171 (when (newsticker--enclosure item)
1172 (insert "<br/><hr/><i>")
1173 (newsticker--insert-enclosure item nil)
1174 (insert "</i>"))
1175 (when (newsticker--extra item)
1176 (insert "<br/><hr/><tt>")
1177 (newsticker--print-extra-elements item nil)
1178 (insert "</tt>"))
1179 (insert "</body></html>"))
1180 (browse-url t-file)))
1181
8e39154d 1182(provide 'newst-reader)
041fa0d4
MB
1183
1184;; arch-tag: c604b701-bdf1-4fc1-8d05-5fabd1939533
2900b2d8 1185;;; newst-reader.el ends here