emacs-devel
[Top][All Lists]
Advanced

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

Re: [Emacs-diffs] master 4d3a595: `load-path' should contain only direct


From: Stephen J. Turnbull
Subject: Re: [Emacs-diffs] master 4d3a595: `load-path' should contain only directory names
Date: Mon, 26 Oct 2015 18:56:13 +0900

Eli Zaretskii writes:

 > IMO, it just looks sloppy on our part if we are inconsistent in
 > setting the value of that list.  The solution was easy, so I think it
 > was a good cleanup.

+1.

XEmacs is pretty careful about using directory names (ie, with
trailing slash) in variables named like "foo-path".  I do think it
looks better to be consistent.

Perhaps it would be useful to have

(defun prepend-to-directory-path (path-variable &rest directories)
  ;; don't use add-to-list because it won't reorder the path for
  ;; directories already present
  (set path-variable (nconc (nreverse (mapcar (lambda (dir)
                                               (file-name-as-directory
                                                (expand-file-name dir)))))
                            (symbol-value path-variable))))

Of course the `file-name-as-directory' could be replaced by
`directory-file-name' if preferred (yes, it's needed for consistency,
in XEmacs at least: `expand-file-name' doesn't strip trailing slashes).

I hereby relinquish all claim to the above defun.  Ie, it's now in the
public domain AFAIK.  Even if it does qualify as a small change. :-)





reply via email to

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