Comments (13)
Sorry! Yes, I broke that way of doing it. I switched to a better way of storing the keys that doesn't rely on strings. This should work for you
(which-key-add-key-based-replacements
"C-x 8" "unicode"
"C-x a" "abbrev/expand"
...
)
from emacs-which-key.
I just realized that I didn't update the README. Doing that now..
from emacs-which-key.
Cool! I will try that. While you are doing that, you can also mark that var as deprecated.
from emacs-which-key.
Well... It's not deprecated because I'm still using it. Maybe I screwed up, but my intention was for people to use the helper functions, which are used the same way. At least the readme is correct now. Sorry for the confusion.
from emacs-which-key.
No problem. Your suggested method brings back the functionality. Thanks for the quick reply!
from emacs-which-key.
If you wish, you can make that a defvar
instead of a defcustom
and rename it to which-key--key-based-description-replacement-alist
(Note the which-key--
prefix). That will give a clear indication that users are not supposed to tinker with it.
from emacs-which-key.
That's a good idea. I'll do that soon. Thanks
from emacs-which-key.
@kaushalmodi Do you think I should use a message or a warning for the old variable?
from emacs-which-key.
I believe a warning would be justified as it's a signification change in the structure of that alist.
I had a related suggestion; why not merge these two into a single function and set the major mode specific options ".dir-locals.el style":
Before
(which-key-add-key-based-replacements
"C-x C-f" "find files")
(which-key-add-major-mode-key-based-replacements 'org-mode
"C-c C-c" "Org C-c C-c"
"C-c C-a" "Org Attach")
After
(which-key-add-key-based-replacements
'((nil . (("C-x C-f" . "find files")))
(org-mode . (("C-c C-c" . "Org C-c C-c")
("C-c C-a" . "Org Attach")))))
This might need a quite some code reworking. So it can be understood if you choose not to take this approach.
from emacs-which-key.
I think what I'll do is switch to defvar as you suggested but not change the name. I can put some code in there to detect if the old style of key string is being used and warn then, but also do the conversion automatically.
Thanks, I'll think about your suggestion for the function change. I think I find the current way more readable at a glance.
from emacs-which-key.
I pushed the changes. I opted not to change the variable names, but just to add code that fixes the old format if necessary for backwards compatibility. It will print a message now if it detects the old format.
Thanks for the report. Your old code should work now too, actually, but the new way will be preferred going forward.
from emacs-which-key.
@kaushalmodi Are you happy with the solution?
from emacs-which-key.
Yes, thanks!
from emacs-which-key.
Related Issues (20)
- which-key crashes when trying to display term-raw-map HOT 1
- How to switch among different pages of keys conveniently in which-key mode? HOT 1
- which-key can’t show keys: There is not enough space based on your settings and frame size HOT 2
- Customize which-key-C-h-dispatch prompt HOT 1
- Make "<prefix> C-h" display which key and prompt for command at the same time HOT 3
- The texts for the same key in different keymaps are overridden each other HOT 2
- Question about `which-key-undo` HOT 1
- which-key is good enough to be built-into Emacs HOT 1
- Question about full description popups HOT 3
- Automatic expansion of unnamed prefixes
- misoperation
- Once which-key popup is triggered via which-key-show-early-on-C-h all delays are ignored afterwards HOT 1
- Which-key shows wrong labels from inactive keymaps HOT 1
- Side window is too narrow HOT 1
- Scrolling/ moving the screen
- How can I hide keys from the which-key popup? HOT 2
- Paging hint suggests C-h even when it's bound under given prefix and won't work HOT 1
- Which-key side-window cuts off some rows HOT 6
- Does paging work for `<escape>-` key sequences? HOT 2
- Error running timer ‘which-key--update’: (void-function take) HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from emacs-which-key.