parent
bb1e2247dd
commit
8402f8aecc
1 changed files with 12 additions and 12 deletions
|
@ -171,19 +171,11 @@ COMMAND, and passes ARGS to it."
|
|||
|
||||
(defun doom-cli--execute-after (lines)
|
||||
(let ((post-script (concat doom-local-dir ".doom.sh"))
|
||||
(coding-system-for-write 'utf-8)
|
||||
(coding-system-for-read 'utf-8)
|
||||
(delimiter "__EOF__"))
|
||||
(coding-system-for-write 'utf-8-unix)
|
||||
(coding-system-for-read 'utf-8-unix))
|
||||
(with-temp-file post-script
|
||||
(insert "#!/usr/bin/env sh\n"
|
||||
(save-match-data
|
||||
(cl-loop for env in process-environment
|
||||
if (string-match "^\\([a-zA-Z0-9_]+\\)=\\(.+\\)$" env)
|
||||
concat (format "%s=%s \\\n"
|
||||
(match-string 1 env)
|
||||
(shell-quote-argument (match-string 2 env)))))
|
||||
(format "PATH=\"%s:$PATH\" \\\n" (concat doom-emacs-dir "bin/"))
|
||||
"/usr/bin/env sh <<" delimiter "\n"
|
||||
"_postscript() {\n"
|
||||
"rm -f " (shell-quote-argument post-script) "\n"
|
||||
(if (stringp lines)
|
||||
lines
|
||||
|
@ -193,7 +185,15 @@ COMMAND, and passes ARGS to it."
|
|||
collect (mapconcat #'shell-quote-argument (remq nil line) " "))
|
||||
(list (mapconcat #'shell-quote-argument (remq nil lines) " ")))
|
||||
"\n"))
|
||||
"\n" delimiter "\n"))
|
||||
"\n}\n"
|
||||
(save-match-data
|
||||
(cl-loop for env in process-environment
|
||||
if (string-match "^\\([a-zA-Z0-9_]+\\)=\\(.+\\)$" env)
|
||||
concat (format "%s=%s \\\n"
|
||||
(match-string 1 env)
|
||||
(shell-quote-argument (match-string 2 env)))))
|
||||
(format "PATH=\"%s:$PATH\" \\\n" (concat doom-emacs-dir "bin/"))
|
||||
"_postscript $@\n"))
|
||||
(set-file-modes post-script #o700)))
|
||||
|
||||
(defun doom-cli-execute-lines-after (&rest lines)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue