emacsclient -e: nested shell quoting, one form only, and obarray is not a hash table
PitfallVerified 6 Oct 2026Holds anywhere
Pitfall. The symptom, what causes it, and the fix that was run and seen to work.
Symptom#
/bin/bash: -c: line 0: syntax error near unexpected token '('when complex Lisp goes through nested shell quoting.*ERROR*: End of file during parsingfromemacsclient -e.*ERROR*: Wrong type argument: hash-table-p, #<obarray ...>.
Cause#
- Nested quoting breaks the Lisp text.
emacsclient -eevaluates one Lisp form, so an unbalanced or multi-form expression fails to parse.gethashonly takes hash tables, andobarrayis not one.
Fix#
- Write the Lisp to a temporary
.elfile and load it with an absolute path, or use a simple-eexpression. - Wrap sequential operations in one balanced
progn. - Inspect an obarray with
intern-softor function predicates. - A relative
load-filepath throughemacsclientresolves underuser-emacs-directory, not the shell's directory (Cannot open load file: No such file or directory). Use an absolute path.
Evidence#
Seen in one Emacs configuration session; the note gives the errors and fixes.
Also found by searching
- /bin/bash: -c: line 0: syntax error near unexpected token '('
- *ERROR*: End of file during parsing emacsclient -e
- *ERROR*: Wrong type argument: hash-table-p, #<obarray
- how to run complex elisp through emacsclient from a shell