diff options
| author | Miha Rihtaršič | 2021-11-08 00:10:03 +0100 |
|---|---|---|
| committer | Lars Ingebrigtsen | 2021-11-08 00:10:03 +0100 |
| commit | 4268d9a2b6bc96c0ae2448c6694bbd765fc577a7 (patch) | |
| tree | 635a5716671301718d8459698fb8f2dee879aa4a /lisp/eshell | |
| parent | 5f70682d7b8a3550bf6b9366329ad3418ab0a95f (diff) | |
| download | emacs-4268d9a2b6bc96c0ae2448c6694bbd765fc577a7.tar.gz emacs-4268d9a2b6bc96c0ae2448c6694bbd765fc577a7.zip | |
Improve undoing of RET in comint and eshell
* lisp/comint.el (comint-send-input):
(comint-accumulate):
* lisp/eshell/esh-mode.el (eshell-send-input): Before sending input to
the process, delete it and reinsert it again. Undoing this
insertion with 'C-/' will delete the region, moving the process mark
back to its original position (bug#49484).
Diffstat (limited to 'lisp/eshell')
| -rw-r--r-- | lisp/eshell/esh-mode.el | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/lisp/eshell/esh-mode.el b/lisp/eshell/esh-mode.el index 2b5a4647e06..a054cd66e27 100644 --- a/lisp/eshell/esh-mode.el +++ b/lisp/eshell/esh-mode.el | |||
| @@ -616,6 +616,14 @@ newline." | |||
| 616 | (and eshell-send-direct-to-subprocesses | 616 | (and eshell-send-direct-to-subprocesses |
| 617 | proc-running-p)) | 617 | proc-running-p)) |
| 618 | (insert-before-markers-and-inherit ?\n)) | 618 | (insert-before-markers-and-inherit ?\n)) |
| 619 | ;; Delete and reinsert input. This seems like a no-op, except | ||
| 620 | ;; for the resulting entries in the undo list: undoing this | ||
| 621 | ;; insertion will delete the region, moving the process mark | ||
| 622 | ;; back to its original position. | ||
| 623 | (let ((text (buffer-substring eshell-last-output-end (point))) | ||
| 624 | (inhibit-read-only t)) | ||
| 625 | (delete-region eshell-last-output-end (point)) | ||
| 626 | (insert text)) | ||
| 619 | (if proc-running-p | 627 | (if proc-running-p |
| 620 | (progn | 628 | (progn |
| 621 | (eshell-update-markers eshell-last-output-end) | 629 | (eshell-update-markers eshell-last-output-end) |