diff options
| author | Andrea Corallo | 2020-11-22 22:23:16 +0100 |
|---|---|---|
| committer | Andrea Corallo | 2020-11-22 22:23:16 +0100 |
| commit | 033e96055cc172d8d84adc128aee7f7d9889bb00 (patch) | |
| tree | 4e6e0a24c60f4c8776fb574bf31727dcaf4af4ba /lisp/eshell | |
| parent | 6781cd670d1487bbf0364d80de68ca9733342769 (diff) | |
| parent | 9b6ad3107f93d40f82c3c53dc0984c6d70aded83 (diff) | |
| download | emacs-033e96055cc172d8d84adc128aee7f7d9889bb00.tar.gz emacs-033e96055cc172d8d84adc128aee7f7d9889bb00.zip | |
Merge remote-tracking branch 'savannah/master' into HEAD
Diffstat (limited to 'lisp/eshell')
| -rw-r--r-- | lisp/eshell/em-basic.el | 9 | ||||
| -rw-r--r-- | lisp/eshell/em-cmpl.el | 53 | ||||
| -rw-r--r-- | lisp/eshell/em-dirs.el | 5 | ||||
| -rw-r--r-- | lisp/eshell/em-hist.el | 19 | ||||
| -rw-r--r-- | lisp/eshell/em-ls.el | 76 | ||||
| -rw-r--r-- | lisp/eshell/em-pred.el | 46 | ||||
| -rw-r--r-- | lisp/eshell/em-prompt.el | 7 | ||||
| -rw-r--r-- | lisp/eshell/em-smart.el | 25 | ||||
| -rw-r--r-- | lisp/eshell/em-unix.el | 5 | ||||
| -rw-r--r-- | lisp/eshell/esh-arg.el | 79 | ||||
| -rw-r--r-- | lisp/eshell/esh-cmd.el | 32 | ||||
| -rw-r--r-- | lisp/eshell/esh-mode.el | 58 | ||||
| -rw-r--r-- | lisp/eshell/esh-module.el | 19 | ||||
| -rw-r--r-- | lisp/eshell/esh-proc.el | 10 | ||||
| -rw-r--r-- | lisp/eshell/esh-var.el | 20 |
15 files changed, 214 insertions, 249 deletions
diff --git a/lisp/eshell/em-basic.el b/lisp/eshell/em-basic.el index 6cfc89cce62..e54eab50fc9 100644 --- a/lisp/eshell/em-basic.el +++ b/lisp/eshell/em-basic.el | |||
| @@ -90,11 +90,10 @@ or `eshell-printn' for display." | |||
| 90 | (car args)) | 90 | (car args)) |
| 91 | (t | 91 | (t |
| 92 | (mapcar | 92 | (mapcar |
| 93 | (function | 93 | (lambda (arg) |
| 94 | (lambda (arg) | 94 | (if (stringp arg) |
| 95 | (if (stringp arg) | 95 | (set-text-properties 0 (length arg) nil arg)) |
| 96 | (set-text-properties 0 (length arg) nil arg)) | 96 | arg) |
| 97 | arg)) | ||
| 98 | args))))) | 97 | args))))) |
| 99 | (if output-newline | 98 | (if output-newline |
| 100 | (cond | 99 | (cond |
diff --git a/lisp/eshell/em-cmpl.el b/lisp/eshell/em-cmpl.el index 8a444c91001..53a0cda354e 100644 --- a/lisp/eshell/em-cmpl.el +++ b/lisp/eshell/em-cmpl.el | |||
| @@ -210,9 +210,8 @@ to writing a completion function." | |||
| 210 | :group 'eshell-cmpl) | 210 | :group 'eshell-cmpl) |
| 211 | 211 | ||
| 212 | (defcustom eshell-command-completion-function | 212 | (defcustom eshell-command-completion-function |
| 213 | (function | 213 | (lambda () |
| 214 | (lambda () | 214 | (pcomplete-here (eshell-complete-commands-list))) |
| 215 | (pcomplete-here (eshell-complete-commands-list)))) | ||
| 216 | (eshell-cmpl--custom-variable-docstring 'pcomplete-command-completion-function) | 215 | (eshell-cmpl--custom-variable-docstring 'pcomplete-command-completion-function) |
| 217 | :type (get 'pcomplete-command-completion-function 'custom-type) | 216 | :type (get 'pcomplete-command-completion-function 'custom-type) |
| 218 | :group 'eshell-cmpl) | 217 | :group 'eshell-cmpl) |
| @@ -224,12 +223,11 @@ to writing a completion function." | |||
| 224 | :group 'eshell-cmpl) | 223 | :group 'eshell-cmpl) |
| 225 | 224 | ||
| 226 | (defcustom eshell-default-completion-function | 225 | (defcustom eshell-default-completion-function |
| 227 | (function | 226 | (lambda () |
| 228 | (lambda () | 227 | (while (pcomplete-here |
| 229 | (while (pcomplete-here | 228 | (pcomplete-dirs-or-entries |
| 230 | (pcomplete-dirs-or-entries | 229 | (cdr (assoc (funcall eshell-cmpl-command-name-function) |
| 231 | (cdr (assoc (funcall eshell-cmpl-command-name-function) | 230 | eshell-command-completions-alist)))))) |
| 232 | eshell-command-completions-alist))))))) | ||
| 233 | (eshell-cmpl--custom-variable-docstring 'pcomplete-default-completion-function) | 231 | (eshell-cmpl--custom-variable-docstring 'pcomplete-default-completion-function) |
| 234 | :type (get 'pcomplete-default-completion-function 'custom-type) | 232 | :type (get 'pcomplete-default-completion-function 'custom-type) |
| 235 | :group 'eshell-cmpl) | 233 | :group 'eshell-cmpl) |
| @@ -308,10 +306,9 @@ to writing a completion function." | |||
| 308 | ;; load-hooks for any other extension modules have been run, which | 306 | ;; load-hooks for any other extension modules have been run, which |
| 309 | ;; is true at the time `eshell-mode-hook' is run | 307 | ;; is true at the time `eshell-mode-hook' is run |
| 310 | (add-hook 'eshell-mode-hook | 308 | (add-hook 'eshell-mode-hook |
| 311 | (function | 309 | (lambda () |
| 312 | (lambda () | 310 | (set (make-local-variable 'comint-file-name-quote-list) |
| 313 | (set (make-local-variable 'comint-file-name-quote-list) | 311 | eshell-special-chars-outside-quoting)) |
| 314 | eshell-special-chars-outside-quoting))) | ||
| 315 | nil t) | 312 | nil t) |
| 316 | (add-hook 'pcomplete-quote-arg-hook #'eshell-quote-backslash nil t) | 313 | (add-hook 'pcomplete-quote-arg-hook #'eshell-quote-backslash nil t) |
| 317 | (add-hook 'completion-at-point-functions | 314 | (add-hook 'completion-at-point-functions |
| @@ -391,19 +388,18 @@ to writing a completion function." | |||
| 391 | (nconc args (list "")) | 388 | (nconc args (list "")) |
| 392 | (nconc posns (list (point)))) | 389 | (nconc posns (list (point)))) |
| 393 | (cons (mapcar | 390 | (cons (mapcar |
| 394 | (function | 391 | (lambda (arg) |
| 395 | (lambda (arg) | 392 | (let ((val |
| 396 | (let ((val | 393 | (if (listp arg) |
| 397 | (if (listp arg) | 394 | (let ((result |
| 398 | (let ((result | 395 | (eshell-do-eval |
| 399 | (eshell-do-eval | 396 | (list 'eshell-commands arg) t))) |
| 400 | (list 'eshell-commands arg) t))) | 397 | (cl-assert (eq (car result) 'quote)) |
| 401 | (cl-assert (eq (car result) 'quote)) | 398 | (cadr result)) |
| 402 | (cadr result)) | 399 | arg))) |
| 403 | arg))) | 400 | (if (numberp val) |
| 404 | (if (numberp val) | 401 | (setq val (number-to-string val))) |
| 405 | (setq val (number-to-string val))) | 402 | (or val ""))) |
| 406 | (or val "")))) | ||
| 407 | args) | 403 | args) |
| 408 | posns))) | 404 | posns))) |
| 409 | 405 | ||
| @@ -454,9 +450,8 @@ to writing a completion function." | |||
| 454 | (eshell-alias-completions filename)) | 450 | (eshell-alias-completions filename)) |
| 455 | (eshell-winnow-list | 451 | (eshell-winnow-list |
| 456 | (mapcar | 452 | (mapcar |
| 457 | (function | 453 | (lambda (name) |
| 458 | (lambda (name) | 454 | (substring name 7)) |
| 459 | (substring name 7))) | ||
| 460 | (all-completions (concat "eshell/" filename) | 455 | (all-completions (concat "eshell/" filename) |
| 461 | obarray #'functionp)) | 456 | obarray #'functionp)) |
| 462 | nil '(eshell-find-alias-function)) | 457 | nil '(eshell-find-alias-function)) |
diff --git a/lisp/eshell/em-dirs.el b/lisp/eshell/em-dirs.el index 51df6fa1d52..b4ed3794add 100644 --- a/lisp/eshell/em-dirs.el +++ b/lisp/eshell/em-dirs.el | |||
| @@ -289,9 +289,8 @@ Thus, this does not include the current directory.") | |||
| 289 | (eshell-read-user-names) | 289 | (eshell-read-user-names) |
| 290 | (pcomplete-uniquify-list | 290 | (pcomplete-uniquify-list |
| 291 | (mapcar | 291 | (mapcar |
| 292 | (function | 292 | (lambda (user) |
| 293 | (lambda (user) | 293 | (file-name-as-directory (cdr user))) |
| 294 | (file-name-as-directory (cdr user)))) | ||
| 295 | eshell-user-names))))))) | 294 | eshell-user-names))))))) |
| 296 | 295 | ||
| 297 | (defun eshell/pwd (&rest _args) | 296 | (defun eshell/pwd (&rest _args) |
diff --git a/lisp/eshell/em-hist.el b/lisp/eshell/em-hist.el index bdc21c916c6..c27e4503767 100644 --- a/lisp/eshell/em-hist.el +++ b/lisp/eshell/em-hist.el | |||
| @@ -79,9 +79,8 @@ | |||
| 79 | 79 | ||
| 80 | (defcustom eshell-hist-unload-hook | 80 | (defcustom eshell-hist-unload-hook |
| 81 | (list | 81 | (list |
| 82 | (function | 82 | (lambda () |
| 83 | (lambda () | 83 | (remove-hook 'kill-emacs-hook 'eshell-save-some-history))) |
| 84 | (remove-hook 'kill-emacs-hook 'eshell-save-some-history)))) | ||
| 85 | "A hook that gets run when `eshell-hist' is unloaded." | 84 | "A hook that gets run when `eshell-hist' is unloaded." |
| 86 | :type 'hook) | 85 | :type 'hook) |
| 87 | 86 | ||
| @@ -250,16 +249,14 @@ Returns nil if INPUT is prepended by blank space, otherwise non-nil." | |||
| 250 | (set (make-local-variable 'search-invisible) t) | 249 | (set (make-local-variable 'search-invisible) t) |
| 251 | (set (make-local-variable 'search-exit-option) t) | 250 | (set (make-local-variable 'search-exit-option) t) |
| 252 | (add-hook 'isearch-mode-hook | 251 | (add-hook 'isearch-mode-hook |
| 253 | (function | 252 | (lambda () |
| 254 | (lambda () | 253 | (if (>= (point) eshell-last-output-end) |
| 255 | (if (>= (point) eshell-last-output-end) | 254 | (setq overriding-terminal-local-map |
| 256 | (setq overriding-terminal-local-map | 255 | eshell-isearch-map))) |
| 257 | eshell-isearch-map)))) | ||
| 258 | nil t) | 256 | nil t) |
| 259 | (add-hook 'isearch-mode-end-hook | 257 | (add-hook 'isearch-mode-end-hook |
| 260 | (function | 258 | (lambda () |
| 261 | (lambda () | 259 | (setq overriding-terminal-local-map nil)) |
| 262 | (setq overriding-terminal-local-map nil))) | ||
| 263 | nil t)) | 260 | nil t)) |
| 264 | (eshell-hist-mode)) | 261 | (eshell-hist-mode)) |
| 265 | 262 | ||
diff --git a/lisp/eshell/em-ls.el b/lisp/eshell/em-ls.el index c1a022ee521..6b306f77874 100644 --- a/lisp/eshell/em-ls.el +++ b/lisp/eshell/em-ls.el | |||
| @@ -270,8 +270,7 @@ instead." | |||
| 270 | eshell-current-subjob-p | 270 | eshell-current-subjob-p |
| 271 | font-lock-mode) | 271 | font-lock-mode) |
| 272 | ;; use the fancy highlighting in `eshell-ls' rather than font-lock | 272 | ;; use the fancy highlighting in `eshell-ls' rather than font-lock |
| 273 | (when (and eshell-ls-use-colors | 273 | (when eshell-ls-use-colors |
| 274 | (featurep 'font-lock)) | ||
| 275 | (font-lock-mode -1) | 274 | (font-lock-mode -1) |
| 276 | (setq font-lock-defaults nil) | 275 | (setq font-lock-defaults nil) |
| 277 | (if (boundp 'font-lock-buffers) | 276 | (if (boundp 'font-lock-buffers) |
| @@ -631,38 +630,37 @@ In Eshell's implementation of ls, ENTRIES is always reversed." | |||
| 631 | (if (eq sort-method 'unsorted) | 630 | (if (eq sort-method 'unsorted) |
| 632 | (nreverse entries) | 631 | (nreverse entries) |
| 633 | (sort entries | 632 | (sort entries |
| 634 | (function | 633 | (lambda (l r) |
| 635 | (lambda (l r) | 634 | (let ((result |
| 636 | (let ((result | 635 | (cond |
| 637 | (cond | 636 | ((eq sort-method 'by-atime) |
| 638 | ((eq sort-method 'by-atime) | 637 | (eshell-ls-compare-entries l r 4 'time-less-p)) |
| 639 | (eshell-ls-compare-entries l r 4 'time-less-p)) | 638 | ((eq sort-method 'by-mtime) |
| 640 | ((eq sort-method 'by-mtime) | 639 | (eshell-ls-compare-entries l r 5 'time-less-p)) |
| 641 | (eshell-ls-compare-entries l r 5 'time-less-p)) | 640 | ((eq sort-method 'by-ctime) |
| 642 | ((eq sort-method 'by-ctime) | 641 | (eshell-ls-compare-entries l r 6 'time-less-p)) |
| 643 | (eshell-ls-compare-entries l r 6 'time-less-p)) | 642 | ((eq sort-method 'by-size) |
| 644 | ((eq sort-method 'by-size) | 643 | (eshell-ls-compare-entries l r 7 '<)) |
| 645 | (eshell-ls-compare-entries l r 7 '<)) | 644 | ((eq sort-method 'by-extension) |
| 646 | ((eq sort-method 'by-extension) | 645 | (let ((lx (file-name-extension |
| 647 | (let ((lx (file-name-extension | 646 | (directory-file-name (car l)))) |
| 648 | (directory-file-name (car l)))) | 647 | (rx (file-name-extension |
| 649 | (rx (file-name-extension | 648 | (directory-file-name (car r))))) |
| 650 | (directory-file-name (car r))))) | 649 | (cond |
| 651 | (cond | 650 | ((or (and (not lx) (not rx)) |
| 652 | ((or (and (not lx) (not rx)) | 651 | (equal lx rx)) |
| 653 | (equal lx rx)) | 652 | (string-lessp (directory-file-name (car l)) |
| 654 | (string-lessp (directory-file-name (car l)) | 653 | (directory-file-name (car r)))) |
| 655 | (directory-file-name (car r)))) | 654 | ((not lx) t) |
| 656 | ((not lx) t) | 655 | ((not rx) nil) |
| 657 | ((not rx) nil) | 656 | (t |
| 658 | (t | 657 | (string-lessp lx rx))))) |
| 659 | (string-lessp lx rx))))) | 658 | (t |
| 660 | (t | 659 | (string-lessp (directory-file-name (car l)) |
| 661 | (string-lessp (directory-file-name (car l)) | 660 | (directory-file-name (car r))))))) |
| 662 | (directory-file-name (car r))))))) | 661 | (if reverse-list |
| 663 | (if reverse-list | 662 | (not result) |
| 664 | (not result) | 663 | result)))))) |
| 665 | result))))))) | ||
| 666 | 664 | ||
| 667 | (defun eshell-ls-files (files &optional size-width copy-fileinfo) | 665 | (defun eshell-ls-files (files &optional size-width copy-fileinfo) |
| 668 | "Output a list of FILES. | 666 | "Output a list of FILES. |
| @@ -799,9 +797,8 @@ to use, and each member of which is the width of that column | |||
| 799 | (width 0) | 797 | (width 0) |
| 800 | (widths | 798 | (widths |
| 801 | (mapcar | 799 | (mapcar |
| 802 | (function | 800 | (lambda (file) |
| 803 | (lambda (file) | 801 | (+ 2 (length (car file)))) |
| 804 | (+ 2 (length (car file))))) | ||
| 805 | files)) | 802 | files)) |
| 806 | ;; must account for the added space... | 803 | ;; must account for the added space... |
| 807 | (max-width (+ (window-width) 2)) | 804 | (max-width (+ (window-width) 2)) |
| @@ -846,9 +843,8 @@ to use, and each member of which is the width of that column | |||
| 846 | (width 0) | 843 | (width 0) |
| 847 | (widths | 844 | (widths |
| 848 | (mapcar | 845 | (mapcar |
| 849 | (function | 846 | (lambda (file) |
| 850 | (lambda (file) | 847 | (+ 2 (length (car file)))) |
| 851 | (+ 2 (length (car file))))) | ||
| 852 | files)) | 848 | files)) |
| 853 | (max-width (+ (window-width) 2)) | 849 | (max-width (+ (window-width) 2)) |
| 854 | col-widths | 850 | col-widths |
diff --git a/lisp/eshell/em-pred.el b/lisp/eshell/em-pred.el index 59139da10db..7b9503917c4 100644 --- a/lisp/eshell/em-pred.el +++ b/lisp/eshell/em-pred.el | |||
| @@ -116,10 +116,9 @@ The format of each entry is | |||
| 116 | (defcustom eshell-modifier-alist | 116 | (defcustom eshell-modifier-alist |
| 117 | '((?E . #'(lambda (lst) | 117 | '((?E . #'(lambda (lst) |
| 118 | (mapcar | 118 | (mapcar |
| 119 | (function | 119 | (lambda (str) |
| 120 | (lambda (str) | 120 | (eshell-stringify |
| 121 | (eshell-stringify | 121 | (car (eshell-parse-argument str)))) |
| 122 | (car (eshell-parse-argument str))))) | ||
| 123 | lst))) | 122 | lst))) |
| 124 | (?L . #'(lambda (lst) (mapcar 'downcase lst))) | 123 | (?L . #'(lambda (lst) (mapcar 'downcase lst))) |
| 125 | (?U . #'(lambda (lst) (mapcar 'upcase lst))) | 124 | (?U . #'(lambda (lst) (mapcar 'upcase lst))) |
| @@ -240,16 +239,14 @@ EXAMPLES: | |||
| 240 | (defun eshell-display-predicate-help () | 239 | (defun eshell-display-predicate-help () |
| 241 | (interactive) | 240 | (interactive) |
| 242 | (with-electric-help | 241 | (with-electric-help |
| 243 | (function | 242 | (lambda () |
| 244 | (lambda () | 243 | (insert eshell-predicate-help-string)))) |
| 245 | (insert eshell-predicate-help-string))))) | ||
| 246 | 244 | ||
| 247 | (defun eshell-display-modifier-help () | 245 | (defun eshell-display-modifier-help () |
| 248 | (interactive) | 246 | (interactive) |
| 249 | (with-electric-help | 247 | (with-electric-help |
| 250 | (function | 248 | (lambda () |
| 251 | (lambda () | 249 | (insert eshell-modifier-help-string)))) |
| 252 | (insert eshell-modifier-help-string))))) | ||
| 253 | 250 | ||
| 254 | (define-minor-mode eshell-pred-mode | 251 | (define-minor-mode eshell-pred-mode |
| 255 | "Minor mode for the eshell-pred module. | 252 | "Minor mode for the eshell-pred module. |
| @@ -544,20 +541,20 @@ that `ls -l' will show in the first column of its display." | |||
| 544 | (if repeat | 541 | (if repeat |
| 545 | `(lambda (lst) | 542 | `(lambda (lst) |
| 546 | (mapcar | 543 | (mapcar |
| 547 | (function | 544 | (lambda (str) |
| 548 | (lambda (str) | 545 | (let ((i 0)) |
| 549 | (let ((i 0)) | 546 | (while (setq i (string-match ,match str i)) |
| 550 | (while (setq i (string-match ,match str i)) | 547 | (setq str (replace-match ,replace t nil str)))) |
| 551 | (setq str (replace-match ,replace t nil str)))) | 548 | str) |
| 552 | str)) lst)) | 549 | lst)) |
| 553 | `(lambda (lst) | 550 | `(lambda (lst) |
| 554 | (mapcar | 551 | (mapcar |
| 555 | (function | 552 | (lambda (str) |
| 556 | (lambda (str) | 553 | (if (string-match ,match str) |
| 557 | (if (string-match ,match str) | 554 | (setq str (replace-match ,replace t nil str)) |
| 558 | (setq str (replace-match ,replace t nil str)) | 555 | (error (concat str ": substitution failed"))) |
| 559 | (error (concat str ": substitution failed"))) | 556 | str) |
| 560 | str)) lst))))) | 557 | lst))))) |
| 561 | 558 | ||
| 562 | (defun eshell-include-members (&optional invert-p) | 559 | (defun eshell-include-members (&optional invert-p) |
| 563 | "Include only lisp members matching a regexp." | 560 | "Include only lisp members matching a regexp." |
| @@ -598,9 +595,8 @@ that `ls -l' will show in the first column of its display." | |||
| 598 | (goto-char (1+ end))) | 595 | (goto-char (1+ end))) |
| 599 | `(lambda (lst) | 596 | `(lambda (lst) |
| 600 | (mapcar | 597 | (mapcar |
| 601 | (function | 598 | (lambda (str) |
| 602 | (lambda (str) | 599 | (split-string str ,sep)) lst)))) |
| 603 | (split-string str ,sep))) lst)))) | ||
| 604 | 600 | ||
| 605 | (provide 'em-pred) | 601 | (provide 'em-pred) |
| 606 | 602 | ||
diff --git a/lisp/eshell/em-prompt.el b/lisp/eshell/em-prompt.el index 9ae5ae12816..dcee1e7a981 100644 --- a/lisp/eshell/em-prompt.el +++ b/lisp/eshell/em-prompt.el | |||
| @@ -48,10 +48,9 @@ as is common with most shells." | |||
| 48 | (autoload 'eshell/pwd "em-dirs") | 48 | (autoload 'eshell/pwd "em-dirs") |
| 49 | 49 | ||
| 50 | (defcustom eshell-prompt-function | 50 | (defcustom eshell-prompt-function |
| 51 | (function | 51 | (lambda () |
| 52 | (lambda () | 52 | (concat (abbreviate-file-name (eshell/pwd)) |
| 53 | (concat (abbreviate-file-name (eshell/pwd)) | 53 | (if (= (user-uid) 0) " # " " $ "))) |
| 54 | (if (= (user-uid) 0) " # " " $ ")))) | ||
| 55 | "A function that returns the Eshell prompt string. | 54 | "A function that returns the Eshell prompt string. |
| 56 | Make sure to update `eshell-prompt-regexp' so that it will match your | 55 | Make sure to update `eshell-prompt-regexp' so that it will match your |
| 57 | prompt." | 56 | prompt." |
diff --git a/lisp/eshell/em-smart.el b/lisp/eshell/em-smart.el index f173c8db9c1..a28bb1d6415 100644 --- a/lisp/eshell/em-smart.el +++ b/lisp/eshell/em-smart.el | |||
| @@ -94,10 +94,9 @@ it to get a real sense of how it works." | |||
| 94 | 94 | ||
| 95 | (defcustom eshell-smart-unload-hook | 95 | (defcustom eshell-smart-unload-hook |
| 96 | (list | 96 | (list |
| 97 | (function | 97 | (lambda () |
| 98 | (lambda () | 98 | (remove-hook 'window-configuration-change-hook |
| 99 | (remove-hook 'window-configuration-change-hook | 99 | 'eshell-refresh-windows))) |
| 100 | 'eshell-refresh-windows)))) | ||
| 101 | "A hook that gets run when `eshell-smart' is unloaded." | 100 | "A hook that gets run when `eshell-smart' is unloaded." |
| 102 | :type 'hook | 101 | :type 'hook |
| 103 | :group 'eshell-smart) | 102 | :group 'eshell-smart) |
| @@ -186,9 +185,8 @@ The options are `begin', `after' or `end'." | |||
| 186 | 185 | ||
| 187 | (make-local-variable 'eshell-smart-command-done) | 186 | (make-local-variable 'eshell-smart-command-done) |
| 188 | (add-hook 'eshell-post-command-hook | 187 | (add-hook 'eshell-post-command-hook |
| 189 | (function | 188 | (lambda () |
| 190 | (lambda () | 189 | (setq eshell-smart-command-done t)) |
| 191 | (setq eshell-smart-command-done t))) | ||
| 192 | t t) | 190 | t t) |
| 193 | 191 | ||
| 194 | (unless (eq eshell-review-quick-commands t) | 192 | (unless (eq eshell-review-quick-commands t) |
| @@ -208,13 +206,12 @@ The options are `begin', `after' or `end'." | |||
| 208 | "Refresh all visible Eshell buffers." | 206 | "Refresh all visible Eshell buffers." |
| 209 | (let (affected) | 207 | (let (affected) |
| 210 | (walk-windows | 208 | (walk-windows |
| 211 | (function | 209 | (lambda (wind) |
| 212 | (lambda (wind) | 210 | (with-current-buffer (window-buffer wind) |
| 213 | (with-current-buffer (window-buffer wind) | 211 | (if eshell-mode |
| 214 | (if eshell-mode | 212 | (let (window-scroll-functions) ;;FIXME: Why? |
| 215 | (let (window-scroll-functions) ;;FIXME: Why? | 213 | (eshell-smart-scroll-window wind (window-start)) |
| 216 | (eshell-smart-scroll-window wind (window-start)) | 214 | (setq affected t))))) |
| 217 | (setq affected t)))))) | ||
| 218 | 0 frame) | 215 | 0 frame) |
| 219 | (if affected | 216 | (if affected |
| 220 | (let (window-scroll-functions) ;;FIXME: Why? | 217 | (let (window-scroll-functions) ;;FIXME: Why? |
diff --git a/lisp/eshell/em-unix.el b/lisp/eshell/em-unix.el index 937b8bfa391..18818648bc4 100644 --- a/lisp/eshell/em-unix.el +++ b/lisp/eshell/em-unix.el | |||
| @@ -419,9 +419,8 @@ Remove the DIRECTORY(ies), if they are empty.") | |||
| 419 | (apply 'eshell-shuffle-files | 419 | (apply 'eshell-shuffle-files |
| 420 | command action | 420 | command action |
| 421 | (mapcar | 421 | (mapcar |
| 422 | (function | 422 | (lambda (file) |
| 423 | (lambda (file) | 423 | (concat source "/" file)) |
| 424 | (concat source "/" file))) | ||
| 425 | (directory-files source)) | 424 | (directory-files source)) |
| 426 | target func t args) | 425 | target func t args) |
| 427 | (when (eq func 'rename-file) | 426 | (when (eq func 'rename-file) |
diff --git a/lisp/eshell/esh-arg.el b/lisp/eshell/esh-arg.el index e7b07b4208d..aefda647689 100644 --- a/lisp/eshell/esh-arg.el +++ b/lisp/eshell/esh-arg.el | |||
| @@ -85,51 +85,48 @@ If POS is nil, the location of point is checked." | |||
| 85 | 'eshell-parse-special-reference | 85 | 'eshell-parse-special-reference |
| 86 | 86 | ||
| 87 | ;; numbers convert to numbers if they stand alone | 87 | ;; numbers convert to numbers if they stand alone |
| 88 | (function | 88 | (lambda () |
| 89 | (lambda () | 89 | (when (and (not eshell-current-argument) |
| 90 | (when (and (not eshell-current-argument) | 90 | (not eshell-current-quoted) |
| 91 | (not eshell-current-quoted) | 91 | (looking-at eshell-number-regexp) |
| 92 | (looking-at eshell-number-regexp) | 92 | (eshell-arg-delimiter (match-end 0))) |
| 93 | (eshell-arg-delimiter (match-end 0))) | 93 | (goto-char (match-end 0)) |
| 94 | (goto-char (match-end 0)) | 94 | (let ((str (match-string 0))) |
| 95 | (let ((str (match-string 0))) | 95 | (if (> (length str) 0) |
| 96 | (if (> (length str) 0) | 96 | (add-text-properties 0 (length str) '(number t) str)) |
| 97 | (add-text-properties 0 (length str) '(number t) str)) | 97 | str))) |
| 98 | str)))) | ||
| 99 | 98 | ||
| 100 | ;; parse any non-special characters, based on the current context | 99 | ;; parse any non-special characters, based on the current context |
| 101 | (function | 100 | (lambda () |
| 102 | (lambda () | 101 | (unless eshell-inside-quote-regexp |
| 103 | (unless eshell-inside-quote-regexp | 102 | (setq eshell-inside-quote-regexp |
| 104 | (setq eshell-inside-quote-regexp | 103 | (format "[^%s]+" |
| 105 | (format "[^%s]+" | 104 | (apply 'string eshell-special-chars-inside-quoting)))) |
| 106 | (apply 'string eshell-special-chars-inside-quoting)))) | 105 | (unless eshell-outside-quote-regexp |
| 107 | (unless eshell-outside-quote-regexp | 106 | (setq eshell-outside-quote-regexp |
| 108 | (setq eshell-outside-quote-regexp | 107 | (format "[^%s]+" |
| 109 | (format "[^%s]+" | 108 | (apply 'string eshell-special-chars-outside-quoting)))) |
| 110 | (apply 'string eshell-special-chars-outside-quoting)))) | 109 | (when (looking-at (if eshell-current-quoted |
| 111 | (when (looking-at (if eshell-current-quoted | 110 | eshell-inside-quote-regexp |
| 112 | eshell-inside-quote-regexp | 111 | eshell-outside-quote-regexp)) |
| 113 | eshell-outside-quote-regexp)) | 112 | (goto-char (match-end 0)) |
| 114 | (goto-char (match-end 0)) | 113 | (let ((str (match-string 0))) |
| 115 | (let ((str (match-string 0))) | 114 | (if str |
| 116 | (if str | 115 | (set-text-properties 0 (length str) nil str)) |
| 117 | (set-text-properties 0 (length str) nil str)) | 116 | str))) |
| 118 | str)))) | ||
| 119 | 117 | ||
| 120 | ;; whitespace or a comment is an argument delimiter | 118 | ;; whitespace or a comment is an argument delimiter |
| 121 | (function | 119 | (lambda () |
| 122 | (lambda () | 120 | (let (comment-p) |
| 123 | (let (comment-p) | 121 | (when (or (looking-at "[ \t]+") |
| 124 | (when (or (looking-at "[ \t]+") | 122 | (and (not eshell-current-argument) |
| 125 | (and (not eshell-current-argument) | 123 | (looking-at "#\\([^<'].*\\|$\\)") |
| 126 | (looking-at "#\\([^<'].*\\|$\\)") | 124 | (setq comment-p t))) |
| 127 | (setq comment-p t))) | 125 | (if comment-p |
| 128 | (if comment-p | 126 | (add-text-properties (match-beginning 0) (match-end 0) |
| 129 | (add-text-properties (match-beginning 0) (match-end 0) | 127 | '(comment t))) |
| 130 | '(comment t))) | 128 | (goto-char (match-end 0)) |
| 131 | (goto-char (match-end 0)) | 129 | (eshell-finish-arg)))) |
| 132 | (eshell-finish-arg))))) | ||
| 133 | 130 | ||
| 134 | ;; parse backslash and the character after | 131 | ;; parse backslash and the character after |
| 135 | 'eshell-parse-backslash | 132 | 'eshell-parse-backslash |
diff --git a/lisp/eshell/esh-cmd.el b/lisp/eshell/esh-cmd.el index e0348ba5013..68b34837a23 100644 --- a/lisp/eshell/esh-cmd.el +++ b/lisp/eshell/esh-cmd.el | |||
| @@ -304,10 +304,9 @@ otherwise t.") | |||
| 304 | ;; situation can occur, for example, if a Lisp function results in | 304 | ;; situation can occur, for example, if a Lisp function results in |
| 305 | ;; `debug' being called, and the user then types \\[top-level] | 305 | ;; `debug' being called, and the user then types \\[top-level] |
| 306 | (add-hook 'eshell-post-command-hook | 306 | (add-hook 'eshell-post-command-hook |
| 307 | (function | 307 | (lambda () |
| 308 | (lambda () | 308 | (setq eshell-current-command nil |
| 309 | (setq eshell-current-command nil | 309 | eshell-last-async-proc nil)) |
| 310 | eshell-last-async-proc nil))) | ||
| 311 | nil t) | 310 | nil t) |
| 312 | 311 | ||
| 313 | (add-hook 'eshell-parse-argument-hook | 312 | (add-hook 'eshell-parse-argument-hook |
| @@ -355,18 +354,17 @@ hooks should be run before and after the command." | |||
| 355 | args)) | 354 | args)) |
| 356 | (commands | 355 | (commands |
| 357 | (mapcar | 356 | (mapcar |
| 358 | (function | 357 | (lambda (cmd) |
| 359 | (lambda (cmd) | 358 | (setq cmd |
| 360 | (setq cmd | 359 | (if (or (not (car eshell--sep-terms)) |
| 361 | (if (or (not (car eshell--sep-terms)) | 360 | (string= (car eshell--sep-terms) ";")) |
| 362 | (string= (car eshell--sep-terms) ";")) | 361 | (eshell-parse-pipeline cmd) |
| 363 | (eshell-parse-pipeline cmd) | 362 | `(eshell-do-subjob |
| 364 | `(eshell-do-subjob | 363 | (list ,(eshell-parse-pipeline cmd))))) |
| 365 | (list ,(eshell-parse-pipeline cmd))))) | 364 | (setq eshell--sep-terms (cdr eshell--sep-terms)) |
| 366 | (setq eshell--sep-terms (cdr eshell--sep-terms)) | 365 | (if eshell-in-pipeline-p |
| 367 | (if eshell-in-pipeline-p | 366 | cmd |
| 368 | cmd | 367 | `(eshell-trap-errors ,cmd))) |
| 369 | `(eshell-trap-errors ,cmd)))) | ||
| 370 | (eshell-separate-commands terms "[&;]" nil 'eshell--sep-terms)))) | 368 | (eshell-separate-commands terms "[&;]" nil 'eshell--sep-terms)))) |
| 371 | (let ((cmd commands)) | 369 | (let ((cmd commands)) |
| 372 | (while cmd | 370 | (while cmd |
| @@ -920,7 +918,7 @@ at the moment are: | |||
| 920 | (funcall pred name)) | 918 | (funcall pred name)) |
| 921 | (throw 'simple nil))) | 919 | (throw 'simple nil))) |
| 922 | t)) | 920 | t)) |
| 923 | (fboundp (intern-soft (concat "eshell/" name)))))) | 921 | (eshell-find-alias-function name)))) |
| 924 | 922 | ||
| 925 | (defun eshell-eval-command (command &optional input) | 923 | (defun eshell-eval-command (command &optional input) |
| 926 | "Evaluate the given COMMAND iteratively." | 924 | "Evaluate the given COMMAND iteratively." |
diff --git a/lisp/eshell/esh-mode.el b/lisp/eshell/esh-mode.el index e0e86348bd8..a80c2fc60d9 100644 --- a/lisp/eshell/esh-mode.el +++ b/lisp/eshell/esh-mode.el | |||
| @@ -742,13 +742,12 @@ This function should be a pre-command hook." | |||
| 742 | (if (eq scroll 'this) | 742 | (if (eq scroll 'this) |
| 743 | (goto-char (point-max)) | 743 | (goto-char (point-max)) |
| 744 | (walk-windows | 744 | (walk-windows |
| 745 | (function | 745 | (lambda (window) |
| 746 | (lambda (window) | 746 | (when (and (eq (window-buffer window) current) |
| 747 | (when (and (eq (window-buffer window) current) | 747 | (or (eq scroll t) (eq scroll 'all))) |
| 748 | (or (eq scroll t) (eq scroll 'all))) | 748 | (select-window window) |
| 749 | (select-window window) | 749 | (goto-char (point-max)) |
| 750 | (goto-char (point-max)) | 750 | (select-window selected))) |
| 751 | (select-window selected)))) | ||
| 752 | nil t)))))) | 751 | nil t)))))) |
| 753 | 752 | ||
| 754 | ;;; jww (1999-10-23): this needs testing | 753 | ;;; jww (1999-10-23): this needs testing |
| @@ -764,29 +763,28 @@ This function should be in the list `eshell-output-filter-functions'." | |||
| 764 | (scroll eshell-scroll-to-bottom-on-output)) | 763 | (scroll eshell-scroll-to-bottom-on-output)) |
| 765 | (unwind-protect | 764 | (unwind-protect |
| 766 | (walk-windows | 765 | (walk-windows |
| 767 | (function | 766 | (lambda (window) |
| 768 | (lambda (window) | 767 | (if (eq (window-buffer window) current) |
| 769 | (if (eq (window-buffer window) current) | 768 | (progn |
| 770 | (progn | 769 | (select-window window) |
| 771 | (select-window window) | 770 | (if (and (< (point) eshell-last-output-end) |
| 772 | (if (and (< (point) eshell-last-output-end) | 771 | (or (eq scroll t) (eq scroll 'all) |
| 773 | (or (eq scroll t) (eq scroll 'all) | 772 | ;; Maybe user wants point to jump to end. |
| 774 | ;; Maybe user wants point to jump to end. | 773 | (and (eq scroll 'this) |
| 775 | (and (eq scroll 'this) | 774 | (eq selected window)) |
| 776 | (eq selected window)) | 775 | (and (eq scroll 'others) |
| 777 | (and (eq scroll 'others) | 776 | (not (eq selected window))) |
| 778 | (not (eq selected window))) | 777 | ;; If point was at the end, keep it at end. |
| 779 | ;; If point was at the end, keep it at end. | 778 | (>= (point) eshell-last-output-start))) |
| 780 | (>= (point) eshell-last-output-start))) | 779 | (goto-char eshell-last-output-end)) |
| 781 | (goto-char eshell-last-output-end)) | 780 | ;; Optionally scroll so that the text |
| 782 | ;; Optionally scroll so that the text | 781 | ;; ends at the bottom of the window. |
| 783 | ;; ends at the bottom of the window. | 782 | (if (and eshell-scroll-show-maximum-output |
| 784 | (if (and eshell-scroll-show-maximum-output | 783 | (>= (point) eshell-last-output-end)) |
| 785 | (>= (point) eshell-last-output-end)) | 784 | (save-excursion |
| 786 | (save-excursion | 785 | (goto-char (point-max)) |
| 787 | (goto-char (point-max)) | 786 | (recenter -1))) |
| 788 | (recenter -1))) | 787 | (select-window selected)))) |
| 789 | (select-window selected))))) | ||
| 790 | nil t) | 788 | nil t) |
| 791 | (set-buffer current)))) | 789 | (set-buffer current)))) |
| 792 | 790 | ||
diff --git a/lisp/eshell/esh-module.el b/lisp/eshell/esh-module.el index 45c4c9e13c0..10994ba3010 100644 --- a/lisp/eshell/esh-module.el +++ b/lisp/eshell/esh-module.el | |||
| @@ -65,16 +65,15 @@ Changes will only take effect in future Eshell buffers." | |||
| 65 | :type (append | 65 | :type (append |
| 66 | (list 'set ':tag "Supported modules") | 66 | (list 'set ':tag "Supported modules") |
| 67 | (mapcar | 67 | (mapcar |
| 68 | (function | 68 | (lambda (modname) |
| 69 | (lambda (modname) | 69 | (let ((modsym (intern modname))) |
| 70 | (let ((modsym (intern modname))) | 70 | (list 'const |
| 71 | (list 'const | 71 | ':tag (format "%s -- %s" modname |
| 72 | ':tag (format "%s -- %s" modname | 72 | (get modsym 'custom-tag)) |
| 73 | (get modsym 'custom-tag)) | 73 | ':link (caar (get modsym 'custom-links)) |
| 74 | ':link (caar (get modsym 'custom-links)) | 74 | ':doc (concat "\n" (get modsym 'group-documentation) |
| 75 | ':doc (concat "\n" (get modsym 'group-documentation) | 75 | "\n ") |
| 76 | "\n ") | 76 | modsym))) |
| 77 | modsym)))) | ||
| 78 | (sort (mapcar 'symbol-name | 77 | (sort (mapcar 'symbol-name |
| 79 | (eshell-subgroups 'eshell-module)) | 78 | (eshell-subgroups 'eshell-module)) |
| 80 | 'string-lessp)) | 79 | 'string-lessp)) |
diff --git a/lisp/eshell/esh-proc.el b/lisp/eshell/esh-proc.el index db1b258c8f5..4a1001bf058 100644 --- a/lisp/eshell/esh-proc.el +++ b/lisp/eshell/esh-proc.el | |||
| @@ -215,9 +215,8 @@ and signal names." | |||
| 215 | The prompt will be set to PROMPT." | 215 | The prompt will be set to PROMPT." |
| 216 | (completing-read prompt | 216 | (completing-read prompt |
| 217 | (mapcar | 217 | (mapcar |
| 218 | (function | 218 | (lambda (proc) |
| 219 | (lambda (proc) | 219 | (cons (process-name proc) t)) |
| 220 | (cons (process-name proc) t))) | ||
| 221 | (process-list)) | 220 | (process-list)) |
| 222 | nil t)) | 221 | nil t)) |
| 223 | 222 | ||
| @@ -499,9 +498,8 @@ See the variable `eshell-kill-processes-on-exit'." | |||
| 499 | (let ((sigs eshell-kill-process-signals)) | 498 | (let ((sigs eshell-kill-process-signals)) |
| 500 | (while sigs | 499 | (while sigs |
| 501 | (eshell-process-interact | 500 | (eshell-process-interact |
| 502 | (function | 501 | (lambda (proc) |
| 503 | (lambda (proc) | 502 | (signal-process (process-id proc) (car sigs))) t query) |
| 504 | (signal-process (process-id proc) (car sigs)))) t query) | ||
| 505 | (setq query nil) | 503 | (setq query nil) |
| 506 | (if (not eshell-process-list) | 504 | (if (not eshell-process-list) |
| 507 | (setq sigs nil) | 505 | (setq sigs nil) |
diff --git a/lisp/eshell/esh-var.el b/lisp/eshell/esh-var.el index 7388279f157..f91fb89412e 100644 --- a/lisp/eshell/esh-var.el +++ b/lisp/eshell/esh-var.el | |||
| @@ -382,9 +382,8 @@ This function is explicit for adding to `eshell-parse-argument-hook'." | |||
| 382 | 382 | ||
| 383 | (defun eshell-envvar-names (&optional environment) | 383 | (defun eshell-envvar-names (&optional environment) |
| 384 | "Return a list of currently visible environment variable names." | 384 | "Return a list of currently visible environment variable names." |
| 385 | (mapcar (function | 385 | (mapcar (lambda (x) |
| 386 | (lambda (x) | 386 | (substring x 0 (string-match "=" x))) |
| 387 | (substring x 0 (string-match "=" x)))) | ||
| 388 | (or environment process-environment))) | 387 | (or environment process-environment))) |
| 389 | 388 | ||
| 390 | (defun eshell-environment-variables () | 389 | (defun eshell-environment-variables () |
| @@ -618,14 +617,13 @@ For example, to retrieve the second element of a user's record in | |||
| 618 | (sort | 617 | (sort |
| 619 | (append | 618 | (append |
| 620 | (mapcar | 619 | (mapcar |
| 621 | (function | 620 | (lambda (varname) |
| 622 | (lambda (varname) | 621 | (let ((value (eshell-get-variable varname))) |
| 623 | (let ((value (eshell-get-variable varname))) | 622 | (if (and value |
| 624 | (if (and value | 623 | (stringp value) |
| 625 | (stringp value) | 624 | (file-directory-p value)) |
| 626 | (file-directory-p value)) | 625 | (concat varname "/") |
| 627 | (concat varname "/") | 626 | varname))) |
| 628 | varname)))) | ||
| 629 | (eshell-envvar-names (eshell-environment-variables))) | 627 | (eshell-envvar-names (eshell-environment-variables))) |
| 630 | (all-completions argname obarray 'boundp) | 628 | (all-completions argname obarray 'boundp) |
| 631 | completions) | 629 | completions) |