<div dir="ltr">I think that it all comes down to this:<div><br></div><div>- emacsclient eval returns the results of expr quoted</div><div><br></div><div>- server-eval-at returns the results of expr unquoted.</div><div><br></div><div>Seemingly the former uses print or prin1 and the latter uses princ.</div><div><br></div><div>The whole reason for this helper script is that I don't want the results of eval auto-quoted, and I don't want to have to remove them myself.</div><div><br></div><div>I updated it all here:</div><div><br></div><div><a href="https://github.com/grettke/be2#about">https://github.com/grettke/be2#about</a><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat, Apr 3, 2021 at 12:16 AM Grant Rettke <<a href="mailto:grant@wisdomandwonder.com">grant@wisdomandwonder.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Oh this is why:<div><br></div><div><a href="https://emacs.stackexchange.com/questions/9391/why-is-emacsclient-inserting-quotes-around-output-strings" target="_blank">https://emacs.stackexchange.com/questions/9391/why-is-emacsclient-inserting-quotes-around-output-strings</a><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat, Apr 3, 2021 at 12:14 AM Grant Rettke <<a href="mailto:grant@wisdomandwonder.com" target="_blank">grant@wisdomandwonder.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">For example<div><br></div><div>Using emacsclient</div><div>✔ gsmac:~/src/be2 [main|✚ 1]> ./be2 "(corporate-bs-generator-make)"<br>OK...<br>"completely scale customized catalysts for change"<br><br></div><div>Using server-eval-at<br></div><div>✔ gsmac:~/src/be2 [main|✚ 1]> ./be2 "(corporate-bs-generator-make)"<br>OK...<br>appropriately reconceptualize professional relationships<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat, Apr 3, 2021 at 12:08 AM Grant Rettke <<a href="mailto:grant@wisdomandwonder.com" target="_blank">grant@wisdomandwonder.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">In the code I set up, instead of returning the value as it is displayed for a human to read, the output from `princ' to STDOUT is captured and returned as the value.<div><br></div><div>This seems to be the one thing I can't figure how to do with emacsclient.</div><div><br></div><div>The reason I need this is that in other programs I don't want to manage return values like "Hello world" should be two words instead of one word wrapped in double quotes.</div><div><br></div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat, Apr 3, 2021 at 12:03 AM Grant Rettke <<a href="mailto:grant@wisdomandwonder.com" target="_blank">grant@wisdomandwonder.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">The one thing I really wanted is to get the result without double-quotes. <div><br></div><div>I have to figure that out.</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Apr 2, 2021 at 5:49 PM Grant Rettke <<a href="mailto:grant@wisdomandwonder.com" target="_blank">grant@wisdomandwonder.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>---</div>/Applications/Emacs.app/Contents/MacOS/bin/emacsclient --socket-name="/Users/gcr/server-sockets/emacs.sock" --eval 'emacs-version'<br>OK...<br><br>"26.3"<br><div>---</div><div><br></div><div>Oh gosh.</div><div><br></div><div>---</div>/usr/bin/emacsclient --version<br>OK...<br><br><div>emacsclient 22.1</div><div>---<br></div><div><br></div><div>Lol.</div><div><br></div><div>---</div><div>✔ gsmac:~> ll /usr/local/bin/emacs <br>OK...<br><br>lrwxr-xr-x 1 gcr admin gcr 44 2019-11-22 21:24 "/usr/local/bin/emacs" -> "/Applications/Emacs.app/Contents/MacOS/Emacs"*<br>✔ gsmac:~> which emacsclient<br>OK...<br><br>/usr/bin/emacsclient<br>✔ gsmac:~> ll /usr/bin/emacsclient <br>OK...<br><br>-rwxr-xr-x 1 root wheel root 33k 2020-09-10 22:16 "/usr/bin/emacsclient"*<br>✔ gsmac:~></div><div>---</div><div><br></div><div>The problem: I forgot to link to the newer emacsclient. <br></div><div><br></div><div>Thank you Til.</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Apr 2, 2021 at 3:47 PM Grant Rettke <<a href="mailto:grant@wisdomandwonder.com" target="_blank">grant@wisdomandwonder.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Here is how it works for me:<div><br></div><div>✔ gsmac:~/src/be2 [main|✚ 2]> emacsclient --socket-name="/Users/gcr/server-sockets/emacs.sock" --eval 'emacs-version'<br>OK...<br><br>-emacs-pid 9230<br>-print "26.3"<br>✔ gsmac:~/src/be2 [main|✚ 2]> emacs --batch --eval "(progn (require 'server) (princ (server-eval-at \"/Users/gcr/server-sockets/emacs.sock\" 'emacs-version)))"<br>OK...<br><br>26.3</div><div>✔ gsmac:~/src/be2 [main|✚ 2]></div><div> <br></div><div>I just want the value 26.3 not the -emacs-pid and -print stuff.</div><div><br></div><div>I can't wait to try this on v27.</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Apr 2, 2021 at 3:24 PM Grant Rettke <<a href="mailto:grant@wisdomandwonder.com" target="_blank">grant@wisdomandwonder.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Forgot to share this is what it does on my machine:<div><br></div><div>---</div><div>emacsclient --socket-name="/Users/gcr/server-sockets/emacs.sock" --eval "(+ 1 1)"<br>OK...<br><br>-emacs-pid 9230<br>-print 2<br></div><div>---</div><div>emacsclient --socket-name="/Users/gcr/server-sockets/emacs.sock" --eval "emacs-version"<br>OK...<br><br>-emacs-pid 9230<br>-print "26.3"<br></div><div>---</div><div>emacsclient --socket-name="/Users/gcr/server-sockets/emacs.sock" --eval '(with-current-buffer "*scratch*" (insert "Hello scratch buffer"))'<br>OK...<br><br>-emacs-pid 9230<br>-print nil<br></div><div>---</div><div><br></div><div>Want to bet that it is because I'm on Emacs 26?</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Apr 2, 2021 at 2:37 PM Grant Rettke <<a href="mailto:grant@wisdomandwonder.com" target="_blank">grant@wisdomandwonder.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">My computer is trying to drive insane. That is what is happening here. And it is working.<div><br></div><div>It has to be working wrong on my machine.<br></div><div><br></div><div>Thanks for sharing that Til. </div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Apr 2, 2021 at 7:09 AM Tilmann Singer <<a href="mailto:tils@tils.net" target="_blank">tils@tils.net</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">I might be missing something obvious, but what exactly is it that<br>
emacsclient can not do? With a running Emacs instance in which<br>
(server-start) has been called before, the following commands on a<br>
terminal with the bash shell work out of the box for me:<br>
<br>
$ emacsclient -e "(+ 1 1)"<br>
2<br>
<br>
$ printf "How many is binary? $(emacsclient -e '(+ 1 1)')\n"<br>
How many is binary? 2<br>
<br>
$ emacsclient -e 'emacs-version'<br>
"27.2"<br>
<br>
$ emacsclient -e '(with-current-buffer "*scratch*" (insert "Hello scratch buffer"))'<br>
nil<br>
=> Text was inserted into buffer *scratch*<br>
<br>
<br>
At least on this (arch) linux machine, the default server-socket-dir of<br>
"/run/user/1000/emacs" seems to be working fine.<br>
<br>
<br>
Til<br>
</blockquote></div>
</blockquote></div>
</blockquote></div>
</blockquote></div>
</blockquote></div>
</blockquote></div>
</blockquote></div>
</blockquote></div>
</blockquote></div>