-
-
Notifications
You must be signed in to change notification settings - Fork 68
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
ruby-block-send sends unexpected block #171
Comments
I realize if we're ok with depending on
|
Hi! Speaking of the first example, arguably, either of the behaviors can make sense. Do you maybe have an example of other major mode where block-related commands behave in this specific way? Just as a way of making this argument. |
Interesting, I'm just starting to learn ruby but I can see now some might expect the current behavior for the first example, that send block sends the next complete block after the cursor. To me at least though it's more intuitive that it sends the block the cursor is in. If anything the traditional send to repl commands for emacs I think are all sending the expression before the cursor not after. The one major mode I know with a comparable command is
It will print outer, inner, outer again. The list (pair of parenthesis around cursor), is equivalent in ruby I think to the block (begin/end pair around cursor). translating the example to python:
I have in my emacs config the function:
which behaves in this same way (sending the block the cursor is in), but I just copied that function from online somewhere, I don't think it's made it into any actual package. It's interesting |
You are right.
|
here if we do ruby send block with the cursor on the first
puts "outer"
, I think expected behavior is to send the block containingputs "outer"
but it sendsputs "inner"
block, asruby-send-block
is usingruby-end-of-block
which usesruby-move-to-block
which moves to what it calls the sibling block, in other words just the next end statement, not the end of the block containing the cursor.Another unexpected behavior is when the cursor is on the ending line of a block:
with the cursor on the end line of the first block,
ruby- block-send
sends the second block.In https://github.com/bo-tato/inf-ruby/tree/fix-ruby-send-block I change
ruby-send-block
to useer/ruby-forward-up
which gives the behavior I'd expect for both those cases. I don't open a pull request as that introduces a dependency onexpand-region
package that I assume is undesired. If it's desired to changeruby-send-block
to behave like this I can try to code it without adding extra dependencyThe text was updated successfully, but these errors were encountered: