all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* define-key turns to go the wrong way.
@ 2013-04-04  1:45 Peng Dai
  2013-04-04  9:05 ` XeCycle
  2013-04-04  9:31 ` Peter Dyballa
  0 siblings, 2 replies; 3+ messages in thread
From: Peng Dai @ 2013-04-04  1:45 UTC (permalink / raw)
  To: help-gnu-emacs

I use ubuntu12.04(32bit,US), and emacs24.2. When I descide to have a new key
"\C-[" and "\C-]" to scroll my window,

so I write the following in the init.el

(global-set-key (kbd "\C-]") (lambda () (interactive) (scroll-up 2)))
(global-set-key (kbd "\C-[") (lambda () (interactive) (scroll-down 2)))

this first is work fine. but the second didn't work.
When I use the "\C-h k" to see what' wrong. It turn out to be "\C-[" was readed as "<ECS>". I search the google with no result, it says it was because of the ISCAE's key value but with no soluvation give.

And I find another key has the same problem,too. like:
"\C-j" turn to be "<SPACE>"
"\C-M-j" turn to be "<RET>j"

Can anyone help.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: define-key turns to go the wrong way.
  2013-04-04  1:45 define-key turns to go the wrong way Peng Dai
@ 2013-04-04  9:05 ` XeCycle
  2013-04-04  9:31 ` Peter Dyballa
  1 sibling, 0 replies; 3+ messages in thread
From: XeCycle @ 2013-04-04  9:05 UTC (permalink / raw)
  To: help-gnu-emacs

[-- Attachment #1: Type: text/plain, Size: 1211 bytes --]

Peng Dai <daipeng123456@gmail.com> writes:

> I use ubuntu12.04(32bit,US), and emacs24.2. When I descide to have a new key
> "\C-[" and "\C-]" to scroll my window,
>
> so I write the following in the init.el
>
> (global-set-key (kbd "\C-]") (lambda () (interactive) (scroll-up 2)))
> (global-set-key (kbd "\C-[") (lambda () (interactive) (scroll-down 2)))

Minor mistake: when using kbd, you're expected to write "C-]"
without the backslash.

> this first is work fine. but the second didn't work.
> When I use the "\C-h k" to see what' wrong. It turn out to be
> "\C-[" was readed as "<ECS>". I search the google with no result,
> it says it was because of the ISCAE's key value but with no
> soluvation give.

Yes.  "C-[" *is* <ESC>, at least on terminals.  Emacs is designed
to be compatible with terminals, so it's unlikely to get changed.

> And I find another key has the same problem,too. like:
> "\C-j" turn to be "<SPACE>"
> "\C-M-j" turn to be "<RET>j"

DO NOT ESCAPE CTRL OR META WHEN USING `kbd'.

-- 
Carl Lei (XeCycle)
Department of Physics, Shanghai Jiao Tong University
OpenPGP public key: 7795E591
Fingerprint: 1FB6 7F1F D45D F681 C845 27F7 8D71 8EC4 7795 E591

[-- Attachment #2: Type: application/pgp-signature, Size: 489 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: define-key turns to go the wrong way.
  2013-04-04  1:45 define-key turns to go the wrong way Peng Dai
  2013-04-04  9:05 ` XeCycle
@ 2013-04-04  9:31 ` Peter Dyballa
  1 sibling, 0 replies; 3+ messages in thread
From: Peter Dyballa @ 2013-04-04  9:31 UTC (permalink / raw)
  To: Peng Dai; +Cc: help-gnu-emacs


Am 04.04.2013 um 03:45 schrieb Peng Dai:

> When I use the "\C-h k" to see what' wrong. It turn out to be "\C-[" was readed as "<ECS>". I search the google with no result, it says it was because of the ISCAE's key value but with no soluvation give.

See 'man ascii' or http://en.wikipedia.org/wiki/ASCII.

The first 32 ASCII codes do not represent printable characters. So, how can one produce them, manually, interactively? (In a C programme no problem, of course.) The way to produce them is by holding down the CONTROL key (ctrl or such) and then pressing another key on the keyboard. This gives a "control code" or "control character", not printable. Since the Latin alphabet has only 26 members (the characters a to z or A to Z) it is necessary to use some other characters to be able to address all 32 control characters. C-a produces ASCII code 1, SOH, C-z produces ASCII code 26, SUB. And C-] is ASCII code 27 or ESC.

> 
> And I find another key has the same problem,too. like:
> "\C-j" turn to be "<SPACE>"
> "\C-M-j" turn to be "<RET>j"

This is not correct. This must be introduced by you.

C-j is ASCII code 10 (because it's the tenth Latin character) or LF, LINEFEED. C-M-j can be mapped to whatever you like.

What you can do is launch GNU Emacs with -Q. Then you can type C-h k <your key combination>. In a *Help* buffer you'll see the explanation of that key code. Directly afterwards type C-x ESC ESC. This will show you in echo area (or mini-buffer) which actual "code" GNU Emacs received when you asked it for an explanation of the meaning of the pressed key combination.

--
Greetings

  Pete

Some day we may discover how to make magnets that can point in any direction.




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-04-04  9:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-04  1:45 define-key turns to go the wrong way Peng Dai
2013-04-04  9:05 ` XeCycle
2013-04-04  9:31 ` Peter Dyballa

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.