[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [conversion fails]
From: |
Uwe Brauer |
Subject: |
Re: [conversion fails] |
Date: |
Tue, 13 Feb 2018 09:43:56 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux) |
> Uwe Brauer <address@hidden> writes:
> [...]
> Right. A corner case I missed. Specifically, if the region ends on
> a key sequence that encodes a valid character, but could be a
> prefix of another character.
> (defun accentuate-region (start end)
> "Replace the region by using it as keys using the current input method"
> (interactive "r")
> (save-excursion
> (goto-char start)
> (let* ((data (delete-and-extract-region start end))
> (size (length data))
> (idx 0) (cand ""))
> (while (< idx size)
> (let* ((next-cand (concat cand (list (aref data idx))))
> (map (quail-lookup-key next-cand))
> (def (and map (quail-map-definition map))))
> (if (null map)
> (progn
> (insert next-cand)
> (setq cand ""))
> (if (and def (null (cdr map)))
> (progn
> (insert (quail-get-current-str (length next-cand) def))
> (setq cand ""))
> (setq cand next-cand)))
> (incf idx)))
> (let* ((map (quail-lookup-key cand))
> (def (and map (quail-map-definition map))))
> (if def
> (insert (quail-get-current-str (length cand) def))
> (insert cand))))))
Great, that looks very very promising. I will run various test cases and
come back when I finished. Maybe that code should make it, perhaps with a
different name, into quail.el?
I have to admit that this code is beyond me, while I more or less
understood the original iso-accentuate code, which worked with tables.
A last question then, for the sake of completion: you said the inverse
function would be trivial. In the case of the original iso-accentuate it
was. Would it be here as well? But as I said in my earlier mail I am
very happy with the accentuate version.
Thanks a zillon
Uwe
- quail input methods and conversion functions, Uwe Brauer, 2018/02/02
- Re: quail input methods and conversion functions, Michael Welsh Duggan, 2018/02/07
- Re: quail input methods and conversion functions, Uwe Brauer, 2018/02/08
- Re: quail input methods and conversion functions, Michael Welsh Duggan, 2018/02/09
- [conversion fails] (was: quail input methods and conversion functions), Uwe Brauer, 2018/02/10
- Re: [conversion fails], Michael Welsh Duggan, 2018/02/11
- Re: [conversion fails], Uwe Brauer, 2018/02/12
- Re: [conversion fails], Uwe Brauer, 2018/02/12
- Re: [conversion fails], Michael Welsh Duggan, 2018/02/12
- Re: [conversion fails],
Uwe Brauer <=
- Re: [conversion fails], Uwe Brauer, 2018/02/13
- Re: [conversion fails], Michael Welsh Duggan, 2018/02/13
- Re: [conversion fails], Uwe Brauer, 2018/02/13
- Re: [conversion fails], Michael Welsh Duggan, 2018/02/13
- Re: [conversion fails], Uwe Brauer, 2018/02/14
- [MELPA] (was: [conversion fails]), Uwe Brauer, 2018/02/19
- Re: [MELPA], Michael Welsh Duggan, 2018/02/19