Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: idea for new feature (was: Re: sticky-note and zle bindings)



On Jan 25, 2008 6:57 PM, Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:


> Shells are slightly different beasts than other applications.  If I
> explicitly exit from a shell, I'm done with whatever that shell was
> doing, and if I were to then start a new shell I wouldn't want it to
> return to the context of the the last shell I exited; the chances are
> very good that the new thing I'll be doing has nothing to do with
> the last thing.

That is only true for local shells. Remote shells should offer a way
to resume. Speaking of which, is OpenSSH able to pass environment
variables from the local to the remote session?


> OTOH if my shell *windows* in a GUI environment are disconnected, or
> the shell is killed by HUP, I probably didn't intentionally exit and I'd
> like the state restored, to the extent possible, when the GUI resumes.
> That applies whether the GUI session is exited abnormally or when I
> choose "Log Out" from a menu.

Even if there is no HUP and I cleanly exit a remote session, I would
probably want to restore session state, sometimes. A cheap way to
emulate screen, so to say.


> This implies that commands in the .zlogout or equivalent need to be
> able to determine what caused the shell to exit:  builtin command,
> user-generated EOF (ctrl-D), real EOF on stdin, HUP signal, etc.

If the user can choose which set of conditions should have what effect
then yes, this would help quite a lot.


> It also implies that the shell needs a way to tell the GUI environment
> NOT to attempt, independently, to restore current directory, etc.

[XDG_]SHELL_SESSION_HANDLER or some such?
Could be 'shell', 'terminal', 'both' or a parseable list/an array?


> Scriptable.  Don't bother trying to define this in the shell itself.
[...]
> Again scriptable.

The shell should probably offer hooks and options for the script to use,
but yes, that is basically what I meant.


> See Util/reporter in the zsh source distribution for examples of how to
> dump out various shell state.

Will do, thanks :)


Richard



Messages sorted by: Reverse Date, Date, Thread, Author