[Top][All Lists]

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

Re: Inputting characters with specialist diacritic marks in emacs

From: B. T. Raven
Subject: Re: Inputting characters with specialist diacritic marks in emacs
Date: Thu, 21 Jan 2016 18:49:38 -0600
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.5.1

By far the easiest and mnemonically most intuitive way of inserting exotic glyphs is with an input method. If you put this line:

(fset 'im-lat
   [?\C-x return ?\C-\\ ?l ?a ?t ?i ?n ?- ?p ?o ?s ?t ?f ?i ?x return])

into your .emacs you can invoke the latin-postfix method with M - im-lat and have access to å ä ö Å Ä Ö plus about 180 other diacritic combinations from all the languages of Europe that use the Latin alphabet, and including £ ¥ €

then you can toggle back and forth to and from your previous input method with C-\

If you need something really exotic, you can accomplish that with e. g.:
(global-set-key "\C-cI" (lambda () (interactive)  (insert  ?‽)))
;;;; interrobang


P.S. When will Emacs support a ring or stack of input method invocations by the C-\ keychord?

On 1/19/2016 1:45 PM, Emanuel Berg wrote:
address@hidden writes:

(global-set-key (kbd "C-c y") (lambda () (interactive)
(insert "ñ"))) ...

This is not ideal since it's quite difficult to type
these bindings.

Do you mean it is difficult/tedious to hit those
keystrokes or do you mean it is a lot of work setting
them up?

If it is difficult/tedious, come up with better
shortcuts! (But `C-c y' is fine in that sense what
I can see.)

If it is a lot of work setting it up, either use
kill/yank, or write a script to automatize it if you
have several hundred such chars - but if you do,
you'll have to come up with a more refined keyboard
scheme as well otherwise the shortcuts will be
depleted before long...

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.

Yes, this is the best solution, to have a
*compose key* which works in Linux in general and in
Emacs the exact same way (with Emacs running on Linux,
of course).

For example, I, as a programmer, am so used to coding
and writing (in English). So I want the Anglo-American
keyboard layout for both purposes. But when I write in
Swedish, which I do say once a day - even tho it is
a 100th or so of all my writing - it is a small part
but not small enough to be neglected, *then*, I still
cannot use the Swedish layout, as that would bring
havoc to my brain as so many chars would change place
on the keyboard. Still (again) I need the å, ä, and
ö chars which are in the Swedish alphabet but not
the English.

The solution is the compose key, which in the
Linux VTs (the ttys, or "the console") are setup like
I show soon. But, you probably don't use the ttys, so
I show this just to illustrate the principle. In X,
you can do the same, of course, just not the same way.

Good luck!

Relevant part from: /etc/console-setup/

Whole file:

### compose key
## To make the compose key work,
## see the setting in /etc/default/keyboard
## if that doesn't work, use showkey(1)
## to get the desired keycode, and:

keycode 125 = Compose

## setup the combinations one by one;
## output current state with 'dumpkeys --compose-only' [1]

## [1] for these to work in a tmux session, use:
##     $ sudo chmod +s /usr/bin/showkey # ditto /bin/dumpkeys

compose '"'  'A' to U+00C4 # Ä
compose '"'  'a' to U+00E4 # ä
compose '"'  'O' to U+00D6 # Ö
compose '"'  'o' to U+00F6 # ö
compose '"'  'U' to U+00DC # Ü
compose '"'  'u' to U+00FC # ü
compose '/'  'A' to U+00C1 # Á
compose '/'  'a' to U+00E1 # á
compose '/'  'E' to U+00C9 # É
compose '/'  'e' to U+00E9 # é
compose '/'  'I' to U+00CD # Í
compose '/'  'i' to U+00ED # í
compose '/'  'O' to U+00D3 # Ó
compose '/'  'o' to U+00F3 # ó
compose '/'  'U' to U+00DA # Ú
compose '/'  'u' to U+00FA # ú
compose '0'  'A' to U+00C5 # Å
compose '0'  'a' to U+00E5 # å
compose '\\' 'A' to U+00C0 # À
compose '\\' 'a' to U+00E0 # à
compose 'o'  'A' to U+00C5 # Å
compose 'o'  'a' to U+00E5 # å

reply via email to

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