EmacsLispScreen

elscreen is a GNU Emacs window session manager modeled after GNU screen by NaotoMorishima.

WorkInProgressPage XavierMaillard

Introduction

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:

Features

Key features of ElScreen are:

Environments

Following emacs variants are confirmed to run ElScreen:

Tips

How to iconify (or suspend) Emacs?

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.

How to change prefix-key after %%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:

(elscreen-set-prefix-key "\C-t")

How to create screen automatically when there is only one screen?

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))
 

How to display the list of screens on the frame-title of my Emacs?

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))

In emacs 25.1, get-alist does not exist. alist-get does the same thing.

How to give each screen its own buffer-list

If you would like each of your elscreens to have independent most-recently-used-buffer-lists, try ElscreenSeparateBufferLists.

How to hide some of buffers with depends from screen name. Example for iswitchb.

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))
 

ElScreen Addons

Use with Anything

Anything, a candidate selection framework, can open files using elscreen .

Start with ‘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.

Interface to GNU ID Utils

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.

ElScreen-GF 1.5.0 or later also supports cscope, and 1.5.2 or later supports GNU GLOBAL. Moreover, 1.5.0 or later is expected to run on XEmacs.

Dired integration

In Dired, ‘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.

ElScreen-server

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.

ElScreen-dnd

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.

ElScreen-WL

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.

ElScreen-W3M

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.

Bugs

There appear to be bugs in elscreen-e21-command-line where it tries to use unbound symbols dir and line. Customizing elscreen-startup-command-line-processing and setting it to nil should suppress the bug.

Opinions

Compared to escreen (EmacsScreen) its frame support is better: it spawns a new set (0-9) of screens for each frame, which is more in line with what I expect. – DanDebertin

EmacsScreen maintains separate screens per frame now, but EmacsLispScreen does still seem more featureful. --NoahFriedman

I had bad time using ElScreen in the past so I can’t say I prefer it or not. – XavierMaillard

Questions

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!


CategoryEmulation CategoryWindows CategoryProject