Commit graph

192 commits

Author SHA1 Message Date
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
a95ca85927
* eat.el: Fix bright faces face definitions 2022-12-04 16:42:34 +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
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
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
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
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
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
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
Akib Azmain Turja
bc4bd45fa6
Avoid copying STR to the extent possible
* eat.el (eat--t-write): Take two more optional arguments BEG
and END to avoid copying STR multiple times unneccessarily.
2022-11-28 20:50:58 +06:00
Akib Azmain Turja
9d14bbeaa5
Support multi-column characters properly
* eat.el (eat--t-write): Use 'char-width' instead of the
unpredictable 'string-width' to support multi-column characters
properly.
2022-11-28 19:37:17 +06:00
Akib Azmain Turja
6a94082eff
Use hash table to convert from charset
* eat.el (eat--t-dec-line-drawing-chars): New constant
containing the hash table.
* eat.el (eat--t-write): Use hash-table instead alist while
converting from DEC Line Drawing charset.
2022-11-28 18:48:38 +06:00
Akib Azmain Turja
6271968c86
Use as less let-bindings as possible
* eat.el (eat--t-goto-bol, eat--t-goto-eol)
(eat--t-repeated-insert, eat--t-cur-right, eat--t-cur-left)
(eat--t-cur-horizontal-abs, eat--t-beg-of-next-line)
(eat--t-beg-of-prev-line, eat--t-cur-down, eat--t-cur-up)
(eat--t-cur-vertical-abs, eat--t-scroll-up, eat--t-scroll-down)
(eat--t-write, eat--t-horizontal-tab)
(eat--t-horizontal-backtab, eat--t-reverse-index)
(eat--t-erase-in-line, eat--t-erase-in-disp)
(eat--t-insert-char, eat--t-delete-char, eat--t-erase-char)
(eat--t-insert-line, eat--t-delete-line)
(eat--t-repeat-last-char, eat--t-change-scroll-region)
(eat--t-send-device-attrs): Minimize let-binding count.
* eat.el (eat--t-break-long-line, eat--t-write)
(eat-trace-replay): Use replace 'propertize' call with already
propertized string.
2022-11-28 18:23:43 +06:00
Akib Azmain Turja
64c537da78
Replace 'let*' with 'let' wherever possible
* eat.el (eat--t-eol, eat--t-reset, eat--t-erase-in-disp)
(eat--t-disable-alt-disp, eat--t-resize, eat-term-redisplay)
(eat-term-input-event, eat--adjust-process-window-size): Use
'let' instead of 'let*' wherever possible.
* eat.el (eat--eshell-exec-visual): Use (VAR nil) form instead
of VAR form in 'let*' variable list.
2022-11-28 12:40:19 +06:00
Akib Azmain Turja
0638ff6212
Experimentally support for multi-column characters
* eat.el (eat--t-move-before-to-safe, eat--t-make-pos-safe)
(eat--t-fix-partial-multi-col-char): New function.
* eat.el (eat--t-write): Handle multi-column characters.
* eat.el (eat--t-insert-char, eat--t-delete-char)
(eat--t-erase-char): Handle multi-column characters on the
display while manipulating text.
2022-11-28 03:01:45 +06:00
Akib Azmain Turja
f65a6b0188
; * eat.el: Use ?\s everywhere as space character 2022-11-27 00:21:56 +06:00
Akib Azmain Turja
ebdbba0c4b
Use third argument of posn-col-row on Emacs >= 29
* eat.el (eat-term-input-event): Use USE-WINDOW argument of
'posn-col-row' to support text scaling properly, but only on
Emacs >= 29 since on Emacs 28 'posn-col-row' takes only one
argument.
2022-11-25 13:06:10 +06:00
Akib Azmain Turja
3464e6b68c
; Fix typo in summany line 2022-11-24 19:07:08 +06:00
Akib Azmain Turja
06e45d68b9
Implement the terminal
This includes everything written from 2022-08-15 up to now.
* .dir-locals.el:
* CONTRIBUTE:
* COPYING:
* Makefile:
* NEWS:
* README.org:
* eat-tests.el:
* eat.el:
* eat.texi:
* eat.ti:
* fdl.texi:
* gitlog-to-changelog:
* gpl.texi:
* make-changelog:
* texinfo.tex:
New file.
2022-11-24 14:26:03 +06:00