Skip to content

Host-qualify ghostel-project buffer identity for remote roots#499

Merged
dakra merged 1 commit into
mainfrom
fix/344-remote-project-identity
Jul 2, 2026
Merged

Host-qualify ghostel-project buffer identity for remote roots#499
dakra merged 1 commit into
mainfrom
fix/344-remote-project-identity

Conversation

@dakra

@dakra dakra commented Jul 2, 2026

Copy link
Copy Markdown
Owner

Fixes #344.

Problem

ghostel-project derives its buffer identity via project-prefixed-buffer-name, which only uses the project root's basename. A local project ~/foo and a remote /ssh:user@host:~/foo therefore collide on *foo-ghostel*, and invoking ghostel-project from 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 by ghostel--project-buffers, so identity-scoped ghostel-project-next/previous/list-buffers could 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 full method:user@host prefix is used rather than just the host, since different users or methods on one host are different environments. file-remote-p is purely syntactic, so no connection is opened. Both ghostel-project and ghostel--project-buffers use the helper, so creation, reuse, and cycling agree on the identity.

Plain M-x ghostel singleton 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 in ghostel--project-buffers. make -j8 all passes.

Also verified live in a sandboxed Emacs session: a real local ghostel-project terminal 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.

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
dakra force-pushed the fix/344-remote-project-identity branch from ce5d474 to 61f11d7 Compare July 2, 2026 06:52
@dakra
dakra merged commit 61f11d7 into main Jul 2, 2026
24 checks passed
@dakra
dakra deleted the fix/344-remote-project-identity branch July 2, 2026 07:00
@dakra
dakra temporarily deployed to github-pages July 2, 2026 07:01 — with GitHub Actions Inactive
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.

Opened Ghostel buffer is confused with remote (TRAMP) variant

1 participant