X-Git-Url: https://git.rrq.au/?a=blobdiff_plain;f=enitool.lsp;h=af06741200aa4a374ef61b474b1e0f6446ffbbd0;hb=d0898f3ed152897f45f7f29a15ff1046531195c0;hp=21508a9e6e3c23339f09b02c9e02088976ad7ca8;hpb=59004c22f11bb4422658e4ae92ead10d42f590fb;p=rrq%2Fnewlisp-ftw.git diff --git a/enitool.lsp b/enitool.lsp index 21508a9..af06741 100755 --- a/enitool.lsp +++ b/enitool.lsp @@ -11,12 +11,13 @@ # right-arrow or return = follow to sourced file, or edit the current block # left-arrow or q = go up or exit -;(signal 2 (fn (x) (exit))) +(signal 2 (fn (x) (exit))) (when (!= "0" (if (exec "id -u") ($it 0) "")) - (let ((SUDO (if (exec "command -v sudo") ($it 0) "/usr/bin/sudo"))) - (wait-pid (process (join (cons SUDO (main-args) " "))))) - (exit 0)) + (let ((SUDO (if (exec "command -v sudo") ($it 0) "/usr/bin/sudo")) + (ED (format "env EDITOR=%s" (or (env "EDITOR") "nano"))) ) + (wait-pid (process (join (flat (list SUDO ED (main-args))) " "))) + (exit 0))) (constant ;; all "block starters", including blank lines