;;; essl-bug.el -- ESS BUGS customization ;; Copyright (C) 2001 Rodney Sparapani ;; Copyright (C) 2002--2004 Free Software Foundation, Inc. ;; Copyright (C) 2002--2004 A.J. Rossini, Rich M. Heiberger, Martin ;; Maechler, Kurt Hornik, Rodney Sparapani, and Stephen Eglen. ;; Original Author: Rodney Sparapani ;; Created: 27 February 2001 ;; Maintainers: ESS-core ;; Keywords: BUGS, bugs, BACKBUGS, backbugs. ;; 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. ;; ;; You should have received a copy of the GNU General Public License ;; along with GNU Emacs; see the file COPYING. If not, write to ;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. ;; ;; In short: you may use this code any way you like, as long as you ;; don't charge money for it, remove this notice, or hold anyone liable ;; for its results. ;; Code: (require 'font-lock) (require 'comint) (require 'ess-emcs) (if (assoc "\\.[bB][uUoO][gG]\\'" auto-mode-alist) nil (setq auto-mode-alist (append '(("\\.[bB][uUoO][gG]\\'" . ess-bugs-mode) ("\\.[bB][mM][dD]\\'" . ess-bugs-mode)) auto-mode-alist) ) ) (defgroup ess-bugs nil "ESS: BUGS." :group 'ess :prefix "ess-") (defcustom ess-bugs-batch-method (if ess-microsoft-p (if (w32-shell-dos-semantics) 'ms-dos 'sh) (if (equal system-type 'Apple-Macintosh) 'apple-script 'sh)) "Method used by `ess-bugs-batch'. The default is based on the value of the emacs variable `system-type' and, on Windows machines, the function `w32-shell-dos-semantics'. 'ms-dos if *shell* follows MS-DOS semantics 'sh if *shell* runs sh, ksh, csh, tcsh or bash 'apple-script *shell* unavailable, use AppleScript Windows users running MS-DOS in *shell* will get 'ms-dos by default. Windows users running bash in *shell* will get 'sh by default. Unix users will get 'sh by default. Users whose default is not 'sh, but are accessing a remote machine with `telnet', `rlogin', or `ssh', should have the following in ~/.emacs (setq-default ess-bugs-batch-method 'sh)" :group 'ess-bugs ) (defcustom ess-bugs-batch-version "0.6" "*ESS[BUGS]: The batch BUGS version to use." :group 'ess-bugs :type 'string ) ;; SJE Thu 13 May 2004 ;; The "backbugs" scripts can be found in ess-etc-directory, so maybe we ;; can use ess-etc-directory here too. (defcustom ess-bugs-batch-command (if (equal ess-bugs-batch-version "0.6") "backbugs" "backbug5") "*ESS[BUGS]: The name of the command to run BUGS in batch mode. Set to the name of the batch BUGS script that comes with ESS or to the name of BUGS command. Make sure it is in your PATH or add path to the command name." :group 'ess-bugs :type 'string ) (defcustom ess-bugs-batch-post-command (if (equal ess-bugs-batch-method 'sh) "&" " ") "*ESS[BUGS]: Modifiers at the end of the batch BUGS command line." :group 'ess-bugs :type 'string ) (defcustom ess-bugs-batch-pre-command (if (equal ess-bugs-batch-method 'sh) "test -f nohup.out && rm -f nohup.out || true; nohup" (if ess-microsoft-p "start")) "*ESS[BUGS]: Modifiers at the beginning of the batch BUGS command line." :group 'ess-bugs :type 'string ) (defcustom ess-bugs-default-bins "32" "ESS[BUGS]: Number of bins to use in the Griddy algorithm (Metropolis sampling)." :group 'ess-bugs :type 'string ) (defcustom ess-bugs-default-burn-in "500" "ESS[BUGS]: Burn-in iterations to discard." :group 'ess-bugs :type 'string ) (defcustom ess-bugs-default-update "1000" "ESS[BUGS]: Iterations to store." :group 'ess-bugs :type 'string ) (defcustom ess-bugs-default-checkpoint "100" "ESS[BUGS]: Make a snapshot every this many iterations." :group 'ess-bugs :type 'string ) (defvar ess-bugs-file "." "ESS[BUGS]: BUGS file with PATH.") (defvar ess-bugs-file-root "." "ESS[BUGS]: Root of BUGS file.") (defvar ess-bugs-file-suffix "." "ESS[BUGS]: Suffix of BUGS file.") (defvar ess-bugs-file-dir "." "ESS[BUGS]: Directory of BUGS file.") (defvar ess-bugs-file-data "..." "ESS[BUGS]: BUGS data file.") (defcustom ess-bugs-inits-suffix ".in" "ESS[BUGS]: BUGS init file suffix." :group 'ess-bugs :type 'string ) (defcustom ess-bugs-data-suffix ".dat" "ESS[BUGS]: BUGS data file suffix." :group 'ess-bugs :type 'string ) (defcustom ess-bugs-suffix-regexp (concat "[.]\\([bB][oOuU][gG]\\|[bB][mM][dD]\\|" (if ess-bugs-inits-suffix (concat "\\|" (downcase ess-bugs-inits-suffix) "\\|" (upcase ess-bugs-inits-suffix))) (if ess-bugs-data-suffix (concat "\\|" (downcase ess-bugs-data-suffix) "\\|" (upcase ess-bugs-data-suffix))) "\\)") "*ESS[BUGS]: Regular expression for BUGS suffixes." :group 'ess-bugs :type 'string ) (defcustom ess-bugs-mode-hook nil "*ESS[BUGS]: List of functions to call upon entering mode." :group 'ess-bugs :type 'hook) (defvar ess-bugs-monitor-vars " " "ESS[BUGS]: List of BUGS variables to be written out to a file.") (defvar ess-bugs-stats-vars " " "ESS[BUGS]: List of BUGS variables to be summarized with statistics.") (defvar ess-bugs-mode-map nil "ESS[BUGS]: Keymap for mode.") (if ess-bugs-mode-map nil (setq ess-bugs-mode-map (make-keymap)) (define-key ess-bugs-mode-map (quote [f2]) 'ess-revert-wisely) (define-key ess-bugs-mode-map (quote [f12]) 'ess-bugs-next-action) ) (defvar ess-bugs-syntax-table nil "ESS[BUGS]: Syntax table for mode.") (if ess-bugs-syntax-table nil (setq ess-bugs-syntax-table (make-syntax-table)) (modify-syntax-entry ?\\ "." ess-bugs-syntax-table) (modify-syntax-entry ?# "<" ess-bugs-syntax-table) (modify-syntax-entry ?\n ">" ess-bugs-syntax-table) (modify-syntax-entry ?( "()" ess-bugs-syntax-table) (modify-syntax-entry ?) ")(" ess-bugs-syntax-table) (modify-syntax-entry ?. "w" ess-bugs-syntax-table) ) (defvar ess-bugs-font-lock-keywords (list ;; .bug files (cons "#.*\n" font-lock-comment-face) (cons "^[ \t]*\\(model\\|const\\|data\\|inits\\|var\\)\\>" font-lock-keyword-face) (cons "\\" font-lock-keyword-face) (cons (concat "\\ *") (make-local-variable 'font-lock-defaults) (setq font-lock-defaults '(ess-bugs-font-lock-keywords nil t)) (run-hooks 'ess-bugs-shell-mode-hook) ) (provide 'essl-bug)