help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Use emacs.desktop when starting emacs from a particular directory


From: Steinar Bang
Subject: Re: Use emacs.desktop when starting emacs from a particular directory
Date: Sat, 03 Nov 2018 09:40:15 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (windows-nt)

>>>>> Eli Zaretskii <eliz@gnu.org>:

>> From: Stefan Monnier <monnier@iro.umontreal.ca>

>> desktop.el only automatically reads the desktop file if
>> desktop-save-mode is enabled and only right after reading the init file.

> So perhaps a better solution to the above would be to make some part
> of .emacs conditional on some environment variable, and set that
> variable in the script?

That would have been my fallback option, but as it turned out there was
a simpler solution:
 1. Remove my old desktop settings from .emacs
 2. Add the following to the end of .emacs
     (setq desktop-path '("."))
 3. Change the commands in the script starting emacs with a desktop, to:
     cd ~/workspaces
     emacs --eval "(progn (desktop-read)(desktop-save-mode 1))" >/dev/null 2>&1 
&

Now emacs started with the script comes up with a restored desktop, but
an emacs started in the home directory with a plain
 emacs &
comes up without desktop restore.

Thanks again!


- Steinar



reply via email to

[Prev in Thread] Current Thread [Next in Thread]