; Fix last change

* doc/emacs/misc.texi (Saving Emacs Sessions): Minor rewording and
rearrangements.  (Bug#60600)
This commit is contained in:
Eli Zaretskii 2023-01-07 10:47:44 +02:00
parent e8b85f225d
commit 7f9588685a

View file

@ -2705,15 +2705,16 @@ when point is on the first byte of a multibyte sequence in the file.
@cindex restore session @cindex restore session
@cindex remember editing session @cindex remember editing session
@cindex reload files @cindex reload files
@cindex desktop
Use the desktop library to save the state of Emacs from one session @cindex desktop configuration
to another. The Emacs @dfn{desktop} consists of the buffers, their You can use the desktop library to save the state of Emacs from one
file names, major modes, buffer positions, and so on. session to another. The saved Emacs @dfn{desktop configuration}
includes the buffers, their file names, major modes, buffer positions,
window and frame configuration, and some important global variables.
@vindex desktop-save-mode @vindex desktop-save-mode
@findex desktop-save-mode @findex desktop-save-mode
To enable this feature, use the Customization buffer (@pxref{Easy To enable this feature, use the Customization buffer (@pxref{Easy
Customization}) to set @code{desktop-save-mode} to @code{t} for future Customization}) to set @code{desktop-save-mode} to @code{t} for future
sessions, or add this line in your init file (@pxref{Init File}): sessions, or add this line in your init file (@pxref{Init File}):
@ -2728,17 +2729,27 @@ Emacs starts, it looks for a saved desktop in @code{desktop-path}
(which defaults to @code{user-emacs-directory} and then your home (which defaults to @code{user-emacs-directory} and then your home
directory) and uses the first desktop it finds. While Emacs runs with directory) and uses the first desktop it finds. While Emacs runs with
@code{desktop-save-mode} turned on, it by default auto-saves the @code{desktop-save-mode} turned on, it by default auto-saves the
desktop whenever any of it changes. The variable desktop whenever any of the desktop configuration changes. The
@code{desktop-auto-save-timeout} determines how frequently Emacs variable @code{desktop-auto-save-timeout} determines how frequently
checks for modifications to your desktop. The desktop is also saved Emacs checks for modifications to your desktop. The desktop is also
when you exit Emacs. saved when you exit Emacs.
@cindex disable restoring of desktop configuration
Specify the option @samp{--no-desktop} on the Emacs command line
when you don't want it to reload any saved desktop configurations.
This turns off @code{desktop-save-mode} for the current session.
Starting Emacs with the @samp{--no-init-file} option also disables
desktop reloading, since it bypasses the init file, where
@code{desktop-save-mode} is usually turned on.
@findex desktop-change-dir @findex desktop-change-dir
@findex desktop-revert @findex desktop-revert
You can have separate saved desktops in different directories. You You can have separate saved desktop configurations in different
can save the current desktop and reload one saved in another directory directories; starting Emacs from a directory where you have a saved
by typing @kbd{M-x desktop-change-dir}. Typing @kbd{M-x desktop configuration will restore that configuration. You can save
desktop-revert} reverts to the desktop previously reloaded. the current desktop and reload the one saved in another directory by
typing @kbd{M-x desktop-change-dir}. Typing @kbd{M-x desktop-revert}
reverts to the previously reloaded desktop.
@vindex desktop-load-locked-desktop @vindex desktop-load-locked-desktop
The file in which Emacs saves the desktop is locked while the The file in which Emacs saves the desktop is locked while the
@ -2749,33 +2760,46 @@ will by default ask you whether to use the locked desktop file. You
can avoid the question by customizing the variable can avoid the question by customizing the variable
@code{desktop-load-locked-desktop} to either @code{nil}, which means @code{desktop-load-locked-desktop} to either @code{nil}, which means
never load the desktop in this case, or @code{t}, which means load the never load the desktop in this case, or @code{t}, which means load the
desktop without asking. Finally, the @code{check-pid} value means to desktop without asking. You can also customize the variable to the
load the file if the Emacs process that has locked the desktop is not special value @code{check-pid}, which means to load the file if the
running on the local machine. This should not be used in Emacs process that has locked the desktop is not running on the local
circumstances where the locking Emacs might still be running on machine. This should not be used in circumstances where the locking
another machine. This could be the case in multi-user environments Emacs might still be running on another machine, which could be the
where your home directory is mounted remotely using NFS or similar. case in multi-user environments where your home directory is mounted
remotely using NFS or similar.
@cindex desktop restore in daemon mode
When Emacs starts in daemon mode, it cannot ask you any questions,
so if it finds the desktop file locked, it will not load it, unless
@code{desktop-load-locked-desktop} is @code{t}. Note that restoring
the desktop in daemon mode is somewhat problematic for other reasons:
e.g., the daemon cannot use GUI features, so parameters such as frame
position, size, and decorations cannot be restored. For that reason,
you may wish to delay restoring the desktop in daemon mode until the
first client connects, by calling @code{desktop-read} (see below) in a
hook function that you add to @code{server-after-make-frame-hook}
(@pxref{Creating Frames,,, elisp, The Emacs Lisp Reference Manual}).
@findex desktop-save @findex desktop-save
@findex desktop-read @findex desktop-read
Whenever you want, you can use the command @kbd{M-x desktop-save} to Whenever you want, you can use the command @kbd{M-x desktop-save} to
force saving the current desktop. If you do not want to use the force immediate saving of the current desktop. This is useful either
automatic @code{desktop-save-mode}, you can use @kbd{M-x desktop-save} if you do not want to use the automatic desktop restoration, and thus
and then @kbd{M-x desktop-read} to restore a previous desktop. don't turn on @code{desktop-save-mode}, or when you have made
significant changes to the desktop, and want to make sure the
configuration doesn't get lost if Emacs or your system crashes. You
can use @kbd{M-x desktop-read} to restore a previously-saved desktop
if the current Emacs session didn't load any desktop yet.
@vindex desktop-restore-frames @vindex desktop-restore-frames
By default, the desktop also tries to save the frame and window By default, the desktop tries to save and restore the frame and
configuration. To disable this, set @code{desktop-restore-frames} to window configuration. To disable this, set
@code{nil}. (See that variable's documentation for some related @code{desktop-restore-frames} to @code{nil}. (See that variable's
options that you can customize to fine-tune this behavior.) documentation for some related options that you can customize to
fine-tune this behavior.)
@vindex desktop-files-not-to-save
Information about buffers visiting remote files is not saved by
default. Customize the variable @code{desktop-files-not-to-save} to
change this.
@vindex frameset-filter-alist @vindex frameset-filter-alist
When the desktop restores the frame and window configuration, it When the desktop restores the frame and window configuration, it
uses the recorded values of frame parameters, disregarding any uses the recorded values of frame parameters, disregarding any
settings for those parameters you have in your init file (@pxref{Init settings for those parameters you have in your init file (@pxref{Init
File}). This means that frame parameters such as fonts and faces for File}). This means that frame parameters such as fonts and faces for
@ -2783,7 +2807,13 @@ the restored frames will come from the desktop file, where they were
saved when you exited your previous Emacs session; any settings for saved when you exited your previous Emacs session; any settings for
those parameters in your init file will be ignored. To disable this, those parameters in your init file will be ignored. To disable this,
customize the value of @code{frameset-filter-alist} to filter out the customize the value of @code{frameset-filter-alist} to filter out the
frame parameters you don't want to be restored. frame parameters you don't want to be restored; they will then be set
according to your customizations in the init file.
@vindex desktop-files-not-to-save
Information about buffers visiting remote files is not saved by
default. Customize the variable @code{desktop-files-not-to-save} to
change this.
@vindex desktop-restore-eager @vindex desktop-restore-eager
By default, all the buffers in the desktop are restored in one go. By default, all the buffers in the desktop are restored in one go.
@ -2795,32 +2825,15 @@ remaining buffers are restored lazily, when Emacs is idle.
@findex desktop-clear @findex desktop-clear
@vindex desktop-globals-to-clear @vindex desktop-globals-to-clear
@vindex desktop-clear-preserve-buffers-regexp @vindex desktop-clear-preserve-buffers-regexp
Type @kbd{M-x desktop-clear} to empty the Emacs desktop. This kills Type @kbd{M-x desktop-clear} to empty the Emacs desktop; this can be
all buffers except for internal ones, and clears the global variables useful, for example, if you want to switch to another desktop by
listed in @code{desktop-globals-to-clear}. If you want this to invoking @kbd{M-x desktop-read} next. The @code{desktop-clear}
preserve certain buffers, customize the variable command kills all buffers except for internal ones, and clears the
global variables listed in @code{desktop-globals-to-clear}. If you
want it to preserve certain buffers, customize the variable
@code{desktop-clear-preserve-buffers-regexp}, whose value is a regular @code{desktop-clear-preserve-buffers-regexp}, whose value is a regular
expression matching the names of buffers not to kill. expression matching the names of buffers not to kill.
Specify the option @samp{--no-desktop} on the command line when you
don't want it to reload any saved desktop. This turns off
@code{desktop-save-mode} for the current session. Starting Emacs with
the @samp{--no-init-file} option also disables desktop reloading,
since it bypasses the init file, where @code{desktop-save-mode} is
usually turned on.
@cindex desktop restore in daemon mode
When Emacs starts in daemon mode, it cannot ask you any questions,
so if it finds the desktop file locked, it will not load it, unless
@code{desktop-load-locked-desktop} is @code{t}. Note that restoring
the desktop in daemon mode is somewhat problematic for other reasons:
e.g., the daemon cannot use GUI features, so parameters such as frame
position, size, and decorations cannot be restored. For that reason,
you may wish to delay restoring the desktop in daemon mode until the
first client connects, by calling @code{desktop-read} in a hook
function that you add to @code{server-after-make-frame-hook}
(@pxref{Creating Frames,,, elisp, The Emacs Lisp Reference Manual}).
If you want to save minibuffer history from one session to If you want to save minibuffer history from one session to
another, use the @code{savehist} library. another, use the @code{savehist} library.