unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Joakim Jalap <joakim.jalap@fastmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 22958@debbugs.gnu.org
Subject: bug#22958: 25.0.91; universal-argument, self-insert and input-method, unexpected result
Date: Tue, 05 Jul 2016 14:14:37 +0200	[thread overview]
Message-ID: <871t38nuxe.fsf@fastmail.com> (raw)
In-Reply-To: <83y49ro93r.fsf@gnu.org> (Eli Zaretskii's message of "Wed, 09 Mar 2016 19:27:04 +0200")

[-- Attachment #1: Type: text/plain, Size: 730 bytes --]

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'.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: ignore universal-argument-map --]
[-- Type: text/x-diff, Size: 770 bytes --]

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))

[-- Attachment #3: Type: text/plain, Size: 146 bytes --]


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. 


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #4: lookup in universal-argument-map --]
[-- Type: text/x-diff, Size: 960 bytes --]

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))

[-- Attachment #5: Type: text/plain, Size: 307 bytes --]


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	other threads:[~2016-07-05 12:14 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-09 12:02 bug#22958: 25.0.91; universal-argument, self-insert and input-method, unexpected result Joakim Jalap
2016-03-09 17:27 ` Eli Zaretskii
2016-07-05 12:14   ` Joakim Jalap [this message]
2016-07-05 14:54     ` Eli Zaretskii
2016-08-10 18:31       ` Joakim Jalap
2016-08-13  9:28         ` Eli Zaretskii

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=871t38nuxe.fsf@fastmail.com \
    --to=joakim.jalap@fastmail.com \
    --cc=22958@debbugs.gnu.org \
    --cc=eliz@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).