nonsequitur / inf-ruby

218 stars 68 forks source link

[FEAT] Create load current ruby file fn and key binding #154

Closed tunnes closed 2 years ago

tunnes commented 2 years ago

Create load current ruby file fn and key binding

What?

Currently, we already have the load ruby file feature, but it needs to provide a the file that must be loaded on the inferior Ruby process.

Why?

Usually, we might want to load the file that we are changing on the current buffer so buy having the possibility to just load the current file without typing anything on the mini-buffer could be very handy.

How?

Well, it was quite simple the implementation we just wrapped the ruby-load-file providing the current buffer to it, also we defined some default key bind to active that it was inspired on the Cider mode.

dgutov commented 2 years ago

I don't mind adding a new command, but what happens if you just press RET after typing C-c C-l?

Over here it consistently results in the current file being loaded.

tunnes commented 2 years ago

I don't mind adding a new command, but what happens if you just press RET after typing C-c C-l?

It appears the option to choose the file to be loaded on the mini buffer, and if I press RET after typing C-c C-l it will raise an error trying to load the first option that is the whole directory, here is a screenshot: Captura de Tela 2022-01-09 às 20 55 55

Over here it consistently results in the current file being loaded.

Yes, the idea is to load the file that is on the currently focused buffer to load another file with this fn or key bind is necessary to jump to the target file or use the traditional load with C-c C-l

tunnes commented 2 years ago

I'm noticed that to evaluate classes and modules using the send-* fn's we must load the target file so I've added this fn on my personal init.el file to interact faster with the evaluation fn's. So I thought that it could be useful to add to the project too 😬

dgutov commented 2 years ago

It appears the option to choose the file to be loaded on the mini buffer, and if I press RET after typing C-c C-l it will raise an error trying to load the first option that is the whole directory, here is a screenshot:

What completion system are you using?

It's a bit of a gray area, but with both Ido (which I'm still using myself) and Vertico (as I have just verified) pressing RET does the right thing: loads the current file.

Ivy and fido-mode don't have this advantage, though. It would be good to try to report that.

dgutov commented 2 years ago

Anyway, let's merge this. SLIME does have a similar command and binding after all.

It's a bit of a problem for my own pet IDE (it uses C-c C-k for "reload the whole rails project"), but that can be resolved there.

tunnes commented 2 years ago

What completion system are you using?

I'm using Ivy I didn't know that this could influence that, thank you for explaining I'll try to understand better what is happen so.

It's a bit of a problem for my own pet IDE (it uses C-c C-k for "reload the whole rails project"), but that can be resolved there.

@dgutov man are you sure? If you prefer we can avoid this change I'm don't want to cause trouble and also I've no strong feelings if this key bind is really useful to the general inf-ruby users, especially if it conflicts with the robe mode that seems more popular, this key binding was a handful to me while I was working on the previous PR and we also can remove the key binding and keep only the fn and the users interested on that behavior bind manually on their init.el 💭

dgutov commented 2 years ago

Nah, it is fine. Having to press RET every time has been a pain too, even though a minor one.

And it's good to mirror SLIME's bindings.

tunnes commented 2 years ago

Nah, it is fine. Having to press RET every time has been a pain too, even though a minor one.

And it's good to mirror SLIME's bindings.

Cool, I'm glad to know that, if you need something you can count on me.

Btw what is SLIME's meaning? Something simple or easy?

dgutov commented 2 years ago

SLIME is https://github.com/slime/slime/

It's the original Lisp IDE for Emacs.