zsh-workers
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: zsh-workers@zsh.org
Subject: Re: Repeatable (@M) bug
Date: Fri, 14 Aug 2015 11:03:22 -0700	[thread overview]
Message-ID: <150814110322.ZM1299@torch.brasslantern.com> (raw)
In-Reply-To: <CAKc7PVAKqsRtvELnchwcfO2jh_HSYiKhHkEtEvGy_g7nXjXpXQ@mail.gmail.com>

On Aug 14, 10:53am, Sebastian Gniazdowski wrote:
}
} Also, when I wrote a script to repeat v-history calls automatically (no
} through command line) it resulted in:
} v-history:fc:21: no such event: 1000
} 
} This is a very interesting result, as the `history -rn 1000` call just must
} work.

Scripts don't normally have history.  How did you run the script?

Glancing through your source code, I suspect the error is not with (@M).

"history 1000" means to start at the 1000th history entry and list up to
the current history entry (which must be event number 1000 or greater,
otherwise you get that "no such event" error).  Adding -r reverses the
order of the output, not the direction of selecting the event numbers.

I suspect you mean "history -rn -1000" to select events up to 1000
history entries ago and list them starting with the current entry.

However, You might avoid running `history -rn` and instead examine
the array $historywords from the zsh/parameter module.  It has all
the individual words from the history with the most recent at the
beginning of the array, which seems to be exactly what you want.

That is, instead of

    list=( `history -rn 1000` )
    list=( "${(@M)list:#*$1*}" )

use

    zmodload zsh/parameter
    list=( "${(@M)historywords:#*$1*}" )


      reply	other threads:[~2015-08-14 18:03 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-14  8:53 Sebastian Gniazdowski
2015-08-14 18:03 ` Bart Schaefer [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=150814110322.ZM1299@torch.brasslantern.com \
    --to=schaefer@brasslantern.com \
    --cc=zsh-workers@zsh.org \
    /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 public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).