# quail: TeX input method: change UTF8 to tex and back: solution & problems

Stephen J. Turnbull stephen at xemacs.org
Tue Jan 8 15:14:34 EST 2008

Uwe Brauer writes:
> >>>>> "Stephen" == Stephen J Turnbull <stephen at xemacs.org> writes:
>
>    > Uwe Brauer writes:
>    >> I am not sure whether I could treat ~ as a string, for example in the
>    >> file latin-ltx.el I see
>    >> ("\\int" ?~)
>
>    > For this purpose, the semantics of a character and of a string of
>    > length 1 are the same.
>
>    >> So the question is how shall I define the tex commands uniquely?
>
>    > Try reordering the strings to be converted longest first.
> Is there any command doing this, sort lines seems not.

C-h f sort

You'll need to actually read that alist into Lisp, then use a
comparsion function like

(lambda (a b) (< (length (car a)) (length (car b))))

to extract the keys and compare their lengths.

You could also try C-h a ^sort to see if there are other sort
functions better suited to what you need to do.