summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Bennée <alex.bennee@linaro.org>2016-04-28 15:00:05 +0100
committerAlex Bennée <alex.bennee@linaro.org>2016-04-28 15:00:05 +0100
commit1d53783164cb988b6218316b08f914c64f255cd9 (patch)
tree81dbb48b9be5adfad559b6c6bb9c8212fb89e894
parent44a5ba7b578e0411f4235ff4f1488bc27bb5b79f (diff)
lava-mode: split into lava-json-mode and lava-yaml-mode
-rw-r--r--lava-json-mode.el (renamed from lava-mode.el)25
-rw-r--r--lava-yaml-mode.el56
2 files changed, 79 insertions, 2 deletions
diff --git a/lava-mode.el b/lava-json-mode.el
index ee13dee..82c099d 100644
--- a/lava-mode.el
+++ b/lava-json-mode.el
@@ -1,4 +1,4 @@
-;;; lava-mode --- A derivative of JSON mode for interacting with Lava
+;;; lava-json-mode --- A derivative of JSON mode for interacting with Lava
;;
;; Copyright (C) 2014 Alex Bennée
@@ -44,7 +44,7 @@
"LAVA specific keywords.")
(defvar lava-mode-elisp-escape-regex
- "`\\((.*)\\)`"
+ "`\\(.*\\)`"
"Regexp that describes the escape syntax for embedded elisp.")
(defvar lava-font-lock-defaults
@@ -84,6 +84,11 @@ bits are correctly tagged.")
"The current test repository, used for insertion into jobs.")
(make-variable-buffer-local 'lava-mode-test-repository)
+(defvar lava-mode-default-bundle-stream
+ nil
+ "The default bundle stream, used for job insertion.")
+(make-variable-buffer-local 'lava-mode-default-bundle-stream)
+
;;; Mode magic
(defvar lava-mode-map
(let ((map (make-sparse-keymap)))
@@ -213,6 +218,21 @@ first device in the list."
(setq lava-mode-current-device (car restrictions)))
lava-mode-current-device)
+(defun lava-mode-current-device-param (param &optional device-name default)
+ "Return a named `PARAM' from the
+ `lava-mode-default-device-image-alist'.
+
+You can pass an optional `DEVICE-NAME' otherwise it defaults to
+`lava-mode-current-device'. The optional `DEFAULT' will return that
+value if nothing is set."
+ (let* ((device (or device-name lava-mode-current-device))
+ (imgspec (assoc device lava-mode-default-device-image-alist)))
+ (unless imgspec
+ (error "No device image for: %s" device))
+ (or
+ (cdr (assoc param (cdr imgspec)))
+ default)))
+
(defun lava-mode-current-device-image(&optional device-name)
"Insert the correct device image starting stanza."
(let* ((device (or device-name lava-mode-current-device))
@@ -275,6 +295,7 @@ If `nth' is defined then find the nth latest file"
(when latest
(lava-jobs-get-actual-device latest))))
+; (lava-mode-device-running-latest "mustang-hacking-session")
; (lava-mode-device-running-latest "mustang-cloudimg-hacking-session")
; (lava-mode-device-running-latest '("mustang-cloudimg-hacking-session" "mustang-cloudimg-continue"))
diff --git a/lava-yaml-mode.el b/lava-yaml-mode.el
new file mode 100644
index 0000000..b61d81d
--- /dev/null
+++ b/lava-yaml-mode.el
@@ -0,0 +1,56 @@
+;;; lava-yaml-mode --- A derived mode for handling YAML LAVA jobs
+;;
+;; Copyright (C) 2014 Alex Bennée
+
+;; Author: Alex Bennée <alex.bennee@linaro.org>
+;; Maintainer: Alex Bennée <alex.bennee@linaro.org>
+;; Version: 0.1
+;; Homepage: git.linaro.org/alex.bennee/lava-mode.git
+
+;; This file is not part of GNU Emacs.
+
+;; This file is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 3, or (at your option)
+;; any later version.
+
+;; This file is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program. If not, see <http://www.gnu.org/licenses/>.
+;;
+;;; Commentary:
+;;
+;; This provides a simple derived mode for submitting LAVA jobs in the
+;; new YAML mode format.
+;;
+;;; Code:
+
+;; Require prerequisites
+(require 'lava-rpc)
+(require 'lava-job-list-mode)
+
+;; Variables
+
+;;; Mode magic
+(defvar lava-yaml-mode-map
+ (let ((map (make-sparse-keymap)))
+ (define-key map (kbd "C-c C-c") 'lava-yaml-mode-done)
+ map)
+ "Keymap for major mode `lava-yaml-mode'.")
+
+;; Define the mode
+;;###autoload
+(define-derived-mode lava-yaml-mode yaml-mode ""
+ "A derivitive of YAML mode for handing new style
+LAVA jobs .
+
+\{lava-yaml-mode-map}"
+ :lighter " "
+ (message "in derived mode"))
+
+(provide 'lava-yaml-mode)
+;;; lava-yaml-mode.el ends here