GNU bug report logs - #22958
25.0.91; universal-argument, self-insert and input-method, unexpected result

Previous Next

Package: emacs;

Reported by: Joakim Jalap <joakim.jalap <at> fastmail.com>

Date: Wed, 9 Mar 2016 12:04:02 UTC

Severity: normal

Found in version 25.0.91

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


Message #11 received at 22958 <at> debbugs.gnu.org (full text, mbox):

From: Joakim Jalap <joakim.jalap <at> fastmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 22958 <at> debbugs.gnu.org
Subject: Re: bug#22958: 25.0.91;
 universal-argument, self-insert and input-method, unexpected result
Date: Tue, 05 Jul 2016 14:14:37 +0200
[Message part 1 (text/plain, inline)]
Eli Zaretskii <eliz <at> gnu.org> writes:

>> From: Joakim Jalap <joakim.jalap <at> 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'.

[ignore-universal-argument-map.diff (text/x-diff, inline)]
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))
[Message part 3 (text/plain, inline)]
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. 

[lookup-in-universal-argument-map.diff (text/x-diff, inline)]
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))
[Message part 5 (text/plain, inline)]
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

This bug report was last modified 8 years and 285 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.