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

Comments on Embark Key Bindings #168

Open
hmelman opened this issue Feb 25, 2021 · 21 comments
Open

Comments on Embark Key Bindings #168

hmelman opened this issue Feb 25, 2021 · 21 comments

Comments

@hmelman
Copy link

hmelman commented Feb 25, 2021

From comments in Consult Issue #210 I took a look at the default embark bindings. Here are some comments, though I don't think any of these are particularly important, they're just things I thought of that might be worth considering.

  • I agree that the find-definition commands should move from "d" to "."
  • I think that delete-file should stay on "d" as other delete commands are on "d" and it's natural.
  • The package and bookmark maps move embark-insert to "I" so maybe it should just be that in the general map. Then the three other maps that bind commands to "I" can bind them to the more natural "i" and "I" can be more consistent.
  • The region map binds fill-region to "f". That's fine, but the other obvious choice is "q" since M-q is fill-paragraph and I think q is less likely to have a future conflict than f.
  • Maybe bind "*" in the region map to calc-grab-region. I'd love it if calc-grab-sum-down and calc-grab-sum-across were bound to ":" and "_" but they're not autoloaded and little known. They would be more convenient from embark than their existing bindings on C-x * :. But they're probably better in personal configs, maybe it's with a comment in a readme or wiki.
  • It's fine that embark-browse-package-url is on "u" but FWIW paradox puts the equivalent on "v" for visit homepage
@oantolin
Copy link
Owner

oantolin commented Mar 2, 2021

calc-grab-region should automatically detect whether the region is a rectangle and if so act as calc-grab-rectangle. 😠

@oantolin
Copy link
Owner

oantolin commented Mar 2, 2021

I think you are right about moving embark-insert to I, to free up i which several other commands seem to want. There are a couple of things giving me pause:

  • Should I then also move embark-save to w for consistency? I think probably the answer is no: I think embark-save is probably much more common an action than embark-insert so it's OK if it gets a prized lowercase binding while embark-insert needs a modifier.

  • In the file map there are actions to insert or save a relative path bound to W and I. If embark-insert moved to I, would I bind embark-insert-relative-path to i? That would leave it flipped with respect to w/W, which sounds like a bad idea.

Any thoughts?

@hmelman
Copy link
Author

hmelman commented Mar 2, 2021

Assuming embark-insert moves to I. embark-save could move for consistency, that could the relative problem (both on lowercase). Or leave save on w and use something else like r or C-i for file's relative version.

@hmelman
Copy link
Author

hmelman commented Sep 1, 2021

FWIW I submitted emacs bug #50311 to have calc-grab-sum-down and calc-grab-sum-across autoload by emacs.

@hmelman
Copy link
Author

hmelman commented Sep 1, 2021

That went well, they'll be autoloaded in emacs 28.

@oantolin
Copy link
Owner

oantolin commented Sep 1, 2021

Let's celebrate by binding them in embark-region-map (I guess I need to add the autoloads for now, but will be able to remove them in a few years when I drop support for 27.1.)

Hey, now that you have an in with the maintainers, maybe you could propose that calc-grab-region call calc-grab-rectangle if the region is rectangular.

@oantolin
Copy link
Owner

oantolin commented Sep 1, 2021

Mmh, Should Embark have a separate embark-rectangular-region-map? A few extra actions only make sense for rectangles, right?

@oantolin
Copy link
Owner

oantolin commented Sep 1, 2021

Well, the rectangle commands very reasonably act on the rectangle between mark and point whether or not you are using rectangle-mode. So actually, they could just be added to the region map.

@hmelman
Copy link
Author

hmelman commented Sep 1, 2021

Yeah, I don't understand what you mean, aren't all regions rectangular? It's just how you interpret what mark and point delimit.

I don't seem to have a rectangle-mode so I don't know what that is.

@oantolin
Copy link
Owner

oantolin commented Sep 1, 2021

