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

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

Re: .emacs poser


From: Joost Kremers
Subject: Re: .emacs poser
Date: 17 Dec 2013 21:15:00 GMT
User-agent: slrn/pre1.0.0-18 (Linux)

Doug Lewan wrote:
> I'm surprised that there's only one mention of input methods and so
> much about composing characters, which is, as you point out, a little
> clumsy.

Yeah, my thoughts exactly.

> It's easy to extend an input method with new rules. I frequently use
> the latin-1-prefix mode for a handful of special characters that I
> use. The lisp to add my rules looks like this:
>
> (setq default-input-method "latin-1-prefix")
> (let ((quail-setup-buf (get-buffer-create "*Quail setup*")))
>   (save-excursion (set-buffer quail-setup-buf)
>                 (toggle-input-method)
>                 ;; MAINTENANCE Look for SYMBOLS
>                 (quail-defrule ":A" ?∀)
>                 (quail-defrule ":E" ?∃)
>                 (quail-defrule ":e" ?∈)
>                                      ...))

It's also possible to define completely new input methods. I load the
following code from my init.el:

(quail-define-package
 "arabic-trans" "Ar-trans" "A>" t
 "Input method for Arabic transcription."
 nil t nil nil nil nil nil nil nil nil t)

(quail-define-rules
 (".-" ?ʔ) ;;   U0294 # IPA GLOTTAL STOP
 ("-A" ?Ā) ;;   U0100 # LATIN CAPITAL LETTER A WITH MACRON
 ("-a" ?ā) ;;   U0101 # LATIN SMALL LETTER A WITH MACRON
 ("-D" ?Ḏ) ;;   U1E0E # LATIN CAPITAL LETTER D WITH LINE BELOW
 ("-d" ?ḏ) ;;   U1E0F # LATIN SMALL LETTER D WITH LINE BELOW
 ...)

> I also notice this comment near that code:
> ;; This seems rather a bit of a hack.
> That was my sense long ago; I don't know if that's really a fair sentiment 
> anymore.

Well, one thing that I find strange about defining input methods is that
the functions to define rules do not say to which input method the new
rule should be added. Apparently, quail-defrule adds the rule to the
current input method, while quail-define-rules seems to add them to the
most recently defined one.

Another thing that I find mildly annoying about input methods is that
even though you can set default-input-method, you still need to switch
input methods yourself. Every new buffer starts out without an input
method, so you need to do `C-\` first.

Other than that, I think they're the best way to input non-ASCII
characters.


-- 
Joost Kremers                                   joostkremers@fastmail.fm
Selbst in die Unterwelt dringt durch Spalten Licht
EN:SiS(9)


reply via email to

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