diff options
author | Alex Bennée <alex.bennee@linaro.org> | 2015-01-07 16:41:54 +0000 |
---|---|---|
committer | Alex Bennée <alex.bennee@linaro.org> | 2015-01-07 16:41:54 +0000 |
commit | 338b4e771f9b6b1c6a8b15a0f4a39324cd4ac8f5 (patch) | |
tree | 1fbe4104d22b930142ba829d3f9a207fc0a39aac | |
parent | ea8f87ddfb4f63eab0e16ca3df7953b60da60e17 (diff) |
lava-mode: add OPTIONAL parameter to the current-device function.
Now you can add (lava-mode-current-device '("mustang" "arndale")) to
your json and have the system default to the first entry if it's not
set.
-rw-r--r-- | lava-mode.el | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/lava-mode.el b/lava-mode.el index e72c231..0ff03cc 100644 --- a/lava-mode.el +++ b/lava-mode.el @@ -197,8 +197,17 @@ lisp." ;; Utility functions ; these can be used in jobs by using `lava-mode-elisp-escape-regex' to ; escape your elisp. -(defun lava-mode-current-device () - "Return the current device" +(defun lava-mode-current-device (&optional restrictions) + "Return the current device. + +The optional `RESTRICTIONS' is a list of device types this job +supports. If the current device is not set it will get set to the +first device in the list." + (when (and restrictions + (--none? + (string-match lava-mode-current-device it) + restrictions)) + (setq lava-mode-current-device (car restrictions))) lava-mode-current-device) (defun lava-mode-current-device-image(&optional device-name) |