feat(emacs): command to import systemd env

This commit is contained in:
2026-04-02 08:58:41 -06:00
parent ed18e5f850
commit 3c1b5191da

View File

@@ -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)