5

For some org-mode files, I would like to run specific commands when that file is opened for editing. These commands should be written in the heading of the file somewhere near the #+CONFIG bits.

E.g in my 'WeeklyReport.org' I would like it to automatically run my function NavigateToOrCreateThisWeek()

Is this possible?

As an alternative, I currently have functions that load a file and then do something. But I'd like to instruct the functions to be ran when ever I open that file.

7

When using eval with Emacs file-speicfic variables, then any valid lisp function can be specified at the top of the file as show here:

;; Local Variables:
;; eval: (myFunction arg1 arg2)
;; End:

If you need variable arguments based on org-mode features, then you can combine the above with in-buffer settings available for org-mode files.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.