xahlee / xah-fly-keys

the most efficient keybinding for emacs
http://xahlee.info/emacs/misc/xah-fly-keys.html
470 stars 80 forks source link

Add variables to customize M-x and search functions #84

Closed gcentauri closed 3 years ago

gcentauri commented 4 years ago

This still needs a bit of work, but i wanted to see what you think.

Probably these variables should be defcustom and I'm not sure if the initialization functions really make sense. The idea is that if the user does nothing, hopefully their preferred functions will be used automatically if helm or ivy is installed. if it doesn't work right, or the user wants to set it to a different function, then they can customize the variable.

I had this set up as a configuration layer for spacemacs, but since you're doing something similar to set the M-x function in the xah-fly-keys package, I thought maybe it would be better to have the logic here.

The other argument would be to only provide a custom variable and let the user handle it. This might be the "cleanest" way to do it, so that the xah-fly-keys package isn't using the fboundp logic to look for other possible functions. There's already an issue with the cond execution... if smex is above counsel-M-x for example, it takes over in my spacemacs config and uses smex instead and I have to manually set it anyway.

gcentauri commented 4 years ago

After a bit more research, it seems like it isn't the best practice to reference functions from other libraries directly. The best practice would be to use with-eval-after-load, but the documentation indicates that "well designed lisp progams" should not use it.

In order to make it easier for users of other packages (specifically Helm and Ivy I'm thinking of) to customize the command invoked by certain key bindings, it might be useful to introduce several defcustoms. I will rework this PR accordingly when I get time.

xahlee commented 4 years ago

i think this is good suggestion. Sorry been busy with family issues. I revisit later. though, i try not to become elaborate customization. Any customization, should be easily done by just pulling out the code and put in init file. Systematic customization tends to slow things now, bloats doc.

gcentauri commented 4 years ago

No worries, take your time. I've got this customized for myself and in the layer I made for Spacemacs. I can definitely see where adding more and more customization would make it harder to maintain. Let me know if there's anything you'd like me to help with.

xahlee commented 3 years ago

hi @gcentauri thanks. surely take me a long time. i think now it does have what you wanted... but the code has changed so much. sorry about that. right now, the command xah-fly-M-x search for smex or helm mx or counsel. no swiper. am going to add a dedicated var so people can set it.

gcentauri commented 3 years ago

thanks @xahlee - i've had my own custom thing working for a while. i'll update my xah-fly-keys and try it out. the package is still great for me every day!