zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <pws@ibmth.df.unipi.it>
To: zsh-workers@sunsite.auc.dk
Subject: Re: Upcoming: handy history extensions
Date: Wed, 05 May 1999 10:11:10 +0200	[thread overview]
Message-ID: <9905050811.AA13411@ibmth.df.unipi.it> (raw)
In-Reply-To: "Wayne Davison"'s message of "Tue, 04 May 1999 12:42:14 DFT." <199905041942.MAA11235@bebop.clari.net>

Wayne Davison wrote:
> HIST_SAVE_NO_DUPS
> HIST_FIND_NO_DUPS
> HIST_EXPIRE_DUPS_FIRST
> HIST_IGNORE_ALL_DUPS
> INCREMENTAL_APPEND_HISTORY
> SHARE_HISTORY

I like these, but it does show (again) that the option-setting mechanism is
a bit old-fashioned, i.e. we really need a simpler way of telling the shell
what to do with duplicates than five boolean options.  Maybe we just need
some easy front end.  SHARE_HISTORY should presumably be turned on in ksh
compatibility mode.  Maybe we should even think in the longer term about
making interactive history a loadable module.

Getting the lexer to reparse history lines is probably non-trivial.  It
wouldn't be as bad as get_comp_string in zle_tricky.c, since all the lines
are complete with no current context.  However, reassembling the line is
probably a lot of work.  Perhaps the best bet would be to use the same
mechanism as happens when the line is first read, i.e. the lexer calls all
the appropriate history functions directly.

> I'm also wondering if we should be using a better string-hash
> function than the one in hasher().  I haven't yet analyzed the
> distribution of nodes within a hash table, but I was thinking that a
> generic CRC function might give us better results.  Also, is there
> any interest in rounding up the history table sizes to the nearest
> prime number?  DBZ has a simple (but not terribly efficient)
> algorithm for this, for instance.

I can't remember anybody ever thinking about this, so it's quite possible
it could do with changing.

> Another issue is history-file locking.  I think we want to lock the
> file when doing incremental updating (especially since re-writing
> now occurs much more frequently).  I'm not familiar with how to get
> metaconfig to look for the current machine's file-locking functions,
> though.  Anyone want to help me out?  If not, I'll look it up later.

It doesn't look like there is any generic autoconf support for this.  Some
mail package might have some autoconf code for checking, possibly emacs.
However, checking for fcntl/F_SETLKW etc., lockf/F_LOCK etc., flock/LOCK_SH
etc. should be straightforward; it's probably safest to use AC_TRY_COMPILE
to see if the expected set of flags is present, and define, say,
HAVE_LOCK_FCNTL, HAVE_LOCK_LOCKF or HAVE_LOCK_FLOCK.  I could potentially
write this.  Then there's the whole Lockdaemon From Hell saga, which we had
better just forget about.

-- 
Peter Stephenson <pws@ibmth.df.unipi.it>       Tel: +39 050 844536
WWW:  http://www.ifh.de/~pws/
Dipartimento di Fisica, Via Buonarroti 2, 56127 Pisa, Italy


  reply	other threads:[~1999-05-05  9:25 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-05-04 19:42 Wayne Davison
1999-05-05  8:11 ` Peter Stephenson [this message]
1999-05-05 10:51   ` 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=9905050811.AA13411@ibmth.df.unipi.it \
    --to=pws@ibmth.df.unipi.it \
    --cc=zsh-workers@sunsite.auc.dk \
    /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).