emacs-devel
[Top][All Lists]
Advanced

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

Re: Patch for user-emacs-directory


From: Tom Tromey
Subject: Re: Patch for user-emacs-directory
Date: Sun, 03 Jun 2007 09:37:39 -0600
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.990 (gnu/linux)

>>>>> "Eli" == Eli Zaretskii <address@hidden> writes:

Eli> IOW, I think leaving convert-standard-filename is good engineering,
Eli> not something for which I have specific failure scenarios.  In
Eli> general, we should run _all_ file names hard-wired into Emacs through
Eli> this function.

Here's an updated patch.

Tom

etc/ChangeLog
2007-06-02  Tom Tromey  <address@hidden>

        * NEWS: Mention user-emacs-directory.

lisp/ChangeLog
2007-06-02  Tom Tromey  <address@hidden>

        * subr.el (user-emacs-directory): New defconst.
        * cmuscheme.el (scheme-start-file): Use user-emacs-directory.
        * shell.el (shell): Use user-emacs-directory.
        * completion.el (save-completions-file-name): Use
        user-emacs-directory.
        * custom.el (custom-theme-directory): Use user-emacs-directory.
        * term/x-win.el (emacs-session-filename): Use
        user-emacs-directory.
        * filesets.el (filesets-menu-cache-file): Use
        user-emacs-directory.
        * thumbs.el (thumbs-thumbsdir): Use user-emacs-directory.
        * server.el (server-auth-dir): Use user-emacs-directory.
        * image-dired.el (image-dired-dir): Use user-emacs-directory.
        (image-dired-db-file): Likewise.
        (image-dired-temp-image-file): Likewise.
        (image-dired-gallery-dir): Likewise.
        (image-dired-temp-rotate-image-file): Likewise.
        * play/gamegrid.el (gamegrid-user-score-file-directory): Use
        user-emacs-directory.
        * savehist.el (savehist-file): Use user-emacs-directory.
        * tutorial.el (tutorial--saved-dir): Use user-emacs-directory.
        * startup.el (auto-save-list-file-prefix): Use
        user-emacs-directory.

lisp/url/ChangeLog
2007-06-02  Tom Tromey  <address@hidden>

        * url.el (url-configuration-directory): Use user-emacs-directory.

lispref/ChangeLog
2007-06-02  Tom Tromey  <address@hidden>

        * os.texi (Init File): Document user-emacs-directory.

Index: etc/NEWS
===================================================================
RCS file: /sources/emacs/emacs/etc/NEWS,v
retrieving revision 1.1481
diff -u -r1.1481 NEWS
--- etc/NEWS    31 May 2007 00:52:35 -0000      1.1481
+++ etc/NEWS    3 Jun 2007 15:57:06 -0000
@@ -48,6 +48,10 @@
 
 * Lisp Changes in Emacs 23.1
 
