Merged
Conversation
A user with `alias ssh=…' in their rc before sourcing ghostel.zsh /
ghostel.bash hit a parse error ("parse error near `()'") because zsh
(at parse time) and bash (once the alias is active in the sourced
file) expand the alias against the `ssh()' function header.
Switching to `function ssh { … }' sidesteps alias expansion — there
is no `()' to clash with — and preserves existing semantics.
Fixes #155.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
source ghostel.zsh(andghostel.bashin the same scenario) failed withparse error near '('when the user hadalias ssh=…set beforehand, because zsh expands aliases at parse time against thessh()function header.function ssh { … }— the keyword form is not subject to alias expansion on the name token, so a pre-existingsshalias no longer breaks sourcing.etc/ghostel.fishis unaffected (fish has no POSIX()form; aliases are themselves functions the laterfunction sshcleanly replaces).sshalias.Test plan
zsh -c 'alias ssh=…; export GHOSTEL_SSH_INSTALL_TERMINFO=1; source etc/ghostel.zsh'sources without error (previously failed).bash -i -c 'source …'afteralias ssh=…) sources without error (previously failed).make -j4 all— 152/152 tests pass.GHOSTEL_SSH_INSTALL_TERMINFO=1(no behavior change expected; listed for completeness).