GNU bug report logs - #66768
30.0.50; [PATCH] Improve read/append behavior of eshell history command

Previous Next

Package: emacs;

Reported by: Liu Hui <liuhui1610 <at> gmail.com>

Date: Fri, 27 Oct 2023 04:18:02 UTC

Severity: normal

Tags: patch

Found in version 30.0.50

Fixed in version 30.1

Done: Jim Porter <jporterbugs <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Jim Porter <jporterbugs <at> gmail.com>
Cc: tracker <at> debbugs.gnu.org
Subject: bug#66768: closed (30.0.50; [PATCH] Improve read/append behavior
 of eshell history command)
Date: Sat, 11 Nov 2023 02:04:02 +0000
[Message part 1 (text/plain, inline)]
Your message dated Fri, 10 Nov 2023 18:03:07 -0800
with message-id <358d06e6-0a07-ffda-1710-400dab7eaecb <at> gmail.com>
and subject line Re: bug#66768: 30.0.50; [PATCH] Improve read/append behavior of eshell history command
has caused the debbugs.gnu.org bug report #66768,
regarding 30.0.50; [PATCH] Improve read/append behavior of eshell history command
to be marked as done.

(If you believe you have received this mail in error, please contact
help-debbugs <at> gnu.org.)


-- 
66768: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=66768
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Liu Hui <liuhui1610 <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 30.0.50;
 [PATCH] Improve read/append behavior of eshell history command
Date: Fri, 27 Oct 2023 12:15:00 +0800
[Message part 3 (text/plain, inline)]
Hi,

This patch fixes some corner cases of the eshell history command about
reading (-r) and appending (-a).

Recipe:

1. create a sample history file containing some lines, e.g.

    ls

2. emacs -Q --eval "(setq eshell-history-file-name ...)"  -f eshell

3. type following commands:

$ ls
$ history -a
$ cd /tmp
$ history -a

'history -a' doesn't distinguish old history from new history items of
current buffer, and always appends the whole history list whenever it
is called, resulting in a mess of the content of history file:

    ls
    ls
    ls
    history -a
    ls
    ls
    history -a
    cd /tmp/
    history -a

If another eshell buffer or emacs instance is launched before we quit
this eshell buffer, they will read messed history. Thus this patch
changes behavior of 'history -a' from "append current history list to
history file" to "append new history in current buffer to history
file", which is also consistent with bash's 'history -a'.

4. continue to type:

$ (setq eshell-hist-ignoredups t)
$ history -a; history -r
$ history

'history -r', which calls eshell-read-history, doesn't remove
consecutive "ls" duplicates from the history file. Thus this patch
amends eshell-read-history to make it respect the
eshell-hist-ignoredups option (both t and 'erase).

Since 'history -r' replaces current history list, which is actually
equivalent to bash's 'history -c; history -r', I have updated the help
text. Maybe it should be split into two commands, i.e. adding 'history
-c'?


Best,

--
Liu Hui
[0001-Improve-read-append-behavior-of-eshell-history-comma.patch (text/x-patch, attachment)]
[Message part 5 (message/rfc822, inline)]
From: Jim Porter <jporterbugs <at> gmail.com>
To: Liu Hui <liuhui1610 <at> gmail.com>
Cc: 66768-done <at> debbugs.gnu.org
Subject: Re: bug#66768: 30.0.50; [PATCH] Improve read/append behavior of
 eshell history command
Date: Fri, 10 Nov 2023 18:03:07 -0800
Version: 30.1

On 11/7/2023 2:14 AM, Liu Hui wrote:
> Thanks for your comments! I've updated the patch to address all
> concerns.

Everything in your patch looks good to me. I've now merged it as 
8b3969006fe (with a small editorial change to a docstring), and added a 
few extra regression tests for the history code on top as f2b162f8ee5.

Closing this now. Thanks for helping improve Eshell!


This bug report was last modified 1 year and 194 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.