emacs-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#66768: closed (30.0.50; [PATCH] Improve read/append behavior of eshe


From: GNU bug Tracking System
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

Your message dated Fri, 10 Nov 2023 18:03:07 -0800
with message-id <358d06e6-0a07-ffda-1710-400dab7eaecb@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@gnu.org.)


-- 
66768: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=66768
GNU Bug Tracking System
Contact help-debbugs@gnu.org with problems
--- Begin Message --- Subject: 30.0.50; [PATCH] Improve read/append behavior of eshell history command Date: Fri, 27 Oct 2023 12:15:00 +0800
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

Attachment: 0001-Improve-read-append-behavior-of-eshell-history-comma.patch
Description: Text Data


--- End Message ---
--- Begin Message --- 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!


--- End Message ---

reply via email to

[Prev in Thread] Current Thread [Next in Thread]