-
Notifications
You must be signed in to change notification settings - Fork 4
/
gnus-recent-helm.el
74 lines (61 loc) · 2.74 KB
/
gnus-recent-helm.el
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
;;; gnus-recent-helm.el --- select recently read Gnus articles with helm -*- lexical-binding: t -*-
;;
;; Version: 0.3.0
;; Package-Requires: ((emacs "25.3.2") (gnus-recent "0.3.0") (helm))
;; Keywords: convenience, mail
;; This file is not part of GNU Emacs.
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 2, or (at your option)
;; any later version.
;;
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
;;; Commentary:
;;; Avoid having to open Gnus and find the right group just to get back to
;;; that e-mail you were reading.
;;; To use, require and bind whatever keys you prefer to the
;;; interactive functions:
;;;
;;; (require 'gnus-recent-helm)
;;; (global-set-key (kbd "<f3>") #'gnus-recent-helm)
;;; If you prefer `use-package', the above settings would be:
;;;
;;; (use-package gnus-recent-helm
;;; :after gnus
;;; :bind (("<f3>" . gnus-recent-helm)))
;;; Code:
(require 'gnus-recent)
(require 'helm)
(defun gnus-recent-helm ()
"Select a recent Gnus article to open with `helm'."
(interactive)
(helm :sources `(((name . "Gnus recent articles")
(candidates . ,(mapcar (lambda (item)
(cons (car item) item))
gnus-recent--articles-list))
(action . (("Open article" . gnus-recent-open-article)
("Copy org link to kill ring" . gnus-recent-kill-new-org-link)
("Insert org link" . gnus-recent-insert-org-link)
("Remove article" . gnus-recent--helm-forget)
("Clear all" . gnus-recent-forget-all)))))
:buffer "*helm gnus recent*"))
(defun gnus-recent--helm-forget (_recent)
"Remove Gnus articles from `gnus-recent--articles-list' using `helm'.
Helm allows for marked articles or current selection. See
function `helm-marked-candidates'. Argument _recent is not used."
(let ((cand (helm-marked-candidates)))
(dolist (article cand)
(gnus-recent-forget article))
(message "Removed %d article(s) from gnus-recent" (length cand))))
(provide 'gnus-recent-helm)
;; Local Variables:
;; coding: utf-8
;; indent-tabs-mode: nil
;; End:
;;; gnus-recent-helm.el ends here