Sorry, I got the name of the mode wrong. It is called rectangle-mark-mode and is bound by default to C-x SPC. I'm sure you are familiar with it, it's what makes the region highlight look rectangular and adds a special yank-handler to a rectangular region so that a later C-y automatically behaves as yank-rectangle.

@oantolin
Copy link
Owner

oantolin commented Sep 1, 2021

So, yes all regions can be considered as rectangular, but when the user explicitly turns on rectangular-mark-mode she is signalling that she intends to use the region as a rectangle. Personally the only rectangle commands I use are string-rectangle and rectangle-number-lines, and I only ever using them after using C-x SPC to turn on rectangle-mark-mode (which is unnecessary!).

@hmelman
Copy link
Author

hmelman commented Sep 1, 2021

Ah. I have heard of rectangle-mark-mode but don't use it (and never remember about it). I use string-rectangle many times a day but didn't know (or completely forgot) about rectangle-number-lines, that definitely looks useful.

FWIW, I've now bound the following which may interest you (the 2nd conflicts with a binding of undo which seems odd to me):

(define-key rectangle-mark-mode-map (kbd "C-:") 'calc-grab-sum-down)
(define-key rectangle-mark-mode-map (kbd "C-_") 'calc-grab-sum-across)

@oantolin
Copy link
Owner

oantolin commented Sep 1, 2021

the 2nd conflicts with a binding of undo which seems odd to me

I know that undo binding very well! I prefer C-/, but had one keyboard where C-/ was very awkward to type (can't remember what layout it had), so one that one keyboard I always used C-_ instead.

For some reason it had never occurred to me to bind things in rectangle-mark-mode-map, what a great idea, thanks! It's like a built-in version of the selected package, but only for rectangles. I think I'll add your bindings (without C-, why use modifiers when they aren't necessary) and rectangle-number-lines there.

I forgot to say earlier that for string-rectangle I never use C-x r t, only C-t in the rectangle-mark-mode-map (so I even knew about the damn keymap but it never occurred to me to bind stuff there!).

@hmelman
Copy link
Author

hmelman commented Sep 1, 2021

Hmmm, I'm on a mac with apple's command key set as a super key, so I mostly use s-z for undo in emacs, sometimes falling back on C-x u. I never got into C-/ but I guess it's popular.

I thought about not using the C- modifier for the binding but then though I might want to type those characters, though that does seem unlikely.

So instead of C-x r t you use C-x SPC C-t which while a little more involved to type, gives you better highlighting of the region. Not sure it's worth it to me in the string-rectangle case but in using calc-grab-sum-down I definitely wished for the rectangular highlighting.

@oantolin
Copy link
Owner

oantolin commented Sep 1, 2021

So instead of C-x r t you use C-x SPC C-t which while a little more involved to type, gives you better highlighting of the region.

But C-x SPC also sets the mark. So it's really C-x SPC (move around) C-t vs C-SPC (move around) C-x r t, which I think is a close call.

@hmelman
Copy link
Author

hmelman commented Sep 1, 2021

But C-x SPC also sets the mark. So it's really C-x SPC (move around) C-t vs C-SPC (move around) C-x r t

Ahh, yeah that is kinda nice. We'll see if I can remember that.

@hmelman
Copy link
Author

hmelman commented Sep 5, 2021

Hey, now that you have an in with the maintainers, maybe you could propose that calc-grab-region call calc-grab-rectangle if the region is rectangular.

So would it just be this:

calc-grab-region should check if rectangle-mark-mode is non-nil and if so it should behave as calc-grab-rectangle otherwise it should work as it does.

@oantolin
Copy link
Owner

oantolin commented Sep 5, 2021

Yes, that's what I had in mind.

@hmelman
Copy link
Author

hmelman commented Sep 5, 2021

It's now Emacs Bug #50403

@hmelman
Copy link
Author

hmelman commented Sep 6, 2021

Fixed, will be in Emacs 28 :)

@oantolin
Copy link
Owner

oantolin commented Sep 6, 2021

Good! Thanks for doing that @hmelman.

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

No branches or pull requests

2 participants