aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorUlf Jasper2017-10-27 13:26:06 +0200
committerUlf Jasper2017-10-27 13:26:06 +0200
commitcb185dfd0c227dda14de25d450d0d684e91cafb3 (patch)
tree2a8dda2edbb88f84c9787ec6567e31cb72217f6c /lisp
parentc015f935e06cf2ba3ef8f69f5ef086fc1e51c9d1 (diff)
downloademacs-cb185dfd0c227dda14de25d450d0d684e91cafb3.tar.gz
emacs-cb185dfd0c227dda14de25d450d0d684e91cafb3.zip
Fix documentation of `newsticker-new-item-functions' (bug#29023).
* lisp/net/newst-backend.el (newsticker-new-item-functions), (newsticker-new-item-functions-sample), (newsticker-download-enclosures): Fix docstring, rename variable feed to feedname (bug#29023). * doc/misc/newsticker.texi (Automatic Processing) (Automatic Processing): Fix documentation of `newsticker-new-item-functions' (bug#29023).
Diffstat (limited to 'lisp')
-rw-r--r--lisp/net/newst-backend.el39
1 files changed, 20 insertions, 19 deletions
diff --git a/lisp/net/newst-backend.el b/lisp/net/newst-backend.el
index 7a73d4688aa..048a7e734a6 100644
--- a/lisp/net/newst-backend.el
+++ b/lisp/net/newst-backend.el
@@ -386,12 +386,12 @@ This hook is run at the very end of `newsticker-stop'."
386(defcustom newsticker-new-item-functions 386(defcustom newsticker-new-item-functions
387 nil 387 nil
388 "List of functions run after a new headline has been retrieved. 388 "List of functions run after a new headline has been retrieved.
389Each function is called with the following three arguments: 389Each function is called with the following two arguments:
390FEED the name of the corresponding news feed, 390FEEDNAME the name of the corresponding news feed,
391TITLE the title of the headline, 391ITEM the decoded headline.
392DESC the decoded description of the headline.
393 392
394See `newsticker-download-images', and 393See `newsticker-new-item-functions-sample',
394`newsticker-download-images', and
395`newsticker-download-enclosures' for sample functions. 395`newsticker-download-enclosures' for sample functions.
396 396
397Please note that these functions are called only once for a 397Please note that these functions are called only once for a
@@ -2444,24 +2444,25 @@ LIST must be an element of `newsticker-auto-mark-filter-list'."
2444;; ====================================================================== 2444;; ======================================================================
2445;;; Hook samples 2445;;; Hook samples
2446;; ====================================================================== 2446;; ======================================================================
2447(defun newsticker-new-item-functions-sample (feed item) 2447(defun newsticker-new-item-functions-sample (feedname item)
2448 "Demonstrate the use of the `newsticker-new-item-functions' hook. 2448 "Demonstrate the use of the `newsticker-new-item-functions' hook.
2449This function just prints out the values of the FEED and title of the ITEM." 2449This function just prints out the values of the FEEDNAME and title of the ITEM."
2450 (message (concat "newsticker-new-item-functions-sample: feed=`%s', " 2450 (message (concat "newsticker-new-item-functions-sample: feed=`%s', "
2451 "title=`%s'") 2451 "title=`%s'")
2452 feed (newsticker--title item))) 2452 feedname (newsticker--title item)))
2453 2453
2454(defun newsticker-download-images (feed item) 2454(defun newsticker-download-images (feedname item)
2455 "Download the first image. 2455 "Download the first image.
2456If FEED equals \"imagefeed\" download the first image URL found 2456If FEEDNAME equals \"imagefeed\" download the first image URL
2457in the description=contents of ITEM to the directory 2457found in the description=contents of ITEM to the directory
2458\"~/tmp/newsticker/FEED/TITLE\" where TITLE is the title of the item." 2458\"~/tmp/newsticker/FEEDNAME/TITLE\" where TITLE is the title of
2459 (when (string= feed "imagefeed") 2459the item."
2460 (when (string= feedname "imagefeed")
2460 (let ((title (newsticker--title item)) 2461 (let ((title (newsticker--title item))
2461 (desc (newsticker--desc item))) 2462 (desc (newsticker--desc item)))
2462 (when (string-match "<img src=\"\\(http://[^ \"]+\\)\"" desc) 2463 (when (string-match "<img src=\"\\(http://[^ \"]+\\)\"" desc)
2463 (let ((url (substring desc (match-beginning 1) (match-end 1))) 2464 (let ((url (substring desc (match-beginning 1) (match-end 1)))
2464 (temp-dir (concat "~/tmp/newsticker/" feed "/" title)) 2465 (temp-dir (concat "~/tmp/newsticker/" feedname "/" title))
2465 (org-dir default-directory)) 2466 (org-dir default-directory))
2466 (unless (file-directory-p temp-dir) 2467 (unless (file-directory-p temp-dir)
2467 (make-directory temp-dir t)) 2468 (make-directory temp-dir t))
@@ -2473,17 +2474,17 @@ in the description=contents of ITEM to the directory
2473 (list url)) 2474 (list url))
2474 (cd org-dir)))))) 2475 (cd org-dir))))))
2475 2476
2476(defun newsticker-download-enclosures (feed item) 2477(defun newsticker-download-enclosures (feedname item)
2477 "In all FEEDs download the enclosed object of the news ITEM. 2478 "In all feeds download the enclosed object of the news ITEM.
2478The object is saved to the directory \"~/tmp/newsticker/FEED/TITLE\", which 2479The object is saved to the directory \"~/tmp/newsticker/FEEDNAME/TITLE\", which
2479is created if it does not exist. TITLE is the title of the news 2480is created if it does not exist. TITLE is the title of the news
2480item. Argument FEED is ignored. 2481item. Argument FEEDNAME is ignored.
2481This function is suited for adding it to `newsticker-new-item-functions'." 2482This function is suited for adding it to `newsticker-new-item-functions'."
2482 (let ((title (newsticker--title item)) 2483 (let ((title (newsticker--title item))
2483 (enclosure (newsticker--enclosure item))) 2484 (enclosure (newsticker--enclosure item)))
2484 (when enclosure 2485 (when enclosure
2485 (let ((url (cdr (assoc 'url enclosure))) 2486 (let ((url (cdr (assoc 'url enclosure)))
2486 (temp-dir (concat "~/tmp/newsticker/" feed "/" title)) 2487 (temp-dir (concat "~/tmp/newsticker/" feedname "/" title))
2487 (org-dir default-directory)) 2488 (org-dir default-directory))
2488 (unless (file-directory-p temp-dir) 2489 (unless (file-directory-p temp-dir)
2489 (make-directory temp-dir t)) 2490 (make-directory temp-dir t))