diff --git a/core/autoload/debug.el b/core/autoload/debug.el index f56eef252..92ef42ffe 100644 --- a/core/autoload/debug.el +++ b/core/autoload/debug.el @@ -32,9 +32,8 @@ ready to be pasted in a bug report on github." (doom-modules (doom-modules))) (cl-letf (((symbol-function 'sh) - (lambda (format) - (string-trim - (shell-command-to-string format))))) + (lambda (&rest args) + (cdr (apply #'doom-call-process args))))) `((emacs (version . ,emacs-version) (features ,@system-configuration-features) @@ -47,14 +46,14 @@ ready to be pasted in a bug report on github." 'server-running)))) (doom (version . ,doom-version) - (build . ,(sh "git log -1 --format=\"%D %h %ci\""))) + (build . ,(sh "git" "log" "-1" "--format=%D %h %ci"))) (system (type . ,system-type) (config . ,system-configuration) (shell . ,shell-file-name) (uname . ,(if IS-WINDOWS "n/a" - (sh "uname -msrv"))) + (sh "uname" "-msrv"))) (path . ,(mapcar #'abbreviate-file-name exec-path))) (config (envfile @@ -117,7 +116,7 @@ branch and commit." "n/a") (or (vc-git-working-revision doom-core-dir) "n/a") - (or (string-trim (shell-command-to-string "git log -1 --format=%ci")) + (or (cdr (doom-call-process "git" "log" "-1" "--format=%ci")) "n/a")))) ;;;###autoload diff --git a/core/autoload/help.el b/core/autoload/help.el index 085976af6..362ec25bc 100644 --- a/core/autoload/help.el +++ b/core/autoload/help.el @@ -395,13 +395,15 @@ current file is in, or d) the module associated with the current major mode (see (message "Couldn't find the config block")))))))) (defun doom--help-package-configs (package) - ;; TODO Add git checks, in case ~/.emacs.d isn't a git repo (let ((default-directory doom-emacs-dir)) + ;; TODO Use ripgrep instead (split-string - (shell-command-to-string - (format "git grep --no-break --no-heading --line-number '%s %s\\($\\| \\)' ':(exclude)*.org'" - "\\(^;;;###package\\|(after!\\|(use-package!\\)" - package)) + (cdr (doom-call-process + "git" "grep" "--no-break" "--no-heading" "--line-number" + (format "%s %s\\($\\| \\)" + "\\(^;;;###package\\|(after!\\|(use-package!\\)" + package) + ":(exclude)*.org")) "\n" t))) ;;;###autoload @@ -463,8 +465,8 @@ If prefix arg is present, refresh the cache." (`straight (format! "Straight (%s)\n%s" (let ((default-directory (straight--build-dir (symbol-name package)))) - (string-trim - (shell-command-to-string "git log -1 --format=\"%D %h %ci\""))) + (cdr + (doom-call-process "git" "log" "-1" "--format=%D %h %ci"))) (indent 13 (string-trim (pp-to-string diff --git a/modules/completion/ivy/autoload/ivy.el b/modules/completion/ivy/autoload/ivy.el index c264f8337..4dbd940d4 100644 --- a/modules/completion/ivy/autoload/ivy.el +++ b/modules/completion/ivy/autoload/ivy.el @@ -179,38 +179,38 @@ If ARG (universal argument), open selection in other-window." .type .file .line))))) (defun +ivy--tasks (target) - (let* (case-fold-search - (task-tags (mapcar #'car +ivy-task-tags)) - (cmd - (format "%s -H -S --no-heading -- %s %s" - (or (when-let (bin (executable-find "rg")) - (concat bin " --line-number")) - (when-let (bin (executable-find "ag")) - (concat bin " --numbers")) - (error "ripgrep & the_silver_searcher are unavailable")) - (shell-quote-argument - (concat "\\s(" - (string-join task-tags "|") - ")([\\s:]|\\([^)]+\\):?)")) - target))) - (save-match-data - (cl-loop with out = (shell-command-to-string cmd) - for x in (and out (split-string out "\n" t)) - when (condition-case-unless-debug ex + (let (case-fold-search) + (cl-loop with task-tags = (mapcar #'car +ivy-task-tags) + with out = + (cdr + (apply #'doom-call-process + (append + (or (when-let (bin (executable-find "rg")) + (list bin "--line-number")) + (when-let (bin (executable-find "ag")) + (list bin "--numbers")) + (user-error "ripgrep & the_silver_searcher are unavailable")) + (list "-H" "-S" "--no-heading" "--" + (concat "\\s(" + (string-join task-tags "|") + ")([\\s:]|\\([^)]+\\):?)") + target)))) + for x in (and out (split-string out "\n" t)) + when (condition-case-unless-debug ex (string-match (concat "^\\([^:]+\\):\\([0-9]+\\):.+\\(" (string-join task-tags "\\|") "\\):?\\s-*\\(.+\\)") x) - (error - (print! (red "Error matching task in file: (%s) %s") - (error-message-string ex) - (car (split-string x ":"))) - nil)) - collect `((type . ,(match-string 3 x)) - (desc . ,(match-string 4 x)) - (file . ,(match-string 1 x)) - (line . ,(match-string 2 x))))))) + (error + (print! (red "Error matching task in file: (%s) %s") + (error-message-string ex) + (car (split-string x ":"))) + nil)) + collect `((type . ,(match-string 3 x)) + (desc . ,(match-string 4 x)) + (file . ,(match-string 1 x)) + (line . ,(match-string 2 x)))))) (defun +ivy--tasks-open-action (x) "Jump to the file and line of the current task." diff --git a/modules/email/notmuch/autoload.el b/modules/email/notmuch/autoload.el index 211e45957..49fdd745f 100644 --- a/modules/email/notmuch/autoload.el +++ b/modules/email/notmuch/autoload.el @@ -100,7 +100,7 @@ (interactive) (let* ((msg-path (car (plist-get (notmuch-tree-get-message-properties) :filename))) (temp (make-temp-file "notmuch-message-" nil ".eml"))) - (shell-command-to-string (format "cp '%s' '%s'" msg-path temp)) + (doom-call-process "cp" msg-path temp) (start-process-shell-command "email" nil (format "xdg-open '%s'" temp)))) ;;;###autoload @@ -108,7 +108,7 @@ (interactive) (let* ((msg-path (car (plist-get (notmuch-show-get-message-properties) :filename))) (temp (make-temp-file "notmuch-message-" nil ".eml"))) - (shell-command-to-string (format "cp '%s' '%s'" msg-path temp)) + (doom-call-process "cp" msg-path temp) (start-process-shell-command "email" nil (format "xdg-open '%s'" temp)))) diff --git a/modules/lang/org/autoload/contrib-ipython.el b/modules/lang/org/autoload/contrib-ipython.el index 4e8e82ef3..e729a0711 100644 --- a/modules/lang/org/autoload/contrib-ipython.el +++ b/modules/lang/org/autoload/contrib-ipython.el @@ -21,12 +21,12 @@ Make sure your src block has a :session param.") (defun +org--ob-ipython-generate-local-path-from-remote (session host params) "Given a remote SESSION with PARAMS and corresponding HOST, copy remote config to local, start a jupyter console to generate a new one." (let* ((runtime-dir - (substring (shell-command-to-string (concat "ssh " host " jupyter --runtime-dir")) 0 -1)) + (cdr + (doom-call-process "ssh " host "jupyter" "--runtime-dir"))) (runtime-file (concat runtime-dir "/" "kernel-" session ".json")) (tramp-path (concat "/ssh:" host ":" runtime-file)) (tramp-copy (concat (or +ob-ipython-local-runtime-dir - (substring (shell-command-to-string "jupyter --runtime-dir") - 0 -1)) + (cdr (doom-call-process "jupyter" "--runtime-dir"))) "/remote-" host "-kernel-" session ".json")) (local-path (concat