zsh-workers
 help / color / Atom feed
From: Daniel Shahaf <d.s@daniel.shahaf.name>
To: Bart Schaefer <schaefer@brasslantern.com>
Cc: Zsh hackers list <zsh-workers@zsh.org>
Subject: Re: Editing the history in the shell
Date: Sat, 23 May 2020 02:28:07 +0000
Message-ID: <20200523022807.08f3ba45@tarpaulin.shahaf.local2> (raw)
In-Reply-To: <CAH+w=7ZFt7jshjv1FCEbmP_PgADvdKwymRutrzwJAvzNpsfOmA@mail.gmail.com>

Bart Schaefer wrote on Fri, 22 May 2020 15:24 -0700:
> 1) Should it be possible to edit empty events into the history?
> Currently empty lines are removed, but changing to IFS=$'\n\n' would
> preserve them (thanks Oliver for the idea)

Hmm.  I guess they might be useful as separators?

> Patch both inlined and attached in case gmail garbles the lines.

It did.

> +++ b/Functions/Misc/zed
> @@ -133,6 +138,17 @@ if ((fun)) then
> +  else
> +    hist=$HISTSIZE; HISTSIZE=0; fc -R /dev/null; HISTSIZE=$hist
> +    for (( hist=1; hist <= $#var; hist++ )) print -s "$var[hist]"

Evaluating «$#var» takes O(N) time, which makes this an O(N²) loop.
Save $#var into an auxiliary variable?

Also, s/print -s/print -s --/.

> +    [[ -n $1 ]] && SAVEHIST=$#var    # Resets on function exit
> +  fi

Cheers,

Daniel

  reply index

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-22 22:24 Bart Schaefer
2020-05-23  2:28 ` Daniel Shahaf [this message]
2020-05-23 21:30   ` Bart Schaefer
2020-05-24 22:02     ` _arguments optspecs (was Re: Editing the history in the shell) Bart Schaefer

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=20200523022807.08f3ba45@tarpaulin.shahaf.local2 \
    --to=d.s@daniel.shahaf.name \
    --cc=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

zsh-workers

Archives are clonable: git clone --mirror http://inbox.vuxu.org/zsh-workers

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://inbox.vuxu.org/vuxu.archive.zsh.workers


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git