mirror of
https://git.savannah.gnu.org/git/emacs.git
synced 2024-11-23 07:19:15 +00:00
Enable 256 colors in fbterm.
* lisp/term/fbterm.el: New file. * doc/misc/efaq.texi (Emacs in a Linux console): Document the TERM environment variable with which the new file is used.
This commit is contained in:
parent
bbc23ca8ab
commit
8807a4f532
@ -3047,23 +3047,35 @@ $ fc-list :spacing=mono family | sed 's/ /\\ /g'
|
||||
|
||||
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
|
||||
@ -3082,7 +3094,7 @@ 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"
|
||||
# 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
|
||||
@ -3096,7 +3108,7 @@ you use Bash, you can add the following function in the root user
|
||||
@example
|
||||
function emacs ()
|
||||
@{
|
||||
CMD="fbterm -- emacs "
|
||||
CMD="fbterm -- env TERM=fbterm emacs "
|
||||
for ARG in "$@@"
|
||||
do
|
||||
CMD="$CMD '$ARG' "
|
||||
|
27
lisp/term/fbterm.el
Normal file
27
lisp/term/fbterm.el
Normal file
@ -0,0 +1,27 @@
|
||||
;;; 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
|
Loading…
Reference in New Issue
Block a user