]> code.delx.au - gnu-emacs-elpa/blobdiff - packages/arbitools/arbitools.el
* packages/arbitools: endoffile bug fixed
[gnu-emacs-elpa] / packages / arbitools / arbitools.el
index 7f2a4deea840341b1b81823784b6a5366993e9c2..9275676a7dce4bb3bd6edcb7244617c1758695cb 100644 (file)
 
 ;;; Code:
 
-(defun arbitools-update (list)
+(defun arbitools-update (elolist)
   "Update the players ratings."
-  (interactive "slist:")
+  (interactive "selolist:")
   ;; FIXME: What if `list' is "foo; bar"?
-  ;; FIXME: Do we really need a shell here?
-  ;; Why not use just call-process, so we don't need to worry about quoting?
-  (shell-command (concat "arbitools-update.py -l " list  " -i "
-                         (shell-quote-argument buffer-file-name))))
+  (call-process "arbitools-run.py" nil nil nil "update" buffer-file-name "-l" elolist))
 
 (defun arbitools-add (addfile)
   "Add players to an existing file."
-  ;; FIXME: is `addfile' a file?  If o, then use "f" rather than "s", else
-  ;; better give it another name!
-  (interactive "saddfile: ")
+  (interactive "faddfile: ")
   ;; FIXME: What if `addlist' is "foo; bar"?
-  ;; FIXME: Do we really need a shell here?
-  ;; Why not use just call-process, so we don't need to worry about quoting?
-  (shell-command (concat "arbitools-add.py -a " addfile " -i "
-                         (shell-quote-argument buffer-file-name))))
+  (call-process "arbitools-add.py" nil nil nil "-a" addfile "-i" buffer-file-name))
 
 (defun arbitools-standings ()
   "Get standings and report files from a tournament file."
   (interactive)
   ;; (shell-command (concat (expand-file-name "arbitools-standings.py") " -i " buffer-file-name))) ;this is to use the actual path
-  ;; FIXME: Do we really need a shell here?
-  ;; Why not use just call-process, so we don't need to worry about quoting?
-  (shell-command (concat "arbitools-standings.py -i "
-                         (shell-quote-argument buffer-file-name))))
+  (call-process "arbitools-standings.py" nil nil nil "-i" buffer-file-name))
+
+(defun arbitools-it3 ()
+   "Get the IT3 tournament report."
+   (interactive)
+   (call-process "arbitools-run.py" nil nil nil "it3" buffer-file-name))
+
+(defun arbitools-fedarating ()
+   "Get the FEDA rating admin file."
+   (interactive)
+   (call-process "arbitools-run.py" nil nil nil "fedarating" buffer-file-name))
+
+(defvar arbitools-mode-map
+  (let ((map (make-sparse-keymap)))
+    (define-key map (kbd "C-c i") 'coffee-compile-buffer)
+    map)
+  "Keymap for Arbitools major mode.")
+
+
+(easy-menu-define arbitools-mode-menu arbitools-mode-map
+  "Menu for Arbitools mode"
+  '("Arbitools"
+    ["Get It3" arbitools-it3]
+    "---"
+    ))
+
 
 (defvar arbitools-highlights
- '(("^001" . font-lock-function-name-face) ;name of the tournament
-   ;; ("\\( b \\)\\|\\( w \\)\\|\\( - \\)" . font-lock-keyword-face) ;colour
-    ;; ("\\( 1 \\)\\|\\( 0 \\)\\|\\( = \\)". font-lock-type-face) ;results
+ '(("^001" . font-lock-function-name-face) ; name of the tournament
     ("^012.*" . font-lock-comment-face)
     ("\\(^022\\|^032\\|^042\\|^052\\|^062\\|^072\\|^082\\|^092\\|^102\\|^112\\|^122\\).*" . font-lock-constant-face)
     ("^132.*" . font-lock-warning-face) ;dates
@@ -86,7 +98,7 @@
     ("\\(^013.\\{1\\}\\)\\(.\\{31\\}\\)" 2 font-lock-comment-face) ;; teams
     ;; (" [0-9]\\{6,\\} " . font-lock-variable-name-face) ;FIDE ID
     ("\\(^001.\\{11\\}\\)\\(.\\{32\\}\\)" 2 font-lock-string-face)  ;; Name of the player (by position)
-    ("\\(^001.\\{55\\}\\)\\(.\\{10\\}\\)" 2 font-lock-function-name-face) ;FIDE ID
+    ("\\(^001.\\{55\\}\\)\\(.\\{10\\}\\)" 2 font-lock-function-name-face) ;FIDE ID
     ("\\(^001.\\{88\\}\\)\\(.\\{4\\}\\)" 2 font-lock-comment-face) ;; round 1 opponent
     ;; ("\\(^132.\\{88\\}\\)\\(.\\{8\\}\\)" 2 font-lock-string-face) ;; round 1 date line
     ("\\(^001.\\{93\\}\\)\\(.\\{1\\}\\)" 2 font-lock-string-face) ;; round 1 colour
   "Arbitools"
   "Major mode for Chess Tournament Management."
   ;(setq font-lock-defaults '(arbitools-highlights))
+  (use-local-map arbitools-mode-map)
   (set (make-local-variable 'font-lock-defaults) '(arbitools-highlights)))
 
 ;;;###autoload