From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Davis Herring" Newsgroups: gmane.emacs.devel Subject: Re: desktop and ~/.emacs.d/ Date: Mon, 14 Sep 2009 08:17:41 -0700 (PDT) Message-ID: <48820.130.55.118.19.1252941461.squirrel@webmail.lanl.gov> References: <4AA1B07E.3080703@alice.it> <4AAABF56.40802@alice.it> <4AAB5BD0.2010503@alice.it> <4AACEE4F.6060404@alice.it> <874or67rt9.fsf_-_@marauder.physik.uni-ulm.de> <33149.130.55.118.19.1252938144.squirrel@webmail.lanl.gov> Reply-To: herring@lanl.gov NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain;charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Trace: ger.gmane.org 1252941767 27664 80.91.229.12 (14 Sep 2009 15:22:47 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 14 Sep 2009 15:22:47 +0000 (UTC) Cc: Stefan Monnier , emacs-devel@gnu.org To: "Lennart Borgman" Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Sep 14 17:22:39 2009 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1MnDNz-0007GV-DO for ged-emacs-devel@m.gmane.org; Mon, 14 Sep 2009 17:22:35 +0200 Original-Received: from localhost ([127.0.0.1]:43007 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MnDNy-0001QG-JQ for ged-emacs-devel@m.gmane.org; Mon, 14 Sep 2009 11:22:34 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MnDJQ-0006uE-2E for emacs-devel@gnu.org; Mon, 14 Sep 2009 11:17:52 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MnDJJ-0006pf-Km for emacs-devel@gnu.org; Mon, 14 Sep 2009 11:17:50 -0400 Original-Received: from [199.232.76.173] (port=33999 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MnDJI-0006pH-Vc for emacs-devel@gnu.org; Mon, 14 Sep 2009 11:17:45 -0400 Original-Received: from proofpoint3.lanl.gov ([204.121.3.28]:49688) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1MnDJI-0001kf-Gw for emacs-devel@gnu.org; Mon, 14 Sep 2009 11:17:44 -0400 Original-Received: from mailrelay1.lanl.gov (mailrelay1.lanl.gov [128.165.4.101]) by proofpoint3.lanl.gov (8.14.3/8.14.3) with ESMTP id n8EFHgvJ023044; Mon, 14 Sep 2009 09:17:42 -0600 Original-Received: from localhost (localhost.localdomain [127.0.0.1]) by mailrelay1.lanl.gov (Postfix) with ESMTP id 0FB3716502E; Mon, 14 Sep 2009 09:17:42 -0600 (MDT) X-NIE-2-Virus-Scanner: amavisd-new at mailrelay1.lanl.gov Original-Received: from webmail1.lanl.gov (webmail1.lanl.gov [128.165.4.106]) by mailrelay1.lanl.gov (Postfix) with ESMTP id D63F3165026; Mon, 14 Sep 2009 09:17:41 -0600 (MDT) Original-Received: by webmail1.lanl.gov (Postfix, from userid 48) id D4B531DE01D4; Mon, 14 Sep 2009 09:17:41 -0600 (MDT) Original-Received: from 130.55.118.19 (SquirrelMail authenticated user 196434) by webmail.lanl.gov with HTTP; Mon, 14 Sep 2009 08:17:41 -0700 (PDT) In-Reply-To: User-Agent: SquirrelMail/1.4.8-5.7.lanl6 X-Priority: 3 (Normal) Importance: Normal X-Proofpoint-Virus-Version: vendor=fsecure engine=1.12.8161:2.4.5, 1.2.40, 4.0.166 definitions=2009-09-11_12:2009-09-01, 2009-09-11, 2009-09-12 signatures=0 X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:115307 Archived-At: >> 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.