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 12:56:43 -0500 Message-ID: <jwvwmr58vth.fsf-monnier+emacs@gnu.org> References: <m11q9jngho.fsf@dazzs-mbp.home> <jwvplwxah1w.fsf-monnier+emacs@gnu.org> <m1v86pln1l.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="36835"; 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 18:58:08 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 1rafzr-0009Jv-JM for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 15 Feb 2024 18:58:07 +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 1rafzV-00015Z-Kx; Thu, 15 Feb 2024 12:57: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 1rafzT-00014h-Js for bug-gnu-emacs@gnu.org; Thu, 15 Feb 2024 12:57: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 1rafzT-0001Nr-Bp for bug-gnu-emacs@gnu.org; Thu, 15 Feb 2024 12:57: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 1rafzm-00089z-1F for bug-gnu-emacs@gnu.org; Thu, 15 Feb 2024 12:58: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 17:58:01 +0000 Resent-Message-ID: <handler.69056.B69056.170801983331276@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.170801983331276 (code B ref 69056); Thu, 15 Feb 2024 17:58:01 +0000 Original-Received: (at 69056) by debbugs.gnu.org; 15 Feb 2024 17:57:13 +0000 Original-Received: from localhost ([127.0.0.1]:56917 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces@debbugs.gnu.org>) id 1rafyy-00088O-Q3 for submit@debbugs.gnu.org; Thu, 15 Feb 2024 12:57:13 -0500 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:60056) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <monnier@iro.umontreal.ca>) id 1rafyw-000886-Ki for 69056@debbugs.gnu.org; Thu, 15 Feb 2024 12:57:11 -0500 Original-Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id B6F121000C3; Thu, 15 Feb 2024 12:56:45 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1708019804; bh=gl/OKg7Bqn0jvu519k1/eJAc4QxcI9IK8mToY5dMj50=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=DI+NuYMA6sXDAEUSKNUzIw9ZZotz5Pvqfr+Qc0KXiCZXTeya1J41Y+usoYFvVMhbw UGrvmdXczD4eU0+zDAqQj2/5e8B0UTH+qG739uptJnrANzjLiS5keo+rRBykl/Z92k GVrtYUvndpvZaZBPsKGxl+HnprhTGWwB7eGK2+bLTZEPy8tJkXa5+gK8JHmtRO2uWn vPJHJtrWSljWeMXkcibg35+5qzYoRlhvDlYBCMssbMYuy3HBerQXAhFY948/QUEbe1 7zUQa72MT2z+i83/BW7GB447v1+G2M+zc/7fSq7wDvV8yk6pN/fOfCro8J1EwE0QG9 8aAi1HYPivVJA== Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id B6EC910004B; Thu, 15 Feb 2024 12:56:44 -0500 (EST) Original-Received: from alfajor (unknown [23.233.149.155]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 9AB0A120713; Thu, 15 Feb 2024 12:56:44 -0500 (EST) In-Reply-To: <m1v86pln1l.fsf@dazzs-mbp.home> (Eshel Yaron's message of "Thu, 15 Feb 2024 17:17:26 +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:280069 Archived-At: <http://permalink.gmane.org/gmane.emacs.bugs/280069> > Thanks, that's what I thought too. Here's an attempt do just that: Looks pretty good. I do have some comments/questions: > @@ -902,6 +903,9 @@ read_minibuf (Lisp_Object map, Lisp_Object initial, Lisp_Object prompt, > /* Don't allow the user to undo past this point. */ > bset_undo_list (current_buffer, Qnil); > > + /* Cache the buffer-local value. */ > + nohist = NILP (find_symbol_value (Qhistory_add_new_input)); Why not use `Vhistory_add_new_input`? [ Also, it's not really "cache" (which implies it impacts only performance). More like "remember". ] > @@ -965,7 +969,7 @@ read_minibuf (Lisp_Object map, Lisp_Object initial, Lisp_Object prompt, > /* Add the value to the appropriate history list, if any. This is > done after the previous buffer has been made current again, in > case the history variable is buffer-local. */ > - if (! (NILP (Vhistory_add_new_input) || NILP (histstring))) > + if (! (nohist || NILP (histstring))) > call2 (Qadd_to_history, histvar, histstring); > > /* If Lisp form desired instead of string, parse it. */ IIUC this change is needed because by the time we get here the buffer-local value of `history-add-new-input` has been flushed by `minibuffer-inactive-mode` called by `read_minibuf_unwind`, itself run by the `unbind_to` a few lines above. So maybe we can simplify this by just moving the above 2 lines before the `unbind_to`, WDYT? Stefan