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

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

Re: Avoiding CLI-emacs character suckage on OS X?


From: Xah Lee
Subject: Re: Avoiding CLI-emacs character suckage on OS X?
Date: Fri, 23 Nov 2007 00:40:14 -0800 (PST)
User-agent: G2/1.0

Moira (Phillip) wrote:
> One thing with the countless emacs options is really bugging me. In
> the OS X Terminal I can either choose to use Alt as the Meta key and
> shed the means to insert such things as "\", "@", "€" and so forth
> (German KB), or I can choose to leave it and then have to use Esc
> whenever I do a single Meta action, which really sucks when scrolling
> or doing other M intensive stuff.
>
> Is there any more or less standard/default way I can insert special
> characters such as backslash, @. € and others or should I build my
> own lisp-script for that?

not quite sure precisely what's the prob....

i'd recommend that you use PC keyboard's Alt (or Apple keyboard's Cmd)
as emacs's Meta, then define

 (global-set-key (kbd "M-i a") (lambda () (interactive) (insert "α")))

enter any special char you need to type.

Here's more detail

Q: How to type this character é ?

To type characters such as é à ü î ñ, type:

character       key press
------------------------------
 é              Ctrl+x 8 ' e
 à              Ctrl+x 8 ` a
 ü              Ctrl+x 8 " u
 î              Ctrl+x 8 ^ i
 ñ              Ctrl+x 8 ~ n

To see all the non-ascii characters you can type with Ctrl+x 8 prefix,
type Ctrl+x 8 Ctrl+h.

Here is a sample of characters you can type by the Ctrl+x 8 scheme: ¡ç
£¢¥ ©®™ •º†‡ “”‘’«» ±π∞.

(If you are on a Mac, these characters can be typed by holding the
option key in most applications. To see what characters are available,
you can pull the Keyboard Viewer. To start Keyboard Viewer, go to
System Preferences→International→Input Menu tab, the click at the
bottom «Show input menu in menu bar». Then, on the input menu on top
right, there's a Show Keyboard Viewer menu.)

Q: How to use abbrev to type unicode chars?

A: Suppose you type a lot math and need math symbols such as: alpha α,
beta β, gamma γ, theta θ, Infinity ∞ etc. You can set up a abbrev-
mode, so that, when you type “alpha”, it automatically becomes “α”.
Here's what to do. Put the following in your emacs init file:

(define-abbrev-table 'global-abbrev-table '(
    ("alpha" "α" nil 0)
    ("beta" "β" nil 0)
    ("gamma" "γ" nil 0)
    ("theta" "θ" nil 0)
    ("Infinity" "∞" nil 0)

    ("ar1" "→" nil 0)
    ("ar2" "⇒" nil 0)
    ))

Then, turn on the abbrev-mode by “Alt+x abbrev-mode”. Then, when you
type alpha, it will become α.

Reference: (info "(emacs)Abbrevs").

Q: How to set a keystroke to type a unicode char?

If you have some characters that you use often, you can make emacs
inserting them with a single keypress. For example, put the following
code in your ~/.emacs, then, each time you press the 6 key on the
number pad, a arrow will be inserted.

(global-set-key [kp-6] (lambda () (interactive) (insert "→")) )

You can also set shortcut by key sequence. In the following, typing
“Alt+i a” will insert α.

(global-set-key (kbd "M-i a") (lambda () (interactive) (insert "α")))
(global-set-key (kbd "M-i b") (lambda () (interactive) (insert "β")))
(global-set-key (kbd "M-i t") (lambda () (interactive) (insert "θ")))

above from
Emacs and Unicode Tips
http://xahlee.org/emacs/emacs_n_unicode.html

  Xah
  xah@xahlee.org
∑ http://xahlee.org/



reply via email to

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