Prefer locate-user-emacs-file

* lisp/cmuscheme.el (scheme-start-file):
* lisp/erc/erc.el (erc-startup-file-list):
* lisp/net/nsm.el (nsm-settings-file):
* lisp/net/tramp-crypt.el (tramp-crypt-config-file-name):
* lisp/org/org-clock.el (org-clock-persist-file):
* lisp/org/org-id.el (org-id-locations-file)
* lisp/shell.el (shell): Prefer 'locate-user-emacs-file' to fiddling
with 'user-emacs-directory' directly.
This commit is contained in:
Stefan Kangas 2021-11-09 07:51:18 +01:00
parent c9fd83e303
commit 104e90d936
7 changed files with 11 additions and 13 deletions

View file

@ -245,7 +245,8 @@ Search in the directories \"~\" and `user-emacs-directory',
in this order. Return nil if no start file found."
(let* ((progname (file-name-nondirectory prog))
(start-file (concat "~/.emacs_" progname))
(alt-start-file (concat user-emacs-directory "init_" progname ".scm")))
(alt-start-file (locate-user-emacs-file
(concat "init_" progname ".scm"))))
(if (file-exists-p start-file)
start-file
(and (file-exists-p alt-start-file) alt-start-file))))

View file

@ -872,8 +872,8 @@ See `erc-server-flood-margin' for other flood-related parameters.")
;; Script parameters
(defcustom erc-startup-file-list
(list (concat user-emacs-directory ".ercrc.el")
(concat user-emacs-directory ".ercrc")
(list (locate-user-emacs-file ".ercrc.el")
(locate-user-emacs-file ".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.

View file

@ -79,8 +79,7 @@ option."
(const :tag "Off" nil)
(function :tag "Custom function")))
(defcustom nsm-settings-file (expand-file-name "network-security.data"
user-emacs-directory)
(defcustom nsm-settings-file (locate-user-emacs-file "network-security.data")
"The file the security manager settings will be stored in."
:version "25.1"
:type 'file)

View file

@ -293,9 +293,8 @@ arguments to pass to the OPERATION."
(defun tramp-crypt-config-file-name (vec)
"Return the encfs config file name for VEC."
(expand-file-name
(concat "tramp-" (tramp-file-name-host vec) tramp-crypt-encfs-config)
user-emacs-directory))
(locate-user-emacs-file
(concat "tramp-" (tramp-file-name-host vec) tramp-crypt-encfs-config)))
(defun tramp-crypt-maybe-open-connection (vec)
"Maybe open a connection VEC.

View file

@ -219,8 +219,7 @@ Emacs initialization file."
(const :tag "Clock and history" t)
(const :tag "No persistence" nil)))
(defcustom org-clock-persist-file (convert-standard-filename
(concat user-emacs-directory "org-clock-save.el"))
(defcustom org-clock-persist-file (locate-user-emacs-file "org-clock-save.el")
"File to save clock data to."
:group 'org-clock
:type 'string)

View file

@ -196,8 +196,7 @@ the link."
:group 'org-id
:type 'boolean)
(defcustom org-id-locations-file (convert-standard-filename
(concat user-emacs-directory ".org-id-locations"))
(defcustom org-id-locations-file (locate-user-emacs-file ".org-id-locations")
"The file for remembering in which file an ID was defined.
This variable is only relevant when `org-id-track-globally' is set."
:group 'org-id

View file

@ -785,7 +785,8 @@ Make the shell buffer the current buffer, and return it.
(startfile (concat "~/.emacs_" name))
(xargs-name (intern-soft (concat "explicit-" name "-args"))))
(unless (file-exists-p startfile)
(setq startfile (concat user-emacs-directory "init_" name ".sh")))
(setq startfile (locate-user-emacs-file
(concat "init_" name ".sh"))))
(setq-local shell--start-prog (file-name-nondirectory prog))
(apply #'make-comint-in-buffer "shell" buffer prog
(if (file-exists-p startfile) startfile)