17

It took really a lot of time to get used to Emacs, but everything I want to have from normal editor like Coda, is just impossible without additional scripts.

I want to restore everything like it was before.

Split windows, their position, opened files/shells/debugger. Everything back to as it was. Coda can do this, Eclipse can do this, anything can do this.

When I need any normal feature for Emacs it always needs tons of scripts to have it. I thought I really would die with pyflakes, code-color, shrink-windows bindings and 20 other scripts which I even don't remember... Why are so many elementary things not integrated already???

Any good books for beginners?

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
holms
  • 9,112
  • 14
  • 65
  • 95

5 Answers5

9

Take a look under "Options" > "Customize Emacs".

It sounds like you want to enable two features:

  • "Save Place" which saves the location in each file the next time you load it.
  • "Desktop" which saves all the files you currently have loaded.

Or if you feel like editing your .emacs file:

(custom-set-variables
  ;; custom-set-variables was added by Custom.
  ;; If you edit it by hand, you could mess it up, so be careful.
  ;; Your init file should contain only one such instance.
  ;; If there is more than one, they won't work right.
  '(desktop-enable t nil (desktop))
  '(save-place t nil (saveplace)))
saschwarz
  • 1,123
  • 2
  • 13
  • 26
  • will this save splited windows also? I have 3 windows usually, in one it's shell in other two, 2 files opened. will this save a position of windows also? btw im using emacs in shell, – holms Sep 25 '10 at 04:19
  • I don't believe it saves the splits or split locations (doesn't in my version). Not sure if you mean splitting the visible frame into 3 buffers or launching 3 frames; but either way AFAIK it only reloads the files you had open when you exited and remembers your edit location in each. So you would have to resplit and change each buffer to your desired file. You'll have to relaunch the shell from w/in emacs. – saschwarz Sep 25 '10 at 12:22
  • 1
    in fact question was: can i save buffer split positions?? can I make a config or something like that ? (everytime I enter to emacs, i want to see my splited buffer with my width and height which were set before) – holms Sep 26 '10 at 11:18
  • to save place in `.emacs` (emacs 23): `(require 'saveplace) (setq-default save-place t)` – scytale Apr 28 '12 at 12:01
5

I have this working. Emacs always starts back up exactly as I left it, unless it crashes...:

http://www.gentei.org/~yuuji/software/windows.el

This will save all window spits and open buffers:

http://www.emacswiki.org/emacs/SavePlace

Thise will save your place in files. Here roughly how to set it up:

(require 'windows)
(require 'recentf)

;; -- Load the saved windows automatically on boot
(add-hook 'window-setup-hook 'resume-windows)

;; -- Save place in file
(setq-default save-place t)

;; --  Use this command to quit and save your setup
(define-key ctl-x-map "C" 'see-you-again)

;; -- Set up window saving!! Place at end of .emacs file
(win:startup-with-window)
Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
math0ne
  • 752
  • 6
  • 12
  • works perfectly. I set it up on emacs-live, in my personal pack. Had to also load revive.el prior to windows.el. http://www.emacswiki.org/emacs/WindowsMode – Noam Ben Ari Aug 21 '13 at 07:34
3

I found Conveniently save and restore frame configurations, and it might be doing what you are looking for.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
ppbitb
  • 519
  • 1
  • 7
  • 19
  • finally something useful, thnx for this link! =)It's strange that emacs supports tabs but couldn't keep their configuration when opening editor again.. – holms Mar 22 '12 at 09:42
  • I looked into it more, and it doesn't work cross-sessions (aka emacs restarts). Instead you can use revive.el from http://www.emacswiki.org/emacs/WindowsMode . I was able to use it last night to save window split configurations and restore them later, even after a restart. Now what I am not clear on is that it seems to not always restore the actual content of the buffer. Specifically it doesn't always work with nav mode buffers (code.google.com/p/emacs-nav/, ide-like file explorer). Maybe I need to dig more on http://www.emacswiki.org/emacs/SessionManagement – ppbitb Mar 22 '12 at 13:46
2

Not sure whether it is nearing to what you want, but give it a try: http://www.emacswiki.org/emacs/LayoutRestore

sstotok
  • 21
  • 1
  • 1
    No it's not. After quitting emacs, after I wake up in the morning, I want to continue with the same layout as it was before. Same splits, same files opened in them, same width/heigh of the splits..everything THE SAME as it was before quiting emacs.. Every editor has things like that. I hate VIM but in vim you can restore everything back as it was... – holms Oct 18 '10 at 17:41
1

Emacs 24.4 snapshots since June 2013 have added frame restoration to the bundled session manager desktop.el. This includes restoring desktop position and opened windows of all frames. I have tried this feature myself using a January 2014 snapshot and it works pretty well, though a few minor bugs remain. These may have already been fixed in more recent snapshots.

Note that some buffers cannot easily be restored even in theory, such as debuggers (gdb, pdb, etc.) and any others buffer that depends on an external process.

holocronweaver
  • 2,171
  • 3
  • 18
  • 20
  • This worked perfectly for me and is nicely documented here: http://ergoemacs.org/emacs/emacs_save_restore_opened_files.html – petergassner Jun 10 '15 at 13:56