aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Arthur Léothaud2016-12-26 16:07:21 +0100
committerGravatar Arthur Léothaud2016-12-26 18:26:27 +0100
commit24075999221b65d4b12ffbe029aec93f333fcbc8 (patch)
tree3748e0d893dfdbc573f4878e3c2b99428a93b3a3
parent891a847b0fff0ec1abfa717ede28250a16d5c429 (diff)
downloadavandu-24075999221b65d4b12ffbe029aec93f333fcbc8.tar.gz
avandu-24075999221b65d4b12ffbe029aec93f333fcbc8.zip
Add avandu-mark-article-unread function
-rw-r--r--README.org1
-rw-r--r--avandu.el25
2 files changed, 26 insertions, 0 deletions
diff --git a/README.org b/README.org
index 5864c02..e3f8411 100644
--- a/README.org
+++ b/README.org
@@ -17,6 +17,7 @@ then run =avandu-overview=.
Once in avandu:overview mode some key bindings will be:
- ~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=.
- ~n~:: Next article.
- ~p~:: Previous article.
diff --git a/avandu.el b/avandu.el
index a7d31ca..f19a55b 100644
--- a/avandu.el
+++ b/avandu.el
@@ -183,6 +183,12 @@ arguments."
(avandu-mark-article-read
(button-get button 'article-id))
(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)
"Keymap for articles in `avandu-overview-mode'.")
@@ -652,6 +658,14 @@ Update the article identified by ID."
(let* ((message-truncate-lines t))
(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)
"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))
(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 ()
"Get the total number of unread feeds."
(interactive)