Skip to content

Commit 1376299

Browse files
authored
add mason-command-overrides (#10)
1 parent fe14918 commit 1376299

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

mason.el

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,16 @@ Will be matched case-insensitively."
6565
:type '(repeat regexp)
6666
:group 'mason)
6767

68+
(defcustom mason-command-overrides '()
69+
"Alist of command and its path to be used in `mason--process'.
70+
This in turn will be used instead of resolving from `exec-path'.
71+
72+
Example:
73+
;; Use python from ~/.local/bin instead of /usr/bin.
74+
(setq mason-command-overrides `''((\"python\" . \"~/.local/bin/python\")))"
75+
:type '(alist :key-type string :value-type string)
76+
:group 'mason)
77+
6878

6979
;; Keybinds
7080

@@ -191,9 +201,11 @@ CWD is the working directory.
191201
THEN is a function to call after process succeed.
192202
THEN needs to accept a parameter, indicating if the process succeeded."
193203
(declare (indent defun))
194-
(let ((prog (car cmd))
195-
(msg (mapconcat #'mason--quote cmd " "))
196-
(process-environment process-environment))
204+
(let* ((prog (car cmd))
205+
(prog (or (cdr (assoc-string prog mason-command-overrides)) prog))
206+
(cmd (cons prog (cdr cmd)))
207+
(msg (mapconcat #'mason--quote cmd " "))
208+
(process-environment process-environment))
197209
(when env
198210
(dolist (e (nreverse env))
199211
(let ((k (car e)) (v (cdr e)))

0 commit comments

Comments
 (0)