Skip to content
This repository
Browse code

Changed the jobs list format

  • Loading branch information...
commit c50e1db73385f7830d2aa14beee7b3a758f4f713 1 parent e3eac79
François Févotte authored November 06, 2012

Showing 1 changed file with 13 additions and 9 deletions. Show diff stats Hide diff stats

  1. 22  slurm-mode.el
22  slurm-mode.el
@@ -96,6 +96,12 @@
96 96
 (defvar slurm-sort-switch)
97 97
 (defvar slurm-jobid)
98 98
 
  99
+;; WARNING: `slurm--user-column' must be updated when `slurm--jobslist-format' changes
  100
+(defconst slurm--jobslist-format "-o '%.7i %9P %37j %8u %2t %.4M %.5D %.4Q %40R'"
  101
+  "Formatting switch to be used when displayign the jobs list.")
  102
+(defconst slurm--user-column 56
  103
+  "Column at which the user-name is defined in the jobs list.")
  104
+
99 105
 (defun slurm-mode ()
100 106
   "Major-mode for interacting with slurm.
101 107
 
@@ -185,8 +191,7 @@ Customization variables:
185 191
   "Switch to slurm jobs list view."
186 192
   (interactive)
187 193
   (when (eq major-mode 'slurm-mode)
188  
-    (let ((format-switch "-o '%.7i %9P %30j %8u %2t %.10M %.5D %.5Q %40R'"))
189  
-      (setq slurm-command (format "squeue %s %s %s %s" format-switch slurm-user-switch slurm-partition-switch slurm-sort-switch)))
  194
+    (setq slurm-command (format "squeue %s %s %s %s" slurm--jobslist-format slurm-user-switch slurm-partition-switch slurm-sort-switch))
190 195
     (setq mode-name "Slurm (jobs list)")
191 196
     (setq slurm-view 'slurm-job-list)
192 197
     (slurm-refresh)))
@@ -300,13 +305,12 @@ ARG must be in a form suitable to be passed as a '-S' switch to the squeue comma
300 305
         (t                                  (error "Bad context for slurm-job-id"))))
301 306
 
302 307
 (defun slurm-job-user ()
303  
-  (let ((user-col 49))
304  
-    (save-excursion
305  
-      (beginning-of-line)
306  
-      (move-to-column user-col)
307  
-      (let ((begin (point)))
308  
-        (forward-word)
309  
-        (buffer-substring begin (point))))))
  308
+  (save-excursion
  309
+    (beginning-of-line)
  310
+    (move-to-column slurm--user-column)
  311
+    (let ((begin (point)))
  312
+      (forward-word)
  313
+      (buffer-substring begin (point)))))
310 314
 
311 315
 (defun slurm-job-user-details ()
312 316
   "Display details on the jub submitter, as returned by the shell `finger' utility."

0 notes on commit c50e1db

Please sign in to comment.
Something went wrong with that request. Please try again.