[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: Inputting characters with specialist diacritic marks in emacs
From: |
Drew Adams |
Subject: |
RE: Inputting characters with specialist diacritic marks in emacs |
Date: |
Tue, 19 Jan 2016 07:25:11 -0800 (PST) |
> My makeshift solution is to use the "global-set-key" function to bind
> individual characters to keys, e.g.,
>
> (global-set-key (kbd "C-c y") (lambda () (interactive) (insert "ñ")))
> (global-set-key (kbd "C-c t") (lambda () (interactive) (insert "ṭ")))
> (global-set-key (kbd "C-c d") (lambda () (interactive) (insert "ḍ")))
>
> This is not ideal since it's quite difficult to type these bindings. In
> Linux I use Ibus mappings which involve double-tapping a similar key (e.g.,
> when I type "a-a" I get "ā", when I type "i-i" I get "ī" and so on.
>
> The question is - is there a way to make similar key-bindings in Emacs?
> Sublime facilitates this, but I'd rather stay in emacs and emacs 24 refuses
> to work with Ibus (I've tried other help forums on Ibus/emacs to no avail).
If the characters or their code points are related in a way that
can be simply ordered, then you can iterate over char/code point
in some range(s), invoking `global-set-key' for each in turn.
Or even if you can just list them:
(defvar cks `((,(kbd "C-c y") "ñ") (,(kbd "C-c t") "ṭ") (,(kbd "C-c d") "ḍ"))
"...")
(dolist (c+k cks)
(global-set-key (car c+k) (lambda () (interactive) (insert (cadr c+k)))))
And perhaps you can codify the relation between, say, (C-c) d and "ḍ".
Admittedly, this just uses a different form, and doesn't really save
you any typing.
But if the main difficulty is entering the characters, then know that
Emacs makes it pretty easy to enter any Unicode characters, if you
know either their Unicode names or their Unicode code points.
Hit `C-x 8 RET' (RET is the Enter key), and you are prompted for the
character name. You can use completion to enter it. Or you can just
enter the code point as a hexadecimal number. Then hit RET again.
----
FWIW, though it likely won't help with creating the keybindings, library
`ucs-cmds.el' might help a little here. Its macro `ucsc-make-commands'
lets you create sets of commands that insert individual characters, by
giving it a regexp that is matched against the Unicode character names.
For example:
(ucsc-make-commands "^greek [a-z]+ letter") ; Commands for Greek letters.
(ucsc-make-commands "arabic") ; Commands for Arabic characters.
The resulting commands have the same names as the characters they insert.
You can then bind those commands to keys. (Perhaps this will help you
create the keybindings, if the names of your chars follow some pattern.)
Library: http://www.emacswiki.org/emacs/download/ucs-cmds.el
- Inputting characters with specialist diacritic marks in emacs, mikew2801, 2016/01/19
- Re: Inputting characters with specialist diacritic marks in emacs, Haines Brown, 2016/01/19
- RE: Inputting characters with specialist diacritic marks in emacs,
Drew Adams <=
- Re: Inputting characters with specialist diacritic marks in emacs, patrick mc allister, 2016/01/19
- Re: Inputting characters with specialist diacritic marks in emacs, Teemu Likonen, 2016/01/19
- Re: Inputting characters with specialist diacritic marks in emacs, Stefan Monnier, 2016/01/19
- Re: Inputting characters with specialist diacritic marks in emacs, Emanuel Berg, 2016/01/19
- Re: Inputting characters with specialist diacritic marks in emacs, mikew2801, 2016/01/20