Do not ask twice for project running ielm, term and vterm by kinote · Pull Request #1639 · bbatsov/projectile · GitHub
Skip to content

Do not ask twice for project running ielm, term and vterm#1639

Merged
bbatsov merged 1 commit intobbatsov:masterfrom
kinote:fix-asking-project-twice
Jan 17, 2021
Merged

Do not ask twice for project running ielm, term and vterm#1639
bbatsov merged 1 commit intobbatsov:masterfrom
kinote:fix-asking-project-twice

Conversation

@kinote
Copy link
Copy Markdown
Contributor

@kinote kinote commented Jan 14, 2021

Do not ask twice for the project root when calling
projectile-run-ielm, projectile-run-term or projectile-run-vterm
from outside a projectile folder.

Use projectile-with-default-dir at the beginning of those functions
to prevent calling projectile-acquire-root twice.

When running one of those functions (e.g. projectile-run-vterm) from a folder outside a projectile root (e.g. my home folder) I was being ask twice in the minibuffer to provide a projectile project root. This was caused because projectile-acquire-root was being called twice without setting the default folder.


Before submitting a PR make sure the following things have been done (and denote this
by checking the relevant checkboxes):

  • The commits are consistent with our contribution guidelines
  • You've added tests (if possible) to cover your change(s)
  • All tests are passing (eldev test)
  • The new code is not generating bytecode or M-x checkdoc warnings
  • You've updated the changelog (if adding/changing user-visible functionality)
  • You've updated the readme (if adding/changing user-visible functionality)

Thanks!

@bbatsov
Copy link
Copy Markdown
Owner

bbatsov commented Jan 16, 2021

@kinote
Copy link
Copy Markdown
Contributor Author

kinote commented Jan 16, 2021

Where exactly is the second call to projectile-acquire-root happening? That's not immediately clear looking at your patch.

projectile-acquire-root gets called the second time inside projectile-generate-process-name.

@bbatsov
Copy link
Copy Markdown
Owner

bbatsov commented Jan 17, 2021

Hmm, won't it be much better to just name the projectile-generate-process-name take an explicit project name argument? It will definitely make the code less brittle, as anyone can accidentally break it now.

Do not ask twice for the project root when calling
`projectile-run-ielm`, `projectile-run-term` or `projectile-run-vterm`
from outside a projectile folder.

These functions called `projectile-acquire-root` and then
`projectile-generate-process-name` which also called
`projectile-acquire-root`.

This commit modifies `projectile-generate-process-name` to require a
`project` parameter.
@kinote
Copy link
Copy Markdown
Contributor Author

kinote commented Jan 17, 2021

Hmm, won't it be much better to just name the projectile-generate-process-name take an explicit project name argument? It will definitely make the code less brittle, as anyone can accidentally break it now.

Yes, I think that makes more sense. I have updated the commit.

@bbatsov bbatsov merged commit 53514f9 into bbatsov:master Jan 17, 2021
@bbatsov
Copy link
Copy Markdown
Owner

bbatsov commented Jan 17, 2021

@kinote kinote deleted the fix-asking-project-twice branch January 17, 2021 12:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants