I wrote a Python script to parse an org file that I keep my tasks in, reformat those tasks, and save them to a taskpaper file so that I can easily view and
process the tasks on my phone. The script works the way I want it to, but I have to
rememeber to run it every time I want my tasks to 'sync'. I
have been trying to use after-save-hook
to run the script whenever I save changes
to my org file, but I haven't been able to get it to work. I am new to Emacs, and
don't know much about lisp. This is what I have come up with based mostly on the
answer to this question.
(defun sync-to-taskpaper ()
"Sync org file to taskpaper file for mobile access"
(when (eq buffer-file-name "~/path/to/org/file.org")
(shell-command "python3 ~/path/to/python/script.py")))
(add-hook 'after-save-hook #'sync-to-taskpaper)
I am not getting any error messages when I save the file, it just is not running my custom function. Is it possible to do it this way, and if so, what am I missing? Thank you for your help!