diff options
| author | Bill Wohler | 2012-11-24 19:43:02 -0800 |
|---|---|---|
| committer | Bill Wohler | 2012-11-24 19:43:02 -0800 |
| commit | 5244bc019bf7376caff3bb198ff674e0ad9fb0e6 (patch) | |
| tree | 02ee1615e904771f692ec2957c79a08ae029a13d /lisp/eshell | |
| parent | 9f7e719509474e92f85955e22e57ffeebd4e96f3 (diff) | |
| parent | c07a6ded1df2f4156badc9add2953579622c3722 (diff) | |
| download | emacs-5244bc019bf7376caff3bb198ff674e0ad9fb0e6.tar.gz emacs-5244bc019bf7376caff3bb198ff674e0ad9fb0e6.zip | |
Merge from trunk.
Diffstat (limited to 'lisp/eshell')
| -rw-r--r-- | lisp/eshell/em-alias.el | 15 | ||||
| -rw-r--r-- | lisp/eshell/em-banner.el | 15 | ||||
| -rw-r--r-- | lisp/eshell/em-basic.el | 7 | ||||
| -rw-r--r-- | lisp/eshell/em-cmpl.el | 31 | ||||
| -rw-r--r-- | lisp/eshell/em-dirs.el | 7 | ||||
| -rw-r--r-- | lisp/eshell/em-glob.el | 7 | ||||
| -rw-r--r-- | lisp/eshell/em-hist.el | 16 | ||||
| -rw-r--r-- | lisp/eshell/em-ls.el | 16 | ||||
| -rw-r--r-- | lisp/eshell/em-pred.el | 7 | ||||
| -rw-r--r-- | lisp/eshell/em-prompt.el | 13 | ||||
| -rw-r--r-- | lisp/eshell/em-rebind.el | 7 | ||||
| -rw-r--r-- | lisp/eshell/em-script.el | 8 | ||||
| -rw-r--r-- | lisp/eshell/em-smart.el | 7 | ||||
| -rw-r--r-- | lisp/eshell/em-term.el | 12 | ||||
| -rw-r--r-- | lisp/eshell/em-unix.el | 74 | ||||
| -rw-r--r-- | lisp/eshell/em-xtra.el | 9 | ||||
| -rw-r--r-- | lisp/eshell/esh-arg.el | 14 | ||||
| -rw-r--r-- | lisp/eshell/esh-cmd.el | 63 | ||||
| -rw-r--r-- | lisp/eshell/esh-ext.el | 48 | ||||
| -rw-r--r-- | lisp/eshell/esh-io.el | 6 | ||||
| -rw-r--r-- | lisp/eshell/esh-mode.el | 23 | ||||
| -rw-r--r-- | lisp/eshell/esh-module.el | 6 | ||||
| -rw-r--r-- | lisp/eshell/esh-opt.el | 17 | ||||
| -rw-r--r-- | lisp/eshell/esh-proc.el | 2 | ||||
| -rw-r--r-- | lisp/eshell/esh-util.el | 10 | ||||
| -rw-r--r-- | lisp/eshell/esh-var.el | 4 | ||||
| -rw-r--r-- | lisp/eshell/eshell.el | 50 |
27 files changed, 266 insertions, 228 deletions
diff --git a/lisp/eshell/em-alias.el b/lisp/eshell/em-alias.el index 04ba19d407d..940056b6438 100644 --- a/lisp/eshell/em-alias.el +++ b/lisp/eshell/em-alias.el | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | ;;; em-alias.el --- creation and management of command aliases | 1 | ;;; em-alias.el --- creation and management of command aliases |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 1999-2011 Free Software Foundation, Inc. | 3 | ;; Copyright (C) 1999-2012 Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | ;; Author: John Wiegley <johnw@gnu.org> | 5 | ;; Author: John Wiegley <johnw@gnu.org> |
| 6 | 6 | ||
| @@ -95,11 +95,12 @@ | |||
| 95 | (require 'eshell) | 95 | (require 'eshell) |
| 96 | 96 | ||
| 97 | ;;;###autoload | 97 | ;;;###autoload |
| 98 | (eshell-defgroup eshell-alias nil | 98 | (progn |
| 99 | (defgroup eshell-alias nil | ||
| 99 | "Command aliases allow for easy definition of alternate commands." | 100 | "Command aliases allow for easy definition of alternate commands." |
| 100 | :tag "Command aliases" | 101 | :tag "Command aliases" |
| 101 | ;; :link '(info-link "(eshell)Command aliases") | 102 | ;; :link '(info-link "(eshell)Command aliases") |
| 102 | :group 'eshell-module) | 103 | :group 'eshell-module)) |
| 103 | 104 | ||
| 104 | (defcustom eshell-aliases-file (expand-file-name "alias" eshell-directory-name) | 105 | (defcustom eshell-aliases-file (expand-file-name "alias" eshell-directory-name) |
| 105 | "The file in which aliases are kept. | 106 | "The file in which aliases are kept. |
| @@ -132,10 +133,10 @@ Each element of this alias is a list of the form: | |||
| 132 | Where NAME is the textual name of the alias, and DEFINITION is the | 133 | Where NAME is the textual name of the alias, and DEFINITION is the |
| 133 | command string to replace that command with. | 134 | command string to replace that command with. |
| 134 | 135 | ||
| 135 | Note: this list should not be modified in your '.emacs' file. Rather, | 136 | Note: this list should not be modified in your init file. |
| 136 | any desired alias definitions should be declared using the `alias' | 137 | Rather, any desired alias definitions should be declared using |
| 137 | command, which will automatically write them to the file named by | 138 | the `alias' command, which will automatically write them to the |
| 138 | `eshell-aliases-file'.") | 139 | file named by `eshell-aliases-file'.") |
| 139 | 140 | ||
| 140 | (put 'eshell-command-aliases-list 'risky-local-variable t) | 141 | (put 'eshell-command-aliases-list 'risky-local-variable t) |
| 141 | 142 | ||
diff --git a/lisp/eshell/em-banner.el b/lisp/eshell/em-banner.el index ce987f132e3..8fdad66f3f0 100644 --- a/lisp/eshell/em-banner.el +++ b/lisp/eshell/em-banner.el | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | ;;; em-banner.el --- sample module that displays a login banner | 1 | ;;; em-banner.el --- sample module that displays a login banner |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 1999-2011 Free Software Foundation, Inc. | 3 | ;; Copyright (C) 1999-2012 Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | ;; Author: John Wiegley <johnw@gnu.org> | 5 | ;; Author: John Wiegley <johnw@gnu.org> |
| 6 | 6 | ||
| @@ -39,20 +39,21 @@ | |||
| 39 | ;;; Code: | 39 | ;;; Code: |
| 40 | 40 | ||
| 41 | (eval-when-compile | 41 | (eval-when-compile |
| 42 | (require 'cl) | 42 | (require 'cl-lib) |
| 43 | (require 'esh-mode) | 43 | (require 'esh-mode) |
| 44 | (require 'eshell)) | 44 | (require 'eshell)) |
| 45 | 45 | ||
| 46 | (require 'esh-util) | 46 | (require 'esh-util) |
| 47 | 47 | ||
| 48 | ;;;###autoload | 48 | ;;;###autoload |
| 49 | (eshell-defgroup eshell-banner nil | 49 | (progn |
| 50 | (defgroup eshell-banner nil | ||
| 50 | "This sample module displays a welcome banner at login. | 51 | "This sample module displays a welcome banner at login. |
| 51 | It exists so that others wishing to create their own Eshell extension | 52 | It exists so that others wishing to create their own Eshell extension |
| 52 | modules may have a simple template to begin with." | 53 | modules may have a simple template to begin with." |
| 53 | :tag "Login banner" | 54 | :tag "Login banner" |
| 54 | ;; :link '(info-link "(eshell)Login banner") | 55 | ;; :link '(info-link "(eshell)Login banner") |
| 55 | :group 'eshell-module) | 56 | :group 'eshell-module)) |
| 56 | 57 | ||
| 57 | ;;; User Variables: | 58 | ;;; User Variables: |
| 58 | 59 | ||
| @@ -76,10 +77,10 @@ This can be any sexp, and should end with at least two newlines." | |||
| 76 | ;; `insert', because `insert' doesn't know how to interact with the | 77 | ;; `insert', because `insert' doesn't know how to interact with the |
| 77 | ;; I/O code used by Eshell | 78 | ;; I/O code used by Eshell |
| 78 | (unless eshell-non-interactive-p | 79 | (unless eshell-non-interactive-p |
| 79 | (assert eshell-mode) | 80 | (cl-assert eshell-mode) |
| 80 | (assert eshell-banner-message) | 81 | (cl-assert eshell-banner-message) |
| 81 | (let ((msg (eval eshell-banner-message))) | 82 | (let ((msg (eval eshell-banner-message))) |
| 82 | (assert msg) | 83 | (cl-assert msg) |
| 83 | (eshell-interactive-print msg)))) | 84 | (eshell-interactive-print msg)))) |
| 84 | 85 | ||
| 85 | (provide 'em-banner) | 86 | (provide 'em-banner) |
diff --git a/lisp/eshell/em-basic.el b/lisp/eshell/em-basic.el index df1987e13ee..e07bc75f89a 100644 --- a/lisp/eshell/em-basic.el +++ b/lisp/eshell/em-basic.el | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | ;;; em-basic.el --- basic shell builtin commands | 1 | ;;; em-basic.el --- basic shell builtin commands |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 1999-2011 Free Software Foundation, Inc. | 3 | ;; Copyright (C) 1999-2012 Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | ;; Author: John Wiegley <johnw@gnu.org> | 5 | ;; Author: John Wiegley <johnw@gnu.org> |
| 6 | 6 | ||
| @@ -66,14 +66,15 @@ | |||
| 66 | (require 'esh-opt) | 66 | (require 'esh-opt) |
| 67 | 67 | ||
| 68 | ;;;###autoload | 68 | ;;;###autoload |
| 69 | (eshell-defgroup eshell-basic nil | 69 | (progn |
| 70 | (defgroup eshell-basic nil | ||
| 70 | "The \"basic\" code provides a set of convenience functions which | 71 | "The \"basic\" code provides a set of convenience functions which |
| 71 | are traditionally considered shell builtins. Since all of the | 72 | are traditionally considered shell builtins. Since all of the |
| 72 | functionality provided by them is accessible through Lisp, they are | 73 | functionality provided by them is accessible through Lisp, they are |
| 73 | not really builtins at all, but offer a command-oriented way to do the | 74 | not really builtins at all, but offer a command-oriented way to do the |
| 74 | same thing." | 75 | same thing." |
| 75 | :tag "Basic shell commands" | 76 | :tag "Basic shell commands" |
| 76 | :group 'eshell-module) | 77 | :group 'eshell-module)) |
| 77 | 78 | ||
| 78 | (defcustom eshell-plain-echo-behavior nil | 79 | (defcustom eshell-plain-echo-behavior nil |
| 79 | "If non-nil, `echo' tries to behave like an ordinary shell echo. | 80 | "If non-nil, `echo' tries to behave like an ordinary shell echo. |
diff --git a/lisp/eshell/em-cmpl.el b/lisp/eshell/em-cmpl.el index c551684210c..b4c86e39e86 100644 --- a/lisp/eshell/em-cmpl.el +++ b/lisp/eshell/em-cmpl.el | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | ;;; em-cmpl.el --- completion using the TAB key | 1 | ;;; em-cmpl.el --- completion using the TAB key |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 1999-2011 Free Software Foundation, Inc. | 3 | ;; Copyright (C) 1999-2012 Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | ;; Author: John Wiegley <johnw@gnu.org> | 5 | ;; Author: John Wiegley <johnw@gnu.org> |
| 6 | 6 | ||
| @@ -70,17 +70,18 @@ | |||
| 70 | ;;; Code: | 70 | ;;; Code: |
| 71 | 71 | ||
| 72 | (eval-when-compile | 72 | (eval-when-compile |
| 73 | (require 'cl) | 73 | (require 'cl-lib) |
| 74 | (require 'eshell)) | 74 | (require 'eshell)) |
| 75 | (require 'esh-util) | 75 | (require 'esh-util) |
| 76 | 76 | ||
| 77 | ;;;###autoload | 77 | ;;;###autoload |
| 78 | (eshell-defgroup eshell-cmpl nil | 78 | (progn |
| 79 | (defgroup eshell-cmpl nil | ||
| 79 | "This module provides a programmable completion function bound to | 80 | "This module provides a programmable completion function bound to |
| 80 | the TAB key, which allows for completing command names, file names, | 81 | the TAB key, which allows for completing command names, file names, |
| 81 | variable names, arguments, etc." | 82 | variable names, arguments, etc." |
| 82 | :tag "Argument completion" | 83 | :tag "Argument completion" |
| 83 | :group 'eshell-module) | 84 | :group 'eshell-module)) |
| 84 | 85 | ||
| 85 | ;;; User Variables: | 86 | ;;; User Variables: |
| 86 | 87 | ||
| @@ -294,13 +295,14 @@ to writing a completion function." | |||
| 294 | 'pcomplete-expand-and-complete) | 295 | 'pcomplete-expand-and-complete) |
| 295 | (define-key eshell-command-map [space] 'pcomplete-expand) | 296 | (define-key eshell-command-map [space] 'pcomplete-expand) |
| 296 | (define-key eshell-command-map [? ] 'pcomplete-expand) | 297 | (define-key eshell-command-map [? ] 'pcomplete-expand) |
| 297 | (define-key eshell-mode-map [tab] 'pcomplete) | 298 | (define-key eshell-mode-map [tab] 'eshell-pcomplete) |
| 298 | (define-key eshell-mode-map [(control ?i)] 'pcomplete) | 299 | (define-key eshell-mode-map [(control ?i)] 'eshell-pcomplete) |
| 300 | (add-hook 'completion-at-point-functions | ||
| 301 | #'pcomplete-completions-at-point nil t) | ||
| 299 | ;; jww (1999-10-19): Will this work on anything but X? | 302 | ;; jww (1999-10-19): Will this work on anything but X? |
| 300 | (if (featurep 'xemacs) | 303 | (if (featurep 'xemacs) |
| 301 | (define-key eshell-mode-map [iso-left-tab] 'pcomplete-reverse) | 304 | (define-key eshell-mode-map [iso-left-tab] 'pcomplete-reverse) |
| 302 | (define-key eshell-mode-map [(shift iso-lefttab)] 'pcomplete-reverse) | 305 | (define-key eshell-mode-map [backtab] 'pcomplete-reverse)) |
| 303 | (define-key eshell-mode-map [(shift control ?i)] 'pcomplete-reverse)) | ||
| 304 | (define-key eshell-mode-map [(meta ??)] 'pcomplete-list)) | 306 | (define-key eshell-mode-map [(meta ??)] 'pcomplete-list)) |
| 305 | 307 | ||
| 306 | (defun eshell-completion-command-name () | 308 | (defun eshell-completion-command-name () |
| @@ -358,7 +360,7 @@ to writing a completion function." | |||
| 358 | (nconc posns (list pos))) | 360 | (nconc posns (list pos))) |
| 359 | (setq pos (1+ pos)))) | 361 | (setq pos (1+ pos)))) |
| 360 | (setq posns (cdr posns)) | 362 | (setq posns (cdr posns)) |
| 361 | (assert (= (length args) (length posns))) | 363 | (cl-assert (= (length args) (length posns))) |
| 362 | (let ((a args) | 364 | (let ((a args) |
| 363 | (i 0) | 365 | (i 0) |
| 364 | l final) | 366 | l final) |
| @@ -370,7 +372,7 @@ to writing a completion function." | |||
| 370 | (and l | 372 | (and l |
| 371 | (setq args (nthcdr (1+ l) args) | 373 | (setq args (nthcdr (1+ l) args) |
| 372 | posns (nthcdr (1+ l) posns)))) | 374 | posns (nthcdr (1+ l) posns)))) |
| 373 | (assert (= (length args) (length posns))) | 375 | (cl-assert (= (length args) (length posns))) |
| 374 | (when (and args (eq (char-syntax (char-before end)) ? ) | 376 | (when (and args (eq (char-syntax (char-before end)) ? ) |
| 375 | (not (eq (char-before (1- end)) ?\\))) | 377 | (not (eq (char-before (1- end)) ?\\))) |
| 376 | (nconc args (list "")) | 378 | (nconc args (list "")) |
| @@ -383,7 +385,7 @@ to writing a completion function." | |||
| 383 | (let ((result | 385 | (let ((result |
| 384 | (eshell-do-eval | 386 | (eshell-do-eval |
| 385 | (list 'eshell-commands arg) t))) | 387 | (list 'eshell-commands arg) t))) |
| 386 | (assert (eq (car result) 'quote)) | 388 | (cl-assert (eq (car result) 'quote)) |
| 387 | (cadr result)) | 389 | (cadr result)) |
| 388 | arg))) | 390 | arg))) |
| 389 | (if (numberp val) | 391 | (if (numberp val) |
| @@ -449,6 +451,13 @@ to writing a completion function." | |||
| 449 | (all-completions filename obarray 'functionp)) | 451 | (all-completions filename obarray 'functionp)) |
| 450 | completions))))))) | 452 | completions))))))) |
| 451 | 453 | ||
| 454 | (defun eshell-pcomplete () | ||
| 455 | "Eshell wrapper for `pcomplete'." | ||
| 456 | (interactive) | ||
| 457 | (condition-case nil | ||
| 458 | (pcomplete) | ||
| 459 | (text-read-only (completion-at-point)))) ; Workaround for bug#12838. | ||
| 460 | |||
| 452 | (provide 'em-cmpl) | 461 | (provide 'em-cmpl) |
| 453 | 462 | ||
| 454 | ;; Local Variables: | 463 | ;; Local Variables: |
diff --git a/lisp/eshell/em-dirs.el b/lisp/eshell/em-dirs.el index cab84951143..4a3fa54626b 100644 --- a/lisp/eshell/em-dirs.el +++ b/lisp/eshell/em-dirs.el | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | ;;; em-dirs.el --- directory navigation commands | 1 | ;;; em-dirs.el --- directory navigation commands |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 1999-2011 Free Software Foundation, Inc. | 3 | ;; Copyright (C) 1999-2012 Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | ;; Author: John Wiegley <johnw@gnu.org> | 5 | ;; Author: John Wiegley <johnw@gnu.org> |
| 6 | 6 | ||
| @@ -47,14 +47,15 @@ | |||
| 47 | (require 'esh-opt) | 47 | (require 'esh-opt) |
| 48 | 48 | ||
| 49 | ;;;###autoload | 49 | ;;;###autoload |
| 50 | (eshell-defgroup eshell-dirs nil | 50 | (progn |
| 51 | (defgroup eshell-dirs nil | ||
| 51 | "Directory navigation involves changing directories, examining the | 52 | "Directory navigation involves changing directories, examining the |
| 52 | current directory, maintaining a directory stack, and also keeping | 53 | current directory, maintaining a directory stack, and also keeping |
| 53 | track of a history of the last directory locations the user was in. | 54 | track of a history of the last directory locations the user was in. |
| 54 | Emacs does provide standard Lisp definitions of `pwd' and `cd', but | 55 | Emacs does provide standard Lisp definitions of `pwd' and `cd', but |
| 55 | they lack somewhat in feel from the typical shell equivalents." | 56 | they lack somewhat in feel from the typical shell equivalents." |
| 56 | :tag "Directory navigation" | 57 | :tag "Directory navigation" |
| 57 | :group 'eshell-module) | 58 | :group 'eshell-module)) |
| 58 | 59 | ||
| 59 | ;;; User Variables: | 60 | ;;; User Variables: |
| 60 | 61 | ||
diff --git a/lisp/eshell/em-glob.el b/lisp/eshell/em-glob.el index df1f7b67e29..288aa9b773b 100644 --- a/lisp/eshell/em-glob.el +++ b/lisp/eshell/em-glob.el | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | ;;; em-glob.el --- extended file name globbing | 1 | ;;; em-glob.el --- extended file name globbing |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 1999-2011 Free Software Foundation, Inc. | 3 | ;; Copyright (C) 1999-2012 Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | ;; Author: John Wiegley <johnw@gnu.org> | 5 | ;; Author: John Wiegley <johnw@gnu.org> |
| 6 | 6 | ||
| @@ -53,11 +53,12 @@ | |||
| 53 | (require 'esh-util) | 53 | (require 'esh-util) |
| 54 | 54 | ||
| 55 | ;;;###autoload | 55 | ;;;###autoload |
| 56 | (eshell-defgroup eshell-glob nil | 56 | (progn |
| 57 | (defgroup eshell-glob nil | ||
| 57 | "This module provides extended globbing syntax, similar what is used | 58 | "This module provides extended globbing syntax, similar what is used |
| 58 | by zsh for filename generation." | 59 | by zsh for filename generation." |
| 59 | :tag "Extended filename globbing" | 60 | :tag "Extended filename globbing" |
| 60 | :group 'eshell-module) | 61 | :group 'eshell-module)) |
| 61 | 62 | ||
| 62 | ;;; User Variables: | 63 | ;;; User Variables: |
| 63 | 64 | ||
diff --git a/lisp/eshell/em-hist.el b/lisp/eshell/em-hist.el index 5e44e541526..64a7ad94c53 100644 --- a/lisp/eshell/em-hist.el +++ b/lisp/eshell/em-hist.el | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | ;;; em-hist.el --- history list management | 1 | ;;; em-hist.el --- history list management |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 1999-2011 Free Software Foundation, Inc. | 3 | ;; Copyright (C) 1999-2012 Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | ;; Author: John Wiegley <johnw@gnu.org> | 5 | ;; Author: John Wiegley <johnw@gnu.org> |
| 6 | 6 | ||
| @@ -54,8 +54,7 @@ | |||
| 54 | 54 | ||
| 55 | ;;; Code: | 55 | ;;; Code: |
| 56 | 56 | ||
| 57 | (eval-when-compile | 57 | (eval-when-compile (require 'cl-lib)) |
| 58 | (require 'cl)) | ||
| 59 | 58 | ||
| 60 | (require 'ring) | 59 | (require 'ring) |
| 61 | (require 'esh-opt) | 60 | (require 'esh-opt) |
| @@ -63,10 +62,11 @@ | |||
| 63 | (require 'eshell) | 62 | (require 'eshell) |
| 64 | 63 | ||
| 65 | ;;;###autoload | 64 | ;;;###autoload |
| 66 | (eshell-defgroup eshell-hist nil | 65 | (progn |
| 66 | (defgroup eshell-hist nil | ||
| 67 | "This module provides command history management." | 67 | "This module provides command history management." |
| 68 | :tag "History list management" | 68 | :tag "History list management" |
| 69 | :group 'eshell-module) | 69 | :group 'eshell-module)) |
| 70 | 70 | ||
| 71 | ;;; User Variables: | 71 | ;;; User Variables: |
| 72 | 72 | ||
| @@ -559,8 +559,8 @@ See also `eshell-read-history'." | |||
| 559 | (forward-char)) | 559 | (forward-char)) |
| 560 | (setq posb (cdr posb) | 560 | (setq posb (cdr posb) |
| 561 | pose (cdr pose)) | 561 | pose (cdr pose)) |
| 562 | (assert (= (length posb) (length args))) | 562 | (cl-assert (= (length posb) (length args))) |
| 563 | (assert (<= (length posb) (length pose)))) | 563 | (cl-assert (<= (length posb) (length pose)))) |
| 564 | (setq hist (buffer-substring-no-properties begin end)) | 564 | (setq hist (buffer-substring-no-properties begin end)) |
| 565 | (let ((b posb) (e pose)) | 565 | (let ((b posb) (e pose)) |
| 566 | (while b | 566 | (while b |
| @@ -570,7 +570,7 @@ See also `eshell-read-history'." | |||
| 570 | (setq b (cdr b) | 570 | (setq b (cdr b) |
| 571 | e (cdr e)))) | 571 | e (cdr e)))) |
| 572 | (setq textargs (cdr textargs)) | 572 | (setq textargs (cdr textargs)) |
| 573 | (assert (= (length textargs) (length args))) | 573 | (cl-assert (= (length textargs) (length args))) |
| 574 | (list textargs posb pose)))) | 574 | (list textargs posb pose)))) |
| 575 | 575 | ||
| 576 | (defun eshell-expand-history-references (beg end) | 576 | (defun eshell-expand-history-references (beg end) |
diff --git a/lisp/eshell/em-ls.el b/lisp/eshell/em-ls.el index 17dbe3fbaf2..2dd92ba3530 100644 --- a/lisp/eshell/em-ls.el +++ b/lisp/eshell/em-ls.el | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | ;;; em-ls.el --- implementation of ls in Lisp | 1 | ;;; em-ls.el --- implementation of ls in Lisp |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 1999-2011 Free Software Foundation, Inc. | 3 | ;; Copyright (C) 1999-2012 Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | ;; Author: John Wiegley <johnw@gnu.org> | 5 | ;; Author: John Wiegley <johnw@gnu.org> |
| 6 | 6 | ||
| @@ -27,20 +27,21 @@ | |||
| 27 | ;;; Code: | 27 | ;;; Code: |
| 28 | 28 | ||
| 29 | (eval-when-compile | 29 | (eval-when-compile |
| 30 | (require 'cl) | 30 | (require 'cl-lib) |
| 31 | (require 'eshell)) | 31 | (require 'eshell)) |
| 32 | (require 'esh-util) | 32 | (require 'esh-util) |
| 33 | (require 'esh-opt) | 33 | (require 'esh-opt) |
| 34 | 34 | ||
| 35 | ;;;###autoload | 35 | ;;;###autoload |
| 36 | (eshell-defgroup eshell-ls nil | 36 | (progn |
| 37 | (defgroup eshell-ls nil | ||
| 37 | "This module implements the \"ls\" utility fully in Lisp. If it is | 38 | "This module implements the \"ls\" utility fully in Lisp. If it is |
| 38 | passed any unrecognized command switches, it will revert to the | 39 | passed any unrecognized command switches, it will revert to the |
| 39 | operating system's version. This version of \"ls\" uses text | 40 | operating system's version. This version of \"ls\" uses text |
| 40 | properties to colorize its output based on the setting of | 41 | properties to colorize its output based on the setting of |
| 41 | `eshell-ls-use-colors'." | 42 | `eshell-ls-use-colors'." |
| 42 | :tag "Implementation of `ls' in Lisp" | 43 | :tag "Implementation of `ls' in Lisp" |
| 43 | :group 'eshell-module) | 44 | :group 'eshell-module)) |
| 44 | 45 | ||
| 45 | ;;; User Variables: | 46 | ;;; User Variables: |
| 46 | 47 | ||
| @@ -61,6 +62,7 @@ properties to colorize its output based on the setting of | |||
| 61 | "How to display time information in `eshell-ls-file'. | 62 | "How to display time information in `eshell-ls-file'. |
| 62 | This is passed to `format-time-string' as a format string. | 63 | This is passed to `format-time-string' as a format string. |
| 63 | To display the date using the current locale, use \"%b \%e\"." | 64 | To display the date using the current locale, use \"%b \%e\"." |
| 65 | :version "24.1" | ||
| 64 | :type 'string | 66 | :type 'string |
| 65 | :group 'eshell-ls) | 67 | :group 'eshell-ls) |
| 66 | 68 | ||
| @@ -310,7 +312,7 @@ instead." | |||
| 310 | (let ((insert-func 'eshell-buffered-print) | 312 | (let ((insert-func 'eshell-buffered-print) |
| 311 | (error-func 'eshell-error) | 313 | (error-func 'eshell-error) |
| 312 | (flush-func 'eshell-flush)) | 314 | (flush-func 'eshell-flush)) |
| 313 | (eshell-do-ls args))) | 315 | (apply 'eshell-do-ls args))) |
| 314 | 316 | ||
| 315 | (put 'eshell/ls 'eshell-no-numeric-conversions t) | 317 | (put 'eshell/ls 'eshell-no-numeric-conversions t) |
| 316 | 318 | ||
| @@ -461,7 +463,7 @@ name should be displayed as, etc. Think of it as cooking a FILEINFO." | |||
| 461 | (progn | 463 | (progn |
| 462 | (setcdr fileinfo attr) | 464 | (setcdr fileinfo attr) |
| 463 | (setcar fileinfo (eshell-ls-decorated-name fileinfo))) | 465 | (setcar fileinfo (eshell-ls-decorated-name fileinfo))) |
| 464 | (assert (eq listing-style 'long-listing)) | 466 | (cl-assert (eq listing-style 'long-listing)) |
| 465 | (setcar fileinfo | 467 | (setcar fileinfo |
| 466 | (concat (eshell-ls-decorated-name fileinfo) " -> " | 468 | (concat (eshell-ls-decorated-name fileinfo) " -> " |
| 467 | (eshell-ls-decorated-name | 469 | (eshell-ls-decorated-name |
| @@ -696,7 +698,7 @@ Each member of FILES is either a string or a cons cell of the form | |||
| 696 | (let* ((col-vals | 698 | (let* ((col-vals |
| 697 | (if (eq listing-style 'by-columns) | 699 | (if (eq listing-style 'by-columns) |
| 698 | (eshell-ls-find-column-lengths display-files) | 700 | (eshell-ls-find-column-lengths display-files) |
| 699 | (assert (eq listing-style 'by-lines)) | 701 | (cl-assert (eq listing-style 'by-lines)) |
| 700 | (eshell-ls-find-column-widths display-files))) | 702 | (eshell-ls-find-column-widths display-files))) |
| 701 | (col-widths (car col-vals)) | 703 | (col-widths (car col-vals)) |
| 702 | (display-files (cdr col-vals)) | 704 | (display-files (cdr col-vals)) |
diff --git a/lisp/eshell/em-pred.el b/lisp/eshell/em-pred.el index e45b36e3511..fc23c0099e8 100644 --- a/lisp/eshell/em-pred.el +++ b/lisp/eshell/em-pred.el | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | ;;; em-pred.el --- argument predicates and modifiers (ala zsh) | 1 | ;;; em-pred.el --- argument predicates and modifiers (ala zsh) |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 1999-2011 Free Software Foundation, Inc. | 3 | ;; Copyright (C) 1999-2012 Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | ;; Author: John Wiegley <johnw@gnu.org> | 5 | ;; Author: John Wiegley <johnw@gnu.org> |
| 6 | 6 | ||
| @@ -49,13 +49,14 @@ | |||
| 49 | (eval-when-compile (require 'eshell)) | 49 | (eval-when-compile (require 'eshell)) |
| 50 | 50 | ||
| 51 | ;;;###autoload | 51 | ;;;###autoload |
| 52 | (eshell-defgroup eshell-pred nil | 52 | (progn |
| 53 | (defgroup eshell-pred nil | ||
| 53 | "This module allows for predicates to be applied to globbing | 54 | "This module allows for predicates to be applied to globbing |
| 54 | patterns (similar to zsh), in addition to string modifiers which can | 55 | patterns (similar to zsh), in addition to string modifiers which can |
| 55 | be applied either to globbing results, variable references, or just | 56 | be applied either to globbing results, variable references, or just |
| 56 | ordinary strings." | 57 | ordinary strings." |
| 57 | :tag "Value modifiers and predicates" | 58 | :tag "Value modifiers and predicates" |
| 58 | :group 'eshell-module) | 59 | :group 'eshell-module)) |
| 59 | 60 | ||
| 60 | ;;; User Variables: | 61 | ;;; User Variables: |
| 61 | 62 | ||
diff --git a/lisp/eshell/em-prompt.el b/lisp/eshell/em-prompt.el index 3e87acc6d1e..f4701ec35ea 100644 --- a/lisp/eshell/em-prompt.el +++ b/lisp/eshell/em-prompt.el | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | ;;; em-prompt.el --- command prompts | 1 | ;;; em-prompt.el --- command prompts |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 1999-2011 Free Software Foundation, Inc. | 3 | ;; Copyright (C) 1999-2012 Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | ;; Author: John Wiegley <johnw@gnu.org> | 5 | ;; Author: John Wiegley <johnw@gnu.org> |
| 6 | 6 | ||
| @@ -29,11 +29,12 @@ | |||
| 29 | (eval-when-compile (require 'eshell)) | 29 | (eval-when-compile (require 'eshell)) |
| 30 | 30 | ||
| 31 | ;;;###autoload | 31 | ;;;###autoload |
| 32 | (eshell-defgroup eshell-prompt nil | 32 | (progn |
| 33 | (defgroup eshell-prompt nil | ||
| 33 | "This module provides command prompts, and navigation between them, | 34 | "This module provides command prompts, and navigation between them, |
| 34 | as is common with most shells." | 35 | as is common with most shells." |
| 35 | :tag "Command prompts" | 36 | :tag "Command prompts" |
| 36 | :group 'eshell-module) | 37 | :group 'eshell-module)) |
| 37 | 38 | ||
| 38 | ;;; User Variables: | 39 | ;;; User Variables: |
| 39 | 40 | ||
| @@ -69,9 +70,9 @@ re-entered for it to take effect." | |||
| 69 | :group 'eshell-prompt) | 70 | :group 'eshell-prompt) |
| 70 | 71 | ||
| 71 | (defface eshell-prompt | 72 | (defface eshell-prompt |
| 72 | '((((class color) (background light)) (:foreground "Red" :bold t)) | 73 | '((default :weight bold) |
| 73 | (((class color) (background dark)) (:foreground "Pink" :bold t)) | 74 | (((class color) (background light)) :foreground "Red") |
| 74 | (t (:bold t))) | 75 | (((class color) (background dark)) :foreground "Pink")) |
| 75 | "The face used to highlight prompt strings. | 76 | "The face used to highlight prompt strings. |
| 76 | For highlighting other kinds of strings -- similar to shell mode's | 77 | For highlighting other kinds of strings -- similar to shell mode's |
| 77 | behavior -- simply use an output filer which changes text properties." | 78 | behavior -- simply use an output filer which changes text properties." |
diff --git a/lisp/eshell/em-rebind.el b/lisp/eshell/em-rebind.el index b6f12e1ff2e..929b74d789d 100644 --- a/lisp/eshell/em-rebind.el +++ b/lisp/eshell/em-rebind.el | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | ;;; em-rebind.el --- rebind keys when point is at current input | 1 | ;;; em-rebind.el --- rebind keys when point is at current input |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 1999-2011 Free Software Foundation, Inc. | 3 | ;; Copyright (C) 1999-2012 Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | ;; Author: John Wiegley <johnw@gnu.org> | 5 | ;; Author: John Wiegley <johnw@gnu.org> |
| 6 | 6 | ||
| @@ -26,7 +26,8 @@ | |||
| 26 | (eval-when-compile (require 'eshell)) | 26 | (eval-when-compile (require 'eshell)) |
| 27 | 27 | ||
| 28 | ;;;###autoload | 28 | ;;;###autoload |
| 29 | (eshell-defgroup eshell-rebind nil | 29 | (progn |
| 30 | (defgroup eshell-rebind nil | ||
| 30 | "This module allows for special keybindings that only take effect | 31 | "This module allows for special keybindings that only take effect |
| 31 | while the point is in a region of input text. By default, it binds | 32 | while the point is in a region of input text. By default, it binds |
| 32 | C-a to move to the beginning of the input text (rather than just the | 33 | C-a to move to the beginning of the input text (rather than just the |
| @@ -37,7 +38,7 @@ commands to cause the point to leave the input area, such as | |||
| 37 | `backward-word', `previous-line', etc. This module intends to mimic | 38 | `backward-word', `previous-line', etc. This module intends to mimic |
| 38 | the behavior of normal shells while the user editing new input text." | 39 | the behavior of normal shells while the user editing new input text." |
| 39 | :tag "Rebind keys at input" | 40 | :tag "Rebind keys at input" |
| 40 | :group 'eshell-module) | 41 | :group 'eshell-module)) |
| 41 | 42 | ||
| 42 | ;;; User Variables: | 43 | ;;; User Variables: |
| 43 | 44 | ||
diff --git a/lisp/eshell/em-script.el b/lisp/eshell/em-script.el index d76e19cdd07..f219a4b6f12 100644 --- a/lisp/eshell/em-script.el +++ b/lisp/eshell/em-script.el | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | ;;; em-script.el --- Eshell script files | 1 | ;;; em-script.el --- Eshell script files |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 1999-2011 Free Software Foundation, Inc. | 3 | ;; Copyright (C) 1999-2012 Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | ;; Author: John Wiegley <johnw@gnu.org> | 5 | ;; Author: John Wiegley <johnw@gnu.org> |
| 6 | 6 | ||
| @@ -24,13 +24,15 @@ | |||
| 24 | ;;; Code: | 24 | ;;; Code: |
| 25 | 25 | ||
| 26 | (require 'eshell) | 26 | (require 'eshell) |
| 27 | (require 'esh-opt) | ||
| 27 | 28 | ||
| 28 | ;;;###autoload | 29 | ;;;###autoload |
| 29 | (eshell-defgroup eshell-script nil | 30 | (progn |
| 31 | (defgroup eshell-script nil | ||
| 30 | "This module allows for the execution of files containing Eshell | 32 | "This module allows for the execution of files containing Eshell |
| 31 | commands, as a script file." | 33 | commands, as a script file." |
| 32 | :tag "Running script files." | 34 | :tag "Running script files." |
| 33 | :group 'eshell-module) | 35 | :group 'eshell-module)) |
| 34 | 36 | ||
| 35 | ;;; User Variables: | 37 | ;;; User Variables: |
| 36 | 38 | ||
diff --git a/lisp/eshell/em-smart.el b/lisp/eshell/em-smart.el index 259072d9750..b427fe69ea4 100644 --- a/lisp/eshell/em-smart.el +++ b/lisp/eshell/em-smart.el | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | ;;; em-smart.el --- smart display of output | 1 | ;;; em-smart.el --- smart display of output |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 1999-2011 Free Software Foundation, Inc. | 3 | ;; Copyright (C) 1999-2012 Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | ;; Author: John Wiegley <johnw@gnu.org> | 5 | ;; Author: John Wiegley <johnw@gnu.org> |
| 6 | 6 | ||
| @@ -71,7 +71,8 @@ | |||
| 71 | (eval-when-compile (require 'eshell)) | 71 | (eval-when-compile (require 'eshell)) |
| 72 | 72 | ||
| 73 | ;;;###autoload | 73 | ;;;###autoload |
| 74 | (eshell-defgroup eshell-smart nil | 74 | (progn |
| 75 | (defgroup eshell-smart nil | ||
| 75 | "This module combines the facility of normal, modern shells with | 76 | "This module combines the facility of normal, modern shells with |
| 76 | some of the edit/review concepts inherent in the design of Plan 9's | 77 | some of the edit/review concepts inherent in the design of Plan 9's |
| 77 | 9term. See the docs for more details. | 78 | 9term. See the docs for more details. |
| @@ -80,7 +81,7 @@ Most likely you will have to turn this option on and play around with | |||
| 80 | it to get a real sense of how it works." | 81 | it to get a real sense of how it works." |
| 81 | :tag "Smart display of output" | 82 | :tag "Smart display of output" |
| 82 | ;; :link '(info-link "(eshell)Smart display of output") | 83 | ;; :link '(info-link "(eshell)Smart display of output") |
| 83 | :group 'eshell-module) | 84 | :group 'eshell-module)) |
| 84 | 85 | ||
| 85 | ;;; User Variables: | 86 | ;;; User Variables: |
| 86 | 87 | ||
diff --git a/lisp/eshell/em-term.el b/lisp/eshell/em-term.el index bd575a0f809..ef59f6d1d35 100644 --- a/lisp/eshell/em-term.el +++ b/lisp/eshell/em-term.el | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | ;;; em-term.el --- running visual commands | 1 | ;;; em-term.el --- running visual commands |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 1999-2011 Free Software Foundation, Inc. | 3 | ;; Copyright (C) 1999-2012 Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | ;; Author: John Wiegley <johnw@gnu.org> | 5 | ;; Author: John Wiegley <johnw@gnu.org> |
| 6 | 6 | ||
| @@ -35,14 +35,15 @@ | |||
| 35 | (require 'term) | 35 | (require 'term) |
| 36 | 36 | ||
| 37 | ;;;###autoload | 37 | ;;;###autoload |
| 38 | (eshell-defgroup eshell-term nil | 38 | (progn |
| 39 | (defgroup eshell-term nil | ||
| 39 | "This module causes visual commands (e.g., 'vi') to be executed by | 40 | "This module causes visual commands (e.g., 'vi') to be executed by |
| 40 | the `term' package, which comes with Emacs. This package handles most | 41 | the `term' package, which comes with Emacs. This package handles most |
| 41 | of the ANSI control codes, allowing curses-based applications to run | 42 | of the ANSI control codes, allowing curses-based applications to run |
| 42 | within an Emacs window. The variable `eshell-visual-commands' defines | 43 | within an Emacs window. The variable `eshell-visual-commands' defines |
| 43 | which commands are considered visual in nature." | 44 | which commands are considered visual in nature." |
| 44 | :tag "Running visual commands" | 45 | :tag "Running visual commands" |
| 45 | :group 'eshell-module) | 46 | :group 'eshell-module)) |
| 46 | 47 | ||
| 47 | ;;; User Variables: | 48 | ;;; User Variables: |
| 48 | 49 | ||
| @@ -62,10 +63,13 @@ which commands are considered visual in nature." | |||
| 62 | :type '(repeat string) | 63 | :type '(repeat string) |
| 63 | :group 'eshell-term) | 64 | :group 'eshell-term) |
| 64 | 65 | ||
| 65 | (defcustom eshell-term-name "eterm" | 66 | ;; If you change this from term-term-name, you need to ensure that the |
| 67 | ;; value you choose exists in the system's terminfo database. (Bug#12485) | ||
| 68 | (defcustom eshell-term-name term-term-name | ||
| 66 | "Name to use for the TERM variable when running visual commands. | 69 | "Name to use for the TERM variable when running visual commands. |
| 67 | See `term-term-name' in term.el for more information on how this is | 70 | See `term-term-name' in term.el for more information on how this is |
| 68 | used." | 71 | used." |
| 72 | :version "24.3" ; eterm -> term-term-name = eterm-color | ||
| 69 | :type 'string | 73 | :type 'string |
| 70 | :group 'eshell-term) | 74 | :group 'eshell-term) |
| 71 | 75 | ||
diff --git a/lisp/eshell/em-unix.el b/lisp/eshell/em-unix.el index 707f2ebc2ce..32744c702a6 100644 --- a/lisp/eshell/em-unix.el +++ b/lisp/eshell/em-unix.el | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | ;;; em-unix.el --- UNIX command aliases | 1 | ;;; em-unix.el --- UNIX command aliases |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 1999-2011 Free Software Foundation, Inc. | 3 | ;; Copyright (C) 1999-2012 Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | ;; Author: John Wiegley <johnw@gnu.org> | 5 | ;; Author: John Wiegley <johnw@gnu.org> |
| 6 | 6 | ||
| @@ -40,7 +40,8 @@ | |||
| 40 | (require 'pcomplete) | 40 | (require 'pcomplete) |
| 41 | 41 | ||
| 42 | ;;;###autoload | 42 | ;;;###autoload |
| 43 | (eshell-defgroup eshell-unix nil | 43 | (progn |
| 44 | (defgroup eshell-unix nil | ||
| 44 | "This module defines many of the more common UNIX utilities as | 45 | "This module defines many of the more common UNIX utilities as |
| 45 | aliases implemented in Lisp. These include mv, ln, cp, rm, etc. If | 46 | aliases implemented in Lisp. These include mv, ln, cp, rm, etc. If |
| 46 | the user passes arguments which are too complex, or are unrecognized | 47 | the user passes arguments which are too complex, or are unrecognized |
| @@ -51,7 +52,7 @@ with Eshell makes them more versatile than their traditional cousins | |||
| 51 | \(such as being able to use `kill' to kill Eshell background processes | 52 | \(such as being able to use `kill' to kill Eshell background processes |
| 52 | by name)." | 53 | by name)." |
| 53 | :tag "UNIX commands in Lisp" | 54 | :tag "UNIX commands in Lisp" |
| 54 | :group 'eshell-module) | 55 | :group 'eshell-module)) |
| 55 | 56 | ||
| 56 | (defcustom eshell-unix-load-hook nil | 57 | (defcustom eshell-unix-load-hook nil |
| 57 | "A list of functions to run when `eshell-unix' is loaded." | 58 | "A list of functions to run when `eshell-unix' is loaded." |
| @@ -305,12 +306,13 @@ Remove (unlink) the FILE(s).") | |||
| 305 | (eshell-eval-using-options | 306 | (eshell-eval-using-options |
| 306 | "mkdir" args | 307 | "mkdir" args |
| 307 | '((?h "help" nil nil "show this usage screen") | 308 | '((?h "help" nil nil "show this usage screen") |
| 309 | (?p "parents" nil em-parents "make parent directories as needed") | ||
| 308 | :external "mkdir" | 310 | :external "mkdir" |
| 309 | :show-usage | 311 | :show-usage |
| 310 | :usage "[OPTION] DIRECTORY... | 312 | :usage "[OPTION] DIRECTORY... |
| 311 | Create the DIRECTORY(ies), if they do not already exist.") | 313 | Create the DIRECTORY(ies), if they do not already exist.") |
| 312 | (while args | 314 | (while args |
| 313 | (eshell-funcalln 'make-directory (car args)) | 315 | (eshell-funcalln 'make-directory (car args) em-parents) |
| 314 | (setq args (cdr args))) | 316 | (setq args (cdr args))) |
| 315 | nil)) | 317 | nil)) |
| 316 | 318 | ||
| @@ -599,7 +601,7 @@ symlink, then revert to the system's definition of cat." | |||
| 599 | (let ((ext-cat (eshell-search-path "cat"))) | 601 | (let ((ext-cat (eshell-search-path "cat"))) |
| 600 | (if ext-cat | 602 | (if ext-cat |
| 601 | (throw 'eshell-replace-command | 603 | (throw 'eshell-replace-command |
| 602 | (eshell-parse-command ext-cat args)) | 604 | (eshell-parse-command (eshell-quote-argument ext-cat) args)) |
| 603 | (if eshell-in-pipeline-p | 605 | (if eshell-in-pipeline-p |
| 604 | (error "Eshell's `cat' does not work in pipelines") | 606 | (error "Eshell's `cat' does not work in pipelines") |
| 605 | (error "Eshell's `cat' cannot display one of the files given")))) | 607 | (error "Eshell's `cat' cannot display one of the files given")))) |
| @@ -712,7 +714,7 @@ available..." | |||
| 712 | 714 | ||
| 713 | (defun eshell-grep (command args &optional maybe-use-occur) | 715 | (defun eshell-grep (command args &optional maybe-use-occur) |
| 714 | "Generic service function for the various grep aliases. | 716 | "Generic service function for the various grep aliases. |
| 715 | It calls Emacs' grep utility if the command is not redirecting output, | 717 | It calls Emacs's grep utility if the command is not redirecting output, |
| 716 | and if it's not part of a command pipeline. Otherwise, it calls the | 718 | and if it's not part of a command pipeline. Otherwise, it calls the |
| 717 | external command." | 719 | external command." |
| 718 | (if (and maybe-use-occur eshell-no-grep-available) | 720 | (if (and maybe-use-occur eshell-no-grep-available) |
| @@ -792,8 +794,6 @@ external command." | |||
| 792 | (funcall (or (pcomplete-find-completion-function (pcomplete-arg 1)) | 794 | (funcall (or (pcomplete-find-completion-function (pcomplete-arg 1)) |
| 793 | pcomplete-default-completion-function))) | 795 | pcomplete-default-completion-function))) |
| 794 | 796 | ||
| 795 | (defalias 'pcomplete/ssh 'pcomplete/rsh) | ||
| 796 | |||
| 797 | (defvar block-size) | 797 | (defvar block-size) |
| 798 | (defvar by-bytes) | 798 | (defvar by-bytes) |
| 799 | (defvar dereference-links) | 799 | (defvar dereference-links) |
| @@ -857,7 +857,7 @@ external command." | |||
| 857 | (file-remote-p (expand-file-name arg) 'method) "ftp") | 857 | (file-remote-p (expand-file-name arg) 'method) "ftp") |
| 858 | (throw 'have-ange-path t)))))) | 858 | (throw 'have-ange-path t)))))) |
| 859 | (throw 'eshell-replace-command | 859 | (throw 'eshell-replace-command |
| 860 | (eshell-parse-command ext-du args)) | 860 | (eshell-parse-command (eshell-quote-argument ext-du) args)) |
| 861 | (eshell-eval-using-options | 861 | (eshell-eval-using-options |
| 862 | "du" args | 862 | "du" args |
| 863 | '((?a "all" nil show-all | 863 | '((?a "all" nil show-all |
| @@ -965,6 +965,8 @@ Show wall-clock time elapsed during execution of COMMAND.") | |||
| 965 | ((string-match "[^[:blank:]]" string) string) | 965 | ((string-match "[^[:blank:]]" string) string) |
| 966 | (nil))) | 966 | (nil))) |
| 967 | 967 | ||
| 968 | (autoload 'diff-no-select "diff") | ||
| 969 | |||
| 968 | (defun eshell/diff (&rest args) | 970 | (defun eshell/diff (&rest args) |
| 969 | "Alias \"diff\" to call Emacs `diff' function." | 971 | "Alias \"diff\" to call Emacs `diff' function." |
| 970 | (let ((orig-args (eshell-stringify-list (eshell-flatten-list args)))) | 972 | (let ((orig-args (eshell-stringify-list (eshell-flatten-list args)))) |
| @@ -986,8 +988,9 @@ Show wall-clock time elapsed during execution of COMMAND.") | |||
| 986 | (setcdr (last args 3) nil)) | 988 | (setcdr (last args 3) nil)) |
| 987 | (with-current-buffer | 989 | (with-current-buffer |
| 988 | (condition-case err | 990 | (condition-case err |
| 989 | (diff old new | 991 | (diff-no-select |
| 990 | (nil-blank-string (eshell-flatten-and-stringify args))) | 992 | old new |
| 993 | (nil-blank-string (eshell-flatten-and-stringify args))) | ||
| 991 | (error | 994 | (error |
| 992 | (throw 'eshell-replace-command | 995 | (throw 'eshell-replace-command |
| 993 | (eshell-parse-command "*diff" orig-args)))) | 996 | (eshell-parse-command "*diff" orig-args)))) |
| @@ -1035,12 +1038,8 @@ Show wall-clock time elapsed during execution of COMMAND.") | |||
| 1035 | 1038 | ||
| 1036 | (put 'eshell/occur 'eshell-no-numeric-conversions t) | 1039 | (put 'eshell/occur 'eshell-no-numeric-conversions t) |
| 1037 | 1040 | ||
| 1038 | ;; Pacify the byte-compiler. | ||
| 1039 | (defvar tramp-default-proxies-alist) | ||
| 1040 | |||
| 1041 | (defun eshell/su (&rest args) | 1041 | (defun eshell/su (&rest args) |
| 1042 | "Alias \"su\" to call Tramp." | 1042 | "Alias \"su\" to call Tramp." |
| 1043 | (require 'tramp) | ||
| 1044 | (setq args (eshell-stringify-list (eshell-flatten-list args))) | 1043 | (setq args (eshell-stringify-list (eshell-flatten-list args))) |
| 1045 | (let ((orig-args (copy-tree args))) | 1044 | (let ((orig-args (copy-tree args))) |
| 1046 | (eshell-eval-using-options | 1045 | (eshell-eval-using-options |
| @@ -1055,29 +1054,29 @@ Become another USER during a login session.") | |||
| 1055 | (host (or (file-remote-p default-directory 'host) | 1054 | (host (or (file-remote-p default-directory 'host) |
| 1056 | "localhost")) | 1055 | "localhost")) |
| 1057 | (dir (or (file-remote-p default-directory 'localname) | 1056 | (dir (or (file-remote-p default-directory 'localname) |
| 1058 | (expand-file-name default-directory)))) | 1057 | (expand-file-name default-directory))) |
| 1058 | (prefix (file-remote-p default-directory))) | ||
| 1059 | (dolist (arg args) | 1059 | (dolist (arg args) |
| 1060 | (if (string-equal arg "-") (setq login t) (setq user arg))) | 1060 | (if (string-equal arg "-") (setq login t) (setq user arg))) |
| 1061 | ;; `eshell-eval-using-options' does not handle "-". | 1061 | ;; `eshell-eval-using-options' does not handle "-". |
| 1062 | (if (member "-" orig-args) (setq login t)) | 1062 | (if (member "-" orig-args) (setq login t)) |
| 1063 | (if login (setq dir "~/")) | 1063 | (if login (setq dir "~/")) |
| 1064 | (if (and (file-remote-p default-directory) | 1064 | (if (and prefix |
| 1065 | (or | 1065 | (or |
| 1066 | (not (string-equal | 1066 | (not (string-equal |
| 1067 | "su" (file-remote-p default-directory 'method))) | 1067 | "su" (file-remote-p default-directory 'method))) |
| 1068 | (not (string-equal | 1068 | (not (string-equal |
| 1069 | user (file-remote-p default-directory 'user))))) | 1069 | user (file-remote-p default-directory 'user))))) |
| 1070 | (add-to-list | 1070 | (eshell-parse-command |
| 1071 | 'tramp-default-proxies-alist | 1071 | "cd" (list (format "%s|su:%s@%s:%s" |
| 1072 | (list host user (file-remote-p default-directory)))) | 1072 | (substring prefix 0 -1) user host dir))) |
| 1073 | (eshell-parse-command | 1073 | (eshell-parse-command |
| 1074 | "cd" (list (format "/su:%s@%s:%s" user host dir)))))))) | 1074 | "cd" (list (format "/su:%s@%s:%s" user host dir))))))))) |
| 1075 | 1075 | ||
| 1076 | (put 'eshell/su 'eshell-no-numeric-conversions t) | 1076 | (put 'eshell/su 'eshell-no-numeric-conversions t) |
| 1077 | 1077 | ||
| 1078 | (defun eshell/sudo (&rest args) | 1078 | (defun eshell/sudo (&rest args) |
| 1079 | "Alias \"sudo\" to call Tramp." | 1079 | "Alias \"sudo\" to call Tramp." |
| 1080 | (require 'tramp) | ||
| 1081 | (setq args (eshell-stringify-list (eshell-flatten-list args))) | 1080 | (setq args (eshell-stringify-list (eshell-flatten-list args))) |
| 1082 | (let ((orig-args (copy-tree args))) | 1081 | (let ((orig-args (copy-tree args))) |
| 1083 | (eshell-eval-using-options | 1082 | (eshell-eval-using-options |
| @@ -1092,21 +1091,28 @@ Execute a COMMAND as the superuser or another USER.") | |||
| 1092 | (host (or (file-remote-p default-directory 'host) | 1091 | (host (or (file-remote-p default-directory 'host) |
| 1093 | "localhost")) | 1092 | "localhost")) |
| 1094 | (dir (or (file-remote-p default-directory 'localname) | 1093 | (dir (or (file-remote-p default-directory 'localname) |
| 1095 | (expand-file-name default-directory)))) | 1094 | (expand-file-name default-directory))) |
| 1095 | (prefix (file-remote-p default-directory))) | ||
| 1096 | ;; `eshell-eval-using-options' reads options of COMMAND. | 1096 | ;; `eshell-eval-using-options' reads options of COMMAND. |
| 1097 | (while (and (stringp (car orig-args)) | 1097 | (while (and (stringp (car orig-args)) |
| 1098 | (member (car orig-args) '("-u" "--user"))) | 1098 | (member (car orig-args) '("-u" "--user"))) |
| 1099 | (setq orig-args (cddr orig-args))) | 1099 | (setq orig-args (cddr orig-args))) |
| 1100 | (if (and (file-remote-p default-directory) | 1100 | (let ((default-directory |
| 1101 | (or | 1101 | (if (and prefix |
| 1102 | (not (string-equal | 1102 | (or |
| 1103 | "sudo" (file-remote-p default-directory 'method))) | 1103 | (not |
| 1104 | (not (string-equal | 1104 | (string-equal |
| 1105 | user (file-remote-p default-directory 'user))))) | 1105 | "sudo" |
| 1106 | (add-to-list | 1106 | (file-remote-p default-directory 'method))) |
| 1107 | 'tramp-default-proxies-alist | 1107 | (not |
| 1108 | (list host user (file-remote-p default-directory)))) | 1108 | (string-equal |
| 1109 | (let ((default-directory (format "/sudo:%s@%s:%s" user host dir))) | 1109 | user |
| 1110 | (file-remote-p default-directory 'user))))) | ||
| 1111 | (format "%s|sudo:%s@%s:%s" | ||
| 1112 | (substring prefix 0 -1) user host dir) | ||
| 1113 | (format "/sudo:%s@%s:%s" user host dir)))) | ||
| 1114 | ;; Ensure, that Tramp has connected to that construct already. | ||
| 1115 | (ignore (file-exists-p default-directory)) | ||
| 1110 | (eshell-named-command (car orig-args) (cdr orig-args)))))))) | 1116 | (eshell-named-command (car orig-args) (cdr orig-args)))))))) |
| 1111 | 1117 | ||
| 1112 | (put 'eshell/sudo 'eshell-no-numeric-conversions t) | 1118 | (put 'eshell/sudo 'eshell-no-numeric-conversions t) |
diff --git a/lisp/eshell/em-xtra.el b/lisp/eshell/em-xtra.el index 50bda108e95..2e7a813cb75 100644 --- a/lisp/eshell/em-xtra.el +++ b/lisp/eshell/em-xtra.el | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | ;;; em-xtra.el --- extra alias functions | 1 | ;;; em-xtra.el --- extra alias functions |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 1999-2011 Free Software Foundation, Inc. | 3 | ;; Copyright (C) 1999-2012 Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | ;; Author: John Wiegley <johnw@gnu.org> | 5 | ;; Author: John Wiegley <johnw@gnu.org> |
| 6 | 6 | ||
| @@ -29,13 +29,14 @@ | |||
| 29 | (require 'compile) | 29 | (require 'compile) |
| 30 | 30 | ||
| 31 | ;;;###autoload | 31 | ;;;###autoload |
| 32 | (eshell-defgroup eshell-xtra nil | 32 | (progn |
| 33 | (defgroup eshell-xtra nil | ||
| 33 | "This module defines some extra alias functions which are entirely | 34 | "This module defines some extra alias functions which are entirely |
| 34 | optional. They can be viewed as samples for how to write Eshell alias | 35 | optional. They can be viewed as samples for how to write Eshell alias |
| 35 | functions, or as aliases which make some of Emacs' behavior more | 36 | functions, or as aliases which make some of Emacs's behavior more |
| 36 | naturally accessible within Emacs." | 37 | naturally accessible within Emacs." |
| 37 | :tag "Extra alias functions" | 38 | :tag "Extra alias functions" |
| 38 | :group 'eshell-module) | 39 | :group 'eshell-module)) |
| 39 | 40 | ||
| 40 | ;;; Functions: | 41 | ;;; Functions: |
| 41 | 42 | ||
diff --git a/lisp/eshell/esh-arg.el b/lisp/eshell/esh-arg.el index dcb23967645..ad52a5d4a71 100644 --- a/lisp/eshell/esh-arg.el +++ b/lisp/eshell/esh-arg.el | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | ;;; esh-arg.el --- argument processing | 1 | ;;; esh-arg.el --- argument processing |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 1999-2011 Free Software Foundation, Inc. | 3 | ;; Copyright (C) 1999-2012 Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | ;; Author: John Wiegley <johnw@gnu.org> | 5 | ;; Author: John Wiegley <johnw@gnu.org> |
| 6 | 6 | ||
| @@ -202,6 +202,18 @@ If POS is nil, the location of point is checked." | |||
| 202 | (or (= pos (point-max)) | 202 | (or (= pos (point-max)) |
| 203 | (memq (char-after pos) eshell-delimiter-argument-list)))) | 203 | (memq (char-after pos) eshell-delimiter-argument-list)))) |
| 204 | 204 | ||
| 205 | (defun eshell-quote-argument (string) | ||
| 206 | "Return STRING with magic characters quoted. | ||
| 207 | Magic characters are those in `eshell-special-chars-outside-quoting'." | ||
| 208 | (let ((index 0)) | ||
| 209 | (mapconcat (lambda (c) | ||
| 210 | (prog1 | ||
| 211 | (or (eshell-quote-backslash string index) | ||
| 212 | (char-to-string c)) | ||
| 213 | (setq index (1+ index)))) | ||
| 214 | string | ||
| 215 | ""))) | ||
| 216 | |||
| 205 | ;; Argument parsing | 217 | ;; Argument parsing |
| 206 | 218 | ||
| 207 | (defun eshell-parse-arguments (beg end) | 219 | (defun eshell-parse-arguments (beg end) |
diff --git a/lisp/eshell/esh-cmd.el b/lisp/eshell/esh-cmd.el index 7b90797eb43..e6e89d83b7c 100644 --- a/lisp/eshell/esh-cmd.el +++ b/lisp/eshell/esh-cmd.el | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | ;;; esh-cmd.el --- command invocation | 1 | ;;; esh-cmd.el --- command invocation |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 1999-2011 Free Software Foundation, Inc. | 3 | ;; Copyright (C) 1999-2012 Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | ;; Author: John Wiegley <johnw@gnu.org> | 5 | ;; Author: John Wiegley <johnw@gnu.org> |
| 6 | 6 | ||
| @@ -108,7 +108,7 @@ | |||
| 108 | (require 'esh-ext) | 108 | (require 'esh-ext) |
| 109 | 109 | ||
| 110 | (eval-when-compile | 110 | (eval-when-compile |
| 111 | (require 'cl) | 111 | (require 'cl-lib) |
| 112 | (require 'pcomplete)) | 112 | (require 'pcomplete)) |
| 113 | 113 | ||
| 114 | 114 | ||
| @@ -236,10 +236,14 @@ return non-nil if the command is complex." | |||
| 236 | :group 'eshell-cmd) | 236 | :group 'eshell-cmd) |
| 237 | 237 | ||
| 238 | (defcustom eshell-debug-command nil | 238 | (defcustom eshell-debug-command nil |
| 239 | "If non-nil, enable debugging code. SSLLOOWW. | 239 | "If non-nil, enable Eshell debugging code. |
| 240 | This option is only useful for reporting bugs. If you enable it, you | 240 | This is slow, and only useful for debugging problems with Eshell. |
| 241 | will have to visit the file 'eshell-cmd.el' and run the command | 241 | If you change this without using customize after Eshell has loaded, |
| 242 | \\[eval-buffer]." | 242 | you must re-load 'esh-cmd.el'." |
| 243 | :initialize 'custom-initialize-default | ||
| 244 | :set (lambda (symbol value) | ||
| 245 | (set symbol value) | ||
| 246 | (load-library "esh-cmd")) | ||
| 243 | :type 'boolean | 247 | :type 'boolean |
| 244 | :group 'eshell-cmd) | 248 | :group 'eshell-cmd) |
| 245 | 249 | ||
| @@ -480,20 +484,22 @@ implemented via rewriting, rather than as a function." | |||
| 480 | (let ((body (car (last terms)))) | 484 | (let ((body (car (last terms)))) |
| 481 | (setcdr (last terms 2) nil) | 485 | (setcdr (last terms 2) nil) |
| 482 | `(let ((for-items | 486 | `(let ((for-items |
| 483 | (append | 487 | (copy-tree |
| 484 | ,@(mapcar | 488 | (append |
| 485 | (lambda (elem) | 489 | ,@(mapcar |
| 486 | (if (listp elem) | 490 | (lambda (elem) |
| 487 | elem | 491 | (if (listp elem) |
| 488 | `(list ,elem))) | 492 | elem |
| 489 | (cdr (cddr terms))))) | 493 | `(list ,elem))) |
| 490 | (eshell-command-body '(nil)) | 494 | (cdr (cddr terms)))))) |
| 495 | (eshell-command-body '(nil)) | ||
| 491 | (eshell-test-body '(nil))) | 496 | (eshell-test-body '(nil))) |
| 492 | (while (consp for-items) | 497 | (while (car for-items) |
| 493 | (let ((,(intern (cadr terms)) (car for-items))) | 498 | (let ((,(intern (cadr terms)) (car for-items))) |
| 494 | (eshell-protect | 499 | (eshell-protect |
| 495 | ,(eshell-invokify-arg body t))) | 500 | ,(eshell-invokify-arg body t))) |
| 496 | (setq for-items (cdr for-items))) | 501 | (setcar for-items (cadr for-items)) |
| 502 | (setcdr for-items (cddr for-items))) | ||
| 497 | (eshell-close-handles | 503 | (eshell-close-handles |
| 498 | eshell-last-command-status | 504 | eshell-last-command-status |
| 499 | (list 'quote eshell-last-command-result)))))) | 505 | (list 'quote eshell-last-command-result)))))) |
| @@ -600,7 +606,7 @@ For an external command, it means an exit code of 0." | |||
| 600 | (list | 606 | (list |
| 601 | (if (<= (length pieces) 1) | 607 | (if (<= (length pieces) 1) |
| 602 | (car pieces) | 608 | (car pieces) |
| 603 | (assert (not eshell-in-pipeline-p)) | 609 | (cl-assert (not eshell-in-pipeline-p)) |
| 604 | `(eshell-execute-pipeline (quote ,pieces)))))) | 610 | `(eshell-execute-pipeline (quote ,pieces)))))) |
| 605 | (setq bp (cdr bp)))) | 611 | (setq bp (cdr bp)))) |
| 606 | ;; `results' might be empty; this happens in the case of | 612 | ;; `results' might be empty; this happens in the case of |
| @@ -611,7 +617,7 @@ For an external command, it means an exit code of 0." | |||
| 611 | results (cdr results) | 617 | results (cdr results) |
| 612 | sep-terms (nreverse sep-terms)) | 618 | sep-terms (nreverse sep-terms)) |
| 613 | (while results | 619 | (while results |
| 614 | (assert (car sep-terms)) | 620 | (cl-assert (car sep-terms)) |
| 615 | (setq final (eshell-structure-basic-command | 621 | (setq final (eshell-structure-basic-command |
| 616 | 'if (string= (car sep-terms) "&&") "if" | 622 | 'if (string= (car sep-terms) "&&") "if" |
| 617 | `(eshell-protect ,(car results)) | 623 | `(eshell-protect ,(car results)) |
| @@ -1022,7 +1028,7 @@ be finished later after the completion of an asynchronous subprocess." | |||
| 1022 | ;; `eshell-copy-tree' is needed here so that the test argument | 1028 | ;; `eshell-copy-tree' is needed here so that the test argument |
| 1023 | ;; doesn't get modified and thus always yield the same result. | 1029 | ;; doesn't get modified and thus always yield the same result. |
| 1024 | (when (car eshell-command-body) | 1030 | (when (car eshell-command-body) |
| 1025 | (assert (not synchronous-p)) | 1031 | (cl-assert (not synchronous-p)) |
| 1026 | (eshell-do-eval (car eshell-command-body)) | 1032 | (eshell-do-eval (car eshell-command-body)) |
| 1027 | (setcar eshell-command-body nil) | 1033 | (setcar eshell-command-body nil) |
| 1028 | (setcar eshell-test-body nil)) | 1034 | (setcar eshell-test-body nil)) |
| @@ -1042,7 +1048,7 @@ be finished later after the completion of an asynchronous subprocess." | |||
| 1042 | ;; doesn't get modified and thus always yield the same result. | 1048 | ;; doesn't get modified and thus always yield the same result. |
| 1043 | (if (car eshell-command-body) | 1049 | (if (car eshell-command-body) |
| 1044 | (progn | 1050 | (progn |
| 1045 | (assert (not synchronous-p)) | 1051 | (cl-assert (not synchronous-p)) |
| 1046 | (eshell-do-eval (car eshell-command-body))) | 1052 | (eshell-do-eval (car eshell-command-body))) |
| 1047 | (unless (car eshell-test-body) | 1053 | (unless (car eshell-test-body) |
| 1048 | (setcar eshell-test-body (eshell-copy-tree (car args)))) | 1054 | (setcar eshell-test-body (eshell-copy-tree (car args)))) |
| @@ -1197,7 +1203,7 @@ COMMAND may result in an alias being executed, or a plain command." | |||
| 1197 | (setq eshell-last-arguments args | 1203 | (setq eshell-last-arguments args |
| 1198 | eshell-last-command-name (eshell-stringify command)) | 1204 | eshell-last-command-name (eshell-stringify command)) |
| 1199 | (run-hook-with-args 'eshell-prepare-command-hook) | 1205 | (run-hook-with-args 'eshell-prepare-command-hook) |
| 1200 | (assert (stringp eshell-last-command-name)) | 1206 | (cl-assert (stringp eshell-last-command-name)) |
| 1201 | (if eshell-last-command-name | 1207 | (if eshell-last-command-name |
| 1202 | (or (run-hook-with-args-until-success | 1208 | (or (run-hook-with-args-until-success |
| 1203 | 'eshell-named-command-hook eshell-last-command-name | 1209 | 'eshell-named-command-hook eshell-last-command-name |
| @@ -1212,13 +1218,12 @@ COMMAND may result in an alias being executed, or a plain command." | |||
| 1212 | (let* ((sym (intern-soft (concat "eshell/" name))) | 1218 | (let* ((sym (intern-soft (concat "eshell/" name))) |
| 1213 | (file (symbol-file sym 'defun))) | 1219 | (file (symbol-file sym 'defun))) |
| 1214 | ;; If the function exists, but is defined in an eshell module | 1220 | ;; If the function exists, but is defined in an eshell module |
| 1215 | ;; that's not currently enabled, don't report it as found | 1221 | ;; that's not currently enabled, don't report it as found. |
| 1216 | (if (and file | 1222 | (if (and file |
| 1217 | (string-match "\\(em\\|esh\\)-\\(.*\\)\\(\\.el\\)?\\'" file)) | 1223 | (setq file (file-name-base file)) |
| 1224 | (string-match "\\`\\(em\\|esh\\)-\\([[:alnum:]]+\\)\\'" file)) | ||
| 1218 | (let ((module-sym | 1225 | (let ((module-sym |
| 1219 | (intern (file-name-sans-extension | 1226 | (intern (concat "eshell-" (match-string 2 file))))) |
| 1220 | (file-name-nondirectory | ||
| 1221 | (concat "eshell-" (match-string 2 file))))))) | ||
| 1222 | (if (and (functionp sym) | 1227 | (if (and (functionp sym) |
| 1223 | (or (null module-sym) | 1228 | (or (null module-sym) |
| 1224 | (eshell-using-module module-sym) | 1229 | (eshell-using-module module-sym) |
diff --git a/lisp/eshell/esh-ext.el b/lisp/eshell/esh-ext.el index 3acbeac0b89..e48213c54d6 100644 --- a/lisp/eshell/esh-ext.el +++ b/lisp/eshell/esh-ext.el | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | ;;; esh-ext.el --- commands external to Eshell | 1 | ;;; esh-ext.el --- commands external to Eshell |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 1999-2011 Free Software Foundation, Inc. | 3 | ;; Copyright (C) 1999-2012 Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | ;; Author: John Wiegley <johnw@gnu.org> | 5 | ;; Author: John Wiegley <johnw@gnu.org> |
| 6 | 6 | ||
| @@ -34,9 +34,10 @@ | |||
| 34 | (provide 'esh-ext) | 34 | (provide 'esh-ext) |
| 35 | 35 | ||
| 36 | (eval-when-compile | 36 | (eval-when-compile |
| 37 | (require 'cl) | 37 | (require 'cl-lib) |
| 38 | (require 'esh-cmd)) | 38 | (require 'esh-cmd)) |
| 39 | (require 'esh-util) | 39 | (require 'esh-util) |
| 40 | (require 'esh-opt) | ||
| 40 | 41 | ||
| 41 | (defgroup eshell-ext nil | 42 | (defgroup eshell-ext nil |
| 42 | "External commands are invoked when operating system executables are | 43 | "External commands are invoked when operating system executables are |
| @@ -91,7 +92,7 @@ since nothing else but Eshell will be able to understand | |||
| 91 | 92 | ||
| 92 | (defcustom eshell-windows-shell-file | 93 | (defcustom eshell-windows-shell-file |
| 93 | (if (eshell-under-windows-p) | 94 | (if (eshell-under-windows-p) |
| 94 | (if (string-match "\\(\\`cmdproxy\\|sh\\)\\.\\(com\\|exe\\)" | 95 | (if (string-match "\\(cmdproxy\\|sh\\)\\.\\(com\\|exe\\)" |
| 95 | shell-file-name) | 96 | shell-file-name) |
| 96 | (or (eshell-search-path "cmd.exe") | 97 | (or (eshell-search-path "cmd.exe") |
| 97 | (eshell-search-path "command.com")) | 98 | (eshell-search-path "command.com")) |
| @@ -108,7 +109,9 @@ wholly ignored." | |||
| 108 | ;; argument... | 109 | ;; argument... |
| 109 | (setcar args (subst-char-in-string ?/ ?\\ (car args))) | 110 | (setcar args (subst-char-in-string ?/ ?\\ (car args))) |
| 110 | (throw 'eshell-replace-command | 111 | (throw 'eshell-replace-command |
| 111 | (eshell-parse-command eshell-windows-shell-file (cons "/c" args)))) | 112 | (eshell-parse-command |
| 113 | (eshell-quote-argument eshell-windows-shell-file) | ||
| 114 | (cons "/c" args)))) | ||
| 112 | 115 | ||
| 113 | (defcustom eshell-interpreter-alist | 116 | (defcustom eshell-interpreter-alist |
| 114 | (if (eshell-under-windows-p) | 117 | (if (eshell-under-windows-p) |
| @@ -186,6 +189,7 @@ all the output from the remote command, and sends it all at once, | |||
| 186 | causing the user to wonder if anything's really going on..." | 189 | causing the user to wonder if anything's really going on..." |
| 187 | (let ((outbuf (generate-new-buffer " *eshell remote output*")) | 190 | (let ((outbuf (generate-new-buffer " *eshell remote output*")) |
| 188 | (errbuf (generate-new-buffer " *eshell remote error*")) | 191 | (errbuf (generate-new-buffer " *eshell remote error*")) |
| 192 | (command (or (file-remote-p command 'localname) command)) | ||
| 189 | (exitcode 1)) | 193 | (exitcode 1)) |
| 190 | (unwind-protect | 194 | (unwind-protect |
| 191 | (progn | 195 | (progn |
| @@ -203,10 +207,15 @@ causing the user to wonder if anything's really going on..." | |||
| 203 | (defun eshell-external-command (command args) | 207 | (defun eshell-external-command (command args) |
| 204 | "Insert output from an external COMMAND, using ARGS." | 208 | "Insert output from an external COMMAND, using ARGS." |
| 205 | (setq args (eshell-stringify-list (eshell-flatten-list args))) | 209 | (setq args (eshell-stringify-list (eshell-flatten-list args))) |
| 206 | (if (file-remote-p default-directory) | 210 | (let ((interp (eshell-find-interpreter |
| 207 | (eshell-remote-command command args)) | 211 | command |
| 208 | (let ((interp (eshell-find-interpreter command))) | 212 | ;; `eshell-find-interpreter' does not work correctly |
| 209 | (assert interp) | 213 | ;; for Tramp file name syntax. But we don't need to |
| 214 | ;; know the interpreter in that case, therefore the | ||
| 215 | ;; check is suppressed. | ||
| 216 | (or (and (stringp command) (file-remote-p command)) | ||
| 217 | (file-remote-p default-directory))))) | ||
| 218 | (cl-assert interp) | ||
| 210 | (if (functionp (car interp)) | 219 | (if (functionp (car interp)) |
| 211 | (apply (car interp) (append (cdr interp) args)) | 220 | (apply (car interp) (append (cdr interp) args)) |
| 212 | (eshell-gather-process-output | 221 | (eshell-gather-process-output |
| @@ -222,20 +231,15 @@ causing the user to wonder if anything's really going on..." | |||
| 222 | Adds the given PATH to $PATH.") | 231 | Adds the given PATH to $PATH.") |
| 223 | (if args | 232 | (if args |
| 224 | (progn | 233 | (progn |
| 225 | (if prepend | 234 | (setq eshell-path-env (getenv "PATH") |
| 226 | (setq args (nreverse args))) | 235 | args (mapconcat 'identity args path-separator) |
| 227 | (while args | 236 | eshell-path-env |
| 228 | (setenv "PATH" | 237 | (if prepend |
| 229 | (if prepend | 238 | (concat args path-separator eshell-path-env) |
| 230 | (concat (car args) path-separator | 239 | (concat eshell-path-env path-separator args))) |
| 231 | (getenv "PATH")) | 240 | (setenv "PATH" eshell-path-env)) |
| 232 | (concat (getenv "PATH") path-separator | 241 | (dolist (dir (parse-colon-path (getenv "PATH"))) |
| 233 | (car args)))) | 242 | (eshell-printn dir))))) |
| 234 | (setq args (cdr args)))) | ||
| 235 | (let ((paths (parse-colon-path (getenv "PATH")))) | ||
| 236 | (while paths | ||
| 237 | (eshell-printn (car paths)) | ||
| 238 | (setq paths (cdr paths))))))) | ||
| 239 | 243 | ||
| 240 | (put 'eshell/addpath 'eshell-no-numeric-conversions t) | 244 | (put 'eshell/addpath 'eshell-no-numeric-conversions t) |
| 241 | 245 | ||
diff --git a/lisp/eshell/esh-io.el b/lisp/eshell/esh-io.el index 71fae34b360..9f3cfe0f6d0 100644 --- a/lisp/eshell/esh-io.el +++ b/lisp/eshell/esh-io.el | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | ;;; esh-io.el --- I/O management | 1 | ;;; esh-io.el --- I/O management |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 1999-2011 Free Software Foundation, Inc. | 3 | ;; Copyright (C) 1999-2012 Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | ;; Author: John Wiegley <johnw@gnu.org> | 5 | ;; Author: John Wiegley <johnw@gnu.org> |
| 6 | 6 | ||
| @@ -59,7 +59,7 @@ | |||
| 59 | (provide 'esh-io) | 59 | (provide 'esh-io) |
| 60 | 60 | ||
| 61 | (eval-when-compile | 61 | (eval-when-compile |
| 62 | (require 'cl) | 62 | (require 'cl-lib) |
| 63 | (require 'eshell)) | 63 | (require 'eshell)) |
| 64 | 64 | ||
| 65 | (defgroup eshell-io nil | 65 | (defgroup eshell-io nil |
| @@ -298,7 +298,7 @@ completed successfully. RESULT is the quoted value of the last | |||
| 298 | command. If nil, then the meta variables for keeping track of the | 298 | command. If nil, then the meta variables for keeping track of the |
| 299 | last execution result should not be changed." | 299 | last execution result should not be changed." |
| 300 | (let ((idx 0)) | 300 | (let ((idx 0)) |
| 301 | (assert (or (not result) (eq (car result) 'quote))) | 301 | (cl-assert (or (not result) (eq (car result) 'quote))) |
| 302 | (setq eshell-last-command-status exit-code | 302 | (setq eshell-last-command-status exit-code |
| 303 | eshell-last-command-result (cadr result)) | 303 | eshell-last-command-result (cadr result)) |
| 304 | (while (< idx eshell-number-of-handles) | 304 | (while (< idx eshell-number-of-handles) |
diff --git a/lisp/eshell/esh-mode.el b/lisp/eshell/esh-mode.el index 43d56a5b89f..673632400f2 100644 --- a/lisp/eshell/esh-mode.el +++ b/lisp/eshell/esh-mode.el | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | ;;; esh-mode.el --- user interface | 1 | ;;; esh-mode.el --- user interface |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 1999-2011 Free Software Foundation, Inc. | 3 | ;; Copyright (C) 1999-2012 Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | ;; Author: John Wiegley <johnw@gnu.org> | 5 | ;; Author: John Wiegley <johnw@gnu.org> |
| 6 | 6 | ||
| @@ -193,8 +193,11 @@ This is used by `eshell-watch-for-password-prompt'." | |||
| 193 | :type '(choice (const nil) function) | 193 | :type '(choice (const nil) function) |
| 194 | :group 'eshell-mode) | 194 | :group 'eshell-mode) |
| 195 | 195 | ||
| 196 | (defcustom eshell-status-in-modeline t | 196 | (define-obsolete-variable-alias 'eshell-status-in-modeline |
| 197 | "If non-nil, let the user know a command is running in the modeline." | 197 | 'eshell-status-in-mode-line "24.3") |
| 198 | |||
| 199 | (defcustom eshell-status-in-mode-line t | ||
| 200 | "If non-nil, let the user know a command is running in the mode line." | ||
| 198 | :type 'boolean | 201 | :type 'boolean |
| 199 | :group 'eshell-mode) | 202 | :group 'eshell-mode) |
| 200 | 203 | ||
| @@ -314,14 +317,14 @@ and the hook `eshell-exit-hook'." | |||
| 314 | (setq eshell-mode-map (make-sparse-keymap)) | 317 | (setq eshell-mode-map (make-sparse-keymap)) |
| 315 | (use-local-map eshell-mode-map) | 318 | (use-local-map eshell-mode-map) |
| 316 | 319 | ||
| 317 | (when eshell-status-in-modeline | 320 | (when eshell-status-in-mode-line |
| 318 | (make-local-variable 'eshell-command-running-string) | 321 | (make-local-variable 'eshell-command-running-string) |
| 319 | (let ((fmt (copy-sequence mode-line-format))) | 322 | (let ((fmt (copy-sequence mode-line-format))) |
| 320 | (make-local-variable 'mode-line-format) | 323 | (make-local-variable 'mode-line-format) |
| 321 | (setq mode-line-format fmt)) | 324 | (setq mode-line-format fmt)) |
| 322 | (let ((modeline (memq 'mode-line-modified mode-line-format))) | 325 | (let ((mode-line-elt (memq 'mode-line-modified mode-line-format))) |
| 323 | (if modeline | 326 | (if mode-line-elt |
| 324 | (setcar modeline 'eshell-command-running-string)))) | 327 | (setcar mode-line-elt 'eshell-command-running-string)))) |
| 325 | 328 | ||
| 326 | (define-key eshell-mode-map [return] 'eshell-send-input) | 329 | (define-key eshell-mode-map [return] 'eshell-send-input) |
| 327 | (define-key eshell-mode-map [(control ?m)] 'eshell-send-input) | 330 | (define-key eshell-mode-map [(control ?m)] 'eshell-send-input) |
| @@ -434,7 +437,7 @@ and the hook `eshell-exit-hook'." | |||
| 434 | (when eshell-scroll-show-maximum-output | 437 | (when eshell-scroll-show-maximum-output |
| 435 | (set (make-local-variable 'scroll-conservatively) 1000)) | 438 | (set (make-local-variable 'scroll-conservatively) 1000)) |
| 436 | 439 | ||
| 437 | (when eshell-status-in-modeline | 440 | (when eshell-status-in-mode-line |
| 438 | (add-hook 'eshell-pre-command-hook 'eshell-command-started nil t) | 441 | (add-hook 'eshell-pre-command-hook 'eshell-command-started nil t) |
| 439 | (add-hook 'eshell-post-command-hook 'eshell-command-finished nil t)) | 442 | (add-hook 'eshell-post-command-hook 'eshell-command-finished nil t)) |
| 440 | 443 | ||
| @@ -448,12 +451,12 @@ and the hook `eshell-exit-hook'." | |||
| 448 | (put 'eshell-mode 'mode-class 'special) | 451 | (put 'eshell-mode 'mode-class 'special) |
| 449 | 452 | ||
| 450 | (defun eshell-command-started () | 453 | (defun eshell-command-started () |
| 451 | "Indicate in the modeline that a command has started." | 454 | "Indicate in the mode line that a command has started." |
| 452 | (setq eshell-command-running-string "**") | 455 | (setq eshell-command-running-string "**") |
| 453 | (force-mode-line-update)) | 456 | (force-mode-line-update)) |
| 454 | 457 | ||
| 455 | (defun eshell-command-finished () | 458 | (defun eshell-command-finished () |
| 456 | "Indicate in the modeline that a command has finished." | 459 | "Indicate in the mode line that a command has finished." |
| 457 | (setq eshell-command-running-string "--") | 460 | (setq eshell-command-running-string "--") |
| 458 | (force-mode-line-update)) | 461 | (force-mode-line-update)) |
| 459 | 462 | ||
diff --git a/lisp/eshell/esh-module.el b/lisp/eshell/esh-module.el index 1581d05889e..2e3c6b8b7b5 100644 --- a/lisp/eshell/esh-module.el +++ b/lisp/eshell/esh-module.el | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | ;;; esh-module.el --- Eshell modules | 1 | ;;; esh-module.el --- Eshell modules |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 1999-2000, 2002-2011 Free Software Foundation, Inc. | 3 | ;; Copyright (C) 1999-2000, 2002-2012 Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | ;; Author: John Wiegley <johnw@gnu.org> | 5 | ;; Author: John Wiegley <johnw@gnu.org> |
| 6 | ;; Keywords: processes | 6 | ;; Keywords: processes |
| @@ -36,7 +36,9 @@ customizing the variable `eshell-modules-list'." | |||
| 36 | 36 | ||
| 37 | ;; load the defgroup's for the standard extension modules, so that | 37 | ;; load the defgroup's for the standard extension modules, so that |
| 38 | ;; documentation can be provided when the user customize's | 38 | ;; documentation can be provided when the user customize's |
| 39 | ;; `eshell-modules-list'. | 39 | ;; `eshell-modules-list'. We use "(progn (defgroup ..." in each file |
| 40 | ;; to force the autoloader into including the entire defgroup, rather | ||
| 41 | ;; than an abbreviated version. | ||
| 40 | (load "esh-groups" nil 'nomessage) | 42 | (load "esh-groups" nil 'nomessage) |
| 41 | 43 | ||
| 42 | ;;; User Variables: | 44 | ;;; User Variables: |
diff --git a/lisp/eshell/esh-opt.el b/lisp/eshell/esh-opt.el index 91d3cac198a..fed2d8f1c62 100644 --- a/lisp/eshell/esh-opt.el +++ b/lisp/eshell/esh-opt.el | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | ;;; esh-opt.el --- command options processing | 1 | ;;; esh-opt.el --- command options processing |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 1999-2011 Free Software Foundation, Inc. | 3 | ;; Copyright (C) 1999-2012 Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | ;; Author: John Wiegley <johnw@gnu.org> | 5 | ;; Author: John Wiegley <johnw@gnu.org> |
| 6 | 6 | ||
| @@ -106,7 +106,9 @@ interned variable `args' (created using a `let' form)." | |||
| 106 | (and (listp opt) (nth 3 opt))) | 106 | (and (listp opt) (nth 3 opt))) |
| 107 | (cadr options))) | 107 | (cadr options))) |
| 108 | '(usage-msg last-value ext-command args)) | 108 | '(usage-msg last-value ext-command args)) |
| 109 | (eshell-do-opt ,name ,options (quote ,body-forms))))) | 109 | ;; FIXME: `options' ends up hiding some variable names under `quote', |
| 110 | ;; which is incompatible with lexical scoping!! | ||
| 111 | (eshell-do-opt ,name ,options (lambda () ,@body-forms))))) | ||
| 110 | 112 | ||
| 111 | ;;; Internal Functions: | 113 | ;;; Internal Functions: |
| 112 | 114 | ||
| @@ -117,7 +119,7 @@ interned variable `args' (created using a `let' form)." | |||
| 117 | ;; Documented part of the interface; see eshell-eval-using-options. | 119 | ;; Documented part of the interface; see eshell-eval-using-options. |
| 118 | (defvar args) | 120 | (defvar args) |
| 119 | 121 | ||
| 120 | (defun eshell-do-opt (name options body-forms) | 122 | (defun eshell-do-opt (name options body-fun) |
| 121 | "Helper function for `eshell-eval-using-options'. | 123 | "Helper function for `eshell-eval-using-options'. |
| 122 | This code doesn't really need to be macro expanded everywhere." | 124 | This code doesn't really need to be macro expanded everywhere." |
| 123 | (setq args temp-args) | 125 | (setq args temp-args) |
| @@ -133,8 +135,7 @@ This code doesn't really need to be macro expanded everywhere." | |||
| 133 | (throw 'eshell-usage | 135 | (throw 'eshell-usage |
| 134 | (eshell-show-usage name options))) | 136 | (eshell-show-usage name options))) |
| 135 | (setq args (eshell-process-args name args options) | 137 | (setq args (eshell-process-args name args options) |
| 136 | last-value (eval (append (list 'progn) | 138 | last-value (funcall body-fun)) |
| 137 | body-forms))) | ||
| 138 | nil)) | 139 | nil)) |
| 139 | (error "%s" usage-msg)))) | 140 | (error "%s" usage-msg)))) |
| 140 | (throw 'eshell-external | 141 | (throw 'eshell-external |
| @@ -218,10 +219,8 @@ switch is unrecognized." | |||
| 218 | found) | 219 | found) |
| 219 | (while opts | 220 | (while opts |
| 220 | (if (and (listp (car opts)) | 221 | (if (and (listp (car opts)) |
| 221 | (nth kind (car opts)) | 222 | (nth kind (car opts)) |
| 222 | (if (= kind 0) | 223 | (equal switch (nth kind (car opts)))) |
| 223 | (eq switch (nth kind (car opts))) | ||
| 224 | (string= switch (nth kind (car opts))))) | ||
| 225 | (progn | 224 | (progn |
| 226 | (eshell-set-option name ai (car opts) options) | 225 | (eshell-set-option name ai (car opts) options) |
| 227 | (setq found t opts nil)) | 226 | (setq found t opts nil)) |
diff --git a/lisp/eshell/esh-proc.el b/lisp/eshell/esh-proc.el index eeaccc4b890..f510f4b5329 100644 --- a/lisp/eshell/esh-proc.el +++ b/lisp/eshell/esh-proc.el | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | ;;; esh-proc.el --- process management | 1 | ;;; esh-proc.el --- process management |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 1999-2011 Free Software Foundation, Inc. | 3 | ;; Copyright (C) 1999-2012 Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | ;; Author: John Wiegley <johnw@gnu.org> | 5 | ;; Author: John Wiegley <johnw@gnu.org> |
| 6 | 6 | ||
diff --git a/lisp/eshell/esh-util.el b/lisp/eshell/esh-util.el index b508fd5352f..01df5fced62 100644 --- a/lisp/eshell/esh-util.el +++ b/lisp/eshell/esh-util.el | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | ;;; esh-util.el --- general utilities | 1 | ;;; esh-util.el --- general utilities |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 1999-2011 Free Software Foundation, Inc. | 3 | ;; Copyright (C) 1999-2012 Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | ;; Author: John Wiegley <johnw@gnu.org> | 5 | ;; Author: John Wiegley <johnw@gnu.org> |
| 6 | 6 | ||
| @@ -84,7 +84,7 @@ Numeric form is tested using the regular expression | |||
| 84 | NOTE: If you find that numeric conversions are interfering with the | 84 | NOTE: If you find that numeric conversions are interfering with the |
| 85 | specification of filenames (for example, in calling `find-file', or | 85 | specification of filenames (for example, in calling `find-file', or |
| 86 | some other Lisp function that deals with files, not numbers), add the | 86 | some other Lisp function that deals with files, not numbers), add the |
| 87 | following in your .emacs file: | 87 | following in your init file: |
| 88 | 88 | ||
| 89 | (put 'find-file 'eshell-no-numeric-conversions t) | 89 | (put 'find-file 'eshell-no-numeric-conversions t) |
| 90 | 90 | ||
| @@ -275,6 +275,7 @@ Prepend remote identification of `default-directory', if any." | |||
| 275 | 275 | ||
| 276 | (defmacro eshell-for (for-var for-list &rest forms) | 276 | (defmacro eshell-for (for-var for-list &rest forms) |
| 277 | "Iterate through a list." | 277 | "Iterate through a list." |
| 278 | (declare (obsolete dolist "24.1")) | ||
| 278 | (declare (indent 2)) | 279 | (declare (indent 2)) |
| 279 | `(let ((list-iter ,for-list)) | 280 | `(let ((list-iter ,for-list)) |
| 280 | (while list-iter | 281 | (while list-iter |
| @@ -282,9 +283,6 @@ Prepend remote identification of `default-directory', if any." | |||
| 282 | ,@forms) | 283 | ,@forms) |
| 283 | (setq list-iter (cdr list-iter))))) | 284 | (setq list-iter (cdr list-iter))))) |
| 284 | 285 | ||
| 285 | |||
| 286 | (make-obsolete 'eshell-for 'dolist "24.1") | ||
| 287 | |||
| 288 | (defun eshell-flatten-list (args) | 286 | (defun eshell-flatten-list (args) |
| 289 | "Flatten any lists within ARGS, so that there are no sublists." | 287 | "Flatten any lists within ARGS, so that there are no sublists." |
| 290 | (let ((new-list (list t))) | 288 | (let ((new-list (list t))) |
| @@ -483,7 +481,7 @@ list." | |||
| 483 | (insert-file-contents eshell-hosts-file) | 481 | (insert-file-contents eshell-hosts-file) |
| 484 | (goto-char (point-min)) | 482 | (goto-char (point-min)) |
| 485 | (while (re-search-forward | 483 | (while (re-search-forward |
| 486 | "^\\(\\S-+\\)\\s-+\\(\\S-+\\)\\(\\s-*\\(\\S-+\\)\\)?" nil t) | 484 | "^\\([^#[:space:]]+\\)\\s-+\\(\\S-+\\)\\(\\s-*\\(\\S-+\\)\\)?" nil t) |
| 487 | (if (match-string 1) | 485 | (if (match-string 1) |
| 488 | (add-to-list 'hosts (match-string 1))) | 486 | (add-to-list 'hosts (match-string 1))) |
| 489 | (if (match-string 2) | 487 | (if (match-string 2) |
diff --git a/lisp/eshell/esh-var.el b/lisp/eshell/esh-var.el index 03774396485..6a0e159e82e 100644 --- a/lisp/eshell/esh-var.el +++ b/lisp/eshell/esh-var.el | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | ;;; esh-var.el --- handling of variables | 1 | ;;; esh-var.el --- handling of variables |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 1999-2011 Free Software Foundation, Inc. | 3 | ;; Copyright (C) 1999-2012 Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | ;; Author: John Wiegley <johnw@gnu.org> | 5 | ;; Author: John Wiegley <johnw@gnu.org> |
| 6 | 6 | ||
| @@ -110,8 +110,8 @@ | |||
| 110 | (eval-when-compile | 110 | (eval-when-compile |
| 111 | (require 'pcomplete) | 111 | (require 'pcomplete) |
| 112 | (require 'esh-util) | 112 | (require 'esh-util) |
| 113 | (require 'esh-opt) | ||
| 114 | (require 'esh-mode)) | 113 | (require 'esh-mode)) |
| 114 | (require 'esh-opt) | ||
| 115 | (require 'env) | 115 | (require 'env) |
| 116 | (require 'ring) | 116 | (require 'ring) |
| 117 | 117 | ||
diff --git a/lisp/eshell/eshell.el b/lisp/eshell/eshell.el index 0c1c03941e5..a9a854221a4 100644 --- a/lisp/eshell/eshell.el +++ b/lisp/eshell/eshell.el | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | ;;; eshell.el --- the Emacs command shell | 1 | ;;; eshell.el --- the Emacs command shell |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 1999-2011 Free Software Foundation, Inc. | 3 | ;; Copyright (C) 1999-2012 Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | ;; Author: John Wiegley <johnw@gnu.org> | 5 | ;; Author: John Wiegley <johnw@gnu.org> |
| 6 | ;; Version: 2.4.2 | 6 | ;; Version: 2.4.2 |
| @@ -140,12 +140,12 @@ | |||
| 140 | ;; paragraph wasn't discovered until two months after I wrote the | 140 | ;; paragraph wasn't discovered until two months after I wrote the |
| 141 | ;; text; it was not intentional). | 141 | ;; text; it was not intentional). |
| 142 | ;; | 142 | ;; |
| 143 | ;; @ Emacs' register and bookmarking facilities can be used for | 143 | ;; @ Emacs's register and bookmarking facilities can be used for |
| 144 | ;; remembering where you've been, and what you've seen -- to varying | 144 | ;; remembering where you've been, and what you've seen -- to varying |
| 145 | ;; levels of persistence. They could perhaps even be tied to | 145 | ;; levels of persistence. They could perhaps even be tied to |
| 146 | ;; specific "moments" during eshell execution, which would include | 146 | ;; specific "moments" during eshell execution, which would include |
| 147 | ;; the environment at that time, as well as other variables. | 147 | ;; the environment at that time, as well as other variables. |
| 148 | ;; Although this would require functionality orthogonal to Emacs' | 148 | ;; Although this would require functionality orthogonal to Emacs's |
| 149 | ;; own bookmarking facilities, the interface used could be made to | 149 | ;; own bookmarking facilities, the interface used could be made to |
| 150 | ;; operate very similarly. | 150 | ;; operate very similarly. |
| 151 | ;; | 151 | ;; |
| @@ -222,36 +222,33 @@ | |||
| 222 | ;; things up. | 222 | ;; things up. |
| 223 | 223 | ||
| 224 | (eval-when-compile | 224 | (eval-when-compile |
| 225 | (require 'cl) | 225 | (require 'cl-lib) |
| 226 | (require 'esh-util)) | 226 | (require 'esh-util)) |
| 227 | (require 'esh-util) | 227 | (require 'esh-util) |
| 228 | (require 'esh-mode) | 228 | (require 'esh-mode) |
| 229 | 229 | ||
| 230 | (defgroup eshell nil | 230 | (defgroup eshell nil |
| 231 | "A command shell implemented entirely in Emacs Lisp. | 231 | "Command shell implemented entirely in Emacs Lisp. |
| 232 | It invokes no external processes beyond those requested by the | 232 | It invokes no external processes beyond those requested by the |
| 233 | user, and is intended to be a functional replacement for command | 233 | user, and is intended to be a functional replacement for command |
| 234 | shells such as bash, zsh, rc, 4dos." | 234 | shells such as bash, zsh, rc, 4dos." |
| 235 | :tag "The Emacs shell" | ||
| 236 | :link '(info-link "(eshell)Top") | 235 | :link '(info-link "(eshell)Top") |
| 237 | :version "21.1" | 236 | :version "21.1" |
| 238 | :group 'applications) | 237 | :group 'applications) |
| 239 | 238 | ||
| 240 | ;; This is hack to force make-autoload to put the whole definition | ||
| 241 | ;; into the autoload file (see esh-module.el). | ||
| 242 | (defalias 'eshell-defgroup 'defgroup) | ||
| 243 | |||
| 244 | ;;;_* User Options | 239 | ;;;_* User Options |
| 245 | ;; | 240 | ;; |
| 246 | ;; The following user options modify the behavior of Eshell overall. | 241 | ;; The following user options modify the behavior of Eshell overall. |
| 247 | (defvar eshell-buffer-name) | 242 | (defvar eshell-buffer-name) |
| 248 | 243 | ||
| 249 | (defsubst eshell-add-to-window-buffer-names () | 244 | (defun eshell-add-to-window-buffer-names () |
| 250 | "Add `eshell-buffer-name' to `same-window-buffer-names'." | 245 | "Add `eshell-buffer-name' to `same-window-buffer-names'." |
| 246 | (declare (obsolete nil "24.3")) | ||
| 251 | (add-to-list 'same-window-buffer-names eshell-buffer-name)) | 247 | (add-to-list 'same-window-buffer-names eshell-buffer-name)) |
| 252 | 248 | ||
| 253 | (defsubst eshell-remove-from-window-buffer-names () | 249 | (defun eshell-remove-from-window-buffer-names () |
| 254 | "Remove `eshell-buffer-name' from `same-window-buffer-names'." | 250 | "Remove `eshell-buffer-name' from `same-window-buffer-names'." |
| 251 | (declare (obsolete nil "24.3")) | ||
| 255 | (setq same-window-buffer-names | 252 | (setq same-window-buffer-names |
| 256 | (delete eshell-buffer-name same-window-buffer-names))) | 253 | (delete eshell-buffer-name same-window-buffer-names))) |
| 257 | 254 | ||
| @@ -260,23 +257,13 @@ shells such as bash, zsh, rc, 4dos." | |||
| 260 | :type 'hook | 257 | :type 'hook |
| 261 | :group 'eshell) | 258 | :group 'eshell) |
| 262 | 259 | ||
| 263 | (defcustom eshell-unload-hook | 260 | (defcustom eshell-unload-hook '(eshell-unload-all-modules) |
| 264 | '(eshell-remove-from-window-buffer-names | ||
| 265 | eshell-unload-all-modules) | ||
| 266 | "A hook run when Eshell is unloaded from memory." | 261 | "A hook run when Eshell is unloaded from memory." |
| 267 | :type 'hook | 262 | :type 'hook |
| 268 | :group 'eshell) | 263 | :group 'eshell) |
| 269 | 264 | ||
| 270 | (defcustom eshell-buffer-name "*eshell*" | 265 | (defcustom eshell-buffer-name "*eshell*" |
| 271 | "The basename used for Eshell buffers." | 266 | "The basename used for Eshell buffers." |
| 272 | :set (lambda (symbol value) | ||
| 273 | ;; remove the old value of `eshell-buffer-name', if present | ||
| 274 | (if (boundp 'eshell-buffer-name) | ||
| 275 | (eshell-remove-from-window-buffer-names)) | ||
| 276 | (set symbol value) | ||
| 277 | ;; add the new value | ||
| 278 | (eshell-add-to-window-buffer-names) | ||
| 279 | value) | ||
| 280 | :type 'string | 267 | :type 'string |
| 281 | :group 'eshell) | 268 | :group 'eshell) |
| 282 | 269 | ||
| @@ -303,7 +290,7 @@ switches to the session with that number, creating it if necessary. A | |||
| 303 | nonnumeric prefix arg means to create a new session. Returns the | 290 | nonnumeric prefix arg means to create a new session. Returns the |
| 304 | buffer selected (or created)." | 291 | buffer selected (or created)." |
| 305 | (interactive "P") | 292 | (interactive "P") |
| 306 | (assert eshell-buffer-name) | 293 | (cl-assert eshell-buffer-name) |
| 307 | (let ((buf (cond ((numberp arg) | 294 | (let ((buf (cond ((numberp arg) |
| 308 | (get-buffer-create (format "%s<%d>" | 295 | (get-buffer-create (format "%s<%d>" |
| 309 | eshell-buffer-name | 296 | eshell-buffer-name |
| @@ -312,13 +299,8 @@ buffer selected (or created)." | |||
| 312 | (generate-new-buffer eshell-buffer-name)) | 299 | (generate-new-buffer eshell-buffer-name)) |
| 313 | (t | 300 | (t |
| 314 | (get-buffer-create eshell-buffer-name))))) | 301 | (get-buffer-create eshell-buffer-name))))) |
| 315 | ;; Simply calling `pop-to-buffer' will not mimic the way that | 302 | (cl-assert (and buf (buffer-live-p buf))) |
| 316 | ;; shell-mode buffers appear, since they always reuse the same | 303 | (pop-to-buffer-same-window buf) |
| 317 | ;; window that that command was invoked from. To achieve this, | ||
| 318 | ;; it's necessary to add `eshell-buffer-name' to the variable | ||
| 319 | ;; `same-window-buffer-names', which is done when Eshell is loaded | ||
| 320 | (assert (and buf (buffer-live-p buf))) | ||
| 321 | (pop-to-buffer buf) | ||
| 322 | (unless (eq major-mode 'eshell-mode) | 304 | (unless (eq major-mode 'eshell-mode) |
| 323 | (eshell-mode)) | 305 | (eshell-mode)) |
| 324 | buf)) | 306 | buf)) |
| @@ -385,11 +367,11 @@ With prefix ARG, insert output into the current buffer at point." | |||
| 385 | (when intr | 367 | (when intr |
| 386 | (if (eshell-interactive-process) | 368 | (if (eshell-interactive-process) |
| 387 | (eshell-wait-for-process (eshell-interactive-process))) | 369 | (eshell-wait-for-process (eshell-interactive-process))) |
| 388 | (assert (not (eshell-interactive-process))) | 370 | (cl-assert (not (eshell-interactive-process))) |
| 389 | (goto-char (point-max)) | 371 | (goto-char (point-max)) |
| 390 | (while (and (bolp) (not (bobp))) | 372 | (while (and (bolp) (not (bobp))) |
| 391 | (delete-char -1))) | 373 | (delete-char -1))) |
| 392 | (assert (and buf (buffer-live-p buf))) | 374 | (cl-assert (and buf (buffer-live-p buf))) |
| 393 | (unless arg | 375 | (unless arg |
| 394 | (let ((len (if (not intr) 2 | 376 | (let ((len (if (not intr) 2 |
| 395 | (count-lines (point-min) (point-max))))) | 377 | (count-lines (point-min) (point-max))))) |
| @@ -429,7 +411,7 @@ corresponding to a successful execution." | |||
| 429 | (list 'eshell-commands | 411 | (list 'eshell-commands |
| 430 | (list 'eshell-command-to-value | 412 | (list 'eshell-command-to-value |
| 431 | (eshell-parse-command command))) t))) | 413 | (eshell-parse-command command))) t))) |
| 432 | (assert (eq (car result) 'quote)) | 414 | (cl-assert (eq (car result) 'quote)) |
| 433 | (if (and status-var (symbolp status-var)) | 415 | (if (and status-var (symbolp status-var)) |
| 434 | (set status-var eshell-last-command-status)) | 416 | (set status-var eshell-last-command-status)) |
| 435 | (cadr result)))))) | 417 | (cadr result)))))) |