unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Drew Adams <drew.adams@oracle.com>
To: mikew2801@gmail.com, help-gnu-emacs@gnu.org
Subject: RE: Inputting characters with specialist diacritic marks in emacs
Date: Tue, 19 Jan 2016 07:25:11 -0800 (PST)	[thread overview]
Message-ID: <deab9332-eee3-44cc-a2b0-26a46b079cae@default> (raw)
In-Reply-To: <571eb6f1-614e-4ec0-9c55-bbe1fbfb9ddc@googlegroups.com>

> 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



  parent reply	other threads:[~2016-01-19 15:25 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-19 13:30 Inputting characters with specialist diacritic marks in emacs mikew2801
2016-01-19 15:00 ` Haines Brown
2016-01-19 15:25 ` Drew Adams [this message]
2016-01-19 15:26 ` patrick mc allister
2016-01-19 15:35   ` Stefan Monnier
2016-01-19 16:03 ` Teemu Likonen
2016-01-19 16:20 ` Stefan Monnier
2016-01-19 19:45 ` Emanuel Berg
2016-01-19 20:49   ` Nick Dokos
2016-01-19 20:58     ` Emanuel Berg
2016-01-19 21:05     ` Emanuel Berg
2016-01-19 22:46       ` Robert Thorpe
2016-01-20  8:25 ` mikew2801
2016-01-21  0:43   ` Emanuel Berg
2016-01-21 20:31 ` Sven Bretfeld
     [not found] ` <mailman.2611.1453232746.843.help-gnu-emacs@gnu.org>
2016-01-22  0:49   ` B. T. Raven
2016-01-22  1:24     ` Emanuel Berg
2016-01-22  1:27     ` Joost Kremers
     [not found]     ` <mailman.2729.1453425895.843.help-gnu-emacs@gnu.org>
2016-01-22  1:31       ` Joost Kremers
2016-01-22  2:30         ` Emanuel Berg
2016-01-27  8:52 ` Alan

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=deab9332-eee3-44cc-a2b0-26a46b079cae@default \
    --to=drew.adams@oracle.com \
    --cc=help-gnu-emacs@gnu.org \
    --cc=mikew2801@gmail.com \
    /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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).