From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#70610: 30.0.50; [PATCH] * lisp/eshell/esh-mode.el (eshell-first-time-mode-hook): Run the hook for once Date: Thu, 02 May 2024 12:09:58 +0300 Message-ID: <86a5l8mvfd.fsf@gnu.org> References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="28297"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 70610@debbugs.gnu.org To: Lin Sun , Jim Porter Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu May 02 11:10:57 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 1s2SSv-00076g-Cr for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 02 May 2024 11:10:57 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s2SSk-0002Ho-Eg; Thu, 02 May 2024 05:10:46 -0400 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 1s2SSf-0002HU-2A for bug-gnu-emacs@gnu.org; Thu, 02 May 2024 05:10:41 -0400 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 1s2SSe-0001q2-NZ for bug-gnu-emacs@gnu.org; Thu, 02 May 2024 05:10:40 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1s2ST0-0005mW-Bp for bug-gnu-emacs@gnu.org; Thu, 02 May 2024 05:11:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 02 May 2024 09:11:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 70610 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 70610-submit@debbugs.gnu.org id=B70610.171464103722216 (code B ref 70610); Thu, 02 May 2024 09:11:02 +0000 Original-Received: (at 70610) by debbugs.gnu.org; 2 May 2024 09:10:37 +0000 Original-Received: from localhost ([127.0.0.1]:42551 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1s2SSa-0005mG-PN for submit@debbugs.gnu.org; Thu, 02 May 2024 05:10:37 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:47334) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1s2SSY-0005m9-Uv for 70610@debbugs.gnu.org; Thu, 02 May 2024 05:10:35 -0400 Original-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 1s2SS4-0001Um-9j; Thu, 02 May 2024 05:10:05 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=vcs7tA/D97p5oOq4dC3hT8gzbA3wFWlH5ZFCsvV+LCA=; b=SI5SZBEFnyrrjyNZ0/p2 fNRRIYeG5T94OWgulq3IgH5TvoHGyHJOOwvJG/qkFWcGiELBH7kzA9dbzCsAog4WAZetQtzSHU/K9 cn3+KQqFEuQxPl/0CMZ8/E4bkt22XoNVQenq+BkLpG+61WcLEmv/1AYJEMnDxiJy+Q7R2YyXZaJ8c LykKt9Bo77uxiHU/WX7yAAiVcNMCCLahmrW+PXLK9pHKaMlvL5cQBv2e8tQMV9X7r5greKijTcoy6 pVUVpIFnsQH+YR1dE93rUHl61Cb4tWQ9uEcFPs0NgqU6FC6t1WsECoMrcDCR1Qj3foyBq45jADz+7 kfPPVNqxEyn69g==; In-Reply-To: (message from Lin Sun on Sat, 27 Apr 2024 16:32:24 +0000) 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:284289 Archived-At: > From: Lin Sun > Date: Sat, 27 Apr 2024 16:32:24 +0000 > > The document of `eshell-first-time-mode-hook' says it would be run the > first time eshell started. > > A hook that gets run the first time ‘eshell-mode’ is entered. > > That is to say, the first time during an Emacs session. > > But it actually runs every time for an eshell buffer(start an eshell, > exit it, start an eshell again). > Here is the one line code to show that: > (add-hook 'eshell-first-time-mode-hook '(lambda () (message "test"))) > > The patch will make the `eshell-first-time-mode-hook' only run once as > its document described. > > Please help review the patch. Thanks > > Best Regards > Lin > > From 094be841bf2261fb5efc0cacd0a40d34695906d7 Mon Sep 17 00:00:00 2001 > From: Lin Sun > Date: Sat, 27 Apr 2024 06:55:49 +0000 > Subject: [PATCH] * lisp/eshell/esh-mode.el (eshell-first-time-mode-hook): Run > the hook for once > > --- > lisp/eshell/esh-mode.el | 6 ++++-- > 1 file changed, 4 insertions(+), 2 deletions(-) > > diff --git a/lisp/eshell/esh-mode.el b/lisp/eshell/esh-mode.el > index b15f99a035..5de200ce4b 100644 > --- a/lisp/eshell/esh-mode.el > +++ b/lisp/eshell/esh-mode.el > @@ -418,8 +418,10 @@ eshell-mode > > (add-hook 'kill-buffer-hook #'eshell-kill-buffer-function t t) > > - (if eshell-first-time-p > - (run-hooks 'eshell-first-time-mode-hook)) > + (when eshell-first-time-p > + (setq eshell-first-time-p nil) > + (run-hooks 'eshell-first-time-mode-hook)) > + > (run-hooks 'eshell-post-command-hook)) > > (put 'eshell-mode 'mode-class 'special) > -- > 2.20.5 Jim, any comments on this change proposal?