Commit graph

249 commits

Author SHA1 Message Date
Akib Azmain Turja
65dbbfcad3
* integration/bash: Check TERM before enabling 2022-12-11 14:50:47 +06:00
Akib Azmain Turja
917464cf56
* eat.el (eat-eshell-emacs-mode-map): Disable undo 2022-12-11 14:44:01 +06:00
Akib Azmain Turja
aa0607e1cb
Use Eshell "emacs" mode map when process is live
* eat.el (eat-eshell-emacs-mode-map): Update docstring.
* eat.el (eat--eshell-process-running-mode): New
non-interactive minor mode.
* eat.el (eat--eshell-setup-proc-and-term): Enable
'eat--eshell-process-running-mode'.
* eat.el (eat--eshell-cleanup): Disable
'eat--eshell-process-running-mode'.
* eat.le (eat--eshell-local-mode): Don't use
'eat-eshell-emacs-mode-map' as the mode keymap.
2022-12-11 14:41:38 +06:00
Akib Azmain Turja
7891cae44b
Synchronize scrolling and point properly
* eat.el (eat--synchronize-scroll)
(eat--eshell-synchronize-scroll): Call 'set-window-point' in
addition to 'goto-char'.
2022-12-11 14:10:25 +06:00
Akib Azmain Turja
ab52caff52
; Release version 0.2.1
* eat.el:
* eat.texi:
Bump version.
* ChangeLog: Update.
2022-12-11 00:43:49 +06:00
Akib Azmain Turja
f54af22d6a
Fix invoking commands with eshell/sudo from Tramp
* eat.el (eat--eshell-adjust-make-process-args): Override
'start-file-process' on Emacs 28, used by Eshell on Emacs 28.
Don't override 'make-process' on Emacs 28, Eshell doesn't use
that on Emacs 28.  Set process filter and sentinel in
'eshell-exec-hook' instead of 'make-process' advice.
2022-12-11 00:39:08 +06:00
Akib Azmain Turja
714d9738cc
Fix Eshell working directory tracking
* eat.el (eat--eshell-local-mode): Call
'eat--eshell-update-cwd'.
* eat.el (eat-eshell-mode): Don't call
'eat--eshell-update-cwd'.
2022-12-11 00:20:05 +06:00
Akib Azmain Turja
b6caebb0ab
; Release 0.2
* eat.el:
* eat.texi:
Bump version.
* ChangeLog: Update with new entries.
2022-12-10 17:43:47 +06:00
Akib Azmain Turja
51eebc562b
Fix yanking text into terminal
* eat.el (eat-yank): Use simpler, saner and better approach to get the
yanked string instead of the previous stupid, insane and buggy
approach.
* eat.el (eat-yank-pop): Remove, because it's not cancel the text
already sent to the terminal.
* eat.el (eat-yank-from-kill-ring): New function.  Behaves essentially
the same the previous (not properly working) 'eat-yank-pop'.
* eat.el (eat-semi-char-mode-map, eat-eshell-semi-char-mode-map):
Replace 'eat-yank-pop' with 'eat-yank-from-kill-ring'.
2022-12-10 15:51:04 +06:00
Akib Azmain Turja
12a5fb72b2
; * eat.el (eat--t-term): Fix 'params' docstring 2022-12-10 13:27:58 +06:00
Akib Azmain Turja
94e56712e3
; * README.org (Usage): Fix Eshell instructions 2022-12-10 02:28:13 +06:00
Akib Azmain Turja
978aff9166
Implement terminal parameters
* eat.el (eat--t-term): New slot: 'params'.
* eat.el (eat-term-parameter): New function and generalized
variable.
* eat.el (eat-set-term-parameter): New function.
2022-12-10 02:14:28 +06:00
Akib Azmain Turja
f047b2d283
Fix terminal color reporting in text terminals
* eat.el (eat--t-report-foreground-color): Fix foreground color
reporting in text terminals.
* eat.el (eat--t-report-background-color): Fix background color
reporting in text terminals.
2022-12-09 20:44:08 +06:00
Akib Azmain Turja
b996bffa4b
Break combined 'setq'/'setf'/'setq-local's
When giving more than two arguments to 'setq', it becomes hard
to figure out what is assigned to what.  As the number of
argument increases, the readablity of code decreases.  This is
also true for 'setq-local'.  For 'setf', the problem is even
greater, unlike 'setq', all arguments to 'setf' look the same.

