branch: elpa/casual
commit 1002306e9df2b12f37ced234e2610ee028ba038c
Merge: 6f53c27ef2 cc32517555
Author: Charles Choi <[email protected]>
Commit: GitHub <[email protected]>
Merge pull request #479 from
kickingvegas/465-add-support-for-copying-last-eshell-command-result
Add casual-eshell-copy-last-output and change some bindings
---
docs/casual.texi | 16 +++++++++++++---
docs/eshell.org | 16 ++++++++++++----
docs/images/casual-eshell-info-screenshot.png | Bin 0 -> 40963 bytes
docs/images/casual-eshell-process-screenshot.png | Bin 67770 -> 68427 bytes
docs/images/casual-eshell-screenshot.png | Bin 52165 -> 53727 bytes
docs/images/casual-eshell-unicode-screenshot.png | Bin 49982 -> 49834 bytes
lisp/casual-eshell-utils.el | 15 ++++++++++++++-
lisp/casual-eshell.el | 10 ++++++----
tests/casual-eshell-test-utils.el | 4 ++--
tests/test-casual-eshell.el | 11 ++++++++---
10 files changed, 55 insertions(+), 17 deletions(-)
diff --git a/docs/casual.texi b/docs/casual.texi
index 4b2c642f54..6b27556e9d 100644
--- a/docs/casual.texi
+++ b/docs/casual.texi
@@ -3130,6 +3130,9 @@ In your initialization file@comma{} bind the Transient
@code{casual-eshell-tmenu
@cindex Eshell Usage
@vindex casual-eshell-tmenu
+@image{images/casual-eshell-screenshot,,,,png}
+
+
Eshell can be invoked via @code{M-x eshell}. In the Eshell window@comma{}
press @kbd{C-o} (or your binding of preference) to raise the menu
@code{casual-eshell-tmenu}.
The following sections are offered in the menu:
@@ -3137,20 +3140,25 @@ The following sections are offered in the menu:
@table @asis
@item Input
Commands supporting input to the current prompt.
+
@item Argument
Commands supporting arguments in the current prompt.
+
@item Prompt
Navigation of previous prompt commands.
+
@item Output
Commands related to display of prompt. Commands marked with the glyph ✦
support an optional prefix (@kbd{C-u}) value.
+
@item Misc
Miscellaneous commands.
-@item Process
-Signal commands to send to the process. This section is only visible when a
process is running.
-@end table
+@item Process
+Signal commands to send to the process.
+This section is only visible when a process is running.
@image{images/casual-eshell-process-screenshot,,,,png}
+@end table
@subsubheading Eshell Settings
@@ -3163,6 +3171,8 @@ The menu @code{casual-eshell-settings-tmenu} provides
access to different @code{
The menu @code{casual-eshell-info-tmenu} provides access to different
@code{eshell-mode} documentation in its Info manual.
+@image{images/casual-eshell-info-screenshot,,,,png}
+
@subsubheading Eshell Unicode Symbol Support
diff --git a/docs/eshell.org b/docs/eshell.org
index fd6962b064..cd8e23566a 100644
--- a/docs/eshell.org
+++ b/docs/eshell.org
@@ -24,19 +24,27 @@ In your initialization file, bind the Transient
~casual-eshell-tmenu~ to your ke
#+CINDEX: Eshell Usage
#+VINDEX: casual-eshell-tmenu
+[[file:images/casual-eshell-screenshot.png]]
+
+
Eshell can be invoked via ~M-x eshell~. In the Eshell window, press
{{{kbd(C-o)}}} (or your binding of preference) to raise the menu
~casual-eshell-tmenu~.
The following sections are offered in the menu:
- Input :: Commands supporting input to the current prompt.
+
- Argument :: Commands supporting arguments in the current prompt.
+
- Prompt :: Navigation of previous prompt commands.
+
- Output :: Commands related to display of prompt. Commands marked with the
glyph ✦ support an optional prefix ({{{kbd(C-u)}}}) value.
+
- Misc :: Miscellaneous commands.
-- Process :: Signal commands to send to the process. This section is only
visible when a process is running.
-
- [[file:images/casual-eshell-process-screenshot.png]]
+- Process :: Signal commands to send to the process.
+ This section is only visible when a process is running.
+
+ [[file:images/casual-eshell-process-screenshot.png]]
#+TEXINFO: @subsubheading Eshell Settings
@@ -51,7 +59,7 @@ The menu ~casual-eshell-settings-tmenu~ provides access to
different ~eshell-mod
The menu ~casual-eshell-info-tmenu~ provides access to different ~eshell-mode~
documentation in its Info manual.
-# TODO: Insert screenshot
+[[file:images/casual-eshell-info-screenshot.png]]
#+TEXINFO: @subsubheading Eshell Unicode Symbol Support
diff --git a/docs/images/casual-eshell-info-screenshot.png
b/docs/images/casual-eshell-info-screenshot.png
new file mode 100644
index 0000000000..fcbfcde031
Binary files /dev/null and b/docs/images/casual-eshell-info-screenshot.png
differ
diff --git a/docs/images/casual-eshell-process-screenshot.png
b/docs/images/casual-eshell-process-screenshot.png
index 0d367c31fe..db38f29173 100644
Binary files a/docs/images/casual-eshell-process-screenshot.png and
b/docs/images/casual-eshell-process-screenshot.png differ
diff --git a/docs/images/casual-eshell-screenshot.png
b/docs/images/casual-eshell-screenshot.png
index 49ba2a601d..091485710e 100644
Binary files a/docs/images/casual-eshell-screenshot.png and
b/docs/images/casual-eshell-screenshot.png differ
diff --git a/docs/images/casual-eshell-unicode-screenshot.png
b/docs/images/casual-eshell-unicode-screenshot.png
index b037b54176..377229af82 100644
Binary files a/docs/images/casual-eshell-unicode-screenshot.png and
b/docs/images/casual-eshell-unicode-screenshot.png differ
diff --git a/lisp/casual-eshell-utils.el b/lisp/casual-eshell-utils.el
index eeca426cc0..be021df3c2 100644
--- a/lisp/casual-eshell-utils.el
+++ b/lisp/casual-eshell-utils.el
@@ -1,6 +1,6 @@
;;; casual-eshell-utils.el --- Casual Eshell Utils -*- lexical-binding: t; -*-
-;; Copyright (C) 2025 Charles Y. Choi
+;; Copyright (C) 2025-2026 Charles Y. Choi
;; Author: Charles Choi <[email protected]>
;; Keywords: tools
@@ -25,6 +25,7 @@
(require 'eshell)
(require 'em-alias)
+(require 'em-prompt)
(require 'tramp)
(require 'casual-lib)
@@ -103,5 +104,17 @@ plain ASCII-range string."
(replace-regexp-in-string
(concat "^" (getenv "HOME")) "~" path)))))
+(defun casual-eshell-copy-last-output ()
+ "Copy output from last command issued."
+ (interactive)
+ (save-excursion
+ (eshell-mark-output)
+ (let* ((start (point))
+ (end (point-max))
+ (output (substring-no-properties (buffer-substring start end)))
+ (prompt (funcall eshell-prompt-function))
+ (output (string-replace prompt "" output)))
+ (kill-new output))))
+
(provide 'casual-eshell-utils)
;;; casual-eshell-utils.el ends here
diff --git a/lisp/casual-eshell.el b/lisp/casual-eshell.el
index 2b6f2d0322..fbd555a96e 100644
--- a/lisp/casual-eshell.el
+++ b/lisp/casual-eshell.el
@@ -76,7 +76,8 @@
("n" "Next" eshell-next-prompt
:description (lambda () (casual-eshell-unicode-get :next))
:transient t)
- ("RET" "Clone" eshell-copy-old-input)]
+ ("c" "Clone" eshell-copy-old-input
+ :inapt-if (lambda () (= (point) (point-max))))]
["Output"
:if-not buffer-narrowed-p
@@ -84,6 +85,7 @@
("." "Show Max" eshell-show-maximum-output)
("m" "Mark" eshell-mark-output
:description (lambda () (if prefix-arg "Narrow" "Mark✦")))
+ ("w" "Copy Last" casual-eshell-copy-last-output)
("D" "Delete" eshell-delete-output
:description (lambda () (if prefix-arg "Kill" "Delete✦")))]
@@ -102,9 +104,9 @@
["Process"
:if (lambda () (car eshell-process-list))
:class transient-row
- ("Pi" "Interrupt" eshell-interrupt-process)
- ("Pk" "Kill" eshell-kill-process)
- ("Pq" "Quit" eshell-quit-process)]
+ ("C-c" "Interrupt" eshell-interrupt-process)
+ ("C-k" "Kill" eshell-kill-process)
+ ("C-\\" "Quit" eshell-quit-process)]
[:class transient-row
(casual-lib-quit-one)
diff --git a/tests/casual-eshell-test-utils.el
b/tests/casual-eshell-test-utils.el
index 7bc96fc7a6..0946125c47 100644
--- a/tests/casual-eshell-test-utils.el
+++ b/tests/casual-eshell-test-utils.el
@@ -1,6 +1,6 @@
;;; casual-eshell-test-utils.el --- Casual Test Utils -*-
lexical-binding: t; -*-
-;; Copyright (C) 2025 Charles Y. Choi
+;; Copyright (C) 2025-2026 Charles Y. Choi
;; Author: Charles Choi <[email protected]>
;; Keywords: tools
@@ -29,7 +29,7 @@
(defun casualt-eshell-setup ()
"Casual Eshell setup."
- )
+ (eshell))
(defun casualt-eshell-breakdown ()
"Casual man breakdown."
diff --git a/tests/test-casual-eshell.el b/tests/test-casual-eshell.el
index 2b1cf146d9..b99870303e 100644
--- a/tests/test-casual-eshell.el
+++ b/tests/test-casual-eshell.el
@@ -1,6 +1,6 @@
;;; test-casual-eshell.el --- Casual Make Tests -*- lexical-binding: t; -*-
-;; Copyright (C) 2025 Charles Y. Choi
+;; Copyright (C) 2025-2026 Charles Y. Choi
;; Author: Charles Choi <[email protected]>
;; Keywords: tools
@@ -32,6 +32,10 @@
(ert-deftest test-casual-eshell-tmenu ()
(let ()
(casualt-eshell-setup)
+ (eshell-return-to-prompt)
+ (insert "echo \"yer\"")
+ (eshell-send-input)
+ (eshell-previous-prompt)
(cl-letf ((casualt-mock #'eshell-insert-buffer-name)
(casualt-mock #'eshell-kill-input)
@@ -48,7 +52,7 @@
(casualt-mock #'eshell-delete-output)
;;(casualt-mock #'dired)
(casualt-mock #'casual-eshell-edit-aliases)
-
+ (casualt-mock #'casual-eshell-copy-last-output)
(casualt-mock #'casual-eshell-info-tmenu)
(casualt-mock #'casual-eshell-settings-tmenu)
;;(casualt-mock #'bookmark-jump)
@@ -64,11 +68,12 @@
(:binding "y" :command eshell-repeat-argument)
(:binding "p" :command eshell-previous-prompt)
(:binding "n" :command eshell-next-prompt)
- (:binding "RET" :command eshell-copy-old-input)
+ (:binding "c" :command eshell-copy-old-input)
(:binding "s" :command eshell-show-output)
(:binding "." :command eshell-show-maximum-output)
(:binding "m" :command eshell-mark-output)
(:binding "D" :command eshell-delete-output)
+ (:binding "w" :command casual-eshell-copy-last-output)
;; (:binding "d" :command dired)
(:binding "a" :command casual-eshell-edit-aliases)
(:binding "i" :command casual-eshell-info-tmenu)