Commit graph

13 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
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
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
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
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
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
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