From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Sean Whitton Newsgroups: gmane.emacs.bugs Subject: bug#66700: 30.0.50; Some history is missing with multiple eshell buffers Date: Wed, 06 Dec 2023 15:33:07 +0000 Message-ID: <87jzpre47g.fsf@melete.silentflame.com> References: <838r70tt11.fsf@gnu.org> <878r70ec8u.fsf@melete.silentflame.com> <2daab250-42dc-37bd-acc4-8c1366763425@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="10448"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: Jim Porter , Eli Zaretskii , 66700@debbugs.gnu.org To: Liu Hui Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Dec 06 16:34:20 2023 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 1rAtuk-0002OT-DV for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 06 Dec 2023 16:34:19 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rAtuQ-0005Az-Gx; Wed, 06 Dec 2023 10:33:58 -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 1rAtuP-0005Ap-Ip for bug-gnu-emacs@gnu.org; Wed, 06 Dec 2023 10:33:57 -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 1rAtuI-0000GF-IY for bug-gnu-emacs@gnu.org; Wed, 06 Dec 2023 10:33:57 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rAtuU-0006uf-BF for bug-gnu-emacs@gnu.org; Wed, 06 Dec 2023 10:34:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Sean Whitton Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 06 Dec 2023 15:34:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 66700 X-GNU-PR-Package: emacs Original-Received: via spool by 66700-submit@debbugs.gnu.org id=B66700.170187680826525 (code B ref 66700); Wed, 06 Dec 2023 15:34:02 +0000 Original-Received: (at 66700) by debbugs.gnu.org; 6 Dec 2023 15:33:28 +0000 Original-Received: from localhost ([127.0.0.1]:40222 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rAttw-0006tl-1h for submit@debbugs.gnu.org; Wed, 06 Dec 2023 10:33:28 -0500 Original-Received: from out4-smtp.messagingengine.com ([66.111.4.28]:59709) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rAttu-0006tY-1R for 66700@debbugs.gnu.org; Wed, 06 Dec 2023 10:33:26 -0500 Original-Received: from compute7.internal (compute7.nyi.internal [10.202.2.48]) by mailout.nyi.internal (Postfix) with ESMTP id 16A3E5C0243; Wed, 6 Dec 2023 10:33:09 -0500 (EST) Original-Received: from mailfrontend2 ([10.202.2.163]) by compute7.internal (MEProxy); Wed, 06 Dec 2023 10:33:09 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=spwhitton.name; h=cc:cc:content-transfer-encoding:content-type:content-type :date:date:from:from:in-reply-to:in-reply-to:message-id :mime-version:references:reply-to:sender:subject:subject:to:to; s=fm3; t=1701876789; x=1701963189; bh=DpB/SASCPVqcubl4ZxBmSFgNF ZMDVpbiP/1TDrXQhAw=; b=r1e8cCslQq+oQNCqXTOl6jvQXY41IUyKk+6KCCOMd Y8TH0t9W7tWsggBpaDxlMUtYXHB7aQd8QczAHESWN9t+bheGadsRQNNVGyTmNSEH 9AhxPozaRkLlvWaBh+znl94dIwbCrzgbjvC+jNIkY5IAy6CjjOEwuiS5BH+urBKy nmp5W6SKoT6/KvJVfN1p4IKgfH9Xlf1xcwz9XwCzehmqjrDTFgs+1eYt42nwwnqi dAReUDo1sFpqSkuvg9ik0CGiQhCVIub3pKpX7uITmfS+AqJ6/A9jiS1RiLykbGj4 g0DpIaG8fNT3doRByKYjPL64BKLJesrd0WQ0WKPXTtYOg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:sender:subject:subject:to:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t= 1701876789; x=1701963189; bh=DpB/SASCPVqcubl4ZxBmSFgNFZMDVpbiP/1 TDrXQhAw=; b=NTt/9ADE6f/vFOe6AxWLJLiDQS5Ke1C5l2/wxqSzyy61RDUBrQa ZaeIz2cKHLFXo0MQBMvmOrHXCVsoQDahaACJwuWOtBXCz0rHZ2w702pCnZiBHpYw fejd8o7XQzxEP8aZCaSPZIG1aJyKO8iWld9L5L1BekBw08VjayCLEg3oQanaZR8U VcGQiolmYdJvUcoHPyIZlEaBR5o8MGACEtlh7r3xAkYLEDqtJHpBGyME3KN6E7jd QZUMXOom33Wzewwp9qTz8KhifeJfBg3ktpPeALkN6BzG8S9jEaMMlAonYiangoGQ 9dHHdQLLoPzbKnQt21NZZ9JWy5N+cKehr7Q== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrudektddgjeelucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvvefujghffffkfgggtgfgsehtqhdttddtreejnecuhfhrohhmpefuvggr nhcuhghhihhtthhonhcuoehsphifhhhithhtohhnsehsphifhhhithhtohhnrdhnrghmvg eqnecuggftrfgrthhtvghrnhepffefhfejudeguddtudekjeekueevvedvieeghfegleet uefhkeegkefhleejvddunecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrg hilhhfrhhomhepshhpfihhihhtthhonhesshhpfihhihhtthhonhdrnhgrmhgv X-ME-Proxy: Feedback-ID: i23c04076:Fastmail Original-Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 6 Dec 2023 10:33:08 -0500 (EST) Original-Received: by melete.silentflame.com (Postfix, from userid 1000) id C4AE47EDF76; Wed, 6 Dec 2023 15:33:07 +0000 (GMT) In-Reply-To: (Liu Hui's message of "Thu, 16 Nov 2023 17:47:43 +0800") 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:275605 Archived-At: On Thu 16 Nov 2023 at 05:47pm +08, Liu Hui wrote: > Jim Porter =E4=BA=8E2023=E5=B9=B411=E6=9C=8815=E6= =97=A5=E5=91=A8=E4=B8=89 01:15=E5=86=99=E9=81=93=EF=BC=9A >> >> On 11/14/2023 4:43 AM, Sean Whitton wrote: >> > On Tue 14 Nov 2023 at 02:32pm +02, Eli Zaretskii wrote: >> >> >> >> IMO, this is too soon to change the default behavior in incompatible >> >> ways. We need to wait for a while, perhaps at least one major >> >> release, before we do that. >> > >> > This is fair enough. It would be really useful to have the default >> > behaviour now for those of used to it from other shells, though -- Liu, >> > perhaps you would be interested in adding a defcustom? >> >> Yeah, I think a defcustom would be good here. That would also make it >> easier for us to test out the new code and find any bugs. > > Thank you all for your suggestions. A defcustom has been added in the > attached patch without changing previous behavior. Thanks. This looks good, but can you add a NEWS entry, please? Ideally it would also get documented in the Eshell manual. > From e2cd3a9d28b35806d4e6a83e98f0dc25550651e2 Mon Sep 17 00:00:00 2001 > From: Liu Hui > Date: Thu, 16 Nov 2023 11:45:28 +0800 > Subject: [PATCH] Add option `eshell-history-append' > > * lisp/eshell/em-hist.el (eshell-history-append): New option. > (eshell--save-history): New function. > (eshell-hist-initialize): > (eshell-save-some-history): Replace eshell-write-history with > eshell--save-history, which respects the new option. > --- > lisp/eshell/em-hist.el | 16 +++++++++++++--- > 1 file changed, 13 insertions(+), 3 deletions(-) > > diff --git a/lisp/eshell/em-hist.el b/lisp/eshell/em-hist.el > index cf03f8399a6..79336204847 100644 > --- a/lisp/eshell/em-hist.el > +++ b/lisp/eshell/em-hist.el > @@ -116,6 +116,12 @@ eshell-save-history-on-exit > (const :tag "Ask" ask) > (const :tag "Always save" t))) >=20=20 > +(defcustom eshell-history-append nil > + "If non-nil, append new entries to the history file when saving histor= y." > + :type '(choice (const :tag "Overwrite history file" nil) > + (const :tag "Append new entries to file" t)) > + :version "30.1") > + > (defcustom eshell-input-filter 'eshell-input-filter-default > "Predicate for filtering additions to input history. > Takes one argument, the input. If non-nil, the input may be saved on > @@ -294,17 +300,21 @@ eshell-hist-initialize > (if eshell-history-file-name > (eshell-read-history nil t)) >=20=20 > - (add-hook 'eshell-exit-hook #'eshell-write-history nil t)) > + (add-hook 'eshell-exit-hook #'eshell--save-history nil t)) >=20=20 > (unless eshell-history-ring > (setq eshell-history-ring (make-ring eshell-history-size))) >=20=20 > - (add-hook 'eshell-exit-hook #'eshell-write-history nil t) > + (add-hook 'eshell-exit-hook #'eshell--save-history nil t) >=20=20 > (add-hook 'kill-emacs-query-functions #'eshell-save-some-history) >=20=20 > (add-hook 'eshell-input-filter-functions #'eshell-add-to-history nil t= )) >=20=20 > +(defun eshell--save-history () > + "Save the history for current Eshell buffer." > + (eshell-write-history nil eshell-history-append)) > + > (defun eshell-save-some-history () > "Save the history for any open Eshell buffers." > (dolist (buf (buffer-list)) > @@ -318,7 +328,7 @@ eshell-save-some-history > (format-message > "Save input history for Eshell buffer `%s'? " > (buffer-name buf))))) > - (eshell-write-history))))) > + (eshell--save-history))))) > t) >=20=20 > (defun eshell/history (&rest args) --=20 Sean Whitton