diff options
| author | Jim Porter | 2023-02-01 17:48:37 -0800 |
|---|---|---|
| committer | Jim Porter | 2023-02-23 14:09:36 -0800 |
| commit | 2f110132d735b3a3db0c4ee29f2a7d49ff2525be (patch) | |
| tree | f1cdbd7a402dae2d376890d42acb487bf3658d43 /lisp/eshell | |
| parent | 6411a9af03a4eb1a82db47a9642b11ba7edaaaf0 (diff) | |
| download | emacs-2f110132d735b3a3db0c4ee29f2a7d49ff2525be.tar.gz emacs-2f110132d735b3a3db0c4ee29f2a7d49ff2525be.zip | |
; Throw strings as the values for 'eshell-incomplete'
This lets us distinguish between cases like "'foo" and "$'foo".
* lisp/eshell/em-cmpl.el (eshell-complete-parse-arguments): Use
strings when checking the delimiter.
* lisp/eshell/em-glob.el (eshell-parse-glob-chars):
* lisp/eshell/em-pred.el (eshell-parse-arg-modifier):
* lisp/eshell/esh-arg.el (eshell-parse-backslash)
(eshell-parse-literal-quote, eshell-parse-double-quote)
(eshell-parse-special-reference):
* lisp/eshell/esh-cmd.el (eshell-parse-subcommand-argument)
(eshell-parse-lisp-argument):
* lisp/eshell/esh-var (eshell-parse-variable-ref)
(eshell-parse-indices): Throw strings instead of characters.
* lisp/eshell/esh-mode.el (eshell-parse-command-input): Print
delimiter as a string.
Diffstat (limited to 'lisp/eshell')
| -rw-r--r-- | lisp/eshell/em-cmpl.el | 4 | ||||
| -rw-r--r-- | lisp/eshell/em-glob.el | 2 | ||||
| -rw-r--r-- | lisp/eshell/em-pred.el | 2 | ||||
| -rw-r--r-- | lisp/eshell/esh-arg.el | 8 | ||||
| -rw-r--r-- | lisp/eshell/esh-cmd.el | 4 | ||||
| -rw-r--r-- | lisp/eshell/esh-mode.el | 2 | ||||
| -rw-r--r-- | lisp/eshell/esh-var.el | 18 |
7 files changed, 22 insertions, 18 deletions
diff --git a/lisp/eshell/em-cmpl.el b/lisp/eshell/em-cmpl.el index af8ac4278f1..5625c53dc9b 100644 --- a/lisp/eshell/em-cmpl.el +++ b/lisp/eshell/em-cmpl.el | |||
| @@ -330,10 +330,10 @@ to writing a completion function." | |||
| 330 | (catch 'eshell-incomplete | 330 | (catch 'eshell-incomplete |
| 331 | (ignore | 331 | (ignore |
| 332 | (setq args (eshell-parse-arguments begin end))))) | 332 | (setq args (eshell-parse-arguments begin end))))) |
| 333 | (cond ((memq (car delim) '(?\{ ?\<)) | 333 | (cond ((member (car delim) '("{" "${" "$<")) |
| 334 | (setq begin (1+ (cadr delim)) | 334 | (setq begin (1+ (cadr delim)) |
| 335 | args (eshell-parse-arguments begin end))) | 335 | args (eshell-parse-arguments begin end))) |
| 336 | ((eq (car delim) ?\() | 336 | ((member (car delim) '("(" "$(")) |
| 337 | (throw 'pcompleted (elisp-completion-at-point))) | 337 | (throw 'pcompleted (elisp-completion-at-point))) |
| 338 | (t | 338 | (t |
| 339 | (eshell--pcomplete-insert-tab)))) | 339 | (eshell--pcomplete-insert-tab)))) |
diff --git a/lisp/eshell/em-glob.el b/lisp/eshell/em-glob.el index c7360fb246e..8a2ba13b2ad 100644 --- a/lisp/eshell/em-glob.el +++ b/lisp/eshell/em-glob.el | |||
| @@ -171,7 +171,7 @@ interpretation." | |||
| 171 | (end (eshell-find-delimiter | 171 | (end (eshell-find-delimiter |
| 172 | delim (if (eq delim ?\[) ?\] ?\))))) | 172 | delim (if (eq delim ?\[) ?\] ?\))))) |
| 173 | (if (not end) | 173 | (if (not end) |
| 174 | (throw 'eshell-incomplete delim) | 174 | (throw 'eshell-incomplete (char-to-string delim)) |
| 175 | (if (and (eshell-using-module 'eshell-pred) | 175 | (if (and (eshell-using-module 'eshell-pred) |
| 176 | (eshell-arg-delimiter (1+ end))) | 176 | (eshell-arg-delimiter (1+ end))) |
| 177 | (ignore (goto-char here)) | 177 | (ignore (goto-char here)) |
diff --git a/lisp/eshell/em-pred.el b/lisp/eshell/em-pred.el index 14fa27aba06..2ccca092b86 100644 --- a/lisp/eshell/em-pred.el +++ b/lisp/eshell/em-pred.el | |||
| @@ -293,7 +293,7 @@ This function is specially for adding onto `eshell-parse-argument-hook'." | |||
| 293 | (forward-char) | 293 | (forward-char) |
| 294 | (let ((end (eshell-find-delimiter ?\( ?\)))) | 294 | (let ((end (eshell-find-delimiter ?\( ?\)))) |
| 295 | (if (not end) | 295 | (if (not end) |
| 296 | (throw 'eshell-incomplete ?\() | 296 | (throw 'eshell-incomplete "(") |
| 297 | (when (eshell-arg-delimiter (1+ end)) | 297 | (when (eshell-arg-delimiter (1+ end)) |
| 298 | (save-restriction | 298 | (save-restriction |
| 299 | (narrow-to-region (point) end) | 299 | (narrow-to-region (point) end) |
diff --git a/lisp/eshell/esh-arg.el b/lisp/eshell/esh-arg.el index 6c882471aee..cb0b2e0938c 100644 --- a/lisp/eshell/esh-arg.el +++ b/lisp/eshell/esh-arg.el | |||
| @@ -421,7 +421,7 @@ backslash is in a quoted string, the backslash and the character | |||
| 421 | after are both returned." | 421 | after are both returned." |
| 422 | (when (eq (char-after) ?\\) | 422 | (when (eq (char-after) ?\\) |
| 423 | (when (eshell-looking-at-backslash-return (point)) | 423 | (when (eshell-looking-at-backslash-return (point)) |
| 424 | (throw 'eshell-incomplete ?\\)) | 424 | (throw 'eshell-incomplete "\\")) |
| 425 | (forward-char 2) ; Move one char past the backslash. | 425 | (forward-char 2) ; Move one char past the backslash. |
| 426 | (let ((special-chars (if eshell-current-quoted | 426 | (let ((special-chars (if eshell-current-quoted |
| 427 | eshell-special-chars-inside-quoting | 427 | eshell-special-chars-inside-quoting |
| @@ -447,7 +447,7 @@ after are both returned." | |||
| 447 | (if (eq (char-after) ?\') | 447 | (if (eq (char-after) ?\') |
| 448 | (let ((end (eshell-find-delimiter ?\' ?\'))) | 448 | (let ((end (eshell-find-delimiter ?\' ?\'))) |
| 449 | (if (not end) | 449 | (if (not end) |
| 450 | (throw 'eshell-incomplete ?\') | 450 | (throw 'eshell-incomplete "'") |
| 451 | (let ((string (buffer-substring-no-properties (1+ (point)) end))) | 451 | (let ((string (buffer-substring-no-properties (1+ (point)) end))) |
| 452 | (goto-char (1+ end)) | 452 | (goto-char (1+ end)) |
| 453 | (while (string-match "''" string) | 453 | (while (string-match "''" string) |
| @@ -460,7 +460,7 @@ after are both returned." | |||
| 460 | (let* ((end (eshell-find-delimiter ?\" ?\" nil nil t)) | 460 | (let* ((end (eshell-find-delimiter ?\" ?\" nil nil t)) |
| 461 | (eshell-current-quoted t)) | 461 | (eshell-current-quoted t)) |
| 462 | (if (not end) | 462 | (if (not end) |
| 463 | (throw 'eshell-incomplete ?\") | 463 | (throw 'eshell-incomplete "\"") |
| 464 | (prog1 | 464 | (prog1 |
| 465 | (save-restriction | 465 | (save-restriction |
| 466 | (forward-char) | 466 | (forward-char) |
| @@ -514,7 +514,7 @@ If the form has no `type', the syntax is parsed as if `type' were | |||
| 514 | t)) ;; buffer-p is non-nil by default. | 514 | t)) ;; buffer-p is non-nil by default. |
| 515 | (end (eshell-find-delimiter ?\< ?\>))) | 515 | (end (eshell-find-delimiter ?\< ?\>))) |
| 516 | (when (not end) | 516 | (when (not end) |
| 517 | (throw 'eshell-incomplete ?\<)) | 517 | (throw 'eshell-incomplete "#<")) |
| 518 | (if (eshell-arg-delimiter (1+ end)) | 518 | (if (eshell-arg-delimiter (1+ end)) |
| 519 | (prog1 | 519 | (prog1 |
| 520 | (list (if buffer-p 'get-buffer-create 'get-process) | 520 | (list (if buffer-p 'get-buffer-create 'get-process) |
diff --git a/lisp/eshell/esh-cmd.el b/lisp/eshell/esh-cmd.el index efc46f10c96..d609711402a 100644 --- a/lisp/eshell/esh-cmd.el +++ b/lisp/eshell/esh-cmd.el | |||
| @@ -681,7 +681,7 @@ This means an exit code of 0." | |||
| 681 | (not (eq (char-after (1+ (point))) ?\})))) | 681 | (not (eq (char-after (1+ (point))) ?\})))) |
| 682 | (let ((end (eshell-find-delimiter ?\{ ?\}))) | 682 | (let ((end (eshell-find-delimiter ?\{ ?\}))) |
| 683 | (if (not end) | 683 | (if (not end) |
| 684 | (throw 'eshell-incomplete ?\{) | 684 | (throw 'eshell-incomplete "{") |
| 685 | (when (eshell-arg-delimiter (1+ end)) | 685 | (when (eshell-arg-delimiter (1+ end)) |
| 686 | (prog1 | 686 | (prog1 |
| 687 | `(eshell-as-subcommand | 687 | `(eshell-as-subcommand |
| @@ -698,7 +698,7 @@ This means an exit code of 0." | |||
| 698 | (condition-case nil | 698 | (condition-case nil |
| 699 | (read (current-buffer)) | 699 | (read (current-buffer)) |
| 700 | (end-of-file | 700 | (end-of-file |
| 701 | (throw 'eshell-incomplete ?\())))) | 701 | (throw 'eshell-incomplete "("))))) |
| 702 | (if (eshell-arg-delimiter) | 702 | (if (eshell-arg-delimiter) |
| 703 | `(eshell-command-to-value | 703 | `(eshell-command-to-value |
| 704 | (eshell-lisp-command (quote ,obj))) | 704 | (eshell-lisp-command (quote ,obj))) |
diff --git a/lisp/eshell/esh-mode.el b/lisp/eshell/esh-mode.el index b3cde472713..0c381dbb86a 100644 --- a/lisp/eshell/esh-mode.el +++ b/lisp/eshell/esh-mode.el | |||
| @@ -580,7 +580,7 @@ will return the parsed command." | |||
| 580 | (setq command (eshell-parse-command (cons beg end) | 580 | (setq command (eshell-parse-command (cons beg end) |
| 581 | args t))))) | 581 | args t))))) |
| 582 | (ignore | 582 | (ignore |
| 583 | (message "Expecting completion of delimiter %c ..." | 583 | (message "Expecting completion of delimiter %s ..." |
| 584 | (if (listp delim) | 584 | (if (listp delim) |
| 585 | (car delim) | 585 | (car delim) |
| 586 | delim))) | 586 | delim))) |
diff --git a/lisp/eshell/esh-var.el b/lisp/eshell/esh-var.el index 60aab92b33e..a5bfbf4254d 100644 --- a/lisp/eshell/esh-var.el +++ b/lisp/eshell/esh-var.el | |||
| @@ -503,7 +503,7 @@ Possible variable references are: | |||
| 503 | ((eq (char-after) ?{) | 503 | ((eq (char-after) ?{) |
| 504 | (let ((end (eshell-find-delimiter ?\{ ?\}))) | 504 | (let ((end (eshell-find-delimiter ?\{ ?\}))) |
| 505 | (if (not end) | 505 | (if (not end) |
| 506 | (throw 'eshell-incomplete ?\{) | 506 | (throw 'eshell-incomplete "${") |
| 507 | (forward-char) | 507 | (forward-char) |
| 508 | (prog1 | 508 | (prog1 |
| 509 | `(eshell-apply-indices | 509 | `(eshell-apply-indices |
| @@ -527,7 +527,7 @@ Possible variable references are: | |||
| 527 | ((eq (char-after) ?\<) | 527 | ((eq (char-after) ?\<) |
| 528 | (let ((end (eshell-find-delimiter ?\< ?\>))) | 528 | (let ((end (eshell-find-delimiter ?\< ?\>))) |
| 529 | (if (not end) | 529 | (if (not end) |
| 530 | (throw 'eshell-incomplete ?\<) | 530 | (throw 'eshell-incomplete "$<") |
| 531 | (let* ((temp (make-temp-file temporary-file-directory)) | 531 | (let* ((temp (make-temp-file temporary-file-directory)) |
| 532 | (cmd (concat (buffer-substring (1+ (point)) end) | 532 | (cmd (concat (buffer-substring (1+ (point)) end) |
| 533 | " > " temp))) | 533 | " > " temp))) |
| @@ -560,15 +560,19 @@ Possible variable references are: | |||
| 560 | (current-buffer))))) | 560 | (current-buffer))))) |
| 561 | indices ,eshell-current-quoted) | 561 | indices ,eshell-current-quoted) |
| 562 | (end-of-file | 562 | (end-of-file |
| 563 | (throw 'eshell-incomplete ?\()))) | 563 | (throw 'eshell-incomplete "$(")))) |
| 564 | ((looking-at (rx-to-string | 564 | ((looking-at (rx-to-string |
| 565 | `(or "'" ,(if eshell-current-quoted "\\\"" "\"")))) | 565 | `(or "'" ,(if eshell-current-quoted "\\\"" "\"")))) |
| 566 | (eshell-with-temp-command | 566 | (eshell-with-temp-command |
| 567 | (or (eshell-unescape-inner-double-quote (point-max)) | 567 | (or (eshell-unescape-inner-double-quote (point-max)) |
| 568 | (cons (point) (point-max))) | 568 | (cons (point) (point-max))) |
| 569 | (let ((name (if (eq (char-after) ?\') | 569 | (let (name) |
| 570 | (eshell-parse-literal-quote) | 570 | (when-let ((delim |
| 571 | (eshell-parse-double-quote)))) | 571 | (catch 'eshell-incomplete |
| 572 | (ignore (setq name (if (eq (char-after) ?\') | ||
| 573 | (eshell-parse-literal-quote) | ||
| 574 | (eshell-parse-double-quote))))))) | ||
| 575 | (throw 'eshell-incomplete (concat "$" delim))) | ||
| 572 | (when name | 576 | (when name |
| 573 | `(eshell-get-variable ,(eval name) indices ,eshell-current-quoted))))) | 577 | `(eshell-get-variable ,(eval name) indices ,eshell-current-quoted))))) |
| 574 | ((assoc (char-to-string (char-after)) | 578 | ((assoc (char-to-string (char-after)) |
| @@ -597,7 +601,7 @@ For example, \"[0 1][2]\" becomes: | |||
| 597 | (while (eq (char-after) ?\[) | 601 | (while (eq (char-after) ?\[) |
| 598 | (let ((end (eshell-find-delimiter ?\[ ?\]))) | 602 | (let ((end (eshell-find-delimiter ?\[ ?\]))) |
| 599 | (if (not end) | 603 | (if (not end) |
| 600 | (throw 'eshell-incomplete ?\[) | 604 | (throw 'eshell-incomplete "[") |
| 601 | (forward-char) | 605 | (forward-char) |
| 602 | (eshell-with-temp-command (or (eshell-unescape-inner-double-quote end) | 606 | (eshell-with-temp-command (or (eshell-unescape-inner-double-quote end) |
| 603 | (cons (point) end)) | 607 | (cons (point) end)) |