From: handa@gnu.org (K. Handa)
To: amit.ramon@riseup.net, emacs-devel@gnu.org
Subject: Re: Issues with quail.el
Date: Thu, 17 May 2018 21:31:01 +0900 [thread overview]
Message-ID: <87fu2qpipm.fsf@gnu.org> (raw)
In-Reply-To: <87po21f4dl.fsf@gnu.org> (handa@gnu.org)
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)))
Have you tried the above patch? Did it work?
> [...]
> > What I get for the second letter (TET, ט) is:
> > ט can't be input by the current input method
> I confimed this bug, but it seems that fixing take more time. Please wait.
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))))))
+(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)
+ (/= char (aref quail-keyboard-layout-standard i)))
+ (setq i (1+ i)))
+ (if (= 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 (= 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 key))
+ (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
next prev parent reply other threads:[~2018-05-17 12:31 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-05 11:53 Issues with quail.el Amit Ramon
2018-05-07 19:33 ` Eli Zaretskii
2018-05-08 8:41 ` Amit Ramon
2018-05-08 17:28 ` Eli Zaretskii
2018-05-08 19:53 ` Amit Ramon
2018-05-09 3:19 ` Michael Welsh Duggan
2018-05-10 14:12 ` Amit Ramon
2018-05-11 3:18 ` Van L
2018-05-11 16:41 ` Amit Ramon
2018-05-12 4:13 ` Michael Welsh Duggan
2018-05-12 17:12 ` Amit Ramon
2018-05-12 12:24 ` K. Handa
2018-05-17 12:31 ` K. Handa [this message]
2018-05-17 15:41 ` Amit Ramon
2018-05-17 15:44 ` Filipp Gunbin
2018-05-17 18:57 ` Amit Ramon
2018-05-18 14:36 ` K. Handa
2018-05-19 12:01 ` Amit Ramon
2018-05-23 14:27 ` K. Handa
2018-05-27 13:09 ` Amit Ramon
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87fu2qpipm.fsf@gnu.org \
--to=handa@gnu.org \
--cc=amit.ramon@riseup.net \
--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 public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).