GNU bug report logs - #79329
Fix duplicate inputs in comint-read-input-ring

Previous Next

Package: emacs;

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

Date: Thu, 28 Aug 2025 10:04:01 UTC

Severity: normal

Done: Eli Zaretskii <eliz <at> gnu.org>

To reply to this bug, email your comments to 79329 AT debbugs.gnu.org.
There is no need to reopen the bug first.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#79329; Package emacs. (Thu, 28 Aug 2025 10:04:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Liu Hui <liuhui1610 <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Thu, 28 Aug 2025 10:04:01 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Liu Hui <liuhui1610 <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: Fix duplicate inputs in comint-read-input-ring
Date: Thu, 28 Aug 2025 18:02:00 +0800
[Message part 1 (text/plain, inline)]
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.
[0001-Fix-duplicate-inputs-in-comint-read-input-ring.patch (application/x-patch, attachment)]

Reply sent to Eli Zaretskii <eliz <at> gnu.org>:
You have taken responsibility. (Sat, 06 Sep 2025 08:28:01 GMT) Full text and rfc822 format available.

Notification sent to Liu Hui <liuhui1610 <at> gmail.com>:
bug acknowledged by developer. (Sat, 06 Sep 2025 08:28:02 GMT) Full text and rfc822 format available.

Message #10 received at 79329-done <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Liu Hui <liuhui1610 <at> gmail.com>
Cc: 79329-done <at> debbugs.gnu.org
Subject: Re: bug#79329: Fix duplicate inputs in comint-read-input-ring
Date: Sat, 06 Sep 2025 11:27:28 +0300
> From: Liu Hui <liuhui1610 <at> gmail.com>
> 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.




This bug report was last modified 4 days ago.

Previous Next


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