Function: newsticker--cache-add
newsticker--cache-add is a byte-compiled function defined in
newst-backend.el.gz.
Signature
(newsticker--cache-add DATA FEED-NAME-SYMBOL TITLE DESC LINK TIME AGE POSITION EXTRA-ELEMENTS &optional UPDATED-TIME UPDATED-AGE PREFORMATTED-CONTENTS PREFORMATTED-TITLE)
Documentation
Add another item to cache data.
Add to DATA in the FEED-NAME-SYMBOL an item with TITLE, DESC, LINK, TIME, AGE, POSITION, and EXTRA-ELEMENTS. If this item is contained already, its time is set to UPDATED-TIME, its mark is set to UPDATED-AGE, and its pre-formatted contents is set to PREFORMATTED-CONTENTS and PREFORMATTED-TITLE. Returns the age which the item got.
Source Code
;; Defined in /usr/src/emacs/lisp/net/newst-backend.el.gz
(defun newsticker--cache-add (data feed-name-symbol title desc link time age
position extra-elements
&optional updated-time updated-age
preformatted-contents
preformatted-title)
"Add another item to cache data.
Add to DATA in the FEED-NAME-SYMBOL an item with TITLE, DESC,
LINK, TIME, AGE, POSITION, and EXTRA-ELEMENTS. If this item is
contained already, its time is set to UPDATED-TIME, its mark is
set to UPDATED-AGE, and its pre-formatted contents is set to
PREFORMATTED-CONTENTS and PREFORMATTED-TITLE. Returns the age
which the item got."
(let* ((guid (newsticker--guid-to-string (assoc 'guid extra-elements)))
(item (newsticker--cache-contains data feed-name-symbol title desc link
age guid)))
;;(message "guid=%s" guid)
(if item
;; does exist already -- change age, update time and position
(progn
;;(newsticker--debug-msg "Updating item %s %s %s %s %s -> %s %s
;; (guid %s -> %s)"
;; feed-name-symbol title link time age
;; updated-time updated-age
;; guid (newsticker--guid item))
(if (nthcdr 5 item)
(setcar (nthcdr 5 item) position)
(setcdr (nthcdr 4 item) (list position)))
(setcar (nthcdr 4 item) updated-age)
(if updated-time
(setcar (nthcdr 3 item) updated-time))
;; replace cached pre-formatted contents
(newsticker--cache-set-preformatted-contents
item preformatted-contents)
(newsticker--cache-set-preformatted-title
item preformatted-title))
;; did not exist or age equals 'feed-name-symbol
(setq item (list title desc link time age position preformatted-contents
preformatted-title extra-elements))
;;(newsticker--debug-msg "Adding item %s" item)
(let ((this-feed (assq feed-name-symbol data)))
(if this-feed
(setcdr this-feed (nconc (cdr this-feed) (list item)))
;; The feed is not contained.
(setq data (append data (list (list feed-name-symbol item)))))))
data))