From unknown Sun Sep 14 01:17:56 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#79393 <79393@debbugs.gnu.org> To: bug#79393 <79393@debbugs.gnu.org> Subject: Status: [PATCH] ; (read-string-from-buffer): Fix thinko and typo. Reply-To: bug#79393 <79393@debbugs.gnu.org> Date: Sun, 14 Sep 2025 08:17:56 +0000 retitle 79393 [PATCH] ; (read-string-from-buffer): Fix thinko and typo. reassign 79393 emacs submitter 79393 Eshel Yaron severity 79393 normal tag 79393 patch thanks From debbugs-submit-bounces@debbugs.gnu.org Sat Sep 06 04:22:49 2025 Received: (at submit) by debbugs.gnu.org; 6 Sep 2025 08:22:49 +0000 Received: from localhost ([127.0.0.1]:34026 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uuoC8-0002ES-LO for submit@debbugs.gnu.org; Sat, 06 Sep 2025 04:22:49 -0400 Received: from lists.gnu.org ([2001:470:142::17]:47464) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1uuoC5-0002Dx-2Z for submit@debbugs.gnu.org; Sat, 06 Sep 2025 04:22:45 -0400 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 1uuoBx-0004s5-4M for bug-gnu-emacs@gnu.org; Sat, 06 Sep 2025 04:22:37 -0400 Received: from mail.eshelyaron.com ([107.175.124.16] helo=eshelyaron.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uuoBp-0002JJ-BT for bug-gnu-emacs@gnu.org; Sat, 06 Sep 2025 04:22:34 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=eshelyaron.com; s=mail; t=1757146944; bh=6dk/oT8aHSCKM+0liYYXOZd5rIBswMwrL22K2YjA5Mc=; h=From:To:Subject:Date:From; b=afD909XCcq344J01t3Ae/M8RN3bwUn2U1LDHSxVxk1BTAiMb8XUBOs/biYmYy6iEy Ulao1J5wVaWv7aPgF1yLTbAeqiv6dl/H88wtI8FdLqj9ARrcoeDYT1ghzHt0Gu90fA 2MQyD/SJqV2ZZpkaD6t3pLu77rU+gdKA50FbUpZzK7H9F69qV55bS4qRS90zDAR2n8 0IPQbDWuNcGoSd0/SmEwnd5BVTkycG+g5m99YwHsF1r26b3JhQjIk7C0zFmmSFgtUz SpXDTxHXtJkOJmdxo9z+59hKtbqMVsAP5kxSfaPaITcSQCwtvGr4PFuZGWhpDbRmqi Yj9FhDqRC9tKA== From: Eshel Yaron To: bug-gnu-emacs@gnu.org Subject: [PATCH] ; (read-string-from-buffer): Fix thinko and typo. Date: Sat, 06 Sep 2025 10:22:20 +0200 Message-ID: <87ecskj8hv.fsf@mail.eshelyaron.com> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=107.175.124.16; envelope-from=me@eshelyaron.com; helo=eshelyaron.com X-Spam_score_int: -16 X-Spam_score: -1.7 X-Spam_bar: - X-Spam_report: (-1.7 / 5.0 requ) BAYES_00=-1.9, DKIM_INVALID=0.1, DKIM_SIGNED=0.1, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-Spam-Score: 0.9 (/) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.1 (/) --=-=-= Content-Type: text/plain Tags: patch This patch fixes an apparent thinko in read-string-from-buffer, which causes the function to return the input string when the user aborts the edit with C-c C-k, instead of actually aborting. :/ Note that this bug could be caught by simple unreachable code analysis, as requested in Bug#73526. In particular, exit-recursive-edit and friends only make sense in tail positions, since they never return. --=-=-= Content-Type: text/patch Content-Disposition: attachment; filename=0001-read-string-from-buffer-Fix-thinko-and-typo.patch >From cca1f9099784486374aebfa4eea0fd4f4e7721c6 Mon Sep 17 00:00:00 2001 From: Eshel Yaron Date: Sat, 6 Sep 2025 07:56:44 +0200 Subject: [PATCH] ; (read-string-from-buffer): Fix thinko and typo. --- lisp/textmodes/string-edit.el | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/lisp/textmodes/string-edit.el b/lisp/textmodes/string-edit.el index dda70437f78..4e292227cda 100644 --- a/lisp/textmodes/string-edit.el +++ b/lisp/textmodes/string-edit.el @@ -93,7 +93,7 @@ string-edit ;;;###autoload (defun read-string-from-buffer (prompt string) "Switch to a new buffer to edit STRING in a recursive edit. -The user finishes editing with \\\\[string-edit-done], or aborts with \\\\[string-edit-abort]). +The user finishes editing with \\\\[string-edit-done], or aborts with \\\\[string-edit-abort]. Insert PROMPT at the start of the buffer. If nil, no prompt is inserted. @@ -108,9 +108,7 @@ read-string-from-buffer (lambda (edited) (setq string edited) (exit-recursive-edit)) - :abort-callback (lambda () - (exit-recursive-edit) - (error "Aborted edit"))) + :abort-callback #'abort-recursive-edit) (recursive-edit) string) -- 2.47.2 --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Sat Sep 13 04:45:18 2025 Received: (at 79393) by debbugs.gnu.org; 13 Sep 2025 08:45:19 +0000 Received: from localhost ([127.0.0.1]:53309 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uxLsj-0005uY-Uh for submit@debbugs.gnu.org; Sat, 13 Sep 2025 04:45:18 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53604) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1uxLsg-0005sq-3A for 79393@debbugs.gnu.org; Sat, 13 Sep 2025 04:45:15 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uxLsa-0000ln-Gc; Sat, 13 Sep 2025 04:45:08 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=+MRjkThwlZuU7QCv9zAcJAe5/RcvtRVjrPMPWrlehvA=; b=WLmqOqCDIdNt mujPXenAZ4gROe3DuCiWcE/LC5ojxU4c7iLSDR7Sm8nXXSd4h9mI/CXBr9jCwxVxAigywPLJ5jtGv Kz7uDl7P/k2epHPy7b6G2HFix3Tc/9Je1UXYL/x4cbyIouqM79Z5RW9TNDEpLS30x8QXYCQji+ztL gdANxGcyPKvCQ4j3QsMCTdcMpYPOo8DSNs77sU/rXS880X9HZ6T1iJf5dBAzBX9nXnvYpcmUS+xMa JMbOVk02z5gAp/A2tcXP5lieDE0t1Ex6jWT6u2DWYOdfDB17KhFJODh4Yoq/fo/HlyzpWKA2UF720 90Oe8BLWw5Fq6feK0Sl1rQ==; Date: Sat, 13 Sep 2025 11:45:05 +0300 Message-Id: <86zfayrbam.fsf@gnu.org> From: Eli Zaretskii To: Eshel Yaron In-Reply-To: <87ecskj8hv.fsf@mail.eshelyaron.com> (bug-gnu-emacs@gnu.org) Subject: Re: bug#79393: [PATCH] ; (read-string-from-buffer): Fix thinko and typo. References: <87ecskj8hv.fsf@mail.eshelyaron.com> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 79393 Cc: 79393@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > Date: Sat, 06 Sep 2025 10:22:20 +0200 > From: Eshel Yaron via "Bug reports for GNU Emacs, > the Swiss army knife of text editors" > > This patch fixes an apparent thinko in read-string-from-buffer, which > causes the function to return the input string when the user aborts the > edit with C-c C-k, instead of actually aborting. :/ > > Note that this bug could be caught by simple unreachable code analysis, > as requested in Bug#73526. In particular, exit-recursive-edit and > friends only make sense in tail positions, since they never return. > > >From cca1f9099784486374aebfa4eea0fd4f4e7721c6 Mon Sep 17 00:00:00 2001 > From: Eshel Yaron > Date: Sat, 6 Sep 2025 07:56:44 +0200 > Subject: [PATCH] ; (read-string-from-buffer): Fix thinko and typo. > > --- > lisp/textmodes/string-edit.el | 6 ++---- > 1 file changed, 2 insertions(+), 4 deletions(-) > > diff --git a/lisp/textmodes/string-edit.el b/lisp/textmodes/string-edit.el > index dda70437f78..4e292227cda 100644 > --- a/lisp/textmodes/string-edit.el > +++ b/lisp/textmodes/string-edit.el > @@ -93,7 +93,7 @@ string-edit > ;;;###autoload > (defun read-string-from-buffer (prompt string) > "Switch to a new buffer to edit STRING in a recursive edit. > -The user finishes editing with \\\\[string-edit-done], or aborts with \\\\[string-edit-abort]). > +The user finishes editing with \\\\[string-edit-done], or aborts with \\\\[string-edit-abort]. > > Insert PROMPT at the start of the buffer. If nil, no prompt is > inserted. > @@ -108,9 +108,7 @@ read-string-from-buffer > (lambda (edited) > (setq string edited) > (exit-recursive-edit)) > - :abort-callback (lambda () > - (exit-recursive-edit) > - (error "Aborted edit"))) > + :abort-callback #'abort-recursive-edit) > (recursive-edit) > string) Thanks, but that change shows just "Quit" in the echo area, whereas the intent here was to show "Aborted edit" there. Can we do better by showing that text to the user? Because "Quit" is confusing in this case, IMO.