reddit / emacs

Multiple-cursors: only the first cursor jumps to the beginning of the line when I use Ctrl-a

WrinklyTidbits · 2022-03-23 19:12
When I use multiple-cursors it works great except when I want all the cursors to snap back to the beginning of the line. C-e works fine to have them all go to the end of their lines. C-a is bound to `crux-beginning-of-line`
WrinklyTidbits · 2022-03-23 19:22
Welp I solved it. I looked up where in my .emacs.d folder it was being bound and I removed it. It seems that multiple-cursors works well with vanilla emacs but not with the specific crux command
WrinklyTidbits · 2022-03-23 19:59
Even better solution: After rereading the README for multiple-cursors I was able to find the section that refers to `mc/cmds-to-run-once` being stored in \~/.emacs.d/.mc-lists.el I found `crux-beginning-of-line` in `mc/cmds-to-run-once` and moved it to `mc/cmds-to-run-for-all` Everything is working back to normal
ellakk · 2022-03-23 21:48
If you are like me and always want to run commands for all cursors, then you can enable the following option: ``` (setq mc/always-run-for-all t) ```
WrinklyTidbits · 2022-03-23 21:58
Thanks! That also looks like a great option!
dpoggio · 2022-03-23 22:02
This is usually a bad idea. Some commands, like `C-x C-s` will also be called multiple times, and every hook too. Togglers like `yas-minor-mode` will enable and disable multiple times, and so on. There are several commands to exclude.
ellakk · 2022-03-23 22:27
Well everyone's different I guess, works great for me, it's not hard to understand what you should and should not do when you know each command runs once for each cursor. I only wanted to show him that the option exists, if it does not work as he expects he can just disable it again :)
dpoggio · 2022-03-23 23:31
I just say: that is usually a bad idea. I can keep bringing examples on why: Say you press <ins> to enable overwrite-mode and you have 6 active cursors. Do you `C-g`, then press <ins> and then mark every cursor again? Or if you use Helm, then `helm-confirm-and-exit-minibuffer` is called 6 times. Say you are editing a ditaa block with 8 cursors and press `C-c C-e h o`, and you have like 10 more ditaa blocks. You will not just `C-g` 8 well placed cursors, but `org-export-dispatch` is supposed to be called just once. An so on. Most of these are daily use cases for me.