From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: handa@gnu.org (K. Handa) Newsgroups: gmane.emacs.devel Subject: Re: Issues with quail.el Date: Thu, 17 May 2018 21:31:01 +0900 Message-ID: <87fu2qpipm.fsf@gnu.org> References: <87po21f4dl.fsf@gnu.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: blaine.gmane.org 1526560165 21524 195.159.176.226 (17 May 2018 12:29:25 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 17 May 2018 12:29:25 +0000 (UTC) To: amit.ramon@riseup.net, emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu May 17 14:29:21 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 1fJI25-0005Vl-2r for ged-emacs-devel@m.gmane.org; Thu, 17 May 2018 14:29:21 +0200 Original-Received: from localhost ([::1]:53629 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fJI4B-0000Ky-V5 for ged-emacs-devel@m.gmane.org; Thu, 17 May 2018 08:31:31 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:60003) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fJI3w-0000KL-8W for emacs-devel@gnu.org; Thu, 17 May 2018 08:31:20 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fJI3r-00069n-Da for emacs-devel@gnu.org; Thu, 17 May 2018 08:31:16 -0400 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:47028) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fJI3l-00066F-HP; Thu, 17 May 2018 08:31:05 -0400 Original-Received: from fl1-119-240-85-224.iba.mesh.ad.jp ([119.240.85.224]:49594 helo=mongkok) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1fJI3k-0003qp-TP; Thu, 17 May 2018 08:31:05 -0400 Original-Received: from handa by mongkok with local (Exim 4.90_1) (envelope-from ) id 1fJI3h-0006aW-Dv; Thu, 17 May 2018 21:31:01 +0900 In-Reply-To: <87po21f4dl.fsf@gnu.org> (handa@gnu.org) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e 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:225363 Archived-At: Hi, In article <87po21f4dl.fsf@gnu.org>, handa@gnu.org (K. Handa) writes: > diff --git a/lisp/international/quail.el b/lisp/international/quail.el > index eece836354..a81244a1db 100644 > --- a/lisp/international/quail.el > +++ b/lisp/international/quail.el > @@ -815,7 +815,7 @@ quail-insert-kbd-layout > (aref (cdr translation) 0) > " "))) > (setq done-list (cons translation done-list))) > - (setq translation (aref kbd-layout i))) > + (setq translation ch)) > (aset layout i translation)) > (setq i (1+ i))) =20 Have you tried the above patch? Did it work? > [...] > > What I get for the second letter (TET, =D7=98) is: > > =D7=98 can't be input by the current input method > I confimed this bug, but it seems that fixing take more time. Please wa= it. Here's the patch to fix it. Could you please try it? diff --git a/lisp/international/quail.el b/lisp/international/quail.el index eece836354..bcbb0c0958 100644 --- a/lisp/international/quail.el +++ b/lisp/international/quail.el @@ -786,6 +786,36 @@ quail-keyboard-translate char) ch)))))) =20 +(defun quail-keyboard-untranslate (char) + "Translate CHAR back to the one on the current keyboard layout. +CHAR is the one on the standard keyboard layout. +If the current keyboard layout does not have the corresponding character, +return nil." + (if (eq quail-keyboard-layout quail-keyboard-layout-standard) + ;; All Quail packages are designed based on + ;; `quail-keyboard-layout-standard'. + char + (let ((i 0)) + ;; Find the key location on the standard keyboard layout. + (while (and (< i quail-keyboard-layout-len) + (/=3D char (aref quail-keyboard-layout-standard i))) + (setq i (1+ i))) + (if (=3D i quail-keyboard-layout-len) + ;; CHAR is not in the current keyboard layout, which means + ;; that a user can not type a key which generates CHAR. + ;; Just return nil. + nil + (let ((ch (aref quail-keyboard-layout i))) + (if (=3D ch ?\ ) + ;; This location not available in the current keyboard + ;; layout. Check if the location is used to substitute + ;; for the other location of the standard layout. + (if (setq i (cdr (rassq i quail-keyboard-layout-substitution))) + (aref quail-keyboard-layout i) + ;; Just return il as well as above. + nil) + ch)))))) + (defun quail-keyseq-translate (keyseq) (apply 'string (mapcar (function (lambda (x) (quail-keyboard-translate x))) @@ -2843,8 +2873,27 @@ quail-show-key (error "No input method is activated")) (or (assoc current-input-method quail-package-alist) (error "The current input method does not use Quail")) - (let* ((char (following-char)) - (key-list (quail-find-key char))) + (let ((char (following-char)) + key-list) + ;; Get a list of keyseqs (the standard keyboard layout based) to type = CHAR. + (let ((quail-keyboard-layout quail-keyboard-layout-standard)) + (setq key-list (quail-find-key char))) + ;; Then convert each key (of each keyseq if any) to the key of the + ;; current keyboard layout. + (if (and (consp key-list) + (quail-kbd-translate)) + (let (untranslated-key-list) + (dolist (keyseq key-list) + (setq keyseq + (catch 'tag + (mapconcat #'(lambda (key) + (setq key (quail-keyboard-untranslate k= ey)) + (if key + (string key) + (throw 'tag nil))) + keyseq ""))) + (if keyseq (push keyseq untranslated-key-list))) + (setq key-list (nreverse untranslated-key-list)))) (cond ((consp key-list) (message "To input `%c', type \"%s\"" char