desktop-save-mode handles storing, and restoring, the buffer state of your session. It can also handle window and frames.
For persistence of variables across sessions, see savehist-mode. By default it handles the minibuffer history, but it's not limited to it. Another interesting thing that might be interesting to persist is for example the kill-ring.
No, it is not possible to reload the modified configuration and have Emacs behave as if those modifications were already in place when Emacs was loaded. In short, Emacs packages have too much freedom for this to be feasible.
You mention that some major modes don't pick up configuration changes. A likely reason for this is that enabling the mode sets some ...
I needed to manage the desktop files just like you; have a separate desktop file for each project and save buffers, Emacs variables, etc independently for each.
I was able to achieve that using a package called bookmark+.
Library Bookmark+ manages different types of bookmarks, one of those is Desktop Bookmarks.
After installing the package,
Since Emacs 24.4, you can use desktop-save-mode. It's been part of Emacs for ages, but the window layout is only saved and restored since version 24.4.
Just add this line in your init file:
The short answer is enable (savehist-mode) in your .emacs. This will save all minibuffer history rings by default, which includes shell-command-history which is used by M-! / (shell-command).
While I'm at it, I figure I'll also explain how to load/save command histories from shell-mode prompts and other modes that derive from comint-mode.
Note: this is for ...
These are saved session files which emacs dumps when the window manager notifies it that it is shutting down. See the function emacs-session-save. There are multiple files because they are suffixed by the X session ID. Are you by chance in the habit of quitting your window manager before you exit emacs?
write a function close to that one in your init file, you will probably have to modify it a little bit to fit your needs:
;; layout definition
(defun my-startup-layout ()
(split-window-horizontally) ;; -> |
(split-window-vertically) ;; -> --
You can use workgroups2 to manage your desktop. From the README on GitHub:
Workgroups is a session manager for Emacs.
It saves all your opened buffers, their location and sizes on disk to restore later
You can create several workspaces
You can also restore such buffers as: org-agenda, shell, magit-status, help.
If you have the MELPA repository enabled, ...
You can use perspective to manage projects. From its README:
perspective.el provides multiple workspaces (or "perspectives") for each Emacs frame. This makes it easy to work on many separate projects without getting lost in all the buffers.
Each perspective is composed of a window configuration and a set of buffers. Switching to a perspective ...
Bob is likely referring to the undo-browse.el package. According to the package's ub-introduction command,
In ub terminology, the undo-history is seen as a movie, each step
being a frame of the movie. You can play (back/forth) the color-coded
movie-history of your document, or manually go back and forth, and
revert your document to the frame you ...
In order for desktop-read (the function used to restore your desktop from a file) to restore the frameset that was saved in the desktop, it must call desktop-restoring-frameset-p (i.e., "should I restore the saved frameset?"), which in turn checks the function display-graphic-p (i.e., "is this a GUI or a TTY?"). This essentially means that, even though ...
You can use Emacs's built-in package desktop.el instead, it saves registers by default. To use it, put following to your init file:
;; prior to Emacs 24
You can also use other packages, such as built-in package savehist.el, as long as you can use it to keep value of the variable register-alist across session.
It sounds like you should start, as others have said, by getting to know (well) desktop.el. Add to that savehist.el and saveplace.el. Others may have other suggestions.
savehist.el will take care of histories and rings (they are variables), including command histories (command-history, extended-command-history ...).
My answer at https://stackoverflow.com/a/4485083/324105 might be of interest (even though this is almost the opposite to what you actually asked for).
With the custom my-desktop command, I only load my desktop file when I want to do that. Once loaded, I do automatically save it (but to my mind, if I loaded a desktop file, why wouldn't I want to save it?)
This is what I use:
;; don't use desktop mode for terminal
(desktop-save-mode 1);; is x window
;; Add variables to desktop saving
(add-to-list 'desktop-globals-to-save 'register-alist)
I've been using something modeled after sanityinc's .emacs.d.
It uses desktop-save-mode, and also is smart enough to use frame-restore on older versions emacs.
From the readme for frame-restore from package-list-packages:
Save and restore parameters of Emacs frames.
Just call frame-restore' in yourinit.el':
Note that ...
Sometimes you need to actually close buffers that are in the modes who have had their configuration changed
Calling normal-mode is a useful way to re-trigger all the modes for a given buffer, if you've made changes to those or their associated hooks.
You can also use revert-buffer (which calls normal-mode), which is sort of like reloading the file without ...
This is within the one buffer , not for the whole session, but it is worth mentioning:
With undo-tree , for example:
You open undo tree buffer with C-x u then up and down arrow to step through your history while seeing it change in the original buffer.
I actually never went fast forward until you asked... but it ...
The python implementation in Org babel has a couple of long-standing problems:
If you specify :results value, then the body is implicitly wrapped in a function and you have to add a return statement to indicate the value of the block - but only if you are not using a session.
If you specify :`:results value but you use a session, you have to wrap the body ...
If you started Emacs normally, so that it read your init file, then yes, Customize should let you save any changes you make. If it does not, then that sounds like a bug.
If you did not start Emacs using switch q or Q (or equivalent, which means not to read your init file), and if you tried to save Customize settings and Emacs gave you that error message, ...
I'm sure that savehist can manage this, here is my setup:
;; Save sessions history
(setq savehist-save-minibuffer-history 1)
'(kill-ring search-ring regexp-search-ring compile-history log-edit-comment-ring)
The problem seems to be that emacs tries to require the session package (as per the REQUEST argument to custom-set-variables), and fails (probably because it is not found in load-path).
You have to make sure that your load-path is correctly populated before you load your customization file. In particular, if session is installed as an ELPA package, it means ...
I think the issue is a nonstandard options('prompt'). I (re)moved ~/.Rpofile and the .RData file for the working directory of the session and no longer had the blocking/endless waiting/frozen issue.
prompt as an issue also showed up when octave's default prompt changed:
Regarding the comments, that encoding is fine (note that it's explicit in the desktop file's header, hence clearly intentional).
The seeming-gibberish is byte-compiled elisp, and we can see from the file path displayed that it's from auto-capitalize.elc.
I can infer from the full path that this is an ELPA package you got from MELPA, so I suspect you ...
I use a combination of a couple different packages.
Most importantly, I use Projectile for working on a "project" and fuzzy-finding files. I use multiple frames, one for each project I'm currently working on. You really only need to know C-x 5 2 and C-x 5 0 to create/kill a frame. To manage switching between projects and for storing the state of window ...
As you said in a comment:
Setting :results to values would only print the last value of the function. My goal is to have exactly the same output as in the interactive interpreter: the values of all typed expressions and of all print statements.
You can't have both, but if you want "exactly the same output as in an interactive interpreter" from multiple ...