From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#27634: 25.2.1; C-g does not quit register-read-with-preview Date: Mon, 10 Jul 2017 20:06:21 +0300 Message-ID: <83shi4i5ma.fsf@gnu.org> References: <1499659134.3804557.1035526184.45B0CA20@webmail.messagingengine.com> <87h8ykdcmx.fsf@calancha-pc> <1499671255.3837111.1035640480.1DBD693E@webmail.messagingengine.com> Reply-To: Eli Zaretskii NNTP-Posting-Host: blaine.gmane.org X-Trace: blaine.gmane.org 1499706435 8378 195.159.176.226 (10 Jul 2017 17:07:15 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 10 Jul 2017 17:07:15 +0000 (UTC) Cc: tino.calancha@gmail.com, 27634@debbugs.gnu.org To: Paul Rankin Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Jul 10 19:07:11 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 1dUc9P-0001s4-GK for geb-bug-gnu-emacs@m.gmane.org; Mon, 10 Jul 2017 19:07:11 +0200 Original-Received: from localhost ([::1]:42146 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dUc9T-0002iV-1T for geb-bug-gnu-emacs@m.gmane.org; Mon, 10 Jul 2017 13:07:15 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:33844) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dUc9J-0002gl-9S for bug-gnu-emacs@gnu.org; Mon, 10 Jul 2017 13:07:06 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dUc9G-0006PY-Gc for bug-gnu-emacs@gnu.org; Mon, 10 Jul 2017 13:07:05 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:58448) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dUc9G-0006PT-Ct for bug-gnu-emacs@gnu.org; Mon, 10 Jul 2017 13:07:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1dUc9G-0005Gt-6z for bug-gnu-emacs@gnu.org; Mon, 10 Jul 2017 13:07:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 10 Jul 2017 17:07: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.149970639420228 (code B ref 27634); Mon, 10 Jul 2017 17:07:02 +0000 Original-Received: (at 27634) by debbugs.gnu.org; 10 Jul 2017 17:06:34 +0000 Original-Received: from localhost ([127.0.0.1]:32892 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dUc8n-0005GC-Mg for submit@debbugs.gnu.org; Mon, 10 Jul 2017 13:06:33 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:42662) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dUc8m-0005Fz-Bt for 27634@debbugs.gnu.org; Mon, 10 Jul 2017 13:06:32 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dUc8g-0006CC-3B for 27634@debbugs.gnu.org; Mon, 10 Jul 2017 13:06:27 -0400 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:44570) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dUc8f-0006C6-W0; Mon, 10 Jul 2017 13:06:26 -0400 Original-Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:4259 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1dUc8f-0004WE-9V; Mon, 10 Jul 2017 13:06:25 -0400 In-reply-to: <1499671255.3837111.1035640480.1DBD693E@webmail.messagingengine.com> (message from Paul Rankin on Mon, 10 Jul 2017 17:20:55 +1000) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] 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:134404 Archived-At: > From: Paul Rankin > Cc: 27634@debbugs.gnu.org, Eli Zaretskii > Date: Mon, 10 Jul 2017 17:20:55 +1000 > > On Mon, 10 Jul 2017, at 04:33 PM, Tino Calancha wrote: > > How about the following? > > > > @@ -164,6 +164,8 @@ register-read-with-preview > > help-chars) > > (unless (get-buffer-window buffer) > > (register-preview buffer 'show-empty))) > > + (when (eq (string-to-char "\C-g") last-input-event) > > + (keyboard-quit)) > > (if (characterp last-input-event) last-input-event > > (error "Non-character input-event"))) > > (and (timerp timer) (cancel-timer timer)) > > I think that's more a bandaid than fixing the root of the problem, which is that the manual tells the user that register names are alphanumeric characters (and I assume 99% of users only use alphanumeric characters) but the function doesn't test for this. e.g. testing for C-g doesn't catch for ^L or ^M, etc. FWIW, I actually agree with Tino's solution, and was about to propose something similar. It's true that control characters are not alphanumeric, but we could fix the documentation to be more accurate if we care about that. OTOH, we've supported control characters as register names for many years, and by now it should be quite clear it didn't bother anyone yet. C-g needs indeed to generate keyboard quit, and perhaps ESC ESC as well. I'd look at read-char-choice for inspiration. > If we want to be strict about it, this might work: > > @@ -164,8 +164,8 @@ > help-chars) > (unless (get-buffer-window buffer) > (register-preview buffer 'show-empty))) > - (if (characterp last-input-event) last-input-event > - (error "Non-character input-event"))) > + (if (= (char-syntax last-input-event) 119) last-input-event > + (error "Register name must be alphanumeric"))) > (and (timerp timer) (cancel-timer timer)) > (let ((w (get-buffer-window buffer))) > (and (window-live-p w) (delete-window w))) > > That prohibits anything except "a-zA-Z0-9", although users may want to save registers to "$" or "*". Why would we want to be so strict when the only real problem is that C-g doesn't quit?