From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#68995: [PATCH] 30.0.50; electric-pair-mode and read-char-from-minibuffer Date: Fri, 09 Feb 2024 14:10:23 -0500 Message-ID: References: <865xyyw2ua.fsf@gnu.org> Reply-To: Stefan Monnier Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="28317"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: 68995@debbugs.gnu.org, Paul Nelson To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Feb 09 20:11:10 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1rYWHG-0007DK-6X for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 09 Feb 2024 20:11:10 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rYWGv-0006zS-Cx; Fri, 09 Feb 2024 14:10:49 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rYWGt-0006yr-AY for bug-gnu-emacs@gnu.org; Fri, 09 Feb 2024 14:10:47 -0500 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rYWGt-0005XV-2H for bug-gnu-emacs@gnu.org; Fri, 09 Feb 2024 14:10:47 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rYWH7-0000sr-Pr for bug-gnu-emacs@gnu.org; Fri, 09 Feb 2024 14:11:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 09 Feb 2024 19:11:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 68995 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 68995-submit@debbugs.gnu.org id=B68995.17075058493367 (code B ref 68995); Fri, 09 Feb 2024 19:11:01 +0000 Original-Received: (at 68995) by debbugs.gnu.org; 9 Feb 2024 19:10:49 +0000 Original-Received: from localhost ([127.0.0.1]:59321 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rYWGu-0000sB-US for submit@debbugs.gnu.org; Fri, 09 Feb 2024 14:10:49 -0500 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:25652) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rYWGt-0000rj-6p for 68995@debbugs.gnu.org; Fri, 09 Feb 2024 14:10:48 -0500 Original-Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 01F93442B79; Fri, 9 Feb 2024 14:10:26 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1707505824; bh=GAjEfLHrcVc2rSt9tb5ZVpV52x8ix2deCIjYpG5NGTk=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=ARYYu3/KNDH25CNfr4+z5WMf8WCftwvY24HDcyVBXAyArZDYu+y9PtiFW5DSufDFh /SfdlsNQBQS5tZyNpF/uVRRBX2QoPR+fJaTM9g/JwSEWFt/eUH593kBiV3uQgtv+Vt 1usYBadecTfvPMwjgoGfILf1+7tUYkcGuEZj7KGiyh5Z+xj9ikIO6Ft9HuOe2Ho5Wp 5APHz0Nkj0dWyEXaBq76D8Q2SLnysUYPMBfaaGVUVwJbHrN9PuF9d4wXaLo4T/fql9 ejCPIlG2/poKY+xlgs9NYeu2JtpiB0OocUG2HtUKPj+G9GiJiNXgiA5MC1lXkAoVXE xjfOeBwbsT+jw== Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id A59BC442621; Fri, 9 Feb 2024 14:10:24 -0500 (EST) Original-Received: from pastel (unknown [104.247.238.113]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 7E2BD1202FC; Fri, 9 Feb 2024 14:10:24 -0500 (EST) In-Reply-To: <865xyyw2ua.fsf@gnu.org> (Eli Zaretskii's message of "Fri, 09 Feb 2024 08:47:57 +0200") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list 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-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:279705 Archived-At: Eli Zaretskii [2024-02-09 08:47:57] wrote: >> From: Paul Nelson >> Date: Thu, 8 Feb 2024 23:52:50 +0100 >> >> Steps to reproduce: >> >> 1. Emacs -Q >> 2. M-x electric-pair-mode >> 3. M-: (read-char-from-minibuffer "test: ") >> 4. Hit "(". >> >> The minibuffer then reads "()"; to get "(" accepted, we need to backspace. >> >> If we instead hit ")", then we get the error "No matching parenthesis found". >> >> I noticed this bug because it complicates using zap-to-char with >> electric-pair-mode. >> >> The bug was introduced in 68dd520e39eccb1be9366add1e3298318e5010de, in >> response to https://debbugs.gnu.org/cgi/bugreport.cgi?bug=65805. In >> that commit, the line that remaps self-insert-command was commented. >> Uncommenting that line fixes the issue. > > Adding Stefan who made the offending commit. I pushed the patch below which should fix both problems. Stefan diff --git a/lisp/subr.el b/lisp/subr.el index e53ef505522..9e92a4c457f 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -3726,11 +3723,11 @@ read-char-from-minibuffer (this-command this-command) (result (minibuffer-with-setup-hook (lambda () + (setq-local post-self-insert-hook nil) (add-hook 'post-command-hook (lambda () - ;; FIXME: Should we use `<='? - (if (= (1+ (minibuffer-prompt-end)) - (point-max)) + (if (<= (1+ (minibuffer-prompt-end)) + (point-max)) (exit-minibuffer))) nil 'local)) ;; Disable text conversion if it is enabled.