Skip to content

Commit

Permalink
feat(core): add proxy setup
Browse files Browse the repository at this point in the history
Signed-off-by: Abdelhak Bougouffa <abougouffa@fedoraproject.org>
  • Loading branch information
abougouffa committed Feb 8, 2024
1 parent b1d3779 commit 06fc5ec
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
18 changes: 18 additions & 0 deletions core/me-lib.el
Original file line number Diff line number Diff line change
Expand Up @@ -1758,6 +1758,24 @@ it forget them only when we are sure they don't exist."



;;; Proxy
;;; =====

(defun minemacs-enable-proxy ()
"Set *_proxy Linux environment variables from `minemacs-proxies'."
(interactive)
(dolist (prox minemacs-proxies)
(let ((var (format "%s_proxy" (car prox))))
(+info! "Set %S to %S" var (cdr prox))
(setenv var (cdr prox)))))

(defun minemacs-disable-proxy ()
"Unset *_proxy Linux environment variables."
(interactive)
(mapc #'setenv (mapcar (apply-partially #'format "%s_proxy") (mapcar #'car minemacs-proxies))))



;;; Keybinding macros
;;; =================

Expand Down
17 changes: 17 additions & 0 deletions core/me-vars.el
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,23 @@ MinEmacs hooks will be run in this order:
:group 'minemacs-core
:type 'hook)

(defcustom minemacs-proxies nil
"MinEmacs proxies.
Example, set it to:
\\='((\"no\" . \"localhost,127.0.0.1,.local,.mylocaltld\")
(\"ftp\" . \"http://myproxy.local:8080/\")
(\"http\" . \"http://myproxy.local:8080/\")
(\"https\" . \"http://myproxy.local:8080/\")))
These will set the environment variables \"no_proxy\", \"ftp_proxy\", ...
When set in \"early-config.el\" or in \"init-tweaks.el\", MinEmacs will enable
it automatically."
:group 'minemacs-core
:type '(repeat (cons string string)))

(defvaralias 'minemacs-build-functions-hook 'minemacs-build-functions)
(defvar minemacs-build-functions nil
"Special hook for build functions that are run after completing package updates.")
Expand Down

0 comments on commit 06fc5ec

Please sign in to comment.