Compare commits

...

10 commits

Author SHA1 Message Date
37f8d09d96
add fish integration 2024-10-24 22:27:29 +02:00
Akib Azmain Turja
3a6f418f55
* eat.texi (Top): Add "Sixel" to table of contents 2024-03-15 01:32:41 +06:00
Akib Azmain Turja
25989bf714
; * eat.texi (Password Input): Fix command name 2024-03-15 01:26:11 +06:00
Akib Azmain Turja
918aaa3593
; eat.el (eat-default-shell,eat-tramp-shells): Fix 2024-02-04 10:45:45 +06:00
Akib Azmain Turja
77bc6d7acc
Allow customizing the default shell
* eat.el (eat-default-shell-function, eat-shell)
(eat-tramp-shells): New user option.
* eat.el (eat-default-shell): New function.
* eat.el (eat--1, eat): Call the function specified in
'eat-default-shell-function' to get the default shell.
* eat.texi (Changing Shell): New chapter.
2024-01-04 12:00:46 +06:00
Akib Azmain Turja
2708a00ecb
* eat.el (eat-line-mode-map): Bind 'xterm-paste' 2024-01-01 21:37:10 +06:00
Akib Azmain Turja
c91451f2d1
; Release version 0.9.4
* eat.el:
* eat.texi:
Bump version.
* ChangeLog: Update.
2023-12-15 22:27:53 +06:00
Akib Azmain Turja
8fe46079df
Don't let automatic scrolling mess up the display
* eat.el (eat-mode, eat--eshell-local-mode): Set both
'scroll-margin' and 'hscroll-margin' to zero.
2023-12-15 22:24:52 +06:00
Piotr Stefański
5aaad960c8
; README.org: Fix wrong keybinding 2023-11-08 23:41:31 +06:00
Akib Azmain Turja
8ea30af42f
; * eat.texi (Fonts): Fix italic face name 2023-11-07 12:57:23 +06:00
5 changed files with 202 additions and 14 deletions

View file

@ -1,3 +1,27 @@
2023-12-15 Akib Azmain Turja <akib@disroot.org>
Don't let automatic scrolling mess up the display
* eat.el (eat-mode, eat--eshell-local-mode): Set both
'scroll-margin' and 'hscroll-margin' to zero.
2023-10-26 Akib Azmain Turja <akib@disroot.org>
Don't queue input
* eat.el (eat--pending-input-chunks)
(eat--defer-input-processing, eat--process-input-queue-timer):
Remove.
All references updated.
* eat.el (eat--send-input): Send the input immediately.
* eat.el (eat--process-input-queue): Remove.
* eat.el (eat--eshell-process-output-queue)
(eat--process-output-queue): Loop while output queue isn't
empty, set 'eat--output-queue-first-chunk-time' to 't' in the
loop.
* eat.el (eat--filter, eat--eshell-filter): Don't start a timer
if 'eat--output-queue-first-chunk-time' is 't'.
2023-10-19 Akib Azmain Turja <akib@disroot.org>
* eat.ti (eat-mono): Remove unused capability 'Ed'

View file

@ -35,13 +35,13 @@ To start Eat, run =M-x eat=. Eat has four input modes:
- =C-c C-k=: Kill process.
- =C-c C-e=: Switch to "emacs" input mode.
- =C-c M-d=: Switch to "char" input mode.
- =C-c C-e=: Switch to "line" input mode.
- =C-c C-l=: Switch to "line" input mode.
- "emacs" mode: No special keybinding, except the following:
- =C-c C-j=: Switch to "semi-char" input mode.
- =C-c M-d=: Switch to "char" input mode.
- =C-c C-e=: Switch to "line" input mode.
- =C-c C-l=: Switch to "line" input mode.
- =C-c C-k=: Kill process.
- "char" mode: All supported keys are bound to send the key to the

48
eat.el
View file

