aartist
aartist

Reputation: 3236

Frames Configuration of Emacs

In emacs C-x r f remembers the frames configuration to a register. How I can 'see' it ? M-x view-register doesn't show it. I also like to store different configurations and re-call them as I need them across emacs sessions.

Upvotes: 3

Views: 506

Answers (4)

Leo
Leo

Reputation: 4428

The winsav.el library is alive, but the new version is on Launchpad as part of nXhtml. The easiest way to get winsav and set it up is just to download the whole of nXhtml and install it. (If you want it to load fast then just byte compile the whole nXhtml - FROM the nXhtml menu.)

If you for some reason believe it is better to just have winsav.el then it is in the util subdirectory:

http://bazaar.launchpad.net/~nxhtml/nxhtml/main/files/head:/util/

(Note that the zip files for downloading nXhtml are a bit old now. In fact everything in my Emacs pages are a bit old at the moment. Except for some parts of nXhtml that I update now and then. And the sources for EmacsW32 - which are not up to date but include man.

Upvotes: 1

Drew
Drew

Reputation: 30701

With Bookmark+ you can bookmark an Emacs desktop. Unfortunately, a desktop does not record the frame configuration. (You can also bookmark a frame configuration, but that is only for the same Emacs session, since they are not peristent.)

I believe there are, however, some libraries that let you save a window or frame configuration persistently (and then restore it). You might try Lennart Borgman's winsav.el, for instance. I know that a couple of years ago he was working on that feature -- dunno what the status is now. If it works, then you can also bookmark persistent frame configs.

Upvotes: 0

phils
phils

Reputation: 73246

C-xrj is bound to jump-to-register, and you can find the code you need in there. You can use either M-x find-function or M-x find-function-on-key to conveniently jump to the source.

The function obtains an argument register and then calls (get-register register) to obtain the data. The following code then deals with restoring the frame or window configuration as required.

The "c" code to interactive means a character, so the register argument is just a character. You could therefore use (get-register ?a) to obtain register a.

(defun jump-to-register (register &optional delete)
  (interactive "cJump to register: \nP")
  (let ((val (get-register register)))
    (cond
     ;; [...]
     ((and (consp val) (frame-configuration-p (car val)))
      (set-frame-configuration (car val) (not delete))
      (goto-char (cadr val)))
     ((and (consp val) (window-configuration-p (car val)))
      (set-window-configuration (car val))
      (goto-char (cadr val)))
     ;; [...]
     )))

Upvotes: 2

choroba
choroba

Reputation: 241768

Quoting the documentation:

Use C-x r j R to restore a window or frame configuration. This is the same command used to restore a cursor position. When you restore a frame configuration, any existing frames not included in the configuration become invisible. If you wish to delete these frames instead, use C-u C-x r j R.

(Where R stands for the register.)

Upvotes: 0

Related Questions