From: Lars Ingebrigtsen <larsi@gnus.org>
To: Matthew Bauer <mjbauer95@gmail.com>
Cc: 36034@debbugs.gnu.org
Subject: bug#36034: [PATCH] Zsh extended_history shows up in comint input ring
Date: Mon, 24 Jun 2019 12:51:08 +0200 [thread overview]
Message-ID: <m3wohb2owu.fsf@gnus.org> (raw)
In-Reply-To: <87E1A7E1-B0B3-45F9-9282-82A19DDB2516@gmail.com> (Matthew Bauer's message of "Sun, 23 Jun 2019 18:27:59 -0400")
Matthew Bauer <mjbauer95@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
prev parent reply other threads:[~2019-06-24 10:51 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-31 20:30 bug#36034: [PATCH] Zsh extended_history shows up in comint input ring Matthew Bauer
2019-06-23 16:53 ` Lars Ingebrigtsen
2019-06-23 22:27 ` Matthew Bauer
2019-06-24 10:51 ` Lars Ingebrigtsen
2019-06-24 22:45 ` Matthew Bauer
2019-06-25 11:05 ` Lars Ingebrigtsen
2019-06-29 21:35 ` Matthew Bauer
2019-07-04 13:37 ` Lars Ingebrigtsen
2020-01-20 19:43 ` Stefan Kangas
2020-03-18 15:05 ` Matthew Bauer
2020-08-10 11:11 ` Lars Ingebrigtsen
2019-06-24 10:51 ` Lars Ingebrigtsen [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m3wohb2owu.fsf@gnus.org \
--to=larsi@gnus.org \
--cc=36034@debbugs.gnu.org \
--cc=mjbauer95@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.