Initial Commit
[packages] / xemacs-packages / ess / lisp / essd-sta.el
1 ;;; essd-sta.el --- Stata customization
2
3 ;; Copyright (C) 1997--1999 A. J. Rossini, Thomas Lumley
4 ;; Copyright (C) 1997--2004 A.J. Rossini, Rich M. Heiberger, Martin
5 ;;      Maechler, Kurt Hornik, Rodney Sparapani, and Stephen Eglen.
6
7 ;; Original Author: A.J. Rossini <rossini@biostat.washington.edu>
8 ;; Created: 9 Sep 1998
9 ;; Maintainers: ESS-core <ESS-core@stat.math.ethz.ch>
10
11 ;; Keywords: start up, configuration.
12
13 ;; This file is part of ESS
14
15 ;; This file is free software; you can redistribute it and/or modify
16 ;; it under the terms of the GNU General Public License as published by
17 ;; the Free Software Foundation; either version 2, or (at your option)
18 ;; any later version.
19
20 ;; This file is distributed in the hope that it will be useful,
21 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
22 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
23 ;; GNU General Public License for more details.
24
25 ;; You should have received a copy of the GNU General Public License
26 ;; along with GNU Emacs; see the file COPYING.  If not, write to
27 ;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
28
29 ;;; Commentary: This file defines all the Stata customizations for
30 ;;; ess-mode.  It is somewhat based on Stata-mode by Thomas Lumley
31 ;;; <thomas@biostat.washington.edu>.
32
33 ;;; Requires and Autoloads:
34
35 (require 'essl-sta)
36
37 (autoload 'inferior-ess "ess-inf" "Run an ESS process.")
38 (autoload 'ess-mode     "ess-mode" "Edit an ESS process.")
39
40 ; Code:
41
42 (defvar STA-dialect-name "Stata"
43   "Name of 'dialect' for Stata.");easily changeable in a user's .emacs
44
45 (defvar STA-customize-alist
46   '((ess-local-customize-alist     . 'STA-customize-alist)
47     (ess-language                  . "STA")
48     (ess-dialect                   . STA-dialect-name)
49     (ess-suffix                    . "ado")
50     (ess-mode-editing-alist        . STA-editing-alist)
51     (ess-mode-syntax-table         . STA-syntax-table)
52     (ess-mode-edit                 . 'STA-mode)
53     (ess-help-sec-regex            . ess-help-STA-sec-regex)
54     (ess-help-sec-keys-alist       . ess-help-STA-sec-keys-alist)
55     (ess-loop-timeout              . 500000 )
56     (ess-object-name-db-file       . "ess-sta-namedb.el" )
57     (ess-retr-lastvalue-command    . "\n")
58     (ess-save-lastvalue-command    . "\n")
59     (inferior-ess-program          . inferior-STA-program-name)
60     (inferior-ess-objects-command  . "description\n")
61     (inferior-ess-help-command     . "set more off\n help %s\n")
62     (inferior-ess-exit-command     . "exit\n")
63     (inferior-ess-primary-prompt   . "^.") ;; "^. ?") 
64     (inferior-ess-secondary-prompt . "^.") ;; "^. ?") 
65     (comint-use-prompt-regexp-instead-of-fields . t) ;; emacs 21 and up
66     (inferior-ess-start-file       . nil) ;"~/.ess-stata")
67     (inferior-ess-start-args       . "")) ; "-q"
68  "Variables to customize for Stata.")
69
70
71 (defun STA-mode (&optional proc-name)
72   "Major mode for editing Stata source.  See `ess-mode' for more help."
73   (interactive)
74   (setq ess-customize-alist STA-customize-alist)
75   (ess-mode STA-customize-alist proc-name))
76
77 (fset 'stata-mode 'STA-mode)
78 (fset 'Stata-mode 'STA-mode)
79
80 (defun stata (&optional start-args)
81   "Call Stata."
82   (interactive "P")
83   (setq ess-customize-alist STA-customize-alist)
84   (ess-write-to-dribble-buffer
85    (format "(STA): ess-dialect=%s , buf=%s \n"
86            ess-dialect
87            (current-buffer)))
88   (let ((sta-start-args
89          (concat "TERM=emacs stata " 
90                  inferior-ess-start-args
91                  (if start-args (read-string
92                                  "Starting Args [possibly -k####] ? ")
93                    nil))))
94     (inferior-ess sta-start-args)))
95
96
97 (defun STA-transcript-mode ()
98   "Stata transcript mode."
99   (interactive)
100   (ess-transcript-mode STA-customize-alist))
101
102
103
104 \f ; Provide package
105
106 (provide 'essd-sta)
107
108 \f ; Local variables section
109
110 ;;; This file is automatically placed in Outline minor mode.
111 ;;; The file is structured as follows:
112 ;;; Chapters:     ^L ;
113 ;;; Sections:    ;;*;;
114 ;;; Subsections: ;;;*;;;
115 ;;; Components:  defuns, defvars, defconsts
116 ;;;              Random code beginning with a ;;;;* comment
117
118 ;;; Local variables:
119 ;;; mode: emacs-lisp
120 ;;; outline-minor-mode: nil
121 ;;; mode: outline-minor
122 ;;; outline-regexp: "\^L\\|\\`;\\|;;\\*\\|;;;\\*\\|(def[cvu]\\|(setq\\|;;;;\\*"
123 ;;; End:
124
125 ;;; essd-sta.el ends here