Add new command 'eat-compile-terminfo'

* eat.el (eat-compile-terminfo): New command.
* eat.texi (Hello Terminal): Refer to 'Common Problems'.
* eat.texi (Common Problems): Add instructions to compile
Terminfo databases with 'eat-compile-terminfo'.
This commit is contained in:
Akib Azmain Turja 2023-03-30 13:25:16 +06:00
parent 26d83d04c1
commit eab01e693b
No known key found for this signature in database
GPG key ID: 5535FCF54D88616B
3 changed files with 56 additions and 10 deletions

View file

@ -38,7 +38,7 @@ pdf: eat.pdf
terminfo: eat.ti
test -d terminfo || mkdir terminfo
env TERMINFO=./terminfo $(TIC) -x eat.ti
# We don't know which directory was created, it depend on the
# We don't know which directory was created, it depends on the
# case-sensitivity of the file-system. So make sure both are created.
test -d terminfo/e || mkdir terminfo/e
test -d terminfo/65 || mkdir terminfo/65

34
eat.el
View file

@ -6636,6 +6636,40 @@ N defaults to 1. Interactively, N is the prefix argument."
"]"))
(add-hook 'kill-buffer-hook #'eat-trace--cleanup nil t))
;;;; Miscellaneous.
(defun eat-compile-terminfo ()
"Compile terminfo databases of Eat."
(interactive)
;; Check for required files and programs.
(let ((source-path (expand-file-name "eat.ti" eat--install-path))
(tic-path (executable-find "tic")))
(unless (file-exists-p source-path)
(error "Eat not installed properly: %s"
"Terminfo source file not found"))
(unless tic-path
(error "Terminfo compiler `tic' not found"))
(message "Compiling terminfo databases...")
;; Compile.
(let* ((command (format "env TERMINFO=\"%s\" %s -x %s"
eat-term-terminfo-directory tic-path
source-path))
(status
(with-temp-buffer
(make-directory eat-term-terminfo-directory 'parents)
(let ((proc (start-process-shell-command
"eat-terminfo-compile"
(current-buffer) command)))
(while (process-live-p proc)
(sleep-for 0.02))
(process-exit-status proc)))))
(if (= status 0)
(message "Compiling terminfo databases...done")
(message "Compiling terminfo databases...error")
(error "Command `%s' exited with non-zero exit code %i"
command status)))))
;;;; Footer.

View file

@ -121,7 +121,8 @@ terminal and run the default shell
(@pxref{Interactive Shell,,, emacs, GNU Emacs Manual}) in it. You
should get a shell prompt and be able to write shell commands and
execute them. Full screen programs like @samp{htop}, @samp{lynx} and
Emacs will work inside it, just like other any other terminal.
Emacs will work inside it, just like other any other terminal. (If
the terminal doesn't work as expected, @pxref{Common Problems}.)
If an Eat terminal already exists, @kbd{M-x eat} will switch to it.
To create a new terminal, call it with a prefix argument like this,
@ -939,22 +940,33 @@ Eat does something unexpected, such as hangs, garbled text, etc.
@section Terminal Not Recognized
If your program says that it can't recognize the terminal, probably
the @env{TERM} environment has a wrong value.
the @env{TERM} environment variable has a wrong value.
@vindex eat-term-name
Check the value of @env{TERM}, if it's not set to something like
@samp{eat-...}, check the user option @code{eat-term-name}. If that's
correct that your shell might be changing the @env{TERM} environment
variable. If @code{eat-term-name} isn't correct, customize to a
suitable value and try again, your problem should be fixed.
@vindex eat-term-terminfo-directory
If @env{TERM} has the correct value, then probably the Terminfo
entries of Eat are missing. This can happen if you manually install
Eat. Check that whether the values of the environment value
@env{TERM} and the user option @code{eat-term-terminfo-directory}
match. If they match, customize @code{eat-term-terminfo-directory} to
the directory that contains the Terminfo database, the program should
now recognize Eat. If they don't match, then your shell is probably
responsible for the problem.
databases of Eat are missing. This can happen if you have installed
Eat without using the package from NonGNU ELPA
(@pxref{Packages,,, emacs, GNU Emacs Manual}). Check that whether
the values of the environment variable @env{TERMINFO} and the user
option @code{eat-term-terminfo-directory} match. If they match,
customize @code{eat-term-terminfo-directory} to the directory
containing the Terminfo databases, the program should now recognize
Eat. If they don't match, then your shell is probably responsible for
the problem.
@findex eat-compile-terminfo
If you can't find the directory containing Terminfo databases, you can
compile it yourself. First, set @code{eat-term-terminfo-directory} to
the directory where to put the Terminfo databases. Then invoke the
command @command{eat-compile-terminfo} to compile the Terminfo
databases.
@node Garbled Text
@cindex garbled text