1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-11-28 07:45:00 +00:00
emacs/lisp/net/newst-backend.el

2403 lines
102 KiB
EmacsLisp
Raw Normal View History

;;; newst-backend.el --- Retrieval backend for newsticker -*- lexical-binding:t -*-
2008-06-08 15:36:18 +00:00
2023-01-01 10:31:12 +00:00
;; Copyright (C) 2003-2023 Free Software Foundation, Inc.
2008-06-08 15:36:18 +00:00
;; Author: Ulf Jasper <ulf.jasper@web.de>
2008-06-13 17:08:25 +00:00
;; Filename: newst-backend.el
2021-12-09 15:22:17 +00:00
;; URL: https://www.nongnu.org/newsticker
2008-06-08 15:36:18 +00:00
;; Keywords: News, RSS, Atom
;; Package: newsticker
2008-06-08 15:36:18 +00:00
;; ======================================================================
2008-06-10 03:19:15 +00:00
;; This file is part of GNU Emacs.
2008-06-08 15:36:18 +00:00
;; GNU Emacs is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;; GNU Emacs is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
2008-06-08 15:36:18 +00:00
;; ======================================================================
;;; Commentary:
;; See newsticker.el
;; ======================================================================
;;; Code:
(require 'xml)
Newsticker: Show feedicons in treeview. Small fix in opml export. * etc/images/newsticker/README: Add rss-feed.png, rss-feed.svg. * etc/images/newsticker/rss-feed.png: New. * etc/images/newsticker/rss-feed.svg: New. * lisp/net/newst-backend.el: Require url-parse. (newsticker--get-news-by-wget): Store feed name as process property. (newsticker--sentinel): Read feed name from process property. (newsticker--sentinel-work): Rename argument name to feed-name. Rename variable imageurl to image-url. Pick icon url from Atom 1.0 data. Launch download of feed icon. (newsticker--get-icon-url-atom-1.0): New. (newsticker--unxml) (newsticker--unxml-node) (newsticker--unxml-attribute): Documentation. (newsticker--icons-dir): New. (newsticker--image-get): New arguments FILENAME and DIRECTORY. Use `url-retrieve' if `newsticker-retrieval-method' is 'intern. (newsticker--image-download-by-wget): New. Use process properties for storing informations. (newsticker--image-sentinel): Read informations from process properties. (newsticker--image-save) (newsticker--image-remove) (newsticker--image-download-by-url) (newsticker--image-download-by-url-callback): New. (newsticker-opml-export): Handle url list entries containing a function instead of an url string. * lisp/net/newst-reader.el (newsticker-html-renderer): Whitespace. (newsticker--print-extra-elements) (newsticker--do-print-extra-element): Documentation (newsticker--image-read): Optionally limit image height. Use imagemagick if possible. (newsticker--icon-read): New. * lisp/net/newst-treeview.el (newsticker--treeview-item-show): Limit height of feed logo. (newsticker--treeview-tree-expand): Use feed icons in treeview. (newsticker--tree-widget-icon-create): New. Set the tree widget icon. (newsticker--tree-widget-leaf-icon): Use feed icon.
2014-10-19 16:50:15 +00:00
(require 'url-parse)
(require 'iso8601)
2008-06-08 15:36:18 +00:00
;; Silence warnings
(defvar newsticker-groups)
2008-06-08 15:36:18 +00:00
(defvar newsticker--retrieval-timer-list nil
"List of timers for news retrieval.
This is an alist, each element consisting of (feed-name . timer).")
(defvar newsticker--sentinel-callback nil
"Function called at end of `newsticker--sentinel'.")
;;;###autoload
(defun newsticker-running-p ()
"Check whether newsticker is running.
Return t if newsticker is running, nil otherwise. Newsticker is
considered to be running if the newsticker timer list is not empty."
(> (length newsticker--retrieval-timer-list) 0))
;; ======================================================================
;;; Customization
;; ======================================================================
(defgroup newsticker nil
"Aggregator for RSS and Atom feeds."
:group 'applications)
;; Hard-coding URLs like this is a recipe for propagating obsolete info.
2008-06-08 15:36:18 +00:00
(defconst newsticker--raw-url-list-defaults
'(("Debian Security Advisories"
2021-03-24 08:28:32 +00:00
"https://www.debian.org/security/dsa.en.rdf")
2008-06-08 15:36:18 +00:00
("Debian Security Advisories - Long format"
2021-03-24 08:28:32 +00:00
"https://www.debian.org/security/dsa-long.en.rdf")
2008-06-08 15:36:18 +00:00
("Emacs Wiki"
"https://www.emacswiki.org/emacs?action=rss"
nil
3600)
2008-06-08 15:36:18 +00:00
("LWN (Linux Weekly News)"
"https://lwn.net/headlines/rss")
2008-06-08 15:36:18 +00:00
("Quote of the day"
2021-03-24 08:28:32 +00:00
"https://feeds.feedburner.com/quotationspage/qotd"
"07:00"
86400)
2008-06-08 15:36:18 +00:00
("The Register"
"https://www.theregister.co.uk/headlines.rss")
2008-06-08 15:36:18 +00:00
("slashdot"
"http://rss.slashdot.org/Slashdot/slashdot"
nil
3600) ;/. will ban you if under 3600 seconds!
2008-06-08 15:36:18 +00:00
("Wired News"
"https://www.wired.com/feed/rss")
2008-06-08 15:36:18 +00:00
("Heise News (german)"
"http://www.heise.de/newsticker/heise.rdf")
2008-06-08 15:36:18 +00:00
("Tagesschau (german)"
"http://www.tagesschau.de/newsticker.rdf"
nil
1800))
2008-06-08 15:36:18 +00:00
"Default URL list in raw form.
This list is fed into defcustom via `newsticker--splicer'.")
(defun newsticker--splicer (item)
"Convert ITEM for splicing into `newsticker-url-list-defaults'."
(let ((result (list 'list :tag (nth 0 item) (list 'const (nth 0 item))))
(element (cdr item)))
(while element
(setq result (append result (list (list 'const (car element)))))
(setq element (cdr element)))
result))
(defun newsticker--set-customvar-retrieval (symbol value)
"Set retrieval related newsticker-variable SYMBOL value to VALUE.
Calls all actions which are necessary in order to make the new
value effective."
(if (or (not (boundp symbol))
(equal (symbol-value symbol) value))
(set symbol value)
;; something must have changed
(let ((need-restart nil)
(new-or-changed-feeds nil)
(removed-feeds))
(cond ((eq symbol 'newsticker-retrieval-interval)
(setq need-restart t))
((memq symbol '(newsticker-url-list-defaults newsticker-url-list))
(dolist (elt value)
(unless (member elt (symbol-value symbol))
(setq new-or-changed-feeds (cons elt new-or-changed-feeds))))
(dolist (elt (symbol-value symbol))
(unless (member elt value)
(setq removed-feeds (cons elt removed-feeds))))))
(cond (need-restart
(set symbol value)
(when (newsticker-running-p)
(message "Restarting newsticker")
(newsticker-stop)
(newsticker-start)))
(t
(dolist (feed removed-feeds)
(message "Stopping feed `%s'" (car feed))
(newsticker--stop-feed (car feed)))
(dolist (feed new-or-changed-feeds)
(message "Starting feed `%s'" (car feed))
(newsticker--stop-feed (car feed))
(newsticker--start-feed feed))
(unless new-or-changed-feeds
(when newsticker--sentinel-callback
(funcall newsticker--sentinel-callback)))))
(set symbol value))))
;; ======================================================================
;; retrieval
(defgroup newsticker-retrieval nil
"Settings for news retrieval."
:group 'newsticker)
(defcustom newsticker-url-list-defaults
'(("Emacs Wiki"
"https://www.emacswiki.org/emacs?action=rss"
nil
3600))
2008-06-08 15:36:18 +00:00
"A customizable list of news feeds to select from.
These were mostly extracted from the Radio Community Server
<http://rcs.userland.com/>.
2008-06-08 15:36:18 +00:00
You may add other entries in `newsticker-url-list'."
Replace insignificant backquotes Replace most insignificant occurrences of '`' with a straight quote, sharp quote or nothing. This includes backquotes in 'pcase' patterns. * admin/admin.el: * lisp/apropos.el: * lisp/arc-mode.el: * lisp/auth-source.el: * lisp/avoid.el: * lisp/bindings.el: * lisp/bs.el: * lisp/calculator.el: * lisp/calendar/todo-mode.el: * lisp/cedet/semantic.el: * lisp/cedet/semantic/analyze/debug.el: * lisp/cedet/semantic/bovine.el: * lisp/cedet/semantic/dep.el: * lisp/cedet/semantic/grammar.el: * lisp/cedet/semantic/wisent/comp.el: * lisp/cedet/semantic/wisent/grammar.el: * lisp/cedet/srecode/mode.el: * lisp/cus-edit.el: * lisp/doc-view.el: * lisp/elec-pair.el: * lisp/electric.el: * lisp/emacs-lisp/autoload.el: * lisp/emacs-lisp/benchmark.el: * lisp/emacs-lisp/byte-opt.el: * lisp/emacs-lisp/bytecomp.el: * lisp/emacs-lisp/cconv.el: * lisp/emacs-lisp/cl-extra.el: * lisp/emacs-lisp/cl-generic.el: * lisp/emacs-lisp/cl-macs.el: * lisp/emacs-lisp/copyright.el: * lisp/emacs-lisp/debug.el: * lisp/emacs-lisp/eieio-compat.el: * lisp/emacs-lisp/ert.el: * lisp/emacs-lisp/generator.el: * lisp/emacs-lisp/inline.el: * lisp/emacs-lisp/macroexp.el: * lisp/emacs-lisp/map.el: * lisp/emacs-lisp/package-x.el: * lisp/emacs-lisp/package.el: * lisp/emacs-lisp/radix-tree.el: * lisp/emacs-lisp/smie.el: * lisp/epa.el: * lisp/erc/erc-dcc.el: * lisp/erc/erc-track.el: * lisp/erc/erc.el: * lisp/eshell/em-ls.el: * lisp/eshell/esh-cmd.el: * lisp/files.el: * lisp/filesets.el: * lisp/font-lock.el: * lisp/frameset.el: * lisp/gnus/gnus-agent.el: * lisp/gnus/gnus-art.el: * lisp/gnus/gnus-cite.el: * lisp/gnus/gnus-group.el: * lisp/gnus/gnus-msg.el: * lisp/gnus/gnus-salt.el: * lisp/gnus/gnus-srvr.el: * lisp/gnus/gnus-sum.el: * lisp/gnus/gnus-topic.el: * lisp/gnus/gnus-util.el: * lisp/gnus/gnus.el: * lisp/gnus/message.el: * lisp/gnus/mm-util.el: * lisp/gnus/mml.el: * lisp/gnus/nnheader.el: * lisp/gnus/nnimap.el: * lisp/gnus/nnmairix.el: * lisp/gnus/spam.el: * lisp/hexl.el: * lisp/hi-lock.el: * lisp/ibuf-ext.el: * lisp/ibuffer.el: * lisp/ido.el: * lisp/info.el: * lisp/international/mule-cmds.el: * lisp/international/mule-util.el: * lisp/json.el: * lisp/jsonrpc.el: * lisp/language/cyrillic.el: * lisp/language/european.el: * lisp/language/georgian.el: * lisp/language/tibetan.el: * lisp/language/utf-8-lang.el: * lisp/language/vietnamese.el: * lisp/ldefs-boot.el: * lisp/mail/mail-extr.el: * lisp/man.el: * lisp/menu-bar.el: * lisp/mh-e/mh-acros.el: * lisp/mh-e/mh-folder.el: * lisp/mh-e/mh-mime.el: * lisp/mh-e/mh-show.el: * lisp/mh-e/mh-speed.el: * lisp/minibuffer.el: * lisp/mpc.el: * lisp/net/ange-ftp.el: * lisp/net/hmac-def.el: * lisp/net/newst-backend.el: * lisp/net/quickurl.el: * lisp/net/tramp-archive.el: * lisp/net/tramp-compat.el: * lisp/notifications.el: * lisp/obsolete/pgg-parse.el: * lisp/obsolete/vc-arch.el: * lisp/obsolete/xesam.el: * lisp/org/ob-C.el: * lisp/org/ob-core.el: * lisp/org/ob-exp.el: * lisp/org/ob-groovy.el: * lisp/org/ob-haskell.el: * lisp/org/ob-io.el: * lisp/org/ob-lisp.el: * lisp/org/ob-lob.el: * lisp/org/ob-lua.el: * lisp/org/ob-octave.el: * lisp/org/ob-perl.el: * lisp/org/ob-python.el: * lisp/org/ob-ref.el: * lisp/org/ob-ruby.el: * lisp/org/ob-sql.el: * lisp/org/org-agenda.el: * lisp/org/org-capture.el: * lisp/org/org-clock.el: * lisp/org/org-colview.el: * lisp/org/org-duration.el: * lisp/org/org-element.el: * lisp/org/org-entities.el: * lisp/org/org-gnus.el: * lisp/org/org-indent.el: * lisp/org/org-info.el: * lisp/org/org-inlinetask.el: * lisp/org/org-lint.el: * lisp/org/org-list.el: * lisp/org/org-mouse.el: * lisp/org/org-plot.el: * lisp/org/org-src.el: * lisp/org/org-table.el: * lisp/org/org.el: * lisp/org/ox-ascii.el: * lisp/org/ox-html.el: * lisp/org/ox-latex.el: * lisp/org/ox-man.el: * lisp/org/ox-md.el: * lisp/org/ox-org.el: * lisp/org/ox-publish.el: * lisp/org/ox-texinfo.el: * lisp/org/ox.el: * lisp/play/bubbles.el: * lisp/play/gamegrid.el: * lisp/progmodes/autoconf.el: * lisp/progmodes/cc-defs.el: * lisp/progmodes/cc-engine.el: * lisp/progmodes/cc-fonts.el: * lisp/progmodes/cc-langs.el: * lisp/progmodes/cperl-mode.el: * lisp/progmodes/ebrowse.el: * lisp/progmodes/elisp-mode.el: * lisp/progmodes/flymake-cc.el: * lisp/progmodes/flymake.el: * lisp/progmodes/fortran.el: * lisp/progmodes/grep.el: * lisp/progmodes/gud.el: * lisp/progmodes/idlwave.el: * lisp/progmodes/js.el: * lisp/progmodes/m4-mode.el: * lisp/progmodes/make-mode.el: * lisp/progmodes/mixal-mode.el: * lisp/progmodes/modula2.el: * lisp/progmodes/octave.el: * lisp/progmodes/opascal.el: * lisp/progmodes/prolog.el: * lisp/progmodes/ps-mode.el: * lisp/progmodes/python.el: * lisp/progmodes/ruby-mode.el: * lisp/progmodes/sh-script.el: * lisp/progmodes/sql.el: * lisp/progmodes/verilog-mode.el: * lisp/ps-mule.el: * lisp/rtree.el: * lisp/ruler-mode.el: * lisp/ses.el: * lisp/simple.el: * lisp/startup.el: * lisp/subr.el: * lisp/term/ns-win.el: * lisp/textmodes/bibtex.el: * lisp/textmodes/conf-mode.el: * lisp/textmodes/css-mode.el: * lisp/textmodes/refill.el: * lisp/textmodes/sgml-mode.el: * lisp/textmodes/tex-mode.el: * lisp/tutorial.el: * lisp/url/url-dav.el: * lisp/url/url-gw.el: * lisp/url/url-http.el: * lisp/url/url-methods.el: * lisp/url/url-privacy.el: * lisp/vc/cvs-status.el: * lisp/vc/diff-mode.el: * lisp/vc/ediff-init.el: * lisp/vc/ediff-ptch.el: * lisp/vc/log-edit.el: * lisp/vc/log-view.el: * lisp/vc/pcvs-info.el: * lisp/vc/pcvs.el: * lisp/vc/smerge-mode.el: * lisp/vc/vc-git.el: * lisp/vc/vc-hg.el: * lisp/vc/vc-mtn.el: * lisp/vc/vc-rcs.el: * lisp/whitespace.el: * lisp/window.el: * test/lisp/electric-tests.el: * test/lisp/emacs-lisp/cl-lib-tests.el: * test/lisp/emacs-lisp/ert-tests.el: * test/lisp/epg-tests.el: * test/lisp/jsonrpc-tests.el: * test/src/data-tests.el: * test/src/json-tests.el: Replace most insignificant backquotes.
2018-11-05 00:22:15 +00:00
:type `(set ,@(mapcar #'newsticker--splicer
2008-06-08 15:36:18 +00:00
newsticker--raw-url-list-defaults))
* lisp/net/*.el: Use lexical-binding Also remove some redundant `:group` arguments. * lisp/net/eudc-export.el: Use lexical-binding. (eudc-create-bbdb-record): Use `cl-progv` and `apply` to avoid `eval`. * lisp/net/eudc-hotlist.el: Use lexical-binding. * lisp/net/eudc.el (eudc-print-attribute-value): Use `funcall` to avoid `eval`. * lisp/net/eudcb-bbdb.el: Use lexical-binding. (eudc-bbdb-filter-non-matching-record): Use `funcall` to avoid `eval`. Move `bbdb-val` binding to avoid `setq`. Use `seq-some` instead of `eval+or`. (eudc-bbdb-format-record-as-result): Use `dolist` and `pcase`. Use `funcall` to avoid `eval`. (eudc-bbdb-query-internal): Simplify a bit. * lisp/net/eudcb-ldap.el: Use lexical-binding. (eudc-ldap-get-host-parameter): Use `defalias` to avoid `eval-and-compile`. * lisp/net/telnet.el: Use lexical-binding. * lisp/net/quickurl.el: Use lexical-binding. * lisp/net/newst-ticker.el: Use lexical-binding. * lisp/net/newst-reader.el: Use lexical-binding. * lisp/net/goto-addr.el: Use lexical-binding. * lisp/net/gnutls.el: Use lexical-binding. * lisp/net/eudcb-macos-contacts.el: Use lexical-binding. * lisp/net/eudcb-mab.el: Use lexical-binding. * lisp/net/net-utils.el: Use lexical-binding. (finger): Remove unused var `found`. * lisp/net/network-stream.el (open-protocol-stream): Remove redundant `defalias`. * lisp/net/newst-plainview.el: Use lexical-binding. (newsticker-hide-entry, newsticker-show-entry): Remove unused var `is-invisible`. (w3m-fill-column, w3-maximum-line-length): Declare vars. * lisp/net/tramp.el (tramp-compute-multi-hops): * lisp/net/tramp-compat.el (tramp-compat-temporary-file-directory): * lisp/net/tramp-cmds.el (tramp-default-rename-file): * lisp/net/webjump.el (webjump): Don't forget lexical-binding for `eval`.
2021-03-08 15:11:22 +00:00
:set #'newsticker--set-customvar-retrieval
2008-06-08 15:36:18 +00:00
:group 'newsticker-retrieval)
(defcustom newsticker-url-list nil
"The news feeds which you like to watch.
This alist will be used in addition to selection made customizing
`newsticker-url-list-defaults'.
This is an alist. Each element consists of two items: a LABEL and a URL,
optionally followed by a START-TIME, INTERVAL specifier and WGET-ARGUMENTS.
The LABEL gives the name of the news feed. It can be an arbitrary string.
The URL gives the location of the news feed. It must point to a valid
RSS or Atom file. The file is retrieved by calling wget, or whatever you
specify as `newsticker-wget-name'.
URL may also be a function which returns news data. In this case
`newsticker-retrieval-method' etc. are ignored for this feed.
2008-06-08 15:36:18 +00:00
The START-TIME can be either a string, or nil. If it is a string it
specifies a fixed time at which this feed shall be retrieved for the
first time. (Examples: \"11:00pm\", \"23:00\".) If it is nil (or
unspecified), this feed will be retrieved immediately after calling
`newsticker-start'.
The INTERVAL specifies the time between retrievals for this feed. If it
is nil (or unspecified) the default interval value as set in
`newsticker-retrieval-interval' is used.
\(newsticker.el calls `run-at-time'. The newsticker-parameters START-TIME
and INTERVAL correspond to the `run-at-time'-parameters TIME and REPEAT.)
WGET-ARGUMENTS specifies arguments for wget (see `newsticker-wget-name')
which apply for this feed only, overriding the value of
`newsticker-wget-arguments'."
:type '(repeat (list :tag "News feed"
(string :tag "Label")
(choice :tag "URI"
(string :tag "String")
(function :tag "Function"))
(choice :tag "Start"
(const :tag "Default" nil)
(string :tag "Fixed Time"))
(choice :tag "Interval"
(const :tag "Default" nil)
(const :tag "Hourly" 3600)
(const :tag "Daily" 86400)
(const :tag "Weekly" 604800)
(integer :tag "Interval"))
(choice :tag "Wget Arguments"
(const :tag "Default arguments" nil)
(repeat :tag "Special arguments" string))))
* lisp/net/*.el: Use lexical-binding Also remove some redundant `:group` arguments. * lisp/net/eudc-export.el: Use lexical-binding. (eudc-create-bbdb-record): Use `cl-progv` and `apply` to avoid `eval`. * lisp/net/eudc-hotlist.el: Use lexical-binding. * lisp/net/eudc.el (eudc-print-attribute-value): Use `funcall` to avoid `eval`. * lisp/net/eudcb-bbdb.el: Use lexical-binding. (eudc-bbdb-filter-non-matching-record): Use `funcall` to avoid `eval`. Move `bbdb-val` binding to avoid `setq`. Use `seq-some` instead of `eval+or`. (eudc-bbdb-format-record-as-result): Use `dolist` and `pcase`. Use `funcall` to avoid `eval`. (eudc-bbdb-query-internal): Simplify a bit. * lisp/net/eudcb-ldap.el: Use lexical-binding. (eudc-ldap-get-host-parameter): Use `defalias` to avoid `eval-and-compile`. * lisp/net/telnet.el: Use lexical-binding. * lisp/net/quickurl.el: Use lexical-binding. * lisp/net/newst-ticker.el: Use lexical-binding. * lisp/net/newst-reader.el: Use lexical-binding. * lisp/net/goto-addr.el: Use lexical-binding. * lisp/net/gnutls.el: Use lexical-binding. * lisp/net/eudcb-macos-contacts.el: Use lexical-binding. * lisp/net/eudcb-mab.el: Use lexical-binding. * lisp/net/net-utils.el: Use lexical-binding. (finger): Remove unused var `found`. * lisp/net/network-stream.el (open-protocol-stream): Remove redundant `defalias`. * lisp/net/newst-plainview.el: Use lexical-binding. (newsticker-hide-entry, newsticker-show-entry): Remove unused var `is-invisible`. (w3m-fill-column, w3-maximum-line-length): Declare vars. * lisp/net/tramp.el (tramp-compute-multi-hops): * lisp/net/tramp-compat.el (tramp-compat-temporary-file-directory): * lisp/net/tramp-cmds.el (tramp-default-rename-file): * lisp/net/webjump.el (webjump): Don't forget lexical-binding for `eval`.
2021-03-08 15:11:22 +00:00
:set #'newsticker--set-customvar-retrieval
2008-06-08 15:36:18 +00:00
:group 'newsticker-retrieval)
(defcustom newsticker-retrieval-method
'intern
"Method for retrieving news from the web, either `intern' or `extern'.
Default value `intern' uses Emacs' built-in asynchronous download
Don't quote symbols 'like-this' in docstrings etc. * admin/unidata/uvs.el (uvs-insert-fields-as-bytes): * lisp/allout-widgets.el (allout-widgets-count-buttons-in-region): * lisp/allout.el (allout-add-resumptions, allout-mode): * lisp/calculator.el (calculator-operators): * lisp/cedet/data-debug.el (dd-propertize): * lisp/cedet/ede/proj-prog.el (ede-proj-target-makefile-program): * lisp/cedet/semantic/analyze/debug.el: (semantic-analyzer-debug-global-miss-text): * lisp/cedet/semantic/lex-spp.el: (semantic-lex-spp-replace-or-symbol-or-keyword): * lisp/cedet/semantic/symref.el: (semantic-symref-cleanup-recent-buffers-fcn): * lisp/cedet/semantic/tag.el (semantic-tag-class): * lisp/cedet/srecode/el.el (srecode-semantic-handle-:el-custom): * lisp/gnus/nnmairix.el (nnmairix-propagate-marks-upon-close): * lisp/gnus/pop3.el (pop3-authentication-scheme): * lisp/help-fns.el (describe-function-orig-buffer): * lisp/imenu.el (imenu--history-list): * lisp/mail/feedmail.el (feedmail-confirm-outgoing) (feedmail-display-full-frame, feedmail-deduce-bcc-where) (feedmail-queue-default-file-slug) (feedmail-queue-buffer-file-name): * lisp/net/mairix.el (mairix-searches-mode-map): * lisp/net/newst-backend.el (newsticker-retrieval-method) (newsticker-auto-mark-filter-list): * lisp/obsolete/vi.el (vi-mode): * lisp/progmodes/cc-engine.el (c-literal-type): * lisp/progmodes/cpp.el (cpp-face): * lisp/progmodes/ebrowse.el (ebrowse-electric-list-looper): * lisp/progmodes/elisp-mode.el (elisp--xref-make-xref): * lisp/progmodes/pascal.el (pascal-auto-lineup): * lisp/progmodes/prog-mode.el (prog-widen): * lisp/progmodes/verilog-mode.el (verilog-regexp-words) (verilog-auto-lineup, verilog-auto-reset-widths) (verilog-auto-arg-format, verilog-auto-inst-template-numbers): * lisp/textmodes/flyspell.el (flyspell-maybe-correct-transposition) (flyspell-maybe-correct-doubling): * lisp/textmodes/table.el (table-justify, table-justify-cell) (table-justify-row, table-justify-column, table-insert-sequence) (table--justify-cell-contents): * lisp/url/url-auth.el (url-get-authentication): * lisp/window.el (display-buffer-record-window): * lisp/xml.el (xml-parse-file, xml-parse-region): * src/gfilenotify.c (Fgfile_add_watch): Don't quote symbols with apostrophes in doc strings. Use asymmetric quotes instead. * lisp/cedet/semantic/complete.el (semantic-displayor-show-request): Likewise for symbol in diagnostic. * lisp/image.el (image-extension-data): * lisp/register.el (frame-configuration-to-register): * src/buffer.c (syms_of_buffer): Remove bogus apostrophes after symbols. * lisp/thumbs.el (thumbs-conversion-program): Quote Lisp string values using double-quotes, not apostrophes.
2015-08-21 00:33:48 +00:00
capabilities (`url-retrieve'). If set to `extern' the external
2008-06-08 15:36:18 +00:00
program wget is used, see `newsticker-wget-name'."
:type '(choice :tag "Method"
(const :tag "Intern" intern)
(const :tag "Extern" extern))
:group 'newsticker-retrieval)
(defcustom newsticker-wget-name
"wget"
"Name of the program which is called to retrieve news from the web.
The canonical choice is wget but you may take any other program which is
able to return the contents of a news feed file on stdout."
:type 'string
:group 'newsticker-retrieval)
(defcustom newsticker-wget-arguments
'("-q" "-O" "-")
"Arguments which are passed to wget.
There is probably no reason to change the default settings, unless you
are living behind a firewall."
:type '(repeat (string :tag "Argument"))
:group 'newsticker-retrieval)
(defcustom newsticker-retrieval-interval
3600
"Time interval for retrieving new news items (seconds).
If this value is not positive (i.e. less than or equal to 0)
items are retrieved only once!
Please note that some feeds, e.g. Slashdot, will ban you if you
make it less than 1800 seconds (30 minutes)!"
:type '(choice :tag "Interval"
(const :tag "No automatic retrieval" 0)
(const :tag "Hourly" 3600)
(const :tag "Daily" 86400)
(const :tag "Weekly" 604800)
(integer :tag "Interval"))
* lisp/net/*.el: Use lexical-binding Also remove some redundant `:group` arguments. * lisp/net/eudc-export.el: Use lexical-binding. (eudc-create-bbdb-record): Use `cl-progv` and `apply` to avoid `eval`. * lisp/net/eudc-hotlist.el: Use lexical-binding. * lisp/net/eudc.el (eudc-print-attribute-value): Use `funcall` to avoid `eval`. * lisp/net/eudcb-bbdb.el: Use lexical-binding. (eudc-bbdb-filter-non-matching-record): Use `funcall` to avoid `eval`. Move `bbdb-val` binding to avoid `setq`. Use `seq-some` instead of `eval+or`. (eudc-bbdb-format-record-as-result): Use `dolist` and `pcase`. Use `funcall` to avoid `eval`. (eudc-bbdb-query-internal): Simplify a bit. * lisp/net/eudcb-ldap.el: Use lexical-binding. (eudc-ldap-get-host-parameter): Use `defalias` to avoid `eval-and-compile`. * lisp/net/telnet.el: Use lexical-binding. * lisp/net/quickurl.el: Use lexical-binding. * lisp/net/newst-ticker.el: Use lexical-binding. * lisp/net/newst-reader.el: Use lexical-binding. * lisp/net/goto-addr.el: Use lexical-binding. * lisp/net/gnutls.el: Use lexical-binding. * lisp/net/eudcb-macos-contacts.el: Use lexical-binding. * lisp/net/eudcb-mab.el: Use lexical-binding. * lisp/net/net-utils.el: Use lexical-binding. (finger): Remove unused var `found`. * lisp/net/network-stream.el (open-protocol-stream): Remove redundant `defalias`. * lisp/net/newst-plainview.el: Use lexical-binding. (newsticker-hide-entry, newsticker-show-entry): Remove unused var `is-invisible`. (w3m-fill-column, w3-maximum-line-length): Declare vars. * lisp/net/tramp.el (tramp-compute-multi-hops): * lisp/net/tramp-compat.el (tramp-compat-temporary-file-directory): * lisp/net/tramp-cmds.el (tramp-default-rename-file): * lisp/net/webjump.el (webjump): Don't forget lexical-binding for `eval`.
2021-03-08 15:11:22 +00:00
:set #'newsticker--set-customvar-retrieval
2008-06-08 15:36:18 +00:00
:group 'newsticker-retrieval)
(defcustom newsticker-desc-comp-max
100
"Relevant length of headline descriptions.
This value gives the maximum number of characters which will be
taken into account when newsticker compares two headline
descriptions."
:type 'integer
:group 'newsticker-retrieval)
;; ======================================================================
;; headline processing
(defgroup newsticker-headline-processing nil
"Settings for the automatic processing of headlines."
:group 'newsticker)
(defcustom newsticker-automatically-mark-items-as-old
t
"Decides whether to automatically mark items as old.
If t a new item is considered as new only after its first retrieval. As
soon as it is retrieved a second time, it becomes old. If not t all
items stay new until you mark them as old. This is done in the
*newsticker* buffer."
:type 'boolean
:group 'newsticker-headline-processing)
(defcustom newsticker-automatically-mark-visited-items-as-old
t
"Decides whether to automatically mark visited items as old.
If t an item is marked as old as soon as the associated link is
visited, i.e. after pressing RET or mouse2 on the item's
headline."
:type 'boolean
:group 'newsticker-headline-processing)
(defcustom newsticker-keep-obsolete-items
t
"Decides whether to keep unread items which have been removed from feed.
If t a new item, which has been removed from the feed, is kept in
the cache until it is marked as read."
:type 'boolean
:group 'newsticker-headline-processing)
(defcustom newsticker-obsolete-item-max-age
(* 60 60 24)
"Maximal age of obsolete items, in seconds.
Obsolete items which are older than this value will be silently
deleted at the next retrieval."
:type 'integer
:group 'newsticker-headline-processing)
(defcustom newsticker-auto-mark-filter-list
nil
"A list of filters for automatically marking headlines.
This is an alist of the form (FEED-NAME PATTERN-LIST). I.e. each
element consists of a FEED-NAME a PATTERN-LIST. Each element of
the pattern-list has the form (AGE TITLE-OR-DESCRIPTION REGEXP).
Don't quote symbols 'like-this' in docstrings etc. * admin/unidata/uvs.el (uvs-insert-fields-as-bytes): * lisp/allout-widgets.el (allout-widgets-count-buttons-in-region): * lisp/allout.el (allout-add-resumptions, allout-mode): * lisp/calculator.el (calculator-operators): * lisp/cedet/data-debug.el (dd-propertize): * lisp/cedet/ede/proj-prog.el (ede-proj-target-makefile-program): * lisp/cedet/semantic/analyze/debug.el: (semantic-analyzer-debug-global-miss-text): * lisp/cedet/semantic/lex-spp.el: (semantic-lex-spp-replace-or-symbol-or-keyword): * lisp/cedet/semantic/symref.el: (semantic-symref-cleanup-recent-buffers-fcn): * lisp/cedet/semantic/tag.el (semantic-tag-class): * lisp/cedet/srecode/el.el (srecode-semantic-handle-:el-custom): * lisp/gnus/nnmairix.el (nnmairix-propagate-marks-upon-close): * lisp/gnus/pop3.el (pop3-authentication-scheme): * lisp/help-fns.el (describe-function-orig-buffer): * lisp/imenu.el (imenu--history-list): * lisp/mail/feedmail.el (feedmail-confirm-outgoing) (feedmail-display-full-frame, feedmail-deduce-bcc-where) (feedmail-queue-default-file-slug) (feedmail-queue-buffer-file-name): * lisp/net/mairix.el (mairix-searches-mode-map): * lisp/net/newst-backend.el (newsticker-retrieval-method) (newsticker-auto-mark-filter-list): * lisp/obsolete/vi.el (vi-mode): * lisp/progmodes/cc-engine.el (c-literal-type): * lisp/progmodes/cpp.el (cpp-face): * lisp/progmodes/ebrowse.el (ebrowse-electric-list-looper): * lisp/progmodes/elisp-mode.el (elisp--xref-make-xref): * lisp/progmodes/pascal.el (pascal-auto-lineup): * lisp/progmodes/prog-mode.el (prog-widen): * lisp/progmodes/verilog-mode.el (verilog-regexp-words) (verilog-auto-lineup, verilog-auto-reset-widths) (verilog-auto-arg-format, verilog-auto-inst-template-numbers): * lisp/textmodes/flyspell.el (flyspell-maybe-correct-transposition) (flyspell-maybe-correct-doubling): * lisp/textmodes/table.el (table-justify, table-justify-cell) (table-justify-row, table-justify-column, table-insert-sequence) (table--justify-cell-contents): * lisp/url/url-auth.el (url-get-authentication): * lisp/window.el (display-buffer-record-window): * lisp/xml.el (xml-parse-file, xml-parse-region): * src/gfilenotify.c (Fgfile_add_watch): Don't quote symbols with apostrophes in doc strings. Use asymmetric quotes instead. * lisp/cedet/semantic/complete.el (semantic-displayor-show-request): Likewise for symbol in diagnostic. * lisp/image.el (image-extension-data): * lisp/register.el (frame-configuration-to-register): * src/buffer.c (syms_of_buffer): Remove bogus apostrophes after symbols. * lisp/thumbs.el (thumbs-conversion-program): Quote Lisp string values using double-quotes, not apostrophes.
2015-08-21 00:33:48 +00:00
AGE must be one of the symbols `old' or `immortal'.
TITLE-OR-DESCRIPTION must be one of the symbols `title',
`description', or `all'. REGEXP is a regular expression, i.e., a
2008-06-08 15:36:18 +00:00
string.
This filter is checked after a new headline has been retrieved.
If FEED-NAME matches the name of the corresponding news feed, the
pattern-list is checked: The new headline will be marked as AGE
if REGEXP matches the headline's TITLE-OR-DESCRIPTION.
If, for example, `newsticker-auto-mark-filter-list' looks like
((slashdot (\\='old \\='title \"^Forget me!$\") (\\='immortal \\='title \"Read me\")
(\\='immortal \\='all \"important\"))))
2008-06-08 15:36:18 +00:00
then all articles from slashdot are marked as old if they have
the title \"Forget me!\". All articles with a title containing
the string \"Read me\" are marked as immortal. All articles which
contain the string \"important\" in their title or their
description are marked as immortal."
:type '(repeat (list :tag "Auto mark filter"
(string :tag "Feed name")
(repeat
(list :tag "Filter element"
(choice
:tag "Auto-assigned age"
(const :tag "Old" old)
(const :tag "Immortal" immortal))
(choice
:tag "Title/Description"
(const :tag "Title" title)
(const :tag "Description" description)
(const :tag "All" all))
Use regexp type for regexps in defcustom declarations * lisp/calendar/diary-lib.el (diary-face-attrs): * lisp/cedet/semantic/db-ebrowse.el (semanticdb-ebrowse-file-match): * lisp/cedet/srecode/document.el (srecode-document-autocomment-common-nouns-abbrevs) (srecode-document-autocomment-function-alist) (srecode-document-autocomment-return-first-alist) (srecode-document-autocomment-return-last-alist) (srecode-document-autocomment-param-alist) (srecode-document-autocomment-param-type-alist): * lisp/desktop.el (desktop-clear-preserve-buffers): * lisp/elide-head.el (elide-head-headers-to-hide): * lisp/erc/erc-backend.el (erc-encoding-coding-alist): * lisp/erc/erc-ezbounce.el (erc-ezb-regexp): * lisp/files.el (auto-save-file-name-transforms): * lisp/gnus/deuglify.el (gnus-outlook-deuglify-attrib-cut-regexp) (gnus-outlook-deuglify-attrib-verb-regexp) (gnus-outlook-deuglify-attrib-end-regexp): * lisp/gnus/gnus-fun.el (gnus-x-face-omit-files, gnus-face-omit-files): * lisp/gnus/spam.el (spam-spamassassin-positive-spam-flag-header): * lisp/htmlfontify.el (hfy-src-doc-link-unstyle): * lisp/info-look.el (info-lookup-file-name-alist): * lisp/international/rfc1843.el (rfc1843-newsgroups-regexp): * lisp/mail/feedmail.el (feedmail-queue-slug-suspect-regexp): * lisp/mail/rmail-spam-filter.el (rsf-white-list, rsf-definitions-alist): * lisp/man.el (Man-name-local-regexp): * lisp/net/ange-ftp.el (ange-ftp-dumb-unix-host-regexp): * lisp/net/newst-backend.el (newsticker-auto-mark-filter-list): * lisp/net/rcirc.el (rcirc-authinfo, rcirc-coding-system-alist): * lisp/net/tramp-adb.el (tramp-adb-prompt): * lisp/org/org-agenda.el (org-agenda-hide-tags-regexp) (org-agenda-category-icon-alist): * lisp/org/org-protocol.el (org-protocol-data-separator): * lisp/org/org-table.el (org-table-number-regexp): * lisp/org/ox-latex.el (org-latex-known-warnings): * lisp/progmodes/bug-reference.el (bug-reference-bug-regexp): * lisp/progmodes/hideif.el (hide-ifdef-header-regexp): * lisp/progmodes/idlw-help.el (idlwave-help-doclib-name) (idlwave-help-doclib-keyword): * lisp/progmodes/idlwave.el (idlwave-no-change-comment): * lisp/progmodes/python.el (python-shell-prompt-input-regexps) (python-shell-prompt-output-regexps, python-shell-prompt-regexp) (python-shell-prompt-block-regexp, python-shell-prompt-output-regexp) (python-shell-prompt-pdb-regexp, python-shell-compilation-regexp-alist) (python-pdbtrack-stacktrace-info-regexp): * lisp/progmodes/sql.el (sql-send-terminator, sql-ansi-statement-starters): * lisp/speedbar.el (speedbar-directory-unshown-regexp) (speedbar-file-unshown-regexp): * lisp/textmodes/flyspell.el (flyspell-mark-duplications-exceptions) (flyspell-tex-command-regexp): * lisp/textmodes/paragraphs.el (sentence-end-base): * lisp/textmodes/tildify.el (tildify-pattern, tildify-space-pattern): * lisp/vc/ediff-init.el (ediff-metachars): * lisp/vc/vc-git.el (vc-git-root-log-format): * lisp/vc/vc-hg.el (vc-hg-root-log-format): * lisp/whitespace.el (whitespace-indentation-regexp) (whitespace-space-after-tab-regexp): * lisp/woman.el (woman-manpath-man-regexp) (woman-imenu-generic-expression): Use 'regexp' instead of 'string' as type for values that are regexps in defcustom declarations.
2019-12-21 17:52:06 +00:00
(regexp :tag "Regexp")))))
2008-06-08 15:36:18 +00:00
:group 'newsticker-headline-processing)
;; ======================================================================
;; hooks
(defgroup newsticker-hooks nil
"Settings for newsticker hooks."
:group 'newsticker)
(defcustom newsticker-start-hook
nil
"Hook run when starting newsticker.
This hook is run at the very end of `newsticker-start'."
:options '(newsticker-start-ticker)
:type 'hook
:group 'newsticker-hooks)
(defcustom newsticker-stop-hook
nil
"Hook run when stopping newsticker.
This hook is run at the very end of `newsticker-stop'."
:options nil
:type 'hook
:group 'newsticker-hooks)
(defcustom newsticker-new-item-functions
nil
"List of functions run after a new headline has been retrieved.
Each function is called with the following two arguments:
FEEDNAME the name of the corresponding news feed,
ITEM the decoded headline.
2008-06-08 15:36:18 +00:00
See `newsticker-new-item-functions-sample',
`newsticker-download-images', and
2008-06-08 15:36:18 +00:00
`newsticker-download-enclosures' for sample functions.
Please note that these functions are called only once for a
headline after it has been retrieved for the first time."
:type 'hook
:options '(newsticker-download-images
newsticker-download-enclosures)
:group 'newsticker-hooks)
;; ======================================================================
;; miscellaneous
(defgroup newsticker-miscellaneous nil
"Miscellaneous newsticker settings."
:group 'newsticker)
2008-11-24 19:40:35 +00:00
(defcustom newsticker-dir
(locate-user-emacs-file "newsticker/" ".newsticker/")
"Directory where newsticker saves data."
:type 'directory
2008-06-08 15:36:18 +00:00
:group 'newsticker-miscellaneous)
;; debugging
(defcustom newsticker-debug
nil
"Enables some features needed for debugging newsticker.el.
If set to t newsticker.el will print lots of debugging messages, and the
buffers *newsticker-wget-<feed>* will not be closed."
:type 'boolean
:group 'newsticker-miscellaneous)
;; ======================================================================
;;; Internal variables
;; ======================================================================
(defvar newsticker--buffer-uptodate-p nil
"Tells whether the newsticker buffer is up to date.")
(defvar newsticker--latest-update-time (current-time)
"The time at which the latest news arrived.")
(defvar newsticker--process-ids nil
"List of PIDs of active newsticker processes.")
(defvar newsticker--cache nil "Cached newsticker data.
This is a list of the form
((label1
(title description link time age index preformatted-contents
preformatted-title extra-elements)
...)
(label2
(title description link time age index preformatted-contents
preformatted-title extra-elements)
...)
...)
where LABEL is a symbol. TITLE, DESCRIPTION, and LINK are
strings. TIME is a time value as returned by `current-time'.
AGE is a symbol: `new', `old', `immortal', and `obsolete' denote
ordinary news items, whereas `feed' denotes an item which is not a
2008-06-08 15:36:18 +00:00
headline but describes the feed itself. INDEX denotes the
original position of the item -- used for restoring the original
order. PREFORMATTED-CONTENTS and PREFORMATTED-TITLE hold the
formatted contents of the item's description and title. This
speeds things up if HTML rendering is used, which is rather
slow. EXTRA-ELEMENTS is an alist containing additional elements.")
(defvar newsticker--auto-narrow-to-feed nil
"Automatically narrow to current news feed.
If non-nil only the items of the current news feed are visible.")
(defvar newsticker--auto-narrow-to-item nil
"Automatically narrow to current news item.
If non-nil only the current headline is visible.")
(defconst newsticker--error-headline
"[COULD NOT DOWNLOAD HEADLINES!]"
"Title of error headline which will be inserted if news retrieval fails.")
;; ======================================================================
;;; Shortcuts
;; ======================================================================
(defsubst newsticker--title (item)
"Return title of ITEM."
(nth 0 item))
(defsubst newsticker--desc (item)
"Return description of ITEM."
(nth 1 item))
(defsubst newsticker--link (item)
"Return link of ITEM."
(nth 2 item))
(defsubst newsticker--time (item)
"Return time of ITEM."
(nth 3 item))
(defsubst newsticker--age (item)
"Return age of ITEM."
(nth 4 item))
(defsubst newsticker--pos (item)
"Return position/index of ITEM."
(nth 5 item))
(defsubst newsticker--preformatted-contents (item)
"Return pre-formatted text of ITEM."
(nth 6 item))
(defsubst newsticker--preformatted-title (item)
"Return pre-formatted title of ITEM."
(nth 7 item))
(defsubst newsticker--extra (item)
"Return extra attributes of ITEM."
(nth 8 item))
(defsubst newsticker--guid-to-string (guid)
"Return string representation of GUID."
(if (stringp guid)
guid
(car (xml-node-children guid))))
(defsubst newsticker--guid (item)
"Return guid of ITEM."
(newsticker--guid-to-string (assoc 'guid (newsticker--extra item))))
(defsubst newsticker--enclosure (item)
"Return enclosure element of ITEM in the form (...FIXME...) or nil."
2008-06-08 15:36:18 +00:00
(let ((enclosure (assoc 'enclosure (newsticker--extra item))))
(if enclosure
(xml-node-attributes enclosure))))
(defun newsticker--real-feed-name (feed)
"Return real name of FEED."
(catch 'name
(mapc (lambda (item)
(if (eq (newsticker--age item) 'feed)
(throw 'name (newsticker--title item))))
(cdr (newsticker--cache-get-feed feed)))
(symbol-name feed)))
;; ======================================================================
;;; User fun
;; ======================================================================
(defun newsticker--start-feed (feed &optional do-not-complain-if-running)
"Start retrieval timer for FEED.
If timer is running already a warning message is printed unless
DO-NOT-COMPLAIN-IF-RUNNING is not nil. Add the started
name/timer pair to `newsticker--retrieval-timer-list'."
(let* ((feed-name (car feed))
(start-time (nth 2 feed))
(interval (or (nth 3 feed)
newsticker-retrieval-interval))
(timer (assoc (car feed)
newsticker--retrieval-timer-list)))
(if timer
(or do-not-complain-if-running
(message "Timer for %s is running already!"
feed-name))
(newsticker--debug-msg "Starting timer for %s: %s, %d"
feed-name start-time interval)
;; do not repeat retrieval if interval not positive
(if (<= interval 0)
(setq interval nil))
(setq timer (run-at-time start-time interval
* lisp/net/*.el: Use lexical-binding Also remove some redundant `:group` arguments. * lisp/net/eudc-export.el: Use lexical-binding. (eudc-create-bbdb-record): Use `cl-progv` and `apply` to avoid `eval`. * lisp/net/eudc-hotlist.el: Use lexical-binding. * lisp/net/eudc.el (eudc-print-attribute-value): Use `funcall` to avoid `eval`. * lisp/net/eudcb-bbdb.el: Use lexical-binding. (eudc-bbdb-filter-non-matching-record): Use `funcall` to avoid `eval`. Move `bbdb-val` binding to avoid `setq`. Use `seq-some` instead of `eval+or`. (eudc-bbdb-format-record-as-result): Use `dolist` and `pcase`. Use `funcall` to avoid `eval`. (eudc-bbdb-query-internal): Simplify a bit. * lisp/net/eudcb-ldap.el: Use lexical-binding. (eudc-ldap-get-host-parameter): Use `defalias` to avoid `eval-and-compile`. * lisp/net/telnet.el: Use lexical-binding. * lisp/net/quickurl.el: Use lexical-binding. * lisp/net/newst-ticker.el: Use lexical-binding. * lisp/net/newst-reader.el: Use lexical-binding. * lisp/net/goto-addr.el: Use lexical-binding. * lisp/net/gnutls.el: Use lexical-binding. * lisp/net/eudcb-macos-contacts.el: Use lexical-binding. * lisp/net/eudcb-mab.el: Use lexical-binding. * lisp/net/net-utils.el: Use lexical-binding. (finger): Remove unused var `found`. * lisp/net/network-stream.el (open-protocol-stream): Remove redundant `defalias`. * lisp/net/newst-plainview.el: Use lexical-binding. (newsticker-hide-entry, newsticker-show-entry): Remove unused var `is-invisible`. (w3m-fill-column, w3-maximum-line-length): Declare vars. * lisp/net/tramp.el (tramp-compute-multi-hops): * lisp/net/tramp-compat.el (tramp-compat-temporary-file-directory): * lisp/net/tramp-cmds.el (tramp-default-rename-file): * lisp/net/webjump.el (webjump): Don't forget lexical-binding for `eval`.
2021-03-08 15:11:22 +00:00
#'newsticker-get-news feed-name))
2008-06-08 15:36:18 +00:00
(if interval
(add-to-list 'newsticker--retrieval-timer-list
(cons feed-name timer))))))
;;;###autoload
(defun newsticker-start (&optional _do-not-complain-if-running)
2008-06-08 15:36:18 +00:00
"Start the newsticker.
Start the timers for display and retrieval. If the newsticker, i.e. the
timers, are running already a warning message is printed unless
DO-NOT-COMPLAIN-IF-RUNNING is not nil.
Run `newsticker-start-hook' if newsticker was not running already."
(interactive)
(let ((running (newsticker-running-p)))
;; read old cache if it exists and newsticker is not running
(unless running
2008-11-24 19:40:35 +00:00
(newsticker--cache-read))
2008-06-08 15:36:18 +00:00
;; start retrieval timers -- one timer for each feed
(dolist (feed (append newsticker-url-list-defaults newsticker-url-list))
(newsticker--start-feed feed))
(unless running
(run-hooks 'newsticker-start-hook)
(message "Newsticker started!"))))
(defun newsticker--stop-feed (feed-name)
"Stop retrieval for feed FEED-NAME.
Delete the stopped name/timer pair from `newsticker--retrieval-timer-list'."
(let ((name-and-timer (assoc feed-name newsticker--retrieval-timer-list)))
(when name-and-timer
(cancel-timer (cdr name-and-timer))
(setq newsticker--retrieval-timer-list
(delete name-and-timer newsticker--retrieval-timer-list)))))
(defun newsticker-stop ()
"Stop the newsticker and the newsticker-ticker.
Cancel the timers for display and retrieval. Run `newsticker-stop-hook'
if newsticker has been running."
(interactive)
2008-11-24 19:40:35 +00:00
(newsticker--cache-save)
2008-06-08 15:36:18 +00:00
(when (fboundp 'newsticker-stop-ticker) ; silence compiler warnings
(newsticker-stop-ticker))
(when (newsticker-running-p)
(dolist (name-and-timer newsticker--retrieval-timer-list)
(newsticker--stop-feed (car name-and-timer)))
2008-06-08 15:36:18 +00:00
(setq newsticker--retrieval-timer-list nil)
(run-hooks 'newsticker-stop-hook)
(message "Newsticker stopped!")))
(defun newsticker-get-all-news ()
"Launch retrieval of news from all configured newsticker sites.
This does NOT start the retrieval timers."
(interactive)
;; launch retrieval of news
(dolist (item (append newsticker-url-list-defaults newsticker-url-list))
(newsticker-get-news (car item))))
2008-06-08 15:36:18 +00:00
(defun newsticker-save-item (feed item)
"Save FEED ITEM."
(interactive)
(let ((filename (read-string "Filename: "
(concat feed ":_"
Use string-replace instead of replace-regexp-in-string `string-replace` is easier to understand, less error-prone, much faster, and results in shorter Lisp and byte code. Use it where applicable and obviously safe (erring on the conservative side). * admin/authors.el (authors-scan-change-log): * lisp/autoinsert.el (auto-insert-alist): * lisp/calc/calc-prog.el (calc-edit-macro-combine-alg-ent) (calc-edit-macro-combine-ext-command) (calc-edit-macro-combine-var-name): * lisp/calc/calc-units.el (math-make-unit-string): * lisp/calendar/cal-html.el (cal-html-comment): * lisp/calendar/cal-tex.el (cal-tex-comment): * lisp/calendar/icalendar.el (icalendar--convert-string-for-export) (icalendar--convert-string-for-import): * lisp/calendar/iso8601.el (iso8601--concat-regexps) (iso8601--full-time-match, iso8601--combined-match): * lisp/calendar/time-date.el (format-seconds): * lisp/calendar/todo-mode.el (todo-filter-items-filename): * lisp/cedet/cedet-files.el (cedet-directory-name-to-file-name) (cedet-file-name-to-directory-name): * lisp/comint.el (comint-watch-for-password-prompt): * lisp/dired-aux.el (dired-do-chmod): * lisp/dired-x.el (dired-man): * lisp/dired.el (dired-insert-directory, dired-goto-file-1): * lisp/emacs-lisp/comp.el (comp-c-func-name): * lisp/emacs-lisp/re-builder.el (reb-copy): * lisp/erc/erc-dcc.el (erc-dcc-unquote-filename): * lisp/erc/erc.el (erc-quit-reason-zippy, erc-part-reason-zippy) (erc-update-mode-line-buffer, erc-message-english-PART): * lisp/files.el (make-backup-file-name-1, files--transform-file-name) (read-file-modes): * lisp/fringe.el (fringe-mode): * lisp/gnus/gnus-art.el (gnus-button-handle-info-url): * lisp/gnus/gnus-group.el (gnus-group-completing-read): * lisp/gnus/gnus-icalendar.el (gnus-icalendar-event-from-ical): * lisp/gnus/gnus-mlspl.el (gnus-group-split-fancy): * lisp/gnus/gnus-search.el (gnus-search-query-parse-date) (gnus-search-transform-expression, gnus-search-run-search): * lisp/gnus/gnus-start.el (gnus-dribble-enter): * lisp/gnus/gnus-sum.el (gnus-summary-refer-article): * lisp/gnus/gnus-util.el (gnus-mode-string-quote): * lisp/gnus/message.el (message-put-addresses-in-ecomplete) (message-parse-mailto-url, message-mailto-1): * lisp/gnus/mml-sec.el (mml-secure-epg-sign): * lisp/gnus/mml-smime.el (mml-smime-epg-verify): * lisp/gnus/mml2015.el (mml2015-epg-verify): * lisp/gnus/nnmaildir.el (nnmaildir--system-name) (nnmaildir-request-list, nnmaildir-retrieve-groups) (nnmaildir-request-group, nnmaildir-retrieve-headers): * lisp/gnus/nnrss.el (nnrss-node-text): * lisp/gnus/spam-report.el (spam-report-gmane-internal) (spam-report-user-mail-address): * lisp/ibuffer.el (name): * lisp/image-dired.el (image-dired-pngnq-thumb) (image-dired-pngcrush-thumb, image-dired-optipng-thumb) (image-dired-create-thumb-1): * lisp/info.el (Info-set-mode-line): * lisp/international/mule-cmds.el (describe-language-environment): * lisp/mail/rfc2231.el (rfc2231-parse-string): * lisp/mail/rfc2368.el (rfc2368-parse-mailto-url): * lisp/mail/rmail.el (rmail-insert-inbox-text) (rmail-simplified-subject-regexp): * lisp/mail/rmailout.el (rmail-output-body-to-file): * lisp/mail/undigest.el (rmail-digest-rfc1153): * lisp/man.el (Man-default-man-entry): * lisp/mouse.el (minor-mode-menu-from-indicator): * lisp/mpc.el (mpc--debug): * lisp/net/browse-url.el (browse-url-mail): * lisp/net/eww.el (eww-update-header-line-format): * lisp/net/newst-backend.el (newsticker-save-item): * lisp/net/rcirc.el (rcirc-sentinel): * lisp/net/soap-client.el (soap-decode-date-time): * lisp/nxml/rng-cmpct.el (rng-c-literal-2-re): * lisp/nxml/xmltok.el (let*): * lisp/obsolete/nnir.el (nnir-run-swish-e, nnir-run-hyrex) (nnir-run-find-grep): * lisp/play/dunnet.el (dun-doassign): * lisp/play/handwrite.el (handwrite): * lisp/proced.el (proced-format-args): * lisp/profiler.el (profiler-report-header-line-format): * lisp/progmodes/gdb-mi.el (gdb-mi-quote): * lisp/progmodes/make-mode.el (makefile-bsdmake-rule-action-regex) (makefile-make-font-lock-keywords): * lisp/progmodes/prolog.el (prolog-guess-fill-prefix): * lisp/progmodes/ruby-mode.el (ruby-toggle-string-quotes): * lisp/progmodes/sql.el (sql-remove-tabs-filter, sql-str-literal): * lisp/progmodes/which-func.el (which-func-current): * lisp/replace.el (query-replace-read-from) (occur-engine, replace-quote): * lisp/select.el (xselect--encode-string): * lisp/ses.el (ses-export-tab): * lisp/subr.el (shell-quote-argument): * lisp/term/pc-win.el (msdos-show-help): * lisp/term/w32-win.el (w32--set-selection): * lisp/term/xterm.el (gui-backend-set-selection): * lisp/textmodes/picture.el (picture-tab-search): * lisp/thumbs.el (thumbs-call-setroot-command): * lisp/tooltip.el (tooltip-show-help-non-mode): * lisp/transient.el (transient-format-key): * lisp/url/url-mailto.el (url-mailto): * lisp/vc/log-edit.el (log-edit-changelog-ours-p): * lisp/vc/vc-bzr.el (vc-bzr-status): * lisp/vc/vc-hg.el (vc-hg--glob-to-pcre): * lisp/vc/vc-svn.el (vc-svn-after-dir-status): * lisp/xdg.el (xdg-desktop-strings): * test/lisp/electric-tests.el (defun): * test/lisp/term-tests.el (term-simple-lines): * test/lisp/time-stamp-tests.el (formatz-mod-del-colons): * test/lisp/wdired-tests.el (wdired-test-bug32173-01) (wdired-test-unfinished-edit-01): * test/src/json-tests.el (json-parse-with-custom-null-and-false-objects): Use `string-replace` instead of `replace-regexp-in-string`.
2021-08-08 16:58:46 +00:00
(string-replace
2008-06-08 15:36:18 +00:00
" " "_" (newsticker--title item))
".html"))))
(with-temp-buffer
(insert (newsticker--desc item))
(write-file filename t))))
(defun newsticker-add-url (url name)
"Add given URL under given NAME to `newsticker-url-list'.
If URL is nil it is searched at point."
(interactive
(list
(read-string "URL: "
(save-excursion
(end-of-line)
(and
(re-search-backward
"http://"
(if (> (point) (+ (point-min) 100))
(- (point) 100)
(point-min))
t)
(re-search-forward
"http://[-a-zA-Z0-9&/_.]*"
(if (< (point) (- (point-max) 200))
(+ (point) 200)
(point-max))
t)
(buffer-substring-no-properties (match-beginning 0)
(match-end 0)))))
(read-string "Name: ")))
(add-to-list 'newsticker-url-list (list name url nil nil nil) t)
(customize-variable 'newsticker-url-list))
(defun newsticker-customize-feed (feed-name)
"Open customization buffer for `newsticker-url-list' and jump to FEED-NAME."
(interactive
(list (completing-read "Name of feed or group to edit: "
(mapcar #'car newsticker-url-list))))
(customize-variable 'newsticker-url-list)
(when (search-forward (concat "Label: " feed-name) nil t)
(forward-line -1)))
2008-06-08 15:36:18 +00:00
(defun newsticker-customize ()
"Open the newsticker customization group."
(interactive)
2009-12-04 19:27:42 +00:00
(delete-other-windows)
2008-06-08 15:36:18 +00:00
(customize-group "newsticker"))
;; ======================================================================
;;; Local stuff
;; ======================================================================
(defun newsticker--get-news-by-funcall (feed-name function)
"Get news for the site FEED-NAME by calling FUNCTION.
See `newsticker-get-news'."
(let ((buffername (concat " *newsticker-funcall-" feed-name "*")))
* textmodes/two-column.el (2C-split): * textmodes/texnfo-upd.el (texinfo-multi-file-included-list): * textmodes/tex-mode.el (tex-set-buffer-directory): * textmodes/spell.el (spell-region, spell-string): * textmodes/reftex.el (reftex-erase-buffer): (reftex-get-file-buffer-force, reftex-kill-temporary-buffers): * textmodes/reftex-toc.el (reftex-toc-promote-action): * textmodes/reftex-sel.el (reftex-get-offset, reftex-insert-docstruct) (reftex-select-item): * textmodes/reftex-ref.el (reftex-label-info-update) (reftex-offer-label-menu): * textmodes/reftex-index.el (reftex-index-change-entry) (reftex-index-phrases-info): * textmodes/reftex-global.el (reftex-create-tags-file) (reftex-save-all-document-buffers, reftex-ensure-write-access): * textmodes/reftex-dcr.el (reftex-echo-ref, reftex-echo-cite) (reftex-view-crossref-from-bibtex): * textmodes/reftex-cite.el (reftex-bibtex-selection-callback) (reftex-extract-bib-entries-from-thebibliography) (reftex-all-used-citation-keys, reftex-create-bibtex-file): * textmodes/refbib.el (r2b-capitalize-title): (r2b-convert-buffer, r2b-help): * textmodes/page-ext.el (pages-directory) (pages-directory-goto-with-mouse): * textmodes/bibtex.el (bibtex-validate-globally): * textmodes/bib-mode.el (bib-capitalize-title): * textmodes/artist.el (artist-clear-buffer, artist-system): * progmodes/xscheme.el (global-set-scheme-interaction-buffer): (local-set-scheme-interaction-buffer, xscheme-process-filter) (verify-xscheme-buffer, xscheme-enter-interaction-mode) (xscheme-enter-debugger-mode, xscheme-debugger-mode-p) (xscheme-send-control-g-interrupt, xscheme-start-process) (xscheme-process-sentinel, xscheme-cd): * progmodes/verilog-mode.el (verilog-read-always-signals) (verilog-set-define, verilog-getopt-file) (verilog-module-inside-filename-p): * progmodes/sh-script.el: * progmodes/python.el (python-pdbtrack-get-source-buffer) (python-pdbtrack-grub-for-buffer, python-execute-file): * progmodes/octave-inf.el (inferior-octave): * progmodes/idlwave.el (idlwave-scan-user-lib-files) (idlwave-shell-compile-helper-routines, idlwave-set-local) (idlwave-display-completion-list-xemacs, idlwave-list-abbrevs) (idlwave-display-completion-list-emacs, idlwave-list-load-path-shadows) (idlwave-completion-fontify-classes, idlwave-display-calling-sequence): * progmodes/idlw-shell.el (idlwave-shell-examine-display-clear) (idlwave-shell-filter, idlwave-shell-examine-highlight) (idlwave-shell-sentinel, idlwave-shell-filter-directory) (idlwave-shell-display-line, idlwave-shell-set-bp-in-module) (idlwave-shell-examine-display, idlwave-shell-run-region) (idlwave-shell-filter-bp, idlwave-shell-save-and-action) (idlwave-shell-sources-filter, idlwave-shell-goto-next-error): * progmodes/idlw-help.el (idlwave-help-get-special-help) (idlwave-help-get-help-buffer): * progmodes/gud.el (gud-basic-call, gud-find-class) (gud-tooltip-activate-mouse-motions-if-enabled): * progmodes/gdb-mi.el (gdb-mouse-toggle-breakpoint-fringe): * progmodes/ebrowse.el (ebrowse-member-table, ebrowse-save-tree-as) (ebrowse-view-exit-fn, ebrowse-tags-list-members-in-file) (ebrowse-tags-next-file): * progmodes/ebnf2ps.el (ebnf-generate-eps, ebnf-generate-eps) (ebnf-eps-production-list, ebnf-begin-file, ebnf-log) (ebnf-eps-finish-and-write): * progmodes/cpp.el (cpp-edit-save): * progmodes/cperl-mode.el (cperl-pod-to-manpage): * progmodes/cc-defs.el (c-emacs-features): * progmodes/antlr-mode.el (antlr-invalidate-context-cache) (antlr-directory-dependencies): * progmodes/ada-xref.el (ada-gnat-parse-gpr, ada-get-ali-file-name) (ada-run-application, ada-find-in-src-path, ada-goto-parent) (ada-find-any-references, ada-make-filename-from-adaname) (ada-make-body-gnatstub): * obsolete/rnews.el (news-list-news-groups): * obsolete/resume.el (resume-suspend-hook,resume-write-buffer-to-file): * obsolete/iso-acc.el (iso-acc-minibuf-setup): * net/rcirc.el (rcirc-debug): * net/newst-treeview.el (newsticker--treeview-list-add-item) (newsticker--treeview-list-clear, newsticker-treeview-browse-url) (newsticker--treeview-list-update-faces, newsticker-treeview-save) (newsticker--treeview-item-show-text, newsticker--treeview-item-show) (newsticker--treeview-tree-update-tag,newsticker--treeview-buffer-init) (newsticker-treeview-show-item, newsticker--treeview-unfold-node) (newsticker--treeview-list-clear-highlight) (newsticker--treeview-list-update-highlight) (newsticker--treeview-list-highlight-start) (newsticker--treeview-tree-update-highlight) (newsticker--treeview-get-selected-item) (newsticker-treeview-mark-list-items-old) (newsticker--treeview-set-current-node): * net/newst-plainview.el (newsticker--buffer-set-uptodate): * net/newst-backend.el (newsticker--get-news-by-funcall) (newsticker--get-news-by-wget, newsticker--image-get) (newsticker--image-sentinel): * net/mairix.el (mairix-rmail-fetch-field, mairix-gnus-fetch-field): * net/eudcb-ph.el (eudc-ph-do-request, eudc-ph-open-session): (eudc-ph-close-session): * net/eudc.el (eudc-save-options): * language/thai-word.el (thai-update-word-table): * language/japan-util.el (japanese-string-conversion): * international/titdic-cnv.el (tsang-quick-converter) (ziranma-converter, ctlau-converter): * international/mule-cmds.el (describe-language-environment): * international/ja-dic-cnv.el (skkdic-convert-okuri-ari) (skkdic-convert-postfix, skkdic-convert-prefix): (skkdic-convert-okuri-nasi, skkdic-convert): * emacs-lisp/re-builder.el (reb-update-overlays): * emacs-lisp/pp.el (pp-to-string, pp-display-expression): * emacs-lisp/gulp.el (gulp-send-requests): * emacs-lisp/find-gc.el (trace-call-tree): * emacs-lisp/eieio-opt.el (eieio-browse, eieio-describe-class) (eieio-describe-generic): * emacs-lisp/eieio-base.el (eieio-persistent-read): * emacs-lisp/edebug.el (edebug-outside-excursion): * emacs-lisp/debug.el (debugger-make-xrefs): * emacs-lisp/cust-print.el (custom-prin1-to-string): * emacs-lisp/chart.el (chart-new-buffer): * emacs-lisp/authors.el (authors-scan-el, authors-scan-change-log): Use with-current-buffer. * textmodes/artist.el (artist-system): Don't call copy-sequence on a fresh string. * progmodes/idlw-shell.el (easymenu setup): Use dolist.
2009-10-31 02:38:34 +00:00
(with-current-buffer (get-buffer-create buffername)
2008-06-08 15:36:18 +00:00
(erase-buffer)
(newsticker--insert-bytes (funcall function feed-name))
2008-06-08 15:36:18 +00:00
(newsticker--sentinel-work nil t feed-name function
(current-buffer)))))
(defun newsticker--get-news-by-url (feed-name url)
"Get news for the site FEED-NAME from address URL using `url-retrieve'.
See `newsticker-get-news'."
(let ((coding-system-for-read 'no-conversion))
(condition-case error-data
2008-11-24 19:40:35 +00:00
(url-retrieve url 'newsticker--get-news-by-url-callback
(list feed-name))
(error (message "Error retrieving news from %s: %s" feed-name
error-data))))
2008-06-08 15:36:18 +00:00
(force-mode-line-update))
(defun newsticker--get-news-by-url-callback (status feed-name)
"Callback function for `newsticker--get-news-by-url'.
STATUS is the return status as delivered by `url-retrieve', and
FEED-NAME is the name of the feed that the news were retrieved
from."
(let ((buf (get-buffer-create (concat " *newsticker-url-" feed-name "*")))
(result (buffer-string)))
2008-06-08 15:36:18 +00:00
(set-buffer buf)
(erase-buffer)
(newsticker--insert-bytes result)
2008-06-08 15:36:18 +00:00
;; remove MIME header
(goto-char (point-min))
(search-forward "\n\n" nil t)
2008-06-08 15:36:18 +00:00
(delete-region (point-min) (point))
;; read the rss/atom contents
(newsticker--sentinel-work nil
(or (not status)
(not (eq (car status) :error)))
feed-name "url-retrieve"
(current-buffer))
2008-06-08 15:36:18 +00:00
(when status
(let ((status-type (car status))
(status-details (cdr status)))
(cond ((eq status-type :redirect)
;; don't care about redirects
)
((eq status-type :error)
(message "%s: Error while retrieving news from %s: %s: \"%s\""
Simplify use of current-time and friends. * doc/misc/org.texi (Dynamic blocks): * lisp/allout-widgets.el (allout-widgets-hook-error-handler): * lisp/calendar/appt.el (appt-display-message): * lisp/calendar/icalendar.el (icalendar--convert-float-to-ical): * lisp/calendar/timeclock.el (timeclock-in, timeclock-when-to-leave) (timeclock-last-period, timeclock-day-base): * lisp/eshell/em-ls.el (eshell-ls-file): * lisp/eshell/esh-util.el (eshell-parse-ange-ls): * lisp/generic-x.el (named-database-print-serial): * lisp/net/newst-backend.el (newsticker--get-news-by-url-callback) (newsticker-get-news, newsticker--sentinel-work) (newsticker--image-get, newsticker--image-sentinel): * lisp/net/tramp-sh.el (tramp-get-remote-touch): * lisp/progmodes/opascal.el (opascal-debug-log): * lisp/textmodes/remember.el (remember-mail-date) (remember-store-in-files): * lisp/vc/vc-annotate.el (vc-annotate-display-autoscale) (vc-default-annotate-current-time): * lisp/vc/vc-bzr.el (vc-bzr-shelve-snapshot): * lisp/vc/vc-cvs.el (vc-cvs-annotate-current-time): * lisp/vc/vc-rcs.el (vc-rcs-annotate-current-time): * lisp/url/url-util.el (url-get-normalized-date): * lisp/erc/erc-backend.el (TOPIC): * lisp/gnus/gnus-delay.el (gnus-delay-article): * lisp/gnus/gnus-sum.el (gnus-summary-read-document): * lisp/gnus/gnus-util.el (gnus-seconds-today, gnus-seconds-month): * lisp/gnus/message.el (message-make-expires-date): * lisp/org/org-archive.el (org-archive-subtree) (org-archive-to-archive-sibling): * lisp/org/org-clock.el (org-resolve-clocks, org-clock-get-sum-start) (org-clock-special-range): * lisp/org/org-timer.el (org-timer-seconds): * lisp/org/org.el (org-read-date-analyze, org-get-cursor-date): * lisp/org/ox-html.el (org-html-format-spec): * lisp/org/ox-icalendar.el (org-icalendar--vtodo): Omit unnecessary call to current-time. * lisp/calendar/time-date.el (time-to-seconds) [!float-time]: * lisp/calendar/timeclock.el (timeclock-time-to-date): * lisp/vc/vc-annotate.el (vc-annotate-convert-time): Use current time if arg is nil, to be compatible with float-time. (time-date--day-in-year): New function, with most of the guts of the old time-to-day-in-year. (time-to-day-in-year): Use it. (time-to-days): Use it, to avoid decoding the same time stamp twice. * lisp/calendar/timeclock.el (timeclock-update-mode-line): * lisp/cedet/srecode/args.el (srecode-semantic-handle-:time): * lisp/gnus/gnus-util.el (gnus-seconds-year): * lisp/org/org.el (org-get-cursor-date): Don't call current-time twice to get the current time stamp, as this can lead to inconsistent results. * lisp/completion.el (cmpl-hours-since-origin): * lisp/erc/erc.el (erc-emacs-time-to-erc-time): * lisp/ido.el (ido-time-stamp): * lisp/vc/vc-annotate.el (vc-annotate-convert-time): Simplify by using float-time. * lisp/completion.el (save-completions-to-file): * lisp/url/url-cache.el (url-cache-prune-cache): Rename local var to avoid confusion. * lisp/gnus/gnus-util.el (gnus-float-time): * lisp/net/rcirc.el (rcirc-float-time): * lisp/org/org-compat.el (org-float-time): Simplify to an alias because time-to-seconds now behaves like float-time with respect to nil arg. * lisp/subr.el (progress-reporter-do-update): Don't call float-time unless needed. * lisp/erc/erc.el (erc-current-time): Simplify by using erc-emacs-time-to-erc-time. * lisp/org/org-clock.el (org-clock-get-table-data): Omit unnecessary, lossy conversion from floating point to Emacs time and back. (org-resolve-clocks): Prefer two-argument floor.
2014-10-29 01:42:51 +00:00
(format-time-string "%A, %H:%M")
2008-06-08 15:36:18 +00:00
feed-name
(car status-details) (cdr status-details))))))))
(defun newsticker--get-news-by-wget (feed-name url wget-arguments)
"Get news for the site FEED-NAME from address URL using wget.
WGET-ARGUMENTS is a list of arguments for wget.
See `newsticker-get-news'."
(let ((buffername (concat " *newsticker-wget-" feed-name "*")))
* textmodes/two-column.el (2C-split): * textmodes/texnfo-upd.el (texinfo-multi-file-included-list): * textmodes/tex-mode.el (tex-set-buffer-directory): * textmodes/spell.el (spell-region, spell-string): * textmodes/reftex.el (reftex-erase-buffer): (reftex-get-file-buffer-force, reftex-kill-temporary-buffers): * textmodes/reftex-toc.el (reftex-toc-promote-action): * textmodes/reftex-sel.el (reftex-get-offset, reftex-insert-docstruct) (reftex-select-item): * textmodes/reftex-ref.el (reftex-label-info-update) (reftex-offer-label-menu): * textmodes/reftex-index.el (reftex-index-change-entry) (reftex-index-phrases-info): * textmodes/reftex-global.el (reftex-create-tags-file) (reftex-save-all-document-buffers, reftex-ensure-write-access): * textmodes/reftex-dcr.el (reftex-echo-ref, reftex-echo-cite) (reftex-view-crossref-from-bibtex): * textmodes/reftex-cite.el (reftex-bibtex-selection-callback) (reftex-extract-bib-entries-from-thebibliography) (reftex-all-used-citation-keys, reftex-create-bibtex-file): * textmodes/refbib.el (r2b-capitalize-title): (r2b-convert-buffer, r2b-help): * textmodes/page-ext.el (pages-directory) (pages-directory-goto-with-mouse): * textmodes/bibtex.el (bibtex-validate-globally): * textmodes/bib-mode.el (bib-capitalize-title): * textmodes/artist.el (artist-clear-buffer, artist-system): * progmodes/xscheme.el (global-set-scheme-interaction-buffer): (local-set-scheme-interaction-buffer, xscheme-process-filter) (verify-xscheme-buffer, xscheme-enter-interaction-mode) (xscheme-enter-debugger-mode, xscheme-debugger-mode-p) (xscheme-send-control-g-interrupt, xscheme-start-process) (xscheme-process-sentinel, xscheme-cd): * progmodes/verilog-mode.el (verilog-read-always-signals) (verilog-set-define, verilog-getopt-file) (verilog-module-inside-filename-p): * progmodes/sh-script.el: * progmodes/python.el (python-pdbtrack-get-source-buffer) (python-pdbtrack-grub-for-buffer, python-execute-file): * progmodes/octave-inf.el (inferior-octave): * progmodes/idlwave.el (idlwave-scan-user-lib-files) (idlwave-shell-compile-helper-routines, idlwave-set-local) (idlwave-display-completion-list-xemacs, idlwave-list-abbrevs) (idlwave-display-completion-list-emacs, idlwave-list-load-path-shadows) (idlwave-completion-fontify-classes, idlwave-display-calling-sequence): * progmodes/idlw-shell.el (idlwave-shell-examine-display-clear) (idlwave-shell-filter, idlwave-shell-examine-highlight) (idlwave-shell-sentinel, idlwave-shell-filter-directory) (idlwave-shell-display-line, idlwave-shell-set-bp-in-module) (idlwave-shell-examine-display, idlwave-shell-run-region) (idlwave-shell-filter-bp, idlwave-shell-save-and-action) (idlwave-shell-sources-filter, idlwave-shell-goto-next-error): * progmodes/idlw-help.el (idlwave-help-get-special-help) (idlwave-help-get-help-buffer): * progmodes/gud.el (gud-basic-call, gud-find-class) (gud-tooltip-activate-mouse-motions-if-enabled): * progmodes/gdb-mi.el (gdb-mouse-toggle-breakpoint-fringe): * progmodes/ebrowse.el (ebrowse-member-table, ebrowse-save-tree-as) (ebrowse-view-exit-fn, ebrowse-tags-list-members-in-file) (ebrowse-tags-next-file): * progmodes/ebnf2ps.el (ebnf-generate-eps, ebnf-generate-eps) (ebnf-eps-production-list, ebnf-begin-file, ebnf-log) (ebnf-eps-finish-and-write): * progmodes/cpp.el (cpp-edit-save): * progmodes/cperl-mode.el (cperl-pod-to-manpage): * progmodes/cc-defs.el (c-emacs-features): * progmodes/antlr-mode.el (antlr-invalidate-context-cache) (antlr-directory-dependencies): * progmodes/ada-xref.el (ada-gnat-parse-gpr, ada-get-ali-file-name) (ada-run-application, ada-find-in-src-path, ada-goto-parent) (ada-find-any-references, ada-make-filename-from-adaname) (ada-make-body-gnatstub): * obsolete/rnews.el (news-list-news-groups): * obsolete/resume.el (resume-suspend-hook,resume-write-buffer-to-file): * obsolete/iso-acc.el (iso-acc-minibuf-setup): * net/rcirc.el (rcirc-debug): * net/newst-treeview.el (newsticker--treeview-list-add-item) (newsticker--treeview-list-clear, newsticker-treeview-browse-url) (newsticker--treeview-list-update-faces, newsticker-treeview-save) (newsticker--treeview-item-show-text, newsticker--treeview-item-show) (newsticker--treeview-tree-update-tag,newsticker--treeview-buffer-init) (newsticker-treeview-show-item, newsticker--treeview-unfold-node) (newsticker--treeview-list-clear-highlight) (newsticker--treeview-list-update-highlight) (newsticker--treeview-list-highlight-start) (newsticker--treeview-tree-update-highlight) (newsticker--treeview-get-selected-item) (newsticker-treeview-mark-list-items-old) (newsticker--treeview-set-current-node): * net/newst-plainview.el (newsticker--buffer-set-uptodate): * net/newst-backend.el (newsticker--get-news-by-funcall) (newsticker--get-news-by-wget, newsticker--image-get) (newsticker--image-sentinel): * net/mairix.el (mairix-rmail-fetch-field, mairix-gnus-fetch-field): * net/eudcb-ph.el (eudc-ph-do-request, eudc-ph-open-session): (eudc-ph-close-session): * net/eudc.el (eudc-save-options): * language/thai-word.el (thai-update-word-table): * language/japan-util.el (japanese-string-conversion): * international/titdic-cnv.el (tsang-quick-converter) (ziranma-converter, ctlau-converter): * international/mule-cmds.el (describe-language-environment): * international/ja-dic-cnv.el (skkdic-convert-okuri-ari) (skkdic-convert-postfix, skkdic-convert-prefix): (skkdic-convert-okuri-nasi, skkdic-convert): * emacs-lisp/re-builder.el (reb-update-overlays): * emacs-lisp/pp.el (pp-to-string, pp-display-expression): * emacs-lisp/gulp.el (gulp-send-requests): * emacs-lisp/find-gc.el (trace-call-tree): * emacs-lisp/eieio-opt.el (eieio-browse, eieio-describe-class) (eieio-describe-generic): * emacs-lisp/eieio-base.el (eieio-persistent-read): * emacs-lisp/edebug.el (edebug-outside-excursion): * emacs-lisp/debug.el (debugger-make-xrefs): * emacs-lisp/cust-print.el (custom-prin1-to-string): * emacs-lisp/chart.el (chart-new-buffer): * emacs-lisp/authors.el (authors-scan-el, authors-scan-change-log): Use with-current-buffer. * textmodes/artist.el (artist-system): Don't call copy-sequence on a fresh string. * progmodes/idlw-shell.el (easymenu setup): Use dolist.
2009-10-31 02:38:34 +00:00
(with-current-buffer (get-buffer-create buffername)
2008-06-08 15:36:18 +00:00
(erase-buffer)
;; throw an error if there is an old wget-process around
(if (get-process feed-name)
(error "Another wget-process is running for %s" feed-name))
;; start wget
(let* ((args (append wget-arguments (list url)))
* lisp/net/*.el: Use lexical-binding Also remove some redundant `:group` arguments. * lisp/net/eudc-export.el: Use lexical-binding. (eudc-create-bbdb-record): Use `cl-progv` and `apply` to avoid `eval`. * lisp/net/eudc-hotlist.el: Use lexical-binding. * lisp/net/eudc.el (eudc-print-attribute-value): Use `funcall` to avoid `eval`. * lisp/net/eudcb-bbdb.el: Use lexical-binding. (eudc-bbdb-filter-non-matching-record): Use `funcall` to avoid `eval`. Move `bbdb-val` binding to avoid `setq`. Use `seq-some` instead of `eval+or`. (eudc-bbdb-format-record-as-result): Use `dolist` and `pcase`. Use `funcall` to avoid `eval`. (eudc-bbdb-query-internal): Simplify a bit. * lisp/net/eudcb-ldap.el: Use lexical-binding. (eudc-ldap-get-host-parameter): Use `defalias` to avoid `eval-and-compile`. * lisp/net/telnet.el: Use lexical-binding. * lisp/net/quickurl.el: Use lexical-binding. * lisp/net/newst-ticker.el: Use lexical-binding. * lisp/net/newst-reader.el: Use lexical-binding. * lisp/net/goto-addr.el: Use lexical-binding. * lisp/net/gnutls.el: Use lexical-binding. * lisp/net/eudcb-macos-contacts.el: Use lexical-binding. * lisp/net/eudcb-mab.el: Use lexical-binding. * lisp/net/net-utils.el: Use lexical-binding. (finger): Remove unused var `found`. * lisp/net/network-stream.el (open-protocol-stream): Remove redundant `defalias`. * lisp/net/newst-plainview.el: Use lexical-binding. (newsticker-hide-entry, newsticker-show-entry): Remove unused var `is-invisible`. (w3m-fill-column, w3-maximum-line-length): Declare vars. * lisp/net/tramp.el (tramp-compute-multi-hops): * lisp/net/tramp-compat.el (tramp-compat-temporary-file-directory): * lisp/net/tramp-cmds.el (tramp-default-rename-file): * lisp/net/webjump.el (webjump): Don't forget lexical-binding for `eval`.
2021-03-08 15:11:22 +00:00
(proc (apply #'start-process feed-name buffername
2008-06-08 15:36:18 +00:00
newsticker-wget-name args)))
(set-process-coding-system proc 'no-conversion 'no-conversion)
* lisp/net/*.el: Use lexical-binding Also remove some redundant `:group` arguments. * lisp/net/eudc-export.el: Use lexical-binding. (eudc-create-bbdb-record): Use `cl-progv` and `apply` to avoid `eval`. * lisp/net/eudc-hotlist.el: Use lexical-binding. * lisp/net/eudc.el (eudc-print-attribute-value): Use `funcall` to avoid `eval`. * lisp/net/eudcb-bbdb.el: Use lexical-binding. (eudc-bbdb-filter-non-matching-record): Use `funcall` to avoid `eval`. Move `bbdb-val` binding to avoid `setq`. Use `seq-some` instead of `eval+or`. (eudc-bbdb-format-record-as-result): Use `dolist` and `pcase`. Use `funcall` to avoid `eval`. (eudc-bbdb-query-internal): Simplify a bit. * lisp/net/eudcb-ldap.el: Use lexical-binding. (eudc-ldap-get-host-parameter): Use `defalias` to avoid `eval-and-compile`. * lisp/net/telnet.el: Use lexical-binding. * lisp/net/quickurl.el: Use lexical-binding. * lisp/net/newst-ticker.el: Use lexical-binding. * lisp/net/newst-reader.el: Use lexical-binding. * lisp/net/goto-addr.el: Use lexical-binding. * lisp/net/gnutls.el: Use lexical-binding. * lisp/net/eudcb-macos-contacts.el: Use lexical-binding. * lisp/net/eudcb-mab.el: Use lexical-binding. * lisp/net/net-utils.el: Use lexical-binding. (finger): Remove unused var `found`. * lisp/net/network-stream.el (open-protocol-stream): Remove redundant `defalias`. * lisp/net/newst-plainview.el: Use lexical-binding. (newsticker-hide-entry, newsticker-show-entry): Remove unused var `is-invisible`. (w3m-fill-column, w3-maximum-line-length): Declare vars. * lisp/net/tramp.el (tramp-compute-multi-hops): * lisp/net/tramp-compat.el (tramp-compat-temporary-file-directory): * lisp/net/tramp-cmds.el (tramp-default-rename-file): * lisp/net/webjump.el (webjump): Don't forget lexical-binding for `eval`.
2021-03-08 15:11:22 +00:00
(set-process-sentinel proc #'newsticker--sentinel)
Newsticker: Show feedicons in treeview. Small fix in opml export. * etc/images/newsticker/README: Add rss-feed.png, rss-feed.svg. * etc/images/newsticker/rss-feed.png: New. * etc/images/newsticker/rss-feed.svg: New. * lisp/net/newst-backend.el: Require url-parse. (newsticker--get-news-by-wget): Store feed name as process property. (newsticker--sentinel): Read feed name from process property. (newsticker--sentinel-work): Rename argument name to feed-name. Rename variable imageurl to image-url. Pick icon url from Atom 1.0 data. Launch download of feed icon. (newsticker--get-icon-url-atom-1.0): New. (newsticker--unxml) (newsticker--unxml-node) (newsticker--unxml-attribute): Documentation. (newsticker--icons-dir): New. (newsticker--image-get): New arguments FILENAME and DIRECTORY. Use `url-retrieve' if `newsticker-retrieval-method' is 'intern. (newsticker--image-download-by-wget): New. Use process properties for storing informations. (newsticker--image-sentinel): Read informations from process properties. (newsticker--image-save) (newsticker--image-remove) (newsticker--image-download-by-url) (newsticker--image-download-by-url-callback): New. (newsticker-opml-export): Handle url list entries containing a function instead of an url string. * lisp/net/newst-reader.el (newsticker-html-renderer): Whitespace. (newsticker--print-extra-elements) (newsticker--do-print-extra-element): Documentation (newsticker--image-read): Optionally limit image height. Use imagemagick if possible. (newsticker--icon-read): New. * lisp/net/newst-treeview.el (newsticker--treeview-item-show): Limit height of feed logo. (newsticker--treeview-tree-expand): Use feed icons in treeview. (newsticker--tree-widget-icon-create): New. Set the tree widget icon. (newsticker--tree-widget-leaf-icon): Use feed icon.
2014-10-19 16:50:15 +00:00
(process-put proc 'nt-feed-name feed-name)
2008-06-08 15:36:18 +00:00
(setq newsticker--process-ids (cons (process-id proc)
newsticker--process-ids))
(force-mode-line-update)))))
(defun newsticker-get-news (feed-name)
"Get news from the site FEED-NAME and load feed logo.
FEED-NAME must be a string which occurs as the label (i.e. the first element)
in an element of `newsticker-url-list' or `newsticker-url-list-defaults'."
(newsticker--debug-msg "%s: Getting news for %s"
Simplify use of current-time and friends. * doc/misc/org.texi (Dynamic blocks): * lisp/allout-widgets.el (allout-widgets-hook-error-handler): * lisp/calendar/appt.el (appt-display-message): * lisp/calendar/icalendar.el (icalendar--convert-float-to-ical): * lisp/calendar/timeclock.el (timeclock-in, timeclock-when-to-leave) (timeclock-last-period, timeclock-day-base): * lisp/eshell/em-ls.el (eshell-ls-file): * lisp/eshell/esh-util.el (eshell-parse-ange-ls): * lisp/generic-x.el (named-database-print-serial): * lisp/net/newst-backend.el (newsticker--get-news-by-url-callback) (newsticker-get-news, newsticker--sentinel-work) (newsticker--image-get, newsticker--image-sentinel): * lisp/net/tramp-sh.el (tramp-get-remote-touch): * lisp/progmodes/opascal.el (opascal-debug-log): * lisp/textmodes/remember.el (remember-mail-date) (remember-store-in-files): * lisp/vc/vc-annotate.el (vc-annotate-display-autoscale) (vc-default-annotate-current-time): * lisp/vc/vc-bzr.el (vc-bzr-shelve-snapshot): * lisp/vc/vc-cvs.el (vc-cvs-annotate-current-time): * lisp/vc/vc-rcs.el (vc-rcs-annotate-current-time): * lisp/url/url-util.el (url-get-normalized-date): * lisp/erc/erc-backend.el (TOPIC): * lisp/gnus/gnus-delay.el (gnus-delay-article): * lisp/gnus/gnus-sum.el (gnus-summary-read-document): * lisp/gnus/gnus-util.el (gnus-seconds-today, gnus-seconds-month): * lisp/gnus/message.el (message-make-expires-date): * lisp/org/org-archive.el (org-archive-subtree) (org-archive-to-archive-sibling): * lisp/org/org-clock.el (org-resolve-clocks, org-clock-get-sum-start) (org-clock-special-range): * lisp/org/org-timer.el (org-timer-seconds): * lisp/org/org.el (org-read-date-analyze, org-get-cursor-date): * lisp/org/ox-html.el (org-html-format-spec): * lisp/org/ox-icalendar.el (org-icalendar--vtodo): Omit unnecessary call to current-time. * lisp/calendar/time-date.el (time-to-seconds) [!float-time]: * lisp/calendar/timeclock.el (timeclock-time-to-date): * lisp/vc/vc-annotate.el (vc-annotate-convert-time): Use current time if arg is nil, to be compatible with float-time. (time-date--day-in-year): New function, with most of the guts of the old time-to-day-in-year. (time-to-day-in-year): Use it. (time-to-days): Use it, to avoid decoding the same time stamp twice. * lisp/calendar/timeclock.el (timeclock-update-mode-line): * lisp/cedet/srecode/args.el (srecode-semantic-handle-:time): * lisp/gnus/gnus-util.el (gnus-seconds-year): * lisp/org/org.el (org-get-cursor-date): Don't call current-time twice to get the current time stamp, as this can lead to inconsistent results. * lisp/completion.el (cmpl-hours-since-origin): * lisp/erc/erc.el (erc-emacs-time-to-erc-time): * lisp/ido.el (ido-time-stamp): * lisp/vc/vc-annotate.el (vc-annotate-convert-time): Simplify by using float-time. * lisp/completion.el (save-completions-to-file): * lisp/url/url-cache.el (url-cache-prune-cache): Rename local var to avoid confusion. * lisp/gnus/gnus-util.el (gnus-float-time): * lisp/net/rcirc.el (rcirc-float-time): * lisp/org/org-compat.el (org-float-time): Simplify to an alias because time-to-seconds now behaves like float-time with respect to nil arg. * lisp/subr.el (progress-reporter-do-update): Don't call float-time unless needed. * lisp/erc/erc.el (erc-current-time): Simplify by using erc-emacs-time-to-erc-time. * lisp/org/org-clock.el (org-clock-get-table-data): Omit unnecessary, lossy conversion from floating point to Emacs time and back. (org-resolve-clocks): Prefer two-argument floor.
2014-10-29 01:42:51 +00:00
(format-time-string "%A, %H:%M")
2008-06-08 15:36:18 +00:00
feed-name)
(let* ((item (or (assoc feed-name newsticker-url-list)
(assoc feed-name newsticker-url-list-defaults)
(error
"Cannot get news for %s: Check newsticker-url-list"
feed-name)))
(url (cadr item))
(wget-arguments (or (car (cdr (cdr (cdr (cdr item)))))
newsticker-wget-arguments)))
(if (functionp url)
(newsticker--get-news-by-funcall feed-name url)
(if (eq newsticker-retrieval-method 'intern)
(newsticker--get-news-by-url feed-name url)
(newsticker--get-news-by-wget feed-name url wget-arguments)))))
;; ======================================================================
;; Parsing
;; ======================================================================
(defun newsticker--sentinel (process event)
"Sentinel for extracting news titles from an RDF buffer.
Argument PROCESS is the process which has just changed its state.
Argument EVENT tells what has happened to the process."
(let ((p-status (process-status process))
(exit-status (process-exit-status process))
Newsticker: Show feedicons in treeview. Small fix in opml export. * etc/images/newsticker/README: Add rss-feed.png, rss-feed.svg. * etc/images/newsticker/rss-feed.png: New. * etc/images/newsticker/rss-feed.svg: New. * lisp/net/newst-backend.el: Require url-parse. (newsticker--get-news-by-wget): Store feed name as process property. (newsticker--sentinel): Read feed name from process property. (newsticker--sentinel-work): Rename argument name to feed-name. Rename variable imageurl to image-url. Pick icon url from Atom 1.0 data. Launch download of feed icon. (newsticker--get-icon-url-atom-1.0): New. (newsticker--unxml) (newsticker--unxml-node) (newsticker--unxml-attribute): Documentation. (newsticker--icons-dir): New. (newsticker--image-get): New arguments FILENAME and DIRECTORY. Use `url-retrieve' if `newsticker-retrieval-method' is 'intern. (newsticker--image-download-by-wget): New. Use process properties for storing informations. (newsticker--image-sentinel): Read informations from process properties. (newsticker--image-save) (newsticker--image-remove) (newsticker--image-download-by-url) (newsticker--image-download-by-url-callback): New. (newsticker-opml-export): Handle url list entries containing a function instead of an url string. * lisp/net/newst-reader.el (newsticker-html-renderer): Whitespace. (newsticker--print-extra-elements) (newsticker--do-print-extra-element): Documentation (newsticker--image-read): Optionally limit image height. Use imagemagick if possible. (newsticker--icon-read): New. * lisp/net/newst-treeview.el (newsticker--treeview-item-show): Limit height of feed logo. (newsticker--treeview-tree-expand): Use feed icons in treeview. (newsticker--tree-widget-icon-create): New. Set the tree widget icon. (newsticker--tree-widget-leaf-icon): Use feed icon.
2014-10-19 16:50:15 +00:00
(feed-name (process-get process 'nt-feed-name))
2008-06-08 15:36:18 +00:00
(command (process-command process))
(buffer (process-buffer process)))
(newsticker--sentinel-work event
(and (eq p-status 'exit)
(= exit-status 0))
Newsticker: Show feedicons in treeview. Small fix in opml export. * etc/images/newsticker/README: Add rss-feed.png, rss-feed.svg. * etc/images/newsticker/rss-feed.png: New. * etc/images/newsticker/rss-feed.svg: New. * lisp/net/newst-backend.el: Require url-parse. (newsticker--get-news-by-wget): Store feed name as process property. (newsticker--sentinel): Read feed name from process property. (newsticker--sentinel-work): Rename argument name to feed-name. Rename variable imageurl to image-url. Pick icon url from Atom 1.0 data. Launch download of feed icon. (newsticker--get-icon-url-atom-1.0): New. (newsticker--unxml) (newsticker--unxml-node) (newsticker--unxml-attribute): Documentation. (newsticker--icons-dir): New. (newsticker--image-get): New arguments FILENAME and DIRECTORY. Use `url-retrieve' if `newsticker-retrieval-method' is 'intern. (newsticker--image-download-by-wget): New. Use process properties for storing informations. (newsticker--image-sentinel): Read informations from process properties. (newsticker--image-save) (newsticker--image-remove) (newsticker--image-download-by-url) (newsticker--image-download-by-url-callback): New. (newsticker-opml-export): Handle url list entries containing a function instead of an url string. * lisp/net/newst-reader.el (newsticker-html-renderer): Whitespace. (newsticker--print-extra-elements) (newsticker--do-print-extra-element): Documentation (newsticker--image-read): Optionally limit image height. Use imagemagick if possible. (newsticker--icon-read): New. * lisp/net/newst-treeview.el (newsticker--treeview-item-show): Limit height of feed logo. (newsticker--treeview-tree-expand): Use feed icons in treeview. (newsticker--tree-widget-icon-create): New. Set the tree widget icon. (newsticker--tree-widget-leaf-icon): Use feed icon.
2014-10-19 16:50:15 +00:00
feed-name command buffer)))
2008-06-08 15:36:18 +00:00
Newsticker: Show feedicons in treeview. Small fix in opml export. * etc/images/newsticker/README: Add rss-feed.png, rss-feed.svg. * etc/images/newsticker/rss-feed.png: New. * etc/images/newsticker/rss-feed.svg: New. * lisp/net/newst-backend.el: Require url-parse. (newsticker--get-news-by-wget): Store feed name as process property. (newsticker--sentinel): Read feed name from process property. (newsticker--sentinel-work): Rename argument name to feed-name. Rename variable imageurl to image-url. Pick icon url from Atom 1.0 data. Launch download of feed icon. (newsticker--get-icon-url-atom-1.0): New. (newsticker--unxml) (newsticker--unxml-node) (newsticker--unxml-attribute): Documentation. (newsticker--icons-dir): New. (newsticker--image-get): New arguments FILENAME and DIRECTORY. Use `url-retrieve' if `newsticker-retrieval-method' is 'intern. (newsticker--image-download-by-wget): New. Use process properties for storing informations. (newsticker--image-sentinel): Read informations from process properties. (newsticker--image-save) (newsticker--image-remove) (newsticker--image-download-by-url) (newsticker--image-download-by-url-callback): New. (newsticker-opml-export): Handle url list entries containing a function instead of an url string. * lisp/net/newst-reader.el (newsticker-html-renderer): Whitespace. (newsticker--print-extra-elements) (newsticker--do-print-extra-element): Documentation (newsticker--image-read): Optionally limit image height. Use imagemagick if possible. (newsticker--icon-read): New. * lisp/net/newst-treeview.el (newsticker--treeview-item-show): Limit height of feed logo. (newsticker--treeview-tree-expand): Use feed icons in treeview. (newsticker--tree-widget-icon-create): New. Set the tree widget icon. (newsticker--tree-widget-leaf-icon): Use feed icon.
2014-10-19 16:50:15 +00:00
(defun newsticker--sentinel-work (event status-ok feed-name command buffer)
2008-06-08 15:36:18 +00:00
"Actually do the sentinel work.
Argument EVENT tells what has happened to the retrieval process.
Argument STATUS-OK is the final status of the retrieval process,
non-nil meaning retrieval was successful.
Newsticker: Show feedicons in treeview. Small fix in opml export. * etc/images/newsticker/README: Add rss-feed.png, rss-feed.svg. * etc/images/newsticker/rss-feed.png: New. * etc/images/newsticker/rss-feed.svg: New. * lisp/net/newst-backend.el: Require url-parse. (newsticker--get-news-by-wget): Store feed name as process property. (newsticker--sentinel): Read feed name from process property. (newsticker--sentinel-work): Rename argument name to feed-name. Rename variable imageurl to image-url. Pick icon url from Atom 1.0 data. Launch download of feed icon. (newsticker--get-icon-url-atom-1.0): New. (newsticker--unxml) (newsticker--unxml-node) (newsticker--unxml-attribute): Documentation. (newsticker--icons-dir): New. (newsticker--image-get): New arguments FILENAME and DIRECTORY. Use `url-retrieve' if `newsticker-retrieval-method' is 'intern. (newsticker--image-download-by-wget): New. Use process properties for storing informations. (newsticker--image-sentinel): Read informations from process properties. (newsticker--image-save) (newsticker--image-remove) (newsticker--image-download-by-url) (newsticker--image-download-by-url-callback): New. (newsticker-opml-export): Handle url list entries containing a function instead of an url string. * lisp/net/newst-reader.el (newsticker-html-renderer): Whitespace. (newsticker--print-extra-elements) (newsticker--do-print-extra-element): Documentation (newsticker--image-read): Optionally limit image height. Use imagemagick if possible. (newsticker--icon-read): New. * lisp/net/newst-treeview.el (newsticker--treeview-item-show): Limit height of feed logo. (newsticker--treeview-tree-expand): Use feed icons in treeview. (newsticker--tree-widget-icon-create): New. Set the tree widget icon. (newsticker--tree-widget-leaf-icon): Use feed icon.
2014-10-19 16:50:15 +00:00
Argument FEED-NAME is the name of the retrieved feed.
2008-06-08 15:36:18 +00:00
Argument COMMAND is the command of the retrieval process.
Argument BUFFER is the buffer of the retrieval process."
(let ((time (current-time))
Newsticker: Show feedicons in treeview. Small fix in opml export. * etc/images/newsticker/README: Add rss-feed.png, rss-feed.svg. * etc/images/newsticker/rss-feed.png: New. * etc/images/newsticker/rss-feed.svg: New. * lisp/net/newst-backend.el: Require url-parse. (newsticker--get-news-by-wget): Store feed name as process property. (newsticker--sentinel): Read feed name from process property. (newsticker--sentinel-work): Rename argument name to feed-name. Rename variable imageurl to image-url. Pick icon url from Atom 1.0 data. Launch download of feed icon. (newsticker--get-icon-url-atom-1.0): New. (newsticker--unxml) (newsticker--unxml-node) (newsticker--unxml-attribute): Documentation. (newsticker--icons-dir): New. (newsticker--image-get): New arguments FILENAME and DIRECTORY. Use `url-retrieve' if `newsticker-retrieval-method' is 'intern. (newsticker--image-download-by-wget): New. Use process properties for storing informations. (newsticker--image-sentinel): Read informations from process properties. (newsticker--image-save) (newsticker--image-remove) (newsticker--image-download-by-url) (newsticker--image-download-by-url-callback): New. (newsticker-opml-export): Handle url list entries containing a function instead of an url string. * lisp/net/newst-reader.el (newsticker-html-renderer): Whitespace. (newsticker--print-extra-elements) (newsticker--do-print-extra-element): Documentation (newsticker--image-read): Optionally limit image height. Use imagemagick if possible. (newsticker--icon-read): New. * lisp/net/newst-treeview.el (newsticker--treeview-item-show): Limit height of feed logo. (newsticker--treeview-tree-expand): Use feed icons in treeview. (newsticker--tree-widget-icon-create): New. Set the tree widget icon. (newsticker--tree-widget-leaf-icon): Use feed icon.
2014-10-19 16:50:15 +00:00
(name-symbol (intern feed-name))
(something-was-added nil)
(ct (current-time)))
2008-06-08 15:36:18 +00:00
;; catch known errors (zombie processes, rubbish-xml etc.
;; if an error occurs the news feed is not updated!
(catch 'oops
(unless status-ok
(setq newsticker--cache
(newsticker--cache-add
newsticker--cache
name-symbol
newsticker--error-headline
More-conservative ‘format’ quote restyling Instead of restyling curved quotes for every call to ‘format’, create a new function ‘format-message’ that does the restyling, and using the new function instead of ‘format’ only in contexts where this seems appropriate. Problem reported by Dmitry Gutov and Andreas Schwab in: http://lists.gnu.org/archive/html/emacs-devel/2015-08/msg00826.html http://lists.gnu.org/archive/html/emacs-devel/2015-08/msg00827.html * doc/lispref/commands.texi (Using Interactive): * doc/lispref/control.texi (Signaling Errors, Signaling Errors): * doc/lispref/display.texi (Displaying Messages, Progress): * doc/lispref/elisp.texi: * doc/lispref/help.texi (Keys in Documentation): * doc/lispref/minibuf.texi (Minibuffer Misc): * doc/lispref/strings.texi (Formatting Strings): * etc/NEWS: Document the changes. * lisp/abbrev.el (expand-region-abbrevs): * lisp/apropos.el (apropos-library): * lisp/calc/calc-ext.el (calc-record-message) (calc-user-function-list): * lisp/calc/calc-help.el (calc-describe-key, calc-full-help): * lisp/calc/calc-lang.el (math-read-big-balance): * lisp/calc/calc-store.el (calc-edit-variable): * lisp/calc/calc-units.el (math-build-units-table-buffer): * lisp/calc/calc-yank.el (calc-edit-mode): * lisp/calendar/icalendar.el (icalendar-export-region) (icalendar--add-diary-entry): * lisp/cedet/mode-local.el (mode-local-print-binding) (mode-local-describe-bindings-2): * lisp/cedet/semantic/complete.el (semantic-completion-message): * lisp/cedet/semantic/edit.el (semantic-parse-changes-failed): * lisp/cedet/semantic/wisent/comp.el (wisent-log): * lisp/cedet/srecode/insert.el (srecode-insert-show-error-report): * lisp/descr-text.el (describe-text-properties-1, describe-char): * lisp/dframe.el (dframe-message): * lisp/dired-aux.el (dired-query): * lisp/emacs-lisp/byte-opt.el (byte-compile-log-lap-1): * lisp/emacs-lisp/bytecomp.el (byte-compile-log) (byte-compile-log-file, byte-compile-warn, byte-compile-form): * lisp/emacs-lisp/cconv.el (cconv-convert, cconv--analyze-use) (cconv-analyze-form): * lisp/emacs-lisp/check-declare.el (check-declare-warn): * lisp/emacs-lisp/checkdoc.el (checkdoc-this-string-valid-engine): * lisp/emacs-lisp/cl-macs.el (cl-symbol-macrolet): * lisp/emacs-lisp/edebug.el (edebug-format): * lisp/emacs-lisp/eieio-core.el (eieio-oref): * lisp/emacs-lisp/eldoc.el (eldoc-minibuffer-message) (eldoc-message): * lisp/emacs-lisp/elint.el (elint-file, elint-log): * lisp/emacs-lisp/find-func.el (find-function-library): * lisp/emacs-lisp/macroexp.el (macroexp--obsolete-warning): * lisp/emacs-lisp/map-ynp.el (map-y-or-n-p): * lisp/emacs-lisp/nadvice.el (advice--make-docstring): * lisp/emacs-lisp/package.el (package-compute-transaction) (package-install-button-action, package-delete-button-action) (package-menu--list-to-prompt): * lisp/emacs-lisp/timer.el (timer-event-handler): * lisp/emacs-lisp/warnings.el (lwarn, warn): * lisp/emulation/viper-cmd.el: (viper-toggle-parse-sexp-ignore-comments) (viper-kill-buffer, viper-brac-function): * lisp/emulation/viper-macs.el (viper-record-kbd-macro): * lisp/facemenu.el (facemenu-add-new-face): * lisp/faces.el (face-documentation, read-face-name) (face-read-string, read-face-font, describe-face): * lisp/files.el (find-alternate-file, hack-local-variables) (hack-one-local-variable--obsolete, write-file) (basic-save-buffer, delete-directory): * lisp/format.el (format-write-file, format-find-file) (format-insert-file): * lisp/help-fns.el (help-fns--key-bindings) (help-fns--compiler-macro, help-fns--obsolete) (help-fns--interactive-only, describe-function-1) (describe-variable): * lisp/help.el (describe-mode): * lisp/info-xref.el (info-xref-output): * lisp/info.el (Info-virtual-index-find-node) (Info-virtual-index, info-apropos): * lisp/international/kkc.el (kkc-error): * lisp/international/mule-cmds.el: (select-safe-coding-system-interactively) (select-safe-coding-system, describe-input-method): * lisp/international/mule-conf.el (code-offset): * lisp/international/mule-diag.el (describe-character-set) (list-input-methods-1): * lisp/international/quail.el (quail-error): * lisp/minibuffer.el (minibuffer-message): * lisp/mpc.el (mpc--debug): * lisp/msb.el (msb--choose-menu): * lisp/net/ange-ftp.el (ange-ftp-message): * lisp/net/gnutls.el (gnutls-message-maybe): * lisp/net/newst-backend.el (newsticker--sentinel-work): * lisp/net/newst-treeview.el (newsticker--treeview-load): * lisp/net/nsm.el (nsm-query-user): * lisp/net/rlogin.el (rlogin): * lisp/net/soap-client.el (soap-warning): * lisp/net/tramp.el (tramp-debug-message): * lisp/nxml/nxml-outln.el (nxml-report-outline-error): * lisp/nxml/nxml-parse.el (nxml-parse-error): * lisp/nxml/rng-cmpct.el (rng-c-error): * lisp/nxml/rng-match.el (rng-compile-error): * lisp/nxml/rng-uri.el (rng-uri-error): * lisp/obsolete/iswitchb.el (iswitchb-possible-new-buffer): * lisp/org/org-ctags.el: (org-ctags-ask-rebuild-tags-file-then-find-tag): * lisp/proced.el (proced-log): * lisp/progmodes/ebnf2ps.el (ebnf-log): * lisp/progmodes/flymake.el (flymake-log): * lisp/progmodes/vhdl-mode.el (vhdl-warning-when-idle): * lisp/replace.el (occur-1): * lisp/simple.el (execute-extended-command) (undo-outer-limit-truncate, define-alternatives): * lisp/startup.el (command-line): * lisp/subr.el (error, user-error, add-to-list): * lisp/tutorial.el (tutorial--describe-nonstandard-key) (tutorial--find-changed-keys): * src/callint.c (Fcall_interactively): * src/editfns.c (Fmessage, Fmessage_box): Restyle the quotes of format strings intended for use as a diagnostic, when restyling seems appropriate. * lisp/subr.el (format-message): New function. * src/doc.c (Finternal__text_restyle): New function. (syms_of_doc): Define it.
2015-08-24 05:38:02 +00:00
(format-message
2008-06-08 15:36:18 +00:00
(concat "%s: Newsticker could not retrieve news from %s.\n"
Go back to grave quoting in source-code docstrings etc. This reverts almost all my recent changes to use curved quotes in docstrings and/or strings used for error diagnostics. There are a few exceptions, e.g., Bahá’í proper names. * admin/unidata/unidata-gen.el (unidata-gen-table): * lisp/abbrev.el (expand-region-abbrevs): * lisp/align.el (align-region): * lisp/allout.el (allout-mode, allout-solicit-alternate-bullet) (outlineify-sticky): * lisp/apropos.el (apropos-library): * lisp/bookmark.el (bookmark-default-annotation-text): * lisp/button.el (button-category-symbol, button-put) (make-text-button): * lisp/calc/calc-aent.el (math-read-if, math-read-factor): * lisp/calc/calc-embed.el (calc-do-embedded): * lisp/calc/calc-ext.el (calc-user-function-list): * lisp/calc/calc-graph.el (calc-graph-show-dumb): * lisp/calc/calc-help.el (calc-describe-key) (calc-describe-thing, calc-full-help): * lisp/calc/calc-lang.el (calc-c-language) (math-parse-fortran-vector-end, math-parse-tex-sum) (math-parse-eqn-matrix, math-parse-eqn-prime) (calc-yacas-language, calc-maxima-language, calc-giac-language) (math-read-giac-subscr, math-read-math-subscr) (math-read-big-rec, math-read-big-balance): * lisp/calc/calc-misc.el (calc-help, report-calc-bug): * lisp/calc/calc-mode.el (calc-auto-why, calc-save-modes) (calc-auto-recompute): * lisp/calc/calc-prog.el (calc-fix-token-name) (calc-read-parse-table-part, calc-user-define-invocation) (math-do-arg-check): * lisp/calc/calc-store.el (calc-edit-variable): * lisp/calc/calc-units.el (math-build-units-table-buffer): * lisp/calc/calc-vec.el (math-read-brackets): * lisp/calc/calc-yank.el (calc-edit-mode): * lisp/calc/calc.el (calc, calc-do, calc-user-invocation): * lisp/calendar/appt.el (appt-display-message): * lisp/calendar/diary-lib.el (diary-check-diary-file) (diary-mail-entries, diary-from-outlook): * lisp/calendar/icalendar.el (icalendar-export-region) (icalendar--convert-float-to-ical) (icalendar--convert-date-to-ical) (icalendar--convert-ical-to-diary) (icalendar--convert-recurring-to-diary) (icalendar--add-diary-entry): * lisp/calendar/time-date.el (format-seconds): * lisp/calendar/timeclock.el (timeclock-mode-line-display) (timeclock-make-hours-explicit, timeclock-log-data): * lisp/calendar/todo-mode.el (todo-prefix, todo-delete-category) (todo-item-mark, todo-check-format) (todo-insert-item--next-param, todo-edit-item--next-key) (todo-mode): * lisp/cedet/ede/pmake.el (ede-proj-makefile-insert-dist-rules): * lisp/cedet/mode-local.el (describe-mode-local-overload) (mode-local-print-binding, mode-local-describe-bindings-2): * lisp/cedet/semantic/complete.el (semantic-displayor-show-request): * lisp/cedet/srecode/srt-mode.el (srecode-macro-help): * lisp/cus-start.el (standard): * lisp/cus-theme.el (describe-theme-1): * lisp/custom.el (custom-add-dependencies, custom-check-theme) (custom--sort-vars-1, load-theme): * lisp/descr-text.el (describe-text-properties-1, describe-char): * lisp/dired-x.el (dired-do-run-mail): * lisp/dired.el (dired-log): * lisp/emacs-lisp/advice.el (ad-read-advised-function) (ad-read-advice-class, ad-read-advice-name, ad-enable-advice) (ad-disable-advice, ad-remove-advice, ad-set-argument) (ad-set-arguments, ad--defalias-fset, ad-activate) (ad-deactivate): * lisp/emacs-lisp/byte-opt.el (byte-compile-inline-expand) (byte-compile-unfold-lambda, byte-optimize-form-code-walker) (byte-optimize-while, byte-optimize-apply): * lisp/emacs-lisp/byte-run.el (defun, defsubst): * lisp/emacs-lisp/bytecomp.el (byte-compile-lapcode) (byte-compile-log-file, byte-compile-format-warn) (byte-compile-nogroup-warn, byte-compile-arglist-warn) (byte-compile-cl-warn) (byte-compile-warn-about-unresolved-functions) (byte-compile-file, byte-compile--declare-var) (byte-compile-file-form-defmumble, byte-compile-form) (byte-compile-normal-call, byte-compile-check-variable) (byte-compile-variable-ref, byte-compile-variable-set) (byte-compile-subr-wrong-args, byte-compile-setq-default) (byte-compile-negation-optimizer) (byte-compile-condition-case--old) (byte-compile-condition-case--new, byte-compile-save-excursion) (byte-compile-defvar, byte-compile-autoload) (byte-compile-lambda-form) (byte-compile-make-variable-buffer-local, display-call-tree) (batch-byte-compile): * lisp/emacs-lisp/cconv.el (cconv-convert, cconv--analyze-use): * lisp/emacs-lisp/chart.el (chart-space-usage): * lisp/emacs-lisp/check-declare.el (check-declare-scan) (check-declare-warn, check-declare-file) (check-declare-directory): * lisp/emacs-lisp/checkdoc.el (checkdoc-this-string-valid-engine) (checkdoc-message-text-engine): * lisp/emacs-lisp/cl-extra.el (cl-parse-integer) (cl--describe-class): * lisp/emacs-lisp/cl-generic.el (cl-defgeneric) (cl--generic-describe, cl-generic-generalizers): * lisp/emacs-lisp/cl-macs.el (cl--parse-loop-clause, cl-tagbody) (cl-symbol-macrolet): * lisp/emacs-lisp/cl.el (cl-unload-function, flet): * lisp/emacs-lisp/copyright.el (copyright) (copyright-update-directory): * lisp/emacs-lisp/edebug.el (edebug-read-list): * lisp/emacs-lisp/eieio-base.el (eieio-persistent-read): * lisp/emacs-lisp/eieio-core.el (eieio--slot-override) (eieio-oref): * lisp/emacs-lisp/eieio-opt.el (eieio-help-constructor): * lisp/emacs-lisp/eieio-speedbar.el: (eieio-speedbar-child-make-tag-lines) (eieio-speedbar-child-description): * lisp/emacs-lisp/eieio.el (defclass, change-class): * lisp/emacs-lisp/elint.el (elint-file, elint-get-top-forms) (elint-init-form, elint-check-defalias-form) (elint-check-let-form): * lisp/emacs-lisp/ert.el (ert-get-test, ert-results-mode-menu) (ert-results-pop-to-backtrace-for-test-at-point) (ert-results-pop-to-messages-for-test-at-point) (ert-results-pop-to-should-forms-for-test-at-point) (ert-describe-test): * lisp/emacs-lisp/find-func.el (find-function-search-for-symbol) (find-function-library): * lisp/emacs-lisp/generator.el (iter-yield): * lisp/emacs-lisp/gv.el (gv-define-simple-setter): * lisp/emacs-lisp/lisp-mnt.el (lm-verify): * lisp/emacs-lisp/macroexp.el (macroexp--obsolete-warning): * lisp/emacs-lisp/map-ynp.el (map-y-or-n-p): * lisp/emacs-lisp/nadvice.el (advice--make-docstring) (advice--make, define-advice): * lisp/emacs-lisp/package-x.el (package-upload-file): * lisp/emacs-lisp/package.el (package-version-join) (package-disabled-p, package-activate-1, package-activate) (package--download-one-archive) (package--download-and-read-archives) (package-compute-transaction, package-install-from-archive) (package-install, package-install-selected-packages) (package-delete, package-autoremove, describe-package-1) (package-install-button-action, package-delete-button-action) (package-menu-hide-package, package-menu--list-to-prompt) (package-menu--perform-transaction) (package-menu--find-and-notify-upgrades): * lisp/emacs-lisp/pcase.el (pcase-exhaustive, pcase--u1): * lisp/emacs-lisp/re-builder.el (reb-enter-subexp-mode): * lisp/emacs-lisp/ring.el (ring-previous, ring-next): * lisp/emacs-lisp/rx.el (rx-check, rx-anything) (rx-check-any-string, rx-check-any, rx-check-not, rx-=) (rx-repeat, rx-check-backref, rx-syntax, rx-check-category) (rx-form): * lisp/emacs-lisp/smie.el (smie-config-save): * lisp/emacs-lisp/subr-x.el (internal--check-binding): * lisp/emacs-lisp/tabulated-list.el (tabulated-list-put-tag): * lisp/emacs-lisp/testcover.el (testcover-1value): * lisp/emacs-lisp/timer.el (timer-event-handler): * lisp/emulation/viper-cmd.el (viper-toggle-parse-sexp-ignore-comments) (viper-toggle-search-style, viper-kill-buffer) (viper-brac-function): * lisp/emulation/viper-macs.el (viper-record-kbd-macro): * lisp/env.el (setenv): * lisp/erc/erc-button.el (erc-nick-popup): * lisp/erc/erc.el (erc-cmd-LOAD, erc-handle-login, english): * lisp/eshell/em-dirs.el (eshell/cd): * lisp/eshell/em-glob.el (eshell-glob-regexp) (eshell-glob-entries): * lisp/eshell/em-pred.el (eshell-parse-modifiers): * lisp/eshell/esh-opt.el (eshell-show-usage): * lisp/facemenu.el (facemenu-add-new-face) (facemenu-add-new-color): * lisp/faces.el (read-face-name, read-face-font, describe-face) (x-resolve-font-name): * lisp/files-x.el (modify-file-local-variable): * lisp/files.el (locate-user-emacs-file, find-alternate-file) (set-auto-mode, hack-one-local-variable--obsolete) (dir-locals-set-directory-class, write-file, basic-save-buffer) (delete-directory, copy-directory, recover-session) (recover-session-finish, insert-directory) (file-modes-char-to-who, file-modes-symbolic-to-number) (move-file-to-trash): * lisp/filesets.el (filesets-add-buffer, filesets-remove-buffer): * lisp/find-cmd.el (find-generic, find-to-string): * lisp/finder.el (finder-commentary): * lisp/font-lock.el (font-lock-fontify-buffer): * lisp/format.el (format-write-file, format-find-file) (format-insert-file): * lisp/frame.el (get-device-terminal, select-frame-by-name): * lisp/fringe.el (fringe--check-style): * lisp/gnus/nnmairix.el (nnmairix-widget-create-query): * lisp/help-fns.el (help-fns--key-bindings) (help-fns--compiler-macro, help-fns--parent-mode) (help-fns--obsolete, help-fns--interactive-only) (describe-function-1, describe-variable): * lisp/help.el (describe-mode) (describe-minor-mode-from-indicator): * lisp/image.el (image-type): * lisp/international/ccl.el (ccl-dump): * lisp/international/fontset.el (x-must-resolve-font-name): * lisp/international/mule-cmds.el (prefer-coding-system) (select-safe-coding-system-interactively) (select-safe-coding-system, activate-input-method) (toggle-input-method, describe-current-input-method) (describe-language-environment): * lisp/international/mule-conf.el (code-offset): * lisp/international/mule-diag.el (describe-character-set) (list-input-methods-1): * lisp/mail/feedmail.el (feedmail-run-the-queue): * lisp/mouse.el (minor-mode-menu-from-indicator): * lisp/mpc.el (mpc-playlist-rename): * lisp/msb.el (msb--choose-menu): * lisp/net/ange-ftp.el (ange-ftp-shell-command): * lisp/net/imap.el (imap-interactive-login): * lisp/net/mairix.el (mairix-widget-create-query): * lisp/net/newst-backend.el (newsticker--sentinel-work): * lisp/net/newst-treeview.el (newsticker--treeview-load): * lisp/net/rlogin.el (rlogin): * lisp/obsolete/iswitchb.el (iswitchb-possible-new-buffer): * lisp/obsolete/otodo-mode.el (todo-more-important-p): * lisp/obsolete/pgg-gpg.el (pgg-gpg-process-region): * lisp/obsolete/pgg-pgp.el (pgg-pgp-process-region): * lisp/obsolete/pgg-pgp5.el (pgg-pgp5-process-region): * lisp/org/ob-core.el (org-babel-goto-named-src-block) (org-babel-goto-named-result): * lisp/org/ob-fortran.el (org-babel-fortran-ensure-main-wrap): * lisp/org/ob-ref.el (org-babel-ref-resolve): * lisp/org/org-agenda.el (org-agenda-prepare): * lisp/org/org-clock.el (org-clock-notify-once-if-expired) (org-clock-resolve): * lisp/org/org-ctags.el (org-ctags-ask-rebuild-tags-file-then-find-tag): * lisp/org/org-feed.el (org-feed-parse-atom-entry): * lisp/org/org-habit.el (org-habit-parse-todo): * lisp/org/org-mouse.el (org-mouse-popup-global-menu) (org-mouse-context-menu): * lisp/org/org-table.el (org-table-edit-formulas): * lisp/org/ox.el (org-export-async-start): * lisp/proced.el (proced-log): * lisp/progmodes/ada-mode.el (ada-get-indent-case) (ada-check-matching-start, ada-goto-matching-start): * lisp/progmodes/ada-prj.el (ada-prj-display-page): * lisp/progmodes/ada-xref.el (ada-find-executable): * lisp/progmodes/ebrowse.el (ebrowse-tags-apropos): * lisp/progmodes/etags.el (etags-tags-apropos-additional): * lisp/progmodes/flymake.el (flymake-parse-err-lines) (flymake-start-syntax-check-process): * lisp/progmodes/python.el (python-shell-get-process-or-error) (python-define-auxiliary-skeleton): * lisp/progmodes/sql.el (sql-comint): * lisp/progmodes/verilog-mode.el (verilog-load-file-at-point): * lisp/progmodes/vhdl-mode.el (vhdl-widget-directory-validate): * lisp/recentf.el (recentf-open-files): * lisp/replace.el (query-replace-read-from) (occur-after-change-function, occur-1): * lisp/scroll-bar.el (scroll-bar-columns): * lisp/server.el (server-get-auth-key): * lisp/simple.el (execute-extended-command) (undo-outer-limit-truncate, list-processes--refresh) (compose-mail, set-variable, choose-completion-string) (define-alternatives): * lisp/startup.el (site-run-file, tty-handle-args, command-line) (command-line-1): * lisp/subr.el (noreturn, define-error, add-to-list) (read-char-choice, version-to-list): * lisp/term/common-win.el (x-handle-xrm-switch) (x-handle-name-switch, x-handle-args): * lisp/term/x-win.el (x-handle-parent-id, x-handle-smid): * lisp/textmodes/reftex-ref.el (reftex-label): * lisp/textmodes/reftex-toc.el (reftex-toc-rename-label): * lisp/textmodes/two-column.el (2C-split): * lisp/tutorial.el (tutorial--describe-nonstandard-key) (tutorial--find-changed-keys): * lisp/type-break.el (type-break-noninteractive-query): * lisp/wdired.el (wdired-do-renames, wdired-do-symlink-changes) (wdired-do-perm-changes): * lisp/whitespace.el (whitespace-report-region): Prefer grave quoting in source-code strings used to generate help and diagnostics. * lisp/faces.el (face-documentation): No need to convert quotes, since the result is a docstring. * lisp/info.el (Info-virtual-index-find-node) (Info-virtual-index, info-apropos): Simplify by generating only curved quotes, since info files are typically that ways nowadays anyway. * lisp/international/mule-diag.el (list-input-methods): Don’t assume text quoting style is curved. * lisp/org/org-bibtex.el (org-bibtex-fields): Revert my recent changes, going back to the old quoting style.
2015-09-07 15:41:44 +00:00
"Return status: `%s'\n"
"Command was `%s'")
Simplify use of current-time and friends. * doc/misc/org.texi (Dynamic blocks): * lisp/allout-widgets.el (allout-widgets-hook-error-handler): * lisp/calendar/appt.el (appt-display-message): * lisp/calendar/icalendar.el (icalendar--convert-float-to-ical): * lisp/calendar/timeclock.el (timeclock-in, timeclock-when-to-leave) (timeclock-last-period, timeclock-day-base): * lisp/eshell/em-ls.el (eshell-ls-file): * lisp/eshell/esh-util.el (eshell-parse-ange-ls): * lisp/generic-x.el (named-database-print-serial): * lisp/net/newst-backend.el (newsticker--get-news-by-url-callback) (newsticker-get-news, newsticker--sentinel-work) (newsticker--image-get, newsticker--image-sentinel): * lisp/net/tramp-sh.el (tramp-get-remote-touch): * lisp/progmodes/opascal.el (opascal-debug-log): * lisp/textmodes/remember.el (remember-mail-date) (remember-store-in-files): * lisp/vc/vc-annotate.el (vc-annotate-display-autoscale) (vc-default-annotate-current-time): * lisp/vc/vc-bzr.el (vc-bzr-shelve-snapshot): * lisp/vc/vc-cvs.el (vc-cvs-annotate-current-time): * lisp/vc/vc-rcs.el (vc-rcs-annotate-current-time): * lisp/url/url-util.el (url-get-normalized-date): * lisp/erc/erc-backend.el (TOPIC): * lisp/gnus/gnus-delay.el (gnus-delay-article): * lisp/gnus/gnus-sum.el (gnus-summary-read-document): * lisp/gnus/gnus-util.el (gnus-seconds-today, gnus-seconds-month): * lisp/gnus/message.el (message-make-expires-date): * lisp/org/org-archive.el (org-archive-subtree) (org-archive-to-archive-sibling): * lisp/org/org-clock.el (org-resolve-clocks, org-clock-get-sum-start) (org-clock-special-range): * lisp/org/org-timer.el (org-timer-seconds): * lisp/org/org.el (org-read-date-analyze, org-get-cursor-date): * lisp/org/ox-html.el (org-html-format-spec): * lisp/org/ox-icalendar.el (org-icalendar--vtodo): Omit unnecessary call to current-time. * lisp/calendar/time-date.el (time-to-seconds) [!float-time]: * lisp/calendar/timeclock.el (timeclock-time-to-date): * lisp/vc/vc-annotate.el (vc-annotate-convert-time): Use current time if arg is nil, to be compatible with float-time. (time-date--day-in-year): New function, with most of the guts of the old time-to-day-in-year. (time-to-day-in-year): Use it. (time-to-days): Use it, to avoid decoding the same time stamp twice. * lisp/calendar/timeclock.el (timeclock-update-mode-line): * lisp/cedet/srecode/args.el (srecode-semantic-handle-:time): * lisp/gnus/gnus-util.el (gnus-seconds-year): * lisp/org/org.el (org-get-cursor-date): Don't call current-time twice to get the current time stamp, as this can lead to inconsistent results. * lisp/completion.el (cmpl-hours-since-origin): * lisp/erc/erc.el (erc-emacs-time-to-erc-time): * lisp/ido.el (ido-time-stamp): * lisp/vc/vc-annotate.el (vc-annotate-convert-time): Simplify by using float-time. * lisp/completion.el (save-completions-to-file): * lisp/url/url-cache.el (url-cache-prune-cache): Rename local var to avoid confusion. * lisp/gnus/gnus-util.el (gnus-float-time): * lisp/net/rcirc.el (rcirc-float-time): * lisp/org/org-compat.el (org-float-time): Simplify to an alias because time-to-seconds now behaves like float-time with respect to nil arg. * lisp/subr.el (progress-reporter-do-update): Don't call float-time unless needed. * lisp/erc/erc.el (erc-current-time): Simplify by using erc-emacs-time-to-erc-time. * lisp/org/org-clock.el (org-clock-get-table-data): Omit unnecessary, lossy conversion from floating point to Emacs time and back. (org-resolve-clocks): Prefer two-argument floor.
2014-10-29 01:42:51 +00:00
(format-time-string "%A, %H:%M")
Newsticker: Show feedicons in treeview. Small fix in opml export. * etc/images/newsticker/README: Add rss-feed.png, rss-feed.svg. * etc/images/newsticker/rss-feed.png: New. * etc/images/newsticker/rss-feed.svg: New. * lisp/net/newst-backend.el: Require url-parse. (newsticker--get-news-by-wget): Store feed name as process property. (newsticker--sentinel): Read feed name from process property. (newsticker--sentinel-work): Rename argument name to feed-name. Rename variable imageurl to image-url. Pick icon url from Atom 1.0 data. Launch download of feed icon. (newsticker--get-icon-url-atom-1.0): New. (newsticker--unxml) (newsticker--unxml-node) (newsticker--unxml-attribute): Documentation. (newsticker--icons-dir): New. (newsticker--image-get): New arguments FILENAME and DIRECTORY. Use `url-retrieve' if `newsticker-retrieval-method' is 'intern. (newsticker--image-download-by-wget): New. Use process properties for storing informations. (newsticker--image-sentinel): Read informations from process properties. (newsticker--image-save) (newsticker--image-remove) (newsticker--image-download-by-url) (newsticker--image-download-by-url-callback): New. (newsticker-opml-export): Handle url list entries containing a function instead of an url string. * lisp/net/newst-reader.el (newsticker-html-renderer): Whitespace. (newsticker--print-extra-elements) (newsticker--do-print-extra-element): Documentation (newsticker--image-read): Optionally limit image height. Use imagemagick if possible. (newsticker--icon-read): New. * lisp/net/newst-treeview.el (newsticker--treeview-item-show): Limit height of feed logo. (newsticker--treeview-tree-expand): Use feed icons in treeview. (newsticker--tree-widget-icon-create): New. Set the tree widget icon. (newsticker--tree-widget-leaf-icon): Use feed icon.
2014-10-19 16:50:15 +00:00
feed-name event command)
2008-06-08 15:36:18 +00:00
""
ct
2008-06-08 15:36:18 +00:00
'new
0 '((guid nil "newsticker--download-error"))
ct))
2008-06-08 15:36:18 +00:00
(message "%s: Error while retrieving news from %s"
Simplify use of current-time and friends. * doc/misc/org.texi (Dynamic blocks): * lisp/allout-widgets.el (allout-widgets-hook-error-handler): * lisp/calendar/appt.el (appt-display-message): * lisp/calendar/icalendar.el (icalendar--convert-float-to-ical): * lisp/calendar/timeclock.el (timeclock-in, timeclock-when-to-leave) (timeclock-last-period, timeclock-day-base): * lisp/eshell/em-ls.el (eshell-ls-file): * lisp/eshell/esh-util.el (eshell-parse-ange-ls): * lisp/generic-x.el (named-database-print-serial): * lisp/net/newst-backend.el (newsticker--get-news-by-url-callback) (newsticker-get-news, newsticker--sentinel-work) (newsticker--image-get, newsticker--image-sentinel): * lisp/net/tramp-sh.el (tramp-get-remote-touch): * lisp/progmodes/opascal.el (opascal-debug-log): * lisp/textmodes/remember.el (remember-mail-date) (remember-store-in-files): * lisp/vc/vc-annotate.el (vc-annotate-display-autoscale) (vc-default-annotate-current-time): * lisp/vc/vc-bzr.el (vc-bzr-shelve-snapshot): * lisp/vc/vc-cvs.el (vc-cvs-annotate-current-time): * lisp/vc/vc-rcs.el (vc-rcs-annotate-current-time): * lisp/url/url-util.el (url-get-normalized-date): * lisp/erc/erc-backend.el (TOPIC): * lisp/gnus/gnus-delay.el (gnus-delay-article): * lisp/gnus/gnus-sum.el (gnus-summary-read-document): * lisp/gnus/gnus-util.el (gnus-seconds-today, gnus-seconds-month): * lisp/gnus/message.el (message-make-expires-date): * lisp/org/org-archive.el (org-archive-subtree) (org-archive-to-archive-sibling): * lisp/org/org-clock.el (org-resolve-clocks, org-clock-get-sum-start) (org-clock-special-range): * lisp/org/org-timer.el (org-timer-seconds): * lisp/org/org.el (org-read-date-analyze, org-get-cursor-date): * lisp/org/ox-html.el (org-html-format-spec): * lisp/org/ox-icalendar.el (org-icalendar--vtodo): Omit unnecessary call to current-time. * lisp/calendar/time-date.el (time-to-seconds) [!float-time]: * lisp/calendar/timeclock.el (timeclock-time-to-date): * lisp/vc/vc-annotate.el (vc-annotate-convert-time): Use current time if arg is nil, to be compatible with float-time. (time-date--day-in-year): New function, with most of the guts of the old time-to-day-in-year. (time-to-day-in-year): Use it. (time-to-days): Use it, to avoid decoding the same time stamp twice. * lisp/calendar/timeclock.el (timeclock-update-mode-line): * lisp/cedet/srecode/args.el (srecode-semantic-handle-:time): * lisp/gnus/gnus-util.el (gnus-seconds-year): * lisp/org/org.el (org-get-cursor-date): Don't call current-time twice to get the current time stamp, as this can lead to inconsistent results. * lisp/completion.el (cmpl-hours-since-origin): * lisp/erc/erc.el (erc-emacs-time-to-erc-time): * lisp/ido.el (ido-time-stamp): * lisp/vc/vc-annotate.el (vc-annotate-convert-time): Simplify by using float-time. * lisp/completion.el (save-completions-to-file): * lisp/url/url-cache.el (url-cache-prune-cache): Rename local var to avoid confusion. * lisp/gnus/gnus-util.el (gnus-float-time): * lisp/net/rcirc.el (rcirc-float-time): * lisp/org/org-compat.el (org-float-time): Simplify to an alias because time-to-seconds now behaves like float-time with respect to nil arg. * lisp/subr.el (progress-reporter-do-update): Don't call float-time unless needed. * lisp/erc/erc.el (erc-current-time): Simplify by using erc-emacs-time-to-erc-time. * lisp/org/org-clock.el (org-clock-get-table-data): Omit unnecessary, lossy conversion from floating point to Emacs time and back. (org-resolve-clocks): Prefer two-argument floor.
2014-10-29 01:42:51 +00:00
(format-time-string "%A, %H:%M")
Newsticker: Show feedicons in treeview. Small fix in opml export. * etc/images/newsticker/README: Add rss-feed.png, rss-feed.svg. * etc/images/newsticker/rss-feed.png: New. * etc/images/newsticker/rss-feed.svg: New. * lisp/net/newst-backend.el: Require url-parse. (newsticker--get-news-by-wget): Store feed name as process property. (newsticker--sentinel): Read feed name from process property. (newsticker--sentinel-work): Rename argument name to feed-name. Rename variable imageurl to image-url. Pick icon url from Atom 1.0 data. Launch download of feed icon. (newsticker--get-icon-url-atom-1.0): New. (newsticker--unxml) (newsticker--unxml-node) (newsticker--unxml-attribute): Documentation. (newsticker--icons-dir): New. (newsticker--image-get): New arguments FILENAME and DIRECTORY. Use `url-retrieve' if `newsticker-retrieval-method' is 'intern. (newsticker--image-download-by-wget): New. Use process properties for storing informations. (newsticker--image-sentinel): Read informations from process properties. (newsticker--image-save) (newsticker--image-remove) (newsticker--image-download-by-url) (newsticker--image-download-by-url-callback): New. (newsticker-opml-export): Handle url list entries containing a function instead of an url string. * lisp/net/newst-reader.el (newsticker-html-renderer): Whitespace. (newsticker--print-extra-elements) (newsticker--do-print-extra-element): Documentation (newsticker--image-read): Optionally limit image height. Use imagemagick if possible. (newsticker--icon-read): New. * lisp/net/newst-treeview.el (newsticker--treeview-item-show): Limit height of feed logo. (newsticker--treeview-tree-expand): Use feed icons in treeview. (newsticker--tree-widget-icon-create): New. Set the tree widget icon. (newsticker--tree-widget-leaf-icon): Use feed icon.
2014-10-19 16:50:15 +00:00
feed-name)
2008-06-08 15:36:18 +00:00
(throw 'oops nil))
(let* ((coding-system 'utf-8)
(node-list
(save-current-buffer
(set-buffer buffer)
Newsticker: Use libxml instead of `xml-parse-region'. Fix some glitches. Clean up. * lisp/net/newst-backend.el: Remove Time-stamp. Rename variable `newsticker--download-logos' to `newsticker-download-logos' and make it customizable. (newsticker--sentinel-work): Move xml-workarounds to function `newsticker--do-xml-workarounds', call unless libxml-parser is used. Allow single quote in regexp for encoding. Use libxml-parser if available, else fall back to `xml-parse-region'. Take care of possibly missing namespace prefixes (like "RDF" instead of "rdf:RDF") when checking xml nodes and attributes (as libxml correctly removes the prefixes). Always use Atom 1.0 as fallback feed type. Rename `newsticker--download-logos' to `newsticker-download-logos' (newsticker--unxml, newsticker--unxml-node) (newsticker--unxml-attribute): New. (newsticker--parse-atom-1.0): Call `unxml' in case that embedded HTML code has become part of the xml parse tree. (newsticker--parse-rss-1.0, newsticker--parse-rss-2.0): Take care of possibly missing namespace prefixes. (newsticker--parse-generic-items): Code formatting. Typo. (newsticker--images-dir): Add trailing slash. (newsticker--image-get): Fix error message. * lisp/net/newst-plainview.el: Remove Time-stamp. * lisp/net/newst-reader.el: Remove Time-stamp. (newsticker-download-logos): Rename variable `newsticker--download-logos' to `newsticker-download-logos' and make it customizable. (newsticker--print-extra-elements): Add optional parameter 'htmlish for using html markup. Amend list of ignored elements. (newsticker--do-print-extra-element): Add parameter 'htmlish for using html markup. * lisp/net/newst-ticker.el: Remove Time-stamp. * lisp/net/newst-treeview.el (newsticker--treeview-item-show): Use html for formatting extra elements. * lisp/net/newsticker.el: Remove Time-stamp, Version. (newsticker-version): Make obsolete.
2014-10-01 17:20:00 +00:00
(unless (fboundp 'libxml-parse-xml-region)
(newsticker--do-xml-workarounds))
2008-06-08 15:36:18 +00:00
;; check coding system
(goto-char (point-min))
Newsticker: Use libxml instead of `xml-parse-region'. Fix some glitches. Clean up. * lisp/net/newst-backend.el: Remove Time-stamp. Rename variable `newsticker--download-logos' to `newsticker-download-logos' and make it customizable. (newsticker--sentinel-work): Move xml-workarounds to function `newsticker--do-xml-workarounds', call unless libxml-parser is used. Allow single quote in regexp for encoding. Use libxml-parser if available, else fall back to `xml-parse-region'. Take care of possibly missing namespace prefixes (like "RDF" instead of "rdf:RDF") when checking xml nodes and attributes (as libxml correctly removes the prefixes). Always use Atom 1.0 as fallback feed type. Rename `newsticker--download-logos' to `newsticker-download-logos' (newsticker--unxml, newsticker--unxml-node) (newsticker--unxml-attribute): New. (newsticker--parse-atom-1.0): Call `unxml' in case that embedded HTML code has become part of the xml parse tree. (newsticker--parse-rss-1.0, newsticker--parse-rss-2.0): Take care of possibly missing namespace prefixes. (newsticker--parse-generic-items): Code formatting. Typo. (newsticker--images-dir): Add trailing slash. (newsticker--image-get): Fix error message. * lisp/net/newst-plainview.el: Remove Time-stamp. * lisp/net/newst-reader.el: Remove Time-stamp. (newsticker-download-logos): Rename variable `newsticker--download-logos' to `newsticker-download-logos' and make it customizable. (newsticker--print-extra-elements): Add optional parameter 'htmlish for using html markup. Amend list of ignored elements. (newsticker--do-print-extra-element): Add parameter 'htmlish for using html markup. * lisp/net/newst-ticker.el: Remove Time-stamp. * lisp/net/newst-treeview.el (newsticker--treeview-item-show): Use html for formatting extra elements. * lisp/net/newsticker.el: Remove Time-stamp, Version. (newsticker-version): Make obsolete.
2014-10-01 17:20:00 +00:00
(if (re-search-forward "encoding=['\"]\\([^\"]+?\\)['\"]"
2008-06-08 15:36:18 +00:00
nil t)
(setq coding-system (intern (downcase (match-string 1))))
(setq coding-system
(condition-case nil
(check-coding-system coding-system)
2008-06-08 15:36:18 +00:00
(coding-system-error
(message
"newsticker.el: ignoring coding system %s for %s"
Newsticker: Show feedicons in treeview. Small fix in opml export. * etc/images/newsticker/README: Add rss-feed.png, rss-feed.svg. * etc/images/newsticker/rss-feed.png: New. * etc/images/newsticker/rss-feed.svg: New. * lisp/net/newst-backend.el: Require url-parse. (newsticker--get-news-by-wget): Store feed name as process property. (newsticker--sentinel): Read feed name from process property. (newsticker--sentinel-work): Rename argument name to feed-name. Rename variable imageurl to image-url. Pick icon url from Atom 1.0 data. Launch download of feed icon. (newsticker--get-icon-url-atom-1.0): New. (newsticker--unxml) (newsticker--unxml-node) (newsticker--unxml-attribute): Documentation. (newsticker--icons-dir): New. (newsticker--image-get): New arguments FILENAME and DIRECTORY. Use `url-retrieve' if `newsticker-retrieval-method' is 'intern. (newsticker--image-download-by-wget): New. Use process properties for storing informations. (newsticker--image-sentinel): Read informations from process properties. (newsticker--image-save) (newsticker--image-remove) (newsticker--image-download-by-url) (newsticker--image-download-by-url-callback): New. (newsticker-opml-export): Handle url list entries containing a function instead of an url string. * lisp/net/newst-reader.el (newsticker-html-renderer): Whitespace. (newsticker--print-extra-elements) (newsticker--do-print-extra-element): Documentation (newsticker--image-read): Optionally limit image height. Use imagemagick if possible. (newsticker--icon-read): New. * lisp/net/newst-treeview.el (newsticker--treeview-item-show): Limit height of feed logo. (newsticker--treeview-tree-expand): Use feed icons in treeview. (newsticker--tree-widget-icon-create): New. Set the tree widget icon. (newsticker--tree-widget-leaf-icon): Use feed icon.
2014-10-19 16:50:15 +00:00
coding-system feed-name)
2008-06-08 15:36:18 +00:00
nil))))
;; Decode if possible
(when coding-system
(decode-coding-region (point-min) (point-max)
coding-system))
(condition-case errordata
;; The xml parser might fail or the xml might be bugged.
Newsticker: Use libxml instead of `xml-parse-region'. Fix some glitches. Clean up. * lisp/net/newst-backend.el: Remove Time-stamp. Rename variable `newsticker--download-logos' to `newsticker-download-logos' and make it customizable. (newsticker--sentinel-work): Move xml-workarounds to function `newsticker--do-xml-workarounds', call unless libxml-parser is used. Allow single quote in regexp for encoding. Use libxml-parser if available, else fall back to `xml-parse-region'. Take care of possibly missing namespace prefixes (like "RDF" instead of "rdf:RDF") when checking xml nodes and attributes (as libxml correctly removes the prefixes). Always use Atom 1.0 as fallback feed type. Rename `newsticker--download-logos' to `newsticker-download-logos' (newsticker--unxml, newsticker--unxml-node) (newsticker--unxml-attribute): New. (newsticker--parse-atom-1.0): Call `unxml' in case that embedded HTML code has become part of the xml parse tree. (newsticker--parse-rss-1.0, newsticker--parse-rss-2.0): Take care of possibly missing namespace prefixes. (newsticker--parse-generic-items): Code formatting. Typo. (newsticker--images-dir): Add trailing slash. (newsticker--image-get): Fix error message. * lisp/net/newst-plainview.el: Remove Time-stamp. * lisp/net/newst-reader.el: Remove Time-stamp. (newsticker-download-logos): Rename variable `newsticker--download-logos' to `newsticker-download-logos' and make it customizable. (newsticker--print-extra-elements): Add optional parameter 'htmlish for using html markup. Amend list of ignored elements. (newsticker--do-print-extra-element): Add parameter 'htmlish for using html markup. * lisp/net/newst-ticker.el: Remove Time-stamp. * lisp/net/newst-treeview.el (newsticker--treeview-item-show): Use html for formatting extra elements. * lisp/net/newsticker.el: Remove Time-stamp, Version. (newsticker-version): Make obsolete.
2014-10-01 17:20:00 +00:00
(if (fboundp 'libxml-parse-xml-region)
(progn
(xml-remove-comments (point-min) (point-max))
(list (libxml-parse-xml-region (point-min) (point-max)
nil)))
Newsticker: Use libxml instead of `xml-parse-region'. Fix some glitches. Clean up. * lisp/net/newst-backend.el: Remove Time-stamp. Rename variable `newsticker--download-logos' to `newsticker-download-logos' and make it customizable. (newsticker--sentinel-work): Move xml-workarounds to function `newsticker--do-xml-workarounds', call unless libxml-parser is used. Allow single quote in regexp for encoding. Use libxml-parser if available, else fall back to `xml-parse-region'. Take care of possibly missing namespace prefixes (like "RDF" instead of "rdf:RDF") when checking xml nodes and attributes (as libxml correctly removes the prefixes). Always use Atom 1.0 as fallback feed type. Rename `newsticker--download-logos' to `newsticker-download-logos' (newsticker--unxml, newsticker--unxml-node) (newsticker--unxml-attribute): New. (newsticker--parse-atom-1.0): Call `unxml' in case that embedded HTML code has become part of the xml parse tree. (newsticker--parse-rss-1.0, newsticker--parse-rss-2.0): Take care of possibly missing namespace prefixes. (newsticker--parse-generic-items): Code formatting. Typo. (newsticker--images-dir): Add trailing slash. (newsticker--image-get): Fix error message. * lisp/net/newst-plainview.el: Remove Time-stamp. * lisp/net/newst-reader.el: Remove Time-stamp. (newsticker-download-logos): Rename variable `newsticker--download-logos' to `newsticker-download-logos' and make it customizable. (newsticker--print-extra-elements): Add optional parameter 'htmlish for using html markup. Amend list of ignored elements. (newsticker--do-print-extra-element): Add parameter 'htmlish for using html markup. * lisp/net/newst-ticker.el: Remove Time-stamp. * lisp/net/newst-treeview.el (newsticker--treeview-item-show): Use html for formatting extra elements. * lisp/net/newsticker.el: Remove Time-stamp, Version. (newsticker-version): Make obsolete.
2014-10-01 17:20:00 +00:00
(xml-parse-region (point-min) (point-max)))
2008-06-08 15:36:18 +00:00
(error (message "Could not parse %s: %s"
(buffer-name) (cadr errordata))
(throw 'oops nil)))))
(topnode (car node-list))
Newsticker: Show feedicons in treeview. Small fix in opml export. * etc/images/newsticker/README: Add rss-feed.png, rss-feed.svg. * etc/images/newsticker/rss-feed.png: New. * etc/images/newsticker/rss-feed.svg: New. * lisp/net/newst-backend.el: Require url-parse. (newsticker--get-news-by-wget): Store feed name as process property. (newsticker--sentinel): Read feed name from process property. (newsticker--sentinel-work): Rename argument name to feed-name. Rename variable imageurl to image-url. Pick icon url from Atom 1.0 data. Launch download of feed icon. (newsticker--get-icon-url-atom-1.0): New. (newsticker--unxml) (newsticker--unxml-node) (newsticker--unxml-attribute): Documentation. (newsticker--icons-dir): New. (newsticker--image-get): New arguments FILENAME and DIRECTORY. Use `url-retrieve' if `newsticker-retrieval-method' is 'intern. (newsticker--image-download-by-wget): New. Use process properties for storing informations. (newsticker--image-sentinel): Read informations from process properties. (newsticker--image-save) (newsticker--image-remove) (newsticker--image-download-by-url) (newsticker--image-download-by-url-callback): New. (newsticker-opml-export): Handle url list entries containing a function instead of an url string. * lisp/net/newst-reader.el (newsticker-html-renderer): Whitespace. (newsticker--print-extra-elements) (newsticker--do-print-extra-element): Documentation (newsticker--image-read): Optionally limit image height. Use imagemagick if possible. (newsticker--icon-read): New. * lisp/net/newst-treeview.el (newsticker--treeview-item-show): Limit height of feed logo. (newsticker--treeview-tree-expand): Use feed icons in treeview. (newsticker--tree-widget-icon-create): New. Set the tree widget icon. (newsticker--tree-widget-leaf-icon): Use feed icon.
2014-10-19 16:50:15 +00:00
(image-url nil)
(icon-url nil))
2008-06-08 15:36:18 +00:00
;; mark all items as obsolete
(newsticker--cache-replace-age newsticker--cache
name-symbol
'new 'obsolete-new)
(newsticker--cache-replace-age newsticker--cache
name-symbol
'old 'obsolete-old)
(newsticker--cache-replace-age newsticker--cache
name-symbol
'feed 'obsolete-old)
;; check Atom/RSS version and call corresponding parser
(condition-case error-data
(if (cond
;; RSS 0.91
((and (eq 'rss (xml-node-name topnode))
(string= "0.91" (xml-get-attribute topnode 'version)))
Newsticker: Show feedicons in treeview. Small fix in opml export. * etc/images/newsticker/README: Add rss-feed.png, rss-feed.svg. * etc/images/newsticker/rss-feed.png: New. * etc/images/newsticker/rss-feed.svg: New. * lisp/net/newst-backend.el: Require url-parse. (newsticker--get-news-by-wget): Store feed name as process property. (newsticker--sentinel): Read feed name from process property. (newsticker--sentinel-work): Rename argument name to feed-name. Rename variable imageurl to image-url. Pick icon url from Atom 1.0 data. Launch download of feed icon. (newsticker--get-icon-url-atom-1.0): New. (newsticker--unxml) (newsticker--unxml-node) (newsticker--unxml-attribute): Documentation. (newsticker--icons-dir): New. (newsticker--image-get): New arguments FILENAME and DIRECTORY. Use `url-retrieve' if `newsticker-retrieval-method' is 'intern. (newsticker--image-download-by-wget): New. Use process properties for storing informations. (newsticker--image-sentinel): Read informations from process properties. (newsticker--image-save) (newsticker--image-remove) (newsticker--image-download-by-url) (newsticker--image-download-by-url-callback): New. (newsticker-opml-export): Handle url list entries containing a function instead of an url string. * lisp/net/newst-reader.el (newsticker-html-renderer): Whitespace. (newsticker--print-extra-elements) (newsticker--do-print-extra-element): Documentation (newsticker--image-read): Optionally limit image height. Use imagemagick if possible. (newsticker--icon-read): New. * lisp/net/newst-treeview.el (newsticker--treeview-item-show): Limit height of feed logo. (newsticker--treeview-tree-expand): Use feed icons in treeview. (newsticker--tree-widget-icon-create): New. Set the tree widget icon. (newsticker--tree-widget-leaf-icon): Use feed icon.
2014-10-19 16:50:15 +00:00
(setq image-url (newsticker--get-logo-url-rss-0.91 topnode))
(newsticker--parse-rss-0.91 feed-name time topnode))
2008-06-08 15:36:18 +00:00
;; RSS 0.92
((and (eq 'rss (xml-node-name topnode))
(string= "0.92" (xml-get-attribute topnode 'version)))
Newsticker: Show feedicons in treeview. Small fix in opml export. * etc/images/newsticker/README: Add rss-feed.png, rss-feed.svg. * etc/images/newsticker/rss-feed.png: New. * etc/images/newsticker/rss-feed.svg: New. * lisp/net/newst-backend.el: Require url-parse. (newsticker--get-news-by-wget): Store feed name as process property. (newsticker--sentinel): Read feed name from process property. (newsticker--sentinel-work): Rename argument name to feed-name. Rename variable imageurl to image-url. Pick icon url from Atom 1.0 data. Launch download of feed icon. (newsticker--get-icon-url-atom-1.0): New. (newsticker--unxml) (newsticker--unxml-node) (newsticker--unxml-attribute): Documentation. (newsticker--icons-dir): New. (newsticker--image-get): New arguments FILENAME and DIRECTORY. Use `url-retrieve' if `newsticker-retrieval-method' is 'intern. (newsticker--image-download-by-wget): New. Use process properties for storing informations. (newsticker--image-sentinel): Read informations from process properties. (newsticker--image-save) (newsticker--image-remove) (newsticker--image-download-by-url) (newsticker--image-download-by-url-callback): New. (newsticker-opml-export): Handle url list entries containing a function instead of an url string. * lisp/net/newst-reader.el (newsticker-html-renderer): Whitespace. (newsticker--print-extra-elements) (newsticker--do-print-extra-element): Documentation (newsticker--image-read): Optionally limit image height. Use imagemagick if possible. (newsticker--icon-read): New. * lisp/net/newst-treeview.el (newsticker--treeview-item-show): Limit height of feed logo. (newsticker--treeview-tree-expand): Use feed icons in treeview. (newsticker--tree-widget-icon-create): New. Set the tree widget icon. (newsticker--tree-widget-leaf-icon): Use feed icon.
2014-10-19 16:50:15 +00:00
(setq image-url (newsticker--get-logo-url-rss-0.92 topnode))
(newsticker--parse-rss-0.92 feed-name time topnode))
2008-06-08 15:36:18 +00:00
;; RSS 1.0
Newsticker: Use libxml instead of `xml-parse-region'. Fix some glitches. Clean up. * lisp/net/newst-backend.el: Remove Time-stamp. Rename variable `newsticker--download-logos' to `newsticker-download-logos' and make it customizable. (newsticker--sentinel-work): Move xml-workarounds to function `newsticker--do-xml-workarounds', call unless libxml-parser is used. Allow single quote in regexp for encoding. Use libxml-parser if available, else fall back to `xml-parse-region'. Take care of possibly missing namespace prefixes (like "RDF" instead of "rdf:RDF") when checking xml nodes and attributes (as libxml correctly removes the prefixes). Always use Atom 1.0 as fallback feed type. Rename `newsticker--download-logos' to `newsticker-download-logos' (newsticker--unxml, newsticker--unxml-node) (newsticker--unxml-attribute): New. (newsticker--parse-atom-1.0): Call `unxml' in case that embedded HTML code has become part of the xml parse tree. (newsticker--parse-rss-1.0, newsticker--parse-rss-2.0): Take care of possibly missing namespace prefixes. (newsticker--parse-generic-items): Code formatting. Typo. (newsticker--images-dir): Add trailing slash. (newsticker--image-get): Fix error message. * lisp/net/newst-plainview.el: Remove Time-stamp. * lisp/net/newst-reader.el: Remove Time-stamp. (newsticker-download-logos): Rename variable `newsticker--download-logos' to `newsticker-download-logos' and make it customizable. (newsticker--print-extra-elements): Add optional parameter 'htmlish for using html markup. Amend list of ignored elements. (newsticker--do-print-extra-element): Add parameter 'htmlish for using html markup. * lisp/net/newst-ticker.el: Remove Time-stamp. * lisp/net/newst-treeview.el (newsticker--treeview-item-show): Use html for formatting extra elements. * lisp/net/newsticker.el: Remove Time-stamp, Version. (newsticker-version): Make obsolete.
2014-10-01 17:20:00 +00:00
((or (eq 'RDF (xml-node-name topnode))
(eq 'rdf:RDF (xml-node-name topnode)))
Newsticker: Show feedicons in treeview. Small fix in opml export. * etc/images/newsticker/README: Add rss-feed.png, rss-feed.svg. * etc/images/newsticker/rss-feed.png: New. * etc/images/newsticker/rss-feed.svg: New. * lisp/net/newst-backend.el: Require url-parse. (newsticker--get-news-by-wget): Store feed name as process property. (newsticker--sentinel): Read feed name from process property. (newsticker--sentinel-work): Rename argument name to feed-name. Rename variable imageurl to image-url. Pick icon url from Atom 1.0 data. Launch download of feed icon. (newsticker--get-icon-url-atom-1.0): New. (newsticker--unxml) (newsticker--unxml-node) (newsticker--unxml-attribute): Documentation. (newsticker--icons-dir): New. (newsticker--image-get): New arguments FILENAME and DIRECTORY. Use `url-retrieve' if `newsticker-retrieval-method' is 'intern. (newsticker--image-download-by-wget): New. Use process properties for storing informations. (newsticker--image-sentinel): Read informations from process properties. (newsticker--image-save) (newsticker--image-remove) (newsticker--image-download-by-url) (newsticker--image-download-by-url-callback): New. (newsticker-opml-export): Handle url list entries containing a function instead of an url string. * lisp/net/newst-reader.el (newsticker-html-renderer): Whitespace. (newsticker--print-extra-elements) (newsticker--do-print-extra-element): Documentation (newsticker--image-read): Optionally limit image height. Use imagemagick if possible. (newsticker--icon-read): New. * lisp/net/newst-treeview.el (newsticker--treeview-item-show): Limit height of feed logo. (newsticker--treeview-tree-expand): Use feed icons in treeview. (newsticker--tree-widget-icon-create): New. Set the tree widget icon. (newsticker--tree-widget-leaf-icon): Use feed icon.
2014-10-19 16:50:15 +00:00
(setq image-url (newsticker--get-logo-url-rss-1.0 topnode))
(newsticker--parse-rss-1.0 feed-name time topnode))
2008-06-08 15:36:18 +00:00
;; RSS 2.0
((and (eq 'rss (xml-node-name topnode))
(string= "2.0" (xml-get-attribute topnode 'version)))
Newsticker: Show feedicons in treeview. Small fix in opml export. * etc/images/newsticker/README: Add rss-feed.png, rss-feed.svg. * etc/images/newsticker/rss-feed.png: New. * etc/images/newsticker/rss-feed.svg: New. * lisp/net/newst-backend.el: Require url-parse. (newsticker--get-news-by-wget): Store feed name as process property. (newsticker--sentinel): Read feed name from process property. (newsticker--sentinel-work): Rename argument name to feed-name. Rename variable imageurl to image-url. Pick icon url from Atom 1.0 data. Launch download of feed icon. (newsticker--get-icon-url-atom-1.0): New. (newsticker--unxml) (newsticker--unxml-node) (newsticker--unxml-attribute): Documentation. (newsticker--icons-dir): New. (newsticker--image-get): New arguments FILENAME and DIRECTORY. Use `url-retrieve' if `newsticker-retrieval-method' is 'intern. (newsticker--image-download-by-wget): New. Use process properties for storing informations. (newsticker--image-sentinel): Read informations from process properties. (newsticker--image-save) (newsticker--image-remove) (newsticker--image-download-by-url) (newsticker--image-download-by-url-callback): New. (newsticker-opml-export): Handle url list entries containing a function instead of an url string. * lisp/net/newst-reader.el (newsticker-html-renderer): Whitespace. (newsticker--print-extra-elements) (newsticker--do-print-extra-element): Documentation (newsticker--image-read): Optionally limit image height. Use imagemagick if possible. (newsticker--icon-read): New. * lisp/net/newst-treeview.el (newsticker--treeview-item-show): Limit height of feed logo. (newsticker--treeview-tree-expand): Use feed icons in treeview. (newsticker--tree-widget-icon-create): New. Set the tree widget icon. (newsticker--tree-widget-leaf-icon): Use feed icon.
2014-10-19 16:50:15 +00:00
(setq image-url (newsticker--get-logo-url-rss-2.0 topnode))
(newsticker--parse-rss-2.0 feed-name time topnode))
2008-06-08 15:36:18 +00:00
;; Atom 0.3
((and (eq 'feed (xml-node-name topnode))
(string= "http://purl.org/atom/ns#"
(xml-get-attribute topnode 'xmlns)))
Newsticker: Show feedicons in treeview. Small fix in opml export. * etc/images/newsticker/README: Add rss-feed.png, rss-feed.svg. * etc/images/newsticker/rss-feed.png: New. * etc/images/newsticker/rss-feed.svg: New. * lisp/net/newst-backend.el: Require url-parse. (newsticker--get-news-by-wget): Store feed name as process property. (newsticker--sentinel): Read feed name from process property. (newsticker--sentinel-work): Rename argument name to feed-name. Rename variable imageurl to image-url. Pick icon url from Atom 1.0 data. Launch download of feed icon. (newsticker--get-icon-url-atom-1.0): New. (newsticker--unxml) (newsticker--unxml-node) (newsticker--unxml-attribute): Documentation. (newsticker--icons-dir): New. (newsticker--image-get): New arguments FILENAME and DIRECTORY. Use `url-retrieve' if `newsticker-retrieval-method' is 'intern. (newsticker--image-download-by-wget): New. Use process properties for storing informations. (newsticker--image-sentinel): Read informations from process properties. (newsticker--image-save) (newsticker--image-remove) (newsticker--image-download-by-url) (newsticker--image-download-by-url-callback): New. (newsticker-opml-export): Handle url list entries containing a function instead of an url string. * lisp/net/newst-reader.el (newsticker-html-renderer): Whitespace. (newsticker--print-extra-elements) (newsticker--do-print-extra-element): Documentation (newsticker--image-read): Optionally limit image height. Use imagemagick if possible. (newsticker--icon-read): New. * lisp/net/newst-treeview.el (newsticker--treeview-item-show): Limit height of feed logo. (newsticker--treeview-tree-expand): Use feed icons in treeview. (newsticker--tree-widget-icon-create): New. Set the tree widget icon. (newsticker--tree-widget-leaf-icon): Use feed icon.
2014-10-19 16:50:15 +00:00
(setq image-url (newsticker--get-logo-url-atom-0.3 topnode))
(newsticker--parse-atom-0.3 feed-name time topnode))
2008-06-08 15:36:18 +00:00
;; Atom 1.0
Newsticker: Use libxml instead of `xml-parse-region'. Fix some glitches. Clean up. * lisp/net/newst-backend.el: Remove Time-stamp. Rename variable `newsticker--download-logos' to `newsticker-download-logos' and make it customizable. (newsticker--sentinel-work): Move xml-workarounds to function `newsticker--do-xml-workarounds', call unless libxml-parser is used. Allow single quote in regexp for encoding. Use libxml-parser if available, else fall back to `xml-parse-region'. Take care of possibly missing namespace prefixes (like "RDF" instead of "rdf:RDF") when checking xml nodes and attributes (as libxml correctly removes the prefixes). Always use Atom 1.0 as fallback feed type. Rename `newsticker--download-logos' to `newsticker-download-logos' (newsticker--unxml, newsticker--unxml-node) (newsticker--unxml-attribute): New. (newsticker--parse-atom-1.0): Call `unxml' in case that embedded HTML code has become part of the xml parse tree. (newsticker--parse-rss-1.0, newsticker--parse-rss-2.0): Take care of possibly missing namespace prefixes. (newsticker--parse-generic-items): Code formatting. Typo. (newsticker--images-dir): Add trailing slash. (newsticker--image-get): Fix error message. * lisp/net/newst-plainview.el: Remove Time-stamp. * lisp/net/newst-reader.el: Remove Time-stamp. (newsticker-download-logos): Rename variable `newsticker--download-logos' to `newsticker-download-logos' and make it customizable. (newsticker--print-extra-elements): Add optional parameter 'htmlish for using html markup. Amend list of ignored elements. (newsticker--do-print-extra-element): Add parameter 'htmlish for using html markup. * lisp/net/newst-ticker.el: Remove Time-stamp. * lisp/net/newst-treeview.el (newsticker--treeview-item-show): Use html for formatting extra elements. * lisp/net/newsticker.el: Remove Time-stamp, Version. (newsticker-version): Make obsolete.
2014-10-01 17:20:00 +00:00
(t
;; The test for Atom 1.0 does not work when using
;; libxml, as with libxml the namespace attribute is
;; not in the xml tree. For the time being we skip
;; the check and assume that we are dealing with an
;; Atom 1.0 feed.
;; (and (eq 'feed (xml-node-name topnode))
;; (string= "https://www.w3.org/2005/Atom"
Newsticker: Use libxml instead of `xml-parse-region'. Fix some glitches. Clean up. * lisp/net/newst-backend.el: Remove Time-stamp. Rename variable `newsticker--download-logos' to `newsticker-download-logos' and make it customizable. (newsticker--sentinel-work): Move xml-workarounds to function `newsticker--do-xml-workarounds', call unless libxml-parser is used. Allow single quote in regexp for encoding. Use libxml-parser if available, else fall back to `xml-parse-region'. Take care of possibly missing namespace prefixes (like "RDF" instead of "rdf:RDF") when checking xml nodes and attributes (as libxml correctly removes the prefixes). Always use Atom 1.0 as fallback feed type. Rename `newsticker--download-logos' to `newsticker-download-logos' (newsticker--unxml, newsticker--unxml-node) (newsticker--unxml-attribute): New. (newsticker--parse-atom-1.0): Call `unxml' in case that embedded HTML code has become part of the xml parse tree. (newsticker--parse-rss-1.0, newsticker--parse-rss-2.0): Take care of possibly missing namespace prefixes. (newsticker--parse-generic-items): Code formatting. Typo. (newsticker--images-dir): Add trailing slash. (newsticker--image-get): Fix error message. * lisp/net/newst-plainview.el: Remove Time-stamp. * lisp/net/newst-reader.el: Remove Time-stamp. (newsticker-download-logos): Rename variable `newsticker--download-logos' to `newsticker-download-logos' and make it customizable. (newsticker--print-extra-elements): Add optional parameter 'htmlish for using html markup. Amend list of ignored elements. (newsticker--do-print-extra-element): Add parameter 'htmlish for using html markup. * lisp/net/newst-ticker.el: Remove Time-stamp. * lisp/net/newst-treeview.el (newsticker--treeview-item-show): Use html for formatting extra elements. * lisp/net/newsticker.el: Remove Time-stamp, Version. (newsticker-version): Make obsolete.
2014-10-01 17:20:00 +00:00
;; (xml-get-attribute topnode 'xmlns)))
Newsticker: Show feedicons in treeview. Small fix in opml export. * etc/images/newsticker/README: Add rss-feed.png, rss-feed.svg. * etc/images/newsticker/rss-feed.png: New. * etc/images/newsticker/rss-feed.svg: New. * lisp/net/newst-backend.el: Require url-parse. (newsticker--get-news-by-wget): Store feed name as process property. (newsticker--sentinel): Read feed name from process property. (newsticker--sentinel-work): Rename argument name to feed-name. Rename variable imageurl to image-url. Pick icon url from Atom 1.0 data. Launch download of feed icon. (newsticker--get-icon-url-atom-1.0): New. (newsticker--unxml) (newsticker--unxml-node) (newsticker--unxml-attribute): Documentation. (newsticker--icons-dir): New. (newsticker--image-get): New arguments FILENAME and DIRECTORY. Use `url-retrieve' if `newsticker-retrieval-method' is 'intern. (newsticker--image-download-by-wget): New. Use process properties for storing informations. (newsticker--image-sentinel): Read informations from process properties. (newsticker--image-save) (newsticker--image-remove) (newsticker--image-download-by-url) (newsticker--image-download-by-url-callback): New. (newsticker-opml-export): Handle url list entries containing a function instead of an url string. * lisp/net/newst-reader.el (newsticker-html-renderer): Whitespace. (newsticker--print-extra-elements) (newsticker--do-print-extra-element): Documentation (newsticker--image-read): Optionally limit image height. Use imagemagick if possible. (newsticker--icon-read): New. * lisp/net/newst-treeview.el (newsticker--treeview-item-show): Limit height of feed logo. (newsticker--treeview-tree-expand): Use feed icons in treeview. (newsticker--tree-widget-icon-create): New. Set the tree widget icon. (newsticker--tree-widget-leaf-icon): Use feed icon.
2014-10-19 16:50:15 +00:00
(setq image-url (newsticker--get-logo-url-atom-1.0 topnode))
(setq icon-url (newsticker--get-icon-url-atom-1.0 topnode))
(newsticker--parse-atom-1.0 feed-name time topnode))
2008-06-08 15:36:18 +00:00
;; unknown feed type
Newsticker: Use libxml instead of `xml-parse-region'. Fix some glitches. Clean up. * lisp/net/newst-backend.el: Remove Time-stamp. Rename variable `newsticker--download-logos' to `newsticker-download-logos' and make it customizable. (newsticker--sentinel-work): Move xml-workarounds to function `newsticker--do-xml-workarounds', call unless libxml-parser is used. Allow single quote in regexp for encoding. Use libxml-parser if available, else fall back to `xml-parse-region'. Take care of possibly missing namespace prefixes (like "RDF" instead of "rdf:RDF") when checking xml nodes and attributes (as libxml correctly removes the prefixes). Always use Atom 1.0 as fallback feed type. Rename `newsticker--download-logos' to `newsticker-download-logos' (newsticker--unxml, newsticker--unxml-node) (newsticker--unxml-attribute): New. (newsticker--parse-atom-1.0): Call `unxml' in case that embedded HTML code has become part of the xml parse tree. (newsticker--parse-rss-1.0, newsticker--parse-rss-2.0): Take care of possibly missing namespace prefixes. (newsticker--parse-generic-items): Code formatting. Typo. (newsticker--images-dir): Add trailing slash. (newsticker--image-get): Fix error message. * lisp/net/newst-plainview.el: Remove Time-stamp. * lisp/net/newst-reader.el: Remove Time-stamp. (newsticker-download-logos): Rename variable `newsticker--download-logos' to `newsticker-download-logos' and make it customizable. (newsticker--print-extra-elements): Add optional parameter 'htmlish for using html markup. Amend list of ignored elements. (newsticker--do-print-extra-element): Add parameter 'htmlish for using html markup. * lisp/net/newst-ticker.el: Remove Time-stamp. * lisp/net/newst-treeview.el (newsticker--treeview-item-show): Use html for formatting extra elements. * lisp/net/newsticker.el: Remove Time-stamp, Version. (newsticker-version): Make obsolete.
2014-10-01 17:20:00 +00:00
;; (t
;; (newsticker--debug-msg "Feed type unknown: %s: %s"
Newsticker: Show feedicons in treeview. Small fix in opml export. * etc/images/newsticker/README: Add rss-feed.png, rss-feed.svg. * etc/images/newsticker/rss-feed.png: New. * etc/images/newsticker/rss-feed.svg: New. * lisp/net/newst-backend.el: Require url-parse. (newsticker--get-news-by-wget): Store feed name as process property. (newsticker--sentinel): Read feed name from process property. (newsticker--sentinel-work): Rename argument name to feed-name. Rename variable imageurl to image-url. Pick icon url from Atom 1.0 data. Launch download of feed icon. (newsticker--get-icon-url-atom-1.0): New. (newsticker--unxml) (newsticker--unxml-node) (newsticker--unxml-attribute): Documentation. (newsticker--icons-dir): New. (newsticker--image-get): New arguments FILENAME and DIRECTORY. Use `url-retrieve' if `newsticker-retrieval-method' is 'intern. (newsticker--image-download-by-wget): New. Use process properties for storing informations. (newsticker--image-sentinel): Read informations from process properties. (newsticker--image-save) (newsticker--image-remove) (newsticker--image-download-by-url) (newsticker--image-download-by-url-callback): New. (newsticker-opml-export): Handle url list entries containing a function instead of an url string. * lisp/net/newst-reader.el (newsticker-html-renderer): Whitespace. (newsticker--print-extra-elements) (newsticker--do-print-extra-element): Documentation (newsticker--image-read): Optionally limit image height. Use imagemagick if possible. (newsticker--icon-read): New. * lisp/net/newst-treeview.el (newsticker--treeview-item-show): Limit height of feed logo. (newsticker--treeview-tree-expand): Use feed icons in treeview. (newsticker--tree-widget-icon-create): New. Set the tree widget icon. (newsticker--tree-widget-leaf-icon): Use feed icon.
2014-10-19 16:50:15 +00:00
;; (xml-node-name topnode) feed-name)
Newsticker: Use libxml instead of `xml-parse-region'. Fix some glitches. Clean up. * lisp/net/newst-backend.el: Remove Time-stamp. Rename variable `newsticker--download-logos' to `newsticker-download-logos' and make it customizable. (newsticker--sentinel-work): Move xml-workarounds to function `newsticker--do-xml-workarounds', call unless libxml-parser is used. Allow single quote in regexp for encoding. Use libxml-parser if available, else fall back to `xml-parse-region'. Take care of possibly missing namespace prefixes (like "RDF" instead of "rdf:RDF") when checking xml nodes and attributes (as libxml correctly removes the prefixes). Always use Atom 1.0 as fallback feed type. Rename `newsticker--download-logos' to `newsticker-download-logos' (newsticker--unxml, newsticker--unxml-node) (newsticker--unxml-attribute): New. (newsticker--parse-atom-1.0): Call `unxml' in case that embedded HTML code has become part of the xml parse tree. (newsticker--parse-rss-1.0, newsticker--parse-rss-2.0): Take care of possibly missing namespace prefixes. (newsticker--parse-generic-items): Code formatting. Typo. (newsticker--images-dir): Add trailing slash. (newsticker--image-get): Fix error message. * lisp/net/newst-plainview.el: Remove Time-stamp. * lisp/net/newst-reader.el: Remove Time-stamp. (newsticker-download-logos): Rename variable `newsticker--download-logos' to `newsticker-download-logos' and make it customizable. (newsticker--print-extra-elements): Add optional parameter 'htmlish for using html markup. Amend list of ignored elements. (newsticker--do-print-extra-element): Add parameter 'htmlish for using html markup. * lisp/net/newst-ticker.el: Remove Time-stamp. * lisp/net/newst-treeview.el (newsticker--treeview-item-show): Use html for formatting extra elements. * lisp/net/newsticker.el: Remove Time-stamp, Version. (newsticker-version): Make obsolete.
2014-10-01 17:20:00 +00:00
;; nil)
)
2008-06-08 15:36:18 +00:00
(setq something-was-added t))
Newsticker: Show feedicons in treeview. Small fix in opml export. * etc/images/newsticker/README: Add rss-feed.png, rss-feed.svg. * etc/images/newsticker/rss-feed.png: New. * etc/images/newsticker/rss-feed.svg: New. * lisp/net/newst-backend.el: Require url-parse. (newsticker--get-news-by-wget): Store feed name as process property. (newsticker--sentinel): Read feed name from process property. (newsticker--sentinel-work): Rename argument name to feed-name. Rename variable imageurl to image-url. Pick icon url from Atom 1.0 data. Launch download of feed icon. (newsticker--get-icon-url-atom-1.0): New. (newsticker--unxml) (newsticker--unxml-node) (newsticker--unxml-attribute): Documentation. (newsticker--icons-dir): New. (newsticker--image-get): New arguments FILENAME and DIRECTORY. Use `url-retrieve' if `newsticker-retrieval-method' is 'intern. (newsticker--image-download-by-wget): New. Use process properties for storing informations. (newsticker--image-sentinel): Read informations from process properties. (newsticker--image-save) (newsticker--image-remove) (newsticker--image-download-by-url) (newsticker--image-download-by-url-callback): New. (newsticker-opml-export): Handle url list entries containing a function instead of an url string. * lisp/net/newst-reader.el (newsticker-html-renderer): Whitespace. (newsticker--print-extra-elements) (newsticker--do-print-extra-element): Documentation (newsticker--image-read): Optionally limit image height. Use imagemagick if possible. (newsticker--icon-read): New. * lisp/net/newst-treeview.el (newsticker--treeview-item-show): Limit height of feed logo. (newsticker--treeview-tree-expand): Use feed icons in treeview. (newsticker--tree-widget-icon-create): New. Set the tree widget icon. (newsticker--tree-widget-leaf-icon): Use feed icon.
2014-10-19 16:50:15 +00:00
(error (message "sentinelerror in %s: %s" feed-name error-data)))
2008-06-08 15:36:18 +00:00
;; Remove those old items from cache which have been removed from
;; the feed
(newsticker--cache-replace-age newsticker--cache
name-symbol 'obsolete-old 'deleteme)
(newsticker--cache-remove newsticker--cache name-symbol
'deleteme)
;; Remove those new items from cache which have been removed from
;; the feed. Or keep them as `obsolete'
(if (not newsticker-keep-obsolete-items)
(newsticker--cache-remove newsticker--cache
name-symbol 'obsolete-new)
(setq newsticker--cache
(newsticker--cache-mark-expired
newsticker--cache name-symbol 'obsolete 'obsolete-expired
newsticker-obsolete-item-max-age))
(newsticker--cache-remove newsticker--cache
name-symbol 'obsolete-expired)
(newsticker--cache-replace-age newsticker--cache
name-symbol 'obsolete-new
'obsolete))
(newsticker--update-process-ids)
;; setup scrollable text
(when (= 0 (length newsticker--process-ids))
(when (fboundp 'newsticker--ticker-text-setup) ;silence
;compiler
;warnings
2008-06-08 15:36:18 +00:00
(newsticker--ticker-text-setup)))
(setq newsticker--latest-update-time (current-time))
(when something-was-added
;; FIXME: should we care about removed items as well?
2008-11-24 19:40:35 +00:00
(newsticker--cache-save-feed
(newsticker--cache-get-feed name-symbol))
2008-06-08 15:36:18 +00:00
(when (fboundp 'newsticker--buffer-set-uptodate) ;silence
;compiler
;warnings
2008-06-08 15:36:18 +00:00
(newsticker--buffer-set-uptodate nil)))
;; kill the process buffer if wanted
(unless newsticker-debug
(kill-buffer buffer))
Newsticker: Show feedicons in treeview. Small fix in opml export. * etc/images/newsticker/README: Add rss-feed.png, rss-feed.svg. * etc/images/newsticker/rss-feed.png: New. * etc/images/newsticker/rss-feed.svg: New. * lisp/net/newst-backend.el: Require url-parse. (newsticker--get-news-by-wget): Store feed name as process property. (newsticker--sentinel): Read feed name from process property. (newsticker--sentinel-work): Rename argument name to feed-name. Rename variable imageurl to image-url. Pick icon url from Atom 1.0 data. Launch download of feed icon. (newsticker--get-icon-url-atom-1.0): New. (newsticker--unxml) (newsticker--unxml-node) (newsticker--unxml-attribute): Documentation. (newsticker--icons-dir): New. (newsticker--image-get): New arguments FILENAME and DIRECTORY. Use `url-retrieve' if `newsticker-retrieval-method' is 'intern. (newsticker--image-download-by-wget): New. Use process properties for storing informations. (newsticker--image-sentinel): Read informations from process properties. (newsticker--image-save) (newsticker--image-remove) (newsticker--image-download-by-url) (newsticker--image-download-by-url-callback): New. (newsticker-opml-export): Handle url list entries containing a function instead of an url string. * lisp/net/newst-reader.el (newsticker-html-renderer): Whitespace. (newsticker--print-extra-elements) (newsticker--do-print-extra-element): Documentation (newsticker--image-read): Optionally limit image height. Use imagemagick if possible. (newsticker--icon-read): New. * lisp/net/newst-treeview.el (newsticker--treeview-item-show): Limit height of feed logo. (newsticker--treeview-tree-expand): Use feed icons in treeview. (newsticker--tree-widget-icon-create): New. Set the tree widget icon. (newsticker--tree-widget-leaf-icon): Use feed icon.
2014-10-19 16:50:15 +00:00
;; launch retrieval of images
(when (and (boundp 'newsticker-download-logos)
Newsticker: Use libxml instead of `xml-parse-region'. Fix some glitches. Clean up. * lisp/net/newst-backend.el: Remove Time-stamp. Rename variable `newsticker--download-logos' to `newsticker-download-logos' and make it customizable. (newsticker--sentinel-work): Move xml-workarounds to function `newsticker--do-xml-workarounds', call unless libxml-parser is used. Allow single quote in regexp for encoding. Use libxml-parser if available, else fall back to `xml-parse-region'. Take care of possibly missing namespace prefixes (like "RDF" instead of "rdf:RDF") when checking xml nodes and attributes (as libxml correctly removes the prefixes). Always use Atom 1.0 as fallback feed type. Rename `newsticker--download-logos' to `newsticker-download-logos' (newsticker--unxml, newsticker--unxml-node) (newsticker--unxml-attribute): New. (newsticker--parse-atom-1.0): Call `unxml' in case that embedded HTML code has become part of the xml parse tree. (newsticker--parse-rss-1.0, newsticker--parse-rss-2.0): Take care of possibly missing namespace prefixes. (newsticker--parse-generic-items): Code formatting. Typo. (newsticker--images-dir): Add trailing slash. (newsticker--image-get): Fix error message. * lisp/net/newst-plainview.el: Remove Time-stamp. * lisp/net/newst-reader.el: Remove Time-stamp. (newsticker-download-logos): Rename variable `newsticker--download-logos' to `newsticker-download-logos' and make it customizable. (newsticker--print-extra-elements): Add optional parameter 'htmlish for using html markup. Amend list of ignored elements. (newsticker--do-print-extra-element): Add parameter 'htmlish for using html markup. * lisp/net/newst-ticker.el: Remove Time-stamp. * lisp/net/newst-treeview.el (newsticker--treeview-item-show): Use html for formatting extra elements. * lisp/net/newsticker.el: Remove Time-stamp, Version. (newsticker-version): Make obsolete.
2014-10-01 17:20:00 +00:00
newsticker-download-logos)
Newsticker: Show feedicons in treeview. Small fix in opml export. * etc/images/newsticker/README: Add rss-feed.png, rss-feed.svg. * etc/images/newsticker/rss-feed.png: New. * etc/images/newsticker/rss-feed.svg: New. * lisp/net/newst-backend.el: Require url-parse. (newsticker--get-news-by-wget): Store feed name as process property. (newsticker--sentinel): Read feed name from process property. (newsticker--sentinel-work): Rename argument name to feed-name. Rename variable imageurl to image-url. Pick icon url from Atom 1.0 data. Launch download of feed icon. (newsticker--get-icon-url-atom-1.0): New. (newsticker--unxml) (newsticker--unxml-node) (newsticker--unxml-attribute): Documentation. (newsticker--icons-dir): New. (newsticker--image-get): New arguments FILENAME and DIRECTORY. Use `url-retrieve' if `newsticker-retrieval-method' is 'intern. (newsticker--image-download-by-wget): New. Use process properties for storing informations. (newsticker--image-sentinel): Read informations from process properties. (newsticker--image-save) (newsticker--image-remove) (newsticker--image-download-by-url) (newsticker--image-download-by-url-callback): New. (newsticker-opml-export): Handle url list entries containing a function instead of an url string. * lisp/net/newst-reader.el (newsticker-html-renderer): Whitespace. (newsticker--print-extra-elements) (newsticker--do-print-extra-element): Documentation (newsticker--image-read): Optionally limit image height. Use imagemagick if possible. (newsticker--icon-read): New. * lisp/net/newst-treeview.el (newsticker--treeview-item-show): Limit height of feed logo. (newsticker--treeview-tree-expand): Use feed icons in treeview. (newsticker--tree-widget-icon-create): New. Set the tree widget icon. (newsticker--tree-widget-leaf-icon): Use feed icon.
2014-10-19 16:50:15 +00:00
;; feed logo
(when image-url
(newsticker--image-get feed-name feed-name (newsticker--images-dir)
image-url))
;; icon / favicon
(setq icon-url
(or icon-url
(let* ((feed-url (newsticker--link (cadr (newsticker--cache-get-feed
(intern feed-name)))))
(uri (url-generic-parse-url feed-url)))
(when (and feed-url uri)
(setf (url-filename uri) nil)
(setf (url-target uri) nil)
(concat (url-recreate-url uri) "favicon.ico")))))
(when icon-url
(newsticker--image-get feed-name
(concat feed-name "."
(file-name-extension icon-url))
(newsticker--icons-dir)
icon-url))))))
2008-06-08 15:36:18 +00:00
(when newsticker--sentinel-callback
(funcall newsticker--sentinel-callback)))
Newsticker: Use libxml instead of `xml-parse-region'. Fix some glitches. Clean up. * lisp/net/newst-backend.el: Remove Time-stamp. Rename variable `newsticker--download-logos' to `newsticker-download-logos' and make it customizable. (newsticker--sentinel-work): Move xml-workarounds to function `newsticker--do-xml-workarounds', call unless libxml-parser is used. Allow single quote in regexp for encoding. Use libxml-parser if available, else fall back to `xml-parse-region'. Take care of possibly missing namespace prefixes (like "RDF" instead of "rdf:RDF") when checking xml nodes and attributes (as libxml correctly removes the prefixes). Always use Atom 1.0 as fallback feed type. Rename `newsticker--download-logos' to `newsticker-download-logos' (newsticker--unxml, newsticker--unxml-node) (newsticker--unxml-attribute): New. (newsticker--parse-atom-1.0): Call `unxml' in case that embedded HTML code has become part of the xml parse tree. (newsticker--parse-rss-1.0, newsticker--parse-rss-2.0): Take care of possibly missing namespace prefixes. (newsticker--parse-generic-items): Code formatting. Typo. (newsticker--images-dir): Add trailing slash. (newsticker--image-get): Fix error message. * lisp/net/newst-plainview.el: Remove Time-stamp. * lisp/net/newst-reader.el: Remove Time-stamp. (newsticker-download-logos): Rename variable `newsticker--download-logos' to `newsticker-download-logos' and make it customizable. (newsticker--print-extra-elements): Add optional parameter 'htmlish for using html markup. Amend list of ignored elements. (newsticker--do-print-extra-element): Add parameter 'htmlish for using html markup. * lisp/net/newst-ticker.el: Remove Time-stamp. * lisp/net/newst-treeview.el (newsticker--treeview-item-show): Use html for formatting extra elements. * lisp/net/newsticker.el: Remove Time-stamp, Version. (newsticker-version): Make obsolete.
2014-10-01 17:20:00 +00:00
(defun newsticker--do-xml-workarounds ()
"Fix all issues which `xml-parse-region' could be choking on."
Simplify use of current-time and friends. * doc/misc/org.texi (Dynamic blocks): * lisp/allout-widgets.el (allout-widgets-hook-error-handler): * lisp/calendar/appt.el (appt-display-message): * lisp/calendar/icalendar.el (icalendar--convert-float-to-ical): * lisp/calendar/timeclock.el (timeclock-in, timeclock-when-to-leave) (timeclock-last-period, timeclock-day-base): * lisp/eshell/em-ls.el (eshell-ls-file): * lisp/eshell/esh-util.el (eshell-parse-ange-ls): * lisp/generic-x.el (named-database-print-serial): * lisp/net/newst-backend.el (newsticker--get-news-by-url-callback) (newsticker-get-news, newsticker--sentinel-work) (newsticker--image-get, newsticker--image-sentinel): * lisp/net/tramp-sh.el (tramp-get-remote-touch): * lisp/progmodes/opascal.el (opascal-debug-log): * lisp/textmodes/remember.el (remember-mail-date) (remember-store-in-files): * lisp/vc/vc-annotate.el (vc-annotate-display-autoscale) (vc-default-annotate-current-time): * lisp/vc/vc-bzr.el (vc-bzr-shelve-snapshot): * lisp/vc/vc-cvs.el (vc-cvs-annotate-current-time): * lisp/vc/vc-rcs.el (vc-rcs-annotate-current-time): * lisp/url/url-util.el (url-get-normalized-date): * lisp/erc/erc-backend.el (TOPIC): * lisp/gnus/gnus-delay.el (gnus-delay-article): * lisp/gnus/gnus-sum.el (gnus-summary-read-document): * lisp/gnus/gnus-util.el (gnus-seconds-today, gnus-seconds-month): * lisp/gnus/message.el (message-make-expires-date): * lisp/org/org-archive.el (org-archive-subtree) (org-archive-to-archive-sibling): * lisp/org/org-clock.el (org-resolve-clocks, org-clock-get-sum-start) (org-clock-special-range): * lisp/org/org-timer.el (org-timer-seconds): * lisp/org/org.el (org-read-date-analyze, org-get-cursor-date): * lisp/org/ox-html.el (org-html-format-spec): * lisp/org/ox-icalendar.el (org-icalendar--vtodo): Omit unnecessary call to current-time. * lisp/calendar/time-date.el (time-to-seconds) [!float-time]: * lisp/calendar/timeclock.el (timeclock-time-to-date): * lisp/vc/vc-annotate.el (vc-annotate-convert-time): Use current time if arg is nil, to be compatible with float-time. (time-date--day-in-year): New function, with most of the guts of the old time-to-day-in-year. (time-to-day-in-year): Use it. (time-to-days): Use it, to avoid decoding the same time stamp twice. * lisp/calendar/timeclock.el (timeclock-update-mode-line): * lisp/cedet/srecode/args.el (srecode-semantic-handle-:time): * lisp/gnus/gnus-util.el (gnus-seconds-year): * lisp/org/org.el (org-get-cursor-date): Don't call current-time twice to get the current time stamp, as this can lead to inconsistent results. * lisp/completion.el (cmpl-hours-since-origin): * lisp/erc/erc.el (erc-emacs-time-to-erc-time): * lisp/ido.el (ido-time-stamp): * lisp/vc/vc-annotate.el (vc-annotate-convert-time): Simplify by using float-time. * lisp/completion.el (save-completions-to-file): * lisp/url/url-cache.el (url-cache-prune-cache): Rename local var to avoid confusion. * lisp/gnus/gnus-util.el (gnus-float-time): * lisp/net/rcirc.el (rcirc-float-time): * lisp/org/org-compat.el (org-float-time): Simplify to an alias because time-to-seconds now behaves like float-time with respect to nil arg. * lisp/subr.el (progress-reporter-do-update): Don't call float-time unless needed. * lisp/erc/erc.el (erc-current-time): Simplify by using erc-emacs-time-to-erc-time. * lisp/org/org-clock.el (org-clock-get-table-data): Omit unnecessary, lossy conversion from floating point to Emacs time and back. (org-resolve-clocks): Prefer two-argument floor.
2014-10-29 01:42:51 +00:00
Newsticker: Use libxml instead of `xml-parse-region'. Fix some glitches. Clean up. * lisp/net/newst-backend.el: Remove Time-stamp. Rename variable `newsticker--download-logos' to `newsticker-download-logos' and make it customizable. (newsticker--sentinel-work): Move xml-workarounds to function `newsticker--do-xml-workarounds', call unless libxml-parser is used. Allow single quote in regexp for encoding. Use libxml-parser if available, else fall back to `xml-parse-region'. Take care of possibly missing namespace prefixes (like "RDF" instead of "rdf:RDF") when checking xml nodes and attributes (as libxml correctly removes the prefixes). Always use Atom 1.0 as fallback feed type. Rename `newsticker--download-logos' to `newsticker-download-logos' (newsticker--unxml, newsticker--unxml-node) (newsticker--unxml-attribute): New. (newsticker--parse-atom-1.0): Call `unxml' in case that embedded HTML code has become part of the xml parse tree. (newsticker--parse-rss-1.0, newsticker--parse-rss-2.0): Take care of possibly missing namespace prefixes. (newsticker--parse-generic-items): Code formatting. Typo. (newsticker--images-dir): Add trailing slash. (newsticker--image-get): Fix error message. * lisp/net/newst-plainview.el: Remove Time-stamp. * lisp/net/newst-reader.el: Remove Time-stamp. (newsticker-download-logos): Rename variable `newsticker--download-logos' to `newsticker-download-logos' and make it customizable. (newsticker--print-extra-elements): Add optional parameter 'htmlish for using html markup. Amend list of ignored elements. (newsticker--do-print-extra-element): Add parameter 'htmlish for using html markup. * lisp/net/newst-ticker.el: Remove Time-stamp. * lisp/net/newst-treeview.el (newsticker--treeview-item-show): Use html for formatting extra elements. * lisp/net/newsticker.el: Remove Time-stamp, Version. (newsticker-version): Make obsolete.
2014-10-01 17:20:00 +00:00
;; a very very dirty workaround to overcome the
;; problems with the newest (20030621) xml.el:
;; remove all unnecessary whitespace
(goto-char (point-min))
(while (re-search-forward ">[ \t\r\n]+<" nil t)
(replace-match "><" nil t))
;; and another brutal workaround (20031105)! For some
;; reason the xml parser does not like the colon in the
;; doctype name "rdf:RDF"
(goto-char (point-min))
(if (re-search-forward "<!DOCTYPE[ \t\n]+rdf:RDF" nil t)
(replace-match "<!DOCTYPE rdfColonRDF" nil t))
;; finally.... ~##^°!!!!!
(goto-char (point-min))
(while (search-forward "\r\n" nil t)
(replace-match "\n" nil t))
;; still more brutal workarounds (20040309)! The xml
;; parser does not like doctype rss
(goto-char (point-min))
(if (re-search-forward "<!DOCTYPE[ \t\n]+rss[ \t\n]*>" nil t)
(replace-match "" nil t))
;; And another one (20050618)! (Fixed in GNU Emacs 22.0.50.18)
;; Remove comments to avoid this xml-parsing bug:
;; "XML files can have only one toplevel tag"
(goto-char (point-min))
(while (search-forward "<!--" nil t)
(let ((start (match-beginning 0)))
(unless (search-forward "-->" nil t)
(error "Can't find end of comment"))
(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
2021-03-24 08:28:32 +00:00
;; https://www.thefreedictionary.com/_/WoD/rss.aspx?type=quote
Newsticker: Use libxml instead of `xml-parse-region'. Fix some glitches. Clean up. * lisp/net/newst-backend.el: Remove Time-stamp. Rename variable `newsticker--download-logos' to `newsticker-download-logos' and make it customizable. (newsticker--sentinel-work): Move xml-workarounds to function `newsticker--do-xml-workarounds', call unless libxml-parser is used. Allow single quote in regexp for encoding. Use libxml-parser if available, else fall back to `xml-parse-region'. Take care of possibly missing namespace prefixes (like "RDF" instead of "rdf:RDF") when checking xml nodes and attributes (as libxml correctly removes the prefixes). Always use Atom 1.0 as fallback feed type. Rename `newsticker--download-logos' to `newsticker-download-logos' (newsticker--unxml, newsticker--unxml-node) (newsticker--unxml-attribute): New. (newsticker--parse-atom-1.0): Call `unxml' in case that embedded HTML code has become part of the xml parse tree. (newsticker--parse-rss-1.0, newsticker--parse-rss-2.0): Take care of possibly missing namespace prefixes. (newsticker--parse-generic-items): Code formatting. Typo. (newsticker--images-dir): Add trailing slash. (newsticker--image-get): Fix error message. * lisp/net/newst-plainview.el: Remove Time-stamp. * lisp/net/newst-reader.el: Remove Time-stamp. (newsticker-download-logos): Rename variable `newsticker--download-logos' to `newsticker-download-logos' and make it customizable. (newsticker--print-extra-elements): Add optional parameter 'htmlish for using html markup. Amend list of ignored elements. (newsticker--do-print-extra-element): Add parameter 'htmlish for using html markup. * lisp/net/newst-ticker.el: Remove Time-stamp. * lisp/net/newst-treeview.el (newsticker--treeview-item-show): Use html for formatting extra elements. * lisp/net/newsticker.el: Remove Time-stamp, Version. (newsticker-version): Make obsolete.
2014-10-01 17:20:00 +00:00
(goto-char (point-min))
(while (re-search-forward
"<description>\\(<img.*?\\)</description>" nil t)
(replace-match
"<description><![CDATA[ \\1 ]]></description>"))
;; And another one (20051123)! XML parser does not
;; like this: <yweather:location city="Frankfurt/Main"
;; region="" country="GM" />
;; try to "fix" empty attributes
;; This happened for
;; http://xml.weather.yahoo.com/forecastrss?p=GMXX0040&u=f
(goto-char (point-min))
(while (re-search-forward "\\(<[^>]*\\)=\"\"" nil t)
(replace-match "\\1=\" \""))
;;
(set-buffer-modified-p nil))
2008-06-08 15:36:18 +00:00
(defun newsticker--get-logo-url-atom-1.0 (node)
"Return logo URL from atom 1.0 data in NODE."
(car (xml-node-children
(car (xml-get-children node 'logo)))))
Newsticker: Show feedicons in treeview. Small fix in opml export. * etc/images/newsticker/README: Add rss-feed.png, rss-feed.svg. * etc/images/newsticker/rss-feed.png: New. * etc/images/newsticker/rss-feed.svg: New. * lisp/net/newst-backend.el: Require url-parse. (newsticker--get-news-by-wget): Store feed name as process property. (newsticker--sentinel): Read feed name from process property. (newsticker--sentinel-work): Rename argument name to feed-name. Rename variable imageurl to image-url. Pick icon url from Atom 1.0 data. Launch download of feed icon. (newsticker--get-icon-url-atom-1.0): New. (newsticker--unxml) (newsticker--unxml-node) (newsticker--unxml-attribute): Documentation. (newsticker--icons-dir): New. (newsticker--image-get): New arguments FILENAME and DIRECTORY. Use `url-retrieve' if `newsticker-retrieval-method' is 'intern. (newsticker--image-download-by-wget): New. Use process properties for storing informations. (newsticker--image-sentinel): Read informations from process properties. (newsticker--image-save) (newsticker--image-remove) (newsticker--image-download-by-url) (newsticker--image-download-by-url-callback): New. (newsticker-opml-export): Handle url list entries containing a function instead of an url string. * lisp/net/newst-reader.el (newsticker-html-renderer): Whitespace. (newsticker--print-extra-elements) (newsticker--do-print-extra-element): Documentation (newsticker--image-read): Optionally limit image height. Use imagemagick if possible. (newsticker--icon-read): New. * lisp/net/newst-treeview.el (newsticker--treeview-item-show): Limit height of feed logo. (newsticker--treeview-tree-expand): Use feed icons in treeview. (newsticker--tree-widget-icon-create): New. Set the tree widget icon. (newsticker--tree-widget-leaf-icon): Use feed icon.
2014-10-19 16:50:15 +00:00
(defun newsticker--get-icon-url-atom-1.0 (node)
"Return icon URL from atom 1.0 data in NODE."
(car (xml-node-children
(car (xml-get-children node 'icon)))))
2008-06-08 15:36:18 +00:00
(defun newsticker--get-logo-url-atom-0.3 (node)
"Return logo URL from atom 0.3 data in NODE."
(car (xml-node-children
(car (xml-get-children (car (xml-get-children node 'image)) 'url)))))
(defun newsticker--get-logo-url-rss-2.0 (node)
"Return logo URL from RSS 2.0 data in NODE."
(car (xml-node-children
(car (xml-get-children
(car (xml-get-children
(car (xml-get-children node 'channel)) 'image)) 'url)))))
(defun newsticker--get-logo-url-rss-1.0 (node)
"Return logo URL from RSS 1.0 data in NODE."
(car (xml-node-children
(car (xml-get-children (car (xml-get-children node 'image)) 'url)))))
(defun newsticker--get-logo-url-rss-0.92 (node)
"Return logo URL from RSS 0.92 data in NODE."
(car (xml-node-children
(car (xml-get-children (car (xml-get-children node 'image)) 'url)))))
(defun newsticker--get-logo-url-rss-0.91 (node)
"Return logo URL from RSS 0.91 data in NODE."
(car (xml-node-children
(car (xml-get-children (car (xml-get-children node 'image)) 'url)))))
(defun newsticker--parse-atom-0.3 (name time topnode)
"Parse Atom 0.3 data.
Return value as well as arguments NAME, TIME, and TOPNODE are the
same as in `newsticker--parse-atom-1.0'."
(newsticker--debug-msg "Parsing Atom 0.3 feed %s" name)
(let (new-feed new-item)
(setq new-feed (newsticker--parse-generic-feed
name time
;; title
(car (xml-node-children
(car (xml-get-children topnode 'title))))
;; desc
(car (xml-node-children
(car (xml-get-children topnode 'content))))
;; link
(xml-get-attribute
(car (xml-get-children topnode 'link)) 'href)
;; extra-elements
(xml-node-children topnode)))
(setq new-item (newsticker--parse-generic-items
name time (xml-get-children topnode 'entry)
;; title-fn
(lambda (node)
(car (xml-node-children
(car (xml-get-children node 'title)))))
;; desc-fn
(lambda (node)
(or (car (xml-node-children
(car (xml-get-children node 'content))))
(car (xml-node-children
(car (xml-get-children node 'summary))))))
;; link-fn
(lambda (node)
(xml-get-attribute
(car (xml-get-children node 'link)) 'href))
;; time-fn
(lambda (node)
(newsticker--decode-rfc822-date
(car (xml-node-children
(car (xml-get-children node 'modified))))))
2008-06-08 15:36:18 +00:00
;; guid-fn
(lambda (node)
(newsticker--guid-to-string
(assoc 'guid (xml-node-children node))))
;; extra-fn
(lambda (node)
(xml-node-children node))))
(or new-item new-feed)))
Newsticker: Use libxml instead of `xml-parse-region'. Fix some glitches. Clean up. * lisp/net/newst-backend.el: Remove Time-stamp. Rename variable `newsticker--download-logos' to `newsticker-download-logos' and make it customizable. (newsticker--sentinel-work): Move xml-workarounds to function `newsticker--do-xml-workarounds', call unless libxml-parser is used. Allow single quote in regexp for encoding. Use libxml-parser if available, else fall back to `xml-parse-region'. Take care of possibly missing namespace prefixes (like "RDF" instead of "rdf:RDF") when checking xml nodes and attributes (as libxml correctly removes the prefixes). Always use Atom 1.0 as fallback feed type. Rename `newsticker--download-logos' to `newsticker-download-logos' (newsticker--unxml, newsticker--unxml-node) (newsticker--unxml-attribute): New. (newsticker--parse-atom-1.0): Call `unxml' in case that embedded HTML code has become part of the xml parse tree. (newsticker--parse-rss-1.0, newsticker--parse-rss-2.0): Take care of possibly missing namespace prefixes. (newsticker--parse-generic-items): Code formatting. Typo. (newsticker--images-dir): Add trailing slash. (newsticker--image-get): Fix error message. * lisp/net/newst-plainview.el: Remove Time-stamp. * lisp/net/newst-reader.el: Remove Time-stamp. (newsticker-download-logos): Rename variable `newsticker--download-logos' to `newsticker-download-logos' and make it customizable. (newsticker--print-extra-elements): Add optional parameter 'htmlish for using html markup. Amend list of ignored elements. (newsticker--do-print-extra-element): Add parameter 'htmlish for using html markup. * lisp/net/newst-ticker.el: Remove Time-stamp. * lisp/net/newst-treeview.el (newsticker--treeview-item-show): Use html for formatting extra elements. * lisp/net/newsticker.el: Remove Time-stamp, Version. (newsticker-version): Make obsolete.
2014-10-01 17:20:00 +00:00
(defun newsticker--unxml (node)
"Reverse parsing of an xml string.
Newsticker: Show feedicons in treeview. Small fix in opml export. * etc/images/newsticker/README: Add rss-feed.png, rss-feed.svg. * etc/images/newsticker/rss-feed.png: New. * etc/images/newsticker/rss-feed.svg: New. * lisp/net/newst-backend.el: Require url-parse. (newsticker--get-news-by-wget): Store feed name as process property. (newsticker--sentinel): Read feed name from process property. (newsticker--sentinel-work): Rename argument name to feed-name. Rename variable imageurl to image-url. Pick icon url from Atom 1.0 data. Launch download of feed icon. (newsticker--get-icon-url-atom-1.0): New. (newsticker--unxml) (newsticker--unxml-node) (newsticker--unxml-attribute): Documentation. (newsticker--icons-dir): New. (newsticker--image-get): New arguments FILENAME and DIRECTORY. Use `url-retrieve' if `newsticker-retrieval-method' is 'intern. (newsticker--image-download-by-wget): New. Use process properties for storing informations. (newsticker--image-sentinel): Read informations from process properties. (newsticker--image-save) (newsticker--image-remove) (newsticker--image-download-by-url) (newsticker--image-download-by-url-callback): New. (newsticker-opml-export): Handle url list entries containing a function instead of an url string. * lisp/net/newst-reader.el (newsticker-html-renderer): Whitespace. (newsticker--print-extra-elements) (newsticker--do-print-extra-element): Documentation (newsticker--image-read): Optionally limit image height. Use imagemagick if possible. (newsticker--icon-read): New. * lisp/net/newst-treeview.el (newsticker--treeview-item-show): Limit height of feed logo. (newsticker--treeview-tree-expand): Use feed icons in treeview. (newsticker--tree-widget-icon-create): New. Set the tree widget icon. (newsticker--tree-widget-leaf-icon): Use feed icon.
2014-10-19 16:50:15 +00:00
Restore an xml-string from a an xml NODE that was returned by xml-parse..."
Newsticker: Use libxml instead of `xml-parse-region'. Fix some glitches. Clean up. * lisp/net/newst-backend.el: Remove Time-stamp. Rename variable `newsticker--download-logos' to `newsticker-download-logos' and make it customizable. (newsticker--sentinel-work): Move xml-workarounds to function `newsticker--do-xml-workarounds', call unless libxml-parser is used. Allow single quote in regexp for encoding. Use libxml-parser if available, else fall back to `xml-parse-region'. Take care of possibly missing namespace prefixes (like "RDF" instead of "rdf:RDF") when checking xml nodes and attributes (as libxml correctly removes the prefixes). Always use Atom 1.0 as fallback feed type. Rename `newsticker--download-logos' to `newsticker-download-logos' (newsticker--unxml, newsticker--unxml-node) (newsticker--unxml-attribute): New. (newsticker--parse-atom-1.0): Call `unxml' in case that embedded HTML code has become part of the xml parse tree. (newsticker--parse-rss-1.0, newsticker--parse-rss-2.0): Take care of possibly missing namespace prefixes. (newsticker--parse-generic-items): Code formatting. Typo. (newsticker--images-dir): Add trailing slash. (newsticker--image-get): Fix error message. * lisp/net/newst-plainview.el: Remove Time-stamp. * lisp/net/newst-reader.el: Remove Time-stamp. (newsticker-download-logos): Rename variable `newsticker--download-logos' to `newsticker-download-logos' and make it customizable. (newsticker--print-extra-elements): Add optional parameter 'htmlish for using html markup. Amend list of ignored elements. (newsticker--do-print-extra-element): Add parameter 'htmlish for using html markup. * lisp/net/newst-ticker.el: Remove Time-stamp. * lisp/net/newst-treeview.el (newsticker--treeview-item-show): Use html for formatting extra elements. * lisp/net/newsticker.el: Remove Time-stamp, Version. (newsticker-version): Make obsolete.
2014-10-01 17:20:00 +00:00
(if (or (not node) (stringp node))
node
(newsticker--unxml-node node)))
(defun newsticker--unxml-node (node)
Newsticker: Show feedicons in treeview. Small fix in opml export. * etc/images/newsticker/README: Add rss-feed.png, rss-feed.svg. * etc/images/newsticker/rss-feed.png: New. * etc/images/newsticker/rss-feed.svg: New. * lisp/net/newst-backend.el: Require url-parse. (newsticker--get-news-by-wget): Store feed name as process property. (newsticker--sentinel): Read feed name from process property. (newsticker--sentinel-work): Rename argument name to feed-name. Rename variable imageurl to image-url. Pick icon url from Atom 1.0 data. Launch download of feed icon. (newsticker--get-icon-url-atom-1.0): New. (newsticker--unxml) (newsticker--unxml-node) (newsticker--unxml-attribute): Documentation. (newsticker--icons-dir): New. (newsticker--image-get): New arguments FILENAME and DIRECTORY. Use `url-retrieve' if `newsticker-retrieval-method' is 'intern. (newsticker--image-download-by-wget): New. Use process properties for storing informations. (newsticker--image-sentinel): Read informations from process properties. (newsticker--image-save) (newsticker--image-remove) (newsticker--image-download-by-url) (newsticker--image-download-by-url-callback): New. (newsticker-opml-export): Handle url list entries containing a function instead of an url string. * lisp/net/newst-reader.el (newsticker-html-renderer): Whitespace. (newsticker--print-extra-elements) (newsticker--do-print-extra-element): Documentation (newsticker--image-read): Optionally limit image height. Use imagemagick if possible. (newsticker--icon-read): New. * lisp/net/newst-treeview.el (newsticker--treeview-item-show): Limit height of feed logo. (newsticker--treeview-tree-expand): Use feed icons in treeview. (newsticker--tree-widget-icon-create): New. Set the tree widget icon. (newsticker--tree-widget-leaf-icon): Use feed icon.
2014-10-19 16:50:15 +00:00
"Actually restore xml-string of an xml NODE."
Newsticker: Use libxml instead of `xml-parse-region'. Fix some glitches. Clean up. * lisp/net/newst-backend.el: Remove Time-stamp. Rename variable `newsticker--download-logos' to `newsticker-download-logos' and make it customizable. (newsticker--sentinel-work): Move xml-workarounds to function `newsticker--do-xml-workarounds', call unless libxml-parser is used. Allow single quote in regexp for encoding. Use libxml-parser if available, else fall back to `xml-parse-region'. Take care of possibly missing namespace prefixes (like "RDF" instead of "rdf:RDF") when checking xml nodes and attributes (as libxml correctly removes the prefixes). Always use Atom 1.0 as fallback feed type. Rename `newsticker--download-logos' to `newsticker-download-logos' (newsticker--unxml, newsticker--unxml-node) (newsticker--unxml-attribute): New. (newsticker--parse-atom-1.0): Call `unxml' in case that embedded HTML code has become part of the xml parse tree. (newsticker--parse-rss-1.0, newsticker--parse-rss-2.0): Take care of possibly missing namespace prefixes. (newsticker--parse-generic-items): Code formatting. Typo. (newsticker--images-dir): Add trailing slash. (newsticker--image-get): Fix error message. * lisp/net/newst-plainview.el: Remove Time-stamp. * lisp/net/newst-reader.el: Remove Time-stamp. (newsticker-download-logos): Rename variable `newsticker--download-logos' to `newsticker-download-logos' and make it customizable. (newsticker--print-extra-elements): Add optional parameter 'htmlish for using html markup. Amend list of ignored elements. (newsticker--do-print-extra-element): Add parameter 'htmlish for using html markup. * lisp/net/newst-ticker.el: Remove Time-stamp. * lisp/net/newst-treeview.el (newsticker--treeview-item-show): Use html for formatting extra elements. * lisp/net/newsticker.el: Remove Time-stamp, Version. (newsticker-version): Make obsolete.
2014-10-01 17:20:00 +00:00
(let ((qname (symbol-name (car node)))
(att-list (cadr node))
(children (cddr node)))
(concat "<" qname
(when att-list " ")
* lisp/net/*.el: Use lexical-binding Also remove some redundant `:group` arguments. * lisp/net/eudc-export.el: Use lexical-binding. (eudc-create-bbdb-record): Use `cl-progv` and `apply` to avoid `eval`. * lisp/net/eudc-hotlist.el: Use lexical-binding. * lisp/net/eudc.el (eudc-print-attribute-value): Use `funcall` to avoid `eval`. * lisp/net/eudcb-bbdb.el: Use lexical-binding. (eudc-bbdb-filter-non-matching-record): Use `funcall` to avoid `eval`. Move `bbdb-val` binding to avoid `setq`. Use `seq-some` instead of `eval+or`. (eudc-bbdb-format-record-as-result): Use `dolist` and `pcase`. Use `funcall` to avoid `eval`. (eudc-bbdb-query-internal): Simplify a bit. * lisp/net/eudcb-ldap.el: Use lexical-binding. (eudc-ldap-get-host-parameter): Use `defalias` to avoid `eval-and-compile`. * lisp/net/telnet.el: Use lexical-binding. * lisp/net/quickurl.el: Use lexical-binding. * lisp/net/newst-ticker.el: Use lexical-binding. * lisp/net/newst-reader.el: Use lexical-binding. * lisp/net/goto-addr.el: Use lexical-binding. * lisp/net/gnutls.el: Use lexical-binding. * lisp/net/eudcb-macos-contacts.el: Use lexical-binding. * lisp/net/eudcb-mab.el: Use lexical-binding. * lisp/net/net-utils.el: Use lexical-binding. (finger): Remove unused var `found`. * lisp/net/network-stream.el (open-protocol-stream): Remove redundant `defalias`. * lisp/net/newst-plainview.el: Use lexical-binding. (newsticker-hide-entry, newsticker-show-entry): Remove unused var `is-invisible`. (w3m-fill-column, w3-maximum-line-length): Declare vars. * lisp/net/tramp.el (tramp-compute-multi-hops): * lisp/net/tramp-compat.el (tramp-compat-temporary-file-directory): * lisp/net/tramp-cmds.el (tramp-default-rename-file): * lisp/net/webjump.el (webjump): Don't forget lexical-binding for `eval`.
2021-03-08 15:11:22 +00:00
(mapconcat #'newsticker--unxml-attribute att-list " ")
Newsticker: Use libxml instead of `xml-parse-region'. Fix some glitches. Clean up. * lisp/net/newst-backend.el: Remove Time-stamp. Rename variable `newsticker--download-logos' to `newsticker-download-logos' and make it customizable. (newsticker--sentinel-work): Move xml-workarounds to function `newsticker--do-xml-workarounds', call unless libxml-parser is used. Allow single quote in regexp for encoding. Use libxml-parser if available, else fall back to `xml-parse-region'. Take care of possibly missing namespace prefixes (like "RDF" instead of "rdf:RDF") when checking xml nodes and attributes (as libxml correctly removes the prefixes). Always use Atom 1.0 as fallback feed type. Rename `newsticker--download-logos' to `newsticker-download-logos' (newsticker--unxml, newsticker--unxml-node) (newsticker--unxml-attribute): New. (newsticker--parse-atom-1.0): Call `unxml' in case that embedded HTML code has become part of the xml parse tree. (newsticker--parse-rss-1.0, newsticker--parse-rss-2.0): Take care of possibly missing namespace prefixes. (newsticker--parse-generic-items): Code formatting. Typo. (newsticker--images-dir): Add trailing slash. (newsticker--image-get): Fix error message. * lisp/net/newst-plainview.el: Remove Time-stamp. * lisp/net/newst-reader.el: Remove Time-stamp. (newsticker-download-logos): Rename variable `newsticker--download-logos' to `newsticker-download-logos' and make it customizable. (newsticker--print-extra-elements): Add optional parameter 'htmlish for using html markup. Amend list of ignored elements. (newsticker--do-print-extra-element): Add parameter 'htmlish for using html markup. * lisp/net/newst-ticker.el: Remove Time-stamp. * lisp/net/newst-treeview.el (newsticker--treeview-item-show): Use html for formatting extra elements. * lisp/net/newsticker.el: Remove Time-stamp, Version. (newsticker-version): Make obsolete.
2014-10-01 17:20:00 +00:00
">"
* lisp/net/*.el: Use lexical-binding Also remove some redundant `:group` arguments. * lisp/net/eudc-export.el: Use lexical-binding. (eudc-create-bbdb-record): Use `cl-progv` and `apply` to avoid `eval`. * lisp/net/eudc-hotlist.el: Use lexical-binding. * lisp/net/eudc.el (eudc-print-attribute-value): Use `funcall` to avoid `eval`. * lisp/net/eudcb-bbdb.el: Use lexical-binding. (eudc-bbdb-filter-non-matching-record): Use `funcall` to avoid `eval`. Move `bbdb-val` binding to avoid `setq`. Use `seq-some` instead of `eval+or`. (eudc-bbdb-format-record-as-result): Use `dolist` and `pcase`. Use `funcall` to avoid `eval`. (eudc-bbdb-query-internal): Simplify a bit. * lisp/net/eudcb-ldap.el: Use lexical-binding. (eudc-ldap-get-host-parameter): Use `defalias` to avoid `eval-and-compile`. * lisp/net/telnet.el: Use lexical-binding. * lisp/net/quickurl.el: Use lexical-binding. * lisp/net/newst-ticker.el: Use lexical-binding. * lisp/net/newst-reader.el: Use lexical-binding. * lisp/net/goto-addr.el: Use lexical-binding. * lisp/net/gnutls.el: Use lexical-binding. * lisp/net/eudcb-macos-contacts.el: Use lexical-binding. * lisp/net/eudcb-mab.el: Use lexical-binding. * lisp/net/net-utils.el: Use lexical-binding. (finger): Remove unused var `found`. * lisp/net/network-stream.el (open-protocol-stream): Remove redundant `defalias`. * lisp/net/newst-plainview.el: Use lexical-binding. (newsticker-hide-entry, newsticker-show-entry): Remove unused var `is-invisible`. (w3m-fill-column, w3-maximum-line-length): Declare vars. * lisp/net/tramp.el (tramp-compute-multi-hops): * lisp/net/tramp-compat.el (tramp-compat-temporary-file-directory): * lisp/net/tramp-cmds.el (tramp-default-rename-file): * lisp/net/webjump.el (webjump): Don't forget lexical-binding for `eval`.
2021-03-08 15:11:22 +00:00
(mapconcat #'newsticker--unxml children "") "</" qname ">")))
Newsticker: Use libxml instead of `xml-parse-region'. Fix some glitches. Clean up. * lisp/net/newst-backend.el: Remove Time-stamp. Rename variable `newsticker--download-logos' to `newsticker-download-logos' and make it customizable. (newsticker--sentinel-work): Move xml-workarounds to function `newsticker--do-xml-workarounds', call unless libxml-parser is used. Allow single quote in regexp for encoding. Use libxml-parser if available, else fall back to `xml-parse-region'. Take care of possibly missing namespace prefixes (like "RDF" instead of "rdf:RDF") when checking xml nodes and attributes (as libxml correctly removes the prefixes). Always use Atom 1.0 as fallback feed type. Rename `newsticker--download-logos' to `newsticker-download-logos' (newsticker--unxml, newsticker--unxml-node) (newsticker--unxml-attribute): New. (newsticker--parse-atom-1.0): Call `unxml' in case that embedded HTML code has become part of the xml parse tree. (newsticker--parse-rss-1.0, newsticker--parse-rss-2.0): Take care of possibly missing namespace prefixes. (newsticker--parse-generic-items): Code formatting. Typo. (newsticker--images-dir): Add trailing slash. (newsticker--image-get): Fix error message. * lisp/net/newst-plainview.el: Remove Time-stamp. * lisp/net/newst-reader.el: Remove Time-stamp. (newsticker-download-logos): Rename variable `newsticker--download-logos' to `newsticker-download-logos' and make it customizable. (newsticker--print-extra-elements): Add optional parameter 'htmlish for using html markup. Amend list of ignored elements. (newsticker--do-print-extra-element): Add parameter 'htmlish for using html markup. * lisp/net/newst-ticker.el: Remove Time-stamp. * lisp/net/newst-treeview.el (newsticker--treeview-item-show): Use html for formatting extra elements. * lisp/net/newsticker.el: Remove Time-stamp, Version. (newsticker-version): Make obsolete.
2014-10-01 17:20:00 +00:00
Newsticker: Show feedicons in treeview. Small fix in opml export. * etc/images/newsticker/README: Add rss-feed.png, rss-feed.svg. * etc/images/newsticker/rss-feed.png: New. * etc/images/newsticker/rss-feed.svg: New. * lisp/net/newst-backend.el: Require url-parse. (newsticker--get-news-by-wget): Store feed name as process property. (newsticker--sentinel): Read feed name from process property. (newsticker--sentinel-work): Rename argument name to feed-name. Rename variable imageurl to image-url. Pick icon url from Atom 1.0 data. Launch download of feed icon. (newsticker--get-icon-url-atom-1.0): New. (newsticker--unxml) (newsticker--unxml-node) (newsticker--unxml-attribute): Documentation. (newsticker--icons-dir): New. (newsticker--image-get): New arguments FILENAME and DIRECTORY. Use `url-retrieve' if `newsticker-retrieval-method' is 'intern. (newsticker--image-download-by-wget): New. Use process properties for storing informations. (newsticker--image-sentinel): Read informations from process properties. (newsticker--image-save) (newsticker--image-remove) (newsticker--image-download-by-url) (newsticker--image-download-by-url-callback): New. (newsticker-opml-export): Handle url list entries containing a function instead of an url string. * lisp/net/newst-reader.el (newsticker-html-renderer): Whitespace. (newsticker--print-extra-elements) (newsticker--do-print-extra-element): Documentation (newsticker--image-read): Optionally limit image height. Use imagemagick if possible. (newsticker--icon-read): New. * lisp/net/newst-treeview.el (newsticker--treeview-item-show): Limit height of feed logo. (newsticker--treeview-tree-expand): Use feed icons in treeview. (newsticker--tree-widget-icon-create): New. Set the tree widget icon. (newsticker--tree-widget-leaf-icon): Use feed icon.
2014-10-19 16:50:15 +00:00
(defun newsticker--unxml-attribute (attribute)
"Actually restore xml-string of an ATTRIBUTE of an xml node."
(let ((name (symbol-name (car attribute)))
(value (cdr attribute)))
Newsticker: Use libxml instead of `xml-parse-region'. Fix some glitches. Clean up. * lisp/net/newst-backend.el: Remove Time-stamp. Rename variable `newsticker--download-logos' to `newsticker-download-logos' and make it customizable. (newsticker--sentinel-work): Move xml-workarounds to function `newsticker--do-xml-workarounds', call unless libxml-parser is used. Allow single quote in regexp for encoding. Use libxml-parser if available, else fall back to `xml-parse-region'. Take care of possibly missing namespace prefixes (like "RDF" instead of "rdf:RDF") when checking xml nodes and attributes (as libxml correctly removes the prefixes). Always use Atom 1.0 as fallback feed type. Rename `newsticker--download-logos' to `newsticker-download-logos' (newsticker--unxml, newsticker--unxml-node) (newsticker--unxml-attribute): New. (newsticker--parse-atom-1.0): Call `unxml' in case that embedded HTML code has become part of the xml parse tree. (newsticker--parse-rss-1.0, newsticker--parse-rss-2.0): Take care of possibly missing namespace prefixes. (newsticker--parse-generic-items): Code formatting. Typo. (newsticker--images-dir): Add trailing slash. (newsticker--image-get): Fix error message. * lisp/net/newst-plainview.el: Remove Time-stamp. * lisp/net/newst-reader.el: Remove Time-stamp. (newsticker-download-logos): Rename variable `newsticker--download-logos' to `newsticker-download-logos' and make it customizable. (newsticker--print-extra-elements): Add optional parameter 'htmlish for using html markup. Amend list of ignored elements. (newsticker--do-print-extra-element): Add parameter 'htmlish for using html markup. * lisp/net/newst-ticker.el: Remove Time-stamp. * lisp/net/newst-treeview.el (newsticker--treeview-item-show): Use html for formatting extra elements. * lisp/net/newsticker.el: Remove Time-stamp, Version. (newsticker-version): Make obsolete.
2014-10-01 17:20:00 +00:00
(concat name "=\"" value "\"")))
2008-06-08 15:36:18 +00:00
(defun newsticker--parse-atom-1.0 (name time topnode)
"Parse Atom 1.0 data.
Argument NAME gives the name of a news feed. TIME gives the
system time at which the data have been retrieved. TOPNODE
contains the feed data as returned by the xml parser.
For the Atom 1.0 specification see
URL `http://www.atompub.org/2005/08/17/draft-ietf-atompub-format-11.html'"
2008-06-08 15:36:18 +00:00
(newsticker--debug-msg "Parsing Atom 1.0 feed %s" name)
(let (new-feed new-item)
(setq new-feed (newsticker--parse-generic-feed
name time
;; title
(car (xml-node-children
(car (xml-get-children topnode 'title))))
;; desc
(car (xml-node-children
(car (xml-get-children topnode 'subtitle))))
;; link
(lambda (node)
(xml-get-attribute
(car (xml-get-children node 'link)) 'href))
;; extra-elements
(xml-node-children topnode)))
(setq new-item (newsticker--parse-generic-items
name time (xml-get-children topnode 'entry)
;; title-fn
(lambda (node)
(car (xml-node-children
(car (xml-get-children node 'title)))))
;; desc-fn
(lambda (node)
;; unxml the content or the summary node. Atom
;; allows for integrating (x)html into the atom
;; structure but we need the raw html string.
2021-03-24 08:28:32 +00:00
;; e.g. https://www.heise.de/open/news/news-atom.xml
;; http://feeds.feedburner.com/ru_nix_blogs
(or (newsticker--unxml
Newsticker: Use libxml instead of `xml-parse-region'. Fix some glitches. Clean up. * lisp/net/newst-backend.el: Remove Time-stamp. Rename variable `newsticker--download-logos' to `newsticker-download-logos' and make it customizable. (newsticker--sentinel-work): Move xml-workarounds to function `newsticker--do-xml-workarounds', call unless libxml-parser is used. Allow single quote in regexp for encoding. Use libxml-parser if available, else fall back to `xml-parse-region'. Take care of possibly missing namespace prefixes (like "RDF" instead of "rdf:RDF") when checking xml nodes and attributes (as libxml correctly removes the prefixes). Always use Atom 1.0 as fallback feed type. Rename `newsticker--download-logos' to `newsticker-download-logos' (newsticker--unxml, newsticker--unxml-node) (newsticker--unxml-attribute): New. (newsticker--parse-atom-1.0): Call `unxml' in case that embedded HTML code has become part of the xml parse tree. (newsticker--parse-rss-1.0, newsticker--parse-rss-2.0): Take care of possibly missing namespace prefixes. (newsticker--parse-generic-items): Code formatting. Typo. (newsticker--images-dir): Add trailing slash. (newsticker--image-get): Fix error message. * lisp/net/newst-plainview.el: Remove Time-stamp. * lisp/net/newst-reader.el: Remove Time-stamp. (newsticker-download-logos): Rename variable `newsticker--download-logos' to `newsticker-download-logos' and make it customizable. (newsticker--print-extra-elements): Add optional parameter 'htmlish for using html markup. Amend list of ignored elements. (newsticker--do-print-extra-element): Add parameter 'htmlish for using html markup. * lisp/net/newst-ticker.el: Remove Time-stamp. * lisp/net/newst-treeview.el (newsticker--treeview-item-show): Use html for formatting extra elements. * lisp/net/newsticker.el: Remove Time-stamp, Version. (newsticker-version): Make obsolete.
2014-10-01 17:20:00 +00:00
(car (xml-node-children
(car (xml-get-children node 'content)))))
(newsticker--unxml
(car (xml-node-children
(car (xml-get-children node 'summary)))))
2008-06-08 15:36:18 +00:00
(car (xml-node-children
(car (xml-get-children node 'summary))))))
;; link-fn
(lambda (node)
(xml-get-attribute
(car (xml-get-children node 'link)) 'href))
;; time-fn
(lambda (node)
(newsticker--decode-iso8601-date
(or (car (xml-node-children
(car (xml-get-children node 'updated))))
(car (xml-node-children
(car (xml-get-children node 'published)))))))
;; guid-fn
(lambda (node)
(car (xml-node-children
(car (xml-get-children node 'id)))))
;; extra-fn
(lambda (node)
(xml-node-children node))))
(or new-item new-feed)))
(defun newsticker--parse-rss-0.91 (name time topnode)
"Parse RSS 0.91 data.
Return value as well as arguments NAME, TIME, and TOPNODE are the
same as in `newsticker--parse-atom-1.0'.
For the RSS 0.91 specification see URL `http://backend.userland.com/rss091'."
2008-06-08 15:36:18 +00:00
(newsticker--debug-msg "Parsing RSS 0.91 feed %s" name)
(let* ((channelnode (car (xml-get-children topnode 'channel)))
is-new-feed has-new-items)
(setq is-new-feed (newsticker--parse-generic-feed
name time
;; title
(car (xml-node-children
(car (xml-get-children channelnode 'title))))
;; desc
(car (xml-node-children
(car (xml-get-children channelnode
'description))))
;; link
(car (xml-node-children
(car (xml-get-children channelnode 'link))))
;; extra-elements
(xml-node-children channelnode)))
(setq has-new-items (newsticker--parse-generic-items
name time (xml-get-children channelnode 'item)
;; title-fn
(lambda (node)
(car (xml-node-children
(car (xml-get-children node 'title)))))
;; desc-fn
(lambda (node)
(car (xml-node-children
(car (xml-get-children node 'description)))))
;; link-fn
(lambda (node)
(car (xml-node-children
(car (xml-get-children node 'link)))))
;; time-fn
(lambda (node)
(newsticker--decode-rfc822-date
(car (xml-node-children
(car (xml-get-children node 'pubDate))))))
;; guid-fn
(lambda (_node)
2008-06-08 15:36:18 +00:00
nil)
;; extra-fn
(lambda (node)
(xml-node-children node))))
(or has-new-items is-new-feed)))
(defun newsticker--parse-rss-0.92 (name time topnode)
"Parse RSS 0.92 data.
Return value as well as arguments NAME, TIME, and TOPNODE are the
same as in `newsticker--parse-atom-1.0'.
For the RSS 0.92 specification see URL `http://backend.userland.com/rss092'."
2008-06-08 15:36:18 +00:00
(newsticker--debug-msg "Parsing RSS 0.92 feed %s" name)
(let* ((channelnode (car (xml-get-children topnode 'channel)))
is-new-feed has-new-items)
(setq is-new-feed (newsticker--parse-generic-feed
name time
;; title
(car (xml-node-children
(car (xml-get-children channelnode 'title))))
;; desc
(car (xml-node-children
(car (xml-get-children channelnode
'description))))
;; link
(car (xml-node-children
(car (xml-get-children channelnode 'link))))
;; extra-elements
(xml-node-children channelnode)))
(setq has-new-items (newsticker--parse-generic-items
name time (xml-get-children channelnode 'item)
;; title-fn
(lambda (node)
(car (xml-node-children
(car (xml-get-children node 'title)))))
;; desc-fn
(lambda (node)
(car (xml-node-children
(car (xml-get-children node 'description)))))
;; link-fn
(lambda (node)
(car (xml-node-children
(car (xml-get-children node 'link)))))
;; time-fn
(lambda (node)
(newsticker--decode-rfc822-date
(car (xml-node-children
(car (xml-get-children node 'pubDate))))))
;; guid-fn
(lambda (_node)
2008-06-08 15:36:18 +00:00
nil)
;; extra-fn
(lambda (node)
(xml-node-children node))))
(or has-new-items is-new-feed)))
(defun newsticker--parse-rss-1.0 (name time topnode)
"Parse RSS 1.0 data.
Return value as well as arguments NAME, TIME, and TOPNODE are the
same as in `newsticker--parse-atom-1.0'.
For the RSS 1.0 specification see URL `http://web.resource.org/rss/1.0/spec'."
2008-06-08 15:36:18 +00:00
(newsticker--debug-msg "Parsing RSS 1.0 feed %s" name)
(let* ((channelnode (car (xml-get-children topnode 'channel)))
is-new-feed has-new-items)
(setq is-new-feed (newsticker--parse-generic-feed
name time
;; title
(car (xml-node-children
(car (xml-get-children channelnode 'title))))
;; desc
Newsticker: Use libxml instead of `xml-parse-region'. Fix some glitches. Clean up. * lisp/net/newst-backend.el: Remove Time-stamp. Rename variable `newsticker--download-logos' to `newsticker-download-logos' and make it customizable. (newsticker--sentinel-work): Move xml-workarounds to function `newsticker--do-xml-workarounds', call unless libxml-parser is used. Allow single quote in regexp for encoding. Use libxml-parser if available, else fall back to `xml-parse-region'. Take care of possibly missing namespace prefixes (like "RDF" instead of "rdf:RDF") when checking xml nodes and attributes (as libxml correctly removes the prefixes). Always use Atom 1.0 as fallback feed type. Rename `newsticker--download-logos' to `newsticker-download-logos' (newsticker--unxml, newsticker--unxml-node) (newsticker--unxml-attribute): New. (newsticker--parse-atom-1.0): Call `unxml' in case that embedded HTML code has become part of the xml parse tree. (newsticker--parse-rss-1.0, newsticker--parse-rss-2.0): Take care of possibly missing namespace prefixes. (newsticker--parse-generic-items): Code formatting. Typo. (newsticker--images-dir): Add trailing slash. (newsticker--image-get): Fix error message. * lisp/net/newst-plainview.el: Remove Time-stamp. * lisp/net/newst-reader.el: Remove Time-stamp. (newsticker-download-logos): Rename variable `newsticker--download-logos' to `newsticker-download-logos' and make it customizable. (newsticker--print-extra-elements): Add optional parameter 'htmlish for using html markup. Amend list of ignored elements. (newsticker--do-print-extra-element): Add parameter 'htmlish for using html markup. * lisp/net/newst-ticker.el: Remove Time-stamp. * lisp/net/newst-treeview.el (newsticker--treeview-item-show): Use html for formatting extra elements. * lisp/net/newsticker.el: Remove Time-stamp, Version. (newsticker-version): Make obsolete.
2014-10-01 17:20:00 +00:00
(or (car (xml-node-children
(car (xml-get-children channelnode
'encoded))))
(car (xml-node-children
(car (xml-get-children channelnode
'content:encoded))))
(car (xml-node-children
(car (xml-get-children channelnode
'description)))))
2008-06-08 15:36:18 +00:00
;; link
(car (xml-node-children
(car (xml-get-children channelnode 'link))))
;; extra-elements
(xml-node-children channelnode)))
(setq has-new-items (newsticker--parse-generic-items
name time (xml-get-children topnode 'item)
;; title-fn
(lambda (node)
(car (xml-node-children
(car (xml-get-children node 'title)))))
;; desc-fn
(lambda (node)
(car (xml-node-children
(car (xml-get-children node
'description)))))
;; link-fn
(lambda (node)
(car (xml-node-children
(car (xml-get-children node 'link)))))
;; time-fn
(lambda (node)
(newsticker--decode-iso8601-date
Newsticker: Use libxml instead of `xml-parse-region'. Fix some glitches. Clean up. * lisp/net/newst-backend.el: Remove Time-stamp. Rename variable `newsticker--download-logos' to `newsticker-download-logos' and make it customizable. (newsticker--sentinel-work): Move xml-workarounds to function `newsticker--do-xml-workarounds', call unless libxml-parser is used. Allow single quote in regexp for encoding. Use libxml-parser if available, else fall back to `xml-parse-region'. Take care of possibly missing namespace prefixes (like "RDF" instead of "rdf:RDF") when checking xml nodes and attributes (as libxml correctly removes the prefixes). Always use Atom 1.0 as fallback feed type. Rename `newsticker--download-logos' to `newsticker-download-logos' (newsticker--unxml, newsticker--unxml-node) (newsticker--unxml-attribute): New. (newsticker--parse-atom-1.0): Call `unxml' in case that embedded HTML code has become part of the xml parse tree. (newsticker--parse-rss-1.0, newsticker--parse-rss-2.0): Take care of possibly missing namespace prefixes. (newsticker--parse-generic-items): Code formatting. Typo. (newsticker--images-dir): Add trailing slash. (newsticker--image-get): Fix error message. * lisp/net/newst-plainview.el: Remove Time-stamp. * lisp/net/newst-reader.el: Remove Time-stamp. (newsticker-download-logos): Rename variable `newsticker--download-logos' to `newsticker-download-logos' and make it customizable. (newsticker--print-extra-elements): Add optional parameter 'htmlish for using html markup. Amend list of ignored elements. (newsticker--do-print-extra-element): Add parameter 'htmlish for using html markup. * lisp/net/newst-ticker.el: Remove Time-stamp. * lisp/net/newst-treeview.el (newsticker--treeview-item-show): Use html for formatting extra elements. * lisp/net/newsticker.el: Remove Time-stamp, Version. (newsticker-version): Make obsolete.
2014-10-01 17:20:00 +00:00
(or (car (xml-node-children
(car (xml-get-children node 'dc:date))))
(car (xml-node-children
(car (xml-get-children node 'date)))))))
2008-06-08 15:36:18 +00:00
;; guid-fn
(lambda (_node)
2008-06-08 15:36:18 +00:00
nil)
;; extra-fn
(lambda (node)
(xml-node-children node))))
(or has-new-items is-new-feed)))
(defun newsticker--parse-rss-2.0 (name time topnode)
"Parse RSS 2.0 data.
Return value as well as arguments NAME, TIME, and TOPNODE are the
same as in `newsticker--parse-atom-1.0'.
For the RSS 2.0 specification see URL `http://blogs.law.harvard.edu/tech/rss'."
2008-06-08 15:36:18 +00:00
(newsticker--debug-msg "Parsing RSS 2.0 feed %s" name)
(let* ((channelnode (car (xml-get-children topnode 'channel)))
is-new-feed has-new-items)
(setq is-new-feed (newsticker--parse-generic-feed
name time
;; title
(car (xml-node-children
(car (xml-get-children channelnode 'title))))
;; desc
Newsticker: Use libxml instead of `xml-parse-region'. Fix some glitches. Clean up. * lisp/net/newst-backend.el: Remove Time-stamp. Rename variable `newsticker--download-logos' to `newsticker-download-logos' and make it customizable. (newsticker--sentinel-work): Move xml-workarounds to function `newsticker--do-xml-workarounds', call unless libxml-parser is used. Allow single quote in regexp for encoding. Use libxml-parser if available, else fall back to `xml-parse-region'. Take care of possibly missing namespace prefixes (like "RDF" instead of "rdf:RDF") when checking xml nodes and attributes (as libxml correctly removes the prefixes). Always use Atom 1.0 as fallback feed type. Rename `newsticker--download-logos' to `newsticker-download-logos' (newsticker--unxml, newsticker--unxml-node) (newsticker--unxml-attribute): New. (newsticker--parse-atom-1.0): Call `unxml' in case that embedded HTML code has become part of the xml parse tree. (newsticker--parse-rss-1.0, newsticker--parse-rss-2.0): Take care of possibly missing namespace prefixes. (newsticker--parse-generic-items): Code formatting. Typo. (newsticker--images-dir): Add trailing slash. (newsticker--image-get): Fix error message. * lisp/net/newst-plainview.el: Remove Time-stamp. * lisp/net/newst-reader.el: Remove Time-stamp. (newsticker-download-logos): Rename variable `newsticker--download-logos' to `newsticker-download-logos' and make it customizable. (newsticker--print-extra-elements): Add optional parameter 'htmlish for using html markup. Amend list of ignored elements. (newsticker--do-print-extra-element): Add parameter 'htmlish for using html markup. * lisp/net/newst-ticker.el: Remove Time-stamp. * lisp/net/newst-treeview.el (newsticker--treeview-item-show): Use html for formatting extra elements. * lisp/net/newsticker.el: Remove Time-stamp, Version. (newsticker-version): Make obsolete.
2014-10-01 17:20:00 +00:00
(or (car (xml-node-children
(car (xml-get-children channelnode
'encoded))))
(car (xml-node-children
(car (xml-get-children channelnode
'content:encoded))))
(car (xml-node-children
(car (xml-get-children channelnode
'description)))))
2008-06-08 15:36:18 +00:00
;; link
(car (xml-node-children
(car (xml-get-children channelnode 'link))))
;; extra-elements
(xml-node-children channelnode)))
(setq has-new-items (newsticker--parse-generic-items
name time (xml-get-children channelnode 'item)
;; title-fn
(lambda (node)
(car (xml-node-children
(car (xml-get-children node 'title)))))
;; desc-fn
(lambda (node)
(or (car (xml-node-children
Newsticker: Use libxml instead of `xml-parse-region'. Fix some glitches. Clean up. * lisp/net/newst-backend.el: Remove Time-stamp. Rename variable `newsticker--download-logos' to `newsticker-download-logos' and make it customizable. (newsticker--sentinel-work): Move xml-workarounds to function `newsticker--do-xml-workarounds', call unless libxml-parser is used. Allow single quote in regexp for encoding. Use libxml-parser if available, else fall back to `xml-parse-region'. Take care of possibly missing namespace prefixes (like "RDF" instead of "rdf:RDF") when checking xml nodes and attributes (as libxml correctly removes the prefixes). Always use Atom 1.0 as fallback feed type. Rename `newsticker--download-logos' to `newsticker-download-logos' (newsticker--unxml, newsticker--unxml-node) (newsticker--unxml-attribute): New. (newsticker--parse-atom-1.0): Call `unxml' in case that embedded HTML code has become part of the xml parse tree. (newsticker--parse-rss-1.0, newsticker--parse-rss-2.0): Take care of possibly missing namespace prefixes. (newsticker--parse-generic-items): Code formatting. Typo. (newsticker--images-dir): Add trailing slash. (newsticker--image-get): Fix error message. * lisp/net/newst-plainview.el: Remove Time-stamp. * lisp/net/newst-reader.el: Remove Time-stamp. (newsticker-download-logos): Rename variable `newsticker--download-logos' to `newsticker-download-logos' and make it customizable. (newsticker--print-extra-elements): Add optional parameter 'htmlish for using html markup. Amend list of ignored elements. (newsticker--do-print-extra-element): Add parameter 'htmlish for using html markup. * lisp/net/newst-ticker.el: Remove Time-stamp. * lisp/net/newst-treeview.el (newsticker--treeview-item-show): Use html for formatting extra elements. * lisp/net/newsticker.el: Remove Time-stamp, Version. (newsticker-version): Make obsolete.
2014-10-01 17:20:00 +00:00
(car (xml-get-children node
'encoded))))
(car (xml-node-children
2008-06-08 15:36:18 +00:00
(car (xml-get-children node
'content:encoded))))
(car (xml-node-children
(car (xml-get-children node
'description))))))
;; link-fn
(lambda (node)
(car (xml-node-children
(car (xml-get-children node 'link)))))
;; time-fn
(lambda (node)
(newsticker--decode-rfc822-date
(car (xml-node-children
(car (xml-get-children node 'pubDate))))))
;; guid-fn
(lambda (node)
(newsticker--guid-to-string
(assoc 'guid (xml-node-children node))))
;; extra-fn
(lambda (node)
(xml-node-children node))))
(or has-new-items is-new-feed)))
(defun newsticker--parse-generic-feed (name time title desc link
extra-elements)
"Parse generic news feed data.
Argument NAME gives the name of a news feed. TIME gives the
system time at which the data have been retrieved.
The arguments TITLE, DESC, LINK, and EXTRA-ELEMENTS give the feed's title,
description, link, and extra elements resp."
(let ((title (or title "[untitled]"))
(link (or link ""))
(position 0)
(something-was-added nil))
;; decode numeric entities
2009-12-06 18:13:19 +00:00
(setq title (xml-substitute-numeric-entities title))
(setq desc (xml-substitute-numeric-entities desc))
(setq link (xml-substitute-numeric-entities link))
2008-06-08 15:36:18 +00:00
;; remove whitespace from title, desc, and link
(setq title (newsticker--remove-whitespace title))
(setq desc (newsticker--remove-whitespace desc))
(setq link (newsticker--remove-whitespace link))
;; handle the feed itself
(unless (newsticker--cache-contains newsticker--cache
(intern name) title
desc link 'feed)
(setq something-was-added t))
(setq newsticker--cache
(newsticker--cache-add newsticker--cache (intern name)
title desc link time 'feed position
extra-elements time 'feed))
something-was-added))
(defun newsticker--parse-generic-items (name time itemlist
title-fn desc-fn
link-fn time-fn
guid-fn extra-fn)
"Parse generic news feed data.
Argument NAME gives the name of a news feed. TIME gives the
system time at which the data have been retrieved. ITEMLIST
contains the news items returned by the xml parser.
The arguments TITLE-FN, DESC-FN, LINK-FN, TIME-FN, GUID-FN, and
EXTRA-FN give functions for extracting title, description, link,
time, guid, and extra-elements resp. They are called with one
argument, which is one of the items in ITEMLIST."
(let ((position 0)
2008-06-08 15:36:18 +00:00
(something-was-added nil))
;; gather all items for this feed
(dolist (node itemlist)
(setq position (1+ position))
(let ((title (or (funcall title-fn node) "[untitled]"))
(desc (funcall desc-fn node))
(link (or (funcall link-fn node) "")))
(setq time (or (funcall time-fn node) time))
;; It happened that the title or description
;; contained evil HTML code that confused the
;; xml parser. Therefore:
(unless (stringp title)
(setq title (prin1-to-string title)))
(unless (or (stringp desc) (not desc))
(setq desc (prin1-to-string desc)))
;; ignore items with empty title AND empty desc
(when (or (> (length title) 0)
(> (length desc) 0))
;; decode numeric entities
(setq title (xml-substitute-numeric-entities title))
(when desc
(setq desc (xml-substitute-numeric-entities desc)))
(setq link (xml-substitute-numeric-entities link))
;; remove whitespace from title, desc, and link
(setq title (newsticker--remove-whitespace title))
(setq desc (newsticker--remove-whitespace desc))
(setq link (newsticker--remove-whitespace link))
;; add data to cache
;; do we have this item already?
(let ((old-item
(let* ((guid (funcall guid-fn node)))
;;(message "guid=%s" guid)
(newsticker--cache-contains newsticker--cache
(intern name) title
desc link nil guid)))
(age1 'new)
(age2 'old)
(item-new-p nil))
;; Add this item, or mark it as old, or do nothing
(if old-item
(let ((prev-age (newsticker--age old-item)))
(unless newsticker-automatically-mark-items-as-old
;; Some feeds deliver items multiply, the
;; first time we find an 'obsolete-old one in
;; the cache, the following times we find an
;; 'old one
(if (memq prev-age '(obsolete-old old))
(setq age2 'old)
(setq age2 'new)))
(if (eq prev-age 'immortal)
(setq age2 'immortal))
(setq time (newsticker--time old-item)))
;; item was not there
(setq item-new-p t)
(setq something-was-added t))
(let ((extra-elements-with-guid (funcall extra-fn node)))
(unless (assoc 'guid extra-elements-with-guid)
(setq extra-elements-with-guid
(cons `(guid nil ,(funcall guid-fn node))
extra-elements-with-guid)))
(setq newsticker--cache
(newsticker--cache-add
newsticker--cache (intern name) title desc link
time age1 position extra-elements-with-guid
time age2)))
(when item-new-p
(let ((item (newsticker--cache-contains
newsticker--cache (intern name) title
desc link nil)))
(if newsticker-auto-mark-filter-list
(newsticker--run-auto-mark-filter name item))
(run-hook-with-args
'newsticker-new-item-functions name item)))))))
2008-06-08 15:36:18 +00:00
something-was-added))
;; ======================================================================
;;; Misc
;; ======================================================================
(defun newsticker--insert-bytes (bytes)
"Decode BYTES and insert in current buffer."
(insert (decode-coding-string bytes 'binary)))
2008-06-08 15:36:18 +00:00
(defun newsticker--remove-whitespace (string)
"Remove leading and trailing whitespace from STRING."
(when (stringp string)
(string-trim string)))
2008-06-08 15:36:18 +00:00
(defun newsticker--do-forget-preformatted (item)
"Forget pre-formatted data for ITEM.
Remove the pre-formatted from `newsticker--cache'."
(if (nthcdr 7 item)
(setcar (nthcdr 7 item) nil))
(if (nthcdr 6 item)
(setcar (nthcdr 6 item) nil)))
(defun newsticker--forget-preformatted ()
"Forget all cached pre-formatted data.
Remove the pre-formatted from `newsticker--cache'."
(mapc (lambda (feed)
* lisp/net/*.el: Use lexical-binding Also remove some redundant `:group` arguments. * lisp/net/eudc-export.el: Use lexical-binding. (eudc-create-bbdb-record): Use `cl-progv` and `apply` to avoid `eval`. * lisp/net/eudc-hotlist.el: Use lexical-binding. * lisp/net/eudc.el (eudc-print-attribute-value): Use `funcall` to avoid `eval`. * lisp/net/eudcb-bbdb.el: Use lexical-binding. (eudc-bbdb-filter-non-matching-record): Use `funcall` to avoid `eval`. Move `bbdb-val` binding to avoid `setq`. Use `seq-some` instead of `eval+or`. (eudc-bbdb-format-record-as-result): Use `dolist` and `pcase`. Use `funcall` to avoid `eval`. (eudc-bbdb-query-internal): Simplify a bit. * lisp/net/eudcb-ldap.el: Use lexical-binding. (eudc-ldap-get-host-parameter): Use `defalias` to avoid `eval-and-compile`. * lisp/net/telnet.el: Use lexical-binding. * lisp/net/quickurl.el: Use lexical-binding. * lisp/net/newst-ticker.el: Use lexical-binding. * lisp/net/newst-reader.el: Use lexical-binding. * lisp/net/goto-addr.el: Use lexical-binding. * lisp/net/gnutls.el: Use lexical-binding. * lisp/net/eudcb-macos-contacts.el: Use lexical-binding. * lisp/net/eudcb-mab.el: Use lexical-binding. * lisp/net/net-utils.el: Use lexical-binding. (finger): Remove unused var `found`. * lisp/net/network-stream.el (open-protocol-stream): Remove redundant `defalias`. * lisp/net/newst-plainview.el: Use lexical-binding. (newsticker-hide-entry, newsticker-show-entry): Remove unused var `is-invisible`. (w3m-fill-column, w3-maximum-line-length): Declare vars. * lisp/net/tramp.el (tramp-compute-multi-hops): * lisp/net/tramp-compat.el (tramp-compat-temporary-file-directory): * lisp/net/tramp-cmds.el (tramp-default-rename-file): * lisp/net/webjump.el (webjump): Don't forget lexical-binding for `eval`.
2021-03-08 15:11:22 +00:00
(mapc #'newsticker--do-forget-preformatted
2008-06-08 15:36:18 +00:00
(cdr feed)))
newsticker--cache)
(when (fboundp 'newsticker--buffer-set-uptodate)
(newsticker--buffer-set-uptodate nil)))
(defun newsticker--debug-msg (string &rest args)
"Print newsticker debug messages.
This function calls `message' with arguments STRING and ARGS, if
`newsticker-debug' is non-nil."
(and newsticker-debug
;;(not (active-minibuffer-window))
;;(not (current-message))
* lisp/net/*.el: Use lexical-binding Also remove some redundant `:group` arguments. * lisp/net/eudc-export.el: Use lexical-binding. (eudc-create-bbdb-record): Use `cl-progv` and `apply` to avoid `eval`. * lisp/net/eudc-hotlist.el: Use lexical-binding. * lisp/net/eudc.el (eudc-print-attribute-value): Use `funcall` to avoid `eval`. * lisp/net/eudcb-bbdb.el: Use lexical-binding. (eudc-bbdb-filter-non-matching-record): Use `funcall` to avoid `eval`. Move `bbdb-val` binding to avoid `setq`. Use `seq-some` instead of `eval+or`. (eudc-bbdb-format-record-as-result): Use `dolist` and `pcase`. Use `funcall` to avoid `eval`. (eudc-bbdb-query-internal): Simplify a bit. * lisp/net/eudcb-ldap.el: Use lexical-binding. (eudc-ldap-get-host-parameter): Use `defalias` to avoid `eval-and-compile`. * lisp/net/telnet.el: Use lexical-binding. * lisp/net/quickurl.el: Use lexical-binding. * lisp/net/newst-ticker.el: Use lexical-binding. * lisp/net/newst-reader.el: Use lexical-binding. * lisp/net/goto-addr.el: Use lexical-binding. * lisp/net/gnutls.el: Use lexical-binding. * lisp/net/eudcb-macos-contacts.el: Use lexical-binding. * lisp/net/eudcb-mab.el: Use lexical-binding. * lisp/net/net-utils.el: Use lexical-binding. (finger): Remove unused var `found`. * lisp/net/network-stream.el (open-protocol-stream): Remove redundant `defalias`. * lisp/net/newst-plainview.el: Use lexical-binding. (newsticker-hide-entry, newsticker-show-entry): Remove unused var `is-invisible`. (w3m-fill-column, w3-maximum-line-length): Declare vars. * lisp/net/tramp.el (tramp-compute-multi-hops): * lisp/net/tramp-compat.el (tramp-compat-temporary-file-directory): * lisp/net/tramp-cmds.el (tramp-default-rename-file): * lisp/net/webjump.el (webjump): Don't forget lexical-binding for `eval`.
2021-03-08 15:11:22 +00:00
(apply #'message string args)))
2008-06-08 15:36:18 +00:00
(defun newsticker--decode-iso8601-date (string)
"Return ISO8601-encoded STRING in format like `encode-time'.
Converts from ISO-8601 to Emacs representation. If no time zone
2019-12-11 04:04:36 +00:00
is present, this function defaults to universal time."
(if string
(condition-case nil
(encode-time (decoded-time-set-defaults (iso8601-parse string) 0))
(wrong-type-argument
(message "Cannot decode \"%s\"" string)
nil))
2008-06-08 15:36:18 +00:00
nil))
(defun newsticker--decode-rfc822-date (rfc822-string)
"Convert RFC822-STRING to a Lisp timestamp.
RFC822-STRING should use RFC 822 (or later) format.
2008-06-08 15:36:18 +00:00
Examples:
Sat, 07 September 2002 00:00:01 +0100
Sat, 07 September 2002 00:00:01 MET
Sat, 07 Sep 2002 00:00:01 GMT
07 Sep 2002 00:00:01 GMT
07 Sep 2002"
(if (and rfc822-string (stringp rfc822-string))
(when (string-match
(concat
"\\s-*"
;; week day
"\\(\\(Mon\\|Tue\\|Wed\\|Thu\\|Fri\\|Sat\\|Sun\\)\\s-*,?\\)?\\s-*"
;; day
"\\([0-9]\\{1,2\\}\\)\\s-+"
;; month
"\\(Jan\\|Feb\\|Mar\\|Apr\\|May\\|Jun\\|"
"Jul\\|Aug\\|Sep\\|Oct\\|Nov\\|Dec\\).*?\\s-+"
;; year
"\\([0-9]\\{2,4\\}\\)"
;; time may be missing
"\\(\\s-+"
;; hour
"\\([0-9]\\{2\\}\\)"
;; minute
":\\([0-9]\\{2\\}\\)"
;; second
"\\(:\\([0-9]\\{2\\}\\)\\)?"
;; zone -- fixme
"\\(\\s-+\\("
"UT\\|GMT\\|EST\\|EDT\\|CST\\|CDT\\|MST\\|MDT\\|PST\\|PDT"
"\\|\\([-+]\\)\\([0-9]\\{2\\}\\)\\([0-9]\\{2\\}\\)"
"\\)\\)?"
"\\)?")
rfc822-string)
(let ((day (read (match-string 3 rfc822-string)))
(month-name (match-string 4 rfc822-string))
(month 0)
(year (read (match-string 5 rfc822-string)))
(hour (read (or (match-string 7 rfc822-string) "0")))
(minute (read (or (match-string 8 rfc822-string) "0")))
(second (read (or (match-string 10 rfc822-string) "0")))
(zone (match-string 12 rfc822-string))
(sign (match-string 13 rfc822-string))
(offset-hour (read (or (match-string 14 rfc822-string)
"0")))
(offset-minute (read (or (match-string 15 rfc822-string)
"0")))
;;FIXME
)
(when zone
(cond ((string= sign "+")
(setq hour (- hour offset-hour))
(setq minute (- minute offset-minute)))
((string= sign "-")
(setq hour (+ hour offset-hour))
(setq minute (+ minute offset-minute)))))
(condition-case error-data
(let ((i 1))
(dolist (m '("Jan" "Feb" "Mar" "Apr" "May" "Jun" "Jul" "Aug"
"Sep" "Oct" "Nov" "Dec"))
(if (string= month-name m)
(setq month i))
(setq i (1+ i)))
2008-06-08 15:36:18 +00:00
(encode-time second minute hour day month year t))
(error
(message "Cannot decode \"%s\": %s %s" rfc822-string
(car error-data) (cdr error-data))
nil))))
nil))
2008-06-08 15:36:18 +00:00
;; FIXME: Can this be replaced by seq-intersection?
2008-06-08 15:36:18 +00:00
(defun newsticker--lists-intersect-p (list1 list2)
"Return t if LIST1 and LIST2 share elements."
(let ((result nil))
(dolist (elt list1)
(if (memq elt list2)
(setq result t)))
2008-06-08 15:36:18 +00:00
result))
(defun newsticker--update-process-ids ()
"Update list of ids of active newsticker processes.
Checks list of active processes against list of newsticker processes."
(let ((new-list nil))
(dolist (proc (process-list))
(let ((id (process-id proc)))
(if (memq id newsticker--process-ids)
(setq new-list (cons id new-list)))))
2008-06-08 15:36:18 +00:00
(setq newsticker--process-ids new-list))
(force-mode-line-update))
;; ======================================================================
;;; Images
;; ======================================================================
2008-11-24 19:40:35 +00:00
(defun newsticker--images-dir ()
"Return directory where feed images are saved."
(expand-file-name "images/" newsticker-dir))
2008-11-24 19:40:35 +00:00
Newsticker: Show feedicons in treeview. Small fix in opml export. * etc/images/newsticker/README: Add rss-feed.png, rss-feed.svg. * etc/images/newsticker/rss-feed.png: New. * etc/images/newsticker/rss-feed.svg: New. * lisp/net/newst-backend.el: Require url-parse. (newsticker--get-news-by-wget): Store feed name as process property. (newsticker--sentinel): Read feed name from process property. (newsticker--sentinel-work): Rename argument name to feed-name. Rename variable imageurl to image-url. Pick icon url from Atom 1.0 data. Launch download of feed icon. (newsticker--get-icon-url-atom-1.0): New. (newsticker--unxml) (newsticker--unxml-node) (newsticker--unxml-attribute): Documentation. (newsticker--icons-dir): New. (newsticker--image-get): New arguments FILENAME and DIRECTORY. Use `url-retrieve' if `newsticker-retrieval-method' is 'intern. (newsticker--image-download-by-wget): New. Use process properties for storing informations. (newsticker--image-sentinel): Read informations from process properties. (newsticker--image-save) (newsticker--image-remove) (newsticker--image-download-by-url) (newsticker--image-download-by-url-callback): New. (newsticker-opml-export): Handle url list entries containing a function instead of an url string. * lisp/net/newst-reader.el (newsticker-html-renderer): Whitespace. (newsticker--print-extra-elements) (newsticker--do-print-extra-element): Documentation (newsticker--image-read): Optionally limit image height. Use imagemagick if possible. (newsticker--icon-read): New. * lisp/net/newst-treeview.el (newsticker--treeview-item-show): Limit height of feed logo. (newsticker--treeview-tree-expand): Use feed icons in treeview. (newsticker--tree-widget-icon-create): New. Set the tree widget icon. (newsticker--tree-widget-leaf-icon): Use feed icon.
2014-10-19 16:50:15 +00:00
(defun newsticker--icons-dir ()
"Return directory where feed icons are saved."
(expand-file-name "icons/" newsticker-dir))
Newsticker: Show feedicons in treeview. Small fix in opml export. * etc/images/newsticker/README: Add rss-feed.png, rss-feed.svg. * etc/images/newsticker/rss-feed.png: New. * etc/images/newsticker/rss-feed.svg: New. * lisp/net/newst-backend.el: Require url-parse. (newsticker--get-news-by-wget): Store feed name as process property. (newsticker--sentinel): Read feed name from process property. (newsticker--sentinel-work): Rename argument name to feed-name. Rename variable imageurl to image-url. Pick icon url from Atom 1.0 data. Launch download of feed icon. (newsticker--get-icon-url-atom-1.0): New. (newsticker--unxml) (newsticker--unxml-node) (newsticker--unxml-attribute): Documentation. (newsticker--icons-dir): New. (newsticker--image-get): New arguments FILENAME and DIRECTORY. Use `url-retrieve' if `newsticker-retrieval-method' is 'intern. (newsticker--image-download-by-wget): New. Use process properties for storing informations. (newsticker--image-sentinel): Read informations from process properties. (newsticker--image-save) (newsticker--image-remove) (newsticker--image-download-by-url) (newsticker--image-download-by-url-callback): New. (newsticker-opml-export): Handle url list entries containing a function instead of an url string. * lisp/net/newst-reader.el (newsticker-html-renderer): Whitespace. (newsticker--print-extra-elements) (newsticker--do-print-extra-element): Documentation (newsticker--image-read): Optionally limit image height. Use imagemagick if possible. (newsticker--icon-read): New. * lisp/net/newst-treeview.el (newsticker--treeview-item-show): Limit height of feed logo. (newsticker--treeview-tree-expand): Use feed icons in treeview. (newsticker--tree-widget-icon-create): New. Set the tree widget icon. (newsticker--tree-widget-leaf-icon): Use feed icon.
2014-10-19 16:50:15 +00:00
(defun newsticker--image-get (feed-name filename directory url)
"Get image for FEED-NAME by returning FILENAME from DIRECTORY.
If the file does no exist or if it is older than 24 hours
download it from URL first."
(let ((image-name (concat directory feed-name)))
2008-06-08 15:36:18 +00:00
(if (and (file-exists-p image-name)
Prefer nil to (current-time) when either works * doc/misc/gnus.texi (Category Syntax): * lisp/allout-widgets.el (allout-widgets-post-command-business): * lisp/cedet/ede/detect.el (ede-detect-qtest): * lisp/cedet/pulse.el (pulse-momentary-highlight-overlay) (pulse-tick): * lisp/cedet/semantic.el (bovinate): * lisp/cedet/semantic/analyze.el: (semantic-analyze-current-symbol-default, semantic-adebug-analyze): * lisp/cedet/semantic/analyze/refs.el (semantic-analyze-current-tag): * lisp/cedet/semantic/lex.el (semantic-lex-test): * lisp/cedet/semantic/symref/filter.el: (semantic-symref-test-count-hits-in-tag): * lisp/cedet/srecode/dictionary.el (srecode-adebug-dictionary): * lisp/cedet/srecode/map.el (srecode-adebug-maps): * lisp/desktop.el (desktop-create-buffer): * lisp/emacs-lisp/benchmark.el (benchmark-elapse): * lisp/emacs-lisp/elp.el (elp--make-wrapper): * lisp/epa.el (epa--show-key): * lisp/erc/erc.el (erc-lurker-cleanup, erc-lurker-p): * lisp/gnus/gnus-agent.el (gnus-agent-fetch-articles) (gnus-agent-expire-group-1, gnus-agent-store-article): * lisp/gnus/gnus-art.el (article-lapsed-string): * lisp/gnus/gnus-cloud.el (gnus-cloud-update-newsrc-data) (gnus-cloud-collect-full-newsrc): * lisp/gnus/gnus-group.el (gnus-group-timestamp-delta): * lisp/gnus/gnus-html.el (gnus-html-cache-expired): * lisp/gnus/gnus-score.el (gnus-score-load-file) (gnus-decay-scores): * lisp/gnus/nndiary.el (nndiary-expired-article-p): * lisp/gnus/nnmail.el (nnmail-expired-article-p): * lisp/gnus/nnmaildir.el (nnmaildir--scan): * lisp/gnus/score-mode.el (gnus-score-edit-insert-date): * lisp/image/gravatar.el (gravatar-cache-expired): * lisp/net/newst-backend.el (newsticker--image-get) (newsticker--cache-mark-expired): * lisp/nxml/rng-maint.el (rng-time-function): * lisp/org/org-agenda.el (org-agenda-to-appt): * lisp/org/org-clock.el (org-clock-resolve-clock) (org-clock-resolve, org-resolve-clocks-if-idle): * lisp/org/org-colview.el (org-columns-edit-value, org-columns) (org-columns-compute-all, org-agenda-columns): * lisp/org/org-element.el (org-element--cache-interrupt-p) (org-element--cache-sync): * lisp/org/org-habit.el (org-habit-get-faces) (org-habit-insert-consistency-graphs): * lisp/org/org-indent.el (org-indent-add-properties): * lisp/org/org-timer.el (org-timer-start) (org-timer-pause-or-continue, org-timer-seconds) (org-timer-show-remaining-time, org-timer-set-timer): * lisp/org/org.el (org-babel-load-file, org-current-time) (org-today, org-auto-repeat-maybe, org-read-date-analyze) (org-small-year-to-year, org-goto-calendar): * lisp/org/ox.el (org-export-insert-default-template): * lisp/time.el (emacs-uptime): * lisp/type-break.el (type-break-mode, type-break) (type-break-time-warning-schedule, type-break-check): * lisp/url/url-cache.el (url-cache-expired): * lisp/url/url.el (url-retrieve-synchronously): * test/lisp/char-fold-tests.el (char-fold--speed-test): * test/manual/cedet/semantic-ia-utest.el: (semantic-symref-test-count-hits-in-tag): * test/manual/cedet/semantic-tests.el (semantic-idle-pnf-test) (semantic-lex-test-full-depth): Use nil instead of (current-time) where either will do, as nil is a bit more efficient and should have less timing error.
2017-10-21 02:40:09 +00:00
(time-less-p nil
file-attributes cleanup Mostly, this replaces magic-number calls like (nth 4 A) with more-informative calls like (file-attribute-access-time A). It also fixes some documentation and minor timestamp coding issues that I noticed while looking into this. * doc/lispref/files.texi (File Attributes): * lisp/files.el (file-attribute-size) (file-attribute-inode-number, file-attribute-device-number): * src/dired.c (Fdirectory_files_and_attributes) (Ffile_attributes): Mention which attributes must be integers, or nonnegative integers, as opposed to merely being numbers. Remove no-longer-correct talk about representing large integers as conses of integers. * doc/lispref/files.texi (Magic File Names): * doc/misc/gnus.texi (Low-level interface to the spam-stat dictionary): * lisp/autorevert.el (auto-revert-find-file-function) (auto-revert-tail-mode, auto-revert-handler): * lisp/auth-source.el (auth-source-netrc-parse): * lisp/cedet/ede/files.el (ede--inode-for-dir): * lisp/cedet/semantic/db-file.el (object-write): * lisp/cedet/semantic/db-mode.el (semanticdb-kill-hook): * lisp/cedet/semantic/db.el (semanticdb-needs-refresh-p) (semanticdb-synchronize): * lisp/cedet/srecode/table.el (srecode-mode-table-new): * lisp/desktop.el (desktop-save, desktop-read): * lisp/dired-aux.el (dired-file-set-difference) (dired-do-chxxx, dired-do-chmod, dired-copy-file-recursive) (dired-create-files): * lisp/dired.el (dired-directory-changed-p, dired-readin): * lisp/dos-w32.el (w32-direct-print-region-helper): * lisp/emacs-lisp/autoload.el (autoload-generate-file-autoloads) (autoload-find-destination, update-directory-autoloads): * lisp/emacs-lisp/shadow.el (load-path-shadows-same-file-or-nonexistent): * lisp/epg.el (epg--start, epg-wait-for-completion): * lisp/eshell/em-ls.el (eshell-ls-filetype-p) (eshell-ls-applicable, eshell-ls-size-string) (eshell-ls-file, eshell-ls-dir, eshell-ls-files) (eshell-ls-entries): * lisp/eshell/em-pred.el (eshell-predicate-alist) (eshell-pred-file-type, eshell-pred-file-links) (eshell-pred-file-size): * lisp/eshell/em-unix.el (eshell-shuffle-files, eshell/cat) (eshell-du-sum-directory, eshell/du): * lisp/eshell/esh-util.el (eshell-read-passwd) (eshell-read-hosts): * lisp/files.el (remote-file-name-inhibit-cache) (find-file-noselect, insert-file-1, dir-locals-find-file) (dir-locals-read-from-dir, backup-buffer) (file-ownership-preserved-p, copy-directory) (read-file-modes): * lisp/find-lisp.el (find-lisp-format): * lisp/gnus/gnus-agent.el (gnus-agent-unfetch-articles) (gnus-agent-read-agentview, gnus-agent-expire-group-1) (gnus-agent-request-article, gnus-agent-regenerate-group) (gnus-agent-update-files-total-fetched-for) (gnus-agent-update-view-total-fetched-for): * lisp/gnus/gnus-cache.el (gnus-cache-read-active) (gnus-cache-update-file-total-fetched-for) (gnus-cache-update-overview-total-fetched-for): * lisp/gnus/gnus-cloud.el (gnus-cloud-file-new-p): * lisp/gnus/gnus-score.el (gnus-score-score-files): * lisp/gnus/gnus-start.el (gnus-save-newsrc-file) (gnus-master-read-slave-newsrc): * lisp/gnus/gnus-sum.el (gnus-summary-import-article): * lisp/gnus/gnus-util.el (gnus-file-newer-than) (gnus-cache-file-contents): * lisp/gnus/mail-source.el (mail-source-delete-old-incoming) (mail-source-callback, mail-source-movemail): * lisp/gnus/nneething.el (nneething-create-mapping) (nneething-make-head): * lisp/gnus/nnfolder.el (nnfolder-read-folder): * lisp/gnus/nnheader.el (nnheader-file-size) (nnheader-insert-nov-file): * lisp/gnus/nnmail.el (nnmail-activate): * lisp/gnus/nnmaildir.el (nnmaildir--group-maxnum) (nnmaildir--new-number, nnmaildir--update-nov) (nnmaildir--scan, nnmaildir-request-scan) (nnmaildir-request-update-info) (nnmaildir-request-expire-articles): * lisp/gnus/nnmh.el (nnmh-request-list-1) (nnmh-request-expire-articles, nnmh-update-gnus-unreads): * lisp/gnus/nnml.el (nnml-request-expire-articles): * lisp/gnus/spam-stat.el (spam-stat-save, spam-stat-load) (spam-stat-process-directory, spam-stat-test-directory): * lisp/ido.el (ido-directory-too-big-p) (ido-file-name-all-completions): * lisp/image-dired.el (image-dired-get-thumbnail-image) (image-dired-create-thumb-1): * lisp/info.el (info-insert-file-contents): * lisp/ls-lisp.el (ls-lisp-insert-directory) (ls-lisp-handle-switches, ls-lisp-classify-file) (ls-lisp-format): * lisp/mail/blessmail.el: * lisp/mail/feedmail.el (feedmail-default-date-generator) (feedmail-default-message-id-generator): * lisp/mail/mailabbrev.el (mail-abbrevs-sync-aliases) (mail-abbrevs-setup): * lisp/mail/mspools.el (mspools-size-folder): * lisp/mail/rmail.el (rmail-insert-inbox-text): * lisp/mail/sendmail.el (sendmail-sync-aliases): * lisp/mh-e/mh-alias.el (mh-alias-tstamp): * lisp/net/ange-ftp.el (ange-ftp-parse-netrc) (ange-ftp-write-region, ange-ftp-file-newer-than-file-p) (ange-ftp-cf1): * lisp/net/eudcb-mab.el (eudc-mab-query-internal): * lisp/net/eww.el (eww-read-bookmarks): * lisp/net/netrc.el (netrc-parse): * lisp/net/newst-backend.el (newsticker--image-get): * lisp/nxml/rng-loc.el (rng-get-parsed-schema-locating-file): * lisp/obsolete/fast-lock.el (fast-lock-save-cache): * lisp/obsolete/vc-arch.el (vc-arch-state) (vc-arch-diff3-rej-p): * lisp/org/ob-eval.el (org-babel--shell-command-on-region): * lisp/org/org-attach.el (org-attach-commit): * lisp/org/org-macro.el (org-macro-initialize-templates): * lisp/org/org.el (org-babel-load-file) (org-file-newer-than-p): * lisp/org/ox-html.el (org-html-format-spec): * lisp/org/ox-publish.el (org-publish-find-date) (org-publish-cache-ctime-of-src): * lisp/pcmpl-gnu.el (pcomplete/tar): * lisp/pcmpl-rpm.el (pcmpl-rpm-packages): * lisp/play/cookie1.el (cookie-snarf): * lisp/progmodes/cmacexp.el (c-macro-expansion): * lisp/ps-bdf.el (bdf-file-mod-time): * lisp/server.el (server-ensure-safe-dir): * lisp/simple.el (shell-command-on-region): * lisp/speedbar.el (speedbar-item-info-file-helper) (speedbar-check-obj-this-line): * lisp/thumbs.el (thumbs-cleanup-thumbsdir): * lisp/time.el (display-time-mail-check-directory) (display-time-file-nonempty-p): * lisp/url/url-cache.el (url-is-cached): * lisp/url/url-file.el (url-file-asynch-callback): * lisp/vc/diff-mode.el (diff-delete-if-empty): * lisp/vc/pcvs-info.el (cvs-fileinfo-from-entries): * lisp/vc/vc-bzr.el (vc-bzr-state-heuristic): * lisp/vc/vc-cvs.el (vc-cvs-checkout-model) (vc-cvs-state-heuristic, vc-cvs-merge-news) (vc-cvs-retrieve-tag, vc-cvs-parse-status, vc-cvs-parse-entry): * lisp/vc/vc-hg.el (vc-hg--slurp-hgignore-1) (vc-hg--ignore-patterns-valid-p) (vc-hg--cached-dirstate-search, vc-hg-state-fast): * lisp/vc/vc-hooks.el (vc-after-save): * lisp/vc/vc-rcs.el (vc-rcs-workfile-is-newer): * lisp/vc/vc-svn.el (vc-svn-merge-news, vc-svn-parse-status): * lisp/vc/vc.el (vc-checkout, vc-checkin, vc-revert-file): * lisp/xdg.el (xdg-mime-apps): Prefer (file-attribute-size A) to (nth 7 A), and similarly for other file attributes accessors. * doc/lispref/files.texi (File Attributes): * doc/lispref/intro.texi (Version Info): * doc/lispref/os.texi (Idle Timers): * lisp/erc/erc.el (erc-string-to-emacs-time): * lisp/files.el (file-attribute-access-time) (file-attribute-modification-time) (file-attribute-status-change-time): * lisp/net/tramp-compat.el: (tramp-compat-file-attribute-modification-time) (tramp-compat-file-attribute-size): * src/buffer.c (syms_of_buffer): * src/editfns.c (Fget_internal_run_time): * src/fileio.c (Fvisited_file_modtime) (Fset_visited_file_modtime): * src/keyboard.c (Fcurrent_idle_time): * src/process.c (Fprocess_attributes): Defer implementation details about timestamp format to the section that talks about timestamp format, to make it easier to change the documentation later if timestamp formats are extended. * lisp/gnus/gnus-util.el (gnus-file-newer-than): * lisp/speedbar.el (speedbar-check-obj-this-line): * lisp/vc/vc-rcs.el (vc-rcs-workfile-is-newer): Prefer time-less-p to doing it by hand. * lisp/ls-lisp.el (ls-lisp-format): Inode numbers are no longer conses. * lisp/vc/vc-bzr.el (vc-bzr-state-heuristic): Use eql, not eq, to compare integers that might be bignums. * lisp/org/ox-publish.el (org-publish-cache-ctime-of-src): Prefer float-time to doing time arithmetic by hand.
2018-09-24 01:30:46 +00:00
(time-add (file-attribute-modification-time
(file-attributes image-name))
Avoid some double-rounding of Lisp timestamps Also, simplify some time-related Lisp timestamp code while we’re in the neighborhood. * lisp/battery.el (battery-linux-proc-acpi) (battery-linux-sysfs, battery-upower, battery-bsd-apm): * lisp/calendar/timeclock.el (timeclock-seconds-to-string) (timeclock-log, timeclock-last-period) (timeclock-entry-length, timeclock-entry-list-span) (timeclock-find-discrep, timeclock-generate-report): * lisp/cedet/ede/detect.el (ede-detect-qtest): * lisp/completion.el (cmpl-hours-since-origin): * lisp/ecomplete.el (ecomplete-decay-1): * lisp/emacs-lisp/ert.el (ert--results-update-stats-display) (ert--results-update-stats-display-maybe): * lisp/emacs-lisp/timer-list.el (list-timers): * lisp/emacs-lisp/timer.el (timer-until) (timer-event-handler): * lisp/erc/erc-backend.el (erc-server-send-ping) (erc-server-send-queue, erc-handle-parsed-server-response) (erc-handle-unknown-server-response): * lisp/erc/erc-track.el (erc-buffer-visible): * lisp/erc/erc.el (erc-lurker-cleanup, erc-lurker-p) (erc-cmd-PING, erc-send-current-line): * lisp/eshell/em-pred.el (eshell-pred-file-time): * lisp/eshell/em-unix.el (eshell-show-elapsed-time): * lisp/gnus/gnus-icalendar.el (gnus-icalendar-event:org-timestamp): * lisp/gnus/gnus-int.el (gnus-backend-trace): * lisp/gnus/gnus-sum.el (gnus-user-date): * lisp/gnus/mail-source.el (mail-source-delete-crash-box): * lisp/gnus/nnmaildir.el (nnmaildir--scan): * lisp/ibuf-ext.el (ibuffer-mark-old-buffers): * lisp/gnus/nnmaildir.el (nnmaildir--scan): * lisp/mouse.el (mouse--down-1-maybe-follows-link) (mouse--click-1-maybe-follows-link): * lisp/mpc.el (mpc--faster-toggle): * lisp/net/rcirc.el (rcirc-handler-ctcp-KEEPALIVE) (rcirc-sentinel): * lisp/net/tramp-cache.el (tramp-get-file-property): * lisp/net/tramp-sh.el (tramp-sh-handle-file-newer-than-file-p) (tramp-maybe-open-connection): * lisp/net/tramp-smb.el (tramp-smb-maybe-open-connection): * lisp/org/org-clock.el (org-clock-resolve): (org-resolve-clocks, org-clock-in, org-clock-out, org-clock-sum): * lisp/org/org-timer.el (org-timer-start) (org-timer-pause-or-continue, org-timer-seconds): * lisp/org/org.el (org-evaluate-time-range): * lisp/org/ox-publish.el (org-publish-cache-ctime-of-src): * lisp/pixel-scroll.el (pixel-scroll-in-rush-p): * lisp/play/hanoi.el (hanoi-move-ring): * lisp/proced.el (proced-format-time): * lisp/progmodes/cpp.el (cpp-progress-message): * lisp/progmodes/flymake.el (flymake--handle-report): * lisp/progmodes/js.el (js--wait-for-matching-output): * lisp/subr.el (progress-reporter-do-update): * lisp/term/xterm.el (xterm--read-event-for-query): * lisp/time.el (display-time-update, emacs-uptime): * lisp/tooltip.el (tooltip-delay): * lisp/url/url-cookie.el (url-cookie-parse-file-netscape): * lisp/url/url-queue.el (url-queue-prune-old-entries): * lisp/url/url.el (url-retrieve-synchronously): * lisp/xt-mouse.el (xterm-mouse-event): Avoid double-rounding of time-related values. Simplify. * lisp/calendar/icalendar.el (icalendar--decode-isodatetime): When hoping for the best (unlikely), use a better decoded time. (icalendar--convert-sexp-to-ical): Avoid unnecessary encode-time. * lisp/calendar/timeclock.el (timeclock-when-to-leave): * lisp/cedet/ede/detect.el (ede-detect-qtest): * lisp/desktop.el (desktop-create-buffer): * lisp/emacs-lisp/benchmark.el (benchmark-elapse): * lisp/gnus/gnus-art.el (article-lapsed-string): * lisp/gnus/gnus-group.el (gnus-group-timestamp-delta): * lisp/gnus/nnmail.el (nnmail-expired-article-p): * lisp/gnus/nnmaildir.el (nnmaildir-request-expire-articles): * lisp/nxml/rng-maint.el (rng-time-function): * lisp/org/org-clock.el (org-clock-get-clocked-time) (org-clock-resolve, org-resolve-clocks, org-resolve-clocks-if-idle): * lisp/org/org-habit.el (org-habit-insert-consistency-graphs): * lisp/progmodes/vhdl-mode.el (vhdl-update-progress-info) (vhdl-fix-case-region-1): Use time-since instead of open-coding most of it. * lisp/erc/erc-dcc.el (erc-dcc-get-sentinel): * lisp/erc/erc.el (erc-string-to-emacs-time, erc-time-gt): Now obsolete. All uses changed. (erc-time-diff): Accept all Lisp time values. All uses changed. * lisp/gnus/gnus-demon.el (gnus-demon-idle-since): * lisp/gnus/gnus-score.el (gnus-score-headers): * lisp/gnus/nneething.el (nneething-make-head): * lisp/gnus/nnheader.el (nnheader-message-maybe): * lisp/gnus/nnimap.el (nnimap-keepalive): * lisp/image.el (image-animate-timeout): * lisp/mail/feedmail.el (feedmail-rfc822-date): * lisp/net/imap.el (imap-wait-for-tag): * lisp/net/newst-backend.el (newsticker--image-get): * lisp/net/rcirc.el (rcirc-handler-317, rcirc-handler-333): * lisp/obsolete/xesam.el (xesam-refresh-entry): * lisp/org/org-agenda.el (org-agenda-show-clocking-issues) (org-agenda-check-clock-gap, org-agenda-to-appt): * lisp/org/org-capture.el (org-capture-set-target-location): * lisp/org/org-clock.el (org-clock-resolve-clock) (org-clocktable-steps): * lisp/org/org-colview.el (org-columns-edit-value) (org-columns, org-agenda-columns): * lisp/org/org-duration.el (org-duration-from-minutes): * lisp/org/org-element.el (org-element-cache-sync-duration) (org-element-cache-sync-break) (org-element--cache-interrupt-p, org-element--cache-sync): * lisp/org/org-habit.el (org-habit-get-faces) * lisp/org/org-indent.el (org-indent-add-properties): * lisp/org/org-table.el (org-table-sum): * lisp/org/org-timer.el (org-timer-show-remaining-time) (org-timer-set-timer): * lisp/org/org.el (org-babel-load-file, org-today) (org-auto-repeat-maybe, org-2ft, org-time-stamp) (org-read-date-analyze, org-time-stamp-to-now) (org-small-year-to-year, org-goto-calendar): * lisp/org/ox.el (org-export-insert-default-template): * lisp/ses.el (ses--time-check): * lisp/type-break.el (type-break-time-warning) (type-break-statistics, type-break-demo-boring): * lisp/url/url-cache.el (url-cache-expired) (url-cache-prune-cache): * lisp/vc/vc-git.el (vc-git-stash-snapshot): * lisp/erc/erc-match.el (erc-log-matches-come-back): Simplify.
2019-02-23 02:32:31 +00:00
86400)))
2008-06-08 15:36:18 +00:00
(newsticker--debug-msg "%s: Getting image for %s skipped"
Simplify use of current-time and friends. * doc/misc/org.texi (Dynamic blocks): * lisp/allout-widgets.el (allout-widgets-hook-error-handler): * lisp/calendar/appt.el (appt-display-message): * lisp/calendar/icalendar.el (icalendar--convert-float-to-ical): * lisp/calendar/timeclock.el (timeclock-in, timeclock-when-to-leave) (timeclock-last-period, timeclock-day-base): * lisp/eshell/em-ls.el (eshell-ls-file): * lisp/eshell/esh-util.el (eshell-parse-ange-ls): * lisp/generic-x.el (named-database-print-serial): * lisp/net/newst-backend.el (newsticker--get-news-by-url-callback) (newsticker-get-news, newsticker--sentinel-work) (newsticker--image-get, newsticker--image-sentinel): * lisp/net/tramp-sh.el (tramp-get-remote-touch): * lisp/progmodes/opascal.el (opascal-debug-log): * lisp/textmodes/remember.el (remember-mail-date) (remember-store-in-files): * lisp/vc/vc-annotate.el (vc-annotate-display-autoscale) (vc-default-annotate-current-time): * lisp/vc/vc-bzr.el (vc-bzr-shelve-snapshot): * lisp/vc/vc-cvs.el (vc-cvs-annotate-current-time): * lisp/vc/vc-rcs.el (vc-rcs-annotate-current-time): * lisp/url/url-util.el (url-get-normalized-date): * lisp/erc/erc-backend.el (TOPIC): * lisp/gnus/gnus-delay.el (gnus-delay-article): * lisp/gnus/gnus-sum.el (gnus-summary-read-document): * lisp/gnus/gnus-util.el (gnus-seconds-today, gnus-seconds-month): * lisp/gnus/message.el (message-make-expires-date): * lisp/org/org-archive.el (org-archive-subtree) (org-archive-to-archive-sibling): * lisp/org/org-clock.el (org-resolve-clocks, org-clock-get-sum-start) (org-clock-special-range): * lisp/org/org-timer.el (org-timer-seconds): * lisp/org/org.el (org-read-date-analyze, org-get-cursor-date): * lisp/org/ox-html.el (org-html-format-spec): * lisp/org/ox-icalendar.el (org-icalendar--vtodo): Omit unnecessary call to current-time. * lisp/calendar/time-date.el (time-to-seconds) [!float-time]: * lisp/calendar/timeclock.el (timeclock-time-to-date): * lisp/vc/vc-annotate.el (vc-annotate-convert-time): Use current time if arg is nil, to be compatible with float-time. (time-date--day-in-year): New function, with most of the guts of the old time-to-day-in-year. (time-to-day-in-year): Use it. (time-to-days): Use it, to avoid decoding the same time stamp twice. * lisp/calendar/timeclock.el (timeclock-update-mode-line): * lisp/cedet/srecode/args.el (srecode-semantic-handle-:time): * lisp/gnus/gnus-util.el (gnus-seconds-year): * lisp/org/org.el (org-get-cursor-date): Don't call current-time twice to get the current time stamp, as this can lead to inconsistent results. * lisp/completion.el (cmpl-hours-since-origin): * lisp/erc/erc.el (erc-emacs-time-to-erc-time): * lisp/ido.el (ido-time-stamp): * lisp/vc/vc-annotate.el (vc-annotate-convert-time): Simplify by using float-time. * lisp/completion.el (save-completions-to-file): * lisp/url/url-cache.el (url-cache-prune-cache): Rename local var to avoid confusion. * lisp/gnus/gnus-util.el (gnus-float-time): * lisp/net/rcirc.el (rcirc-float-time): * lisp/org/org-compat.el (org-float-time): Simplify to an alias because time-to-seconds now behaves like float-time with respect to nil arg. * lisp/subr.el (progress-reporter-do-update): Don't call float-time unless needed. * lisp/erc/erc.el (erc-current-time): Simplify by using erc-emacs-time-to-erc-time. * lisp/org/org-clock.el (org-clock-get-table-data): Omit unnecessary, lossy conversion from floating point to Emacs time and back. (org-resolve-clocks): Prefer two-argument floor.
2014-10-29 01:42:51 +00:00
(format-time-string "%A, %H:%M")
2008-06-08 15:36:18 +00:00
feed-name)
;; download
(newsticker--debug-msg "%s: Getting image for %s"
Simplify use of current-time and friends. * doc/misc/org.texi (Dynamic blocks): * lisp/allout-widgets.el (allout-widgets-hook-error-handler): * lisp/calendar/appt.el (appt-display-message): * lisp/calendar/icalendar.el (icalendar--convert-float-to-ical): * lisp/calendar/timeclock.el (timeclock-in, timeclock-when-to-leave) (timeclock-last-period, timeclock-day-base): * lisp/eshell/em-ls.el (eshell-ls-file): * lisp/eshell/esh-util.el (eshell-parse-ange-ls): * lisp/generic-x.el (named-database-print-serial): * lisp/net/newst-backend.el (newsticker--get-news-by-url-callback) (newsticker-get-news, newsticker--sentinel-work) (newsticker--image-get, newsticker--image-sentinel): * lisp/net/tramp-sh.el (tramp-get-remote-touch): * lisp/progmodes/opascal.el (opascal-debug-log): * lisp/textmodes/remember.el (remember-mail-date) (remember-store-in-files): * lisp/vc/vc-annotate.el (vc-annotate-display-autoscale) (vc-default-annotate-current-time): * lisp/vc/vc-bzr.el (vc-bzr-shelve-snapshot): * lisp/vc/vc-cvs.el (vc-cvs-annotate-current-time): * lisp/vc/vc-rcs.el (vc-rcs-annotate-current-time): * lisp/url/url-util.el (url-get-normalized-date): * lisp/erc/erc-backend.el (TOPIC): * lisp/gnus/gnus-delay.el (gnus-delay-article): * lisp/gnus/gnus-sum.el (gnus-summary-read-document): * lisp/gnus/gnus-util.el (gnus-seconds-today, gnus-seconds-month): * lisp/gnus/message.el (message-make-expires-date): * lisp/org/org-archive.el (org-archive-subtree) (org-archive-to-archive-sibling): * lisp/org/org-clock.el (org-resolve-clocks, org-clock-get-sum-start) (org-clock-special-range): * lisp/org/org-timer.el (org-timer-seconds): * lisp/org/org.el (org-read-date-analyze, org-get-cursor-date): * lisp/org/ox-html.el (org-html-format-spec): * lisp/org/ox-icalendar.el (org-icalendar--vtodo): Omit unnecessary call to current-time. * lisp/calendar/time-date.el (time-to-seconds) [!float-time]: * lisp/calendar/timeclock.el (timeclock-time-to-date): * lisp/vc/vc-annotate.el (vc-annotate-convert-time): Use current time if arg is nil, to be compatible with float-time. (time-date--day-in-year): New function, with most of the guts of the old time-to-day-in-year. (time-to-day-in-year): Use it. (time-to-days): Use it, to avoid decoding the same time stamp twice. * lisp/calendar/timeclock.el (timeclock-update-mode-line): * lisp/cedet/srecode/args.el (srecode-semantic-handle-:time): * lisp/gnus/gnus-util.el (gnus-seconds-year): * lisp/org/org.el (org-get-cursor-date): Don't call current-time twice to get the current time stamp, as this can lead to inconsistent results. * lisp/completion.el (cmpl-hours-since-origin): * lisp/erc/erc.el (erc-emacs-time-to-erc-time): * lisp/ido.el (ido-time-stamp): * lisp/vc/vc-annotate.el (vc-annotate-convert-time): Simplify by using float-time. * lisp/completion.el (save-completions-to-file): * lisp/url/url-cache.el (url-cache-prune-cache): Rename local var to avoid confusion. * lisp/gnus/gnus-util.el (gnus-float-time): * lisp/net/rcirc.el (rcirc-float-time): * lisp/org/org-compat.el (org-float-time): Simplify to an alias because time-to-seconds now behaves like float-time with respect to nil arg. * lisp/subr.el (progress-reporter-do-update): Don't call float-time unless needed. * lisp/erc/erc.el (erc-current-time): Simplify by using erc-emacs-time-to-erc-time. * lisp/org/org-clock.el (org-clock-get-table-data): Omit unnecessary, lossy conversion from floating point to Emacs time and back. (org-resolve-clocks): Prefer two-argument floor.
2014-10-29 01:42:51 +00:00
(format-time-string "%A, %H:%M")
2008-06-08 15:36:18 +00:00
feed-name)
Newsticker: Show feedicons in treeview. Small fix in opml export. * etc/images/newsticker/README: Add rss-feed.png, rss-feed.svg. * etc/images/newsticker/rss-feed.png: New. * etc/images/newsticker/rss-feed.svg: New. * lisp/net/newst-backend.el: Require url-parse. (newsticker--get-news-by-wget): Store feed name as process property. (newsticker--sentinel): Read feed name from process property. (newsticker--sentinel-work): Rename argument name to feed-name. Rename variable imageurl to image-url. Pick icon url from Atom 1.0 data. Launch download of feed icon. (newsticker--get-icon-url-atom-1.0): New. (newsticker--unxml) (newsticker--unxml-node) (newsticker--unxml-attribute): Documentation. (newsticker--icons-dir): New. (newsticker--image-get): New arguments FILENAME and DIRECTORY. Use `url-retrieve' if `newsticker-retrieval-method' is 'intern. (newsticker--image-download-by-wget): New. Use process properties for storing informations. (newsticker--image-sentinel): Read informations from process properties. (newsticker--image-save) (newsticker--image-remove) (newsticker--image-download-by-url) (newsticker--image-download-by-url-callback): New. (newsticker-opml-export): Handle url list entries containing a function instead of an url string. * lisp/net/newst-reader.el (newsticker-html-renderer): Whitespace. (newsticker--print-extra-elements) (newsticker--do-print-extra-element): Documentation (newsticker--image-read): Optionally limit image height. Use imagemagick if possible. (newsticker--icon-read): New. * lisp/net/newst-treeview.el (newsticker--treeview-item-show): Limit height of feed logo. (newsticker--treeview-tree-expand): Use feed icons in treeview. (newsticker--tree-widget-icon-create): New. Set the tree widget icon. (newsticker--tree-widget-leaf-icon): Use feed icon.
2014-10-19 16:50:15 +00:00
(if (eq newsticker-retrieval-method 'intern)
(newsticker--image-download-by-url feed-name filename directory url)
(newsticker--image-download-by-wget feed-name filename directory url)))))
(defun newsticker--image-download-by-wget (feed-name filename directory url)
"Download image for FEED-NAME using external program.
Save image as FILENAME in DIRECTORY, download it from URL."
(let* ((proc-name (concat feed-name "-" filename))
(buffername (concat " *newsticker-wget-image-" proc-name "*"))
(item (or (assoc feed-name newsticker-url-list)
(assoc feed-name newsticker-url-list-defaults)
(error
"Cannot get image for %s: Check newsticker-url-list"
feed-name)))
Newsticker: Show feedicons in treeview. Small fix in opml export. * etc/images/newsticker/README: Add rss-feed.png, rss-feed.svg. * etc/images/newsticker/rss-feed.png: New. * etc/images/newsticker/rss-feed.svg: New. * lisp/net/newst-backend.el: Require url-parse. (newsticker--get-news-by-wget): Store feed name as process property. (newsticker--sentinel): Read feed name from process property. (newsticker--sentinel-work): Rename argument name to feed-name. Rename variable imageurl to image-url. Pick icon url from Atom 1.0 data. Launch download of feed icon. (newsticker--get-icon-url-atom-1.0): New. (newsticker--unxml) (newsticker--unxml-node) (newsticker--unxml-attribute): Documentation. (newsticker--icons-dir): New. (newsticker--image-get): New arguments FILENAME and DIRECTORY. Use `url-retrieve' if `newsticker-retrieval-method' is 'intern. (newsticker--image-download-by-wget): New. Use process properties for storing informations. (newsticker--image-sentinel): Read informations from process properties. (newsticker--image-save) (newsticker--image-remove) (newsticker--image-download-by-url) (newsticker--image-download-by-url-callback): New. (newsticker-opml-export): Handle url list entries containing a function instead of an url string. * lisp/net/newst-reader.el (newsticker-html-renderer): Whitespace. (newsticker--print-extra-elements) (newsticker--do-print-extra-element): Documentation (newsticker--image-read): Optionally limit image height. Use imagemagick if possible. (newsticker--icon-read): New. * lisp/net/newst-treeview.el (newsticker--treeview-item-show): Limit height of feed logo. (newsticker--treeview-tree-expand): Use feed icons in treeview. (newsticker--tree-widget-icon-create): New. Set the tree widget icon. (newsticker--tree-widget-leaf-icon): Use feed icon.
2014-10-19 16:50:15 +00:00
(wget-arguments (or (car (cdr (cdr (cdr (cdr item)))))
newsticker-wget-arguments)))
(with-current-buffer (get-buffer-create buffername)
(erase-buffer)
;; throw an error if there is an old wget-process around
(if (get-process feed-name)
(error "Another wget-process is running for image %s"
feed-name))
;; start wget
(let* ((args (append wget-arguments (list url)))
* lisp/net/*.el: Use lexical-binding Also remove some redundant `:group` arguments. * lisp/net/eudc-export.el: Use lexical-binding. (eudc-create-bbdb-record): Use `cl-progv` and `apply` to avoid `eval`. * lisp/net/eudc-hotlist.el: Use lexical-binding. * lisp/net/eudc.el (eudc-print-attribute-value): Use `funcall` to avoid `eval`. * lisp/net/eudcb-bbdb.el: Use lexical-binding. (eudc-bbdb-filter-non-matching-record): Use `funcall` to avoid `eval`. Move `bbdb-val` binding to avoid `setq`. Use `seq-some` instead of `eval+or`. (eudc-bbdb-format-record-as-result): Use `dolist` and `pcase`. Use `funcall` to avoid `eval`. (eudc-bbdb-query-internal): Simplify a bit. * lisp/net/eudcb-ldap.el: Use lexical-binding. (eudc-ldap-get-host-parameter): Use `defalias` to avoid `eval-and-compile`. * lisp/net/telnet.el: Use lexical-binding. * lisp/net/quickurl.el: Use lexical-binding. * lisp/net/newst-ticker.el: Use lexical-binding. * lisp/net/newst-reader.el: Use lexical-binding. * lisp/net/goto-addr.el: Use lexical-binding. * lisp/net/gnutls.el: Use lexical-binding. * lisp/net/eudcb-macos-contacts.el: Use lexical-binding. * lisp/net/eudcb-mab.el: Use lexical-binding. * lisp/net/net-utils.el: Use lexical-binding. (finger): Remove unused var `found`. * lisp/net/network-stream.el (open-protocol-stream): Remove redundant `defalias`. * lisp/net/newst-plainview.el: Use lexical-binding. (newsticker-hide-entry, newsticker-show-entry): Remove unused var `is-invisible`. (w3m-fill-column, w3-maximum-line-length): Declare vars. * lisp/net/tramp.el (tramp-compute-multi-hops): * lisp/net/tramp-compat.el (tramp-compat-temporary-file-directory): * lisp/net/tramp-cmds.el (tramp-default-rename-file): * lisp/net/webjump.el (webjump): Don't forget lexical-binding for `eval`.
2021-03-08 15:11:22 +00:00
(proc (apply #'start-process proc-name buffername
newsticker-wget-name args)))
(set-process-coding-system proc 'no-conversion 'no-conversion)
* lisp/net/*.el: Use lexical-binding Also remove some redundant `:group` arguments. * lisp/net/eudc-export.el: Use lexical-binding. (eudc-create-bbdb-record): Use `cl-progv` and `apply` to avoid `eval`. * lisp/net/eudc-hotlist.el: Use lexical-binding. * lisp/net/eudc.el (eudc-print-attribute-value): Use `funcall` to avoid `eval`. * lisp/net/eudcb-bbdb.el: Use lexical-binding. (eudc-bbdb-filter-non-matching-record): Use `funcall` to avoid `eval`. Move `bbdb-val` binding to avoid `setq`. Use `seq-some` instead of `eval+or`. (eudc-bbdb-format-record-as-result): Use `dolist` and `pcase`. Use `funcall` to avoid `eval`. (eudc-bbdb-query-internal): Simplify a bit. * lisp/net/eudcb-ldap.el: Use lexical-binding. (eudc-ldap-get-host-parameter): Use `defalias` to avoid `eval-and-compile`. * lisp/net/telnet.el: Use lexical-binding. * lisp/net/quickurl.el: Use lexical-binding. * lisp/net/newst-ticker.el: Use lexical-binding. * lisp/net/newst-reader.el: Use lexical-binding. * lisp/net/goto-addr.el: Use lexical-binding. * lisp/net/gnutls.el: Use lexical-binding. * lisp/net/eudcb-macos-contacts.el: Use lexical-binding. * lisp/net/eudcb-mab.el: Use lexical-binding. * lisp/net/net-utils.el: Use lexical-binding. (finger): Remove unused var `found`. * lisp/net/network-stream.el (open-protocol-stream): Remove redundant `defalias`. * lisp/net/newst-plainview.el: Use lexical-binding. (newsticker-hide-entry, newsticker-show-entry): Remove unused var `is-invisible`. (w3m-fill-column, w3-maximum-line-length): Declare vars. * lisp/net/tramp.el (tramp-compute-multi-hops): * lisp/net/tramp-compat.el (tramp-compat-temporary-file-directory): * lisp/net/tramp-cmds.el (tramp-default-rename-file): * lisp/net/webjump.el (webjump): Don't forget lexical-binding for `eval`.
2021-03-08 15:11:22 +00:00
(set-process-sentinel proc #'newsticker--image-sentinel)
(process-put proc 'nt-directory directory)
(process-put proc 'nt-feed-name feed-name)
(process-put proc 'nt-filename filename)))))
2008-06-08 15:36:18 +00:00
(defun newsticker--image-sentinel (process _event)
2008-06-08 15:36:18 +00:00
"Sentinel for image-retrieving PROCESS caused by EVENT."
(let* ((p-status (process-status process))
(exit-status (process-exit-status process))
Newsticker: Show feedicons in treeview. Small fix in opml export. * etc/images/newsticker/README: Add rss-feed.png, rss-feed.svg. * etc/images/newsticker/rss-feed.png: New. * etc/images/newsticker/rss-feed.svg: New. * lisp/net/newst-backend.el: Require url-parse. (newsticker--get-news-by-wget): Store feed name as process property. (newsticker--sentinel): Read feed name from process property. (newsticker--sentinel-work): Rename argument name to feed-name. Rename variable imageurl to image-url. Pick icon url from Atom 1.0 data. Launch download of feed icon. (newsticker--get-icon-url-atom-1.0): New. (newsticker--unxml) (newsticker--unxml-node) (newsticker--unxml-attribute): Documentation. (newsticker--icons-dir): New. (newsticker--image-get): New arguments FILENAME and DIRECTORY. Use `url-retrieve' if `newsticker-retrieval-method' is 'intern. (newsticker--image-download-by-wget): New. Use process properties for storing informations. (newsticker--image-sentinel): Read informations from process properties. (newsticker--image-save) (newsticker--image-remove) (newsticker--image-download-by-url) (newsticker--image-download-by-url-callback): New. (newsticker-opml-export): Handle url list entries containing a function instead of an url string. * lisp/net/newst-reader.el (newsticker-html-renderer): Whitespace. (newsticker--print-extra-elements) (newsticker--do-print-extra-element): Documentation (newsticker--image-read): Optionally limit image height. Use imagemagick if possible. (newsticker--icon-read): New. * lisp/net/newst-treeview.el (newsticker--treeview-item-show): Limit height of feed logo. (newsticker--treeview-tree-expand): Use feed icons in treeview. (newsticker--tree-widget-icon-create): New. Set the tree widget icon. (newsticker--tree-widget-leaf-icon): Use feed icon.
2014-10-19 16:50:15 +00:00
(feed-name (process-get process 'nt-feed-name))
(directory (process-get process 'nt-directory))
(filename (process-get process 'nt-filename)))
2008-06-08 15:36:18 +00:00
;; catch known errors (zombie processes, rubbish-xml, etc.)
;; if an error occurs the news feed is not updated!
(catch 'oops
(unless (and (eq p-status 'exit)
(= exit-status 0))
(message "%s: Error while retrieving image from %s"
Simplify use of current-time and friends. * doc/misc/org.texi (Dynamic blocks): * lisp/allout-widgets.el (allout-widgets-hook-error-handler): * lisp/calendar/appt.el (appt-display-message): * lisp/calendar/icalendar.el (icalendar--convert-float-to-ical): * lisp/calendar/timeclock.el (timeclock-in, timeclock-when-to-leave) (timeclock-last-period, timeclock-day-base): * lisp/eshell/em-ls.el (eshell-ls-file): * lisp/eshell/esh-util.el (eshell-parse-ange-ls): * lisp/generic-x.el (named-database-print-serial): * lisp/net/newst-backend.el (newsticker--get-news-by-url-callback) (newsticker-get-news, newsticker--sentinel-work) (newsticker--image-get, newsticker--image-sentinel): * lisp/net/tramp-sh.el (tramp-get-remote-touch): * lisp/progmodes/opascal.el (opascal-debug-log): * lisp/textmodes/remember.el (remember-mail-date) (remember-store-in-files): * lisp/vc/vc-annotate.el (vc-annotate-display-autoscale) (vc-default-annotate-current-time): * lisp/vc/vc-bzr.el (vc-bzr-shelve-snapshot): * lisp/vc/vc-cvs.el (vc-cvs-annotate-current-time): * lisp/vc/vc-rcs.el (vc-rcs-annotate-current-time): * lisp/url/url-util.el (url-get-normalized-date): * lisp/erc/erc-backend.el (TOPIC): * lisp/gnus/gnus-delay.el (gnus-delay-article): * lisp/gnus/gnus-sum.el (gnus-summary-read-document): * lisp/gnus/gnus-util.el (gnus-seconds-today, gnus-seconds-month): * lisp/gnus/message.el (message-make-expires-date): * lisp/org/org-archive.el (org-archive-subtree) (org-archive-to-archive-sibling): * lisp/org/org-clock.el (org-resolve-clocks, org-clock-get-sum-start) (org-clock-special-range): * lisp/org/org-timer.el (org-timer-seconds): * lisp/org/org.el (org-read-date-analyze, org-get-cursor-date): * lisp/org/ox-html.el (org-html-format-spec): * lisp/org/ox-icalendar.el (org-icalendar--vtodo): Omit unnecessary call to current-time. * lisp/calendar/time-date.el (time-to-seconds) [!float-time]: * lisp/calendar/timeclock.el (timeclock-time-to-date): * lisp/vc/vc-annotate.el (vc-annotate-convert-time): Use current time if arg is nil, to be compatible with float-time. (time-date--day-in-year): New function, with most of the guts of the old time-to-day-in-year. (time-to-day-in-year): Use it. (time-to-days): Use it, to avoid decoding the same time stamp twice. * lisp/calendar/timeclock.el (timeclock-update-mode-line): * lisp/cedet/srecode/args.el (srecode-semantic-handle-:time): * lisp/gnus/gnus-util.el (gnus-seconds-year): * lisp/org/org.el (org-get-cursor-date): Don't call current-time twice to get the current time stamp, as this can lead to inconsistent results. * lisp/completion.el (cmpl-hours-since-origin): * lisp/erc/erc.el (erc-emacs-time-to-erc-time): * lisp/ido.el (ido-time-stamp): * lisp/vc/vc-annotate.el (vc-annotate-convert-time): Simplify by using float-time. * lisp/completion.el (save-completions-to-file): * lisp/url/url-cache.el (url-cache-prune-cache): Rename local var to avoid confusion. * lisp/gnus/gnus-util.el (gnus-float-time): * lisp/net/rcirc.el (rcirc-float-time): * lisp/org/org-compat.el (org-float-time): Simplify to an alias because time-to-seconds now behaves like float-time with respect to nil arg. * lisp/subr.el (progress-reporter-do-update): Don't call float-time unless needed. * lisp/erc/erc.el (erc-current-time): Simplify by using erc-emacs-time-to-erc-time. * lisp/org/org-clock.el (org-clock-get-table-data): Omit unnecessary, lossy conversion from floating point to Emacs time and back. (org-resolve-clocks): Prefer two-argument floor.
2014-10-29 01:42:51 +00:00
(format-time-string "%A, %H:%M")
2008-06-08 15:36:18 +00:00
feed-name)
Newsticker: Show feedicons in treeview. Small fix in opml export. * etc/images/newsticker/README: Add rss-feed.png, rss-feed.svg. * etc/images/newsticker/rss-feed.png: New. * etc/images/newsticker/rss-feed.svg: New. * lisp/net/newst-backend.el: Require url-parse. (newsticker--get-news-by-wget): Store feed name as process property. (newsticker--sentinel): Read feed name from process property. (newsticker--sentinel-work): Rename argument name to feed-name. Rename variable imageurl to image-url. Pick icon url from Atom 1.0 data. Launch download of feed icon. (newsticker--get-icon-url-atom-1.0): New. (newsticker--unxml) (newsticker--unxml-node) (newsticker--unxml-attribute): Documentation. (newsticker--icons-dir): New. (newsticker--image-get): New arguments FILENAME and DIRECTORY. Use `url-retrieve' if `newsticker-retrieval-method' is 'intern. (newsticker--image-download-by-wget): New. Use process properties for storing informations. (newsticker--image-sentinel): Read informations from process properties. (newsticker--image-save) (newsticker--image-remove) (newsticker--image-download-by-url) (newsticker--image-download-by-url-callback): New. (newsticker-opml-export): Handle url list entries containing a function instead of an url string. * lisp/net/newst-reader.el (newsticker-html-renderer): Whitespace. (newsticker--print-extra-elements) (newsticker--do-print-extra-element): Documentation (newsticker--image-read): Optionally limit image height. Use imagemagick if possible. (newsticker--icon-read): New. * lisp/net/newst-treeview.el (newsticker--treeview-item-show): Limit height of feed logo. (newsticker--treeview-tree-expand): Use feed icons in treeview. (newsticker--tree-widget-icon-create): New. Set the tree widget icon. (newsticker--tree-widget-leaf-icon): Use feed icon.
2014-10-19 16:50:15 +00:00
(newsticker--image-remove directory feed-name)
2008-06-08 15:36:18 +00:00
(throw 'oops nil))
Newsticker: Show feedicons in treeview. Small fix in opml export. * etc/images/newsticker/README: Add rss-feed.png, rss-feed.svg. * etc/images/newsticker/rss-feed.png: New. * etc/images/newsticker/rss-feed.svg: New. * lisp/net/newst-backend.el: Require url-parse. (newsticker--get-news-by-wget): Store feed name as process property. (newsticker--sentinel): Read feed name from process property. (newsticker--sentinel-work): Rename argument name to feed-name. Rename variable imageurl to image-url. Pick icon url from Atom 1.0 data. Launch download of feed icon. (newsticker--get-icon-url-atom-1.0): New. (newsticker--unxml) (newsticker--unxml-node) (newsticker--unxml-attribute): Documentation. (newsticker--icons-dir): New. (newsticker--image-get): New arguments FILENAME and DIRECTORY. Use `url-retrieve' if `newsticker-retrieval-method' is 'intern. (newsticker--image-download-by-wget): New. Use process properties for storing informations. (newsticker--image-sentinel): Read informations from process properties. (newsticker--image-save) (newsticker--image-remove) (newsticker--image-download-by-url) (newsticker--image-download-by-url-callback): New. (newsticker-opml-export): Handle url list entries containing a function instead of an url string. * lisp/net/newst-reader.el (newsticker-html-renderer): Whitespace. (newsticker--print-extra-elements) (newsticker--do-print-extra-element): Documentation (newsticker--image-read): Optionally limit image height. Use imagemagick if possible. (newsticker--icon-read): New. * lisp/net/newst-treeview.el (newsticker--treeview-item-show): Limit height of feed logo. (newsticker--treeview-tree-expand): Use feed icons in treeview. (newsticker--tree-widget-icon-create): New. Set the tree widget icon. (newsticker--tree-widget-leaf-icon): Use feed icon.
2014-10-19 16:50:15 +00:00
(newsticker--image-save (process-buffer process) directory filename))))
(defun newsticker--image-save (buffer directory file-name)
"Save contents of BUFFER in DIRECTORY as FILE-NAME.
Finally kill buffer."
(with-current-buffer buffer
(let ((image-name (concat directory file-name)))
(set-buffer-file-coding-system 'no-conversion)
;; make sure the cache dir exists
(unless (file-directory-p directory)
(make-directory directory))
;; write and close buffer
(let ((require-final-newline nil)
(backup-inhibited t)
(coding-system-for-write 'no-conversion))
(write-region nil nil image-name nil 'quiet))
(set-buffer-modified-p nil)
(kill-buffer buffer))))
Newsticker: Show feedicons in treeview. Small fix in opml export. * etc/images/newsticker/README: Add rss-feed.png, rss-feed.svg. * etc/images/newsticker/rss-feed.png: New. * etc/images/newsticker/rss-feed.svg: New. * lisp/net/newst-backend.el: Require url-parse. (newsticker--get-news-by-wget): Store feed name as process property. (newsticker--sentinel): Read feed name from process property. (newsticker--sentinel-work): Rename argument name to feed-name. Rename variable imageurl to image-url. Pick icon url from Atom 1.0 data. Launch download of feed icon. (newsticker--get-icon-url-atom-1.0): New. (newsticker--unxml) (newsticker--unxml-node) (newsticker--unxml-attribute): Documentation. (newsticker--icons-dir): New. (newsticker--image-get): New arguments FILENAME and DIRECTORY. Use `url-retrieve' if `newsticker-retrieval-method' is 'intern. (newsticker--image-download-by-wget): New. Use process properties for storing informations. (newsticker--image-sentinel): Read informations from process properties. (newsticker--image-save) (newsticker--image-remove) (newsticker--image-download-by-url) (newsticker--image-download-by-url-callback): New. (newsticker-opml-export): Handle url list entries containing a function instead of an url string. * lisp/net/newst-reader.el (newsticker-html-renderer): Whitespace. (newsticker--print-extra-elements) (newsticker--do-print-extra-element): Documentation (newsticker--image-read): Optionally limit image height. Use imagemagick if possible. (newsticker--icon-read): New. * lisp/net/newst-treeview.el (newsticker--treeview-item-show): Limit height of feed logo. (newsticker--treeview-tree-expand): Use feed icons in treeview. (newsticker--tree-widget-icon-create): New. Set the tree widget icon. (newsticker--tree-widget-leaf-icon): Use feed icon.
2014-10-19 16:50:15 +00:00
(defun newsticker--image-remove (directory file-name)
"In DIRECTORY remove FILE-NAME."
(let ((image-name (concat directory file-name)))
(when (file-exists-p file-name)
(delete-file image-name))))
(defun newsticker--image-download-by-url (feed-name filename directory url)
"Download image for FEED-NAME using `url-retrieve'.
Save image as FILENAME in DIRECTORY, download it from URL."
(let ((coding-system-for-read 'no-conversion))
(condition-case error-data
(url-retrieve url 'newsticker--image-download-by-url-callback
(list feed-name directory filename))
(error (message "Error retrieving image from %s: %s" feed-name
error-data))))
Newsticker: Show feedicons in treeview. Small fix in opml export. * etc/images/newsticker/README: Add rss-feed.png, rss-feed.svg. * etc/images/newsticker/rss-feed.png: New. * etc/images/newsticker/rss-feed.svg: New. * lisp/net/newst-backend.el: Require url-parse. (newsticker--get-news-by-wget): Store feed name as process property. (newsticker--sentinel): Read feed name from process property. (newsticker--sentinel-work): Rename argument name to feed-name. Rename variable imageurl to image-url. Pick icon url from Atom 1.0 data. Launch download of feed icon. (newsticker--get-icon-url-atom-1.0): New. (newsticker--unxml) (newsticker--unxml-node) (newsticker--unxml-attribute): Documentation. (newsticker--icons-dir): New. (newsticker--image-get): New arguments FILENAME and DIRECTORY. Use `url-retrieve' if `newsticker-retrieval-method' is 'intern. (newsticker--image-download-by-wget): New. Use process properties for storing informations. (newsticker--image-sentinel): Read informations from process properties. (newsticker--image-save) (newsticker--image-remove) (newsticker--image-download-by-url) (newsticker--image-download-by-url-callback): New. (newsticker-opml-export): Handle url list entries containing a function instead of an url string. * lisp/net/newst-reader.el (newsticker-html-renderer): Whitespace. (newsticker--print-extra-elements) (newsticker--do-print-extra-element): Documentation (newsticker--image-read): Optionally limit image height. Use imagemagick if possible. (newsticker--icon-read): New. * lisp/net/newst-treeview.el (newsticker--treeview-item-show): Limit height of feed logo. (newsticker--treeview-tree-expand): Use feed icons in treeview. (newsticker--tree-widget-icon-create): New. Set the tree widget icon. (newsticker--tree-widget-leaf-icon): Use feed icon.
2014-10-19 16:50:15 +00:00
(force-mode-line-update))
(defun newsticker--image-download-by-url-callback (status feed-name directory filename)
"Callback function for `newsticker--image-download-by-url'.
STATUS is the return status as delivered by `url-retrieve'.
FEED-NAME is the name of the feed that the news were retrieved
from.
The image is saved in DIRECTORY as FILENAME."
(let ((do-save
(or (not status)
;; (let ((status-type (car status)))
;; (cond ((eq status-type :redirect)
;; ;; don't care about redirects
;; t)
;; ((eq status-type :error)
;; ;; silently ignore errors
;; nil)))
(eq (car status) :redirect))))
(when do-save
(let ((buf (get-buffer-create (concat " *newsticker-url-image-" feed-name "-"
directory "*")))
(result (buffer-string)))
(set-buffer buf)
(erase-buffer)
(newsticker--insert-bytes result)
;; remove MIME header
(goto-char (point-min))
(search-forward "\n\n")
(delete-region (point-min) (point))
;; save
(newsticker--image-save buf directory filename)))))
2008-06-08 15:36:18 +00:00
(defun newsticker--insert-image (img string)
"Insert IMG with STRING at point."
(insert-image img string))
;; ======================================================================
;;; HTML rendering
;; ======================================================================
(defun newsticker-htmlr-render (pos1 pos2) ;
"Replacement for `htmlr-render'.
Renders the HTML code in the region POS1 to POS2 using htmlr."
(let ((str (buffer-substring-no-properties pos1 pos2)))
(delete-region pos1 pos2)
(insert
(with-temp-buffer
(insert str)
(goto-char (point-min))
;; begin original htmlr-render
(when (fboundp 'htmlr-reset) (htmlr-reset))
;; something omitted here...
(when (fboundp 'htmlr-step)
(while (< (point) (point-max))
(htmlr-step)))
;; end original htmlr-render
(newsticker--remove-whitespace (buffer-string))))))
;; ======================================================================
;;; Manipulation of cached data
;; ======================================================================
(defun newsticker--cache-set-preformatted-contents (item contents)
"Set preformatted contents of ITEM to CONTENTS."
(if (nthcdr 6 item)
(setcar (nthcdr 6 item) contents)
(setcdr (nthcdr 5 item) (list contents))))
(defun newsticker--cache-set-preformatted-title (item title)
"Set preformatted title of ITEM to TITLE."
(if (nthcdr 7 item)
(setcar (nthcdr 7 item) title)
(setcdr (nthcdr 6 item) title)))
(defun newsticker--cache-replace-age (data feed old-age new-age)
"Mark all items in DATA in FEED which carry age OLD-AGE with NEW-AGE.
If FEED is `any' it applies to all feeds. If OLD-AGE is `any',
2008-06-08 15:36:18 +00:00
all marks are replaced by NEW-AGE. Removes all pre-formatted contents."
(mapc (lambda (a-feed)
(when (or (eq feed 'any)
(eq (car a-feed) feed))
(let ((items (cdr a-feed)))
(mapc (lambda (item)
(when (or (eq old-age 'any)
(eq (newsticker--age item) old-age))
(setcar (nthcdr 4 item) new-age)
(newsticker--do-forget-preformatted item)))
items))))
data)
data)
(defun newsticker--cache-mark-expired (data feed old-age new-age time)
"Mark all expired entries.
This function sets the age entries in DATA in the feed FEED. If
an item's age is OLD-AGE it is set to NEW-AGE if the item is
older than TIME."
(mapc
(lambda (a-feed)
(when (or (eq feed 'any)
(eq (car a-feed) feed))
(let ((items (cdr a-feed)))
(mapc
(lambda (item)
(when (eq (newsticker--age item) old-age)
Avoid some double-rounding of Lisp timestamps Also, simplify some time-related Lisp timestamp code while we’re in the neighborhood. * lisp/battery.el (battery-linux-proc-acpi) (battery-linux-sysfs, battery-upower, battery-bsd-apm): * lisp/calendar/timeclock.el (timeclock-seconds-to-string) (timeclock-log, timeclock-last-period) (timeclock-entry-length, timeclock-entry-list-span) (timeclock-find-discrep, timeclock-generate-report): * lisp/cedet/ede/detect.el (ede-detect-qtest): * lisp/completion.el (cmpl-hours-since-origin): * lisp/ecomplete.el (ecomplete-decay-1): * lisp/emacs-lisp/ert.el (ert--results-update-stats-display) (ert--results-update-stats-display-maybe): * lisp/emacs-lisp/timer-list.el (list-timers): * lisp/emacs-lisp/timer.el (timer-until) (timer-event-handler): * lisp/erc/erc-backend.el (erc-server-send-ping) (erc-server-send-queue, erc-handle-parsed-server-response) (erc-handle-unknown-server-response): * lisp/erc/erc-track.el (erc-buffer-visible): * lisp/erc/erc.el (erc-lurker-cleanup, erc-lurker-p) (erc-cmd-PING, erc-send-current-line): * lisp/eshell/em-pred.el (eshell-pred-file-time): * lisp/eshell/em-unix.el (eshell-show-elapsed-time): * lisp/gnus/gnus-icalendar.el (gnus-icalendar-event:org-timestamp): * lisp/gnus/gnus-int.el (gnus-backend-trace): * lisp/gnus/gnus-sum.el (gnus-user-date): * lisp/gnus/mail-source.el (mail-source-delete-crash-box): * lisp/gnus/nnmaildir.el (nnmaildir--scan): * lisp/ibuf-ext.el (ibuffer-mark-old-buffers): * lisp/gnus/nnmaildir.el (nnmaildir--scan): * lisp/mouse.el (mouse--down-1-maybe-follows-link) (mouse--click-1-maybe-follows-link): * lisp/mpc.el (mpc--faster-toggle): * lisp/net/rcirc.el (rcirc-handler-ctcp-KEEPALIVE) (rcirc-sentinel): * lisp/net/tramp-cache.el (tramp-get-file-property): * lisp/net/tramp-sh.el (tramp-sh-handle-file-newer-than-file-p) (tramp-maybe-open-connection): * lisp/net/tramp-smb.el (tramp-smb-maybe-open-connection): * lisp/org/org-clock.el (org-clock-resolve): (org-resolve-clocks, org-clock-in, org-clock-out, org-clock-sum): * lisp/org/org-timer.el (org-timer-start) (org-timer-pause-or-continue, org-timer-seconds): * lisp/org/org.el (org-evaluate-time-range): * lisp/org/ox-publish.el (org-publish-cache-ctime-of-src): * lisp/pixel-scroll.el (pixel-scroll-in-rush-p): * lisp/play/hanoi.el (hanoi-move-ring): * lisp/proced.el (proced-format-time): * lisp/progmodes/cpp.el (cpp-progress-message): * lisp/progmodes/flymake.el (flymake--handle-report): * lisp/progmodes/js.el (js--wait-for-matching-output): * lisp/subr.el (progress-reporter-do-update): * lisp/term/xterm.el (xterm--read-event-for-query): * lisp/time.el (display-time-update, emacs-uptime): * lisp/tooltip.el (tooltip-delay): * lisp/url/url-cookie.el (url-cookie-parse-file-netscape): * lisp/url/url-queue.el (url-queue-prune-old-entries): * lisp/url/url.el (url-retrieve-synchronously): * lisp/xt-mouse.el (xterm-mouse-event): Avoid double-rounding of time-related values. Simplify. * lisp/calendar/icalendar.el (icalendar--decode-isodatetime): When hoping for the best (unlikely), use a better decoded time. (icalendar--convert-sexp-to-ical): Avoid unnecessary encode-time. * lisp/calendar/timeclock.el (timeclock-when-to-leave): * lisp/cedet/ede/detect.el (ede-detect-qtest): * lisp/desktop.el (desktop-create-buffer): * lisp/emacs-lisp/benchmark.el (benchmark-elapse): * lisp/gnus/gnus-art.el (article-lapsed-string): * lisp/gnus/gnus-group.el (gnus-group-timestamp-delta): * lisp/gnus/nnmail.el (nnmail-expired-article-p): * lisp/gnus/nnmaildir.el (nnmaildir-request-expire-articles): * lisp/nxml/rng-maint.el (rng-time-function): * lisp/org/org-clock.el (org-clock-get-clocked-time) (org-clock-resolve, org-resolve-clocks, org-resolve-clocks-if-idle): * lisp/org/org-habit.el (org-habit-insert-consistency-graphs): * lisp/progmodes/vhdl-mode.el (vhdl-update-progress-info) (vhdl-fix-case-region-1): Use time-since instead of open-coding most of it. * lisp/erc/erc-dcc.el (erc-dcc-get-sentinel): * lisp/erc/erc.el (erc-string-to-emacs-time, erc-time-gt): Now obsolete. All uses changed. (erc-time-diff): Accept all Lisp time values. All uses changed. * lisp/gnus/gnus-demon.el (gnus-demon-idle-since): * lisp/gnus/gnus-score.el (gnus-score-headers): * lisp/gnus/nneething.el (nneething-make-head): * lisp/gnus/nnheader.el (nnheader-message-maybe): * lisp/gnus/nnimap.el (nnimap-keepalive): * lisp/image.el (image-animate-timeout): * lisp/mail/feedmail.el (feedmail-rfc822-date): * lisp/net/imap.el (imap-wait-for-tag): * lisp/net/newst-backend.el (newsticker--image-get): * lisp/net/rcirc.el (rcirc-handler-317, rcirc-handler-333): * lisp/obsolete/xesam.el (xesam-refresh-entry): * lisp/org/org-agenda.el (org-agenda-show-clocking-issues) (org-agenda-check-clock-gap, org-agenda-to-appt): * lisp/org/org-capture.el (org-capture-set-target-location): * lisp/org/org-clock.el (org-clock-resolve-clock) (org-clocktable-steps): * lisp/org/org-colview.el (org-columns-edit-value) (org-columns, org-agenda-columns): * lisp/org/org-duration.el (org-duration-from-minutes): * lisp/org/org-element.el (org-element-cache-sync-duration) (org-element-cache-sync-break) (org-element--cache-interrupt-p, org-element--cache-sync): * lisp/org/org-habit.el (org-habit-get-faces) * lisp/org/org-indent.el (org-indent-add-properties): * lisp/org/org-table.el (org-table-sum): * lisp/org/org-timer.el (org-timer-show-remaining-time) (org-timer-set-timer): * lisp/org/org.el (org-babel-load-file, org-today) (org-auto-repeat-maybe, org-2ft, org-time-stamp) (org-read-date-analyze, org-time-stamp-to-now) (org-small-year-to-year, org-goto-calendar): * lisp/org/ox.el (org-export-insert-default-template): * lisp/ses.el (ses--time-check): * lisp/type-break.el (type-break-time-warning) (type-break-statistics, type-break-demo-boring): * lisp/url/url-cache.el (url-cache-expired) (url-cache-prune-cache): * lisp/vc/vc-git.el (vc-git-stash-snapshot): * lisp/erc/erc-match.el (erc-log-matches-come-back): Simplify.
2019-02-23 02:32:31 +00:00
(let ((exp-time (time-add (newsticker--time item) time)))
Prefer nil to (current-time) when either works * doc/misc/gnus.texi (Category Syntax): * lisp/allout-widgets.el (allout-widgets-post-command-business): * lisp/cedet/ede/detect.el (ede-detect-qtest): * lisp/cedet/pulse.el (pulse-momentary-highlight-overlay) (pulse-tick): * lisp/cedet/semantic.el (bovinate): * lisp/cedet/semantic/analyze.el: (semantic-analyze-current-symbol-default, semantic-adebug-analyze): * lisp/cedet/semantic/analyze/refs.el (semantic-analyze-current-tag): * lisp/cedet/semantic/lex.el (semantic-lex-test): * lisp/cedet/semantic/symref/filter.el: (semantic-symref-test-count-hits-in-tag): * lisp/cedet/srecode/dictionary.el (srecode-adebug-dictionary): * lisp/cedet/srecode/map.el (srecode-adebug-maps): * lisp/desktop.el (desktop-create-buffer): * lisp/emacs-lisp/benchmark.el (benchmark-elapse): * lisp/emacs-lisp/elp.el (elp--make-wrapper): * lisp/epa.el (epa--show-key): * lisp/erc/erc.el (erc-lurker-cleanup, erc-lurker-p): * lisp/gnus/gnus-agent.el (gnus-agent-fetch-articles) (gnus-agent-expire-group-1, gnus-agent-store-article): * lisp/gnus/gnus-art.el (article-lapsed-string): * lisp/gnus/gnus-cloud.el (gnus-cloud-update-newsrc-data) (gnus-cloud-collect-full-newsrc): * lisp/gnus/gnus-group.el (gnus-group-timestamp-delta): * lisp/gnus/gnus-html.el (gnus-html-cache-expired): * lisp/gnus/gnus-score.el (gnus-score-load-file) (gnus-decay-scores): * lisp/gnus/nndiary.el (nndiary-expired-article-p): * lisp/gnus/nnmail.el (nnmail-expired-article-p): * lisp/gnus/nnmaildir.el (nnmaildir--scan): * lisp/gnus/score-mode.el (gnus-score-edit-insert-date): * lisp/image/gravatar.el (gravatar-cache-expired): * lisp/net/newst-backend.el (newsticker--image-get) (newsticker--cache-mark-expired): * lisp/nxml/rng-maint.el (rng-time-function): * lisp/org/org-agenda.el (org-agenda-to-appt): * lisp/org/org-clock.el (org-clock-resolve-clock) (org-clock-resolve, org-resolve-clocks-if-idle): * lisp/org/org-colview.el (org-columns-edit-value, org-columns) (org-columns-compute-all, org-agenda-columns): * lisp/org/org-element.el (org-element--cache-interrupt-p) (org-element--cache-sync): * lisp/org/org-habit.el (org-habit-get-faces) (org-habit-insert-consistency-graphs): * lisp/org/org-indent.el (org-indent-add-properties): * lisp/org/org-timer.el (org-timer-start) (org-timer-pause-or-continue, org-timer-seconds) (org-timer-show-remaining-time, org-timer-set-timer): * lisp/org/org.el (org-babel-load-file, org-current-time) (org-today, org-auto-repeat-maybe, org-read-date-analyze) (org-small-year-to-year, org-goto-calendar): * lisp/org/ox.el (org-export-insert-default-template): * lisp/time.el (emacs-uptime): * lisp/type-break.el (type-break-mode, type-break) (type-break-time-warning-schedule, type-break-check): * lisp/url/url-cache.el (url-cache-expired): * lisp/url/url.el (url-retrieve-synchronously): * test/lisp/char-fold-tests.el (char-fold--speed-test): * test/manual/cedet/semantic-ia-utest.el: (semantic-symref-test-count-hits-in-tag): * test/manual/cedet/semantic-tests.el (semantic-idle-pnf-test) (semantic-lex-test-full-depth): Use nil instead of (current-time) where either will do, as nil is a bit more efficient and should have less timing error.
2017-10-21 02:40:09 +00:00
(when (time-less-p exp-time nil)
2008-06-08 15:36:18 +00:00
(newsticker--debug-msg
"Item `%s' from %s has expired on %s"
(newsticker--title item)
(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)))))
items))))
data)
data)
(defun newsticker--cache-contains (data feed title desc link _age
2008-06-08 15:36:18 +00:00
&optional guid)
"Check DATA whether FEED contains an item with the given properties.
This function returns the contained item or nil if it is not
contained.
The properties which are checked are TITLE, DESC, LINK, AGE, and
GUID. In general all properties must match in order to return a
certain item, except for the following cases.
If AGE equals `feed' the TITLE, DESCription and LINK do not
2008-06-08 15:36:18 +00:00
matter. If DESC is nil it is ignored as well. If
`newsticker-desc-comp-max' is non-nil, only the first
`newsticker-desc-comp-max' characters of DESC are taken into
account.
If GUID is non-nil it is sufficient to match this value, and the
other properties are ignored."
;;(newsticker--debug-msg "Looking for %s guid=%s" title guid)
(condition-case nil
(catch 'found
(when (and desc newsticker-desc-comp-max
(> (length desc) newsticker-desc-comp-max))
(setq desc (substring desc 0 newsticker-desc-comp-max)))
(mapc
(lambda (this-feed)
(when (eq (car this-feed) feed)
(mapc (lambda (anitem)
(when (cond (guid
;; global unique id can match
(string= guid (newsticker--guid anitem)))
(t;;FIXME?
(or
;; or title, desc, etc.
(and
;;(or (not (eq age 'feed))
;; (eq (newsticker--age anitem) 'feed))
(string= (newsticker--title anitem)
title)
(or (not link)
(string= (newsticker--link anitem)
link))
(or (not desc)
(if (and desc newsticker-desc-comp-max
(> (length (newsticker--desc
anitem))
newsticker-desc-comp-max))
(string= (substring
(newsticker--desc anitem)
2008-11-24 19:40:35 +00:00
0
2008-06-08 15:36:18 +00:00
newsticker-desc-comp-max)
desc)
(string= (newsticker--desc anitem)
desc)))))))
2008-11-24 19:40:35 +00:00
;;(newsticker--debug-msg "Found %s guid=%s"
2008-06-08 15:36:18 +00:00
;; (newsticker--title anitem)
;; (newsticker--guid anitem))
(throw 'found anitem)))
(cdr this-feed))))
data)
;;(newsticker--debug-msg "Found nothing")
nil)
(error nil)))
(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
2008-11-24 19:40:35 +00:00
;;(newsticker--debug-msg "Updating item %s %s %s %s %s -> %s %s
2008-06-08 15:36:18 +00:00
;; (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)
Avoid add-to-list on local variables * lisp/gnus/nnir.el: Use lexical-binding and cl-lib. (nnir-retrieve-headers): Use pcase. (nnir-search-thread): Avoid add-to-list on local variables. * lisp/gnus/smime.el: Use lexical-binding and cl-lib. (smime-verify-region): Avoid add-to-list on local variables. * lisp/mail/undigest.el: Use lexical-binding and cl-lib. (rmail-digest-parse-mime, rmail-digest-rfc1153) (rmail-digest-parse-rfc934): Avoid add-to-list on local variable. * lisp/net/ldap.el (ldap-search): Move init into declaration. * lisp/net/newst-backend.el (newsticker--cache-add): Avoid add-to-list on local variables; Simplify code with `assq'. * lisp/net/zeroconf.el: Use lexical-binding and cl-lib. (dbus-debug): Remove declaration, unused. (zeroconf-service-add-hook, zeroconf-service-remove-hook) (zeroconf-service-browser-handler, zeroconf-publish-service): Avoid add-to-list and *-hook on local variables. * lisp/org/org-archive.el (org-all-archive-files): * lisp/org/org-agenda.el (org-agenda-get-restriction-and-command): Avoid add-to-list on local variables. * lisp/org/ox-publish.el (org-publish--run-functions): New function. (org-publish-projects): Use it to avoid run-hooks on a local variable. (org-publish-cache-file-needs-publishing): Avoid add-to-list on local variables. * lisp/progmodes/ada-prj.el: Use setq instead of (set '...). (ada-prj-load-from-file): Avoid add-to-list on local variables. * lisp/progmodes/ada-xref.el (ada-initialize-runtime-library): Simplify. (ada-gnat-parse-gpr, ada-parse-prj-file-1) (ada-xref-find-in-modified-ali): Avoid add-to-list on local variables. * lisp/progmodes/idlw-shell.el (idlwave-shell-update-bp-overlays): Avoid add-to-list on local variables.
2017-01-04 05:40:45 +00:00
(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))
2008-06-08 15:36:18 +00:00
(defun newsticker--cache-remove (data feed-symbol age)
"Remove all entries from DATA in the feed FEED-SYMBOL with AGE.
FEED-SYMBOL may be `any'. Entries from old feeds, which are no longer in
2008-06-08 15:36:18 +00:00
`newsticker-url-list' or `newsticker-url-list-defaults', are removed as
well."
(let* ((pos data)
(feed (car pos))
(last-pos nil))
(while feed
(if (or (assoc (symbol-name (car feed)) newsticker-url-list)
(assoc (symbol-name (car feed)) newsticker-url-list-defaults))
;; feed is still valid=active
;; (message "Keeping feed %s" (car feed))
(if (or (eq feed-symbol 'any)
(eq feed-symbol (car feed)))
(let* ((item-pos (cdr feed))
(item (car item-pos))
(prev-pos nil))
(while item
;;(message "%s" (car item))
(if (eq age (newsticker--age item))
;; remove this item
(progn
;;(message "Removing item %s" (car item))
(if prev-pos
(setcdr prev-pos (cdr item-pos))
(setcdr feed (cdr item-pos))))
;;(message "Keeping item %s" (car item))
(setq prev-pos item-pos))
(setq item-pos (cdr item-pos))
(setq item (car item-pos)))))
;; feed is not active anymore
;; (message "Removing feed %s" (car feed))
(if last-pos
(setcdr last-pos (cdr pos))
(setq data (cdr pos))))
(setq last-pos pos)
(setq pos (cdr pos))
(setq feed (car pos)))))
;; ======================================================================
;;; Sorting
;; ======================================================================
(defun newsticker--cache-item-compare-by-time (item1 item2)
"Compare two news items ITEM1 and ITEM2 by comparing their time values."
(catch 'result
(let ((age1 (newsticker--age item1))
(age2 (newsticker--age item2)))
(if (not (eq age1 age2))
(cond ((eq age1 'obsolete)
(throw 'result nil))
((eq age2 'obsolete)
(throw 'result t)))))
(time-less-p (newsticker--time item2)
(newsticker--time item1))))
2008-06-08 15:36:18 +00:00
(defun newsticker--cache-item-compare-by-title (item1 item2)
"Compare ITEM1 and ITEM2 by comparing their titles."
(catch 'result
(let ((age1 (newsticker--age item1))
(age2 (newsticker--age item2)))
(if (not (eq age1 age2))
(cond ((eq age1 'obsolete)
(throw 'result nil))
((eq age2 'obsolete)
(throw 'result t)))))
(string< (newsticker--title item1) (newsticker--title item2))))
(defun newsticker--cache-item-compare-by-position (item1 item2)
"Compare ITEM1 and ITEM2 by comparing their original positions."
(catch 'result
(let ((age1 (newsticker--age item1))
(age2 (newsticker--age item2)))
(if (not (eq age1 age2))
(cond ((eq age1 'obsolete)
(throw 'result nil))
((eq age2 'obsolete)
(throw 'result t)))))
(< (or (newsticker--pos item1) 0) (or (newsticker--pos item2) 0))))
(defun newsticker--cache-get-feed (feed)
"Return the cached data for the feed FEED.
FEED is a symbol!"
(assoc feed newsticker--cache))
2008-11-24 19:40:35 +00:00
(defun newsticker--cache-dir ()
"Return directory for saving cache data."
(expand-file-name "feeds/" newsticker-dir))
2008-11-24 19:40:35 +00:00
(defun newsticker--cache-save ()
"Save cache data for all feeds."
(unless (file-directory-p newsticker-dir)
(make-directory newsticker-dir t))
* lisp/net/*.el: Use lexical-binding Also remove some redundant `:group` arguments. * lisp/net/eudc-export.el: Use lexical-binding. (eudc-create-bbdb-record): Use `cl-progv` and `apply` to avoid `eval`. * lisp/net/eudc-hotlist.el: Use lexical-binding. * lisp/net/eudc.el (eudc-print-attribute-value): Use `funcall` to avoid `eval`. * lisp/net/eudcb-bbdb.el: Use lexical-binding. (eudc-bbdb-filter-non-matching-record): Use `funcall` to avoid `eval`. Move `bbdb-val` binding to avoid `setq`. Use `seq-some` instead of `eval+or`. (eudc-bbdb-format-record-as-result): Use `dolist` and `pcase`. Use `funcall` to avoid `eval`. (eudc-bbdb-query-internal): Simplify a bit. * lisp/net/eudcb-ldap.el: Use lexical-binding. (eudc-ldap-get-host-parameter): Use `defalias` to avoid `eval-and-compile`. * lisp/net/telnet.el: Use lexical-binding. * lisp/net/quickurl.el: Use lexical-binding. * lisp/net/newst-ticker.el: Use lexical-binding. * lisp/net/newst-reader.el: Use lexical-binding. * lisp/net/goto-addr.el: Use lexical-binding. * lisp/net/gnutls.el: Use lexical-binding. * lisp/net/eudcb-macos-contacts.el: Use lexical-binding. * lisp/net/eudcb-mab.el: Use lexical-binding. * lisp/net/net-utils.el: Use lexical-binding. (finger): Remove unused var `found`. * lisp/net/network-stream.el (open-protocol-stream): Remove redundant `defalias`. * lisp/net/newst-plainview.el: Use lexical-binding. (newsticker-hide-entry, newsticker-show-entry): Remove unused var `is-invisible`. (w3m-fill-column, w3-maximum-line-length): Declare vars. * lisp/net/tramp.el (tramp-compute-multi-hops): * lisp/net/tramp-compat.el (tramp-compat-temporary-file-directory): * lisp/net/tramp-cmds.el (tramp-default-rename-file): * lisp/net/webjump.el (webjump): Don't forget lexical-binding for `eval`.
2021-03-08 15:11:22 +00:00
(mapc #'newsticker--cache-save-feed newsticker--cache)
nil)
2008-11-24 19:40:35 +00:00
(defun newsticker--cache-save-feed (feed)
"Save cache data for FEED."
(let ((dir (file-name-as-directory
(expand-file-name (symbol-name (car feed))
(newsticker--cache-dir)))))
2008-11-24 19:40:35 +00:00
(unless (file-directory-p dir)
(make-directory dir t))
(let ((coding-system-for-write 'utf-8))
(with-temp-file (expand-file-name "data" dir)
2008-11-24 19:40:35 +00:00
(insert ";; -*- coding: utf-8 -*-\n")
(prin1 (cdr feed) (current-buffer) t)))))
2008-11-24 19:40:35 +00:00
(defun newsticker--cache-read ()
"Read cache data."
(setq newsticker--cache nil)
(dolist (f (append newsticker-url-list-defaults newsticker-url-list))
(newsticker--cache-read-feed (car f))))
2008-11-24 19:40:35 +00:00
(defun newsticker--cache-read-feed (feed-name)
"Read cache data for feed named FEED-NAME."
(let ((file-name (expand-file-name
"data" (expand-file-name
feed-name (newsticker--cache-dir))))
2008-11-24 19:40:35 +00:00
(coding-system-for-read 'utf-8))
(when (file-exists-p file-name)
(with-temp-buffer
(insert-file-contents file-name)
(goto-char (point-min))
(condition-case nil
(add-to-list 'newsticker--cache (cons (intern feed-name)
(read (current-buffer))))
(error
(message "Error while reading newsticker cache file %s!"
2009-09-18 07:07:33 +00:00
file-name)
(setq newsticker--cache nil)))))))
2008-11-24 19:40:35 +00:00
2008-06-08 15:36:18 +00:00
;; ======================================================================
;;; Statistics
;; ======================================================================
(defun newsticker--stat-num-items (feed &rest ages)
"Return number of items in the given FEED which have one of the given AGES.
If AGES is nil, the total number of items is returned."
(let ((items (cdr (newsticker--cache-get-feed feed)))
(num 0))
(while items
(if ages
(if (memq (newsticker--age (car items)) ages)
(setq num (1+ num)))
(if (memq (newsticker--age (car items)) '(new old immortal obsolete))
(setq num (1+ num))))
2008-06-08 15:36:18 +00:00
(setq items (cdr items)))
num))
(defun newsticker--stat-num-items-total (&optional age)
"Return total number of items in all feeds which have the given AGE.
If AGE is nil, the total number of items is returned."
* lisp/net/*.el: Use lexical-binding Also remove some redundant `:group` arguments. * lisp/net/eudc-export.el: Use lexical-binding. (eudc-create-bbdb-record): Use `cl-progv` and `apply` to avoid `eval`. * lisp/net/eudc-hotlist.el: Use lexical-binding. * lisp/net/eudc.el (eudc-print-attribute-value): Use `funcall` to avoid `eval`. * lisp/net/eudcb-bbdb.el: Use lexical-binding. (eudc-bbdb-filter-non-matching-record): Use `funcall` to avoid `eval`. Move `bbdb-val` binding to avoid `setq`. Use `seq-some` instead of `eval+or`. (eudc-bbdb-format-record-as-result): Use `dolist` and `pcase`. Use `funcall` to avoid `eval`. (eudc-bbdb-query-internal): Simplify a bit. * lisp/net/eudcb-ldap.el: Use lexical-binding. (eudc-ldap-get-host-parameter): Use `defalias` to avoid `eval-and-compile`. * lisp/net/telnet.el: Use lexical-binding. * lisp/net/quickurl.el: Use lexical-binding. * lisp/net/newst-ticker.el: Use lexical-binding. * lisp/net/newst-reader.el: Use lexical-binding. * lisp/net/goto-addr.el: Use lexical-binding. * lisp/net/gnutls.el: Use lexical-binding. * lisp/net/eudcb-macos-contacts.el: Use lexical-binding. * lisp/net/eudcb-mab.el: Use lexical-binding. * lisp/net/net-utils.el: Use lexical-binding. (finger): Remove unused var `found`. * lisp/net/network-stream.el (open-protocol-stream): Remove redundant `defalias`. * lisp/net/newst-plainview.el: Use lexical-binding. (newsticker-hide-entry, newsticker-show-entry): Remove unused var `is-invisible`. (w3m-fill-column, w3-maximum-line-length): Declare vars. * lisp/net/tramp.el (tramp-compute-multi-hops): * lisp/net/tramp-compat.el (tramp-compat-temporary-file-directory): * lisp/net/tramp-cmds.el (tramp-default-rename-file): * lisp/net/webjump.el (webjump): Don't forget lexical-binding for `eval`.
2021-03-08 15:11:22 +00:00
(apply #'+
2008-06-08 15:36:18 +00:00
(mapcar (lambda (feed)
(if age
(newsticker--stat-num-items (intern (car feed)) age)
(newsticker--stat-num-items (intern (car feed)))))
(append newsticker-url-list-defaults newsticker-url-list))))
;; ======================================================================
;;; OPML
;; ======================================================================
(defun newsticker-opml-export ()
"OPML subscription export.
Export subscriptions to a buffer in OPML Format."
(interactive)
(with-current-buffer (get-buffer-create "*OPML Export*")
(erase-buffer)
2008-06-08 15:36:18 +00:00
(set-buffer-file-coding-system 'utf-8)
(insert (concat
"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"
"<!-- OPML generated by Emacs newsticker.el -->\n"
"<opml version=\"1.0\">\n"
" <head>\n"
" <title>Emacs newsticker subscriptions</title>\n"
2008-06-08 15:36:18 +00:00
" <dateCreated>" (format-time-string "%a, %d %b %Y %T %z")
"</dateCreated>\n"
" <ownerEmail>" user-mail-address "</ownerEmail>\n"
" <ownerName>" (user-full-name) "</ownerName>\n"
" </head>\n"
" <body>\n"))
(let ((feeds (append newsticker-url-list newsticker-url-list-defaults))
;; insert the feed groups and all feeds that are contained
(saved-feed-names (newsticker--opml-insert-elt newsticker-groups 2)))
;; to be safe: insert all feeds that are not contained in any group
(dolist (f feeds)
(unless (seq-find (lambda (sfn) (string= (car f) sfn)) saved-feed-names)
(newsticker--opml-insert-feed (car f) 4)))
(insert " </body>\n</opml>\n")))
2008-06-08 15:36:18 +00:00
(pop-to-buffer "*OPML Export*")
(sgml-mode))
2008-06-08 15:36:18 +00:00
(defun newsticker--opml-insert-elt (elt depth)
"Insert an OPML ELT with indentation level DEPTH."
(if (listp elt)
(newsticker--opml-insert-group elt (+ 2 depth))
(newsticker--opml-insert-feed elt (+ 2 depth))))
(defun newsticker--opml-insert-group (group depth)
"Insert an OPML GROUP with indentation level DEPTH."
(let (saved-feeds)
(insert (make-string depth ? ) "<outline type=\"folder\" text=\"" (car group) "\">\n")
(setq saved-feeds (mapcar (lambda (e)
(newsticker--opml-insert-elt e depth))
(cdr group)))
(insert (make-string depth ? ) "</outline>\n")
(flatten-tree saved-feeds)))
(defun newsticker--opml-insert-feed (feed-name depth)
"Insert an OPML FEED-NAME with indentation level DEPTH."
(let* ((feed-definition (seq-find (lambda (f)
(string= feed-name (car f)))
(append newsticker-url-list newsticker-url-list-defaults)))
(url (nth 1 feed-definition))
(url-string (if (functionp url) (prin1-to-string url)
(xml-escape-string url))))
(insert (make-string depth ? ) "<outline text=\"" feed-name
"\" xmlUrl=\"" url-string
"\"/>\n"))
feed-name)
2008-06-08 15:36:18 +00:00
(defun newsticker--opml-import-outlines (outlines)
"Recursively import OUTLINES from OPML data."
(mapcar (lambda (outline)
2008-06-08 15:36:18 +00:00
(let ((name (xml-get-attribute outline 'text))
(url (xml-get-attribute outline 'xmlUrl))
(children (xml-get-children outline 'outline)))
(unless (string= "" url)
(add-to-list 'newsticker-url-list
(list name url nil nil nil) t))
(if children
(append (list name)
(newsticker--opml-import-outlines children))
name)))
outlines))
2008-06-08 15:36:18 +00:00
(defun newsticker-opml-import (filename)
"Import OPML data from FILENAME.
Feeds are added to `newsticker-url-list' and `newsticker-groups'
preserving the outline structure."
2008-06-08 15:36:18 +00:00
(interactive "fOPML file: ")
(set-buffer (find-file-noselect filename))
(goto-char (point-min))
(let* ((node-list (xml-parse-region (point-min) (point-max)))
(title (car (xml-node-children
(car (xml-get-children
(car (xml-get-children (car node-list) 'head))
'title)))))
2008-06-08 15:36:18 +00:00
(body (car (xml-get-children (car node-list) 'body)))
(outlines (xml-get-children body 'outline))
(imported-groups-data (newsticker--opml-import-outlines outlines)))
(add-to-list 'newsticker-groups (cons title imported-groups-data) t))
2008-06-08 15:36:18 +00:00
(customize-variable 'newsticker-url-list))
;; ======================================================================
;;; Auto marking
;; ======================================================================
(defun newsticker--run-auto-mark-filter (feed item)
"Automatically mark an item as old or immortal.
This function checks the variable `newsticker-auto-mark-filter-list'
for an entry that matches FEED and ITEM."
(let ((case-fold-search t))
(dolist (filter newsticker-auto-mark-filter-list)
(let ((filter-feed (car filter))
(pattern-list (cadr filter)))
(when (string-match filter-feed feed)
(newsticker--do-run-auto-mark-filter item pattern-list))))))
2008-06-08 15:36:18 +00:00
(defun newsticker--do-run-auto-mark-filter (item list)
"Actually compare ITEM against the pattern-LIST.
LIST must be an element of `newsticker-auto-mark-filter-list'."
(dolist (pattern list)
(let ((place (nth 1 pattern))
(regexp (nth 2 pattern))
(title (newsticker--title item))
(desc (newsticker--desc item)))
(when (or (eq place 'title) (eq place 'all))
(when (and title (string-match regexp title))
(newsticker--process-auto-mark-filter-match item pattern)))
(when (or (eq place 'description) (eq place 'all))
(when (and desc (string-match regexp desc))
(newsticker--process-auto-mark-filter-match item pattern))))))
2008-06-08 15:36:18 +00:00
(defun newsticker--process-auto-mark-filter-match (item pattern)
"Process ITEM that matches an auto-mark-filter PATTERN."
(let ((age (nth 0 pattern))
(place (nth 1 pattern))
(regexp (nth 2 pattern)))
(newsticker--debug-msg "Auto-mark-filter %s matches `%s'"
pattern (newsticker--title item))
(setcar (nthcdr 4 item) age)
(nconc (newsticker--extra item)
(list (list 'newsticker-auto-mark nil
(format "age=%s, title/desc=%s, regexp=%s"
age place regexp))))))
2008-06-08 15:36:18 +00:00
;; ======================================================================
;;; Hook samples
;; ======================================================================
(defun newsticker-new-item-functions-sample (feedname item)
2008-06-08 15:36:18 +00:00
"Demonstrate the use of the `newsticker-new-item-functions' hook.
This function just prints out the values of the FEEDNAME and title of the ITEM."
2008-06-08 15:36:18 +00:00
(message (concat "newsticker-new-item-functions-sample: feed=`%s', "
"title=`%s'")
feedname (newsticker--title item)))
2008-06-08 15:36:18 +00:00
(defun newsticker-download-images (feedname item)
2008-06-08 15:36:18 +00:00
"Download the first image.
If FEEDNAME equals \"imagefeed\" download the first image URL
found in the description=contents of ITEM to the directory
`temporary-file-directory'/newsticker/FEEDNAME/TITLE where TITLE
is the title of the item."
(when (string= feedname "imagefeed")
2008-06-08 15:36:18 +00:00
(let ((title (newsticker--title item))
(desc (newsticker--desc item)))
(when (string-match "<img src=\"\\(http://[^ \"]+\\)\"" desc)
(let ((url (substring desc (match-beginning 1) (match-end 1)))
(temp-dir (file-name-as-directory
(expand-file-name
title (expand-file-name
feedname (expand-file-name
"newsticker"
temporary-file-directory)))))
2008-06-08 15:36:18 +00:00
(org-dir default-directory))
(unless (file-directory-p temp-dir)
(make-directory temp-dir t))
(cd temp-dir)
(message "Getting image %s" url)
* lisp/net/*.el: Use lexical-binding Also remove some redundant `:group` arguments. * lisp/net/eudc-export.el: Use lexical-binding. (eudc-create-bbdb-record): Use `cl-progv` and `apply` to avoid `eval`. * lisp/net/eudc-hotlist.el: Use lexical-binding. * lisp/net/eudc.el (eudc-print-attribute-value): Use `funcall` to avoid `eval`. * lisp/net/eudcb-bbdb.el: Use lexical-binding. (eudc-bbdb-filter-non-matching-record): Use `funcall` to avoid `eval`. Move `bbdb-val` binding to avoid `setq`. Use `seq-some` instead of `eval+or`. (eudc-bbdb-format-record-as-result): Use `dolist` and `pcase`. Use `funcall` to avoid `eval`. (eudc-bbdb-query-internal): Simplify a bit. * lisp/net/eudcb-ldap.el: Use lexical-binding. (eudc-ldap-get-host-parameter): Use `defalias` to avoid `eval-and-compile`. * lisp/net/telnet.el: Use lexical-binding. * lisp/net/quickurl.el: Use lexical-binding. * lisp/net/newst-ticker.el: Use lexical-binding. * lisp/net/newst-reader.el: Use lexical-binding. * lisp/net/goto-addr.el: Use lexical-binding. * lisp/net/gnutls.el: Use lexical-binding. * lisp/net/eudcb-macos-contacts.el: Use lexical-binding. * lisp/net/eudcb-mab.el: Use lexical-binding. * lisp/net/net-utils.el: Use lexical-binding. (finger): Remove unused var `found`. * lisp/net/network-stream.el (open-protocol-stream): Remove redundant `defalias`. * lisp/net/newst-plainview.el: Use lexical-binding. (newsticker-hide-entry, newsticker-show-entry): Remove unused var `is-invisible`. (w3m-fill-column, w3-maximum-line-length): Declare vars. * lisp/net/tramp.el (tramp-compute-multi-hops): * lisp/net/tramp-compat.el (tramp-compat-temporary-file-directory): * lisp/net/tramp-cmds.el (tramp-default-rename-file): * lisp/net/webjump.el (webjump): Don't forget lexical-binding for `eval`.
2021-03-08 15:11:22 +00:00
(apply #'start-process "wget-image"
2008-06-08 15:36:18 +00:00
" *newsticker-wget-download-images*"
newsticker-wget-name
(list url))
(cd org-dir))))))
(defun newsticker-download-enclosures (feedname item)
"In all feeds download the enclosed object of the news ITEM.
The object is saved to the directory
`temporary-file-directory'/newsticker/FEEDNAME/TITLE, which
2008-06-08 15:36:18 +00:00
is created if it does not exist. TITLE is the title of the news
item. Argument FEEDNAME is ignored.
2008-06-08 15:36:18 +00:00
This function is suited for adding it to `newsticker-new-item-functions'."
(let ((title (newsticker--title item))
(enclosure (newsticker--enclosure item)))
(when enclosure
(let ((url (cdr (assoc 'url enclosure)))
(temp-dir (file-name-as-directory
(expand-file-name
title (expand-file-name
feedname (expand-file-name
"newsticker"
temporary-file-directory)))))
2008-06-08 15:36:18 +00:00
(org-dir default-directory))
(unless (file-directory-p temp-dir)
(make-directory temp-dir t))
(cd temp-dir)
(message "Getting enclosure %s" url)
* lisp/net/*.el: Use lexical-binding Also remove some redundant `:group` arguments. * lisp/net/eudc-export.el: Use lexical-binding. (eudc-create-bbdb-record): Use `cl-progv` and `apply` to avoid `eval`. * lisp/net/eudc-hotlist.el: Use lexical-binding. * lisp/net/eudc.el (eudc-print-attribute-value): Use `funcall` to avoid `eval`. * lisp/net/eudcb-bbdb.el: Use lexical-binding. (eudc-bbdb-filter-non-matching-record): Use `funcall` to avoid `eval`. Move `bbdb-val` binding to avoid `setq`. Use `seq-some` instead of `eval+or`. (eudc-bbdb-format-record-as-result): Use `dolist` and `pcase`. Use `funcall` to avoid `eval`. (eudc-bbdb-query-internal): Simplify a bit. * lisp/net/eudcb-ldap.el: Use lexical-binding. (eudc-ldap-get-host-parameter): Use `defalias` to avoid `eval-and-compile`. * lisp/net/telnet.el: Use lexical-binding. * lisp/net/quickurl.el: Use lexical-binding. * lisp/net/newst-ticker.el: Use lexical-binding. * lisp/net/newst-reader.el: Use lexical-binding. * lisp/net/goto-addr.el: Use lexical-binding. * lisp/net/gnutls.el: Use lexical-binding. * lisp/net/eudcb-macos-contacts.el: Use lexical-binding. * lisp/net/eudcb-mab.el: Use lexical-binding. * lisp/net/net-utils.el: Use lexical-binding. (finger): Remove unused var `found`. * lisp/net/network-stream.el (open-protocol-stream): Remove redundant `defalias`. * lisp/net/newst-plainview.el: Use lexical-binding. (newsticker-hide-entry, newsticker-show-entry): Remove unused var `is-invisible`. (w3m-fill-column, w3-maximum-line-length): Declare vars. * lisp/net/tramp.el (tramp-compute-multi-hops): * lisp/net/tramp-compat.el (tramp-compat-temporary-file-directory): * lisp/net/tramp-cmds.el (tramp-default-rename-file): * lisp/net/webjump.el (webjump): Don't forget lexical-binding for `eval`.
2021-03-08 15:11:22 +00:00
(apply #'start-process "wget-enclosure"
2008-06-08 15:36:18 +00:00
" *newsticker-wget-download-enclosures*"
newsticker-wget-name
(list url))
(cd org-dir)))))
;; ======================================================================
;;; Retrieve samples
;; ======================================================================
(defun newsticker-retrieve-random-message (_feed-name)
2008-06-08 15:36:18 +00:00
"Return an artificial RSS string under the name FEED-NAME."
(concat "<?xml version=\"1.0\" encoding=\"iso-8859-1\" ?><rss version=\"0.91\">"
"<channel>"
"<title>newsticker-retrieve-random-message</title>"
"<description>Sample retrieval function</description>"
"<pubDate>FIXME Sat, 07 Sep 2005 00:00:01 GMT</pubDate>"
"<item><title>" (format "Your lucky number is %d" (random 10000))
"</title><description>" (format "Or maybe it is %d" (random 10000))
"</description></item></channel></rss>"))
2009-12-06 19:49:04 +00:00
(provide 'newst-backend)
2008-06-08 15:36:18 +00:00
2008-11-24 19:40:35 +00:00
;;; newst-backend.el ends here