[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Using quail input methods to translate buffer text.
From: |
Kenichi Handa |
Subject: |
Re: Using quail input methods to translate buffer text. |
Date: |
Fri, 07 Jul 2006 10:40:12 +0900 |
User-agent: |
SEMI/1.14.3 (Ushinoya) FLIM/1.14.2 (Yagi-Nishiguchi) APEL/10.2 Emacs/22.0.50 (i686-pc-linux-gnu) MULE/5.0 (SAKAKI) |
In article <address@hidden>, Peter Heslin <address@hidden> writes:
> I have some ascii text that I want to convert to utf-8, and it is
> encoded in a manner just like one of the quail input methods. Can
> anyone tell me if there is a function that will take text from a buffer
> and treat it as if it were input as keystrokes to quail, and then output
> the result in Unicode?
We don't have such a function, but this will work in many
cases.
(defun temp (input-method key-string)
(let ((str ""))
(activate-input-method input-method)
(setq unread-command-events (string-to-list key-string))
(while unread-command-events
(let ((key (car unread-command-events))
events)
(setq unread-command-events (cdr unread-command-events))
(setq events (funcall input-method-function key))
(dolist (elt events)
(if (integerp elt)
(setq str (concat str (string elt)))))))
(activate-input-method nil)
(decode-coding-string (encode-coding-string str 'utf-8) 'utf-8)))
For example:
(temp "cyrillic-yawerty" "abcd") => "абцд"
You don't need the last decode-coding-string if you use
emacs-unicode-2.
---
Kenichi Handa
address@hidden
- Using quail input methods to translate buffer text., Peter Heslin, 2006/07/05
- Re: Using quail input methods to translate buffer text., Evil Boris, 2006/07/06
- Re: Using quail input methods to translate buffer text.,
Kenichi Handa <=
- Re: Using quail input methods to translate buffer text., Peter Heslin, 2006/07/07
- Re: Using quail input methods to translate buffer text., Kenichi Handa, 2006/07/07
- Re: Using quail input methods to translate buffer text., Peter Heslin, 2006/07/07
- Re: Using quail input methods to translate buffer text., Miles Bader, 2006/07/07
- Re: Using quail input methods to translate buffer text., Miles Bader, 2006/07/07
- Re: Using quail input methods to translate buffer text., Peter Heslin, 2006/07/10
- Re: Using quail input methods to translate buffer text., Kenichi Handa, 2006/07/17
- Re: Using quail input methods to translate buffer text., Peter Heslin, 2006/07/20
- Re: Using quail input methods to translate buffer text., Kenichi Handa, 2006/07/20
- Re: Using quail input methods to translate buffer text., Miles Bader, 2006/07/20