diff options
author | Miha Rihtaršič <miha@kamnitnik.top> | 2021-11-08 00:10:03 +0100 |
---|---|---|
committer | Lars Ingebrigtsen <larsi@gnus.org> | 2021-11-08 00:10:03 +0100 |
commit | 4268d9a2b6bc96c0ae2448c6694bbd765fc577a7 (patch) | |
tree | 635a5716671301718d8459698fb8f2dee879aa4a /lisp/eshell | |
parent | 5f70682d7b8a3550bf6b9366329ad3418ab0a95f (diff) | |
download | emacs-4268d9a2b6bc96c0ae2448c6694bbd765fc577a7.tar.gz emacs-4268d9a2b6bc96c0ae2448c6694bbd765fc577a7.tar.bz2 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." (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) |