diff options
author | Ricardo Wurmus <ricardo.wurmus@mdc-berlin.de> | 2014-10-24 13:18:09 +0200 |
---|---|---|
committer | Ricardo Wurmus <ricardo.wurmus@mdc-berlin.de> | 2014-10-24 13:18:09 +0200 |
commit | 86e39f1ee3aa7222c81c0bf6d37195e56d091221 (patch) | |
tree | 74182b4ed35b5e18f43f8e10b99372d5b89e2c0b | |
parent | 57f77d55f3face142e69d192d04380a7e6438a6d (diff) |
store job alist and fields in text properties
-rw-r--r-- | grid-engine-mode.el | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/grid-engine-mode.el b/grid-engine-mode.el index 73c9c9d..b91c829 100644 --- a/grid-engine-mode.el +++ b/grid-engine-mode.el @@ -67,12 +67,22 @@ "Priority" "User" "State")) + (defun field-as-text (field obj &optional format-string) + (let* ((value (cdr (assoc field obj))) + (format-string (if format-string format-string + "%s")) + (text (format format-string value))) + (put-text-property 0 (length text) 'field value text) + text)) + (defun format-job-record (job) - (format row-pattern - (cdr (assoc 'job-id job)) - (cdr (assoc 'priority job)) - (cdr (assoc 'owner job)) - (cdr (assoc 'state job)))) + (let ((text (format row-pattern + (field-as-text 'job-id job) + (field-as-text 'priority job) + (field-as-text 'owner job) + (field-as-text 'state job)))) + (put-text-property 0 (length text) 'grid-engine-job job text) + text)) (defun mkjob-alist (subtree) "Convert a parsed XML subtree for a job entry to an alist." |