diff --git a/src/emacs/server.lisp b/src/emacs/server.lisp index ce4ded56..1643ffd5 100644 --- a/src/emacs/server.lisp +++ b/src/emacs/server.lisp @@ -66,8 +66,11 @@ return a value json-serialize accepts: a plist, vector, string, number, t, :timeout timeout))) (handler-case (progn + ;; Like emacsclient, end every argument with a space; newer + ;; servers reject a request line that does not end in one. (write-string "-eval " stream) (write-string (emacs-server-quote form) stream) + (write-char #\Space stream) (write-char #\Newline stream) (finish-output stream) (emacs-server--read-reply stream)) diff --git a/tests/emacs-tests.lisp b/tests/emacs-tests.lisp index ee8e1540..6294460c 100644 --- a/tests/emacs-tests.lisp +++ b/tests/emacs-tests.lisp @@ -137,8 +137,8 @@ (format stream "-emacs-pid 42~%-print \"abc~%-print-nonl &_def\"~%"))) (test-assert (equal (emacs-server-evaluate socket "(foo bar)") "\"abc def\"") "Print chunks join and unquote."))) - (test-assert (equal request "-eval (foo&_bar)") - "The request is one quoted -eval line.") + (test-assert (equal request "-eval (foo&_bar) ") + "The request is one quoted -eval line ending in a space.") (join-thread (prog1 (emacs-test-serve-once socket