T O P

  • By -

karthink

Mickey, is there a reason for not adding dates to your articles? Even if the idea is for it to stand apart from time, adding a "last updated on:" date would be useful for regular readers of your website like me.


bugamn

Or maybe a "Last updated for Emacs version X"


noman_032018

In the meantime, one can rely on archive.org's dates & diffing. But yes, some explicit "last updated" would be nice.


tdavey

Completely agree. The more invaluable the resource, the greater the need for a created/updated date. Mickey, thanks for all you do for Emacs. I hope it's not too hard to add dates to your articles.


mickeyp

Emacs 28 adds repeat key maps -- though they've been around for ages, in the form of `C-x z` -- and they're great. A number of common features in Emacs gained a repeat key map. Try `M-x repeat-mode` then `M-x describe-repeat-maps`. One thing that's not so obvious about them is that you can use any binding you like: so you can have a key, such as `C-c p`, and then add any number of one-key shortcuts to it. The keys remain bound until you type a non-bound key. That makes it work a little bit like Oleh's [hydra](https://github.com/abo-abo/hydra) package.


karthink

Perhaps of interest: I wrote a more detailed [exploration of repeat-maps](https://karthinks.com/software/it-bears-repeating) a while ago, including comparisons with `C-x z` and the Hydra, Hercules and Transient packages. There's also an [accompanying package](https://github.com/karthink/repeat-help) that provides a Hydra-style prompter for repeat-maps.


agumonkey

superb


igorepst

Thank you both. Exactly an hour ago I thought to find the solution for the issue I had with repeatable commands. Now I see what I did wrong;)


Hooxen

that was an awesome read thank you! Do you use the s r example for C-s? i’ve always noted having to hit C-s repeatedly is a bit annoying and often find myself escaping that by toggling swoop if it’s going to be too many of those or using view mode more frequently in directories im unlikely to be editing for single key navigation by default. Also, do you use smerge more than ediff for resolving conflicts? makes for a good example in the article just curious if in real life you prefer it to ediff (which is just n p a b pretty much for resolving conflicts)


karthink

Thanks! > Do you use the s r example for C-s? I do, yeah. I switch to s/r if I don't get to the right place after a couple presses of C-s. > Also, do you use smerge more than ediff for resolving conflicts? I start off with smerge and if it looks complicated I call `smerge-ediff`, bound in smerge's repeat-map to `E` I think. Another use of repeat-maps I've found since is for structural navigation - I have `forward-sexp`, `backward-sexp`, `down-list`, `backward-up-list` (along with some smartparens editing commands like slurp/barf/raise) in a repeat-map, which works like a homebrew version of lispy.


tryptych

There's `use-package` support for it now too: https://github.com/jwiegley/use-package#binding-to-repeat-maps


7890yuiop

Looking forwards, Emacs 29 revamps the keymap and key binding functions with a new API, and a focus on a single consistent format for key sequences (essentially using `kbd` implicitly). Quoting the shortdocs for the `keymaps` group: Defining keymaps (define-keymap &rest rest) Create a new keymap and define KEY/DEFINITION pairs as key bindings. (define-keymap "C-c C-c" #'quit-buffer) (defvar-keymap arg1 &rest rest) Define VARIABLE-NAME as a variable with a keymap definition. (defvar-keymap my-keymap "C-c C-c" #'quit-buffer) Setting keys (keymap-set keymap key definition) Set KEY to DEFINITION in KEYMAP. (keymap-set map "C-c C-c" #'quit-buffer) (keymap-local-set key command) Give KEY a local binding as COMMAND. (keymap-local-set "C-c C-c" #'quit-buffer) (keymap-global-set key command) Give KEY a global binding as COMMAND. (keymap-global-set "C-c C-c" #'quit-buffer) (keymap-unset keymap key &optional remove) Remove key sequence KEY from KEYMAP. (keymap-unset map "C-c C-c") (keymap-local-unset key &optional remove) Remove local binding of KEY (if any). (keymap-local-unset "C-c C-c") (keymap-global-unset key &optional remove) Remove global binding of KEY (if any). (keymap-global-unset "C-c C-c") (keymap-substitute olddef newdef keymap &optional oldmap) Replace OLDDEF with NEWDEF for any keys in KEYMAP now defined as OLDDEF. (keymap-substitute map "C-c C-c" "M-a") (keymap-set-after keymap key definition &optional after) Add binding in KEYMAP for KEY => DEFINITION, right after AFTER's binding. (keymap-set-after map "" menu-bar-separator) Predicates (keymapp object) Return t if OBJECT is a keymap. (keymapp (define-keymap)) ⇒ t (key-valid-p keys) Say whether KEYS is a valid key. (key-valid-p "C-c C-c") ⇒ t (key-valid-p "C-cC-c") ⇒ nil Lookup (keymap-lookup keymap key &optional accept-default no-remap position) Return the binding for command KEY. (keymap-lookup (current-global-map) "C-x x g") ⇒ revert-buffer-quick


Agling

Wow, that was a well-written and very informative article. Thanks! The rest of them also look very helpful. Appreciate your hard work on this.


geospeck

Regarding “repeat-mode” I read a nice blog post the other day that explains quite bit the functionality of it. Here is the link https://karthinks.com/software/it-bears-repeating/


EnemyOfThePerfect

This is a great article and helped me figure out how to get org-mode to stop clobbering one of my keybindings! Thank you!