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" <bug-gnu-emacs@gnu.org>
Newsgroups: gmane.emacs.bugs
Subject: bug#69056: 30.0.50; history-add-new-input and recursive minibuffers
Date: Thu, 15 Feb 2024 10:24:45 -0500
Message-ID: <jwvplwxah1w.fsf-monnier+emacs@gnu.org>
References: <m11q9jngho.fsf@dazzs-mbp.home>
Reply-To: Stefan Monnier <monnier@iro.umontreal.ca>
Mime-Version: 1.0
Content-Type: text/plain
Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214";
	logging-data="13006"; mail-complaints-to="usenet@ciao.gmane.io"
User-Agent: Gnus/5.13 (Gnus v5.13)
Cc: 69056@debbugs.gnu.org
To: Eshel Yaron <me@eshelyaron.com>
Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Feb 15 16:26:05 2024
Return-path: <bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org>
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 <bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org>)
	id 1radcj-00036T-0X
	for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 15 Feb 2024 16:26:05 +0100
Original-Received: from localhost ([::1] helo=lists1p.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.90_1)
	(envelope-from <bug-gnu-emacs-bounces@gnu.org>)
	id 1radcP-0000Mn-0D; Thu, 15 Feb 2024 10:25:45 -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 <Debian-debbugs@debbugs.gnu.org>)
 id 1radcN-0000Ma-OU
 for bug-gnu-emacs@gnu.org; Thu, 15 Feb 2024 10:25:43 -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 <Debian-debbugs@debbugs.gnu.org>)
 id 1radcN-0008Ep-GL
 for bug-gnu-emacs@gnu.org; Thu, 15 Feb 2024 10:25:43 -0500
Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2)
 (envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1radcg-00015r-57
 for bug-gnu-emacs@gnu.org; Thu, 15 Feb 2024 10:26:02 -0500
X-Loop: help-debbugs@gnu.org
Resent-From: Stefan Monnier <monnier@iro.umontreal.ca>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces@debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@gnu.org
Resent-Date: Thu, 15 Feb 2024 15:26:02 +0000
Resent-Message-ID: <handler.69056.B69056.17080107114138@debbugs.gnu.org>
Resent-Sender: help-debbugs@gnu.org
X-GNU-PR-Message: followup 69056
X-GNU-PR-Package: emacs
Original-Received: via spool by 69056-submit@debbugs.gnu.org id=B69056.17080107114138
 (code B ref 69056); Thu, 15 Feb 2024 15:26:02 +0000
Original-Received: (at 69056) by debbugs.gnu.org; 15 Feb 2024 15:25:11 +0000
Original-Received: from localhost ([127.0.0.1]:56764 helo=debbugs.gnu.org)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <debbugs-submit-bounces@debbugs.gnu.org>)
 id 1radbq-00014g-MJ
 for submit@debbugs.gnu.org; Thu, 15 Feb 2024 10:25:11 -0500
Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:54006)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <monnier@iro.umontreal.ca>) id 1radbo-00014T-Nr
 for 69056@debbugs.gnu.org; Thu, 15 Feb 2024 10:25:09 -0500
Original-Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1])
 by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id A06A480577;
 Thu, 15 Feb 2024 10:24:44 -0500 (EST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca;
 s=mail; t=1708010683;
 bh=RU8z6t/Ra8H6lAplm/q7IzoKPLEpA1sPIX0SpRWjUPg=;
 h=From:To:Cc:Subject:In-Reply-To:References:Date:From;
 b=R3LCYKvVj9uXQWwAmRk0M4One6YbJX70YTqtJ++ObijKJPEPiZEoAt+T+QVEPbYP+
 uI/nYNRsRAk/Fs+Qzjhy5ofyfMaMrq1fh5WDpKBLez72rk/9hqH4d1hwhxVE9U1VXF
 JlxZxB0+cBKPvOrErI6s3mbm44K4Zf4w8F2Rlg8pNDSbzIOlAFyCWAVldMiwVIoH9f
 LBIEC/7D8AARwRABadbhz82AyI7d6/8x1tdk+iRAL9UKT3aGU/qO6zlB82XnRC3wC0
 707bIhBn45vTP24K8+wX4kA5DQkYXVBggZAp2cHM5o/Qo+E7wCUwaRUDWvf0RVoKwR
 PtP3G1SOayUhg==
Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1])
 by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id A133A80348;
 Thu, 15 Feb 2024 10:24:43 -0500 (EST)
Original-Received: from alfajor (unknown [23.233.149.155])
 by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 8822B120223;
 Thu, 15 Feb 2024 10:24:43 -0500 (EST)
In-Reply-To: <m11q9jngho.fsf@dazzs-mbp.home> (Eshel Yaron's message of "Sun,
 11 Feb 2024 16:54:43 +0100")
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" <bug-gnu-emacs.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-gnu-emacs>,
 <mailto:bug-gnu-emacs-request@gnu.org?subject=unsubscribe>
List-Archive: <https://lists.gnu.org/archive/html/bug-gnu-emacs>
List-Post: <mailto:bug-gnu-emacs@gnu.org>
List-Help: <mailto:bug-gnu-emacs-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-gnu-emacs>,
 <mailto:bug-gnu-emacs-request@gnu.org?subject=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:280061
Archived-At: <http://permalink.gmane.org/gmane.emacs.bugs/280061>

> 1. emacs -Q
> 2. (setq enable-recursive-minibuffers t)
> 3. M-y
> 4. In the minibuffer (with the prompt "Yank from kill-ring: "),
>    type M-x calendar RET (or any other command).
> 5. M-x M-p
>    Expected: "calendar" is inserted in the minibuffer.
>    Observed: error saying "Beginning of history; no preceding item".
>
> The problem is that the minibuffer history of M-x isn't recorded when
> you invoke M-x from within the minibuffer of read-from-kill-ring (M-y).
> The reason is that read-from-kill-ring let binds history-add-new-input,
> and that affects all recursive minibuffers as well, so no minibuffer
> history is recorded until you exit the first (non-recursive) minibuffer.

I suspect this can bite in more cases, including cases which don't
involve setting `enable-recursive-minibuffers` to t.
We should probably change the way `history-add-new-input` works so it's
attached to a particular minibuffer rather than being dynbound.


        Stefan