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

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

Re: greek writing language and keybindings


From: Pascal J. Bourguignon
Subject: Re: greek writing language and keybindings
Date: Wed, 08 Dec 2010 15:33:50 -0000
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux)

Dimitrios Apostolou <jimis@gmx.net> writes:

> Hi, thanks for your reply
>
> I should note that I am already writing greek perfectly in emacs, and
> I am switching languages using the X server shortcut I have chosen for
> every X application with the following command, and I wouldn't like to
> change that:
>
> setxkbmap us,el -option "grp:shifts_toggle"

This is the problem!


> The problem is that I have to switch back to english for the default
> keybindings to work, which is very irritating!

Yes, but if you're sending C-β, how do you want emacs to know you meant
C-b, and not C-β?

>> Next, in order to be able to type in Greek characters, you need to set
>> the input method.  Do this for the current buffer by clicking on
>> "Options", "MULE", and "Select Input Method".  In the minibuffer type
>> "gr", then hit Tab (C-i) and you'll see several Greek input methods.
>> You'll have to play around with these to find the one(s) you prefer.
>
> Thanks for the suggestion, I tried that and indeed emacs keybindings
> work fine like that. But that requires switching languages within
> emacs with C-\, overriding the setxkbmap command. Is there a better
> way?

Perhaps:

(defvar *greek-keys*  "abcdefghijklmnopqrstuvwx")
(defvar *greek-chars* "αβγδεζηθικλνξοπρςστυφχψω")
;; You will have to set these two strings to map the letters produced by
;; the normal latin, qwerty keyboard, to the greek letters as you want.

(defun local-set-greek-keys ()
  "Maps the characters in *greek-keys* to the characters in *greek-chars*"
  (interactive)
  (loop
     for key across *greek-keys* 
     for cha across *greek-chars*
     do (local-set-key (vector key) `(lambda () (interactive) (insert ,(string 
cha))))))

(defun local-reset-greek-keys ()
  "Reset the greek character mapping, reverting to the normal behavior."
  (interactive)
  (loop
     for key across *greek-keys*
     do (local-set-key (vector key) 'self-insert-command)))


M-x local-set-greek-keys RET once to activate greek in a buffer.
Then any key chord will still behave normally.  Notably, you can insert
the original latin letter prefixing it with C-q.


-- 
__Pascal Bourguignon__                     http://www.informatimago.com/


reply via email to

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