From: Gregory Heytings Date: Mon, 29 Aug 2022 16:06:37 +0000 (+0000) Subject: Recommend using fbterm in the Linux console. X-Git-Tag: emacs-28.2~19 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=2d9a391727;p=emacs.git Recommend using fbterm in the Linux console. * doc/misc/efaq.texi (Emacs in a Linux console): New node. (Common requests): Entry for the new node. * etc/PROBLEMS (Linux console problems...): Mention the new FAQ node. --- diff --git a/doc/misc/efaq.texi b/doc/misc/efaq.texi index 373efe9ad5f..2da37a1d215 100644 --- a/doc/misc/efaq.texi +++ b/doc/misc/efaq.texi @@ -1603,6 +1603,7 @@ is better to write ``Emacs and XEmacs.'' * Filling paragraphs with a single space:: * Escape sequences in shell output:: * Fullscreen mode on MS-Windows:: +* Emacs in a Linux console:: @end menu @node Setting up a customization file @@ -3020,6 +3021,90 @@ To compute the correct values for width and height, first maximize the Emacs frame and then evaluate @code{(frame-height)} and @code{(frame-width)} with @kbd{M-:}. +@node Emacs in a Linux console +@section How can I alleviate the limitations of the Linux console? +@cindex Console, Linux console, TTY, fbterm + +If possible, we recommend running Emacs inside @command{fbterm}, when +in a Linux console. This brings the Linux console on par with most +terminal emulators under X. To do this, install @command{fbterm}, for +example with the package manager of your GNU/Linux distribution, and +execute the command + +@example +$ fbterm +@end example + +This will create a sample configuration file @file{~/.fbtermrc} in +your home directory. Edit that file and change the options +@code{font-names} and @code{font-size} if necessary. For the former, +you can choose one or more of the lines in the output of the following +command, separated by commas: + +@example +$ fc-list :spacing=mono family | sed 's/ /\\ /g' +@end example + +You can now start Emacs inside @command{fbterm} with the command + +@example +$ fbterm -- emacs +@end example + +You may want to add an alias for that command in your shell +configuration file. For example, if you use Bash, you can add the +following line to your @file{~/.bashrc} file: + +@example +alias emacs="fbterm -- emacs" +@end example + +@noindent +or, if you use Emacs both in the Linux console and under X: + +@example +[[ "$(tty)" =~ "/dev/tty" ]] && alias emacs="fbterm -- emacs" +@end example + +The @command{fbterm} terminal emulator may define a number of key +bindings for its own use, some of which conflict with those that Emacs +uses. Execute the following two commands as root to ensure that +@command{fbterm} does not define these key bindings: + +@example +# chmod a-s `which fbterm` +# setcap cap_sys_tty_config=-ep `which fbterm` +@end example + +If you use Emacs as root, the above is not enough however, because the +root user has all privileges. You can use the following command to +start Emacs inside @command{fbterm} as root while ensuring that +@command{fbterm} does not define any key bindings for its own use: + +@example +# capsh --drop=cap_sys_tty_config -- -c "fbterm -- emacs" +@end example + +Again you may want to add a shortcut for that command in the shell +configuration file of the root user. In this case however, it is not +possible to use an alias, because the command line arguments passed to +Emacs need to be inserted in the string at the end of the command. A +wrapper script or a function can be used to do that. For example, if +you use Bash, you can add the following function in the root user +@file{~/.bashrc} file: + +@example +function emacs () +@{ + CMD="fbterm -- emacs " + for ARG in "$@@" + do + CMD="$CMD '$ARG' " + done + capsh --drop=cap_sys_tty_config -- -c "$CMD" +@} +@end example + @c ------------------------------------------------------------ @node Bugs and problems @chapter Bugs and problems diff --git a/etc/PROBLEMS b/etc/PROBLEMS index 2a82995c994..9e0b0148ba3 100644 --- a/etc/PROBLEMS +++ b/etc/PROBLEMS @@ -2108,6 +2108,13 @@ term/xterm.el) for more details. *** Linux console problems with double-width characters +If possible, we recommend running Emacs inside fbterm, when in a Linux +console (see the node "Emacs in a Linux console" in the Emacs FAQ). +Most Unicode characters should then be displayed correctly. + +If that is not possible, the following may be useful to alleviate the +problem of displaying Unicode characters in a raw console. + The Linux console declares UTF-8 encoding, but supports only a limited number of Unicode characters, and can cause Emacs produce corrupted or garbled display with some unusual characters and sequences. Emacs 28