zsh-users
 help / color / mirror / code / Atom feed
From: "Bart Schaefer" <schaefer@candle.brasslantern.com>
To: Steve Reid <steve@edmweb.com>, zsh-users@math.gatech.edu
Subject: Re: history sharing between ttys
Date: Fri, 14 Feb 1997 00:07:48 -0800	[thread overview]
Message-ID: <970214000748.ZM24379@candle.brasslantern.com> (raw)
In-Reply-To: Steve Reid <steve@edmweb.com> "Re: history sharing between ttys" (Feb 13,  5:26pm)

On Feb 13,  5:26pm, Steve Reid wrote:
} Subject: Re: history sharing between ttys
}
} > [...] set it up so that you
} > can share history between multiple ttys.  So if I typed a command in one
} > window, I could retrieve and execute it from another window.  
} 
} Something like this? Last time I tried it (zsh 3.0.2) it didn't work
} correctly... I was told that it was because of a bug in the new history
} code.
} 
} precmd() {
} 	fc -AI ~$USER/.history;	# Append latest commands
} 	fc -R ~$USER/.history;	# Read changes from all zsh's
} }                                         

This appears to work fine in zsh 3.0.3-test4 (although I have applied a
couple of other patches, I don't think any of them would affect this).

However, the behavior is a little strange, because you immediately read
back not only everything the other shell wrote, but also everything you
just wrote, which causes the event numbers to jump by large increments at
every command.  The following seems to work a bit better; the event number
jumps only when some other zsh has actually written the file:

    precmd() {
	if [[ ~/.history -nt ~/.history-$HOST-$$ ]]
	then
	    fc -AI ~/.history
	    fc -R ~/.history
	else
	    fc -AI ~/.history
	fi
	<~/.history >| ~/.history-$HOST-$$
    }

} Ideally, it should be possible to append the command to the history
} file immediately after the command is entered.

Write a zsh 3.1 module that fronts for the `accept-line' ZLE action ...

} Other running zsh's
} should detect the change and read it, so the user doesn't have to hit
} enter every time they switch ttys.

That's almost doable:	TMOUT=10 ; trap precmd ALRM

-- 
Bart Schaefer                             Brass Lantern Enterprises
http://www.well.com/user/barts            http://www.nbn.com/people/lantern


      reply	other threads:[~1997-02-14  8:19 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-02-13 23:53 Herb Maeder
1997-02-14  1:26 ` Steve Reid
1997-02-14  8:07   ` 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=970214000748.ZM24379@candle.brasslantern.com \
    --to=schaefer@candle.brasslantern.com \
    --cc=schaefer@nbn.com \
    --cc=steve@edmweb.com \
    --cc=zsh-users@math.gatech.edu \
    /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).