You can now start Emacs inside @command{fbterm} with the command
+@example
+$ fbterm -- env TERM=fbterm emacs
+@end example
+
+In some versions of @command{fbterm}, setting @env{TERM} to
+@samp{fbterm} can be omitted. To check whether it is needed, start
+Emacs inside @command{fbterm} with the command
+
@example
$ fbterm -- emacs
@end example
+@noindent
+and type @kbd{M-x list-colors-display}. If only 8 colors are
+displayed, it is necessary; if 256 colors are displayed, it isn't.
+
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"
+alias emacs="fbterm -- env TERM=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"
+[[ "$(tty)" =~ "/dev/tty" ]] && alias emacs="fbterm -- env TERM=fbterm emacs"
@end example
The @command{fbterm} terminal emulator may define a number of key
@command{fbterm} does not define any key bindings for its own use:
@example
-# capsh --drop=cap_sys_tty_config -- -c "fbterm -- emacs"
+# capsh --drop=cap_sys_tty_config -- -c "fbterm -- env TERM=fbterm emacs"
@end example
Again you may want to add a shortcut for that command in the shell
@example
function emacs ()
@{
- CMD="fbterm -- emacs "
+ CMD="fbterm -- env TERM=fbterm emacs "
for ARG in "$@@"
do
CMD="$CMD '$ARG' "
--- /dev/null
+;;; fbterm.el -*- lexical-binding:t -*-
+
+;; Copyright (C) 2022 Free Software Foundation, Inc.
+
+;; Note that, in some versions of fbterm, the TERM environment
+;; variable is set to "linux". When that's the case, the code below
+;; will not be executed, and only 8 colors will be available. It is
+;; therefore necessary, with these versions of fbterm, to set that
+;; environment variable to "fbterm" to enable its 256 color mode
+;; extension. See also the node "Emacs in a Linux console" of the
+;; Emacs FAQ.
+
+(require 'term/xterm)
+
+(defun terminal-init-fbterm ()
+ "Terminal initialization function for fbterm."
+
+ ;; fbterm can't display underlines, even though its terminfo data
+ ;; says it can.
+ (tty-no-underline)
+
+ ;; fbterm supports xterm's 256 color mode extension.
+ (xterm-register-default-colors xterm-standard-colors))
+
+(provide 'term/fbterm)
+
+;;; fbterm.el ends here