GNU bug report logs - #36034
[PATCH] Zsh extended_history shows up in comint input ring

Previous Next

Package: emacs;

Reported by: Matthew Bauer <mjbauer95 <at> gmail.com>

Date: Fri, 31 May 2019 20:43:02 UTC

Severity: normal

Tags: fixed, patch

Fixed in version 28.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Matthew Bauer <mjbauer95 <at> gmail.com>
Cc: 36034 <at> debbugs.gnu.org
Subject: Re: bug#36034: [PATCH] Zsh extended_history shows up in comint input
 ring
Date: Mon, 24 Jun 2019 12:51:08 +0200
Matthew Bauer <mjbauer95 <at> gmail.com> writes:

> Yes, it does apply for any comint buffer that uses
> comint-read-input-ring. i had originally thought this was only used by
> shell-mode, but you are correct that it is used by others. Ive added
> defcustom handling to the patch to properly account for this.

Looks less dangerous now.  :-)

Some comments:

> +(defcustom comint-input-ring-file-prefix nil
> +  "If non-nil, the prefix to skip when parsing the input ring file.
> +This is useful in Zsh when the extended_history option is on."
> +  :type 'boolean
> +  :group 'comint)

This doesn't really seem like a user-level variable, so it should just
be a defvar, I think.

>                   (setq start
>                         (if (re-search-backward comint-input-ring-separator
>                                                 nil t)
> -                           (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?

> +                         (progn
> +                           (goto-char (point-min))
> +                           (if (and comint-input-ring-file-prefix
> +                                    (looking-at comint-input-ring-file-prefix))
> +                               (progn
> +                                 (re-search-forward comint-input-ring-file-prefix
> +                                                    nil t)
> +                                 (match-end 0))
> +                             (point-min)))))

And I don't understand this bit.  This is when we didn't find
comint-input-ring-separator, right?  But you still want to skip
comint-input-ring-file-prefix?

If you want to skip it anyway, then you can just have the check (and the
skip) after the if statement...

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




This bug report was last modified 4 years and 282 days ago.

Previous Next


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