Subject: bug#36034: [PATCH] Zsh extended_history shows up in comint input ring

From: Lars Ingebrigtsen <[email-masked]>
Date: Tue, 25 Jun 2019 13:05:22 +0200

Matthew Bauer <[email-masked]> writes:

>  -                           (match-end 0)
>  -                         (point-min)))
>  +                           (progn
>  +                             (when (and
>  +                                    comint-input-ring-file-prefix
>  +                                    (looking-at (concat
>  comint-input-ring-separator
>  +                                                        comint-input-ring-file-prefix)))
>  +                               ;; Skip zsh extended_history stamps
>  +                               (re-search-forward comint-input-ring-file-prefix
>  +                                                  nil t))
>  +                             (match-end 0))
>
>  The re-search-forward here doesn't seem necessary -- can't you just go
>  to (match-end 0) here instead?
>
> Without re-search-forward, the “start” integer would just be the character
> right after the newline. re-search-forward skips that prefix.

You first do a

(looking-at (concat comint-input-ring-separator comint-input-ring-file-prefix)))

and then

(re-search-forward comint-input-ring-file-prefix)

This will make point end up at where (match-end 0) would be after the
looking-at, surely?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no