use underlying job alist to display job details
authorRicardo Wurmus <ricardo.wurmus@mdc-berlin.de>
Fri, 24 Oct 2014 11:18:52 +0000 (13:18 +0200)
committerRicardo Wurmus <ricardo.wurmus@mdc-berlin.de>
Fri, 24 Oct 2014 11:18:52 +0000 (13:18 +0200)
grid-engine-mode.el

index b91c829..988d4c5 100644 (file)
     (define-key grid-engine-map (kbd "<RET>")
       (lambda (&optional arg)
         (interactive)
-        (grid-engine-job-details (thing-at-point 'word) arg)))
+        (let ((field (get-text-property (point) 'field))
+              (job   (get-text-property (point) 'grid-engine-job)))
+          (unless (and field job)
+            (error "[Grid Engine] point is not on a field of a job record"))
+          (grid-engine-job-details field job arg))))
     (define-key grid-engine-map (kbd "g")
       (lambda () (interactive) (grid-engine-list-jobs)))))
 
     (grid-engine--raise-buffer)
     (message nil)))
 
-(defun grid-engine-job-details (job-id &optional new-buffer)
-;  (unless (number-or-marker-p job-id)
-;    (error "[Grid Engine] %s is not a valid job id."))
-  (let ((cmd   (concat grid-engine-qstat " -j " job-id))
-        (title (if new-buffer
-                   (concat "*grid-engine-job-details-" job-id "*")
-                 "*grid-engine-job-details*")))
+(defun grid-engine-job-details (field job &optional new-buffer)
+  (message (format "%s" job))
+  (let* ((job-id (cdr (assoc 'job-id job)))
+         (cmd    (concat grid-engine-qstat " -j " job-id))
+         (title  (if new-buffer
+                     (concat "*grid-engine-job-details-" job-id "*")
+                   "*grid-engine-job-details*")))
     (message "[Grid Engine] fetching details for job %s" job-id)
     (grid-engine--cmd-to-buffer cmd title)
     (grid-engine--split-buffer)))