Hiding specials, and namerefs
Bart Schaefer <[email protected]> Sun, 19 Jul 2026 13:34:28 -0700
| Newsgroups | gmane.comp.shells.zsh.devel |
|---|---|
| Message-ID | <CAH+w=7ZVUPRKBpRVOGX4eSqbKNFyt8PrYC4r37GMGu1KJO8Egg@mail.gmail.com> |
Consider this:
local_nonspecial() { () {
local -h BUFFER;
local -n BUFFER=CURSOR;
((BUFFER-=3));
} }
zle -N local_nonspecial
Notes:
-- `typeset -hn ...` is not allowed, but can be worked around, so
probably should be allowed?
-- the ZLE parameters are already implicitly local on entry to a
widget function, so declaring them local again (even with -h) doesn't
change anything without introducing another scope.
(Noticed this while checking for side-effects of workers/54809)
Should there be an error or warning when attempting to "de-specialize"
a special parameter in the same scope where it already exists as a
special?
This is similar to this situation:
% typeset -i WATCH
typeset: WATCH: can't change type of autoloaded parameter