At work I use a MacMini connected to an italian layout keyboard (please, look at the image) enter image description here

I've discovered that Emacs doesn't insert the characters @ and # when I use AltGr+ò and AltGr+à, respectively.

Any clue?

  • 2
    Try C-h k AltGr-ò to determine what emacs receives. Maybe you can bind that to the required character by (global-set-key [...] (lambda () (interactive) "@")).
    – Tobias
    Nov 29 '17 at 14:59
  • M-ò is undefined M-à is undefined
    – Daniele
    Nov 30 '17 at 10:33
  • I don't have experience with Mac OS. Maybe, the solution of matteol is the way to go. If for any reason that is not possible for you my next best guess would be to use (global-set-key (kbd "M-ò") (lambda () (interactive) "@")).
    – Tobias
    Nov 30 '17 at 20:46
  • I've updated my answer with a configuration that let you use the left Alt as Meta and the right one to insert special characters
    – matteol
    Dec 2 '17 at 15:30

I have the following in my init.el to use the italian layout with Mac OS

;; Command key is Meta
(setq ns-command-modifier 'meta)
;; Option (alt) key used for special characters (e.g. []@#{}...)
(setq ns-alternate-modifier nil)

If you want to use the left Alt key as Meta and the right one to insert special characters you can set the following

;; AltGr used for special characters (e.g. []@#{}...)
(setq ns-right-alternate-modifier nil)

leaving the default values for ns-command-modifier and ns-alternate-modifier.

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.