diff options
author | Kyle Meyer <kyle@kyleam.com> | 2014-03-08 00:05:21 -0500 |
---|---|---|
committer | Kyle Meyer <kyle@kyleam.com> | 2014-03-09 01:06:10 -0500 |
commit | b9c822d00c1257ed3a081b7d2ec3e7ac2f084621 (patch) | |
tree | 09a9c48ce2a39a0034460ab458dc33c278cf9149 /lisp | |
parent | 9650a843f0198d4448fea34dcf7a9d90fc684f01 (diff) | |
download | emacs.d-b9c822d00c1257ed3a081b7d2ec3e7ac2f084621.tar.gz |
Add functions to bury and unbury gnus
Diffstat (limited to 'lisp')
-rw-r--r-- | lisp/init-gnus.el | 51 |
1 files changed, 44 insertions, 7 deletions
diff --git a/lisp/init-gnus.el b/lisp/init-gnus.el index 6bc566f..1c7f91d 100644 --- a/lisp/init-gnus.el +++ b/lisp/init-gnus.el @@ -193,12 +193,49 @@ on a new line and the resulting paragraph is filled." (gnus-define-keys gnus-article-mode-map "e" shr-browse-url))) -(defadvice gnus (around gnus-fullscreen activate) - (window-configuration-to-register :gnus-fullscreen) - ad-do-it - (delete-other-windows)) -(defadvice gnus-group-exit (around gnus-restore-screen activate) - ad-do-it - (jump-to-register :gnus-fullscreen)) +;; Modified from http://www.xsteve.at/prg/gnus/ + +(defun km/gnus () + "Start, select, or bury gnus." + (interactive) + (let ((bufname (buffer-name))) + (if (or (string-equal "*Group*" bufname) + (string-match "\*Summary" bufname) + (string-match "\*Article" bufname)) + (km/bury-gnus) + (if (get-buffer "*Group*") + (km/unbury-gnus) + (gnus-unplugged))))) + +(defvar gnus-bury-window-configuration nil) + +(defun km/unbury-gnus () + (let (dead-frame-p + (windows-saved-p + (and (boundp 'gnus-bury-window-configuration) + gnus-bury-window-configuration))) + (when windows-saved-p + (unless (set-window-configuration gnus-bury-window-configuration) + (setq dead-frame-p t))) + (when (or dead-frame-p (not windows-saved-p)) + (switch-to-buffer "*Group*")))) + +(defun km/bury-gnus () + (let ((buf nil) + (bufname nil)) + (setq gnus-bury-window-configuration nil) + (dolist (buf (buffer-list)) + (setq bufname (buffer-name buf)) + (when (or (string-equal "*Group*" bufname) + (string-match "\*Summary" bufname) + (string-match "\*Article" bufname)) + (unless gnus-bury-window-configuration + (setq gnus-bury-window-configuration (current-window-configuration))) + (delete-other-windows) + (if (eq (current-buffer) buf) + (bury-buffer) + (bury-buffer buf)))))) + +(global-set-key (kbd "C-x m") 'km/gnus) (provide 'init-gnus) |