diff options
author | Tassilo Horn <tsdh@gnu.org> | 2013-06-02 11:19:09 +0200 |
---|---|---|
committer | Tassilo Horn <tsdh@gnu.org> | 2013-06-02 11:19:09 +0200 |
commit | d105b0e26f965b41452153ad405efe98ff142de6 (patch) | |
tree | bf98e74bdf26d4be65559abee240ced7b8633b86 /lisp/eshell/em-term.el | |
parent | 8a621d5317e94977bb3e5e5ab2800b810d0297ee (diff) | |
download | emacs-d105b0e26f965b41452153ad405efe98ff142de6.tar.gz |
* eshell/esh-ext.el (eshell-external-command): Pass args to
`eshell-find-interpreter'.
(eshell-find-interpreter): Add new second parameter ARGS.
* eshell/em-script.el (eshell-script-initialize): Add second arg
to the function added as MATCH to `eshell-interpreter-alist'
* eshell/em-dirs.el (eshell-dirs-initialize): Add second arg to
the function added as MATCH to `eshell-interpreter-alist'
* eshell/em-term.el (eshell-visual-subcommands): New defcustom.
(eshell-visual-options): New defcustom.
(eshell-escape-control-x): Adapt docstring.
(eshell-term-initialize): Test `eshell-visual-subcommands' and
`eshell-visual-options' in addition to `eshell-visual-commands'.
(eshell-exec-visual): Pass args to `eshell-find-interpreter'.
Diffstat (limited to 'lisp/eshell/em-term.el')
-rw-r--r-- | lisp/eshell/em-term.el | 52 |
1 files changed, 46 insertions, 6 deletions
diff --git a/lisp/eshell/em-term.el b/lisp/eshell/em-term.el index e5360f2deb4..7875fbc9c80 100644 --- a/lisp/eshell/em-term.el +++ b/lisp/eshell/em-term.el @@ -65,6 +65,39 @@ which commands are considered visual in nature." :type '(repeat string) :group 'eshell-term) +(defcustom eshell-visual-subcommands + nil + "An alist of the form + + ((COMMAND1 SUBCOMMAND1 SUBCOMMAND2...) + (COMMAND2 SUBCOMMAND1 ...)) + +of commands with subcommands that present their output in a +visual fashion. A likely entry is + + (\"git\" \"log\" \"diff\" \"show\") + +because git shows logs and diffs using a pager by default." + :type '(repeat (cons (string :tag "Command") + (repeat (string :tag "Subcommand"))))) + +(defcustom eshell-visual-options + nil + "An alist of the form + + ((COMMAND1 OPTION1 OPTION2...) + (COMMAND2 OPTION1 ...)) + +of commands with options that present their output in a visual +fashion. For example, a sensible entry would be + + (\"git\" \"--help\") + +because \"git <command> --help\" shows the command's +documentation with a pager." + :type '(repeat (cons (string :tag "Command") + (repeat (string :tag "Option"))))) + ;; If you change this from term-term-name, you need to ensure that the ;; value you choose exists in the system's terminfo database. (Bug#12485) (defcustom eshell-term-name term-term-name @@ -77,8 +110,10 @@ used." (defcustom eshell-escape-control-x t "If non-nil, allow <C-x> to be handled by Emacs key in visual buffers. -See the variable `eshell-visual-commands'. If this variable is set to -nil, <C-x> will send that control character to the invoked process." +See the variables `eshell-visual-commands', +`eshell-visual-subcommands', and `eshell-visual-options'. If +this variable is set to nil, <C-x> will send that control +character to the invoked process." :type 'boolean :group 'eshell-term) @@ -93,9 +128,14 @@ nil, <C-x> will send that control character to the invoked process." (make-local-variable 'eshell-interpreter-alist) (setq eshell-interpreter-alist (cons (cons (function - (lambda (command) - (member (file-name-nondirectory command) - eshell-visual-commands))) + (lambda (command args) + (let ((command (file-name-nondirectory command))) + (or (member command eshell-visual-commands) + (member (car args) + (cdr (assoc command eshell-visual-subcommands))) + (intersection args + (cdr (assoc command eshell-visual-options)) + :test 'string=))))) 'eshell-exec-visual) eshell-interpreter-alist))) @@ -104,7 +144,7 @@ nil, <C-x> will send that control character to the invoked process." ARGS are passed to the program. At the moment, no piping of input is allowed." (let* (eshell-interpreter-alist - (interp (eshell-find-interpreter (car args))) + (interp (eshell-find-interpreter (car args) (cdr args))) (program (car interp)) (args (eshell-flatten-list (eshell-stringify-list (append (cdr interp) |