Add avandu-mark-article-unread function

This commit is contained in:
Arthur Léothaud 2016-12-26 16:07:21 +01:00
parent 891a847b0f
commit 2407599922
2 changed files with 26 additions and 0 deletions

View file

@ -17,6 +17,7 @@ then run =avandu-overview=.
Once in avandu:overview mode some key bindings will be: Once in avandu:overview mode some key bindings will be:
- ~r~:: Mark article at point as read. - ~r~:: Mark article at point as read.
- ~u~:: Mark article at point as unread.
- ~o~:: Open article at point in a browser. Uses =browse-url=. - ~o~:: Open article at point in a browser. Uses =browse-url=.
- ~n~:: Next article. - ~n~:: Next article.
- ~p~:: Previous article. - ~p~:: Previous article.

View file

@ -183,6 +183,12 @@ arguments."
(avandu-mark-article-read (avandu-mark-article-read
(button-get button 'article-id)) (button-get button 'article-id))
(avandu-ui-mark-article-read button)))) (avandu-ui-mark-article-read button))))
(define-key map "u" #'(lambda ()
(interactive)
(let ((button (button-at (point))))
(avandu-mark-article-unread
(button-get button 'article-id))
(avandu-ui-mark-article-unread button))))
map) map)
"Keymap for articles in `avandu-overview-mode'.") "Keymap for articles in `avandu-overview-mode'.")
@ -652,6 +658,14 @@ Update the article identified by ID."
(let* ((message-truncate-lines t)) (let* ((message-truncate-lines t))
(avandu-update-article id 0 2))) (avandu-update-article id 0 2)))
(defun avandu-mark-article-unread (id)
"Send a request to tt-rss to mark an article as unread.
Update the article identified by ID."
(interactive)
(let* ((message-truncate-lines t))
(avandu-update-article id 1 2)))
(defun avandu-ui-mark-article-read (&optional button) (defun avandu-ui-mark-article-read (&optional button)
"Try to change the state of BUTTON to a read article button. "Try to change the state of BUTTON to a read article button.
@ -663,6 +677,17 @@ If BUTTON is nil, try to use a button at `point'."
(avandu-next-article)) (avandu-next-article))
(error "No button found")))) (error "No button found"))))
(defun avandu-ui-mark-article-unread (&optional button)
"Try to change the state of BUTTON to an unread article button.
If BUTTON is nil, try to use a button at `point'."
(let ((button (or button (button-at (point)))))
(if button
(progn
(button-put button 'face 'avandu-overview-unread-article)
(avandu-next-article))
(error "No button found"))))
(defun avandu-new-articles-count () (defun avandu-new-articles-count ()
"Get the total number of unread feeds." "Get the total number of unread feeds."
(interactive) (interactive)