From: Daniel Shahaf <d.s@daniel.shahaf.name>
To: Marlon Richert <marlon.richert@gmail.com>
Cc: Zsh hackers list <zsh-workers@zsh.org>
Subject: Re: [RFC][PATCH] Add zrestart()
Date: Mon, 26 Apr 2021 03:22:00 +0000 [thread overview]
Message-ID: <20210426032200.GA26443@tarpaulin.shahaf.local2> (raw)
In-Reply-To: <CAHLkEDu2hWS8GQg4deQbHgVYxfj_Jm-tF6aa1hBP0JtgnB7WNg@mail.gmail.com>
> Subject: [PATCH] Add zrestart()
Nitpick, but the parentheses are wrong. They imply zrestart() is a C
function, which it isn't.
> +++ b/Doc/Zsh/contrib.yo
> @@ -4649,6 +4649,11 @@ See `Recompiling Functions'
> ifzman(above)\
> ifnzman((noderef(Utilities))).
> )
> +findex(zrestart)
> +item(tt(zrestart))(
> +This function tests whether the shell is able to restart without error and, if
> +so, restarts the shell.
> +)
> +++ b/Functions/Misc/zrestart
> @@ -0,0 +1,42 @@
> +#
> +# Restarts the shell if and only if it can restart without error.
> +#
> +
> +emulate -LR zsh
> +{
> + # Some users export $ZDOTDIR, which can mess things up.
> + local zdotdir=$ZDOTDIR
> + unset ZDOTDIR
The comment implies those users are doing something unusual, which isn't
the case. Exporting ZDOTDIR is normal.
More importantly, I don't see any reason to munge $ZDOTDIR in the first
place. It amounts to second-guessing the user.
> + print 'Validating...'
Error and progress messages should name their originator.
> + # Try if the shell can start up without errors. Passing an empty command
> + # ensures that the subshell exits immediately after executing all dotfiles.
> + # We suppress standard out, since we're interested in standard error only.
> + setopt multios
This option will already be on, and in any case isn't required for the
next line.
> + local err="$(zsh --interactive --monitor --zle -c '' 2>&1 > /dev/null)"
This doesn't necessarily restart the _same_ zsh, if there's more than
one installed.
Also, I think it's quite a stretch to describe this line as "_tests_
whether the shell is able to restart". This line executes a whole bunch
of code you have no control over. I don't think that's an acceptable
approach.
next prev parent reply other threads:[~2021-04-26 3:22 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-24 20:50 Marlon Richert
2021-04-26 3:22 ` Daniel Shahaf [this message]
2021-04-26 19:03 ` Marlon Richert
2021-04-26 19:29 ` Daniel Shahaf
2021-04-26 23:54 ` Bart Schaefer
2021-04-27 11:42 ` Marlon Richert
2021-04-27 11:49 ` Roman Perepelitsa
2021-04-27 17:49 ` Marlon Richert
2021-04-27 17:57 ` Marlon Richert
2021-04-27 18:37 ` Bart Schaefer
2021-04-29 13:58 ` Daniel Shahaf
2021-04-27 11:37 ` Marlon Richert
2021-04-29 14:12 ` Daniel Shahaf
2021-04-30 17:27 ` Marlon Richert
2021-05-09 20:59 ` Lawrence Velázquez
2021-05-09 22:52 ` 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=20210426032200.GA26443@tarpaulin.shahaf.local2 \
--to=d.s@daniel.shahaf.name \
--cc=marlon.richert@gmail.com \
--cc=zsh-workers@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).