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

Make b command more useful #237

Open
rjkroege opened this issue Jun 1, 2019 · 4 comments
Open

Make b command more useful #237

rjkroege opened this issue Jun 1, 2019 · 4 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@rjkroege
Copy link
Owner

rjkroege commented Jun 1, 2019

Per #236, the sam b command requires a full filename path. This can be a lot of typing (or cutting and pasting). b would be easier to use if it permitted autocomplete or (much easier) a regexp match against the currently open files.

@rjkroege rjkroege added enhancement New feature or request good first issue Good for newcomers labels Jun 1, 2019
@rjkroege
Copy link
Owner Author

rjkroege commented Jun 1, 2019

Note: necessary changes probably go in ecmd.go:/func.*tofile and ecmd.go:/func.*alltofile.

@paul-lalonde
Copy link
Collaborator

Is a regexp the right way? Sam (but not acme it seems, having just tried it) allows a redirection to satisfy this, so you can use the shell to glob: b <ls a*.c
If we use a regexp we lose the ability to name files with regexp parts in the name.

@rjkroege
Copy link
Owner Author

This:

If we use a regexp we lose the ability to name files with regexp
parts in the name.

seems a quibble 😀 but this

Is a regexp the right way? Sam (but not acme it seems, having just tried
it) allows a redirection to satisfy this, so you can use the shell to glob:
b <ls a*.c

is an excellent point. I should have read the sam manual page before naïvely suggesting adding a regexp to the b command. Let's make it more like sam. Per man:

* b file-list
	Set the current file to the first file named in the list that sam
	also has in its menu.  The list may be expressed <Plan 9 command
 	in which case the file names are taken as words (in the shell
	sense) generated by the Plan 9 command.

I think that we can make the following clarifying assumptions:

  • the working directory for the invoked command is the one associated with the Window within which the b command executed
  • similarly for relative path arguments to b (this makes autocomplete work)
  • the "menu" is the set of currently open Edwood files

@camsn0w
Copy link
Contributor

camsn0w commented Jan 27, 2022

Is a regexp the right way? Sam (but not acme it seems, having just tried it) allows a redirection to satisfy this, so you can use the shell to glob: b <ls a*.c If we use a regexp we lose the ability to name files with regexp parts in the name.

Following Robert's instruction, I'll be adding tests and getting #418 in so that we've got a b command that does something. Afterwards I'll circle back and get into adding support for autocorrect. Also, there is a way to keep it working with filenames that include regex characters by not doing a regex search when the argument is a absolute path (begins with /), and I'll add this to the PR.
Thank you for the feedback Paul.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

3 participants