;;; ess-bugs-d.el --- ESS[BUGS] dialect ;; Copyright (C) 2008-2011 Rodney Sparapani ;; Author: Rodney Sparapani ;; Created: 13 March 2008 ;; Maintainer: ESS-help ;; This file is part of ESS ;; This file is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by ;; the Free Software Foundation; either version 2, or (at your option) ;; any later version. ;; ;; This file is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. ;; ;; A copy of the GNU General Public License is available at ;; http://www.r-project.org/Licenses/ ;;; Code: (require 'ess-bugs-l) (require 'ess-utils) (require 'ess-inf) (setq auto-mode-alist (append '(("\\.[bB][uU][gG]\\'" . ess-bugs-mode)) auto-mode-alist)) (defvar ess-bugs-command "OpenBUGS" "Default BUGS program in PATH.") (make-local-variable 'ess-bugs-command) (defvar ess-bugs-monitor '("") "Default list of variables to monitor.") (make-local-variable 'ess-bugs-monitor) (defvar ess-bugs-thin 1 "Default thinning parameter.") (make-local-variable 'ess-bugs-thin) (defvar ess-bugs-chains 1 "Default number of chains.") (make-local-variable 'ess-bugs-chains) (defvar ess-bugs-burnin 10000 "Default burn-in.") (make-local-variable 'ess-bugs-burnin) (defvar ess-bugs-update 10000 "Default number of updates after burnin.") (make-local-variable 'ess-bugs-update) (defvar ess-bugs-system nil "Default whether BUGS recognizes the system command.") (defvar ess-bugs-font-lock-keywords (list ;; .bug files (cons "#.*\n" font-lock-comment-face) (cons "^[ \t]*\\(model\\|var\\)\\>" font-lock-keyword-face) (cons (concat "\\ " ess-bugs-file-root ".bog 2>&1 " ;; ess-bugs-batch-post-command "' > " ess-bugs-file-root ".bsh") ;; (comint-send-input) ;; (insert "at -f " ess-bugs-file-root ".bsh now") ;; (comint-send-input) (insert "echo '" ess-bugs-batch-pre-command " " bugs-command " < " ess-bugs-file-root ".bmd > " ess-bugs-file-root ".bog 2>&1 " ess-bugs-batch-post-command "' | at now") (comint-send-input) )) (defun ess-bugs-na-bug () "ESS[BUGS]: Perform Next-Action for .bug" (if (equal 0 (buffer-size)) (ess-bugs-switch-to-suffix ".bug") ;else (ess-save-and-set-local-variables) (ess-bugs-switch-to-suffix ".bmd" ess-bugs-chains ess-bugs-monitor ess-bugs-thin ess-bugs-burnin ess-bugs-update)) ) (defun ess-bugs-mode () "ESS[BUGS]: Major mode for BUGS." (interactive) (kill-all-local-variables) (ess-setq-vars-local '((comment-start . "#"))) (setq major-mode 'ess-bugs-mode) (setq mode-name "ESS[BUGS]") (use-local-map ess-bugs-mode-map) (setq font-lock-auto-fontify t) (make-local-variable 'font-lock-defaults) (setq font-lock-defaults '(ess-bugs-font-lock-keywords nil t)) (setq ess-language "S") ; mimic S for ess-smart-underscore (run-hooks 'ess-bugs-mode-hook) (if (not (w32-shell-dos-semantics)) (add-hook 'comint-output-filter-functions 'ess-bugs-exit-notify-sh)) ) (setq features (delete 'ess-bugs-d features)) (provide 'ess-bugs-d) ;;; ess-bugs-d.el ends here