diff options
Diffstat (limited to 'grid-engine-mode.el')
-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." |