2

I would like to:

  1. run an emacs function from the shell
  2. in a standard emacs session (configured as if it was run in an interactive session)
  3. with a certain file in the active buffer

So I would like to do something like:

emacs --function org-beamer-export-to-pdf --file my-presentation.org

Bonus points if I can run it with the emacsclient, connecting to an already running emacs server.

5

This should do what you want. If you don't have the file open, you may need to replace the switch-to-buffer function to something that opens the file.

emacsclient -e '(progn (switch-to-buffer "my-presentation.org") (org-beamer-export-to-pdf))'
2
  • 1
    Great, I had to use find-file instead of switch-to-buffer – blueFast Sep 8 '16 at 5:33
  • Should I do somethings as follows: emacsclient -e '(progn (switch-to-buffer "foo.py"))' – alper May 10 '20 at 11:45

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.