unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* global-set-key with altGr on PC
@ 2003-10-14 12:28 Sébastien Kirche
  0 siblings, 0 replies; 5+ messages in thread
From: Sébastien Kirche @ 2003-10-14 12:28 UTC (permalink / raw)


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 ?

Thanks for help.
Sébastien Kirche

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

* Re: global-set-key with altGr on PC
       [not found] <mailman.1662.1066134615.21628.help-gnu-emacs@gnu.org>
@ 2003-10-14 15:30 ` Kevin Rodgers
  2003-10-14 15:51   ` Sébastien Kirche
  2003-10-14 17:01   ` Kevin Rodgers
  0 siblings, 2 replies; 5+ messages in thread
From: Kevin Rodgers @ 2003-10-14 15:30 UTC (permalink / raw)


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

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

* Re: global-set-key with altGr on PC
  2003-10-14 15:30 ` global-set-key with altGr on PC Kevin Rodgers
@ 2003-10-14 15:51   ` Sébastien Kirche
  2003-10-14 16:35     ` Sébastien Kirche
  2003-10-14 17:01   ` Kevin Rodgers
  1 sibling, 1 reply; 5+ messages in thread
From: Sébastien Kirche @ 2003-10-14 15:51 UTC (permalink / raw)


			
Le mardi, 14 oct 2003, à 17:30 Europe/Paris, Kevin Rodgers a écrit :

>
> 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

Thanks Kevin,
That's *just* what i need :)

I still have to improve elisp.
Manual is ordered, i am just waiting for it to cross the see to France 
:)

Sébastien Kirche

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

* Re: global-set-key with altGr on PC
  2003-10-14 15:51   ` Sébastien Kirche
@ 2003-10-14 16:35     ` Sébastien Kirche
  0 siblings, 0 replies; 5+ messages in thread
From: Sébastien Kirche @ 2003-10-14 16:35 UTC (permalink / raw)


Le mardi, 14 oct 2003, à 17:51 Europe/Paris, Sébastien Kirche a écrit :

> Manual is ordered, i am just waiting for it to cross the see to France 
> :)

oops, "the sea" of course :)

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

* Re: global-set-key with altGr on PC
  2003-10-14 15:30 ` global-set-key with altGr on PC Kevin Rodgers
  2003-10-14 15:51   ` Sébastien Kirche
@ 2003-10-14 17:01   ` Kevin Rodgers
  1 sibling, 0 replies; 5+ messages in thread
From: Kevin Rodgers @ 2003-10-14 17:01 UTC (permalink / raw)


I wrote:

> 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)


Oops: (interactive "*P")


>   (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

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

end of thread, other threads:[~2003-10-14 17:01 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <mailman.1662.1066134615.21628.help-gnu-emacs@gnu.org>
2003-10-14 15:30 ` global-set-key with altGr on PC Kevin Rodgers
2003-10-14 15:51   ` Sébastien Kirche
2003-10-14 16:35     ` Sébastien Kirche
2003-10-14 17:01   ` Kevin Rodgers
2003-10-14 12:28 Sébastien Kirche

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).