GNU Emacs is more of an “environment” than just an editor, since it has the strong configuration language, emacs-lisp. There are a lot of applications written in emacs-lisp, and you may run many applications on your Emacs at the same time, i.e. e-mail reader, news reader, IRC client, a kind of IDE, etc. These applications likely consist of two or more windows, so when you switch among applications, you may want to save or restore how windows are located (this is called as “window-configuration”). For this purpose, Emacs has two functions, window-configuration-to-register and jump-to-register, but these are too primitive to use on a daily basis.
ElScreen provides the ease-to-use environment to save or restore several window-configurations. For instance, you just have to type C-z C-a to switch following two window-configurations:
Latest release is 1.4.6. Download it at:
There are also add-ons for popular GNU Emacs modes such as EmacsDired?, w3m. To use this version you also need to find and install APEL.
There is a fork of ElScreen/package.el updated for Emacs 24 and without external dependencies:
Key features of ElScreen are:
- Key bindings are similar to GNU Screen. - Screens are tabbed which makes it easier and faster to switch among applications. - %%ElScreen%% menu is also added to menu-bar to create, select or delete screens. - Each frame keeps up to 10 window-configurations. - List of screens can be shown in mini-buffer. - You can assign your own name to each window.
Following emacs variants are confirmed to run ElScreen:
- GNU Emacs 23.0.92 - GNU Emacs 22.0.50 (including Meadow 3.00-dev) - GNU Emacs 21.4 - GNU Emacs 21.3 - GNU Emacs 21.2 - XEmacs 21.4 - XEmacs 21.5
C-z is assigned to iconify-or-deiconify-frame (or suspend-emacs), however ElScreen reassigns this key to its prefix key. How can we iconify (or suspend) our Emacs?
Ask emacs where iconify-or-deiconify-frame on with “C-h w iconify-or-deiconify”, and it will reply with “iconify-or-deiconify-frame is on C-x C-z”. … Yes, you can also use C-x C-z to iconify-or-deiconify (or suspend-emacs)!
Of course you can change it by setting elscreen-prefix-key as following:
(setq elscreen-prefix-key “\C-z”)
Note: You must set this value before ElScreen is loaded.
As described above, ElScreen prefix key can be changed by setting elscreen-prefix-key. However, this will not have any effect after ElScreen is loaded. Even in this case, you can change it with elscreen-set-prefix-key as following:
C-z C-n, C-z C-p and suchlike are used to switch screen. When there is only one screen, these commands just warn and exit. Following code fragment makes new screen for you automatically in that case, just put this to your InitFile.
(defmacro elscreen-create-automatically (ad-do-it) (` (if (not (elscreen-one-screen-p)) (, ad-do-it) (elscreen-create) (elscreen-notify-screen-modification 'force-immediately) (elscreen-message "New screen is automatically created")))) (defadvice elscreen-next (around elscreen-create-automatically activate) (elscreen-create-automatically ad-do-it)) (defadvice elscreen-previous (around elscreen-create-automatically activate) (elscreen-create-automatically ad-do-it)) (defadvice elscreen-toggle (around elscreen-create-automatically activate) (elscreen-create-automatically ad-do-it))
Following code fragment will help those who does not want the tabs to occupy valuable space on their Emacsen but display the list of screens somewhere. This displays it on the frame-title of your Emacsen. (This code fragments now uses set-frame-name instead of setting frame-title-format if set-frame-name is avaiable, suggested by Evgeny V. Oleynik).
(defun elscreen-frame-title-update () (when (elscreen-screen-modified-p 'elscreen-frame-title-update) (let* ((screen-list (sort (elscreen-get-screen-list) '<)) (screen-to-name-alist (elscreen-get-screen-to-name-alist)) (title (mapconcat (lambda (screen) (format "%d%s %s" screen (elscreen-status-label screen) (get-alist screen screen-to-name-alist))) screen-list " "))) (if (fboundp 'set-frame-name) (set-frame-name title) (setq frame-title-format title))))) (eval-after-load "elscreen" '(add-hook 'elscreen-screen-update-hook 'elscreen-frame-title-update))
If you would like each of your elscreens to have independent most-recently-used-buffer-lists, try ElscreenSeparateBufferLists.
Example to use with iswitchb buffer switcher, show in screen with name “cde” only c-mode buffers:
(defun screen-dependent-hide-buffers () "Hook to [un]ignore buffers for elscreen name" (interactive) (let* ((screen-name (elscreen-get-screen-nickname (elscreen-get-current-screen))) (ignore (cond ((equal screen-name "cde") '((lambda (name) (with-current-buffer name (not (derived-mode-p 'c-mode)))))) (t '("^ "))))) ;; let variables (setq iswitchb-buffer-ignore ignore))) (eval-after-load "elscreen" '(add-hook 'elscreen-goto-hook 'screen-dependent-hide-buffers))
Anything, a candidate selection framework, can open files using elscreen .
‘M-x anything-for-files’ or
‘anything-find-files’, narrow the list by typing some patterns(multiple patterns are space-delimited string), select with up/down/pgup/pgdown/C-p/C-n/C-v/M-v, choose with enter, With TAB actions can be selected if the selected candidate has more than one possible action. With C-z contents of file/buffer is displayed without quitting anything session.
GNU ID Utils is a package of language independent tools that indexes tokens in source codes. Through ID database, it becomes much easier to list these tokens.
ElScreen-GF is an Emacs interface to GNU ID Utils. With this add-on, you can list tokens with filename and line number in which each token apper, select interesting entries, and jump to them more easily, making use of ElScreen.
‘dired-find-file-other-window’, which is bound to “o”, opens the entry in another window. With ElScreen Dired, new screen is created for the selected entry if it is a regular file.
Emacssen has the ways to access from remote program, emacsclient or GNUServ, and can ask running emacs to open files through these programs. With ElScreen-server, new screens are automatically created for each file.
On some window system, such as MacOS? X, Microsoft Windows, X Window System with some cool toolkit, you can drag & drop files from a file manager to your emacsen to open. With ElScreen-dnd, new screens are automatically created for each file.
Wanderlust is a mail and news client which can manage internet messages with IMAP. ElScreen-WL Add-On software provides the capability to manage draft buffers of Wanderlust effectively in conjunction with ElScreen. When you write new message or reply message, new screen is created for the draft buffer, and when a draft buffer is killed or a message is submitted, the screen for this draft buffer is automatically closed.
Emacs-W3M is the Web browser on Emacs variants using w3m. It supports tabbed browsing, so ElScreen’s tabbing capability is incompatible with it. ElScreen-W3M resolves this incompatibility by integrating Emacs-W3M’s tabbing into ElScreen.
There appear to be bugs in
elscreen-e21-command-line where it tries to use unbound symbols
elscreen-startup-command-line-processing and setting it to
nil should suppress the bug.
I had bad time using ElScreen in the past so I can’t say I prefer it or not. – XavierMaillard
I want to let first sceen numbered as 1 instead 0, how to do ?
How do I deactivate elscreen once it was loaded?
I’m trying out elscreen, but when I switch buffers via “C-x b” which runs “switch-to-buffer”, I see buffers from all screens when I tab complete. Is there a way to set it up so only the current screen’s buffers show? Thanks!