@ -4,7 +4,7 @@
;; Author: Akib Azmain Turja <akib@disroot.org>
;; Created: 2022-08-15
;; Version: 0.9.3
;; Version: 0.9.4
;; Package-Requires: ((emacs "26.1") (compat "29.1"))
;; Keywords: terminals processes
;; Homepage: https://codeberg.org/akib/emacs-eat
@ -89,6 +89,8 @@
(require 'shell)
(require 'term)
(require 'url)
(require 'tramp)
(require 'term/xterm)
;; Needed by `eat-reload'.
(defvar eat--being-loaded nil
@ -117,6 +119,26 @@
"Eat Eshell integration."
:group 'eat)
(defcustom eat-default-shell-function #'eat-default-shell
"Function to call to get the default shell to run."
:type 'function
:group 'eat-ui)
(defcustom eat-shell (or explicit-shell-file-name
(getenv "ESHELL")
shell-file-name)
"Default shell to run."
:type 'string
:group 'eat-ui)
(defcustom eat-tramp-shells '(("docker" . "/bin/sh"))
"Alist specifying the shells to run in Tramp.
Each element of form (TRAMP-METHOD . SHELL), where SHELL corresponds
to the default shell for remote directories using TRAMP-METHOD."
:type '(alist :key-type string :value-type string)
:group 'eat-ui)
(defcustom eat-buffer-name "*eat*"
"The basename used for Eat buffers.
@ -5829,6 +5851,7 @@ EVENT is the mouse event."
#'eat-line-previous-matching-input-from-input)
(define-key map [?\C-c ?\M-s]
#'eat-line-next-matching-input-from-input)
(define-key map [xterm-paste] #'xterm-paste)
map)
"Keymap for Eat line mode.")
@ -6582,6 +6605,8 @@ END if it's safe to do so."
glyphless-char-display
cursor-type
track-mouse
scroll-margin
hscroll-margin
eat-terminal
eat--synchronize-scroll-function
eat--mouse-grabbing-type
@ -6604,6 +6629,8 @@ END if it's safe to do so."
eat--shell-prompt-annotation-correction-timer))
;; This is intended; input methods don't work on read-only buffers.
(setq buffer-read-only nil)
(setq scroll-margin 0)
(setq hscroll-margin 0)
(setq eat--synchronize-scroll-function #'eat--synchronize-scroll)
(setq filter-buffer-substring-function
#'eat--filter-buffer-substring)
@ -7038,14 +7065,19 @@ PROGRAM."
(eat-exec buffer name program startfile switches))
buffer))
(defun eat-default-shell ()
"Return a shell to run."
(or (and (file-remote-p default-directory)
(with-parsed-tramp-file-name default-directory nil
(alist-get method eat-tramp-shells nil nil 'equal)))
eat-shell))
(defun eat--1 (program arg display-buffer-fn)
"Start a new Eat terminal emulator in a buffer.
PROGRAM and ARG is same as in `eat' and `eat-other-window'.
DISPLAY-BUFFER-FN is the function to display the buffer."
(let ((program (or program (or explicit-shell-file-name
(getenv "ESHELL")
shell-file-name)))
(let ((program (or program (funcall eat-default-shell-function)))
(buffer
(cond
((numberp arg)
@ -7084,9 +7116,7 @@ PROGRAM can be a shell command."
(interactive
(list (when (equal current-prefix-arg '(16))
(read-shell-command "Run program: "
(or explicit-shell-file-name
(getenv "ESHELL")
shell-file-name)))
(funcall eat-default-shell-function)))
current-prefix-arg))
(eat--1 program arg #'pop-to-buffer-same-window))
@ -7553,6 +7583,8 @@ symbol `buffer', in which case the point of current buffer is set."
:interactive nil
(let ((locals '(cursor-type
glyphless-char-display
scroll-margin
hscroll-margin
track-mouse
filter-buffer-substring-function
eat-terminal
@ -7565,6 +7597,8 @@ symbol `buffer', in which case the point of current buffer is set."
(cond
(eat--eshell-local-mode
(mapc #'make-local-variable locals)
(setq scroll-margin 0)
(setq hscroll-margin 0)
(setq eat--synchronize-scroll-function
#'eat--eshell-synchronize-scroll)
(setq filter-buffer-substring-function

View file

@ -2,8 +2,8 @@
@comment %**start of header
@setfilename eat.info
@set UPDATED 19 October 2023
@set VERSION 0.9.3
@set UPDATED 15 December 2023
@set VERSION 0.9.4
@documentencoding UTF-8
@codequotebacktick on
@codequoteundirected on
@ -67,6 +67,7 @@ Basic Operations
Advanced Customizations
* Shell Integration:: Getting the most from Eat and your shell.
* Querying Before Kill:: Confirming before you kill your terminal.
* Changing Shell:: Changing the default shell.
* Display:: The region where everything is shown.
* Scrollback:: Region for things that went out of display.
* Cursor Types:: Cursor can displayed in many forms.
@ -74,6 +75,7 @@ Advanced Customizations
* Clipboard:: Integrating kill ring with terminal.
* Colors:: Eat can show more than sixteen million colors.
* Fonts:: Eat can show up to sixteen different fonts.
* Sixel:: Eat can render Sixel graphics.
* Blinking Text:: Annoying blinking texts.
* Performance Tuning:: Fine tuning to maximize performance.
@ -460,11 +462,11 @@ By default, every keystroke gets recorded in the lossage, which can be
seen by pressing @kbd{C-h l}. This is actually a good thing, unless
you're inputting password.
@findex eat-send-command
@findex eat-send-password
Emacs doesn't record keystrokes when a password is read from the
minibuffer. However, when the password prompt is in the terminal, the
keys you use to type in your password gets recorded. To prevent this
from happening, you can use the command @command{eat-send-command},
from happening, you can use the command @command{eat-send-password},
it'll read password from the minibuffer and send it. Since the
password is read from the minibuffer, it's not recorded.
@ -676,6 +678,39 @@ integration code is executed on shell); before that it is essentially
same as @code{t}, and Eat will always query.
@end defopt
@node Changing Shell
@cindex changing default shell
@cindex changing shell
@cindex shell, default, changing
@cindex default, shell changing
@cindex shell, changing shell
@chapter Changing the Default Shell
Eat automatically uses a reasonable shell by default. However you can
customize it.
@vindex eat-shell
@defopt eat-shell
The default shell to run.
@end defopt
@vindex eat-tramp-shells
@defopt eat-tramp-shells
This user options allows you to customize default shell for each Tramp
method. It's an alist and it's elements are of form (TRAMP-METHOD
SHELL).
@end defopt
@vindex eat-default-shell-function
@defopt eat-default-shell-function
This user options gives more control on the default shell. It
specifies a function to call without any argument, whose return value
is used as the default shell.
If you change this from the default value, @code{eat-shell} and
@code{eat-tramp-shells} won't work.
@end defopt
@node Display
@cindex display
@chapter Display
@ -944,7 +979,7 @@ normal. Faint text uses the face @code{eat-term-faint}.
@cindex text, slant
@vindex eat-term-italic
Programs may request the terminal to show italic text too. Italic
text uses the customizable face @code{eat-term-faint}.
text uses the customizable face @code{eat-term-italic}.
@cindex font family
@cindex text, font family

95
integration/fish Normal file
View file

@ -0,0 +1,95 @@
# integration/fish --- Fish integration
# Copyright (C) 2022-2024 Akib Azmain Turja.
# This file is not part of GNU Emacs.
# This file is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3, or (at your option)
# any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# For a full copy of the GNU General Public License
# see <https://www.gnu.org/licenses/>.
# Features missing compared to the bash/zsh integrations:
# - Fish history import into Emacs.
# - The prompt markers are not portable, they depend on a specific prompt customization.
# - The PS2 prompt support (line continuation).
function eat_enable_integration
set -g __eat_integration_enabled yes
function __eat_chpwd --on-variable PWD
# Send the current working directory, for directory tracking.
printf '\e]51;e;A;%s;%s\e\\\\' \
"$(echo -n -- $hostname | base64)" \
"$(echo -n -- $PWD | base64)"
end
function __eat_preexec --on-event fish_preexec
set current_command $argv[1]
# Send current command.
printf '\e]51;e;F;%s\e\\\\' \
"$(echo -n -- $current_command | base64)"
# Send pre-exec sequence.
printf '\e]51;e;G\e\\\\'
# Update title to include the command running.
# "${PWD/$HOME/'~'}" converts "/home/akib/foo/" to "~/foo/".
# The next one is substituted with '$', or '#' if we're "root".
printf '\e]2;%s@%s:%s%s\e\\\\' "$USER" "$hostname" \
"$(string replace $HOME '~' $PWD)" \
"$(fish_is_root_user && echo '#' || echo '$')" \
"$current_command"
end
function __eat_postexec --on-event fish_postexec
set exit_status $status
# Send exit status.
printf '\e]51;e;H;%i\e\\\\' $exit_status
# Inform that a new prompt is going to be printed.
printf '\e]51;e;J\e\\\\'
# Update title.
# "${PWD/$HOME/'~'}" converts "/home/akib/org/" to "~/org/".
# The next one is substituted with '$', or '#' if we're "root".
printf '\e]2;%s@%s:%s%s\e\\\\' "$USER" "$hostname" \
"$(string replace $HOME '~' $PWD)" \
"$(fish_is_root_user && echo '#' || echo '$')"
end
# FIXME: These are custom variables for a modified prompt, not native to Fish.
set --global --prepend fish_before_prompt \
(printf '\e]51;e;B\e\\\\')
set --global --append fish_after_prompt \
(printf '\e]51;e;C\e\\\\')
end
function _eat_msg
set msg (printf '\e]51;e;M')
for arg in $argv
set msg $msg "$(echo -n -- $arg | base64)"
end
printf "%s\e\\\\" (string join ";" $msg)
end
if status is-interactive
and test -z $__eat_integration_enabled
and set -q EAT_SHELL_INTEGRATION_DIR
and string match -q "eat-*" $TERM
eat_enable_integration
end
# Local Variables:
# mode: fish
# End: