tags:

views:

679

answers:

3

I have read the page in Emacs wiki which contains a list of session manager plugins. But after trying all of these, I am still not happy with any of them.

By comparison, the VIM session manager saves and loads sessions by name, which is one of the most important features for me.

In particular, I want a session manager for Emacs that:

  • Managing sessions by name
  • Saving tabs, screens, frames etc..

I'm trying to use Emacs because it has got really good features but a good session manager is important to my workflow.


Related:

+1  A: 

Try Emacs desktop. Go here

Nifle
I already tried desktop.el (as I said 4 times), it does not support saving sessions by names.
sid3k
Where did you say you used desktop.el?
Nifle
"I tried all of the sessionmanager plugins for emacs that is written in the wiki but I saw that most useful of them doesn't save frames, doesn't use session names and all of them have really bad names."
sid3k
+3  A: 

Already answered:

Explaining your requirements in detail allow us to provide a more specific solution for you.

Edit

Desktop mode allows you to have more than one sessions—saved desktops are not name but directory based.

From chapter Saving Emacs Sessions:

You can save the current desktop and reload one saved in another directory by typing M-x desktop-change-dir.

Furthermore, desktop-path variable allows you to define a list of directories to search for the saved desktops.

Edit 2

The Elisp code snippet sent by scottfrazer allows you to name your session, as in the background it translates the name to the proper directory name for Desktop mode.

Török Gábor
I already tried desktop.el (as I said 4 times), it does not support saving sessions by names.
sid3k
@Török Gábor: He claims to have tried the choice list therein, and is asking for a very particular feature. The formulation of the question was marginal, and the tone passive-aggressive, but the question seems to be unique.
dmckee
@dmckee: yes, the comment to my answer clarified it, that's why I tried to point out then that Emacs Desktop handles multiple sessions, it just doesn't separate them by names but directories.
Török Gábor
+15  A: 

Since you don't like the base functionality of desktop.el, throw some elisp around it:

(defvar my-desktop-session-dir
  (concat (getenv "HOME") "/.emacs.d/desktop-sessions/")
  "*Directory to save desktop sessions in")

(defvar my-desktop-session-name-hist nil
  "Desktop session name history")

(defun my-desktop-save (&optional name)
  "Save desktop with a name."
  (interactive)
  (unless name
    (setq name (my-desktop-get-session-name "Save session as: ")))
  (make-directory (concat my-desktop-session-dir name) t)
  (desktop-save (concat my-desktop-session-dir name) t))

(defun my-desktop-read (&optional name)
  "Read desktop with a name."
  (interactive)
  (unless name
    (setq name (my-desktop-get-session-name "Load session: ")))
  (desktop-read (concat my-desktop-session-dir name)))

(defun my-desktop-get-session-name (prompt)
  (completing-read prompt (and (file-exists-p my-desktop-session-dir)
                               (directory-files my-desktop-session-dir))
                   nil nil nil my-desktop-session-name-hist))

EDIT:

Getting some votes, so add niceties like completing-read and history

scottfrazer
Thanks, I was looking for something like this and this is perfect. This is pretty awesome for an emacs noob like me.
Ibrahim
@Ibrahim: Updated to make things a little nicer
scottfrazer