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

Use passthrough for kill-line #508

Merged
merged 7 commits into from
Oct 16, 2021
Merged

Use passthrough for kill-line #508

merged 7 commits into from
Oct 16, 2021

Conversation

mattfidler
Copy link
Member

@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:

  • ergoemacs-mode pushes the emacs keys to the unread keys stack (and tags it to be unrecorded).
  • Then all of ergoemacs-mode is turned off for that one command.
  • After the command is complete, ergoemacs-mode is turned back on.

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

@mattfidler
Copy link
Member Author

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

@mattfidler
Copy link
Member Author

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

@wlandry
Copy link
Contributor

wlandry commented Oct 15, 2021

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
Copy link
Member Author

mattfidler commented Oct 15, 2021

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

@wlandry
Copy link
Contributor

wlandry commented Oct 15, 2021

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

@wlandry
Copy link
Contributor

wlandry commented Oct 15, 2021

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
Copy link
Member Author

Based on your prior feedback;

  • Changed the variable for regular ergoemacs-mode keys to ergoemacs-mode-regular. This way the mode indicator is never modified while swapping keys (and would possibly avoid any unknown problems by avoiding convention).
  • Put back the kill-line in the standard ergoemacs-mode keymap as the default binding.
  • Added a remapping keymap ergoemacs--send-emacs-keys-map. When enabled with the variable ergoemacs-mode-send-emacs-keys, then emacs keys are sent, otherwise the bindings remain as is.

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 mattfidler merged commit 465d265 into master Oct 16, 2021
@mattfidler
Copy link
Member Author

I accidentally merged the opposite way...

@wlandry wlandry deleted the passthrough branch October 16, 2021 04:40
@mattfidler
Copy link
Member Author

@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
Copy link
Contributor

wlandry commented Oct 17, 2021

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
Copy link
Member Author

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

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

Successfully merging this pull request may close these issues.

2 participants