1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-04-17 11:32:59 -07:00

Fix duplicate inputs in 'comint-read-input-ring'

* lisp/comint.el (comint-read-input-ring): Fix the index of
the last input in the ring.  (Bug#79329)
This commit is contained in:
Liu Hui 2025-08-28 17:57:21 +08:00 committed by Eli Zaretskii
parent c374bb50da
commit fb969ab174

View file

@ -1090,8 +1090,9 @@ See also `comint-input-ignoredups' and `comint-write-input-ring'."
(when (and (not (string-match history-ignore history))
(or (null ignoredups)
(ring-empty-p ring)
(not (string-equal (ring-ref ring 0)
history))))
(not (string-equal
(ring-ref ring (1- (ring-length ring)))
history))))
(when (= count ring-size)
(ring-extend ring (min (- ring-max-size ring-size)
ring-size))