* C-<digit> key bindings not working on console @ 2014-01-23 10:50 Thorsten Jolitz 2014-01-23 11:00 ` Thorsten Jolitz 2014-01-23 14:17 ` Stefan Monnier 0 siblings, 2 replies; 14+ messages in thread From: Thorsten Jolitz @ 2014-01-23 10:50 UTC (permalink / raw) To: help-gnu-emacs Hi List, I have in some modes keybindings defined like ,------ | C-3 f `------ and they work under X11, just like C-<digit> can replace C-u <digit> as argument for commands: C-4 n and C-u 4 n prints ,----- | nnnn `----- in the scratch buffer under X11. -- cheers, Thorsten ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: C-<digit> key bindings not working on console 2014-01-23 10:50 C-<digit> key bindings not working on console Thorsten Jolitz @ 2014-01-23 11:00 ` Thorsten Jolitz 2014-01-23 12:48 ` Tassilo Horn 2014-01-23 14:17 ` Stefan Monnier 1 sibling, 1 reply; 14+ messages in thread From: Thorsten Jolitz @ 2014-01-23 11:00 UTC (permalink / raw) To: help-gnu-emacs Thorsten Jolitz <tjolitz@gmail.com> writes: PS [sorry, that post was accidentally sent too early, here is the full version] I have in some modes keybindings defined like ,------ | C-3 f `------ and they work under X11, just like C-<digit> can replace C-u <digit> as argument for commands: ,------------------ | C-4 n and C-u 4 n `------------------ both print ,----- | nnnn `----- in the scratch buffer under X11 (as far as I remember, can't test right now). Both things do not work for me anymore working without X11 on the console, although most of the usual C- and M- bindings in Emacs do work? Is that a general problem or a specific problem related to my configs? #+BEGIN_SRC emacs-lisp (message "%s" (emacs-version)) #+END_SRC #+RESULTS: : GNU Emacs 24.3.1 (x86_64-unknown-linux-gnu, GTK+ Version 3.10.6) : of 2014-01-18 on mnt-storage-buildroots-staging-x86_64-eric -- cheers, Thorsten ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: C-<digit> key bindings not working on console 2014-01-23 11:00 ` Thorsten Jolitz @ 2014-01-23 12:48 ` Tassilo Horn 2014-01-23 13:00 ` Thorsten Jolitz 0 siblings, 1 reply; 14+ messages in thread From: Tassilo Horn @ 2014-01-23 12:48 UTC (permalink / raw) To: Thorsten Jolitz; +Cc: help-gnu-emacs Thorsten Jolitz <tjolitz@gmail.com> writes: > Both things do not work for me anymore working without X11 on the > console, although most of the usual C- and M- bindings in Emacs do > work? Is that a general problem or a specific problem related to my > configs? I can confirm that C-<digit> is not recognized on the linux console, M-<digit> however is. But I also don't know it it's a general limitation. Bye, Tassilo ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: C-<digit> key bindings not working on console 2014-01-23 12:48 ` Tassilo Horn @ 2014-01-23 13:00 ` Thorsten Jolitz 2014-01-23 13:39 ` Tassilo Horn 0 siblings, 1 reply; 14+ messages in thread From: Thorsten Jolitz @ 2014-01-23 13:00 UTC (permalink / raw) To: help-gnu-emacs Tassilo Horn <tsdh@gnu.org> writes: > Thorsten Jolitz <tjolitz@gmail.com> writes: > >> Both things do not work for me anymore working without X11 on the >> console, although most of the usual C- and M- bindings in Emacs do >> work? Is that a general problem or a specific problem related to my >> configs? > > I can confirm that C-<digit> is not recognized on the linux console, > M-<digit> however is. But I also don't know it it's a general > limitation. yes, M-<digit> works but I use that already to select windows with `window-numbering' ,------------------------------------------------------------------- | M-2 runs the command select-window-2, which is an interactive Lisp | function in `window-numbering.el'. | | It is bound to M-2. | | (select-window-2 &optional ARG) | | Select the window with number 2. `------------------------------------------------------------------- which is very convenient. I always thought that the M- bindings are more problematic than the C- bindings on a console (in fact they are sometimes presented as alternatives for not working M- bindings iirc), so I'm a bit surprised. -- cheers, Thorsten ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: C-<digit> key bindings not working on console 2014-01-23 13:00 ` Thorsten Jolitz @ 2014-01-23 13:39 ` Tassilo Horn 0 siblings, 0 replies; 14+ messages in thread From: Tassilo Horn @ 2014-01-23 13:39 UTC (permalink / raw) To: Thorsten Jolitz; +Cc: help-gnu-emacs Thorsten Jolitz <tjolitz@gmail.com> writes: >> I can confirm that C-<digit> is not recognized on the linux console, >> M-<digit> however is. But I also don't know it it's a general >> limitation. > > yes, M-<digit> works but I use that already to select windows with > `window-numbering' Me, too. Or rather, I don't use window-numbering anymore because I had some issue with it (I think with speedbar), but use this simple replacement instead: --8<---------------cut here---------------start------------->8--- (defun th/select-nth-window (n) "Selects the N-th window. When called interactively, the N is provided as the last part of the keybinding. So you'd usually bind this function to M-{1,..,9}, and then M-3 selects the third window." (interactive (list (let ((ev (event-basic-type last-command-event))) (string-to-number (char-to-string ev))))) (if (> n (length (window-list))) (user-error "There's no window %s." n) (select-window (window-at 0 0)) (other-window (1- n)))) (dotimes (i 9) (global-set-key (kbd (format "M-%s" (1+ i))) 'th/select-nth-window)) --8<---------------cut here---------------end--------------->8--- > which is very convenient. Yep. > I always thought that the M- bindings are more problematic than the C- > bindings on a console (in fact they are sometimes presented as > alternatives for not working M- bindings iirc), so I'm a bit > surprised. Indeed. Although I have to confess that I rarely use the console, both because of not being able to use some keybindings that are deep in my muscle memory and because of the frequently unreadable color choices resulting from Emacs trying to make the best out of the definitions in my angry fruit salad theme. Bye, Tassilo ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: C-<digit> key bindings not working on console 2014-01-23 10:50 C-<digit> key bindings not working on console Thorsten Jolitz 2014-01-23 11:00 ` Thorsten Jolitz @ 2014-01-23 14:17 ` Stefan Monnier 2014-01-23 16:35 ` Thorsten Jolitz [not found] ` <mailman.12639.1390494920.10748.help-gnu-emacs@gnu.org> 1 sibling, 2 replies; 14+ messages in thread From: Stefan Monnier @ 2014-01-23 14:17 UTC (permalink / raw) To: help-gnu-emacs That's got nothing to do with Emacs: your text-terminal is the culprit. But don't worry: it's not just your text-terminal, it's all(?) known text-terminals. Of course, you can configure your text-terminal (e.g. Linux's console) to send a different escape sequence for those chars, and then tell Emacs to recognize those sequence. Stefan ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: C-<digit> key bindings not working on console 2014-01-23 14:17 ` Stefan Monnier @ 2014-01-23 16:35 ` Thorsten Jolitz 2014-01-23 16:57 ` Stefan Monnier [not found] ` <mailman.12639.1390494920.10748.help-gnu-emacs@gnu.org> 1 sibling, 1 reply; 14+ messages in thread From: Thorsten Jolitz @ 2014-01-23 16:35 UTC (permalink / raw) To: help-gnu-emacs Stefan Monnier <monnier@iro.umontreal.ca> writes: > That's got nothing to do with Emacs: your text-terminal is the culprit. > But don't worry: it's not just your text-terminal, it's all(?) known > text-terminals. > > Of course, you can configure your text-terminal (e.g. Linux's console) > to send a different escape sequence for those chars, and then tell Emacs > to recognize those sequence. I once investigated how to do that kind of thing, unfortunately I forgot most of it by now and will have relearn it. What is always a bit hard to understand is why e.g. C-M-v will work on the console but C-M-V (i.e. C-M-S-v) won't. One would be tempted to think that if Emacs knows how to deal with C- and M- and S- as modifiers alone or in some combinations it should be able to deal with them always. -- cheers, Thorsten ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: C-<digit> key bindings not working on console 2014-01-23 16:35 ` Thorsten Jolitz @ 2014-01-23 16:57 ` Stefan Monnier 2014-01-27 9:18 ` Thorsten Jolitz 0 siblings, 1 reply; 14+ messages in thread From: Stefan Monnier @ 2014-01-23 16:57 UTC (permalink / raw) To: help-gnu-emacs > One would be tempted to think that if Emacs knows how to deal with C- > and M- and S- as modifiers alone or in some combinations it should be > able to deal with them always. The byte sequences used for various key-combos in a text-terminal have evolved in an "organic" way over the years, starting from plain ASCII (which already includes 32 "key combined with CTRL") but without ever someone coming and saying "OK, let's scrap this mess and use a regular encoding". IOW, C-M-v is not sent as "the encoding of CTRL plus the encoding of META plus the encoding of `v'", so there's no natural generalization for C-M-V. And of course, it's not even clear whether C-M-V should be the same as C-M-S-v or C-M-v (Emacs decided C-M-V is the same as C-M-v, which are different from C-M-S-v). After all, it's not clear if ASCII code 1 should be considered as C-a or C-A or both (Emacs considers C-a is equal to C-A, which is different from C-S-a). Stefan ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: C-<digit> key bindings not working on console 2014-01-23 16:57 ` Stefan Monnier @ 2014-01-27 9:18 ` Thorsten Jolitz 0 siblings, 0 replies; 14+ messages in thread From: Thorsten Jolitz @ 2014-01-27 9:18 UTC (permalink / raw) To: help-gnu-emacs Stefan Monnier <monnier@iro.umontreal.ca> writes: >> One would be tempted to think that if Emacs knows how to deal with C- >> and M- and S- as modifiers alone or in some combinations it should be >> able to deal with them always. > > The byte sequences used for various key-combos in a text-terminal have > evolved in an "organic" way over the years, starting from plain ASCII > (which already includes 32 "key combined with CTRL") but without ever > someone coming and saying "OK, let's scrap this mess and use a regular > encoding". So the 'organic mess' is itself a bit complicated, and not only hard to understand. > IOW, C-M-v is not sent as "the encoding of CTRL plus the encoding of > META plus the encoding of `v'", so there's no natural generalization for > C-M-V. I see, explains some surprising behaviour > And of course, it's not even clear whether C-M-V should be the same as > C-M-S-v or C-M-v (Emacs decided C-M-V is the same as C-M-v, which are > different from C-M-S-v). After all, it's not clear if ASCII code > 1 should be considered as C-a or C-A or both (Emacs considers C-a is > equal to C-A, which is different from C-S-a). How can you produce C-M-V without typing C-M-S-v (at least on a German QWERTZ keyboard its the only way I can see)? -- cheers, Thorsten ^ permalink raw reply [flat|nested] 14+ messages in thread
[parent not found: <mailman.12639.1390494920.10748.help-gnu-emacs@gnu.org>]
* Re: C-<digit> key bindings not working on console [not found] ` <mailman.12639.1390494920.10748.help-gnu-emacs@gnu.org> @ 2014-01-23 22:08 ` Emanuel Berg 2014-01-27 10:10 ` Thorsten Jolitz [not found] ` <mailman.12925.1390817447.10748.help-gnu-emacs@gnu.org> 0 siblings, 2 replies; 14+ messages in thread From: Emanuel Berg @ 2014-01-23 22:08 UTC (permalink / raw) To: help-gnu-emacs Thorsten Jolitz <tjolitz@gmail.com> writes: >> That's got nothing to do with Emacs: your >> text-terminal is the culprit. But don't worry: it's >> not just your text-terminal, it's all(?) known >> text-terminals. Of course, you can configure your >> text-terminal (e.g. Linux's console) to send a >> different escape sequence for those chars, and then >> tell Emacs to recognize those sequence. > > I once investigated how to do that kind of thing, > unfortunately I forgot most of it by now and will > have relearn it. Linux console/VT/tty solution - tested on Debian. I didn't figure out this myself, someone told me, just as I tell someone, now. But because this question comes now and then, it would be good to get feedback from the OP, because then I can make adjustments and, if all good and well, use this text next time around as well. Use, reuse, and not reinventing the wheel, remember? OK: Put, in /etc/console-setup/remap.inc control keycode 11 = U+0110 11 is 0, and you get that from 'showkey'. [If you use tmux on top of the VT, use 'sudo showkey' (every time) or 'chmod u+s /usr/bin/showkey' (once, then just 'showkey'). Find out where 'showkey' is with 'type' in bash, and 'type' or 'where' in zsh.] The Unicode (U+0110) is arbitrary in the sense it doesn't matter what it is as long as it isn't in use already, so make it exotic. Then: 'sudo loadkeys /etc/console-setup/remap.inc' Next, in an Emacs init file (.emacs, or if you want to put such things somewhere else, and then `load-file' from the main init file), in such a file, put: (define-key input-decode-map [?\u0110] [C-zero]) Now, hit C-0 and it should say "<C-zero> is undefined", which means you can bind it to whatever: (global-set-key (kbd "<C-zero>") 'switch-buffer) Note: Because you want to load the modified keymap when booting the system, but without having to give the sudo password, one way to do that on Debian is to put loadkeys /etc/console-setup/remap.inc > /dev/null in /etc/rc.local -- underground experts united: http://user.it.uu.se/~embe8573 ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: C-<digit> key bindings not working on console 2014-01-23 22:08 ` Emanuel Berg @ 2014-01-27 10:10 ` Thorsten Jolitz [not found] ` <mailman.12925.1390817447.10748.help-gnu-emacs@gnu.org> 1 sibling, 0 replies; 14+ messages in thread From: Thorsten Jolitz @ 2014-01-27 10:10 UTC (permalink / raw) To: help-gnu-emacs Emanuel Berg <embe8573@student.uu.se> writes: > Thorsten Jolitz <tjolitz@gmail.com> writes: > >>> That's got nothing to do with Emacs: your >>> text-terminal is the culprit. But don't worry: it's >>> not just your text-terminal, it's all(?) known >>> text-terminals. Of course, you can configure your >>> text-terminal (e.g. Linux's console) to send a >>> different escape sequence for those chars, and then >>> tell Emacs to recognize those sequence. >> >> I once investigated how to do that kind of thing, >> unfortunately I forgot most of it by now and will >> have relearn it. > > Linux console/VT/tty solution - tested on Debian. > > I didn't figure out this myself, someone told me, just > as I tell someone, now. But because this question comes > now and then, it would be good to get feedback from the > OP, because then I can make adjustments and, if all > good and well, use this text next time around as > well. Use, reuse, and not reinventing the wheel, > remember? OK: > > Put, in /etc/console-setup/remap.inc > > control keycode 11 = U+0110 > > 11 is 0, and you get that from 'showkey'. [If you use > tmux on top of the VT, use 'sudo showkey' (every time) > or 'chmod u+s /usr/bin/showkey' (once, then just > 'showkey'). Find out where 'showkey' is with 'type' in > bash, and 'type' or 'where' in zsh.] > > The Unicode (U+0110) is arbitrary in the sense it > doesn't matter what it is as long as it isn't in use > already, so make it exotic. > > Then: 'sudo loadkeys /etc/console-setup/remap.inc' > > Next, in an Emacs init file (.emacs, or if you want to > put such things somewhere else, and then `load-file' > from the main init file), in such a file, put: > > (define-key input-decode-map [?\u0110] [C-zero]) > > Now, hit C-0 and it should say "<C-zero> is undefined", > which means you can bind it to whatever: > > (global-set-key (kbd "<C-zero>") 'switch-buffer) > > Note: Because you want to load the modified keymap when > booting the system, but without having to give the sudo > password, one way to do that on Debian is to put > > loadkeys /etc/console-setup/remap.inc > /dev/null > > in /etc/rc.local Thanks for the recipe, I'll try that out when I have enough time. One annoying thing is that M-<arrow-keys> (i.e. Alt-<arrow-keys>) are at least partly (left-arrow, right-arrow) occupied by the system, in my case Archlinux, for switching between tty's. That is convenient, but for an Org-mode user these key-combos are much more important inside Org-mode than for tty-navigation. -- cheers, Thorsten ^ permalink raw reply [flat|nested] 14+ messages in thread
[parent not found: <mailman.12925.1390817447.10748.help-gnu-emacs@gnu.org>]
* Re: C-<digit> key bindings not working on console [not found] ` <mailman.12925.1390817447.10748.help-gnu-emacs@gnu.org> @ 2014-01-27 16:50 ` Emanuel Berg 0 siblings, 0 replies; 14+ messages in thread From: Emanuel Berg @ 2014-01-27 16:50 UTC (permalink / raw) To: help-gnu-emacs Thorsten Jolitz <tjolitz@gmail.com> writes: > One annoying thing is that M-<arrow-keys> > (i.e. Alt-<arrow-keys>) are at least partly > (left-arrow, right-arrow) occupied by the system, in > my case Archlinux, for switching between tty's. You can change that as well. I think the arrow keys suck because then you have to move your right hand back and forth from typing position (not as bad as reaching for the mouse, but bad enough for me to never use those keys, just as I never use the function keys or the numpad) - so I setup Alt/M-j and -l to iterate consoles, and Alt/M-u to go to X. (Then, in urxvt in X, I have the same shortcut to go to Emacs in tty1.) [Really I should say Alt because I run Emacs in tty1, and in the ttys, including tty1, the "tty global" keymap keystrokes take precedence.] If you want to drop the tty use of the arrow keys, find out what keycodes they are with 'showkey', then set it all up anew. Here is how I did it, or sort of that, anyway: ## Linux VTs # J - Emacs to the leftmost (in tty1)... alt keycode 36 = Decr_Console ctrll alt keycode 36 = Decr_Console # L - ... tmux/zsh to the right (tty2-tty6) alt keycode 38 = Incr_Console ctrll alt keycode 38 = Incr_Console ## M-u - X (tty7) alt keycode 22 = Console_7 ctrll alt keycode 22 = Console_7 The double entries are to make it work with caps. But, I dropped that key, so perhaps that's redundant for me. Ah, let's keep it. > That is convenient, but for an Org-mode user these > key-combos are much more important inside Org-mode > than for tty-navigation. If you are able to drop them in the keymap, they should work in Emacs without any setup. Try to keycode them to themselves: keycode 105 = 105 (and ditto 106) - that might work. -- underground experts united: http://user.it.uu.se/~embe8573 ^ permalink raw reply [flat|nested] 14+ messages in thread
[parent not found: <mailman.12620.1390474210.10748.help-gnu-emacs@gnu.org>]
* Re: C-<digit> key bindings not working on console [not found] <mailman.12620.1390474210.10748.help-gnu-emacs@gnu.org> @ 2014-01-27 8:59 ` Javier 2014-01-27 10:25 ` Thorsten Jolitz 0 siblings, 1 reply; 14+ messages in thread From: Javier @ 2014-01-27 8:59 UTC (permalink / raw) To: help-gnu-emacs You can edit us.kmap.gz (or whatever country keymap you are using). Below is what I have in mine: Then rename the file to personal.kmap.gz and load it with loadkeys personal.kmap.gz Then in .emacs write: (define-key function-key-map "\eO5A" '[C-up]) (define-key function-key-map "\eO5B" '[C-down]) (define-key function-key-map "\eO5C" '[C-right]) (define-key function-key-map "\eO5D" '[C-left]) (define-key function-key-map "\eO3A" '[M-up]) (define-key function-key-map "\eO3B" '[M-down]) (define-key function-key-map "\eO3C" '[M-right]) (define-key function-key-map "\eO3D" '[M-left]) (define-key function-key-map "\eO2A" '[S-up]) (define-key function-key-map "\eO2B" '[S-down]) (define-key function-key-map "\eO2C" '[S-right]) (define-key function-key-map "\eO2D" '[S-left]) You can see the characters a key compination produces with cat > /dev/null ^[O5D ^[O5C ^[O5A^[O5B and Control-D to finish. If you see nothing, then you need to change the keymap. C-0, C-1 give nothing in Linux console. It is a bit painful, but at the end it works. --------------------------------------------------- keycode 103 = Up Alt keycode 103 = F49 Shift keycode 103 = F53 Control keycode 103 = F57 keycode 108 = Down Alt keycode 108 = F50 Shift keycode 108 = F54 Control keycode 108 = F58 keycode 106 = Right alt keycode 106 = Incr_Console Shift keycode 106 = F55 Control keycode 106 = F59 keycode 105 = Left alt keycode 105 = Decr_Console Shift keycode 105 = F56 Control keycode 105 = F60 string F49 = "\033O3A" string F50 = "\033O3B" string F53 = "\033O2A" string F54 = "\033O2B" string F55 = "\033O2C" string F56 = "\033O2D" string F57 = "\033O5A" string F58 = "\033O5B" string F59 = "\033O5C" string F60 = "\033O5D" string F80 = "\033O2E" ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: C-<digit> key bindings not working on console 2014-01-27 8:59 ` Javier @ 2014-01-27 10:25 ` Thorsten Jolitz 0 siblings, 0 replies; 14+ messages in thread From: Thorsten Jolitz @ 2014-01-27 10:25 UTC (permalink / raw) To: help-gnu-emacs Javier <nospam@nospam.com> writes: > You can edit us.kmap.gz (or whatever country keymap you are using). > Below is what I have in mine: Thank you too for the recipe, seems that with a bit of effort it is actually possible to make all keybindings work on the console too. -- cheers, Thorsten ^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2014-01-27 16:50 UTC | newest] Thread overview: 14+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2014-01-23 10:50 C-<digit> key bindings not working on console Thorsten Jolitz 2014-01-23 11:00 ` Thorsten Jolitz 2014-01-23 12:48 ` Tassilo Horn 2014-01-23 13:00 ` Thorsten Jolitz 2014-01-23 13:39 ` Tassilo Horn 2014-01-23 14:17 ` Stefan Monnier 2014-01-23 16:35 ` Thorsten Jolitz 2014-01-23 16:57 ` Stefan Monnier 2014-01-27 9:18 ` Thorsten Jolitz [not found] ` <mailman.12639.1390494920.10748.help-gnu-emacs@gnu.org> 2014-01-23 22:08 ` Emanuel Berg 2014-01-27 10:10 ` Thorsten Jolitz [not found] ` <mailman.12925.1390817447.10748.help-gnu-emacs@gnu.org> 2014-01-27 16:50 ` Emanuel Berg [not found] <mailman.12620.1390474210.10748.help-gnu-emacs@gnu.org> 2014-01-27 8:59 ` Javier 2014-01-27 10:25 ` Thorsten Jolitz
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).