|
|
@ -10,6 +10,7 @@ const sexpr = require("sexpr-plus").parse;
|
|
|
|
$`echo $PWD`;
|
|
|
|
$`echo $PWD`;
|
|
|
|
|
|
|
|
|
|
|
|
const path = resolve(process.env.PWD, process.argv.slice(-1)[0]);
|
|
|
|
const path = resolve(process.env.PWD, process.argv.slice(-1)[0]);
|
|
|
|
|
|
|
|
const fs = require("fs").promises;
|
|
|
|
|
|
|
|
|
|
|
|
const mail_body = (await $`mu view ${path} -o sexp`).stdout;
|
|
|
|
const mail_body = (await $`mu view ${path} -o sexp`).stdout;
|
|
|
|
|
|
|
|
|
|
|
@ -61,7 +62,16 @@ if (!html.includes(`<meta charset="utf-8"`)) {
|
|
|
|
const attachments = (await $`mu extract ${path}`).stdout;
|
|
|
|
const attachments = (await $`mu extract ${path}`).stdout;
|
|
|
|
|
|
|
|
|
|
|
|
async function emacsEval(expr) {
|
|
|
|
async function emacsEval(expr) {
|
|
|
|
return (await $`emacsclient --eval ${expr}`).stdout.slice(0, -1); // slice to remove trailing newline;
|
|
|
|
const filename = `/tmp/${Math.random()}${Math.random()}${Math.random()}${Math.random()}${Math.random()}.el`;
|
|
|
|
|
|
|
|
await fs.writeFile(filename, expr);
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
|
|
|
await $`emacsclient --eval ${`(eval
|
|
|
|
|
|
|
|
(ignore-errors
|
|
|
|
|
|
|
|
(read-from-whole-string
|
|
|
|
|
|
|
|
(with-temp-buffer
|
|
|
|
|
|
|
|
(insert-file-contents "${filename}")
|
|
|
|
|
|
|
|
(buffer-string)))))`}`
|
|
|
|
|
|
|
|
).stdout.slice(0, -1); // slice to remove trailing newline;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
async function getSimpleHeader(body_sexp, header_name) {
|
|
|
|
async function getSimpleHeader(body_sexp, header_name) {
|
|
|
|