From eab01e693b3935f719310ed1f24f8b6b08899cce Mon Sep 17 00:00:00 2001 From: Akib Azmain Turja Date: Thu, 30 Mar 2023 13:25:16 +0600 Subject: [PATCH] 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'. --- Makefile | 2 +- eat.el | 34 ++++++++++++++++++++++++++++++++++ eat.texi | 30 +++++++++++++++++++++--------- 3 files changed, 56 insertions(+), 10 deletions(-) diff --git a/Makefile b/Makefile index cc509b1..558d360 100644 --- a/Makefile +++ b/Makefile @@ -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 diff --git a/eat.el b/eat.el index 16d5485..e01ee3a 100644 --- a/eat.el +++ b/eat.el @@ -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. diff --git a/eat.texi b/eat.texi index 0cb4ab9..83e753a 100644 --- a/eat.texi +++ b/eat.texi @@ -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