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

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

RE: Using punctuation in abbrev


From: Drew Adams
Subject: RE: Using punctuation in abbrev
Date: Sat, 1 Jun 2013 11:42:56 -0700 (PDT)

> I want to substitute $-> with a unicode rightwards arrow (U+2192  →).

1. Does that mean that you want to type `$->' and use `expand-abbrev'
each time to insert a Unicode right arrow?  If so, and if you don't
really care whether you use abbrev, consider binding insertion of a
right arrow char to a key sequence instead.

2. On the other hand, if you already have lots of `$->' occurrences in
your text and you want to change them to right arrows, consider using
`query-replace' or `replace-string' instead.

For #1, library ucs-cmds.el can help.
http://www.emacswiki.org/emacs-en/download/ucs-cmds.el
http://www.emacswiki.org/emacs/UnicodeEncoding

Command `ucsc-insert' is a replacement for `insert-char'.

You can remap the keys bound to `insert-char' to `uscs-insert', if
you like: (define-key global-map [remap insert-char] 'ucsc-insert)

Unless you give `ucsc-insert' a negative prefix arg it does the same
thing as `insert-char'.  With a negative prefix arg it creates a
command that inserts the Unicode character you choose.

You can provide the character by hex or by name (with completion).
In this case, that means 2192 or "RIGHT ARROW".

Create command `right-arrow', which inserts a right arrow char (U+2192):

M-- M-x ucsc-insert 2192 RET

Bind the command to a key (e.g., <f9>):

(global-set-key [f9] 'right-arrow)

You can use a numeric prefix arg to insert multiple right arrows:
`M-8 <f9>' inserts eight right arrows.



reply via email to

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