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

Remove "oint" keybinding in racket-unicode input method #717

Merged
merged 3 commits into from
Sep 14, 2024

Conversation

bkc39
Copy link
Contributor

@bkc39 bkc39 commented Sep 10, 2024

The oint quail prefix activates when writing common identifiers such as point and pointer. This removes the binding from the input method out of convenience.

@greghendershott
Copy link
Owner

Thanks for the PR!

This is one feature I don't "dog food" myself. So I don't have any useful opinion. I'm happy to defer to you, and merge this.

Comment: I didn't realize these trigger in the middle of words. That seems... tricky.

Question: Just out of curiosity, are these case sensitive? If so, would it make any sense maybe to change it from "oint" to "Oint"?

(Not seeking a long discussion. Just wanted to ask before merging.)

@capfredf
Copy link
Contributor

I feel like we should use a leader/prefix key to turn on the unicode input method

@bkc39
Copy link
Contributor Author

bkc39 commented Sep 11, 2024

This is one feature I don't "dog food" myself. So I don't have any useful opinion. I'm happy to defer to you, and merge this.

Yea, this came up on the Racket Discord channel and some others seem to have experienced the same issue.

Comment: I didn't realize these trigger in the middle of words. That seems... tricky.

Yea what i generally do is C-g right before the last character to exit the quail completion.

Question: Just out of curiosity, are these case sensitive? If so, would it make any sense maybe to change it from "oint" to "Oint"?

The bindings are case sensitive. I would personally be fine with "Oint" as the mapping and agree that is better than removing the binding completely

@bkc39
Copy link
Contributor Author

bkc39 commented Sep 11, 2024

I feel like we should use a leader/prefix key to turn on the unicode input method

C-\ toggles the input method on and off. The issue with oint is that because oint is a common substring of Racket identifiers you end up having to toggle a lot.

@capfredf
Copy link
Contributor

I was not clear. In the agda2 mode, the Agda unicode input method is turned on by default, but one needs to press \ to input the unicode symbols.

@bkc39
Copy link
Contributor Author

bkc39 commented Sep 11, 2024

I would be fine with something similar to Agda mode. I also use the TeX input method which has the same convention as Agda, but I think that would be different enough behavior that we may want to consider making a different quail package altogether. If we decide on a name for the input method I would be fine adding something that has the same keybindings as racket-unicode but uses a prefix \ instead of a suffix space .

@greghendershott
Copy link
Owner

It looks like agda2-mode does this, not in the translation map itself, but via a user customization agda-input-tweak-all to tweak that map in various ways.

The customization is extremely generalized; including predefined functions. (First glance, I wonder is that excessive? But subsequent glances, maybe I'd say sure why not.)

@greghendershott
Copy link
Owner

In any case, some customizable prefix (and/or suffix?) seems the way to go.

For example, if I were using this mode, a \ prefix would drive me nuts given how often I need that for escapes in Racket strings and regexps. In fact that's bound to paredit-backslash for me. Also, I had to type \\ twice to escape itself here in this markdown comment. :)

@greghendershott
Copy link
Owner

It looks like agda2-mode does this, not in the translation map itself, but via a user customization agda-input-tweak-all to tweak that map in various ways.

The customization is extremely generalized; including predefined functions. (First glance, I wonder is that excessive? But subsequent glances, maybe I'd say sure why not.)

This seems like the right direction to proceed.

I'd be fine cargo-cult-ing all of the agda-mode code (because, hell, originally this was mostly cargo-cult-ed from haskell-mode). Of course, just using the rackety translations, instead.

I'd also be fine limiting the predefined utility functions, for users when customizing, to just the stuff pertaining to changing the prefix. No strong opinion here either way.

@bkc39 I don't know if this is something you would still like to do as a PR? If that feels like too much: I could take a crack at this, probably within a week after getting a finish on another issue I'm currently working on.

@bkc39
Copy link
Contributor Author

bkc39 commented Sep 14, 2024

@greghendershott I could probably take a swing at this this weekend. Do you think this should be included in this PR or submitted separately? Do you think we should update racket-unicode input method or make another that "inherits" from racket-unicode like they "inherit" from TeX in agda2-mode?

I actually have the beginnings of this in my personal config but I am not sure the best way to port it into the racket-mode package.

@greghendershott
Copy link
Owner

It seems that the existing translation table could be fine, provided there's a way users can customize a prefix or suffix?

If you do agree, then I'd say the PR could morph into or be replaced by the new "cargo cult agda2-input" plan.

But maybe you disagree, because you'd rather not type any prefix at all; you just want to change "oint" to "Oint" and you'd be happy? So for you the esting PR would suffice?

If so, that's OK, too. Just let me know. I could merge your simpler change, and then you or I could tackle the bigger change, later.

Or,

@bkc39
Copy link
Contributor Author

bkc39 commented Sep 14, 2024

It seems that the existing translation table could be fine, provided there's a way users can customize a prefix or suffix?

I agree.

But maybe you disagree, because you'd rather not type any prefix at all; you just want to change "oint" to "Oint" and you'd be happy? So for you the esting PR would suffice?

I think that in the immediate term the "oint" binding specifically is what I and others would like change and in that sense the existing PR would suffice to remove the pain point.

If so, that's OK, too. Just let me know. I could merge your simpler change, and then you or I could tackle the bigger change, later.

My preference would be to merge this change and then have a separate PR for the bigger change as that is likely to warrant more scrutiny.

@greghendershott greghendershott merged commit f0f1a7b into greghendershott:master Sep 14, 2024
8 checks passed
@greghendershott
Copy link
Owner

Merged; thanks!

@bkc39 bkc39 deleted the unbind-oint branch September 14, 2024 15:30
greghendershott added a commit that referenced this pull request Oct 18, 2024
Add two customization variables from which the quail input method is
defined: racket-input-prefix and racket-input-translations.

The prefix defaults to \ and avoids common conflicts.

Add a minor mode to activate the input method: racket-input-mode. The
old racket-unicode-input-method-enable is now just a defalias for
that.

Add a plain command, as an alternative to the input method as a way to
use racket-input-translations: racket-insert-symbol.

Closes #718.
Closes #723.

Related to already-closed issue #717: This commit reverts the change
from "oint" to "Oint", on the theory that it's unnecessary now with
the prefix. Even if someone wanted to have no prefix (like before),
they could easily M-x customize that, and they could easily M-x
customize "oint" back to "Oint" or whatever they want. TL;DR the whole
point of this commit is to enable most such changes to be a
customization instead of a PR.
@greghendershott
Copy link
Owner

@bkc39 I wanted to give you a heads up about commit 36c7062, which I just merged.

Among other things, it:

  • Adds a prefix, by default "\\" (a single backslash).
  • Reverts the change from "oint" to "Oint", because such conflicts should be moot with the prefix. e.g. "\oint" won't trigger annoyingly when you're trying to input "point".

If you try this, you might like it. But if you don't, you could restore things exactly to the previous status quo:

  • Customize racket-input-prefix to nil or "".
  • Customize racket-input-translations, to change the item for "oint" back to "Oint" (or delete the item entirely, if you prefer).

In other words the default should reduce conflicts. And for people who don't like a prefix, they can remove that, and racket-input-translations can now be customized without needing to make a PR.

I hope I explained this well; if you have any questions please let me know.

And thanks again contributing the original PR, it was helpful in the meantime!

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.

3 participants