* eat.el (eat--t-reset, eat--t-write, eat--t-save-cur)
(eat--t-restore-cur, eat--t-enable-alt-disp)
(eat--t-disable-alt-disp, eat--t-change-scroll-region)
(eat--t-set-sgr-params, eat--t-manipulate-selection)
(eat--t-resize, eat--blink-start-timers, eat-blink-mode)
(eat--cursor-blink-mode, eat--set-cursor, eat-self-input)
(eat-mode, eat-exec, eat--eshell-setup-proc-and-term)
(eat--eshell-cleanup, eat--eshell-adjust-make-process-args)
(eat--eshell-local-mode, eat--eshell-exec-visual)
(eat--trace-exec, eat--trace-eshell-adjust-make-process-args)
(eat--trace-replay-eval, eat-trace-replay, eat-trace--cleanup):
Break combined 'setq'/'setf'/'setq-local's.
2022-12-08 18:04:56 +06:00
Akib Azmain Turja
2207109d24
; * eat.el (eat-term-color-.*): Fix docstring 2022-12-08 17:36:54 +06:00
Akib Azmain Turja
980265ac05
Don't 'cd' as root when using 'sudo' from Tramp
* eat.el (eat--eshell-setup-proc-and-term): Don't set
'eat--eshell-invocation-directory'.
* eat.el (eat--eshell-update-cwd): New function.
* eat.el (eat--eshell-local-mode): Call
'eat--eshell-update-cwd' when enabling the mode and add it to
'eshell-directory-change-hook' to keep track of Eshell's
working directory.
2022-12-08 17:00:12 +06:00
Akib Azmain Turja
856d429f2d
Fix prompt annotation bug trigger when shell exits
* eat.el (eat--correct-shell-prompt-mark-overlays): Make sure
'eat--terminal' is non-nil.
* eat.el (eat--sentinel): Cancel timers, correct shell prompt
annotations for the final time, reset shell prompt annotation
related local variables.
2022-12-08 15:58:20 +06:00
Akib Azmain Turja
58fd1b1196
Synchronize scrolling only when point is on cursor
* eat.el (eat--adjust-process-window-size): Synchronize
scrolling only when point is on cursor.
2022-12-07 15:38:47 +06:00
Akib Azmain Turja
ebc77efd0f
Escape control characters in trace output
* eat.el (eat--trace-log): Escape control
characters (codepoints from 0 to 31) in trace output.
2022-12-07 15:34:14 +06:00
Akib Azmain Turja
e6a7deafd0
Auto update 'eat-term-shell-integration-directory'
* eat.el: Auto update 'eat-term-shell-integration-directory' if
not modified.
2022-12-07 13:17:37 +06:00
Akib Azmain Turja
b3c81c3078
Move Bash global variables to function
* integration/bash (__eat_current_command, __eat_exit_status)
(__eat_inhibit_preexec): Move to '__eat_enable_integration'.
* integration/bash (__eat_prompt_start, __eat_prompt_end)
(__eat_continuation_start, __eat_continuation_end): Move to
'__eat_enable_integration' and make local there.
2022-12-07 13:06:29 +06:00
Akib Azmain Turja
e05931d7e9
Document annotation correction delay user option
* eat.texi (Performance Tuning): Document the purpose and the
use of 'eat-shell-prompt-annotation-correction-delay' user
option.
2022-12-07 12:00:41 +06:00
Akib Azmain Turja
2ea84e0a34
Don't accept 'nil' as annotation correction delay
* eat.el (eat-shell-prompt-annotation-correction-delay): Don't
accept 'nil'.
* eat.el (eat--process-output-queue): Don't accept value 'nil'
for 'eat-shell-prompt-annotation-correction-delay'.
2022-12-07 11:17:20 +06:00
Akib Azmain Turja
a65b7bc064
Rename some symbols to reflect their purposes
* eat.el (eat-shell-prompt-annotation-delay): Rename to
'eat-shell-prompt-annotation-correction-delay'.
* eat.el (eat--update-shell-prompt-mark-overlays): Rename to
'eat--correct-shell-prompt-mark-overlays'.
* eat.el (eat--shell-prompt-annotation-update-timer): Rename to
'eat--shell-prompt-annotation-correction-timer'.
* eat.el (eat-mode, eat--process-output-queue, eat--filter):
Update references to renamed symbols.
2022-12-07 11:06:44 +06:00
Akib Azmain Turja
693940c733
* README.org: Add shell integration instructions 2022-12-07 00:29:20 +06:00
Akib Azmain Turja
8188f71562
* eat-tests.el (eat-test-set-cwd): Update test 2022-12-07 00:12:22 +06:00
Akib Azmain Turja
62a09caef1
* eat.el (eat--t-term): Fix initial value of 'cwd' 2022-12-07 00:11:29 +06:00
Akib Azmain Turja
e287487b42
Document everything about shell integration
* eat.texi (Shell Integration): Move to be the first chapter of
Part III.  Document everything about shell integration.
* eat.texi (Directory Tracking): Merge with the node 'Shell
Integration'.
2022-12-06 23:37:08 +06:00
Akib Azmain Turja
b42687f146
Fix prompt navigation when annotation is disabled
* eat.el (eat--pre-prompt): Always set
'eat--shell-prompt-begin'.
* eat.el (eat--post-prompt): Always put special prompt end
marking text property.
2022-12-06 22:57:47 +06:00
Akib Azmain Turja
2c6afa4dc0
Add shell prompt navigation commands
* eat.el (eat--post-prompt): Add special text property on the
last character of shell prompt.
* eat.el (eat-previous-shell-prompt, eat-next-shell-prompt):
New command.
* eat.el (eat-mode-map): Bind 'eat-previous-shell-prompt' and
'eat-next-shell-prompt' to 'C-c C-p' and 'C-c C-n'
respectively.
2022-12-06 22:03:33 +06:00
Akib Azmain Turja
a04999011f
Annotate shell prompts
* eat.el (eat-enable-shell-prompt-annotation)
(eat-shell-prompt-annotation-position)
(eat-shell-prompt-annotation-running-margin-indicator)
(eat-shell-prompt-annotation-success-margin-indicator)
(eat-shell-prompt-annotation-failure-margin-indicator)
(eat-shell-prompt-annotation-delay): New user option.
* eat.el (eat-shell-prompt-annotation-running)
(eat-shell-prompt-annotation-success)
(eat-shell-prompt-annotation-failure): New face.
* eat.el (eat--shell-command-status, eat--shell-prompt-begin)
(eat--shell-prompt-mark, eat--shell-prompt-mark-overlays): New
variable.
* eat.el (eat--pre-prompt, eat--post-prompt)
(eat--update-shell-prompt-mark-overlays, eat--pre-cmd)
(eat--set-cmd-status): New function.
* eat.el (eat-mode): Make 'eat--shell-command-status',
'eat--shell-prompt-begin', 'eat--shell-prompt-mark',
'eat--shell-prompt-mark-overlays' and
'eat--shell-prompt-annotation-update-timer' local.  Set margin
width if shell prompt annotation is enabled.
* eat.el (eat--shell-prompt-annotation-update-timer): New
variable.
* eat.el (eat--process-output-queue): Call or schedule
'eat--update-shell-prompt-mark-overlays' call.
* eat.el (eat--filter): Cancel timer
'eat--shell-prompt-annotation-update-timer'.
* eat.el (eat-exec): Set prompt start & end and command start &
end functions.
2022-12-06 21:30:01 +06:00
Akib Azmain Turja
b4d07cb474
Add shell commands run in Eat to Emacs history
* eat.el (eat-enable-shell-command-history): New user option.
* eat.el (eat--set-cmd): New function.
* eat.el (eat-exec, eat--eshell-setup-proc-and-term): Call
'eat--set-cmd' when the shell reports the command being run.
2022-12-06 13:22:43 +06:00
Akib Azmain Turja
9caa496e45
Tighter shell integration
* eat.el (eat--t-term): New slots: 'prompt-start-fn',
'prompt-end-fn', 'cont-prompt-start-fn', 'cont-prompt-end-fn',
'set-cmd-fn', 'cmd-start-fn', 'cmd-finish-fn'
* eat.el (eat--t-set-cwd): Accept three arguments in two
different formats.
* eat.el (eat--t-prompt-start, eat--t-prompt-end)
(eat--t-cont-prompt-start, eat--t-cont-prompt-end)
(eat--t-set-cmd, eat--t-cmd-start, eat--t-cmd-finish): New
function.
* eat.el (eat--t-handle-output): Accept Eat's own
OSC 51 ; e ; ... ST sequences.
* eat.el (eat-term-prompt-start-function)
(eat-term-prompt-end-function)
(eat-term-continuation-prompt-start-function)
(eat-term-continuation-prompt-end-function)
(eat-term-set-cmd-function, eat-term-cmd-start-function)
(eat-term-cmd-finish-function): New generalized variable.
* integration/bash (__eat_current_command, __eat_exit_status):
New variable.
* integration/bash (__eat_prompt_command): Send exit status of
last command, if applicable.  Use Eat specific sequence to
report working directory.  Set title.
* integration/bash (__eat_preexec): Report current command and
execution start.
* integration/bash (__eat_before_prompt_command): Set
'__eat_exit_status' to the exit status of the last command.
* integration/bash (__eat_prompt_start, __eat_prompt_end)
(__eat_continuation_start, __eat_continuation_end): New
variable, used as constant only to make the code more readable.
* integration/bash (__eat_enable_integration): Wrap 'PS1' and
'PS2'.  Don't set title from 'PS1'.
2022-12-06 00:21:48 +06:00
Akib Azmain Turja
d35864ca6b
Calculate the number of lines on window properly
* eat.el (eat-exec, eat--eshell-setup-proc-and-term)
(eat--eshell-adjust-make-process-args)
(eat--eshell-synchronize-scroll): Calculate the number of
available lines on window properly.
2022-12-04 22:49:56 +06:00
Akib Azmain Turja
775328790c
Remap 'insert-char' to read and input a character
* eat.el (eat-input-char): New function.
* eat.el (eat-semi-char-mode-map)
(eat-eshell-semi-char-mode-map): Remap 'insert-char' to
'eat-input-char'.
2022-12-04 19:32:14 +06:00
Akib Azmain Turja
a21e665120
Use full command as title in shell integration
* integration/bash (__eat_in_prompt_command): Rename to
'__eat_inhibit_preexec'.
* integration/bash (__eat_before_exec): Inhibit further
'__eat_preexec' calls until next prompt.
* integration/bash (__eat_preexec): Use 'history' to get the
real command typed by the user.
2022-12-04 18:43:06 +06:00
Akib Azmain Turja
f4b5fd527e
; integration/bash: Make the joke a bit more funny 2022-12-04 18:27:40 +06:00
Akib Azmain Turja
ccc405ec14
Fix Bash integration
* integration/bash (__eat_enable_integration): Fix moving
'PROMPT_COMMAND' array elements.
2022-12-04 16:57:47 +06:00
Akib Azmain Turja
a95ca85927
* eat.el: Fix bright faces face definitions 2022-12-04 16:42:34 +06:00
Akib Azmain Turja
01f5f3b2af
Refactor shell integration enabling code
* integration/bash (__eat_enable_integration): New function.
* integration/bash: Move enabling code to dedicated function.
2022-12-04 15:20:12 +06:00
Akib Azmain Turja
0887bd6a7d
Update title automatically in shell integration
* integration/bash (__eat_prompt_command): Remove extra '\'s.
* integration/bash (__eat_in_prompt_command): New variable.
* integration/bash (__eat_preexec, __eat_before_prompt_command)
(__eat_after_prompt_command, __eat_before_exec): New function.
* integration/bash: Modify PS1 to update terminal title when
displaying prompt.  Add '__eat_before_exec' as 'DEBUG' trap
handler to update terminal title just before executing a
command.  Prepend and append '__eat_before_prompt_command' and
'__eat_after_prompt_command' to 'PROMPT_COMMAND' to avoid
getting trapped in 'DEBUG' trap.
2022-12-04 15:10:13 +06:00
Akib Azmain Turja
226ff56932
* README.org (Quelpa): Update recipe. 2022-12-04 13:00:18 +06:00
Akib Azmain Turja
468fe893cf
* term/eat.el: New file. 2022-12-04 12:52:36 +06:00
Akib Azmain Turja
85c0c16380
Refer to NonGNU ELPA in README
* README.org (NonGNU ELPA Devel): Rename to NonGNU ELPA.
Change the code-snippet to use NonGNU ELPA (stable).
2022-12-04 01:22:47 +06:00
Akib Azmain Turja
7abb81e16a
* integration/bash: Add copyright notice. 2022-12-03 23:46:05 +06:00
Akib Azmain Turja
a9bf5e5248
* integration/bash: Use '__' prefix 2022-12-03 22:37:19 +06:00
Akib Azmain Turja
fa62d693f6
* integration/bash: Append to array more cleanly 2022-12-03 19:28:39 +06:00
Akib Azmain Turja
729717b84f
* integration/bash: Don't setup again on reload 2022-12-03 19:23:12 +06:00
Akib Azmain Turja
55c7d21cef
Use more uniform names for tracer functions
* eat.el: Rename 'eat--eshell-trace-...' symbols to
'eat--trace-eshell-...'.
2022-12-03 11:18:28 +06:00
Akib Azmain Turja
d918dbae87
Add shell integration script for GNU Bash
* integration/bash: New file.
* eat.el (eat-term-shell-integration-directory): New variable.
Contains path to the directory containing the scripts,
automatically updated when Eat is updated.
* eat.el (eat-exec, eat-eshell-mode): New enviroment variable
'EAT_SHELL_INTEGRATION_DIR'.
* eat.texi (Shell Integration): New chapter.
* eat.texi (Directory Tracking): Refer to 'Shell Integration'.
2022-12-03 11:14:01 +06:00