diff options
| author | Thien-Thi Nguyen | 2004-09-08 11:43:30 +0000 |
|---|---|---|
| committer | Thien-Thi Nguyen | 2004-09-08 11:43:30 +0000 |
| commit | b96879714912e2b9b762c02ab91b3ad08974cdd3 (patch) | |
| tree | bb5b1c6affd2d5bf50e60fe004874b6372708b1e | |
| parent | bc9447bc283af2fea14ad5b9ea904916070015ee (diff) | |
| download | emacs-b96879714912e2b9b762c02ab91b3ad08974cdd3.tar.gz emacs-b96879714912e2b9b762c02ab91b3ad08974cdd3.zip | |
(command-line-1): Make option
--directory/-L modify `load-path' straight away.
| -rw-r--r-- | lisp/startup.el | 37 |
1 files changed, 20 insertions, 17 deletions
diff --git a/lisp/startup.el b/lisp/startup.el index f376fe5e0e1..c32ba2ddfe7 100644 --- a/lisp/startup.el +++ b/lisp/startup.el | |||
| @@ -1479,12 +1479,19 @@ normal otherwise." | |||
| 1479 | (file-count 0) | 1479 | (file-count 0) |
| 1480 | first-file-buffer | 1480 | first-file-buffer |
| 1481 | tem | 1481 | tem |
| 1482 | ;; The directories listed in --directory/-L options will *appear* | 1482 | ;; This approach loses for "-batch -L DIR --eval "(require foo)", |
| 1483 | ;; at the front of `load-path' in the order they appear on the | 1483 | ;; if foo is intended to be found in DIR. |
| 1484 | ;; command-line. We cannot do this by *placing* them at the front | 1484 | ;; |
| 1485 | ;; in the order they appear, so we need this variable to hold them, | 1485 | ;; ;; The directories listed in --directory/-L options will *appear* |
| 1486 | ;; temporarily. | 1486 | ;; ;; at the front of `load-path' in the order they appear on the |
| 1487 | extra-load-path | 1487 | ;; ;; command-line. We cannot do this by *placing* them at the front |
| 1488 | ;; ;; in the order they appear, so we need this variable to hold them, | ||
| 1489 | ;; ;; temporarily. | ||
| 1490 | ;; extra-load-path | ||
| 1491 | ;; | ||
| 1492 | ;; To DTRT we keep track of the splice point and modify `load-path' | ||
| 1493 | ;; straight away upon any --directory/-L option. | ||
| 1494 | splice | ||
| 1488 | just-files ;; t if this follows the magic -- option. | 1495 | just-files ;; t if this follows the magic -- option. |
| 1489 | ;; This includes our standard options' long versions | 1496 | ;; This includes our standard options' long versions |
| 1490 | ;; and long versions of what's on command-switch-alist. | 1497 | ;; and long versions of what's on command-switch-alist. |
| @@ -1553,15 +1560,15 @@ normal otherwise." | |||
| 1553 | 1560 | ||
| 1554 | ((member argi '("-eval" "-execute")) | 1561 | ((member argi '("-eval" "-execute")) |
| 1555 | (eval (read (or argval (pop command-line-args-left))))) | 1562 | (eval (read (or argval (pop command-line-args-left))))) |
| 1556 | ;; Set the default directory as specified in -L. | ||
| 1557 | 1563 | ||
| 1558 | ((member argi '("-L" "-directory")) | 1564 | ((member argi '("-L" "-directory")) |
| 1559 | (setq tem (or argval (pop command-line-args-left))) | 1565 | (setq tem (expand-file-name |
| 1560 | ;; We will reverse `extra-load-path' and prepend it to | 1566 | (command-line-normalize-file-name |
| 1561 | ;; `load-path' after all the arguments have been processed. | 1567 | (or argval (pop command-line-args-left))))) |
| 1562 | (push | 1568 | (cond (splice (setcdr splice (cons tem (cdr splice))) |
| 1563 | (expand-file-name (command-line-normalize-file-name tem)) | 1569 | (setq splice (cdr splice))) |
| 1564 | extra-load-path)) | 1570 | (t (setq load-path (cons tem load-path) |
| 1571 | splice load-path)))) | ||
| 1565 | 1572 | ||
| 1566 | ((member argi '("-l" "-load")) | 1573 | ((member argi '("-l" "-load")) |
| 1567 | (let* ((file (command-line-normalize-file-name | 1574 | (let* ((file (command-line-normalize-file-name |
| @@ -1642,10 +1649,6 @@ normal otherwise." | |||
| 1642 | (move-to-column (1- column))) | 1649 | (move-to-column (1- column))) |
| 1643 | (setq column 0)))))))) | 1650 | (setq column 0)))))))) |
| 1644 | 1651 | ||
| 1645 | ;; See --directory/-L option above. | ||
| 1646 | (when extra-load-path | ||
| 1647 | (setq load-path (append (nreverse extra-load-path) load-path))) | ||
| 1648 | |||
| 1649 | ;; If 3 or more files visited, and not all visible, | 1652 | ;; If 3 or more files visited, and not all visible, |
| 1650 | ;; show user what they all are. But leave the last one current. | 1653 | ;; show user what they all are. But leave the last one current. |
| 1651 | (and (> file-count 2) | 1654 | (and (> file-count 2) |