Commits

yagnesh raghava yakkala committed 0050882

* init-gnus.el: some more gnus settings from emacswiki.org

Comments (0)

Files changed (3)

init-custom-key-set.el

 (global-set-key (kbd "C-m") 'newline-and-indent)
 
 (global-set-key (kbd "<f9> c") 'calendar)
-(global-set-key (kbd "<f9> g") 'gnus)
+(global-set-key (kbd "<f9> g") 'door-gnus)
 (global-set-key (kbd "<f9> s") 'yag/switch-to-scratch)
 (global-set-key (kbd "<f9> S") 'ielm)
 (global-set-key (kbd "<f9> f") 'boxquote-insert-file)
       (5 (message "Gnus timed out.") (debug))
     ad-do-it))
 
-
-;;; archive
-;;; --------------------------------------------------------
-setq gnus-message-archive-group
-'((if (message-news-p)
-      "sent-news"
-    "sent-mail")))
-
 ;;; group mode
 ;;; --------------------------------------------------------
 (defun gnus-topic-select-group (&optional all)
           (insert " "))))
     (kill-buffer mouse-buffer)))
 
+;;; start/switch to gnus
+(defun door-gnus ()
+  "Switch between gnus and non-gnus buffers, preserving window configurations."
+  (interactive)
+  (let ((bufname (buffer-name)))
+    (if (or
+         (string-equal "*Group*" bufname)
+         (string-equal "*BBDB*" bufname)
+         (string-match "\*Summary" bufname)
+         (string-match "\*mail" bufname)
+         (string-match "\*wide" bufname)
+         (string-match "\*reply" bufname)
+         (string-match "\*Article" bufname))
+        (progn
+          (door-bury-gnus))
+      (if (get-buffer "*Group*")
+          (door-unbury-gnus)
+        (progn
+          (setq gnus-unbury-window-configuration (current-window-configuration))
+          (delete-other-windows)
+          (gnus))))))
+
+(defun door-unbury-gnus ()
+  (interactive)
+  (setq gnus-unbury-window-configuration nil)
+  (let ((buf nil)
+        (bufname nil))
+    (dolist (buf (buffer-list))
+      (setq bufname (buffer-name buf))
+      (when (and (boundp 'gnus-bury-window-configuration) gnus-bury-window-configuration)
+        (unless gnus-unbury-window-configuration
+          (setq gnus-unbury-window-configuration (current-window-configuration)))
+        (delete-other-windows)
+        (if (eq (current-buffer) buf)
+            (bury-buffer)
+          (bury-buffer buf))
+        (set-window-configuration gnus-bury-window-configuration)))))
+
+(defun door-bury-gnus ()
+  (interactive)
+  (setq gnus-bury-window-configuration nil)
+  (let ((buf nil)
+        (bufname nil))
+    (dolist (buf (buffer-list))
+      (setq bufname (buffer-name buf))
+      (when (or
+             (string-equal "*Group*" bufname)
+             (string-equal "*BBDB*" bufname)
+             (string-match "\*Summary" bufname)
+             (string-match "\*mail" bufname)
+             (string-match "\*reply" bufname)
+             (string-match "\*wide" 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))
+        (set-window-configuration gnus-unbury-window-configuration)))))
+
+(defun switch-to-gnus-group-buffer ()
+  "Switch to gnus group buffer if it exists, otherwise start gnus"
+  (interactive)
+  (if (or (not (fboundp 'gnus-alive-p))
+          (not (gnus-alive-p)))
+      (gnus)
+    (switch-to-buffer "*Group*")))
+
 ;;; init-utils-el ends here
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.