Another great video! I would like to share one alternative I prefer by using the `cons` keyword on `defvar-keymap` example: ` "b" (cons "Buffer" my-test-buffer-map) ` Basically the same thing you are doing with grave and dots, but DRYer since you don't need to rebind all keys again with `which-key-add-keymap-based-replacements`
It works, thank you! I have a vague memory trying the equivalent with 'define-key' but it did not do the right thing. Maybe defvar-keymap expands to something else. I will have to check.
Thank you! This is exactly what I was looking for. Your videos are comprehensive and very detailed-oriented. I appreciate that very much. Thanks again.
Excellent video, thanks! Was great timing, as I'm currently in the middle of setting up some key prefixes. Question for you: From my initial research on this, I ended up using "define-prefix-command" instead of just "defvar"-ing a new keymap, since it seemed like you still get the backing keymap created with the additional ability to treat it like you would a command when setting up the key binds. Any particular reason you would prefer to just go with the plain keymap approach, or any downsides to "define-prefix-command" I should consider?
Thanks Prot. You are awesome as usual, I am trying the snippet but it works fine but i cannot see the menu like yours. when press C-t i dont see the menu. But it works. How can i get the interactive menu like yours? here is my snippet (defun test-command() (interactive) (message "This is a test" )) (keymap-set global-map "C-t" 'test-command (defvar-keymap my-test-prefix-map :doc "My prefix map" "f" 'find-file "d" 'dired "t" 'test-command) (keymap-set global-map "C-t" my-test-prefix-map)
I was using evil to help ease the pain on the left arm. But the hjkl only improve things for the right hand. I am experimenting with alternatives, including a different placement for modifiers keys. But, the real fix is to stay away from the keyboard as much as possible, which I have been doing for a while (if I type for ~30 minutes straight I start to fail a lot of pain).
Great video as always! As you talked about the news in Emacs 29, could you make a new video on completion? The one you have is 3 years old and there are some news in Emacs 29 about this topic. Also, I cannot make lsp-mode/corfu work as intended, lol.
Oh, I didn't realise it was that long ago... I will check. About lsp-mode+corfu, check that your language server is installed and everything is right with it.
Your help and videos have been invaluable to me I really appreciate your contributions to the comunity
Good to know. Thank you!
Another great video!
I would like to share one alternative I prefer by using the `cons` keyword on `defvar-keymap`
example: ` "b" (cons "Buffer" my-test-buffer-map) `
Basically the same thing you are doing with grave and dots, but DRYer since you don't need to rebind all keys again with `which-key-add-keymap-based-replacements`
It works, thank you! I have a vague memory trying the equivalent with 'define-key' but it did not do the right thing. Maybe defvar-keymap expands to something else. I will have to check.
Thanks for this tip! Just confirmed it worked for me (at least in Emacs 29).
As usual, there is plenty of practical, clearly-communicated knowledge to be gained here. Thanks for the excellent videos, Prot.
You are welcome!
Thank you! This is exactly what I was looking for.
Your videos are comprehensive and very detailed-oriented. I appreciate that very much. Thanks again.
You are welcome!
Thanks! I really appreciate the details in the examples, especially the "test-hello" back tick vs single quote example.
You are welcome!
Excellent video, thanks! Was great timing, as I'm currently in the middle of setting up some key prefixes.
Question for you: From my initial research on this, I ended up using "define-prefix-command" instead of just "defvar"-ing a new keymap, since it seemed like you still get the backing keymap created with the additional ability to treat it like you would a command when setting up the key binds. Any particular reason you would prefer to just go with the plain keymap approach, or any downsides to "define-prefix-command" I should consider?
Pretends to just show us how to do some basic customization, then turns us into Elisp hackers 😀. Great content.
Thank you!
In this video, Prot accidentally creates Evil mode 😂
It's all about getting started, haha!
clear and very helpful! THX for the great work!
You are welcome!
Any reason to change my general.el configuration into something like you have shown?
No. If it works, keep it. Also, I believe general.el is a macro that expands into the usual key bindings: it's fine.
thank you, great description
You are welcome!
This is nice ..Thank you
You are welcome!
Thanks Prot. You are awesome as usual, I am trying the snippet but it works fine but i cannot see the menu like yours. when press C-t i dont see the menu. But it works. How can i get the interactive menu like yours?
here is my snippet
(defun test-command()
(interactive)
(message "This is a test" ))
(keymap-set global-map "C-t" 'test-command
(defvar-keymap my-test-prefix-map
:doc "My prefix map"
"f" 'find-file
"d" 'dired
"t" 'test-command)
(keymap-set global-map "C-t" my-test-prefix-map)
You need to use 'which-key-mode'. It is provided by the 'which-key' package (this is built into Emacs 30, by the way).
Perfect! But how can I add a lambda to defvar-keymap?
Like this:
(defvar-keymap test
"a" (lambda () (interactive) (message "Hello!")))
(keymap-set global-map "C-t" test)
@@protesilaos
Very strange, I had tried that 😮😅
But can which-key display a meaningful name instead of lambda? Or only with a real function?
Thank you for the good video. I learned a lot!
Also, I saw that you're not using evil package anymore. Any reasons for that?
I was using evil to help ease the pain on the left arm. But the hjkl only improve things for the right hand. I am experimenting with alternatives, including a different placement for modifiers keys. But, the real fix is to stay away from the keyboard as much as possible, which I have been doing for a while (if I type for ~30 minutes straight I start to fail a lot of pain).
Great video as always! As you talked about the news in Emacs 29, could you make a new video on completion? The one you have is 3 years old and there are some news in Emacs 29 about this topic. Also, I cannot make lsp-mode/corfu work as intended, lol.
Oh, I didn't realise it was that long ago... I will check. About lsp-mode+corfu, check that your language server is installed and everything is right with it.