Have avandu-headlines use a plist
Calling `(avandu-headlines -4 :view-mode "unread" :show-excerpt t)' seems much cleaner than `(avandu-headlines -4 nil nil nil t nil "unread")'.
This commit is contained in:
parent
a92da69dea
commit
7a7b7fb8b3
1 changed files with 40 additions and 27 deletions
45
avandu.el
45
avandu.el
|
@ -334,37 +334,50 @@ There are a number of special category IDs:
|
||||||
,@(when limit `((limit . ,limit)))
|
,@(when limit `((limit . ,limit)))
|
||||||
,@(when offset `((offset . ,offset))))))))
|
,@(when offset `((offset . ,offset))))))))
|
||||||
|
|
||||||
(defun avandu-headlines (feed-id &optional limit skip is-cat show-excerpt
|
(defun avandu-headlines (feed-id &rest plist)
|
||||||
show-content view-mode
|
|
||||||
include-attachments since-id)
|
|
||||||
"Get a list of headlines from Tiny Tiny RSS from the feed
|
"Get a list of headlines from Tiny Tiny RSS from the feed
|
||||||
identified by FEED-ID. If LIMIT is specified only get LIMIT
|
identified by FEED-ID. Options about what to get can be
|
||||||
number of headlines, and if SKIP has been specified skip the
|
specified in the form of a property list PLIST.
|
||||||
first SKIP headlines. If IS-CAT is non-nil, that means FEED-ID
|
|
||||||
is actually the ID of a category. When SHOW-EXCERPT is non-nil,
|
If `:limit' is specified only get that many headlines, and if
|
||||||
send back an excerpt along with the headline and if SHOW-CONTENT
|
`:skip' has been specified skip that many headlines first.
|
||||||
is non-nil send along the entire article.
|
|
||||||
|
If `:is-cat' is non-nil, that means FEED-ID is actually the ID of
|
||||||
|
a category.
|
||||||
|
|
||||||
|
When `:show-excerpt' is non-nil, send back an excerpt along with
|
||||||
|
the headline and if `:show-content' is non-nil send along the
|
||||||
|
entire article.
|
||||||
|
|
||||||
|
`:view-mode' determines what type of headlines are sent back:
|
||||||
|
|
||||||
VIEW-MODE determines what type of headlines are sent back.
|
|
||||||
all_articles -- All articles found are sent back.
|
all_articles -- All articles found are sent back.
|
||||||
unread -- Only unread articles are sent back.
|
unread -- Only unread articles are sent back.
|
||||||
adaptive -- ?
|
adaptive -- ?
|
||||||
marked -- ?
|
marked -- ?
|
||||||
updated -- ?
|
updated -- ?
|
||||||
|
|
||||||
If INCLUDE-ATTATCHMENTS is non-nil, send along any files enclosed
|
If `:include-attatchments' is non-nil, send along any files
|
||||||
in the articles.
|
enclosed in the articles.
|
||||||
|
|
||||||
If SINCE-ID is specified, send only articles with a FEED-ID
|
If `:since-id' is specified, send only articles with a FEED-ID
|
||||||
greater than this.
|
greater than this.
|
||||||
|
|
||||||
There are some special feed ids:
|
There are some special feed IDs:
|
||||||
-1 -- Starred feeds
|
-1 -- Starred feeds
|
||||||
-2 -- Published feeds
|
-2 -- Published feeds
|
||||||
-3 -- Fresh feeds (less than X hours old)
|
-3 -- Fresh feeds (less than X hours old)
|
||||||
-4 -- All articles
|
-4 -- All articles
|
||||||
0 -- Archived articles
|
0 -- Archived articles
|
||||||
IDs < -10 -- Labels"
|
IDs < -10 -- Labels"
|
||||||
|
(let ((limit (plist-get plist :limit))
|
||||||
|
(skip (plist-get plist :skip))
|
||||||
|
(is-cat (plist-get plist :is-cat))
|
||||||
|
(show-excerpt (plist-get plist :show-excerpt))
|
||||||
|
(show-content (plist-get plist :show-content))
|
||||||
|
(view-mode (plist-get plist :view-mode))
|
||||||
|
(include-attachments (plist-get plist :include-attachments))
|
||||||
|
(since-id (plist-get plist :since-id)))
|
||||||
(cdr (assq 'content
|
(cdr (assq 'content
|
||||||
(avandu--send-command
|
(avandu--send-command
|
||||||
`((op . "getHeadlines")
|
`((op . "getHeadlines")
|
||||||
|
@ -376,7 +389,7 @@ There are some special feed ids:
|
||||||
,@(when show-content `((show_content . ,show-content)))
|
,@(when show-content `((show_content . ,show-content)))
|
||||||
,@(when view-mode `((view_mode . ,view-mode)))
|
,@(when view-mode `((view_mode . ,view-mode)))
|
||||||
,@(when include-attachments `((include_attachments . ,include-attachments)))
|
,@(when include-attachments `((include_attachments . ,include-attachments)))
|
||||||
,@(when since-id `((since_id . ,since-id))))))))
|
,@(when since-id `((since_id . ,since-id)))))))))
|
||||||
|
|
||||||
;; Commands
|
;; Commands
|
||||||
(defun avandu-browse-article ()
|
(defun avandu-browse-article ()
|
||||||
|
@ -528,7 +541,7 @@ by feed."
|
||||||
(interactive)
|
(interactive)
|
||||||
(avandu--check-login)
|
(avandu--check-login)
|
||||||
(let ((buffer (get-buffer-create "*avandu-overview*"))
|
(let ((buffer (get-buffer-create "*avandu-overview*"))
|
||||||
(result (avandu-headlines -4 nil nil nil t nil "unread"))
|
(result (avandu-headlines -4 :show-excerpt t :view-mode "unread"))
|
||||||
feed-id)
|
feed-id)
|
||||||
(with-current-buffer buffer
|
(with-current-buffer buffer
|
||||||
(setq buffer-read-only nil)
|
(setq buffer-read-only nil)
|
||||||
|
|
Loading…
Reference in a new issue