2

I've just installed emacs 24 on my Windows 7 32-bit OS. Usually, I activate Colemak keyboard layout and use it to do all sorts of typing (in browsers, spreadsheets or word processors). It works fine and has tilde (~) and backtick (`) on a key in the top left corner of the keyboard, between the Esc key and the Tab, at the left of key 1.

enter image description here

In emacs, most of the Colemak keys are recognized but that key doesn't work. If I press it, emacs' cursor stops blinking and after 4-5 seconds types 'sssssssssss' or whatever alphabet key I pressed after that key. For now I've managed to get tilde to work by putting (set global-key [f2] "~") and was thinking of associating F3 with backtick, but I was wandering if there's a way to make emacs recognize that key. That way I would get backtick by pressing the ordinary key and tilde by pressing it in combination with Shift.

EDIT

I have downloaded the Colemak layout from the official Colemak Forum that caters to all users, whether on Windows, Linux or Mac. A zip file can be downloaded from section [5.1 DOWNLOAD AND INSTALL] of a thread titled "DreymaR's Big Bag of Keyboard Tricks - PKL/Windows Edition!". The decompressed zip file has some folders and files inside, among them a pkl.exe. I have placed a shortcut to this file, next to Windows' "Start" button and everytime I log into my OS I double click it and launch Colemak. The 2 most important files contained in the zip file are pkl.ini and layout.ini, the latter being inside layouts > colemak-eD_ISO folder.

pkl.ini allows one to set the locale or language of the keyboard by adding this line layout = colemak-eD-Lat_ISO:Colemak[eD]-ISO-It and commenting out any other similar lines so they don't interfere. The layout.ini allows you to customize certain keys. I, for instance, tweaked it to allow CapsLock to write capital letters just like it does in QWERTY.

Below are 2 "Display help images" that come with the colemak bundle. The first is Ordinary keyboard, the second one shows changes as Shift is pressed. They resemble very much my keyboard layout. As it turns out, it's the top left corner key that doesn't get recognized by Emacs.

colemak italian keyboard keyboard changes with Shift key pressed

EDIT 2

The main reason why I need backtick to be recognized is so that I can use keyboard shortcuts in AUCTeX to get Greek alphabet. By default, to get the Greek letter alpha you can press backtick and a. This spurs EMACS to immediately substitute 'a' with 'α'. That's the use behind my question. I tried to work-around this problem by adding this line in my .emacs file: (setq LaTeX-math-abbrev-prefix "'") but writing words such as didn't or ain't became problematic since EMACS kept substituting the single quote followed by letter 't' with Greek letter 'tau'.

  • 1
    Looks like that key does not, in fact, appear as a backtick key. Press C-h c and then the backtick key, what does Emacs tell you? – Gilles Sep 19 '15 at 15:21
  • In "scratch" mode I typed C-h c and emacs responded M-6-. What does it mean? Can I set it to backtick and tilde? If so, how do I do that? – WobblyWindows Sep 20 '15 at 16:09
  • Is the Colemak layout one that's bundled with Windows? Is your keyboard a Mac laptop as depicted in your question? I wonder why it would make the key something other than a backtick. Can you try an external keyboard and see if you have the same problem? What does the key do in another layout such as US QWERTY? – Gilles Sep 20 '15 at 16:17
  • 1
    I use a Colemak script that I downloaded and customized as told by the author, from the Colemak forum here (see section 5.1). I have the Italian Colemak edition "keep local symbols" image. The picture is a little old, the backtick has been moved to the left of key 1. The picture in my OP above is just for illustration's purpose. My laptop's keyboard looks different. When I'm in italian QWERTY that key does \ (backslash) and vertical line, |. – WobblyWindows Sep 20 '15 at 16:59
  • 1
    Please edit your question to add this information. It's going to take some Windows expertise to figure this out. – Gilles Sep 20 '15 at 17:11
1

Somehow, but I don't know how, your Emacs is receiving the wrong keys, M-6 M-9 instead of ` and M-2 instead of ~. The easiest solution would be to translate those keys to the correct ones, but all M-number (being number a single digit numeric key) keys are bound to command digit-argument, which is a really useful feature that would be a pity to lose. This is why you get a long sequence of letters when you press a letter key after the backtick, they are 69, count them ;-)

Fortunately, also all C-number keys are bound to command digit-argument and, speaking for myself, I prefer to use C-number over M-number, so it won't hurt to translate M-2, M-6, and M-9 to what you need.

To restore the wanted behavior add the following code to your init file:

;; For the backtick
(define-key key-translation-map (kbd "M-6") "")        ; Do nothing
(define-key key-translation-map (kbd "M-9") (kbd "`")) ; Actually insert the backtick
;; For the tilde
(define-key key-translation-map (kbd "M-2") (kbd "~"))
  • Probably it would be better to bind M-6 to ignore, but it doesn't appear to be effective. – giordano Oct 21 '15 at 19:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.