Commit graph

69 commits

Author SHA1 Message Date
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
Akib Azmain Turja
5f4f4a87d1
; * eat.el: Fix font face names. 2022-12-02 10:27:37 +06:00
Akib Azmain Turja
b65c0c40ec
Check terminal contents while testing bell
* eat-tests.el (eat-test-character-sets): Check terminal
contents.
2022-12-01 02:26:04 +06:00
Akib Azmain Turja
406d72b4b5
Refer to Info manual to setup directory tracking
* eat.el (eat-enable-directory-tracking): Refer to Info manual.
2022-12-01 02:01:11 +06:00
Akib Azmain Turja
0121c3747f
; * README.org: Fix typo. 2022-12-01 01:41:21 +06:00
Akib Azmain Turja
eac1165a1a
Support directory tracking with OSC 7
* eat.el: Require 'url'.
* eat.el (eat-enable-directory-tracking): New user option.
* eat.el (eat--t-term): New slots: 'cwd' and 'set-cwd-fn'.
* eat.el (eat--t-set-cwd, eat-term-cwd): New function.
* eat.el (eat-term-set-cwd-function): New function and
generalized variable.
* eat.el (eat--t-handle-output): Handle OSC 7.
* eat.el (eat--set-cwd): New function.
* eat.el (eat-exec): Use 'eat--set-cwd' to change current
working directory.
* eat.el (eat--eshell-invocation-directory): New variable,
local in Eshell buffers when 'eat-eshell-mode' is enabled.
* eat.el (eat--eshell-setup-proc-and-term): Save the invocation
directory of process.
* eat.el (eat--eshell-cleanup): Revert working directory to
invocation directory.
* eat.el (eat--eshell-local-mode): When enabling, make
'eat--eshell-invocation-directory' local variable and kill when
disabling.
* eat-tests.el (eat-test-set-cwd): New test.
* eat.texi (Directory Tracking): New chapter.
2022-12-01 01:40:17 +06:00
Akib Azmain Turja
29a6ab9141
Fix byte-compilation warnings on Emacs 28
* eat.el (eat-term-input-event): Fix byte-compilation warnings
on Emacs 28, caused by calling 'posn-col-row' with two
arguments on Emacs >= 29, which is not available on Emacs 28.
2022-11-30 22:40:11 +06:00
Akib Azmain Turja
b378306e36
; Write copyright year range properly in ChangeLog 2022-11-30 17:27:44 +06:00
Akib Azmain Turja
2b7dccd741
* eat.el: Use loop to define color and font faces 2022-11-30 17:26:26 +06:00
Akib Azmain Turja
16d9a5074f
; Bump version to 0.1.1
* eat.el:
* eat.texi:
Bump version.
* ChangeLog: Add ChangeLog.
2022-11-30 13:09:02 +06:00
Akib Azmain Turja
f35cbd2124
; Ignore "Bump version to 0.1" commit in ChangeLog 2022-11-30 13:08:04 +06:00
Akib Azmain Turja
de93ce07e3
Document eat-eshell-visual-command-mode in manual
* eat.texi (Eshell Terminal): Document
'eat-eshell-visual-command-mode' and suggest to set
'eshell-visual-commands' to nil.
2022-11-30 13:01:42 +06:00
Akib Azmain Turja
0cf617d60e
Fix compatibility issues with Emacs 28
* eat.el: Require 'subr-x'.
* eat.el (eat-yank, eat-yank-pop): Pass three arguments to
'mapconcat'.
* eat.el (eat--eshell-term-name): New function.
* eat.el (eat-eshell-mode): Use 'eat--eshell-term-name' instead
of using 'eat-term-name' directly.
* eat.el (eat-eshell-mode) [(< emacs-major-version 29)]: Use
'eshell-last-async-proc' instead of 'eshell-last-async-procs'.
* eat.el (eat--eshell-adjust-make-process-args)
[(< emacs-major-version 29)]: Don't check and set ':filter' and
':sentinel' of 'make-process' argument plist.  Set process
filter and sentinel from 'eshell-exec-hook'.
* eat.el (eat--eshell-adjust-make-process-args): Call
'eat--eshell-setup-proc-and-term' from 'eshell-exec-hook', not
just after 'make-process'.
2022-11-30 12:29:05 +06:00
Akib Azmain Turja
d8171b9a8c
; Ignore a commit while generating ChangeLog
The commit is summary line is "Prefer 'pcase-exhaustive' over
'pcase'", but the ChangeLog in the body isn't formatted
correctly.
2022-11-29 16:18:35 +06:00
Akib Azmain Turja
3e496e8db8
; Merge diverged elpa/eat branch of NonGNU ELPA 2022-11-29 14:59:43 +06:00
Akib Azmain Turja
1b2b7aee26
Bump version to 0.1
* eat.el:
* eat.texi:
Bump version.
2022-11-29 01:39:25 +06:00
Akib Azmain Turja
59c0745e75
Don't put 'error' as the only then part of 'if'
* eat.el (eat-semi-char-mode, eat-char-mode): Don't put 'error'
as only then part of 'if'.
2022-11-29 01:38:41 +06:00
Akib Azmain Turja
10d9f3cb56
Use 'mapc' to make & kill multiple local variables
* eat.el (eat-blink-mode, eat--cursor-blink-mode, eat-mode)
(eat--eshell-local-mode, eat-trace-replay-mode): Use 'mapc' to
make & kill multiple local variables.
2022-11-29 01:04:36 +06:00
Akib Azmain Turja
528bfe424d
Put declare-function and defvar outside functions
* eat.el (eat--flip-slow-blink-state)
(eat--flip-fast-blink-state, eat-blink-mode)
(eat--eshell-output-filter, eat--eshell-cleanup)
(eat--eshell-process-output-queue, eat--eshell-sentinel)
(eat-eshell-mode, eat--eshell-visual-sentinel)
(eat--eshell-exec-visual, eat-eshell-visual-command-mode)
(eat-project): Move 'declare-function's and 'defvar's outside.
2022-11-29 00:48:04 +06:00
Akib Azmain Turja
86e247137b
Use 'vector' directly instead of backquote
* eat.el (eat-term-make-keymap): Use 'vector' directly instead
of backquote.
2022-11-29 00:40:51 +06:00
Akib Azmain Turja
c19cf68b28
* eat.el (eat-term-make-keymap): Use 'cl-flet' 2022-11-29 00:37:47 +06:00
Akib Azmain Turja
5ce98430e8
Use more readable '?\C-\s' instead of '?\C-\ '
* eat.el (eat-term-input-event, eat-term-make-keymap): Use more
readable '?\C-\s' instead of '?\C-\ '.
2022-11-29 00:31:34 +06:00
Akib Azmain Turja
31f93da3fd
* eat.el (eat-mode): Fix char mode 'help-echo' 2022-11-29 00:28:03 +06:00
Akib Azmain Turja
9a9d9165f2
* eat.el (eat--bell): Use 'ding' instead of 'beep' 2022-11-29 00:22:39 +06:00
Akib Azmain Turja
dc99739fb8
* eat.el (eat--trace-exec): Use "-*- mode: MD -*-" 2022-11-29 00:18:28 +06:00
Akib Azmain Turja
0e82988d6f
Use 'setf' + 'plist-get' instead of 'plist-put'
* eat.el (eat--eshell-adjust-make-process-args): Use (setf (plist-get
...) ...) instead of 'plist-put' without taking the result, which is
not guaranteed to always work.
2022-11-29 00:17:15 +06:00
Akib Azmain Turja
a736f08ea9
Prefer 'and-let*' and 'when-let*' over 'when-let'
* eat.el (eat--t-set-sgr-params): Use 'and-let*' instead of 'when-let'
for side-effect free 'when-let'.
* eat.el (eat--flip-cursor-blink-state, eat--synchronize-scroll)
(eat-exec, eat--eshell-setup-proc-and-term)
(eat--eshell-synchronize-scroll, eat--eshell-visual-sentinel)
(eat--trace-replay-eval-next): Use 'when-let*' instead of 'when-let'
for 'when-let's with side-effect.
2022-11-28 23:22:52 +06:00
Akib Azmain Turja
2dd4e42773
Prefer 'pcase-exhaustive' over 'pcase'
* eat.el (eat--t-erase-in-line, eat--t-erase-in-disp)
(eat--t-set-mouse-mode, eat--t-send-device-attrs)
(eat--t-handle-output, eat-term-input-event)
(eat--manipulate-kill-ring, eat--trace-replay-eval):
Prefer 'pcase-exhaustive' over 'pcase'.
2022-11-28 23:19:56 +06:00
Akib Azmain Turja
f3fed64957
Prefer 'pcase-exhaustive' over 'pcase'
* eat.el (eat--t-erase-in-line, eat--t-erase-in-disp,
eat--t-set-mouse-mode, eat--t-send-device-attrs,
eat--t-handle-output, eat-term-input-event,
eat--manipulate-kill-ring, eat--trace-replay-eval):
Prefer 'pcase-exhaustive' over 'pcase'.
2022-11-28 22:29:15 +06:00
Akib Azmain Turja
b36f923919
* eat.el (eat--t-change-charset): Assert argument 2022-11-28 22:13:06 +06:00
Akib Azmain Turja
9a5bd15866
Combine multiple setq/setf/setq-local into one
* eat.el (eat--t-reset, eat--t-goto, eat--t-write)
(eat--t-save-cur, eat--t-enable-alt-disp)
(eat--t-change-scroll-region, eat--t-set-sgr-params)
(eat--t-manipulate-selection, eat--t-handle-output)
(eat--t-resize, eat--flip-slow-blink-state)
(eat--flip-fast-blink-state, 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-local-mode)
(eat--eshell-exec-visual, eat--trace-exec)
(eat--eshell-trace-adjust-make-process-args)
(eat--trace-replay-eval, eat-trace-replay, eat-trace--cleanup):
Combine multiple setq/setf/setq-local into one wherever
possible.
2022-11-28 21:54:55 +06:00