dev: merging from master:
This commit is contained in:
commit
9cc792dd3a
8 changed files with 119 additions and 34 deletions
|
@ -1121,19 +1121,27 @@ Emacs' batch library lacks an implementation of the exec system call."
|
|||
(error "__DOOMSTEP envvar missing; extended `exit!' functionality will not work"))
|
||||
(let* ((pid (doom-cli-context-pid context))
|
||||
(step (doom-cli-context-step context))
|
||||
(shtype (or (getenv "__DOOMSH") "sh"))
|
||||
(context-file (format (doom-path temporary-file-directory "doom.%s.%s.context") pid step))
|
||||
(script-file (format (doom-path temporary-file-directory "doom.%s.%s.sh") pid step))
|
||||
(script-file (format (doom-path temporary-file-directory "doom.%s.%s.%s") pid step shtype))
|
||||
(command (if (listp args) (combine-and-quote-strings (remq nil args)) args))
|
||||
(persistent-files
|
||||
(combine-and-quote-strings (delq nil (list script-file context-file))))
|
||||
(persisted-env
|
||||
(save-match-data
|
||||
(cl-loop with initial-env = (get 'process-environment 'initial-value)
|
||||
for env in (seq-difference process-environment initial-env)
|
||||
if (string-match "^\\([a-zA-Z0-9_][^=]+\\)=\\(.+\\)$" env)
|
||||
collect (format "%s=%s"
|
||||
(match-string 1 env)
|
||||
(shell-quote-argument (match-string 2 env)))))))
|
||||
(cl-remove-if-not
|
||||
#'cdr (append
|
||||
`(("DOOMPROFILE" . ,(ignore-errors (doom-profile->id doom-profile)))
|
||||
("EMACSDIR" . ,doom-emacs-dir)
|
||||
("DOOMDIR" . ,doom-user-dir)
|
||||
("DEBUG" . ,(if init-file-debug "1"))
|
||||
("__DOOMPID" . ,(number-to-string (doom-cli-context-pid context)))
|
||||
("__DOOMSTEP" . ,(number-to-string (doom-cli-context-step context)))
|
||||
("__DOOMCONTEXT" . ,context-file))
|
||||
(save-match-data
|
||||
(cl-loop with initial-env = (get 'process-environment 'initial-value)
|
||||
for env in (seq-difference process-environment initial-env)
|
||||
if (string-match "^\\([a-zA-Z0-9_][^=]+\\)=\\(.+\\)$" env)
|
||||
collect (cons (match-string 1 env) (match-string 2 env))))))))
|
||||
(cl-incf (doom-cli-context-step context))
|
||||
(with-file-modes #o600
|
||||
(doom-log "restart: writing context to %s" context-file)
|
||||
|
@ -1154,25 +1162,35 @@ Emacs' batch library lacks an implementation of the exec system call."
|
|||
newcontext))
|
||||
(doom-log "restart: writing post-script to %s" script-file)
|
||||
(doom-file-write
|
||||
script-file `("#!/usr/bin/env sh\n"
|
||||
"trap _doomcleanup EXIT\n"
|
||||
"_doomcleanup() {\n rm -f " ,persistent-files "\n}\n"
|
||||
"_doomrun() {\n " ,command "\n}\n"
|
||||
,(string-join persisted-env " \\\n")
|
||||
,(cl-loop for (envvar . val)
|
||||
in `(("DOOMPROFILE" . ,(ignore-errors (doom-profile->id doom-profile)))
|
||||
("EMACSDIR" . ,doom-emacs-dir)
|
||||
("DOOMDIR" . ,doom-user-dir)
|
||||
("DEBUG" . ,(if init-file-debug "1"))
|
||||
("__DOOMSTEP" . ,(number-to-string (doom-cli-context-step context)))
|
||||
("__DOOMCONTEXT" . ,context-file))
|
||||
if val
|
||||
concat (format "%s=%s \\\n" envvar (shell-quote-argument val)))
|
||||
,(format "PATH=\"%s%s$PATH\" \\\n"
|
||||
(doom-path doom-emacs-dir "bin")
|
||||
path-separator)
|
||||
"_doomrun \"$@\"\n")))
|
||||
(doom-log "_doomrun: %s %s" (string-join persisted-env " ") command)
|
||||
script-file
|
||||
(pcase-exhaustive shtype
|
||||
("sh" `(,(if (featurep :system 'android)
|
||||
"#!/bin/sh\n"
|
||||
"#!/usr/bin/env sh\n")
|
||||
"trap _doomcleanup EXIT\n"
|
||||
"_doomcleanup() {\n rm -f " ,persistent-files "\n}\n"
|
||||
"_doomrun() {\n " ,command "\n}\n"
|
||||
,(cl-loop for (var . val) in persisted-env
|
||||
concat (format "%s=%s \\\n" var (shell-quote-argument val)))
|
||||
,(format "PATH=\"%s%s$PATH\" \\\n"
|
||||
(doom-path doom-emacs-dir "bin")
|
||||
path-separator)
|
||||
"_doomrun \"$@\"\n"))
|
||||
("ps1" `("try {\n"
|
||||
,(cl-loop for (var . val) in persisted-env
|
||||
concat (format " $__%s = $env:%s; $env:%s = %S\n "
|
||||
var var var val))
|
||||
,command
|
||||
"\n} finally {\n"
|
||||
,(cl-loop for file in persistent-files
|
||||
concat (format " Remove-Item -Path %S\n " file))
|
||||
,(cl-loop for (var . val) in envvars
|
||||
concat (format " $env:%s = $__%s\n " var var))
|
||||
"\n}")))))
|
||||
(doom-log "_doomrun: %s %s"
|
||||
(cl-loop for (var . val) in persisted-env
|
||||
concat (format "%s=%s \\\n" var (shell-quote-argument val)))
|
||||
command)
|
||||
(doom-log "_doomcleanup: %s" persistent-files)
|
||||
;; Error code 254 is special: it indicates to the caller that the
|
||||
;; post-script should be executed after this session ends. It's up to
|
||||
|
@ -1268,7 +1286,11 @@ Arguments don't have to be switches either."
|
|||
|
||||
ARGS are options passed to less. If DOOMPAGER is set, ARGS are ignored."
|
||||
(let ((pager (or doom-cli-pager (getenv "DOOMPAGER"))))
|
||||
(cond ((null (or pager (executable-find "less")))
|
||||
(cond ((equal (getenv "__DOOMSH") "ps1")
|
||||
;; Pager isn't supported in powershell
|
||||
(doom-cli--exit 0 context))
|
||||
|
||||
((null (or pager (executable-find "less")))
|
||||
(user-error "No pager set or available")
|
||||
(doom-cli--exit 1 context))
|
||||
|
||||
|
|
|
@ -589,7 +589,9 @@ windows, switch to `doom-fallback-buffer'. Otherwise, delegate to original
|
|||
(setq doom-theme theme)
|
||||
(put 'doom-theme 'previous-themes (or last-themes 'none))
|
||||
;; DEPRECATED Hook into `enable-theme-functions' when we target 29
|
||||
(doom-run-hooks 'doom-load-theme-hook))))))
|
||||
(doom-run-hooks 'doom-load-theme-hook)
|
||||
(setf (alist-get 'foreground-color default-frame-alist) (face-foreground 'default nil t)
|
||||
(alist-get 'background-color default-frame-alist) (face-background 'default nil t)))))))
|
||||
|
||||
|
||||
;;
|
||||
|
|
|
@ -121,7 +121,8 @@
|
|||
('darwin '(macos bsd))
|
||||
((or 'cygwin 'windows-nt 'ms-dos) '(windows))
|
||||
((or 'gnu 'gnu/linux) '(linux))
|
||||
((or 'gnu/kfreebsd 'berkeley-unix) '(linux bsd)))
|
||||
((or 'gnu/kfreebsd 'berkeley-unix) '(linux bsd))
|
||||
('android '(android)))
|
||||
"A list of symbols denoting available features in the active Doom profile.")
|
||||
|
||||
;; Convenience aliases for internal use only (may be removed later).
|
||||
|
|
|
@ -74,7 +74,12 @@ And jumps to your `doom!' block."
|
|||
,on-failure))
|
||||
nil 'local))))))
|
||||
|
||||
(defvar doom-reload-command "%s sync -B -e"
|
||||
(defvar doom-reload-command
|
||||
(format "%s sync -B -e"
|
||||
;; /usr/bin/env doesn't exist on Android
|
||||
(if (featurep :system 'android)
|
||||
"sh %%s"
|
||||
"%%s"))
|
||||
"Command that `doom/reload' runs.")
|
||||
;;;###autoload
|
||||
(defun doom/reload ()
|
||||
|
@ -138,7 +143,12 @@ imported into Emacs."
|
|||
(doom-load-envvars-file doom-env-file)
|
||||
(message "Reloaded %S" (abbreviate-file-name doom-env-file))))))
|
||||
|
||||
(defvar doom-upgrade-command "%s upgrade -B --force"
|
||||
(defvar doom-upgrade-command
|
||||
(format "%s upgrade -B --force"
|
||||
;; /usr/bin/env doesn't exist on Android
|
||||
(if (featurep :system 'android)
|
||||
"sh %%s"
|
||||
"%%s"))
|
||||
"Command that `doom/upgrade' runs.")
|
||||
;;;###autoload
|
||||
(defun doom/upgrade ()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue