Using emacs in a terminal window
Mark Harig
idirectscm@aim.com
Thu Jun 11 18:59:00 GMT 2009
> Yes, but nevertheless the TERM setting needs to fit the terminal that
> Emacs is actually running in, so "rxvt" (or some variation thereof)
> for rxvt and "xterm" for xterm or mintty. As Ken said, the "Eterm"
> setting is intended for programs that run inside emacs' builtin
> terminal. Using "Eterm*" outside that might appear to work because
> many of its capabilities will be the same as with other terminals, but
> there will also be things that don't fit.
Let's consider the case of the Cygwin Bash Shell (which runs the batch
file 'cygwin.bat'). In this case, we do not want to set TERM (which
defaults to 'cygwin') to 'Eterm-256color'. If we do, then terminal-mode
emacs will attempt to use capabilities that Cygwin bash running inside
cmd.exe does not support. So, the general principal of not exceeding
the capabilities of the terminal that the application is running in is
correct.
Similarly, if we were running Emacs in a physical terminal, then we
would need to be careful to tell Emacs about the correct set of
control strings to send to the terminal. Of course, we are not
generally, with Cygwin, running Emacs on a physical terminal
so we do not have the restrictions of, say, a VT100.
Leaving aside the very limited Cygwin Bash Shell and physical
terminals, do the Cygwin terminal emulators have some capabilities
that 'Eterm-256color' restricts, or, conversely, does 'Eterm-256color'
attempt to use some capability that the terminal emulators do
not support? If so, then I would like to know what they are.
Here are some differences between the terminfo capabilities
'rxvt-cygwin-native' and 'Eterm-256color':
1. max_colors:
rxvt - max_colors: 8
Eterm - max_colors: 256
We do not want to limit Emacs to 8 colors, and having
Eterm-256color set the value to 256 does not cause
any problem for rxvt.
2. auto_left_margin:
rxvt - False
Eterm - True
So, when you reach the left margin in rxvt, it will not
automatically wrap back to the previous line. In Eterm,
you will. Does it matter for Emacs? No.
3. key_f0 / key_help:
rxvt - key_f0: \E[21~, key_help: NULL
Eterm - key_f0: NULL, key_help: \E28~
So, rxvt defines a Function key 0, which most modern
keyboards do not have, correct? And Eterm defines
the "Help" key, which modern keyboards do not have
(this is not the F1 key). Neither key matters for Emacs.
4. key_a1, key_a3, key_c1, key_c3:
These are the Home/PgUp/PgDn/End keys
rxvt - \E0w, \E0y, \E0q, \E0s
Eterm - \E[7~, \E[5~, \E[8~, \E[6~
Does this difference in key definitions matter in
Cygwin's terminal-mode Emacs running in rxvt?
No. A test reveals that Emacs translates the
keycodes to the same control-char sequence
regardless of whether Emacs is started with
TERM set to 'rxvt-cygwin-native' or 'Eterm-256color':
Home: ^[[7~
PgUp: ^[[5~
PgDn: ^[[6~
End: ^[[8~
I am attaching to this message a complete listing of
the differences between the 'rxvt-cygwin-native' and
the 'Eterm-256color' terminfo capability files. Please
let me know if there is some critical capability that
'rxvt-cygwin-native' provides that 'Eterm-256color'
lacks, or, conversely, if 'Eterm-256color' exceeds
some capability of 'rxvt-cygwin-native' which results
in defective behavior by Emacs. I would really like
to know.
Here are three reasons for using 'env TERM=Eterm-256color emacs...':
1. More distinct visual elements can be seen in Emacs's display.
(I described what some of these were in a previous message.)
The developers of Emacs have written it to make these
elements available to provide information that would not
be available otherwise. In general, we want to provide
to Emacs the maximum number of terminal capabilities
that we can so that the code can make use of those
capabilities instead of using a lowest-common-denominator
capability.
2. The appearance of terminal-mode Emacs more closely matches
the default display of "native-mode, windowing" Emacs (either
MS-Windows or X-Windows).
3. There is the possibility of a more consistent display across
different terminal emulators (assuming that the terminal
emulators will support the Eterm-256color capabilities).
We now come back to the "judgement" question: In terminal-
mode Emacs under Cygwin, would it be a better default for
it to be started with TERM set to 'Eterm-256color'? If not,
then -- specifically -- why not? What defects appear, that
outweigh the benefits listed above? I would like to know
what those are. And it would be helpful if replies were
confined to those users who actually use terminal-mode
Emacs, and who use it with the suggested TERM setting,
preferably in 'rxvt', 'mintty', or 'screen' running in one of
those terminal emulators.
---
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: diff.txt
URL: <http://cygwin.com/pipermail/cygwin/attachments/20090611/49197908/attachment.txt>
-------------- next part --------------
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/
More information about the Cygwin
mailing list