> [new:IanYang:2011-04-18 11:06 UTC]
> Specify the name of the first configuration:
> (flet ((winring-next-name nil "default"))
winring.el by BarryWarsaw allows you to switch between named window configurations (“mail”, “irc”, “gnus” etc.) with the C-x 7 prefix command. There is a ring of window configurations for every frame.
To use, make sure this file is on your
‘load-path’ and put the following in your ~/.emacs file:
(require 'winring) (winring-initialize)
You can get it from here:
Barry comments upon other existing similar packages in the commentary of the file:
‘escreen’by Noah Friedman (EmacsScreen). A much more ambitious package that does Emacs window session management. Very cool, but I wanted something more lightweight.
‘wconfig’by Bob Weiner as part of Hyperbole. I think wconfig is similar in spirit to winring; it seems to have also have named window configurations, but not frame-specific window rings.
‘winner’by Ivar Rummelhoff (WinnerMode). This package comes with Emacs 20, and appears to differ from winring by providing undo/redo semantics to window configuration changes. winner is a minor mode and does seem to support frame-specific window rings.
‘window-xemacs’by the XEmacs Development Team. It appears that this package, which is specific to XEmacs (and perhaps just XEmacs 20) implements stacks of window configurations which are frame independent.
Create or jump wrapper by IanYang:
(defun iy/winring-jump-or-create (&optional name) "Jump to or create configuration by name" (interactive) (let* ((ring (winring-get-ring)) (n (1- (ring-length ring))) (current (winring-name-of-current)) (lst (list (cons current -1))) index item) (while (<= 0 n) (push (cons (winring-name-of (ring-ref ring n)) n) lst) (setq n (1- n))) (setq name (or name (completing-read (format "Window configuration name (%s): " current) lst nil 'confirm nil 'winring-name-history current))) (setq index (cdr (assoc name lst))) (if (eq nil index) (progn (winring-save-current-configuration) (delete-other-windows) (switch-to-buffer winring-new-config-buffer-name) (winring-set-name name)) (when (<= 0 index) (setq item (ring-remove ring index)) (winring-save-current-configuration) (winring-restore-configuration item)))))
Specify the name of the first configuration:
(flet ((winring-next-name nil "default")) (winring-initialize))
See Also: FrameConfiguration for info on switching between frame configurations (window-manager “windows”).