* lisp/startup.el (command-line-1): Allow `-L :...' to append to load-path.
authorGlenn Morris <rgm@gnu.org>
Mon, 4 Nov 2013 01:36:14 +0000 (17:36 -0800)
committerGlenn Morris <rgm@gnu.org>
Mon, 4 Nov 2013 01:36:14 +0000 (17:36 -0800)
* doc/emacs/cmdargs.texi (Action Arguments): Mention that `-L :...' appends.

* etc/NEWS: Mention this.

doc/emacs/ChangeLog
doc/emacs/cmdargs.texi
etc/NEWS
lisp/ChangeLog
lisp/startup.el

index 79047e3..7f051e7 100644 (file)
@@ -1,3 +1,7 @@
+2013-11-04  Glenn Morris  <rgm@gnu.org>
+
+       * cmdargs.texi (Action Arguments): Mention that `-L :...' appends.
+
 2013-11-02  Glenn Morris  <rgm@gnu.org>
 
        * cmdargs.texi (Action Arguments): Clarify `-L' a bit.
index 1ef6529..d0f5f1e 100644 (file)
@@ -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
index 0ab4e34..1c171ba 100644 (file)
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -62,6 +62,10 @@ To use the old backend by default, do on the command line:
 \f
 * 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 `:'.
+
 \f
 * Changes in Emacs 24.4
 
index 4f1b214..522181b 100644 (file)
@@ -1,3 +1,7 @@
+2013-11-04  Glenn Morris  <rgm@gnu.org>
+
+       * startup.el (command-line-1): Allow `-L :...' to append to load-path.
+
 2013-11-03  Stefan Monnier  <monnier@iro.umontreal.ca>
 
        * progmodes/ruby-mode.el (ruby-smie--rule-parent-skip-assign): Remove.
index 391d65a..e93c3fa 100644 (file)
@@ -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