+*** New variable `user-emacs-directory'.
+
+Use this instead of "~/.emacs.d".
+
 
 * New Packages for Lisp Programming in Emacs 23.1
 
Index: lisp/cmuscheme.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/cmuscheme.el,v
retrieving revision 1.46
diff -u -r1.46 cmuscheme.el
--- lisp/cmuscheme.el   21 Jan 2007 03:53:12 -0000      1.46
+++ lisp/cmuscheme.el   3 Jun 2007 15:57:06 -0000
@@ -271,7 +271,7 @@
 order.  Return nil if no start file found."
   (let* ((progname (file-name-nondirectory prog))
         (start-file (concat "~/.emacs_" progname))
-        (alt-start-file (concat "~/.emacs.d/init_" progname ".scm")))
+        (alt-start-file (concat user-emacs-directory "init_" progname ".scm")))
     (if (file-exists-p start-file)
         start-file
       (and (file-exists-p alt-start-file) alt-start-file))))
Index: lisp/completion.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/completion.el,v
retrieving revision 1.60
diff -u -r1.60 completion.el
--- lisp/completion.el  21 Jan 2007 03:53:12 -0000      1.60
+++ lisp/completion.el  3 Jun 2007 15:57:07 -0000
@@ -301,9 +301,9 @@
   (let ((olddef (convert-standard-filename "~/.completions")))
     (cond
      ((file-readable-p olddef) olddef)
-     ((file-directory-p (convert-standard-filename "~/.emacs.d/"))
+     ((file-directory-p user-emacs-directory)
       (convert-standard-filename
-       (expand-file-name "completions" "~/.emacs.d/")))
+       (expand-file-name "completions" user-emacs-directory)))
      (t olddef)))
   "The filename to save completions to."
   :type 'file
Index: lisp/custom.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/custom.el,v
retrieving revision 1.133
diff -u -r1.133 custom.el
--- lisp/custom.el      25 Apr 2007 04:44:28 -0000      1.133
+++ lisp/custom.el      3 Jun 2007 15:57:07 -0000
@@ -1009,10 +1009,7 @@
 ;;; Loading themes.
 
 (defcustom custom-theme-directory
-  (if (eq system-type 'ms-dos)
-        ;; MS-DOS cannot have initial dot.
-        "~/_emacs.d/"
-      "~/.emacs.d/")
+  user-emacs-directory
   "Directory in which Custom theme files should be written.
 `load-theme' searches this directory in addition to load-path.
 The command `customize-create-theme' writes the files it produces
Index: lisp/filesets.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/filesets.el,v
retrieving revision 1.32
diff -u -r1.32 filesets.el
--- lisp/filesets.el    21 Jan 2007 03:53:11 -0000      1.32
+++ lisp/filesets.el    3 Jun 2007 15:57:07 -0000
@@ -354,7 +354,7 @@
 (defcustom filesets-menu-cache-file
   (if filesets-running-xemacs
       "~/.xemacs/filesets-cache.el"
-      "~/.emacs.d/filesets-cache.el")
+    (concat user-emacs-directory "filesets-cache.el"))
   "*File to be used for saving the filesets menu between sessions.
 Set this to \"\", to disable caching of menus.
 Don't forget to check out `filesets-menu-ensure-use-cached'."
Index: lisp/image-dired.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/image-dired.el,v
retrieving revision 1.3
diff -u -r1.3 image-dired.el
--- lisp/image-dired.el 28 Apr 2007 04:12:58 -0000      1.3
+++ lisp/image-dired.el 3 Jun 2007 15:57:07 -0000
@@ -166,7 +166,7 @@
   :prefix "image-dired-"
   :group 'multimedia)
 
