diff options
Diffstat (limited to 'lisp/eshell')
-rw-r--r-- | lisp/eshell/em-basic.el | 2 | ||||
-rw-r--r-- | lisp/eshell/em-cmpl.el | 9 | ||||
-rw-r--r-- | lisp/eshell/em-glob.el | 6 | ||||
-rw-r--r-- | lisp/eshell/em-hist.el | 2 | ||||
-rw-r--r-- | lisp/eshell/em-ls.el | 14 | ||||
-rw-r--r-- | lisp/eshell/em-pred.el | 4 | ||||
-rw-r--r-- | lisp/eshell/em-rebind.el | 2 | ||||
-rw-r--r-- | lisp/eshell/em-smart.el | 4 | ||||
-rw-r--r-- | lisp/eshell/em-term.el | 6 | ||||
-rw-r--r-- | lisp/eshell/em-unix.el | 5 | ||||
-rw-r--r-- | lisp/eshell/esh-arg.el | 2 | ||||
-rw-r--r-- | lisp/eshell/esh-cmd.el | 38 | ||||
-rw-r--r-- | lisp/eshell/esh-ext.el | 2 | ||||
-rw-r--r-- | lisp/eshell/esh-io.el | 4 | ||||
-rw-r--r-- | lisp/eshell/esh-mode.el | 28 | ||||
-rw-r--r-- | lisp/eshell/esh-module.el | 2 | ||||
-rw-r--r-- | lisp/eshell/esh-proc.el | 2 | ||||
-rw-r--r-- | lisp/eshell/esh-util.el | 2 | ||||
-rw-r--r-- | lisp/eshell/esh-var.el | 4 | ||||
-rw-r--r-- | lisp/eshell/eshell.el | 12 |
20 files changed, 88 insertions, 62 deletions
diff --git a/lisp/eshell/em-basic.el b/lisp/eshell/em-basic.el index 64fc7e7f03b..af5550b11df 100644 --- a/lisp/eshell/em-basic.el +++ b/lisp/eshell/em-basic.el @@ -164,7 +164,7 @@ or `eshell-printn' for display." (set-default-file-modes (- 511 (car (read-from-string (concat "?\\" (number-to-string (car args))))))) - (error "setting umask symbolically is not yet implemented")) + (error "Setting umask symbolically is not yet implemented")) (eshell-print "Warning: umask changed for all new files created by Emacs.\n")) nil)) diff --git a/lisp/eshell/em-cmpl.el b/lisp/eshell/em-cmpl.el index cbfe0b81545..4fd0afbeb88 100644 --- a/lisp/eshell/em-cmpl.el +++ b/lisp/eshell/em-cmpl.el @@ -72,6 +72,7 @@ (require 'esh-mode) (require 'esh-util) +(require 'em-dirs) (eval-when-compile (require 'cl-lib) @@ -377,8 +378,12 @@ to writing a completion function." (cl-assert (eq (car result) 'quote)) (cadr result)) arg))) - (if (numberp val) - (setq val (number-to-string val))) + (cond ((numberp val) + (setq val (number-to-string val))) + ;; expand .../ etc that only eshell understands to + ;; standard ../../ + ((string-match "\\.\\.\\.+/" val) + (setq val (eshell-expand-multiple-dots val)))) (or val ""))) args) posns))) diff --git a/lisp/eshell/em-glob.el b/lisp/eshell/em-glob.el index 316094b17e4..ba12e43a3c2 100644 --- a/lisp/eshell/em-glob.el +++ b/lisp/eshell/em-glob.el @@ -91,7 +91,7 @@ This option slows down recursive glob processing by quite a bit." (defcustom eshell-error-if-no-glob nil "If non-nil, it is an error for a glob pattern not to match. - This mimics the behavior of zsh if non-nil, but bash if nil." +This mimics the behavior of zsh if non-nil, but bash if nil." :type 'boolean :group 'eshell-glob) @@ -266,7 +266,7 @@ the form: ;; FIXME does this really need to abuse eshell-glob-matches, message-shown? (defun eshell-glob-entries (path globs &optional recurse-p) - "Glob the entries in PATHS, possibly recursing if RECURSE-P is non-nil." + "Glob the entries in PATH, possibly recursing if RECURSE-P is non-nil." (let* ((entries (ignore-errors (file-name-all-completions "" path))) (case-fold-search eshell-glob-case-insensitive) @@ -291,7 +291,7 @@ the form: (let ((index 1)) (setq incl glob) (while (and (eq incl glob) - (setq index (string-match "~" glob index))) + (setq index (string-search "~" glob index))) (if (or (get-text-property index 'escaped glob) (or (= (1+ index) len))) (setq index (1+ index)) diff --git a/lisp/eshell/em-hist.el b/lisp/eshell/em-hist.el index d82946add00..aa158fa24cc 100644 --- a/lisp/eshell/em-hist.el +++ b/lisp/eshell/em-hist.el @@ -402,7 +402,7 @@ variable `eshell-input-filter' returns non-nil when called on the command. This function is supposed to be called from the minibuffer, presumably -as a minibuffer-exit-hook." +as a `minibuffer-exit-hook'." (eshell-add-input-to-history (buffer-substring (minibuffer-prompt-end) (point-max)))) diff --git a/lisp/eshell/em-ls.el b/lisp/eshell/em-ls.el index 3d7c43b404b..57146bb126d 100644 --- a/lisp/eshell/em-ls.el +++ b/lisp/eshell/em-ls.el @@ -35,10 +35,10 @@ ;;;###autoload (progn (defgroup eshell-ls nil - "This module implements the \"ls\" utility fully in Lisp. If it is -passed any unrecognized command switches, it will revert to the -operating system's version. This version of \"ls\" uses text -properties to colorize its output based on the setting of + "This module implements the \"ls\" utility fully in Lisp. +If it is passed any unrecognized command switches, it will revert +to the operating system's version. This version of \"ls\" uses +text properties to colorize its output based on the setting of `eshell-ls-use-colors'." :tag "Implementation of `ls' in Lisp" :group 'eshell-module)) @@ -476,9 +476,9 @@ name should be displayed as, etc. Think of it as cooking a FILEINFO." fileinfo) (defun eshell-ls-file (fileinfo &optional size-width copy-fileinfo) - "Output FILE in long format. -FILE may be a string, or a cons cell whose car is the filename and -whose cdr is the list of file attributes." + "Output FILEINFO in long format. +FILEINFO may be a string, or a cons cell whose car is the +filename and whose cdr is the list of file attributes." (if (not (cdr fileinfo)) (funcall error-func (format "%s: No such file or directory\n" (car fileinfo))) diff --git a/lisp/eshell/em-pred.el b/lisp/eshell/em-pred.el index def52f42e55..75a803d3ad4 100644 --- a/lisp/eshell/em-pred.el +++ b/lisp/eshell/em-pred.el @@ -258,7 +258,7 @@ EXAMPLES: (eshell-pred-mode)) (defun eshell-apply-modifiers (lst predicates modifiers) - "Apply to LIST a series of PREDICATES and MODIFIERS." + "Apply to list LST a series of PREDICATES and MODIFIERS." (let (stringified) (if (stringp lst) (setq lst (list lst) @@ -553,7 +553,7 @@ that `ls -l' will show in the first column of its display." lst))))) (defun eshell-include-members (&optional invert-p) - "Include only lisp members matching a regexp." + "Include only Lisp members matching a regexp." (let ((delim (char-after)) regexp end) (forward-char) diff --git a/lisp/eshell/em-rebind.el b/lisp/eshell/em-rebind.el index fa61fffaec8..d70444ea109 100644 --- a/lisp/eshell/em-rebind.el +++ b/lisp/eshell/em-rebind.el @@ -168,7 +168,7 @@ This is default behavior of shells like bash." (defun eshell-lock-local-map (&optional arg) "Lock or unlock the current local keymap. -Within a prefix arg, set the local keymap to its normal value, and +With prefix ARG, set the local keymap to its normal value, and lock it at that." (interactive "P") (if (or arg (not eshell-lock-keymap)) diff --git a/lisp/eshell/em-smart.el b/lisp/eshell/em-smart.el index d1c83db188a..dffc8f804b7 100644 --- a/lisp/eshell/em-smart.el +++ b/lisp/eshell/em-smart.el @@ -131,7 +131,7 @@ only if that output can be presented in its entirely in the Eshell window." :group 'eshell-smart) (defcustom eshell-smart-space-goes-to-end t - "If non-nil, space will go to end of buffer when point-max is visible. + "If non-nil, space will go to end of buffer when `point-max' is visible. That is, if a command is running and the user presses SPACE at a time when the end of the buffer is visible, point will go to the end of the buffer and smart-display will be turned off (that is, subsequently @@ -195,7 +195,7 @@ The options are `begin', `after' or `end'." ;; This is called by window-scroll-functions with two arguments. (defun eshell-smart-scroll-window (wind _start) - "Scroll the given Eshell window accordingly." + "Scroll the given Eshell window WIND accordingly." (unless eshell-currently-handling-window (let ((inhibit-point-motion-hooks t) (eshell-currently-handling-window t)) diff --git a/lisp/eshell/em-term.el b/lisp/eshell/em-term.el index d199a939a31..f9d8acccf26 100644 --- a/lisp/eshell/em-term.el +++ b/lisp/eshell/em-term.el @@ -92,13 +92,13 @@ See also `eshell-visual-commands' and `eshell-visual-options'." (defcustom eshell-visual-options nil - "An alist of the form + "An alist of commands that present their output in a visual fashion. +It has this 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 +For example, a sensible entry would be (\"git\" \"--help\" \"--paginate\") diff --git a/lisp/eshell/em-unix.el b/lisp/eshell/em-unix.el index 7e48a9c7578..e71edaf4765 100644 --- a/lisp/eshell/em-unix.el +++ b/lisp/eshell/em-unix.el @@ -165,7 +165,8 @@ Otherwise, Emacs will attempt to use rsh to invoke du on the remote machine." (put 'eshell/man 'eshell-no-numeric-conversions t) (defun eshell/info (&rest args) - "Run the info command in-frame with the same behavior as command-line `info', ie: + "Run the info command in-frame with the same behavior as command-line `info'. +For example: `info' => goes to top info window `info arg1' => IF arg1 is a file, then visits arg1 `info arg1' => OTHERWISE goes to top info window and then menu item arg1 @@ -968,7 +969,7 @@ Show wall-clock time elapsed during execution of COMMAND.") (set-window-configuration eshell-diff-window-config))) (defun nil-blank-string (string) - "Return STRING, or nil if STRING contains only non-blank characters." + "Return STRING, or nil if STRING contains only blank characters." (cond ((string-match "[^[:blank:]]" string) string) (nil))) diff --git a/lisp/eshell/esh-arg.el b/lisp/eshell/esh-arg.el index 3cf80e45187..1990c0cfa55 100644 --- a/lisp/eshell/esh-arg.el +++ b/lisp/eshell/esh-arg.el @@ -203,7 +203,7 @@ treated as a literal character." (setq eshell-current-modifiers nil)) (defun eshell-finish-arg (&optional argument) - "Finish the current argument being processed." + "Finish the current ARGUMENT being processed." (if argument (setq eshell-current-argument argument)) (throw 'eshell-arg-done t)) diff --git a/lisp/eshell/esh-cmd.el b/lisp/eshell/esh-cmd.el index daca035ea49..a2464ad4a98 100644 --- a/lisp/eshell/esh-cmd.el +++ b/lisp/eshell/esh-cmd.el @@ -116,9 +116,9 @@ (&optional form stub paring form-only)) (defgroup eshell-cmd nil - "Executing an Eshell command is as simple as typing it in and -pressing <RET>. There are several different kinds of commands, -however." + "Executing an Eshell command is as simple as typing it in and \ +pressing \\<eshell-mode-map>\\[eshell-send-input]. +There are several different kinds of commands, however." :tag "Command invocation" ;; :link '(info-link "(eshell)Command invocation") :group 'eshell) @@ -923,10 +923,10 @@ at the moment are: (defun eshell-eval-command (command &optional input) "Evaluate the given COMMAND iteratively." (if eshell-current-command - ;; we can just stick the new command at the end of the current - ;; one, and everything will happen as it should + ;; We can just stick the new command at the end of the current + ;; one, and everything will happen as it should. (setcdr (last (cdr eshell-current-command)) - (list `(let ((here (and (eobp) (point)))) + (list `(let ((here (and (eobp) (point)))) ,(and input `(insert-and-inherit ,(concat input "\n"))) (if here @@ -937,14 +937,20 @@ at the moment are: (erase-buffer) (insert "command: \"" input "\"\n"))) (setq eshell-current-command command) - (let ((delim (catch 'eshell-incomplete - (eshell-resume-eval)))) - ;; On systems that don't support async subprocesses, eshell-resume - ;; can return t. Don't treat that as an error. - (if (listp delim) - (setq delim (car delim))) - (if (and delim (not (eq delim t))) - (error "Unmatched delimiter: %c" delim))))) + (let* ((delim (catch 'eshell-incomplete + (eshell-resume-eval))) + (val (car-safe delim))) + ;; If the return value of `eshell-resume-eval' is wrapped in a + ;; list, it indicates that the command was run asynchronously. + ;; In that case, unwrap the value before checking the delimiter + ;; value. + (if (and val + (not (processp val)) + (not (eq val t))) + (error "Unmatched delimiter: %S" val) + ;; Eshell-command expect a list like (<process>) to know if the + ;; command should be async or not. + (or (and (processp val) delim) val))))) (defun eshell-resume-command (proc status) "Resume the current command when a process ends." @@ -1230,10 +1236,10 @@ or an external command." (eshell-external-command command args)))) (defun eshell-exec-lisp (printer errprint func-or-form args form-p) - "Execute a lisp FUNC-OR-FORM, maybe passing ARGS. + "Execute a Lisp FUNC-OR-FORM, maybe passing ARGS. PRINTER and ERRPRINT are functions to use for printing regular messages, and errors. FORM-P should be non-nil if FUNC-OR-FORM -represent a lisp form; ARGS will be ignored in that case." +represent a Lisp form; ARGS will be ignored in that case." (eshell-condition-case err (let ((result (save-current-buffer diff --git a/lisp/eshell/esh-ext.el b/lisp/eshell/esh-ext.el index 9930e0884cb..fa149dd46e3 100644 --- a/lisp/eshell/esh-ext.el +++ b/lisp/eshell/esh-ext.el @@ -110,7 +110,7 @@ wholly ignored." (autoload 'eshell-parse-command "esh-cmd") (defsubst eshell-invoke-batch-file (&rest args) - "Invoke a .BAT or .CMD file on DOS/Windows systems." + "Invoke a .BAT or .CMD file on MS-DOS/MS-Windows systems." ;; since CMD.EXE can't handle forward slashes in the initial ;; argument... (setcar args (subst-char-in-string ?/ ?\\ (car args))) diff --git a/lisp/eshell/esh-io.el b/lisp/eshell/esh-io.el index 0e98aa0049e..c2471912ab8 100644 --- a/lisp/eshell/esh-io.el +++ b/lisp/eshell/esh-io.el @@ -34,7 +34,7 @@ ;;;_* Redirect to a Buffer or Process ;; ;; Buffers and processes can be named with '#<buffer buffer-name>' and -;; '#<process process-name>', respectively. As a shorthand, +;; '#<process process-name>', respectively. As a shorthand, ;; '#<buffer-name>' without the explicit "buffer" arg is equivalent to ;; '#<buffer buffer-name>'. ;; @@ -94,7 +94,7 @@ though they were files." Currently this is standard input, output and error. But even all of these Emacs does not currently support with asynchronous processes \(which is what eshell uses so that you can continue doing work in -other buffers) ." +other buffers)." :type 'integer :group 'eshell-io) diff --git a/lisp/eshell/esh-mode.el b/lisp/eshell/esh-mode.el index f9dbce9770d..a054cd66e27 100644 --- a/lisp/eshell/esh-mode.el +++ b/lisp/eshell/esh-mode.el @@ -315,6 +315,8 @@ and the hook `eshell-exit-hook'." (setq-local bookmark-make-record-function #'eshell-bookmark-make-record) (setq local-abbrev-table eshell-mode-abbrev-table) + (setq-local window-point-insertion-type t) + (setq-local list-buffers-directory (expand-file-name default-directory)) ;; always set the tab width to 8 in Eshell buffers, since external @@ -499,7 +501,7 @@ and the hook `eshell-exit-hook'." (yank))) (defun eshell-bol () - "Goes to the beginning of line, then skips past the prompt, if any." + "Go to the beginning of line, then skip past the prompt, if any." (interactive) (beginning-of-line) (and eshell-skip-prompt-function @@ -614,6 +616,14 @@ newline." (and eshell-send-direct-to-subprocesses proc-running-p)) (insert-before-markers-and-inherit ?\n)) + ;; Delete and reinsert input. This seems like a no-op, except + ;; for the resulting entries in the undo list: undoing this + ;; insertion will delete the region, moving the process mark + ;; back to its original position. + (let ((text (buffer-substring eshell-last-output-end (point))) + (inhibit-read-only t)) + (delete-region eshell-last-output-end (point)) + (insert text)) (if proc-running-p (progn (eshell-update-markers eshell-last-output-end) @@ -696,13 +706,10 @@ This is done after all necessary filtering has been done." (setq oend (+ oend nchars))) ;; Let the ansi-color overlay hooks run. (let ((inhibit-modification-hooks nil)) - (insert-before-markers string)) + (insert string)) (if (= (window-start) (point)) (set-window-start (selected-window) (- (point) nchars))) - (if (= (point) eshell-last-input-end) - (set-marker eshell-last-input-end - (- eshell-last-input-end nchars))) (set-marker eshell-last-output-start ostart) (set-marker eshell-last-output-end (point)) (force-mode-line-update)) @@ -940,7 +947,14 @@ This function could be in the list `eshell-output-filter-functions'." (beginning-of-line) (if (re-search-forward eshell-password-prompt-regexp eshell-last-output-end t) - (eshell-send-invisible)))))) + ;; Use `run-at-time' in order not to pause execution of + ;; the process filter with a minibuffer + (run-at-time + 0 nil + (lambda (current-buf) + (with-current-buffer current-buf + (eshell-send-invisible))) + (current-buffer))))))) (custom-add-option 'eshell-output-filter-functions 'eshell-watch-for-password-prompt) @@ -993,8 +1007,6 @@ This function could be in the list `eshell-output-filter-functions'." ;;; Bookmark support: -(declare-function bookmark-make-record-default - "bookmark" (&optional no-file no-context posn)) (declare-function bookmark-prop-get "bookmark" (bookmark prop)) (defun eshell-bookmark-name () diff --git a/lisp/eshell/esh-module.el b/lisp/eshell/esh-module.el index 703179504c1..97ffedae62a 100644 --- a/lisp/eshell/esh-module.el +++ b/lisp/eshell/esh-module.el @@ -20,6 +20,8 @@ ;; You should have received a copy of the GNU General Public License ;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. +;;; Commentary: + ;;; Code: (require 'esh-util) diff --git a/lisp/eshell/esh-proc.el b/lisp/eshell/esh-proc.el index 96c9a60deab..7a0b26a0658 100644 --- a/lisp/eshell/esh-proc.el +++ b/lisp/eshell/esh-proc.el @@ -266,7 +266,7 @@ See `eshell-needs-pipe'." ;; neither 'first nor 'last? See bug#1388 discussion. (catch 'found (dolist (exe eshell-needs-pipe) - (if (string-equal exe (if (string-match "/" exe) + (if (string-equal exe (if (string-search "/" exe) command (file-name-nondirectory command))) (throw 'found t)))))) diff --git a/lisp/eshell/esh-util.el b/lisp/eshell/esh-util.el index 30104816f07..72de6b13e2e 100644 --- a/lisp/eshell/esh-util.el +++ b/lisp/eshell/esh-util.el @@ -204,7 +204,7 @@ then quoting is done by a backslash, rather than a doubled delimiter." string (if (eq (aref string (1- len)) ?\n) (setq string (substring string 0 (1- len)))) - (if (string-match "\n" string) + (if (string-search "\n" string) (split-string string "\n") (if (and eshell-convert-numeric-arguments (string-match diff --git a/lisp/eshell/esh-var.el b/lisp/eshell/esh-var.el index 9fccc6b1c9d..fa9853ae00a 100644 --- a/lisp/eshell/esh-var.el +++ b/lisp/eshell/esh-var.el @@ -45,7 +45,7 @@ ;; ;; $(lisp) ;; -;; Returns result of lisp evaluation. Note: Used alone like this, it +;; Returns result of Lisp evaluation. Note: Used alone like this, it ;; is identical to just saying (lisp); but with the variable expansion ;; form, the result may be interpolated a larger string, such as ;; '$(lisp)/other'. @@ -381,7 +381,7 @@ This function is explicit for adding to `eshell-parse-argument-hook'." (defun eshell-envvar-names (&optional environment) "Return a list of currently visible environment variable names." (mapcar (lambda (x) - (substring x 0 (string-match "=" x))) + (substring x 0 (string-search "=" x))) (or environment process-environment))) (defun eshell-environment-variables () diff --git a/lisp/eshell/eshell.el b/lisp/eshell/eshell.el index 101ac860346..c66ad000722 100644 --- a/lisp/eshell/eshell.el +++ b/lisp/eshell/eshell.el @@ -33,15 +33,15 @@ ;; @ A high degree of configurability ;; ;; @ The ability to have the same shell on every system Emacs has been -;; ported to. Since Eshell imposes no external requirements, and +;; ported to. Since Eshell imposes no external requirements, and ;; relies upon only the Lisp functions exposed by Emacs, it is quite -;; operating system independent. Several of the common UNIX +;; operating system independent. Several of the common UNIX ;; commands, such as ls, mv, rm, ln, etc., have been implemented in ;; Lisp in order to provide a more consistent work environment. ;; ;; For those who might be using an older version of Eshell, version -;; 2.1 represents an entirely new, module-based architecture. It -;; supports most of the features offered by modern shells. Here is a +;; 2.1 represents an entirely new, module-based architecture. It +;; supports most of the features offered by modern shells. Here is a ;; brief list of some of its more visible features: ;; ;; @ Command argument completion (tcsh, zsh) @@ -136,7 +136,7 @@ ;; errors, such as 'dri' for `dir'. Since executing non-existent ;; programs is rarely the intention of the user, eshell could prompt ;; for the replacement string, and then record that in a database of -;; known misspellings. (Note: The typo at the beginning of this +;; known misspellings. (Note: The typo at the beginning of this ;; paragraph wasn't discovered until two months after I wrote the ;; text; it was not intentional). ;; @@ -240,7 +240,7 @@ session. Return the buffer selected (or created). With a nonnumeric prefix arg, create a new session. -With a numeric prefix arg (as in `C-u 42 M-x eshell RET'), switch +With a numeric prefix arg (as in `\\[universal-argument] 42 \\[eshell]'), switch to the session with that number, or create it if it doesn't already exist. |