Commit graph

21 commits

Author SHA1 Message Date
37f8d09d96
add fish integration 2024-10-24 22:27:29 +02:00
Akib Azmain Turja
b2ad1be411
Add message passing support
* eat.el (eat-message-handler-alist): New user option.
* eat.el (eat--handle-message): New function.
* eat.el (eat--handle-uic, eat--eshell-handle-uic): Handle
message passing sequence.
* eat.texi (Message Passing): New section in chapter "Shell
Integration".
* integration/bash (__eat_enable_integration): Remove the
unnecessary complex code to update PROMPT_COMMAND.
* integration/bash (_eat_msg):
* integration/zsh (_eat_msg):
New function.
2023-09-17 21:58:40 +06:00
Akib Azmain Turja
9e129f33a2
Don't enter prompt mode after exit till new prompt
* eat.el (eat--inhibit-prompt-mode): New variable.
* eat.el (eat--post-prompt, eat--post-cont-prompt): Check
'eat--inhibit-prompt-mode' before switching to prompt mode.
* eat.el (eat--before-new-prompt): New function.
* eat.el (eat--handle-uic): Support "before new prompt"
sequence.
* eat.el (eat-emacs-mode, eat-semi-char-mode, eat-char-mode):
Set 'eat--inhibit-prompt-mode' to t if prompt mode is enabled.
* eat.el (eat-mode): Make 'eat--inhibit-prompt-mode'
buffer-local.
* integration/bash (__eat_prompt_command):
* integration/zsh (__eat_precmd):
Send the "before new prompt" sequence.
2023-09-16 19:13:16 +06:00
Akib Azmain Turja
268d7c57b8
Add history reporting in Zsh integration script
* eat.el (eat--get-shell-history): New argument FORMAT, pass it
to 'eat--prompt-populate-input-ring'.
* eat.el (eat--handle-uic): Accept FORMAT argument in input
history reporting sequence and pass it to
'eat--get-shell-history'.
* eat.el (eat--prompt-populate-input-ring): New argument
FORMAT.  Support Zsh extended history file format.
* integration/bash (__eat_enable_integration): Send "bash" as
the history file format.
* integration/zsh (__eat_enable_integration): Send shell
history.
2023-09-16 18:55:31 +06:00
Illia Ostapyshyn
7bff1c4974
* eat.el (eat-mode): Escape '%' character in title 2023-09-14 20:48:30 +06:00
Akib Azmain Turja
baf0bb7e5f
Add prompt mode and process OSC 51 as UI Command
* eat.el (eat-enable-native-shell-prompt-editing)
(eat-prompt-input-ring-size)
(eat-prompt-move-point-for-matching-input): New user option.
* eat.el (eat--t-term): Remove slots 'cwd', 'prompt-start-fn',
'prompt-end-fn', 'cont-prompt-start-fn', 'cont-prompt-end-fn',
'cmd-start-fn' and 'cmd-finish-fn'.  Add new slot 'ui-cmd-fn'.
* eat.el (eat--t-set-cwd): Support only the format used by OSC
7.
* 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): Remove
function.
* eat.el (eat--t-ui-cmd): New function.
* eat.el (eat--t-handle-output): Remove all specialized OSC 51
handlers and call 'eat--t-ui-cmd' to handle any OSC 51
sequence.
* eat.el (eat-term-set-parameter): Set 'ui-cmd-fn' slot of
terminal when 'ui-command-function' is set.
* eat.el (eat-term-cwd): Remove function.
* eat.el (eat-term-prompt-start-function)
(eat-term-prompt-end-function, eat-term-cmd-start-function)
(eat-term-cont-prompt-start-function)
(eat-term-cont-prompt-end-function, eat-term-set-cmd-function)
(eat-term-cmd-finish-function): Remove generalized variables.
* eat.el (eat-term-send-string): New function.
* eat.el (eat-send-string-as-yank): Rename to
'eat-term-send-string-as-yank'.
All callers changed.
* eat.el (eat--set-cwd-uic, eat--post-cont-prompt): New
function.
* eat.el (eat--pre-prompt, eat--post-prompt, eat--set-cmd)
(eat--pre-cmd, eat--set-cmd-status): Remove unused first
argument.
All callers changed.
* eat.el (eat--get-shell-history, eat--handle-uic): New
function.
* eat.el (eat-prompt-mode-map): New variable.
* eat.el (eat-emacs-mode, eat-semi-char-mode, eat-char-mode):
Handle the case when prompt mode is active.
* eat.el (eat--prompt-mode-previous-mode): New variable.
* eat.el (eat--prompt-mode): New non-interactive minor mode.
* eat.el (eat-prompt-send-default, eat-prompt-send)
(eat-prompt-newline, eat-prompt-delchar-or-eof)
(eat-prompt-send-interrupt): New command.
* eat.el (eat--prompt-input-ring, eat--prompt-input-ring-index)
(eat--prompt-stored-incomplete-input)
(eat--prompt-matching-input-from-input-string): New variable.
* eat.el (eat--prompt-populate-input-ring)
(eat--prompt-reset-input-ring-vars, eat--prompt-ask-for-regexp-arg)
(eat--prompt-search-arg, eat--prompt-search-start)
(eat--prompt-prev-input-string, eat--prompt-prev-matching-input-str)
(eat--prompt-delete-input, eat--prompt-prev-matching-input-str-pos):
New function.
* eat.el (eat-prompt-previous-input, eat-prompt-next-input)
(eat-prompt-restore-input, eat-prompt-previous-matching-input)
(eat-prompt-next-matching-input, eat-prompt-find-input)
(eat-prompt-previous-matching-input-from-input)
(eat-prompt-next-matching-input-from-input): New command.
* eat.el (eat-mode): Make 'eat--prompt-mode-previous-mode',
'eat--prompt-input-ring', 'eat--prompt-input-ring-index',
'eat--prompt-stored-incomplete-input' and
'eat--prompt-matching-input-from-input-string' buffer-local.
Record undo information if
'eat-enable-native-shell-prompt-editing' is enabled.  Set
'mode-line-process' properly so that prompt mode is shown when
enabled.
* eat.el (eat--process-output-queue): Remove any narrowing
temporarily when called.  Don't
* eat.el (eat--sentinel): Disable prompt mode.  Also fix the
bug where the point centers when the program exits, instead of
going to the end of buffer.
* eat.el (eat-exec): Don't set removed generalized variables
'eat-term-prompt-start-function', 'eat-term-set-cmd-function',
'eat-term-prompt-end-function', 'eat-term-cmd-start-function'
and 'eat-term-cmd-finish-function'.  Set terminal parameter
'ui-command-function' to 'eat--handle-uic'.
* eat.el (eat--eshell-handle-uic): New function.
* eat.el (eat--eshell-output-filter): Let-bind
'inhibit-read-only' only for required parts.
* eat.el (eat--eshell-setup-proc-and-term): Set terminal
parameter 'ui-command-function' to 'eat--eshell-handle-uic'.
* eat.el (eat--eshell-sentinel): Fix the bug where the point
centers when the program exits, instead of going to the end of
buffer.
* integration/bash (__eat_enable_integration): Send shell
history.
2023-09-13 21:34:00 +06:00
Akib Azmain Turja
5c5711a97e
Fix directory tracking in Zsh
* integration/zsh (__eat_precmd): Use '$HOST' instead of
'$HOSTNAME'.
2023-03-31 10:36:56 +06:00
Akib Azmain Turja
792a98810e
Implement Zsh integration
* integration/zsh: New file.
* eat.texi (Shell Integration): Add instructions for Zsh.
* integration/bash: Always return zero on succuss.
2023-03-31 00:05:33 +06:00
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