From: "Davis Herring" <herring@lanl.gov>
To: "Lennart Borgman" <lennart.borgman@gmail.com>
Cc: Stefan Monnier <monnier@iro.umontreal.ca>, emacs-devel@gnu.org
Subject: Re: desktop and ~/.emacs.d/
Date: Mon, 14 Sep 2009 08:17:41 -0700 (PDT) [thread overview]
Message-ID: <48820.130.55.118.19.1252941461.squirrel@webmail.lanl.gov> (raw)
In-Reply-To: <e01d8a50909140743pb2a56bbm325931ee162eb267@mail.gmail.com>
>> Sounds fine to me; in fact, it might make sense for .emacs.d to be
>> offered as the default location (rather than the directory current at
>> the first invocation of `desktop-save', that `interactive' picks).
>
> A very welcome patch... ;-)
Hey, isn't that my line? ;)
It occurs to me that `user-emacs-directory' isn't always the right
default, because if you want to create multiple desktops, you'll probably
want them near some file that's current when you issue `desktop-save'. So
here's a heuristic: if `desktop-dirname' is nil, so no desktop is loaded,
offer `user-emacs-directory' as a default; otherwise offer the current
directory as before. The only place this seems wrong is when you, say,
abort loading ~/.emacs.d/.emacs.desktop, so that the default would
overwrite it when you probably meant to make a new one elsewhere. But
it's safe: `desktop-save' will prompt intelligently before overwriting it.
Davis
*** cvs/desktop.el 2009-09-14 08:46:20.910215000 -0600
--- new/desktop.el 2009-09-14 09:09:17.649462000 -0600
***************
*** 519,524 ****
--- 519,528 ----
(defvar desktop-dirname nil
"The directory in which the desktop file should be saved.")
+ (defun desktop-read-dirname ()
+ (read-directory-name "Directory to save desktop file in: "
+ (and (not desktop-dirname) user-emacs-directory) nil t))
+
(defun desktop-full-file-name (&optional dirname)
"Return the full name of the desktop file in DIRNAME.
DIRNAME omitted or nil means use `desktop-dirname'."
***************
*** 625,634 ****
(and exists (eq desktop-save 'ask-if-exists)))
(y-or-n-p "Save desktop? ")))))
(unless desktop-dirname
! (setq desktop-dirname
! (file-name-as-directory
! (expand-file-name
! (read-directory-name "Directory for desktop file: " nil nil t)))))
(condition-case err
(desktop-save desktop-dirname t)
(file-error
--- 629,636 ----
(and exists (eq desktop-save 'ask-if-exists)))
(y-or-n-p "Save desktop? ")))))
(unless desktop-dirname
! (setq desktop-dirname (file-name-as-directory
! (expand-file-name (desktop-read-dirname)))))
(condition-case err
(desktop-save desktop-dirname t)
(file-error
***************
*** 850,856 ****
Parameter DIRNAME specifies where to save the desktop file.
Optional parameter RELEASE says whether we're done with this desktop.
See also `desktop-base-file-name'."
! (interactive "DDirectory to save desktop file in: ")
(setq desktop-dirname (file-name-as-directory (expand-file-name
dirname)))
(save-excursion
(let ((eager desktop-restore-eager)
--- 852,858 ----
Parameter DIRNAME specifies where to save the desktop file.
Optional parameter RELEASE says whether we're done with this desktop.
See also `desktop-base-file-name'."
! (interactive (list (desktop-read-dirname)))
(setq desktop-dirname (file-name-as-directory (expand-file-name
dirname)))
(save-excursion
(let ((eager desktop-restore-eager)
--
This product is sold by volume, not by mass. If it appears too dense or
too sparse, it is because mass-energy conversion has occurred during
shipping.
next prev parent reply other threads:[~2009-09-14 15:17 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-09-05 0:27 Bug for .emacs.d? Angelo Graziosi
2009-09-05 2:12 ` bug#4347: " Juanma Barranquero
2009-09-11 20:23 ` Stefan Monnier
2009-09-11 20:34 ` Juanma Barranquero
2009-09-11 21:21 ` Angelo Graziosi
2009-09-12 4:25 ` Stefan Monnier
2009-09-12 8:29 ` Angelo Graziosi
2009-09-12 19:32 ` Stefan Monnier
2009-09-12 19:32 ` Stefan Monnier
2009-09-12 21:43 ` Angelo Graziosi
2009-09-13 2:31 ` Miles Bader
2009-09-13 2:31 ` Miles Bader
2009-09-13 2:57 ` message creates ~/Mail [was Re: bug#4347: Bug for .emacs.d?] Glenn Morris
2009-09-13 3:23 ` message creates ~/Mail Miles Bader
2009-09-13 8:20 ` Reiner Steib
2009-09-13 8:56 ` Miles Bader
2009-09-13 11:12 ` Daniel Clemente
2009-09-14 19:07 ` Glenn Morris
2009-09-13 4:16 ` Stefan Monnier
2009-09-12 21:43 ` bug#4347: Bug for .emacs.d? Angelo Graziosi
2009-09-13 13:06 ` Angelo Graziosi
2009-09-13 13:06 ` Angelo Graziosi
2009-09-13 13:35 ` Juanma Barranquero
2009-09-13 13:48 ` Angelo Graziosi
2009-09-13 13:48 ` Angelo Graziosi
2009-09-13 13:35 ` Juanma Barranquero
2009-09-13 14:04 ` Stefan Monnier
2009-09-13 14:12 ` Angelo Graziosi
2009-09-13 17:41 ` Juanma Barranquero
2009-09-13 17:41 ` Juanma Barranquero
2009-09-13 14:12 ` Angelo Graziosi
2009-09-13 16:06 ` desktop and ~/.emacs.d/ (was: bug#4347: Bug for .emacs.d?) Reiner Steib
2009-09-14 1:26 ` desktop and ~/.emacs.d/ Stefan Monnier
2009-09-14 1:30 ` Juanma Barranquero
2009-09-14 14:22 ` Davis Herring
2009-09-14 14:43 ` Lennart Borgman
2009-09-14 15:17 ` Davis Herring [this message]
2009-09-13 14:04 ` bug#4347: Bug for .emacs.d? Stefan Monnier
2009-09-12 8:29 ` Angelo Graziosi
2009-09-12 11:16 ` Juanma Barranquero
2009-09-12 19:38 ` Stefan Monnier
2009-09-12 19:42 ` Juanma Barranquero
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=48820.130.55.118.19.1252941461.squirrel@webmail.lanl.gov \
--to=herring@lanl.gov \
--cc=emacs-devel@gnu.org \
--cc=lennart.borgman@gmail.com \
--cc=monnier@iro.umontreal.ca \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.