X-Recipient: archive-cygwin AT delorie DOT com X-SWARE-Spam-Status: No, hits=-0.1 required=5.0 tests=AWL,BAYES_40,SPF_PASS X-Spam-Check-By: sourceware.org Message-ID: <4A3153FA.8080606@aim.com> Date: Thu, 11 Jun 2009 14:59:06 -0400 From: Mark Harig User-Agent: Thunderbird 2.0.0.21 (X11/20090320) MIME-Version: 1.0 To: cygwin AT cygwin DOT com Subject: Re: Using emacs in a terminal window Content-Type: multipart/mixed; boundary="------------070002070108020307020502" X-AOL-IP: 64.12.78.137 Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com --------------070002070108020307020502 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit > 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. --- --------------070002070108020307020502 Content-Type: text/plain; name="diff.txt" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="diff.txt" comparing rxvt-cygwin-native to Eterm-256color. comparing booleans. auto_left_margin: F:T. backspaces_with_bs: T:F. can_change: F:T. prtr_silent: F:T. comparing numbers. buttons: NULL, 5. lines_of_memory: NULL, 0. max_colors: 8, 256. max_pairs: 64, 32767. comparing strings. acs_chars: '+\257\054\256-\1360\333`\004a\261f\370g\361h\260j\331k\277l\332m\300n\305o~p\304q\304r\304s_t\303u\264v\301w\302x\263y\363z\362{\343|\330~\376', '``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~'. cursor_down: '^J', '\E[B'. delete_character: NULL, '\E[P'. ena_acs: '\E(B\E)0', '\E)0'. enter_am_mode: NULL, '\E[?7h'. erase_chars: NULL, '\E[%p1%dX'. exit_am_mode: NULL, '\E[?7l'. flash_screen: '\E[?5h\E[?5l', NULL. init_1string: '\E[?47l\E=\E[?1l', '\E[?47l\E>\E[?1l'. initialize_color: NULL, '\E]4;%p1%d;rgb\072%p2%{255}%*%{1000}%/%2.2X/%p3%{255}%*%{1000}%/%2.2X/%p4%{255}%*%{1000}%/%2.2X\E\'. key_a1: '\EOw', '\E[7~'. key_a3: '\EOy', '\E[5~'. key_beg: NULL, '\EOu'. key_btab: '\E[Z', NULL. key_c1: '\EOq', '\E[8~'. key_c3: '\EOs', '\E[6~'. key_f0: '\E[21~', NULL. key_help: NULL, '\E[28~'. key_snext: '\E[6$', NULL. key_sprevious: '\E[5$', NULL. keypad_local: '\E>', ''. keypad_xmit: '\E=', ''. parm_dch: NULL, '\E[%p1%dP'. prtr_off: NULL, '\E[4i'. prtr_on: NULL, '\E[5i'. set0_des_seq: '\E(B', NULL. set1_des_seq: '\E(0', NULL. set_a_background: '\E[4%p1%dm', '\E[%?%p1%{8}%<%t4%p1%d%e%p1%{16}%<%t10%p1%{8}%-%d%e48;5;%p1%d%;m'. set_a_foreground: '\E[3%p1%dm', '\E[%?%p1%{8}%<%t3%p1%d%e%p1%{16}%<%t9%p1%{8}%-%d%e38;5;%p1%d%;m'. set_attributes: '\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;m%?%p9%t\016%e\017%;', '\E[0%?%p1%p6%|%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;m%?%p9%t\016%e\017%;'. --------------070002070108020307020502 Content-Type: text/plain; charset=us-ascii -- 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/ --------------070002070108020307020502--