lokedhs / gnu-apl-mode

GNU APL mode for Emacs
GNU General Public License v3.0
94 stars 18 forks source link

FR: Make modifier key configurable #13

Closed Fabricationatorishnicatorist closed 8 years ago

Fabricationatorishnicatorist commented 8 years ago

First of all, thanks for creating this. I'm new to APL and this is so much better then typing in unicode hex codes into urxvt... :)

I use a tiling window manager and Super is dedicated to it. That fact is stored more deeply in my muscle memory than most generic human motor skills. I switched gnu-apl-mode to employ the unused Hyper key but this required editing the code and recompiling and will get clobbered next time you push an update to MELPA.

Would you please make the hotkey configurable via a customization option?

lokedhs commented 8 years ago

The way it's built right now isn't really very customisable. I have been thinking of better ways to handle the keymaps. I'll take another look and see what I can do.

On 8 November 2015 at 22:47, Fabricationatorishnicatorist < notifications@github.com> wrote:

First of all, thanks for creating this. I'm new to APL and this is so much better then typing in unicode hex codes into urxvt... :)

I use a tiling window manager and Super is dedicated to it. That fact is stored more deeply in my muscle memory than most generic human motor skills. I switched gnu-apl-mode to employ the unused Hyper key, but this required editing the code and recompiling, and will get clobbered next time you push an update to MELPA.

Would you please make the hotkey configurable via a customization option?

— Reply to this email directly or view it on GitHub https://github.com/lokedhs/gnu-apl-mode/issues/13.

Fabricationatorishnicatorist commented 8 years ago

I appreciate it, thank you.

grettke commented 8 years ago

Hi @lokedhs . Here is a patch that does not work to provide a customizable keymap prefix https://github.com/grettke/gnu-apl-mode/commit/2183d7a55ff474bbbcfe4c7d3dcbab1b0849b62f . Can you tell me more about the approach for the keybindings (why it isn't customizable)?

lokedhs commented 8 years ago

Hello Grant,

I'm not entirely sure what it is you're trying to do that won't work. Are you perhaps changing the value of gnu-apl-interactive-mode-map-prefix after the file was loaded? If so, you must also regenerate the value of gnu-apl-interactive-mode-map (as well as gnu-apl-mode-map).

Regards, Elias

On 9 June 2016 at 11:27, Grant Rettke notifications@github.com wrote:

Hi @lokedhs https://github.com/lokedhs . Here is a patch that does not work to provide a customizable keymap prefix grettke@2183d7a https://github.com/grettke/gnu-apl-mode/commit/2183d7a55ff474bbbcfe4c7d3dcbab1b0849b62f . Can you tell me more about the approach for the keybindings (why it isn't customizable)?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/lokedhs/gnu-apl-mode/issues/13#issuecomment-224791626, or mute the thread https://github.com/notifications/unsubscribe/AA-yk88VJp5yXbZ58dDIRscOTSvNFFHNks5qJ4g6gaJpZM4GeKst .

grettke commented 8 years ago

@lokedhs Hi Elias. You are right. The code is fine. I made a mistake using `customize'. When you set variables used by customize, you have to set them /before/ you load a library that uses customize. So even though I set the variables, they weren't considered. Is that what you meant by regenerating?

Either way: I will submit this as a patch because it does work as expected.

lokedhs commented 8 years ago

Thanks,

I do want you to update it such that you can go into customize and have the change immediately update the existing keymap.

Customize has a feature that allows you to configure a function to be called when a customisable setting is changed. When this is done the keymap has to be rebuilt.

Regards, Elias On 14 Jun 2016 23:14, "Grant Rettke" notifications@github.com wrote:

@lokedhs https://github.com/lokedhs Hi Elias. You are right. The code is fine. I made a mistake using `customize'. When you set variables used by customize, you have to set them /before/ you load a library that uses customize. So even though I set the variables, they weren't considered. Is that what you meant by regenerating?

Either way: I will submit this as a patch because it does work as expected.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/lokedhs/gnu-apl-mode/issues/13#issuecomment-226018416, or mute the thread https://github.com/notifications/unsubscribe/AA-yk3zi6cJXGHLScuBynAiN6Pfo20PKks5qLxm_gaJpZM4GeKst .

grettke commented 8 years ago

Hi Elias,

You are welcome. Gotcha. Will do.

Sincerely,

Grant Rettke

lokedhs commented 8 years ago

I have merged the fix as of 88070ad09670599da0750c6209e819b97ed2e821

grettke commented 8 years ago

Thank you @lokedhs .

lokedhs commented 8 years ago

I just noticed something. Your fix only changes the keymap for interactive mode, not the one used when editing .apl files.

Could you fix that too?

grettke commented 8 years ago

I had tested both interactive and editing mode.

Let me look again and test it out.

lokedhs commented 8 years ago

In that case, it's OK. I haven't tested editing mode. I just had that impression by looking at the code just now.

The first thing that struck me was that you had put the functions and variables in the file gnu-apl-interactive.el, and I didn't see any references to the other keymap in the diff (I could have misread).

grettke commented 8 years ago

Gotcha.

I was thinking that since the edit features were defined in gnu-apl-mode.el https://github.com/lokedhs/gnu-apl-mode/blob/master/gnu-apl-mode.el#L228-L256 that I should put them there and keep the interactive features in that file https://github.com/lokedhs/gnu-apl-mode/blob/master/gnu-apl-interactive.el#L197-L229 .

lokedhs commented 8 years ago

Does the fix made by @grettke solve this issue? Can we close it?

grettke commented 8 years ago

Yes it solves it because you can use Hyper like this:

(setq gnu-apl-mode-map-prefix "H-") (setq gnu-apl-interactive-mode-map-prefix "H-")

or use Customize.