We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 1de3cda commit 33f6fdfCopy full SHA for 33f6fdf
index.js
@@ -51,16 +51,15 @@ class EmacsLisp{
51
* Evaluate a string of Emacs Lisp code.
52
*
53
* @example eval("(+ 5 5)") -> "10"
54
- * @param {String} text
+ * @param {String} expr
55
* @return {Promise} Resolves with collected output.
56
*/
57
- eval(text){
+ eval(expr){
58
return new Promise((resolve, reject) => {
59
- const emacs = childProcess.spawn("emacs", [
60
- "--batch",
61
- "--eval",
62
- `(message "%s" ${text})`
63
- ]);
+ expr = expr.replace(/\r(?=\n)/g, "");
+ if(!/^\s*\(message\s+".+?%.+?"\s(?:.|\n)+\)\s*$/.test(expr))
+ expr = `(message "%s" ${expr})`;
+ const emacs = childProcess.spawn("emacs", ["--batch", "--eval", expr]);
64
65
let output = "";
66
emacs.stderr.on("data", data => {
0 commit comments