Repository navigation
Conversation
|
Thanks for the PR. I'm in the process of overhauling the whole public API anyway. |
|
Yep, it's basically a convenience wrapper over those two commands, picking the right one situationally. No worries if this isn't accepted, I'm just tinkering and contributing in case it's useful to others. :) Out of curiosity, what was your expectation for a dwim command? In case it helps for the public API, here's my research into what's provided by other packages.
|
Create the project terminal when the project has none, switch to it when there is exactly one, and pick one via read-buffer when there are several (membership per ghostel-project-buffer-scope). A prefix argument passes through to ghostel-project, so C-u still forces a new terminal. Co-Authored-By: Claude Fable 5 <[email protected]>
|
@mrcnski I'm thinking of changing the default behaviour of consult-ghostel(-project) to yours. |
|
Thanks for considering this and sharing your thoughts. Regarding About the consult commands getting some (or all) of the dwim behavior: here I think we should look at what existing consult commands do, and opt for consistency. I had Fable look at them and it found that "no built-in [consult command] bypasses the minibuffer when there is exactly one candidate" and that "there is [...] a general consult precedent, and the current consult-ghostel already fits it". So here I think the more ergonomic functionality should live in a wrapper around the default consult ghostel commands - maybe documented somewhere like the README if it's too opinionated to bundle with the package. |

Problem
Working with more than one terminal per project is awkward, because no single command is safe to bind as "take me to a project terminal":
ghostel-projectkeys its reuse check on the unnumbered project identity. Once only numbered or renamed instances remain (e.g. open two project terminals, kill the first), it creates yet another terminal instead of switching to the surviving one.ghostel-project-nextcycling orghostel-project-list-buffers, and both signal an error when the project has no terminal yet.(Related: #133 asked for support for multiple terminals per project. The cycle and list commands have since been added to ghostel, but without a tidy way to make everything work together in a single command.)
Fix
A new command,
ghostel-project-dwim, that does the expected thing at every amount of project terminals:ghostel-projectread-buffer, defaulting to the forward-cycle buffer likeghostel-project-list-buffersdoes. Membership uses the existingghostel-project-buffer-scopemachinery.ghostel-project, soC-ustill forces a new terminal and numeric session arguments keep their meaning.For what it's worth, I surveyed how comparable packages (project.el's
project-shell/project-eshell, eat, vterm, multi-vterm, mistty, vterm-toggle, shell-pop) handle several-terminals-per-project. All of them provide numeric prefix indices or blind cycling, consistent with ghostel, but none supports a picker. As far as I could tell, this would be a novel feature unique to ghostel. 🚀Since ghostel already ships a
read-bufferpicker, extending it into a dwim entry point seemed like the natural ghostel-native answer.Other info
Four new tests in test/ghostel-buffers-test.el cover the three branches and the prefix pass-through.
README command table and CHANGELOG entries included.
🤖 Generated with Claude Code