initial commit

This commit is contained in:
Kristell Lymilark 2024-08-04 22:40:31 -04:00
commit 53977c71f7
190 changed files with 63292 additions and 0 deletions

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1 @@
Good signature from 645357D2883A0966 GNU ELPA Signing Agent (2023) <elpasign@elpa.gnu.org> (trust undefined) created at 2024-08-02T05:05:03-0400 using EDDSA

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,19 @@
This is the file .../info/dir, which contains the
topmost node of the Info hierarchy, called (dir)Top.
The first time you invoke Info you start off looking at this node.

File: dir, Node: Top This is the top of the INFO tree
This (the Directory node) gives a menu of major topics.
Typing "q" exits, "H" lists all Info commands, "d" returns here,
"h" gives a primer for first-timers,
"mEmacs<Return>" visits the Emacs manual, etc.
In Emacs, you can click mouse button 2 on a menu item or cross reference
to select it.
* Menu:
Emacs
* ESS: (ess). Emacs Speaks Statistics (R/S/S+, SAS,
BUGS/JAGS and Stata).

View file

@ -0,0 +1,433 @@
;;; ess-autoloads.el --- automatically extracted autoloads (do not edit) -*- lexical-binding: t -*-
;; Generated by the `loaddefs-generate' function.
;; This file is part of GNU Emacs.
;;; Code:
(add-to-list 'load-path (or (and load-file-name (directory-file-name (file-name-directory load-file-name))) (car load-path)))
;;; Generated autoloads from ess.el
(autoload 'ess-version "ess" "\
Return a string with ESS version information." t)
(autoload 'ess-submit-bug-report "ess" "\
Submit a bug report to the ESS maintainers." t)
(register-definition-prefixes "ess" '("ess"))
;;; Generated autoloads from ess-bugs-d.el
(autoload 'ess-bugs-mode "ess-bugs-d" "\
Major mode for BUGS.
(fn)" t)
(add-to-list 'auto-mode-alist '("\\.[Bb][Uu][Gg]\\'" . ess-bugs-mode))
(add-to-list 'auto-mode-alist '("\\.[Bb][Oo][Gg]\\'" . ess-bugs-mode))
(add-to-list 'auto-mode-alist '("\\.[Bb][Mm][Dd]\\'" . ess-bugs-mode))
(register-definition-prefixes "ess-bugs-d" '("ess-"))
;;; Generated autoloads from ess-bugs-l.el
(register-definition-prefixes "ess-bugs-l" '("ess-bugs-"))
;;; Generated autoloads from ess-custom.el
(defvar ess-lisp-directory (file-name-directory (or load-file-name buffer-file-name)) "\
Directory containing ess-site.el(c) and other ESS Lisp files.")
(custom-autoload 'ess-lisp-directory "ess-custom" t)
(add-to-list 'load-path (directory-file-name ess-lisp-directory))
(add-to-list 'load-path (directory-file-name (expand-file-name "obsolete" ess-lisp-directory)))
(put 'ess-indent-offset 'safe-local-variable #'numberp)
(put 'ess-style 'safe-local-variable #'symbolp)
(register-definition-prefixes "ess-custom" '("R-" "S+" "S-" "comint-highlight-prompt" "ess-" "inferior-"))
;;; Generated autoloads from ess-gretl.el
(autoload 'ess-gretl-mode "ess-gretl" "\
Major mode for editing gretl source. See `ess-mode' for more help.
(fn)" t)
(autoload 'gretl "ess-gretl" "\
Call `gretl',
Optional prefix (C-u) allows to set command line arguments, such as
--vsize. This should be OS agnostic.
If you have certain command line arguments that should always be passed
to gretl, put them in the variable `inferior-gretl-args'.
(fn &optional START-ARGS)" t)
(register-definition-prefixes "ess-gretl" '("ess-gretl-" "gretl-" "inferior-gretl-args"))
;;; Generated autoloads from ess-help.el
(register-definition-prefixes "ess-help" '("ess-"))
;;; Generated autoloads from ess-inf.el
(autoload 'ess-load-file "ess-inf" "\
Load FILENAME into an inferior ESS process.
This handles Tramp when working on a remote.
(fn &optional FILENAME)" t)
(register-definition-prefixes "ess-inf" '("ess-" "inferior-ess" "update-ess-process-name-list"))
;;; Generated autoloads from ess-jags-d.el
(autoload 'ess-jags-mode "ess-jags-d" "\
Major mode for JAGS.
(fn)" t)
(add-to-list 'auto-mode-alist '("\\.[Jj][Aa][Gg]\\'" . ess-jags-mode))
(register-definition-prefixes "ess-jags-d" '("ess-jags-"))
;;; Generated autoloads from ess-julia.el
(autoload 'ess-julia-mode "ess-julia" "\
Major mode for julia files.
(fn)" t)
(autoload 'run-ess-julia "ess-julia" "\
Start an inferior julia process.
Optional prefix START-ARGS (\\[universal-argument]) allows to set
command line arguments, such as --load=<file>. This should be OS
agnostic. If you have certain command line arguments that should
always be passed to julia, put them in the variable
`inferior-julia-args'.
(fn &optional START-ARGS)" t)
(defalias 'julia #'run-ess-julia)
(register-definition-prefixes "ess-julia" '("ac-source-ess-julia-objects" "company-ess-julia-objects" "ess-" "inferior-"))
;;; Generated autoloads from ess-mode.el
(autoload 'ess-mode "ess-mode" "\
Major mode for editing ESS source.
Optional arg ALIST describes how to customize the editing mode.
Optional arg PROC-NAME is name of associated inferior process.
\\{ess-mode-map}
You can send text to the inferior ESS process from other buffers containing
ESS source.
`ess-eval-region' sends the current region to the ESS process.
`ess-eval-buffer' sends the current buffer to the ESS process.
`ess-eval-function' sends the current function to the ESS process.
`ess-eval-line' sends the current line to the ESS process.
`ess-switch-to-ESS' switches the current buffer to the ESS process buffer.
`ess-switch-to-end-of-ESS' switches the current buffer to the ESS process
buffer and puts point at the end of it.
`ess-eval-region-and-go', `ess-eval-buffer-and-go',
`ess-eval-function-and-go', and `ess-eval-line-and-go' switch to the S
process buffer after sending their text.
`ess-load-file' sources a file of commands to the ESS process.
\\[ess-indent-command] indents for ESS code.
\\[backward-delete-char-untabify] converts tabs to spaces as it moves back.
Comments are indented in a similar way to Emacs-lisp mode:
`###' beginning of line
`##' the same level of indentation as the code
`#' the same column on the right, or to the right of such a
column if that is not possible.(default value 40).
\\[indent-for-comment] command automatically inserts such a
`#' in the right place, or aligns such a comment if it is
already inserted.
\\[ess-indent-exp] command indents each line of the syntactic unit following point.
Variables controlling indentation style:
`ess-indent-offset'
Indentation of ESS statements within surrounding block.
The surrounding block's indentation is the indentation of the line on
which the open-brace appears.
`ess-offset-block'
Indentation of blocks opened with curly braces or anonymous parentheses.
`ess-offset-arguments'
Indentation of function arguments or bracket indices.
`ess-offset-arguments-newline'
Indentation of function arguments or bracket indices when the opening
delimiter is immediately followed by a newline.
`ess-offset-continued'
Indentation style for continued statements.
`ess-align-nested-calls'
Functions whose nested calls should be aligned.
`ess-align-arguments-in-calls'
Calls in which arguments should be aligned.
`ess-align-continuations-in-calls'
Whether ignore indentation after an operator in calls
`ess-align-blocks'
Blocks that should always be aligned vertically.
`ess-indent-from-lhs'
Whether function calls given as argument should be indented from the
parameter name.
`ess-indent-from-chain-start'
Whether to indent arguments from the first of several consecutive calls.
`ess-indent-with-fancy-comments'
Non-nil means distinguish between #, ##, and ### for indentation.
Furthermore, \\[ess-set-style] command enables you to set up predefined ess-mode
indentation style. See `ess-style-alist' for predefined styles.
(fn)" t)
(register-definition-prefixes "ess-mode" '("ess-"))
;;; Generated autoloads from ess-r-completion.el
(register-definition-prefixes "ess-r-completion" '("ac-source-R" "company-R-" "ess-"))
;;; Generated autoloads from ess-r-flymake.el
(register-definition-prefixes "ess-r-flymake" '("ess-r-"))
;;; Generated autoloads from ess-r-mode.el
(autoload 'run-ess-r "ess-r-mode" "\
Call 'R', the 'GNU S' system from the R Foundation.
Optional prefix (\\[universal-argument]) allows to set command line arguments, such as
--vsize. This should be OS agnostic.
If you have certain command line arguments that should always be passed
to R, put them in the variable `inferior-R-args'.
START-ARGS can be a string representing an argument, a list of
such strings, or any other non-nil value. In the latter case, you
will be prompted to enter arguments interactively.
(fn &optional START-ARGS)" t)
(autoload 'R "ess-r-mode" "\
(fn &optional START-ARGS)" t)
(autoload 'ess-r-mode "ess-r-mode" "\
Major mode for editing R source. See `ess-mode' for more help.
(fn)" t)
(defalias 'R-mode #'ess-r-mode)
(defalias 'r-mode #'ess-r-mode)
(add-to-list 'auto-mode-alist '("/R/.*\\.q\\'" . ess-r-mode))
(add-to-list 'auto-mode-alist '("\\.[rR]\\'" . ess-r-mode))
(add-to-list 'auto-mode-alist '("\\.[rR]profile\\'" . ess-r-mode))
(add-to-list 'auto-mode-alist '("NAMESPACE\\'" . ess-r-mode))
(add-to-list 'auto-mode-alist '("CITATION\\'" . ess-r-mode))
(autoload 'ess-r-transcript-mode "ess-r-mode" "\
A Major mode for R transcript files.
(fn)" t)
(add-to-list 'auto-mode-alist '("\\.[Rr]out\\'" . ess-r-transcript-mode))
(add-to-list 'interpreter-mode-alist '("Rscript" . ess-r-mode))
(add-to-list 'interpreter-mode-alist '("r" . ess-r-mode))
(add-to-list 'auto-mode-alist '("/Makevars\\(\\.win\\)?\\'" . makefile-mode))
(add-to-list 'auto-mode-alist '("DESCRIPTION\\'" . conf-colon-mode))
(register-definition-prefixes "ess-r-mode" '("R-" "ess-" "inferior-ess-r-" "r-transcript-mode" "run-ess-r-newest"))
;;; Generated autoloads from ess-r-package.el
(register-definition-prefixes "ess-r-package" '("ess-"))
;;; Generated autoloads from ess-r-syntax.el
(register-definition-prefixes "ess-r-syntax" '("ess-"))
;;; Generated autoloads from ess-r-xref.el
(register-definition-prefixes "ess-r-xref" '("ess-r-xref-"))
;;; Generated autoloads from ess-rd.el
(autoload 'Rd-mode "ess-rd" "\
Major mode for editing R documentation source files.
Type \\[list-abbrevs] to display the built-in abbrevs for Rd
keywords.To automatically turn on the abbrev(iate) features, add
the following to your Emacs configuration file:
(add-hook \\='Rd-mode-hook #\\='abbrev-mode)
(fn)" t)
(add-to-list 'auto-mode-alist '("\\.Rd\\'" . Rd-mode))
(register-definition-prefixes "ess-rd" '("Rd-"))
;;; Generated autoloads from ess-rdired.el
(autoload 'ess-rdired "ess-rdired" "\
Show R objects from the global environment in a separate buffer.
You may interact with these objects, see `ess-rdired-mode' for
details." t)
(register-definition-prefixes "ess-rdired" '("ess-rdired-"))
;;; Generated autoloads from ess-roxy.el
(autoload 'ess-roxy-mode "ess-roxy" "\
Minor mode for editing ROxygen documentation.
This is a minor mode. If called interactively, toggle the
`Ess-Roxy mode' mode. If the prefix argument is positive, enable
the mode, and if it is zero or negative, disable the mode.
If called from Lisp, toggle the mode if ARG is `toggle'. Enable
the mode if ARG is nil, omitted, or is a positive number.
Disable the mode if ARG is a negative number.
To check whether the minor mode is enabled in the current buffer,
evaluate `ess-roxy-mode'.
The mode's hook is called both when the mode is enabled and when
it is disabled.
(fn &optional ARG)" t)
(register-definition-prefixes "ess-roxy" '("ess-"))
;;; Generated autoloads from ess-s-lang.el
(add-to-list 'auto-mode-alist '("\\.[Ss]t\\'" . S-transcript-mode))
(add-to-list 'auto-mode-alist '("\\.Sout\\'" . S-transcript-mode))
(register-definition-prefixes "ess-s-lang" '("S+common-cust-alist" "S-" "ess-" "inferior-S-language-start"))
;;; Generated autoloads from ess-sas-a.el
(register-definition-prefixes "ess-sas-a" '("ess-" "sas-program"))
;;; Generated autoloads from ess-sas-d.el
(autoload 'SAS-mode "ess-sas-d" "\
Major mode for editing SAS source. See `ess-mode' for more help.
(fn)" t)
(add-to-list 'auto-mode-alist '("\\.[Ss][Aa][Ss]\\'" . SAS-mode))
(register-definition-prefixes "ess-sas-d" '("SAS" "ess-" "inferior-SAS-args"))
;;; Generated autoloads from ess-sas-l.el
(register-definition-prefixes "ess-sas-l" '("SAS-" "backward-page-top-of-window" "beginning-of-sas-" "ess-" "fix-page-breaks" "forward-page-top-of-window" "indent-sas-statement" "next-sas-proc" "sas-" "set-sas-file-" "submit-sas" "switch-to-"))
;;; Generated autoloads from ess-sp6-d.el
(autoload 'S+-mode "ess-sp6-d" "\
Major mode for editing S+ source. See `ess-mode' for more help.
(fn &optional PROC-NAME)" t)
(register-definition-prefixes "ess-sp6-d" '("S+" "ess-"))
;;; Generated autoloads from ess-toolbar.el
(register-definition-prefixes "ess-toolbar" '("ess-"))
;;; Generated autoloads from ess-tracebug.el
(register-definition-prefixes "ess-tracebug" '("ess-" "inferior-ess-" "org-"))
;;; Generated autoloads from ess-trns.el
(autoload 'ess-transcript-mode "ess-trns" "\
Major mode for transcript files.
Type \\[ess-transcript-send-command] to send a command in the
transcript to the current inferior process. \\[ess-transcript-copy-command]
copies the command but does not execute it, allowing you to edit it in
the process buffer first.
Type \\[ess-transcript-clean-region] to delete all outputs and prompts
in the region, leaving only the commands.
(fn)" t)
(register-definition-prefixes "ess-trns" '("ess-transcript-"))
;;; Generated autoloads from ess-utils.el
(defvar ess-elisp-trace-mode nil "\
Non-nil if Ess-Elisp-Trace mode is enabled.
See the `ess-elisp-trace-mode' command
for a description of this minor mode.
Setting this variable directly does not take effect;
either customize it (see the info node `Easy Customization')
or call the function `ess-elisp-trace-mode'.")
(custom-autoload 'ess-elisp-trace-mode "ess-utils" nil)
(autoload 'ess-elisp-trace-mode "ess-utils" "\
Toggle tracing of ess-prefixed functions.
Tracing is useful for debugging background ESS behaviour. When
enabled, all functions prefixed in `ess-' and `inferior-ess' are
instrumented with `trace-function'. Tracing is turned off by
calling `untrace-function' on these functions.
This is a global minor mode. If called interactively, toggle the
`Ess-Elisp-Trace mode' mode. If the prefix argument is positive,
enable the mode, and if it is zero or negative, disable the mode.
If called from Lisp, toggle the mode if ARG is `toggle'. Enable
the mode if ARG is nil, omitted, or is a positive number.
Disable the mode if ARG is a negative number.
To check whether the minor mode is enabled in the current buffer,
evaluate `(default-value \\='ess-elisp-trace-mode)'.
The mode's hook is called both when the mode is enabled and when
it is disabled.
(fn &optional ARG)" t)
(register-definition-prefixes "ess-utils" '("ess-" "with-ess-process-buffer"))
;;; Generated autoloads from essd-els.el
(autoload 'ess-remote "essd-els" "\
Execute this command from within a buffer running a process.
It runs `ess-add-ess-process' to add the PROC-NAME to
`ess-process-name-alist' and to make it the
`ess-current-process-name'. It then prompts the user for an ESS
language and sets the editing characteristics appropriately.
To use this command, first start a process on a remote computer by
manual use of telnet, rlogin, ssh, or some other protocol. Start the
relevant program (\"S\" or \"R\" or \"sas -stdio\") in that buffer. Once
you are talking to S or R or SAS, then do \\[ess-remote] to make
the current buffer an inferior-ess buffer with the right behavior for
the language you are currently working with. With S and R, use C-c
C-n to send lines over. With SAS, use C-c i
`ess-eval-line-and-step-invisibly' to send lines over invisibly.
DIALECT is the desired ess-dialect. If nil, ask for dialect
(fn &optional PROC-NAME DIALECT)" t)
(register-definition-prefixes "essd-els" '("S+elsewhere" "ess-" "inferior-ess-remote-pager"))
;;; End of scraped data
(provide 'ess-autoloads)
;; Local Variables:
;; version-control: never
;; no-byte-compile: t
;; no-update-autoloads: t
;; no-native-compile: t
;; coding: utf-8-emacs-unix
;; End:
;;; ess-autoloads.el ends here

View file

@ -0,0 +1,298 @@
;;; ess-bugs-d.el --- ESS[BUGS] dialect -*- lexical-binding: t; -*-
;; Copyright (C) 2008-2022 Free Software Foundation, Inc.
;; Author: Rodney Sparapani
;; Maintainer: ESS-help <ess-help@r-project.org>
;; This file is part of GNU Emacs.
;;; License:
;;
;; This program 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 3 of the License, or
;; (at your option) any later version.
;;
;; This program 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 this program. If not, see
;; <http://www.gnu.org/licenses/>
;;; Code:
(require 'ess-bugs-l)
(require 'ess-utils)
(require 'ess-inf)
(require 'ess-mode)
(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 "\\<d\\(bern\\|beta\\|bin\\|cat\\|chisq\\|"
"dexp\\|dirch\\|exp\\|\\(gen[.]\\)?gamma\\|hyper\\|"
"interval\\|lnorm\\|logis\\|mnorm\\|mt\\|multi\\|"
"negbin\\|norm\\(mix\\)?\\|par\\|pois\\|sum\\|t\\|"
"unif\\|weib\\|wish\\)[ \t\n]*(")
font-lock-constant-face)
(cons (concat "\\<\\(abs\\|cos\\|C\\|dim\\|\\(i\\)?cloglog\\|equals\\|"
"exp\\|for\\|inprod\\|interp[.]line\\|inverse\\|length\\|"
"\\(i\\)?logit\\|logdet\\|logfact\\|loggam\\|max\\|mean\\|"
"mexp\\|min\\|phi\\|pow\\|probit\\|prod\\|rank\\|round\\|"
"sd\\|sin\\|sort\\|sqrt\\|step\\|sum\\|t\\|trunc\\|T\\)[ \t\n]*(")
font-lock-function-name-face)
;; .bmd files
(cons (concat (regexp-opt '(
"dicClear" "dicSet" "dicStats"
"infoMemory" "infoModules" "infoNodeMethods"
"infoNodeTypes" "infoNodeValues"
"infoUpdatersbyDepth" "infoUpdatersbyName"
"modelCheck" "modelCompile" "modelData"
"modelDisable" "modelEnable" "modelGenInits"
"modelInits" "modelPrecision" "modelQuit"
"modelSaveState" "modelSetAP" "modelSetIts"
"modelSetOR" "modelSetRN" "modelUpdate"
"ranksClear" "ranksSet" "ranksStats"
"samplesAutoC" "samplesBgr" "samplesCoda"
"samplesDensity" "samplesHistory" "samplesSet"
"sampleStats" "samplesThin"
"summaryClear" "summarySet" "summaryStats"
) 'words) "(")
font-lock-function-name-face)
(cons (concat (regexp-opt '("Local Variables" "End") 'words) ":")
font-lock-keyword-face)
)
"ESS[BUGS]: Font lock keywords."
)
(defun ess-bugs-switch-to-suffix (suffix &optional bugs-chains bugs-monitor bugs-thin
bugs-burnin bugs-update)
"ESS[BUGS]: Switch to file with suffix."
(find-file (concat ess-bugs-file-dir ess-bugs-file-root suffix))
(if (equal 0 (buffer-size)) (progn
(if (equal ".bug" suffix) (progn
;(insert "var ;\n")
(insert "model {\n")
(insert " for (i in 1:N) {\n \n")
(insert " }\n")
(insert "}\n")
(insert "#Local Variables" ":\n")
; (insert "#enable-local-variables: :all\n")
(insert "#ess-bugs-chains:1\n")
(insert "#ess-bugs-monitor:(\"\")\n")
(insert "#ess-bugs-thin:1\n")
(insert "#ess-bugs-burnin:10000\n")
(insert "#ess-bugs-update:10000\n")
(insert "#End:\n")
))
(if (equal ".bmd" suffix) (let
((ess-bugs-temp-chains "") (ess-bugs-temp-monitor ""))
(if bugs-chains (setq ess-bugs-chains bugs-chains))
(if bugs-monitor (setq ess-bugs-monitor bugs-monitor))
(if bugs-thin (setq ess-bugs-thin bugs-thin))
(setq ess-bugs-temp-chains
(concat "modelCompile(" (format "%d" ess-bugs-chains) ")\n"))
(setq bugs-chains ess-bugs-chains)
(while (< 0 bugs-chains)
(setq ess-bugs-temp-chains
(concat ess-bugs-temp-chains
"modelInits('" ess-bugs-file-root
".##" (format "%d" bugs-chains) "', "
(format "%d" bugs-chains) ")\n"))
(setq bugs-chains (- bugs-chains 1)))
(setq ess-bugs-temp-monitor "")
(while (and (listp ess-bugs-monitor) (consp ess-bugs-monitor))
(if (not (string-equal "" (car ess-bugs-monitor)))
(setq ess-bugs-temp-monitor
(concat ess-bugs-temp-monitor "samplesSet('"
(car ess-bugs-monitor)
;", thin(" (format "%d" ess-bugs-thin)
"')\n")))
(setq ess-bugs-monitor (cdr ess-bugs-monitor)))
(insert "modelCheck('" ess-bugs-file-root ".bug')\n")
(insert "modelData('" ess-bugs-file-root ".bdt')\n")
(insert (ess-replace-in-string ess-bugs-temp-chains "##" "in"))
(insert "modelGenInits()\n")
(insert "modelUpdate(" (format "%d" bugs-burnin) ")\n")
;(insert "modelUpdate(" (format "%d" (* bugs-thin bugs-burnin)) ")\n")
(insert ess-bugs-temp-monitor)
(insert "modelUpdate(" (format "%d" (* bugs-thin bugs-update)) ")\n")
; (insert (ess-replace-in-string
; (ess-replace-in-string ess-bugs-temp-chains
; "modelCompile([0-9]+)" "#") "##" "to"))
(if (< 1 bugs-thin) (insert "samplesThin(" (format "%d" bugs-thin) ")\n"))
(insert "samplesCoda('*', '" ess-bugs-file-root "')\n")
; (if ess-bugs-system (progn
; (insert "system rm -f " ess-bugs-file-root ".ind\n")
; (insert "system ln -s " ess-bugs-file-root "index.txt " ess-bugs-file-root ".ind\n")
; (setq bugs-chains ess-bugs-chains)
; (while (< 0 bugs-chains)
; (setq ess-bugs-temp-chain (format "%d" bugs-chains))
; ;.txt not recognized by BOA and impractical to over-ride
; (insert "system rm -f " ess-bugs-file-root ess-bugs-temp-chain ".out\n")
; (insert "system ln -s " ess-bugs-file-root "chain" ess-bugs-temp-chain ".txt "
; ess-bugs-file-root ess-bugs-temp-chain ".out\n")
; (setq bugs-chains (- bugs-chains 1)))))
(insert "modelQuit()\n")
(insert "Local Variables" ":\n")
; (insert "enable-local-variables: :all\n")
(insert "ess-bugs-chains:" (format "%d" ess-bugs-chains) "\n")
(insert "ess-bugs-command:\"" ess-bugs-command "\"\n")
(insert "End:\n")
))
))
)
(defun ess-bugs-na-bmd (bugs-command)
"ESS[BUGS]: Perform the Next-Action for .bmd."
;(ess-save-and-set-local-variables)
(if (equal 0 (buffer-size)) (ess-bugs-switch-to-suffix ".bmd")
;else
(shell)
(ess-sleep)
(when (and (when (fboundp 'w32-shell-dos-semantics)
(w32-shell-dos-semantics))
(string-equal ":" (substring ess-bugs-file 1 2)))
(insert (substring ess-bugs-file 0 2)))
(comint-send-input)
(insert "cd \"" ess-bugs-file-dir "\"")
(comint-send-input)
; (let ((ess-bugs-temp-chains ""))
;
; (while (< 0 bugs-chains)
; (setq ess-bugs-temp-chains
; (concat (format "%d " bugs-chains) ess-bugs-temp-chains))
; (setq bugs-chains (- bugs-chains 1)))
;; (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 "' > " 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))
)
;;;###autoload
(define-derived-mode ess-bugs-mode ess-mode "ESS[BUGS]"
"Major mode for BUGS."
(setq-local comment-start "#")
(setq font-lock-defaults '(ess-bugs-font-lock-keywords nil t))
(setq ess-language "S") ; mimic S for ess-smart-underscore
(unless (when (fboundp 'w32-shell-dos-semantics)
(w32-shell-dos-semantics))
(add-hook 'comint-output-filter-functions #'ess-bugs-exit-notify-sh)))
;;;###autoload
(add-to-list 'auto-mode-alist '("\\.[Bb][Uu][Gg]\\'" . ess-bugs-mode))
;;;###autoload
(add-to-list 'auto-mode-alist '("\\.[Bb][Oo][Gg]\\'" . ess-bugs-mode))
;;;###autoload
(add-to-list 'auto-mode-alist '("\\.[Bb][Mm][Dd]\\'" . ess-bugs-mode))
(defun ess-sci-to-dec ()
"For BUGS/S family: Express +/-0.000E+/-0 or +/-0.0e+/-00 as a decimal."
(interactive)
(setq buffer-read-only nil)
(save-excursion (goto-char 0)
(save-match-data (let ((ess-temp-replacement-string nil)
(ess-temp-replacement-9 0)
(ess-temp-replacement-diff 0))
(while (search-forward-regexp "-?[0-9][.][0-9][0-9]?[0-9]?[Ee][+-][0-9][0-9]?" nil t)
(setq ess-temp-replacement-string
(int-to-string (string-to-number (match-string 0))))
(setq ess-temp-replacement-diff (- (match-end 0) (match-beginning 0)))
(save-match-data
(setq ess-temp-replacement-9
(string-match "99999999999$" ess-temp-replacement-string))
(if (not ess-temp-replacement-9)
(setq ess-temp-replacement-9
(string-match "000000000001$" ess-temp-replacement-string))))
(if ess-temp-replacement-9
(setq ess-temp-replacement-string
(substring ess-temp-replacement-string 0 ess-temp-replacement-9)))
(setq ess-temp-replacement-diff
(- ess-temp-replacement-diff (string-width ess-temp-replacement-string)))
(while (> ess-temp-replacement-diff 0)
(setq ess-temp-replacement-string (concat ess-temp-replacement-string " "))
(setq ess-temp-replacement-diff (- ess-temp-replacement-diff 1)))
(replace-match ess-temp-replacement-string))))))
(provide 'ess-bugs-d)
;;; ess-bugs-d.el ends here

Binary file not shown.

View file

@ -0,0 +1,290 @@
;;; ess-bugs-l.el --- ESS[BUGS] languages -*- lexical-binding: t; -*-
;; Copyright (C) 2006-2020 Free Software Foundation, Inc.
;; Author: Rodney Sparapani
;; Maintainer: ESS-help <ess-help@r-project.org>
;; This file is part of GNU Emacs
;;; License:
;;
;; This program 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 3 of the License, or
;; (at your option) any later version.
;;
;; This program 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 this program. If not, see
;; <http://www.gnu.org/licenses/>
;;; Code:
(require 'shell)
(require 'ess-utils)
(defvar ess-bugs-command)
(defvar ess-bugs-chains)
(defvar ess-jags-command)
(defvar ess-jags-chains)
(defvar ess-bugs-default-bins)
(declare-function ess-bugs-na-bug "ess-bugs-d")
(declare-function ess-jags-na-bug "ess-jags-d")
(declare-function ess-bugs-na-bmd "ess-bugs-d")
(declare-function ess-jags-na-jmd "ess-jags-d")
(defgroup ess-bugs nil
"ESS: BUGS."
:group 'ess
:prefix "ess-")
(defcustom ess-bugs-batch-method
(if (and ess-microsoft-p
(fboundp 'w32-shell-dos-semantics)
(w32-shell-dos-semantics))
'dos
'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'.
\\='sh if *shell* runs a Bourne-like or a C-like Unix shell
\\='dos if *shell* runs a DOS-like Windows shell
Unix users will get \\='sh by default.
Windows users running a DOS-like *shell* will get \\='dos by default,
while those running a Unix-like *shell* will get \\='sh by default.
Users whose default is not \\='sh, but are accessing a remote machine with
`telnet' or `ssh', should have the following in their init file:
(setq-default ess-bugs-batch-method \\='sh)"
:group 'ess-bugs
:type '(choice (const sh :tag "Bourne/C-like Unix Shell")
(const dos :tag "DOS-like Windows shell")))
(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) "nohup nice time"
(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-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
)
(defvar ess-bugs-batch-command ";"
"ESS[BUGS]: The name of the command to run BUGS in batch mode."
)
(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-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
(let ((map (make-sparse-keymap)))
(define-key map (quote [f2]) #'ess-revert-wisely)
(define-key map "\C-c\C-c" #'ess-bugs-next-action)
(define-key map "=" #'ess-bugs-hot-arrow)
;; (define-key map "_" #'ess-bugs-hot-arrow)
map)
"ESS[BUGS]: Keymap for mode.")
(defvar ess-bugs-syntax-table
(let ((table (make-syntax-table)))
(modify-syntax-entry ?\\ "." table)
(modify-syntax-entry ?# "<" table)
(modify-syntax-entry ?\n ">" table)
(modify-syntax-entry ?\( "()" table)
(modify-syntax-entry ?\) ")(" table)
(modify-syntax-entry ?. "w" table)
table)
"ESS[BUGS]: Syntax table for mode.")
(defun ess-bugs-file ()
"ESS[BUGS]: Set internal variables dealing with BUGS files.
Set `ess-bugs-file', `ess-bugs-file-root', `ess-bugs-file-suffix'
and `ess-bugs-file-dir'."
(let ((ess-bugs-temp-string (buffer-name)))
(setq ess-bugs-file (expand-file-name ess-bugs-temp-string))
(setq ess-bugs-file-dir
(convert-standard-filename (file-name-directory ess-bugs-file)))
(setq ess-bugs-file-root
(file-name-nondirectory (file-name-sans-extension ess-bugs-file)))
(if (fboundp 'file-name-extension)
(setq ess-bugs-file-suffix (file-name-extension ess-bugs-temp-string))
;;else
(setq ess-bugs-file-suffix (car (last (split-string ess-bugs-temp-string "[.]")))))
(setq ess-bugs-file-suffix
(downcase (car (split-string (concat "." ess-bugs-file-suffix) "[<]"))))
(setq ess-bugs-file (concat ess-bugs-file-dir ess-bugs-file-root ess-bugs-file-suffix))
)
)
(defun ess-bugs-exit-notify-sh (string)
"ESS[BUGS]: Detect completion or failure of submitted job and notify the user."
(let* ((exit-done "\\[[0-9]+\\] *\\+* *\\(Exit\\|Done\\)[^\r\n]*")
(beg (string-match exit-done string)))
(if beg (message "%s" (substring string beg (match-end 0))))))
(defun ess-bugs-hot-arrow ()
"ESS[BUGS]: Substitute <- for = key press"
(interactive)
(insert " <- "))
(defun ess-bugs-next-action ()
"ESS[BUGS/JAGS]: Perform the appropriate next action."
(interactive)
(ess-bugs-file)
(cond ((equal ".bug" ess-bugs-file-suffix) (ess-bugs-na-bug))
((equal ".jag" ess-bugs-file-suffix) (ess-jags-na-bug))
((equal ".bmd" ess-bugs-file-suffix)
(ess-save-and-set-local-variables)
(ess-bugs-na-bmd ess-bugs-command ess-bugs-chains))
((equal ".jmd" ess-bugs-file-suffix)
(ess-save-and-set-local-variables)
(ess-jags-na-jmd ess-jags-command ess-jags-chains)))
)
(defun ess-bugs-sci-to-round-4-dp ()
"ESS[BUGS]: round output from +/-0.000E+/-0 to 4 decimal places."
(interactive)
(setq buffer-read-only nil)
(save-excursion (goto-char 0)
(save-match-data (let ((ess-bugs-replacement-string nil)
(ess-bugs-replacement-9 0)
(ess-bugs-replacement-diff 0))
(while (search-forward-regexp "-?[0-9][.][0-9][0-9][0-9]E[+-][0-9]" nil t)
(setq ess-bugs-replacement-string
(int-to-string (string-to-number (match-string 0))))
(setq ess-bugs-replacement-diff (- (match-end 0) (match-beginning 0)))
(save-match-data
(setq ess-bugs-replacement-9
(string-match "99999999999$" ess-bugs-replacement-string))
(if (not ess-bugs-replacement-9)
(setq ess-bugs-replacement-9
(string-match "000000000001$" ess-bugs-replacement-string))))
(if ess-bugs-replacement-9
(setq ess-bugs-replacement-string
(substring ess-bugs-replacement-string 0 ess-bugs-replacement-9)))
(setq ess-bugs-replacement-diff
(- ess-bugs-replacement-diff (string-width ess-bugs-replacement-string)))
(while (> ess-bugs-replacement-diff 0)
(setq ess-bugs-replacement-string (concat ess-bugs-replacement-string " "))
(setq ess-bugs-replacement-diff (- ess-bugs-replacement-diff 1)))
(replace-match ess-bugs-replacement-string))))))
;;; ESS[BUGS-Shell] for running BUGS interactively
(defgroup ess-bugs-shell nil
"ESS: BUGS-Shell."
:group 'ess-bugs
:prefix "ess-")
(defcustom ess-bugs-shell-buffer-name "BUGS"
"ESS[BUGS-Shell]: The name of the BUGS-Shell buffer."
:group 'ess-bugs-shell
:type 'string)
(defcustom ess-bugs-shell-command "OpenBUGS"
"ESS[BUGS-Shell]: The name of the command to run BUGS interactively.
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-shell
:type 'string)
(defcustom ess-bugs-shell-default-output-file-root "bugs"
"ESS[BUGS-Shell]: Default value for the root of output files."
:group 'ess-bugs-shell
:type 'string)
(defcustom ess-bugs-shell-mode-hook nil
"ESS[BUGS-Shell]: List of functions to call upon entering mode."
:group 'ess-bugs-shell
:type 'hook)
(defun ess-bugs-shell ()
"Create a buffer with BUGS running as a subprocess."
(interactive)
(pop-to-buffer-same-window (concat "*" ess-bugs-shell-buffer-name "*"))
(make-comint ess-bugs-shell-buffer-name ess-bugs-shell-command nil
ess-bugs-default-bins ess-bugs-shell-default-output-file-root)
(comint-mode)
(setq shell-dirtrackp t
major-mode 'bugs-shell-mode
mode-name "ESS[BUGS-Shell]"
comint-prompt-regexp "^Bugs> *")
(make-local-variable 'font-lock-defaults)
(setq font-lock-defaults '(ess-bugs-font-lock-keywords nil t))
(run-mode-hooks 'ess-bugs-shell-mode-hook)
)
(provide 'ess-bugs-l)
;;; ess-bugs-l.el ends here

Binary file not shown.

File diff suppressed because it is too large Load diff

Binary file not shown.

View file

@ -0,0 +1,579 @@
;; ess-gretl.el --- ESS gretl mode and inferior interaction -*- lexical-binding: t; -*-
;; Copyright (C) 2012-2022 Free Software Foundation, Inc.
;; Author: Ahmadou Dicko, Spinu Vitalie and Allin Cottrell
;; Maintainer: ESS Core Team <ESS-core@r-project.org>
;; Created: 01-10-2012 (ESS 12.09)
;; This file is part of GNU Emacs.
;;; License:
;;
;; This program 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 3 of the License, or
;; (at your option) any later version.
;;
;; This program 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 this program. If not, see
;; <http://www.gnu.org/licenses/>
;;; Commentary:
;; start the inferior with M-x gretl.
;;; Code:
(require 'compile); for compilation-* below
(require 'ess-r-mode)
(add-to-list 'auto-mode-alist '("\\.inp\\'" . ess-gretl-mode))
(defvar gretl-syntax-table
(let ((table (make-syntax-table)))
(modify-syntax-entry ?_ "w" table) ; underscores in words
(modify-syntax-entry ?@ "w" table)
(modify-syntax-entry ?# "<" table) ; # single-line comment start
(modify-syntax-entry ?\n ">" table) ; \n single-line comment end
(modify-syntax-entry ?\{ "(} " table)
(modify-syntax-entry ?\} "){ " table)
(modify-syntax-entry ?\[ "(] " table)
(modify-syntax-entry ?\] ")[ " table)
(modify-syntax-entry ?\( "() " table)
(modify-syntax-entry ?\) ")( " table)
(modify-syntax-entry ?\r " " table)
(modify-syntax-entry ?+ "." table)
(modify-syntax-entry ?- "." table)
(modify-syntax-entry ?= "." table)
(modify-syntax-entry ?* "." table)
(modify-syntax-entry ?/ "." table)
(modify-syntax-entry ?> "." table)
(modify-syntax-entry ?< "." table)
(modify-syntax-entry ?& "." table)
(modify-syntax-entry ?| "." table)
(modify-syntax-entry ?! "." table)
(modify-syntax-entry ?\\ "\\" table)
(modify-syntax-entry ?\' "." table)
(modify-syntax-entry ?\` "w" table)
(modify-syntax-entry ?\" "\"" table)
(modify-syntax-entry ?. "w" table)
(modify-syntax-entry ?_ "w" table)
(modify-syntax-entry ?\% "." table)
(modify-syntax-entry ?\# "<" table)
(modify-syntax-entry ?\n ">" table)
table)
"Syntax table for `ess-gretl-mode'.")
;; syntax table that holds within strings
(defvar ess-gretl-mode-string-syntax-table
(let ((table (make-syntax-table)))
table)
"Syntax table for `ess-gretl-mode' that holds within strings.")
(defcustom gretl-continuation-offset 4
"Extra indentation applied to Gretl continuation lines."
:type 'integer
:group 'ess-gretl)
(defvar gretl-continuation-regexp
"[^#%\n]*\\(\\\\\\|\\.\\.\\.\\)\\s-*\\(\\s<.*\\)?$")
(defcustom gretl-continuation-string "\\"
"Character string used for Gretl continuation lines. Normally \\."
:type 'string
:group 'ess-gretl)
;; (defconst gretl-string-regex
;; "\"[^\"]*?\\(\\(\\\\\\\\\\)*\\\\\"[^\"]*?\\)*\"")
(defconst gretl-function-header-regexp
(concat "^\\s-*\\<\\(function\\)\\>"
"\\([^=;\n]*=[ \t]*\\|[ \t]*\\)\\(\\w+\\)\\>")
"Regexp to match a Gretl function header.
The string `function' and its name are given by the first and third
parenthetical grouping.")
;; (defconst ess-function-call-regexp
;; "\\s\"?\\(\\(\\sw\\|\\s_\\)+\\(<-\\)?\\)\\s\"?*\\s-*("
;; "Regexp for function names")
(defvar gretl-command-words
'("add" "adf" "anova" "append" "ar" "ar1" "arbond" "arch"
"arima" "biprobit" "break" "boxplot" "chow" "clear" "coeffsum" "coint"
"coint2" "corr" "corrgm" "cusum" "data" "dataset" "delete" "diff"
"difftest" "discrete" "dpanel" "dummify" "duration" "elif" "else" "end"
"endif" "endloop" "eqnprint" "equation" "estimate" "fcast" "foreign" "fractint"
"freq" "function" "funcerr" "garch" "genr" "gmm" "gnuplot" "graphpg"
"hausman" "heckit" "help" "hsk" "hurst" "if" "include" "info"
"intreg" "kalman" "kpss" "labels" "lad" "lags" "ldiff" "leverage"
"levinlin" "logistic" "logit" "logs" "loop" "mahal" "makepkg" "meantest"
"mle" "modeltab" "modprint" "modtest" "mpols" "negbin" "nls" "normtest"
"nulldata" "ols" "omit" "open" "orthdev" "outfile" "panel" "pca"
"pergm" "textplot" "poisson" "print" "printf" "probit" "pvalue" "quantreg"
"qlrtest" "qqplot" "quit" "rename" "reset" "restrict" "rmplot" "run"
"runs" "scatters" "sdiff" "set" "setinfo" "setobs" "setmiss" "shell"
"smpl" "spearman" "sprintf" "square" "sscanf" "store" "summary" "system"
"tabprint" "tobit" "tsls" "var" "varlist" "vartest" "vecm" "vif"
"wls" "xcorrgm" "xtab" "debug" "return" "catch" "for" "foreach"
"while" "const" "3sls" "liml" "fiml"
"sur" "params" "deriv" "orthog" "weights" "series" "scalar")
"Commands in Gretl (these names are also reserved).")
(defvar gretl-genr-functions
'("abs" "sin" "cos" "tan" "asin" "acos" "atan" "sinh"
"cosh" "tanh" "asinh" "acosh" "atanh" "log" "ln" "log10"
"log2" "exp" "sqrt" "diff" "ldiff" "sdiff" "lags" "int"
"round" "ceil" "floor" "sort" "dsort" "sortby" "ranking" "orthdev"
"nobs" "firstobs" "lastobs" "uniform" "normal" "cum" "missing" "ok"
"misszero" "lrvar" "quantile" "median" "gini" "zeromiss" "sum" "mean"
"min" "max" "sd" "var" "sst" "cnorm" "dnorm" "qnorm"
"gammafun" "lngamma" "digamma" "resample" "pnobs" "pmin" "pmax" "pmean"
"psd" "hpfilt" "bkfilt" "bwfilt" "fracdiff" "boxcox" "cov" "corr"
"movavg" "I" "zeros" "ones" "seq" "replace" "muniform" "mnormal"
"sumc" "sumr" "meanc" "meanr" "sdc" "minc" "maxc" "minr"
"maxr" "iminc" "imaxc" "iminr" "imaxr" "fft" "ffti" "cmult"
"cdiv" "mcov" "mcorr" "mxtab" "cdemean" "cholesky" "psdroot" "inv"
"invpd" "ginv" "diag" "transp" "vec" "vech" "unvech" "upper"
"lower" "rows" "cols" "det" "ldet" "tr" "onenorm" "infnorm"
"rcond" "rank" "qform" "mlag" "qrdecomp" "eigensym" "eigengen" "nullspace"
"princomp" "mexp" "fdjac" "BFGSmax" "obsnum" "isseries" "isscalar" "islist"
"isstring" "isnull" "nelem" "pdf" "cdf" "invcdf" "pvalue" "critical"
"randgen" "urcpval" "values" "mshape" "svd" "mols" "mpols" "mrls"
"mread" "mwrite" "selifc" "selifr" "polroots" "dummify" "wmean" "wvar"
"wsd" "xpx" "filter" "kfilter" "ksmooth" "ksimul" "trimr" "getenv"
"argname" "obslabel" "readfile" "grab" "strstr" "strncmp" "strlen" "sscanf"
"varname" "varnum" "tolower" "colnames" "rownames" "ljungbox" "msortby" "lincomb"
"imhof" "toepsolv" "diagcat" "xmin" "xmax" "corrgm" "mcovg" "fcstats"
"bessel" "fraclag" "mreverse" "deseas" "pergm" "irr" "npv" "logistic"
"weekday" "kdensity" "monthlen" "epochday" "setnote" "invmills" "polyfit" "chowlin"
"varsimul" "strsplit" "inlist" "errmsg" "isconst" "irf" "inbundle")
"Builtin functions for Gretl's genr command.")
(defvar gretl-option-flags
'("addstats" "all" "anova" "append"
"arch" "arma-init" "asymptotic" "auto"
"autocorr" "auxiliary" "balanced" "bartlett"
"between" "bootstrap" "both" "breusch-pagan"
"byobs" "by" "c" "close"
"coded" "cols" "column" "comfac"
"complete" "conditional" "contiguous" "continue"
"continuous" "control" "covariance" "cross"
"cross-section" "crt" "csv" "ct"
"ctt" "cubes-only" "dat" "database"
"dataset" "db" "degrees" "dhansen"
"difference" "diffuse" "discrete" "dpdstyle"
"drop-empty" "drop-first" "drop-last" "dummy"
"dynamic" "equal" "exit" "exponential"
"fcp" "fixed-effects" "from-file" "full"
"func" "gamma" "geomean" "gls"
"gmm" "gnu-R" "gnu-octave" "gph"
"gzipped" "hausman-reg" "hessian" "hilu"
"impulse-responses" "input" "inst" "integrate"
"intervals" "inverse-fit" "iterate" "jackknife"
"jbera" "jitter" "jmulti" "kendall"
"lags" "lagselect" "lbfgs" "lillie"
"liml" "linear-fit" "list" "loess-fit"
"log" "loglogistic" "lognormal" "logs"
"matrix" "matrix-diff" "medians" "ml"
"model1" "multi" "multinomial" "nc"
"next" "no-corc" "no-dates" "no-df-corr"
"no-gradient-check" "no-header" "no-missing" "no-scaling"
"no-stats" "normal" "normality" "notches"
"numerical" "odbc" "omit-obs" "one-scale"
"opg" "orthdev" "other" "out-of-sample"
"output" "overwrite" "p-values" "panel"
"panel-vars" "plot" "pooled" "preserve"
"print-final" "progress-bar" "progressive" "pwe"
"quadratic-fit" "quiet" "quit" "radians"
"random" "random-effects" "rank-sum" "raw"
"rc" "replace" "restrict" "restructure"
"reverse" "robust" "rolling" "row"
"rtf" "save" "save-all" "save-ehat"
"save-xbeta" "scalars" "seasonals" "send-data"
"sign" "signed-rank" "silent" "simple"
"simple-print" "single-yaxis" "skip-df" "spearman"
"special-time-series" "squares" "squares-only" "stacked-cross-section"
"stacked-time-series" "static" "stdresid" "suppress-fitted"
"swilk" "system" "t-ratios" "tall"
"test-down" "tex" "time-dummies" "time-series"
"to-file" "to_file" "traditional" "trend"
"two-step" "unequal-vars" "uniform" "unit-weights"
"variance-decomp" "vcv" "verbose" "wald"
"weibull" "weights" "white" "white-nocross"
"with-impulses" "with-lines" "write" "www"
"x-12-arima" "y-diff-only" "z-scores" "zeros")
"Gretl option flags.")
(defvar gretl-internal-vars
'("Fstat" "T" "ahat" "aic" "bic" "chisq" "coeff_ci"
"coeff" "compan" "datatype" "df" "dwpval" "ec" "ehat"
"error" "ess" "fcast" "fcerr" "gmmcrit" "hausman" "hqc"
"h" "jalpha" "jbeta" "jvbeta" "kalman_llt" "kalman_lnl" "kalman_s2"
"kalman_t" "kalman_uhat" "llt" "lnl" "mnlprobs" "ncoeff" "nobs"
"nscan" "nvars" "obs" "pd" "pvalue" "rho" "rlnl"
"rsq" "s00" "s01" "s11" "sample" "sargan" "sigma"
"stderr" "stopwatch" "sysA" "sysB" "sysGamma" "t1" "t2"
"test" "trsq" "uhat" "unit" "vcv" "version" "vma"
"windows" "xlist" "xtxinv" "yhat" )
"Model- and dataset-related variables.")
(defconst gretl-block-start-keywords
(list "loop" "foreign" "function" "gmm" "if" "system" "mle" "nls" "restrict"))
(defconst gretl-block-other-keywords
(list "else" "elif"))
(defconst gretl-block-end-keywords
(list "end" "endif" "endloop"))
(defvar gretl-keywords
(append gretl-block-start-keywords
gretl-block-other-keywords
gretl-block-end-keywords
'("break"))
"Reserved words in Gretl.")
(defun gretl-at-keyword (kw-list)
; not a keyword if used as a field name, X.word, or quoted, :word
(and (or (= (point) 1)
(and (not (equal (char-before (point)) ?.))
(not (equal (char-before (point)) ?:))))
(not (ess-inside-string-or-comment-p (point)))
(not (ess-inside-brackets-p (point)))
(member (current-word) kw-list)))
(defconst gretl-font-lock-keywords
(list
;; Fontify all builtin keywords.
(cons (concat "\\<\\(" (regexp-opt gretl-keywords) "\\)\\>")
'font-lock-keyword-face)
;; Fontify all option flags.
(cons (concat "[ \t]--\\(" (regexp-opt gretl-option-flags) "\\)")
'font-lock-constant-face)
;; Fontify all command words.
(cons (concat "\\<\\(" (regexp-opt gretl-command-words) "\\)\\>")
'font-lock-builtin-face)
;; Fontify all builtin operators.
(cons "\\(&\\||\\|<=\\|>=\\|==\\|<\\|>\\|!=\\|!\\)"
(if (boundp 'font-lock-builtin-face)
'font-lock-builtin-face
'font-lock-preprocessor-face))
;; Fontify all internal variables.
(cons (concat "\\$\\(" (regexp-opt gretl-internal-vars) "\\)\\>")
'font-lock-variable-name-face)
;; Fontify all genr functions.
(cons (concat "\\<\\(" (regexp-opt gretl-genr-functions) "\\)\\>")
'font-lock-variable-name-face)
;; Fontify all function declarations.
(list gretl-function-header-regexp
'(1 font-lock-keyword-face)
'(3 font-lock-function-name-face nil t)))
"Additional Gretl expressions to highlight.")
(defvar gretl-block-begin-regexp
(concat "\\<\\(" (regexp-opt gretl-block-start-keywords) "\\)\\>"))
(defvar gretl-block-else-regexp
(concat "\\<\\(" (regexp-opt gretl-block-other-keywords) "\\)\\>"))
(defvar gretl-block-end-regexp
(concat "\\<\\(" (regexp-opt gretl-block-end-keywords) "\\)\\>"))
(defvar gretl-block-begin-or-end-regexp
(concat gretl-block-begin-regexp "\\|" gretl-block-end-regexp))
(defvar gretl-block-else-or-end-regexp
(concat gretl-block-else-regexp "\\|" gretl-block-end-regexp))
(defvar gretl-basic-offset 4)
(defvar gretl-block-match-alist
'(("loop" . ("endloop"))
("if" . ("else" "elif" "endif"))
("nls" . ("end"))
("mle" . ("end"))
("gmm" . ("end"))
("foreign" . ("end"))
("restrict" . ("end"))
("kalman" . ("end"))
("system" . ("end")))
"Alist with Gretl's matching block keywords.
Has Gretl's begin keywords as keys and a list of the matching else or
end keywords as associated values.")
; get the position of the last open block
(defun gretl-last-open-block-pos (min)
(let ((count 0))
(while (not (or (> count 0) (<= (point) min)))
(backward-word 1)
(setq count