all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Uwe Brauer <oub@mat.ucm.es>
To: emacs-devel@gnu.org
Subject: Re: [conversion fails]
Date: Tue, 13 Feb 2018 09:43:56 +0100	[thread overview]
Message-ID: <87r2ppl1o3.fsf@mat.ucm.es> (raw)
In-Reply-To: 87lgfxo8qb.fsf@md5i.com


    > Uwe Brauer <oub@mat.ucm.es> 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 




  reply	other threads:[~2018-02-13  8:43 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-02 21:58 quail input methods and conversion functions Uwe Brauer
2018-02-08  4:08 ` Michael Welsh Duggan
2018-02-08 15:16   ` Uwe Brauer
2018-02-09 18:26     ` Michael Welsh Duggan
2018-02-10 14:18       ` [conversion fails] (was: quail input methods and conversion functions) Uwe Brauer
2018-02-12  3:53         ` [conversion fails] Michael Welsh Duggan
2018-02-12 10:07           ` Uwe Brauer
2018-02-12 10:40           ` Uwe Brauer
2018-02-13  3:43             ` Michael Welsh Duggan
2018-02-13  8:43               ` Uwe Brauer [this message]
2018-02-13  8:51               ` Uwe Brauer
2018-02-13 20:58                 ` Michael Welsh Duggan
2018-02-13 21:41                   ` Uwe Brauer
2018-02-14  0:21                     ` Michael Welsh Duggan
2018-02-14  9:08                       ` Uwe Brauer
2018-02-19 21:26                       ` [MELPA] (was: [conversion fails]) Uwe Brauer
2018-02-20  2:12                         ` [MELPA] Michael Welsh Duggan

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

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

  git send-email \
    --in-reply-to=87r2ppl1o3.fsf@mat.ucm.es \
    --to=oub@mat.ucm.es \
    --cc=emacs-devel@gnu.org \
    /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.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.