From: Glenn Morris Date: Mon, 4 Nov 2013 01:36:14 +0000 (-0800) Subject: * lisp/startup.el (command-line-1): Allow `-L :...' to append to load-path. X-Git-Tag: emacs-24.3.90~173^2^2~42^2~45^2~387^2~1003 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=a0833f62d5e41901b5ab12fb19a7728593b088ed;p=emacs.git * lisp/startup.el (command-line-1): Allow `-L :...' to append to load-path. * doc/emacs/cmdargs.texi (Action Arguments): Mention that `-L :...' appends. * etc/NEWS: Mention this. --- diff --git a/doc/emacs/ChangeLog b/doc/emacs/ChangeLog index 79047e3285b..7f051e751e5 100644 --- a/doc/emacs/ChangeLog +++ b/doc/emacs/ChangeLog @@ -1,3 +1,7 @@ +2013-11-04 Glenn Morris + + * cmdargs.texi (Action Arguments): Mention that `-L :...' appends. + 2013-11-02 Glenn Morris * cmdargs.texi (Action Arguments): Clarify `-L' a bit. diff --git a/doc/emacs/cmdargs.texi b/doc/emacs/cmdargs.texi index 1ef6529f295..d0f5f1e06b1 100644 --- a/doc/emacs/cmdargs.texi +++ b/doc/emacs/cmdargs.texi @@ -139,6 +139,8 @@ Prepend directory @var{dir} to the variable @code{load-path}. If you specify multiple @samp{-L} options, Emacs preserves the relative order; i.e., using @samp{-L /foo -L /bar} results in a @code{load-path} of the form @code{("/foo" "/bar" @dots{})}. +If @var{dir} begins with @samp{:}, Emacs removes the @samp{:} and +appends (rather than prepends) the remainder to @code{load-path}. @item -f @var{function} @opindex -f diff --git a/etc/NEWS b/etc/NEWS index 0ab4e34a265..1c171ba6f51 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -62,6 +62,10 @@ To use the old backend by default, do on the command line: * Startup Changes in Emacs 24.4 ++++ +** The -L option, which normally prepends its argument to load-path, +will instead append, if the argument begins with `:'. + * Changes in Emacs 24.4 diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 4f1b2142a69..522181b3e4f 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,7 @@ +2013-11-04 Glenn Morris + + * startup.el (command-line-1): Allow `-L :...' to append to load-path. + 2013-11-03 Stefan Monnier * progmodes/ruby-mode.el (ruby-smie--rule-parent-skip-assign): Remove. diff --git a/lisp/startup.el b/lisp/startup.el index 391d65a3520..e93c3fa5826 100644 --- a/lisp/startup.el +++ b/lisp/startup.el @@ -2171,13 +2171,22 @@ A fancy display is used on graphic displays, normal otherwise." (eval (read (or argval (pop command-line-args-left))))) ((member argi '("-L" "-directory")) - (setq tem (expand-file-name - (command-line-normalize-file-name - (or argval (pop command-line-args-left))))) - (cond (splice (setcdr splice (cons tem (cdr splice))) - (setq splice (cdr splice))) - (t (setq load-path (cons tem load-path) - splice load-path)))) + ;; -L :/foo adds /foo to the _end_ of load-path. + (let (append) + (if (string-match-p + "\\`:" + (setq tem (or argval (pop command-line-args-left)))) + (setq tem (substring tem 1) + append t)) + (setq tem (expand-file-name + (command-line-normalize-file-name tem))) + (cond (append (setq load-path + (append load-path (list tem))) + (if splice (setq splice load-path))) + (splice (setcdr splice (cons tem (cdr splice))) + (setq splice (cdr splice))) + (t (setq load-path (cons tem load-path) + splice load-path))))) ((member argi '("-l" "-load")) (let* ((file (command-line-normalize-file-name