Zsh Mailing List Archive
Messages sorted by:
Re: How to fix run-help-* functions?
- X-seq: zsh-workers 51570
- From: Mikael Magnusson <mikachu@xxxxxxxxx>
- To: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- Cc: Michele Venturi <dardo82@xxxxxxxxx>, Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx>, zsh-workers@xxxxxxx
- Subject: Re: How to fix run-help-* functions?
- Date: Mon, 13 Mar 2023 19:19:33 +0100
- Archived-at: <https://zsh.org/workers/51570>
- In-reply-to: <CAH+w=7Zf8S_eCgvYjTV3sp5h8ApXwy9SduMKViBe+hha0_OZHg@mail.gmail.com>
- List-id: <zsh-workers.zsh.org>
- References: <CA+Ds4NvZ1uQhgfZChLWAT2_QjTjMzZfujFXDLAfmAR8email@example.com> <CAH+w=7a=-==MoeLJLUVLvkedvO=qi-jTU3G2uLasivQhZZU78Q@mail.gmail.com> <firstname.lastname@example.org> <CAH+w=7YVtW=YmMiB60mssvYskitkxruFQVE3ai3g5KvPesN7ZQ@mail.gmail.com> <CA+Ds4NtzgeBtHGo9fdXFLc0xFzQM8WfFxoKr6R7OEkT5Y=qV7g@mail.gmail.com> <CAH+w=7Zf8S_eCgvYjTV3sp5h8ApXwy9SduMKViBe+hha0_OZHg@mail.gmail.com>
On 3/13/23, Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
> On Mon, Mar 13, 2023 at 4:14 AM Michele Venturi <dardo82@xxxxxxxxx> wrote:
>> On Tue, Mar 7, 2023, 18:41 Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
>>> If you don't do the "make install" part, you get an error about a
>>> "shift" count being wrong, which probably looks like a bug rather than
>>> a usage problem.
>> I've tried this but it doesn't make any difference,
> When you "configure" or by passing an environment variable to "make"
> you can specify a custom location for the help files.
> Because run-help is a shell function, it doesn't have a "source file"
> and an "object file" so the source itself contains a replacement
> string @runhelpdir@ which is updated by the installfns.sh script
> during "make install". Yes, we could have put a "run-help.in" file
> somewhere and processed that at a different build step to create
> run-help, but that complicates installing the rest of the functions.
> The help directory is populated by the Util/helpfiles script, which is
> run by "make install" in the Doc subdirectory (but I do not recommend
> attempting to run make in individual subdirectories rather than
> letting the top-level Makefile drive it.)
> However, all of that turns out to be necessary but secondary, because
> the real problem is that you're using run-help wrong.
[moved this part to after]
> Question for the audience is whether we want to consider this a bug
> and make it possible to use run-help as a standalone function.
It could/should at least output some diagnostic, because it is very
easy for an end-user (or very confused developer) to do this:
% git<invoke run-help>
[git manpage is shown]
# above prompt has now changed to this:
% run-help git
% git<now press page up and enter which changes this line to:>
% run-help git
git is /usr/bin/git
run-help:shift:106: shift count must be <= $#
> You're not intended to type out "run-help sudo" and hit enter, you're
> intended to type "sudo" and then invoke the run-help ZLE widget
> (normally ESC h or Alt+h), which then calls the run-help function with
> some preliminary setup having been done.
Looking at the code for processcmd it seems to literally only insert
the string "run-help git" on the command line, so what exactly is this
preliminary setup? I can't find it. The comment for the function is:
/* Run '$WIDGET $commandword' and then restore the command-line using
which is missing some key piece of information.
Messages sorted by: