From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Joakim Jalap Newsgroups: gmane.emacs.bugs Subject: bug#22958: 25.0.91; universal-argument, self-insert and input-method, unexpected result Date: Tue, 05 Jul 2016 14:14:37 +0200 Message-ID: <871t38nuxe.fsf@fastmail.com> References: <87a8m7c106.fsf@fastmail.com> <83y49ro93r.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: ger.gmane.org 1467720937 26008 80.91.229.3 (5 Jul 2016 12:15:37 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 5 Jul 2016 12:15:37 +0000 (UTC) Cc: 22958@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Jul 05 14:15:24 2016 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1bKPG7-0000l4-St for geb-bug-gnu-emacs@m.gmane.org; Tue, 05 Jul 2016 14:15:24 +0200 Original-Received: from localhost ([::1]:54576 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bKPG7-0004Jl-2N for geb-bug-gnu-emacs@m.gmane.org; Tue, 05 Jul 2016 08:15:23 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:33783) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bKPFt-0004Ct-Ec for bug-gnu-emacs@gnu.org; Tue, 05 Jul 2016 08:15:15 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bKPFm-0003z9-G5 for bug-gnu-emacs@gnu.org; Tue, 05 Jul 2016 08:15:08 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:53686) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bKPFm-0003yw-7J for bug-gnu-emacs@gnu.org; Tue, 05 Jul 2016 08:15:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1bKPFm-0007Te-44 for bug-gnu-emacs@gnu.org; Tue, 05 Jul 2016 08:15:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Joakim Jalap Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 05 Jul 2016 12:15:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 22958 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 22958-submit@debbugs.gnu.org id=B22958.146772088828705 (code B ref 22958); Tue, 05 Jul 2016 12:15:02 +0000 Original-Received: (at 22958) by debbugs.gnu.org; 5 Jul 2016 12:14:48 +0000 Original-Received: from localhost ([127.0.0.1]:37790 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bKPFX-0007Su-OT for submit@debbugs.gnu.org; Tue, 05 Jul 2016 08:14:47 -0400 Original-Received: from out3-smtp.messagingengine.com ([66.111.4.27]:46884) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bKPFV-0007Sl-9K for 22958@debbugs.gnu.org; Tue, 05 Jul 2016 08:14:46 -0400 Original-Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 60D87201D0; Tue, 5 Jul 2016 08:14:43 -0400 (EDT) Original-Received: from frontend2 ([10.202.2.161]) by compute4.internal (MEProxy); Tue, 05 Jul 2016 08:14:43 -0400 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=fastmail.com; h=cc :content-type:date:from:in-reply-to:message-id:mime-version :references:subject:to:x-sasl-enc:x-sasl-enc; s=mesmtp; bh=mkriU 6+FqMMNmA7lPsvaftXFunA=; b=usKRC4SOCXNtEPAaCqGwjsVBnqVQZDmO3ej36 tXIlFyEFHdDc+a7WFgSAedEmMT2c8xZGZqOFCohKzzNJezbLvd2/H0V9tPs3HaFy NNW6DAm8faV7VOM6lTGsHdKK/1MLtS1JdwwdLxTaKXZp40vgq1wPOEngIq4xAOJ5 kO0elk= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-sasl-enc :x-sasl-enc; s=smtpout; bh=mkriU6+FqMMNmA7lPsvaftXFunA=; b=C+h4A 2wBETWLAMkbyayYa2817QR3GnwdHJwhZORNEhC41gxnnS+gfWN+ftwoSha3yBFb5 c0XnfpHWdB7oco+t+fZbJ/ea+Yarr3ousaSOh0cIcRuXA676H7flU9WyDWsynLD4 yvOI1xO0E6tC8giPtDMdsfwYnF3w0zHqpXOii8= X-Sasl-enc: kRiA36ophSEl7eDTlYveG1x59vL1zALSNFvkAlnyb1mU 1467720881 Original-Received: from thinkpad (c-5eeaaacc-74736162.cust.telenor.se [94.234.170.204]) by mail.messagingengine.com (Postfix) with ESMTPA id 08FECCCDB9; Tue, 5 Jul 2016 08:14:40 -0400 (EDT) In-Reply-To: <83y49ro93r.fsf@gnu.org> (Eli Zaretskii's message of "Wed, 09 Mar 2016 19:27:04 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:120430 Archived-At: --=-=-= Content-Type: text/plain Eli Zaretskii writes: >> From: Joakim Jalap >> 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'. --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=ignore-universal-argument-map.diff Content-Description: ignore 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)) --=-=-= Content-Type: text/plain 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. --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=lookup-in-universal-argument-map.diff Content-Description: lookup in universal-argument-map 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)) --=-=-= Content-Type: text/plain 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 --=-=-=--