-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feat/lexical binding #37
Merged
redguardtoo
merged 20 commits into
redguardtoo:master
from
joshbax189:feat/lexical-binding
Oct 19, 2024
Merged
Feat/lexical binding #37
redguardtoo
merged 20 commits into
redguardtoo:master
from
joshbax189:feat/lexical-binding
Oct 19, 2024
Conversation
This file contains 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
It just changes the output in the comint buffer.
require does not load if already present. Convert cond to equivalent if
This means that default-directory is always added to NODE_PATH when calling js-comint-repl
This avoids modifying NODE_PATH for later calls
Made cmd optional and documented behaviour.
read-directory-name defaults to default-directory if nil and expand-file-name produces output equivalent to file-truename.
This way js-rest-repl does not "forget" the local node_modules.
This fixes byte-compiler warnings, but keeps nvm optional
js-comint-select-node-version is the common entry point when using nvm functions.
Thanks |
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
Fixes #36
Enables lexical binding, removes uses of dynamic binding and fixes some issues arising from those changes.
Major changes
js-comint-repl (cmd)
signature change tojs-comint-repl (&optional cmd)
,This better reflects intended usage
js-comint-setup-module-paths
removed, functionality merged intojs-comint-start-or-switch-to-repl
js-comint-start-or-switch-to-repl
now creates a temporary environment rather than doingsetenv
every runwith-environment-variables
macrojs-comint-repl
now sets the command and uses nvm without using a prefix argPreviously these were included in the
when
clause within theinteractive
call, meaning that they were almost never used.This probably was an indentation/nesting error. The effect is that when
cmd
is given, the globaljs-comint-program-command
will be updated.Questions
js-comint-repl
correct/sensible?Check use with and without nvm
(IMO emacs LTS version is 29, so it's ok)
Specifics
After enabling lexical binding in the main file these functions had "unused lexical variable" warnings
js-comint-filter-output (string)
Fixed by marking the arg as ignored.
js-comint-repl (cmd)
Fixed by moving the "set command" logic out of the
interactive
call.As noted above, the behaviour of
js-comint-repl (cmd)
is now sticky:If nvm is used:
Previously, these effects only happened when
js-comint-repl
was called interactively with a prefix argument.Also, within
js-comint-repl
the variablejs-comint-module-paths
is dynamically let-bound to temporarily change its value (used injs-comint-setup-module-paths
). This required more extensive changes to fix.Since
js-comint-setup-module-paths
sets the environment permanently usingsetenv
, the dynamic binding creates a bug where every new visited node_modules is added to the NODE_PATH for each successive call tojs-comint-repl
. Instead I changed to using a local environment for each call tojs-comint-start-or-switch-to-repl
.Using a local environment uncovers a different problem:
When NODE_PATH was set globally, this was fine as the old path was still present. But now the environment is reset for each call to
js-comint-start-or-switch-to-repl
. Better for the dynamic setting behaviour to move fromjs-comint-repl
tojs-comint-start-or-switch-to-repl
so that successive calls still use the expected node_modules.