How to write a tilde character (~) in Emacs on Mac OS X?

I use to write a character by pressing Alt + N on Mac OS X. This does not work on Emacs. Alt + N seems to be tied to command history. So my question is how to write a character in Emacs on Mac OS X?

EDIT: I use Aquamacs.

+5
source share
5 answers

You can always open the "character view", select "Punctuation", find "~" (tilde), and then double-click on it. This will add it to the Emacs point. ("Character watcher" is easily accessible after checking "Display the keyboard and character viewers in the menu bar" in the "Keyboard" panel in the "System Preferences" window.)

emacs- lisp :

(defun tilde () (interactive) (insert "~"))

M-x tilde, .

(global-set-key "\M-\C-!" 'tilde)   ;; you choose the combo

emacs init.

+2

, Emacs OS X ( ). , ...

Plain Emacs OS X Alt Meta . Alt Mac (, , ..), ns-right-alternate-modifier nil, (Alt-n) Alt, Meta (, M-x).

Cmd Meta. M-x customize-group ns.

+7

quoted-insert .

C-q Alt-N

0

Aquamacs: → - → ?

0

, fpbhb emacs (emacs -nw).

, ( -). , , emacs .

"META" emacs (.. ). , :

(setq mac-command-key-is-meta nil
      mac-command-modifier nil)
(setq mac-option-key-is-meta t
      mac-option-modifier 'meta
      mac-right-option-modifier nil)

emacs . , :

→ → -

Unfortunately, after that you will not be able to use the option key to enter special characters on international keyboards. In particular, I missed the tilde, backslash, and @.

I solved this last issue by adding the missing key mapping to my .emacs:

(define-key key-translation-map (kbd "M-ñ") (kbd "~"))
(define-key key-translation-map (kbd "M-º") (kbd "\\"))
(define-key key-translation-map (kbd "M-2") (kbd "@"))

Voila.

0
source

All Articles