Zsh Mailing List Archive
Messages sorted by:
Re: idea for new feature (was: Re: sticky-note and zle bindings)
- X-seq: zsh-users 12450
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: zsh-users@xxxxxxxxxx
- Subject: Re: idea for new feature (was: Re: sticky-note and zle bindings)
- Date: Wed, 16 Jan 2008 19:11:03 -0800
- In-reply-to: <20080116171253.GF16058@xxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <20080104105900.37a87f7e@news01> <237967ef0801040304h494987bv939bf6ff9541123f@xxxxxxxxxxxxxx> <477E177A.3060303@xxxxxxxxxxxxx> <Xns9A20C0F173D23zzappergmailcom@xxxxxxxxxxxx> <080113000048.ZM15017@xxxxxxxxxxxxxxxxxxxxxx> <20080116131048.GC16058@xxxxxxxxx> <080116075915.ZM12209@xxxxxxxxxxxxxxxxxxxxxx> <20080116171253.GF16058@xxxxxxxxx>
On Jan 16, 6:12pm, Andy Spiegl wrote:
} How about saving the current directory (or even the whole directory
} stack) of every zsh-instance so that it's possible to restore the
} status of all shells after an (in)voluntary crash, like network splits
} or an X-server crash.
Of course this is what share_history and inc_append_history are in
part intended to accomplish.
The problem is that zsh can't do it by iself. So, your X server has
crashed and 20 shell windows went kablooie. Even if every zsh has
faithfully been recording its state somewhere, how does each new
xterm you launch on the retarted X desktop know which one of the 20
saved states it should restore?
This is actually made *worse* by the fact that many modern X desktops
have "session managers" that will remember the apps and placement of
your windows and re-launch them on restart, so you may have 20 new
xterms all examining the set of state files effectively at once.
Even supposing your session manager doesn't do this, and you have a
command to launch a new xterm for every state file and somehow pass it
(ZDOTDIR maybe?) the name of the file it should initialize, zsh can't
track window placements or much of anything else that would help you
to tell which window is which after they reappear.
The upshot is that this isn't a zsh feature -- it's a cooperative
feature that requires effort from both the shell and whatever other
user interface environment it's running inside. It's pretty simple
to dump state somewhere from the precmd() function, if only you know
what to do with it later.
One of my sysadmins back in grad school had a collection of csh scripts
read from his .login to do something like this, 20 years ago. I never
saw them in detail, but I got the impression that they were stashing
away data they'd extracted from the SunWindows environment on his old
Sun-1 desktop (before there was such a thing as a sparc chip or even
OpenWindows -- can you say "black-and-white bitmap"?). And he didn't
even have such a thing as precmd -- he was relying on aliases for "cd"
and the like.
Messages sorted by: