emacs-devel
[Top][All Lists]
Advanced

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

RE: Feature suggestion


From: Drew Adams
Subject: RE: Feature suggestion
Date: Sat, 2 Jun 2012 07:13:29 -0700

> > I think there is a way to enter characters by their long names, too,
> > but I don't recall what it is.  It would be good to mention that
> > method too.
> 
> `C-x 8 RET' (command `ucs-insert') also lets you complete 
> against the char name.

FWIW - 

1. I use a variant (`ucsc-insert') of `ucs-insert' that has the same behavior
except for a negative prefix arg (`ucs-insert' is anyway a no-op for such an
arg):

* A negative arg is treated as its absolute value, so -3 inserts 3 copies of the
char, just like 3 does.

* A negative arg also automatically creates a command that inserts the same
character (accepting a prefix arg for multiple copies).  The command name is the
same as the char name, except lowercase and with SPC chars replaced by hyphens
(`-').  I bind it to `C-x 8 RET', obviously.

For example, if you use `C-- C-x 8 RET greek capital letter delta' (e.g., using
completion), then it defines a command `greek-capital-letter-delta' that inserts
that char.  Convenient for binding keys to effectively add Unicode chars to your
keyboard.

2. I define a macro, `ucsc-make-commands', that takes a regexp arg and defines
all such insertion commands for chars whose names match the regexp.

Examples:

(ucsc-make-commands "^math") ; Math symbols
(ucsc-make-commands "latin") ; Latin alphabet characters
(ucsc-make-commands "arabic")
(ucsc-make-commands "^cjk")  ; Chinese, Japanese, Korean characters
(ucsc-make-commands "^box drawings ")
(ucsc-make-commands "^greek [a-z]+ letter") ; Greek characters
(ucsc-make-commands
  "\\(^hangul\\|^circled hangul\\|^parenthesized hangul\\)")

Note that a drawback to using `ucs[c]-insert' with completion is that it is slow
- there are *many* Unicode chars.  This lets you use it when you really need it,
but have tailor-made insertion commands for the chars you use often.  And of
course even if you do not bind most such commands, completion against their
names is much quicker, since the domain is smaller (even if you create a lot of
such commands).

The code is here:
http://www.emacswiki.org/emacs/download/ucs-cmds.el
I have no objection to it being added to Emacs (the patch is trivial).




reply via email to

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