I'm interested in tracking how I spend my time at work. I have been using ManicTime, and it does much of what I want.
However, I use Emacs as my primary editor, and ManicTime doesn't know how to get info from Emacs. In its generic querying way, it attempts to get the window title (frequently in apps, the open document is in the title). For some apps, there are even plugins for ManicTime that are smarter about the target app.
I attempted to add a hook when switching buffers that wrote the Emacs PID and buffer name to a file that a plugin could read, but this did not work out very well for me. (My elisp could very well be suspect, but from a design perspective, this seems like a less than elegant and efficient solution.)
Is there a way to query Emacs from another process? This would be the simplest way to add Emacs support to ManicTime, but I don't know how to do it. Is there a good way?
emacs --daemon
, or calling(server-start)
in your config file), you can useemacsclient
to execute any elisp you want in the emacs process. If you have an an emacs function that returns the information you want, you could then do something likeemacsclient -e '(get-manic-time-data)'
(called from the command line), and then do whatever you need with the output.C-h i g (emacs)Emacs Server
frame-title-format
, such as buffer filename, directory name, and project name. I guess there is no other efficient way that a user can achieve. For example, your tracking app knows what URL and title Chrome is visiting because the Chrome app exposes the information in some way, however, the Emacs application probably doesn't do this. I'm using Timing, I use the buffer file name as Emacs's frame title, and Timing tracks it.