-(defcustom image-dired-dir "~/.emacs.d/image-dired/"
+(defcustom image-dired-dir (concat user-emacs-directory "image-dired/")
   "Directory where thumbnail images are stored."
   :type 'string
   :group 'image-dired)
@@ -187,17 +187,20 @@
                  (const :tag "Per-directory" per-directory))
   :group 'image-dired)
 
-(defcustom image-dired-db-file "~/.emacs.d/image-dired/.image-dired_db"
+(defcustom image-dired-db-file
+  (concat user-emacs-directory "image-dired/.image-dired_db")
   "Database file where file names and their associated tags are stored."
   :type 'string
   :group 'image-dired)
 
-(defcustom image-dired-temp-image-file 
"~/.emacs.d/image-dired/.image-dired_temp"
+(defcustom image-dired-temp-image-file
+  (concat user-emacs-directory "image-dired/.image-dired_temp")
   "Name of temporary image file used by various commands."
   :type 'string
   :group 'image-dired)
 
-(defcustom image-dired-gallery-dir 
"~/.emacs.d/image-dired/.image-dired_gallery"
+(defcustom image-dired-gallery-dir
+  (concat user-emacs-directory "image-dired/.image-dired_gallery")
   "Directory to store generated gallery html pages.
 This path needs to be \"shared\" to the public so that it can access
 the index.html page that image-dired creates."
@@ -342,7 +345,7 @@
   :group 'image-dired)
 
 (defcustom image-dired-temp-rotate-image-file
-  "~/.emacs.d/image-dired/.image-dired_rotate_temp"
+  (concat user-emacs-directory "image-dired/.image-dired_rotate_temp")
   "Temporary file for rotate operations."
   :type 'string
   :group 'image-dired)
Index: lisp/savehist.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/savehist.el,v
retrieving revision 1.19
diff -u -r1.19 savehist.el
--- lisp/savehist.el    21 Jan 2007 03:53:11 -0000      1.19
+++ lisp/savehist.el    3 Jun 2007 15:57:07 -0000
@@ -101,8 +101,8 @@
   (cond
    ;; Backward compatibility with previous versions of savehist.
    ((file-exists-p "~/.emacs-history") "~/.emacs-history")
-   ((and (not (featurep 'xemacs)) (file-directory-p "~/.emacs.d/"))
-    "~/.emacs.d/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/'.
Index: lisp/server.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/server.el,v
retrieving revision 1.127
diff -u -r1.127 server.el
--- lisp/server.el      21 Mar 2007 12:02:32 -0000      1.127
+++ lisp/server.el      3 Jun 2007 15:57:07 -0000
@@ -105,7 +105,7 @@
   :version "22.1")
 (put 'server-host 'risky-local-variable t)
 
-(defcustom server-auth-dir "~/.emacs.d/server/"
+(defcustom server-auth-dir (concat user-emacs-directory "server/")
   "Directory for server authentication files."
   :group 'server
   :type 'directory
Index: lisp/shell.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/shell.el,v
retrieving revision 1.149
diff -u -r1.149 shell.el
--- lisp/shell.el       4 Mar 2007 17:47:19 -0000       1.149
+++ lisp/shell.el       3 Jun 2007 15:57:07 -0000
@@ -557,7 +557,7 @@
           (startfile (concat "~/.emacs_" name))
           (xargs-name (intern-soft (concat "explicit-" name "-args"))))
       (unless (file-exists-p startfile)
-       (setq startfile (concat "~/.emacs.d/init_" name ".sh")))
+       (setq startfile (concat user-emacs-directory "init_" name ".sh")))
       (apply 'make-comint-in-buffer "shell" buffer prog
             (if (file-exists-p startfile) startfile)
             (if (and xargs-name (boundp xargs-name))
Index: lisp/startup.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/startup.el,v
retrieving revision 1.437
diff -u -r1.437 startup.el
--- lisp/startup.el     11 May 2007 04:44:30 -0000      1.437
+++ lisp/startup.el     3 Jun 2007 15:57:08 -0000
@@ -263,9 +263,9 @@
 (defcustom auto-save-list-file-prefix
   (cond ((eq system-type 'ms-dos)
         ;; MS-DOS cannot have initial dot, and allows only 8.3 names
-        "~/_emacs.d/auto-save.list/_s")
+        (concat user-emacs-directory "auto-save.list/_s"))
        (t
-        "~/.emacs.d/auto-save-list/.saves-"))
+        (concat user-emacs-directory "auto-save-list/.saves-")))
   "Prefix for generating `auto-save-list-file-name'.
 This is used after reading your `.emacs' file to initialize
 `auto-save-list-file-name', by appending Emacs's pid and the system name,
Index: lisp/subr.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/subr.el,v
retrieving revision 1.554
diff -u -r1.554 subr.el
--- lisp/subr.el        22 Apr 2007 16:56:19 -0000      1.554
+++ lisp/subr.el        3 Jun 2007 15:57:08 -0000
@@ -2041,6 +2041,15 @@
 (put 'cl-assertion-failed 'error-conditions '(error))
 (put 'cl-assertion-failed 'error-message "Assertion failed")
 
+(defconst user-emacs-directory
+  (if (eq system-type 'ms-dos)
+      ;; MS-DOS cannot have initial dot.
+      "~/_emacs.d/"
+    "~/.emacs.d/")
+  "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.")
+
 
 ;;;; Misc. useful functions.
 
Index: lisp/thumbs.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/thumbs.el,v
retrieving revision 1.33
diff -u -r1.33 thumbs.el
--- lisp/thumbs.el      22 Apr 2007 13:44:43 -0000      1.33
+++ lisp/thumbs.el      3 Jun 2007 15:57:08 -0000
@@ -67,7 +67,7 @@
   :version "22.1"
   :group 'multimedia)
 
-(defcustom thumbs-thumbsdir "~/.emacs.d/thumbs"
+(defcustom thumbs-thumbsdir (concat user-emacs-directory "thumbs")
   "*Directory to store thumbnails."
   :type 'directory
   :group 'thumbs)
Index: lisp/tutorial.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/tutorial.el,v
retrieving revision 1.16
diff -u -r1.16 tutorial.el
--- lisp/tutorial.el    16 May 2007 13:19:02 -0000      1.16
+++ lisp/tutorial.el    3 Jun 2007 15:57:10 -0000
@@ -611,8 +611,7 @@
 
 (defun tutorial--saved-dir ()
   "Directory to which tutorials are saved."
-  (expand-file-name "tutorial"
-                   (if (eq system-type 'ms-dos) "~/_emacs.d/" "~/.emacs.d/")))
+  (expand-file-name "tutorial" user-emacs-directory))
 
 (defun tutorial--saved-file ()
   "File name in which to save tutorials."
Index: lisp/play/gamegrid.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/play/gamegrid.el,v
retrieving revision 1.27
diff -u -r1.27 gamegrid.el
--- lisp/play/gamegrid.el       3 Mar 2007 12:15:23 -0000       1.27
+++ lisp/play/gamegrid.el       3 Jun 2007 15:57:10 -0000
@@ -66,7 +66,8 @@
 (defvar gamegrid-score-file-length 50
   "Number of high scores to keep")
 
-(defvar gamegrid-user-score-file-directory "~/.emacs.d/games"
+(defvar gamegrid-user-score-file-directory
+  (concat user-emacs-directory "games")
   "A directory for game scores which can't be shared.
 If Emacs was built without support for shared game scores, then this
 directory will be used.")
Index: lisp/term/x-win.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/term/x-win.el,v
retrieving revision 1.200
diff -u -r1.200 x-win.el
--- lisp/term/x-win.el  6 Mar 2007 05:50:48 -0000       1.200
+++ lisp/term/x-win.el  3 Jun 2007 15:57:10 -0000
@@ -263,7 +263,7 @@
 If the directory ~/.emacs.d exists, we make a filename in there, otherwise
 a file in the home directory."
   (let ((basename (concat "session." session-id))
-       (emacs-dir "~/.emacs.d/"))
+       (emacs-dir user-emacs-directory))
     (expand-file-name (if (file-directory-p emacs-dir)
                          (concat emacs-dir basename)
                        (concat "~/.emacs-" basename)))))
Index: lisp/url/url.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/url/url.el,v
retrieving revision 1.27
diff -u -r1.27 url.el
--- lisp/url/url.el     21 Jan 2007 03:24:41 -0000      1.27
+++ lisp/url/url.el     3 Jun 2007 15:57:10 -0000
@@ -50,7 +50,8 @@
 (defvar url-configuration-directory
   (cond
    ((file-directory-p "~/.url") "~/.url")
-   ((file-directory-p "~/.emacs.d") "~/.emacs.d/url")
+   ((file-directory-p user-emacs-directory)
+    (concat user-emacs-directory "url"))
    (t "~/.url")))
 
 (defun url-do-setup ()
Index: lispref/os.texi
===================================================================
RCS file: /sources/emacs/emacs/lispref/os.texi,v
retrieving revision 1.106
diff -u -r1.106 os.texi
--- lispref/os.texi     7 Apr 2007 01:57:13 -0000       1.106
+++ lispref/os.texi     3 Jun 2007 15:57:12 -0000
@@ -258,6 +258,10 @@
 the value refers to the corresponding source file.
 @end defvar
 
address@hidden user-emacs-directory
+This variable holds the name of the @file{.emacs.d} directory.  It is
+ordinarily @file{~/.emacs.d}, but differs on some platforms.
+
 @node Terminal-Specific
 @subsection Terminal-Specific Initialization
 @cindex terminal-specific initialization




reply via email to

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