;; Created: 17. June 2003
;; Keywords: News, RSS
;; Time-stamp: "26. August 2005, 16:33:46 (ulf)"
-;; CVS-Version: $Id: newsticker.el,v 1.1 2005/09/12 15:30:19 rms Exp $
+;; CVS-Version: $Id: newsticker.el,v 1.2 2005/09/12 22:54:28 miles Exp $
(defconst newsticker-version "1.8" "Version number of newsticker.el.")
;; following.
;; (add-hook 'newsticker-mode-hook 'imenu-add-menubar-index)
-;; That's it.
+;; That's it.
;; Usage
;; -----
(require 'derived)
(require 'xml)
+;; Silence warnings
+(defvar tool-bar-map)
+(defvar w3-mode-map)
+(defvar w3m-minor-mode-map)
+
;; ======================================================================
;;; Customizables
;; ======================================================================
:type 'boolean
:set 'newsticker--set-customvar
:group 'newsticker-ticker)
-
+
(defcustom newsticker-hide-old-items-in-echo-area
t
"Decides whether to show only the newest news items in the ticker.
(run-at-time newsticker-display-interval
newsticker-display-interval
'newsticker--display-tick))))
-
+
(defun newsticker-stop ()
"Stop the newsticker and the newsticker-ticker.
Cancel the timers for display and retrieval. Run `newsticker-stop-hook'
;; Emacs 21.3.50 does not care if we turn off auto-fill in the
;; definition of newsticker-mode, so we do it here (again)
(auto-fill-mode -1)
-
+
(set-buffer-file-coding-system 'utf-8)
(if newsticker-use-full-width
(w3m-remove-image
pos (next-single-property-change pos 'w3m-image))
(w3m-toggle-inline-image t))))))))))))
-
+
;; ======================================================================
;;; keymap stuff
;; ======================================================================
(interactive)
(newsticker--buffer-hideshow 'desc-old nil)
(newsticker--buffer-redraw))
-
+
(defun newsticker-show-old-item-desc ()
"Show the description of old items."
(interactive)
"Hide description of entry at point."
(interactive)
(save-excursion
- (let* (pos1 pos2
+ (let* (pos1 pos2
(inhibit-read-only t)
inv-prop org-inv-prop
is-invisible)
"Show description of entry at point."
(interactive)
(save-excursion
- (let* (pos1 pos2
+ (let* (pos1 pos2
(inhibit-read-only t)
inv-prop org-inv-prop
is-invisible)
(set-process-coding-system proc 'no-conversion 'no-conversion)
(set-process-sentinel proc 'newsticker--sentinel)))))
-
+
(defun newsticker-mouse-browse-url (event)
"Call `browse-url' for the link of the item at which the EVENT occurred."
(interactive "e")
(let ((start (match-beginning 0)))
(unless (search-forward "-->" nil t)
(error "Can't find end of comment"))
- (delete-region start (point))))
+ (delete-region start (point))))
;; And another one (20050702)! If description is HTML
;; encoded and starts with a `<', wrap the whole
;; description in a CDATA expression. This happened for
(guid (if (stringp tguid)
tguid
(car (xml-node-children tguid)))))
- ;;(message "guid=%s" guid)
+ ;;(message "guid=%s" guid)
(setq old-item
(newsticker--cache-contains newsticker--cache
name-symbol title
(when (and imageurl
(string-match "%l" newsticker-heading-format))
(newsticker--image-get name imageurl))))))
-
+
(defun newsticker--display-tick ()
"Called from the display timer.
This function calls a display function, according to the variable
feed-name-symbol)))
items)
(put-text-property pos (point) 'feed (car feed))
-
+
;; insert empty line between feeds
(let ((p (point)))
(insert "\n")
(put-text-property p (point) 'hard t)))))
(append newsticker-url-list newsticker-url-list-defaults))
-
+
(newsticker--buffer-set-faces (point-min) (point-max))
(newsticker--buffer-set-invisibility (point-min) (point-max))
(goto-char (point-min)))
-
+
(defun newsticker--buffer-insert-item (item &optional feed-name-symbol)
"Insert a news item in the current buffer.
Insert the string PREFIX and a formatted representation of the
(setq format newsticker-item-format)
(if (eq type 'feed)
(setq format newsticker-heading-format)))
-
+
(while (> (length format) 0)
(let ((prefix (if (> (length format) 1)
(substring format 0 2)
;; in case that the format string contained newlines
(put-text-property p (point) 'hard t))
(setq format (substring format (match-beginning 2)))))))
-
+
;; decode HTML if possible...
(let ((is-rendered-HTML nil))
(when (and newsticker-html-renderer pos-text-start pos-text-end)
(save-excursion
(funcall newsticker-html-renderer pos-text-start
pos-text-end)))
- ;; FIXME: compiler warning about free variable
- ;; w3m-minor-mode-map
(cond ((eq newsticker-html-renderer 'w3m-region)
(add-text-properties pos (point-max)
(list 'keymap
(add-text-properties pos (point)
(list 'nt-title (newsticker--title item)
'nt-desc (newsticker--desc item))))
-
+
(add-text-properties pos (point)
(list 'nt-type type
'nt-face type
;; left margin
;;(unless (memq type '(feed item))
;;(set-left-margin pos (1- (point)) 1))
-
+
;; save rendered stuff
(cond ((eq type 'desc)
;; preformatted contents
(put-text-property (max (point-min) pos1) (1- pos2)
'invisible
(list (intern
- (concat
- (symbol-name
+ (concat
+ (symbol-name
(if (eq nt-type 'extra) 'desc nt-type))
"-"
(symbol-name nt-age)))
(put-text-property (1- pos1) (1- pos2)
'invisible
(list (intern
- (concat
- (symbol-name
+ (concat
+ (symbol-name
(if (eq nt-type 'extra) 'desc nt-type))
"-"
(symbol-name nt-age)))
'newsticker-enclosure-face))))
(when face
(put-text-property pos1 (max pos1 pos2) 'face face))))
-
+
(defun newsticker--insert-image (img string)
"Insert IMG with STRING at point.
This is a work-around for a strange behavior of Emacs versions before
(newsticker--debug-msg
"Item `%s' from %s has expired on %s"
(newsticker--title item)
- (format-time-string "%Y-%02m-%d, %H:%M"
+ (format-time-string "%Y-%02m-%d, %H:%M"
(newsticker--time item))
(format-time-string "%Y-%02m-%d, %H:%M" exp-time))
(setcar (nthcdr 4 item) new-age)))))
(setcdr feed-list (sort (cdr feed-list)
sort-fun)))
newsticker--cache)))
-
+
(defun newsticker--cache-update (&optional save)
"Update newsticker cache file.
If optional argument SAVE is not nil the cache file is saved to disk."
(list name url nil nil nil) t)))
outlines))
(customize-variable 'newsticker-url-list))
-
+
;; ======================================================================
;;; Auto marking
;; ======================================================================