0

I'm having a problem while invoking emacs to eval some elisp from the windows powershell.It seems to be a problem with the usage of quotes, but I can't figure that out:

This is the command that I'm executing:

PS> emacs.exe --eval '(with-current-buffer "*scratch*" (insert "Hi"))'

Then emacs opens and I get the following message in the *Backtrace* buffer:

Debugger entered--Lisp error: (void-variable *scratch*)
(set-buffer *scratch*)
(save-current-buffer (set-buffer *scratch*) (insert Hi))
(with-current-buffer *scratch* (insert Hi))
eval((with-current-buffer *scratch* (insert Hi)))
command-line-1(("--eval" "(with-current-buffer *scratch* (insert Hi))"))
command-line()
normal-top-level()

Any help on how to run this correctly would be awesome.

Thanks

5
  • @JordonBiondo I don't see a way how can the quotes can be escaped here. Any suggestion? Commented May 16, 2014 at 2:32
  • @quicoju It looks like this has all the information you could possibly need. Also, SO has a couple of related posts about escaping quotes in PowerShell... Commented May 16, 2014 at 6:19
  • What is *scratch*? Why in asterisks? The error says that var is void. Commented May 16, 2014 at 10:30
  • @Vesper That is the buffer's name, emacs should see this string as "*scratch*", but for some reason powershell isn't passing the double quotes to emacs. Commented May 16, 2014 at 12:50
  • After playing a while with the quotes, I realized that I need to pass the emacs' escape character for the double quotes. So the command that finally worked for me is: PS> emacs.exe --eval '(with-current-buffer \"*scratch*\" (insert \"Hi\"))' Thanks everyone for your help. Commented May 16, 2014 at 13:32

1 Answer 1

3

After playing a while with the quotes, I realized that I need to pass the emacs' escape character for the double quotes. So the command that finally worked for me is:

PS> emacs.exe --eval '(with-current-buffer \"*scratch*\" (insert \"Hi\"))'

Thanks everyone for your help.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.