0

Since there is parameter I need to use, so I will not use single quote as the question's answer

First, I try

emacsclient -q --eval (progn (find-file "ORG/${UN}.org") (org-latex-export-to-pdf))

zsh: bad pattern: (progn (find-file ORG/Austin.org) (org-latex-export-to-pdf))

Then,

emacsclient -q --eval "(progn (find-file "ORG/${UN}.org") (org-latex-export-to-pdf))"

I get the error again

ERROR: Symbol’s value as variable is void: ORG/Austin\.org

The question is how to give the parameters.

Update

I still get error after backslash the period

emacsclient -q --eval "(progn (find-file "ORG/${UN}\.org") (org-latex-export-to-pdf))" 

ERROR: Symbol’s value as variable is void: ORG/Austin\.org

  • 1
    This is a zsh question and nothing to do with org-mode, org-export etc. . Have you tried to backslash the inner apostrophs ? – politza Oct 29 '16 at 21:57
  • @politza Still get error after backslash the period emacsclient -q --eval "(progn (find-file "ORG/${UN}\.org") (org-latex-export-to-pdf))" *ERROR*: Symbol’s value as variable is void: ORG/Austin\.org – yuxuan Oct 29 '16 at 22:24
  • ...(find-file \"ORG/${UN}\.org\")... – politza Oct 30 '16 at 1:37
1

Use either

emacsclient -q --eval "(progn (find-file \"ORG/${UN}.org\") (org-latex-export-to-pdf))"

or

emacsclient -q --eval '(progn (find-file "ORG/'"${UN}"'.org") (org-latex-export-to-pdf))'

The problem that needs to be solved is to give the string "ORG/Austin.org" rather than the symbol ORG/Austin.org to emacs.

0
emacs --batch foo.org -f org-latex-export-to-pdf
  • --batch: Run Emacs in batch mode
  • foo.org: Open foo.org and set it as current buffer (org.el is loaded by the way)
  • -f org-latex-export-to-pdf: Then call org-latex-export-to-pdf to export the current buffer to pdf

As your tries

emacsclient -q --eval (progn (find-file "ORG/${UN}.org") (org-latex-export-to-pdf))

you need quote your expression for shell since it contains white spaces.

emacsclient -q --eval "(progn (find-file "ORG/${UN}.org") (org-latex-export-to-pdf))"

you need escape the inner " because you are using " outside. You can refer to @icarus's answer, I think it's correct. However, instead of writing Lisp in your shell, you can just make a function in Emacs and call it using emacsclient from command line, for example,

(defun my-org-latex-export-to-pdf ()
  ...)

$ emacsclient --eval '(my-org-latex-export-to-pdf)'

In Emacs Lisp, you can use getenv to access value of environment variable if you need to.

-1

Use eval solve this question.

 eval "emacsclient -q --eval '(progn (find-file \"ORG/$UN.org\") (org-latex-export-to-pdf))'"
  • eval is a very useful and powerful feature of the shell, but is almost certainly the wrong tool for this. You just need to get the quotes correct, – icarus Oct 30 '16 at 1:59

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.