* can't global-set-key in emacs -nw @ 2004-02-01 0:27 Joel Smith 2004-02-01 6:33 ` Eli Zaretskii 2004-02-01 16:56 ` Stefan Monnier 0 siblings, 2 replies; 6+ messages in thread From: Joel Smith @ 2004-02-01 0:27 UTC (permalink / raw) using xterm or aterm i can't set any keys using the shift key. for example (global-set-key [(shift right)] "\C-e") won't do anything in aterm. in xterm it inserts 2C. resetting the home, end keys doesn't work, and backspace starts help in aterm. it's fine in xterm. finally the mouse doesn't work. any advice would be greatly appreciated. ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: can't global-set-key in emacs -nw 2004-02-01 0:27 can't global-set-key in emacs -nw Joel Smith @ 2004-02-01 6:33 ` Eli Zaretskii 2004-02-01 16:56 ` Stefan Monnier 1 sibling, 0 replies; 6+ messages in thread From: Eli Zaretskii @ 2004-02-01 6:33 UTC (permalink / raw) > Newsgroups: gnu.emacs.help > From: Joel Smith <joelvsmith@earthlink.net> > Date: Sun, 01 Feb 2004 00:27:42 GMT > > using xterm or aterm i can't set any keys using the shift key. for > example > > (global-set-key [(shift right)] "\C-e") > > won't do anything in aterm. in xterm it inserts 2C. > > resetting the home, end keys doesn't work, and backspace starts help > in aterm. it's fine in xterm. You need to set up your keyboard configuration (sorry, I don't know how exactly). Using "C-h l", you will see that Emacs doesn't get any useful key codes when you press the problematic keys. > finally the mouse doesn't work. You mean, it doesn't work in Emacs? If so, you will have to set up xt-mouse.el, I think. Basically, Emacs doesn't support the mouse on a text terminal without some package such as xt-mouse. ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: can't global-set-key in emacs -nw 2004-02-01 0:27 can't global-set-key in emacs -nw Joel Smith 2004-02-01 6:33 ` Eli Zaretskii @ 2004-02-01 16:56 ` Stefan Monnier 2004-02-01 22:57 ` Peter Heslin 1 sibling, 1 reply; 6+ messages in thread From: Stefan Monnier @ 2004-02-01 16:56 UTC (permalink / raw) > using xterm or aterm i can't set any keys using the shift key. for > example > (global-set-key [(shift right)] "\C-e") > won't do anything in aterm. in xterm it inserts 2C. First, you need to make sure your terminal sends some useful byte-sequence when you press those keys. Most terminal emulators send the same sequence for shirt-right than for right, so Emacs simply can't tell the difference. Once your terminal emulator is properly configured you need to tell Emacs what that seuqnce is by appropriate (define-key function-key-map ...) calls. See lisp/term/xterm.el for some default settings used if your terminal is xterm. The same terminal emulator may send different sequences depending on the configuration, so there's no standard sadly. > resetting the home, end keys doesn't work, and backspace starts help > in aterm. it's fine in xterm. I.e. in your xterm, the backspace key sends code 127 (aka C-?) whereas in your aterm it sends code 8 (aka C-h). Fix your aterm config. > finally the mouse doesn't work. M-x xterm-mouse-mode might help. I don't know if aterm supports this xterm-specific extension. Stefan ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: can't global-set-key in emacs -nw 2004-02-01 16:56 ` Stefan Monnier @ 2004-02-01 22:57 ` Peter Heslin 2004-02-02 0:44 ` Stefan Monnier 0 siblings, 1 reply; 6+ messages in thread From: Peter Heslin @ 2004-02-01 22:57 UTC (permalink / raw) Stefan Monnier <monnier@iro.umontreal.ca> wrote in message news:<jwvad427nhg.fsf-monnier+gnu.emacs.help@asado.iro.umontreal.ca>... > Once your terminal emulator is properly configured you need to tell Emacs > what that seuqnce is by appropriate (define-key function-key-map ...) calls. > See lisp/term/xterm.el for some default settings used if your terminal > is xterm. The same terminal emulator may send different sequences > depending on the configuration, so there's no standard sadly. Assuming the user has not changed any escape sequences via resources settings, is this still really the case? On my (Debian x86) system, xterm and gnome-terminal (which gives $TERM as "xterm") seem to agree on a quasi-standard set of escape sequences for function-keys modified by shift, control, alt, shift-control and shift-alt, all of which are distinct. But in term/xterm.el, only the unmodified function-key escapes are translated. Is there a good reason for this absence? Are the escape sequences for modified function-keys in fact different in xterm from system to system? Is it really true that life is messier than it seems on my system? I am aware that the escape sequences for rxvt and rxvt-derived terminal emulators are completely different, but again term/rxvt.el translates some of these -- including control-modified function keys -- but not all, such as shift-control modified function-keys. Again, is there a good reason for this omission? Peter ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: can't global-set-key in emacs -nw 2004-02-01 22:57 ` Peter Heslin @ 2004-02-02 0:44 ` Stefan Monnier 2004-02-02 21:04 ` Peter Heslin 0 siblings, 1 reply; 6+ messages in thread From: Stefan Monnier @ 2004-02-02 0:44 UTC (permalink / raw) >> Once your terminal emulator is properly configured you need to tell Emacs >> what that seuqnce is by appropriate (define-key function-key-map ...) calls. >> See lisp/term/xterm.el for some default settings used if your terminal >> is xterm. The same terminal emulator may send different sequences >> depending on the configuration, so there's no standard sadly. > Assuming the user has not changed any escape sequences via resources > settings, is this still really the case? Well, yes, it seems. > On my (Debian x86) system, xterm and gnome-terminal (which gives $TERM > as "xterm") seem to agree on a quasi-standard set of escape sequences > for function-keys modified by shift, control, alt, shift-control and > shift-alt, all of which are distinct. Xterm on Redhat did not send the same sequences as xterm from XFree86, last time I checked (which was a whilie back admittedly). > But in term/xterm.el, only the unmodified function-key escapes are > translated. Is there a good reason for this absence? Are the escape > sequences for modified function-keys in fact different in xterm from > system to system? Is it really true that life is messier than it seems on > my system? Since adding sequences to lisp/term/xterm.el is mostly harmless even if the sequences are not used (as long as there's no conflict), the CVS version of the file has more entries because I've added the sequences I've come across. You may want to check that version of the file (from savannah.gnu.org/projects/emacs, for example) and tell me if you know of other sequences so I can add them. > I am aware that the escape sequences for rxvt and rxvt-derived > terminal emulators are completely different, but again term/rxvt.el > translates some of these -- including control-modified function keys > -- but not all, such as shift-control modified function-keys. Again, > is there a good reason for this omission? I wouldn't know. I never use rxvt. Stefan ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: can't global-set-key in emacs -nw 2004-02-02 0:44 ` Stefan Monnier @ 2004-02-02 21:04 ` Peter Heslin 0 siblings, 0 replies; 6+ messages in thread From: Peter Heslin @ 2004-02-02 21:04 UTC (permalink / raw) Stefan Monnier <monnier@iro.umontreal.ca> wrote in message news:<jwvwu7648no.fsf-monnier+gnu.emacs.help@asado.iro.umontreal.ca>... > >> Once your terminal emulator is properly configured you need to tell Emacs > >> what that seuqnce is by appropriate (define-key function-key-map ...) calls. > >> See lisp/term/xterm.el for some default settings used if your terminal > >> is xterm. The same terminal emulator may send different sequences > >> depending on the configuration, so there's no standard sadly. > > > Assuming the user has not changed any escape sequences via resources > > settings, is this still really the case? > > Well, yes, it seems. Hi Stefan, I decided to check on this. I went and downloaded the current source of xterm from http://dickey.his.com/xterm/xterm.html, and there is a document with it called ctlseqs.ms, which confirms that the behavior I am seeing on my system is the documented, correct behavior of current xterm. It has the following statement:: <quote> In normal mode, i.e., a Sun/PC keyboard when the sunKeyboard resource is false, xterm recognizes function key modifiers which are parameters appended before the final character of the control sequence. Code Modifiers --------------------------------- 2 Shift 3 Alt 4 Shift + Alt 5 Control 6 Shift + Control 7 Alt + Control 8 Shift + Alt + Control --------------------------------- For example, shift-F5 would be sent as CSI 1 5 ; 2 ~ If the alwaysUseMods resource is set, the Meta modifier also is recog nized, making parameters 9 through 16. </quote> In other words, all of these combinations of modifiers on function keys send distinct and documented escape sequences that Emacs could and should interpret correctly. So I think we should regard systems on which xterm behaves differently as broken. I think it's more likely that it's just that some distributions have older versions of xterm stuck in them out of inertia, rather than that they are deliberately wanting different behavior. I would be happy to work on adding these escape sequences to term/xterm.el, if you think such a patch would be acceptable in principle. My only question would be the Alt/Meta issue. Xterm clearly regards Alt as the more important key, with Meta available additionally on some systems where the alwaysUseMods resource is set. This might be taken to imply that the Alt combinations that xterm sees ought to be translated to Emacs Meta, which is the more important key for Emacs. But then people who have and use both Alt and Meta keys would probably not like to see them switched around when using xterm. Is there a way that we could have the best of both worlds? In other words, can we send Alt to Emacs as Alt and Meta as Meta, but have it easy for users who just use the Alt key as a Meta key not to have to duplicate all of their Meta-Fx bindings as Alt-Fx also, just to work under xterm? I suspect that I'm not the only one who would like to have it so that Emacs just treats my Alt key as Meta both under X and in xterm. Peter ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2004-02-02 21:04 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2004-02-01 0:27 can't global-set-key in emacs -nw Joel Smith 2004-02-01 6:33 ` Eli Zaretskii 2004-02-01 16:56 ` Stefan Monnier 2004-02-01 22:57 ` Peter Heslin 2004-02-02 0:44 ` Stefan Monnier 2004-02-02 21:04 ` Peter Heslin
Code repositories for project(s) associated with this external index https://git.savannah.gnu.org/cgit/emacs.git https://git.savannah.gnu.org/cgit/emacs/org-mode.git This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.