diff options
author | Arthur Léothaud | 2016-12-26 16:07:21 +0100 |
---|---|---|
committer | Arthur Léothaud | 2016-12-26 18:26:27 +0100 |
commit | 24075999221b65d4b12ffbe029aec93f333fcbc8 (patch) | |
tree | 3748e0d893dfdbc573f4878e3c2b99428a93b3a3 | |
parent | 891a847b0fff0ec1abfa717ede28250a16d5c429 (diff) | |
download | avandu-24075999221b65d4b12ffbe029aec93f333fcbc8.tar.gz avandu-24075999221b65d4b12ffbe029aec93f333fcbc8.zip |
Add avandu-mark-article-unread function
-rw-r--r-- | README.org | 1 | ||||
-rw-r--r-- | avandu.el | 25 |
2 files changed, 26 insertions, 0 deletions
@@ -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. @@ -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) |