aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2012-11-08 14:45:58 -0500
committerStefan Monnier2012-11-08 14:45:58 -0500
commit85e5541248a4674f6e0749d3ea3def39a62f4537 (patch)
treecfe4defad4e37bfb0bfa34455cfcdfdf86f28ea6
parentbe883b34f2c2c15681c1aec28aae0811807c64d3 (diff)
downloademacs-85e5541248a4674f6e0749d3ea3def39a62f4537.tar.gz
emacs-85e5541248a4674f6e0749d3ea3def39a62f4537.zip
* lisp/subr.el (locate-user-emacs-file): If both old and new name exist, use
the new name.
-rw-r--r--lisp/ChangeLog3
-rw-r--r--lisp/subr.el13
2 files changed, 11 insertions, 5 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index fc699759d4d..edd3950e24f 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,8 @@
12012-11-08 Stefan Monnier <monnier@iro.umontreal.ca> 12012-11-08 Stefan Monnier <monnier@iro.umontreal.ca>
2 2
3 * subr.el (locate-user-emacs-file): If both old and new name exist, use
4 the new name.
5
3 * progmodes/js.el (js--filling-paragraph): New var. 6 * progmodes/js.el (js--filling-paragraph): New var.
4 (c-forward-sws, c-backward-sws, c-beginning-of-macro): Advise. 7 (c-forward-sws, c-backward-sws, c-beginning-of-macro): Advise.
5 (js-c-fill-paragraph): Prefer advice to cl-letf so the rebinding is 8 (js-c-fill-paragraph): Prefer advice to cl-letf so the rebinding is
diff --git a/lisp/subr.el b/lisp/subr.el
index d328b7cddf5..9c89bd3e045 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -2657,13 +2657,17 @@ See also `locate-user-emacs-file'.")
2657 2657
2658(defun locate-user-emacs-file (new-name &optional old-name) 2658(defun locate-user-emacs-file (new-name &optional old-name)
2659 "Return an absolute per-user Emacs-specific file name. 2659 "Return an absolute per-user Emacs-specific file name.
2660If OLD-NAME is non-nil and ~/OLD-NAME exists, return ~/OLD-NAME. 2660If NEW-NAME exists in `user-emacs-directory', return it.
2661Else If OLD-NAME is non-nil and ~/OLD-NAME exists, return ~/OLD-NAME.
2661Else return NEW-NAME in `user-emacs-directory', creating the 2662Else return NEW-NAME in `user-emacs-directory', creating the
2662directory if it does not exist." 2663directory if it does not exist."
2663 (convert-standard-filename 2664 (convert-standard-filename
2664 (let* ((home (concat "~" (or init-file-user ""))) 2665 (let* ((home (concat "~" (or init-file-user "")))
2665 (at-home (and old-name (expand-file-name old-name home)))) 2666 (at-home (and old-name (expand-file-name old-name home)))
2666 (if (and at-home (file-readable-p at-home)) 2667 (bestname (abbreviate-file-name
2668 (expand-file-name new-name user-emacs-directory))))
2669 (if (and at-home (not (file-readable-p bestname))
2670 (file-readable-p at-home))
2667 at-home 2671 at-home
2668 ;; Make sure `user-emacs-directory' exists, 2672 ;; Make sure `user-emacs-directory' exists,
2669 ;; unless we're in batch mode or dumping Emacs 2673 ;; unless we're in batch mode or dumping Emacs
@@ -2677,8 +2681,7 @@ directory if it does not exist."
2677 (set-default-file-modes ?\700) 2681 (set-default-file-modes ?\700)
2678 (make-directory user-emacs-directory)) 2682 (make-directory user-emacs-directory))
2679 (set-default-file-modes umask)))) 2683 (set-default-file-modes umask))))
2680 (abbreviate-file-name 2684 bestname))))
2681 (expand-file-name new-name user-emacs-directory))))))
2682 2685
2683;;;; Misc. useful functions. 2686;;;; Misc. useful functions.
2684 2687