Actually, I just realized that what I was doing with line-init is not actually solving my problem. So, here's a new version of the patch that simply lets chpwd call precmd. See attachment. On Thu, Jun 10, 2021 at 4:47 PM Marlon Richert wrote: > > On Thu, Jun 10, 2021 at 12:30 PM Roman Perepelitsa > wrote: > > > > There is //'%%'/% in a few places. What's the logic behind it? > > Some prompt escape codes (such as %b for bold) need %% when used in > vcs_info -- except when they are used in nvcsformats. > > > > I think invoking prompt_vcs_setup twice in the same shell will produce > > an error. I haven't tried it though. > > I just tried it and I didn't get any errors. Why do you think it would > produce an error? > > > > prompt_vcs_chpwd always prints at least one line to the TTY regardless > > of configuration options. Is this intended? > > Yes, that was my intention, but I can see how it could be useful to be > able to customize that. I'll change it. > > > > Why is prompt_vcs_precmd checking whether prompt_vcs_fd is a readable > > fd? How can it not be? > > I don't know how or why, but if I don't check for that, then I get > this error repeatedly: > > prompt_vcs_precmd:6: failed to close file descriptor 11: bad file descriptor > > > > There is a comment in prompt_vcs_precmd that says it's going to kill a > > process while in fact it closes the file descriptor. That may > > *eventually* kill the process when it decides to print something > > (assuming it hasn't blocked SIGPIPE or is checking for write errors). > > True. I'll change it to actually kill the process, too. > > > > What is the purpose of the "Info is not for current dir" check? Is > > this to account for the possibility of `cd` from a zle widget? If so, > > perhaps handle this by hooking chpwd? > > The purpose is to account for the possibility that we receive the info > _after_ we've already changed to a new dir. However, if I correct the > piece of code you mentioned previously, then that shouldn't be > necessary. > > > > prompt_vcs_fd-widget has a check for [[ -n $1 ]]. When is it false? > > When prompt_vcs_fd-widget is being called incorrectly. :) Perhaps it > should not return 1 in that case, though. > > > Thanks again. New version of the patch attached.