Re: [PATCH] Fix WATCH/watch tying
Oliver Kiddle <[email protected]>
| Newsgroups | gmane.comp.shells.zsh.devel |
|---|---|
| Message-ID | <[email protected]> |
Philippe Altherr wrote: > Do you mean that if WATCH is defined in the environment when Zsh starts (or > when the watch module is reloaded), then the WATCH and watch parameters should > be auto-loaded and initialized with the environment value of WATCH? In other > words, would you like the following? Yes, exactly. Though this was more a matter of backward compatibility with zsh from before watch became a module. I mentioned this in 49539. In the case of WATCH, I really don't think it matters and nobody has complained. In contrast, MAIL and MAILPATH do commonly come from the environment. > I guess that the code of add_autoparam could be changed to do what you wish. I > would only do it if the existing parameter is at the top-level and if it has > the same type as the autoload parameter to be created. In that case, the value > of the existing parameter could be saved, the existing parameter could then be > replaced with the autoload parameter, which would then be immediately loaded > and initialized with the saved value. An environment variable doesn't have a type associated with it so it'd be a case of limiting this to scalars. From a quick scan, WATCH is about the only scalar autoloaded parameter. Otherwise, there's only SRANDOM which is readonly. Without loading the module, the shell only knows the parameter's name and not the type. Maybe some additional marker can be added. Oliver