From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Juanma Barranquero" Newsgroups: gmane.emacs.devel Subject: Re: Files that begin with a period Date: Mon, 20 Oct 2008 11:03:27 +0200 Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1224518814 8941 80.91.229.12 (20 Oct 2008 16:06:54 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 20 Oct 2008 16:06:54 +0000 (UTC) Cc: emacs-devel@gnu.org To: "Stefan Monnier" Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Oct 20 18:07:52 2008 connect(): Connection refused 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 1Krr15-0002qQ-4M for ged-emacs-devel@m.gmane.org; Mon, 20 Oct 2008 11:25:35 +0200 Original-Received: from localhost ([127.0.0.1]:35361 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Krqzz-0001YI-OR for ged-emacs-devel@m.gmane.org; Mon, 20 Oct 2008 05:24:27 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Krqfr-0003A6-Df for emacs-devel@gnu.org; Mon, 20 Oct 2008 05:03:40 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Krqfj-00037s-IC for emacs-devel@gnu.org; Mon, 20 Oct 2008 05:03:35 -0400 Original-Received: from [199.232.76.173] (port=48572 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Krqfg-00037I-K1 for emacs-devel@gnu.org; Mon, 20 Oct 2008 05:03:29 -0400 Original-Received: from mail-gx0-f10.google.com ([209.85.217.10]:63734) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Krqfg-0005c1-4u for emacs-devel@gnu.org; Mon, 20 Oct 2008 05:03:28 -0400 Original-Received: by gxk3 with SMTP id 3so3568527gxk.18 for ; Mon, 20 Oct 2008 02:03:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:cc:in-reply-to:mime-version:content-type :content-transfer-encoding:content-disposition:references; bh=WMV4D8gmpmmNmIbC0e0zt2uJ+cGQCqsVxDRJ853cQ0Q=; b=vDU9+s01q0XYlfofhrY/2Jd9/qdZiG6S0iQQaBNr54RduUqc/dpuDd54RfbZNy1vKT clLsygRIsyFzyz1V/jdViw6sdUBrDrQmBliYt/pAnFKLA/nZlYCnC1rtLOWCnMK+2Tju 3XitMbalPYpQirQNVIJdX6DPjhdNVgTZqdDas= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:cc:in-reply-to:mime-version :content-type:content-transfer-encoding:content-disposition :references; b=IbfomTIGd9Vgm5XzREL9jY9IniZWDYoi1eUna4Qn/VUEegkF84e5/YEB/WjkAyR4Dw DEccoadBogC0Jteky9g9bJIZ0yI79JpP4TfjzWgFl3BKebgvu1jQeBY3Vsb4+PVn96hx eeVrOPrYppuiQcwU1Rysl4/uDtBHyAJKKmF7o= Original-Received: by 10.100.248.9 with SMTP id v9mr7757762anh.115.1224493407125; Mon, 20 Oct 2008 02:03:27 -0700 (PDT) Original-Received: by 10.100.13.13 with HTTP; Mon, 20 Oct 2008 02:03:27 -0700 (PDT) In-Reply-To: Content-Disposition: inline X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2) 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:104671 Archived-At: On Sun, Oct 19, 2008 at 22:04, Stefan Monnier wrote: > Nothing: I agree 100% with your change and just reminded that it would > additionally be good to try and use user-emacs-directory (i.e. move > those files into ~/.emacs.d). Sixteen months ago we had a longish thread about introducing a new function to help defaulting configuration files to .emacs.d (and changing the name of `user-emacs-directory'): http://lists.gnu.org/archive/html/emacs-devel/2007-06/msg00755.html I have an old patch with the following: --- lisp/subr.el 13 Jun 2007 00:03:28 -0000 1.555 +++ lisp/subr.el 25 Jun 2007 13:13:33 -0000 @@ -2042,5 +2042,5 @@ (put 'cl-assertion-failed 'error-message "Assertion failed") -(defconst user-emacs-directory +(defconst user-data-directory (if (eq system-type 'ms-dos) ;; MS-DOS cannot have initial dot. @@ -2049,5 +2049,21 @@ "Directory beneath which additional per-user Emacs-specific files are placed. Various programs in Emacs store information in this directory. -Note that this should end with a directory separator.") +Note that this should end with a directory separator. +See also `locate-user-data-path'.") + +(defun locate-user-data-path (new-name &optional old-name) + "Return an absolute per-user Emacs-specific path. +If OLD-NAME is non-nil and ~/OLD-NAME exists, return ~/OLD-NAME. +Else return NEW-NAME in `user-data-directory', creating the +directory if it does not exist." + (convert-standard-filename + (let* ((home (concat "~" (or init-file-user ""))) + (at-home (and old-name (expand-file-name old-name home)))) + (if (and at-home (file-readable-p at-home)) + at-home + (unless (or purify-flag ;; don't create dir while dumping + (file-accessible-directory-p (directory-file-name user-data-directory))) + (make-directory user-data-directory t)) ;; don't catch errors + (expand-file-name new-name user-data-directory))))) The idea was to help converting something like this: (defcustom savehist-file (cond ;; Backward compatibility with previous versions of savehist. ((file-exists-p "~/.emacs-history") "~/.emacs-history") ((and (not (featurep 'xemacs)) (file-directory-p user-emacs-directory)) (concat user-emacs-directory "history")) ((and (featurep 'xemacs) (file-directory-p "~/.xemacs/")) "~/.xemacs/history") ;; For users without `~/.emacs.d/' or `~/.xemacs/'. (t (convert-standard-filename "~/.emacs-history"))) ...) into (defcustom savehist-file (locate-user-data-path "history" ".emacs-history") ...) In the thread there was much discussion about names, and I haven't tried to maintain the patch up-to-date. I still think a function like this one would be helpful, though. Juanma