Subject: Re: bug#79329: Fix duplicate inputs in comint-read-input-ring
From: Eli Zaretskii <[email-masked]>
To: Liu Hui <[email-masked]>
Cc: [email-masked]
Date: Sat, 06 Sep 2025 11:27:28 +0300
List-Id: <debbugs-submit.debbugs.gnu.org>

> From: Liu Hui <[email-masked]>
> Date: Thu, 28 Aug 2025 18:02:00 +0800
> 
> 1. create a temp history file:
> cat > /tmp/history <<EOF
> foo
> foo
> bar
> other
> bar
> EOF
> 
> 2. HISTFILE=/tmp/history emacs -Q
> 
> 3. (setq comint-input-ignoredups t)
> 
> 4. M-x shell
> 
> The expected history (ring-elements comint-input-ring) is ("bar"
> "other" "bar" "foo"), but the actual result is ("bar" "other" "foo"
> "foo").
> 
> 
> The reason is comint-read-input-ring uses 0 as the index of the last
> input. But the last input is actually inserted by
> ring-insert-at-beginning, and it is the oldest item.

Thanks, your changes are now installed on the master branch, and I'm
therefore closing the bug.