diff options
| author | Jim Porter | 2023-10-11 11:38:27 -0700 |
|---|---|---|
| committer | Jim Porter | 2023-10-11 12:44:31 -0700 |
| commit | 60f695285331dcf723dc9ce69c8bffc3b3d606c9 (patch) | |
| tree | 72909216bbe3083b93d541985240f069f0f9ac63 /lisp/eshell | |
| parent | cfed3bb395030662059d560f94ea0318f820f00f (diff) | |
| download | emacs-60f695285331dcf723dc9ce69c8bffc3b3d606c9.tar.gz emacs-60f695285331dcf723dc9ce69c8bffc3b3d606c9.zip | |
Fix behavior of Eshell prompt when yanking output into it
* lisp/eshell/esh-util.el (eshell--unmark-string-as-output): New
function...
* lisp/eshell/esh-mode.el (eshell-mode): ... use it.
* test/lisp/eshell/eshell-tests.el (eshell-test/yank-output): New test
(bug#66469).
Diffstat (limited to 'lisp/eshell')
| -rw-r--r-- | lisp/eshell/esh-mode.el | 3 | ||||
| -rw-r--r-- | lisp/eshell/esh-util.el | 8 |
2 files changed, 11 insertions, 0 deletions
diff --git a/lisp/eshell/esh-mode.el b/lisp/eshell/esh-mode.el index 2b560afb92c..9d2cd1e67eb 100644 --- a/lisp/eshell/esh-mode.el +++ b/lisp/eshell/esh-mode.el | |||
| @@ -361,6 +361,9 @@ and the hook `eshell-exit-hook'." | |||
| 361 | (setq-local eshell-last-output-end (point-marker)) | 361 | (setq-local eshell-last-output-end (point-marker)) |
| 362 | (setq-local eshell-last-output-block-begin (point)) | 362 | (setq-local eshell-last-output-block-begin (point)) |
| 363 | 363 | ||
| 364 | (add-function :filter-return (local 'filter-buffer-substring-function) | ||
| 365 | #'eshell--unmark-string-as-output) | ||
| 366 | |||
| 364 | (let ((modules-list (copy-sequence eshell-modules-list))) | 367 | (let ((modules-list (copy-sequence eshell-modules-list))) |
| 365 | (setq-local eshell-modules-list modules-list)) | 368 | (setq-local eshell-modules-list modules-list)) |
| 366 | 369 | ||
diff --git a/lisp/eshell/esh-util.el b/lisp/eshell/esh-util.el index 4c251a29269..ca2f775318a 100644 --- a/lisp/eshell/esh-util.el +++ b/lisp/eshell/esh-util.el | |||
| @@ -234,6 +234,14 @@ current buffer." | |||
| 234 | (eshell--mark-as-output start1 end1))))) | 234 | (eshell--mark-as-output start1 end1))))) |
| 235 | (add-hook 'after-change-functions hook nil t))) | 235 | (add-hook 'after-change-functions hook nil t))) |
| 236 | 236 | ||
| 237 | (defun eshell--unmark-string-as-output (string) | ||
| 238 | "Unmark STRING as Eshell output." | ||
| 239 | (remove-list-of-text-properties | ||
| 240 | 0 (length string) | ||
| 241 | '(rear-nonsticky front-sticky field insert-in-front-hooks) | ||
| 242 | string) | ||
| 243 | string) | ||
| 244 | |||
| 237 | (defun eshell-find-delimiter | 245 | (defun eshell-find-delimiter |
| 238 | (open close &optional bound reverse-p backslash-p) | 246 | (open close &optional bound reverse-p backslash-p) |
| 239 | "From point, find the CLOSE delimiter corresponding to OPEN. | 247 | "From point, find the CLOSE delimiter corresponding to OPEN. |