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

Better interactive backward-kill-word #1680

Open
wants to merge 15 commits into
base: master
Choose a base branch
from
Open

Better interactive backward-kill-word #1680

wants to merge 15 commits into from

Conversation

r-zip
Copy link

@r-zip r-zip commented Oct 26, 2019

This PR implements a fix to backward-kill-word in interactive-haskell-mode.

The way things are currently implemented, calling backward-kill-word in the REPL causes the point to move to the beginning of the line if there is nothing else to delete on the line. The user then gets a message that the prompt text is read-only.

This is annoying for two reasons:

  1. The message about read-only prompt text clutters the minibuffer, and
  2. The user has to move the point past the prompt again to continue typing.

The changes in this PR improve the ergonomics of interactive-haskell-mode by detecting when backward-kill-word would move past the prompt. In that case, the point is just moved to right after the prompt.

I've chosen to re-bind backward-kill-word in the haskell-interactive-mode-map, and from what I can tell, it works.

I've never contributed a PR to an open-source project, but I've read the wiki page on contribution guidelines. The implementation has gotten more complex since I originally opened the PR, so if you guys want unit tests, I can write those.

Old behavior:
https://asciinema.org/a/OYRtYHCAUSNZjWq2NoCn4UEdb

New behavior:
https://asciinema.org/a/fm3Gd6WV1Q7IMWMzAxwcNQTCV

@r-zip r-zip changed the title Interactive mode backward kill word Better interactive mode backward kill word Oct 26, 2019
@r-zip r-zip changed the title Better interactive mode backward kill word Better interactive backward-kill-word Oct 26, 2019
@purcell
Copy link
Member

purcell commented Aug 12, 2021

Thanks for taking the time to submit this! I feel like there must be a more general way to tackle this, since many other commands exist which would need to be overridden in this way, e.g. backward-kill-sexp, kill-back-to-indentation etc.

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