feat(emacs): command to import systemd env
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user