I want to log my usage of M-x in emacs to a file so that I can see which functions I should learn the shortcut to / bind a shortcut for. This would preferably just append the names of the used functions to a file/emacs-buffer, maybe with a timestamp, so that I can see in what context I use them. Does anyone know how to solve this?
I would suggest adding an advisory function to
I have been meaning to learn how to use advise, so I will be editing this comment later with working elisp code once I have code that does this (should be less than ten lines).
based on Trey Jackson's very wonderful work, here is my additional version:
This logs the timestamp, the command, and the keybindings, and does not obscure any echos from the m-x commands.
You will have to save the log file manually like you would any other emacs buffer, unlike Trey's version. There may be a compromise possible where the file is written to but there is no message echod to the minibuffer obscuring results of a command.
Edit: On re-reading I believe that I have answered the wrong question. You might have been better off asking this on Stack Overflow since the answer probably required hacking elisp.
will get you the documentation on
will show the current function bound to any key stroke
will list all active key binding
You can start with this elisp, which will simply add the commands you execute to a given log file. You can get fancier and do automatic tallying if you want. Or, you can occasionally just pipe the file through a