all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Patch for user-emacs-directory
@ 2007-05-27 21:24 Tom Tromey
  2007-05-27 22:47 ` Leo
                   ` (2 more replies)
  0 siblings, 3 replies; 15+ messages in thread
From: Tom Tromey @ 2007-05-27 21:24 UTC (permalink / raw)
  To: Emacs Hackers

This patch changes Emacs to use user-emacs-directory rather than
"~/.emacs.d".  I spot-tested various instances of the change but did
not try to test every single one.  The patch is essentially
mechanical.

A few notes:

* I didn't try to update the docs.
* I chose subr.el for the new definition because it had to be early
  enough in the bootstrap for custom.el and other files to reference.
* I used a defconst and not a defcustom because the use of .emacs.d
  in some places would seem to make it difficult to meaningfully
  configure this.
* I didn't use convert-standard-filename because that is not available
  when subr.el is loaded.
* The ERC change needs to be redone if ERC needs to continue working
  on Emacs 21 and 22.  Perhaps this needs to be done upstream?  I'm
  happy to handle that, just let me know.

Tom

etc/ChangeLog
2007-05-27  Tom Tromey  <tromey@redhat.com>

	* NEWS: Mention user-emacs-directory.

lisp/ChangeLog
2007-05-27  Tom Tromey  <tromey@redhat.com>

	* 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/erc/ChangeLog
2007-05-27  Tom Tromey  <tromey@redhat.com>

	* erc.el (erc-startup-file-list): Use user-emacs-directory.

Index: lisp/url/ChangeLog
2007-05-27  Tom Tromey  <tromey@redhat.com>

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


Index: etc/NEWS
===================================================================
RCS file: /sources/emacs/emacs/etc/NEWS,v
retrieving revision 1.1480
diff -u -r1.1480 NEWS
--- etc/NEWS 25 May 2007 16:58:18 -0000 1.1480
+++ etc/NEWS 27 May 2007 21:38:45 -0000
@@ -47,6 +47,10 @@
 \f
 * Lisp Changes in Emacs 23.1
 
+*** New variable `user-emacs-directory'.
+
+Use this instead of "~/.emacs.d".
+
 \f
 * 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 27 May 2007 21:38:46 -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 27 May 2007 21:38:47 -0000
@@ -301,9 +301,8 @@
   (let ((olddef (convert-standard-filename "~/.completions")))
     (cond
      ((file-readable-p olddef) olddef)
-     ((file-directory-p (convert-standard-filename "~/.emacs.d/"))
-      (convert-standard-filename
-       (expand-file-name "completions" "~/.emacs.d/")))
+     ((file-directory-p user-emacs-directory)
+      (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 27 May 2007 21:38:47 -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 27 May 2007 21:38:48 -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 27 May 2007 21:38:50 -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 27 May 2007 21:38:50 -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 27 May 2007 21:38:50 -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 27 May 2007 21:38:50 -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 27 May 2007 21:38:51 -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 27 May 2007 21:38:52 -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.")
+
 \f
 ;;;; 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 27 May 2007 21:38:52 -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 27 May 2007 21:38:53 -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/erc/erc.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/erc/erc.el,v
retrieving revision 1.26
diff -u -r1.26 erc.el
--- lisp/erc/erc.el 1 Apr 2007 13:36:38 -0000 1.26
+++ lisp/erc/erc.el 27 May 2007 21:38:55 -0000
@@ -836,8 +836,9 @@
 ;; Script parameters
 
 (defcustom erc-startup-file-list
-  '("~/.emacs.d/.ercrc.el" "~/.emacs.d/.ercrc"
-    "~/.ercrc.el" "~/.ercrc" ".ercrc.el" ".ercrc")
+  (list (concat user-emacs-directory ".ercrc.el")
+	(concat user-emacs-directory ".ercrc")
+	"~/.ercrc.el" "~/.ercrc" ".ercrc.el" ".ercrc")
   "List of files to try for a startup script.
 The first existent and readable one will get executed.
 
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 27 May 2007 21:38:55 -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 27 May 2007 21:38:56 -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 27 May 2007 21:38:57 -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 ()

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2007-06-13  0:13 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-05-27 21:24 Patch for user-emacs-directory Tom Tromey
2007-05-27 22:47 ` Leo
2007-05-28 14:37 ` Richard Stallman
2007-06-02 21:53   ` Tom Tromey
2007-06-03  3:09     ` Eli Zaretskii
2007-06-03  3:26       ` Tom Tromey
2007-06-03  5:08         ` Eli Zaretskii
2007-06-03 15:37           ` Tom Tromey
2007-06-03 16:47             ` Eli Zaretskii
2007-06-13  0:13             ` Chong Yidong
2007-06-13  0:02               ` Tom Tromey
2007-06-03 21:27     ` Richard Stallman
2007-06-03 22:20       ` Tom Tromey
2007-06-04  5:01         ` Richard Stallman
2007-05-30  1:32 ` Michael Olson

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.