From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Tino Calancha Newsgroups: gmane.emacs.bugs Subject: bug#27634: 25.2.1; C-g does not quit register-read-with-preview Date: Tue, 11 Jul 2017 14:50:21 +0900 (JST) Message-ID: References: <1499659134.3804557.1035526184.45B0CA20@webmail.messagingengine.com> <87h8ykdcmx.fsf@calancha-pc> <1499671255.3837111.1035640480.1DBD693E@webmail.messagingengine.com> <83shi4i5ma.fsf@gnu.org> <1499746462.2451911.1036820704.00105E22@webmail.messagingengine.com> <3D7307DF-FB47-49FF-AEA9-67659E12821A@paulwrankin.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; BOUNDARY="8323329-2139224032-1499752224=:16870" X-Trace: blaine.gmane.org 1499752272 13168 195.159.176.226 (11 Jul 2017 05:51:12 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 11 Jul 2017 05:51:12 +0000 (UTC) User-Agent: Alpine 2.20 (DEB 67 2015-01-07) Cc: Tino Calancha , 27634@debbugs.gnu.org To: Paul Rankin Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Jul 11 07:51:08 2017 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dUo4f-00033C-9N for geb-bug-gnu-emacs@m.gmane.org; Tue, 11 Jul 2017 07:51:05 +0200 Original-Received: from localhost ([::1]:44351 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dUo4k-0006t6-LB for geb-bug-gnu-emacs@m.gmane.org; Tue, 11 Jul 2017 01:51:10 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:56725) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dUo4f-0006t0-Ap for bug-gnu-emacs@gnu.org; Tue, 11 Jul 2017 01:51:06 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dUo4c-0007A1-94 for bug-gnu-emacs@gnu.org; Tue, 11 Jul 2017 01:51:05 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:58822) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dUo4c-00079v-5R for bug-gnu-emacs@gnu.org; Tue, 11 Jul 2017 01:51:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1dUo4b-0005VS-Qm for bug-gnu-emacs@gnu.org; Tue, 11 Jul 2017 01:51:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Tino Calancha Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 11 Jul 2017 05:51:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 27634 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 27634-submit@debbugs.gnu.org id=B27634.149975223321127 (code B ref 27634); Tue, 11 Jul 2017 05:51:01 +0000 Original-Received: (at 27634) by debbugs.gnu.org; 11 Jul 2017 05:50:33 +0000 Original-Received: from localhost ([127.0.0.1]:33266 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dUo49-0005Uh-4j for submit@debbugs.gnu.org; Tue, 11 Jul 2017 01:50:33 -0400 Original-Received: from mail-pg0-f65.google.com ([74.125.83.65]:36754) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dUo47-0005UT-Ic for 27634@debbugs.gnu.org; Tue, 11 Jul 2017 01:50:32 -0400 Original-Received: by mail-pg0-f65.google.com with SMTP id y129so582939pgy.3 for <27634@debbugs.gnu.org>; Mon, 10 Jul 2017 22:50:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:date:to:cc:subject:in-reply-to:message-id:references :user-agent:mime-version; bh=nj1+poOzQ9A6euf6WAVC6RisVCjeFhMmzJ7KmlbNYyQ=; b=Gexb2AmFf4IjOlWnGCf/8DsO0sNoF+TvMyxGJ309qa9Obc1K5xui5g0drV3hur0Ih0 6tsO6kA88O2diK5IyEWTXGq7NQEAXIWr8Gu1/Qwtlyjz4zG36qqlfvIWZwYB6yI/Biso 82fLCCx74KUsdZz7haY6y5qbaUIwRBcGM5gVUj39KMNLwvwD0TlbFbYTr3s9SYX7J5ES oZZ8RwXBso4oBw5w4gtC76B97Mp7+E01YAJfIuqBWylxWsRw2MCCiD2CXopmA15dCWAT Zl0TA5GTJZk18vNsSC0f/ABd46zV0pbhU8Ni5kNQeOSlF2FHuEQuAI3RG84PiQNy5oj9 iJxw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:date:to:cc:subject:in-reply-to:message-id :references:user-agent:mime-version; bh=nj1+poOzQ9A6euf6WAVC6RisVCjeFhMmzJ7KmlbNYyQ=; b=unFnbDZSJfyCt41wmZaTIwjWhcRmsxskGHYAgb/E3EeQNeG2XsrfwZLyrhu3vWQ2RE wwAQl/sF3F/Dpldci9RUoDXtJfgUzdxiCFcDS2DYBNQ2WjbIuAi/9qhXiBzyj9ktp+c1 /aWLhCU6Un7FULOb2my6iZ1tGvnXCO3547YXfZFdBmMdowIRtzu8/cVRrLluikFHWKuQ VhpnwMi9FzpCPGGPNj7nPwk12xzioX3Jn/Snf4V141qKHI0OlWj8OpLGao4CEm859mCn FwUdh52WwIAd9bbRtsdcxvPjoM8EUKmAUf37+ywMpyaQFKAc02IvLOetBosyVOxzw6ho 8pyA== X-Gm-Message-State: AIVw113CPKQ5obBrJH3+fMT7szoZp4utp+XRMwIWqrjb9+ah9k5qNIgH 3Hz6qTVGgjr9hg== X-Received: by 10.84.157.74 with SMTP id u10mr21951511plu.137.1499752225533; Mon, 10 Jul 2017 22:50:25 -0700 (PDT) Original-Received: from calancha-pc (170.224.128.101.dy.bbexcite.jp. [101.128.224.170]) by smtp.gmail.com with ESMTPSA id p15sm28260271pfi.99.2017.07.10.22.50.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 10 Jul 2017 22:50:24 -0700 (PDT) X-Google-Original-From: Tino Calancha X-X-Sender: calancha@calancha-pc In-Reply-To: <3D7307DF-FB47-49FF-AEA9-67659E12821A@paulwrankin.com> 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:134424 Archived-At: --8323329-2139224032-1499752224=:16870 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8BIT On Tue, 11 Jul 2017, Paul Rankin wrote: >>> >>> One overlooked thing about Tino's solution is that C-g is a keystroke and keyboard-quit is a function, which obviously aren't necessarily equivalent. What if the user remaps keyboard quit to "7"? >> I thought about that, but i discarded because i think binding something >> other that `keyboard-quit' to `C-g' is a misuse. The Emacs manual is full >> of mentions to `C-g' as `keyboard-quit'. >> There is even the following remark in the tips section: >> >> "don't bind a key sequence ending in @key{C-g}, since that >> is commonly used to cancel a key sequence." >> >> If a user want to ignore such kind of advice he/she should >> not expect everything will work the same. > > I'm gonna do this just to mess with you 😉 Thank you. Actually i feel quite boring now, so it's OK :-) >> Maybe we can fix this so that `register-read-with-preview' >> will work with `C-g' bound to `my-cool-foo-command'; but we >> cannot assure that no other Emacs part is affected because such >> misguided `C-g' binding. We must encourage users to follow >> good practices. > >the point about C-g is more what if the user *also* binds keyboard-quit >to "7". In this case the user expects 7 to call keyboard-quit, not just >C-g. I see. Good point! Paul, what do you think about this? --- a/lisp/register.el +++ b/lisp/register.el @@ -164,6 +164,9 @@ register-read-with-preview help-chars) (unless (get-buffer-window buffer) (register-preview buffer 'show-empty))) + (when (and (characterp last-input-event) + (eq 'keyboard-quit (key-binding (string last-input-event)))) + (keyboard-quit)) (if (characterp last-input-event) last-input-event (error "Non-character input-event"))) I) Note, that my patch won't work in case our fearless user bind "7" to ...: (lambda () (message "What the hell are you doing?") (keyboard-quit)) ... But i don't think we must protect about things like I). --8323329-2139224032-1499752224=:16870--