diff --git a/modules/home/users/msyds/emacs/lisp/syd/prelude.el b/modules/home/users/msyds/emacs/lisp/syd/prelude.el index b3a4c08..f752e91 100755 --- a/modules/home/users/msyds/emacs/lisp/syd/prelude.el +++ b/modules/home/users/msyds/emacs/lisp/syd/prelude.el @@ -227,4 +227,21 @@ form." 'confirm))) (insert choice)))) +(defun syd-import-systemd-environment () + (interactive) + (with-temp-buffer + (shell-command "systemctl --user show-environment" (current-buffer)) + (goto-char (point-min)) + (while (re-search-forward + (rx bol (group (+ (not "="))) + "=" + (or (and "$'" (group (* (not "'"))) "'") + (group (* any))) + eol) + nil t) + (let ((var (match-string 1)) + (val (or (match-string 2) + (match-string 3)))) + (setenv var val))))) + (provide 'syd/prelude)