For Emacs, how do I store what view-lossage collects into an external file? Ideally I’d like to store these keystroke data into an external log file incrementally and automatically, meaning it is done so by default when Emacs is started.
For Emacs, how do I store what view-lossage collects into an external file? Ideally
Share
In Emacs 24 at least (I can’t check a prior version right now), the docstring for
view-lossagestates:And C-hf
open-dribble-fileRET tells me:So simply add something like the following to your .emacs file:
Experimentally this clobbers the file if it already exists, so you’ll need to deal with that.
Here’s one approach. It accounts for multiple Emacs sessions by using
make-temp-nameto generate a semi-random filename for the dribble file, and then appends the contents of that to a primary lossage log file when Emacs exists. (If Emacs crashes, it would leave behind the temp file for you to deal with manually.)