annotate lisp/net/newst-ticker.el @ 102165:f93f5035af02

(rmail-cease-edit): Notice changes in buffer's encoding during editing. Make sure to use encoding that can safely encode the message. Rewrite MIME charset= header if the new encoding is different from the old one.
author Eli Zaretskii <eliz@gnu.org>
date Sat, 21 Feb 2009 15:05:01 +0000
parents a9dc0e7c3f2b
children e341c53bc4af
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-ticker.el --- modeline ticker for newsticker.
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
2
100908
a9dc0e7c3f2b Add 2009 to copyright years.
Glenn Morris <rgm@gnu.org>
parents: 95904
diff changeset
3 ;; Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009
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-ticker.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
95904
594d82b81559 Renamed newsticker-*.el to newst-*.el. Fixed (require).
Ulf Jasper <ulf.jasper@web.de>
parents: 95901
diff changeset
10 ;; Time-stamp: "13. Juni 2008, 19:28:50 (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
95904
594d82b81559 Renamed newsticker-*.el to newst-*.el. Fixed (require).
Ulf Jasper <ulf.jasper@web.de>
parents: 95901
diff changeset
38 (require 'newsticker-backend "newst-backend")
95901
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
39
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
40 (defvar newsticker--ticker-timer nil
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
41 "Timer for newsticker ticker.")
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
42
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
43 ;;;###autoload
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
44 (defun newsticker-ticker-running-p ()
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
45 "Check whether newsticker's actual ticker is running.
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
46 Return t if ticker is running, nil otherwise. Newsticker is
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
47 considered to be running if the newsticker timer list is not
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
48 empty."
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
49 (timerp newsticker--ticker-timer))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
50
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
51 ;; customization group ticker
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
52 (defgroup newsticker-ticker nil
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
53 "Settings for the headline ticker."
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
54 :group 'newsticker)
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 (defun newsticker--set-customvar-ticker (symbol value)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
57 "Set newsticker-variable SYMBOL value to VALUE.
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
58 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
59 value effective."
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
60 (if (or (not (boundp symbol))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
61 (equal (symbol-value symbol) value))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
62 (set symbol value)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
63 ;; something must have changed -- restart ticker
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
64 (when (newsticker-running-p)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
65 (message "Restarting ticker")
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
66 (newsticker-stop-ticker)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
67 (newsticker--ticker-text-setup)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
68 (newsticker-start-ticker)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
69 (message ""))))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
70
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
71 (defcustom newsticker-ticker-interval
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
72 0.3
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
73 "Time interval for displaying news items in the echo area (seconds).
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
74 If equal or less than 0 no messages are shown in the echo area. For
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
75 smooth display (see `newsticker-scroll-smoothly') a value of 0.3 seems
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
76 reasonable. For non-smooth display a value of 10 is a good starting
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
77 point."
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
78 :type 'number
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
79 :set 'newsticker--set-customvar-ticker
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
80 :group 'newsticker-ticker)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
81
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
82 (defcustom newsticker-scroll-smoothly
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
83 t
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
84 "Decides whether to flash or scroll news items.
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
85 If t the news headlines are scrolled (more-or-less) smoothly in the echo
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
86 area. If nil one headline after another is displayed in the echo area.
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
87 The variable `newsticker-ticker-interval' determines how fast this
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
88 display moves/changes and whether headlines are shown in the echo area
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
89 at all. If you change `newsticker-scroll-smoothly' you should also change
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
90 `newsticker-ticker-interval'."
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
91 :type 'boolean
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
92 :group 'newsticker-ticker)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
93
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
94 (defcustom newsticker-hide-immortal-items-in-echo-area
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
95 t
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
96 "Decides whether to show immortal/non-expiring news items in the ticker.
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
97 If t the echo area will not show immortal items. See also
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
98 `newsticker-hide-old-items-in-echo-area'."
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
99 :type 'boolean
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
100 :set 'newsticker--set-customvar-ticker
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
101 :group 'newsticker-ticker)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
102
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
103 (defcustom newsticker-hide-old-items-in-echo-area
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
104 t
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
105 "Decides whether to show only the newest news items in the ticker.
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
106 If t the echo area will show only new items, i.e. only items which have
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
107 been added between the last two retrievals."
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
108 :type 'boolean
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
109 :set 'newsticker--set-customvar-ticker
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
110 :group 'newsticker-ticker)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
111
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
112 (defcustom newsticker-hide-obsolete-items-in-echo-area
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
113 t
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
114 "Decides whether to show obsolete items items in the ticker.
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
115 If t the echo area will not show obsolete items. See also
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
116 `newsticker-hide-old-items-in-echo-area'."
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
117 :type 'boolean
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
118 :set 'newsticker--set-customvar-ticker
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
119 :group 'newsticker-ticker)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
120
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
121 (defun newsticker--display-tick ()
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
122 "Called from the display timer.
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
123 This function calls a display function, according to the variable
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
124 `newsticker-scroll-smoothly'."
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
125 (if newsticker-scroll-smoothly
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
126 (newsticker--display-scroll)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
127 (newsticker--display-jump)))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
128
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
129 (defsubst newsticker--echo-area-clean-p ()
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
130 "Check whether somebody is using the echo area / minibuffer.
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
131 Return t if echo area and minibuffer are unused."
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
132 (not (or (active-minibuffer-window)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
133 (and (current-message)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
134 (not (string= (current-message)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
135 newsticker--prev-message))))))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
136
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
137 (defun newsticker--display-jump ()
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
138 "Called from the display timer.
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
139 This function displays the next ticker item in the echo area, unless
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
140 there is another message displayed or the minibuffer is active."
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
141 (let ((message-log-max nil));; prevents message text from being logged
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
142 (when (newsticker--echo-area-clean-p)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
143 (setq newsticker--item-position (1+ newsticker--item-position))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
144 (when (>= newsticker--item-position (length newsticker--item-list))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
145 (setq newsticker--item-position 0))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
146 (setq newsticker--prev-message
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
147 (nth newsticker--item-position newsticker--item-list))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
148 (message "%s" newsticker--prev-message))))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
149
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
150 (defun newsticker--display-scroll ()
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
151 "Called from the display timer.
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
152 This function scrolls the ticker items in the echo area, unless
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
153 there is another message displayed or the minibuffer is active."
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
154 (when (newsticker--echo-area-clean-p)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
155 (let* ((width (- (frame-width) 1))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
156 (message-log-max nil);; prevents message text from being logged
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
157 (i newsticker--item-position)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
158 subtext
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
159 (s-text newsticker--scrollable-text)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
160 (l (length s-text)))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
161 ;; don't show anything if there is nothing to show
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
162 (unless (< (length s-text) 1)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
163 ;; repeat the ticker string if it is shorter than frame width
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
164 (while (< (length s-text) width)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
165 (setq s-text (concat s-text s-text)))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
166 ;; get the width of the printed string
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
167 (setq l (length s-text))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
168 (cond ((< i (- l width))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
169 (setq subtext (substring s-text i (+ i width))))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
170 (t
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
171 (setq subtext (concat
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
172 (substring s-text i l)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
173 (substring s-text 0 (- width (- l i)))))))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
174 ;; Take care of multibyte strings, for which (string-width) is
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
175 ;; larger than (length).
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
176 ;; Actually, such strings may be smaller than (frame-width)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
177 ;; because return values of (string-width) are too large:
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
178 ;; (string-width "<japanese character>") => 2
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
179 (let ((t-width (1- (length subtext))))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
180 (while (> (string-width subtext) width)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
181 (setq subtext (substring subtext 0 t-width))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
182 (setq t-width (1- t-width))))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
183 ;; show the ticker text and save current position
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
184 (message "%s" subtext)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
185 (setq newsticker--prev-message subtext)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
186 (setq newsticker--item-position (1+ i))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
187 (when (>= newsticker--item-position l)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
188 (setq newsticker--item-position 0))))))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
189
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
190 ;;;###autoload
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
191 (defun newsticker-start-ticker ()
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
192 "Start newsticker's ticker (but not the news retrieval).
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
193 Start display timer for the actual ticker if wanted and not
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
194 running already."
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
195 (interactive)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
196 (if (and (> newsticker-ticker-interval 0)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
197 (not newsticker--ticker-timer))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
198 (setq newsticker--ticker-timer
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
199 (run-at-time newsticker-ticker-interval
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
200 newsticker-ticker-interval
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
201 'newsticker--display-tick))))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
202
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
203 (defun newsticker-stop-ticker ()
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
204 "Stop newsticker's ticker (but not the news retrieval)."
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
205 (interactive)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
206 (when newsticker--ticker-timer
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
207 (cancel-timer newsticker--ticker-timer)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
208 (setq newsticker--ticker-timer nil)))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
209
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 ;;; Manipulation of ticker text
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
212 ;; ======================================================================
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
213 (defun newsticker--ticker-text-setup ()
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
214 "Build the ticker text which is scrolled or flashed in the echo area."
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
215 ;; reset scrollable text
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
216 (setq newsticker--scrollable-text "")
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
217 (setq newsticker--item-list nil)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
218 (setq newsticker--item-position 0)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
219 ;; build scrollable text from cache data
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
220 (let ((have-something nil))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
221 (mapc
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
222 (lambda (feed)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
223 (let ((feed-name (symbol-name (car feed))))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
224 (let ((num-new (newsticker--stat-num-items (car feed) 'new))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
225 (num-old (newsticker--stat-num-items (car feed) 'old))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
226 (num-imm (newsticker--stat-num-items (car feed) 'immortal))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
227 (num-obs (newsticker--stat-num-items (car feed) 'obsolete)))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
228 (when (or (> num-new 0)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
229 (and (> num-old 0)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
230 (not newsticker-hide-old-items-in-echo-area))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
231 (and (> num-imm 0)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
232 (not newsticker-hide-immortal-items-in-echo-area))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
233 (and (> num-obs 0)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
234 (not newsticker-hide-obsolete-items-in-echo-area)))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
235 (setq have-something t)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
236 (mapc
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
237 (lambda (item)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
238 (let ((title (replace-regexp-in-string
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
239 "[\r\n]+" " "
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
240 (newsticker--title item)))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
241 (age (newsticker--age item)))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
242 (unless (string= title newsticker--error-headline)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
243 (when
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
244 (or (eq age 'new)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
245 (and (eq age 'old)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
246 (not newsticker-hide-old-items-in-echo-area))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
247 (and (eq age 'obsolete)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
248 (not
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
249 newsticker-hide-obsolete-items-in-echo-area))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
250 (and (eq age 'immortal)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
251 (not
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
252 newsticker-hide-immortal-items-in-echo-area)))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
253 (setq title (newsticker--remove-whitespace title))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
254 ;; add to flash list
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
255 (add-to-list 'newsticker--item-list
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
256 (concat feed-name ": " title) t)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
257 ;; and to the scrollable text
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
258 (setq newsticker--scrollable-text
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
259 (concat newsticker--scrollable-text
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
260 " " feed-name ": " title " +++"))))))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
261 (cdr feed))))))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
262 newsticker--cache)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
263 (when have-something
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
264 (setq newsticker--scrollable-text
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
265 (concat "+++ "
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
266 (format-time-string "%A, %H:%M"
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
267 newsticker--latest-update-time)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
268 " ++++++" newsticker--scrollable-text)))))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
269
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
270 (defun newsticker--ticker-text-remove (feed title)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
271 "Remove the item of FEED with TITLE from the ticker text."
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
272 ;; reset scrollable text
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
273 (setq newsticker--item-position 0)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
274 (let ((feed-name (symbol-name feed))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
275 (t-title (replace-regexp-in-string "[\r\n]+" " " title)))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
276 ;; remove from flash list
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
277 (setq newsticker--item-list (remove (concat feed-name ": " t-title)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
278 newsticker--item-list))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
279 ;; and from the scrollable text
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
280 (setq newsticker--scrollable-text
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
281 (replace-regexp-in-string
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
282 (regexp-quote (concat " " feed-name ": " t-title " +++"))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
283 ""
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
284 newsticker--scrollable-text))
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
285 (if (string-match (concat "^\\+\\+\\+ [A-Z][a-z]+, "
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
286 "[012]?[0-9]:[0-9][0-9] \\+\\+\\+\\+\\+\\+$")
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
287 newsticker--scrollable-text)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
288 (setq newsticker--scrollable-text ""))))
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 (provide 'newsticker-ticker)
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
291
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
292 ;; arch-tag: faee3ebb-749b-4935-9835-7f36d4b700f0
b4bd9957663d Renamed newsticker-*.el to newst-*.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
293 ;;; newst-ticker.el ends here