emacs-devel
[Top][All Lists]
Advanced

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

Re: Don't concat directories to file names


From: Stephen J. Turnbull
Subject: Re: Don't concat directories to file names
Date: Fri, 15 Jun 2007 23:19:19 +0900

Juanma Barranquero writes:

 > Then the recently introduced `user-emacs-directory' should be renamed
 > to `user-init-directory', or aliased, I think (but it doesn't make
 > much sense to alias a just created var). The variable currently must
 > end with a directory separator, but that could be fixed.

I think requiring the directory separator on the variable is
reasonable; after all, in most cases it will be determined implicitly
at startup or by a function call.  The trick of doing

(defun user-init-directory ()
  "Return the per-user directory holding Emacs configuration files."
  (if (and (boundp 'user-init-directory) 
           (file-directory-p user-init-directory))
      user-init-directory
    (find-user-init-directory)))  ; this may be oversimplified

is always available, too.

 > (defun user-emacs-file (name &optional new-name)
 >   "Convert NAME to an absolute per-user Emacs-specific path.
 > If \"~/NAME\" exists, or `user-emacs-directory' is nil, return \"~/NAME\".
 > Else, return \"`user-emacs-directory'/NEW-NAME\", or /NAME if NEW-NAME is 
 > nil."

Looks reasonable to me.  FWIW, existing XEmacs practice is to
encourage use of `user-init-directory' by looking there first (for our
startup files; we don't have the API you are proposing yet, so other
libraries have to code by hand).  Also, if ~/.emacs is found,
~/.xemacs/ doesn't exist, and migration is not inhibited, XEmacs
offers to migrate its files (.emacs and optionally custom.el) from
$HOME to `user-init-directory'.  If you say no, you get the option of
trying again later, or telling XEmacs not to bug you any more.

 > People wanting to use the same setup files in X?Emacs will have to
 > make user-(emacs|init)-directory point to the right place, or perhaps
 > set it to nil (and then `user-emacs-file' defers to ~/ and does not
 > try to create any dir).

XEmacs has -user-init-file and -user-init-directory options to handle
this (as well as the -u option).

I'm at my limit here: I can imagine use cases for all this
flexibility, but I've never encountered them in the wild.  I think
that `user-emacs-directory' and `user-init-directory' have similar
enough semantics that it would be nice if the variable name could be
the same.  I'd like to claim priority for `user-init-directory': it's
over ten years old in XEmacs.

Other than that, it's not at all obvious to me that any of XEmacs's
APIs or UIs in this area are used often enough to worry about
incompatibility.  I'm not a big fan of the name "user-emacs-file" for
the function you've defined; for me, even after all this time using
the ~/.xemacs/init.el style, I think it should point to ".emacs".  How
does "user-configuration-file" or "find-user-configuration-file"
sound?  (Of course "configuration" could be shortened to "config".)






reply via email to

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