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: Fri, 21 Jul 2017 15:19:03 +0900 Message-ID: <87h8y6fh2g.fsf@calancha-pc> References: <1499659134.3804557.1035526184.45B0CA20@webmail.messagingengine.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1500618012 29074 195.159.176.226 (21 Jul 2017 06:20:12 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 21 Jul 2017 06:20:12 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux) Cc: Andreas Schwab , Paul Rankin , 27634@debbugs.gnu.org, Tino Calancha To: Allen Li Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Jul 21 08:20:07 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 1dYRIF-0007Jb-E4 for geb-bug-gnu-emacs@m.gmane.org; Fri, 21 Jul 2017 08:20:07 +0200 Original-Received: from localhost ([::1]:41253 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dYRIK-0001ih-Ty for geb-bug-gnu-emacs@m.gmane.org; Fri, 21 Jul 2017 02:20:12 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:35819) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dYRIG-0001hU-0a for bug-gnu-emacs@gnu.org; Fri, 21 Jul 2017 02:20:09 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dYRIA-0006Qu-SF for bug-gnu-emacs@gnu.org; Fri, 21 Jul 2017 02:20:07 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:47631) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dYRIA-0006Qg-OK for bug-gnu-emacs@gnu.org; Fri, 21 Jul 2017 02:20:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1dYRIA-0001K4-CM for bug-gnu-emacs@gnu.org; Fri, 21 Jul 2017 02:20:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Tino Calancha Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 21 Jul 2017 06:20:02 +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.15006179555028 (code B ref 27634); Fri, 21 Jul 2017 06:20:02 +0000 Original-Received: (at 27634) by debbugs.gnu.org; 21 Jul 2017 06:19:15 +0000 Original-Received: from localhost ([127.0.0.1]:50308 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dYRHP-0001J2-4l for submit@debbugs.gnu.org; Fri, 21 Jul 2017 02:19:15 -0400 Original-Received: from mail-pg0-f68.google.com ([74.125.83.68]:35990) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dYRHN-0001Ip-P3 for 27634@debbugs.gnu.org; Fri, 21 Jul 2017 02:19:14 -0400 Original-Received: by mail-pg0-f68.google.com with SMTP id y129so4601806pgy.3 for <27634@debbugs.gnu.org>; Thu, 20 Jul 2017 23:19:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=alKzk/fwjwZnOHBvr9Y7/SUnkGU7FwXJIPth/B30hqA=; b=Ey33u9IC/COs/ujrcNuUZYhjJ/m+ziGaWLnVTQKkVU55ZktMh94t4zgnZRovF3k94S Dj2WLxQIkhvKJQvz1BmvKo06GGW2/jaufsZHU2eVCAgCEkuo6SmllKlepg5eRgJyj44e 7+iIUxkXGStiBXWFJHefSvjJy5hajQb71iURhrT8/n0S6zumx+jLFhDTBdv6d3m0qc0l VfuA932WWbTRHbfGypPPa2S2qrHtZwr97r+bOqyUWybf+D9kL8jAsF4oWXiAqMSiJduL diaqLxeGdMwEnt3xXY34UZKj4EF/jaiO5a5jtUdkfq2cF8yHUr4GFHG8HaL7Pt9u0Cae JQ2g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=alKzk/fwjwZnOHBvr9Y7/SUnkGU7FwXJIPth/B30hqA=; b=UajTgU1wbEODPs3OCxAom2OszynDuEUzBxTFvtiRrtf9N4UxIpuea9+WBrvoNGRsTP 2bvdfYaMEC0q3SgrvEMPElJXIi+3GHe1b23iXoOo+rqKvJGk7EEYs2jnDPOg4oLMYURo tXhY4cNyc7IjWGJhsMt8BTFN2Gg2UPJThACe8tn52KoH0BuKl2E8BJMoUNNyxfQwt5Nc Mnry4JxI9bAbtmVIDrcobkpDu2llcX/o/IByrOtPOzjARQAUhu+qbYf9W46UEiG3L6Vv IurM3YzOrB5VnzFQJfpLDBn32r3eDVfdOPQGe9nT1/lzgLmSDIiN4jRgjQYm7WNh+kj2 4ylA== X-Gm-Message-State: AIVw110eoD6EKBlyFLSytX/tZ7NVp85GdqjbpI3LoZhjskSLdmonNrsm dEBLTE5Y+6W4Gw== X-Received: by 10.98.13.28 with SMTP id v28mr6433520pfi.249.1500617947799; Thu, 20 Jul 2017 23:19:07 -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 d29sm7878639pfb.11.2017.07.20.23.19.05 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 20 Jul 2017 23:19:07 -0700 (PDT) In-Reply-To: (Allen Li's message of "Thu, 20 Jul 2017 20:47:32 -0700") 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:134815 Archived-At: Allen Li writes: > It sounds like there's a general consensus on how to fix this. Tino, would you care to post a finalized patch? OK. > Note: bug#25370 is a duplicate of this, it should probably be marked closed, wontfix, etc. Thanks, i merged this thread with your bug report. Let's discuss following patch: *) Call `keyboard-quit' whenever last-input-event is ?\C-g or 'escape or ?\C-\[. **) Updated the manual to point out that non-alphanumeric keys are valid to store registers as well. Let me know if that is OK or if we need a fine-grained control. --8<-----------------------------cut here---------------start------------->8--- commit 484faa217fe5a76d12ce266bc3f84737da73f0ae Author: Tino Calancha Date: Fri Jul 21 15:08:06 2017 +0900 register-read-with-preview: Quit if user input C-g or ESC * lisp/register.el (register-read-with-preview): Quit if user input C-g or ESC (bug#27634). * doc/emacs/regs.texi (Registers): Update manual. diff --git a/doc/emacs/regs.texi b/doc/emacs/regs.texi index 7369f6b05b..40e3e2c1c3 100644 --- a/doc/emacs/regs.texi +++ b/doc/emacs/regs.texi @@ -15,7 +15,10 @@ Registers Each register has a name that consists of a single character, which we will denote by @var{r}; @var{r} can be a letter (such as @samp{a}) or a number (such as @samp{1}); case matters, so register @samp{a} is -not the same as register @samp{A}. +not the same as register @samp{A}. You can also set a register in +non-alphanumeric characters, for instance @samp{*} or @samp{C-d}. +Note, it's not possible to set a register in @samp{C-g} or @samp{ESC}, +because these keys are reserved to terminate interactive commands. @findex view-register A register can store a position, a piece of text, a rectangle, a diff --git a/lisp/register.el b/lisp/register.el index 7cc3ccd870..e395963f56 100644 --- a/lisp/register.el +++ b/lisp/register.el @@ -164,6 +164,10 @@ register-read-with-preview help-chars) (unless (get-buffer-window buffer) (register-preview buffer 'show-empty))) + (when (or (eq ?\C-g last-input-event) + (eq 'escape last-input-event) + (eq ?\C-\[ last-input-event)) + (keyboard-quit)) (if (characterp last-input-event) last-input-event (error "Non-character input-event"))) (and (timerp timer) (cancel-timer timer)) --8<-----------------------------cut here---------------end--------------->8--- In GNU Emacs 26.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.22.11) of 2017-07-21 Repository revision: 1d559e384b467b3f74e8b78695f124b561c884d9