Function: majutsu-jj--editor-command-from-env
majutsu-jj--editor-command-from-env is a natively compiled function
defined in majutsu-jj.el.
Signature
(majutsu-jj--editor-command-from-env)
Documentation
Return with-editor command words from majutsu-with-editor-envvar.
Source Code
;; Defined in /nix/store/jagqw3nms546pad0gxi5f3wsckk6pji7-emacs-packages-deps/share/emacs/site-lisp/majutsu-jj.el
(defun majutsu-jj--editor-command-from-env ()
"Return with-editor command words from `majutsu-with-editor-envvar'."
(let ((raw (getenv majutsu-with-editor-envvar)))
(unless (and raw (not (equal raw "")))
(user-error "Missing %s in process environment" majutsu-with-editor-envvar))
(condition-case err
(let ((words
;; `split-string-shell-command' can mis-parse with-editor's
;; sleeping editor and yield only ("wait" "$sleep").
;; Detect `PROGRAM -c 'SCRIPT'' forms directly and preserve
;; the script as a single argument.
(or (and (string-match "\\`\\([^[:space:]]+\\)[[:space:]]+-c[[:space:]]+'" raw)
(let ((program (match-string 1 raw))
(start (match-end 0)))
(when (and (<= start (length raw))
(string-suffix-p "'" raw))
(list program "-c" (substring raw start -1)))))
(split-string-shell-command raw))))
(unless words
(user-error "%s is empty" majutsu-with-editor-envvar))
words)
(error
(user-error "Failed to parse %s: %s"
majutsu-with-editor-envvar
(error-message-string err))))))