Comment Addition for Gnus (Score 1) 412
A useful addition to Gnus (it may be part of the distribution now):
;; Provide a function to switch to a *Summary buffer or the *Group buffer.
;; Let the user decide whether to bind it. Written by Randell Jesup.
;;
(defun switch-to-gnus ()
"Switch to a *Summary whatever* buffer if one exists. If none exist,
switch to the *Group* buffer. If that doesn't exist, complain."
(interactive)
;;
(let ((buflist (buffer-list))
(done 0)
(saw_group 0))
(while (and (= done 0)
(not (equal buflist nil)))
(let ((candidate (car buflist)))
(let ((candname (prin1-to-string candidate)))
(if (string-match "#<buffer +\\*Summary.*\\*>" candname)
(progn
(switch-to-buffer candidate)
(setq done 1))
(setq buflist (cdr buflist)))
;; remember if we saw *Group*
(if (string-equal "#<buffer *Group*>" candname)
(progn
(setq saw_group 1))))))
(if (= done 0)
(if (= saw_group 1)
(switch-to-buffer "*Group*")
(error "Gnus doesn't appear to be running")))))
;; This switches to the a *Summary buffer if one exists, else to *Group*
(global-set-key [f9] 'switch-to-gnus)
A couple of other goodies:
;; If invoked from a non-shell buffer, it changes to or opens a shell
;; buffer with the path set to that of the buffer from which this command
;; was invoked. If invoked from a shell-mode buffer, it changes back to
;; the last buffer from which the shell was invoked whith this command.
(global-set-key [f3] 'shell-pushd-to-buffer-path)
;; make switching buffers easy
(global-set-key [f6] 'other-window)
(defun prev-window ()
"previous window"
(interactive)
(other-window -1))
(global-set-key [S-f6] 'prev-window)
;; Windows-ish commands:
;; Block cut, copy, paste:
;;; KEY: [A-x]: Cut region.
(global-set-key [?\A-x] 'kill-region)
;;; KEY: [A-c]: Copy region.
(global-set-key [?\A-c] 'copy-region-as-kill)
;;; KEY: [A-v]: Paste.
(global-set-key [?\A-v] 'yank)
;;; KEY: [ESC A-v]: If you've just used paste, use this key to cycle through
;;; KEY: previous available pastes on the Emacs clipboard.
(define-key esc-map [?\A-v] 'yank-pop)
;; Provide a function to switch to a *Summary buffer or the *Group buffer.
;; Let the user decide whether to bind it. Written by Randell Jesup.
;;
(defun switch-to-gnus ()
"Switch to a *Summary whatever* buffer if one exists. If none exist,
switch to the *Group* buffer. If that doesn't exist, complain."
(interactive)
(let ((buflist (buffer-list))
(done 0)
(saw_group 0))
(while (and (= done 0)
(not (equal buflist nil)))
(let ((candidate (car buflist)))
(let ((candname (prin1-to-string candidate)))
(if (string-match "#<buffer +\\*Summary.*\\*>" candname)
(progn
(switch-to-buffer candidate)
(setq done 1))
(setq buflist (cdr buflist)))
(if (string-equal "#<buffer *Group*>" candname)
(progn
(setq saw_group 1))))))
(if (= done 0)
(if (= saw_group 1)
(switch-to-buffer "*Group*")
(error "Gnus doesn't appear to be running")))))
;; This switches to the a *Summary buffer if one exists, else to *Group*
(global-set-key [f9] 'switch-to-gnus)
A couple of other goodies:
;; If invoked from a non-shell buffer, it changes to or opens a shell
;; buffer with the path set to that of the buffer from which this command
;; was invoked. If invoked from a shell-mode buffer, it changes back to
;; the last buffer from which the shell was invoked whith this command.
(global-set-key [f3] 'shell-pushd-to-buffer-path)
;; make switching buffers easy
(global-set-key [f6] 'other-window)
(defun prev-window ()
"previous window"
(interactive)
(other-window -1))
(global-set-key [S-f6] 'prev-window)
;; Windows-ish commands:
;; Block cut, copy, paste:
;;; KEY: [A-x]: Cut region.
(global-set-key [?\A-x] 'kill-region)
;;; KEY: [A-c]: Copy region.
(global-set-key [?\A-c] 'copy-region-as-kill)
;;; KEY: [A-v]: Paste.
(global-set-key [?\A-v] 'yank)
;;; KEY: [ESC A-v]: If you've just used paste, use this key to cycle through
;;; KEY: previous available pastes on the Emacs clipboard.
(define-key esc-map [?\A-v] 'yank-pop)