From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Uwe Brauer Newsgroups: gmane.emacs.devel Subject: [conversion fails] (was: quail input methods and conversion functions) Date: Sat, 10 Feb 2018 15:18:07 +0100 Message-ID: <8760750vz4.fsf_-_@mat.ucm.es> References: <878tcbdpf3.fsf@mat.ucm.es> <876078p1gy.fsf@md5i.com> <87tvurldff.fsf@mat.ucm.es> <87wozmnhny.fsf@md5i.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: blaine.gmane.org 1518272315 23657 195.159.176.226 (10 Feb 2018 14:18:35 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 10 Feb 2018 14:18:35 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Feb 10 15:18:30 2018 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ekVyT-0003eT-Sz for ged-emacs-devel@m.gmane.org; Sat, 10 Feb 2018 15:17:54 +0100 Original-Received: from localhost ([::1]:47495 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ekW0V-0004IR-D2 for ged-emacs-devel@m.gmane.org; Sat, 10 Feb 2018 09:19:59 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:59335) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ekVzi-0004I6-RK for emacs-devel@gnu.org; Sat, 10 Feb 2018 09:19:11 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ekVzf-0004Cc-9g for emacs-devel@gnu.org; Sat, 10 Feb 2018 09:19:10 -0500 Original-Received: from [195.159.176.226] (port=58544 helo=blaine.gmane.org) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ekVzf-00049j-2t for emacs-devel@gnu.org; Sat, 10 Feb 2018 09:19:07 -0500 Original-Received: from list by blaine.gmane.org with local (Exim 4.84_2) (envelope-from ) id 1ekVxN-00081A-1V for emacs-devel@gnu.org; Sat, 10 Feb 2018 15:16:45 +0100 X-Injected-Via-Gmane: http://gmane.org/ Mail-Followup-To: emacs-devel@gnu.org Original-Lines: 78 Original-X-Complaints-To: usenet@blaine.gmane.org Mail-Copies-To: never Cancel-Lock: sha1:XKKRabXjoW2NJ2IZHYpNOpWkQ0w= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 195.159.176.226 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:222646 Archived-At: > Uwe Brauer writes: > In the unaccentuate case (which is what your original question), it > should be easy to write that functionality using `quail-find-key' > as a base. You would have to decide how to handle failures > (character can't be typed using the current input method). Actually taking iso-accentuate and un accuate as a reference it is the accentuate part which I want to implement, for example for the greek-ibycus I want to replace a) by ἀ > The accentuate case looks more difficult. Quail allows more than one > translation candidate for a single key sequence, which leaves no good I am puzzled now, I thought any input method should be an bijection. So the old iso method was, wasn't it? > way handle these characters. A simple example from the ipa input > method: tsh can translate into ʧ, tʃ, or t⁀ʃ. I tried that out, but I obtain ʧ none of the others. > Something that works with > input methods that do not have this ambiguity is possible, though my > initial look through the code leads me to believe that this is still > going to be more difficult to write then the (fairly trivial) > unaccentuate case. I boldly took the code from iso accentuate/accentuate And define (defun ibycus4-translate-conventions (from to trans-tab) "Translate between FROM and TO using the translation table TRANS-TAB. Based on iso-cvt" (save-excursion (save-restriction (narrow-to-region from to) (goto-char from) (let ((work-tab trans-tab) (buffer-read-only nil) (case-fold-search nil)) (while work-tab (save-excursion (let ((trans-this (car work-tab))) (while (re-search-forward (car trans-this) nil t) (replace-match (car (cdr trans-this)) t nil))) (setq work-tab (cdr work-tab))))) (point-max)))) Then my table starts like this (defvar ibycus4-ibycus4-to-utf8-trans-tab '( ("a)" "ἀ") ("a(" "ἁ") ("a)`" "ἂ") ("a(`" "ἃ") ("a)'" "ἄ") ("a('" "ἅ"))) But now surprise, surprise ("ἀ" "ἀ") correct ("ἁ" "ἁ") correct ("ἀ‘" "ἂ")wrong ("ἁ‘" "ἃ")wrong ("ἀ’" "ἄ")wrong ("ἁ’" "ἅ") wrong So what is up here and what shall I do? Any help is now strongly appreciated.