11

I have a keyboard which, for some inexplicable reason, features a key that sends the Danish Dollar symbol to OS X - §. With shift it sends the plus/minus symbol - ±.

Is it possible within Emacs to see the § key and convert that into Hyper or Super? So if I hold down that § key and press f, it will activate H-f in Emacs.

I've tried the following, which does not work:

(define-key key-translation-map (kbd "§") (kbd "<Hyper>"))

It just says <Hyper> is undefined upon pressing the key, and doesn't act as a modifier at all.

This also doesn't work:

(define-key key-translation-map (kbd "§") "<Hyper>")

that just turns the § key into a <key.

4

Short version: in Emacs terms, what I really needed was key-chords.


@Malabarba and @XinUmbralis seem to be right - Emacs doesn't let you turn a normal key into a modifier key normally. I don't really like the idea of combining every modifier key on the keyboard and calling that "Hyper", because it could conflict with other things in the future.

I already use Karabiner, and apparently you can create custom modifiers with it. But that requires mapping every combination at the OS level so that, say, §-a sends something that Emacs knows how to handle.

Then I remembered the key-chord library, and realized that was the real Emacs terminology for what I wanted. Example config:

(require 'key-chord)
(key-chord-mode 1)
(key-chord-define-global "§a" 'other-frame)

The one issue I have with key-chord is that the semantics of a key-chord are a bit different from a modifier+key - there's no repetition allowed, and the whole chord has to be entered really quickly.

If I come up with a solution to those problems, I'll write about it somewhere and provide a link in an edit to this answer.

3

You may nor may not be able to rebind the section sign key (§ key) to send the hyper command, however you could rebind the caps-lock key to send Hyper, using Seil PCKeyboardHack.

In order to rebind the caps-lock key in Seil, just do the following:

  1. Open up Seil and click 'Change the caps lock key'.
  2. Select the checkbox next to 'Change the caps lock key'.
  3. Double click on the keycode, and enter the keycode 80.
  • 1
    This answer would probably be better as a comment. In general, answers should do more than provide links, in part because the links could disappear at any time. Could you please edit your answer to make it more self-contained? – Dan Nov 8 '14 at 17:37
  • Unfortunately, at least for me, setting the keycode to 80 does nothing. – Marcin Oct 31 '16 at 23:59

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.