Skip to content

inconsistent use of "builtin" with alias in zsh-syntax-highlighting.zsh #972

@isaacl

Description

@isaacl

zsh-syntax-highlighting.zsh, is generally defensive when invoking builtins. For example, alias is called using builtin alias. However, later aliases are restored without the builtin modifier.

This seems slightly inconsistent. In an environment where alias has been overridden, this might clear aliases and then fail to restore them.

Although alias -L is currently is exactly one alias command per line, this is not guaranteed by zsh. But if we can assume this output format (and it seems unlikely to ever change) then one could prepend builtin to each line. Example:

typeset zsh_highlight__aliases=(${(f)"$(builtin alias -Lm '[^+]*')"})
...
for __line in zsh_highlight__aliases; do
  eval builtin "$__line"
done
builtin unset zsh_highlight__aliases __line

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions