shell-command-to-string -> doom-call-process #1887
Minor optimization to remove a layer of indirection when starting processes.
This commit is contained in:
parent
873fc5c0db
commit
44d5e097c9
5 changed files with 46 additions and 45 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue