Host-qualify ghostel-project buffer identity for remote roots#499
Merged
Conversation
A local and a remote (TRAMP) project with the same name produced the same *NAME-ghostel* identity, so ghostel-project reused the wrong buffer. Fold the full method:user@host prefix into the identity for remote roots, and use the same name in ghostel--project-buffers so identity-scoped cycling stays host-local. Fixes #344
dakra
force-pushed
the
fix/344-remote-project-identity
branch
from
July 2, 2026 06:52
ce5d474 to
61f11d7
Compare
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.
Fixes #344.
Problem
ghostel-projectderives its buffer identity viaproject-prefixed-buffer-name, which only uses the project root's basename. A local project~/fooand a remote/ssh:user@host:~/footherefore collide on*foo-ghostel*, and invokingghostel-projectfrom the remote project reused (and displayed) the local project's terminal instead of creating one on the remote host. The same host-blind prefix was used byghostel--project-buffers, so identity-scopedghostel-project-next/previous/list-bufferscould cycle into the other host's buffers.Fix
New helper
ghostel--project-buffer-name: for local roots it returns the same*NAME-ghostel*as before (no behavior change); for remote roots it folds the TRAMP prefix into the name, e.g.*foo-ghostel@ssh:user@host*. The fullmethod:user@hostprefix is used rather than just the host, since different users or methods on one host are different environments.file-remote-pis purely syntactic, so no connection is opened. Bothghostel-projectandghostel--project-buffersuse the helper, so creation, reuse, and cycling agree on the identity.Plain
M-x ghostelsingleton behavior is unchanged (confirmed as intended in the issue discussion).Tests
Four new elisp tests in
test/ghostel-project-test.el: helper naming for local vs remote roots, the regression scenario itself (remote project must not reuse the local buffer), idempotent reuse of the remote buffer, and identity-scope separation inghostel--project-buffers.make -j8 allpasses.Also verified live in a sandboxed Emacs session: a real local
ghostel-projectterminal plus a stubbed-spawn remote invocation yield two distinct buffers with distinct identities; re-running the remote call reuses the remote buffer and the local call still reuses the local one.