reddit / emacs

What function does evil mode run when I press :w?

asimpleperson123 · 2022-05-29 17:44
I was wondering what function evil mode ran when I pressed `:w` I tried using `C-h k` and then I pressed `:w` but it only registered the `:` I pressed and showed me information about `evil-ex` function instead of showing me what function is run when I save the file using `:w`.
nv-elisp · 2022-05-29 17:59
That's enough info to point you in the right direction. If you search evil's source for "evil-ex", I'll bet you can find it.
sylvain_soliman · 2022-05-29 18:11
You can look at the value of `evil-ex-commands` to see what emacs command is run for each ex command.
tom_dl · 2022-05-29 19:04
`evil-write` see evil-maps.el for all ex commands
organic-bookworm · 2022-05-29 19:32
You've already got specific answers. As a more general approach to quickly scratch unobvious places, you could use (or abuse?) built-in [profiler](https://www.gnu.org/software/emacs/manual/html_node/elisp/Profiling.html): 1. `profiler-start` 2. Run the `:w` command 3. `profiler-report` 4. `profiler-stop` This will display a call tree, which should help you narrow down to specific functions you can e.g. read or [debug](https://www.gnu.org/software/emacs/manual/html_node/elisp/Function-Debugging.html).
asimpleperson123 · 2022-05-29 20:49
Thanks!
00-11 · 2022-05-30 14:15
https://stackoverflow.com/q/72425739/729907
pragmat1c1 · 2022-06-15 10:42
Excellent infos! Saved! Thanks for sharing.