all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Xah Lee <xah@xahlee.org>
To: help-gnu-emacs@gnu.org
Subject: Re: Avoiding CLI-emacs character suckage on OS X?
Date: Fri, 23 Nov 2007 00:40:14 -0800 (PST)	[thread overview]
Message-ID: <f770ac76-4980-4dfb-b6a8-a6d9e3a4d690@s19g2000prg.googlegroups.com> (raw)
In-Reply-To: mailman.3862.1195603755.18990.help-gnu-emacs@gnu.org

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	other threads:[~2007-11-23  8:40 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <mailman.3862.1195603755.18990.help-gnu-emacs@gnu.org>
2007-11-23  8:40 ` Xah Lee [this message]
2007-11-23 10:05 ` Avoiding CLI-emacs character suckage on OS X? David Reitter
2007-11-21  0:09 Moira

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f770ac76-4980-4dfb-b6a8-a6d9e3a4d690@s19g2000prg.googlegroups.com \
    --to=xah@xahlee.org \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.