emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] Changes to emacs/lisp/subr.el,v


From: Juanma Barranquero
Subject: [Emacs-diffs] Changes to emacs/lisp/subr.el,v
Date: Fri, 24 Oct 2008 09:39:36 +0000

CVSROOT:        /sources/emacs
Module name:    emacs
Changes by:     Juanma Barranquero <lektu>      08/10/24 09:39:33

Index: lisp/subr.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/subr.el,v
retrieving revision 1.614
retrieving revision 1.615
diff -u -b -r1.614 -r1.615
--- lisp/subr.el        20 Oct 2008 23:12:43 -0000      1.614
+++ lisp/subr.el        24 Oct 2008 09:39:32 -0000      1.615
@@ -2156,7 +2156,24 @@
     "~/.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.")
+Note that this should end with a directory separator.
+See also `locate-user-emacs-file'.")
+
+(defun locate-user-emacs-file (new-name &optional old-name)
+  "Return an absolute per-user Emacs-specific file name.
+If OLD-NAME is non-nil and ~/OLD-NAME exists, return ~/OLD-NAME.
+Else return NEW-NAME in `user-emacs-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-emacs-directory)))
+        (make-directory user-emacs-directory t)) ;; don't catch errors
+       (expand-file-name new-name user-emacs-directory)))))
 
 
 ;;;; Misc. useful functions.




reply via email to

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