ergoemacs / ergoemacs-mode

ergoemacs-mode
ergoemacs.github.io/
GNU General Public License v3.0
293 stars 35 forks source link

Use passthrough for kill-line #508

Closed mattfidler closed 3 years ago

mattfidler commented 3 years ago

@wlandry:

This is a proof of concept, but should support the kill line equivalent key in gnus.

If you could try it out and it seems to work for you, I can try to apply it more broadly.

Unlike the last edition:

For me, the kill-line seems to work. I am unsure if it recorded the last command correctly.

mattfidler commented 3 years ago

It also recorded the last-command correctly. For kill-line this should work fine.

mattfidler commented 3 years ago

Some things probably shouldn't use this, though. Shift selection seems to break with a simple passthrough.

wlandry commented 3 years ago

For gnus, C-k does not just kill the one line. It runs gnus-summary-kill-same-subject, which kills a group of lines. It is sort of like killing a block. I do not see an equivalent ergoemacs binding.

I am also a bit concerned about how this is implemented. Enabling and disabling ergoemacs-mode sounds error prone.

mattfidler commented 3 years ago

Did you try it? It simply enables and disables the keymaps.

wlandry commented 3 years ago

I must have messed up something in my initial test. I just did a proper test, and it works correctly.

wlandry commented 3 years ago

Part of my unease with the implementation here is that I can not ask for all of the bindings in a gnus buffer and get a list that includes the binding of M-d to gnus-summary-kill-same-subject. I would prefer to manually bind all of the necessary keys. Then there is no magic.

mattfidler commented 3 years ago

Based on your prior feedback;

This means, by adding the following lines:

(setq ergoemacs-mode-send-emacs-keys nil
        ergoemacs-mode-unbind-emacs-keys nil)

The C-k would work as you thought it should in the past.

Part of my unease with the implementation here is that I can not ask for all of the bindings in a gnus buffer and get a list that includes the binding of M-d to gnus-summary-kill-same-subject. I would prefer to manually bind all of the necessary keys. Then there is no magic.

I think it is easier to describe the keys to show M-d is gnus-summary-kill-same-subject in the binding than to support manually binding each of the keymaps. However, this solution allows you to try different approaches.

mattfidler commented 3 years ago

I accidentally merged the opposite way...

mattfidler commented 3 years ago

@wlandry

Now the C-h ' shows the ergoemacs-mode keymap and describes the key ergoemacs key translations in the current buffer.

So, you should be able to see that M-d is gnus-summary-kill-same-subject by running that command in the gnus buffer

wlandry commented 3 years ago

I do not think that C-h ' should change depending on the minor mode. The main output of C-h ' is the picture, which is something that you can tape next to your monitor as a cheat sheet. The binding for M-d should show up when I type C-h b.

In any event, when I run C-h ' in a gnus summary buffer, it shows that M-d is bound to kill-line. Following the link for that function leads to documentation that starts

Its keys are remapped to ‘ergoemacs-kill-line’.  Without this
remapping, it would be bound to M-d, <deleteline>.

So there is still no sign that it will end up running gnus-summary-kill-same-subject.

mattfidler commented 3 years ago

Hm. I show no remaps. I will try again at this later...