bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#22958: 25.0.91; universal-argument, self-insert and input-method, un


From: Joakim Jalap
Subject: bug#22958: 25.0.91; universal-argument, self-insert and input-method, unexpected result
Date: Tue, 05 Jul 2016 14:14:37 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux)

Eli Zaretskii <eliz@gnu.org> writes:

>> From: Joakim Jalap <joakim.jalap@fastmail.com>
>> Date: Wed, 09 Mar 2016 13:02:49 +0100
>>
>> Perhaps this is not a bug, but it certainly surprised me.
>
> Of course, it's a bug.

Good :) Or something...

I looked into it a bit more, and it seems to me the trouble is that
`universal-argument--mode' uses `set-transient-map' to set
`universal-argument-map' when `C-u' is pressed. This sets
`overriding-terminal-local-map', which makes quail chicken out. Below
are two different patches which fix the original problem. I have no idea
if this is a good way to do it, but it seems to work for me :)

This way we just ignore `overriding-terminal-local-map' if it is
`universal-argument-map'.

diff --git a/lisp/international/quail.el b/lisp/international/quail.el
index f5e3902..2cb3ad1 100644
--- a/lisp/international/quail.el
+++ b/lisp/international/quail.el
@@ -1333,7 +1333,12 @@ quail-conversion-str
 
 (defun quail-input-method (key)
   (if (or buffer-read-only
-         overriding-terminal-local-map
+         (and overriding-terminal-local-map
+               ;; If the overriding map is `universal-argument-map'
+               ;; that must mean the user has pressed 'C-u KEY'.  In
+               ;; this case we act as if there was no overriding map.
+               (not (eq (cadr overriding-terminal-local-map)
+                        universal-argument-map)))
          overriding-local-map)
       (list key)
     (quail-setup-overlays (quail-conversion-keymap))
This way, we defer to the input method iff
`overriding-terminal-local-map' is `universal-argument-map' and the
given key has no binding there. 

diff --git a/lisp/international/quail.el b/lisp/international/quail.el
index f5e3902..e5ac0d3 100644
--- a/lisp/international/quail.el
+++ b/lisp/international/quail.el
@@ -1333,7 +1333,15 @@ quail-conversion-str
 
 (defun quail-input-method (key)
   (if (or buffer-read-only
-         overriding-terminal-local-map
+         (and overriding-terminal-local-map
+               ;; If the overriding map is `universal-argument-map' that
+               ;; must mean the user has pressed 'C-u KEY'.  If KEY has a
+               ;; binding in `universal-argument-map' just return
+               ;; (list KEY), otherwise act as if there was no
+               ;; overriding map.
+               (or (not (eq (cadr overriding-terminal-local-map)
+                            universal-argument-map))
+                   (lookup-key overriding-terminal-local-map (vector key))))
          overriding-local-map)
       (list key)
     (quail-setup-overlays (quail-conversion-keymap))
The difference is whether or not the current input method should be used
to input the digit arguments of the universal argument. With an
input-method that rebinds the number row (like programmer-dvorak) the
results may be a bit strange... I don't really know which is the most
natural behavior.

-- Joakim

reply via email to

[Prev in Thread] Current Thread [Next in Thread]