summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKyle Meyer <meyerkya@gmail.com>2013-07-23 15:13:58 -0400
committerKyle Meyer <meyerkya@gmail.com>2013-07-23 16:56:11 -0400
commit4f51322552da0f1c4bb9b0ae58daef643f2a331d (patch)
treea7f0e55d82211931d7029a6ca4d16df8206b51b3
parenta96a23d9ce117923d86aa4db035db194ec9583ed (diff)
downloademacs.d-4f51322552da0f1c4bb9b0ae58daef643f2a331d.tar.gz
Add keybinding for level 1 gnus start or switch
Create a function that always fetches a specified level even if gnus is already started. This is different from the behavior of both `gnus' and `gnus-other-frame' (although I might be missing a gnus function that already does this). I'm fine frequently fetching level 1 because I reserve this for mail groups (which are local).
-rw-r--r--init/km-gnus.el17
1 files changed, 17 insertions, 0 deletions
diff --git a/init/km-gnus.el b/init/km-gnus.el
index 53077ba..d1f53f3 100644
--- a/init/km-gnus.el
+++ b/init/km-gnus.el
@@ -130,3 +130,20 @@
(setq notmuch-fcc-dirs nil)
(setq footnote-section-tag "")
+
+(defun km/gnus-other-frame-always-fetch (arg)
+ "Run `gnus-other-frame' and always fetch level ARG.
+The default behavior of `gnus-other-frame' is to fetch level ARG
+only if gnus is not yet started. Otherwise, it will just switch
+to a gnus frame. This function calls `gnus-other-frame', but
+fetches level ARG regardless of whether gnus was already running"
+ (interactive "P")
+ (let ((need-fetch (gnus-alive-p)))
+ (gnus-other-frame arg)
+ (when need-fetch
+ (gnus-group-get-new-news arg))))
+
+;; only check level one (mail)
+(global-set-key (kbd "C-c m") '(lambda ()
+ (interactive)
+ (km/gnus-other-frame-always-fetch 1)))