help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: global-set-key with altGr on PC


From: Kevin Rodgers
Subject: Re: global-set-key with altGr on PC
Date: Tue, 14 Oct 2003 09:30:27 -0600
User-agent: Mozilla/5.0 (X11; U; SunOS i86pc; en-US; rv:0.9.4.1) Gecko/20020406 Netscape6/6.2.2

Sébastien Kirche wrote:

Hi all,

to resolve the insertion of the euro symbol i have defined the following in my .emacs :
,----
| (defun insert-euro () "Insert Euro sign"
|   (interactive)
|   (insert (make-char 'latin-iso8859-15 164))
| )
| (defun insert-euro-unicode () "Insert Unicode Euro"
|   (interactive)
|   (insert (make-char 'mule-unicode-0100-24ff 116 76))
| )
`----

To help for easy typing, i have added that (for PC):
,----
|(global-set-key [128] 'insert-euro); C-h l gives \200 for euro (AltGr-e) = 128 dec
`----
This works fine.
But then i tried to add another key like C-u AltGr-e for insert-euro-unicode,
,----
| (global-set-key (concat "\C-u" [128]) 'insert-euro)
| or
| (global-set-key "\C-u\200 'insert-euro) ; \200 is C-q AltGr-e
`----
but it fails with the following:
error: Key sequence C-u C-M-@ uses invalid prefix characters

How can I define a global-set-key with C-u Altgr-e ?

You have to modify the function bound to AltGr-e to behave differently

when it's called with a prefix arg (C-u):

(defun insert-euro (&optional arg)
  "Insert the ISO 8859-15 Euro symbol.
With a prefix arg, insert the corresponding Unicode character instead."
  (interactive)
  (if arg
      (insert (make-char 'mule-unicode-0100-24ff 116 76))
    (insert (make-char 'latin-iso8859-15 164))))

(global-set-key [128] 'insert-euro)     ; AltGr-e

--
Kevin Rodgers



reply via email to

[Prev in Thread] Current Thread [Next in Thread]