Skip to content
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

Implement fsys SetBufferName operation #83

Draft
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

izuzak
Copy link
Contributor

@izuzak izuzak commented Jan 28, 2025

This is based on the discussion in #77 (comment).

Currently, it's not possible to do something like this:

$> echo "/Users/izuzak/Developer/ad/docs/tour/intro" | 9p write ad/buffers/1/filename
9p: write error: unknown file

As @sminez wrote in that issue:

All of the filesystem logic lives in the fsys module. The handler for writing to a buffer's filename file is here: https://github.com/sminez/ad/blob/develop/src%2Ffsys%2Fbuffer.rs#L249 (currently hard coded to return an error). To achieve what you're after you would need to alter that handler to send a message to the main event loop similar to how things are handled for writing to the body.

The behaviour around this in acme would be something like writing to the filename to update it to the file you wanted to swap to and then sending a command to reload that buffer from disk (to load the file content)

We'll use this PR to iterate towards a solution. List of things that need to be done:

  • Support file renaming. "It wouldn't be possible to rename a file (as the file not being found results in an error) and I think at least from how I've seen this used in acme this is an expected use case (update the filename of the "window" in acme terminology and then run Get to load that file into the window)."
  • Support changing buffer type. "The current buffer type is being retained rather than being set based on the new path, which would mean you would be unable to move from a file, to a directory or scratch buffer etc"

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.

1 participant