* `global-set-key' doesn't work in my console
@ 2008-01-07 8:03 Forrest
2008-01-07 9:51 ` Peter Dyballa
2008-01-07 15:40 ` Drew Adams
0 siblings, 2 replies; 8+ messages in thread
From: Forrest @ 2008-01-07 8:03 UTC (permalink / raw)
To: help-gnu-emacs
[-- Attachment #1.1: Type: text/plain, Size: 646 bytes --]
`global-set-key' doesn't work in my console.
i have definitions below in my ~/.emacs:
global-set-key (kbd "C-,")
'(lambda () "scroll the page down" (interactive) (scroll-down 1)))
(defun up-slightly () (interactive) (scroll-up 1))
(global-set-key [(control .)] 'up-slightly)
then i went to console, launched emacs, opened a file, i can use the
"default" key-bindings like C-x C-c, but when i press C-, or C-. , nothing
happened, they work well in X window, how can i get it work in console?
Thanks a lot!
Forrest
%%
GNU Emacs 23.0.60.1 (i686-pc-linux-gnu, GTK+ Version 2.8.20)
Debian Etch
%%
--
Stupid is as stupid does.
[-- Attachment #1.2: Type: text/html, Size: 880 bytes --]
[-- Attachment #2: Type: text/plain, Size: 152 bytes --]
_______________________________________________
help-gnu-emacs mailing list
help-gnu-emacs@gnu.org
http://lists.gnu.org/mailman/listinfo/help-gnu-emacs
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: `global-set-key' doesn't work in my console
2008-01-07 8:03 Forrest
@ 2008-01-07 9:51 ` Peter Dyballa
2008-01-07 15:40 ` Drew Adams
1 sibling, 0 replies; 8+ messages in thread
From: Peter Dyballa @ 2008-01-07 9:51 UTC (permalink / raw)
To: Forrest; +Cc: help-gnu-emacs
Am 07.01.2008 um 09:03 schrieb Forrest:
> global-set-key (kbd "C-,")
> '(lambda () "scroll the page down" (interactive) (scroll-
> down 1)))
The console and other terminal emulations can only produce "key
events" in the ASCII or extended ASCII range, i.e. 8 bit characters
(man ascii). Therefore not every time you hold down the control
"modifier" key and press some other key something with a meaning is
produced. It's like when you're scribbling on paper: not every
"picture" is a letter or a digit or worth an exhibition at MOMA ...
C-, can work X which has its own concept of events that are
abstracted from ASCII codes.
--
Greetings
Pete
November, n.:
The eleventh twelfth of a weariness.
– Ambrose Bierce, "The Devil's Dictionary"
^ permalink raw reply [flat|nested] 8+ messages in thread
* RE: `global-set-key' doesn't work in my console
2008-01-07 8:03 Forrest
2008-01-07 9:51 ` Peter Dyballa
@ 2008-01-07 15:40 ` Drew Adams
1 sibling, 0 replies; 8+ messages in thread
From: Drew Adams @ 2008-01-07 15:40 UTC (permalink / raw)
To: Forrest, help-gnu-emacs
> `global-set-key' doesn't work in my console.
> i have definitions below in my ~/.emacs:
>
> global-set-key (kbd "C-,")
> '(lambda () "scroll the page down" (interactive) (scroll-down 1)))
> (defun up-slightly () (interactive) (scroll-up 1))
> (global-set-key [(control .)] 'up-slightly)
>
> then i went to console, launched emacs, opened a file, i can use the
> "default" key-bindings like C-x C-c, but when i press C-, or C-. ,
> nothing happened, they work well in X window, how can i get it work
> in console?
I believe the problem is that those particular keys (e.g. C-,) are not
available using a console.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: `global-set-key' doesn't work in my console
@ 2008-01-08 16:32 Forrest
2008-01-08 19:31 ` Peter Dyballa
0 siblings, 1 reply; 8+ messages in thread
From: Forrest @ 2008-01-08 16:32 UTC (permalink / raw)
To: help-gnu-emacs
[-- Attachment #1.1: Type: text/plain, Size: 2651 bytes --]
> Mike Mattie writes:
> > On Tue, 8 Jan 2008 15:38:08 +0800
> > Forrest <forrest.yu@gmail.com> wrote:
> >
> > > > > global-set-key (kbd "C-,")
> > > > > '(lambda () "scroll the page down" (interactive) (scroll-
> > > > > down 1)))
> >
> > try a space like this:
> > (kbd "C-c ,")
>
> Have you tried this? It won't work.
i tried, it worked
>
> > If that fixes it try using a function I previously posted that
eliminates
> > the errors from the process of defining keys.
>
> If it were so simple don't you think Emacs would do this?
>
> > (defun insert-key-notation ()
> > "inject a complete \(kbd \"sequence\"\) with key notation for a key
sequence given by prompt"
> > (interactive)
> > (insert "(kbd \"")
> > (insert (format-kbd-macro (read-key-sequence "Key? " nil t)))
> > (insert "\")"))
> >
> > it will define the kbd sexp for you after it prompts you for the key
sequence.
>
> It looks like the reason that it doesn't work has already been explained
but
> Forrest has decided not to accept the answer (or perhaps there is a
> communication problem)...
that's what you think, not what i think
>
> > > > The console and other terminal emulations can only produce "key
> > > > events" in the ASCII or extended ASCII range, i.e. 8 bit characters
> > > > (man ascii). Therefore not every time you hold down the control
> > > > "modifier" key and press some other key something with a meaning is
> > > > produced. It's like when you're scribbling on paper: not every
> > > > "picture" is a letter or a digit or worth an exhibition at MOMA ...
> > > > C-, can work X which has its own concept of events that are
> > > > abstracted from ASCII codes.
> > >
> > > C-x C-c work well in console, so i guess there must be something
> > > wrong with my key-binding settings. and also, emacs was designed in
> > > ages when X was not popular, it's unreasonable that custom
> > > key-binding doesn't work
>
> Do "man ascii". This is 128 character set and 96, or thereabout, are
printing
> characters. If there were a control character counterpart for each one
that
> would result in 192 character set. Presumably control characters only
exist
> for C-@ to C-_ (0 to 32, @ to _ being 64 to 96).
thank you for your patience, however, do you mean that only printing
characters and C-@ to C-_ can be processed by emacs?
then what if you press F1~F12? and Home, End, Del, Ins? and Left, Right, Up,
Down?
96 + (96 - 64) = 128 i hope i had understood you
>
> > > i'm a newbie, could you give me any detailed clue to solve it?
>
> On a normal console, I don't think you can.
>
> --
> Nick http://www.inet.net.nz/~nickrob
Forrest
--
Stupid is as stupid does.
[-- Attachment #1.2: Type: text/html, Size: 3623 bytes --]
[-- Attachment #2: Type: text/plain, Size: 152 bytes --]
_______________________________________________
help-gnu-emacs mailing list
help-gnu-emacs@gnu.org
http://lists.gnu.org/mailman/listinfo/help-gnu-emacs
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: `global-set-key' doesn't work in my console
2008-01-08 16:32 `global-set-key' doesn't work in my console Forrest
@ 2008-01-08 19:31 ` Peter Dyballa
2008-01-09 9:48 ` Forrest
0 siblings, 1 reply; 8+ messages in thread
From: Peter Dyballa @ 2008-01-08 19:31 UTC (permalink / raw)
To: Forrest; +Cc: help-gnu-emacs
Am 08.01.2008 um 17:32 schrieb Forrest:
> thank you for your patience, however, do you mean that only printing
> characters and C-@ to C-_ can be processed by emacs?
Please don't mix up GNU Emacs and your console!
> then what if you press F1~F12? and Home, End, Del, Ins? and Left,
> Right, Up,
> Down?
These keys are not producing Control-anything events. Simple proof: C-
q <your key press>.
--
Greetings
Pete
There are two major products that come out of Berkeley: LSD and UNIX.
We don't believe this to be a coincidence.
- Jeremy S. Anderson
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: `global-set-key' doesn't work in my console
2008-01-08 19:31 ` Peter Dyballa
@ 2008-01-09 9:48 ` Forrest
2008-01-10 12:51 ` Peter Dyballa
0 siblings, 1 reply; 8+ messages in thread
From: Forrest @ 2008-01-09 9:48 UTC (permalink / raw)
To: Peter Dyballa; +Cc: help-gnu-emacs
[-- Attachment #1.1: Type: text/plain, Size: 1273 bytes --]
On Jan 9, 2008 3:31 AM, Peter Dyballa <Peter_Dyballa@web.de> wrote:
>
> Am 08.01.2008 um 17:32 schrieb Forrest:
>
>
> > thank you for your patience, however, do you mean that only printing
> > characters and C-@ to C-_ can be processed by emacs?
>
> Please don't mix up GNU Emacs and your console!
>
>
> > then what if you press F1~F12? and Home, End, Del, Ins? and Left,
> > Right, Up,
> > Down?
>
> These keys are not producing Control-anything events. Simple proof: C-
> q <your key press>.
>
> --
> Greetings
>
> Pete
>
> There are two major products that come out of Berkeley: LSD and UNIX.
> We don't believe this to be a coincidence.
> - Jeremy S. Anderson
>
>
>
>
i wrote a program which invokes `getchar()' at startup, then i press `C-,',
nothing happened, while `C-[a~z]' seem ok.
so i think the terminal doesn't pass all of the C-<KeyPress> combinations to
the program, i don't know which ones are chosen, but obviousely `C-,' and
`C-.' are not
i tried to figure out why, then i googled much but got little helpful, it
seems that `terminfo' is the point but i cannot understand what it is, the
output of 'infocmp' is a mess for me :(
i have changed the scrolling key-bindings to `M-n' and `M-p' and they work
good in the console
--
Stupid is as stupid does.
[-- Attachment #1.2: Type: text/html, Size: 1667 bytes --]
[-- Attachment #2: Type: text/plain, Size: 152 bytes --]
_______________________________________________
help-gnu-emacs mailing list
help-gnu-emacs@gnu.org
http://lists.gnu.org/mailman/listinfo/help-gnu-emacs
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: `global-set-key' doesn't work in my console
2008-01-09 9:48 ` Forrest
@ 2008-01-10 12:51 ` Peter Dyballa
2008-01-10 16:37 ` Forrest Y. Yu
0 siblings, 1 reply; 8+ messages in thread
From: Peter Dyballa @ 2008-01-10 12:51 UTC (permalink / raw)
To: Forrest; +Cc: help-gnu-emacs
Am 09.01.2008 um 10:48 schrieb Forrest:
> i tried to figure out why, then i googled much but got little
> helpful, it
> seems that `terminfo' is the point but i cannot understand what it
> is, the
> output of 'infocmp' is a mess for me :(
It's not that. It's ASCII:
C-@ -> \000 or NUL
C-a -> \001
C-b -> \002
...
C-z -> \032
C-[ -> \033
C-\ -> \034
C-] -> \035
C-^ -> \036
C-_ -> \037
SPC -> \040
This has nothing to do with terminfo. The latter is for drawing and
moving the cursor on an alpha-numeric text screen.
--
Greetings
Pete
It isn't pollution that's harming the environment. It's the
impurities in our air and water that are doing it.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: `global-set-key' doesn't work in my console
2008-01-10 12:51 ` Peter Dyballa
@ 2008-01-10 16:37 ` Forrest Y. Yu
0 siblings, 0 replies; 8+ messages in thread
From: Forrest Y. Yu @ 2008-01-10 16:37 UTC (permalink / raw)
To: Peter Dyballa; +Cc: help-gnu-emacs
[-- Attachment #1.1: Type: text/plain, Size: 2169 bytes --]
On Jan 10, 2008 8:51 PM, Peter Dyballa < Peter_Dyballa@web.de> wrote:
>
> Am 09.01.2008 um 10:48 schrieb Forrest:
>
>
> > i tried to figure out why, then i googled much but got little
> > helpful, it
> > seems that `terminfo' is the point but i cannot understand what it
> > is, the
> > output of 'infocmp' is a mess for me :(
>
> It's not that. It's ASCII:
>
> C-@ -> \000 or NUL
> C-a -> \001
> C-b -> \002
> ...
> C-z -> \032
> C-[ -> \033
> C-\ -> \034
> C-] -> \035
> C-^ -> \036
> C-_ -> \037
> SPC -> \040
>
> This has nothing to do with terminfo. The latter is for drawing and
> moving the cursor on an alpha-numeric text screen.
>
> --
> Greetings
>
> Pete
>
> It isn't pollution that's harming the environment. It's the
> impurities in our air and water that are doing it.
>
>
>
>
Thank you very much Pete! I think I've got it.
1. It's the keyboard driver that ignores key-combinations like `C-,'
(mentioned by Andreas). When I press `C-,', the keyboard driver received it
and does nothing, so the terminal doesn't even know I've press keys. That's
why emacs cannot accept `C-,' ---- emacs doesn't even know the key-press
action!
2. The keyboard driver gives an ASCII code to any `Ctrl-' thing it thinks
reasonable. The code is actually "stolen" from the ASCII table. Because the
Char 0~32 will never be generated by a keyboard, they can be used for any
purpose the driver wants. That's why Pete and Nick asked me to see `man
ascii'.
3. When a key like F1~F12 or HOME, END are pressed, a key sequence begins
with a ESC(27) will be passed to the terminal, and probably be passed on to
emacs.
4. I guess that the keyboard driver used in an X is different with that used
in a console. The former passed each key-press to a program, but not ignore
combinations like `C-,'. Thus emacs in an X can receive every press of mine.
Again, a lot of thanks to Pete, and Nick, and Andreas, and everyone who
helped me in this question. I just reviewed all the messages I received. I
didn't understand what I've read because I took it for granted that the
keyboard driver will pass everything to the terminal.
Best Regards,
Forrest Y. Yu
--
Stupid is as stupid does.
[-- Attachment #1.2: Type: text/html, Size: 2769 bytes --]
[-- Attachment #2: Type: text/plain, Size: 152 bytes --]
_______________________________________________
help-gnu-emacs mailing list
help-gnu-emacs@gnu.org
http://lists.gnu.org/mailman/listinfo/help-gnu-emacs
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2008-01-10 16:37 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-01-08 16:32 `global-set-key' doesn't work in my console Forrest
2008-01-08 19:31 ` Peter Dyballa
2008-01-09 9:48 ` Forrest
2008-01-10 12:51 ` Peter Dyballa
2008-01-10 16:37 ` Forrest Y. Yu
-- strict thread matches above, loose matches on Subject: below --
2008-01-07 8:03 Forrest
2008-01-07 9:51 ` Peter Dyballa
2008-01-07 15:40 ` Drew Adams
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).