zsh-users
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: Zsh users <zsh-users@zsh.org>
Subject: Re: Infinite history size
Date: Sun, 15 Dec 2013 12:06:07 -0800	[thread overview]
Message-ID: <131215120607.ZM20484@torch.brasslantern.com> (raw)
In-Reply-To: <20131214104823.GA16269@chrisdown.name>
In-Reply-To: <20131214115345.GA17562@chrisdown.name>

On Dec 14,  6:48pm, Chris Down wrote:
} 
} In bash, and some other shells, this can be done by nullfying (note: not
} unsetting) HIST{,FILE}SIZE, and then making sure readline's
} "history-size" is -1.

I think what you've found there is a behavior of readline, not especially
a behavior of the shells in question.  Since zsh doesn't use readline, ...

On Dec 14,  7:53pm, Chris Down wrote:
}
} So I'll take the answer as "you can't" (although LONG_MAX is obviously
} not something that I'm going to reach :-) ).

Although setting a very large number is probably the easiest way, you
could do something along these lines:

    SAVEHIST=$(( $(wc -l $HISFILE) * 2 ))
    HISTSIZE=$SAVEHIST
    zshaddhistory() {
      if (( HISTNO == HISTSIZE ));
      then
        (( HISTSIZE *= 2 )) 
	SAVEHIST=$HISTSIZE
      fi
      return 0
    }

I haven't tested that, and obviously it needs some tweaking for cases
where file size actually becomes a significant fraction of LONG_MAX.


  reply	other threads:[~2013-12-15 20:06 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-14 10:48 Chris Down
2013-12-14 11:49 ` ZyX
2013-12-14 11:53   ` Chris Down
2013-12-15 20:06     ` Bart Schaefer [this message]
2013-12-15 20:17       ` 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=131215120607.ZM20484@torch.brasslantern.com \
    --to=schaefer@brasslantern.com \
    --cc=zsh-users@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).