Remove ignored files
This commit is contained in:
10
elpa/ess-20180701.100/.dir-locals.el
Normal file
10
elpa/ess-20180701.100/.dir-locals.el
Normal file
@@ -0,0 +1,10 @@
|
||||
;;; Directory Local Variables
|
||||
;;; For more information see (info "(emacs) Directory Variables")
|
||||
|
||||
((nil
|
||||
(bug-reference-bug-regexp . "#\\(?2:[0-9]+\\)")
|
||||
(bug-reference-url-format . "https://github.com/emacs-ess/ess/issues/%s")
|
||||
(sentence-end-double-space))
|
||||
(emacs-lisp-mode
|
||||
(outline-regexp . "\f\\|\\`;\\|;;\\*\\|;;;\\*\\|(def[cvu]\\|(setq\\|;;;;\\*")
|
||||
(indent-tabs-mode)))
|
||||
1737
elpa/ess-20180701.100/allnews.info
Normal file
1737
elpa/ess-20180701.100/allnews.info
Normal file
File diff suppressed because it is too large
Load Diff
443
elpa/ess-20180701.100/announc.info
Normal file
443
elpa/ess-20180701.100/announc.info
Normal file
@@ -0,0 +1,443 @@
|
||||
This is announc.info, produced by makeinfo version 6.1 from
|
||||
announc.texi.
|
||||
|
||||
|
||||
File: announc.info, Node: Announce
|
||||
|
||||
1 ANNOUNCING ESS
|
||||
****************
|
||||
|
||||
The ESS Developers proudly announce the release of ESS 17.11
|
||||
|
||||
Emacs Speaks Statistics (ESS) provides an intelligent, consistent
|
||||
interface between the user and the software. ESS interfaces with
|
||||
R/S-PLUS, SAS, BUGS/JAGS, Stata and other statistical analysis packages
|
||||
under the UNIX, GNU Linux, Microsoft Windows, macOS and other operating
|
||||
systems. ESS is a package for the GNU Emacs and XEmacs text editors
|
||||
whose features ESS uses to streamline the creation and use of
|
||||
statistical software. ESS knows the syntax and grammar of statistical
|
||||
analysis packages and provides consistent display and editing features
|
||||
based on that knowledge. ESS assists in interactive and batch execution
|
||||
of statements written in these statistical analysis languages.
|
||||
|
||||
ESS is freely available under the GNU General Public License (GPL).
|
||||
Please read the file COPYING which comes with the distribution, for more
|
||||
information about the license. For more detailed information, please
|
||||
read the README files that come with ESS.
|
||||
|
||||
* Menu:
|
||||
|
||||
* Latest Version::
|
||||
* Current Features::
|
||||
* Requirements::
|
||||
* Stability::
|
||||
* Mailing List::
|
||||
* Reporting Bugs::
|
||||
* Authors::
|
||||
* License::
|
||||
* New Features::
|
||||
|
||||
|
||||
File: announc.info, Node: Latest Version, Next: Current Features, Prev: Announce, Up: Announce
|
||||
|
||||
1.1 Getting the Latest Version
|
||||
==============================
|
||||
|
||||
1.1.1 Source code
|
||||
-----------------
|
||||
|
||||
You may download the latest ESS release source code from the ESS web
|
||||
page (http://ess.r-project.org) or StatLib
|
||||
(http://lib.stat.cmu.edu/general/ESS/)
|
||||
|
||||
1.1.2 Git for ESS development
|
||||
-----------------------------
|
||||
|
||||
Developers and experimentation on ESS mainly happens through git. ESS
|
||||
is currently hosted on Github: <https://github.com/emacs-ess/ESS>.
|
||||
|
||||
|
||||
File: announc.info, Node: Current Features, Next: Requirements, Prev: Latest Version, Up: Announce
|
||||
|
||||
1.2 Current Features
|
||||
====================
|
||||
|
||||
* Languages Supported:
|
||||
* S family (R, S, and S+ AKA S-PLUS)
|
||||
* SAS
|
||||
* BUGS/JAGS
|
||||
* Stata
|
||||
* Julia
|
||||
* Editing source code (S family, SAS, BUGS/JAGS, Stata, Julia)
|
||||
* Syntactic indentation and highlighting of source code
|
||||
* Partial evaluation of code
|
||||
* Loading and error-checking of code
|
||||
* Source code revision maintenance
|
||||
* Batch execution (SAS, BUGS/JAGS)
|
||||
* Use of imenu to provide links to appropriate functions
|
||||
* Interacting with the process (R family, SAS, Stata, Julia)
|
||||
* Command-line editing
|
||||
* Searchable Command history
|
||||
* Command-line completion of R family object names and file
|
||||
names
|
||||
* Quick access to object lists and search lists
|
||||
* Transcript recording
|
||||
* Interface to the help system
|
||||
* Transcript manipulation (S family, Stata)
|
||||
* Recording and saving transcript files
|
||||
* Manipulating and editing saved transcripts
|
||||
* Re-evaluating commands from transcript files
|
||||
* Interaction with Help Pages and other Documentation (R)
|
||||
* Fast Navigation
|
||||
* Sending Examples to running ESS process.
|
||||
* Fast Transfer to Further Help Pages
|
||||
* Help File Editing (R)
|
||||
* Syntactic indentation and highlighting of source code.
|
||||
* Sending Examples to running ESS process.
|
||||
* Previewing
|
||||
|
||||
|
||||
File: announc.info, Node: Requirements, Next: Stability, Prev: Current Features, Up: Announce
|
||||
|
||||
1.3 Requirements
|
||||
================
|
||||
|
||||
ESS is most likely to work with current/recent versions of the following
|
||||
statistical packages: R/S-PLUS, SAS, Stata, OpenBUGS and JAGS.
|
||||
|
||||
ESS supports current, and recent, stable versions of GNU Emacs
|
||||
(currently, 24.3 or higher; alpha/beta/pre-release versions are NOT
|
||||
SUPPORTED).
|
||||
|
||||
Due to XEmacs lacking some features that ESS requires, ESS support of
|
||||
XEmacs ended with ESS 12.04-4.
|
||||
|
||||
To build the PDF documentation, you will need a version of TeX Live
|
||||
or texinfo that includes texi2dvi (BEWARE: recent TeX Live, and some
|
||||
texinfo RPMs, do NOT include texi2dvi).
|
||||
|
||||
|
||||
File: announc.info, Node: Stability, Next: Mailing List, Prev: Requirements, Up: Announce
|
||||
|
||||
1.4 Stability
|
||||
=============
|
||||
|
||||
All recent released versions are meant to be release-quality versions.
|
||||
While some new features are being introduced, we are cleaning up and
|
||||
improving the interface. We know that there are many remaining
|
||||
opportunities for documentation improvements, but all contributors are
|
||||
volunteers and time is precious. Patches or suggested fixes with bug
|
||||
reports are much appreciated!
|
||||
|
||||
|
||||
File: announc.info, Node: Mailing List, Next: Reporting Bugs, Prev: Stability, Up: Announce
|
||||
|
||||
1.5 Mailing List
|
||||
================
|
||||
|
||||
There is a mailing list for discussions and announcements relating to
|
||||
ESS. Join the list by sending an e-mail with "subscribe ess-help" (or
|
||||
"help") in the body to <ess-help-request@r-project.org>; contributions
|
||||
to the list may be mailed to <ess-help@r-project.org>. Rest assured,
|
||||
this is a fairly low-volume mailing list.
|
||||
|
||||
The purposes of the mailing list include
|
||||
|
||||
* helping users of ESS to get along with it.
|
||||
* discussing aspects of using ESS on Emacs and XEmacs.
|
||||
* suggestions for improvements.
|
||||
* announcements of new releases of ESS.
|
||||
* posting small patches to ESS.
|
||||
|
||||
|
||||
File: announc.info, Node: Reporting Bugs, Next: Authors, Prev: Mailing List, Up: Announce
|
||||
|
||||
1.6 Reporting Bugs
|
||||
==================
|
||||
|
||||
Please send bug reports, suggestions etc. to <ESS-bugs@r-project.org>,
|
||||
or post them on our github issue tracker
|
||||
(https://github.com/emacs-ess/ESS/issues)
|
||||
|
||||
The easiest way to do this is within Emacs by typing
|
||||
|
||||
'M-x ess-submit-bug-report'
|
||||
|
||||
This also gives the maintainers valuable information about your
|
||||
installation which may help us to identify or even fix the bug.
|
||||
|
||||
If Emacs reports an error, backtraces can help us debug the problem.
|
||||
Type "M-x set-variable RET debug-on-error RET t RET". Then run the
|
||||
command that causes the error and you should see a *Backtrace* buffer
|
||||
containing debug information; send us that buffer.
|
||||
|
||||
Note that comments, suggestions, words of praise and large cash
|
||||
donations are also more than welcome.
|
||||
|
||||
|
||||
File: announc.info, Node: Authors, Next: License, Prev: Reporting Bugs, Up: Announce
|
||||
|
||||
1.7 Authors
|
||||
===========
|
||||
|
||||
* A.J. Rossini (mailto:blindglobe@gmail.com)
|
||||
* Richard M. Heiberger (mailto:rmh@temple.edu)
|
||||
* Kurt Hornik (mailto:Kurt.Hornik@R-project.org)
|
||||
* Martin Maechler (mailto:maechler@stat.math.ethz.ch)
|
||||
* Rodney A. Sparapani (mailto:rsparapa@mcw.edu)
|
||||
* Stephen Eglen (mailto:stephen@gnu.org)
|
||||
* Sebastian P. Luque (mailto:spluque@gmail.com)
|
||||
* Henning Redestig (mailto:henning.red@googlemail.com)
|
||||
* Vitalie Spinu (mailto:spinuvit@gmail.com)
|
||||
* Lionel Henry (mailto:lionel.hry@gmail.com)
|
||||
|
||||
|
||||
File: announc.info, Node: License, Next: New Features, Prev: Authors, Up: Announce
|
||||
|
||||
1.8 License
|
||||
===========
|
||||
|
||||
The source and documentation of ESS 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.
|
||||
|
||||
ESS 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 in
|
||||
the file COPYING in the same directory as this file for more details.
|
||||
|
||||
|
||||
File: announc.info, Node: New Features, Prev: License, Up: Announce
|
||||
|
||||
1.9 New Features
|
||||
================
|
||||
|
||||
Changes and New Features in development version:
|
||||
|
||||
* This is the last release to support Emacs older than 25.1 Going
|
||||
forward, only GNU Emacs 25.1 and newer will be supported. Soon
|
||||
after this release, support for older Emacs versions will be
|
||||
dropped from the git master branch. Note that MELPA uses the git
|
||||
master branch to produce ESS snapshots, so if you are using Emacs <
|
||||
25.1 from MELPA and are unable to upgrade, you should switch to
|
||||
MELPA-stable.
|
||||
|
||||
* ESS[R]: Long + + prompts in the inferior no longer offset output.
|
||||
New option 'strip' for 'inferior-ess-replace-long+' strips the
|
||||
entire + + sequence.
|
||||
|
||||
* ESS[R]: Fontification of roxygen '@param' keywords now supports
|
||||
comma-separated parameters.
|
||||
|
||||
* ESS[R]: Function-like keywords such as 'if ()' or 'stop()' are no
|
||||
longer fontified as keyword if not followed by an opening
|
||||
parenthesis. The same holds for search path modifiers like
|
||||
'library()' or 'require()'. This feature is only available in
|
||||
Emacs >= 25.
|
||||
|
||||
* ESS[R]: We have improved fontification of keywords so they better
|
||||
reflect the semantics of the R language. 'ess-R-keywords' now only
|
||||
contains words reserved by the R parser.
|
||||
'ess-R-control-flow-keywords' contains words of base functions that
|
||||
cause non-contiguous control flow, such as 'return()' and 'stop()'.
|
||||
It includes the following variables that were previously not
|
||||
fontified: 'on.exit()', 'tryCatch()', 'withRestarts()',
|
||||
'invokeRestart()', 'recover()' and 'browser()'
|
||||
|
||||
Finally, 'ess-R-signal-keywords' contains functions part of the
|
||||
condition system that only potentially impact control flow:
|
||||
'message()', 'warning()' (moved from 'ess-R-keywords'),
|
||||
'signalCondition()' and 'withCallingHandlers()'. These keywords
|
||||
inherit from 'ess-modifiers-face' (the face used for 'library()'
|
||||
etc).
|
||||
|
||||
* ESS modes now inherit from 'prog-mode'.
|
||||
|
||||
* ESS[R]: The package development minor mode now only activates
|
||||
within editing buffers by default, i.e. ones that inherit from
|
||||
'prog-mode' or 'text-mode'. If you want to restore the old
|
||||
behaviour and activate the package mode in all buffers (that have a
|
||||
'default-directory' that is part of a package path), set
|
||||
'ess-r-package-auto-activate' to 't'.
|
||||
|
||||
* ESS now provides support for flymake in R buffers for Emacs 26 and
|
||||
newer. Users need to install the 'lintr' package (available on
|
||||
CRAN) to use it. Customizable options include 'ess-use-flymake',
|
||||
'ess-r-flymake-linters', and 'ess-r-flymake-lintr-cache'.
|
||||
|
||||
* Improved customization for faces. ESS now provides custom faces
|
||||
for (nearly) all faces used and places face customization options
|
||||
into their own group. Users can customize these options using 'M-x
|
||||
customize-group RET ess-faces'.
|
||||
|
||||
* ESS[R]: Gained support for xref in Emacs 25+. *Note (emacs)Xref::
|
||||
|
||||
* ESS[R]: Changing the working directory is now always reflected in
|
||||
the process buffer.
|
||||
|
||||
* ESS[R]: The startup screen has been cleaned up and displays the
|
||||
startup directory with an explicit 'setwd()'.
|
||||
|
||||
* ESS now displays the language dialect in the mode-line So, for
|
||||
example, R buffers will now show ESS[R] rather than ESS[S].
|
||||
|
||||
* The ESS manual has been updated and revised.
|
||||
|
||||
* ESS[R]: 'Makevars' files are now automatically opened with
|
||||
'makefile-mode'.
|
||||
|
||||
* New varaible 'ess-write-to-dribble'. This allows users to disable
|
||||
the dribble ('*ESS*') buffer if they wish.
|
||||
|
||||
* ESS now respects Emacs conventions for keybindings. This means
|
||||
that The 'C-c [letter]' bindings have been removed. This affects
|
||||
'C-c h', which was bound to 'ess-eval-line-and-step-invisibly' in
|
||||
'sas-mode-local-map'; 'C-c f', which was bound to
|
||||
'ess-insert-function-outline' in 'ess-add-MM-keys'; and 'C-c h',
|
||||
which was bound to 'ess-handy-commands' in 'Rd-mode-map',
|
||||
'ess-noweb-minor-mode-map', and 'ess-help-mode-map'
|
||||
|
||||
* prettify-symbols-mode no longer breaks indentation This is
|
||||
accomplished by having the pretty symbols occupy the same number of
|
||||
characters as their non-pretty cousins. You may customize the new
|
||||
variable 'ess-r-prettify-symbols' to control this behavior.
|
||||
|
||||
* Variable 'ess-s-versions-list' is obsolete and ignored. Use
|
||||
'ess-s-versions' instead. You may pass arguments by starting the
|
||||
inferior process with the universal argument.
|
||||
|
||||
* The 'ess-r-args.el' library has obsoleted and will be removed in a
|
||||
future release. Use 'eldoc-mode' instead, which is on by default.
|
||||
|
||||
* All of the '*-program-name' variables have been renamed to
|
||||
'*-program'. Users who previously customized e.g.
|
||||
'inferior-ess-R-program-name' will need to update their
|
||||
customization to 'inferior-ess-R-program'. These variables are
|
||||
treated as risky variables.
|
||||
|
||||
* Customization of ess-smart-S-assign-key has been reworked. Use
|
||||
'(setq ess-smart-S-assign-key nil)' to disable smart assignment at
|
||||
any time instead of '(ess-toggle-underscore nil)'. To use another
|
||||
key, you should set the value of 'ess-smart-S-assign-key' before
|
||||
ESS is loaded. The following functions have been made obsolete.
|
||||
You should customize ess-smart-S-assign-key instead:
|
||||
ess-toggle-S-assign, ess-toggle-S-assign-key,
|
||||
ess-unset-smart-S-assign-key, ess-activate-smart-S-assign-key,
|
||||
ess-disable-smart-S-assign
|
||||
|
||||
Changes and New Features in 17.11:
|
||||
|
||||
* The ESS initialisation process has been streamlined. You can now
|
||||
load the R and Stata modes independently from the rest of ESS. Just
|
||||
put '(require 'ess-r-mode)' or '(require 'ess-stata-mode)' in your
|
||||
init file. This is for experienced Emacs users as this requires
|
||||
setting up autoloads for '.R' files manually. We will keep
|
||||
maintaining 'ess-site' for easy loading of all ESS features.
|
||||
|
||||
* Reloading and quitting the process is now more robust. If no
|
||||
process is attached, ESS now switches automatically to one
|
||||
(prompting you for selection if there are several running).
|
||||
Reloading and quitting will now work during a debug session or when
|
||||
R is prompting for input (for instance after a crash). Finally,
|
||||
the window configuration is saved and restored after reloading to
|
||||
prevent the buffer of the new process from capturing the cursor.
|
||||
|
||||
* ESS[R]: New command 'ess-r-package-use-dir'. It sets the working
|
||||
directory of the current process to the current package directory.
|
||||
|
||||
* ESS[R] Lookup for references in inferior buffers has been improved.
|
||||
New variable 'ess-r-package-source-roots' contains package
|
||||
sub-directories which are searched recursively during the file
|
||||
lookup point. Directories in 'ess-tracebug-search-path' are now
|
||||
also searched recursively.
|
||||
|
||||
* ESS[R] Namespaced evaluation is now automatically enabled only in
|
||||
the 'R/' directory. This way ESS will not attempt to update
|
||||
function definitions from a package if you are working from e.g. a
|
||||
test file.
|
||||
|
||||
Changes and New Features in 16.10:
|
||||
|
||||
* ESS[R]: Syntax highlighting is now more consistent. Backquoted
|
||||
names are not fontified as strings (since they really are
|
||||
identifiers). Furthermore they are now correctly recognised when
|
||||
they are function definitions or function calls.
|
||||
* ESS[R]: Backquoted names and '%op%' operators are recognised as
|
||||
sexp. This is useful for code navigation, e.g. with 'C-M-f' and
|
||||
'C-M-b'.
|
||||
* ESS[R]: Integration of outline mode with roxygen examples fields.
|
||||
You can use outline mode's code folding commands to fold the
|
||||
examples field. This is especially nice to use with well
|
||||
documented packages with long examples set. Set
|
||||
'ess-roxy-fold-examples' to non-nil to automatically fold the
|
||||
examples field when you open a buffer.
|
||||
* ESS[R]: New experimental feature: syntax highlighting in roxygen
|
||||
examples fields. This is turned off by default. Set
|
||||
'ess-roxy-fontify-examples' to non-nil to try it out.
|
||||
* ESS[R]: New package development command 'ess-r-devtools-ask' bound
|
||||
to 'C-c C-w C-a'. It asks with completion for any devtools command
|
||||
that takes 'pkg' as argument.
|
||||
* ESS[R]: New command 'C-c C-e C-r' to reload the inferior process.
|
||||
Currently only implemented for R. The R method runs
|
||||
'inferior-ess-r-reload-hook' on reloading.
|
||||
* ESS[R]: 'ess-r-package-mode' is now activated in non-file buffers
|
||||
as well.
|
||||
|
||||
Bug fixes in 16.10:
|
||||
* ESS[R]: Fix broken (un)flagging for debugging inside packages
|
||||
* ESS[R]: Fixes (and improvements) in Package development
|
||||
* ESS[R]: Completion no longer produces '...=' inside 'list( )'.
|
||||
* ESS[R]: Better debugging and tracing in packages.
|
||||
* ESS[R]: Better detection of symbols at point.
|
||||
* ESS[R]: No more spurious warnings on deletion of temporary files.
|
||||
* ESS[julia]: help and completion work (better)
|
||||
* ESS[julia]: available via 'ess-remote'
|
||||
|
||||
Changes and New Features in 16.04:
|
||||
|
||||
* ESS[R]: 'developer' functionality has been refactored. The new
|
||||
user interface consists of a single command
|
||||
'ess-r-set-evaluation-env' bound by default to 'C-c C-t C-s'. Once
|
||||
an evaluation environment has been set with, all subsequent ESS
|
||||
evaluation will source the code into that environment. By default,
|
||||
for file within R packages the evaluation environment is set to the
|
||||
package environment. Set 'ess-r-package-auto-set-evaluation-env'
|
||||
to 'nil' to disable this.
|
||||
* ESS[R]: New 'ess-r-package-mode' This development mode provides
|
||||
features to make package development easier. Currently, most of
|
||||
the commands are based on the 'devtools' packages and are
|
||||
accessible with 'C-c C-w' prefix. See the documentation of
|
||||
'ess-r-package-mode' function for all available commands. With
|
||||
'C-u' prefix each command asks for extra arguments to the
|
||||
underlying devtools function. This mode is automatically enabled
|
||||
in all files within R packages and is indicated with '[pkg:NAME]'
|
||||
in the mode-line.
|
||||
* ESS[R]: Help lookup has been improved. It is now possible to get
|
||||
help for namespaced objects such as pkg::foobar. Furthermore, ESS
|
||||
recognizes more reliably when you change 'options('html_type')'.
|
||||
* ESS[R]: New specialized breakpoints for debugging magrittr pipes
|
||||
* ESS: ESS now implements a simple message passing interface to
|
||||
communicate between ESS and inferior process.
|
||||
|
||||
Bug fixes in 16.04:
|
||||
* ESS[R]: Roxygen blocks with backtics are now correctly filled
|
||||
* ESS[R]: Don't skip breakpoints in magrittr's 'debug_pipe'
|
||||
* ESS[R]: Error highlighting now understands 'testthat' type errors
|
||||
* ESS[Julia]: Added getwd and setwd generic commands
|
||||
|
||||
|
||||
|
||||
Tag Table:
|
||||
Node: Announce75
|
||||
Node: Latest Version1315
|
||||
Node: Current Features1869
|
||||
Node: Requirements3412
|
||||
Node: Stability4118
|
||||
Node: Mailing List4620
|
||||
Node: Reporting Bugs5343
|
||||
Node: Authors6223
|
||||
Node: License6847
|
||||
Node: New Features7495
|
||||
|
||||
End Tag Table
|
||||
18
elpa/ess-20180701.100/authors.info
Normal file
18
elpa/ess-20180701.100/authors.info
Normal file
@@ -0,0 +1,18 @@
|
||||
This is authors.info, produced by makeinfo version 6.1 from
|
||||
authors.texi.
|
||||
|
||||
* A.J. Rossini (mailto:blindglobe@gmail.com)
|
||||
* Richard M. Heiberger (mailto:rmh@temple.edu)
|
||||
* Kurt Hornik (mailto:Kurt.Hornik@R-project.org)
|
||||
* Martin Maechler (mailto:maechler@stat.math.ethz.ch)
|
||||
* Rodney A. Sparapani (mailto:rsparapa@mcw.edu)
|
||||
* Stephen Eglen (mailto:stephen@gnu.org)
|
||||
* Sebastian P. Luque (mailto:spluque@gmail.com)
|
||||
* Henning Redestig (mailto:henning.red@googlemail.com)
|
||||
* Vitalie Spinu (mailto:spinuvit@gmail.com)
|
||||
* Lionel Henry (mailto:lionel.hry@gmail.com)
|
||||
|
||||
|
||||
Tag Table:
|
||||
|
||||
End Tag Table
|
||||
26
elpa/ess-20180701.100/bugrept.info
Normal file
26
elpa/ess-20180701.100/bugrept.info
Normal file
@@ -0,0 +1,26 @@
|
||||
This is bugrept.info, produced by makeinfo version 6.1 from
|
||||
bugrept.texi.
|
||||
|
||||
Please send bug reports, suggestions etc. to <ESS-bugs@r-project.org>,
|
||||
or post them on our github issue tracker
|
||||
(https://github.com/emacs-ess/ESS/issues)
|
||||
|
||||
The easiest way to do this is within Emacs by typing
|
||||
|
||||
'M-x ess-submit-bug-report'
|
||||
|
||||
This also gives the maintainers valuable information about your
|
||||
installation which may help us to identify or even fix the bug.
|
||||
|
||||
If Emacs reports an error, backtraces can help us debug the problem.
|
||||
Type "M-x set-variable RET debug-on-error RET t RET". Then run the
|
||||
command that causes the error and you should see a *Backtrace* buffer
|
||||
containing debug information; send us that buffer.
|
||||
|
||||
Note that comments, suggestions, words of praise and large cash
|
||||
donations are also more than welcome.
|
||||
|
||||
|
||||
Tag Table:
|
||||
|
||||
End Tag Table
|
||||
80
elpa/ess-20180701.100/credits.info
Normal file
80
elpa/ess-20180701.100/credits.info
Normal file
@@ -0,0 +1,80 @@
|
||||
This is credits.info, produced by makeinfo version 6.1 from
|
||||
credits.texi.
|
||||
|
||||
The ESS environment is built on the open-source projects of many
|
||||
contributors, dating back to 1989 where Doug Bates and Ed Kademan wrote
|
||||
S-mode to edit S and Splus files in GNU Emacs. Frank Ritter and Mike
|
||||
Meyer added features, creating version 2. Meyer and David Smith made
|
||||
further contributions, creating version 3. For version 4, David Smith
|
||||
provided significant enhancements to allow for powerful process
|
||||
interaction.
|
||||
|
||||
John Sall wrote GNU Emacs macros for SAS source code around 1990.
|
||||
Tom Cook added functions to submit jobs, review listing and log files,
|
||||
and produce basic views of a dataset, thus creating a SAS-mode which was
|
||||
distributed in 1994.
|
||||
|
||||
In 1994, A.J. Rossini extended S-mode to support XEmacs. Together
|
||||
with extensions written by Martin Maechler, this became version 4.7 and
|
||||
supported S, Splus, and R. In 1995, Rossini extended SAS-mode to work
|
||||
with XEmacs.
|
||||
|
||||
In 1997, Rossini merged S-mode and SAS-mode into a single Emacs
|
||||
package for statistical programming; the product of this marriage was
|
||||
called ESS version 5. Richard M. Heiberger designed the inferior mode
|
||||
for interactive SAS and SAS-mode was further integrated into ESS. Thomas
|
||||
Lumley's Stata mode, written around 1996, was also folded into ESS. More
|
||||
changes were made to support additional statistical languages,
|
||||
particularly XLispStat.
|
||||
|
||||
ESS initially worked only with Unix statistics packages that used
|
||||
standard-input and standard-output for both the command-line interface
|
||||
and batch processing. ESS could not communicate with statistical
|
||||
packages that did not use this protocol. This changed in 1998 when
|
||||
Brian Ripley demonstrated use of the Windows Dynamic Data Exchange (DDE)
|
||||
protocol with ESS. Heiberger then used DDE to provide interactive
|
||||
interfaces for Windows versions of Splus. In 1999, Rodney A. Sparapani
|
||||
and Heiberger implemented SAS batch for ESS relying on files, rather
|
||||
than standard-input/standard-output, for Unix, Windows and Mac. In
|
||||
2001, Sparapani added BUGS batch file processing to ESS for Unix and
|
||||
Windows.
|
||||
|
||||
* The multiple process code, and the idea for
|
||||
'ess-eval-line-and-next-line' are by Rod Ball.
|
||||
|
||||
* Thanks to Doug Bates for many useful suggestions.
|
||||
|
||||
* Thanks to Martin Maechler for reporting and fixing bugs, providing
|
||||
many useful comments and suggestions, and for maintaining the ESS
|
||||
mailing lists.
|
||||
|
||||
* Thanks to Frank Ritter for updates, particularly the menu code, and
|
||||
invaluable comments on the manual.
|
||||
|
||||
* Thanks to Ken'ichi Shibayama for his excellent indenting code, and
|
||||
many comments and suggestions.
|
||||
|
||||
* Thanks to Aki Vehtari for adding interactive BUGS support.
|
||||
|
||||
* Thanks to Brendan Halpin for bug-fixes and updates to Stata-mode.
|
||||
|
||||
* Last, but definitely not least, thanks to the many ESS users and
|
||||
contributors to the ESS mailing lists.
|
||||
|
||||
_ESS_ is being developed and currently maintained by
|
||||
|
||||
* A.J. Rossini (mailto:blindglobe@gmail.com)
|
||||
* Richard M. Heiberger (mailto:rmh@temple.edu)
|
||||
* Kurt Hornik (mailto:Kurt.Hornik@R-project.org)
|
||||
* Martin Maechler (mailto:maechler@stat.math.ethz.ch)
|
||||
* Rodney A. Sparapani (mailto:rsparapa@mcw.edu)
|
||||
* Stephen Eglen (mailto:stephen@gnu.org)
|
||||
* Sebastian P. Luque (mailto:spluque@gmail.com)
|
||||
* Henning Redestig (mailto:henning.red@googlemail.com)
|
||||
* Vitalie Spinu (mailto:spinuvit@gmail.com)
|
||||
* Lionel Henry (mailto:lionel.hry@gmail.com)
|
||||
|
||||
|
||||
Tag Table:
|
||||
|
||||
End Tag Table
|
||||
42
elpa/ess-20180701.100/currfeat.info
Normal file
42
elpa/ess-20180701.100/currfeat.info
Normal file
@@ -0,0 +1,42 @@
|
||||
This is currfeat.info, produced by makeinfo version 6.1 from
|
||||
currfeat.texi.
|
||||
|
||||
* Languages Supported:
|
||||
* S family (R, S, and S+ AKA S-PLUS)
|
||||
* SAS
|
||||
* BUGS/JAGS
|
||||
* Stata
|
||||
* Julia
|
||||
* Editing source code (S family, SAS, BUGS/JAGS, Stata, Julia)
|
||||
* Syntactic indentation and highlighting of source code
|
||||
* Partial evaluation of code
|
||||
* Loading and error-checking of code
|
||||
* Source code revision maintenance
|
||||
* Batch execution (SAS, BUGS/JAGS)
|
||||
* Use of imenu to provide links to appropriate functions
|
||||
* Interacting with the process (R family, SAS, Stata, Julia)
|
||||
* Command-line editing
|
||||
* Searchable Command history
|
||||
* Command-line completion of R family object names and file
|
||||
names
|
||||
* Quick access to object lists and search lists
|
||||
* Transcript recording
|
||||
* Interface to the help system
|
||||
* Transcript manipulation (S family, Stata)
|
||||
* Recording and saving transcript files
|
||||
* Manipulating and editing saved transcripts
|
||||
* Re-evaluating commands from transcript files
|
||||
* Interaction with Help Pages and other Documentation (R)
|
||||
* Fast Navigation
|
||||
* Sending Examples to running ESS process.
|
||||
* Fast Transfer to Further Help Pages
|
||||
* Help File Editing (R)
|
||||
* Syntactic indentation and highlighting of source code.
|
||||
* Sending Examples to running ESS process.
|
||||
* Previewing
|
||||
|
||||
|
||||
|
||||
Tag Table:
|
||||
|
||||
End Tag Table
|
||||
19
elpa/ess-20180701.100/dir
Normal file
19
elpa/ess-20180701.100/dir
Normal 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, "?" 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).
|
||||
85
elpa/ess-20180701.100/ess-arc-d.el
Normal file
85
elpa/ess-20180701.100/ess-arc-d.el
Normal file
@@ -0,0 +1,85 @@
|
||||
;;; ess-arc-d.el --- ARC customization
|
||||
|
||||
;; Copyright (C) 2000 A. J. Rossini
|
||||
;; Copyright (C) 2001--2004 A.J. Rossini, Richard M. Heiberger, Martin
|
||||
;; Maechler, Kurt Hornik, Rodney Sparapani, and Stephen Eglen.
|
||||
|
||||
;; Author: A.J. Rossini <rossini@stat.sc.edu>
|
||||
;; Created: 30 Jun 2000
|
||||
;; Maintainer: ESS-core <ESS-core@r-project.org>
|
||||
|
||||
;; Keywords: languages
|
||||
|
||||
;; 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/
|
||||
|
||||
|
||||
;;; Commentary:
|
||||
|
||||
;; This file extends the XLispStat configuration for ARC, the extension of the
|
||||
;; R-Code.
|
||||
|
||||
;;; Code:
|
||||
|
||||
(require 'ess-lsp-l)
|
||||
(require 'ess-inf)
|
||||
(declare-function ess-write-to-dribble-buffer "ess-utils")
|
||||
(defvar ess-customize-alist)
|
||||
(defvar ess-dialect)
|
||||
|
||||
(defvar ARC-customize-alist
|
||||
'((ess-customize-alist . ARC-customize-alist )
|
||||
(ess-language . "XLS" )
|
||||
(ess-dialect . "ARC" )
|
||||
(ess-loop-timeout . ess-XLS-loop-timeout)
|
||||
(ess-object-name-db-file . "ess-xls-namedb.el" )
|
||||
(ess-help-sec-regex . " ")
|
||||
(ess-help-sec-keys-alist . " ")
|
||||
(inferior-ess-primary-prompt . "> ?" )
|
||||
(comint-use-prompt-regexp . t)
|
||||
(inferior-ess-program . inferior-ARC-program)
|
||||
(inferior-ess-help-command . "(help '%s)\n" )
|
||||
(inferior-ess-objects-command . "(variables)\n" )
|
||||
(inferior-ess-exit-command . "(exit)\n" )
|
||||
;;(inferior-ess-start-args . nil)
|
||||
(inferior-ess-start-file . nil)) ; "~/.ess-ARC")
|
||||
|
||||
"Variables to customize for ARC, a dialect of XLS.")
|
||||
|
||||
|
||||
(defun ARC-mode (&optional proc-name)
|
||||
"Major mode for editing ARC source. NOT EVEN STARTED."
|
||||
(interactive)
|
||||
(setq ess-customize-alist ARC-customize-alist)
|
||||
(lisp-mode))
|
||||
|
||||
|
||||
(defun ARC ()
|
||||
"Call 'ARC', the extend XLispStat statistical system, from Forrest Young."
|
||||
|
||||
(interactive)
|
||||
(setq ess-customize-alist ARC-customize-alist)
|
||||
(ess-write-to-dribble-buffer
|
||||
(format "(ARC): ess-dialect=%s , buf=%s\n"
|
||||
ess-dialect (current-buffer)))
|
||||
(inferior-ess))
|
||||
|
||||
(fset 'arc 'ARC)
|
||||
|
||||
; Provide package
|
||||
|
||||
(provide 'ess-arc-d)
|
||||
|
||||
;;; ess-arc-d.el ends here
|
||||
940
elpa/ess-20180701.100/ess-autoloads.el
Normal file
940
elpa/ess-20180701.100/ess-autoloads.el
Normal file
@@ -0,0 +1,940 @@
|
||||
;;; ess-autoloads.el --- automatically extracted autoloads
|
||||
;;
|
||||
;;; Code:
|
||||
|
||||
(add-to-list 'load-path (directory-file-name
|
||||
(or (file-name-directory #$) (car load-path))))
|
||||
|
||||
|
||||
;;;### (autoloads nil "ess-arc-d" "ess-arc-d.el" (0 0 0 0))
|
||||
;;; Generated autoloads from ess-arc-d.el
|
||||
|
||||
(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ess-arc-d" '("ARC")))
|
||||
|
||||
;;;***
|
||||
|
||||
;;;### (autoloads nil "ess-bugs-d" "ess-bugs-d.el" (0 0 0 0))
|
||||
;;; Generated autoloads from ess-bugs-d.el
|
||||
|
||||
(autoload 'ess-bugs-mode "ess-bugs-d" "\
|
||||
ESS[BUGS]: Major mode for BUGS.
|
||||
|
||||
\(fn)" t nil)
|
||||
|
||||
(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))
|
||||
|
||||
(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ess-bugs-d" '("ess-")))
|
||||
|
||||
;;;***
|
||||
|
||||
;;;### (autoloads nil "ess-bugs-l" "ess-bugs-l.el" (0 0 0 0))
|
||||
;;; Generated autoloads from ess-bugs-l.el
|
||||
|
||||
(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ess-bugs-l" '("ess-bugs-")))
|
||||
|
||||
;;;***
|
||||
|
||||
;;;### (autoloads nil "ess-custom" "ess-custom.el" (0 0 0 0))
|
||||
;;; Generated autoloads from ess-custom.el
|
||||
|
||||
(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ess-custom" '("ess-" "inferior-" "julia-basic-offset" "comint-highlight-prompt" "SAS-mode-hook" "S+" "S-" "Rnw-mode-hook" "R-" "no-doc")))
|
||||
|
||||
;;;***
|
||||
|
||||
;;;### (autoloads nil "ess-dde" "ess-dde.el" (0 0 0 0))
|
||||
;;; Generated autoloads from ess-dde.el
|
||||
|
||||
(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ess-dde" '("ess-")))
|
||||
|
||||
;;;***
|
||||
|
||||
;;;### (autoloads nil "ess-font-lock" "ess-font-lock.el" (0 0 0 0))
|
||||
;;; Generated autoloads from ess-font-lock.el
|
||||
|
||||
(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ess-font-lock" '("ess-font-lock-")))
|
||||
|
||||
;;;***
|
||||
|
||||
;;;### (autoloads nil "ess-generics" "ess-generics.el" (0 0 0 0))
|
||||
;;; Generated autoloads from ess-generics.el
|
||||
|
||||
(autoload 'ess-defgeneric "ess-generics" "\
|
||||
Define a new function, as with `defun', which can be overloaded.
|
||||
NAME is the name of the function to create. ARGS are the
|
||||
arguments to the function. DOCSTRING is a documentation string to
|
||||
describe the function. The docstring will automatically have
|
||||
details about its overload symbol appended to the end. BODY is
|
||||
code that would be run when there is no override defined. The
|
||||
default is to signal error if {name}-function is not defined.
|
||||
|
||||
\(fn NAME ARGS DOCSTRING &rest BODY)" nil t)
|
||||
|
||||
(function-put 'ess-defgeneric 'doc-string-elt '3)
|
||||
|
||||
(function-put 'ess-defgeneric 'lisp-indent-function 'defun)
|
||||
|
||||
(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ess-generics" '("ess-")))
|
||||
|
||||
;;;***
|
||||
|
||||
;;;### (autoloads nil "ess-gretl" "ess-gretl.el" (0 0 0 0))
|
||||
;;; Generated autoloads from ess-gretl.el
|
||||
|
||||
(autoload 'gretl-mode "ess-gretl" "\
|
||||
Major mode for editing gretl source. See `ess-mode' for more help.
|
||||
|
||||
\(fn &optional PROC-NAME)" t nil)
|
||||
|
||||
(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 nil)
|
||||
|
||||
(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ess-gretl" '("ess-gretl-post-run-hook" "inferior-gretl-args" "gretl-")))
|
||||
|
||||
;;;***
|
||||
|
||||
;;;### (autoloads nil "ess-help" "ess-help.el" (0 0 0 0))
|
||||
;;; Generated autoloads from ess-help.el
|
||||
|
||||
(autoload 'ess-display-help-on-object "ess-help" "\
|
||||
Display documentation for OBJECT in another window.
|
||||
If prefix arg is given, force an update of the cached help topics
|
||||
and query the ESS process for the help file instead of reusing an
|
||||
existing buffer if it exists. Uses the variable
|
||||
`inferior-ess-help-command' for the actual help command. Prompts
|
||||
for the object name based on the cursor location for all cases
|
||||
except the S-Plus GUI. With S-Plus on Windows (both GUI and in
|
||||
an inferior Emacs buffer) the GUI help window is used.
|
||||
|
||||
If COMMAND is suplied, it is used instead of `inferior-ess-help-command'.
|
||||
|
||||
\(fn OBJECT &optional COMMAND)" t nil)
|
||||
|
||||
(defalias 'ess-help 'ess-display-help-on-object)
|
||||
|
||||
(autoload 'ess-helpobjs-at-point "ess-help" "\
|
||||
|
||||
|
||||
\(fn SLIST)" nil nil)
|
||||
|
||||
(autoload 'ess-goto-info "ess-help" "\
|
||||
Display node NODE from `ess-mode' info.
|
||||
|
||||
\(fn NODE)" nil nil)
|
||||
|
||||
(autoload 'ess-submit-bug-report "ess-help" "\
|
||||
Submit a bug report on the ess-mode package.
|
||||
|
||||
\(fn)" t nil)
|
||||
|
||||
(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ess-help" '("ess-")))
|
||||
|
||||
;;;***
|
||||
|
||||
;;;### (autoloads nil "ess-inf" "ess-inf.el" (0 0 0 0))
|
||||
;;; Generated autoloads from ess-inf.el
|
||||
|
||||
(autoload 'ess-proc-name "ess-inf" "\
|
||||
Return name of process N, as a string, with NAME prepended.
|
||||
If `ess-plain-first-buffername', then initial process is number-free.
|
||||
|
||||
\(fn N NAME)" nil nil)
|
||||
|
||||
(autoload 'inferior-ess "ess-inf" "\
|
||||
Start inferior ESS process.
|
||||
|
||||
Without a prefix argument, starts a new ESS process, or switches
|
||||
to the ESS process associated with the current buffer. With
|
||||
ESS-START-ARGS (perhaps specified via \\[universal-argument]),
|
||||
starts the process with those args. The current buffer is used
|
||||
if it is an `inferior-ess-mode' or `ess-transcript-mode' buffer.
|
||||
|
||||
If `ess-ask-about-transfile' is non-nil, you will be asked for a
|
||||
transcript file to use. If there is no transcript file, the
|
||||
buffer name will be like *R* or *R2*, determined by
|
||||
`ess-gen-proc-buffer-name-function'.
|
||||
|
||||
Takes the program name from the variable `inferior-ess-program'.
|
||||
An initialization file (dumped into the process) is specified by
|
||||
`inferior-ess-start-file', and `inferior-ess-start-args' is used
|
||||
to accompany the call for `inferior-ess-program'.
|
||||
|
||||
When creating a new process, the process buffer replaces the
|
||||
current window if `inferior-ess-same-window' is non-nil.
|
||||
Alternatively, it can appear in its own frame if
|
||||
`inferior-ess-own-frame' is non-nil.
|
||||
|
||||
\(Type \\[describe-mode] in the process buffer for a list of
|
||||
commands.)
|
||||
|
||||
CUSTOMIZE-ALIST is the list of dialect-specific variables. When
|
||||
non-nil, NO-WAIT tells ESS not to wait for the process to finish.
|
||||
This may be useful for debugging.
|
||||
|
||||
\(fn &optional ESS-START-ARGS CUSTOMIZE-ALIST NO-WAIT)" t nil)
|
||||
|
||||
(ess-defgeneric ess-load-file (&optional filename) "\
|
||||
Load a source file into an inferior ESS process.
|
||||
|
||||
This handles Tramp when working on a remote." (interactive (list (or (and (memq major-mode (quote (ess-mode ess-julia-mode))) (buffer-file-name)) (expand-file-name (read-file-name "Load source file: " nil nil t))))) (ess-load-file--normalise-buffer filename) (save-selected-window (ess-switch-to-ESS t)) (:override (let ((file (ess-load-file--normalise-file filename))) (let ((command (ess-build-load-command file nil t))) (ess-send-string (ess-get-process) command t)))))
|
||||
|
||||
(autoload 'inferior-ess-mode "ess-inf" "\
|
||||
Major mode for interacting with an inferior ESS process.
|
||||
Runs an S interactive job as a subprocess of Emacs, with I/O through an
|
||||
Emacs buffer. Variable `inferior-ess-program' controls which S
|
||||
is run.
|
||||
|
||||
Commands are sent to the ESS process by typing them, and pressing
|
||||
\\[inferior-ess-send-input]. Pressing \\[complete-dynamic-complete]
|
||||
completes known object names or filenames, as appropriate. Other
|
||||
keybindings for this mode are:
|
||||
|
||||
\\{inferior-ess-mode-map}
|
||||
|
||||
When editing S objects, the use of \\[ess-load-file] is advocated.
|
||||
`ess-load-file' keeps source files (if `ess-keep-dump-files' is non-nil) in
|
||||
the directory specified by `ess-source-directory', with the
|
||||
filename chosen according to `ess-dump-filename-template'. When a file is
|
||||
loaded, `ess-mode' parses error messages and jumps to the appropriate file
|
||||
if errors occur. The ess-eval- commands do not do this.
|
||||
|
||||
Customization: Entry to this mode runs the hooks on `comint-mode-hook' and
|
||||
`inferior-ess-mode-hook' (in that order).
|
||||
|
||||
You can send text to the inferior ESS process from other buffers containing
|
||||
S source. The key bindings of these commands can be found by typing
|
||||
C-h m (help for mode) in the other buffers.
|
||||
`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-beginning-of-function' and `ess-end-of-function' move the point to
|
||||
the beginning and end of the current S function.
|
||||
`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-dump-object-into-edit-buffer' moves an S object into a temporary file
|
||||
and buffer for editing
|
||||
`ess-load-file' sources a file of commands to the ESS process.
|
||||
|
||||
Commands:
|
||||
Return after the end of the process' output sends the text from the
|
||||
end of process to point.
|
||||
Return before the end of the process' output copies the sexp ending at point
|
||||
to the end of the process' output, and sends it.
|
||||
Delete converts tabs to spaces as it moves back.
|
||||
C-M-q does Tab on each line starting within following expression.
|
||||
Paragraphs are separated only by blank lines. Crosshatches start comments.
|
||||
If you accidentally suspend your process, use \\[comint-continue-subjob]
|
||||
to continue it.
|
||||
|
||||
\(fn)" t nil)
|
||||
|
||||
(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ess-inf" '("ess-" "inferior-ess-" "update-ess-process-name-list" "with-ess-process-buffer")))
|
||||
|
||||
;;;***
|
||||
|
||||
;;;### (autoloads nil "ess-jags-d" "ess-jags-d.el" (0 0 0 0))
|
||||
;;; Generated autoloads from ess-jags-d.el
|
||||
|
||||
(autoload 'ess-jags-mode "ess-jags-d" "\
|
||||
ESS[JAGS]: Major mode for JAGS.
|
||||
|
||||
\(fn)" t nil)
|
||||
|
||||
(add-to-list 'auto-mode-alist '("\\.[Jj][Aa][Gg]\\'" . ess-jags-mode))
|
||||
|
||||
(add-to-list 'auto-mode-alist '("\\.[Jj][Oo][Gg]\\'" . ess-jags-mode))
|
||||
|
||||
(add-to-list 'auto-mode-alist '("\\.[Jj][Mm][Dd]\\'" . ess-jags-mode))
|
||||
|
||||
(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ess-jags-d" '("ess-jags-")))
|
||||
|
||||
;;;***
|
||||
|
||||
;;;### (autoloads nil "ess-lsp-l" "ess-lsp-l.el" (0 0 0 0))
|
||||
;;; Generated autoloads from ess-lsp-l.el
|
||||
|
||||
(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ess-lsp-l" '("Lisp-editing-alist")))
|
||||
|
||||
;;;***
|
||||
|
||||
;;;### (autoloads nil "ess-mode" "ess-mode.el" (0 0 0 0))
|
||||
;;; 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}
|
||||
|
||||
Extra binding to note: 'ESC C-\\' indent-region.
|
||||
|
||||
Entry to this mode runs the hooks in ess-mode-hook.
|
||||
|
||||
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-beginning-of-function' and `ess-end-of-function' move the point to
|
||||
the beginning and end of the current ESS function.
|
||||
`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-tab-always-indent'
|
||||
Non-nil means TAB in ESS mode should always reindent the current line,
|
||||
regardless of where in the line point is when the TAB command is used.
|
||||
`ess-auto-newline'
|
||||
Non-nil means automatically newline before and after braces inserted in S
|
||||
code.
|
||||
`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. At present, predefined style are `BSD', `GNU', `K&R', `C++',
|
||||
`CLB' (quoted from C language style).
|
||||
|
||||
\(fn &optional ALIST PROC-NAME IS-DERIVED)" nil nil)
|
||||
|
||||
(autoload 'ess-parse-errors "ess-mode" "\
|
||||
Jump to error in last loaded ESS source file.
|
||||
With prefix argument, only shows the errors ESS reported.
|
||||
|
||||
RESET is for compatibility with `next-error' and is ignored.
|
||||
|
||||
\(fn &optional SHOWERR RESET)" t nil)
|
||||
|
||||
(autoload 'ess-dump-object-into-edit-buffer "ess-mode" "\
|
||||
Edit an ESS OBJECT in its own buffer.
|
||||
Without a prefix argument, this simply finds the file pointed to by
|
||||
`ess-source-directory'. If this file does not exist, or if a
|
||||
prefix argument is given, a dump() command is sent to the ESS process to
|
||||
generate the source buffer.
|
||||
|
||||
\(fn OBJECT)" t nil)
|
||||
|
||||
(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ess-mode" '("ess-")))
|
||||
|
||||
;;;***
|
||||
|
||||
;;;### (autoloads nil "ess-mouse" "ess-mouse.el" (0 0 0 0))
|
||||
;;; Generated autoloads from ess-mouse.el
|
||||
|
||||
(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ess-mouse" '("ess-")))
|
||||
|
||||
;;;***
|
||||
|
||||
;;;### (autoloads nil "ess-noweb" "ess-noweb.el" (0 0 0 0))
|
||||
;;; Generated autoloads from ess-noweb.el
|
||||
|
||||
(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ess-noweb" '("ess-")))
|
||||
|
||||
;;;***
|
||||
|
||||
;;;### (autoloads nil "ess-noweb-font-lock-mode" "ess-noweb-font-lock-mode.el"
|
||||
;;;;;; (0 0 0 0))
|
||||
;;; Generated autoloads from ess-noweb-font-lock-mode.el
|
||||
|
||||
(autoload 'ess-noweb-font-lock-mode "ess-noweb-font-lock-mode" "\
|
||||
Minor mode for syntax highlighting when using `ess-noweb-mode' to edit noweb files.
|
||||
Each chunk is fontified in accordance with its own mode.
|
||||
|
||||
\(fn &optional ARG)" t nil)
|
||||
|
||||
(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ess-noweb-font-lock-mode" '("ess-noweb-" "nwfl-donowt")))
|
||||
|
||||
;;;***
|
||||
|
||||
;;;### (autoloads nil "ess-noweb-mode" "ess-noweb-mode.el" (0 0 0
|
||||
;;;;;; 0))
|
||||
;;; Generated autoloads from ess-noweb-mode.el
|
||||
|
||||
(autoload 'ess-noweb-mode "ess-noweb-mode" "\
|
||||
Minor meta mode for editing noweb files.
|
||||
`Meta' refers to the fact that this minor mode is switching major
|
||||
modes depending on the location of point.
|
||||
|
||||
The following special keystrokes are available in noweb mode:
|
||||
|
||||
Movement:
|
||||
\\[ess-noweb-next-chunk] goto the next chunk
|
||||
\\[ess-noweb-previous-chunk] goto the previous chunk
|
||||
\\[ess-noweb-goto-previous] goto the previous chunk of the same name
|
||||
\\[ess-noweb-goto-next] goto the next chunk of the same name
|
||||
\\[ess-noweb-goto-chunk] goto a chunk
|
||||
\\[ess-noweb-next-code-chunk] goto the next code chunk
|
||||
\\[ess-noweb-previous-code-chunk] goto the previous code chunk
|
||||
\\[ess-noweb-next-doc-chunk] goto the next documentation chunk
|
||||
\\[ess-noweb-previous-doc-chunk] goto the previous documentation chunk
|
||||
|
||||
Copying/Killing/Marking/Narrowing:
|
||||
\\[ess-noweb-copy-chunk-as-kill] copy the chunk the point is in into the kill ring
|
||||
\\[ess-noweb-copy-chunk-pair-as-kill] copy the pair of doc/code chunks the point is in
|
||||
\\[ess-noweb-kill-chunk] kill the chunk the point is in
|
||||
\\[ess-noweb-kill-chunk-pair] kill the pair of doc/code chunks the point is in
|
||||
\\[ess-noweb-mark-chunk] mark the chunk the point is in
|
||||
\\[ess-noweb-mark-chunk-pair] mark the pair of doc/code chunks the point is in
|
||||
\\[ess-noweb-narrow-to-chunk] narrow to the chunk the point is in
|
||||
\\[ess-noweb-narrow-to-chunk-pair] narrow to the pair of doc/code chunks the point is in
|
||||
\\[widen] widen
|
||||
\\[ess-noweb-toggle-narrowing] toggle auto narrowing
|
||||
|
||||
Filling and Indenting:
|
||||
\\[ess-noweb-fill-chunk] fill (or indent) the chunk at point according to mode
|
||||
\\[ess-noweb-fill-paragraph-chunk] fill the paragraph at point, restricted to chunk
|
||||
\\[ess-noweb-indent-line] indent the line at point according to mode
|
||||
|
||||
Insertion:
|
||||
\\[ess-noweb-insert-default-mode-line] insert a line to set this file's code mode
|
||||
\\[ess-noweb-new-chunk] insert a new chunk at point
|
||||
\\[ess-noweb-complete-chunk] complete the chunk name before point
|
||||
\\[ess-noweb-electric-@] insert a `@' or start a new doc chunk
|
||||
\\[ess-noweb-electric-<] insert a `<' or start a new code chunk
|
||||
|
||||
Modes:
|
||||
\\[ess-noweb-set-doc-mode] set the major mode for editing doc chunks
|
||||
\\[ess-noweb-set-code-mode] set the major mode for editing code chunks
|
||||
\\[ess-noweb-set-this-code-mode] set the major mode for editing this code chunk
|
||||
|
||||
Misc:
|
||||
\\[ess-noweb-occur] find all occurrences of the current chunk
|
||||
\\[ess-noweb-update-chunk-vector] update the markers for chunks
|
||||
\\[ess-noweb-describe-mode] describe ess-noweb-mode
|
||||
|
||||
\(fn &optional ARG)" t nil)
|
||||
|
||||
(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ess-noweb-mode" '("ess-noweb-")))
|
||||
|
||||
;;;***
|
||||
|
||||
;;;### (autoloads nil "ess-omg-d" "ess-omg-d.el" (0 0 0 0))
|
||||
;;; Generated autoloads from ess-omg-d.el
|
||||
|
||||
(autoload 'OMG-mode "ess-omg-d" "\
|
||||
Major mode for editing Omegahat source. NOT EVEN STARTED.
|
||||
|
||||
\(fn &optional PROC-NAME)" t nil)
|
||||
|
||||
(add-to-list 'auto-mode-alist '("\\.omg\\'" . omegahat-mode))
|
||||
|
||||
(add-to-list 'auto-mode-alist '("\\.hat\\'" . omegahat-mode))
|
||||
|
||||
(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ess-omg-d" '("OMG")))
|
||||
|
||||
;;;***
|
||||
|
||||
;;;### (autoloads nil "ess-omg-l" "ess-omg-l.el" (0 0 0 0))
|
||||
;;; Generated autoloads from ess-omg-l.el
|
||||
|
||||
(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ess-omg-l" '("ess-" "OMG-")))
|
||||
|
||||
;;;***
|
||||
|
||||
;;;### (autoloads nil "ess-r-a" "ess-r-a.el" (0 0 0 0))
|
||||
;;; Generated autoloads from ess-r-a.el
|
||||
|
||||
(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ess-r-a" '("pd::set-up-demo" "ess")))
|
||||
|
||||
;;;***
|
||||
|
||||
;;;### (autoloads nil "ess-r-completion" "ess-r-completion.el" (0
|
||||
;;;;;; 0 0 0))
|
||||
;;; Generated autoloads from ess-r-completion.el
|
||||
|
||||
(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ess-r-completion" '("ess-" "ac-source-R" "company-R-")))
|
||||
|
||||
;;;***
|
||||
|
||||
;;;### (autoloads nil "ess-r-flymake" "ess-r-flymake.el" (0 0 0 0))
|
||||
;;; Generated autoloads from ess-r-flymake.el
|
||||
|
||||
(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ess-r-flymake" '("ess-r-")))
|
||||
|
||||
;;;***
|
||||
|
||||
;;;### (autoloads nil "ess-r-gui" "ess-r-gui.el" (0 0 0 0))
|
||||
;;; Generated autoloads from ess-r-gui.el
|
||||
|
||||
(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ess-r-gui" '("Rgui" "ess-" "inferior-")))
|
||||
|
||||
;;;***
|
||||
|
||||
;;;### (autoloads nil "ess-r-mode" "ess-r-mode.el" (0 0 0 0))
|
||||
;;; Generated autoloads from ess-r-mode.el
|
||||
|
||||
(defvar ess-dev-map (let (ess-dev-map) (define-prefix-command 'ess-dev-map) (define-key ess-dev-map "" 'ess-r-set-evaluation-env) (define-key ess-dev-map "s" 'ess-r-set-evaluation-env) (define-key ess-dev-map "T" 'ess-toggle-tracebug) (define-key ess-dev-map "\f" 'ess-r-devtools-load-package) (define-key ess-dev-map "l" 'ess-r-devtools-load-package) (define-key ess-dev-map "`" 'ess-show-traceback) (define-key ess-dev-map "~" 'ess-show-call-stack) (define-key ess-dev-map "" 'ess-watch) (define-key ess-dev-map "w" 'ess-watch) (define-key ess-dev-map "" 'ess-debug-flag-for-debugging) (define-key ess-dev-map "d" 'ess-debug-flag-for-debugging) (define-key ess-dev-map "" 'ess-debug-unflag-for-debugging) (define-key ess-dev-map "u" 'ess-debug-unflag-for-debugging) (define-key ess-dev-map [(control 68)] 'ess-debug-unflag-for-debugging) (define-key ess-dev-map "" 'ess-bp-set) (define-key ess-dev-map "b" 'ess-bp-set) (define-key ess-dev-map [(control 66)] 'ess-bp-set-conditional) (define-key ess-dev-map "B" 'ess-bp-set-conditional) (define-key ess-dev-map "\f" 'ess-bp-set-logger) (define-key ess-dev-map "L" 'ess-bp-set-logger) (define-key ess-dev-map "" 'ess-bp-toggle-state) (define-key ess-dev-map "o" 'ess-bp-toggle-state) (define-key ess-dev-map "" 'ess-bp-kill) (define-key ess-dev-map "k" 'ess-bp-kill) (define-key ess-dev-map "" 'ess-bp-kill-all) (define-key ess-dev-map "K" 'ess-bp-kill-all) (define-key ess-dev-map "" 'ess-bp-next) (define-key ess-dev-map "n" 'ess-bp-next) (define-key ess-dev-map "i" 'ess-debug-goto-input-event-marker) (define-key ess-dev-map "I" 'ess-debug-goto-input-event-marker) (define-key ess-dev-map "" 'ess-bp-previous) (define-key ess-dev-map "p" 'ess-bp-previous) (define-key ess-dev-map "" 'ess-debug-toggle-error-action) (define-key ess-dev-map "e" 'ess-debug-toggle-error-action) (define-key ess-dev-map "0" 'ess-electric-selection) (define-key ess-dev-map "1" 'ess-electric-selection) (define-key ess-dev-map "2" 'ess-electric-selection) (define-key ess-dev-map "3" 'ess-electric-selection) (define-key ess-dev-map "4" 'ess-electric-selection) (define-key ess-dev-map "5" 'ess-electric-selection) (define-key ess-dev-map "6" 'ess-electric-selection) (define-key ess-dev-map "7" 'ess-electric-selection) (define-key ess-dev-map "8" 'ess-electric-selection) (define-key ess-dev-map "9" 'ess-electric-selection) (define-key ess-dev-map "?" 'ess-tracebug-show-help) ess-dev-map) "\
|
||||
Keymap for commands related to development and debugging.")
|
||||
|
||||
(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 nil)
|
||||
|
||||
(defalias 'R #'run-ess-r)
|
||||
|
||||
(autoload 'R-mode "ess-r-mode" "\
|
||||
Major mode for editing R source. See `ess-mode' for more help.
|
||||
|
||||
\(fn &optional PROC-NAME)" t nil)
|
||||
|
||||
(add-to-list 'auto-mode-alist '("/R/.*\\.q\\'" . R-mode))
|
||||
|
||||
(add-to-list 'auto-mode-alist '("\\.[rR]\\'" . R-mode))
|
||||
|
||||
(add-to-list 'auto-mode-alist '("\\.[rR]profile\\'" . R-mode))
|
||||
|
||||
(add-to-list 'auto-mode-alist '("NAMESPACE\\'" . R-mode))
|
||||
|
||||
(add-to-list 'auto-mode-alist '("CITATION\\'" . R-mode))
|
||||
|
||||
(autoload 'Rnw-mode "ess-r-mode" "\
|
||||
Major mode for editing Sweave(R) source.
|
||||
See `ess-noweb-mode' and `R-mode' for more help.
|
||||
|
||||
\(fn)" t nil)
|
||||
|
||||
(add-to-list 'auto-mode-alist '("\\.[rR]nw\\'" . Rnw-mode))
|
||||
|
||||
(add-to-list 'auto-mode-alist '("\\.[sS]nw\\'" . Snw-mode))
|
||||
|
||||
(autoload 'R-transcript-mode "ess-r-mode" "\
|
||||
Does the right thing.
|
||||
|
||||
\(fn)" t nil)
|
||||
|
||||
(add-to-list 'auto-mode-alist '("\\.[Rr]out" . R-transcript-mode))
|
||||
|
||||
(add-to-list 'interpreter-mode-alist '("Rscript" . r-mode))
|
||||
|
||||
(add-to-list 'interpreter-mode-alist '("r" . r-mode))
|
||||
|
||||
(add-to-list 'auto-mode-alist '("/Makevars\\(\\.win\\)?$" . makefile-mode))
|
||||
|
||||
(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ess-r-mode" '("ess-" "inferior-ess-r-" "R-")))
|
||||
|
||||
;;;***
|
||||
|
||||
;;;### (autoloads nil "ess-r-package" "ess-r-package.el" (0 0 0 0))
|
||||
;;; Generated autoloads from ess-r-package.el
|
||||
|
||||
(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ess-r-package" '("ess-")))
|
||||
|
||||
;;;***
|
||||
|
||||
;;;### (autoloads nil "ess-r-syntax" "ess-r-syntax.el" (0 0 0 0))
|
||||
;;; Generated autoloads from ess-r-syntax.el
|
||||
|
||||
(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ess-r-syntax" '("ess-" "backward-ess-r-" "forward-ess-r-")))
|
||||
|
||||
;;;***
|
||||
|
||||
;;;### (autoloads nil "ess-r-xref" "ess-r-xref.el" (0 0 0 0))
|
||||
;;; Generated autoloads from ess-r-xref.el
|
||||
|
||||
(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ess-r-xref" '("ess-r-xref-")))
|
||||
|
||||
;;;***
|
||||
|
||||
;;;### (autoloads nil "ess-rd" "ess-rd.el" (0 0 0 0))
|
||||
;;; Generated autoloads from ess-rd.el
|
||||
|
||||
(autoload 'Rd-mode "ess-rd" "\
|
||||
Major mode for editing R documentation source files.
|
||||
|
||||
This mode makes it easier to write R documentation by helping with
|
||||
indentation, doing some of the typing for you (with Abbrev mode) and by
|
||||
showing keywords, strings, etc. in different faces (with Font Lock mode
|
||||
on terminals that support it).
|
||||
|
||||
Type \\[list-abbrevs] to display the built-in abbrevs for Rd keywords.
|
||||
|
||||
Keybindings
|
||||
===========
|
||||
|
||||
\\{Rd-mode-map}
|
||||
|
||||
Variables you can use to customize Rd mode
|
||||
==========================================
|
||||
|
||||
`Rd-indent-level'
|
||||
Indentation of Rd code with respect to containing blocks.
|
||||
Default is 2.
|
||||
|
||||
Turning on Rd mode runs the hook `Rd-mode-hook'.
|
||||
|
||||
To automatically turn on the abbrev(iate) features, add the
|
||||
following lines to your `.emacs' file:
|
||||
|
||||
(add-hook 'Rd-mode-hook
|
||||
(lambda ()
|
||||
(abbrev-mode 1)))
|
||||
|
||||
\(fn)" t nil)
|
||||
|
||||
(add-to-list 'auto-mode-alist '("\\.Rd\\'" . Rd-mode))
|
||||
|
||||
(autoload 'Rd-preview-help "ess-rd" "\
|
||||
Preview the current Rd buffer contents as help.
|
||||
If optional VIA-SHELL is set, using `Rd-to-help-command'.
|
||||
If the current buffer is not associated with a file, create a
|
||||
temporary one in `temporary-file-directory'.
|
||||
|
||||
\(fn &optional VIA-SHELL)" t nil)
|
||||
|
||||
(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ess-rd" '("Rd-" "ess")))
|
||||
|
||||
;;;***
|
||||
|
||||
;;;### (autoloads nil "ess-rdired" "ess-rdired.el" (0 0 0 0))
|
||||
;;; Generated autoloads from ess-rdired.el
|
||||
|
||||
(autoload 'ess-rdired "ess-rdired" "\
|
||||
Run dired-like mode on R objects.
|
||||
This is the main function. See documentation for `ess-rdired-mode' though
|
||||
for more information!
|
||||
|
||||
\(fn)" t nil)
|
||||
|
||||
(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ess-rdired" '("ess-rdired-")))
|
||||
|
||||
;;;***
|
||||
|
||||
;;;### (autoloads nil "ess-roxy" "ess-roxy.el" (0 0 0 0))
|
||||
;;; Generated autoloads from ess-roxy.el
|
||||
|
||||
(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ess-roxy" '("ess-")))
|
||||
|
||||
;;;***
|
||||
|
||||
;;;### (autoloads nil "ess-rutils" "ess-rutils.el" (0 0 0 0))
|
||||
;;; Generated autoloads from ess-rutils.el
|
||||
|
||||
(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ess-rutils" '("ess-rutils-")))
|
||||
|
||||
;;;***
|
||||
|
||||
;;;### (autoloads nil "ess-s-lang" "ess-s-lang.el" (0 0 0 0))
|
||||
;;; 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))
|
||||
|
||||
(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ess-s-lang" '("ess-" "S+common-cust-alist" "S-" "inferior-S-language-start")))
|
||||
|
||||
;;;***
|
||||
|
||||
;;;### (autoloads nil "ess-s3-d" "ess-s3-d.el" (0 0 0 0))
|
||||
;;; Generated autoloads from ess-s3-d.el
|
||||
|
||||
(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ess-s3-d" 'nil))
|
||||
|
||||
;;;***
|
||||
|
||||
;;;### (autoloads nil "ess-s4-d" "ess-s4-d.el" (0 0 0 0))
|
||||
;;; Generated autoloads from ess-s4-d.el
|
||||
|
||||
(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ess-s4-d" 'nil))
|
||||
|
||||
;;;***
|
||||
|
||||
;;;### (autoloads nil "ess-sas-a" "ess-sas-a.el" (0 0 0 0))
|
||||
;;; Generated autoloads from ess-sas-a.el
|
||||
|
||||
(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ess-sas-a" '("ess-" "sas-program")))
|
||||
|
||||
;;;***
|
||||
|
||||
;;;### (autoloads nil "ess-sas-d" "ess-sas-d.el" (0 0 0 0))
|
||||
;;; 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 &optional PROC-NAME)" t nil)
|
||||
|
||||
(add-to-list 'auto-mode-alist '("\\.[Ss][Aa][Ss]\\'" . SAS-mode))
|
||||
|
||||
(autoload 'SAS-menu "ess-sas-d" "\
|
||||
Start SAS from the menu.
|
||||
|
||||
\(fn)" t nil)
|
||||
|
||||
(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ess-sas-d" '("ess-" "SAS" "inferior-SAS-args")))
|
||||
|
||||
;;;***
|
||||
|
||||
;;;### (autoloads nil "ess-sas-l" "ess-sas-l.el" (0 0 0 0))
|
||||
;;; Generated autoloads from ess-sas-l.el
|
||||
|
||||
(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ess-sas-l" '("ess-" "set-sas-file-" "submit-sas" "switch-to-" "sas-" "beginning-of-sas-" "backward-page-top-of-window" "fix-page-breaks" "forward-page-top-of-window" "next-sas-proc" "indent-sas-statement" "SAS-")))
|
||||
|
||||
;;;***
|
||||
|
||||
;;;### (autoloads nil "ess-site" "ess-site.el" (0 0 0 0))
|
||||
;;; Generated autoloads from ess-site.el
|
||||
|
||||
(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ess-site" '("ess-")))
|
||||
|
||||
;;;***
|
||||
|
||||
;;;### (autoloads nil "ess-sp3-d" "ess-sp3-d.el" (0 0 0 0))
|
||||
;;; Generated autoloads from ess-sp3-d.el
|
||||
|
||||
(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ess-sp3-d" '("S+3")))
|
||||
|
||||
;;;***
|
||||
|
||||
;;;### (autoloads nil "ess-sp4-d" "ess-sp4-d.el" (0 0 0 0))
|
||||
;;; Generated autoloads from ess-sp4-d.el
|
||||
|
||||
(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ess-sp4-d" '("Sqpe+4" "S+4" "inferior-S+4-multipleinstances")))
|
||||
|
||||
;;;***
|
||||
|
||||
;;;### (autoloads nil "ess-sp5-d" "ess-sp5-d.el" (0 0 0 0))
|
||||
;;; Generated autoloads from ess-sp5-d.el
|
||||
|
||||
(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ess-sp5-d" '("S+5")))
|
||||
|
||||
;;;***
|
||||
|
||||
;;;### (autoloads nil "ess-sp6-d" "ess-sp6-d.el" (0 0 0 0))
|
||||
;;; 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 nil)
|
||||
|
||||
(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ess-sp6-d" '("ess-" "S+")))
|
||||
|
||||
;;;***
|
||||
|
||||
;;;### (autoloads nil "ess-sp6w-d" "ess-sp6w-d.el" (0 0 0 0))
|
||||
;;; Generated autoloads from ess-sp6w-d.el
|
||||
|
||||
(add-to-list 'auto-mode-alist '("\\.sp\\'" . S-mode))
|
||||
|
||||
(add-to-list 'auto-mode-alist '("\\.[qsS]\\'" . S-mode))
|
||||
|
||||
(add-to-list 'auto-mode-alist '("\\.ssc\\'" . S-mode))
|
||||
|
||||
(add-to-list 'auto-mode-alist '("\\.SSC\\'" . S-mode))
|
||||
|
||||
(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ess-sp6w-d" '("S+" "Sqpe+" "ess-sqpe-versions-create" "inferior-S+")))
|
||||
|
||||
;;;***
|
||||
|
||||
;;;### (autoloads nil "ess-stata-lang" "ess-stata-lang.el" (0 0 0
|
||||
;;;;;; 0))
|
||||
;;; Generated autoloads from ess-stata-lang.el
|
||||
|
||||
(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ess-stata-lang" '("ess-" "stata-" "STA-" "ado-set-font-lock-keywords")))
|
||||
|
||||
;;;***
|
||||
|
||||
;;;### (autoloads nil "ess-stata-mode" "ess-stata-mode.el" (0 0 0
|
||||
;;;;;; 0))
|
||||
;;; Generated autoloads from ess-stata-mode.el
|
||||
|
||||
(autoload 'STA-mode "ess-stata-mode" "\
|
||||
Major mode for editing Stata source. See `ess-mode' for more help.
|
||||
|
||||
\(fn &optional PROC-NAME)" t nil)
|
||||
|
||||
(add-to-list 'auto-mode-alist '("\\.do\\'" . STA-mode))
|
||||
|
||||
(add-to-list 'auto-mode-alist '("\\.ado\\'" . STA-mode))
|
||||
|
||||
(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ess-stata-mode" '("stata" "ess-" "STA-")))
|
||||
|
||||
;;;***
|
||||
|
||||
;;;### (autoloads nil "ess-swv" "ess-swv.el" (0 0 0 0))
|
||||
;;; Generated autoloads from ess-swv.el
|
||||
|
||||
(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ess-swv" '("ess-")))
|
||||
|
||||
;;;***
|
||||
|
||||
;;;### (autoloads nil "ess-toolbar" "ess-toolbar.el" (0 0 0 0))
|
||||
;;; Generated autoloads from ess-toolbar.el
|
||||
|
||||
(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ess-toolbar" '("ess-")))
|
||||
|
||||
;;;***
|
||||
|
||||
;;;### (autoloads nil "ess-tracebug" "ess-tracebug.el" (0 0 0 0))
|
||||
;;; Generated autoloads from ess-tracebug.el
|
||||
|
||||
(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ess-tracebug" '("ess-" "org-" "inferior-ess-")))
|
||||
|
||||
;;;***
|
||||
|
||||
;;;### (autoloads nil "ess-trns" "ess-trns.el" (0 0 0 0))
|
||||
;;; Generated autoloads from ess-trns.el
|
||||
|
||||
(autoload 'ess-transcript-mode "ess-trns" "\
|
||||
Major mode for manipulating {ESS} transcript files.
|
||||
|
||||
Type \\[ess-transcript-send-command] to send a command in the
|
||||
transcript to the current S 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 S commands. Other keybindings are:
|
||||
|
||||
\\{ess-transcript-mode-map}
|
||||
|
||||
\(fn ALIST &optional PROC)" nil nil)
|
||||
|
||||
(autoload 'ess-transcript-clean-region "ess-trns" "\
|
||||
Strip the transcript in the region, leaving only (R/S/Lsp/..) commands.
|
||||
Deletes any lines not beginning with a prompt, and then removes the
|
||||
prompt from those lines that remain. Prefix argument means to
|
||||
clean even if the buffer is \\[read-only].
|
||||
|
||||
\(fn BEG END EVEN-IF-READ-ONLY)" t nil)
|
||||
|
||||
(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ess-trns" '("ess-transcript-")))
|
||||
|
||||
;;;***
|
||||
|
||||
;;;### (autoloads nil "ess-utils" "ess-utils.el" (0 0 0 0))
|
||||
;;; Generated autoloads from ess-utils.el
|
||||
|
||||
(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ess-utils" '("ess-")))
|
||||
|
||||
;;;***
|
||||
|
||||
;;;### (autoloads nil "ess-vst-d" "ess-vst-d.el" (0 0 0 0))
|
||||
;;; Generated autoloads from ess-vst-d.el
|
||||
|
||||
(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ess-vst-d" '("VST-" "ViSta")))
|
||||
|
||||
;;;***
|
||||
|
||||
;;;### (autoloads nil "ess-xls-d" "ess-xls-d.el" (0 0 0 0))
|
||||
;;; Generated autoloads from ess-xls-d.el
|
||||
|
||||
(autoload 'XLS-mode "ess-xls-d" "\
|
||||
Major mode for editing XLispStat source. NOT EVEN STARTED.
|
||||
|
||||
\(fn &optional PROC-NAME)" t nil)
|
||||
|
||||
(add-to-list 'auto-mode-alist '("\\.lsp\\'" . XLS-mode))
|
||||
|
||||
(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ess-xls-d" '("xls-transcript-mode" "XLS" "ess-help-XLS-sec-keys-alist")))
|
||||
|
||||
;;;***
|
||||
|
||||
;;;### (autoloads nil "essd-els" "essd-els.el" (0 0 0 0))
|
||||
;;; Generated autoloads from essd-els.el
|
||||
|
||||
(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "essd-els" '("ess-" "S+elsewhere" "inferior-ess-remote-pager")))
|
||||
|
||||
;;;***
|
||||
|
||||
;;;### (autoloads nil "make-regexp" "make-regexp.el" (0 0 0 0))
|
||||
;;; Generated autoloads from make-regexp.el
|
||||
|
||||
(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "make-regexp" '("make-regexp" "regexp-span")))
|
||||
|
||||
;;;***
|
||||
|
||||
;;;### (autoloads nil "mouseme" "mouseme.el" (0 0 0 0))
|
||||
;;; Generated autoloads from mouseme.el
|
||||
|
||||
(autoload 'mouse-me "mouseme" "\
|
||||
Popup a menu of functions to run on selected string or region.
|
||||
|
||||
\(fn EVENT)" t nil)
|
||||
|
||||
(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "mouseme" '("mouse-me-")))
|
||||
|
||||
;;;***
|
||||
|
||||
;;;### (autoloads nil nil ("ess-julia.el" "ess-pkg.el" "ess.el")
|
||||
;;;;;; (0 0 0 0))
|
||||
|
||||
;;;***
|
||||
|
||||
;; Local Variables:
|
||||
;; version-control: never
|
||||
;; no-byte-compile: t
|
||||
;; no-update-autoloads: t
|
||||
;; coding: utf-8
|
||||
;; End:
|
||||
;;; ess-autoloads.el ends here
|
||||
310
elpa/ess-20180701.100/ess-bugs-d.el
Normal file
310
elpa/ess-20180701.100/ess-bugs-d.el
Normal file
@@ -0,0 +1,310 @@
|
||||
;;; ess-bugs-d.el --- ESS[BUGS] dialect
|
||||
|
||||
;; Copyright (C) 2008-2011 Rodney Sparapani
|
||||
|
||||
;; Author: Rodney Sparapani
|
||||
;; Created: 13 March 2008
|
||||
;; Maintainer: ESS-help <ess-help@r-project.org>
|
||||
|
||||
;; 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)
|
||||
(require 'ess-custom)
|
||||
(require 'ess-mode)
|
||||
|
||||
(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 "\\<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 "") (ess-bugs-temp-chain ""))
|
||||
|
||||
(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 bugs-chains)
|
||||
"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
|
||||
(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)
|
||||
(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-mode-hooks 'ess-bugs-mode-hook)
|
||||
|
||||
(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))))))
|
||||
|
||||
(setq features (delete 'ess-bugs-d features))
|
||||
(provide 'ess-bugs-d)
|
||||
|
||||
;;; ess-bugs-d.el ends here
|
||||
289
elpa/ess-20180701.100/ess-bugs-l.el
Normal file
289
elpa/ess-20180701.100/ess-bugs-l.el
Normal file
@@ -0,0 +1,289 @@
|
||||
;;; ess-bugs-l.el --- ESS[BUGS] languages
|
||||
|
||||
;; Copyright (C) 2006-2011 Rodney Sparapani
|
||||
|
||||
;; Author: Rodney Sparapani
|
||||
;; Created: 16 August 2006
|
||||
;; Maintainer: ESS-help <ess-help@r-project.org>
|
||||
|
||||
;; 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 'font-lock)
|
||||
(require 'comint)
|
||||
(require 'ess-utils)
|
||||
(require 'ess-custom)
|
||||
(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 ess-microsoft-p (if (w32-shell-dos-semantics) 'dos 'sh) '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 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)
|
||||
(define-key ess-bugs-mode-map "\C-c\C-c" 'ess-bugs-next-action)
|
||||
(define-key ess-bugs-mode-map "=" 'ess-bugs-hot-arrow)
|
||||
(define-key ess-bugs-mode-map "_" 'ess-bugs-hot-arrow)
|
||||
|
||||
(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)
|
||||
|
||||
(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 (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)
|
||||
(require 'shell)
|
||||
(switch-to-buffer (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
|
||||
3224
elpa/ess-20180701.100/ess-custom.el
Normal file
3224
elpa/ess-20180701.100/ess-custom.el
Normal file
File diff suppressed because it is too large
Load Diff
177
elpa/ess-20180701.100/ess-dde.el
Normal file
177
elpa/ess-20180701.100/ess-dde.el
Normal file
@@ -0,0 +1,177 @@
|
||||
;;; ess-dde.el --- ESS customization for ddeclients under Windows 9x/NT
|
||||
|
||||
;; Copyright (C) 1998--1999 Richard M. Heiberger <rmh@temple.edu>
|
||||
;; Copyright (C) 2000--2006 A.J. Rossini, Richard M. Heiberger, Martin
|
||||
;; Maechler, Kurt Hornik, Rodney Sparapani, and Stephen Eglen.
|
||||
|
||||
;; Author: Richard M. Heiberger <rmh@temple.edu>
|
||||
;; Created: 9 Dec 1998
|
||||
;; Maintainer: ESS-core <ESS-core@r-project.org>
|
||||
|
||||
;; 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/
|
||||
|
||||
|
||||
;;; Commentary:
|
||||
|
||||
;; Code for dealing with running external processes on Windows 9x/NT
|
||||
;; through ddeclient.
|
||||
|
||||
;;; Code:
|
||||
|
||||
|
||||
;; *NO* Requires and autoloads
|
||||
|
||||
(defun ess-ddeclient-p ()
|
||||
"Returns t iff `ess-local-process-name' is associated with an
|
||||
inferior-ess-ddeclient, and nil if the ess-process is running as an
|
||||
ordinary inferior process. Alway nil on Unix machines."
|
||||
(interactive)
|
||||
(when ess-microsoft-p
|
||||
;; Debug: C-c C-l fails (to start R or give good message) in Windows
|
||||
(ess-write-to-dribble-buffer
|
||||
(format "*ddeclient-p: ess-loc-proc-name is '%s'" ess-local-process-name))
|
||||
(ess-force-buffer-current "Process to load into: ")
|
||||
(not (equal (ess-get-process-variable 'inferior-ess-ddeclient)
|
||||
(default-value 'inferior-ess-ddeclient)))))
|
||||
|
||||
;; C-c C-r
|
||||
(defun ess-dde-send-region (proc start end &optional visibly message)
|
||||
"Loop through lines in region and send them to ESS via ddeclient.
|
||||
|
||||
PROC, VISIBLY and MESSAGE are ignored."
|
||||
(setq ;; set the following variables for the current ddeESS process.
|
||||
inferior-ess-ddeclient (ess-get-process-variable 'inferior-ess-ddeclient)
|
||||
inferior-ess-client-name (ess-get-process-variable 'inferior-ess-client-name)
|
||||
inferior-ess-client-command (ess-get-process-variable 'inferior-ess-client-command))
|
||||
(narrow-to-region start end)
|
||||
(goto-char (point-min))
|
||||
(let ((beg))
|
||||
(while (or (< (point) (point-max))
|
||||
(and (= 1 (point-max))
|
||||
(bound-and-true-p ess-dde-even-empty)))
|
||||
(setq beg (point))
|
||||
(end-of-line)
|
||||
;; call-process-region won't send over a 0-character line.
|
||||
;; We go outside the loop to create a 1-character line " " in the
|
||||
;; *ESS-temporary* buffer
|
||||
(if (= beg (point)) ;; do empty line outside loop
|
||||
(ess-dde-eval-linewise " " nil 'eob t)
|
||||
;;(call-process-region start end
|
||||
;; "ddeclient" nil nil nil "S-PLUS" "SCommand")
|
||||
(call-process-region
|
||||
beg (point)
|
||||
inferior-ess-ddeclient nil nil nil
|
||||
inferior-ess-client-name inferior-ess-client-command))
|
||||
(forward-line 1))
|
||||
(widen)))
|
||||
|
||||
;; C-c C-n
|
||||
(defun ess-dde-eval-linewise (text-withtabs &optional invisibly eob
|
||||
even-empty wait-last-prompt &rest args)
|
||||
(with-current-buffer (get-buffer-create "*ESS-temporary*")
|
||||
(ess-setq-vars-local ess-customize-alist (current-buffer))
|
||||
(erase-buffer)
|
||||
(insert text-withtabs)
|
||||
(let ((ess-dde-even-empty even-empty))
|
||||
(ess-dde-send-region nil (point-min) (point-max))))
|
||||
(when wait-last-prompt
|
||||
ess-eval-ddeclient-sleep)) ; in addition to timeout-ms
|
||||
|
||||
;; C-c C-v
|
||||
(defun ess-dde-display-help-on-object (object &rest args)
|
||||
"Display the ESS documentation for OBJECT in another window.
|
||||
If prefix arg is given, forces a query of the ESS process for the help
|
||||
file. Otherwise just pops to an existing buffer if it exists."
|
||||
(ess-force-buffer-current "Process to load into: ")
|
||||
(ess-dde-eval-linewise (concat "help(" object ")")))
|
||||
|
||||
(defun ess-dde-find-help-file (p-string)
|
||||
(read-string "Help on: "))
|
||||
|
||||
;; C-c C-l
|
||||
(defun ess-dde-load-file (filename)
|
||||
"Load an S source file into an inferior ESS process; alternate behavior for
|
||||
`ess-load-file', required with S-Plus GUI for Windows: Sends the S-Plus command
|
||||
source(\"filename\") to S. This version does not guarantee to save .Last.value,
|
||||
nor offer alternate buffers or editing capability."
|
||||
(let ((source-buffer (get-file-buffer filename)))
|
||||
(if (ess-check-source filename)
|
||||
(error "Buffer %s has not been saved" (buffer-name source-buffer))
|
||||
;; Find the process to load into
|
||||
(if source-buffer
|
||||
(with-current-buffer source-buffer
|
||||
(ess-force-buffer-current "Process to load into: ")
|
||||
;; (ess-check-modifications) ;;; not possible with ddeclient
|
||||
;; it calls ess-command which requires two-way communication
|
||||
;; with the S-Plus process
|
||||
)))
|
||||
(ess-dde-eval-linewise (format ess-load-command filename)))
|
||||
(widen))
|
||||
|
||||
|
||||
;; C-c C-d
|
||||
(defun ess-dde-dump-object (object filename)
|
||||
"Dump the ESS object OBJECT into file FILENAME."
|
||||
(ess-force-buffer-current "Process to load into: ")
|
||||
(ess-dde-eval-linewise (concat "dump('" object "','" filename "')"))
|
||||
(sleep-for 5)
|
||||
(find-file filename)
|
||||
(widen))
|
||||
|
||||
(defun ess-dde-read-object-name (p-string)
|
||||
(read-string "Object to edit: "))
|
||||
|
||||
(defun ess-dput-expression-ddeclient (object filename)
|
||||
"Dump the ESS object found by evaluating OBJECT into file FILENAME."
|
||||
(ess-force-buffer-current "Process to load into: ")
|
||||
(ess-dde-eval-linewise (concat "dput(" object ",'" filename "')"))
|
||||
(sleep-for 2)
|
||||
(find-file filename))
|
||||
|
||||
(defun ess-command-ddeclient-proposed (com &optional buf sleep)
|
||||
"ddeclient version of real `ess-command'.
|
||||
Send the ESS process command COM and redirect its output to the
|
||||
temporary file named BUF. The temporary filename is constructed
|
||||
in emacs, not in the ESS process. The default name for the
|
||||
temporary buffer is \"ess-temp.st\". The function waits
|
||||
SLEEP (which defaults to 1) seconds and then brings the temporary
|
||||
file into an emacs buffer and displays it."
|
||||
(let (filename bufname)
|
||||
(if (not buf) (setq buf "ess-temp.st"))
|
||||
(if (not sleep) (setq sleep 1))
|
||||
(setq filename (concat (file-name-as-directory (getenv "TEMP")) buf))
|
||||
(ess-dde-eval-linewise
|
||||
(concat ".old.Last.value <- .Last.value; sink('"
|
||||
filename
|
||||
"'); print("
|
||||
com
|
||||
"); sink(); .Last.value <- .old.Last.value"))
|
||||
(setq bufname (ess-get-file-or-buffer filename)) ;; must follow the eval
|
||||
(sleep-for sleep)
|
||||
(if (not bufname)
|
||||
(find-file filename)
|
||||
(switch-to-buffer bufname))
|
||||
(revert-buffer t t) ;; this allows the user to reuse the BUF name
|
||||
))
|
||||
|
||||
;; previous version (ESS-5.2.12 and earlier)
|
||||
(defun ess-dde-command (com &optional buf sleep)
|
||||
"ddeclient bypass of real ess-command"
|
||||
(ess-eval-linewise com))
|
||||
|
||||
(provide 'ess-dde)
|
||||
|
||||
;;; ess-dde.el ends here
|
||||
8
elpa/ess-20180701.100/ess-defs.info
Normal file
8
elpa/ess-20180701.100/ess-defs.info
Normal file
@@ -0,0 +1,8 @@
|
||||
This is ess-defs.info, produced by makeinfo version 6.1 from
|
||||
ess-defs.texi.
|
||||
|
||||
|
||||
|
||||
Tag Table:
|
||||
|
||||
End Tag Table
|
||||
151
elpa/ess-20180701.100/ess-font-lock.el
Normal file
151
elpa/ess-20180701.100/ess-font-lock.el
Normal file
@@ -0,0 +1,151 @@
|
||||
;;; ess-font-lock.el --- font-lock color options
|
||||
|
||||
;; Copyright (C) 2000--2006 A.J. Rossini, Richard M. Heiberger, Martin
|
||||
;; Maechler, Kurt Hornik, Rodney Sparapani, and Stephen Eglen.
|
||||
|
||||
;; Author: Richard M. Heiberger <rmh@temple.edu>
|
||||
;; Created: 06 Feb 2000
|
||||
|
||||
;; Keywords: languages, faces
|
||||
|
||||
;; 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/
|
||||
|
||||
;;; Commentary:
|
||||
|
||||
;; provides syntax highlighting support.
|
||||
|
||||
;;; Code:
|
||||
|
||||
; Requires and autoloads
|
||||
|
||||
(require 'font-lock)
|
||||
(require 'paren)
|
||||
|
||||
;; FIXME: What is this doing here!?
|
||||
(if (fboundp 'show-paren-mode) (show-paren-mode 1))
|
||||
|
||||
;;; Emacs 20.x notes:
|
||||
|
||||
;; font-lock faces are defined in /emacs/emacs-20.5/lisp/font-lock.el
|
||||
;; The font-lock faces are applied to ESS buffers by
|
||||
;; ess-mode.el ess-inf.el ess-trns.el ess-custom.el
|
||||
;; The keywords for faces are defined in the ess[dl]*.el files.
|
||||
;; All faces can be looked at, under Emacs 20.x, with
|
||||
;; [menu-bar] [Edit] [Text Properties] [Display Faces}
|
||||
|
||||
(defun ess-font-lock-rmh ()
|
||||
"Set font-lock colors to Richard Heiberger's usual choice."
|
||||
;; FIXME: Turn it into a Custom theme!
|
||||
(interactive)
|
||||
|
||||
(set-foreground-color "Black")
|
||||
(set-background-color "lightcyan")
|
||||
|
||||
(set-face-background 'mode-line "lightskyblue")
|
||||
(set-face-foreground 'mode-line "midnightblue")
|
||||
|
||||
(set-face-foreground 'font-lock-comment-face "Firebrick")
|
||||
(set-face-foreground 'font-lock-function-name-face "Blue")
|
||||
(set-face-foreground 'font-lock-keyword-face "Purple")
|
||||
(set-face-foreground 'font-lock-constant-face "Brown")
|
||||
(set-face-foreground 'font-lock-string-face "VioletRed")
|
||||
(set-face-foreground 'font-lock-type-face "Sienna")
|
||||
(set-face-foreground 'font-lock-variable-name-face "Black"))
|
||||
|
||||
(defun ess-font-lock-blue ()
|
||||
"Set font-lock colors to Richard Heiberger's blue color scheme."
|
||||
;; FIXME: Turn it into a Custom theme!
|
||||
(interactive)
|
||||
|
||||
(set-foreground-color "Black")
|
||||
(set-background-color "LightBlue")
|
||||
|
||||
(set-face-foreground 'mode-line "LightBlue")
|
||||
(set-face-background 'mode-line "DarkSlateBlue")
|
||||
|
||||
(set-face-foreground 'font-lock-comment-face "Firebrick")
|
||||
(set-face-foreground 'font-lock-function-name-face "Blue")
|
||||
(set-face-foreground 'font-lock-keyword-face "Purple")
|
||||
(set-face-foreground 'font-lock-constant-face "Brown")
|
||||
(set-face-foreground 'font-lock-string-face "VioletRed")
|
||||
(set-face-foreground 'font-lock-type-face "Sienna")
|
||||
(set-face-foreground 'font-lock-variable-name-face "Black"))
|
||||
|
||||
(defun ess-font-lock-wheat ()
|
||||
"Set font-lock colors to Richard Heiberger's wheat color scheme."
|
||||
;; FIXME: Turn it into a Custom theme!
|
||||
(interactive)
|
||||
|
||||
(set-foreground-color "Black")
|
||||
(set-background-color "Wheat")
|
||||
|
||||
(set-face-foreground 'mode-line "Wheat")
|
||||
(set-face-background 'mode-line "Sienna")
|
||||
|
||||
(set-face-foreground 'font-lock-comment-face "Firebrick")
|
||||
(set-face-foreground 'font-lock-function-name-face "Blue")
|
||||
(set-face-foreground 'font-lock-keyword-face "Purple")
|
||||
(set-face-foreground 'font-lock-constant-face "Brown")
|
||||
(set-face-foreground 'font-lock-string-face "VioletRed")
|
||||
(set-face-foreground 'font-lock-type-face "Sienna")
|
||||
(set-face-foreground 'font-lock-variable-name-face "Black"))
|
||||
|
||||
|
||||
(defun ess-font-lock-bw ()
|
||||
"Set font-lock colors to Richard Heiberger's black and white color scheme."
|
||||
;; FIXME: Turn it into a Custom theme!
|
||||
(interactive)
|
||||
|
||||
(set-foreground-color "Black")
|
||||
(set-background-color "white")
|
||||
|
||||
(set-face-foreground 'mode-line "gray10")
|
||||
(set-face-background 'mode-line "gray90")
|
||||
|
||||
;; modify-face is an interactive compiled Lisp function in `faces'.
|
||||
;; Sample usage:
|
||||
|
||||
;;(modify-face FACE FOREGROUND BACKGROUND STIPPLE BOLD-P ITALIC-P UNDERLINE-P &optional INVERSE-P FRAME)
|
||||
|
||||
(modify-face 'mode-line "gray10" "gray90" nil nil t nil )
|
||||
(modify-face 'font-lock-comment-face "black" "white" nil nil t nil )
|
||||
(modify-face 'font-lock-function-name-face "black" "white" nil t nil nil )
|
||||
(modify-face 'font-lock-keyword-face "black" "white" nil nil nil t )
|
||||
(modify-face 'font-lock-constant-face "black" "white" nil t nil nil )
|
||||
(modify-face 'font-lock-string-face "black" "white" nil nil t t )
|
||||
(modify-face 'font-lock-type-face "black" "white" nil t t nil )
|
||||
(modify-face 'font-lock-variable-name-face "black" "white" nil nil nil nil )
|
||||
(modify-face 'font-lock-builtin-face "black" "white" nil t nil nil )
|
||||
(modify-face 'font-lock-warning-face "black" "white" nil t nil nil )
|
||||
(modify-face 'show-paren-match-face "gray20" "gray80" nil t nil nil )
|
||||
(modify-face 'show-paren-mismatch-face "white" "gray40" nil t t nil ))
|
||||
|
||||
(defun ess-font-lock-db ()
|
||||
"Set font-lock colors (leave fore-/back-ground alone) courtesy David Brahm <David.Brahm@fmr.com>"
|
||||
;; FIXME: Turn it into a Custom theme!
|
||||
(interactive)
|
||||
(set-face-foreground 'font-lock-comment-face "Firebrick") ; #... %...
|
||||
(set-face-foreground 'font-lock-string-face "SeaGreen") ; "..." "..."
|
||||
(set-face-foreground 'font-lock-keyword-face "MediumBlue") ; if \end
|
||||
(set-face-foreground 'font-lock-function-name-face "VioletRed") ; talk<- {center}
|
||||
(set-face-foreground 'font-lock-variable-name-face "Blue") ; xv
|
||||
(set-face-foreground 'font-lock-type-face "Goldenrod") ; T,F ?
|
||||
(set-face-foreground 'font-lock-constant-face "Magenta") ; <- {eq1}
|
||||
)
|
||||
|
||||
(provide 'ess-font-lock)
|
||||
|
||||
;;; ess-font-lock.el ends here
|
||||
109
elpa/ess-20180701.100/ess-generics.el
Normal file
109
elpa/ess-20180701.100/ess-generics.el
Normal file
@@ -0,0 +1,109 @@
|
||||
;;; ess-generics.el --- Mode-generic functions
|
||||
;;
|
||||
;; Copyright (C) ESS-core <ESS-core@r-project.org>
|
||||
;; Maintainer: ESS-core <ESS-core@r-project.org>
|
||||
;;
|
||||
;; 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/
|
||||
;;
|
||||
;;; Comment
|
||||
;;
|
||||
;; Define generic method with `ess-defgeneric' and dialect specific override with
|
||||
;; `ess-defmethod`. Current implementation is using `{name}-function' and
|
||||
;; `ess-customize-alist' as the backbone mechanism. This might change in the
|
||||
;; future.
|
||||
;;
|
||||
;;; Code
|
||||
|
||||
(defun ess-generics--override (name args body)
|
||||
(let ((funname (intern (format "%s-function" name)))
|
||||
(arg-list (delq '&rest (delq '&optional (copy-alist args)))))
|
||||
`(if (fboundp ,funname)
|
||||
,(if (memq '&rest args)
|
||||
`(apply ,funname ,@arg-list)
|
||||
`(funcall ,funname ,@arg-list))
|
||||
,@(or body
|
||||
`((error (format "`%s' is not implemented for dialect `%s'"
|
||||
',name ess-dialect)))))))
|
||||
|
||||
(defun ess-generics--expand-overrides (name args body)
|
||||
;; ripped off from `mode-local--expand-overrides'
|
||||
(let ((forms body)
|
||||
(ditto t)
|
||||
form xbody)
|
||||
(while forms
|
||||
(setq form (car forms))
|
||||
(cond
|
||||
((atom form))
|
||||
((eq (car form) :override)
|
||||
(setq form (ess-generics--override name args (cdr form))))
|
||||
((eq (car form) :override-with-args)
|
||||
(setq form (ess-generics--override name (cadr form) (cddr form))))
|
||||
((setq form (ess-generics--expand-overrides name args form))))
|
||||
(setq ditto (and ditto (eq (car forms) form))
|
||||
xbody (cons form xbody)
|
||||
forms (cdr forms)))
|
||||
(if ditto body (nreverse xbody))))
|
||||
|
||||
;;;###autoload
|
||||
(defmacro ess-defgeneric (name args docstring &rest body)
|
||||
"Define a new function, as with `defun', which can be overloaded.
|
||||
NAME is the name of the function to create. ARGS are the
|
||||
arguments to the function. DOCSTRING is a documentation string to
|
||||
describe the function. The docstring will automatically have
|
||||
details about its overload symbol appended to the end. BODY is
|
||||
code that would be run when there is no override defined. The
|
||||
default is to signal error if {name}-function is not defined."
|
||||
(declare (doc-string 3) (indent defun) (debug defun))
|
||||
(let ((funname (intern (format "%s-function" name))))
|
||||
`(eval-and-compile
|
||||
(defvar-local ,funname nil ,(format "When defined this function is called by `%s'." name))
|
||||
(defun ,name ,args ,(format "%s\n\nUse `ess-defmethod' to define dialect specific overrides." docstring)
|
||||
,@(ess-generics--expand-overrides name args body)))))
|
||||
|
||||
(defmacro ess-defmethod (dialect name args &rest body)
|
||||
"Define a dialect specific override of the method NAME.
|
||||
If NAME wasn't created with `ess-defgeneric' signal an
|
||||
error. DIALECT is the dialect name this override is being defined
|
||||
for. ARGS are the function arguments, which should match those of
|
||||
the same named function created with `ess-defgeneric'. BODY is the
|
||||
implementation of this function."
|
||||
(declare (indent defun) (debug (&define sexp sexp lambda-list def-body)))
|
||||
(let ((new-name (intern (format "%s:%s" name dialect)))
|
||||
(fun-name (intern (format "%s-function" name)))
|
||||
(alist-name (intern (downcase (format "ess-%s-customize-alist" dialect)))))
|
||||
`(eval-and-compile
|
||||
(unless (boundp ',alist-name)
|
||||
(defvar ,alist-name nil
|
||||
,(format "Variables to customize dialect '%s'." dialect)))
|
||||
(add-to-list ',alist-name
|
||||
'(,fun-name . ',new-name))
|
||||
(defun ,new-name ,args
|
||||
,(format "%s\nThis is an override for `%s' for `%s' dialect."
|
||||
;; fixme: NAME might be undefined as yet. Look at help-fns-describe-function-functions
|
||||
(or (and (fboundp name)
|
||||
(documentation name)
|
||||
;; hackish
|
||||
(replace-regexp-in-string "\nUse.*ess-defmethod.*\\." "" (documentation name)))
|
||||
"")
|
||||
name dialect)
|
||||
;; The body for this implementation
|
||||
,@body)
|
||||
;; For find-func to locate the definition of NEW-NAME.
|
||||
(put ',new-name 'definition-name ',name))))
|
||||
|
||||
|
||||
|
||||
(provide 'ess-generics)
|
||||
652
elpa/ess-20180701.100/ess-gretl.el
Normal file
652
elpa/ess-20180701.100/ess-gretl.el
Normal file
@@ -0,0 +1,652 @@
|
||||
;; ess-gretl.el --- ESS gretl mode and inferior interaction
|
||||
;;
|
||||
;; Copyright (C) 2012 Allin Cottrell
|
||||
;; Copyright (C) 2012 Ahmadou DICKO
|
||||
;; Copyright (C) 2013 ESS core team
|
||||
;;
|
||||
;; Filename: ess-gretl.el
|
||||
;; Author: Ahmadou DICKO, Spinu Vitalie and Allin Cottrell (based on ess-julia.el and gretl.el)
|
||||
;; Maintainer: Ahmadou DICKO
|
||||
;; Created: 01-10-2012 (ESS 12.09)
|
||||
;; Keywords: ESS, gretl, econometrics
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
|
||||
;; This file is *NOT* part of GNU Emacs.
|
||||
;; This file is *NOT YET* part of ESS
|
||||
;;
|
||||
;; 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, 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.
|
||||
;;
|
||||
;; A copy of the GNU General Public License is available at
|
||||
;; http://www.r-project.org/Licenses/
|
||||
;;
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;;; Commentary:
|
||||
;; start the inferior with M-x gretl.
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
(require 'compile); for compilation-* below
|
||||
(require 'ess-r-mode)
|
||||
|
||||
|
||||
;;; Code:
|
||||
(defvar gretl-mode-hook nil)
|
||||
(add-to-list 'auto-mode-alist '("\\.inp$" . 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 `gretl-mode'.")
|
||||
|
||||
;; syntax table that holds within strings
|
||||
(defvar gretl-mode-string-syntax-table
|
||||
(let ((table (make-syntax-table)))
|
||||
table)
|
||||
"Syntax table for `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"
|
||||
"funcerr" "return" "while" "elif" "const" "3sls" "liml" "fiml"
|
||||
"sur" "params" "deriv" "orthog" "weights" "series" "scalar" "genr")
|
||||
"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" "autocorr" "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-defaults
|
||||
(list
|
||||
;; Fontify all builtin keywords.
|
||||
(cons (concat "\\<\\("
|
||||
(mapconcat 'identity gretl-keywords "\\|")
|
||||
"\\)\\>")
|
||||
'font-lock-keyword-face)
|
||||
;; Fontify all option flags.
|
||||
(cons (concat "[ \t]--\\("
|
||||
(mapconcat 'identity gretl-option-flags "\\|")
|
||||
"\\)")
|
||||
'font-lock-constant-face)
|
||||
;; Fontify all command words.
|
||||
(cons (concat "\\<\\("
|
||||
(mapconcat 'identity 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 "\\$\\("
|
||||
(mapconcat 'identity gretl-internal-vars "\\|")
|
||||
"\\)\\>")
|
||||
'font-lock-variable-name-face)
|
||||
|
||||
;; Fontify all genr functions.
|
||||
(cons (concat "\\<\\("
|
||||
(mapconcat 'identity 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 "\\<\\("
|
||||
(mapconcat 'identity gretl-block-start-keywords "\\|")
|
||||
"\\)\\>"))
|
||||
|
||||
(defvar gretl-block-else-regexp
|
||||
(concat "\\<\\("
|
||||
(mapconcat 'identity gretl-block-other-keywords "\\|")
|
||||
"\\)\\>"))
|
||||
|
||||
(defvar gretl-block-end-regexp
|
||||
(concat "\\<\\("
|
||||
(mapconcat 'identity 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
|
||||
(cond ((gretl-at-keyword gretl-block-start-keywords)
|
||||
(+ count 1))
|
||||
((and (zerop (string-match "\\(?:e\\(?:l\\(?:if\\|se\\)\\|nd\\(?:if\\|loop\\)?\\)\\)" (current-word)))
|
||||
(not (ess-inside-comment-p)) (not (ess-inside-brackets-p)))
|
||||
(- count 1))
|
||||
(t count))))
|
||||
(if (> count 0)
|
||||
(point)
|
||||
nil)))
|
||||
|
||||
|
||||
(defun gretl-last-open-block (min)
|
||||
(let ((pos (gretl-last-open-block-pos min)))
|
||||
(and pos
|
||||
(progn
|
||||
(goto-char pos)
|
||||
(+ gretl-basic-offset (current-indentation))))))
|
||||
|
||||
|
||||
; return indent implied by a special form opening on the previous line, if any
|
||||
(defun gretl-form-indent ()
|
||||
(forward-line -1)
|
||||
(end-of-line)
|
||||
(backward-sexp)
|
||||
(if (gretl-at-keyword gretl-block-other-keywords)
|
||||
(+ gretl-basic-offset (current-indentation))
|
||||
(if (char-equal (char-after (point)) ?\()
|
||||
(progn
|
||||
(backward-word 1)
|
||||
(let ((cur (current-indentation)))
|
||||
(if (gretl-at-keyword gretl-block-start-keywords)
|
||||
(+ gretl-basic-offset cur)
|
||||
nil)))
|
||||
nil)))
|
||||
|
||||
|
||||
(defun gretl-indent-line ()
|
||||
"Indent current line of gretl code"
|
||||
(interactive)
|
||||
; (save-excursion
|
||||
(end-of-line)
|
||||
(indent-line-to
|
||||
(or (and (ess-inside-string-p (point-at-bol)) 0)
|
||||
(save-excursion (ignore-errors (gretl-form-indent)))
|
||||
(save-excursion
|
||||
(let ((endtok (progn
|
||||
(beginning-of-line)
|
||||
(forward-to-indentation 0)
|
||||
(gretl-at-keyword gretl-block-end-keywords))))
|
||||
(ignore-errors (+ (gretl-last-open-block (point-min))
|
||||
(if endtok (- gretl-basic-offset) 0)))))
|
||||
;; previous line ends in =
|
||||
(save-excursion
|
||||
(if (and (not (equal (point-min) (line-beginning-position)))
|
||||
(progn
|
||||
(forward-line -1)
|
||||
(end-of-line) (backward-char 1)
|
||||
(equal (char-after (point)) ?=)))
|
||||
(+ gretl-basic-offset (current-indentation))
|
||||
nil))
|
||||
;; take same indentation as previous line
|
||||
(save-excursion (forward-line -1)
|
||||
(current-indentation))
|
||||
0))
|
||||
(when (gretl-at-keyword gretl-block-end-keywords)
|
||||
(forward-word 1)))
|
||||
|
||||
|
||||
(defvar gretl-editing-alist
|
||||
'((paragraph-start . (concat "\\s-*$\\|" page-delimiter))
|
||||
(paragraph-separate . (concat "\\s-*$\\|" page-delimiter))
|
||||
(paragraph-ignore-fill-prefix . t)
|
||||
(require-final-newline . mode-require-final-newline)
|
||||
(comment-start . "# ")
|
||||
(comment-add . 1)
|
||||
(comment-start-skip . "\\s<+\\s-*")
|
||||
(comment-column . 40)
|
||||
;;(comment-indent-function . 'S-comment-indent)
|
||||
;;(ess-comment-indent . 'S-comment-indent)
|
||||
;;(ess-indent-line . 'S-indent-line)
|
||||
(ess-calculate-indent . 'ess-calculate-indent)
|
||||
(ess-indent-line-function . 'gretl-indent-line)
|
||||
(parse-sexp-ignore-comments . t)
|
||||
(ess-style . ess-default-style) ;; ignored
|
||||
(ess-local-process-name . nil)
|
||||
;;(ess-keep-dump-files . 'ask)
|
||||
(ess-mode-syntax-table . gretl-syntax-table)
|
||||
;; (add-log-current-defun-header-regexp . "^.*function[ \t]*\\([^ \t(]*\\)[ \t]*(")
|
||||
(font-lock-defaults . '(gretl-font-lock-defaults))
|
||||
)
|
||||
"General options for gretl source files.")
|
||||
|
||||
|
||||
;; (defun gretl-send-string-function (process string visibly)
|
||||
;; (let ((gretl-process (get-process "gretlcli")))
|
||||
;; (process-send-string process (format ess-load-command file)))
|
||||
|
||||
|
||||
;; (defun gretl-send-string-function (process string visibly)
|
||||
;; (let ((file (concat temporary-file-directory "gretl_eval_region.inp")))
|
||||
;; (with-temp-file file
|
||||
;; (insert string))
|
||||
;; (process-send-string process (format ess-load-command file))))
|
||||
|
||||
(defun gretl--get-words-from-command (command start-reg end-reg)
|
||||
(with-current-buffer (ess-command command)
|
||||
(goto-char (point-min))
|
||||
(let ((beg (or (re-search-forward start-reg nil t)
|
||||
(point-min)))
|
||||
(end (progn (goto-char (point-max))
|
||||
(or (re-search-backward end-reg)
|
||||
(point-max))))
|
||||
acum)
|
||||
(goto-char beg)
|
||||
(skip-chars-forward "\n")
|
||||
(while (re-search-forward "[^ \t\n]+" end t)
|
||||
(push (match-string-no-properties 0) acum))
|
||||
acum)))
|
||||
|
||||
(defun gretl-get-help-topics-function (name)
|
||||
(delete-dups
|
||||
(append gretl-command-words gretl-genr-functions
|
||||
gretl-block-end-keywords gretl-block-other-keywords
|
||||
gretl-block-start-keywords
|
||||
(gretl--get-words-from-command "help\n" "are:" "^For")
|
||||
(gretl--get-words-from-command "help functions\n" "Accessors:" "^Functions")
|
||||
(gretl--get-words-from-command "help functions\n" "^Functions" "^For")
|
||||
)))
|
||||
|
||||
;; (defvar ess-gretl-error-regexp-alist '(gretl-in gretl-at)
|
||||
;; "List of symbols which are looked up in `compilation-error-regexp-alist-alist'.")
|
||||
|
||||
;; (add-to-list 'compilation-error-regexp-alist-alist
|
||||
;; '(gretl-in "^\\s-*in [^ \t\n]* \\(at \\(.*\\):\\([0-9]+\\)\\)" 2 3 nil 2 1))
|
||||
;; (add-to-list 'compilation-error-regexp-alist-alist
|
||||
;; '(gretl-at "^\\s-*\\(at \\(.*\\):\\([0-9]+\\)\\)" 2 3 nil 2 1))
|
||||
|
||||
|
||||
(defvar gretl-customize-alist
|
||||
'((comint-use-prompt-regexp . t)
|
||||
(inferior-ess-primary-prompt . "\\? ")
|
||||
(inferior-ess-secondary-prompt . "\\ ")
|
||||
(inferior-ess-prompt . "\\? ")
|
||||
(ess-local-customize-alist . 'gretl-customize-alist)
|
||||
(inferior-ess-program . "gretlcli")
|
||||
(inferior-ess-font-lock-defaults . gretl-font-lock-defaults)
|
||||
(ess-get-help-topics-function . 'gretl-get-help-topics-function)
|
||||
(ess-load-command . "open \"%s\"\n")
|
||||
;; (ess-dump-error-re . "in \\w* at \\(.*\\):[0-9]+")
|
||||
;; (ess-error-regexp . "\\(^\\s-*at\\s-*\\(?3:.*\\):\\(?2:[0-9]+\\)\\)")
|
||||
;; (ess-error-regexp-alist . ess-gretl-error-regexp-alist)
|
||||
;; (inferior-ess-objects-command . inferior-gretl-objects-command)
|
||||
;; (inferior-ess-search-list-command . "search()\n")
|
||||
;; inferior-ess-help-command . gretl-help-command)
|
||||
(inferior-ess-help-command . "help %s\n")
|
||||
(ess-language . "gretl")
|
||||
(ess-dialect . "gretl")
|
||||
(ess-suffix . "inp")
|
||||
(ess-dump-filename-template . (replace-regexp-in-string
|
||||
"S$" ess-suffix ; in the one from custom:
|
||||
ess-dump-filename-template-proto))
|
||||
(ess-mode-syntax-table . gretl-syntax-table)
|
||||
(ess-mode-editing-alist . gretl-editing-alist)
|
||||
(ess-change-sp-regexp . nil );ess-r-change-sp-regexp)
|
||||
(ess-help-sec-regex . ess-help-r-sec-regex)
|
||||
(ess-help-sec-keys-alist . ess-help-r-sec-keys-alist)
|
||||
(ess-loop-timeout . ess-S-loop-timeout);fixme: dialect spec.
|
||||
(ess-function-pattern . ess-r-function-pattern)
|
||||
(ess-object-name-db-file . "ess-r-namedb.el" )
|
||||
;; (ess-imenu-mode-function . nil)
|
||||
(ess-smart-operators . ess-r-smart-operators)
|
||||
(inferior-ess-help-filetype . nil)
|
||||
(inferior-ess-exit-command . "exit\n")
|
||||
;;harmful for shell-mode's C-a: -- but "necessary" for ESS-help?
|
||||
(inferior-ess-start-file . nil) ;; "~/.ess-R"
|
||||
(inferior-ess-start-args . "")
|
||||
(inferior-ess-language-start . nil)
|
||||
(ess-STERM . "iESS")
|
||||
)
|
||||
"Variables to customize for Gretl -- set up later than emacs initialization.")
|
||||
|
||||
;; (defcustom inferior-gretl-program "gretlcli"
|
||||
;; "*The program to use for running gretl scripts."
|
||||
;; :type 'string
|
||||
;; :group 'ess-gretl)
|
||||
|
||||
;; (defvar ess-gretl-versions '("gretcli")
|
||||
;; "List of partial strings for versions of Julia to access within ESS.
|
||||
;; Each string specifies the start of a filename. If a filename
|
||||
;; beginning with one of these strings is found on `exec-path', a M-x
|
||||
;; command for that version of Julia is made available. ")
|
||||
|
||||
(defcustom inferior-gretl-args ""
|
||||
"String of arguments used when starting gretl.
|
||||
These arguments are currently not passed to other versions of gretl that have
|
||||
been created using the variable `ess-r-versions'."
|
||||
:group 'ess-gretl
|
||||
:type 'string)
|
||||
|
||||
;;;###autoload
|
||||
(defun gretl-mode (&optional proc-name)
|
||||
"Major mode for editing gretl source. See `ess-mode' for more help."
|
||||
(interactive "P")
|
||||
;; (setq ess-customize-alist gretl-customize-alist)
|
||||
;;(setq imenu-generic-expression R-imenu-generic-expression)
|
||||
(ess-mode gretl-customize-alist proc-name)
|
||||
;; for emacs < 24
|
||||
;; (add-hook 'comint-dynamic-complete-functions 'ess-complete-object-name nil 'local)
|
||||
;; for emacs >= 24
|
||||
;; (remove-hook 'completion-at-point-functions 'ess-filename-completion 'local) ;; should be first
|
||||
;; (add-hook 'completion-at-point-functions 'ess-object-completion nil 'local)
|
||||
;; (add-hook 'completion-at-point-functions 'ess-filename-completion nil 'local)
|
||||
(if (fboundp 'ess-add-toolbar) (ess-add-toolbar))
|
||||
(set (make-local-variable 'end-of-defun-function) 'ess-end-of-function)
|
||||
;; (local-set-key "\t" 'gretl-indent-line) ;; temp workaround
|
||||
;; (set (make-local-variable 'indent-line-function) 'gretl-indent-line)
|
||||
;; (ess-imenu-gretl)
|
||||
(run-mode-hooks 'gretl-mode-hook))
|
||||
|
||||
|
||||
(defvar ess-gretl-post-run-hook nil
|
||||
"Functions run in process buffer after the initialization of
|
||||
Gretl process.")
|
||||
|
||||
|
||||
|
||||
;;;###autoload
|
||||
(defun gretl (&optional start-args)
|
||||
"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'."
|
||||
(interactive "P")
|
||||
;; get settings, notably inferior-ess-r-program :
|
||||
;; (if (null inferior-gretl-program)
|
||||
;; (error "'inferior-gretl-program' does not point to 'gretl-release-basic' executable")
|
||||
(setq ess-customize-alist gretl-customize-alist)
|
||||
(ess-write-to-dribble-buffer ;; for debugging only
|
||||
(format
|
||||
"\n(Gretl): ess-dialect=%s, buf=%s"
|
||||
ess-dialect (current-buffer)))
|
||||
(let* ((r-start-args
|
||||
(concat inferior-gretl-args " " ; add space just in case
|
||||
(if start-args
|
||||
(read-string
|
||||
(concat "Starting Args [other than `"
|
||||
inferior-gretl-args
|
||||
"'] ? "))
|
||||
nil))))
|
||||
(inferior-ess r-start-args)
|
||||
(set (make-local-variable 'indent-line-function) 'gretl-indent-line)
|
||||
(set (make-local-variable 'gretl-basic-offset) 4)
|
||||
(setq indent-tabs-mode nil)
|
||||
(goto-char (point-max))
|
||||
;; (if inferior-ess-language-start
|
||||
;; (ess-eval-linewise inferior-ess-language-start
|
||||
;; nil nil nil 'wait-prompt)))
|
||||
(with-ess-process-buffer nil
|
||||
(run-mode-hooks 'ess-gretl-post-run-hook))
|
||||
))
|
||||
|
||||
|
||||
;;;; IMENU
|
||||
|
||||
;; (defvar gretl-imenu-generic-expression
|
||||
;; '(("Function (_)" "^\\s-*function\\s-+\\(_[^ \t\n]*\\)" 1)
|
||||
;; ("Function" "^\\s-*function\\s-+\\([^_][^ \t\n]*\\)" 1)
|
||||
;; ("Const" "^\\s-*const \\([^ \t\n]*\\)" 1)
|
||||
;; ("Type" "^\\s-*\\w*type\\w* \\([^ \t\n]*\\)" 1)
|
||||
;; ("Load" " *\\(load\\)(\\([^ \t\n)]*\\)" 2)
|
||||
;; ;; ("Classes" "^.*setClass(\\(.*\\)," 1)
|
||||
;; ;; ("Coercions" "^.*setAs(\\([^,]+,[^,]*\\)," 1) ; show from and to
|
||||
;; ;; ("Generics" "^.*setGeneric(\\([^,]*\\)," 1)
|
||||
;; ;; ("Methods" "^.*set\\(Group\\|Replace\\)?Method(\"\\(.+\\)\"," 2)
|
||||
;; ;; ;;[ ]*\\(signature=\\)?(\\(.*,?\\)*\\)," 1)
|
||||
;; ;; ;;
|
||||
;; ;; ;;("Other" "^\\(.+\\)\\s-*<-[ \t\n]*[^\\(function\\|read\\|.*data\.frame\\)]" 1)
|
||||
;; ;; ("Package" "^.*\\(library\\|require\\)(\\(.*\\)," 2)
|
||||
;; ;; ("Data" "^\\(.+\\)\\s-*<-[ \t\n]*\\(read\\|.*data\.frame\\).*(" 1)))
|
||||
;; ))
|
||||
|
||||
|
||||
;; (defun ess-imenu-gretl (&optional arg)
|
||||
;; "Gretl Language Imenu support for ESS."
|
||||
;; (interactive)
|
||||
;; (setq imenu-generic-expression gretl-imenu-generic-expression)
|
||||
;; (imenu-add-to-menubar "Imenu-gretl"))
|
||||
|
||||
|
||||
;; (defun ess-imenu-gretl (&optional arg)
|
||||
;; "Gretl Language Imenu support for ESS."
|
||||
;; (interactive)
|
||||
;; (setq imenu-generic-expression gretl-imenu-generic-expression)
|
||||
;; (imenu-add-to-menubar "Imenu-jl"))
|
||||
|
||||
|
||||
(provide 'ess-gretl)
|
||||
;; (provide 'ess-gretl)
|
||||
|
||||
(provide 'ess-gretl)
|
||||
|
||||
;;; ess-gretl.el ends here
|
||||
1034
elpa/ess-20180701.100/ess-help.el
Normal file
1034
elpa/ess-20180701.100/ess-help.el
Normal file
File diff suppressed because it is too large
Load Diff
3168
elpa/ess-20180701.100/ess-inf.el
Normal file
3168
elpa/ess-20180701.100/ess-inf.el
Normal file
File diff suppressed because it is too large
Load Diff
272
elpa/ess-20180701.100/ess-jags-d.el
Normal file
272
elpa/ess-20180701.100/ess-jags-d.el
Normal file
@@ -0,0 +1,272 @@
|
||||
;;; ess-jags-d.el --- ESS[JAGS] dialect
|
||||
|
||||
;; Copyright (C) 2008-2011 Rodney Sparapani
|
||||
|
||||
;; Author: Rodney Sparapani
|
||||
;; Created: 13 March 2008
|
||||
;; Maintainer: ESS-help <ess-help@r-project.org>
|
||||
|
||||
;; 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 '(("\\.[jJ][aA][gG]\\'" . ess-jags-mode)) auto-mode-alist))
|
||||
|
||||
(defvar ess-jags-command "jags" "Default JAGS program in PATH.")
|
||||
(make-local-variable 'ess-jags-command)
|
||||
|
||||
(defvar ess-jags-monitor '("") "Default list of variables to monitor.")
|
||||
(make-local-variable 'ess-jags-monitor)
|
||||
|
||||
(defvar ess-jags-thin 1 "Default thinning parameter.")
|
||||
(make-local-variable 'ess-jags-thin)
|
||||
|
||||
(defvar ess-jags-chains 1 "Default number of chains.")
|
||||
(make-local-variable 'ess-jags-chains)
|
||||
|
||||
(defvar ess-jags-burnin 10000 "Default burn-in.")
|
||||
(make-local-variable 'ess-jags-burnin)
|
||||
|
||||
(defvar ess-jags-update 10000 "Default number of updates after burnin.")
|
||||
(make-local-variable 'ess-jags-update)
|
||||
|
||||
(defvar ess-jags-system t "Default whether JAGS recognizes the system command.")
|
||||
|
||||
(defvar ess-jags-font-lock-keywords
|
||||
(list
|
||||
;; .jag 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\\|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)
|
||||
|
||||
;; .jmd files
|
||||
(cons (concat "\\<\\(adapt\\|cd\\|clear\\|coda\\|data\\|dir\\|"
|
||||
"exit\\|in\\(itialize\\)?\\|load\\|model\\|monitors\\|parameters\\|"
|
||||
"pwd\\|run\\|s\\(amplers\\|ystem\\)\\|to\\|update\\)[ \t\n]")
|
||||
font-lock-keyword-face)
|
||||
|
||||
(cons "\\<\\(compile\\|monitor\\)[, \t\n]"
|
||||
font-lock-keyword-face)
|
||||
|
||||
(cons "[, \t\n]\\(by\\|chain\\|nchains\\|stem\\|thin\\|type\\)[ \t\n]*("
|
||||
font-lock-function-name-face)
|
||||
)
|
||||
"ESS[JAGS]: Font lock keywords."
|
||||
)
|
||||
|
||||
(defun ess-jags-switch-to-suffix (suffix &optional jags-chains jags-monitor jags-thin
|
||||
jags-burnin jags-update)
|
||||
"ESS[JAGS]: 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 ".jag" 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 "#ess-jags-chains:1\n")
|
||||
(insert "#ess-jags-monitor:(\"\")\n")
|
||||
(insert "#ess-jags-thin:1\n")
|
||||
(insert "#ess-jags-burnin:10000\n")
|
||||
(insert "#ess-jags-update:10000\n")
|
||||
(insert "#End:\n")
|
||||
))
|
||||
|
||||
(if (equal ".jmd" suffix) (let
|
||||
((ess-jags-temp-chains "") (ess-jags-temp-monitor "") (ess-jags-temp-chain ""))
|
||||
|
||||
(if jags-chains (setq ess-jags-chains jags-chains))
|
||||
(if jags-monitor (setq ess-jags-monitor jags-monitor))
|
||||
(if jags-thin (setq ess-jags-thin jags-thin))
|
||||
|
||||
(setq ess-jags-temp-chains
|
||||
(concat "compile, nchains(" (format "%d" ess-jags-chains) ")\n"))
|
||||
|
||||
(setq jags-chains ess-jags-chains)
|
||||
|
||||
(while (< 0 jags-chains)
|
||||
(setq ess-jags-temp-chains
|
||||
(concat ess-jags-temp-chains
|
||||
"parameters ## \"" ess-bugs-file-root
|
||||
".##" (format "%d" jags-chains) "\", chain("
|
||||
(format "%d" jags-chains) ")\n"))
|
||||
(setq jags-chains (- jags-chains 1)))
|
||||
|
||||
(setq ess-jags-temp-monitor "")
|
||||
|
||||
(while (and (listp ess-jags-monitor) (consp ess-jags-monitor))
|
||||
(if (not (string-equal "" (car ess-jags-monitor)))
|
||||
(setq ess-jags-temp-monitor
|
||||
(concat ess-jags-temp-monitor "monitor "
|
||||
(car ess-jags-monitor) ", thin(" (format "%d" ess-jags-thin) ")\n")))
|
||||
(setq ess-jags-monitor (cdr ess-jags-monitor)))
|
||||
|
||||
(insert "model in \"" ess-bugs-file-root ".jag\"\n")
|
||||
(insert "data in \"" ess-bugs-file-root ".jdt\"\n")
|
||||
(insert (ess-replace-in-string ess-jags-temp-chains "##" "in"))
|
||||
(insert "initialize\n")
|
||||
;(insert "update " (format "%d" (* jags-thin jags-burnin)) "\n")
|
||||
(insert "update " (format "%d" jags-burnin) "\n")
|
||||
(insert ess-jags-temp-monitor)
|
||||
(insert "update " (format "%d" (* jags-thin jags-update)) "\n")
|
||||
(insert (ess-replace-in-string
|
||||
(ess-replace-in-string ess-jags-temp-chains
|
||||
"compile, nchains([0-9]+)" "#") "##" "to"))
|
||||
(insert "coda "
|
||||
;(if ess-microsoft-p (if (w32-shell-dos-semantics) "*" "\\*") "\\*")
|
||||
"*, stem(\"" ess-bugs-file-root "\")\n")
|
||||
|
||||
(if ess-jags-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 jags-chains ess-jags-chains)
|
||||
|
||||
(while (< 0 jags-chains)
|
||||
(setq ess-jags-temp-chain (format "%d" jags-chains))
|
||||
|
||||
;.txt not recognized by BOA and impractical to over-ride
|
||||
(insert "system rm -f " ess-bugs-file-root ess-jags-temp-chain ".out\n")
|
||||
(insert "system ln -s " ess-bugs-file-root "chain" ess-jags-temp-chain ".txt "
|
||||
ess-bugs-file-root ess-jags-temp-chain ".out\n")
|
||||
(setq jags-chains (- jags-chains 1)))))
|
||||
|
||||
(insert "exit\n")
|
||||
(insert "Local Variables" ":\n")
|
||||
(insert "ess-jags-chains:" (format "%d" ess-jags-chains) "\n")
|
||||
(insert "ess-jags-command:\"jags\"\n")
|
||||
(insert "End:\n")
|
||||
))
|
||||
))
|
||||
)
|
||||
|
||||
(defun ess-jags-na-jmd (jags-command jags-chains)
|
||||
"ESS[JAGS]: Perform the Next-Action for .jmd."
|
||||
;(ess-save-and-set-local-variables)
|
||||
(if (equal 0 (buffer-size)) (ess-jags-switch-to-suffix ".jmd")
|
||||
;else
|
||||
(shell)
|
||||
(ess-sleep)
|
||||
|
||||
(if (when (fboundp 'w32-shell-dos-semantics)
|
||||
(w32-shell-dos-semantics))
|
||||
(if (string-equal ":" (substring ess-bugs-file 1 2))
|
||||
(progn
|
||||
(insert (substring ess-bugs-file 0 2))
|
||||
(comint-send-input)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
(insert "cd \"" ess-bugs-file-dir "\"")
|
||||
(comint-send-input)
|
||||
|
||||
; (let ((ess-jags-temp-chains ""))
|
||||
;
|
||||
; (while (< 0 jags-chains)
|
||||
; (setq ess-jags-temp-chains
|
||||
; (concat (format "%d " jags-chains) ess-jags-temp-chains))
|
||||
; (setq jags-chains (- jags-chains 1)))
|
||||
|
||||
(insert ess-bugs-batch-pre-command " " jags-command " "
|
||||
ess-bugs-file-root ".jmd "
|
||||
|
||||
(if (or (equal shell-file-name "/bin/csh")
|
||||
(equal shell-file-name "/bin/tcsh")
|
||||
(equal shell-file-name "/bin/zsh")
|
||||
(equal shell-file-name "/bin/bash"))
|
||||
(concat ">& " ess-bugs-file-root ".jog ")
|
||||
;else
|
||||
"> " ess-bugs-file-root ".jog 2>&1 ")
|
||||
|
||||
; ;.txt not recognized by BOA and impractical to over-ride
|
||||
; "&& (rm -f " ess-bugs-file-root ".ind; "
|
||||
; "ln -s " ess-bugs-file-root "index.txt " ess-bugs-file-root ".ind; "
|
||||
; "for i in " ess-jags-temp-chains "; do; "
|
||||
; "rm -f " ess-bugs-file-root "$i.out; "
|
||||
; "ln -s " ess-bugs-file-root "chain$i.txt " ess-bugs-file-root "$i.out; done) "
|
||||
|
||||
ess-bugs-batch-post-command)
|
||||
|
||||
(comint-send-input)
|
||||
))
|
||||
|
||||
(defun ess-jags-na-bug ()
|
||||
"ESS[JAGS]: Perform Next-Action for .jag"
|
||||
|
||||
(if (equal 0 (buffer-size)) (ess-jags-switch-to-suffix ".jag")
|
||||
;else
|
||||
(ess-save-and-set-local-variables)
|
||||
(ess-jags-switch-to-suffix ".jmd"
|
||||
ess-jags-chains ess-jags-monitor ess-jags-thin ess-jags-burnin ess-jags-update))
|
||||
)
|
||||
|
||||
;;;###autoload
|
||||
(defun ess-jags-mode ()
|
||||
"ESS[JAGS]: Major mode for JAGS."
|
||||
(interactive)
|
||||
(kill-all-local-variables)
|
||||
(ess-setq-vars-local '((comment-start . "#")))
|
||||
(setq major-mode 'ess-jags-mode)
|
||||
(setq mode-name "ESS[JAGS]")
|
||||
(use-local-map ess-bugs-mode-map)
|
||||
(make-local-variable 'font-lock-defaults)
|
||||
(setq font-lock-defaults '(ess-jags-font-lock-keywords nil t))
|
||||
(setq ess-language "S") ; mimic S for ess-smart-underscore
|
||||
(run-mode-hooks 'ess-bugs-mode-hook)
|
||||
|
||||
(unless (and (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 '("\\.[Jj][Aa][Gg]\\'" . ess-jags-mode))
|
||||
;;;###autoload
|
||||
(add-to-list 'auto-mode-alist '("\\.[Jj][Oo][Gg]\\'" . ess-jags-mode))
|
||||
;;;###autoload
|
||||
(add-to-list 'auto-mode-alist '("\\.[Jj][Mm][Dd]\\'" . ess-jags-mode))
|
||||
|
||||
(defvaralias 'ess-jags-mode-hook 'ess-bugs-mode-hook)
|
||||
(defvaralias 'ess-jags-mode-map 'ess-bugs-mode-map)
|
||||
|
||||
(setq features (delete 'ess-bugs-d features))
|
||||
(provide 'ess-jags-d)
|
||||
|
||||
;;; ess-jags-d.el ends here
|
||||
446
elpa/ess-20180701.100/ess-julia.el
Normal file
446
elpa/ess-20180701.100/ess-julia.el
Normal file
@@ -0,0 +1,446 @@
|
||||
;; ess-julia.el --- ESS julia mode and inferior interaction
|
||||
;;
|
||||
;; Copyright (C) 2012-2015 Vitalie Spinu and the ESS Core team.
|
||||
;;
|
||||
;; Filename: ess-julia.el
|
||||
;; Author: Vitalie Spinu (based on julia-mode.el from julia-lang project)
|
||||
;; Maintainer: Vitalie Spinu
|
||||
;; Created: 02-04-2012 (ESS 12.03)
|
||||
;; Keywords: ESS, julia
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;; This file is *NOT* part of GNU Emacs.
|
||||
;; This file is part of ESS
|
||||
;;
|
||||
;; 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, 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/
|
||||
;;
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;;; Commentary:
|
||||
;;
|
||||
;; Customise inferior-julia-program to point to your julia binary
|
||||
;; and start the inferior with M-x julia.
|
||||
;;
|
||||
;; As of Sept 2015, this file depends heavily on julia-mode.el from the Julia
|
||||
;; sources. If you install ESS using `make', this will work fine, otherwise
|
||||
;; ensure that julia-mode.el is on your path before loading this file.
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;;; Code:
|
||||
|
||||
(require 'compile)
|
||||
(require 'ess-utils)
|
||||
(require 'ess-r-mode)
|
||||
|
||||
(defvar ac-prefix)
|
||||
(declare-function company-in-string-or-comment "company")
|
||||
(declare-function company-doc-buffer "company")
|
||||
|
||||
;;;--- ALL the following only if julia-mode is found and loaded correctly : ----------
|
||||
(condition-case nil
|
||||
(progn
|
||||
(require 'julia-mode)
|
||||
(when (featurep 'julia-mode)
|
||||
|
||||
(eval-when-compile
|
||||
(require 'cl-lib))
|
||||
|
||||
(defun ess-julia-send-string-function (process string visibly)
|
||||
"Send the Julia STRING to the PROCESS.
|
||||
VISIBLY is not currently used."
|
||||
(let ((file (concat temporary-file-directory "julia_eval_region.jl")))
|
||||
(with-temp-file file
|
||||
(insert string))
|
||||
(process-send-string process (format ess-load-command file))))
|
||||
|
||||
|
||||
;;; HELP
|
||||
(defun ess-julia-get-help-topics (&optional proc)
|
||||
(append (with-current-buffer (ess-command "ESS.all_help_topics()\n")
|
||||
(split-string (buffer-string) "\n"))
|
||||
(ess-julia--get-objects proc)))
|
||||
|
||||
(defun ess-julia--retrive-topics (url)
|
||||
(with-current-buffer (url-retrieve-synchronously url)
|
||||
(require 'url)
|
||||
(goto-char (point-min))
|
||||
(let (out)
|
||||
(while (re-search-forward "toctree.*href=\"\\(.+\\)\">\\(.+\\)</a" nil t)
|
||||
(push (propertize (match-string 2)
|
||||
:manual (concat url (match-string 1)))
|
||||
out))
|
||||
(kill-buffer)
|
||||
(nreverse out))))
|
||||
|
||||
(defvar ess-julia--manual-topics nil)
|
||||
(defun ess-julia-manual-lookup-function (&rest args) ; args are not used
|
||||
(interactive)
|
||||
"Look up topics at http://docs.julialang.org/en/latest/manual/"
|
||||
;; <li class="toctree-l1"><a class="reference internal" href="introduction/">Introduction</a></li>
|
||||
(let* ((pages (or ess-julia--manual-topics
|
||||
(setq ess-julia--manual-topics
|
||||
(ess-julia--retrive-topics "http://docs.julialang.org/en/latest/manual/"))))
|
||||
(page (ess-completing-read "Lookup:" pages nil t)))
|
||||
(browse-url (get-text-property 1 :manual page))))
|
||||
|
||||
(defun ess-julia-input-sender (proc string)
|
||||
(save-current-buffer
|
||||
(let* ((help-?-regexp "^ *\\(?:\\(?1: *?\\? *\\)\\(?2:.+\\)\\)")
|
||||
(help-?-match (string-match help-?-regexp string)))
|
||||
(cond (help-?-match
|
||||
(ess-display-help-on-object (match-string 2 string))
|
||||
(process-send-string proc "\n"))
|
||||
(t ;; normal command
|
||||
(inferior-ess-input-sender proc string))))))
|
||||
|
||||
;; julia 0.3.0 doesn't provide categories. Thus we don't support this anymore.
|
||||
;; (defun ess-julia-reference-lookup-function (&rest args) ; args are not used
|
||||
;; (interactive)
|
||||
;; "Look up reference topics"
|
||||
;; ;; <li class="toctree-l1"><a class="reference internal" href="introduction/">Introduction</a></li>
|
||||
;; (let* ((pages (ess-get-words-from-vector "ESS.help_categories()\n")))
|
||||
;; (ess-display-help-on-object
|
||||
;; (ess-completing-read "Category" pages nil t))))
|
||||
|
||||
|
||||
|
||||
;;; COMPLETION
|
||||
(defun ess-julia-latexsub-completion ()
|
||||
"Complete latex input, and returns in a format required by `completion-at-point-functions'."
|
||||
(if (julia-latexsub) ; julia-latexsub returns nil if it performed a completion, the point otherwise
|
||||
nil
|
||||
(lambda () t) ;; bypass other completion methods
|
||||
))
|
||||
|
||||
(defun ess-julia-object-completion ()
|
||||
"Return completions at point in a format required by `completion-at-point-functions'. "
|
||||
(let ((proc (ess-get-next-available-process ess-dialect t))
|
||||
(beg (ess-symbol-start)))
|
||||
(if proc
|
||||
(when beg
|
||||
(let* ((prefix (buffer-substring-no-properties beg (point)))
|
||||
(obj (and (string-match "\\(.*\\)\\..*$" prefix)
|
||||
(match-string 1 prefix)))
|
||||
(beg (if obj
|
||||
(+ beg 1 (length obj))
|
||||
beg)))
|
||||
(list beg (point)
|
||||
(nreverse (mapcar 'car (ess-julia--get-objects proc obj)))
|
||||
:exclusive 'no)))
|
||||
(when (string-match "complet" (symbol-name last-command))
|
||||
(message "No ESS process of dialect %s started" ess-dialect)
|
||||
nil))))
|
||||
|
||||
(defun ess-julia-objects (prefix &optional proc)
|
||||
"Given PREFIX get all cached objects from PROC."
|
||||
(when prefix
|
||||
(let ((proc (or proc (ess-get-next-available-process nil t))))
|
||||
(if (string-match "\\(.*\\)\\..*$" prefix)
|
||||
(let ((module (match-string 1 prefix)))
|
||||
(mapcar (lambda (el) (concat module "." (car el)))
|
||||
(ess-julia--get-objects proc module)))
|
||||
(ess-julia--get-objects proc)))))
|
||||
|
||||
(defun ess-julia--get-objects (&optional proc obj)
|
||||
"Return all available objects.
|
||||
Local caching might be used. If MODULE is givven, return only
|
||||
objects from that MODULE."
|
||||
(setq proc (or proc (ess-get-process)))
|
||||
(when (stringp proc)
|
||||
(setq proc (get-process proc)))
|
||||
(when (process-live-p proc)
|
||||
(let ((objects (process-get proc 'objects)))
|
||||
(if (process-get proc 'busy)
|
||||
(if obj
|
||||
(assoc obj objects)
|
||||
(process-get proc 'objects))
|
||||
(if obj
|
||||
(or (cdr (assoc obj objects))
|
||||
;; don't cache composite objects and datatypes
|
||||
(ess-julia--get-components proc obj))
|
||||
;; this segment is entered when user completon at top level is
|
||||
;; requested, either Tab or AC. Hence Main is always updated.
|
||||
(let ((modules (ess-get-words-from-vector
|
||||
"ESS.main_modules()\n" nil nil proc))
|
||||
(loc (process-get proc 'last-objects-cache))
|
||||
(lev (process-get proc 'last-eval)))
|
||||
(prog1
|
||||
(apply #'nconc
|
||||
(mapcar
|
||||
(lambda (mod)
|
||||
;; we are caching all modules, and reinit Main every
|
||||
;; time user enters commands
|
||||
(copy-sequence
|
||||
(or (and (or (not (equal mod "Main"))
|
||||
(ignore-errors (time-less-p lev loc)))
|
||||
(cdr (assoc mod objects)))
|
||||
(ess-julia--get-components proc mod t))))
|
||||
modules))
|
||||
(process-put proc 'last-objects-cache (current-time)))))))))
|
||||
|
||||
(defun ess-julia--get-components (proc obj &optional cache?)
|
||||
(with-current-buffer (ess-command (format "ESS.components(%s)\n" obj)
|
||||
nil nil nil nil proc)
|
||||
(goto-char (point-min))
|
||||
(let (list)
|
||||
(while (re-search-forward
|
||||
"^\\([^ \t\n]+\\) +\\([^ \t\n]+\\)$" nil t)
|
||||
(push (cons (match-string 1) (match-string 2)) list))
|
||||
(when cache?
|
||||
(let ((objects (process-get proc 'objects)))
|
||||
(push (cons obj list) objects)
|
||||
(process-put proc 'objects objects)))
|
||||
list)))
|
||||
|
||||
(defun ess-julia-get-object-help-string (sym)
|
||||
"Help string for ac."
|
||||
(let ((proc (ess-get-next-available-process nil t)))
|
||||
(if (null proc)
|
||||
"No free ESS process found"
|
||||
(let ((buf (get-buffer-create " *ess-command-output*")))
|
||||
(with-current-buffer (process-buffer proc)
|
||||
(ess-with-current-buffer buf
|
||||
(ess--flush-help-into-current-buffer sym nil t)))
|
||||
(with-current-buffer buf
|
||||
(ess-help-underline)
|
||||
(goto-char (point-min))
|
||||
(buffer-string))))))
|
||||
|
||||
(defvar ac-source-ess-julia-objects
|
||||
'((prefix . ess-symbol-start)
|
||||
(requires . 2)
|
||||
(candidates . ess-ac-julia-objects)
|
||||
(document . ess-julia-get-object-help-string))
|
||||
"Auto-completion source for julia objects")
|
||||
|
||||
(defun ess-ac-julia-objects ()
|
||||
(require 'auto-complete)
|
||||
(ess-julia-objects ac-prefix))
|
||||
|
||||
(declare-function company-begin-backend "company.el")
|
||||
|
||||
(defun company-ess-julia-objects (command &optional arg &rest ignored)
|
||||
(interactive (list 'interactive))
|
||||
(cl-case command
|
||||
(interactive (company-begin-backend 'company-ess-julia-objects))
|
||||
(prefix (unless (company-in-string-or-comment)
|
||||
(let ((start (ess-symbol-start)))
|
||||
(when start (buffer-substring-no-properties start (point))))))
|
||||
(candidates (let ((proc (ess-get-next-available-process)))
|
||||
(when proc
|
||||
(all-completions arg (mapcar (lambda (x) (or (car-safe x) x))
|
||||
(ess-julia-objects arg proc))))))
|
||||
(doc-buffer (company-doc-buffer (ess-julia-get-object-help-string arg)))))
|
||||
|
||||
|
||||
;;; ERRORS
|
||||
(defvar ess-julia-error-regexp-alist '(ess-julia-in ess-julia-at ess-julia-while-load)
|
||||
"List of symbols which are looked up in `compilation-error-regexp-alist-alist'.")
|
||||
|
||||
(add-to-list 'compilation-error-regexp-alist-alist
|
||||
'(ess-julia-in "^\\s-*in [^ \t\n]* \\(at \\(.*\\):\\([0-9]+\\)\\)" 2 3 nil 2 1))
|
||||
(add-to-list 'compilation-error-regexp-alist-alist
|
||||
'(ess-julia-at "^\\S-+\\s-+\\(at \\(.*\\):\\([0-9]+\\)\\)" 2 3 nil 2 1))
|
||||
(add-to-list 'compilation-error-regexp-alist-alist
|
||||
'(ess-julia-while-load "^\\s-*\\(while loading\\s-\\(.*\\), in .* on line +\\([0-9]+\\)\\)" 2 3 nil 2 1))
|
||||
|
||||
|
||||
;;; ELDOC
|
||||
(defun ess-julia-eldoc-function ()
|
||||
"Return the doc string, or nil.
|
||||
If an ESS process is not associated with the buffer, do not try
|
||||
to look up any doc strings."
|
||||
(interactive)
|
||||
(when (and ess-can-eval-in-background
|
||||
(ess-process-live-p)
|
||||
(not (ess-process-get 'busy)))
|
||||
(let ((funname (or (and ess-eldoc-show-on-symbol ;; aggressive completion
|
||||
(symbol-name (ess-symbol-at-point)))
|
||||
(car (ess--fn-name-start)))))
|
||||
(when funname
|
||||
(let* ((args (copy-sequence (nth 2 (ess-function-arguments funname))))
|
||||
(W (- (window-width (minibuffer-window)) (+ 4 (length funname))))
|
||||
(doc (concat (propertize funname 'face font-lock-function-name-face) ": ")))
|
||||
(when args
|
||||
(setq args (sort args (lambda (s1 s2)
|
||||
(< (length s1) (length s2)))))
|
||||
(setq doc (concat doc (pop args)))
|
||||
(while (and args (< (+ (length doc) (length (car args))) W))
|
||||
(setq doc (concat doc " "
|
||||
(pop args))))
|
||||
(when (and args (< (length doc) W))
|
||||
(setq doc (concat doc " {--}")))
|
||||
doc))))))
|
||||
|
||||
|
||||
;;; IMENU
|
||||
(defvar ess-julia-imenu-generic-expression
|
||||
;; don't use syntax classes, screws egrep
|
||||
'(("Function (_)" "[ \t]*function[ \t]+\\(_[^ \t\n]*\\)" 1)
|
||||
("Function" "^[ \t]*function[ \t]+\\([^_][^\t\n]*\\)" 1)
|
||||
("Const" "[ \t]*const \\([^ \t\n]*\\)" 1)
|
||||
("Type" "^[ \t]*[a-zA-Z0-9_]*type[a-zA-Z0-9_]* \\([^ \t\n]*\\)" 1)
|
||||
("Require" " *\\(\\brequire\\)(\\([^ \t\n)]*\\)" 2)
|
||||
("Include" " *\\(\\binclude\\)(\\([^ \t\n)]*\\)" 2)
|
||||
))
|
||||
|
||||
|
||||
;;; CORE
|
||||
(defvar ess-julia-customize-alist
|
||||
'((comint-use-prompt-regexp . t)
|
||||
(ess-eldoc-function . 'ess-julia-eldoc-function)
|
||||
(inferior-ess-primary-prompt . "a> ") ;; from julia>
|
||||
(inferior-ess-secondary-prompt . nil)
|
||||
(inferior-ess-prompt . "\\w*> ")
|
||||
(ess-local-customize-alist . 'ess-julia-customize-alist)
|
||||
(inferior-ess-program . inferior-julia-program)
|
||||
(ess-get-help-topics-function . 'ess-julia-get-help-topics)
|
||||
(ess-help-web-search-command . "http://docs.julialang.org/en/latest/search/?q=%s")
|
||||
(ess-manual-lookup-command . 'ess-julia-manual-lookup-function)
|
||||
;; (ess-reference-lookup-command . 'ess-julia-reference-lookup-function)
|
||||
(ess-load-command . "include(\"%s\")\n")
|
||||
(ess-funargs-command . "ESS.fun_args(\"%s\")\n")
|
||||
(ess-dump-error-re . "in \\w* at \\(.*\\):[0-9]+")
|
||||
(ess-error-regexp . "\\(^\\s-*at\\s-*\\(?3:.*\\):\\(?2:[0-9]+\\)\\)")
|
||||
(ess-error-regexp-alist . ess-julia-error-regexp-alist)
|
||||
(ess-imenu-generic-expression . ess-julia-imenu-generic-expression)
|
||||
(ess-mode-syntax-table . julia-mode-syntax-table)
|
||||
(ess-mode-completion-syntax-table . ess-julia-completion-syntax-table)
|
||||
;; (inferior-ess-objects-command . inferior-ess-r-objects-command)
|
||||
;; (inferior-ess-search-list-command . "search()\n")
|
||||
(inferior-ess-help-command . "ESS.help(\"%s\")\n")
|
||||
;; (inferior-ess-help-command . "help(\"%s\")\n")
|
||||
(ess-language . "julia")
|
||||
(ess-dialect . "julia")
|
||||
(ess-suffix . "jl")
|
||||
(ess-ac-sources . '(ac-source-ess-julia-objects))
|
||||
(ess-company-backends . '(company-ess-julia-objects))
|
||||
(ess-dump-filename-template . (replace-regexp-in-string
|
||||
"S$" ess-suffix ; in the one from custom:
|
||||
ess-dump-filename-template-proto))
|
||||
(ess-mode-editing-alist . nil)
|
||||
(ess-change-sp-regexp . nil );ess-r-change-sp-regexp)
|
||||
(ess-help-sec-regex . ess-help-r-sec-regex)
|
||||
(ess-help-sec-keys-alist . ess-help-r-sec-keys-alist)
|
||||
(ess-loop-timeout . ess-S-loop-timeout);fixme: dialect spec.
|
||||
(ess-function-pattern . ess-r-function-pattern)
|
||||
(ess-object-name-db-file . "ess-jl-namedb.el" )
|
||||
(ess-smart-operators . ess-r-smart-operators)
|
||||
(inferior-ess-help-filetype . nil)
|
||||
(inferior-ess-exit-command . "exit()\n")
|
||||
;;harmful for shell-mode's C-a: -- but "necessary" for ESS-help?
|
||||
(inferior-ess-start-file . nil) ;; "~/.ess-R"
|
||||
(inferior-ess-start-args . "")
|
||||
(inferior-ess-language-start . nil)
|
||||
(ess-STERM . "iESS")
|
||||
(ess-editor . ess-r-editor)
|
||||
(ess-pager . ess-r-pager)
|
||||
(ess-getwd-command . "pwd()\n")
|
||||
(ess-setwd-command . "cd(expanduser(\"%s\"))\n")
|
||||
)
|
||||
"Variables to customize for Julia -- set up later than emacs initialization.")
|
||||
|
||||
(defcustom inferior-julia-args ""
|
||||
"String of arguments (see 'julia --help') used when starting julia."
|
||||
:group 'ess-julia
|
||||
:type 'string)
|
||||
|
||||
(defvar ess-julia-completion-syntax-table
|
||||
(let ((table (make-syntax-table ess-r-syntax-table)))
|
||||
(modify-syntax-entry ?. "_" table)
|
||||
;; (modify-syntax-entry ?: "_" table)
|
||||
;; (modify-syntax-entry ?$ "_" table)
|
||||
(modify-syntax-entry ?@ "_" table)
|
||||
table)
|
||||
"Syntax table used for completion and help symbol lookup.
|
||||
It makes underscores and dots word constituent chars.")
|
||||
|
||||
(defvar ess-julia-basic-offset 4)
|
||||
|
||||
;;;###autoload
|
||||
(define-derived-mode ess-julia-mode julia-mode "ESS[julia]"
|
||||
"Major mode for editing julia source. See `ess-mode' for more help."
|
||||
(ess-mode ess-julia-customize-alist nil t)
|
||||
;; for emacs >= 24
|
||||
(remove-hook 'completion-at-point-functions 'ess-filename-completion 'local) ;; should be first
|
||||
(add-hook 'completion-at-point-functions 'ess-julia-object-completion nil 'local)
|
||||
(add-hook 'completion-at-point-functions 'ess-filename-completion nil 'local)
|
||||
(if (fboundp 'ess-add-toolbar) (ess-add-toolbar))
|
||||
(set (make-local-variable 'end-of-defun-function) 'ess-end-of-function)
|
||||
(setq imenu-generic-expression ess-julia-imenu-generic-expression)
|
||||
(imenu-add-to-menubar "Imenu-jl")
|
||||
(run-mode-hooks 'ess-julia-mode-hook))
|
||||
|
||||
(defvar ess-julia-mode-hook nil)
|
||||
(defvar ess-julia-post-run-hook nil
|
||||
"Functions run in process buffer after starting julia process.")
|
||||
|
||||
;;;###autoload
|
||||
(defun julia (&optional start-args)
|
||||
"Call 'julia'.
|
||||
Optional prefix (C-u) 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'."
|
||||
(interactive "P")
|
||||
;; get settings, notably inferior-julia-program :
|
||||
(if (null inferior-julia-program)
|
||||
(error "'inferior-julia-program' does not point to 'julia' or 'julia-basic' executable")
|
||||
(setq ess-customize-alist ess-julia-customize-alist)
|
||||
(ess-write-to-dribble-buffer ;; for debugging only
|
||||
(format
|
||||
"\n(julia): ess-dialect=%s, buf=%s, start-arg=%s\n current-prefix-arg=%s\n"
|
||||
ess-dialect (current-buffer) start-args current-prefix-arg))
|
||||
(let* ((jl-start-args
|
||||
(concat inferior-julia-args " " ; add space just in case
|
||||
(if start-args
|
||||
(read-string
|
||||
(concat "Starting Args"
|
||||
(if inferior-julia-args
|
||||
(concat " [other than '" inferior-julia-args "']"))
|
||||
" ? "))
|
||||
nil))))
|
||||
(inferior-ess jl-start-args)
|
||||
|
||||
(remove-hook 'completion-at-point-functions 'ess-filename-completion 'local) ;; should be first
|
||||
(add-hook 'completion-at-point-functions 'ess-julia-object-completion nil 'local)
|
||||
(add-hook 'completion-at-point-functions 'ess-filename-completion nil 'local)
|
||||
(add-hook 'completion-at-point-functions 'ess-julia-latexsub-completion nil 'local)
|
||||
(setq comint-input-sender 'ess-julia-input-sender)
|
||||
|
||||
(ess--tb-start)
|
||||
;; remove ` from julia's logo
|
||||
(goto-char (point-min))
|
||||
(while (re-search-forward "`" nil t)
|
||||
(replace-match "'"))
|
||||
;; remove an offending unmatched parenthesis
|
||||
(goto-char (point-min))
|
||||
(forward-line 4)
|
||||
(when (re-search-forward "(" nil t)
|
||||
(replace-match "|"))
|
||||
(goto-char (point-max))
|
||||
;; --> julia helpers from ../etc/ess-julia.jl :
|
||||
(ess--inject-code-from-file (format "%sess-julia.jl" ess-etc-directory))
|
||||
(with-ess-process-buffer nil
|
||||
(run-mode-hooks 'ess-julia-post-run-hook))
|
||||
)))
|
||||
|
||||
(add-to-list 'auto-mode-alist '("\\.jl\\'" . ess-julia-mode))
|
||||
|
||||
)) (error nil))
|
||||
(provide 'ess-julia)
|
||||
;;; ess-julia.el ends here
|
||||
65
elpa/ess-20180701.100/ess-lsp-l.el
Normal file
65
elpa/ess-20180701.100/ess-lsp-l.el
Normal file
@@ -0,0 +1,65 @@
|
||||
;;; ess-lsp-l.el --- Support for editing Lisp source code
|
||||
|
||||
;; Copyright (C) 1997 A.J. Rossini.
|
||||
;; Copyright (C) 1998--2004 A.J. Rossini, Richard M. Heiberger, Martin
|
||||
;; Maechler, Kurt Hornik, Rodney Sparapani, and Stephen Eglen.
|
||||
|
||||
;; Author: A.J. Rossini <rossini@stat.sc.edu>
|
||||
;; Created: 1 Sept 1997
|
||||
;; Maintainer: ESS-core <ESS-core@r-project.org>
|
||||
|
||||
;; 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/
|
||||
|
||||
;;; Commentary:
|
||||
|
||||
;; Configurations for editing XLispStat source code. Contains any underlying
|
||||
;; changes that need to be made.
|
||||
|
||||
;;; Code:
|
||||
|
||||
; Requires and autoloads
|
||||
|
||||
;; Contents "translated" from lisp-mode.el
|
||||
(require 'lisp-mode)
|
||||
|
||||
; Configuration variables
|
||||
|
||||
|
||||
|
||||
(defvar Lisp-editing-alist
|
||||
'((paragraph-start . (concat "^$\\|" page-delimiter))
|
||||
(paragraph-separate . (concat "^$\\|" page-delimiter))
|
||||
(paragraph-ignore-fill-prefix . t)
|
||||
(fill-paragraph-function . 'lisp-fill-paragraph)
|
||||
(adaptive-fill-mode . nil)
|
||||
(indent-line-function . 'lisp-indent-line)
|
||||
(indent-region-function . 'lisp-indent-region)
|
||||
(require-final-newline . mode-require-final-newline)
|
||||
(comment-start . ";")
|
||||
(comment-start-skip . "\\(\\(^\\|[^\\\\\n]\\)\\(\\\\\\\\\\)*\\);+ *")
|
||||
(comment-column . 40)
|
||||
(comment-indent-function . 'lisp-comment-indent)
|
||||
(parse-sexp-ignore-comments . t)
|
||||
(ess-style . ess-default-style)
|
||||
(ess-local-process-name . nil)
|
||||
;;(ess-keep-dump-files . 'ask)
|
||||
(ess-mode-syntax-table . lisp-mode-syntax-table)
|
||||
(font-lock-defaults . '(lisp-font-lock-keywords)))
|
||||
"General options for editing LispStat, XLispStat, and ViSta source files.")
|
||||
|
||||
(provide 'ess-lsp-l)
|
||||
|
||||
;;; ess-lsp-l.el ends here
|
||||
1014
elpa/ess-20180701.100/ess-mode.el
Normal file
1014
elpa/ess-20180701.100/ess-mode.el
Normal file
File diff suppressed because it is too large
Load Diff
234
elpa/ess-20180701.100/ess-mouse.el
Normal file
234
elpa/ess-20180701.100/ess-mouse.el
Normal file
@@ -0,0 +1,234 @@
|
||||
;;; ess-mouse.el --- Support for mouse- or cursor-sensitive actions
|
||||
|
||||
;; Copyright (C) 2001 Richard M. Heiberger <rmh@temple.edu>
|
||||
;; Copyright (C) 2002--2004 A.J. Rossini, Richard M. Heiberger, Martin
|
||||
;; Maechler, Kurt Hornik, Rodney Sparapani, and Stephen Eglen.
|
||||
|
||||
;; Author: Richard M. Heiberger <rmh@temple.edu>
|
||||
;; Created: 25 Mar 2001
|
||||
;; Maintainer: ESS-core <ESS-core@r-project.org>
|
||||
|
||||
;; 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/
|
||||
|
||||
;;; Commentary:
|
||||
|
||||
;; Support for mouse- or cursor-sensitive actions. This is based on
|
||||
;; and uses mouseme.el. mouseme.el only does mouse sensititivity.
|
||||
;; The new functions ess-mouse-me and ess-mouse-me-helper do similar
|
||||
;; things based on the cursor, not the mouse, and can be bound to a
|
||||
;; keystroke.
|
||||
|
||||
;;; Code:
|
||||
|
||||
; Requires and autoloads
|
||||
|
||||
;;*;; Requires
|
||||
(require 'mouseme)
|
||||
(require 'ess-dde)
|
||||
(require 'ess-trns)
|
||||
;;(if (or (equal window-system 'w32)
|
||||
;; (equal window-system 'win32)
|
||||
;; (equal window-system 'mswindows))
|
||||
;; (require 'essiw32b))
|
||||
|
||||
(defun ess-mouse-me ()
|
||||
"Popup a menu of functions to run on selected string or region."
|
||||
(interactive)
|
||||
(ess-mouse-me-helper
|
||||
(lambda (name)
|
||||
(or (x-popup-menu (list '(0 0)
|
||||
(get-buffer-window (get-buffer (buffer-name))))
|
||||
(funcall mouse-me-build-menu-function name))
|
||||
(error "No command to run")))))
|
||||
|
||||
|
||||
|
||||
(defun ess-mouse-me-helper (func)
|
||||
"Determine the string to use to process EVENT and call FUNC to get cmd."
|
||||
(let (name sp sm mouse beg end cmd mmtype)
|
||||
;; temporarily goto where the event occurred, get the name clicked
|
||||
;; on and enough info to figure out what to do with it
|
||||
(save-match-data
|
||||
(save-excursion
|
||||
(setq sp (point)) ; saved point
|
||||
(setq sm (mark t)) ; saved mark
|
||||
;;; (set-buffer (window-buffer (posn-window (event-start event))))
|
||||
;;; (setq mouse (goto-char (posn-point (event-start event))))
|
||||
(setq mouse (point)) ;; ess-mouse-me-helper
|
||||
;; if there is a region and point is inside it
|
||||
;; check for sm first incase (null (mark t))
|
||||
;; set name to either the thing they clicked on or region
|
||||
(if (and sm
|
||||
(or (and transient-mark-mode mark-active)
|
||||
(eq last-command 'mouse-drag-region))
|
||||
(>= mouse (setq beg (min sp sm)))
|
||||
(<= mouse (setq end (max sp sm))))
|
||||
(setq name (buffer-substring beg end))
|
||||
(setq name (funcall mouse-me-get-string-function))
|
||||
(if (listp name)
|
||||
(setq beg (nth 1 name)
|
||||
end (nth 2 name)
|
||||
name (car name))
|
||||
(goto-char mouse)
|
||||
(while (not (looking-at (regexp-quote name)))
|
||||
(backward-char 1))
|
||||
(setq beg (point))
|
||||
(setq end (search-forward name))))))
|
||||
;; check if name is null, meaning they clicked on no word
|
||||
(if (or (null name)
|
||||
(and (stringp name) (string= name "" )))
|
||||
(error "No string to pass to function"))
|
||||
;; popup a menu to get a command to run
|
||||
(setq cmd (funcall func name))
|
||||
;; run the command, eval'ing if it was a list
|
||||
(if (listp cmd)
|
||||
(setq cmd (eval cmd)))
|
||||
(setq mmtype (get cmd 'mouse-me-type))
|
||||
(cond ((eq mmtype 'region)
|
||||
(funcall cmd beg end))
|
||||
((eq mmtype 'string)
|
||||
(funcall cmd name))
|
||||
(t
|
||||
(funcall cmd name)))))
|
||||
|
||||
(defcustom ess-S-mouse-me-menu-commands-alist
|
||||
'("S-Plus 4 and 6 GUI under Windows"
|
||||
("Edit.data" . ess-mouse-me-Edit.data)
|
||||
"----"
|
||||
("print" . ess-mouse-me-print)
|
||||
("summary" . ess-mouse-me-summary)
|
||||
("plot" . ess-mouse-me-plot)
|
||||
("show" . ess-mouse-me-show)
|
||||
("help" . ess-display-help-on-object)
|
||||
("args" . ess-mouse-me-args)
|
||||
"----"
|
||||
("Browser on" . ess-mouse-me-browser-on)
|
||||
("Browser off" . ess-mouse-me-browser-off))
|
||||
"*Command menu used by `mouse-me-build-menu'.
|
||||
A alist of elements where each element is either a cons cell or a string.
|
||||
If a cons cell the car is a string to be displayed in the menu and the
|
||||
cdr is either a function to call passing a string to, or a list which evals
|
||||
to a function to call passing a string to. If the element is a string
|
||||
it makes a non-selectable element in the menu. To make a separator line
|
||||
use a string consisting solely of hyphens.
|
||||
|
||||
The function returned from this menu will be called with one string
|
||||
argument. Or if the function has the symbol property `mouse-me-type'
|
||||
and if its value is the symbol `region' it will be called with the
|
||||
beginning and ending points of the selected string. If the value is
|
||||
the symbol `string' it will be called with one string argument."
|
||||
:type '(repeat sexp)
|
||||
:group 'mouseme)
|
||||
|
||||
|
||||
(defun ess-mouse-me-Edit.data (string)
|
||||
(ess-mouse-me-eval-expanded string "Edit.data(" ")" nil nil nil))
|
||||
|
||||
(defun ess-mouse-me-print (string)
|
||||
(ess-mouse-me-eval-expanded string "" "" nil (ess-ddeclient-p) t))
|
||||
(defun ess-mouse-me-summary (string)
|
||||
(ess-mouse-me-eval-expanded string "summary(" ")" nil (ess-ddeclient-p) t))
|
||||
(defun ess-mouse-me-plot (string)
|
||||
(ess-mouse-me-eval-expanded string "plot(" ")") nil nil nil)
|
||||
(defun ess-mouse-me-show (string)
|
||||
(ess-mouse-me-eval-expanded string "show(" ")") nil nil nil)
|
||||
(defun ess-mouse-me-args (string)
|
||||
(ess-mouse-me-eval-expanded string "args(" ")" nil (ess-ddeclient-p) t))
|
||||
|
||||
(defun ess-mouse-me-browser-on (string)
|
||||
(if (equal (substring ess-dialect 0 1) "R")
|
||||
(ess-eval-linewise (concat "debug(" string ")"))
|
||||
(ess-mouse-me-eval-expanded string "trace(" ", exit=browser)") nil nil nil))
|
||||
|
||||
(defun ess-mouse-me-browser-off (string)
|
||||
(if (equal (substring ess-dialect 0 1) "R")
|
||||
(ess-eval-linewise (concat "undebug(" string ")"))
|
||||
(ess-mouse-me-eval-expanded string "untrace(" ")") nil nil nil))
|
||||
|
||||
|
||||
|
||||
(defun ess-mouse-me-eval-expanded (string &optional head tail commands-buffer
|
||||
page value-returned)
|
||||
"Send the expanded STRING to the inferior-ess process using `ess-command'
|
||||
after first concating the HEAD and TAIL. Put answer in COMMANDS-BUFFER if
|
||||
specified and not using ddeclient, otherwise in \"tmp-buffer\". In either
|
||||
case the buffer containing the answer is renamed to the value of the
|
||||
constructed command. If PAGE is non-nil and using ddeclient, expand
|
||||
the string one more time by embedding it in a \"page()\" command."
|
||||
(interactive)
|
||||
(let* (scommand
|
||||
page-scommand
|
||||
(lproc-name ess-local-process-name)
|
||||
(ess-mouse-customize-alist ess-local-customize-alist))
|
||||
(if (not head) (setq head "summary("))
|
||||
(if (not tail) (setq tail ")"))
|
||||
(if (not commands-buffer) (setq commands-buffer
|
||||
(get-buffer-create "tmp-buffer")))
|
||||
(setq scommand (concat head string tail))
|
||||
|
||||
(if (ess-ddeclient-p)
|
||||
(progn
|
||||
(setq page-scommand (if page
|
||||
(concat "page(" scommand ")")
|
||||
scommand))
|
||||
(set-buffer-file-coding-system 'undecided-dos)
|
||||
(ess-command page-scommand commands-buffer)
|
||||
(if (not value-returned)
|
||||
nil
|
||||
(sleep-for 2)
|
||||
(switch-to-buffer (car (buffer-list)))))
|
||||
(ess-make-buffer-current)
|
||||
(switch-to-buffer commands-buffer)
|
||||
(ess-setq-vars-local (eval ess-mouse-customize-alist) (current-buffer))
|
||||
(setq ess-local-process-name lproc-name)
|
||||
(ess-command (concat scommand "\n") commands-buffer)
|
||||
(if (not value-returned) (switch-to-buffer (nth 1 (buffer-list)))))
|
||||
(if (not value-returned)
|
||||
nil
|
||||
(if ess-microsoft-p ;; there ought to be a filter
|
||||
(while (search-forward "\r" nil t) ;; function to keep the ^M
|
||||
(replace-match "" nil t))) ;; from showing up at all
|
||||
(ess-transcript-mode (eval ess-mouse-customize-alist))
|
||||
(setq ess-local-process-name lproc-name)
|
||||
(rename-buffer scommand))))
|
||||
|
||||
|
||||
; Provide package
|
||||
|
||||
(provide 'ess-mouse)
|
||||
|
||||
|
||||
|
||||
;;;;;;;; STARTUP STUFF ;;;;;;;;;;;;
|
||||
|
||||
(make-variable-buffer-local 'mouse-me-menu-commands)
|
||||
|
||||
(defun ess-S-mouse-me-menu-commands ()
|
||||
(if (equal ess-language "S")
|
||||
(setq mouse-me-menu-commands ess-S-mouse-me-menu-commands-alist)))
|
||||
|
||||
;; (define-key ess-mode-map [S-mouse-3] 'ess-mouse-me)
|
||||
;; (define-key inferior-ess-mode-map [S-mouse-3] 'ess-mouse-me)
|
||||
;; (defun ess-S-mouse-me-ess-transcript-mode ()
|
||||
;; (define-key ess-transcript-mode-map [S-mouse-3] 'ess-mouse-me))
|
||||
;;
|
||||
(add-hook 'ess-mode-hook 'ess-S-mouse-me-menu-commands)
|
||||
(add-hook 'inferior-ess-mode-hook 'ess-S-mouse-me-menu-commands)
|
||||
(add-hook 'ess-transcript-mode-hook 'ess-S-mouse-me-menu-commands)
|
||||
;; (add-hook 'ess-transcript-mode-hook 'ess-S-mouse-me-ess-transcript-mode)
|
||||
|
||||
|
||||
;;; ess-mouse.el ends here
|
||||
393
elpa/ess-20180701.100/ess-noweb-font-lock-mode.el
Normal file
393
elpa/ess-20180701.100/ess-noweb-font-lock-mode.el
Normal file
@@ -0,0 +1,393 @@
|
||||
;;; ess-noweb-font-lock-mode.el --- edit noweb files with GNU Emacs
|
||||
|
||||
;; Copyright (C) 1999 by Adnan Yaqub (AYaqub@orga.com)
|
||||
;; and Mark Lunt (mark.lunt@mrc-bsu.cam.ac.uk
|
||||
;; Copyright (C) 2002 by A.J. Rossini <rossini@u.washington.edu>
|
||||
;; Copyright (C) 2003--2004 A.J. Rossini, Richard M. Heiberger, Martin
|
||||
;; Maechler, Kurt Hornik, Rodney Sparapani, and Stephen Eglen.
|
||||
|
||||
;; Maintainer: ESS-core <ESS-core@r-project.org>
|
||||
|
||||
;; 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 2, 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.
|
||||
;;
|
||||
;; A copy of the GNU General Public License is available at
|
||||
;; http://www.r-project.org/Licenses/
|
||||
;;
|
||||
|
||||
;;; Commentary:
|
||||
|
||||
;; Code-dependent highlighting
|
||||
;; *****
|
||||
;;
|
||||
;; Adding highlighting to ess-noweb-mode.el
|
||||
;;
|
||||
;; Here is a description of how one can add highlighting via the
|
||||
;; font-lock package to noweb buffers. It uses the hooks provided by
|
||||
;; ess-noweb-mode.el. The solution provides the following features:
|
||||
;; 1) The documentation chunks are highlighted in the ess-noweb-doc-mode
|
||||
;; (e.g., LaTeX).
|
||||
;; 2) The code chunks without mode comments (-*- mode -*-) are
|
||||
;; highlighted in the ess-noweb-code-mode.
|
||||
;; 3) The code chunks with mode comments (-*- mode -*-) on the first
|
||||
;; line of the first chunk with this name are highlighted in the mode
|
||||
;; in the comment.
|
||||
;;
|
||||
;; For example, given the file:
|
||||
;;
|
||||
;; % -*- mode: Noweb; ess-noweb-code-mode: c-mode -*-
|
||||
;;
|
||||
;; \begin{itemize}
|
||||
;; \item a main routine written in C,
|
||||
;; \item a log configuration file parser written in YACC, and
|
||||
;; \item a lexical analyzer written in Lex.
|
||||
;; \end{itemize}
|
||||
;;
|
||||
;; <<warning c comment>>=
|
||||
;; /* DO NOT EDIT ME! */
|
||||
;; /* This file was automatically generated from %W% (%G%). */
|
||||
;; @
|
||||
;;
|
||||
;; <<warning nroff comment>>=
|
||||
;; .\" -*- nroff -*-
|
||||
;; .\" DO NOT EDIT ME!
|
||||
;; .\" This file was automatically generated from %W% (%G%).
|
||||
;; @
|
||||
;;
|
||||
;; The LaTeX list is highlighted in latex-mode (the default noweb doc
|
||||
;; mode), the chunk <<warning c comment>> is highlighted in c-mode (the
|
||||
;; default noweb code mode), and the chunk <<warning nroff comment>> is
|
||||
;; highlighted in nroff-mode due to the "-*- nroff -*-" comment.
|
||||
;;
|
||||
;; Chunks are highlighted each time point moves into them from a
|
||||
;; different mode. They are also fontified 'on the fly', but this is
|
||||
;; less reliable, since the syntax can depend on the context. It's as
|
||||
;; good as you would get outside ess-noweb-mode, though.
|
||||
;;
|
||||
;; To use it, you must add
|
||||
;; (require 'ess-noweb-font-lock-mode) to your .emacs file.
|
||||
;; Then, if you use either global-font-lock or turn-on-font-lock
|
||||
;; statements, any ess-noweb-mode buffers will be fontified
|
||||
;; appropriately. (We have to redefine turn-on-font-lock, but it
|
||||
;; saves breaking other packages (in particular ESS, which I use a
|
||||
;; lot), that assume that turn-on-font-lock is the way to turn on
|
||||
;; font locking.
|
||||
|
||||
;; Alternatively, you can turn ess-noweb-font-lock-mode on and off by
|
||||
;; using M-x ess-noweb-font-lock-mode. However, turning
|
||||
;; ess-noweb-font-lock-mode off when global-font-lock-mode is t makes it
|
||||
;; impossible to use font-locking in that buffer subsequently, other
|
||||
;; than by turning ess-noweb-font-lock-mode back on.
|
||||
|
||||
;; 2) The highlighting sometimes get confused, but this is no longer
|
||||
;; a noweb problem. Highlighting should work as well within a chunk
|
||||
;; as it does without ess-noweb-mode.
|
||||
;; There are some problems with, for example latex-mode: a `$' in a
|
||||
;; verbatim environment with throw the font-locking out.
|
||||
;; One slight blemish is that code-quotes are highlighted as comments
|
||||
;; as they are being entered. They are only highlighted correctly
|
||||
;; after `ess-noweb-font-lock-fontify-chunk' has been run, either as a
|
||||
;; command or through changing to a different chunk and back again
|
||||
;; (unless they lie on a single line, in which case they are
|
||||
;; fontified correctly once they are completed).
|
||||
|
||||
;;; Code:
|
||||
|
||||
(require 'ess-noweb-mode)
|
||||
(require 'font-lock)
|
||||
|
||||
(defvar ess-noweb-font-lock-mode nil
|
||||
"Buffer local variable, t iff this buffer is using `ess-noweb-font-lock-mode'.")
|
||||
|
||||
(defvar ess-noweb-use-font-lock-mode t
|
||||
"DO NOT CHANGE THIS VARIABLE
|
||||
If you use `nw-turn-on-font-lock' to turn on font-locking, then turn it
|
||||
off again, it would come back on again of its own accord when you
|
||||
changed major-mode. This variable is used internally to stop it.")
|
||||
|
||||
(defvar ess-noweb-font-lock-mode-hook nil
|
||||
"Hook that is run after entering ess-noweb-font-lock mode.")
|
||||
|
||||
(defvar ess-noweb-font-lock-max-initial-chunks 30
|
||||
"Maximum number of chunks to fontify initially.
|
||||
If nil, will fontify the entire buffer when
|
||||
ess-noweb-font-lock-initial-fontify-buffer is called" )
|
||||
|
||||
;; (defvar old-beginning-of-syntax nil
|
||||
;; "Stores the function used to find the beginning of syntax in the
|
||||
;; current major mode. ess-noweb-font-lock-mode needs a different one." )
|
||||
|
||||
(defvar ess-noweb-font-lock-doc-start-face font-lock-reference-face
|
||||
"Face to use to highlight the `@' at the start of each doc chunk")
|
||||
|
||||
(defvar ess-noweb-font-lock-brackets-face font-lock-reference-face
|
||||
"Face to use to highlight `<<', `>>' `[[' and `]]' ")
|
||||
|
||||
(defvar ess-noweb-font-lock-chunk-name-face font-lock-keyword-face
|
||||
"Face to use to highlight the between `<<' and `>>'")
|
||||
|
||||
(defvar ess-noweb-font-lock-code-quote-face font-lock-keyword-face
|
||||
"Face to use to highlight the between `[[' and `]]'")
|
||||
|
||||
;; Now we add [[ess-noweb-font-lock-mode]] to the list of existing minor
|
||||
;; modes. The string ``NWFL'' will be added to the mode-line: ugly, but
|
||||
;; brief.
|
||||
|
||||
(if (not (assq 'ess-noweb-font-lock-mode minor-mode-alist))
|
||||
(setq minor-mode-alist (append minor-mode-alist
|
||||
(list '(ess-noweb-font-lock-mode " NWFL")))))
|
||||
|
||||
;; An ugly kludge to get around problems with global-font-lock, which
|
||||
;; fontifies the entire buffer in the new major mode every time you
|
||||
;; change mode, which is time-consuming and makes a pigs trotters of
|
||||
;; it. Trying to stop it looks tricky, but using this function as your
|
||||
;; `font-lock-fontify-buffer' function stops it wasting your time
|
||||
|
||||
(defalias 'nwfl-donowt #'ignore)
|
||||
|
||||
;; The following function is just a wrapper for ess-noweb-font-lock-mode,
|
||||
;; enabling it to be called as ess-noweb-font-lock-minor-mode instead.
|
||||
|
||||
(define-obsolete-function-alias 'ess-noweb-font-lock-minor-mode
|
||||
#'ess-noweb-font-lock-mode "ESS-16.11")
|
||||
|
||||
;; Here we get to the meat of the problem
|
||||
;;;###autoload
|
||||
(defun ess-noweb-font-lock-mode ( &optional arg)
|
||||
;; FIXME: Don't define a new minor mode. Instead, arrange for normal
|
||||
;; font-lock to call our functions such as
|
||||
;; ess-noweb-font-lock-fontify-chunk-by-number.
|
||||
"Minor mode for syntax highlighting when using `ess-noweb-mode' to edit noweb files.
|
||||
Each chunk is fontified in accordance with its own mode."
|
||||
(interactive "P")
|
||||
(if (or ess-noweb-mode ess-noweb-font-lock-mode)
|
||||
(progn
|
||||
;; This bit is tricky: copied almost verbatim from bib-cite-mode.el
|
||||
;; It seems to ensure that the variable ess-noweb-font-lock-mode is made
|
||||
;; local to this buffer. It then sets ess-noweb-font-lock-mode to `t' if
|
||||
;; 1) It was called with a prefix argument greater than 0
|
||||
;; or 2) It was called with no argument, and ess-noweb-font-lock-mode is
|
||||
;; currently nil
|
||||
;; ess-noweb-font-lock-mode is nil if the prefix argument was <= 0 or there
|
||||
;; was no prefix argument and ess-noweb-font-lock-mode is currently `t'
|
||||
(set (make-local-variable 'ess-noweb-font-lock-mode)
|
||||
(if arg
|
||||
(> (prefix-numeric-value arg) 0)
|
||||
(not ess-noweb-font-lock-mode)))
|
||||
;; Now, if ess-noweb-font-lock-mode is true, we want to turn
|
||||
;; ess-noweb-font-lock-mode on
|
||||
(cond
|
||||
(ess-noweb-font-lock-mode ;Setup the minor-mode
|
||||
(when (and (boundp 'global-font-lock-mode) global-font-lock-mode)
|
||||
(mapc #'ess-noweb-make-variable-permanent-local
|
||||
'(font-lock-fontify-buffer-function
|
||||
font-lock-unfontify-buffer-function))
|
||||
(setq font-lock-fontify-buffer-function #'nwfl-donowt)
|
||||
(setq font-lock-unfontify-buffer-function #'nwfl-donowt))
|
||||
(mapc #'ess-noweb-make-variable-permanent-local
|
||||
'(ess-noweb-font-lock-mode
|
||||
font-lock-dont-widen
|
||||
;; font-lock-beginning-of-syntax-function
|
||||
syntax-begin-function
|
||||
ess-noweb-use-font-lock-mode
|
||||
after-change-functions))
|
||||
(setq ess-noweb-font-lock-mode t
|
||||
font-lock-dont-widen t)
|
||||
(add-hook 'after-change-functions
|
||||
#'font-lock-after-change-function nil t)
|
||||
;; FIXME: Why add ess-noweb-font-lock-mode-fn to our own hook,
|
||||
;; instead of just calling ess-noweb-font-lock-mode-fn directly?
|
||||
(add-hook 'ess-noweb-font-lock-mode-hook #'ess-noweb-font-lock-mode-fn)
|
||||
(add-hook 'ess-noweb-changed-chunk-hook
|
||||
#'ess-noweb-font-lock-fontify-this-chunk)
|
||||
(run-hooks 'ess-noweb-font-lock-mode-hook)
|
||||
(message "ess-noweb-font-lock mode: use `M-x ess-noweb-font-lock-describe-mode' for more info"))
|
||||
;; If we didn't do the above, then we want to turn ess-noweb-font-lock-mode
|
||||
;; off, no matter what (hence the condition `t')
|
||||
(t
|
||||
(when (and (boundp 'global-font-lock-mode) global-font-lock-mode)
|
||||
;; (setq font-lock-fontify-buffer-function
|
||||
;; 'font-lock-default-fontify-buffer)
|
||||
;; Get back our unfontify buffer function
|
||||
(setq font-lock-unfontify-buffer-function
|
||||
#'font-lock-default-unfontify-buffer))
|
||||
(remove-hook 'ess-noweb-font-lock-mode-hook #'ess-noweb-font-lock-mode-fn)
|
||||
(remove-hook 'ess-noweb-changed-chunk-hook
|
||||
#'ess-noweb-font-lock-fontify-this-chunk)
|
||||
(remove-hook 'after-change-functions
|
||||
#'font-lock-after-change-function )
|
||||
(font-lock-default-unfontify-buffer)
|
||||
(setq ess-noweb-use-font-lock-mode nil)
|
||||
(message "ess-noweb-font-lock-mode removed"))))
|
||||
(message "ess-noweb-font-lock-mode can only be used with ess-noweb-mode")))
|
||||
|
||||
(defun ess-noweb-start-of-syntax ()
|
||||
"Go to the place to start fontifying from"
|
||||
(interactive)
|
||||
(goto-char (car (ess-noweb-chunk-region))))
|
||||
|
||||
(defvar font-latex-extend-region-functions)
|
||||
(defvar syntax-begin-function)
|
||||
|
||||
(defun ess-noweb-font-lock-fontify-chunk-by-number ( chunk-num )
|
||||
"Fontify chunk CHUNK-NUM based on the current major mode."
|
||||
(save-excursion
|
||||
(font-lock-set-defaults)
|
||||
;; (setq old-beginning-of-syntax font-lock-beginning-of-syntax-function)
|
||||
(setq syntax-begin-function #'ess-noweb-start-of-syntax)
|
||||
(setq font-lock-keywords
|
||||
;; (append font-lock-keywords
|
||||
;; '(("\\(\\[\\[\\)\\([^]]*\\]*\\)\\(\\]\\]\\|\\$\\)"
|
||||
;; (1 ess-noweb-font-lock-brackets-face prepend )
|
||||
;; (2 ess-noweb-font-lock-code-quote-face prepend)
|
||||
;; (3 ess-noweb-font-lock-brackets-face prepend))
|
||||
;; ("^[ \t\n]*\\(<<\\)\\([^>]*\\)\\(>>=?\\)"
|
||||
;; (1 ess-noweb-font-lock-brackets-face prepend )
|
||||
;; (2 ess-noweb-font-lock-chunk-name-face prepend)
|
||||
;; (3 ess-noweb-font-lock-brackets-face prepend))
|
||||
;; ("^@[ \t\n]+"
|
||||
;; (0 ess-noweb-font-lock-doc-start-face prepend )))))
|
||||
(append font-lock-keywords
|
||||
'(("^[ \t\n]*\\(<<\\)\\([^>]*\\)\\(>>=?\\)"
|
||||
;; FIXME: Why not use ess-noweb-font-lock-brackets-face?
|
||||
(1 font-lock-reference-face prepend )
|
||||
;; FIXME: Why not use ess-noweb-font-lock-chunk-name-face?
|
||||
(2 font-lock-keyword-face prepend)
|
||||
(3 font-lock-reference-face prepend))
|
||||
("^@[ \t\n]+"
|
||||
(0 font-lock-reference-face prepend )))))
|
||||
|
||||
|
||||
(let ((r (cons (marker-position (cdr (aref ess-noweb-chunk-vector
|
||||
chunk-num)))
|
||||
(marker-position (cdr (aref ess-noweb-chunk-vector
|
||||
(1+ chunk-num))))))
|
||||
(font-latex-extend-region-functions nil);; don't extend anything
|
||||
(font-lock-extend-region-functions nil)) ;; this infloops :(
|
||||
(save-restriction
|
||||
(narrow-to-region (car r) (cdr r))
|
||||
;; (sit-for 3)
|
||||
(font-lock-fontify-region (car r) (cdr r)))
|
||||
t)))
|
||||
|
||||
|
||||
(defun ess-noweb-font-lock-fontify-this-chunk ()
|
||||
"Fontify this chunk according to its own major mode.
|
||||
Since we are in the chunk, the major mode will already have been set
|
||||
by ess-noweb-mode.el"
|
||||
(interactive)
|
||||
(ess-noweb-font-lock-fontify-chunk-by-number (ess-noweb-find-chunk-index-buffer)))
|
||||
|
||||
(defun ess-noweb-font-lock-initial-fontify-buffer ()
|
||||
"Applies syntax highlighting to some or all chunks in a noweb buffer.
|
||||
The number of chunks is set by `ess-noweb-font-lock-max-initial-chunks': if
|
||||
this is nil, the entire buffer is fontified.
|
||||
It is intended to be called when first entering `ess-noweb-font-lock-mode'.
|
||||
For other purposes, use `ess-noweb-font-lock-fontify-chunks'."
|
||||
(interactive)
|
||||
;; This will be tricky. It will be very slow to go throught the chunks
|
||||
;; in order, switching major modes all the time.
|
||||
;; So, we will do the documentation in one pass, the code in a second
|
||||
;; pass. This could still be a little slow if we have to swap between
|
||||
;; different code modes regularly, but it should be bearable. It should
|
||||
;; only happen when the file is first read in, anyway
|
||||
(save-excursion
|
||||
(let (start-chunk end-chunk this-chunk)
|
||||
(setq this-chunk (ess-noweb-find-chunk-index-buffer))
|
||||
(if ess-noweb-font-lock-max-initial-chunks
|
||||
(progn
|
||||
(setq start-chunk
|
||||
(max 0
|
||||
(- this-chunk
|
||||
(/ ess-noweb-font-lock-max-initial-chunks 2))))
|
||||
;; Don't you just love hairy lisp syntax ? The above means set the
|
||||
;; starting chunk to the current chunk minus half of
|
||||
;; ess-noweb-font-lock-max-initial-chunks, unless that is negative in
|
||||
;; which case set it to 0
|
||||
(setq end-chunk (+ start-chunk ess-noweb-font-lock-max-initial-chunks))
|
||||
(if (> end-chunk (- (length ess-noweb-chunk-vector) 2))
|
||||
(setq end-chunk (- (length ess-noweb-chunk-vector) 2))))
|
||||
;; If ess-noweb-font-lock-max-initial-chunks is nil, do the whole buffer
|
||||
(progn
|
||||
(setq start-chunk 0)
|
||||
(setq end-chunk (- (length ess-noweb-chunk-vector) 2))))
|
||||
(ess-noweb-font-lock-fontify-chunks start-chunk end-chunk))))
|
||||
|
||||
(defun ess-noweb-font-lock-fontify-buffer ()
|
||||
"This function will fontify each chunk in the buffer appropriately."
|
||||
(interactive)
|
||||
(let ((start-chunk 0)
|
||||
(end-chunk (- (length ess-noweb-chunk-vector) 2)))
|
||||
(ess-noweb-font-lock-fontify-chunks start-chunk end-chunk)))
|
||||
|
||||
(defun ess-noweb-font-lock-fontify-chunks (start-chunk end-chunk)
|
||||
"Fontify a noweb file from START-CHUNK to END-CHUNK."
|
||||
(interactive)
|
||||
(let ((chunk-counter start-chunk))
|
||||
(save-excursion
|
||||
(message "Fontifying from %d to %d" start-chunk end-chunk)
|
||||
;; Want to set DOC mode for the first Doc chunk, not for the others
|
||||
(while (stringp (car (aref ess-noweb-chunk-vector chunk-counter)))
|
||||
(setq chunk-counter (+ chunk-counter 1)))
|
||||
(goto-char (cdr (aref ess-noweb-chunk-vector chunk-counter)))
|
||||
(ess-noweb-select-mode)
|
||||
;; Now go through the chunks, fontifying the documentation ones.
|
||||
(while (<= chunk-counter end-chunk)
|
||||
(if (not (stringp (car (aref ess-noweb-chunk-vector chunk-counter))))
|
||||
(ess-noweb-font-lock-fontify-chunk-by-number chunk-counter))
|
||||
(message "Fontifying documentation chunks: chunk %d" chunk-counter)
|
||||
(setq chunk-counter (+ 1 chunk-counter)))
|
||||
;; Go back to the start and go through the chunks, fontifying the code ones.
|
||||
(setq chunk-counter start-chunk)
|
||||
(message "About to do code chunks")
|
||||
(while (<= chunk-counter end-chunk)
|
||||
(when (stringp (car (aref ess-noweb-chunk-vector chunk-counter)))
|
||||
;; It's a code chunk: goto it to set the correct code mode, then
|
||||
;; fontify it.
|
||||
(message "Fontifying code chunks: chunk %d" chunk-counter)
|
||||
(goto-char (cdr (aref ess-noweb-chunk-vector chunk-counter)))
|
||||
(ess-noweb-select-mode)
|
||||
(ess-noweb-font-lock-fontify-this-chunk))
|
||||
(setq chunk-counter (1+ chunk-counter))))
|
||||
(ess-noweb-select-mode)))
|
||||
|
||||
(defun ess-noweb-font-lock-mode-fn()
|
||||
"Function that is intended to be attached to ess-noweb-font-lock-mode-hook."
|
||||
(ess-noweb-font-lock-initial-fontify-buffer))
|
||||
|
||||
;; This is a wee bit of a hack. If people attach `turn-on-font-lock'
|
||||
;; to their major mode hook, it will play hell with
|
||||
;; ess-noweb-font-lock-mode. I had hoped that providing a replacement
|
||||
;; `nw-turn-on-font-lock' would solve the problem, but it didn't
|
||||
;; (sometimes turn-on-font-lock appears in places other than
|
||||
;; `.emacs', such as in ESS). So rather than have it fall over if
|
||||
;; turn-on-lock was around, I redefined turn-on-font-lock to do the
|
||||
;; right thing.
|
||||
|
||||
(define-obsolete-function-alias 'nw-turn-on-font-lock
|
||||
#'turn-on-font-lock "ESS-16.11")
|
||||
|
||||
(defadvice turn-on-font-lock (around ess-noweb-font-lock activate)
|
||||
;; FIXME: An advice on turn-on-font-lock is definitely not sufficient,
|
||||
;; since font-lock can be enabled without going through turn-on-font-lock!
|
||||
(if (not ess-noweb-mode)
|
||||
ad-do-it
|
||||
(if (and (not ess-noweb-font-lock-mode) ess-noweb-use-font-lock-mode)
|
||||
(ess-noweb-font-lock-mode))))
|
||||
|
||||
(provide 'ess-noweb-font-lock-mode)
|
||||
;; *****
|
||||
;;
|
||||
;; Adnan Yaqub (AYaqub@orga.com)
|
||||
;; ORGA Kartensysteme GmbH // An der Kapelle 2 // D-33104 Paderborn // Germany
|
||||
;; Tel. +49 5254 991-823 //Fax. +49 5254 991-749
|
||||
|
||||
|
||||
;;; ess-noweb-font-lock-mode.el ends here
|
||||
1892
elpa/ess-20180701.100/ess-noweb-mode.el
Normal file
1892
elpa/ess-20180701.100/ess-noweb-mode.el
Normal file
File diff suppressed because it is too large
Load Diff
128
elpa/ess-20180701.100/ess-noweb.el
Normal file
128
elpa/ess-20180701.100/ess-noweb.el
Normal file
@@ -0,0 +1,128 @@
|
||||
;;; ess-noweb.el --- support for Literate Data Analysis
|
||||
|
||||
;; Copyright (C) 1999 Mark Lunt
|
||||
;; Copyright (C) 1999--2004 A.J. Rossini, Richard M. Heiberger, Martin
|
||||
;; Maechler, Kurt Hornik, Rodney Sparapani, and Stephen Eglen.
|
||||
|
||||
;; Author: Mark Lunt <mark.lunt@mrc-bsu.cam.ac.uk>
|
||||
;; A.J. Rossini <rossini@u.washington.edu>
|
||||
;; Created: April 18, 1999
|
||||
;; Maintainer: ESS-core <ESS-core@r-project.org>
|
||||
|
||||
;; Keywords: statistics, languages
|
||||
;; Summary: Noweb support for ESS
|
||||
|
||||
;; 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/
|
||||
|
||||
;;; Commentary:
|
||||
|
||||
;; Code for ESS and Literate Data Analysis.
|
||||
|
||||
;;; Code:
|
||||
|
||||
; Requires and autoloads
|
||||
|
||||
(require 'ess-noweb-mode)
|
||||
|
||||
; Variables
|
||||
|
||||
(defvar ess-noweb-use-font-lock font-lock-mode
|
||||
"Set to t if you want to use font-locking in ESS noweb buffers.")
|
||||
|
||||
(if ess-noweb-use-font-lock
|
||||
(require 'ess-noweb-font-lock-mode))
|
||||
|
||||
; Functions
|
||||
|
||||
;;*;; Code Chunk evaluation.
|
||||
|
||||
(defun ess-eval-chunk (vis)
|
||||
"Tangle the current chunk and send it to the inferior ESS process.
|
||||
Arg has same meaning as for `ess-eval-region'."
|
||||
(interactive "P")
|
||||
(let ((process-name ess-local-process-name)
|
||||
new-process-name
|
||||
(cbuf (current-buffer))
|
||||
(temp-buffer (ess-create-temp-buffer "Tangle Buffer")))
|
||||
(save-excursion
|
||||
(ess-noweb-tangle-chunk temp-buffer)
|
||||
(set-buffer temp-buffer)
|
||||
;; When the temp buffer is created, it does not inherit any value
|
||||
;; of ess-local-process-name from the .Rnw buffer, so we have to set it
|
||||
;; here. If ess-local-process-name is not set in the .Rnw buffer,
|
||||
;; it will inherit the value that is chosen here.
|
||||
(set (make-local-variable 'ess-local-process-name) process-name)
|
||||
(ess-eval-region (point-min) (point-max) vis "Eval Chunk")
|
||||
(if process-name
|
||||
(kill-buffer temp-buffer)
|
||||
;; if process-name was nil, source buffer did not have a local process
|
||||
;; so keep value from temp buffer before killing it.
|
||||
(setq new-process-name ess-local-process-name)
|
||||
(kill-buffer temp-buffer)
|
||||
(set-buffer cbuf)
|
||||
(set (make-local-variable 'ess-local-process-name) new-process-name)))))
|
||||
|
||||
|
||||
(defun ess-eval-chunk-and-step (&optional vis)
|
||||
"Tangle the current chunk and send it to the inferior ESS process and
|
||||
step to the next chunk"
|
||||
(interactive)
|
||||
(ess-eval-chunk vis)
|
||||
(ess-noweb-next-code-chunk 1))
|
||||
|
||||
(defun ess-eval-chunk-and-go (vis)
|
||||
"Tangle the current chunk, send to the ESS process, and go there.
|
||||
Arg has same meaning as for `ess-eval-region'."
|
||||
(interactive "P")
|
||||
(ess-eval-chunk vis)
|
||||
(ess-switch-to-ESS t))
|
||||
|
||||
;;*;; Thread code chunk evaluation
|
||||
|
||||
;;
|
||||
;; Threads are code chunks which fit into the same "buffer" (I'm (AJR)
|
||||
;; abusing terminology, but what I mean is things like:
|
||||
;; <<thing1>>=
|
||||
;; code for thing1
|
||||
;; @
|
||||
;; Documentation
|
||||
;; <<thing1>>=
|
||||
;; continuing code for thing1
|
||||
;; @
|
||||
;;
|
||||
|
||||
(defun ess-eval-thread (vis)
|
||||
"Tangle all chunks in the current chunk-thread and send to the ESS process.
|
||||
Arg has same meaning as for `ess-eval-region'."
|
||||
(interactive "P")
|
||||
(let ((temp-buffer (ess-create-temp-buffer "Tangle Buffer")))
|
||||
(ess-noweb-tangle-current-thread temp-buffer)
|
||||
(set-buffer temp-buffer)
|
||||
(ess-eval-region (point-min) (point-max) vis "Eval buffer")
|
||||
(kill-buffer temp-buffer)))
|
||||
|
||||
(defun ess-eval-thread-and-go (vis)
|
||||
"Tangle all chunks in the current chunk-thread, send to ESS process,
|
||||
and go there. Arg has same meaning as for `ess-eval-region'."
|
||||
(interactive "P")
|
||||
(ess-eval-thread vis)
|
||||
(ess-switch-to-ESS t))
|
||||
|
||||
; Provide package
|
||||
|
||||
(provide 'ess-noweb)
|
||||
|
||||
;;; ess-noweb.el ends here
|
||||
112
elpa/ess-20180701.100/ess-omg-d.el
Normal file
112
elpa/ess-20180701.100/ess-omg-d.el
Normal file
@@ -0,0 +1,112 @@
|
||||
;;; ess-omg-d.el --- Omega customization
|
||||
|
||||
;; Copyright (C) 1999 A. J. Rossini
|
||||
;; Copyright (C) 2000--2004 A.J. Rossini, Richard M. Heiberger, Martin
|
||||
;; Maechler, Kurt Hornik, Rodney Sparapani, and Stephen Eglen.
|
||||
|
||||
;; Author: A.J. Rossini <rossini@biostat.washington.edu>
|
||||
;; Created: 15 August 1999
|
||||
;; Maintainer: ESS-core <ESS-core@r-project.org>
|
||||
|
||||
;; Keywords: languages
|
||||
|
||||
;; 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/
|
||||
|
||||
;;; Commentary:
|
||||
|
||||
;; This file defines all the S-PLUS 3.x customizations for ess-mode.
|
||||
|
||||
;;; Code:
|
||||
|
||||
;;; Requires and Autoloads:
|
||||
|
||||
(require 'ess-omg-l)
|
||||
|
||||
(defvar OMG-dialect-name "OMG"
|
||||
"Name of 'dialect' for Omega.") ;easily changeable in a user's .emacs
|
||||
|
||||
(defvar OMG-customize-alist
|
||||
'((ess-local-customize-alist . 'OMG-customize-alist)
|
||||
(ess-language . "OMG")
|
||||
(ess-dialect . "omegahat")
|
||||
(ess-suffix . "omg")
|
||||
(ess-loop-timeout . 5000)
|
||||
(ess-dump-filename-template . (replace-regexp-in-string
|
||||
"S$" ess-suffix ; in the one from custom:
|
||||
ess-dump-filename-template-proto))
|
||||
(ess-mode-editing-alist . OMG-editing-alist)
|
||||
(ess-mode-syntax-table . OMG-syntax-table)
|
||||
(ess-change-sp-regexp . "");fixme (if omegahat ever ..)
|
||||
(ess-help-sec-regex . ess-help-S+-sec-regex)
|
||||
(ess-help-sec-keys-alist . ess-help-S+sec-keys-alist)
|
||||
(ess-object-name-db-file . "ess-omg-namedb.el" )
|
||||
(inferior-ess-program . inferior-OMG-program)
|
||||
(inferior-ess-objects-command . "objects(%d)\n")
|
||||
(inferior-ess-help-command . "help(\"%s\",pager=\"cat\",window=F)\n")
|
||||
(inferior-ess-exit-command . "q()\n")
|
||||
(inferior-ess-primary-prompt . "\\[[0-9]*\\]")
|
||||
(inferior-ess-secondary-prompt . ".. ?")
|
||||
(comint-use-prompt-regexp . t)
|
||||
(inferior-ess-start-file . nil) ;"~/.ess-omg")
|
||||
(inferior-ess-start-args . ""))
|
||||
"Variables to customize for OMG (Omegahat)")
|
||||
|
||||
|
||||
(defun OMG (&optional start-args) ; proc-name)
|
||||
"Call Omegahat, from the Omega Group for Statistical Computing."
|
||||
(interactive "P")
|
||||
(setq ess-customize-alist OMG-customize-alist)
|
||||
(ess-write-to-dribble-buffer
|
||||
(format "\n(OMG): ess-dialect=%s, buf=%s\n"
|
||||
ess-dialect
|
||||
(current-buffer)))
|
||||
(let ((omg-start-args
|
||||
(concat inferior-ess-start-args
|
||||
(if start-args (read-string
|
||||
"Starting Args [possibly -CORBA] ? ")
|
||||
nil))))
|
||||
(inferior-ess omg-start-args)))
|
||||
|
||||
|
||||
|
||||
(fset 'omegahat 'OMG)
|
||||
|
||||
;;;###autoload
|
||||
(defun OMG-mode (&optional proc-name)
|
||||
"Major mode for editing Omegahat source. NOT EVEN STARTED."
|
||||
(interactive)
|
||||
(setq ess-customize-alist OMG-customize-alist)
|
||||
(ess-mode OMG-customize-alist proc-name)
|
||||
;;(java-mode)
|
||||
(setq major-mode 'OMG-mode))
|
||||
|
||||
;;;###autoload
|
||||
(add-to-list 'auto-mode-alist '("\\.omg\\'" . omegahat-mode))
|
||||
;;;###autoload
|
||||
(add-to-list 'auto-mode-alist '("\\.hat\\'" . omegahat-mode))
|
||||
|
||||
(fset 'omegahat-mode 'OMG-mode)
|
||||
|
||||
(defun OMG-transcript-mode ()
|
||||
"Omegahat transcript mode."
|
||||
(interactive)
|
||||
(ess-transcript-mode OMG-customize-alist))
|
||||
|
||||
; Provide package
|
||||
|
||||
(provide 'ess-omg-d)
|
||||
|
||||
;;; ess-omg-d.el ends here
|
||||
326
elpa/ess-20180701.100/ess-omg-l.el
Normal file
326
elpa/ess-20180701.100/ess-omg-l.el
Normal file
@@ -0,0 +1,326 @@
|
||||
;;; ess-omg-l.el --- Support for editing Omega source code
|
||||
|
||||
;; Copyright (C) 1999--2001 A.J. Rossini.
|
||||
;; Copyright (C) 2002--2004 A.J. Rossini, Richard M. Heiberger, Martin
|
||||
;; Maechler, Kurt Hornik, Rodney Sparapani, and Stephen Eglen.
|
||||
|
||||
;; Author: A.J. Rossini <rossini@u.washington.edu>
|
||||
;; Created: 15 Aug 1999
|
||||
;; Maintainer: ESS-core <ESS-core@r-project.org>
|
||||
|
||||
;; This file is part of ESS (Emacs Speaks Statistics).
|
||||
|
||||
;; 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/
|
||||
|
||||
;;; Commentary:
|
||||
|
||||
;; Code for general editing Omega source code. This is initially
|
||||
;; based upon the similarities between Omega and S, but will need to
|
||||
;; diverge to incorporate the use of Java-style coding.
|
||||
|
||||
;;; Code:
|
||||
|
||||
(require 'ess-s-lang)
|
||||
|
||||
; Specialized functions
|
||||
|
||||
(defun OMG-comment-indent ()
|
||||
"Indentation for Omega comments."
|
||||
|
||||
(if (looking-at "////")
|
||||
(current-column)
|
||||
(if (looking-at "///")
|
||||
(let ((tem (ess-calculate-indent)))
|
||||
(if (listp tem) (car tem) tem))
|
||||
(skip-chars-backward " \t")
|
||||
(max (if (bolp) 0 (1+ (current-column)))
|
||||
comment-column))))
|
||||
|
||||
;; (defun OMG-indent-line ()
|
||||
;; "Indent current line as Omega code.
|
||||
;; Return the amount the indentation changed by."
|
||||
;; (let ((indent (ess-calculate-indent nil))
|
||||
;; beg shift-amt
|
||||
;; (case-fold-search nil)
|
||||
;; (pos (- (point-max) (point))))
|
||||
;; (beginning-of-line)
|
||||
;; (setq beg (point))
|
||||
;; (cond ((eq indent nil)
|
||||
;; (setq indent (current-indentation)))
|
||||
;; (t
|
||||
;; (skip-chars-forward " \t")
|
||||
;; (if (and ess-indent-with-fancy-comments (looking-at "////"))
|
||||
;; (setq indent 0))
|
||||
;; (if (and ess-indent-with-fancy-comments
|
||||
;; (looking-at "//")
|
||||
;; (not (looking-at "///")))
|
||||
;; (setq indent comment-column)
|
||||
;; (if (eq indent t) (setq indent 0))
|
||||
;; (if (listp indent) (setq indent (car indent)))
|
||||
;; (cond ((and (looking-at "else\\b")
|
||||
;; (not (looking-at "else\\s_")))
|
||||
;; (setq indent (save-excursion
|
||||
;; (ess-backward-to-start-of-if)
|
||||
;; (+ ess-else-offset
|
||||
;; (current-indentation)))))
|
||||
;; ((= (following-char) ?})
|
||||
;; (setq indent
|
||||
;; (+ indent
|
||||
;; (- ess-close-brace-offset ess-indent-offset))))
|
||||
;; ((= (following-char) ?{)
|
||||
;; (setq indent (+ indent ess-brace-offset)))))))
|
||||
;; (skip-chars-forward " \t")
|
||||
;; (setq shift-amt (- indent (current-column)))
|
||||
;; (if (zerop shift-amt)
|
||||
;; (if (> (- (point-max) pos) (point))
|
||||
;; (goto-char (- (point-max) pos)))
|
||||
;; (delete-region beg (point))
|
||||
;; (indent-to indent)
|
||||
;; ;; If initial point was within line's indentation,
|
||||
;; ;; position after the indentation.
|
||||
;; ;; Else stay at same point in text.
|
||||
;; (if (> (- (point-max) pos) (point))
|
||||
;; (goto-char (- (point-max) pos))))
|
||||
;; shift-amt))
|
||||
|
||||
|
||||
;; (defun OMG-calculate-indent (&optional parse-start)
|
||||
;; "Return appropriate indentation for current line as Omega code.
|
||||
;; In usual case returns an integer: the column to indent to.
|
||||
;; Returns nil if line starts inside a string, t if in a comment."
|
||||
;; (save-excursion
|
||||
;; (beginning-of-line)
|
||||
;; (let ((indent-point (point))
|
||||
;; (case-fold-search nil)
|
||||
;; state
|
||||
;; containing-sexp)
|
||||
;; (if parse-start
|
||||
;; (goto-char parse-start)
|
||||
;; (beginning-of-defun))
|
||||
;; (while (< (point) indent-point)
|
||||
;; (setq parse-start (point))
|
||||
;; (setq state (parse-partial-sexp (point) indent-point 0))
|
||||
;; (setq containing-sexp (car (cdr state))))
|
||||
;; (cond ((or (nth 3 state) (nth 4 state))
|
||||
;; ;; return nil or t if should not change this line
|
||||
;; (nth 4 state))
|
||||
;; ((null containing-sexp)
|
||||
;; ;; Line is at top level. May be data or function definition,
|
||||
;; (beginning-of-line)
|
||||
;; (if (and (/= (following-char) ?\{)
|
||||
;; (save-excursion
|
||||
;; (ess-backward-to-noncomment (point-min))
|
||||
;; (ess-continued-statement-p)))
|
||||
;; ess-continued-statement-offset
|
||||
;; 0)) ; Unless it starts a function body
|
||||
;; ((/= (char-after containing-sexp) ?{)
|
||||
;; ;; line is expression, not statement:
|
||||
;; ;; indent to just after the surrounding open.
|
||||
;; (goto-char containing-sexp)
|
||||
;; (let ((bol (save-excursion (beginning-of-line) (point))))
|
||||
|
||||
;; ;; modified by shiba@isac 7.3.1992
|
||||
;; (cond ((and (numberp ess-expression-offset)
|
||||
;; (re-search-backward "[ \t]*expression[ \t]*" bol t))
|
||||
;; ;; This regexp match every "expression".
|
||||
;; ;; modified by shiba
|
||||
;; ;;(forward-sexp -1)
|
||||
;; (beginning-of-line)
|
||||
;; (skip-chars-forward " \t")
|
||||
;; ;; End
|
||||
;; (+ (current-column) ess-expression-offset))
|
||||
;; ((and (numberp ess-arg-function-offset)
|
||||
;; (re-search-backward
|
||||
;; "=[ \t]*\\s\"*\\(\\w\\|\\s_\\)+\\s\"*[ \t]*"
|
||||
;; bol
|
||||
;; t))
|
||||
;; (forward-sexp -1)
|
||||
;; (+ (current-column) ess-arg-function-offset))
|
||||
;; ;; "expression" is searched before "=".
|
||||
;; ;; End
|
||||
|
||||
;; (t
|
||||
;; (progn (goto-char (1+ containing-sexp))
|
||||
;; (current-column))))))
|
||||
;; (t
|
||||
;; ;; Statement level. Is it a continuation or a new statement?
|
||||
;; ;; Find previous non-comment character.
|
||||
;; (goto-char indent-point)
|
||||
;; (ess-backward-to-noncomment containing-sexp)
|
||||
;; ;; Back up over label lines, since they don't
|
||||
;; ;; affect whether our line is a continuation.
|
||||
;; (while (eq (preceding-char) ?\,)
|
||||
;; (ess-backward-to-start-of-continued-exp containing-sexp)
|
||||
;; (beginning-of-line)
|
||||
;; (ess-backward-to-noncomment containing-sexp))
|
||||
;; ;; Now we get the answer.
|
||||
;; (if (ess-continued-statement-p)
|
||||
;; ;; This line is continuation of preceding line's statement;
|
||||
;; ;; indent ess-continued-statement-offset more than the
|
||||
;; ;; previous line of the statement.
|
||||
;; (progn
|
||||
;; (ess-backward-to-start-of-continued-exp containing-sexp)
|
||||
;; (+ ess-continued-statement-offset (current-column)
|
||||
;; (if (save-excursion (goto-char indent-point)
|
||||
;; (skip-chars-forward " \t")
|
||||
;; (eq (following-char) ?{))
|
||||
;; ess-continued-brace-offset 0)))
|
||||
;; ;; This line starts a new statement.
|
||||
;; ;; Position following last unclosed open.
|
||||
;; (goto-char containing-sexp)
|
||||
;; ;; Is line first statement after an open-brace?
|
||||
;; (or
|
||||
;; ;; If no, find that first statement and indent like it.
|
||||
;; (save-excursion
|
||||
;; (forward-char 1)
|
||||
;; (while (progn (skip-chars-forward " \t\n")
|
||||
;; (looking-at "//"))
|
||||
;; ;; Skip over comments following openbrace.
|
||||
;; (forward-line 1))
|
||||
;; ;; The first following code counts
|
||||
;; ;; if it is before the line we want to indent.
|
||||
;; (and (< (point) indent-point)
|
||||
;; (current-column)))
|
||||
;; ;; If no previous statement,
|
||||
;; ;; indent it relative to line brace is on.
|
||||
;; ;; For open brace in column zero, don't let statement
|
||||
;; ;; start there too. If ess-indent-offset is zero,
|
||||
;; ;; use ess-brace-offset + ess-continued-statement-offset instead.
|
||||
;; ;; For open-braces not the first thing in a line,
|
||||
;; ;; add in ess-brace-imaginary-offset.
|
||||
;; (+ (if (and (bolp) (zerop ess-indent-offset))
|
||||
;; (+ ess-brace-offset ess-continued-statement-offset)
|
||||
;; ess-indent-offset)
|
||||
;; ;; Move back over whitespace before the openbrace.
|
||||
;; ;; If openbrace is not first nonwhite thing on the line,
|
||||
;; ;; add the ess-brace-imaginary-offset.
|
||||
;; (progn (skip-chars-backward " \t")
|
||||
;; (if (bolp) 0 ess-brace-imaginary-offset))
|
||||
;; ;; If the openbrace is preceded by a parenthesized exp,
|
||||
;; ;; move to the beginning of that;
|
||||
;; ;; possibly a different line
|
||||
;; (progn
|
||||
;; (if (eq (preceding-char) ?\))
|
||||
;; (forward-sexp -1))
|
||||
;; ;; Get initial indentation of the line we are on.
|
||||
;; (current-indentation))))))))))
|
||||
|
||||
|
||||
|
||||
|
||||
(defvar OMG-syntax-table nil "Syntax table for Omegahat code.")
|
||||
(if S-syntax-table
|
||||
nil
|
||||
(setq S-syntax-table (make-syntax-table))
|
||||
(modify-syntax-entry ?\\ "\\" S-syntax-table)
|
||||
(modify-syntax-entry ?+ "." S-syntax-table)
|
||||
(modify-syntax-entry ?- "." S-syntax-table)
|
||||
(modify-syntax-entry ?= "." S-syntax-table)
|
||||
(modify-syntax-entry ?% "." S-syntax-table)
|
||||
(modify-syntax-entry ?< "." S-syntax-table)
|
||||
(modify-syntax-entry ?> "." S-syntax-table)
|
||||
(modify-syntax-entry ?& "." S-syntax-table)
|
||||
(modify-syntax-entry ?| "." S-syntax-table)
|
||||
(modify-syntax-entry ?\' "\"" S-syntax-table)
|
||||
;;FIXME: This fails (warning in compilation):
|
||||
;;F "//" are 2 characters; ?// is invalid
|
||||
;;F NEXT LINE IS BOGUS IN XEMACS, AJR
|
||||
;;F (modify-syntax-entry ?// "<" S-syntax-table) ; open comment
|
||||
;;F (modify-syntax-entry ?\n ">" S-syntax-table) ; close comment
|
||||
;;(modify-syntax-entry ?. "w" S-syntax-table) ; "." used in S obj names
|
||||
(modify-syntax-entry ?. "_" S-syntax-table) ; see above/below,
|
||||
; plus consider separation.
|
||||
(modify-syntax-entry ?$ "_" S-syntax-table) ; foo.bar$hack is 1 symbol
|
||||
(modify-syntax-entry ?_ "." S-syntax-table)
|
||||
(modify-syntax-entry ?* "." S-syntax-table)
|
||||
(modify-syntax-entry ?< "." S-syntax-table)
|
||||
(modify-syntax-entry ?> "." S-syntax-table)
|
||||
(modify-syntax-entry ?/ "." S-syntax-table))
|
||||
|
||||
|
||||
(defvar OMG-editing-alist
|
||||
'((paragraph-start . (concat "^$\\|" page-delimiter))
|
||||
(paragraph-separate . (concat "^$\\|" page-delimiter))
|
||||
(paragraph-ignore-fill-prefix . t)
|
||||
(require-final-newline . mode-require-final-newline)
|
||||
(comment-start . "//")
|
||||
(comment-start-skip . "//+ *")
|
||||
(comment-column . 40)
|
||||
;;(comment-indent-function . 'S-comment-indent)
|
||||
;;(ess-comment-indent . 'S-comment-indent)
|
||||
;;(ess-indent-line . 'S-indent-line)
|
||||
;;(ess-calculate-indent . 'ess-calculate-indent)
|
||||
(indent-line-function . 'ess-indent-line)
|
||||
(parse-sexp-ignore-comments . t)
|
||||
(ess-style . ess-default-style)
|
||||
(ess-local-process-name . nil)
|
||||
;;(ess-keep-dump-files . 'ask)
|
||||
(ess-mode-syntax-table . S-syntax-table)
|
||||
(font-lock-defaults . '(ess-OMG-font-lock-defaults
|
||||
nil nil ((?\. . "w")))))
|
||||
"General options for Omegahat source files.")
|
||||
|
||||
(defvar ess-OMG-font-lock-defaults
|
||||
(append (list
|
||||
(cons "\\b[0-9]+\\b" 'font-lock-type-face) ; numbers
|
||||
(cons (regexp-opt ess-S-keywords 'words) 'font-lock-keyword-face))
|
||||
(list
|
||||
(cons (regexp-opt ess-S-assign-ops)
|
||||
'font-lock-constant-face) ; assign
|
||||
(cons (regexp-opt ess-S-constants 'words)
|
||||
'font-lock-type-face) ; constants
|
||||
(cons (regexp-opt ess-S-modifyiers 'words)
|
||||
'font-lock-constant-face) ; modify search list or source
|
||||
|
||||
(cons ess-S-function-name-regexp
|
||||
'(1 font-lock-function-name-face keep))
|
||||
; function name
|
||||
(cons "\\s.\\|\\s(\\|\\s)" 'font-lock-function-name-face)
|
||||
;punctuation and parents (same as function not to cause vidual disturbance)
|
||||
)) ; keywords
|
||||
"Font-lock patterns used in `OMG' buffers.")
|
||||
|
||||
|
||||
;;; Changes from S to S-PLUS 3.x. (standard S3 should be in ess-s-lang.el !).
|
||||
|
||||
(defconst OMG-help-sec-keys-alist
|
||||
'((?a . "ARGUMENTS:")
|
||||
(?b . "BACKGROUND:")
|
||||
(?B . "BUGS:")
|
||||
(?d . "DESCRIPTION:")
|
||||
(?D . "DETAILS:")
|
||||
(?e . "EXAMPLES:")
|
||||
(?n . "NOTE:")
|
||||
(?O . "OPTIONAL ARGUMENTS:")
|
||||
(?R . "REQUIRED ARGUMENTS:")
|
||||
(?r . "REFERENCES:")
|
||||
(?s . "SEE ALSO:")
|
||||
(?S . "SIDE EFFECTS:")
|
||||
(?u . "USAGE:")
|
||||
(?v . "VALUE:"))
|
||||
"Alist of (key . string) pairs for use in section searching.")
|
||||
;;; `key' indicates the keystroke to use to search for the section heading
|
||||
;;; `string' in an S help file. `string' is used as part of a
|
||||
;;; regexp-search, and so specials should be quoted.
|
||||
|
||||
(defconst ess-help-OMG-sec-regex "^[A-Z. ---]+:$"
|
||||
"Reg(ular) Ex(pression) of section headers in help file")
|
||||
|
||||
;;; S-mode extras of Martin Maechler, Statistik, ETH Zurich.
|
||||
|
||||
;;>> Moved things into --> ./ess-utils.el
|
||||
|
||||
(provide 'ess-omg-l)
|
||||
|
||||
;;; ess-omg-l.el ends here
|
||||
8
elpa/ess-20180701.100/ess-pkg.el
Normal file
8
elpa/ess-20180701.100/ess-pkg.el
Normal file
@@ -0,0 +1,8 @@
|
||||
(define-package "ess" "20180701.100" "Emacs Speaks Statistics: statistical programming within Emacs"
|
||||
'((julia-mode "0.3"))
|
||||
:keywords
|
||||
'("statistics" "languages")
|
||||
:url "http://ess.r-project.org/")
|
||||
;; Local Variables:
|
||||
;; no-byte-compile: t
|
||||
;; End:
|
||||
151
elpa/ess-20180701.100/ess-r-a.el
Normal file
151
elpa/ess-20180701.100/ess-r-a.el
Normal file
@@ -0,0 +1,151 @@
|
||||
;;; ess-r-a.el -- Possible local customizations for R with ESS.
|
||||
|
||||
;; Copyright (C) 1997--2005 A.J. Rossini, Richard M. Heiberger, Martin
|
||||
;; Maechler, Kurt Hornik, Rodney Sparapani, and Stephen Eglen.
|
||||
|
||||
;; Author: A.J. Rossini <blindglobe@gmail.com>
|
||||
;; Created: 17 November 1999
|
||||
;; Maintainer: ESS-core <ESS-core@r-project.org>
|
||||
|
||||
;; Keywords: languages
|
||||
|
||||
;; 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/
|
||||
|
||||
;;; Commentary:
|
||||
|
||||
;; The purpose of this file is to demonstrate some of the extras that
|
||||
;; have been constructed for the ESS R mode; if they prove
|
||||
;; interesting, then they might be migrated to ess-r-mode, the primary
|
||||
;; ESS R mode tools.
|
||||
|
||||
;;; Code:
|
||||
|
||||
;; you can invoke ESS/R from emacs by typing
|
||||
;; C-u M-x essr
|
||||
;; with vsize set to (for example) 40M, and nsize set to 600000.
|
||||
|
||||
;; Undefined on non-apple devices
|
||||
(declare-function ns-do-applescript "nsfns.m" (script))
|
||||
(declare-function do-applescript "ess-r-a" (script))
|
||||
(unless (fboundp 'do-applescript)
|
||||
(defalias 'do-applescript 'ns-do-applescript))
|
||||
|
||||
(defalias 'essr
|
||||
(read-kbd-macro
|
||||
"C-u M-x R RET - - vsize = 40M SPC - - nsize = 600000 2*RET"))
|
||||
|
||||
(defun ess-r-do-region (start end &optional message)
|
||||
"Send the current region to R via AppleScript."
|
||||
(interactive "r\nP")
|
||||
(message "Starting evaluation...")
|
||||
(do-applescript (concat
|
||||
"try\n"
|
||||
"tell application \"R\"\n"
|
||||
"activate\n"
|
||||
"with timeout of 0 seconds\n"
|
||||
"cmd \"" (buffer-substring start end)
|
||||
"\"\n"
|
||||
"end timeout\n"
|
||||
"end tell\n"
|
||||
"end try\n"))
|
||||
(message "Finished evaluation"))
|
||||
|
||||
(defun ess-r-do-line ()
|
||||
"Send the current line to R via AppleScript."
|
||||
(interactive) ;; "r\nP")
|
||||
(message "Starting evaluation...")
|
||||
(save-excursion
|
||||
(let ((end (point)))
|
||||
(move-to-column 0)
|
||||
(do-applescript (concat
|
||||
"try\n"
|
||||
"tell application \"R\"\n"
|
||||
"activate\n"
|
||||
"with timeout of 0 seconds\n"
|
||||
"cmd \"" (buffer-substring (point) end)
|
||||
"\"\n"
|
||||
"end timeout\n"
|
||||
"end tell\n"
|
||||
"end try\n"))))
|
||||
(message "Finished evaluation"))
|
||||
|
||||
(defun ess-r-var (beg end)
|
||||
"Load the current region of numbers into an R variable. Prompts for
|
||||
a variable name. If none is given, it uses a default variable name,
|
||||
e. BEG and END denote the region in the current buffer to be sent."
|
||||
(interactive "r")
|
||||
(save-window-excursion
|
||||
(let ((tmp-file (make-temp-file "ess-r-var"))
|
||||
cmd
|
||||
var)
|
||||
(write-region beg end tmp-file)
|
||||
|
||||
;; Decide on the variable name to use in R; could use completion.
|
||||
(setq var (read-string "R Variable name (default e): "))
|
||||
(if (equal var "")
|
||||
(setq var "e"))
|
||||
|
||||
;; Command to send to the R process. Get R to delete the file
|
||||
;; rather than Emacs in case it takes R a long time to run the
|
||||
;; scan command.
|
||||
(setq cmd (concat var " <- scan(\"" tmp-file "\"); "
|
||||
"unlink(\"" tmp-file "\")" ))
|
||||
|
||||
;; Put the output from the scan command into the process buffer so
|
||||
;; the user has a record of it.
|
||||
(ess-execute cmd 'buffer))))
|
||||
|
||||
|
||||
;;; Peter Dalgaard's code.
|
||||
;;; This needs to be cleaned and validated!
|
||||
|
||||
(defun pd::set-up-demo ()
|
||||
(run-ess-r)
|
||||
(split-window-vertically 6)
|
||||
(find-file "demos.R")
|
||||
|
||||
;; Don't need to run this as a function -- ought to be fine if set
|
||||
;; just once.
|
||||
|
||||
(defun ajr::scroll-to-end::peterD (emacs)
|
||||
"Goal: map prompt to bottom of the screen after every command.
|
||||
Alternatively, use the scroll-in-place package, not sure where that
|
||||
is)."
|
||||
(interactive)
|
||||
(other-buffer 1)
|
||||
(if (= emacs "emacs")
|
||||
(setq scroll-up-aggressively t)
|
||||
(setq scroll-conservatively -4)) ;; <- change this
|
||||
(other-buffer -1))
|
||||
|
||||
(defun show-max-other-window ()
|
||||
(interactive)
|
||||
(other-window 1)
|
||||
(comint-show-maximum-output)
|
||||
(other-window -1))
|
||||
|
||||
;; call this once
|
||||
;; (ajr::scroll-to-end::peterD "emacs")
|
||||
|
||||
(global-set-key [f11] 'show-max-other-window)
|
||||
(global-set-key [f12] 'ess-eval-line-and-step))
|
||||
|
||||
|
||||
; Provide package
|
||||
|
||||
(provide 'ess-r-a)
|
||||
|
||||
;;; ess-r-a.el ends here
|
||||
506
elpa/ess-20180701.100/ess-r-completion.el
Normal file
506
elpa/ess-20180701.100/ess-r-completion.el
Normal file
@@ -0,0 +1,506 @@
|
||||
;;; ess-r-completion.el --- R completion
|
||||
;;
|
||||
;; Copyright (C) 2015 A.J. Rossini, Richard M. Heiberger, Martin Maechler, Kurt
|
||||
;; Hornik, Rodney Sparapani, Stephen Eglen and Vitalie Spinu.
|
||||
;;
|
||||
;; Author: Vitalie Spinu
|
||||
;; Maintainer: ESS-core <ESS-core@r-project.org>
|
||||
;;
|
||||
;; Keywords: languages, statistics
|
||||
;;
|
||||
;; 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/
|
||||
;;
|
||||
;;; Commentary:
|
||||
;;
|
||||
;;; Code:
|
||||
|
||||
|
||||
;;; ElDoc
|
||||
|
||||
(eval-when-compile
|
||||
(require 'cl-lib))
|
||||
(require 'ess-utils)
|
||||
|
||||
(defvar ac-auto-start)
|
||||
(defvar ac-prefix)
|
||||
(defvar ac-point)
|
||||
(defvar ac-use-comphist)
|
||||
(declare-function company-begin-backend "company")
|
||||
(declare-function company-doc-buffer "company")
|
||||
|
||||
(defun ess-r-eldoc-function ()
|
||||
"Return the doc string, or nil.
|
||||
If an ESS process is not associated with the buffer, do not try
|
||||
to look up any doc strings."
|
||||
(interactive)
|
||||
(when (and eldoc-mode ess-can-eval-in-background)
|
||||
(let* ((proc (ess-get-next-available-process))
|
||||
(funname (and proc (or (and ess-eldoc-show-on-symbol ;; Aggressive completion
|
||||
(thing-at-point 'symbol))
|
||||
(car (ess--fn-name-start))))))
|
||||
(when funname
|
||||
(let* ((args (ess-function-arguments funname proc))
|
||||
(bargs (cadr args))
|
||||
(doc (mapconcat (lambda (el)
|
||||
(if (equal (car el) "...")
|
||||
"..."
|
||||
(concat (car el) "=" (cdr el))))
|
||||
bargs ", "))
|
||||
(margs (nth 2 args))
|
||||
(W (- (window-width (minibuffer-window)) (+ 4 (length funname))))
|
||||
doc1)
|
||||
(when doc
|
||||
(setq doc (ess-eldoc-docstring-format funname doc))
|
||||
(when (and margs (< (length doc1) W))
|
||||
(setq doc1 (concat doc (propertize " || " 'face font-lock-function-name-face)))
|
||||
(while (and margs (< (length doc1) W))
|
||||
(let ((head (pop margs)))
|
||||
(unless (assoc head bargs)
|
||||
(setq doc doc1
|
||||
doc1 (concat doc1 head "=, ")))))
|
||||
(when (equal (substring doc -2) ", ")
|
||||
(setq doc (substring doc 0 -2)))
|
||||
(when (and margs (< (length doc) W))
|
||||
(setq doc (concat doc " {--}"))))
|
||||
doc))))))
|
||||
|
||||
(defun ess-eldoc-docstring-format (funname doc)
|
||||
(save-match-data
|
||||
(let* (;; (name (symbol-name sym))
|
||||
(truncate (or (not (eq t eldoc-echo-area-use-multiline-p))
|
||||
(eq ess-eldoc-abbreviation-style 'aggressive)))
|
||||
;; Subtract 1 from window width since will cause a wraparound and
|
||||
;; resize of the echo area.
|
||||
(W (1- (- (window-width (minibuffer-window))
|
||||
(+ 2 (length funname)))))
|
||||
newdoc)
|
||||
(setq doc
|
||||
(if (or (<= (length doc) W)
|
||||
(null ess-eldoc-abbreviation-style)
|
||||
(eq 'none ess-eldoc-abbreviation-style))
|
||||
doc
|
||||
;;MILD filter
|
||||
(setq doc (replace-regexp-in-string "TRUE" "T" doc))
|
||||
(setq doc (replace-regexp-in-string "FALSE" "F" doc))
|
||||
(if (or (<= (length doc) W)
|
||||
(eq 'mild ess-eldoc-abbreviation-style))
|
||||
doc
|
||||
;;NORMAL filter (deal with long defaults)
|
||||
(setq doc (replace-regexp-in-string
|
||||
;; function calls inside default docs foo(xxxx{..})
|
||||
"([^)]\\{8\\}\\([^)]\\{4,\\}\\))"
|
||||
"{.}" doc nil nil 1))
|
||||
(if (<= (length doc) W)
|
||||
doc
|
||||
(setq doc (replace-regexp-in-string
|
||||
" +[^ \t=,\"\]+=[^ \t]\\{10\\}\\([^ \t]\\{4,\\}\\)\\(,\\|\\'\\)"
|
||||
"{.}," doc nil nil 1))
|
||||
(if (<= (length doc) W)
|
||||
doc
|
||||
(setq doc (replace-regexp-in-string
|
||||
" +[^ \t=,\"]+=\\([^ \t]\\{10,\\}\\)\\(,\\|\\'\\)"
|
||||
"{.}," doc nil nil 1))
|
||||
(if (or (<= (length doc) W)
|
||||
(eq 'normal ess-eldoc-abbreviation-style))
|
||||
doc
|
||||
;;STRONG filter (replace defaults)
|
||||
(setq doc (replace-regexp-in-string
|
||||
" *[^ \t=,\"\\]* = \\([^ \t]\\{4,\\}\\)\\(,\\|\\'\\)"
|
||||
"{.}," doc nil nil 1))
|
||||
(if (<= (length doc) W)
|
||||
doc
|
||||
(setq doc (replace-regexp-in-string
|
||||
"\\(=[^FT0-9].+?\\)\\(, [^ =,\"\\]+=\\|\\'\\)"
|
||||
"" doc nil nil 1))
|
||||
(setq doc (replace-regexp-in-string
|
||||
"\\(=[^FT0-9].+?\\)\\(, [^ =,\"\\]+,\\|\\'\\)"
|
||||
"" doc nil nil 1))
|
||||
(if (or (<= (length doc) W)
|
||||
(eq 'strong ess-eldoc-abbreviation-style))
|
||||
doc
|
||||
;;AGGRESSIVE filter (truncate what is left)
|
||||
(concat (substring doc 0 (- W 4)) "{--}")))))))))
|
||||
(when (and truncate
|
||||
(> (length doc) W))
|
||||
(setq doc (concat (substring doc 0 (- W 4)) "{--}")))
|
||||
(format "%s: %s" (propertize funname 'face 'font-lock-function-name-face) doc))))
|
||||
|
||||
|
||||
;;; OBJECTS
|
||||
|
||||
(defun ess-r-object-completion ()
|
||||
"Return completions at point in a format required by `completion-at-point-functions'."
|
||||
(if (ess-make-buffer-current)
|
||||
(let* ((funstart (cdr (ess--fn-name-start)))
|
||||
(completions (ess-r-get-rcompletions funstart))
|
||||
(token (pop completions)))
|
||||
(when completions
|
||||
(list (- (point) (length token)) (point)
|
||||
completions)))
|
||||
(when (string-match "complete" (symbol-name last-command))
|
||||
(message "No ESS process associated with current buffer")
|
||||
nil)))
|
||||
|
||||
(defun ess-complete-object-name ()
|
||||
"Perform completion on `ess-language' object preceding point.
|
||||
Uses \\[ess-r-complete-object-name] when `ess-use-R-completion' is non-nil,
|
||||
or \\[ess-internal-complete-object-name] otherwise."
|
||||
(interactive)
|
||||
(if (ess-make-buffer-current)
|
||||
(if ess-use-R-completion
|
||||
(ess-r-complete-object-name)
|
||||
(ess-internal-complete-object-name))
|
||||
;; else give a message on second invocation
|
||||
(when (string-match "complete" (symbol-name last-command))
|
||||
(message "No ESS process associated with current buffer")
|
||||
nil)))
|
||||
|
||||
(defun ess-complete-object-name-deprecated ()
|
||||
"Gives a deprecated message "
|
||||
(interactive)
|
||||
(ess-complete-object-name)
|
||||
(message "C-c TAB is deprecated, completions has been moved to [M-TAB] (aka C-M-i)")
|
||||
(sit-for 2 t))
|
||||
|
||||
;; This one is needed for R <= 2.6.x -- hence *not* obsoleting it
|
||||
(defun ess-internal-complete-object-name ()
|
||||
"Perform completion on `ess-language' object preceding point.
|
||||
The object is compared against those objects known by
|
||||
`ess-get-object-list' and any additional characters up to ambiguity are
|
||||
inserted. Completion only works on globally-known objects (including
|
||||
elements of attached data frames), and thus is most suitable for
|
||||
interactive command-line entry, and not so much for function editing
|
||||
since local objects (e.g. argument names) aren't known.
|
||||
|
||||
Use \\[ess-resynch] to re-read the names of the attached directories.
|
||||
This is done automatically (and transparently) if a directory is
|
||||
modified (S only!), so the most up-to-date list of object names is always
|
||||
available. However attached dataframes are *not* updated, so this
|
||||
command may be necessary if you modify an attached dataframe."
|
||||
(interactive)
|
||||
(ess-make-buffer-current)
|
||||
(if (memq (char-syntax (preceding-char)) '(?w ?_))
|
||||
(let* ((comint-completion-addsuffix nil)
|
||||
(bounds (ess-bounds-of-symbol))
|
||||
(beg (car bounds))
|
||||
(end (cdr bounds))
|
||||
(full-prefix (buffer-substring beg end))
|
||||
(pattern full-prefix)
|
||||
;; See if we're indexing a list with `$'
|
||||
(listname (if (string-match "\\(.+\\)\\$\\(\\(\\sw\\|\\s_\\)*\\)$"
|
||||
full-prefix)
|
||||
(progn
|
||||
(setq pattern
|
||||
(if (not (match-beginning 2)) ""
|
||||
(substring full-prefix
|
||||
(match-beginning 2)
|
||||
(match-end 2))))
|
||||
(substring full-prefix (match-beginning 1)
|
||||
(match-end 1)))))
|
||||
;; are we trying to get a slot via `@' ?
|
||||
(classname (if (string-match "\\(.+\\)@\\(\\(\\sw\\|\\s_\\)*\\)$"
|
||||
full-prefix)
|
||||
(progn
|
||||
(setq pattern
|
||||
(if (not (match-beginning 2)) ""
|
||||
(substring full-prefix
|
||||
(match-beginning 2)
|
||||
(match-end 2))))
|
||||
(ess-write-to-dribble-buffer
|
||||
(format "(ess-C-O-Name : slots..) : patt=%s"
|
||||
pattern))
|
||||
(substring full-prefix (match-beginning 1)
|
||||
(match-end 1)))))
|
||||
(components (if listname
|
||||
(ess-object-names listname)
|
||||
(if classname
|
||||
(ess-slot-names classname)
|
||||
;; Default case: It hangs here when
|
||||
;; options(error=recover) :
|
||||
(ess-get-object-list ess-current-process-name)))))
|
||||
;; always return a non-nil value to prevent history expansions
|
||||
(or (completion-in-region beg end components) 'none))))
|
||||
|
||||
(defun ess-r-get-rcompletions (&optional start end prefix allow-3-dots)
|
||||
"Call R internal completion utilities (rcomp) for possible completions.
|
||||
Optional START and END delimit the entity to complete, default to
|
||||
bol and point. If PREFIX is given, perform completion on
|
||||
PREFIX. First element of the returned list is the completion
|
||||
token. Needs version of R >= 2.7.0."
|
||||
(let* ((start (or start
|
||||
(if prefix
|
||||
0
|
||||
(save-excursion (comint-bol nil) (point)))))
|
||||
(end (or end (if prefix (length prefix) (point))))
|
||||
(prefix (or prefix (buffer-substring start end)))
|
||||
;; (opts1 (if no-args "op<-rc.options(args=FALSE)" ""))
|
||||
;; (opts2 (if no-args "rc.options(op)" ""))
|
||||
(call1 (format ".ess_get_completions(\"%s\", %d)"
|
||||
(ess-quote-special-chars prefix)
|
||||
(- end start)))
|
||||
(cmd (if allow-3-dots
|
||||
(concat call1 "\n")
|
||||
(concat "local({ r <- " call1 "; r[r != '...='] })\n"))))
|
||||
(ess-get-words-from-vector cmd)))
|
||||
|
||||
(defun ess-r-complete-object-name ()
|
||||
"Completion in R via R's completion utilities (formerly 'rcompgen').
|
||||
To be used instead of ESS' completion engine for R versions >= 2.7.0."
|
||||
(interactive)
|
||||
(let ((possible-completions (ess-r-get-rcompletions))
|
||||
token-string)
|
||||
(when possible-completions
|
||||
(setq token-string (pop possible-completions))
|
||||
(or (completion-in-region (- (point) (length token-string))
|
||||
(point)
|
||||
possible-completions)
|
||||
'none))))
|
||||
|
||||
(defvar ess--cached-sp-objects nil)
|
||||
|
||||
(defun ess--get-cached-completions (prefix &optional point)
|
||||
(if (string-match-p "[]:$@[]" prefix)
|
||||
;; call proc for objects
|
||||
(cdr (ess-r-get-rcompletions nil nil prefix))
|
||||
;; else, get cached list of objects
|
||||
(with-ess-process-buffer 'no-error ;; use proc buf alist
|
||||
(ess-when-new-input last-cached-completions
|
||||
(if (and ess--cached-sp-objects
|
||||
(not (process-get *proc* 'sp-for-ac-changed?)))
|
||||
;; if global cache is already there, only re-read local .GlobalEnv
|
||||
(progn
|
||||
(unless ess-sl-modtime-alist
|
||||
;; initialize if empty
|
||||
(setq ess-sl-modtime-alist '((".GlobalEnv" nil))))
|
||||
;; fixme: Make adaptive. Not on all remotes are slow; For lots of
|
||||
;; objects in .GlobalEnv,locals could also be slow.
|
||||
(unless (file-remote-p default-directory)
|
||||
(ess-extract-onames-from-alist ess-sl-modtime-alist 1 'force)))
|
||||
(if ess--cached-sp-objects
|
||||
(ess-get-modtime-list 'ess--cached-sp-objects 'exclude-first)
|
||||
(ess-get-modtime-list)
|
||||
(setq ess--cached-sp-objects (cdr ess-sl-modtime-alist)))
|
||||
;; reread new package, but not rda, much faster and not needed anyways
|
||||
(process-put *proc* 'sp-for-ac-changed? nil)))
|
||||
(apply 'append
|
||||
(cddar ess-sl-modtime-alist) ; .GlobalEnv
|
||||
(mapcar 'cddr ess--cached-sp-objects)))))
|
||||
|
||||
|
||||
;;; ARGUMENTS
|
||||
|
||||
(defcustom ess-R-argument-suffix " = "
|
||||
"Suffix appended by `ac-source-R' and `ac-source-R-args' to candidates."
|
||||
:group 'R
|
||||
:type 'string)
|
||||
|
||||
(define-obsolete-variable-alias 'ess-ac-R-argument-suffix 'ess-R-argument-suffix "15.3")
|
||||
|
||||
(defvar ess-r--funargs-pre-cache
|
||||
'(("plot"
|
||||
(("graphics")
|
||||
(("x" . "") ("y" . "NULL") ("type" . "p") ("xlim" . "NULL") ("ylim" . "NULL") ("log" . "") ("main" . "NULL") ("sub" . "NULL") ("xlab" . "NULL") ("ylab" . "NULL")
|
||||
("ann" . "par(\"ann\")") ("axes" . "TRUE") ("frame.plot" . "axes") ("panel.first" . "NULL") ("panel.last" . "NULL") ("asp" . "NA") ("..." . ""))
|
||||
("x" "y" "..." "ci" "type" "xlab" "ylab" "ylim" "main" "ci.col" "ci.type" "max.mfrow" "ask" "mar" "oma" "mgp" "xpd" "cex.main" "verbose" "scale" "xlim" "log" "sub" "ann" "axes" "frame.plot"
|
||||
"panel.first" "panel.last" "asp" "center" "edge.root" "nodePar" "edgePar" "leaflab" "dLeaf" "xaxt" "yaxt" "horiz"
|
||||
"zero.line" "verticals" "col.01line" "pch" "legend.text" "formula" "data" "subset" "to" "from" "newpage" "vp" "labels"
|
||||
"hang" "freq" "density" "angle" "col" "border" "lty" "add" "predicted.values" "intervals" "separator" "col.predicted"
|
||||
"col.intervals" "col.separator" "lty.predicted" "lty.intervals" "lty.separator" "plot.type" "main2" "par.fit" "grid"
|
||||
"panel" "cex" "dimen" "abbrev" "which" "caption" "sub.caption" "id.n" "labels.id" "cex.id" "qqline" "cook.levels"
|
||||
"add.smooth" "label.pos" "cex.caption" "rows" "levels" "conf" "absVal" "ci.lty" "xval" "do.points" "col.points" "cex.points"
|
||||
"col.hor" "col.vert" "lwd" "set.pars" "range.bars" "col.range" "xy.labels" "xy.lines" "nc" "yax.flip" "mar.multi" "oma.multi")))
|
||||
("print"
|
||||
(("base")
|
||||
(("x" . "") ("digits" . "NULL") ("quote" . "TRUE") ("na.print" . "NULL") ("print.gap" . "NULL") ("right" . "FALSE") ("max" . "NULL") ("useSource" . "TRUE") ("..." . ""))
|
||||
("x" "..." "digits" "signif.stars" "intercept" "tol" "se" "sort" "verbose" "indent" "style" ".bibstyle" "prefix" "vsep" "minlevel" "quote" "right" "row.names" "max" "na.print" "print.gap"
|
||||
"useSource" "diag" "upper" "justify" "title" "max.levels" "width" "steps" "showEnv" "newpage" "vp" "cutoff" "max.level" "give.attr" "units" "abbrCollate" "print.x" "deparse" "locale" "symbolic.cor"
|
||||
"loadings" "zero.print" "calendar"))))
|
||||
"Alist of cached arguments for time consuming functions.")
|
||||
|
||||
|
||||
;;; HELP
|
||||
|
||||
(defun ess-r-get-object-help-string (sym)
|
||||
"Help string for ac."
|
||||
(let ((proc (ess-get-next-available-process)))
|
||||
(if (null proc)
|
||||
"No free ESS process found"
|
||||
(let ((buf (get-buffer-create " *ess-command-output*")))
|
||||
(when (string-match ":+\\(.*\\)" sym)
|
||||
(setq sym (match-string 1 sym)))
|
||||
(with-current-buffer (process-buffer proc)
|
||||
(ess-with-current-buffer buf
|
||||
(ess--flush-help-into-current-buffer sym nil t)))
|
||||
(with-current-buffer buf
|
||||
(ess-help-underline)
|
||||
(goto-char (point-min))
|
||||
(buffer-string))))))
|
||||
|
||||
(defun ess-r-get-arg-help-string (sym &optional proc)
|
||||
"Help string for ac."
|
||||
(setq sym (replace-regexp-in-string " *= *\\'" "" sym))
|
||||
(let ((proc (or proc (ess-get-next-available-process))))
|
||||
(if (null proc)
|
||||
"No free ESS process found"
|
||||
(let ((fun (car ess--fn-name-start-cache)))
|
||||
(with-current-buffer (ess-command (format ".ess_arg_help('%s','%s')\n" sym fun)
|
||||
nil nil nil nil proc)
|
||||
(goto-char (point-min))
|
||||
(forward-line)
|
||||
(buffer-substring-no-properties (point) (point-max)))))))
|
||||
|
||||
|
||||
;;; COMPANY
|
||||
;;; http://company-mode.github.io/
|
||||
|
||||
(defun company-R-objects (command &optional arg &rest ignored)
|
||||
(interactive (list 'interactive))
|
||||
(cl-case command
|
||||
(interactive (company-begin-backend 'company-R-objects))
|
||||
(prefix (unless (ess-inside-string-or-comment-p)
|
||||
(let ((start (ess-symbol-start)))
|
||||
(when start
|
||||
(buffer-substring-no-properties start (point))))))
|
||||
(candidates (let ((proc (ess-get-next-available-process)))
|
||||
(when proc
|
||||
(with-current-buffer (process-buffer proc)
|
||||
(all-completions arg (ess--get-cached-completions arg))))))
|
||||
(doc-buffer (company-doc-buffer (ess-r-get-object-help-string arg)))))
|
||||
|
||||
(defun company-R-args (command &optional arg &rest ignored)
|
||||
(interactive (list 'interactive))
|
||||
(cl-case command
|
||||
(interactive (company-begin-backend 'company-R-args))
|
||||
(prefix (unless (ess-inside-string-or-comment-p)
|
||||
(let ((start (ess-arg-start)))
|
||||
(when start
|
||||
(let ((prefix (buffer-substring-no-properties start (point))))
|
||||
(if ess-company-arg-prefix-length
|
||||
(cons prefix (>= (length prefix)
|
||||
ess-company-arg-prefix-length))
|
||||
prefix))))))
|
||||
(candidates (let* ((proc (ess-get-next-available-process))
|
||||
(args (delete "..." (nth 2 (ess-function-arguments
|
||||
(car ess--fn-name-start-cache) proc))))
|
||||
(args (mapcar (lambda (a) (concat a ess-R-argument-suffix))
|
||||
args)))
|
||||
(all-completions arg args)))
|
||||
(meta (let ((proc (ess-get-next-available-process)))
|
||||
(when (and proc
|
||||
(with-current-buffer (process-buffer proc)
|
||||
(not (file-remote-p default-directory))))
|
||||
;; fixme: ideally meta should be fetched with args
|
||||
(let ((doc (ess-r-get-arg-help-string arg proc)))
|
||||
(replace-regexp-in-string "^ +\\| +$" ""
|
||||
(replace-regexp-in-string "[ \t\n]+" " " doc))))))
|
||||
(sorted t)
|
||||
(require-match 'never)
|
||||
(doc-buffer (company-doc-buffer (ess-r-get-arg-help-string arg)))))
|
||||
|
||||
;; installed.packages maintains its own cache
|
||||
(defun company-R-library-all-completions ()
|
||||
(let ((proc (ess-get-next-available-process)))
|
||||
(when proc
|
||||
(ess-get-words-from-vector
|
||||
"local({ out <- try({rownames(installed.packages())}); print(out, max=1e6) })\n"))))
|
||||
|
||||
;; completion for library names -- only active within 'library(...)'
|
||||
(defun company-R-library (command &optional arg &rest ignored)
|
||||
(interactive (list 'interactive))
|
||||
(cl-case command
|
||||
(interactive (company-begin-backend 'company-R-library))
|
||||
(prefix (and (string= "library" (car-safe (ess--fn-name-start 'symbol)))
|
||||
(let ((start (ess-symbol-start)))
|
||||
(and start (buffer-substring start (point))))))
|
||||
(candidates (all-completions arg (company-R-library-all-completions)))
|
||||
(annotation "<package>")
|
||||
(duplicates nil)
|
||||
(sorted t)))
|
||||
|
||||
|
||||
;;; AC SOURCES
|
||||
;;; http://cx4a.org/software/auto-complete/index.html
|
||||
|
||||
(defvar ac-source-R
|
||||
'((prefix . ess-ac-start)
|
||||
;; (requires . 0) ::)
|
||||
(candidates . ess-ac-candidates)
|
||||
;; (action . ess-ac-action-args) ;; interfere with ac-fallback mechanism on RET (which is extremely annoing in inferior buffers)
|
||||
(document . ess-ac-help))
|
||||
"Combined ad-completion source for R function arguments and R objects")
|
||||
|
||||
(defun ess-ac-start ()
|
||||
(when (ess-process-live-p)
|
||||
(or (ess-arg-start)
|
||||
(ess-symbol-start))))
|
||||
|
||||
(defun ess-ac-candidates ()
|
||||
"OBJECTS + ARGS"
|
||||
(let ((args (ess-ac-args)))
|
||||
;; sort of intrusive but right
|
||||
(if (and ac-auto-start
|
||||
(< (length ac-prefix) ac-auto-start))
|
||||
args
|
||||
(if args
|
||||
(append args (ess-ac-objects t))
|
||||
(ess-ac-objects)))))
|
||||
|
||||
(defun ess-ac-help (sym)
|
||||
(if (string-match-p "= *\\'" sym)
|
||||
(ess-r-get-arg-help-string sym)
|
||||
(ess-r-get-object-help-string sym)))
|
||||
|
||||
;; OBJECTS
|
||||
(defvar ac-source-R-objects
|
||||
'((prefix . ess-symbol-start)
|
||||
;; (requires . 2)
|
||||
(candidates . ess-ac-objects)
|
||||
(document . ess-r-get-object-help-string))
|
||||
"Auto-completion source for R objects")
|
||||
|
||||
(defun ess-ac-objects (&optional no-kill)
|
||||
"Get all cached objects"
|
||||
(let ((aprf ac-prefix))
|
||||
(when (and aprf (ess-process-live-p))
|
||||
(unless no-kill ;; workaround
|
||||
(kill-local-variable 'ac-use-comphist))
|
||||
(ess--get-cached-completions aprf ac-point))))
|
||||
|
||||
;; ARGS
|
||||
(defvar ac-source-R-args
|
||||
'((prefix . ess-arg-start)
|
||||
;; (requires . 0)
|
||||
(candidates . ess-ac-args)
|
||||
;; (action . ess-ac-action-args)
|
||||
(document . ess-r-get-arg-help-string))
|
||||
"Auto-completion source for R function arguments")
|
||||
|
||||
(defun ess-ac-args ()
|
||||
"Get the args of the function when inside parentheses."
|
||||
(when (and ess--fn-name-start-cache ;; set in a call to ess-arg-start
|
||||
(ess-process-live-p))
|
||||
(let ((args (nth 2 (ess-function-arguments (car ess--fn-name-start-cache)))))
|
||||
(if args
|
||||
(set (make-local-variable 'ac-use-comphist) nil)
|
||||
(kill-local-variable 'ac-use-comphist))
|
||||
(delete "..." args)
|
||||
(mapcar (lambda (a) (concat a ess-R-argument-suffix))
|
||||
args))))
|
||||
|
||||
(defvar ess--ac-help-arg-command
|
||||
"getArgHelp('%s','%s')")
|
||||
|
||||
(provide 'ess-r-completion)
|
||||
201
elpa/ess-20180701.100/ess-r-flymake.el
Normal file
201
elpa/ess-20180701.100/ess-r-flymake.el
Normal file
@@ -0,0 +1,201 @@
|
||||
;;; ess-r-flymake.el --- A ess-r Flymake backend -*- lexical-binding: t; -*-
|
||||
;;
|
||||
;; Copyright (C) 2018 J. Alexander Branham (alex DOT branham AT gmail DOT com)
|
||||
;; Copyright (C) 2018 ESS-core team
|
||||
;; Maintainer: ESS-core <ESS-core@r-project.org>
|
||||
;;
|
||||
;; This file is NOT part of GNU Emacs.
|
||||
;;
|
||||
;; This 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, or (at your option) any later
|
||||
;; version.
|
||||
;;
|
||||
;; This 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, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
;; MA 02110-1301 USA.
|
||||
;;
|
||||
;;; Commentary:
|
||||
;;
|
||||
;; Flymake is the built-in Emacs package that supports on-the-fly
|
||||
;; syntax checking. This file adds support for this in R-mode by
|
||||
;; relying on the lintr package, available on CRAN and currently
|
||||
;; hosted at https://github.com/jimhester/lintr.
|
||||
;;
|
||||
;; It is enabled by default.
|
||||
;;
|
||||
;;; Code:
|
||||
|
||||
(require 'cl-lib)
|
||||
(require 'ess-custom)
|
||||
(require 'flymake)
|
||||
|
||||
(defcustom ess-r-flymake-linters
|
||||
'("commented_code_linter = NULL"
|
||||
"single_quotes_linter = NULL"
|
||||
"infix_spaces_linter = NULL"
|
||||
"line_length_linter = NULL"
|
||||
"object_name_linter = NULL"
|
||||
"object_usage_linter = NULL"
|
||||
"open_curly_linter = NULL"
|
||||
"pipe_continuation_linter = NULL"
|
||||
"spaces_left_parentheses_linter = NULL"
|
||||
"trailing_whitespace_linter = NULL"
|
||||
"trailing_blank_lines_linter = NULL")
|
||||
"Default linters to use.
|
||||
Can be either a string with R expression to be used as
|
||||
is (e.g. 'lintr::default_linters'). Or a list of strings where
|
||||
each element is passed as argument to 'lintr::with_defaults'."
|
||||
:group 'ess-R
|
||||
:type '(choice string (repeat string)))
|
||||
|
||||
(defcustom ess-r-flymake-lintr-cache t
|
||||
"If non-nil, cache lintr results."
|
||||
:group 'ess-R
|
||||
:type 'boolean)
|
||||
|
||||
(defvar-local ess-r--flymake-proc nil)
|
||||
|
||||
(defvar ess-r--flymake-def-linter
|
||||
(replace-regexp-in-string
|
||||
"[\n\t ]+" " "
|
||||
"esslint <- function(str, linters, cache) {
|
||||
if (!suppressWarnings(require(lintr, quietly=T))) {
|
||||
cat('@@error: @@`lintr` package not installed')
|
||||
} else {
|
||||
if (packageVersion('lintr') <= '1.0.1') {
|
||||
cat('@@error: @@Need `lintr` version > v1.0.1')
|
||||
} else {
|
||||
tryCatch(lintr::lint(commandArgs(TRUE), linters = linters, cache = cache),
|
||||
error = function(e) {
|
||||
cat('@@warning: @@', e)
|
||||
})
|
||||
}
|
||||
}
|
||||
};"))
|
||||
|
||||
(defun ess-r--flymake-linters ()
|
||||
"If `ess-r-flymake-linters' is a string, use that.
|
||||
Otherwise, construct a string to pass to lintr::with_defaults."
|
||||
(replace-regexp-in-string
|
||||
"[\n\t ]+" " "
|
||||
(if (stringp ess-r-flymake-linters)
|
||||
ess-r-flymake-linters
|
||||
(concat "lintr::with_defaults("
|
||||
(mapconcat #'identity
|
||||
ess-r-flymake-linters
|
||||
", ")
|
||||
")"))))
|
||||
|
||||
(defun ess-r--flymake-msg-type (str)
|
||||
"Transform STR into log level."
|
||||
(cond ((string= str "error: ") :error)
|
||||
((string= str "warning: ") :warning)
|
||||
((string= str "style: ") :note)
|
||||
(t (error "Invalid msg type %s" str))))
|
||||
|
||||
(defun ess-r--flymake-check-errors ()
|
||||
"Check for critical errors and return non-nil if such occurred."
|
||||
(goto-char (point-min))
|
||||
(when (re-search-forward "@@\\(\\(error\\|warning\\): \\)@@" nil t)
|
||||
(let ((type (ess-r--flymake-msg-type (match-string 1)))
|
||||
(msg (buffer-substring-no-properties (match-end 0) (point-max))))
|
||||
(flymake-log type msg)
|
||||
(eq type :error))))
|
||||
|
||||
(defun ess-r--flymake-parse-output (msg-buffer src-buffer report-fn)
|
||||
"Parse the content of MSG-BUFFER for lint locations.
|
||||
SRC-BUFFER is the original source buffer. Collect all messages
|
||||
into a list and call REPORT-FN on it."
|
||||
(with-current-buffer msg-buffer
|
||||
(if (ess-r--flymake-check-errors)
|
||||
(with-current-buffer src-buffer
|
||||
;; we are in the sentinel here; don't throw but remove our hook instead
|
||||
(remove-hook 'flymake-diagnostic-functions 'ess-r-flymake t))
|
||||
(goto-char (point-min))
|
||||
(cl-loop
|
||||
while (search-forward-regexp
|
||||
;; Regex to match the output lint() gives us.
|
||||
(rx line-start "<text>:"
|
||||
;; row
|
||||
(group-n 1 (one-or-more num)) ":"
|
||||
;; column
|
||||
(group-n 2 (one-or-more num)) ": "
|
||||
;; type
|
||||
(group-n 3 (| "style: " "warning: " "error: "))
|
||||
;; msg
|
||||
(group-n 4 (one-or-more not-newline)) line-end)
|
||||
nil t)
|
||||
for msg = (match-string 4)
|
||||
for (beg . end) = (let ((line (string-to-number (match-string 1)))
|
||||
(col (string-to-number (match-string 2))))
|
||||
(flymake-diag-region src-buffer line col))
|
||||
for type = (ess-r--flymake-msg-type (match-string 3))
|
||||
collect (flymake-make-diagnostic src-buffer beg end type msg)
|
||||
into diags
|
||||
finally (funcall report-fn diags)))))
|
||||
|
||||
(defun ess-r-flymake (report-fn &rest _args)
|
||||
"A Flymake backend for ESS-R modes. Relies on the lintr package.
|
||||
REPORT-FN is flymake's callback function."
|
||||
(unless (executable-find inferior-ess-r-program)
|
||||
(error "Cannot find program '%s'" inferior-ess-r-program))
|
||||
;; Kill the process if earlier check was found. The sentinel of the earlier
|
||||
;; check will detect this.
|
||||
(when (process-live-p ess-r--flymake-proc)
|
||||
(kill-process ess-r--flymake-proc))
|
||||
(let ((src-buffer (current-buffer)))
|
||||
(setq ess-r--flymake-proc
|
||||
(make-process
|
||||
:name "ess-r-flymake" :noquery t :connection-type 'pipe
|
||||
:buffer (generate-new-buffer "*ess-r-flymake*")
|
||||
:command (list inferior-R-program
|
||||
"--no-save" "--no-restore" "--no-site-file" "--no-init-file" "--slave"
|
||||
"-e" (concat
|
||||
ess-r--flymake-def-linter
|
||||
;; commandArgs(TRUE) returns everything after
|
||||
;; --args as a character vector
|
||||
"esslint(commandArgs(TRUE),"
|
||||
"linters = " (ess-r--flymake-linters)
|
||||
(when ess-r-flymake-lintr-cache
|
||||
", cache = TRUE")
|
||||
")")
|
||||
"--args" (buffer-substring-no-properties
|
||||
(point-min) (point-max)))
|
||||
:sentinel
|
||||
(lambda (proc _event)
|
||||
(cond
|
||||
((eq 'exit (process-status proc))
|
||||
(unwind-protect
|
||||
(if (eq proc (buffer-local-value 'ess-r--flymake-proc src-buffer))
|
||||
(ess-r--flymake-parse-output (process-buffer proc) src-buffer report-fn)
|
||||
(flymake-log :warning "Canceling obsolete check %s" proc))
|
||||
(kill-buffer (process-buffer proc))))
|
||||
((not (eq 'run (process-status proc)))
|
||||
(kill-buffer (process-buffer proc)))))))))
|
||||
|
||||
(defun ess-r-setup-flymake ()
|
||||
"Setup flymake for ESS.
|
||||
Activate flymake only if `ess-use-flymake' is non-nil."
|
||||
(when ess-use-flymake
|
||||
(when (< emacs-major-version 26)
|
||||
(error "ESS-flymake requires Emacs version 26 or later"))
|
||||
(when (string= "R" ess-dialect)
|
||||
(add-hook 'flymake-diagnostic-functions #'ess-r-flymake nil t)
|
||||
;; Try not to enable flymake if flycheck is already running:
|
||||
(unless (bound-and-true-p flycheck-mode)
|
||||
(flymake-mode)))))
|
||||
|
||||
;; Enable flymake in Emacs 26+
|
||||
(when (<= 26 emacs-major-version)
|
||||
(add-hook 'ess-mode-hook #'ess-r-setup-flymake))
|
||||
|
||||
(provide 'ess-r-flymake)
|
||||
|
||||
;;; ess-r-flymake.el ends here
|
||||
208
elpa/ess-20180701.100/ess-r-gui.el
Normal file
208
elpa/ess-20180701.100/ess-r-gui.el
Normal file
@@ -0,0 +1,208 @@
|
||||
;;; ess-r-gui.el --- Run Rgui on Windows as an inferior Emacs process
|
||||
|
||||
;; Copyright (C) 2008 A.J. Rossini, Richard M. Heiberger, Martin
|
||||
;; Maechler, Kurt Hornik, Rodney Sparapani, and Stephen Eglen.
|
||||
|
||||
;; Author: Richard M. Heiberger <rmh@temple.edu>
|
||||
;; Created: 10 Mar 2008
|
||||
;; Maintainer: ESS-core <ESS-core@r-project.org>
|
||||
|
||||
;; 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/
|
||||
|
||||
;;; Commentary:
|
||||
|
||||
;; In Rgui:
|
||||
;; > library(tcltk2) ## >= 1.0-6
|
||||
;; > .ess.command <- function() source("c:/temp/ess-tempfile.R", echo=TRUE)
|
||||
;; > tclFun(.ess.command)
|
||||
;; [1] "R_call 0203A04C"
|
||||
|
||||
;;; Code:
|
||||
|
||||
(require 'ess-dde) ;; needed here because we override several definitions
|
||||
(require 'ess-r-mode)
|
||||
|
||||
(defun ess-ddeclient-p ()
|
||||
"Returns the name of the ddeclient iff `ess-local-process-name'
|
||||
is associated with an `inferior-ess-ddeclient', and nil if the
|
||||
ess-process is running as an ordinary inferior process. Alway
|
||||
nil on Unix machines."
|
||||
(interactive)
|
||||
(if ess-microsoft-p
|
||||
(let ((ess-ddeclient (ess-get-process-variable 'inferior-ess-ddeclient)))
|
||||
(if (not (equal ess-ddeclient (default-value 'inferior-ess-ddeclient)))
|
||||
ess-ddeclient))))
|
||||
|
||||
(defvar ess-command-file "c:/temp/ess-tempfile.R"
|
||||
"File name for communication with Rgui.")
|
||||
(defvar inferior-ess-execdde
|
||||
(concat (getenv "R_HOME") "/site-library/tcltk2/bin/execdde.exe")
|
||||
"Full pathname to execdde executable.")
|
||||
(defvar ess-rgui-command " -s TclEval -t R -c .ess.command > NUL"
|
||||
"Command to `inferior-ess-execdde' that will make Rgui read the command file.")
|
||||
|
||||
|
||||
(defun ess-eval-region-execdde (start end even-empty)
|
||||
"Loop through lines in region and send them to ESS via execdde."
|
||||
(setq ;; set the following variables for the current ddeESS process.
|
||||
inferior-ess-ddeclient (ess-get-process-variable 'inferior-ess-ddeclient)
|
||||
)
|
||||
(write-region start end ess-command-file nil nil 'no-message)
|
||||
(call-process-shell-command
|
||||
(concat inferior-ess-execdde ess-rgui-command))
|
||||
)
|
||||
|
||||
|
||||
(if (not (getenv "R_HOME")) (setenv "R_HOME" "c:/progra~1/R/R-2.6.1"))
|
||||
;; ^^^^^^^^^ FIXME! do something better
|
||||
(defvar inferior-Rgui-program "cmd" "Rgui program name")
|
||||
(defvar Rgui-pager "emacsclientw.exe" "Rgui pager program")
|
||||
(defvar inferior-ess-language-start-rgui
|
||||
"options(chmhelp=FALSE, htmlhelp=FALSE, help_type='text'); require(tcltk2)"
|
||||
"additional arguments to rgui")
|
||||
|
||||
(defun ess-dde-rgui-send-region (proc start end &optional visibly message)
|
||||
"Loop through lines in region and send them to ESS via ddeclient.
|
||||
|
||||
PROC, VISIBLY and MESSAGE are ignored."
|
||||
(setq ;; set the following variables for the current ddeESS process.
|
||||
inferior-ess-ddeclient (ess-get-process-variable 'inferior-ess-ddeclient)
|
||||
inferior-ess-client-name (ess-get-process-variable 'inferior-ess-client-name)
|
||||
inferior-ess-client-command (ess-get-process-variable 'inferior-ess-client-command))
|
||||
(narrow-to-region start end)
|
||||
(goto-char (point-min))
|
||||
|
||||
(if (equal inferior-ess-ddeclient "execdde")
|
||||
(ess-eval-region-execdde start end 'even-empty)
|
||||
|
||||
(let ((beg))
|
||||
(while (or (< (point) (point-max))
|
||||
(= 1 (point-max)))
|
||||
(setq beg (point))
|
||||
(end-of-line)
|
||||
;; call-process-region won't send over a 0-character line.
|
||||
;; We go outside the loop to create a 1-character line " " in the
|
||||
;; *ESS-temporary* buffer
|
||||
(if (= beg (point)) ;; do empty line outside loop
|
||||
(ess-dde-eval-linewise " " nil 'eob t)
|
||||
(call-process-region
|
||||
beg (point)
|
||||
inferior-ess-ddeclient nil nil nil
|
||||
inferior-ess-client-name inferior-ess-client-command))
|
||||
(forward-line 1))))
|
||||
(widen))
|
||||
|
||||
|
||||
|
||||
(defvar Rgui-customize-alist
|
||||
(append
|
||||
'((ess-local-customize-alist . 'Rgui-customize-alist)
|
||||
(ess-dialect . "R")
|
||||
(ess-suffix . "R")
|
||||
(ess-dump-filename-template . (replace-regexp-in-string
|
||||
"S$" ess-suffix ; in the one from custom:
|
||||
ess-dump-filename-template-proto))
|
||||
(ess-mode-syntax-table . ess-r-syntax-table)
|
||||
(ess-mode-editing-alist . ess-r-editing-alist)
|
||||
(ess-change-sp-regexp . ess-r-change-sp-regexp)
|
||||
(ess-help-sec-regex . ess-help-r-sec-regex)
|
||||
(ess-help-sec-keys-alist . ess-help-r-sec-keys-alist)
|
||||
(ess-loop-timeout . ess-S-loop-timeout);fixme: dialect spec.
|
||||
(ess-function-pattern . ess-r-function-pattern)
|
||||
(ess-object-name-db-file . "ess-r-namedb.el" )
|
||||
(ess-send-region-function . #'ess-dde-rgui-send-region)
|
||||
(ess-load-file-function . #'ess-dde-load-file)
|
||||
(ess-command-function . #'ess-dde-command)
|
||||
(ess-eval-linewise-function . #'ess-dde-eval-linewise)
|
||||
(ess-dump-object-function . #'ess-dde-dump-object)
|
||||
(ess-read-object-name-function . #'ess-dde-read-object-name)
|
||||
(ess-find-help-file-function . #'ess-dde-find-help-file)
|
||||
(ess-display-help-on-object-function . #'ess-dde-display-help-on-object)
|
||||
(inferior-ess-program . inferior-Rgui-program)
|
||||
(inferior-ess-objects-command . inferior-ess-r-objects-command)
|
||||
(inferior-ess-font-lock-keywords . 'inferior-ess-r-font-lock-keywords)
|
||||
(inferior-ess-search-list-command . "search()\n")
|
||||
(inferior-ess-help-command . "help(\"%s\")\n")
|
||||
(inferior-ess-help-filetype . nil) ;; "chm") ;;?
|
||||
(inferior-ess-exit-command . "q()")
|
||||
(inferior-ess-exit-prompt . "Save workspace image? [y/n/c]: ")
|
||||
(inferior-ess-primary-prompt . "\\([A-Z/][][A-Za-z0-9./]*\\)*[>$] ")
|
||||
(inferior-ess-secondary-prompt . "+ ?")
|
||||
;;harmful for shell-mode's C-a: -- but "necessary" for ESS-help?
|
||||
(inferior-ess-start-file . nil) ;; "~/.ess-R"
|
||||
(inferior-ess-start-args . "")
|
||||
(inferior-ess-ddeclient . "execdde")
|
||||
(ess-STERM . "ddeSS")
|
||||
(ess-editor . ess-r-editor)
|
||||
(ess-pager . Rgui-pager)
|
||||
)
|
||||
S-common-cust-alist)
|
||||
"Variables to customize for Rgui")
|
||||
|
||||
|
||||
(defun Rgui (&optional proc-name)
|
||||
"Call 'Rgui for Windows'. Put R in an independent MS-Window (R
|
||||
persists even if the '(ddeESS [R])' window is killed in emacs).
|
||||
Do this by creating a comint process that calls cmd. This is a
|
||||
placeholder buffer with mode '(ddeESS [R])'. Commands sent from
|
||||
an (ESS[S] [R]) buffer to this process will be sourced into the
|
||||
independent Rgui R Console."
|
||||
(interactive)
|
||||
(save-excursion
|
||||
(setq ess-customize-alist Rgui-customize-alist)
|
||||
(ess-write-to-dribble-buffer
|
||||
(format "\n(Rgui): ess-dialect=%s, buf=%s\n" ess-dialect
|
||||
(current-buffer)))
|
||||
(setq ess-customize-alist ; change inferior-ess-primary-prompt
|
||||
(append ess-customize-alist '((inferior-ess-primary-prompt . "^"))))
|
||||
(when
|
||||
;; Silence byte compiler warns about this function
|
||||
(fboundp 'w32-short-file-name)
|
||||
(let ((default-ddeclient (default-value 'inferior-ess-ddeclient)))
|
||||
(cd (w32-short-file-name (directory-file-name default-directory)))
|
||||
;; (setenv "S_PROJ" default-directory)
|
||||
(setq-default inferior-ess-ddeclient "execdde")
|
||||
(inferior-ess)
|
||||
(setq-default inferior-ess-ddeclient default-ddeclient)
|
||||
(sleep-for 2) ; need to wait, else working too fast!
|
||||
))
|
||||
(setq comint-process-echoes nil)
|
||||
|
||||
;; *R* buffer
|
||||
(goto-char (point-min))
|
||||
(insert
|
||||
"This is a placeholder buffer. You can't type anything here.\n
|
||||
You may ignore the 'options' error in this buffer.\n\n")
|
||||
(goto-char (point-max))
|
||||
(set-buffer-process-coding-system 'raw-text-dos 'raw-text-unix)
|
||||
(setq buffer-read-only t) ; force buffer to be read-only
|
||||
(setq mode-name "ddeESS")
|
||||
|
||||
;; initialization
|
||||
(set-buffer (find-file-noselect ess-command-file 'nowarn))
|
||||
(erase-buffer)
|
||||
(setq ;; set the following variables for the current ddeESS process.
|
||||
inferior-ess-language-start (ess-get-process-variable 'inferior-ess-language-start))
|
||||
(if inferior-ess-language-start
|
||||
(insert inferior-ess-language-start))
|
||||
(if inferior-ess-language-start-rgui
|
||||
(insert (concat "\n" inferior-ess-language-start-rgui)))
|
||||
(save-buffer 0)
|
||||
(call-process-shell-command
|
||||
(concat inferior-ess-execdde ess-rgui-command))
|
||||
))
|
||||
|
||||
;;; ess-r-gui.el ends here
|
||||
2234
elpa/ess-20180701.100/ess-r-mode.el
Normal file
2234
elpa/ess-20180701.100/ess-r-mode.el
Normal file
File diff suppressed because it is too large
Load Diff
547
elpa/ess-20180701.100/ess-r-package.el
Normal file
547
elpa/ess-20180701.100/ess-r-package.el
Normal file
@@ -0,0 +1,547 @@
|
||||
;;; ess-r-package.el --- Package development mode for R.
|
||||
|
||||
;; Copyright (C) 2011-2015 Lionel Henry, Vitalie Spinu, A.J. Rossini, Richard
|
||||
;; M. Heiberger, Martin Maechler, Kurt Hornik, Rodney Sparapani, and
|
||||
;; Stephen Eglen.
|
||||
|
||||
;; Author: Lionel Henry, Vitalie Spinu
|
||||
;; Maintainer: ESS-core <ESS-core@r-project.org>
|
||||
|
||||
;; Keywords: languages, tools
|
||||
|
||||
;; 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/
|
||||
|
||||
;;; Commentary:
|
||||
|
||||
;; see apropriate documentation section of ESS user manual
|
||||
|
||||
;;; Code:
|
||||
|
||||
(require 'ess-utils)
|
||||
|
||||
(defcustom ess-r-package-auto-enable-namespaced-evaluation t
|
||||
"If non-nil, evaluation env is set to package env automatically.
|
||||
See also `ess-r-set-evaluation-env' and `ess-r-evaluation-env'."
|
||||
:group 'ess-r-package
|
||||
:type 'boolean)
|
||||
|
||||
(defvar-local ess-r-package--project-cache nil
|
||||
"Current package info cache.
|
||||
|
||||
Cons cell of two strings. CAR is the package name active in the
|
||||
current buffer. CDR is the path to its source directory.")
|
||||
|
||||
(defcustom ess-r-package-library-paths nil
|
||||
"Default path to find user packages.
|
||||
Can be either a string specifying a directory or a list of directories."
|
||||
:group 'ess-r-package-library-paths
|
||||
:type `(choice string (repeat string)))
|
||||
(define-obsolete-variable-alias 'ess-r-package-library-path 'ess-r-package-library-paths "v18.04")
|
||||
|
||||
(defvar ess-r-package-root-file "DESCRIPTION"
|
||||
"Presence of this file indicates the project's root.")
|
||||
|
||||
(defvar ess-r-package-dirs
|
||||
'(("R" . 1)
|
||||
("r" . 1)
|
||||
("tests" . 1)
|
||||
("testthat" . 2)
|
||||
("inst" . 1)
|
||||
("include" . 2)
|
||||
("src" . 1))
|
||||
"Alist of directories names and their depth in R package hierarchy.
|
||||
This list is used to figure out whether the current file belongs
|
||||
to an R package. If the file specified in `ess-r-package-root-file'
|
||||
\(DESCRIPTION by default) is found at the presumed root directory
|
||||
of the package, the current directory is considered to be part of
|
||||
a R package.")
|
||||
|
||||
(defvar ess-r-package-source-roots
|
||||
'("R" "src" "tests" "inst/include")
|
||||
"List of sub-directories within R package where source files are located.
|
||||
All children of these directories are also considered source
|
||||
containing directories. Use `ess-r-package-source-dirs' to get
|
||||
all source dirs recursively within the current package.")
|
||||
|
||||
|
||||
;;;*;;; Package Detection
|
||||
|
||||
(defun ess-r-package-project (&optional dir)
|
||||
"Return the current package as an Emacs project instance.
|
||||
A project instance is a cons cell of the project name as symbol
|
||||
and the project path as string. If DIR is provided, the package
|
||||
is searched from that directory instead of `default-directory'."
|
||||
(if (car ess-r-package--project-cache)
|
||||
ess-r-package--project-cache
|
||||
(let* ((pkg-path (ess-r-package--find-package-path (or dir default-directory)))
|
||||
(project (when pkg-path
|
||||
(cons (ess-r-package--find-package-name pkg-path) pkg-path))))
|
||||
;; Cache info for better performance on remotes
|
||||
(setq-local ess-r-package--project-cache (or project (list nil)))
|
||||
(when (car project)
|
||||
(cons 'r-package (cdr project))))))
|
||||
|
||||
(defun ess-r-package-name (&optional dir)
|
||||
"Return the name of the current package as a string."
|
||||
(let ((project (ess-r-package-project dir)))
|
||||
(when project
|
||||
(symbol-name (car ess-r-package--project-cache)))))
|
||||
|
||||
(defun ess-r-package-get-info ()
|
||||
"Deprecated function to get package info.
|
||||
Please use `ess-r-package-project' instead."
|
||||
(let ((project (ess-r-package-project)))
|
||||
(if project
|
||||
(cons (ess-r-package-name) (cdr project))
|
||||
(list nil))))
|
||||
(make-obsolete 'ess-r-package-get-info 'ess-r-package-project "17.11")
|
||||
|
||||
(defun ess-r-package--all-source-dirs (dir)
|
||||
(when (file-exists-p dir)
|
||||
(cl-loop for f in (directory-files-and-attributes dir t "^[^.]")
|
||||
if (cadr f)
|
||||
append (cons (car f) (ess-r-package--all-source-dirs (car f))))))
|
||||
|
||||
(defun ess-r-package-source-dirs ()
|
||||
"Get paths within current R package with source files.
|
||||
Return nil if not in a package. Search sub-directories listed in
|
||||
`ess-r-package-source-roots' are searched recursively and
|
||||
return all physically present directories."
|
||||
(let ((pkg-root (cdr (ess-r-package-project))))
|
||||
(when pkg-root
|
||||
(let ((files (directory-files-and-attributes pkg-root t "^[^.]")))
|
||||
(cl-loop for f in files
|
||||
if (and (cadr f)
|
||||
(cl-some (lambda (el) (string-match-p (concat "/" el "$") (car f)))
|
||||
ess-r-package-source-roots))
|
||||
append (cons (car f)
|
||||
(ess-r-package--all-source-dirs (car f))))))))
|
||||
|
||||
(defun ess-r--select-package-name ()
|
||||
(inferior-ess-r-force)
|
||||
(let ((pkgs (ess-get-words-from-vector
|
||||
(format "print(.packages(%s), max = 1e6)\n"
|
||||
(if ess-r-prompt-for-attached-pkgs-only "FALSE" "TRUE"))))
|
||||
(current-pkg (ess-r-package-name)))
|
||||
(let ((env (ess-r-get-evaluation-env)))
|
||||
(when env
|
||||
(setq pkgs (append '("*none*") pkgs))
|
||||
(when (equal env current-pkg)
|
||||
(setq current-pkg "*none*"))))
|
||||
(ess-completing-read "Package" pkgs nil nil nil nil current-pkg)))
|
||||
|
||||
(defun ess-r-package--find-package-path (&optional dir)
|
||||
"Get the root of R package that contains current directory.
|
||||
Root is determined by locating `ess-r-package-root-file'."
|
||||
(let* ((path (cond
|
||||
(dir)
|
||||
((buffer-file-name)
|
||||
(file-name-directory (buffer-file-name)))
|
||||
(t
|
||||
default-directory)))
|
||||
(pkg-path
|
||||
(when path
|
||||
(or
|
||||
;; First check current directory
|
||||
(and (file-exists-p (expand-file-name ess-r-package-root-file path))
|
||||
path)
|
||||
;; Check for known directories in current path
|
||||
(let ((current-dir (file-name-nondirectory (directory-file-name path)))
|
||||
known-pkg-dir known-path presumptive-path)
|
||||
(while (and path (not presumptive-path))
|
||||
(setq current-dir (file-name-nondirectory (directory-file-name path)))
|
||||
(if (and (setq known-pkg-dir (assoc current-dir ess-r-package-dirs))
|
||||
(setq known-path (ess--parent-dir path (cdr known-pkg-dir)))
|
||||
(file-exists-p (expand-file-name ess-r-package-root-file known-path)))
|
||||
(setq presumptive-path known-path)
|
||||
(setq path (ess--parent-dir path 1))))
|
||||
presumptive-path)))))
|
||||
(when pkg-path
|
||||
(directory-file-name pkg-path))))
|
||||
|
||||
(defun ess-r-package--find-package-name (path)
|
||||
(let ((file (expand-file-name ess-r-package-root-file path))
|
||||
(case-fold-search t))
|
||||
(when (file-exists-p file)
|
||||
(with-temp-buffer
|
||||
(insert-file-contents file)
|
||||
(goto-char (point-min))
|
||||
(when (re-search-forward "package: \\(.*\\)" nil t)
|
||||
(intern (match-string 1)))))))
|
||||
|
||||
|
||||
;;;*;;; UI
|
||||
|
||||
(defun ess-r-package-use-dir ()
|
||||
"Set process directory to current package directory."
|
||||
(interactive)
|
||||
(let ((dir (cdr (ess-r-package-project))))
|
||||
(ess-set-working-directory dir)))
|
||||
|
||||
(defun ess-r-package-set-package ()
|
||||
"Set a package for ESS r-package commands."
|
||||
(interactive)
|
||||
(let* ((pkg-path (read-directory-name
|
||||
"Path: " (or (ess-r-package--find-package-path)
|
||||
(if (stringp ess-r-package-library-paths)
|
||||
ess-r-package-library-paths
|
||||
(car ess-r-package-library-paths)))
|
||||
nil t))
|
||||
(pkg-name (ess-r-package--find-package-name pkg-path))
|
||||
(pkg-info (cons pkg-name pkg-path)))
|
||||
(unless (and pkg-name pkg-path
|
||||
(file-exists-p (expand-file-name ess-r-package-root-file pkg-path)))
|
||||
(error "Not a valid package. No '%s' found in `%s'." ess-r-package-root-file pkg-path))
|
||||
(message (format "%s selected and added to file-local variables" pkg-name))
|
||||
(save-excursion
|
||||
(add-file-local-variable 'ess-r-package--project-cache pkg-info))
|
||||
(setq ess-r-package--project-cache pkg-info)))
|
||||
|
||||
|
||||
;;;*;;; Evaluation
|
||||
|
||||
(defun ess-r-package-enable-namespaced-evaluation ()
|
||||
"Enable namespaced evaluation in current buffer.
|
||||
Namespaced evaluation is enabled if
|
||||
`ess-r-package-auto-enable-namespaced-evaluation' is non-nil."
|
||||
(when ess-r-package-auto-enable-namespaced-evaluation
|
||||
(let ((path (cdr (ess-r-package-project))))
|
||||
;; Check that we are in a file within R/
|
||||
(when (and path
|
||||
(let ((subpath (substring default-directory
|
||||
(1+ (length path))
|
||||
(length default-directory))))
|
||||
(when (> (length subpath) 1)
|
||||
(string= (substring subpath 0 2)
|
||||
(file-name-as-directory "R")))))
|
||||
(ess-r-set-evaluation-env (ess-r-package-name))))))
|
||||
|
||||
(add-hook 'R-mode-hook 'ess-r-package-enable-namespaced-evaluation)
|
||||
|
||||
(defun ess-r-package-eval-linewise (command &optional msg p actions pkg-path)
|
||||
"Send COMMAND to R process.
|
||||
COMMAND is a command string with %s placeholder for the
|
||||
arguments. MSG is the message displayed in minibuffer with %s
|
||||
placeholder for the package name. P is the value of universal
|
||||
argument usually received from the upstream command and indicates
|
||||
which action in ACTIONS list to perform; if 0 or nil, first
|
||||
action, if 1 or (4) second if 2 or (16) third etc. ACTIONS is a
|
||||
list of strings (R arguments), or functions which return R
|
||||
arguments, or expressions which return R arguments."
|
||||
(inferior-ess-r-force)
|
||||
(let* ((pkg-info (or (ess-r-package-project)
|
||||
(ess-r-package-set-package)))
|
||||
(pkg-name (ess-r-package-name))
|
||||
(pkg-path (or pkg-path (concat "'" (cdr pkg-info) "'")))
|
||||
(args (ess-r-command--build-args p actions)))
|
||||
(message msg pkg-name)
|
||||
(with-ess-process-buffer nil
|
||||
(setq ess-r-package--project-cache ess-r-package--project-cache))
|
||||
(ess-show-buffer (ess-get-process-buffer))
|
||||
(ess-eval-linewise (format command (concat pkg-path args)))))
|
||||
|
||||
(defun ess-r-command--build-args (ix &optional actions)
|
||||
(let* ((n (cond ((null ix) 0)
|
||||
((listp ix) (round (log (car ix) 4)))
|
||||
((integerp ix) ix)
|
||||
(t (error "Invalid index"))))
|
||||
(action (nth n actions))
|
||||
(args (cond ((null action) "")
|
||||
((stringp action) action)
|
||||
((functionp action) (funcall action))
|
||||
((listp action) (eval action))
|
||||
(t (error "Invalid action")))))
|
||||
(if (string= "" args)
|
||||
args
|
||||
(concat ", " args))))
|
||||
|
||||
|
||||
;;;*;;; Devtools Integration
|
||||
|
||||
(defun ess-r-devtools-load-package (&optional arg)
|
||||
"Interface for `devtools::load_all()'.
|
||||
With prefix ARG ask for extra args."
|
||||
(interactive "P")
|
||||
(ess-r-package-eval-linewise
|
||||
"devtools::load_all(%s)\n" "Loading %s" arg
|
||||
'("" (read-string "Arguments: " "recompile = TRUE"))))
|
||||
|
||||
(defun ess-r-devtools-unload-package ()
|
||||
"Interface to `devtools::unload()'."
|
||||
(interactive)
|
||||
(ess-r-package-eval-linewise
|
||||
"devtools::unload(%s)\n" "Unloading %s"))
|
||||
|
||||
(defun ess-r-devtools-check-package (&optional arg)
|
||||
"Interface for `devtools::check()'.
|
||||
With prefix ARG ask for extra args."
|
||||
(interactive "P")
|
||||
(ess-r-package-eval-linewise
|
||||
"devtools::check(%s)\n" "Checking %s" arg
|
||||
'("" (read-string "Arguments: " "vignettes = FALSE"))))
|
||||
|
||||
(defun ess-r-devtools-check-with-winbuilder (&optional arg)
|
||||
"Interface for `devtools::buildwin()'.
|
||||
With prefix ARG build with R-devel instead of R-patched."
|
||||
(interactive "P")
|
||||
(ess-r-package-eval-linewise
|
||||
"devtools::build_win(%s)\n" "Checking %s on CRAN's Windows server" arg
|
||||
'("" "version = 'R-devel'")))
|
||||
|
||||
(defvar ess-r-rhub--history nil)
|
||||
(declare-function ess-r-check-install-package "ess-r-mode.el")
|
||||
(defun ess-r-rhub-check-package (&optional arg)
|
||||
"Interface for `rhub::check()'.
|
||||
With prefix ARG run with `valgrind = TRUE'."
|
||||
(interactive "P")
|
||||
(ess-r-check-install-package "rhub")
|
||||
(let* ((platforms (ess-get-words-from-vector "rhub::platforms()$name\n"))
|
||||
(platform (completing-read "Platform: " platforms nil t nil
|
||||
ess-r-rhub--history (car ess-r-rhub--history)))
|
||||
(cmd (format "rhub::check_for_cran(%%s, platform = '%s')\n" platform))
|
||||
(msg (format "Checking %%s on RHUB (%s)" platform)))
|
||||
(ess-r-package-eval-linewise cmd msg arg '("" "valgrind = TRUE"))))
|
||||
|
||||
(defun ess-r-devtools-build (&optional arg)
|
||||
"Interface for `devtools::build()'.
|
||||
With prefix arg, build with 'vignettes = FALSE'."
|
||||
(interactive "P")
|
||||
(ess-r-package-eval-linewise
|
||||
"devtools::build(%s)\n" "Building %s" arg
|
||||
'("" "vignettes = FALSE")))
|
||||
|
||||
(defun ess-r-devtools-test-package (&optional arg)
|
||||
"Interface for `devtools::test()'.
|
||||
With prefix argument ARG, run tests on current file only."
|
||||
(interactive "P")
|
||||
(ess-r-package-eval-linewise
|
||||
"devtools::test(%s)\n" "Testing %s" arg
|
||||
'("" ess-r-devtools--cur-file-filter)))
|
||||
|
||||
(defun ess-r-devtools--cur-file-filter ()
|
||||
(let ((file (or (and buffer-file-name
|
||||
(file-name-nondirectory buffer-file-name))
|
||||
(error "Buffer not visiting a file"))))
|
||||
(format "filter = \"%s\""
|
||||
(if (string-match "test-\\([[:alnum:]]+\\)\\.[rR]" file)
|
||||
(match-string-no-properties 1 file)
|
||||
(file-name-base buffer-file-name)))))
|
||||
|
||||
(defvar ess-r-devtools-revdep-check-cmd
|
||||
"local({
|
||||
pkg_path <- %s
|
||||
res <- devtools::revdep_check(pkg_path)
|
||||
|
||||
if (file.exists(file.path(pkg_path, 'revdep'))) {
|
||||
save_path <- file.path(pkg_path, 'revdep')
|
||||
} else {
|
||||
save_path <- file.path(pkg_path, '.metadata', 'revdep')
|
||||
}
|
||||
devtools::revdep_check_save_summary(res, save_path)
|
||||
|
||||
logs_path <- file.path(save_path, 'logs')
|
||||
if (!dir.exists(logs_path)) {
|
||||
dir.create(logs_path)
|
||||
}
|
||||
devtools::revdep_check_save_logs(res, logs_path)
|
||||
})
|
||||
")
|
||||
|
||||
(defun ess-r-devtools-document-package (&optional arg)
|
||||
"Interface for `devtools::document()'.
|
||||
With prefix ARG ask for extra arguments."
|
||||
(interactive "P")
|
||||
(ess-r-package-eval-linewise
|
||||
"devtools::document(%s)\n" "Documenting %s" arg
|
||||
'("" (read-string "Arguments: "))))
|
||||
|
||||
(defun ess-r-devtools-install-package (&optional arg)
|
||||
"Interface to `devtools::install()'.
|
||||
On prefix ARG (C-u), build the package first outside of current
|
||||
tree (local = FALSE). With double prefix ARG (C-u C-u) install
|
||||
quickly (quick = TRUE, upgrade_dependencies = FALSE)."
|
||||
(interactive "P")
|
||||
(ess-r-package-eval-linewise
|
||||
"devtools::install(%s)\n" "Installing %s" arg
|
||||
'("quick = TRUE, upgrade_dependencies = FALSE, keep_source = TRUE"
|
||||
(read-string "Arguments: " "keep_source = TRUE")
|
||||
(read-string "Arguments: " "local = FALSE, keep_source = TRUE"))))
|
||||
|
||||
(defvar ess-r-devtools--install-github-history nil)
|
||||
(defun ess-r-devtools-install-github (&optional arg)
|
||||
"Interface to `devtools::install_github()'.
|
||||
Asks for github repository in the form of user/repo. Force
|
||||
re-installation when called with a prefix ARG."
|
||||
(interactive "P")
|
||||
(let ((command "devtools::install_github(%s)")
|
||||
(repo (format "'%s'"
|
||||
(read-string "User/Repo: " nil
|
||||
'ess-r-devtools--install-github-history
|
||||
(car ess-r-devtools--install-github-history)))))
|
||||
(ess-r-package-eval-linewise
|
||||
command "Installing '%s' from github" arg
|
||||
'("" (read-string "Arguments: " "force = TRUE"))
|
||||
repo)))
|
||||
|
||||
(defun ess-r-devtools-create-package ()
|
||||
"Interface to `devtools::create()'.
|
||||
Default location is determined by the first element of
|
||||
`ess-r-package-library-paths'."
|
||||
(interactive)
|
||||
(let* ((command "devtools::create(\"%s\")")
|
||||
(default-path (if (stringp ess-r-package-library-paths)
|
||||
ess-r-package-library-paths
|
||||
(car ess-r-package-library-paths)))
|
||||
(path (read-directory-name "Path: " default-path)))
|
||||
(ess-eval-linewise (format command path))))
|
||||
|
||||
(defun ess-r-devtools-execute-command (&optional arg)
|
||||
"Asks with completion for a devtools command.
|
||||
When called with prefix ARG asks for additional arguments."
|
||||
(interactive "P")
|
||||
(inferior-ess-r-force)
|
||||
(let* ((devtools-funs (ess-get-words-from-vector ".ess_devtools_functions()\n"))
|
||||
(fun (completing-read "Function: " devtools-funs))
|
||||
(command (format "devtools::%s(%%s)\n" fun)))
|
||||
(ess-r-package-eval-linewise
|
||||
command (format "Running %s" fun) arg
|
||||
'("" (read-string "Arguments: ")))))
|
||||
|
||||
|
||||
;;;*;;; Minor Mode
|
||||
|
||||
(defcustom ess-r-package-auto-activate t
|
||||
"If non-nil, `ess-r-package-mode' is turned on within R packages.
|
||||
If `t' the minor mode auto-activates in R packages. See
|
||||
`ess-r-package-exclude-modes' if you wish to inhibit
|
||||
`ess-r-package-mode' in specific buffers."
|
||||
:group 'ess-r-package
|
||||
:type 'boolean)
|
||||
|
||||
(defcustom ess-r-package-exclude-modes '(fundamental-mode)
|
||||
"A list of modes where `ess-r-package' must not be activated.
|
||||
The check is done with `derived-mode-p'."
|
||||
:group 'ess-r-package
|
||||
:type '(repeat symbol))
|
||||
|
||||
(defcustom ess-r-package-enter-hook nil
|
||||
"Normal hook run on entering `ess-r-package-mode'."
|
||||
:group 'ess-r-package
|
||||
:type 'hook)
|
||||
|
||||
(defcustom ess-r-package-exit-hook nil
|
||||
"Normal hook run on exiting `ess-r-package-mode'."
|
||||
:group 'ess-r-package
|
||||
:type 'hook)
|
||||
|
||||
(defcustom ess-r-package-mode-line
|
||||
;; FIXME Emacs 25.1: Use `when-let'
|
||||
'(:eval (let ((pkg-name (ess-r-package-name)))
|
||||
(when pkg-name
|
||||
(format " [pkg:%s]" pkg-name))))
|
||||
"Mode line for ESS developer. Set this variable to nil to
|
||||
disable the mode line entirely."
|
||||
:group 'ess-r-package
|
||||
:type 'sexp
|
||||
:risky t)
|
||||
|
||||
(defvar ess-r-package-mode-map
|
||||
(let ((ess-r-package-mode-map (make-sparse-keymap)))
|
||||
(define-key ess-r-package-mode-map "\C-c\C-w" 'ess-r-package-dev-map)
|
||||
ess-r-package-mode-map))
|
||||
|
||||
(define-minor-mode ess-r-package-mode
|
||||
"Minor mode for enabling R package development features.
|
||||
|
||||
\\{ess-r-package-mode-map}"
|
||||
:init-value nil
|
||||
:keymap ess-r-package-mode-map
|
||||
:lighter ess-r-package-mode-line
|
||||
(if ess-r-package-mode
|
||||
(progn
|
||||
(add-hook 'project-find-functions #'ess-r-package-project)
|
||||
(run-hooks 'ess-r-package-enter-hook))
|
||||
(remove-hook 'project-find-functions #'ess-r-package-project)
|
||||
(run-hooks 'ess-r-package-exit-hook)))
|
||||
|
||||
(add-hook 'after-change-major-mode-hook 'ess-r-package-auto-activate)
|
||||
|
||||
|
||||
;;;*;;; Activation
|
||||
|
||||
(defun ess-r-package-auto-activate ()
|
||||
"Activate developer if current file is part of a package."
|
||||
(when (and ess-r-package-auto-activate
|
||||
(or (buffer-name) default-directory)
|
||||
(not (eq major-mode 'minibuffer-inactive-mode))
|
||||
(or
|
||||
;; users probably have these in fundamental mode
|
||||
(member (buffer-name) '("DESCRIPTION" "NAMESPACE"))
|
||||
(if ess-r-package-exclude-modes
|
||||
(not (apply #'derived-mode-p ess-r-package-exclude-modes))
|
||||
t)))
|
||||
(let ((pkg-info (ess-r-package-project)))
|
||||
(when pkg-info
|
||||
(ess-r-package-mode 1)))))
|
||||
|
||||
(defun ess-r-package-re-activate ()
|
||||
"Restart `ess-r-package-mode'.
|
||||
First, deactivate package mode if active, and activate if in
|
||||
package mode. Use this function if state of the buffer such as
|
||||
`default-directory' has changed."
|
||||
(when ess-r-package-mode
|
||||
(ess-r-package-mode -1))
|
||||
(setq ess-r-package--project-cache nil)
|
||||
(ess-r-package-auto-activate))
|
||||
|
||||
(defvar-local ess-r--old-default-dir nil)
|
||||
(defun ess-r-package-default-directory-tracker (&rest _)
|
||||
(unless (equal ess-r--old-default-dir default-directory)
|
||||
(setq ess-r--old-default-dir default-directory)
|
||||
(ess-r-package-re-activate)))
|
||||
|
||||
(defun ess-r-package-activate-directory-tracker ()
|
||||
(add-hook 'after-change-functions 'ess-r-package-default-directory-tracker t t))
|
||||
|
||||
(add-hook 'shell-mode-hook 'ess-r-package-activate-directory-tracker t)
|
||||
(add-hook 'eshell-mode-hook 'ess-r-package-activate-directory-tracker t)
|
||||
(when (fboundp 'advice-add)
|
||||
(require 'shell)
|
||||
(advice-add 'shell-resync-dirs :after 'ess-r-package-re-activate))
|
||||
|
||||
|
||||
;;;*;;; Deprecated variables and functions
|
||||
(defun ess-developer (&optional val)
|
||||
(error "As of ESS 16.04, `ess-developer' is deprecated. Use `ess-r-set-evaluation-env' instead."))
|
||||
|
||||
(defalias 'ess-toggle-developer 'ess-developer)
|
||||
(define-obsolete-function-alias 'ess-r-devtools-check-package-buildwin 'ess-r-devtools-check-with-winbuilder)
|
||||
(define-obsolete-variable-alias 'ess-r-package-auto-set-evaluation-env 'ess-r-package-auto-enable-namespaced-evaluation "18.04")
|
||||
(define-obsolete-function-alias 'ess-r-devtools-ask 'ess-r-devtools-execute-command "18.04")
|
||||
(define-obsolete-variable-alias 'ess-r-package-auto-set-evaluation-env 'ess-r-package-auto-enable-namespaced-evaluation "18.04")
|
||||
|
||||
(make-obsolete-variable 'ess-developer "Please use `ess-developer-select-package' and `ess-r-set-evaluation-env' instead." "16.04")
|
||||
(make-obsolete-variable 'ess-developer-root-file "Please use `ess-r-package-root-file' instead." "16.04")
|
||||
(make-obsolete-variable 'ess-developer-packages "Please use `ess-r-package-set-package' and `ess-r-set-evaluation-env' instead." "16.04")
|
||||
(make-obsolete-variable 'ess-developer-load-on-add-commands "Please use `ess-r-package-set-package' and `ess-r-set-evaluation-env' instead." "16.04")
|
||||
(make-obsolete-variable 'ess-developer-activate-in-package "Please use `ess-r-package-auto-activate' instead." "16.04")
|
||||
(make-obsolete-variable 'ess-developer-enter-hook "Please use `ess-r-package-enter-hook' instead." "16.04")
|
||||
(make-obsolete-variable 'ess-developer-exit-hook "Please use `ess-r-package-exit-hook' instead." "16.04")
|
||||
|
||||
|
||||
(provide 'ess-r-package)
|
||||
|
||||
;;; ess-r-package.el ends here
|
||||
1579
elpa/ess-20180701.100/ess-r-syntax.el
Normal file
1579
elpa/ess-20180701.100/ess-r-syntax.el
Normal file
File diff suppressed because it is too large
Load Diff
128
elpa/ess-20180701.100/ess-r-xref.el
Normal file
128
elpa/ess-20180701.100/ess-r-xref.el
Normal file
@@ -0,0 +1,128 @@
|
||||
;;; ess-r-xref.el --- An xref backend for R. -*- lexical-binding: t -*-
|
||||
;;
|
||||
;; Author: Aaron Jacobs
|
||||
;; Created: 21 January 2018
|
||||
;; Maintainer: ESS-core <ESS-core@r-project.org>
|
||||
;;
|
||||
;; Keywords: languages, statistics, xref
|
||||
;; Package-Requires: ((emacs "25"))
|
||||
;;
|
||||
;; 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/
|
||||
|
||||
;;; Commentary:
|
||||
|
||||
;; This file contains an xref backend for `R-mode'.
|
||||
|
||||
;;; Code:
|
||||
|
||||
(when (>= emacs-major-version 25)
|
||||
(require 'subr-x)
|
||||
(require 'xref))
|
||||
|
||||
(require 'ess-utils)
|
||||
(require 'ess-r-package)
|
||||
(require 'ess-tracebug)
|
||||
|
||||
(defvar ess-r-xref-pkg-sources nil
|
||||
"Alist of R package->directory associations.
|
||||
This variable is used as a cache of package->directory
|
||||
associations, but could be used by the users for a more refined
|
||||
control of package locations than `ess-r-package-library-paths'.")
|
||||
|
||||
(defun ess-r-xref-backend ()
|
||||
"An `xref-backend-functions' implementation for `R-mode'.
|
||||
R's xref backend searches for `ess-r-package-library-paths' when
|
||||
srcrefs point to temporary locations."
|
||||
'ess-r)
|
||||
|
||||
(cl-defmethod xref-backend-identifier-at-point ((_backend (eql ess-r)))
|
||||
(symbol-name (ess-symbol-at-point)))
|
||||
|
||||
(cl-defmethod xref-backend-definitions ((_backend (eql ess-r)) symbol)
|
||||
(let ((xref (ess-r-xref--xref symbol)))
|
||||
(when xref (list xref))))
|
||||
|
||||
(cl-defmethod xref-backend-apropos ((_backend (eql ess-r)))
|
||||
;; Not yet supported.
|
||||
nil)
|
||||
|
||||
(cl-defmethod xref-backend-identifier-completion-table ((_backend (eql ess-r)))
|
||||
(inferior-ess-r-force)
|
||||
(ess-get-words-from-vector ".ess_all_functions()\n"))
|
||||
|
||||
(defun ess-r-xref--srcref (symbol)
|
||||
(inferior-ess-r-force)
|
||||
;; Look for `symbol' inside the package namespace
|
||||
(let* ((pkg (ess-r-package-name))
|
||||
(pkg (if pkg
|
||||
(concat "\"" pkg "\"")
|
||||
"NULL")))
|
||||
(with-current-buffer (ess-command (format ".ess_srcref(\"%s\", %s)\n" symbol pkg))
|
||||
(goto-char (point-min))
|
||||
(when (re-search-forward "(" nil 'noerror)
|
||||
(goto-char (match-beginning 0))
|
||||
(read (current-buffer))))))
|
||||
|
||||
(defun ess-r-xref--pkg-srcfile (symbol r-src-file)
|
||||
"Look in the source directory of the R package containing symbol SYMBOL for R-SRC-FILE."
|
||||
(let* ((env-name (ess-string-command (format ".ess_fn_pkg(\"%s\")\n" symbol)))
|
||||
(pkg (if (string-equal env-name "")
|
||||
(error "Can't find package for symbol %s." symbol)
|
||||
env-name))
|
||||
(dir (or (assoc-default pkg ess-r-xref-pkg-sources)
|
||||
(cond ((stringp ess-r-package-library-paths)
|
||||
(expand-file-name pkg ess-r-package-library-paths))
|
||||
((listp ess-r-package-library-paths)
|
||||
(cl-loop for d in ess-r-package-library-paths
|
||||
for p = (expand-file-name pkg d)
|
||||
when (file-exists-p p) return p))
|
||||
(t (error "Invalid value of `ess-r-package-library-paths'")))))
|
||||
(file (when dir (expand-file-name r-src-file dir))))
|
||||
(when file
|
||||
(unless (file-readable-p file)
|
||||
(error "Can't read %s." file))
|
||||
;; Cache package's source directory.
|
||||
(unless (assoc pkg ess-r-xref-pkg-sources)
|
||||
(push `(,pkg . ,dir) ess-r-xref-pkg-sources))
|
||||
file)))
|
||||
|
||||
(defun ess-r-xref--xref (symbol)
|
||||
"Create an xref for the source file reference of R symbol SYMBOL."
|
||||
(let ((ref (ess-r-xref--srcref symbol)))
|
||||
(when ref
|
||||
(let ((file (nth 0 ref))
|
||||
(line (nth 1 ref))
|
||||
(col (nth 2 ref)))
|
||||
(or
|
||||
;; 1) Result of ESS evaluation
|
||||
(let* ((ess-ref (gethash file ess--srcrefs))
|
||||
(ess-buff (when ess-ref (ess--dbg-find-buffer (car ess-ref)))))
|
||||
(when ess-buff
|
||||
;; FIXME: this breaks when eval is on larger spans than function
|
||||
(xref-make symbol (xref-make-buffer-location ess-buff (nth 2 ess-ref)))))
|
||||
;; 2) Actual file location
|
||||
(when (file-readable-p file)
|
||||
(xref-make symbol (xref-make-file-location file line col)))
|
||||
;; 3) Temporary sources - truncate and locate in ess-r-package-library-paths
|
||||
(when (string-match "/\\(R/.*\\)$" file)
|
||||
(let ((pkg-file (ess-r-xref--pkg-srcfile symbol (match-string 1 file))))
|
||||
(when pkg-file
|
||||
(xref-make symbol (xref-make-file-location
|
||||
(expand-file-name pkg-file) line col))))))))))
|
||||
|
||||
(provide 'ess-r-xref)
|
||||
|
||||
;;; ess-r-xref.el ends here
|
||||
539
elpa/ess-20180701.100/ess-rd.el
Normal file
539
elpa/ess-20180701.100/ess-rd.el
Normal file
@@ -0,0 +1,539 @@
|
||||
;; ess-rd.el --- Support for editing R documentation (Rd) source
|
||||
|
||||
;; Copyright (C) 1997--2005 A.J. Rossini, Richard M. Heiberger, Martin
|
||||
;; Maechler, Kurt Hornik, Rodney Sparapani, and Stephen Eglen.
|
||||
|
||||
;; Author: KH <Kurt.Hornik@ci.tuwien.ac.at>
|
||||
;; Created: 25 July 1997
|
||||
;; Maintainer: ESS-core <ESS-core@r-project.org>
|
||||
|
||||
;; This file is part of ESS (Emacs Speaks Statistics).
|
||||
|
||||
;; This file is free software; you may 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 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 on the World
|
||||
;; Wide Web at http://www.gnu.org/copyleft/gpl.html. You can also
|
||||
;; obtain it by writing to the Free Software Foundation, Inc., 675 Mass
|
||||
;; Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
;;; Code:
|
||||
|
||||
(require 'ess-utils)
|
||||
(require 'ess-help)
|
||||
(require 'ess-inf)
|
||||
|
||||
(defvar essddr-version "0.9-1"
|
||||
"Current version of ess-rd.el.")
|
||||
|
||||
(defvar essddr-maintainer-address
|
||||
"ESS Core Team <ess-core@r-project.org>"
|
||||
"Current maintainer of ess-rd.el.")
|
||||
|
||||
(defvar Rd-mode-abbrev-table nil
|
||||
"Abbrev table for R documentation keywords.
|
||||
All Rd mode abbrevs start with a grave accent (`).")
|
||||
(if Rd-mode-abbrev-table
|
||||
()
|
||||
(define-abbrev-table 'Rd-mode-abbrev-table ())
|
||||
(define-abbrev Rd-mode-abbrev-table "`ag" "\\arguments")
|
||||
(define-abbrev Rd-mode-abbrev-table "`al" "\\alias")
|
||||
(define-abbrev Rd-mode-abbrev-table "`au" "\\author")
|
||||
(define-abbrev Rd-mode-abbrev-table "`bf" "\\bold")
|
||||
(define-abbrev Rd-mode-abbrev-table "`co" "\\code")
|
||||
(define-abbrev Rd-mode-abbrev-table "`de" "\\describe")
|
||||
(define-abbrev Rd-mode-abbrev-table "`dn" "\\description")
|
||||
(define-abbrev Rd-mode-abbrev-table "`dt" "\\details")
|
||||
(define-abbrev Rd-mode-abbrev-table "`em" "\\emph")
|
||||
(define-abbrev Rd-mode-abbrev-table "`en" "\\enumerate")
|
||||
(define-abbrev Rd-mode-abbrev-table "`ex" "\\examples")
|
||||
(define-abbrev Rd-mode-abbrev-table "`fi" "\\file")
|
||||
(define-abbrev Rd-mode-abbrev-table "`fo" "\\format")
|
||||
(define-abbrev Rd-mode-abbrev-table "`it" "\\item")
|
||||
(define-abbrev Rd-mode-abbrev-table "`iz" "\\itemize")
|
||||
(define-abbrev Rd-mode-abbrev-table "`kw" "\\keyword")
|
||||
(define-abbrev Rd-mode-abbrev-table "`li" "\\link")
|
||||
(define-abbrev Rd-mode-abbrev-table "`me" "\\method")
|
||||
(define-abbrev Rd-mode-abbrev-table "`na" "\\name")
|
||||
(define-abbrev Rd-mode-abbrev-table "`no" "\\note")
|
||||
(define-abbrev Rd-mode-abbrev-table "`re" "\\references")
|
||||
(define-abbrev Rd-mode-abbrev-table "`sa" "\\seealso")
|
||||
(define-abbrev Rd-mode-abbrev-table "`se" "\\section")
|
||||
(define-abbrev Rd-mode-abbrev-table "`so" "\\source")
|
||||
(define-abbrev Rd-mode-abbrev-table "`ss" "\\subsection")
|
||||
(define-abbrev Rd-mode-abbrev-table "`sy" "\\synopsis")
|
||||
(define-abbrev Rd-mode-abbrev-table "`ta" "\\tabular")
|
||||
(define-abbrev Rd-mode-abbrev-table "`ti" "\\title")
|
||||
(define-abbrev Rd-mode-abbrev-table "`us" "\\usage")
|
||||
(define-abbrev Rd-mode-abbrev-table "`va" "\\value"))
|
||||
|
||||
(defvar Rd-mode-syntax-table nil
|
||||
"Syntax table for Rd mode.")
|
||||
(if Rd-mode-syntax-table
|
||||
()
|
||||
(setq Rd-mode-syntax-table (copy-syntax-table text-mode-syntax-table))
|
||||
(modify-syntax-entry ?\\ "\\" Rd-mode-syntax-table)
|
||||
(modify-syntax-entry ?\{ "(}" Rd-mode-syntax-table)
|
||||
(modify-syntax-entry ?\} "){" Rd-mode-syntax-table)
|
||||
;; Nice for editing, not for parsing ...
|
||||
(modify-syntax-entry ?\( "()" Rd-mode-syntax-table)
|
||||
(modify-syntax-entry ?\) ")(" Rd-mode-syntax-table)
|
||||
(modify-syntax-entry ?\[ "(]" Rd-mode-syntax-table)
|
||||
(modify-syntax-entry ?\] ")[" Rd-mode-syntax-table)
|
||||
;; To get strings right
|
||||
;; (modify-syntax-entry ?\' "\"" Rd-mode-syntax-table)
|
||||
(modify-syntax-entry ?\" "\"" Rd-mode-syntax-table)
|
||||
;; To make abbrevs starting with a grave accent work ...
|
||||
(modify-syntax-entry ?\` "w" Rd-mode-syntax-table)
|
||||
;; Comments
|
||||
(modify-syntax-entry ?\% "<" Rd-mode-syntax-table)
|
||||
(modify-syntax-entry ?\n ">" Rd-mode-syntax-table))
|
||||
|
||||
(defvar Rd-mode-parse-syntax-table nil
|
||||
"Syntax table for parsing Rd mode.")
|
||||
(if Rd-mode-parse-syntax-table
|
||||
()
|
||||
(setq Rd-mode-parse-syntax-table
|
||||
(copy-syntax-table Rd-mode-syntax-table))
|
||||
;; To make parse-partial-sexps do the thing we want for computing
|
||||
;; indentations
|
||||
(modify-syntax-entry ?\( "_" Rd-mode-parse-syntax-table)
|
||||
(modify-syntax-entry ?\) "_" Rd-mode-parse-syntax-table)
|
||||
(modify-syntax-entry ?\[ "_" Rd-mode-parse-syntax-table)
|
||||
(modify-syntax-entry ?\] "_" Rd-mode-parse-syntax-table))
|
||||
|
||||
(defvar Rd-section-names
|
||||
'("Rdversion" "arguments" "alias" "author" "concept" "describe" "description"
|
||||
"details" "docType" "encoding" "enumerate" "examples" "format"
|
||||
"itemize" "keyword" "name" "note" "preformatted" "references"
|
||||
"seealso" "section" "source" "subsection" "synopsis"
|
||||
"tabular" "title" "usage"
|
||||
"value"))
|
||||
|
||||
(defvar Rd-keywords
|
||||
'(
|
||||
;; the next two lines: only valid in R <= 2.8.1
|
||||
;; commented out on 2011-01-14 for ESS version 5.13:
|
||||
;; "Alpha" "Gamma" "alpha" "beta" "epsilon" "lambda" "mu" "pi" "sigma"
|
||||
;; "ge" "le" "left" "right"
|
||||
;;
|
||||
"R" "RdOpts" "S3method" "S4method" "Sexpr" "acronym"
|
||||
"bold" "cite" "code" "command" "cr" "dQuote" "deqn" "dfn" "dontrun"
|
||||
"dontshow" "donttest" "dots" "email" "emph" "enc" "env" "eqn" "figure" "file"
|
||||
"href" "if" "ifelse"
|
||||
"item" "kbd" "ldots" "linkS4class" "link" "method"
|
||||
"newcommand" "option" "out"
|
||||
"pkg" "sQuote" "renewcommand"
|
||||
"samp" "strong" "tab" "url" "var" "verb"
|
||||
;; System macros (from <R>/share/Rd/macros/system.Rd ):
|
||||
"CRANpkg" "PR" "sspace" "doi"
|
||||
"packageTitle" "packageDescription" "packageAuthor"
|
||||
"packageMaintainer" "packageDESCRIPTION" "packageIndices"
|
||||
))
|
||||
|
||||
;; Need to fix Rd-bold-face problem.
|
||||
;;
|
||||
;; (defvar Rd-bold-face 'bold)
|
||||
;(defvar Rd-bold-face nil)
|
||||
;(make-face Rd-bold-face "R documentation bold face")
|
||||
;(make-face-bold Rd-bold-face
|
||||
|
||||
(defvar Rd-font-lock-keywords
|
||||
(list
|
||||
(cons
|
||||
(concat "\\\\\\("
|
||||
(mapconcat 'identity Rd-section-names "\\|")
|
||||
"\\>\\)")
|
||||
'font-lock-reference-face) ; Rd-bold-face
|
||||
(cons
|
||||
(concat "\\\\\\("
|
||||
(mapconcat 'identity Rd-keywords "\\|")
|
||||
"\\>\\)")
|
||||
'font-lock-keyword-face)
|
||||
'("^#\\(ifn?def\\)\\s-+\\(\\sw+\\)"
|
||||
(1 font-lock-builtin-face)
|
||||
(2 font-lock-variable-name-face nil t))
|
||||
'("^#\\(endif\\)" 1 font-lock-builtin-face))
|
||||
"Additional Rd expressions to highlight.")
|
||||
|
||||
(defvar Rd-indent-level 2
|
||||
"*Indentation of Rd code with respect to containing blocks.")
|
||||
|
||||
(defvar Rd-mode-map
|
||||
(let ((map (make-sparse-keymap)))
|
||||
(define-key map "\t" 'indent-according-to-mode)
|
||||
(define-key map "\C-j" 'reindent-then-newline-and-indent)
|
||||
(define-key map "\C-m" 'reindent-then-newline-and-indent)
|
||||
(define-key map "\C-c\C-p" 'Rd-preview-help)
|
||||
(define-key map "\C-c\C-j" 'Rd-mode-insert-item)
|
||||
(define-key map "\C-c\C-e" 'Rd-mode-insert-skeleton)
|
||||
(define-key map "\C-c\C-f" 'Rd-font)
|
||||
;; ^C^F ^E : \emph{ . }
|
||||
;; ^C^F ^C : \code{ . }
|
||||
;; ^C^F ^L : \link{ . }
|
||||
;; ^C^F L : \code{\link{ . }} etc
|
||||
(define-key map "\C-c\C-s" 'Rd-mode-insert-section)
|
||||
(define-key map "\C-c\C-n" 'ess-eval-line-and-step)
|
||||
(define-key map "\C-c\C-r" 'ess-eval-region)
|
||||
(define-key map "\C-c\C-c" 'ess-eval-region-or-function-or-paragraph-and-step)
|
||||
(define-key map "\C-\M-x" 'ess-eval-region-or-function-or-paragraph)
|
||||
(define-key map "\C-c\C-v" 'ess-display-help-on-object)
|
||||
(define-key map "\C-c\C-w" 'ess-switch-process); is on C-c C-s in ess-mode..
|
||||
(define-key map "\C-c\C-y" 'ess-switch-to-ESS)
|
||||
(define-key map "\C-c\C-z" 'ess-switch-to-end-of-ESS)
|
||||
map)
|
||||
"Keymap used in Rd mode.")
|
||||
|
||||
(defvar Rd-mode-menu
|
||||
(list "Rd"
|
||||
["Markup [word]" Rd-font t]
|
||||
["Insert Item" Rd-mode-insert-item t]
|
||||
["Insert Section" Rd-mode-insert-section t]
|
||||
["Insert Skeleton" Rd-mode-insert-skeleton t]
|
||||
"-"
|
||||
["Preview" Rd-preview-help t]
|
||||
"-"
|
||||
["Eval Line" ess-eval-line-and-step t]
|
||||
["Eval Region" ess-eval-region t]
|
||||
["Switch to ESS Process" ess-switch-to-ESS t]
|
||||
["Switch the ESS Process" ess-switch-process t]
|
||||
["Switch to end{ESS Pr}" ess-switch-to-end-of-ESS t]
|
||||
"-"
|
||||
["Toggle Abbrev Mode" abbrev-mode t]
|
||||
["Toggle Auto-Fill Mode" auto-fill-mode t]
|
||||
"-"
|
||||
["Submit Bug Report" Rd-submit-bug-report t]
|
||||
"-"
|
||||
["Describe Rd Mode" Rd-describe-major-mode t])
|
||||
"Menu used in Rd mode.")
|
||||
|
||||
(defvar Rd-mode-hook nil
|
||||
"*Hook to be run when Rd mode is entered.")
|
||||
|
||||
(defvar Rd-to-help-command "R CMD Rd2txt"
|
||||
"*Shell command for converting R documentation source to help text.")
|
||||
|
||||
|
||||
(defvar Rd-font-list
|
||||
'((?\C-b "\\bold{" "}")
|
||||
(?\C-c "\\code{" "}")
|
||||
(?\C-e "\\emph{" "}")
|
||||
(?\C-l "\\link{" "}")
|
||||
(?l "\\code{\\link{" "}}")
|
||||
(?\C-m "\\email{" "}")
|
||||
(?\C-q "\\eqn{" "}")
|
||||
(?\C-u "\\url{" "}")
|
||||
)
|
||||
"List of ``fonts'' used by Rd-font.
|
||||
|
||||
Each entry is a list.
|
||||
The first element is the key to activate the font.
|
||||
The second element is the string to insert before point, and the third
|
||||
element is the string to insert after point."
|
||||
)
|
||||
|
||||
|
||||
;;;###autoload
|
||||
(defun Rd-mode ()
|
||||
"Major mode for editing R documentation source files.
|
||||
|
||||
This mode makes it easier to write R documentation by helping with
|
||||
indentation, doing some of the typing for you (with Abbrev mode) and by
|
||||
showing keywords, strings, etc. in different faces (with Font Lock mode
|
||||
on terminals that support it).
|
||||
|
||||
Type \\[list-abbrevs] to display the built-in abbrevs for Rd keywords.
|
||||
|
||||
Keybindings
|
||||
===========
|
||||
|
||||
\\{Rd-mode-map}
|
||||
|
||||
Variables you can use to customize Rd mode
|
||||
==========================================
|
||||
|
||||
`Rd-indent-level'
|
||||
Indentation of Rd code with respect to containing blocks.
|
||||
Default is 2.
|
||||
|
||||
Turning on Rd mode runs the hook `Rd-mode-hook'.
|
||||
|
||||
To automatically turn on the abbrev(iate) features, add the
|
||||
following lines to your `.emacs' file:
|
||||
|
||||
(add-hook 'Rd-mode-hook
|
||||
(lambda ()
|
||||
(abbrev-mode 1)))
|
||||
"
|
||||
|
||||
(interactive)
|
||||
(text-mode)
|
||||
(kill-all-local-variables)
|
||||
(ess-setq-vars-local ess-r-customize-alist) ;same functionality is available as in R buffers
|
||||
(use-local-map Rd-mode-map)
|
||||
(setq mode-name "Rd")
|
||||
(setq major-mode 'Rd-mode)
|
||||
(setq local-abbrev-table Rd-mode-abbrev-table)
|
||||
(set-syntax-table Rd-mode-syntax-table)
|
||||
|
||||
(set (make-local-variable 'indent-line-function) 'Rd-mode-indent-line)
|
||||
(set (make-local-variable 'fill-column) 72)
|
||||
(set (make-local-variable 'comment-start-skip) "\\s<+\\s-*")
|
||||
(set (make-local-variable 'comment-start) "% ")
|
||||
(set (make-local-variable 'comment-end) "")
|
||||
(set (make-local-variable 'font-lock-defaults)
|
||||
'(Rd-font-lock-keywords nil nil))
|
||||
;; (set (make-local-variable 'parse-sexp-ignore-comments) t)
|
||||
|
||||
;; Here is a workaround for an Emacs bug related to indirect buffers and
|
||||
;; spurious lockfiles that rears its ugly head with .Rd files
|
||||
;; http://lists.gnu.org/archive/html/bug-gnu-emacs/2013-02/msg01368.html
|
||||
;; http://debbugs.gnu.org/cgi/bugreport.cgi?bug=14328
|
||||
(make-local-variable 'create-lockfiles)
|
||||
(setq create-lockfiles nil)
|
||||
|
||||
(require 'easymenu)
|
||||
(easy-menu-define Rd-mode-menu-map Rd-mode-map
|
||||
"Menu keymap for Rd mode." Rd-mode-menu)
|
||||
(easy-menu-add Rd-mode-menu-map Rd-mode-map)
|
||||
|
||||
(turn-on-auto-fill)
|
||||
(message "Rd mode version %s" essddr-version)
|
||||
(setq ess-language "S" ess-dialect "R"); (buffer local)
|
||||
(run-mode-hooks 'Rd-mode-hook))
|
||||
|
||||
;;;###autoload
|
||||
(add-to-list 'auto-mode-alist '("\\.Rd\\'" . Rd-mode))
|
||||
|
||||
;; FIXME: The following should be moved to ess-utils.el, no? (MM thinks)
|
||||
(defun ess-point (position)
|
||||
"Returns the value of point at certain positions."
|
||||
(save-excursion
|
||||
(cond
|
||||
((eq position 'bol) (beginning-of-line))
|
||||
((eq position 'eol) (end-of-line))
|
||||
((eq position 'boi) (back-to-indentation))
|
||||
((eq position 'bonl) (forward-line 1))
|
||||
((eq position 'bopl) (forward-line -1))
|
||||
(t (error "unknown buffer position requested: %s" position)))
|
||||
(point)))
|
||||
|
||||
(defun Rd-describe-major-mode ()
|
||||
"Describe the current major mode."
|
||||
(interactive)
|
||||
(describe-function major-mode))
|
||||
|
||||
(defun Rd-mode-in-verbatim-p ()
|
||||
(let ((pos (point)))
|
||||
(save-excursion
|
||||
(if (and (re-search-backward
|
||||
"\\\\\\(usage\\|examples\\|synopsis\\)" nil t)
|
||||
(re-search-forward "\\s(" nil t))
|
||||
(condition-case ()
|
||||
(progn
|
||||
(up-list 1)
|
||||
(< pos (point)))
|
||||
(error t))
|
||||
nil))))
|
||||
|
||||
(defun Rd-mode-in-preprocessor-line-p ()
|
||||
(save-excursion
|
||||
(beginning-of-line)
|
||||
(looking-at "[ \t]*#\\(ifdef\\|endif\\)")))
|
||||
|
||||
(defun Rd-mode-calculate-indent ()
|
||||
"Return appropriate indentation for current line in Rd mode."
|
||||
(interactive)
|
||||
(save-excursion
|
||||
(beginning-of-line)
|
||||
(cond
|
||||
((Rd-mode-in-verbatim-p)
|
||||
;; Don't do anything in verbatims
|
||||
nil)
|
||||
((Rd-mode-in-preprocessor-line-p)
|
||||
;; Indent to 0
|
||||
0)
|
||||
(t
|
||||
(let ((p (progn
|
||||
(re-search-forward "[ \t]*\\s)*" (ess-point 'eol) t)
|
||||
(point))))
|
||||
(if (or (< (forward-line -1) 0)
|
||||
(Rd-mode-in-verbatim-p))
|
||||
0
|
||||
(set-syntax-table Rd-mode-parse-syntax-table)
|
||||
(while (and (or (looking-at "[ \t]*$")
|
||||
(Rd-mode-in-preprocessor-line-p))
|
||||
(not (bobp)))
|
||||
(forward-line -1))
|
||||
(re-search-forward "[ \t]*\\s)*" (ess-point 'eol) t)
|
||||
(prog1
|
||||
(+ (current-indentation)
|
||||
(* (car (parse-partial-sexp (point) p))
|
||||
Rd-indent-level))
|
||||
(set-syntax-table Rd-mode-syntax-table))))))))
|
||||
|
||||
(defun Rd-mode-indent-line ()
|
||||
"Indent current line as Rd source."
|
||||
(interactive)
|
||||
(let ((ic (Rd-mode-calculate-indent))
|
||||
(rp (- (current-column) (current-indentation))))
|
||||
(if ic ; Not inside a verbatim
|
||||
(if (< ic 0)
|
||||
(error "Unmatched parenthesis")
|
||||
(indent-line-to ic)
|
||||
(if (> rp 0)
|
||||
(move-to-column (+ ic rp)))))))
|
||||
|
||||
(defun Rd-mode-insert-item ()
|
||||
(interactive)
|
||||
(reindent-then-newline-and-indent)
|
||||
(insert "\\item{")
|
||||
)
|
||||
|
||||
(defun Rd-mode-insert-section ()
|
||||
(interactive)
|
||||
(let ((s (ess-completing-read
|
||||
"Insert section: "
|
||||
(mapcar (lambda (x) (cons x x)) Rd-section-names)
|
||||
nil t)))
|
||||
(if (string= s "")
|
||||
(progn (insert "\\section{}{") (backward-char 2))
|
||||
(insert (format "\\%s{" s)))))
|
||||
|
||||
(defun Rd-mode-insert-skeleton ()
|
||||
(interactive)
|
||||
;; Hmm: in theory this should be kept in sync with prompt()
|
||||
;; --- maybe using prompt() [or promptClass()...] would be better anyway?!
|
||||
(insert "\\name{}\n")
|
||||
(insert "\\alias{}\n")
|
||||
(insert "\\title{}\n")
|
||||
(insert "\\description{\n}\n")
|
||||
(insert "\\usage{\n}\n")
|
||||
(insert "\\arguments{\n}\n")
|
||||
(insert "\\value{\n}\n")
|
||||
(insert "\\details{\n}\n")
|
||||
(insert "\\references{\n}\n")
|
||||
(insert "\\seealso{\n}\n")
|
||||
(insert "\\examples{\n}\n")
|
||||
(insert "\\author{}\n")
|
||||
(insert "\\keyword{}\n"))
|
||||
|
||||
;; This is an `easy' version of (defun TeX-font ..) in AUCtex's tex.el ;
|
||||
;; see TeX-font-list and also LaTeX-font-list in latex.el
|
||||
|
||||
(defun Rd-font (what)
|
||||
"Insert template for font command.
|
||||
WHAT determines the font to use, as specified by `Rd-font-list'."
|
||||
(interactive "c")
|
||||
;;TeX had : (Rd-update-style)
|
||||
(let* ((entry (assoc what Rd-font-list))
|
||||
(before (nth 1 entry))
|
||||
(after (nth 2 entry)))
|
||||
(cond ((null entry) ;; help on possibilities :
|
||||
(let ((help
|
||||
(concat
|
||||
"Rd Markup (available from C-c C-f):\n\n\t"
|
||||
"KEY Rd-Markup\n\n"
|
||||
(mapconcat
|
||||
(lambda (entry)
|
||||
;; A textual description of an ENTRY in TeX-font-list.
|
||||
(concat (format "%11s "
|
||||
(key-description
|
||||
(char-to-string (nth 0 entry))))
|
||||
(format "%14s %-3s"
|
||||
(nth 1 entry) (nth 2 entry))))
|
||||
Rd-font-list "\n"))))
|
||||
(with-output-to-temp-buffer "*Help*"
|
||||
(set-buffer "*Help*")
|
||||
(insert help))))
|
||||
|
||||
((region-active-p)
|
||||
(save-excursion
|
||||
(cond ((> (mark) (point))
|
||||
(insert before)
|
||||
(goto-char (mark))
|
||||
(insert after))
|
||||
(t
|
||||
(insert after)
|
||||
(goto-char (mark))
|
||||
(insert before)))))
|
||||
(t
|
||||
(insert before)
|
||||
(save-excursion
|
||||
(insert after))))))
|
||||
;;;###autoload
|
||||
(defun Rd-preview-help (&optional via-shell)
|
||||
"Preview the current Rd buffer contents as help.
|
||||
If optional VIA-SHELL is set, using `Rd-to-help-command'.
|
||||
If the current buffer is not associated with a file, create a
|
||||
temporary one in `temporary-file-directory'.
|
||||
"
|
||||
(interactive "P")
|
||||
(require 'ess-help)
|
||||
(let ((file buffer-file-name)
|
||||
(pbuf (get-buffer-create "R Help Preview"))
|
||||
del-p)
|
||||
(unless file
|
||||
(setq file (make-temp-file "RD_" nil ".Rd"))
|
||||
(write-region (point-min) (point-max) file)
|
||||
(setq del-p t))
|
||||
|
||||
(if via-shell ;; FIXME eventually get rid of this option
|
||||
;; only method in ESS <= 14.09 -- calls "R" even if in "R-devel"; slower
|
||||
(let ((shcmd (format "%s '%s'" Rd-to-help-command file)))
|
||||
(set-buffer pbuf)
|
||||
(erase-buffer)
|
||||
(ess-write-to-dribble-buffer
|
||||
(format "Rd-preview-help: (shell-command |%s| t)" shcmd))
|
||||
(shell-command shcmd t))
|
||||
;; else directly:
|
||||
(ess-force-buffer-current "R process to use: ")
|
||||
(ess-command (format ".ess_Rd2txt(\"%s\")\n" file) pbuf)
|
||||
(set-buffer pbuf))
|
||||
|
||||
;; FIXME(2): once got rid of via-shell, consider
|
||||
;; (ess--flush-help-into-current-buffer file "tools::Rd2txt(\"%s\")\n")
|
||||
;; instead of all this :
|
||||
(ess-setq-vars-local ess-r-customize-alist)
|
||||
;; FIXME: Is this really needed?
|
||||
(setq ess-help-sec-regex ess-help-r-sec-regex
|
||||
ess-help-sec-keys-alist ess-help-r-sec-keys-alist)
|
||||
;; mostly cut'n'paste from ess--flush-help* (see FIXME(2)):
|
||||
(ess-help-underline)
|
||||
(ess-help-mode)
|
||||
(goto-char (point-min))
|
||||
(set-buffer-modified-p 'nil)
|
||||
(setq buffer-read-only t)
|
||||
(setq truncate-lines nil)
|
||||
(when del-p (delete-file file))
|
||||
(unless (get-buffer-window pbuf 'visible)
|
||||
(display-buffer pbuf t))))
|
||||
|
||||
;; Bug reporting
|
||||
(defun Rd-submit-bug-report ()
|
||||
"Submit a bug report on Rd mode via mail."
|
||||
(interactive)
|
||||
(require 'reporter)
|
||||
(and
|
||||
(y-or-n-p "Do you want to submit a bug report? ")
|
||||
(reporter-submit-bug-report
|
||||
essddr-maintainer-address
|
||||
(concat "Emacs version " emacs-version)
|
||||
(list
|
||||
'essddr-version
|
||||
'Rd-indent-level))))
|
||||
|
||||
|
||||
;; Provide ourself
|
||||
(provide 'ess-rd)
|
||||
;; Legacy feature
|
||||
(provide 'essddr)
|
||||
|
||||
;; ess-rd.el ends here
|
||||
498
elpa/ess-20180701.100/ess-rdired.el
Normal file
498
elpa/ess-20180701.100/ess-rdired.el
Normal file
@@ -0,0 +1,498 @@
|
||||
;;; ess-rdired.el --- prototype object browser for R, looks like dired mode.
|
||||
|
||||
;; Copyright (C) 2002--2004 A.J. Rossini, Richard M. Heiberger, Martin
|
||||
;; Maechler, Kurt Hornik, Rodney Sparapani, and Stephen Eglen.
|
||||
|
||||
;; Author: Stephen Eglen <stephen@anc.ed.ac.uk>
|
||||
;; Created: Thu 24 Oct 2002
|
||||
;; Maintainer: ESS-core <ESS-core@r-project.org>
|
||||
|
||||
;; This file is part of ESS
|
||||
|
||||
;; This file is not part of GNU Emacs.
|
||||
|
||||
;; ess-rdired.el 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.
|
||||
|
||||
;; ess-rdired.el 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/
|
||||
|
||||
;; This provides a dired-like buffer for R objects. Instead of
|
||||
;; operating on files, we operate on R objects in the current
|
||||
;; environment. Objects can be viewed, edited, deleted, plotted and
|
||||
;; so on.
|
||||
|
||||
;;; Commentary:
|
||||
|
||||
;; Installation and usage.
|
||||
;;
|
||||
;; After loading this file, do "M-x R" to start an R session, then
|
||||
;; create a few variables:
|
||||
;; s <- sin(seq(from=0, to=8*pi, length=100))
|
||||
;; x <- c(1, 4, 9)
|
||||
;; y <- rnorm(20)
|
||||
;; z <- TRUE
|
||||
|
||||
;; Then in Emacs, do "M-x ess-rdired" and you should see the following in
|
||||
;; the buffer *R dired*:
|
||||
;; mode length
|
||||
;; s numeric 100
|
||||
;; x numeric 3
|
||||
;; y numeric 20
|
||||
;; z logical 1
|
||||
|
||||
;; Type "?" in the buffer to see the documentation. e.g. when the
|
||||
;; cursor is on the line for `s', type 'p' to plot it, or `v' to view
|
||||
;; its contents in a buffer. Then type 'd' to mark it for deletion.
|
||||
|
||||
;; How it works.
|
||||
|
||||
;; Most of the hardwork is done by the R routine .rdired.objects(),
|
||||
;; which, when called, produces the list of objects in a tidy format.
|
||||
;; This function is stored within the lisp variable `ess-rdired-objects',
|
||||
;; and can be altered to provide other information if you so need it.
|
||||
;; (Martin Maechler suggested providing output from str() here.)
|
||||
|
||||
;; Todo - compare functionality with ess-mouse-me (ess-mous.el).
|
||||
|
||||
;; Todo - How to select alternative environments? Currently only
|
||||
;; shows objects in the .GlobalEnv? See BrowseEnv() in 1.6.x for way
|
||||
;; of browsing other environments.
|
||||
|
||||
;; Todo - problem with fix -- have to wait for fix() command to return
|
||||
;; before *R* buffer can be used again. This can get stuck, umm. not
|
||||
;; sure what is going wrong here. Maybe add a hook to the temp buffer
|
||||
;; so that when buffer is killed, we send an instruction to R to
|
||||
;; update the value of the variable to the contents of the buffer.
|
||||
;; This way *R* doesn't have to wait.
|
||||
|
||||
;; Todo - small bug in .rdired.objects -- if we have a variable called
|
||||
;; `my.x', its value is replaced by the value of my.x used in the
|
||||
;; sapply() calls within .rdired.objects().
|
||||
|
||||
;;; Code:
|
||||
|
||||
(defvar ess-rdired-objects "{.rdired.objects <- function(objs) {
|
||||
if (length(objs)==0) {
|
||||
\"No objects to view!\"
|
||||
} else {
|
||||
mode <- sapply(objs, function(my.x) {
|
||||
eval( parse( text=sprintf('data.class(get(\"%s\"))', my.x))) })
|
||||
length <- sapply(objs, function(my.x) {
|
||||
eval( parse( text=sprintf('length(get(\"%s\"))', my.x))) })
|
||||
size <- sapply(objs, function(my.x) {
|
||||
eval( parse( text=sprintf('format(object.size(get(\"%s\")), units=\"auto\")', my.x))) })
|
||||
d <- data.frame(mode, length, size)
|
||||
|
||||
var.names <- row.names(d)
|
||||
|
||||
## If any names contain spaces, we need to quote around them.
|
||||
quotes = rep('', length(var.names))
|
||||
spaces = grep(' ', var.names)
|
||||
if (any(spaces))
|
||||
quotes[spaces] <- '\"'
|
||||
var.names = paste(quotes, var.names, quotes, sep='')
|
||||
row.names(d) <- paste(' ', var.names, sep='')
|
||||
d
|
||||
}
|
||||
}; cat('\n'); print(.rdired.objects(ls()))}\n"
|
||||
"Function to call within R to print information on objects. The last
|
||||
line of this string should be the instruction to call the
|
||||
function which prints the output for rdired.")
|
||||
|
||||
(defvar ess-rdired-buffer "*R dired*"
|
||||
"Name of buffer for displaying R objects.")
|
||||
|
||||
(defvar ess-rdired-mode-map
|
||||
(let ((ess-rdired-mode-map (make-sparse-keymap)))
|
||||
(if (require 'hide-lines nil t)
|
||||
(define-key ess-rdired-mode-map "/" 'hide-lines))
|
||||
(define-key ess-rdired-mode-map "?" 'ess-rdired-help)
|
||||
(define-key ess-rdired-mode-map "d" 'ess-rdired-delete)
|
||||
(define-key ess-rdired-mode-map "u" 'ess-rdired-undelete)
|
||||
(define-key ess-rdired-mode-map "x" 'ess-rdired-expunge)
|
||||
;; editing requires a little more work.
|
||||
;;(define-key ess-rdired-mode-map "e" 'ess-rdired-edit)
|
||||
(define-key ess-rdired-mode-map "v" 'ess-rdired-view)
|
||||
(define-key ess-rdired-mode-map "V" 'ess-rdired-View)
|
||||
(define-key ess-rdired-mode-map "p" 'ess-rdired-plot)
|
||||
(define-key ess-rdired-mode-map "s" 'ess-rdired-sort)
|
||||
(define-key ess-rdired-mode-map "r" 'ess-rdired-reverse)
|
||||
(define-key ess-rdired-mode-map "q" 'ess-rdired-quit)
|
||||
(define-key ess-rdired-mode-map "y" 'ess-rdired-type) ;what type?
|
||||
(define-key ess-rdired-mode-map " " 'ess-rdired-next-line)
|
||||
(define-key ess-rdired-mode-map [backspace] 'ess-rdired-previous-line)
|
||||
(define-key ess-rdired-mode-map "\C-n" 'ess-rdired-next-line)
|
||||
(define-key ess-rdired-mode-map "\C-p" 'ess-rdired-previous-line)
|
||||
;; (define-key ess-rdired-mode-map "n" 'ess-rdired-next-line)
|
||||
;; (define-key ess-rdired-mode-map "p" 'ess-rdired-previous-line)
|
||||
|
||||
;; R mode keybindings.
|
||||
(define-key ess-rdired-mode-map "\C-c\C-s" 'ess-rdired-switch-process)
|
||||
(define-key ess-rdired-mode-map "\C-c\C-y" 'ess-switch-to-ESS)
|
||||
(define-key ess-rdired-mode-map "\C-c\C-z" 'ess-switch-to-end-of-ESS)
|
||||
|
||||
(define-key ess-rdired-mode-map [down] 'ess-rdired-next-line)
|
||||
(define-key ess-rdired-mode-map [up] 'ess-rdired-previous-line)
|
||||
(define-key ess-rdired-mode-map "g" 'revert-buffer)
|
||||
(define-key ess-rdired-mode-map [mouse-2] 'ess-rdired-mouse-view)
|
||||
ess-rdired-mode-map))
|
||||
|
||||
(defun ess-rdired-mode ()
|
||||
"Major mode for output from `ess-rdired'.
|
||||
`ess-rdired' provides a dired-like mode for R objects. It shows the
|
||||
list of current objects in the current environment, one-per-line. You
|
||||
can then examine these objects, plot them, and so on.
|
||||
\\{ess-rdired-mode-map}"
|
||||
;; (kill-all-local-variables)
|
||||
(make-local-variable 'revert-buffer-function)
|
||||
(setq revert-buffer-function 'ess-rdired-revert-buffer)
|
||||
(use-local-map ess-rdired-mode-map)
|
||||
(setq major-mode 'ess-rdired-mode)
|
||||
(setq mode-name (concat "RDired " ess-local-process-name))
|
||||
(run-mode-hooks 'ess-rdired-mode-hook))
|
||||
|
||||
(defun ess-rdired-mode-hook nil
|
||||
"Run upon entering `ess-rdired-mode'.")
|
||||
|
||||
(defvar ess-rdired-sort-num nil) ;silence the compiler.
|
||||
;; but see following defun -- maybe it should be buffer local.
|
||||
|
||||
;;;###autoload
|
||||
(defun ess-rdired ()
|
||||
"Run dired-like mode on R objects.
|
||||
This is the main function. See documentation for `ess-rdired-mode' though
|
||||
for more information!"
|
||||
(interactive)
|
||||
(let ((proc ess-local-process-name)
|
||||
(buff (get-buffer-create ess-rdired-buffer)))
|
||||
|
||||
(ess-command ess-rdired-objects buff)
|
||||
(ess-setq-vars-local (symbol-value ess-local-customize-alist) buff)
|
||||
|
||||
(with-current-buffer buff
|
||||
(setq ess-local-process-name proc)
|
||||
(ess-rdired-mode)
|
||||
|
||||
;; When definiting the function .rdired.objects(), a "+ " is printed
|
||||
;; for every line of the function definition; these are deleted
|
||||
;; here.
|
||||
(goto-char (point-min))
|
||||
(delete-region (point-min) (1+ (point-at-eol)))
|
||||
|
||||
;; todo: not sure how to make ess-rdired-sort-num buffer local?
|
||||
;;(set (make-local-variable 'ess-rdired-sort-num) 2)
|
||||
;;(make-variable-buffer-local 'ess-rdired-sort-num)
|
||||
(setq ess-rdired-sort-num 1)
|
||||
(ess-rdired-insert-set-properties (save-excursion
|
||||
(goto-char (point-min))
|
||||
(forward-line 1)
|
||||
(point))
|
||||
(point-max))
|
||||
(setq buffer-read-only t)
|
||||
)
|
||||
|
||||
(pop-to-buffer buff)
|
||||
))
|
||||
|
||||
|
||||
(defun ess-rdired-object ()
|
||||
"Return name of object on current line.
|
||||
Handle special case when object contains spaces."
|
||||
(save-excursion
|
||||
(beginning-of-line)
|
||||
(forward-char 2)
|
||||
|
||||
(cond ((looking-at " ") ; First line?
|
||||
nil)
|
||||
((looking-at "\"") ; Object name contains spaces?
|
||||
(let (beg)
|
||||
(setq beg (point))
|
||||
(forward-char 1)
|
||||
(search-forward "\"")
|
||||
(buffer-substring-no-properties beg (point))))
|
||||
(t ;should be a regular object.
|
||||
(let (beg)
|
||||
(setq beg (point))
|
||||
(search-forward " ") ;assume space follows object name.
|
||||
(buffer-substring-no-properties beg (1- (point))))))))
|
||||
|
||||
(defun ess-rdired-edit ()
|
||||
"Edit (fix) the object at point."
|
||||
(interactive)
|
||||
(let ((objname (ess-rdired-object)))
|
||||
(ess-command (concat "edit(" objname ")\n"))))
|
||||
|
||||
(defun ess-rdired-view ()
|
||||
"View the object at point."
|
||||
(interactive)
|
||||
(let ((objname (ess-rdired-object)))
|
||||
(ess-execute (ess-rdired-get objname)
|
||||
nil "R view" )))
|
||||
|
||||
(defun ess-rdired-get (name)
|
||||
"Generate R code to get the value of the variable name.
|
||||
This is complicated because some variables might have spaces in their names.
|
||||
Otherwise, we could just pass the variable name directly to *R*."
|
||||
(concat "get(" (ess-rdired-quote name) ")")
|
||||
)
|
||||
|
||||
(defun ess-rdired-quote (name)
|
||||
"Quote name if not already quoted."
|
||||
(if (equal (substring name 0 1) "\"")
|
||||
name
|
||||
(concat "\"" name "\"")))
|
||||
|
||||
|
||||
(defun ess-rdired-View ()
|
||||
"View the object at point in its own buffer.
|
||||
Like `ess-rdired-view', but the object gets its own buffer name."
|
||||
(interactive)
|
||||
(let ((objname (ess-rdired-object)))
|
||||
(ess-execute (ess-rdired-get objname)
|
||||
nil (concat "R view " objname ))))
|
||||
|
||||
(defun ess-rdired-plot ()
|
||||
"Plot the object on current line."
|
||||
(interactive)
|
||||
(let ((objname (ess-rdired-object)))
|
||||
(ess-eval-linewise (format "plot(%s)" (ess-rdired-get objname)))))
|
||||
|
||||
(defun ess-rdired-type ()
|
||||
"Run the mode() on command at point.
|
||||
Named type because of similarity with the dired command bound to
|
||||
y key."
|
||||
(interactive)
|
||||
(let ((objname (ess-rdired-object))
|
||||
;; create a temp buffer, and then show output in echo area
|
||||
(tmpbuf (get-buffer-create "**ess-rdired-mode**")))
|
||||
(if objname
|
||||
(progn
|
||||
(ess-command (concat "mode(" (ess-rdired-get objname) ")\n")
|
||||
tmpbuf )
|
||||
(set-buffer tmpbuf)
|
||||
(message (concat
|
||||
objname ": "
|
||||
(buffer-substring (+ 4 (point-min)) (1- (point-max)))))
|
||||
(kill-buffer tmpbuf)))))
|
||||
|
||||
(defun ess-rdired-delete (arg)
|
||||
"Mark the current (or next ARG) objects for deletion.
|
||||
If point is on first line, all objects are marked for deletion."
|
||||
(interactive "p")
|
||||
(ess-rdired-mark "D" arg))
|
||||
|
||||
(defun ess-rdired-undelete (arg)
|
||||
"Unmark the current (or next ARG) objects.
|
||||
If point is on first line, all objects will be unmarked."
|
||||
(interactive "p")
|
||||
(ess-rdired-mark " " arg))
|
||||
|
||||
(defun ess-rdired-mark (mark-char arg)
|
||||
"Mark the object, using MARK-CHAR, on current line (or next ARG lines)."
|
||||
;; If we are on first line, mark all lines.
|
||||
(let ((buffer-read-only nil)
|
||||
move)
|
||||
(if (eq (point-min)
|
||||
(save-excursion (beginning-of-line) (point)))
|
||||
(progn
|
||||
;; we are on first line, so make a note of point, and count
|
||||
;; how many objects we want to delete. Then at end of defun,
|
||||
;; restore point.
|
||||
(setq move (point))
|
||||
(forward-line 1)
|
||||
(setq arg (count-lines (point) (point-max)))))
|
||||
(while (and (> arg 0) (not (eobp)))
|
||||
(setq arg (1- arg))
|
||||
(beginning-of-line)
|
||||
(progn
|
||||
(insert mark-char)
|
||||
(delete-char 1)
|
||||
(forward-line 1)))
|
||||
(if move
|
||||
(goto-char move))))
|
||||
|
||||
|
||||
(defun ess-rdired-expunge ()
|
||||
"Delete the marked objects.
|
||||
User is queried first to check that objects should really be deleted."
|
||||
(interactive)
|
||||
(let ((objs "rm(")
|
||||
(count 0))
|
||||
(save-excursion
|
||||
(goto-char (point-min)) (forward-line 1)
|
||||
(while (< (count-lines (point-min) (point))
|
||||
(count-lines (point-min) (point-max)))
|
||||
(beginning-of-line)
|
||||
(if (looking-at "^D ")
|
||||
(setq count (1+ count)
|
||||
objs (concat objs (ess-rdired-object) ", " )))
|
||||
(forward-line 1)
|
||||
))
|
||||
(if (> count 0)
|
||||
;; found objects to delete
|
||||
(progn
|
||||
(setq objs (concat
|
||||
(substring objs 0 (- (length objs) 2))
|
||||
")\n"))
|
||||
(if (yes-or-no-p (format "Delete %d %s " count
|
||||
(if (> count 1) "objects" "object")))
|
||||
(progn
|
||||
(ess-eval-linewise objs nil nil nil 'wait)
|
||||
(ess-rdired)
|
||||
)))
|
||||
;; else nothing to delete
|
||||
(message "no objects set to delete")
|
||||
)))
|
||||
|
||||
;; Fancy delete method, based on dired. Bit too much for our needs?
|
||||
;; (defun ess-rdired-expunge ()
|
||||
;; "Delete the marked objects.
|
||||
;; User is queried first to check that objects should really be deleted."
|
||||
;; (interactive)
|
||||
;; (let ((objs)
|
||||
;; (cmd "rm("))
|
||||
;; (save-excursion
|
||||
;; (goto-line 2)
|
||||
;; (while (< (count-lines (point-min) (point))
|
||||
;; (count-lines (point-min) (point-max)))
|
||||
;; (beginning-of-line)
|
||||
;; (if (looking-at "^D ")
|
||||
;; (progn
|
||||
;; (setq objs (cons (ess-rdired-object) objs ))
|
||||
;; (setq cmd (concat cmd (ess-rdired-object) ", "))
|
||||
;; ))
|
||||
;; (forward-line 1)
|
||||
;; ))
|
||||
;; (if (> (length objs) 0)
|
||||
;; ;; found objects to delete
|
||||
;; (if
|
||||
;; (dired-mark-pop-up "*RDired deletions*" 'delete
|
||||
;; objs dired-deletion-confirmer
|
||||
;; (format "delete %s "
|
||||
;; (dired-mark-prompt nil objs)))
|
||||
;; ;; should delete the objects.
|
||||
;; (progn
|
||||
;; (setq cmd (concat (substring cmd 0 (- (length cmd) 2))
|
||||
;; ")\n"))
|
||||
;; (ess-command cmd)
|
||||
;; (ess-rdired)))
|
||||
;; ;; else nothing to delete
|
||||
;; (message "no objects set to delete")
|
||||
;; )))
|
||||
|
||||
(defun ess-rdired-quit ()
|
||||
"Quit the R dired buffer."
|
||||
(interactive)
|
||||
(kill-buffer ess-rdired-buffer))
|
||||
|
||||
(defun ess-rdired-revert-buffer (ignore noconfirm)
|
||||
"Update the buffer list (in case object list has changed).
|
||||
Arguments IGNORE and NOCONFIRM currently not used."
|
||||
(ess-rdired))
|
||||
|
||||
(defun ess-rdired-help ()
|
||||
"Show help for `ess-rdired-mode'."
|
||||
(interactive)
|
||||
(describe-function 'ess-rdired-mode))
|
||||
|
||||
(defun ess-rdired-sort ()
|
||||
"Sort the rdired output according to one of the columns.
|
||||
Rotate between the alternative sorting methods."
|
||||
(interactive)
|
||||
(setq ess-rdired-sort-num (1+ ess-rdired-sort-num))
|
||||
(let ((buffer-read-only nil)
|
||||
(beg (save-excursion
|
||||
(goto-char (point-min))
|
||||
(forward-line 1)
|
||||
(point)))
|
||||
(end (point-max)))
|
||||
(if (> ess-rdired-sort-num 4)
|
||||
(setq ess-rdired-sort-num 1))
|
||||
(cond ((eq ess-rdired-sort-num 1)
|
||||
(sort-fields 1 beg end))
|
||||
((eq ess-rdired-sort-num 2)
|
||||
(sort-fields 2 beg end))
|
||||
((eq ess-rdired-sort-num 3)
|
||||
(sort-numeric-fields 3 beg end))
|
||||
((eq ess-rdired-sort-num 4)
|
||||
(sort-numeric-fields 4 beg end)))))
|
||||
|
||||
(defun ess-rdired-reverse ()
|
||||
"Reverse the current sort order."
|
||||
(interactive)
|
||||
(let ((buffer-read-only nil)
|
||||
(beg (save-excursion
|
||||
(goto-char (point-min))
|
||||
(forward-line 1)
|
||||
(point)))
|
||||
(end (point-max)))
|
||||
(reverse-region beg end)))
|
||||
|
||||
(defun ess-rdired-next-line (arg)
|
||||
"Move down lines then position at object.
|
||||
Optional prefix ARG says how many lines to move; default is one line."
|
||||
(interactive "p")
|
||||
(forward-line arg)
|
||||
(ess-rdired-move-to-object))
|
||||
|
||||
(defun ess-rdired-previous-line (arg)
|
||||
"Move up lines then position at object.
|
||||
Optional prefix ARG says how many lines to move; default is one line."
|
||||
(interactive "p")
|
||||
(forward-line (- (or arg 1))) ; -1 if arg was nil
|
||||
(ess-rdired-move-to-object))
|
||||
|
||||
(defun ess-rdired-move-to-object ()
|
||||
"Put point at start of object."
|
||||
(beginning-of-line)
|
||||
(forward-char 2)
|
||||
)
|
||||
|
||||
(defun ess-rdired-mouse-view (event)
|
||||
"In rdired, visit the object on the line you click on."
|
||||
(interactive "e")
|
||||
(let (window pos)
|
||||
(save-excursion
|
||||
(setq window (posn-window (event-end event))
|
||||
pos (posn-point (event-end event)))
|
||||
(if (not (windowp window))
|
||||
(error "No file chosen"))
|
||||
(set-buffer (window-buffer window))
|
||||
(goto-char pos)
|
||||
(ess-rdired-view))))
|
||||
|
||||
(defun ess-rdired-insert-set-properties (beg end)
|
||||
"Add mouse highlighting to each object name in the R dired buffer."
|
||||
(save-excursion
|
||||
(goto-char beg)
|
||||
(while (< (point) end)
|
||||
(ess-rdired-move-to-object)
|
||||
(add-text-properties
|
||||
(point)
|
||||
(save-excursion
|
||||
(search-forward " ")
|
||||
(1- (point)))
|
||||
'(mouse-face highlight
|
||||
help-echo "mouse-2: view object in other window"))
|
||||
(forward-line 1))))
|
||||
|
||||
(defun ess-rdired-switch-process ()
|
||||
"Switch to examine different *R* process.
|
||||
If you have multiple R processes running, e.g. *R*, *R:2*, *R:3*, you can
|
||||
use this command to choose which R process you would like to examine.
|
||||
After switching to a new process, the buffer is updated."
|
||||
(interactive)
|
||||
(ess-switch-process)
|
||||
(ess-rdired))
|
||||
|
||||
(provide 'ess-rdired)
|
||||
|
||||
;;; ess-rdired.el ends here.
|
||||
1077
elpa/ess-20180701.100/ess-roxy.el
Normal file
1077
elpa/ess-20180701.100/ess-roxy.el
Normal file
File diff suppressed because it is too large
Load Diff
440
elpa/ess-20180701.100/ess-rutils.el
Normal file
440
elpa/ess-20180701.100/ess-rutils.el
Normal file
@@ -0,0 +1,440 @@
|
||||
;;; ess-rutils.el --- R functions and keybindings to use in iESS.
|
||||
|
||||
;; Author: Sebastian Luque <sluque@gmail.com>
|
||||
;; Created: Thu Nov 10 02:20:36 2004 (UTC)
|
||||
;; Last-Updated: 2013-09-22T16:08:47+0000
|
||||
;; By: Sebastian P. Luque
|
||||
;; Version: $Id$
|
||||
|
||||
;; Copyright (c) 2005-2013 Sebastian P. Luque
|
||||
|
||||
;; 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, 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.
|
||||
|
||||
;; A copy of the GNU General Public License is available at
|
||||
;; http://www.r-project.org/Licenses/
|
||||
|
||||
;;; Commentary:
|
||||
|
||||
;; This library provides key bindings for performing basic R functions,
|
||||
;; such as loading and managing packages, as well as object manipulation
|
||||
;; (listing, viewing, and deleting), and an alternative to RSiteSearch()
|
||||
;; that uses the browse-url function. Load the library with the method you
|
||||
;; prefer (e.g. M-x load-file), but the easiest is probably to: a) make
|
||||
;; sure your load-path variable includes the directory where ess-rutils.el
|
||||
;; resides, and b) include (require 'ess-rutils) statement in your
|
||||
;; ~/.emacs.
|
||||
;;
|
||||
;; Usage:
|
||||
;;
|
||||
;; Once R is started with M-x R, you should have the key bindings defined
|
||||
;; at the end of this file working in your iESS process buffers. Simply
|
||||
;; type the desired key binding.
|
||||
;;
|
||||
;; Acknowledgements:
|
||||
;;
|
||||
;; I am grateful to John Fox for having written his init.el file for
|
||||
;; XEmacs, which motivated this Emacs alternative. I wanted to add some
|
||||
;; object management comforts and came across Stephen Eglen's
|
||||
;; ess-rdired.el, which provides a lot of these. ess-rutils.el builds upon
|
||||
;; on a *lot* of ideas from ess-rdired.el.
|
||||
|
||||
;; TODO: Refactor and remove byte-compile-warnings file-local variable.
|
||||
(defvar pkg)
|
||||
|
||||
;;; Code:
|
||||
|
||||
;; Autoloads and requires
|
||||
(require 'ess-site)
|
||||
(require 'ess-rdired)
|
||||
|
||||
(defvar ess-rutils-buf "*R temp*"
|
||||
"Name of temporary R buffer.")
|
||||
|
||||
(defvar ess-rutils-mode-map nil
|
||||
"Keymap for the *R temp* buffer.")
|
||||
|
||||
(defvar ess-rutils-rhtml-fn
|
||||
(expand-file-name "ess-rutils-help-start.R" ess-etc-directory)
|
||||
"Path to the file defining the R function .rutils.help.start().
|
||||
This file is loaded into the inferior R process so that
|
||||
`ess-rutils-html-docs' can use .rutils.help.start().")
|
||||
|
||||
(if ess-rutils-mode-map
|
||||
()
|
||||
(setq ess-rutils-mode-map (make-sparse-keymap))
|
||||
(define-key ess-rutils-mode-map "l" 'ess-rutils-loadpkg)
|
||||
(define-key ess-rutils-mode-map "i" 'ess-rutils-mark-install)
|
||||
(define-key ess-rutils-mode-map "I" 'ess-rutils-install)
|
||||
(define-key ess-rutils-mode-map "u" 'ess-rutils-unmark)
|
||||
(define-key ess-rutils-mode-map "q" 'ess-rutils-quit)
|
||||
(define-key ess-rutils-mode-map "?" 'ess-rutils-help))
|
||||
|
||||
(defun ess-rutils-mode ()
|
||||
"Major mode for output from `ess-rutils-local-pkgs' and `ess-rutils-repos-pkgs'.
|
||||
Useful bindings to handle package loading and installing.
|
||||
\\{ess-rutils-mode-map}"
|
||||
(kill-all-local-variables)
|
||||
(use-local-map ess-rutils-mode-map)
|
||||
(setq major-mode 'ess-rutils-mode)
|
||||
(setq mode-name (concat "R utils " ess-local-process-name)))
|
||||
|
||||
(defun ess-rutils-local-pkgs ()
|
||||
"List all packages in all libraries."
|
||||
(interactive)
|
||||
(if (get-buffer ess-rutils-buf)
|
||||
(progn
|
||||
(set-buffer ess-rutils-buf)
|
||||
(setq buffer-read-only nil)))
|
||||
(ess-execute
|
||||
"writeLines(paste(' ', sort(.packages(all.available=TRUE)), sep=''))"
|
||||
nil
|
||||
(substring ess-rutils-buf 1 (- (length ess-rutils-buf) 1)))
|
||||
(pop-to-buffer ess-rutils-buf)
|
||||
(save-excursion
|
||||
(beginning-of-line) (open-line 1)
|
||||
(insert "**Available packages in all local R libraries**"))
|
||||
(setq buffer-read-only t)
|
||||
(ess-rutils-mode)
|
||||
(if (fboundp 'fit-frame)
|
||||
(fit-frame)))
|
||||
|
||||
(defun ess-rutils-namepkg ()
|
||||
"Return name of the package on current line."
|
||||
(save-excursion
|
||||
(beginning-of-line)
|
||||
(if (looking-at "*")
|
||||
nil
|
||||
(forward-char 2)
|
||||
(let (beg)
|
||||
(setq beg (point))
|
||||
(end-of-line) ;assume package names are separated by newlines.
|
||||
(buffer-substring-no-properties beg (point))))))
|
||||
|
||||
(defun ess-rutils-loadpkg ()
|
||||
"Load package from a library."
|
||||
(interactive)
|
||||
(let ((oklocal nil))
|
||||
(save-excursion
|
||||
(goto-char (point-min))
|
||||
(if (search-forward "libraries**" nil t)
|
||||
(setq oklocal t)))
|
||||
(if oklocal
|
||||
(progn
|
||||
(setq pkg (ess-rutils-namepkg))
|
||||
(ess-execute (concat "library('" pkg "', character.only=TRUE)")
|
||||
'buffer))
|
||||
nil)))
|
||||
|
||||
(defun ess-rutils-repos-pkgs ()
|
||||
"List available packages from the repositories as listed by
|
||||
getOptions(\"repos\") in the current R session."
|
||||
(interactive)
|
||||
(if (get-buffer ess-rutils-buf)
|
||||
(progn
|
||||
(set-buffer ess-rutils-buf)
|
||||
(setq buffer-read-only nil)))
|
||||
(ess-execute (concat "writeLines(paste(' \"', "
|
||||
"rownames(available.packages()), '\"', sep=''))")
|
||||
nil
|
||||
(substring ess-rutils-buf 1 (- (length ess-rutils-buf) 1)))
|
||||
(pop-to-buffer ess-rutils-buf)
|
||||
(save-excursion
|
||||
(kill-line 5)
|
||||
(insert "**packages available to install**\n"))
|
||||
(setq buffer-read-only t)
|
||||
(ess-rutils-mode)
|
||||
(if (fboundp 'fit-frame)
|
||||
(fit-frame)))
|
||||
|
||||
(defun ess-rutils-mark-install (arg)
|
||||
"Mark the current package for installing.
|
||||
ARG lines to mark is passed to `ess-rutils-mark'."
|
||||
(interactive "p")
|
||||
;; if this is not an install package buffer return nil.
|
||||
(let ((okmark nil))
|
||||
(save-excursion
|
||||
(goto-char (point-min))
|
||||
(if (search-forward "install**" nil t)
|
||||
(setq okmark t)))
|
||||
(if okmark
|
||||
(ess-rutils-mark "I" arg)
|
||||
nil)))
|
||||
|
||||
(defun ess-rutils-unmark (arg)
|
||||
"Unmark the packages, passing ARG lines to unmark to `ess-rutils-mark'."
|
||||
(interactive "p")
|
||||
(ess-rutils-mark " " arg))
|
||||
|
||||
;; The next two functions almost verbatim from ess-rdired.el.
|
||||
(defun ess-rutils-mark (mark-char arg)
|
||||
"Use MARK-CHAR to mark package on current line, or next ARG lines."
|
||||
;; If we are on first line, mark all lines.
|
||||
(let ((buffer-read-only nil)
|
||||
move)
|
||||
(if (eq (point-min)
|
||||
(save-excursion (beginning-of-line) (point)))
|
||||
(progn
|
||||
;; we are on first line, so make a note of point, and count
|
||||
;; how many objects we want to delete. Then at end of defun,
|
||||
;; restore point.
|
||||
(setq move (point))
|
||||
(forward-line 1)
|
||||
(setq arg (count-lines (point) (point-max)))))
|
||||
(while (and (> arg 0) (not (eobp)))
|
||||
(setq arg (1- arg))
|
||||
(beginning-of-line)
|
||||
(progn
|
||||
(insert mark-char)
|
||||
(delete-char 1)
|
||||
(forward-line 1)))
|
||||
(if move
|
||||
(goto-char move))))
|
||||
|
||||
(defun ess-rutils-install ()
|
||||
"Install all packages flagged for installation, and return to the iESS buffer.
|
||||
User is asked for confirmation."
|
||||
(interactive)
|
||||
(let ((inst "install.packages(c(")
|
||||
(count 0))
|
||||
(save-excursion
|
||||
(goto-char (point-min))
|
||||
(forward-line)
|
||||
;; as long as number of lines between buffer start and point is smaller
|
||||
;; than the total number of lines in buffer, go to the beginning of the
|
||||
;; line, check if line is flagged, and if it is, advance the counter by
|
||||
;; one, create the root of install function, add the package name,
|
||||
;; insert a comma, and move forward a line.
|
||||
(while (< (count-lines (point-min) (point))
|
||||
(count-lines (point-min) (point-max)))
|
||||
(beginning-of-line)
|
||||
(if (looking-at "^I ")
|
||||
(setq count (1+ count)
|
||||
inst (concat inst (ess-rutils-namepkg) ", " )))
|
||||
(forward-line 1)))
|
||||
(if (> count 0) ;found packages to install
|
||||
(progn
|
||||
;; Fix the install function created before and close it.
|
||||
(setq inst (concat
|
||||
(substring inst 0 (- (length inst) 2)) "))"))
|
||||
;;
|
||||
(if (yes-or-no-p (format "Install %d %s " count
|
||||
(if (> count 1) "packages" "package")))
|
||||
(progn
|
||||
(ess-execute inst 'buffer)
|
||||
(ess-rutils-quit))))
|
||||
;; else nothing to install
|
||||
(message "no packages flagged to install"))))
|
||||
|
||||
(defun ess-rutils-update-pkgs (lib repos)
|
||||
"Update packages in library LIB and repos REPOS. Defaults are the first
|
||||
element returned by .libPaths() for LIB, and the repository named CRAN
|
||||
returned by getOption(\"repos\") for REPOS. This also uses checkBuilt=TRUE
|
||||
to rebuild installed packages if needed."
|
||||
(interactive "DPath to library to update: \nsrepos: ")
|
||||
(if (string= "" lib)
|
||||
(setq lib
|
||||
(car (ess-get-words-from-vector
|
||||
"as.character(.libPaths())\n"))))
|
||||
(if (string= "" repos)
|
||||
(setq repos
|
||||
(car (ess-get-words-from-vector
|
||||
"as.character(getOption(\"repos\")[\"CRAN\"])\n"))))
|
||||
(ess-execute (concat "update.packages(lib.loc='"
|
||||
lib "', repos='" repos
|
||||
"', ask=FALSE, checkBuilt=TRUE)") 'buffer))
|
||||
|
||||
(defun ess-rutils-apropos (string)
|
||||
"Search for STRING using apropos."
|
||||
(interactive "sApropos search for? ")
|
||||
(if (get-buffer ess-rutils-buf)
|
||||
(progn
|
||||
(set-buffer ess-rutils-buf)
|
||||
(setq buffer-read-only nil)))
|
||||
(ess-execute (concat "apropos('" string "')")
|
||||
nil
|
||||
(substring ess-rutils-buf 1 (- (length ess-rutils-buf) 1)))
|
||||
(pop-to-buffer ess-rutils-buf)
|
||||
(setq buffer-read-only t)
|
||||
(ess-rutils-mode))
|
||||
|
||||
(defun ess-rutils-rm-all ()
|
||||
"Remove all R objects."
|
||||
(interactive)
|
||||
(if (y-or-n-p "Delete all objects? ")
|
||||
(ess-execute "rm(list=ls())" 'buffer)))
|
||||
|
||||
(defun ess-rutils-load-wkspc (file)
|
||||
"Load workspace FILE into R."
|
||||
(interactive "fFile with workspace to load: ")
|
||||
(ess-execute (concat "load('" file "')") 'buffer))
|
||||
|
||||
(defun ess-rutils-save-wkspc (file)
|
||||
"Save FILE workspace.
|
||||
File extension not required."
|
||||
(interactive "FSave workspace to file (no extension): ")
|
||||
(ess-execute (concat "save.image('" file ".RData')") 'buffer))
|
||||
|
||||
(defun ess-rutils-quit ()
|
||||
"Kill the ess-rutils buffer and return to the iESS buffer."
|
||||
(interactive)
|
||||
(ess-switch-to-end-of-ESS)
|
||||
(kill-buffer ess-rutils-buf))
|
||||
|
||||
(defun ess-rutils-html-docs (&optional remote)
|
||||
"Use `browse-url' to navigate R html documentation.
|
||||
Documentation is produced by a modified help.start(), that returns the URL
|
||||
produced by GNU R's http server. This function is defined in a file given
|
||||
by the path in variable `ess-rutils-rhtml-fn'. If called with a prefix,
|
||||
the modified help.start() is called with update=TRUE. The optional REMOTE
|
||||
argument should be a string with a valid URL for the 'R_HOME' directory on
|
||||
a remote server (defaults to NULL)."
|
||||
(interactive)
|
||||
(let* ((update (if current-prefix-arg "update=TRUE" "update=FALSE"))
|
||||
(remote (if (or (and remote (not (string= "" remote))))
|
||||
(concat "remote=" remote) "remote=NULL"))
|
||||
(rhtml (format ".rutils.help.start(%s, %s)\n" update remote))
|
||||
(tmpbuf (get-buffer-create "**ess-rutils-mode**")))
|
||||
(ess-command rhtml tmpbuf)
|
||||
(set-buffer tmpbuf)
|
||||
(let* ((begurl (search-backward "http://"))
|
||||
(endurl (search-forward "index.html"))
|
||||
(url (buffer-substring-no-properties begurl endurl)))
|
||||
(browse-url url))
|
||||
(kill-buffer tmpbuf)))
|
||||
|
||||
(defun ess-rutils-rsitesearch (string)
|
||||
"Search the R archives for STRING, using default criteria, and show results
|
||||
using `browse-url'. If called with a prefix, options are offered (with
|
||||
completion) for matches per page, sections of the archives to search,
|
||||
displaying results in long or short formats, and sorting by any given field.
|
||||
Options should be separated by value of `crm-default-separator'."
|
||||
(interactive "sSearch string: ")
|
||||
(let ((site "http://search.r-project.org/cgi-bin/namazu.cgi?query=")
|
||||
(okstring (replace-regexp-in-string " +" "+" string)))
|
||||
(if current-prefix-arg
|
||||
(let ((mpp (concat
|
||||
"&max="
|
||||
(completing-read
|
||||
"Matches per page: "
|
||||
'(("20" 1) ("30" 2) ("40" 3) ("50" 4) ("100" 5)))))
|
||||
(format (concat
|
||||
"&result="
|
||||
(completing-read
|
||||
"Format: " '(("normal" 1) ("short" 2))
|
||||
nil t "normal" nil "normal")))
|
||||
(sortby (concat
|
||||
"&sort="
|
||||
(completing-read
|
||||
"Sort by: "
|
||||
'(("score" 1) ("date:late" 2) ("date:early" 3)
|
||||
("field:subject:ascending" 4)
|
||||
("field:subject:decending" 5)
|
||||
("field:from:ascending" 6) ("field:from:decending" 7)
|
||||
("field:size:ascending" 8) ("field:size:decending" 9))
|
||||
nil t "score" nil "score")))
|
||||
(restrict (concat
|
||||
"&idxname="
|
||||
(mapconcat
|
||||
'identity
|
||||
(completing-read-multiple
|
||||
"Limit search to: "
|
||||
'(("Rhelp02a" 1) ("functions" 2)
|
||||
("docs" 3) ("Rhelp01" 4))
|
||||
nil t "Rhelp02a,functions,docs" nil
|
||||
"Rhelp02a,functions,docs") "&idxname="))))
|
||||
(browse-url (concat site okstring mpp format sortby restrict)))
|
||||
(browse-url (concat site okstring "&max=20&result=normal&sort=score"
|
||||
"&idxname=Rhelp02a&idxname=functions&idxname=docs")))))
|
||||
|
||||
(defun ess-rutils-help ()
|
||||
"Show help on `ess-rutils-mode'."
|
||||
(interactive)
|
||||
(describe-function 'ess-rutils-mode))
|
||||
|
||||
(defun ess-rutils-help-search (string)
|
||||
"Search for STRING using help.search()."
|
||||
(interactive "sString to search for? ")
|
||||
(if (get-buffer ess-rutils-buf)
|
||||
(progn
|
||||
(set-buffer ess-rutils-buf)
|
||||
(setq buffer-read-only nil)))
|
||||
(ess-execute (concat "help.search('" string "')")
|
||||
nil
|
||||
(substring ess-rutils-buf 1 (- (length ess-rutils-buf) 1)))
|
||||
(pop-to-buffer ess-rutils-buf)
|
||||
(setq buffer-read-only t)
|
||||
(ess-rutils-mode))
|
||||
|
||||
;; Customizable variable to allow ess-rutils-keys to activate default key bindings.
|
||||
;; Suggested by Richard M. Heiberger.
|
||||
(defcustom ess-rutils-keys t
|
||||
"Non-nil means activate ess-rutils keybindings and menu."
|
||||
:group 'ess-R
|
||||
:type 'boolean)
|
||||
|
||||
;; Keybindings
|
||||
(defun ess-rutils-keys ()
|
||||
"Provide key bindings."
|
||||
(interactive)
|
||||
(when ess-rutils-keys
|
||||
(define-key inferior-ess-mode-map [(control c) (control \.) (l)]
|
||||
'ess-rutils-local-pkgs)
|
||||
(define-key inferior-ess-mode-map [(control c) (control \.) (r)]
|
||||
'ess-rutils-repos-pkgs)
|
||||
(define-key inferior-ess-mode-map [(control c) (control \.) (u)]
|
||||
'ess-rutils-update-pkgs)
|
||||
(define-key inferior-ess-mode-map [(control c) (control \.) (a)]
|
||||
'ess-rutils-apropos)
|
||||
(define-key inferior-ess-mode-map [(control c) (control \.) (m)]
|
||||
'ess-rutils-rm-all)
|
||||
(define-key inferior-ess-mode-map [(control c) (control \.) (o)]
|
||||
'ess-rdired)
|
||||
(define-key inferior-ess-mode-map [(control c) (control \.) (w)]
|
||||
'ess-rutils-load-wkspc)
|
||||
(define-key inferior-ess-mode-map [(control c) (control \.) (s)]
|
||||
'ess-rutils-save-wkspc)
|
||||
(define-key inferior-ess-mode-map [(control c) (control \.) (d)]
|
||||
'ess-change-directory)
|
||||
(define-key inferior-ess-mode-map [(control c) (control \.) (H)]
|
||||
'ess-rutils-html-docs)))
|
||||
|
||||
(easy-menu-define ess-rutils-mode-menu inferior-ess-mode-menu
|
||||
"Submenu of `inferior-ess-mode' to use with RUtils."
|
||||
'("RUtils"
|
||||
["Manage objects" ess-rdired t]
|
||||
["Remove objects" ess-rutils-rm-all t]
|
||||
"------"
|
||||
["Local packages" ess-rutils-local-pkgs t]
|
||||
["Packages in repositories" ess-rutils-repos-pkgs t]
|
||||
["Update packages" ess-rutils-update-pkgs t]
|
||||
"------"
|
||||
["Load workspace" ess-rutils-load-wkspc t]
|
||||
["Save workspace" ess-rutils-save-wkspc t]
|
||||
["Change directory" ess-change-directory t]
|
||||
"------"
|
||||
["Browse HTML" ess-rutils-html-docs t]
|
||||
["Apropos" ess-rutils-apropos t]))
|
||||
|
||||
(easy-menu-add-item inferior-ess-mode-menu nil
|
||||
ess-rutils-mode-menu)
|
||||
|
||||
(add-hook 'inferior-ess-mode-hook 'ess-rutils-keys t)
|
||||
(add-hook 'ess-r-post-run-hook
|
||||
(lambda ()
|
||||
(ess--inject-code-from-file ess-rutils-rhtml-fn)) t)
|
||||
|
||||
|
||||
(provide 'ess-rutils)
|
||||
|
||||
;;; ess-rutils.el ends here
|
||||
|
||||
;; Local Variables:
|
||||
;; byte-compile-warnings: (not lexical)
|
||||
;; End:
|
||||
818
elpa/ess-20180701.100/ess-s-lang.el
Normal file
818
elpa/ess-20180701.100/ess-s-lang.el
Normal file
@@ -0,0 +1,818 @@
|
||||
;;; ess-s-lang.el --- Support for editing S source code
|
||||
|
||||
;; Copyright (C) 1989-1997 D. Bates, Kademan, Ritter, D.M. Smith, K. Hornik,
|
||||
;; R.M. Heiberger, M. Maechler, and A.J. Rossini.
|
||||
;; Copyright (C) 1998-2015 A.J. Rossini, Richard M. Heiberger, Martin
|
||||
;; Maechler, Kurt Hornik, Rodney Sparapani, and Stephen Eglen.
|
||||
|
||||
;; Author: A.J. Rossini <rossini@biostat.washington.edu>
|
||||
;; Created: 26 Aug 1997
|
||||
;; Maintainer: ESS-core <ESS-core@r-project.org>
|
||||
|
||||
;; This file is part of ESS (Emacs Speaks Statistics).
|
||||
|
||||
;; 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/
|
||||
|
||||
;;; Commentary:
|
||||
|
||||
;; Code for general editing S source code (specializes to S, S+, R).
|
||||
|
||||
;;; Code:
|
||||
|
||||
; Requires and autoloads
|
||||
|
||||
(require 'ess-utils)
|
||||
|
||||
(autoload 'speedbar-add-supported-extension "speedbar.el")
|
||||
|
||||
; Configuration variables
|
||||
|
||||
(defvar S-syntax-table
|
||||
(let ((S-syntax-table (make-syntax-table)))
|
||||
(modify-syntax-entry ?\\ "\\" S-syntax-table)
|
||||
(modify-syntax-entry ?+ "." S-syntax-table)
|
||||
(modify-syntax-entry ?- "." S-syntax-table)
|
||||
(modify-syntax-entry ?= "." S-syntax-table)
|
||||
(modify-syntax-entry ?% "." S-syntax-table)
|
||||
(modify-syntax-entry ?< "." S-syntax-table)
|
||||
(modify-syntax-entry ?> "." S-syntax-table)
|
||||
(modify-syntax-entry ?& "." S-syntax-table)
|
||||
(modify-syntax-entry ?| "." S-syntax-table)
|
||||
(modify-syntax-entry ?\' "\"" S-syntax-table)
|
||||
(modify-syntax-entry ?\" "\"" S-syntax-table)
|
||||
(modify-syntax-entry ?# "<" S-syntax-table) ; open comment
|
||||
(modify-syntax-entry ?\n ">" S-syntax-table) ; close comment
|
||||
;;(modify-syntax-entry ?. "w" S-syntax-table) ; "." used in S obj names
|
||||
(modify-syntax-entry ?. "_" S-syntax-table) ; see above/below,
|
||||
; plus consider separation.
|
||||
(modify-syntax-entry ?$ "_" S-syntax-table); foo$comp = 1 symbol(completion)
|
||||
(modify-syntax-entry ?@ "_" S-syntax-table); foo@slot = 1 symbol(completion)
|
||||
(modify-syntax-entry ?_ "_" S-syntax-table)
|
||||
(modify-syntax-entry ?: "_" S-syntax-table)
|
||||
(modify-syntax-entry ?* "." S-syntax-table)
|
||||
(modify-syntax-entry ?< "." S-syntax-table)
|
||||
(modify-syntax-entry ?> "." S-syntax-table)
|
||||
(modify-syntax-entry ?/ "." S-syntax-table)
|
||||
S-syntax-table)
|
||||
"Syntax table for S code."
|
||||
)
|
||||
|
||||
(defvar S-editing-alist
|
||||
'((paragraph-start . (concat "\\s-*$\\|" page-delimiter))
|
||||
(paragraph-separate . (concat "\\s-*$\\|" page-delimiter))
|
||||
(paragraph-ignore-fill-prefix . t)
|
||||
(require-final-newline . mode-require-final-newline)
|
||||
;;(comment-indent-function . 'S-comment-indent)
|
||||
;;(ess-comment-indent . 'S-comment-indent)
|
||||
;;(ess-indent-line . 'S-indent-line)
|
||||
;;(ess-calculate-indent . 'ess-calculate-indent)
|
||||
(indent-line-function . 'ess-indent-line)
|
||||
(parse-sexp-ignore-comments . t)
|
||||
(ess-style . ess-default-style)
|
||||
;;(ess-keep-dump-files . 'ask)
|
||||
(ess-mode-syntax-table . S-syntax-table)
|
||||
;; For Changelog add, require ' ' before <- : "attr<-" is a function name :
|
||||
(add-log-current-defun-header-regexp . "^\\(.+\\)\\s-+<-[ \t\n]*function")
|
||||
(ess-font-lock-keywords . 'ess-S-font-lock-keywords)
|
||||
(ess-font-lock-defaults . (ess--extract-default-fl-keywords ess-S-font-lock-keywords))
|
||||
(font-lock-defaults . '(ess-font-lock-defaults
|
||||
nil nil ((?\. . "w") (?\_ . "w"))))
|
||||
)
|
||||
"General options for S and S+ source files.")
|
||||
|
||||
(defvar inferior-S-language-start
|
||||
'(concat "options("
|
||||
"STERM='" ess-STERM "'"
|
||||
", str.dendrogram.last=\"'\""
|
||||
(if ess-editor (concat ", editor='" ess-editor "'"))
|
||||
(if ess-pager (concat ", pager='" ess-pager "', help.pager='" ess-pager "'"))
|
||||
", show.error.locations=TRUE"
|
||||
")")
|
||||
"S language expression for startup -- default for all S dialects.")
|
||||
|
||||
(defconst S-common-cust-alist
|
||||
'((ess-language . "S")
|
||||
(inferior-ess-exit-command . "q()\n")
|
||||
(inferior-ess-language-start . (eval inferior-S-language-start))
|
||||
(comint-use-prompt-regexp . t) ;;use fields if nil
|
||||
(comint-process-echoes . t)
|
||||
;; these prompt are the same for all S-languages As long as custom prompt
|
||||
;; ends in inferior-ess-primary-prompt everything should work as expected.
|
||||
(inferior-ess-primary-prompt . "> ")
|
||||
;; (inferior-ess-secondary-prompt . "[+:] ") ;; catch Selection: and alike
|
||||
(inferior-ess-secondary-prompt . "+ ") ;; catch Selection: and alike
|
||||
(comment-start . "#")
|
||||
(ess-imenu-generic-expression . ess-imenu-S-generic-expression)
|
||||
(comment-add . 1)
|
||||
(comment-start-skip . "#+ *")
|
||||
(comment-use-syntax . t) ; see log for bug report 2013-06-07
|
||||
(comment-column . 40)
|
||||
(ess-no-skip-regexp . (concat "^ *@\\|" (default-value 'ess-no-skip-regexp)))
|
||||
;; inferior-ess-prompt is used by comint for navigation, only if
|
||||
;; comint-use-prompt-regexp is t; (transcript-mode also relies on this regexp)
|
||||
(inferior-ess-prompt . inferior-S-prompt)
|
||||
(ess-get-help-topics-function . #'ess-s-get-help-topics-function)
|
||||
(ess-getwd-command . "getwd()\n")
|
||||
(ess-setwd-command . "setwd('%s')\n")
|
||||
(ess-funargs-command . ".ess_funargs(\"%s\")\n")
|
||||
(fill-nobreak-predicate . 'ess-inside-string-p)
|
||||
(normal-auto-fill-function . 'ess-do-auto-fill)
|
||||
(ess-execute-screen-options-command . "options(width=%d, length=99999)\n")
|
||||
)
|
||||
"S-language common settings for all <dialect>-customize-alist s")
|
||||
|
||||
(defconst S+common-cust-alist
|
||||
(append
|
||||
'((ess-suffix . "S")
|
||||
(ess-mode-syntax-table . S-syntax-table)
|
||||
(ess-help-sec-regex . ess-help-S+-sec-regex)
|
||||
(ess-help-sec-keys-alist . ess-help-S+sec-keys-alist)
|
||||
(ess-change-sp-regexp . ess-S+-change-sp-regexp)
|
||||
(ess-function-pattern . ess-s-function-pattern)
|
||||
(ess-function-template . " <- \n#\nfunction()\n{\n\n}\n")
|
||||
(ess-dump-filename-template . (replace-regexp-in-string
|
||||
"S$" ess-suffix ; in the one from custom:
|
||||
ess-dump-filename-template-proto))
|
||||
(ess-traceback-command . "traceback()\n")
|
||||
(ess-mode-editing-alist . S-editing-alist)
|
||||
|
||||
(ess-dumped-missing-re
|
||||
. "\\(\\(<-\\|=\\)\nDumped\n\\'\\)\\|\\(\\(<-\\|=\\)\\(\\s \\|\n\\)*\\'\\)")
|
||||
(ess-syntax-error-re
|
||||
. "\\(Syntax error: .*\\) at line \\([0-9]*\\), file \\(.*\\)$")
|
||||
(inferior-ess-objects-command . inferior-Splus-objects-command)
|
||||
(ess-describe-object-at-point-commands . 'ess-S-describe-object-at-point-commands)
|
||||
(inferior-ess-font-lock-keywords . 'inferior-S-font-lock-keywords)
|
||||
(ess-editor . S-editor)
|
||||
(ess-pager . S-pager)
|
||||
)
|
||||
S-common-cust-alist)
|
||||
"Common settings for all S+<*>-customize-alist s"
|
||||
)
|
||||
|
||||
;;; Changes from S to S-PLUS 3.x. (standard S3 should be in ess-s-lang!).
|
||||
|
||||
(defconst ess-help-S+sec-keys-alist
|
||||
'((?a . "ARGUMENTS:")
|
||||
(?b . "BACKGROUND:")
|
||||
(?B . "BUGS:")
|
||||
(?d . "DESCRIPTION:")
|
||||
(?D . "DETAILS:")
|
||||
(?e . "EXAMPLES:")
|
||||
(?n . "NOTE:")
|
||||
(?O . "OPTIONAL ARGUMENTS:")
|
||||
(?R . "REQUIRED ARGUMENTS:")
|
||||
(?r . "REFERENCES:")
|
||||
(?s . "SEE ALSO:")
|
||||
(?S . "SIDE EFFECTS:")
|
||||
(?u . "USAGE:")
|
||||
(?v . "VALUE:"))
|
||||
"Alist of (key . string) pairs for use in section searching.")
|
||||
;;; `key' indicates the keystroke to use to search for the section heading
|
||||
;;; `string' in an S help file. `string' is used as part of a
|
||||
;;; regexp-search, and so specials should be quoted.
|
||||
|
||||
;; S ver.3 (NOT S-Plus)
|
||||
(defconst ess-help-S3-sec-keys-alist
|
||||
'((?a . "ARGUMENTS:")
|
||||
(?b . "BACKGROUND:")
|
||||
(?B . "BUGS:")
|
||||
(?d . "DESCRIPTION:")
|
||||
(?D . "DETAILS:")
|
||||
(?e . "EXAMPLES:")
|
||||
(?n . "NOTE:")
|
||||
(?r . "REFERENCES:")
|
||||
(?s . "SEE ALSO:")
|
||||
(?S . "SIDE EFFECTS:")
|
||||
(?u . "USAGE:")
|
||||
(?v . "VALUE:"))
|
||||
"Help section keys for S ver.3.")
|
||||
|
||||
;; S ver.4 (NOT S-Plus)
|
||||
(defconst ess-help-S4-sec-keys-alist
|
||||
'((?a . "ARGUMENTS:")
|
||||
(?b . "BACKGROUND:")
|
||||
(?B . "BUGS:")
|
||||
(?d . "DESCRIPTION:")
|
||||
(?D . "DETAILS:")
|
||||
(?e . "EXAMPLES:")
|
||||
(?n . "NOTE:")
|
||||
(?r . "REFERENCES:")
|
||||
(?s . "SEE ALSO:")
|
||||
(?S . "SIDE EFFECTS:")
|
||||
(?u . "USAGE:")
|
||||
(?v . "VALUE:"))
|
||||
"Help section keys for S4.")
|
||||
|
||||
|
||||
(defconst ess-help-S+-sec-regex "^[A-Z. ---]+:$"
|
||||
"Reg(ular) Ex(pression) of section headers in help file.")
|
||||
|
||||
; Function Definitions
|
||||
|
||||
(defun S-comment-indent ()
|
||||
"Indentation for S comments."
|
||||
(if (or (looking-at "###")
|
||||
(and (looking-at "#!") (= 1 (line-number-at-pos))))
|
||||
(current-column)
|
||||
(if (looking-at "##")
|
||||
(let ((tem (ess-calculate-indent)))
|
||||
(if (listp tem) (car tem) tem))
|
||||
(skip-chars-backward " \t")
|
||||
(max (if (bolp) 0 (1+ (current-column)))
|
||||
comment-column))))
|
||||
|
||||
;; VS: these are ess-indent-line and ess-calculate-indent from 2004 already,so
|
||||
;; commented out to avoid confusion:
|
||||
|
||||
;; (defun S-indent-line ()
|
||||
;; "Indent current line as S code.
|
||||
;; Return the amount the indentation changed by."
|
||||
;; (let ((indent (S-calculate-indent nil))
|
||||
;; beg shift-amt
|
||||
;; (case-fold-search nil)
|
||||
;; (pos (- (point-max) (point))))
|
||||
;; (beginning-of-line)
|
||||
;; (setq beg (point))
|
||||
;; (cond ((eq indent nil)
|
||||
;; (setq indent (current-indentation)))
|
||||
;; (t
|
||||
;; (skip-chars-forward " \t")
|
||||
;; (cond ((and ess-indent-with-fancy-comments ;; ### or #!
|
||||
;; (or (looking-at "###")
|
||||
;; (and (looking-at "#!") (= 1 (line-number-at-pos)))))
|
||||
;; (setq indent 0))
|
||||
;; ;; Single # comment
|
||||
;; ((and ess-indent-with-fancy-comments
|
||||
;; (looking-at "#") (not (looking-at "##")))
|
||||
;; (setq indent comment-column))
|
||||
;; (t
|
||||
;; (if (eq indent t) (setq indent 0))
|
||||
;; (if (listp indent) (setq indent (car indent)))
|
||||
;; (cond ((and (looking-at "else\\b")
|
||||
;; (not (looking-at "else\\s_")))
|
||||
;; (setq indent (save-excursion
|
||||
;; (ess-backward-to-start-of-if)
|
||||
;; (+ ess-else-offset (current-indentation)))))
|
||||
;; ((= (following-char) ?})
|
||||
;; (setq indent
|
||||
;; (+ indent
|
||||
;; (- ess-close-brace-offset ess-indent-offset))))
|
||||
;; ((= (following-char) ?{)
|
||||
;; (setq indent (+ indent ess-brace-offset))))))))
|
||||
;; (skip-chars-forward " \t")
|
||||
;; (setq shift-amt (- indent (current-column)))
|
||||
;; (if (zerop shift-amt)
|
||||
;; (if (> (- (point-max) pos) (point))
|
||||
;; (goto-char (- (point-max) pos)))
|
||||
;; (delete-region beg (point))
|
||||
;; (indent-to indent)
|
||||
;; ;; If initial point was within line's indentation,
|
||||
;; ;; position after the indentation.
|
||||
;; ;; Else stay at same point in text.
|
||||
;; (if (> (- (point-max) pos) (point))
|
||||
;; (goto-char (- (point-max) pos))))
|
||||
;; shift-amt))
|
||||
|
||||
;; (defun S-calculate-indent (&optional parse-start)
|
||||
;; "Return appropriate indentation for current line as S code.
|
||||
;; In usual case returns an integer: the column to indent to.
|
||||
;; Returns nil if line starts inside a string, t if in a comment."
|
||||
;; (save-excursion
|
||||
;; (beginning-of-line)
|
||||
;; (let ((indent-point (point))
|
||||
;; (beginning-of-defun-function nil) ;; don't call ess-beginning-of-function
|
||||
;; (case-fold-search nil)
|
||||
;; state
|
||||
;; containing-sexp)
|
||||
;; (if parse-start
|
||||
;; (goto-char parse-start)
|
||||
;; (beginning-of-defun))
|
||||
;; (while (< (point) indent-point)
|
||||
;; (setq parse-start (point))
|
||||
;; (setq state (parse-partial-sexp (point) indent-point 0))
|
||||
;; (setq containing-sexp (car (cdr state))))
|
||||
;; (cond ((or (nth 3 state) (nth 4 state))
|
||||
;; ;; return nil or t if should not change this line
|
||||
;; (nth 4 state))
|
||||
;; ((null containing-sexp)
|
||||
;; ;; Line is at top level. May be data or function definition,
|
||||
;; (beginning-of-line)
|
||||
;; (if (and (/= (following-char) ?\{)
|
||||
;; (save-excursion
|
||||
;; (ess-backward-to-noncomment (point-min))
|
||||
;; (ess-continued-statement-p)))
|
||||
;; ess-continued-statement-offset
|
||||
;; 0)) ; Unless it starts a function body
|
||||
;; ((/= (char-after containing-sexp) ?{)
|
||||
;; ;; line is expression, not statement:
|
||||
;; ;; indent to just after the surrounding open.
|
||||
;; (goto-char containing-sexp)
|
||||
;; (let ((bol (save-excursion (beginning-of-line) (point))))
|
||||
|
||||
;; ;; modified by shiba@isac 7.3.1992
|
||||
;; (cond ((and (numberp ess-expression-offset)
|
||||
;; (re-search-backward "[ \t]*expression[ \t]*" bol t))
|
||||
;; ;; This regexp match every "expression".
|
||||
;; ;; modified by shiba
|
||||
;; ;;(forward-sexp -1)
|
||||
;; (beginning-of-line)
|
||||
;; (skip-chars-forward " \t")
|
||||
;; ;; End
|
||||
;; (+ (current-column) ess-expression-offset))
|
||||
;; ((and (numberp ess-arg-function-offset)
|
||||
;; (re-search-backward
|
||||
;; "=[ \t]*\\s\"?\\(\\w\\|\\s_\\)+\\s\"?[ \t]*"
|
||||
;; bol
|
||||
;; t))
|
||||
;; (forward-sexp -1)
|
||||
;; (+ (current-column) ess-arg-function-offset))
|
||||
;; ;; "expression" is searched before "=".
|
||||
;; ;; End
|
||||
|
||||
;; (t
|
||||
;; (progn (goto-char (1+ containing-sexp))
|
||||
;; (current-column))))))
|
||||
;; (t
|
||||
;; ;; Statement level. Is it a continuation or a new statement?
|
||||
;; ;; Find previous non-comment character.
|
||||
;; (goto-char indent-point)
|
||||
;; (ess-backward-to-noncomment containing-sexp)
|
||||
;; ;; Back up over label lines, since they don't
|
||||
;; ;; affect whether our line is a continuation.
|
||||
;; (while (eq (preceding-char) ?\,)
|
||||
;; (ess-backward-to-start-of-continued-exp containing-sexp)
|
||||
;; (beginning-of-line)
|
||||
;; (ess-backward-to-noncomment containing-sexp))
|
||||
;; ;; Now we get the answer.
|
||||
;; (if (ess-continued-statement-p)
|
||||
;; ;; This line is continuation of preceding line's statement;
|
||||
;; ;; indent ess-continued-statement-offset more than the
|
||||
;; ;; previous line of the statement.
|
||||
;; (progn
|
||||
;; (ess-backward-to-start-of-continued-exp containing-sexp)
|
||||
;; (+ ess-continued-statement-offset (current-column)
|
||||
;; (if (save-excursion (goto-char indent-point)
|
||||
;; (skip-chars-forward " \t")
|
||||
;; (eq (following-char) ?{))
|
||||
;; ess-continued-brace-offset 0)))
|
||||
;; ;; This line starts a new statement.
|
||||
;; ;; Position following last unclosed open.
|
||||
;; (goto-char containing-sexp)
|
||||
;; ;; Is line first statement after an open-brace?
|
||||
;; (or
|
||||
;; ;; If no, find that first statement and indent like it.
|
||||
;; (save-excursion
|
||||
;; (forward-char 1)
|
||||
;; (while (progn (skip-chars-forward " \t\n")
|
||||
;; (looking-at "#"))
|
||||
;; ;; Skip over comments following openbrace.
|
||||
;; (forward-line 1))
|
||||
;; ;; The first following code counts
|
||||
;; ;; if it is before the line we want to indent.
|
||||
;; (and (< (point) indent-point)
|
||||
;; (current-column)))
|
||||
;; ;; If no previous statement,
|
||||
;; ;; indent it relative to line brace is on.
|
||||
;; ;; For open brace in column zero, don't let statement
|
||||
;; ;; start there too. If ess-indent-offset is zero, use
|
||||
;; ;; ess-brace-offset + ess-continued-statement-offset
|
||||
;; ;; instead.
|
||||
;; ;; For open-braces not the first thing in a line,
|
||||
;; ;; add in ess-brace-imaginary-offset.
|
||||
;; (+ (if (and (bolp) (zerop ess-indent-offset))
|
||||
;; (+ ess-brace-offset ess-continued-statement-offset)
|
||||
;; ess-indent-offset)
|
||||
;; ;; Move back over whitespace before the openbrace.
|
||||
;; ;; If openbrace is not first nonwhite thing on the line,
|
||||
;; ;; add the ess-brace-imaginary-offset.
|
||||
;; (progn (skip-chars-backward " \t")
|
||||
;; (if (bolp) 0 ess-brace-imaginary-offset))
|
||||
;; ;; If the openbrace is preceded by a parenthesized exp,
|
||||
;; ;; move to the beginning of that;
|
||||
;; ;; possibly a different line
|
||||
;; (progn
|
||||
;; (if (eq (preceding-char) ?\))
|
||||
;; (forward-sexp -1))
|
||||
;; ;; Get initial indentation of the line we are on.
|
||||
;; (current-indentation))))))))))
|
||||
|
||||
;;*;; S/R Pretty-Editing
|
||||
|
||||
(defun ess-fix-comments (&optional dont-query verbose)
|
||||
"Fix ess-mode buffer so that single-line comments start with at least '##',
|
||||
and ensure space before subsequent text."
|
||||
(interactive "P")
|
||||
(ess-replace-regexp-dump-to-src "#\\([A-Za-z0-9]\\)" "# \\1" nil verbose)
|
||||
(ess-replace-regexp-dump-to-src "^\\([ \t]*#\\)\\([^#]\\)"
|
||||
"\\1#\\2" dont-query verbose))
|
||||
|
||||
(defun ess-dump-to-src (&optional dont-query verbose)
|
||||
"Make the changes in an S - dump() file to improve human readability."
|
||||
(interactive "P")
|
||||
(ess-replace-regexp-dump-to-src "^\"\\([a-z.][a-z.0-9]*\\)\" *<-\n"
|
||||
"\n\\1 <- "
|
||||
dont-query verbose 'ensure-ess))
|
||||
|
||||
(defun ess-num-var-round (&optional dont-query verbose)
|
||||
"Is VERY useful for dump(.)'ed numeric variables; ROUND some of them by
|
||||
replacing endings of 000000*.. and 999999*. Martin Maechler"
|
||||
(interactive "P")
|
||||
(save-excursion
|
||||
(goto-char (point-min))
|
||||
|
||||
(let ((num 0)
|
||||
(str "")
|
||||
(rgxp "000000+[1-9]?[1-9]?\\>")
|
||||
(to ""))
|
||||
(if dont-query
|
||||
(ess-rep-regexp rgxp to nil nil verbose)
|
||||
(query-replace-regexp rgxp to nil))
|
||||
|
||||
(while (< num 9)
|
||||
(setq str (concat (int-to-string num) "999999+[0-8]*"))
|
||||
(if (and (numberp verbose) (> verbose 1))
|
||||
(message (format "\nregexp: '%s'" str)))
|
||||
(goto-char (point-min))
|
||||
(ess-rep-regexp str (int-to-string (1+ num))
|
||||
'fixedcase 'literal verbose)
|
||||
(setq num (1+ num))))))
|
||||
|
||||
(defun ess-fix-dot (before-chars &optional dont-query verbose)
|
||||
"Remove trailing decimal '.' (\"dot\"), before BEFORE; typically from S-plus"
|
||||
;; typically, before-chars = "]:" or more
|
||||
(ess-replace-regexp-dump-to-src
|
||||
(concat "\\([0-9]\\)\\.\\( *[" before-chars "]\\)")
|
||||
;; 111 ^
|
||||
"\\1\\2" dont-query verbose))
|
||||
|
||||
(defun ess-fix-dot-1 (&optional do-query verbose)
|
||||
"Remove trailing decimal '.' (\"dot\"), before ':' or ']', i.e.,
|
||||
in cases where it's ugly and nonsense. DO-QUERY(prefix) asks before replacing."
|
||||
(interactive "P")
|
||||
(ess-fix-dot "]:" (not do-query) verbose))
|
||||
|
||||
(defun ess-fix-dot-more (&optional dont-query verbose)
|
||||
"Remove trailing decimal '.' (\"dot\", typically from S+) in more cases
|
||||
than `ess-fix-dot-1'."
|
||||
(interactive "P")
|
||||
(ess-fix-dot-1 nil verbose)
|
||||
(ess-fix-dot ",)" dont-query verbose))
|
||||
|
||||
(defun ess-fix-EQ-assign (&optional dont-query verbose not-all)
|
||||
"Replace \"=\" by \"<-\" in places where it 'might make sense', e.g.,
|
||||
for function assignments and lines not ending in \",\".
|
||||
Be *careful* for list()s of functions and when argument not-all is
|
||||
nil (as by default) !"
|
||||
;;TODO: "in the few places we can be very sure.."
|
||||
;;---- is hard in general: local functions: ok; but functions in
|
||||
;; list(a = function(x) abs(x), b= function(y) bound(y)) *NOT* ok!
|
||||
(interactive "P")
|
||||
(ess-replace-regexp-dump-to-src
|
||||
"^\\( *[a-z.][_a-z.0-9]*\\) *= *\\(function *(\\)"
|
||||
"\\1 <- \\2" dont-query verbose)
|
||||
|
||||
(unless not-all
|
||||
;; "too" aggressive {proposing to replace function argument specs}:
|
||||
(ess-replace-regexp-dump-to-src ;; all those *not* ending in ","
|
||||
;; including Mat[ i, ] = ...,
|
||||
;; but not `names(x) = "..."' for that is "confused" with plot(x=x,..)
|
||||
"^\\( *[a-z.][][, \"_a-z.0-9]*\\) *= *\\([a-z.0-9({]\\(.*[^,]\\)? *$\\)"
|
||||
"\\1 <- \\2" nil ;; always query - often has many "false positives"
|
||||
verbose)
|
||||
))
|
||||
|
||||
;;; All of the above three :
|
||||
(defun ess-MM-fix-src (&optional dont-query verbose)
|
||||
"Clean up ess-source code which has been produced by dump(..), and other
|
||||
code typically produced by other tools. Produces more readable code,
|
||||
and one that is well formatted in emacs ess-mode."
|
||||
(interactive "P")
|
||||
;; each of the following does a save-excursion:
|
||||
(ess-dump-to-src dont-query)
|
||||
(ess-fix-comments dont-query)
|
||||
(ess-num-var-round dont-query verbose)
|
||||
(ess-fix-dot-more dont-query verbose)
|
||||
(ess-fix-EQ-assign dont-query verbose 'not-all)
|
||||
)
|
||||
|
||||
(defun ess-fix-miscellaneous (&optional from verbose)
|
||||
"Fix Miscellaneous S/R `ill-formation's from current \\[point].
|
||||
Particularly use \"<-\"and put spaces around operators."
|
||||
(interactive "d\nP"); Defaults: point and prefix (C-u)
|
||||
;; activate by (setq ess-verbose t)
|
||||
(ess-if-verbose-write
|
||||
(format "ess-fix-misc begin (from = %s, verbose = %s)\n" from verbose))
|
||||
(save-excursion
|
||||
|
||||
(if (string= ess-dialect "R")
|
||||
(progn
|
||||
(require 'ess-r-mode)
|
||||
(R-fix-T-F from (not verbose))))
|
||||
|
||||
;; activate by (setq ess-verbose t)
|
||||
(ess-if-verbose-write "ess-fix-misc: after fix-T-F\n");___D___
|
||||
|
||||
;; former C and matlab programmers leave trailing ";" :
|
||||
;; (goto-char from) (ess-rep-regexp "; *$" "" nil 'literal verbose)
|
||||
;; (ess-if-verbose-write "ess-fix-misc: after trailing ';'\n");___D___
|
||||
(goto-char from) (ess-rep-regexp ";\\( *\\)#" "\\1#" nil nil verbose)
|
||||
(ess-if-verbose-write "ess-fix-misc: after ';' before #\n");___D___
|
||||
|
||||
;;from R 1.9.x "_" is valid in names; here assume no initial / trailing '_'
|
||||
;; BUG: The following changes "beta_ " or " _abc"
|
||||
;; (goto-char from) (ess-rep-regexp " +_ *" " <- " nil 'literal verbose)
|
||||
;; (goto-char from) (ess-rep-regexp "_ +" " <- " nil 'literal verbose)
|
||||
|
||||
(ess-if-verbose-write "ess-fix-misc: before 'around \"<-\"' :\n");___D___
|
||||
;; ensure space around "<-" ---- but only replace if necessary:
|
||||
(goto-char from)
|
||||
(ess-rep-regexp "\\([^< \t\n]\\)\\(<<?-\\)" "\\1 \\2" nil nil verbose)
|
||||
(goto-char from)(ess-rep-regexp "<-\\([^ \t\n]\\)" "<- \\1" nil nil verbose)
|
||||
;; ensure space around "<" (not in "<-","<=","<<-") and ">" (not ">=") :
|
||||
(goto-char from);; --> " <", care with "->":
|
||||
(ess-rep-regexp "\\([^-< \t\n]\\)\\([<>]\\)" "\\1 \\2" nil nil verbose)
|
||||
;; ">" -> "> " , for "<", don't split "<-" nor "<<-":
|
||||
(goto-char from)
|
||||
(ess-rep-regexp "\\(>=?\\)\\([^= \t\n]\\)" "\\1 \\2" nil nil verbose)
|
||||
(goto-char from)
|
||||
(ess-rep-regexp "\\(<=?\\)\\([^-<= \t\n]\\)" "\\1 \\2" nil nil t)
|
||||
|
||||
(ess-if-verbose-write "ess-fix-misc: before \"=\" \"==\" .. :\n");___D___
|
||||
;; -- ensure space around "=", "==", "!=" :
|
||||
(goto-char from) ;; --> " ="
|
||||
(ess-rep-regexp "\\([^=!<> ]\\)\\([=!]?\\)=" "\\1 \\2=" nil nil verbose)
|
||||
(goto-char from) (ess-rep-regexp "=\\([^= ]\\)" "= \\1" nil nil verbose)
|
||||
|
||||
(goto-char from) ;; add a space between "{" and surrounding ..char:
|
||||
(ess-rep-regexp "{\\([.A-Za-z()]\\)" "{ \\1" 'fix nil verbose)
|
||||
(ess-rep-regexp "\\([()]\\){" "\\1 {" 'fix nil verbose)
|
||||
(goto-char from) ;; add a space between "}" and a preceding wordchar:
|
||||
(ess-rep-regexp "\\([A-Za-z0-9()]\\)}" "\\1 }" 'fix nil verbose)
|
||||
(ess-space-around "else" from verbose)
|
||||
|
||||
(ess-if-verbose-write "ess-fix-misc: after \"{ ... }\" :\n");___D___
|
||||
(goto-char from) ;; add a space inside "){"
|
||||
(ess-rep-regexp "){" ") {" 'fix nil verbose)
|
||||
|
||||
;; add a newline and indent before a "}"
|
||||
;; --- IFF there's NO "{" or "#" AND some NON-white text on the same line:
|
||||
;;D (if verbose (message "\t R-fix-misc..: Hard.. '}'"))
|
||||
(goto-char from)
|
||||
(ess-rep-regexp "^\\([^#{\n]*[^#{ \t\n]+[ \t]*\\)}[ \t]*$"
|
||||
"\\1\n}" 'fix nil verbose)
|
||||
(ess-if-verbose-write "ess-fix-misc __end__\n");___D___
|
||||
))
|
||||
|
||||
(defvar polymode-mode)
|
||||
(defun ess-smart-S-assign (&optional N)
|
||||
"Act as smart `ess-S-assign' key.
|
||||
Insert `ess-S-assign', unless in string/comment. If the
|
||||
underscore key is pressed a second time, the assignment operator
|
||||
is removed and replaced by the underscore. `ess-S-assign',
|
||||
typically \" <- \", can be customized. In ESS modes other than
|
||||
R/S, the underscore is always inserted.
|
||||
|
||||
If `ess-smart-S-assign-key' is nil, just call
|
||||
`self-insert-command'. You can pass N as usual."
|
||||
(interactive)
|
||||
(if ess-smart-S-assign-key
|
||||
(save-restriction
|
||||
(ignore-errors
|
||||
(when (and (eq major-mode 'inferior-ess-mode)
|
||||
(> (point) (process-mark (get-buffer-process (current-buffer)))))
|
||||
(narrow-to-region (process-mark (ess-get-process)) (point-max)))
|
||||
(and ess-noweb-mode
|
||||
(ess-noweb-in-code-chunk)
|
||||
(ess-noweb-narrow-to-chunk))
|
||||
(and (fboundp 'pm/narrow-to-span)
|
||||
polymode-mode
|
||||
(pm/narrow-to-span)))
|
||||
(if (or
|
||||
(ess-inside-string-or-comment-p (point))
|
||||
(not (equal ess-language "S")))
|
||||
(insert ess-smart-S-assign-key)
|
||||
(ess-insert-S-assign)))
|
||||
(funcall #'self-insert-command (or N 1))))
|
||||
|
||||
(defun ess-insert-S-assign ()
|
||||
"Insert the assignment operator `ess-S-assign', unless it is already there.
|
||||
In that case, it is removed and replaced by `ess-smart-S-assign-key'.
|
||||
`ess-S-assign', typically \" <- \", can be customized."
|
||||
(interactive)
|
||||
;; one keypress produces ess-S-assign; a second keypress will delete
|
||||
;; ess-S-assign and instead insert _
|
||||
;; Rather than trying to count a second _ keypress, just check whether
|
||||
;; the current point is preceded by ess-S-assign.
|
||||
(let ((assign-len (length ess-S-assign)))
|
||||
(if (and
|
||||
(>= (point) (+ assign-len (point-min))) ;check that we can move back
|
||||
(save-excursion
|
||||
(backward-char assign-len)
|
||||
(looking-at ess-S-assign)))
|
||||
;; If we are currently looking at ess-S-assign, replace it with _
|
||||
(progn
|
||||
(delete-char (- assign-len))
|
||||
(insert ess-smart-S-assign-key))
|
||||
(if (string= ess-smart-S-assign-key "_")
|
||||
(delete-horizontal-space))
|
||||
(insert ess-S-assign))))
|
||||
|
||||
(defalias 'ess--activate-smart-S-assign-key 'ignore "")
|
||||
(make-obsolete 'ess--activate-smart-S-assign-key
|
||||
"it does nothing. Set `ess-smart-S-assign-key' instead." "2018-06-08")
|
||||
(defun ess-disable-smart-S-assign (&rest _ignore)
|
||||
"Disable `ess-smart-S-assign'."
|
||||
(declare (obsolete ess-smart-S-assign-key "2018-06-08"))
|
||||
(warn "This function is obsolete, use `ess-smart-S-assign-key' instead.")
|
||||
(setq ess-smart-S-assign-key nil))
|
||||
|
||||
(defun ess-add-MM-keys ()
|
||||
"Define MM's user keys, currently \\<ess-mode-map>\\[ess-insert-function-outline], and
|
||||
\\<inferior-ess-mode-map>\\[ess-execute-screen-options]."
|
||||
(interactive)
|
||||
(require 'ess-mode); typically unnecessary
|
||||
(require 'ess-inf); dito
|
||||
(define-key inferior-ess-mode-map "\C-cw" 'ess-execute-screen-options)
|
||||
|
||||
;; Make M-- : [Alt] + [-] (in addition to / instead of "_" = (on US-keyboard) [Shift]+ [-]
|
||||
;; Note this overwrites 'M--' as "negative argument" (still on 'C--'):
|
||||
(define-key ess-mode-map [?\M--] 'ess-insert-S-assign)
|
||||
(define-key inferior-ess-mode-map [?\M--] 'ess-insert-S-assign)
|
||||
)
|
||||
|
||||
|
||||
(defun ess-dump-args-and-go (Sfunc) ; &optional buff)
|
||||
"Dump the function name, with arguments, to a buffer for editing.
|
||||
|
||||
Currently, this needs to:
|
||||
1. set the buffer to the right mode, with the right settings
|
||||
2. format the statement,
|
||||
3. c/function/Sfunc/
|
||||
and I need to relearn emacs lisp (but I had to, anyway."
|
||||
|
||||
(interactive "sFunction ? ")
|
||||
(let* ((buffname "ess-complete.R")
|
||||
(buf (ess-execute (format "args(%s)" Sfunc) t buffname)))
|
||||
(pop-to-buffer buf)
|
||||
(message "here yet?")
|
||||
(while (search-forward "function" nil t)
|
||||
(replace-match Sfunc nil t))
|
||||
(ess-setq-vars-local ess-customize-alist); (current-buffer))
|
||||
(setq major-mode 'ess-mode)
|
||||
(use-local-map ess-mode-map)
|
||||
(set-syntax-table ess-mode-syntax-table)
|
||||
))
|
||||
|
||||
(defun ess-chm-display-help-on-object (object &rest args)
|
||||
(ess-eval-linewise (concat "help(" object ")")))
|
||||
|
||||
|
||||
;;; S imenu support
|
||||
|
||||
;; don't use syntax classes, bad for etags
|
||||
(defvar ess-imenu-S-generic-expression
|
||||
'(("Functions" "^\\(.+\\)[ \t\n]*<-[ \t\n]*function[ ]*(" 1)
|
||||
("Classes" "^.*setClass(\\(.*\\)," 1)
|
||||
("Coercions" "^.*setAs(\\([^,]+,[^,]*\\)," 1) ; show from and to
|
||||
("Generics" "^.*setGeneric(\\([^,]*\\)," 1)
|
||||
("Methods" "^.*set\\(Group\\|Replace\\)?Method(\\([^,]+,[^,]*\\)" 2)
|
||||
;;[ ]*\\(signature=\\)?(\\(.*,?\\)*\\)," 1)
|
||||
;;
|
||||
;;("Other" "^\\(.+\\)\\s-*<-[ \t\n]*[^\\(function\\|read\\|.*data\.frame\\)]" 1)
|
||||
("Package" "^.*\\(library\\|require\\)(\\(.*\\)" 2)
|
||||
("Data" "^\\(.+\\)[ \t\n]-*<-[ \t\n]*\\(read\\|.*data\.frame\\).*(" 1)))
|
||||
|
||||
(defun ess-imenu-S (&optional arg)
|
||||
"S Language Imenu support for ESS."
|
||||
(interactive)
|
||||
(setq imenu-generic-expression ess-imenu-generic-expression)
|
||||
(imenu-add-to-menubar "Imenu-S"))
|
||||
|
||||
(defalias 'ess-imenu-R 'ess-imenu-S)
|
||||
|
||||
|
||||
;;; Speedbar stuff.
|
||||
(defun ess-S-initialize-speedbar ()
|
||||
"Extend to all extensions; see initialization, and edit."
|
||||
(speedbar-add-supported-extension ".R")
|
||||
(speedbar-add-supported-extension ".S")
|
||||
(speedbar-add-supported-extension ".s")
|
||||
(speedbar-add-supported-extension ".q"))
|
||||
|
||||
;(if (featurep 'speedbar)
|
||||
; (progn
|
||||
; (message "enabling speedbar support")
|
||||
; (require 'speedbar)
|
||||
; (ess-S-initialize-speedbar)))
|
||||
|
||||
(eval-when-compile
|
||||
(condition-case nil
|
||||
(progn
|
||||
(require 'speedbar)
|
||||
(when (featurep 'speedbar)
|
||||
|
||||
(defun S-speedbar-buttons (buffer)
|
||||
"attempted hack."
|
||||
|
||||
;;(speedbar-make-tag-line)
|
||||
;;(speedbar-insert-button)
|
||||
(speedbar-with-writable))
|
||||
|
||||
(fset 'R-speedbar-buttons 'S-speedbar-buttons)
|
||||
|
||||
(defun S-speedbar-menu-items ( )
|
||||
"Need to write.")
|
||||
|
||||
(ess-S-initialize-speedbar)))
|
||||
(error nil)))
|
||||
|
||||
(defun ess-s-get-help-topics-function (name)
|
||||
"Return a list of current S help topics associated with process NAME.
|
||||
If 'sp-for-help-changed?' process variable is non-nil or
|
||||
`ess-help-topics-list' is nil, (re)-populate the latter and
|
||||
return it. Otherwise, return `ess-help-topics-list'."
|
||||
(with-ess-process-buffer nil
|
||||
(ess-write-to-dribble-buffer
|
||||
(format "(ess-get-help-topics-list %s) .." name))
|
||||
(ess-help-r--check-last-help-type)
|
||||
(cond
|
||||
;; (Re)generate the list of topics
|
||||
((or (not ess-help-topics-list)
|
||||
(ess-process-get 'sp-for-help-changed?))
|
||||
(ess-process-put 'sp-for-help-changed? nil)
|
||||
(setq ess-help-topics-list
|
||||
(ess-uniq-list
|
||||
(append (ess-get-object-list name 'exclude-1st)
|
||||
(ess-get-help-files-list)
|
||||
(ess-get-help-aliases-list)))))
|
||||
(t
|
||||
ess-help-topics-list))))
|
||||
|
||||
;;; On a PC, the default is S+.
|
||||
;; Elsewhere (unix and linux) the default is S+
|
||||
(cond (ess-microsoft-p
|
||||
;; MS-Windows-------------------------------------------------
|
||||
|
||||
;; (fset 'S
|
||||
;; (if (equal (file-name-nondirectory shell-file-name) "cmdproxy.exe")
|
||||
;; 'S+-msdos
|
||||
;; 'S+))
|
||||
(defun S-by-icon (&rest x)
|
||||
(interactive)
|
||||
(message "Please start S+ from the icon.
|
||||
Then you can connect emacs to it with `M-x S-existing'.")
|
||||
)
|
||||
(fset 'S 'S-by-icon)
|
||||
(fset 'S-existing
|
||||
(if (equal (file-name-nondirectory shell-file-name) "cmdproxy.exe")
|
||||
'S+-msdos-existing
|
||||
'S+-existing))
|
||||
(fset 'Sqpe 'Sqpe+)
|
||||
(fset 's-mode 'S+-mode)
|
||||
(fset 's-transcript-mode 'S+-transcript-mode))
|
||||
|
||||
(t ;;((eq system-type 'gnu/linux)
|
||||
;; Linux etc (including Mac OSX !?) --------------------------
|
||||
(fset 'S 'S+)
|
||||
(fset 's-mode 'S+-mode)
|
||||
(fset 's-transcript-mode 'S+-transcript-mode)))
|
||||
|
||||
;;;;* Alias S-mode to s-mode
|
||||
;;; Emacs will set the mode for a file based on the file's header.
|
||||
;;; The mode name is indicated by putting it between -*- on the top line.
|
||||
;;; (Other commands can go here too, see an Emacs manual.)
|
||||
;;; For a file you also load, you will want a leading # (comment to S)
|
||||
;;; Emacs will downcase the name of the mode, e.g., S, so we must provide
|
||||
;;; s-mode in lower case too. That is, "#-*- S-*-" invokes s-mode and
|
||||
;;; not S-mode.
|
||||
(fset 'S-transcript-mode 's-transcript-mode)
|
||||
(fset 'S-mode 's-mode)
|
||||
|
||||
|
||||
(define-obsolete-function-alias 'ess-toggle-S-assign-key #'ignore "2018-06-08")
|
||||
(define-obsolete-function-alias 'ess-smart-underscore 'ess-smart-S-assign "2018-06-08")
|
||||
|
||||
(define-obsolete-function-alias 'ess-toggle-underscore 'ess-disable-smart-S-assign "2018-06-08")
|
||||
(define-obsolete-function-alias 'ess-toggle-S-assign 'ess-disable-smart-S-assign "2018-06-08")
|
||||
(define-obsolete-function-alias 'ess--unset-smart-S-assign-key 'ess-disable-smart-S-assign "2018-06-08")
|
||||
|
||||
;;;###autoload
|
||||
(add-to-list 'auto-mode-alist '("\\.[Ss]t\\'" . S-transcript-mode))
|
||||
;;;###autoload
|
||||
(add-to-list 'auto-mode-alist '("\\.Sout" . S-transcript-mode))
|
||||
|
||||
(provide 'ess-s-lang)
|
||||
|
||||
;;; ess-s-lang.el ends here
|
||||
80
elpa/ess-20180701.100/ess-s3-d.el
Normal file
80
elpa/ess-20180701.100/ess-s3-d.el
Normal file
@@ -0,0 +1,80 @@
|
||||
;;; ess-s3-d.el --- S 3 (AT&T version) customization
|
||||
|
||||
;; Copyright (C) 1997 A. J. Rossini
|
||||
;; Copyright (C) 1998--2005 A.J. Rossini, Richard M. Heiberger, Martin
|
||||
;; Maechler, Kurt Hornik, Rodney Sparapani, and Stephen Eglen.
|
||||
|
||||
;; Author: A.J. Rossini <rossini@stat.sc.edu>
|
||||
;; Created: 12 Jun 1997
|
||||
;; Maintainer: ESS-core <ESS-core@r-project.org>
|
||||
|
||||
;; Keywords: languages
|
||||
|
||||
;; 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/
|
||||
|
||||
;;; Commentary:
|
||||
|
||||
;; This file defines all the S 3 customizations for ess-mode.
|
||||
|
||||
;;; Code:
|
||||
|
||||
(require 'ess-s-lang)
|
||||
|
||||
(defvar S3-customize-alist
|
||||
(append
|
||||
'((ess-local-customize-alist . 'S3-customize-alist)
|
||||
(ess-dialect . "S3")
|
||||
(ess-loop-timeout . ess-S-loop-timeout);fixme: dialect spec.
|
||||
(ess-change-sp-regexp . ess-S-change-sp-regexp)
|
||||
(ess-help-sec-keys-alist . ess-help-S3-sec-keys-alist)
|
||||
(ess-object-name-db-file . "ess-s3-namedb.el" )
|
||||
(inferior-ess-program . inferior-S3-program) ; "S")
|
||||
(inferior-ess-help-command . "help(\"%s\")\n")
|
||||
(inferior-ess-help-filetype . nil)
|
||||
(inferior-ess-search-list-command . "search()\n")
|
||||
(inferior-ess-objects-command . "objects(%d)\n")
|
||||
(inferior-ess-start-file . nil) ;"~/.ess-S3")
|
||||
(inferior-ess-start-args . "")
|
||||
(ess-STERM . "iESS")
|
||||
)
|
||||
S+common-cust-alist); use S+ ones here; partly overwritten above!!
|
||||
|
||||
"Variables to customize for S3")
|
||||
|
||||
(defun S3 (&optional proc-name)
|
||||
"Call 'S 3.x', the version from AT&T."
|
||||
(interactive)
|
||||
(setq ess-customize-alist S3-customize-alist)
|
||||
(ess-write-to-dribble-buffer
|
||||
(format "\n(S3): ess-dialect=%s, buf=%s\n" ess-dialect (current-buffer)))
|
||||
(inferior-ess)
|
||||
(if inferior-ess-language-start
|
||||
(ess-eval-linewise inferior-ess-language-start)))
|
||||
|
||||
|
||||
(defun S3-mode (&optional proc-name)
|
||||
"Major mode for editing S3 source. See `ess-mode' for more help."
|
||||
(interactive)
|
||||
(setq ess-customize-alist S3-customize-alist)
|
||||
(ess-mode S3-customize-alist proc-name)
|
||||
(if ess-imenu-use-S (ess-imenu-S)))
|
||||
|
||||
|
||||
; Provide package
|
||||
|
||||
(provide 'ess-s3-d)
|
||||
|
||||
;;; ess-s3-d.el ends here
|
||||
278
elpa/ess-20180701.100/ess-s4-d.el
Normal file
278
elpa/ess-20180701.100/ess-s4-d.el
Normal file
@@ -0,0 +1,278 @@
|
||||
;;; ess-s4-d.el --- S4 customization
|
||||
|
||||
;; Copyright (C) 1997--2004 A.J. Rossini, Richard M. Heiberger, Martin
|
||||
;; Maechler, Kurt Hornik, Rodney Sparapani, and Stephen Eglen.
|
||||
|
||||
;; Author: A.J. Rossini <rossini@stat.sc.edu>
|
||||
;; Created: 12 Jun 1997
|
||||
;; Maintainer: ESS-core <ESS-core@r-project.org>
|
||||
|
||||
;; Keywords: languages
|
||||
|
||||
;; 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/
|
||||
|
||||
|
||||
;;; Commentary:
|
||||
|
||||
;; DB contributed the changes from ess-s3-d.el to
|
||||
;; ess-s4-d.el (removed the old ugly approach).
|
||||
;; This file defines S4 customizations for ess-mode. Lots of thanks
|
||||
;; to RMH and JMC for code and suggestions
|
||||
|
||||
;;; Code:
|
||||
|
||||
(require 'ess-s-lang)
|
||||
|
||||
;; Some of this is based on files from:
|
||||
;; Copyright (C) 1996, John M. Chambers.
|
||||
|
||||
(defvar S4-customize-alist
|
||||
(append
|
||||
'((ess-local-customize-alist . 'S4-customize-alist)
|
||||
(ess-dialect . "S4")
|
||||
(ess-loop-timeout . ess-S-loop-timeout);fixme: dialect spec.
|
||||
(ess-change-sp-regexp . ess-S-change-sp-regexp)
|
||||
(ess-help-sec-keys-alist . ess-help-S3-sec-keys-alist)
|
||||
(ess-object-name-db-file . "ess-s4-namedb.el")
|
||||
(inferior-ess-program . inferior-S4-program)
|
||||
(inferior-ess-objects-command . ".SmodeObs(%d, pattern=\"%s\")\n")
|
||||
;;(inferior-ess-objects-pattern . ".*") ; for new s4 stuff
|
||||
(inferior-ess-help-command . "help(\"%s\")\n")
|
||||
(inferior-ess-help-filetype . nil)
|
||||
(inferior-ess-search-list-command . ".SmodePaths()\n")
|
||||
(ess-load-command . ".SmodeLoad(\"%s\")\n")
|
||||
(inferior-ess-dump-command . ".SmodeDump(\"%s\", \"%s\")\n")
|
||||
|
||||
(inferior-ess-start-file . nil) ;"~/.ess-S3")
|
||||
(inferior-ess-start-args . "")
|
||||
(ess-STERM . "iESS")
|
||||
)
|
||||
S+common-cust-alist); use S+ ones here; partly overwritten above!!
|
||||
|
||||
"Variables to customize for S4.")
|
||||
|
||||
;; For loading up the S code required for the above.
|
||||
;;(add-hook 'ess-post-run-hook
|
||||
;; (lambda ()
|
||||
;; (ess-command
|
||||
;; (concat
|
||||
;; "if(exists(\"Sversion\")) library(emacs) else source(\""
|
||||
;; ess-mode-run-file
|
||||
;; "\")\n"))
|
||||
;; (if ess-mode-run-file2
|
||||
;; (ess-command
|
||||
;; (concat "source(\"" ess-mode-run-file2 "\")\n")))))
|
||||
|
||||
|
||||
(defun S4 ()
|
||||
"Call 'S version 4', from Bell Labs. New way to do it."
|
||||
(interactive)
|
||||
(setq ess-customize-alist S4-customize-alist)
|
||||
(ess-write-to-dribble-buffer
|
||||
(format "\n(S4): ess-dialect=%s, buf=%s\n" ess-dialect (current-buffer)))
|
||||
(inferior-ess)
|
||||
(if inferior-ess-language-start
|
||||
(ess-eval-linewise inferior-ess-language-start)))
|
||||
|
||||
|
||||
(defun S4-mode (&optional proc-name)
|
||||
"Major mode for editing S4 source. See `ess-mode' for more help."
|
||||
(interactive)
|
||||
(setq ess-customize-alist S4-customize-alist)
|
||||
(ess-mode S4-customize-alist proc-name)
|
||||
(if ess-imenu-use-S (ess-imenu-S)))
|
||||
|
||||
|
||||
;; From RMH: ALL THIS SHOULD BE INCORPORATED BY 5.0!
|
||||
|
||||
;;; s4.el startup file
|
||||
;;; Richard M. Heiberger
|
||||
;;; rmh@temple.edu
|
||||
;;
|
||||
;;(load "S")
|
||||
;;(setq inferior-S-program "/disk05/s4/betaJun96/S")
|
||||
;;(setq S-plus nil) ;; needed for non S-plus
|
||||
;;(add-to-list 'load-path "/disk05/s4/betaJun96") ;; S-namedb.el is here
|
||||
;;(S)
|
||||
;;(load-file "/disk05/s4/betaJun96/library/emacs/S-modeadds.el") ;; must come after (S)
|
||||
;;
|
||||
;;
|
||||
;;;;; S4 __Help, no longer S3 .Help
|
||||
;;(load "S-help")
|
||||
;; ;; Must follow S-help
|
||||
;;; S-help.file line 270
|
||||
;;(defun S-get-help-files-list nil
|
||||
;; (mapcar 'list
|
||||
;; (apply 'append
|
||||
;; (mapcar (lambda (dirname)
|
||||
;; (if (file-directory-p dirname)
|
||||
;; (directory-files dirname)))
|
||||
;; (mapcar (lambda (str) (concat str "/__Help"))
|
||||
;; (S-search-list))))))
|
||||
;;
|
||||
;;
|
||||
;;;;; additional font-lock-keywords for S4
|
||||
;;
|
||||
;;;;*;; based on S-inf.el line 107
|
||||
;;;;(add-to-list 'S-inf-font-lock-keywords
|
||||
;;;; '("\\<\\(^Problem\\|^Warning\\|^Error\\|Debug ?\\|Browsing in frame of\\|Local Variables\\)\\>" . font-lock-reference-face) ; S-inf problems
|
||||
;;;;)
|
||||
;;;;(add-to-list 'S-inf-font-lock-keywords
|
||||
;;;; '("^R>" . font-lock-keyword-face) ; debug prompt
|
||||
;;;;)
|
||||
;;(inferior-S-mode)
|
||||
;;
|
||||
;;; S-inf.el line 150
|
||||
;;(setq inferior-S-search-list-command "searchPaths()\n")
|
||||
;;
|
||||
;;;; fontify S-transcript-mode
|
||||
;;;; overwrites S-trans.el lines 60-69
|
||||
;;;;(setq S-trans-font-lock-keywords S-inf-font-lock-keywords)
|
||||
;;
|
||||
;;(load "S-mode")
|
||||
;; ;; Must follow S-mode
|
||||
;;;;*;; based on S-mode.el line 219
|
||||
;;(add-to-list 'S-mode-font-lock-keywords
|
||||
;; '("\\<\\(setGeneric\\|removeGeneric\\|setMethod\\|unsetMethod\\|setReplaceGeneric\\|setReplaceMethod\\|standardGeneric\\|setIs\\|setClass\\|representation\\)\\>" . font-lock-function-name-face) ; S4 method functions
|
||||
;;)
|
||||
;;
|
||||
;;
|
||||
;;
|
||||
;;;;; fix to S-load-file to make C-c C-l work with S4
|
||||
;;
|
||||
;;;When a file sourced into S4 by C-c C-l has a syntax error
|
||||
;;;without the following changes, the system
|
||||
;;;freezes until it is released with ^G. The reason is that the error
|
||||
;;;messages, including the `Debug ?' request, go to the *S-errors*
|
||||
;;;buffer. The *S-errors* buffer is not switched to, and couldn't accept
|
||||
;;;a response if it were.
|
||||
;;;
|
||||
;;;The fix requires three modification to S-inf.el and two to S-mode.el.
|
||||
;;;The correction to S-check-source noted in smode.cmt is also necessary.
|
||||
;;;
|
||||
;;
|
||||
;;; S-inf.el line 92 NEW variable
|
||||
;;(defvar inferior-S-debug-prompt "Debug \\? (y|n): "
|
||||
;; "The expression S uses to offer to initiate debug tracing.")
|
||||
;;
|
||||
;;; S-inf.el line 458
|
||||
;;(defun inferior-S-wait-for-prompt ()
|
||||
;; "Wait until the S process is ready for input."
|
||||
;; (let* ((cbuffer (current-buffer))
|
||||
;; (sprocess (get-S-process S-current-process-name))
|
||||
;; (sbuffer (process-buffer sprocess))
|
||||
;; r
|
||||
;; (timeout 0))
|
||||
;; (set-buffer sbuffer)
|
||||
;; (while (progn
|
||||
;; (if (not (eq (process-status sprocess) 'run))
|
||||
;; (S-error "S process has died unexpectedly.")
|
||||
;; (if (> (setq timeout (1+ timeout)) S-loop-timeout)
|
||||
;; (S-error "Timeout waiting for prompt. Check inferior-S-prompt or S-loop-timeout."))
|
||||
;; (accept-process-output)
|
||||
;; (goto-char (point-max))
|
||||
;;(setq end (point))
|
||||
;; (beginning-of-line)
|
||||
;;(setq e (buffer-substring (point) end))
|
||||
;;(if (equal e inferior-S-debug-prompt)
|
||||
;; (S-error "Debug prompt"))
|
||||
;; (setq r (looking-at inferior-S-prompt))
|
||||
;; (not (or r (looking-at ".*\\?\\s *"))))))
|
||||
;; (goto-char (point-max))
|
||||
;; (set-buffer cbuffer)
|
||||
;; (symbol-value r)))
|
||||
;;
|
||||
;;
|
||||
;;
|
||||
;;; S-mode.el line 204
|
||||
;;(setq S-dump-error-re "Problem")
|
||||
;;
|
||||
;;;; S-mode.el line 655
|
||||
;;(defun S-parse-errors (showerr)
|
||||
;; "Jump to error in last loaded S source file.
|
||||
;;With prefix argument, only shows the errors S reported."
|
||||
;; (interactive "P")
|
||||
;; (S-make-buffer-current)
|
||||
;; (let ((errbuff (get-buffer S-error-buffer-name)))
|
||||
;; (if (not errbuff)
|
||||
;; (error "You need to do a load first!")
|
||||
;; (set-buffer errbuff)
|
||||
;; (goto-char (point-max))
|
||||
;; (if
|
||||
;; (re-search-backward ", file \"" nil t)
|
||||
;; (let* ((beg-pos (progn (re-search-forward "\"" nil t) (point)))
|
||||
;; (end-pos (progn (re-search-forward "\"" nil t) (- (point) 1)))
|
||||
;; (filename (buffer-substring beg-pos end-pos))
|
||||
;; (fbuffer (get-file-buffer filename))
|
||||
;; (linenum (string-to-number
|
||||
;; (progn (re-search-backward "," nil t)
|
||||
;; (current-word))))
|
||||
;; (end-pos (point))
|
||||
;; (beg-pos (progn (goto-char (point-min))
|
||||
;; (re-search-forward ":" nil t)
|
||||
;; (1+ (point))))
|
||||
;; (errmess (buffer-substring beg-pos end-pos))
|
||||
;; )
|
||||
;; (if showerr
|
||||
;; (S-display-temp-buffer errbuff)
|
||||
;; (if fbuffer nil
|
||||
;; (setq fbuffer (find-file-noselect filename))
|
||||
;; (save-excursion
|
||||
;; (set-buffer fbuffer)
|
||||
;; (S-mode)))
|
||||
;; (pop-to-buffer fbuffer)
|
||||
;; (goto-line linenum))
|
||||
;; (princ errmess t))
|
||||
;; (message "Not a syntax error.")
|
||||
;; (S-display-temp-buffer errbuff)))))
|
||||
;;
|
||||
;;
|
||||
;;
|
||||
;;;; S-inf.el line 584
|
||||
;;(defun S-prompt-wait (proc &optional start-of-output)
|
||||
;; "Wait for a prompt to appear at BOL of current buffer
|
||||
;;PROC is the S process. Does not change point"
|
||||
;; (if start-of-output nil (setq start-of-output (point-min)))
|
||||
;; (save-excursion
|
||||
;; (while (progn
|
||||
;; ;; get output if there is some ready
|
||||
;; (accept-process-output proc 0 500)
|
||||
;; (goto-char (marker-position (process-mark proc)))
|
||||
;; (beginning-of-line)
|
||||
;;
|
||||
;; (if (re-search-forward inferior-S-debug-prompt nil t)
|
||||
;; (if (equal (get-buffer S-error-buffer-name)
|
||||
;; (get-buffer S-error-buffer-name))
|
||||
;; (let* ((sprocess (get-S-process S-current-process-name))
|
||||
;; (sbuffer (process-buffer sprocess)))
|
||||
;; (set-buffer sbuffer)
|
||||
;; (process-send-string sprocess "n\n")
|
||||
;; (accept-process-output sprocess)
|
||||
;; (beginning-of-line); delete inferior-S-debug-prompt
|
||||
;; (kill-line)
|
||||
;; (insert "> ")))
|
||||
;;
|
||||
;; (if (< (point) start-of-output) (goto-char start-of-output))
|
||||
;; (not (looking-at inferior-S-primary-prompt)))))))
|
||||
;;
|
||||
|
||||
|
||||
|
||||
; Provide package
|
||||
|
||||
(provide 'ess-s4-d)
|
||||
|
||||
;;; ess-s4-d.el ends here
|
||||
1351
elpa/ess-20180701.100/ess-sas-a.el
Normal file
1351
elpa/ess-20180701.100/ess-sas-a.el
Normal file
File diff suppressed because it is too large
Load Diff
316
elpa/ess-20180701.100/ess-sas-d.el
Normal file
316
elpa/ess-20180701.100/ess-sas-d.el
Normal file
@@ -0,0 +1,316 @@
|
||||
;;; ess-sas-d.el --- SAS customization
|
||||
|
||||
;; Copyright (C) 1997--2001 Richard M. Heiberger and A. J. Rossini
|
||||
;; Copyright (C) 2002--2004 A.J. Rossini, Richard M. Heiberger, Martin
|
||||
;; Maechler, Kurt Hornik, Rodney Sparapani, and Stephen Eglen.
|
||||
|
||||
;; Author: Richard M. Heiberger <rmh@temple.edu>
|
||||
;; Created: 20 Aug 1997
|
||||
;; Maintainer: ESS-core <ESS-core@r-project.org>
|
||||
|
||||
;; Keywords: languages
|
||||
|
||||
;; 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/
|
||||
|
||||
;;; Commentary:
|
||||
|
||||
;; This file defines all the SAS customizations for ESS behaviors. See
|
||||
;; ess-sas-l and ess-sas-a for the underlying general modifications.
|
||||
|
||||
;;; Code:
|
||||
|
||||
;;; Autoloads:
|
||||
|
||||
(require 'comint)
|
||||
(require 'shell)
|
||||
(require 'executable)
|
||||
(require 'ess-sas-l)
|
||||
|
||||
(defvar inferior-SAS-args "-stdio -linesize 80 -noovp -nosyntaxcheck"
|
||||
"*Arguments to use for starting SAS.")
|
||||
|
||||
(defvar inferior-SAS-args-temp nil
|
||||
"Hack variable, needed for args preprocessing.
|
||||
Better logic needed! (see 2 uses, in this file).")
|
||||
|
||||
(defun ess-SAS-pre-run-hook (temp-ess-dialect)
|
||||
"Set up log and list files for interactive SAS."
|
||||
|
||||
(let* ((ess-shell-buffer-name-flag (get-buffer "*shell*"))
|
||||
ess-shell-buffer-name
|
||||
;; isn't pretty yet.
|
||||
;; ess-local-process-name is defined after this function.
|
||||
;; it needs to be defined prior to this function.
|
||||
(tmp-procname (let ((ntry 0)
|
||||
(done nil))
|
||||
;; find a non-existent process
|
||||
(while (not done)
|
||||
(setq ntry (1+ ntry)
|
||||
done (not
|
||||
(get-process (ess-proc-name
|
||||
ntry
|
||||
temp-ess-dialect)))))
|
||||
(ess-proc-name ntry temp-ess-dialect)))
|
||||
;; Following was tmp-local-process-name. Stolen from inferior-ess
|
||||
(ess-sas-lst-bufname (concat "*" tmp-procname ".lst*"))
|
||||
(ess-sas-log-bufname (concat "*" tmp-procname ".log*"))
|
||||
(explicit-shell-file-name "/bin/sh")
|
||||
inferior-SAS-redirect-args
|
||||
ess-sas-lst
|
||||
ess-sas-log)
|
||||
|
||||
(ess-write-to-dribble-buffer
|
||||
(format "(ess-SAS-pre-run-hook 1): ess-lang=%s, ess-dialect=%s, temp-dialect=%s, buf=%s \n"
|
||||
ess-language
|
||||
ess-dialect
|
||||
temp-ess-dialect
|
||||
(current-buffer)))
|
||||
;; If someone is running a *shell* buffer, rename it to avoid
|
||||
;; inadvertent nuking.
|
||||
(if ess-shell-buffer-name-flag
|
||||
(with-current-buffer "*shell*"
|
||||
(setq ess-shell-buffer-name
|
||||
(rename-buffer "*ess-shell-regular*" t))))
|
||||
|
||||
;; Construct the LST buffer for output
|
||||
(if (get-buffer ess-sas-lst-bufname)
|
||||
nil
|
||||
(shell)
|
||||
(accept-process-output (get-buffer-process (current-buffer)))
|
||||
(sleep-for 2) ; need to wait, else working too fast!
|
||||
(setq ess-sas-lst (ess-insert-accept "tty"))
|
||||
(SAS-listing-mode)
|
||||
(shell-mode)
|
||||
(ess-listing-minor-mode t)
|
||||
(rename-buffer ess-sas-lst-bufname t))
|
||||
|
||||
;; Construct the LOG buffer for output
|
||||
(if (get-buffer ess-sas-log-bufname)
|
||||
nil
|
||||
(shell)
|
||||
(accept-process-output (get-buffer-process (current-buffer)))
|
||||
(sleep-for 2) ; need to wait, else working too fast!
|
||||
(setq ess-sas-log (ess-insert-accept "tty"))
|
||||
;(SAS-log-mode)
|
||||
(shell-mode)
|
||||
(ess-transcript-minor-mode t)
|
||||
(rename-buffer ess-sas-log-bufname t))
|
||||
|
||||
(setq inferior-SAS-redirect-args (concat " "
|
||||
ess-sas-lst
|
||||
" "
|
||||
ess-sas-log
|
||||
" ")
|
||||
inferior-SAS-args-temp (concat inferior-SAS-redirect-args
|
||||
inferior-SAS-args))
|
||||
|
||||
;; Restore the *shell* buffer
|
||||
(if ess-shell-buffer-name-flag
|
||||
(with-current-buffer ess-shell-buffer-name
|
||||
(rename-buffer "*shell*")))
|
||||
|
||||
(delete-other-windows)
|
||||
(split-window-vertically)
|
||||
(split-window-vertically)
|
||||
(switch-to-buffer (nth 2 (buffer-list)))
|
||||
(other-window 2)
|
||||
(switch-to-buffer ess-sas-log-bufname)
|
||||
(split-window-vertically)
|
||||
(other-window 1)
|
||||
(switch-to-buffer ess-sas-lst-bufname)
|
||||
(other-window 2)
|
||||
|
||||
;;workaround
|
||||
(setq inferior-SAS-program
|
||||
(concat (file-name-as-directory ess-etc-directory)
|
||||
"ess-sas-sh-command"))
|
||||
(setq inferior-ess-program inferior-SAS-program)))
|
||||
|
||||
(defun ess-insert-accept (command)
|
||||
"Submit command to process, get next line."
|
||||
(interactive)
|
||||
(goto-char (point-max))
|
||||
(insert command)
|
||||
(comint-send-input)
|
||||
(accept-process-output (get-buffer-process (current-buffer)))
|
||||
(forward-line -1)
|
||||
(let* ((beg (point))
|
||||
(ess-tty-name (progn (end-of-line) (buffer-substring beg (point)))))
|
||||
(goto-char (point-max))
|
||||
ess-tty-name))
|
||||
|
||||
|
||||
(defvar SAS-customize-alist
|
||||
'((ess-local-customize-alist . 'SAS-customize-alist)
|
||||
(ess-language . "SAS")
|
||||
(ess-dialect . "SAS")
|
||||
(ess-mode-editing-alist . SAS-editing-alist) ; from ess-sas-l.el
|
||||
(ess-mode-syntax-table . SAS-syntax-table)
|
||||
(inferior-ess-program . inferior-SAS-program)
|
||||
(ess-help-sec-regex . "^[A-Z. ---]+:$")
|
||||
(ess-help-sec-keys-alist . " ")
|
||||
(ess-object-name-db-file . "ess-sas-namedb.el")
|
||||
(inferior-ess-objects-command . "objects(%d)");;FIXME
|
||||
(inferior-ess-help-command . "help(\"%s\",pager=\"cat\",window=F)\n");;FIXME
|
||||
(inferior-ess-exit-command . "endsas;\n")
|
||||
(ess-loop-timeout . 500000 )
|
||||
(inferior-ess-primary-prompt . "^")
|
||||
(inferior-ess-secondary-prompt . "^")
|
||||
(comint-use-prompt-regexp . t)
|
||||
(inferior-ess-start-file . nil) ;"~/.ess-SAS")
|
||||
(inferior-ess-start-args . inferior-SAS-args-temp)
|
||||
(inferior-ess-font-lock-defaults . SAS-mode-font-lock-defaults)
|
||||
;; (ess-pre-run-hook . 'ess-SAS-pre-run-hook)
|
||||
;; (ess-local-process-name . nil)
|
||||
)
|
||||
"Variables to customize for SAS")
|
||||
|
||||
;;; The functions of interest (mode, inferior mode)
|
||||
|
||||
;;;###autoload
|
||||
(defun SAS-mode (&optional proc-name)
|
||||
"Major mode for editing SAS source. See ess-mode for more help."
|
||||
(interactive)
|
||||
(setq ess-customize-alist SAS-customize-alist)
|
||||
(ess-mode SAS-customize-alist proc-name)
|
||||
|
||||
;; Local map settings, AFTER initialization (only if not yet defined)
|
||||
(if sas-mode-local-map
|
||||
nil
|
||||
(setq sas-mode-local-map (copy-keymap (current-local-map)))
|
||||
(ess-sas-edit-keys-set ess-sas-edit-keys-toggle)
|
||||
(if ess-sas-local-unix-keys (ess-sas-local-unix-keys))
|
||||
(if ess-sas-local-pc-keys (ess-sas-local-pc-keys))
|
||||
(if ess-sas-global-unix-keys (ess-sas-global-unix-keys))
|
||||
(if ess-sas-global-pc-keys (ess-sas-global-pc-keys)))
|
||||
(define-key sas-mode-local-map ";" 'ess-electric-run-semicolon)
|
||||
|
||||
;; this is a mess
|
||||
;; interactive and batch commands share sas-mode-local-map,
|
||||
;; but the associated commands are very different
|
||||
;; what would be better is two maps like
|
||||
;; sas-batch-mode-local-map and sas-interactive-mode-local-map
|
||||
;; or smart function definitions that would do the appropriate
|
||||
;; thing for either batch or interactive sessions
|
||||
;; however, neither of these solutions are planned
|
||||
;; therefore, no key definitions can be shared between
|
||||
;; batch and interactive at this time, hence the lines that
|
||||
;; are commented below: uncomment at your own risk
|
||||
;; (define-key sas-mode-local-map "\C-c\C-p" 'ess-sas-file-path)
|
||||
;; (define-key sas-mode-local-map "\C-c\C-b" 'ess-sas-submit)
|
||||
;; (define-key sas-mode-local-map "\C-c\C-r" 'ess-sas-submit-region)
|
||||
;; (define-key sas-mode-local-map "\C-c\C-x" 'ess-sas-goto-log)
|
||||
;; (define-key sas-mode-local-map "\C-c\C-y" 'ess-sas-goto-lst)
|
||||
|
||||
(use-local-map sas-mode-local-map)
|
||||
|
||||
(set (make-local-variable 'font-lock-defaults)
|
||||
;; KEYWORDS KEYWORDS-ONLY CASE-FOLD .....
|
||||
'(SAS-mode-font-lock-defaults nil t))
|
||||
;; ^^ this *should* set
|
||||
;; font-lock-keywords-case-fold-search, but it fails for Emacs 22.[23]
|
||||
;; hence :
|
||||
(setq font-lock-keywords-case-fold-search t)
|
||||
(run-mode-hooks 'SAS-mode-hook))
|
||||
|
||||
|
||||
;;;###autoload
|
||||
(add-to-list 'auto-mode-alist '("\\.[Ss][Aa][Ss]\\'" . SAS-mode))
|
||||
|
||||
;; rmh Jul 10 2003
|
||||
(defun ess-electric-run-semicolon (arg)
|
||||
"Insert character. If the line contains \"run;\" or \"quit;\" and nothing else then indent line."
|
||||
(interactive "P")
|
||||
(if ess-sas-edit-keys-toggle (insert ";") (let (insertpos)
|
||||
(if (and (not arg)
|
||||
(eolp)
|
||||
(save-excursion
|
||||
(skip-chars-backward " \t")
|
||||
(backward-word 1)
|
||||
(and (looking-at "run\\|quit")
|
||||
(progn
|
||||
(skip-chars-backward " \t")
|
||||
(bolp)))))
|
||||
(progn
|
||||
(insert last-command-event)
|
||||
(ess-indent-line)
|
||||
(save-excursion
|
||||
(if insertpos (goto-char (1+ insertpos)))
|
||||
(delete-char -1))))
|
||||
(if insertpos
|
||||
(save-excursion
|
||||
(goto-char insertpos)
|
||||
(self-insert-command (prefix-numeric-value arg)))
|
||||
(self-insert-command (prefix-numeric-value arg))))))
|
||||
|
||||
;;;###autoload
|
||||
(defun SAS-menu ()
|
||||
"Start SAS from the menu."
|
||||
(interactive)
|
||||
(if ess-microsoft-p
|
||||
;; replace with other choices for starting SAS?
|
||||
(error "SAS cannot be started this way in ESS on Windows.")
|
||||
(SAS)))
|
||||
|
||||
(defun SAS ()
|
||||
"Call 'SAS', from SAS Institute."
|
||||
(interactive)
|
||||
(setq-default ess-customize-alist SAS-customize-alist)
|
||||
(let* ((temp-dialect "SAS")) ;(cdr (rassoc ess-dialect SAS-customize-alist))))
|
||||
(ess-write-to-dribble-buffer
|
||||
(format "(SAS): ess-dial=%s, temp-dial=%s\n"
|
||||
ess-dialect
|
||||
temp-dialect))
|
||||
(ess-SAS-pre-run-hook temp-dialect)
|
||||
(setq ess-eval-visibly-p nil)
|
||||
(inferior-ess)
|
||||
(with-current-buffer "*SAS*"
|
||||
(use-local-map sas-mode-local-map))))
|
||||
|
||||
|
||||
(defun ess-multi-frame-SAS ()
|
||||
"Put running SAS buffers into separate frames.
|
||||
Load this function M-x load-file essx-sas.el RET.
|
||||
Then find-file myfile.sas. If myfile.sas is already in a buffer, kill-buffer
|
||||
it and then find-file it again.
|
||||
Place the cursor in a myfile.sas buffer. Run SAS with M-x SAS,
|
||||
Return the cursor to the myfile.sas buffer,
|
||||
then enter C-c C-w to put *SAS* *SAS.log* *SAS.lst* buffers into
|
||||
their own frames."
|
||||
(interactive)
|
||||
(delete-other-windows)
|
||||
(with-current-buffer "*SAS*"
|
||||
(make-frame))
|
||||
(with-current-buffer "*SAS.log*"
|
||||
(make-frame))
|
||||
(with-current-buffer "*SAS.lst*"
|
||||
(make-frame)))
|
||||
|
||||
|
||||
(add-hook 'ess-mode-hook
|
||||
(lambda ()
|
||||
(when (string= ess-language "SAS") ;; e.g. not for R-only users
|
||||
(local-set-key "\C-c\C-w" 'ess-multi-frame-SAS))))
|
||||
|
||||
(defun ess-num-or-zero (arg)
|
||||
"*If a number, then return that number, otherwise return 0."
|
||||
(or (and (numberp arg) arg) 0))
|
||||
|
||||
; Provide package
|
||||
|
||||
(provide 'ess-sas-d)
|
||||
|
||||
;;; ess-sas-d.el ends here
|
||||
1925
elpa/ess-20180701.100/ess-sas-l.el
Normal file
1925
elpa/ess-20180701.100/ess-sas-l.el
Normal file
File diff suppressed because it is too large
Load Diff
156
elpa/ess-20180701.100/ess-site.el
Normal file
156
elpa/ess-20180701.100/ess-site.el
Normal file
@@ -0,0 +1,156 @@
|
||||
;;; ess-site.el --- user customization of ESS
|
||||
|
||||
;; Copyright (C) 1993 David M. Smith
|
||||
;; Copyright (C) 1997--2010 A.J. Rossini, Richard M. Heiberger, Martin
|
||||
;; Maechler, Kurt Hornik, Rodney Sparapani, and Stephen Eglen.
|
||||
;; Copyright (C) 2011--2018 A.J. Rossini, Richard M. Heiberger, Martin
|
||||
;; Maechler, Kurt Hornik, Rodney Sparapani, Stephen Eglen,
|
||||
;; Vitalie Spinu, and Lionel Henry.
|
||||
|
||||
;; Author: David Smith <D.M.Smith@lancaster.ac.uk>
|
||||
;; Created: 12 Nov 1993
|
||||
;; Maintainer: ESS-core <ESS-core@r-project.org>
|
||||
;; Keywords: local
|
||||
|
||||
;; 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/
|
||||
|
||||
|
||||
;;; Commentary:
|
||||
|
||||
;; This file defines all the site-specific customizations for ESS. It should be
|
||||
;; edited on a per-site basis. Read the comments (1.1 in Section 1 to see if
|
||||
;; ess-site.el must be edited. The final directory location of this file must be
|
||||
;; supplied in ess-lisp-directory. The editing of remaining sections is
|
||||
;; optional. It should then be byte-compiled, and users who wish to use ESS
|
||||
;; should add the path to ess-site to their `load-path' and require it:
|
||||
;;
|
||||
;; (add-to-list 'load-path "/path/to/ess/lisp-directory");;
|
||||
;; (require 'ess-site)
|
||||
|
||||
;;; Code:
|
||||
|
||||
;; Provide here; otherwise we'll get infinite loops of (require ..):
|
||||
(provide 'ess-site)
|
||||
|
||||
;;;; Load path, autoloads, and major modes
|
||||
;;;; ========================================
|
||||
;;
|
||||
;; For most users the variable ess-lisp-directory will automatically
|
||||
;; be set correctly. If you are working with an old emacs, one in
|
||||
;; which file-truename is not defined, then you might need to change
|
||||
;; the value of ess-lisp-directory to the directory which is to
|
||||
;; contain the file ess-site.elc. This is probably the current
|
||||
;; directory, or the value of LISPDIR if it was set in the Makefile.
|
||||
|
||||
;; DEBUG: (setq ess-show-load-messages t); instead of nil above
|
||||
|
||||
;; This sets `ess-lisp-directory' either from the current directory
|
||||
;; when the file is being `load'ed, or from the installed location
|
||||
;; otherwise. This way, users can load ESS without having added ESS to
|
||||
;; `load-path'.
|
||||
(defvar ess-lisp-directory
|
||||
;; A nice default
|
||||
(directory-file-name
|
||||
(file-name-directory
|
||||
(if load-file-name
|
||||
(file-truename load-file-name)
|
||||
(locate-library "ess-site") )))
|
||||
"Directory containing ess-site.el(c) and other ESS Lisp files.")
|
||||
|
||||
(defvar ess-etc-directory nil
|
||||
"Location of the ESS etc/ directory.
|
||||
The ESS etc directory stores various auxillary files that are useful
|
||||
for ESS, such as icons.")
|
||||
|
||||
|
||||
;; Depending on how ESS is loaded the `load-path' might not contain
|
||||
;; the `lisp' directory. For this reason we need to add it before we
|
||||
;; start requiring ESS files
|
||||
(add-to-list 'load-path (file-name-as-directory ess-lisp-directory))
|
||||
;; Add ess-lisp-directory/obsolete to load-path; files here will
|
||||
;; automatically warn that they are obsolete when loaded.
|
||||
(add-to-list 'load-path (file-name-as-directory (expand-file-name "obsolete" ess-lisp-directory)))
|
||||
|
||||
(require 'ess-utils)
|
||||
(ess-write-to-dribble-buffer
|
||||
(format "[ess-site:] ess-lisp-directory = '%s'" ess-lisp-directory))
|
||||
|
||||
|
||||
;; If ess.info is not found, then ess-lisp-directory/../doc/info is added
|
||||
;; resurrecting Stephen's version with a bug-fix
|
||||
(unless (locate-file "ess.info" Info-default-directory-list)
|
||||
(add-to-list 'Info-default-directory-list (expand-file-name "../doc/info/" ess-lisp-directory)))
|
||||
|
||||
|
||||
;; Loads ess-custom.el and more
|
||||
(require 'ess)
|
||||
|
||||
|
||||
;;; Loading popular dialects (they should become optional in the future)
|
||||
|
||||
;; R and Julia
|
||||
(require 'ess-r-mode)
|
||||
(require 'ess-julia)
|
||||
|
||||
;; S-PLUS (MathSoft/StatSci/Insightful/TIBCO)
|
||||
(require 'ess-sp3-d)
|
||||
(if ess-microsoft-p
|
||||
(require 'ess-sp6w-d)
|
||||
(require 'ess-sp6-d))
|
||||
|
||||
;; S-elsewhere, on another machine by telnet
|
||||
(require 'essd-els)
|
||||
|
||||
;; Stata, SAS and batch BUGS
|
||||
(require 'ess-stata-mode)
|
||||
(require 'ess-sas-d)
|
||||
(require 'ess-bugs-l)
|
||||
|
||||
(ess-write-to-dribble-buffer
|
||||
(format "[ess-site.el]: ess-customize-alist=%s \n"
|
||||
ess-customize-alist))
|
||||
|
||||
;;; Literate Data Analysis
|
||||
(require 'ess-noweb)
|
||||
(require 'ess-swv)
|
||||
|
||||
(ess-write-to-dribble-buffer
|
||||
(format "[ess-site.el _2_]: ess-customize-alist=%s \n"
|
||||
ess-customize-alist))
|
||||
|
||||
;;; Speedbar and mouse
|
||||
(require 'ess-mouse)
|
||||
|
||||
;;; Toolbar support
|
||||
(require 'ess-toolbar)
|
||||
|
||||
;;; Site Specific setup
|
||||
;;;; ===============================================
|
||||
|
||||
(eval-after-load "ess-r-mode"
|
||||
'(progn
|
||||
(ess-write-to-dribble-buffer "[ess-site:] before creating ess-versions-* ...")
|
||||
(ess-r-s-define-runners+menu)
|
||||
(ess-write-to-dribble-buffer "[ess-site:] after ess-versions-created ...")))
|
||||
|
||||
;; Check to see that inferior-ess-r-program points to a working version
|
||||
;; of R; if not, try to find the newest version:
|
||||
(ess-check-R-program) ;; -> (ess-find-newest-R) if needed, in ./ess-r-d.el
|
||||
(ess-write-to-dribble-buffer "[ess-site:] *very* end ...")
|
||||
|
||||
|
||||
|
||||
;;; ess-site.el ends here
|
||||
85
elpa/ess-20180701.100/ess-sp3-d.el
Normal file
85
elpa/ess-20180701.100/ess-sp3-d.el
Normal file
@@ -0,0 +1,85 @@
|
||||
;;; ess-sp3-d.el --- S-PLUS 3.x customization
|
||||
|
||||
;; Copyright (C) 1997--2004 A.J. Rossini, Richard M. Heiberger, Martin
|
||||
;; Maechler, Kurt Hornik, Rodney Sparapani, and Stephen Eglen.
|
||||
|
||||
;; Author: A.J. Rossini <rossini@u.washington.edu>
|
||||
;; Created: 12 Jun 1997
|
||||
;; Maintainer: ESS-core <ESS-core@r-project.org>
|
||||
|
||||
;; Keywords: languages
|
||||
|
||||
;; 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/
|
||||
|
||||
;;; Commentary:
|
||||
|
||||
;; This file defines all the S-PLUS 3.x customizations for ess-mode.
|
||||
|
||||
;;; Code:
|
||||
|
||||
(require 'ess-s-lang)
|
||||
|
||||
(defvar S+3-dialect-name "S+3"
|
||||
"Name of 'dialect' for S-PLUS 3.x.");easily changeable in a user's .emacs
|
||||
|
||||
(defvar S+3-customize-alist
|
||||
(append
|
||||
'((ess-local-customize-alist . 'S+3-customize-alist)
|
||||
(ess-dialect . S+3-dialect-name)
|
||||
(ess-loop-timeout . ess-S-loop-timeout);fixme: dialect spec.
|
||||
(ess-object-name-db-file . "ess-s+3-namedb.el" )
|
||||
(inferior-ess-program . inferior-S+3-program)
|
||||
(inferior-ess-help-command . "help(\"%s\", pager=\"cat\", window=FALSE)\n")
|
||||
(inferior-ess-help-filetype . nil)
|
||||
(inferior-ess-search-list-command . "search()\n")
|
||||
(inferior-ess-start-file . nil) ;"~/.ess-S+3")
|
||||
(inferior-ess-start-args . "")
|
||||
(ess-STERM . "iESS")
|
||||
)
|
||||
S+common-cust-alist)
|
||||
|
||||
"Variables to customize for S+3.")
|
||||
|
||||
|
||||
(defun S+3 (&optional proc-name)
|
||||
"Call 'S-PLUS 3.x', the 'Real Thing' from StatSci."
|
||||
(interactive)
|
||||
(setq ess-customize-alist S+3-customize-alist)
|
||||
(ess-write-to-dribble-buffer
|
||||
(format "\n(S+3): ess-dialect=%s, buf=%s\n" ess-dialect (current-buffer)))
|
||||
(inferior-ess)
|
||||
(if inferior-ess-language-start
|
||||
(ess-eval-linewise inferior-ess-language-start)))
|
||||
|
||||
(defun S+3-mode (&optional proc-name)
|
||||
"Major mode for editing S+3 source. See `ess-mode' for more help."
|
||||
(interactive)
|
||||
(setq ess-customize-alist S+3-customize-alist)
|
||||
(ess-mode S+3-customize-alist proc-name)
|
||||
(if ess-imenu-use-S (ess-imenu-S)))
|
||||
|
||||
(defun S+3-transcript-mode ()
|
||||
"S-PLUS 3.x transcript mode."
|
||||
(interactive)
|
||||
(ess-transcript-mode S+3-customize-alist))
|
||||
|
||||
|
||||
|
||||
; Provide package
|
||||
|
||||
(provide 'ess-sp3-d)
|
||||
|
||||
;;; ess-sp3-d.el ends here
|
||||
419
elpa/ess-20180701.100/ess-sp4-d.el
Normal file
419
elpa/ess-20180701.100/ess-sp4-d.el
Normal file
@@ -0,0 +1,419 @@
|
||||
;;; ess-sp4-d.el --- S-PLUS 4.x customization
|
||||
|
||||
;; Copyright (C) 1998--2002 Richard M. Heiberger <rmh@temple.edu>
|
||||
;; Copyright (C) 2003--2004 A.J. Rossini, Richard M. Heiberger, Martin
|
||||
;; Maechler, Kurt Hornik, Rodney Sparapani, and Stephen Eglen.
|
||||
|
||||
;; Author: Richard M. Heiberger <rmh@temple.edu>
|
||||
;; Created: December 1998
|
||||
;; Maintainer: ESS-core <ESS-core@r-project.org>
|
||||
|
||||
;; Keywords: languages
|
||||
|
||||
;; 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/
|
||||
|
||||
;;; Commentary:
|
||||
|
||||
;; This file defines all the S-PLUS 4.x customizations for ess-mode
|
||||
;; with ddeclient.
|
||||
|
||||
;;; Code:
|
||||
|
||||
;;; Requires and Autoloads:
|
||||
|
||||
(require 'ess-mode)
|
||||
(require 'ess-inf)
|
||||
(require 'ess-s-lang)
|
||||
(require 'ess-dde)
|
||||
|
||||
(defvar ess-S+-startup-delay)
|
||||
|
||||
(defvar S+4-dialect-name "S+4"
|
||||
"Name of 'dialect' for S-PLUS 4.x.");easily changeable in a user's .emacs
|
||||
|
||||
(defvar inferior-S+4-multipleinstances "/MULTIPLEINSTANCES"
|
||||
"Default \"/MULTIPLEINSTANCES\" opens up a new instance of S+4 in a
|
||||
GUI window and connects it to the '(ddeESS [S+4])' window. The
|
||||
alternative nil uses an existing S+4 GUI (if there is one) and
|
||||
connects it to the '(ddeESS [S+4])' window.")
|
||||
|
||||
(defvar S+4-customize-alist
|
||||
(append
|
||||
'((ess-local-customize-alist . 'S+4-customize-alist)
|
||||
(ess-dialect . S+4-dialect-name)
|
||||
(ess-loop-timeout . ess-S-loop-timeout) ;fixme: dialect spec.
|
||||
(ess-object-name-db-file . "ess-sp4-namedb.el" )
|
||||
(inferior-ess-program . inferior-S+4-program)
|
||||
(inferior-ess-help-command . "help(\"%s\")\n")
|
||||
(inferior-ess-help-filetype . "chm")
|
||||
|
||||
(ess-send-region-function . #'ess-dde-send-region)
|
||||
(ess-load-file-function . #'ess-dde-load-file)
|
||||
(ess-command-function . #'ess-dde-command)
|
||||
(ess-eval-linewise-function . #'ess-dde-eval-linewise)
|
||||
(ess-dump-object-function . #'ess-dde-dump-object)
|
||||
(ess-read-object-name-function . #'ess-dde-read-object-name)
|
||||
(ess-find-help-file-function . #'ess-dde-find-help-file)
|
||||
(ess-display-help-on-object-function . #'ess-chm-display-help-on-object)
|
||||
|
||||
(inferior-ess-start-file . nil) ;"~/.ess-S+4")
|
||||
(inferior-ess-start-args . (concat
|
||||
inferior-S+4-multipleinstances " "
|
||||
inferior-S+4-print-command
|
||||
" S_PROJ="
|
||||
(directory-file-name default-directory)))
|
||||
;; (inferior-ess-ddeclient . "ddeclient")
|
||||
;; (inferior-ess-client-name . "S-PLUS")
|
||||
;; (inferior-ess-client-command . "SCommand")
|
||||
(ess-STERM . "ddeESS")
|
||||
)
|
||||
S+common-cust-alist)
|
||||
|
||||
"Variables to customize for S+4")
|
||||
|
||||
(defvar Sqpe+4-customize-alist
|
||||
(append
|
||||
'((ess-local-customize-alist . 'Sqpe+4-customize-alist)
|
||||
(ess-dialect . S+4-dialect-name)
|
||||
(ess-loop-timeout . 500000 );fixme: dialect specific custom.v
|
||||
(ess-object-name-db-file . "ess-sp4-namedb.el" )
|
||||
(ess-display-help-on-object-function . #'ess-chm-display-help-on-object)
|
||||
(inferior-ess-program . inferior-Sqpe+4-program)
|
||||
(inferior-ess-help-command . "help(\"%s\")\n")
|
||||
(inferior-ess-help-filetype . "chm")
|
||||
(inferior-ess-search-list-command . "searchPaths()\n")
|
||||
(inferior-ess-start-file . nil) ;"~/.ess-S+4")
|
||||
(inferior-ess-language-start . (concat
|
||||
"options("
|
||||
"STERM='" ess-STERM "'"
|
||||
(if ess-editor
|
||||
(concat ", editor='" ess-editor "'"))
|
||||
(if ess-pager
|
||||
(concat ", pager='" ess-pager "'"))
|
||||
")"))
|
||||
(ess-STERM . "iESS")
|
||||
)
|
||||
S+common-cust-alist)
|
||||
|
||||
"Variables to customize for Sqpe+4.")
|
||||
|
||||
|
||||
;;; There are extra complications in S+4 (compared to S+3) because
|
||||
;;;
|
||||
;;; (1) The StatSci supplied Splus.exe doesn't work in an emacs
|
||||
;;; buffer. It works as as a GUI window and we must send commands
|
||||
;;; to it through ddeclient. Nonetheless, we need to give it a
|
||||
;;; process name and be sure that that there is a valid running
|
||||
;;; process in the '(ddeESS [S+4])' buffer. Therefore we create an
|
||||
;;; ESS process in the buffer as a placeholder and start a shell
|
||||
;;; in the ESS buffer. From the shell we start Splus. Once Splus
|
||||
;;; finishes initializing and kills the original shell, we start
|
||||
;;; another shell. We have a buffer-local variable
|
||||
;;; inferior-ess-ddeclient, initialized to nil. When there is a
|
||||
;;; non-nil value of inferior-ess-ddeclient we send lines to
|
||||
;;; inferior-ess-ddeclient rather than to the Splus process.
|
||||
;;; (2) There is no Splus process running in the '(ddeESS [S+4])'
|
||||
;;; buffer. Therefore inferior-ess will never see a prompt,
|
||||
;;; unless we first change it to the null prompt "^". Then once
|
||||
;;; the process has started, we change it back.
|
||||
;;; (3) When M-x S+4 starts Splus by a shell command, then Splus is an
|
||||
;;; independent process and will be survive if the '(ddeESS [S+4])'
|
||||
;;; buffer is killed (or emacs is quit). The '(ddeESS [S+4])' is
|
||||
;;; made read-only and a warning is placed in it saying that "You
|
||||
;;; can't type anything here." Actually, if the standalone Splus
|
||||
;;; is killed and the '(ddeESS [S+4])' is made writable (C-x C-q),
|
||||
;;; then '(ddeESS [S+4])' becomes a shell buffer.
|
||||
;;;
|
||||
(defun S+4 (&optional proc-name)
|
||||
"Call 'S-PLUS 4.x', the 'GUI Thing' from StatSci. Put S-Plus in an
|
||||
independent MS-Window (Splus persists even if the '(ddeESS [S+4])'
|
||||
window is killed in emacs). Do this by creating a comint process that
|
||||
calls sh. Send a shell command in that sh buffer to call Splus. When
|
||||
it completes set up a shell as a placeholder in the '(ddeESS [S+4])'
|
||||
buffer. The S-Plus options are correctly set. In particular, the
|
||||
S-Plus Commands window is opened if the Options/General
|
||||
Settings/Startup menu says it should be. There is a 30 second delay
|
||||
during startup in which the screen will not be refreshed. This delay
|
||||
is here to allow slow disks to start the Splus program."
|
||||
(interactive)
|
||||
(save-excursion
|
||||
(setq ess-customize-alist S+4-customize-alist)
|
||||
(ess-write-to-dribble-buffer
|
||||
(format "\n(S+4): ess-dialect=%s, buf=%s\n" ess-dialect
|
||||
(current-buffer)))
|
||||
(setq ess-customize-alist ; change inferior-ess-program
|
||||
(append ess-customize-alist '((inferior-ess-program . "sh"))))
|
||||
(setq ess-customize-alist ; change inferior-ess-primary-prompt
|
||||
(append ess-customize-alist '((inferior-ess-primary-prompt . "^"))))
|
||||
(setq ess-customize-alist ; change inferior-ess-start-args
|
||||
(append ess-customize-alist '((inferior-ess-start-args . "-i"))))
|
||||
(let ((s-proj (getenv "S_PROJ"))
|
||||
(manpath (getenv "MANPATH")))
|
||||
(if (fboundp 'w32-short-file-name)
|
||||
(cd (w32-short-file-name (directory-file-name default-directory)))
|
||||
(cd (directory-file-name default-directory)))
|
||||
(setenv "S_PROJ" default-directory)
|
||||
;; I don't know why this PATH/MANPATH game is needed,
|
||||
;; except that it doesn't work without it.
|
||||
(setenv "MANPATH" (getenv "PATH"))
|
||||
(inferior-ess)
|
||||
(sleep-for 2) ; need to wait, else working too fast! The Splus
|
||||
; command in '(ddeESS [S+4])' should follow the "$"
|
||||
; prompt. If not, then increase the sleep-for time!
|
||||
(setenv "MANPATH" manpath)
|
||||
(setenv "S_PROJ" s-proj))
|
||||
(setq ess-customize-alist S+4-customize-alist)
|
||||
(ess-setq-vars-local ess-customize-alist)
|
||||
;;; the next three lines belong in customize-alist, but can't be there
|
||||
;;; because of the broken ess-setq-vars-default usage in ess-inf.el
|
||||
(setq inferior-ess-ddeclient "ddeclient")
|
||||
(setq inferior-ess-client-name "S-PLUS")
|
||||
(setq inferior-ess-client-command "SCommand")
|
||||
;;; end of what belongs in customize-alist
|
||||
(setq comint-process-echoes nil)
|
||||
(setq comint-input-sender 'comint-simple-send)
|
||||
(goto-char (point-max))
|
||||
(insert (concat inferior-S+4-program " "
|
||||
inferior-ess-start-args)) ; Note: there is no final "&".
|
||||
;; Without the "&", the results of !system.command come to '(ddeESS [S+4])'
|
||||
;; With the "&", the results of !system.command in S get lost.
|
||||
(inferior-ess-send-input)
|
||||
(sleep-for 30) ; Need to wait, else working too fast!
|
||||
; If the ess-current-process-name doesn't appear in the
|
||||
; Splus Commands window increase the sleep-for time!
|
||||
(setq ess-local-process-name ess-current-process-name)
|
||||
(ess-eval-linewise (concat "#" ess-current-process-name))
|
||||
(goto-char (point-min))
|
||||
(insert
|
||||
"This is a placeholder buffer. You can't type anything here.
|
||||
Use `C-x b RET' to return to your file.\n
|
||||
Anything sent to this process from an S-mode buffer goes
|
||||
directly to the associated Splus Commands window.\n
|
||||
The S-Plus Commands window must be visible.
|
||||
You may need to open the S-Plus Commands window manually (by clicking on
|
||||
Splus/Window/Commands Window).\n
|
||||
Any results of the !system.command typed at the S prompt in the
|
||||
Splus Commands window appear in this buffer.\n\n")
|
||||
(goto-char (point-max)) ; comint-mode-map makes '(ddeESS [S+4])'
|
||||
;; (use-local-map comint-mode-map) ;a shell buffer after Splus is finished.
|
||||
(set-buffer-process-coding-system 'raw-text-dos 'raw-text-unix)
|
||||
(setq buffer-read-only t) ; force buffer to be read-only
|
||||
(setq mode-name "ddeESS")
|
||||
;; (ess-eval-linewise inferior-S+4-editor-pager-command)
|
||||
(if inferior-ess-language-start
|
||||
(ess-eval-linewise inferior-ess-language-start))
|
||||
))
|
||||
|
||||
|
||||
|
||||
|
||||
(defun S+4-existing (&optional proc-name)
|
||||
"Call 'S-PLUS 4.x', the 'GUI Thing' from StatSci. Do so by finding
|
||||
an existing S-Plus in an independent MS-Window (if there is one) and
|
||||
set up a '(ddeESS [S+4])' buffer in emacs. If there is no existing
|
||||
S-Plus, then a new one will be opened in the default directory,
|
||||
usually something like c:/Program Files/spls45se/users/yourname.
|
||||
If you have a HOME environment variable, it will open it there."
|
||||
(interactive)
|
||||
(let* ((inferior-S+4-multipleinstances " & # ")) ; Note: there is a final "&".
|
||||
;; Without the "&", there is a core dump.
|
||||
;; With the "&", the results of !system.command in S get lost.
|
||||
;; We are picking up an existing S-Plus process for sending to.
|
||||
;; It doesn't know about us, so nothing comes back.
|
||||
(S+4 proc-name))
|
||||
(with-current-buffer (car (buffer-list)) ; get the ESS buffer just created
|
||||
(setq buffer-read-only nil) ; permit writing in ESS buffer
|
||||
(goto-char (point-max))
|
||||
(beginning-of-line)
|
||||
(forward-line -1)
|
||||
(insert
|
||||
"This is S+4-existing.
|
||||
Results of the !system.command typed at the S prompt in the
|
||||
Splus Commands window blink a DOS window and you won't see them.\n\n")
|
||||
(setq buffer-read-only t) ; restore ESS buffer to be read-only
|
||||
))
|
||||
|
||||
|
||||
;;; There are extra complications in Sqpe+4 (compared to S+3) because
|
||||
;;; (1) The StatSci supplied Sqpe.exe won't work without SHOME as an
|
||||
;;; environment variable and Sqpe does not take command line
|
||||
;;; arguments and
|
||||
;;; (2) Sqpe.exe comes up with options(interactive=F), which means it
|
||||
;;; doesn't provide prompts by default, and we must change it to T so
|
||||
;;; it will provide prompts.
|
||||
;;;
|
||||
(defun Sqpe+4 (&optional proc-name)
|
||||
"Call 'Sqpe' from 'S-PLUS 4.x', the 'Real Thing' from StatSci."
|
||||
(interactive)
|
||||
(setq ess-customize-alist Sqpe+4-customize-alist)
|
||||
(let* ((shome-nil-p (equal (getenv "SHOME") nil)))
|
||||
(if shome-nil-p (setenv "SHOME" inferior-Sqpe+4-SHOME-name))
|
||||
(ess-write-to-dribble-buffer
|
||||
(format "\n(Sqpe+4): ess-dialect=%s, buf=%s\n" ess-dialect
|
||||
(current-buffer)))
|
||||
(setq ess-customize-alist ; change inferior-ess-primary-prompt
|
||||
(append ess-customize-alist '((inferior-ess-primary-prompt . "^"))))
|
||||
(inferior-ess)
|
||||
(setq ess-customize-alist Sqpe+4-customize-alist) ; restore i-e-p-p in alist
|
||||
(ess-setq-vars-local ess-customize-alist) ; restore i-e-p-p in buffer
|
||||
(setq inferior-ess-prompt ; define with correct i-e-p-p
|
||||
;; Do not anchor to bol with `^' ; (copied from ess-inf.el)
|
||||
(concat "\\("
|
||||
inferior-ess-primary-prompt
|
||||
"\\|"
|
||||
inferior-ess-secondary-prompt
|
||||
"\\)"))
|
||||
(setq comint-prompt-regexp (concat "^" inferior-ess-prompt))
|
||||
; define with correct i-e-p-p
|
||||
(setq comint-input-sender 'inferior-ess-input-sender)
|
||||
(add-hook 'comint-output-filter-functions 'shell-strip-ctrl-m nil t)
|
||||
(goto-char (point-max))
|
||||
(insert "options(interactive=T)")
|
||||
(inferior-ess-send-input)
|
||||
(setq mode-name "iESS(Sqpe)")
|
||||
;; (ess-eval-linewise inferior-S+4-editor-pager-command)
|
||||
(if inferior-ess-language-start
|
||||
(ess-eval-linewise inferior-ess-language-start))
|
||||
(if shome-nil-p (setenv "SHOME" nil))))
|
||||
|
||||
|
||||
|
||||
(defun S+4-mode (&optional proc-name)
|
||||
"Major mode for editing S+4 source. See `ess-mode' for more help."
|
||||
(interactive)
|
||||
(setq ess-customize-alist S+4-customize-alist)
|
||||
(ess-mode S+4-customize-alist proc-name)
|
||||
(if ess-imenu-use-S (ess-imenu-S)))
|
||||
|
||||
(defun S+4-transcript-mode ()
|
||||
"S-PLUS 4.x transcript mode."
|
||||
(interactive)
|
||||
(ess-transcript-mode S+4-customize-alist))
|
||||
|
||||
|
||||
(defun S+4-msdos (&optional proc-name)
|
||||
"Call 'S-PLUS 4.x', the 'GUI Thing' from StatSci. Put S-Plus in an
|
||||
independent MS-Window (Splus persists even if the '(ddeESS [S+4])'
|
||||
window is killed in emacs). Do this by creating a comint process that
|
||||
calls sh. Send a shell command in that sh buffer to call Splus. When
|
||||
it completes set up a shell as a placeholder in the '(ddeESS [S+4])'
|
||||
buffer. The S-Plus options are correctly set. In particular, the
|
||||
S-Plus Commands window is opened if the Options/General
|
||||
Settings/Startup menu says it should be. There is a 30 second delay
|
||||
during startup in which the screen will not be refreshed. This delay
|
||||
is here to allow slow disks to start the Splus program."
|
||||
(interactive)
|
||||
(save-excursion
|
||||
(setq ess-customize-alist S+4-customize-alist)
|
||||
(ess-write-to-dribble-buffer
|
||||
(format "\n(S+4): ess-dialect=%s, buf=%s\n" ess-dialect
|
||||
(current-buffer)))
|
||||
(setq ess-customize-alist ; change inferior-ess-program
|
||||
(append ess-customize-alist '((inferior-ess-program
|
||||
. (getenv "COMSPEC")))))
|
||||
(setq ess-customize-alist ; change inferior-ess-primary-prompt
|
||||
(append ess-customize-alist '((inferior-ess-primary-prompt . "^"))))
|
||||
(setq ess-customize-alist ; change inferior-ess-start-args
|
||||
(append ess-customize-alist '((inferior-ess-start-args . ""))))
|
||||
(let ((s-proj (getenv "S_PROJ")))
|
||||
(if (fboundp 'w32-short-file-name)
|
||||
(cd (w32-short-file-name (directory-file-name default-directory)))
|
||||
(cd (directory-file-name default-directory)))
|
||||
(setenv "S_PROJ" default-directory)
|
||||
(inferior-ess)
|
||||
(sleep-for 2) ; need to wait, else working too fast! The Splus
|
||||
; command in '(ddeESS [S+4])' should follow the "$"
|
||||
; prompt. If not, then increase the sleep-for time!
|
||||
(setenv "S_PROJ" s-proj))
|
||||
(setq ess-customize-alist S+4-customize-alist)
|
||||
(ess-setq-vars-local ess-customize-alist)
|
||||
;;; the next three lines belong in customize-alist, but can't be there
|
||||
;;; because of the broken ess-setq-vars-default usage in ess-inf.el
|
||||
(setq inferior-ess-ddeclient "ddeclient")
|
||||
(setq inferior-ess-client-name "S-PLUS")
|
||||
(setq inferior-ess-client-command "SCommand")
|
||||
;;; end of what belongs in customize-alist
|
||||
(setq comint-input-sender 'comint-simple-send)
|
||||
(setq comint-process-echoes nil)
|
||||
(set-buffer-process-coding-system 'raw-text-dos 'raw-text-dos)
|
||||
(goto-char (point-max))
|
||||
(insert (concat inferior-S+4-program " "
|
||||
inferior-ess-start-args)) ; Note: there is no final "&".
|
||||
; Without the "&", the results of !system.command come to '(ddeESS [S+4])'
|
||||
; With the "&", the results of !system.command in S get lost.
|
||||
(inferior-ess-send-input)
|
||||
(sleep-for 30) ; Need to wait, else working too fast!
|
||||
; If the ess-current-process-name doesn't appear in the
|
||||
; Splus Commands window increase the sleep-for time!
|
||||
;;; from msdos-minor-mode
|
||||
(setq comint-process-echoes t)
|
||||
(add-hook 'comint-output-filter-functions 'shell-strip-ctrl-m nil t)
|
||||
;;; end from msdos-minor-mode
|
||||
(setq ess-local-process-name ess-current-process-name)
|
||||
(ess-eval-linewise (concat "#" ess-current-process-name))
|
||||
(goto-char (point-min))
|
||||
(insert
|
||||
"This is a placeholder buffer. You can't type anything here.
|
||||
Use 'C-x b RET' to return to your file.\n
|
||||
Anything sent to this process from an S-mode buffer goes
|
||||
directly to the associated Splus Commands window.\n
|
||||
The S-Plus Commands window must be visible.
|
||||
You may need to open the S-Plus Commands window manually
|
||||
(by clicking on Splus/Window/Commands Window).\n There is a 30
|
||||
second delay when this program starts during which the emacs
|
||||
screen will be partially blank.\n Remember to `q()' from S-Plus
|
||||
and then C-x C-q exit from the `'(ddeESS [S+4])'' buffer, or take
|
||||
the risk of not being able to shut down your computer and
|
||||
suffering through scandisk.\n Any results of the !system.command
|
||||
typed at the S prompt in the Splus Commands window (are supposed
|
||||
to) appear in this buffer.\n\n")
|
||||
(goto-char (point-max)) ; comint-mode-map makes '(ddeESS [S+4])'
|
||||
(use-local-map comint-mode-map) ; a shell buffer after Splus is finished.
|
||||
(setq buffer-read-only t) ; force buffer to be read-only
|
||||
(setq mode-name "ddeESS")
|
||||
;; (ess-eval-linewise inferior-S+4-editor-pager-command)
|
||||
(if inferior-ess-language-start
|
||||
(ess-eval-linewise inferior-ess-language-start))
|
||||
))
|
||||
|
||||
(defun S+4-msdos-existing (&optional proc-name)
|
||||
"Call 'S-PLUS 4.x', the 'GUI Thing' from StatSci. Do so by finding
|
||||
an existing S-Plus in an independent MS-Window (if there is one) and
|
||||
set up a '(ddeESS [S+4])' buffer in emacs. If there is no existing
|
||||
S-Plus, then a new one will be opened in the default directory,
|
||||
usually something like c:/Program Files/spls45se/users/yourname.
|
||||
If you have a HOME environment variable, it will open it there."
|
||||
(interactive)
|
||||
(let* ((inferior-S+4-multipleinstances ""))
|
||||
(S+4-msdos proc-name))
|
||||
(with-current-buffer
|
||||
(car (buffer-list)) ; get the ESS buffer just created
|
||||
(setq buffer-read-only nil) ; permit writing in ESS buffer
|
||||
(goto-char (point-max))
|
||||
(beginning-of-line)
|
||||
(forward-line -1)
|
||||
(insert
|
||||
"This is S+4-msdos-existing.
|
||||
Results of the !system.command typed at the S prompt in the
|
||||
Splus Commands window blink a DOS window and you won't see them.\n\n")
|
||||
(setq buffer-read-only t) ; restore ESS buffer to be read-only
|
||||
))
|
||||
|
||||
; Provide package
|
||||
|
||||
(provide 'ess-sp4-d)
|
||||
|
||||
;;; ess-sp4-d.el ends here
|
||||
106
elpa/ess-20180701.100/ess-sp5-d.el
Normal file
106
elpa/ess-20180701.100/ess-sp5-d.el
Normal file
@@ -0,0 +1,106 @@
|
||||
;;; ess-sp5-d.el --- S-plus 5 customization
|
||||
|
||||
;; Copyright (C) 1998 A.J. Rossini
|
||||
;; Copyright (C) 1999--2004 A.J. Rossini, Richard M. Heiberger, Martin
|
||||
;; Maechler, Kurt Hornik, Rodney Sparapani, and Stephen Eglen.
|
||||
|
||||
;; Author: A.J. Rossini <rossini@biostat.washington.edu>
|
||||
;; Created: 9 Nov 1998
|
||||
;; Maintainer: ESS-core <ESS-core@r-project.org>
|
||||
|
||||
;; Keywords: languages
|
||||
|
||||
;; 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/
|
||||
|
||||
;;; Commentary:
|
||||
|
||||
;; AJR copied S4 to be S+5.
|
||||
;; DB contributed the changes from ess-sp3-d.el to
|
||||
;; ess-s4-d.el. (removed the old ugly approach).
|
||||
;; This file defines Sp5 customizations for ess-mode. Lots of thanks
|
||||
;; to RMH and JMC for code and suggestions
|
||||
;; Thanks to MM for making this sensible.
|
||||
|
||||
;;; Code:
|
||||
|
||||
(require 'ess-s-lang)
|
||||
|
||||
;; You now need to make sure you've defined if you are running 5.0 or 5.1.
|
||||
;; Lots of things are broken between them, GRR...
|
||||
|
||||
(defvar S+5-dialect-name "S+5"
|
||||
"Name of 'dialect' for S-PLUS 5.");easily changeable in a user's .emacs
|
||||
|
||||
(defvar S+5-customize-alist
|
||||
(append
|
||||
'((ess-local-customize-alist . 'S+5-customize-alist)
|
||||
(ess-dialect . S+5-dialect-name)
|
||||
(ess-loop-timeout . ess-S-loop-timeout);fixme: dialect spec.
|
||||
(ess-object-name-db-file . "ess-sp5-namedb.el")
|
||||
(inferior-ess-program . inferior-S+5-program)
|
||||
;;(inferior-ess-objects-pattern . ".*") ; for new s4 stuff
|
||||
(inferior-ess-help-command . "help(\"%s\", pager=\"slynx -dump\", window=FALSE)\n")
|
||||
(inferior-ess-help-filetype . nil)
|
||||
(inferior-ess-search-list-command . "searchPaths()\n")
|
||||
(inferior-ess-start-args . inferior-S+-start-args)
|
||||
(ess-STERM . "iESS")
|
||||
)
|
||||
S+common-cust-alist)
|
||||
|
||||
"Variables to customize for S+5.")
|
||||
|
||||
|
||||
;; For loading up the S code required for the above.
|
||||
;;(add-hook 'ess-post-run-hook
|
||||
;; (lambda ()
|
||||
;; (ess-command
|
||||
;; (concat
|
||||
;; "if(exists(\"Sversion\")) library(emacs) else source(\""
|
||||
;; ess-mode-run-file
|
||||
;; "\")\n"))
|
||||
;; (if ess-mode-run-file2
|
||||
;; (ess-command
|
||||
;; (concat "source(\"" ess-mode-run-file2 "\")\n")))))
|
||||
|
||||
|
||||
(defun S+5 (&optional proc-name)
|
||||
"Call 'Splus5', based on S version 4, from Bell Labs.
|
||||
New way to do it."
|
||||
(interactive)
|
||||
(setq ess-customize-alist S+5-customize-alist)
|
||||
(ess-write-to-dribble-buffer
|
||||
(format "\n(S+5): ess-dialect=%s, buf=%s\n" ess-dialect (current-buffer)))
|
||||
(inferior-ess)
|
||||
(if inferior-ess-language-start
|
||||
(ess-eval-linewise inferior-ess-language-start)))
|
||||
|
||||
(defun S+5-mode (&optional proc-name)
|
||||
"Major mode for editing S+5 source. See `ess-mode' for more help."
|
||||
(interactive)
|
||||
(setq ess-customize-alist S+5-customize-alist)
|
||||
(ess-mode S+5-customize-alist proc-name)
|
||||
(if ess-imenu-use-S (ess-imenu-S)))
|
||||
|
||||
(defun S+5-transcript-mode ()
|
||||
"S-PLUS 5 transcript mode."
|
||||
(interactive)
|
||||
(ess-transcript-mode S+5-customize-alist))
|
||||
|
||||
; Provide package
|
||||
|
||||
(provide 'ess-sp5-d)
|
||||
|
||||
;;; ess-sp5-d.el ends here
|
||||
198
elpa/ess-20180701.100/ess-sp6-d.el
Normal file
198
elpa/ess-20180701.100/ess-sp6-d.el
Normal file
@@ -0,0 +1,198 @@
|
||||
;;; ess-sp6-d.el --- S-Plus 6 & 7 & 8 customization
|
||||
|
||||
;; Copyright (C) 2001--2005 A.J. Rossini, Richard M. Heiberger, Martin
|
||||
;; Maechler, Kurt Hornik, Rodney Sparapani, and Stephen Eglen.
|
||||
|
||||
;; Author: A.J. Rossini <rossini@u.washington.edu>
|
||||
;; Created: 2001/02/06
|
||||
;; Maintainer: ESS Core Team <ESS-core@r-project.org>
|
||||
|
||||
;; Keywords: languages
|
||||
|
||||
;; 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/
|
||||
|
||||
;;; Commentary:
|
||||
|
||||
;; AJR copied S+5 to be S+6.
|
||||
;; AJR copied S4 to be S+5.
|
||||
;; DB contributed the changes from ess-sp3-d.el to
|
||||
;; ess-s4-d.el. (removed the old ugly approach).
|
||||
;; This file defines Sp5 customizations for ess-mode. Lots of thanks
|
||||
;; to RMH and JMC for code and suggestions
|
||||
;; Thanks to MM for making this sensible.
|
||||
|
||||
;;; Code:
|
||||
|
||||
(require 'ess-mode)
|
||||
(require 'ess-inf)
|
||||
(require 'ess-s-lang)
|
||||
(require 'ess-dde)
|
||||
|
||||
;; You now need to make sure you've defined if you are running 5.0 or 5.1.
|
||||
;; Lots of things are broken between them, GRR...
|
||||
|
||||
(defun S+-directory-p (directory)
|
||||
"Splus 5++ directories have a .Data directory and a __Meta directory within."
|
||||
(and directory
|
||||
(file-directory-p (concat directory ".Data"))
|
||||
(file-directory-p (concat directory ".Data/__Meta"))))
|
||||
|
||||
(defvar S+-directory-function #'inferior-ess-default-directory)
|
||||
|
||||
(defvaralias 'S+6-setup-directory-function 'S+-setup-directory-function)
|
||||
(defvar S+-setup-directory-function
|
||||
(lambda (startdir)
|
||||
(when (and startdir (S+-directory-p startdir))
|
||||
(setenv "S_WORK"
|
||||
(if (getenv "S_WORK")
|
||||
(concat startdir ":" (getenv "S_WORK"))
|
||||
;;(message "adding %s to S_WORK" startdir)
|
||||
startdir)))))
|
||||
|
||||
|
||||
|
||||
(defvaralias 'S+6-customize-alist 'S+-customize-alist)
|
||||
(defvar S+-customize-alist
|
||||
(append
|
||||
'((ess-local-customize-alist . 'S+-customize-alist)
|
||||
(ess-dialect . S+-dialect-name)
|
||||
(ess-loop-timeout . ess-S-loop-timeout) ;fixme: dialect spec.
|
||||
(ess-function-pattern . ess-r-function-pattern)
|
||||
|
||||
(ess-object-name-db-file . "ess-sp6-namedb.el")
|
||||
(inferior-ess-program . inferior-S+-program)
|
||||
(inferior-ess-help-command . "help(\"%s\", pager=\"slynx -dump\", window=FALSE)\n")
|
||||
(inferior-ess-help-filetype . nil)
|
||||
(inferior-ess-search-list-command . "searchPaths()\n")
|
||||
|
||||
(ess-send-region-function . #'ess-dde-send-region)
|
||||
(ess-load-file-function . #'ess-dde-load-file)
|
||||
(ess-command-function . #'ess-dde-command)
|
||||
(ess-eval-linewise-function . #'ess-dde-eval-linewise)
|
||||
(ess-dump-object-function . #'ess-dde-dump-object)
|
||||
(ess-read-object-name-function . #'ess-dde-read-object-name)
|
||||
(ess-find-help-file-function . #'ess-dde-find-help-file)
|
||||
(ess-display-help-on-object-function . #'ess-dde-display-help-on-object)
|
||||
|
||||
(ess-directory-function . S+-directory-function)
|
||||
(ess-setup-directory-function . S+-setup-directory-function)
|
||||
(inferior-ess-start-args . inferior-S+-start-args)
|
||||
(ess-STERM . "iESS")
|
||||
)
|
||||
S+common-cust-alist)
|
||||
|
||||
"Variables to customize for S+.")
|
||||
|
||||
(defvar ess-S+-post-run-hook nil
|
||||
"Functions run in process buffer after the initialization of S+
|
||||
process.")
|
||||
|
||||
(defalias 'S+6 'S+)
|
||||
(defun S+ (&optional proc-name)
|
||||
"Call 'Splus6', based on S version 4, from Bell Labs.
|
||||
New way to do it."
|
||||
(interactive)
|
||||
(setq ess-customize-alist S+-customize-alist)
|
||||
(ess-write-to-dribble-buffer
|
||||
(format "\n(S+): ess-dialect=%s, buf=%s\n" ess-dialect (current-buffer)))
|
||||
(inferior-ess)
|
||||
(ess-command ess-S+--injected-code)
|
||||
(if inferior-ess-language-start
|
||||
(ess-eval-linewise inferior-ess-language-start))
|
||||
(with-ess-process-buffer nil
|
||||
(run-mode-hooks 'ess-S+-post-run-hook)))
|
||||
|
||||
(defvar ess-S+--injected-code
|
||||
".ess_funargs <- function(funname){
|
||||
## funname <- deparse(substitute(object))
|
||||
fun <- try(eval(parse(text=funname)), silent = TRUE)
|
||||
if(is.function(fun)) {
|
||||
special <- grepl('[:$@[]', funname)
|
||||
args <- args(fun)
|
||||
fmls <- formals(args)
|
||||
fmls.names <- names(fmls)
|
||||
fmls <- gsub('\\\"', '\\\\\\\"', as.character(fmls), fixed = TRUE)
|
||||
args.alist <- sprintf(\"'(%s)\", paste(\"(\\\"\", fmls.names, \"\\\" . \\\"\", fmls, \"\\\")\", sep = '', collapse = ' '))
|
||||
## envname <- environmentName(environment(fun))
|
||||
envname <- if (special) '' else 'S+'
|
||||
cat(sprintf('(list \\\"%s\\\" %s )\\n', envname, args.alist))
|
||||
}
|
||||
}
|
||||
")
|
||||
|
||||
|
||||
(defalias 'S+6-mode 'S+-mode)
|
||||
;;;###autoload
|
||||
(defun S+-mode (&optional proc-name)
|
||||
"Major mode for editing S+ source. See `ess-mode' for more help."
|
||||
(interactive)
|
||||
(setq ess-customize-alist S+-customize-alist)
|
||||
(ess-mode S+-customize-alist proc-name)
|
||||
(if (fboundp 'ess-add-toolbar) (ess-add-toolbar))
|
||||
(if ess-imenu-use-S (ess-imenu-S)))
|
||||
|
||||
(defalias 'S+6-transcript-mode 'S+-transcript-mode)
|
||||
(defun S+-transcript-mode ()
|
||||
"S-PLUS 6 transcript mode."
|
||||
(interactive)
|
||||
(ess-transcript-mode S+-customize-alist))
|
||||
|
||||
(defvar ess-s-versions '("Splus")
|
||||
"List of partial strings for versions of S to access within ESS.
|
||||
Each string specifies the start of a filename. If a filename
|
||||
beginning with one of these strings is found on `exec-path', a M-x
|
||||
command for that version of S is made available. For example, if the
|
||||
file \"Splus7\" is found and this variable includes the string
|
||||
\"Splus\", a function called `M-x Splus7' will be available to run that
|
||||
version of S.
|
||||
If duplicate versions of the same program are found (which happens if
|
||||
the same path is listed on `exec-path' more than once), they are
|
||||
ignored by calling `ess-uniq-list'.
|
||||
Set this variable to nil to disable searching for other versions
|
||||
of S using this method.
|
||||
If you set this variable, you need to restart Emacs (and set this variable
|
||||
before ess-site is loaded) for it to take effect.")
|
||||
|
||||
(defvar ess-s-created-runners)
|
||||
(define-obsolete-variable-alias
|
||||
'ess-s-versions-created 'ess-s-created-runners "2018-05-12")
|
||||
(defun ess-s-define-runners ()
|
||||
"Generate functions for starting other versions of S.
|
||||
See `ess-s-versions' for strings that determine which functions are created.
|
||||
It assumes these versions of S can be run as a substitute for Splus6.
|
||||
|
||||
This function returns the list of functions, if any, that were
|
||||
created. The functions will normally be placed on the menubar upon
|
||||
ESS initialization."
|
||||
(when ess-s-versions
|
||||
(let ((versions
|
||||
(ess-uniq-list
|
||||
(mapcar #'file-name-nondirectory
|
||||
(apply #'nconc
|
||||
(mapcar #'ess-find-exec-completions
|
||||
ess-s-versions))))))
|
||||
;; Iterate over each string in VERSIONS, creating a new defun
|
||||
;; each time.
|
||||
(setq ess-s-created-runners
|
||||
(mapc (lambda (v) (ess-define-runner v "S")) versions)))))
|
||||
(define-obsolete-function-alias
|
||||
'ess-s-versions-create 'ess-s-define-runners "2018-05-12")
|
||||
|
||||
; Provide package
|
||||
|
||||
(provide 'ess-sp6-d)
|
||||
|
||||
;;; ess-sp6-d.el ends here
|
||||
603
elpa/ess-20180701.100/ess-sp6w-d.el
Normal file
603
elpa/ess-20180701.100/ess-sp6w-d.el
Normal file
@@ -0,0 +1,603 @@
|
||||
;;; ess-sp6w-d.el --- S-PLUS 6.x for Windows customization
|
||||
|
||||
;;; copied and edited from ess-s4-d.el - Richard M. Heiberger, April 2001
|
||||
|
||||
;; Copyright (C) 2001 Richard M. Heiberger <rmh@temple.edu>
|
||||
;; Copyright (C) 2002--2005 A.J. Rossini, Richard M. Heiberger, Martin
|
||||
;; Maechler, Kurt Hornik, Rodney Sparapani, and Stephen Eglen.
|
||||
|
||||
;; Author: Richard M. Heiberger <rmh@temple.edu>
|
||||
;; Created: April 2001
|
||||
;; Maintainer: ESS-core <ESS-core@r-project.org>
|
||||
|
||||
;; Keywords: languages
|
||||
|
||||
;; 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/
|
||||
|
||||
;;; Commentary:
|
||||
|
||||
;; This file defines all the S-PLUS 6.x for Windows customizations
|
||||
;; for ess-mode with ddeclient.
|
||||
|
||||
;;; Code:
|
||||
|
||||
;;; Requires and Autoloads:
|
||||
|
||||
(require 'ess-s-lang)
|
||||
(defvar ess-S+-startup-delay)
|
||||
(defvar version-function-name)
|
||||
;;NO: this is autoloaded from other places (require 'ess-dde)
|
||||
|
||||
(defvaralias 'inferior-S+6-multipleinstances 'inferior-S+-multipleinstances)
|
||||
(defvar inferior-S+-multipleinstances "/MULTIPLEINSTANCES"
|
||||
"Default \"/MULTIPLEINSTANCES\" opens up a new instance of S+[678] in a
|
||||
GUI window and connects it to the '(ddeESS [S+])' window. The
|
||||
alternative nil uses an existing S+ GUI (if there is one) and
|
||||
connects it to the '(ddeESS [S+])' window.")
|
||||
|
||||
(defvaralias 'S+6-customize-alist 'S+-customize-alist)
|
||||
(defvar S+-customize-alist
|
||||
(append
|
||||
'((ess-local-customize-alist . 'S+-customize-alist)
|
||||
(ess-dialect . S+-dialect-name)
|
||||
(ess-loop-timeout . ess-S-loop-timeout);fixme: dialect spec.
|
||||
(ess-object-name-db-file . "ess-sp6-namedb.el" )
|
||||
(ess-display-help-on-object-function . #'ess-chm-display-help-on-object)
|
||||
(inferior-ess-program . inferior-S+-program)
|
||||
(inferior-ess-help-command . "help(\"%s\")\n")
|
||||
(inferior-ess-help-filetype . "chm")
|
||||
(inferior-ess-search-list-command . "searchPaths()\n")
|
||||
(inferior-ess-start-file . nil) ;"~/.ess-S+")
|
||||
(inferior-ess-start-args . (concat
|
||||
inferior-S+-multipleinstances
|
||||
" "
|
||||
inferior-S+-start-args
|
||||
" "
|
||||
inferior-S+-print-command
|
||||
" S_PROJ="
|
||||
(when (fboundp 'w32-short-file-name)
|
||||
(w32-short-file-name
|
||||
(directory-file-name
|
||||
default-directory)))))
|
||||
;; (inferior-ess-ddeclient . "ddeclient")
|
||||
;; (inferior-ess-client-name . "S-PLUS")
|
||||
;; (inferior-ess-client-command . "SCommand")
|
||||
(ess-STERM . "ddeESS")
|
||||
)
|
||||
S+common-cust-alist)
|
||||
"Variables to customize for S+")
|
||||
|
||||
(defvaralias 'Sqpe+6-customize-alist 'Sqpe+-customize-alist)
|
||||
(defvar Sqpe+-customize-alist
|
||||
(append
|
||||
'((ess-local-customize-alist . 'Sqpe+-customize-alist)
|
||||
(ess-dialect . S+-dialect-name)
|
||||
(ess-loop-timeout . 500000 );fixme: dialect specific custom.var
|
||||
(ess-object-name-db-file . "ess-sp6-namedb.el" )
|
||||
(ess-display-help-on-object-function . #'ess-chm-display-help-on-object)
|
||||
(inferior-ess-program . inferior-Sqpe+-program)
|
||||
(inferior-ess-help-command . "help(\"%s\")\n")
|
||||
(inferior-ess-help-filetype . "chm")
|
||||
(inferior-ess-search-list-command . "searchPaths()\n")
|
||||
(inferior-ess-start-file . nil) ;"~/.ess-S+")
|
||||
(inferior-ess-start-args . (concat
|
||||
;; workaround for bug in S-Plus 6 for Windows:
|
||||
"ALWAYS_PROMPT=X"
|
||||
" "
|
||||
inferior-Sqpe+-start-args ;; e.g. license manager
|
||||
))
|
||||
(ess-STERM . "iESS")
|
||||
)
|
||||
S+common-cust-alist)
|
||||
"Variables to customize for Sqpe+.")
|
||||
|
||||
|
||||
|
||||
;;; There are extra complications in S+6 and S+7 and S+8 (compared to S+3)
|
||||
;;; because
|
||||
;;;
|
||||
;;; (1) The StatSci supplied Splus.exe doesn't work in an emacs
|
||||
;;; buffer. It works as as a GUI window and we must send commands
|
||||
;;; to it through ddeclient. Nonetheless, we need to give it a
|
||||
;;; process name and be sure that that there is a valid running
|
||||
;;; process in the '(ddeESS [S+])' buffer. Therefore we create an
|
||||
;;; ESS process in the buffer as a placeholder and start a shell
|
||||
;;; in the ESS buffer. From the shell we start Splus. Once Splus
|
||||
;;; finishes initializing and kills the original shell, we start
|
||||
;;; another shell. We have a buffer-local variable
|
||||
;;; inferior-ess-ddeclient, initialized to nil. When there is a
|
||||
;;; non-nil value of inferior-ess-ddeclient we send lines to
|
||||
;;; inferior-ess-ddeclient rather than to the Splus process.
|
||||
;;; (2) There is no Splus process running in the '(ddeESS [S+])'
|
||||
;;; buffer. Therefore inferior-ess will never see a prompt,
|
||||
;;; unless we first change it to the null prompt "^". Then once
|
||||
;;; the process has started, we change it back.
|
||||
;;; (3) When M-x S+ starts Splus by a shell command, then Splus is an
|
||||
;;; independent process and will be survive if the '(ddeESS [S+])'
|
||||
;;; buffer is killed (or emacs is quit). The '(ddeESS [S+])' is
|
||||
;;; made read-only and a warning is placed in it saying that "You
|
||||
;;; can't type anything here." Actually, if thestandalone Splus
|
||||
;;; is killed and the '(ddeESS [S+])' is made writable (C-x C-q),
|
||||
;;; then '(ddeESS [S+])' becomes a shell buffer.
|
||||
;;;
|
||||
(defalias 'S+6 'S+)
|
||||
(defun S+ (&optional proc-name)
|
||||
"Verify that `inferior-S+-program' points to S-Plus 6 or
|
||||
S-Plus 7 or S-Plus 8. Start normally for S-Plus 6.1 and later.
|
||||
Inform the user to start S-Plus 6.0 from the icon and then
|
||||
connect to it with `S+-existing'. Give an error message if
|
||||
`inferior-S+-program' doesn't point to S-Plus 6 or S-Plus 7
|
||||
or S-Plus 8."
|
||||
(interactive)
|
||||
(with-current-buffer (find-file-noselect
|
||||
(concat (executable-find inferior-S+-program)
|
||||
"/../../versions") t)
|
||||
(setq buffer-read-only 1)
|
||||
(forward-line)
|
||||
(if (not (search-backward-regexp "splus\t[678].[0-9]" (point-min) t))
|
||||
(error "The emacs variable `inferior-S+-program' does
|
||||
not point to S-Plus 6 or 7 or 8. Please add `splus[678]?/cmd' (expand the
|
||||
`[678]?' to match your setup) to your `exec-path' or specify the complete
|
||||
path to `Splus.exe' in the variable `inferior-S+-program' in your
|
||||
`.emacs' file.")
|
||||
(forward-line)
|
||||
(if (search-backward "splus\t6.0" (point-min) t)
|
||||
(error "S-Plus 6.0 for Microsoft Windows has a bug that
|
||||
prevents it from being started by emacs. Instead, you must start it
|
||||
by double-clicking an icon. Then you can connect to it with
|
||||
`S+-existing'. You should consider upgrading to a newer
|
||||
release of S-Plus."))))
|
||||
(S+-initiate proc-name)) ;; normal start ;
|
||||
|
||||
(defalias 'S+6-initiate 'S+-initiate)
|
||||
(defun S+-initiate (&optional proc-name)
|
||||
"Call 'S-PLUS [678].x for Windows', the 'GUI Thing' from StatSci. Put
|
||||
S-Plus in an independent MS-Window (Splus persists even if the
|
||||
'(ddeESS [S+])' window is killed in emacs). Do this by creating a
|
||||
comint process that calls sh. Send a shell command in that sh buffer
|
||||
to call Splus. When it completes set up a shell as a placeholder in
|
||||
the '(ddeESS [S+])' buffer. The S-Plus options are correctly set.
|
||||
In particular, the S-Plus Commands window is opened if the
|
||||
Options/General Settings/Startup menu says it should be. There is a
|
||||
startup delay of `ess-S+-startup-delay' seconds during which the
|
||||
screen will not be refreshed. This delay is here to allow slow disks
|
||||
to start the Splus program."
|
||||
(interactive)
|
||||
(save-excursion
|
||||
(setq ess-customize-alist S+-customize-alist)
|
||||
(ess-write-to-dribble-buffer
|
||||
(format "\n(S+): ess-dialect=%s, buf=%s\n" ess-dialect
|
||||
(current-buffer)))
|
||||
(setq ess-customize-alist ; change inferior-ess-program
|
||||
(append ess-customize-alist '((inferior-ess-program . "sh"))))
|
||||
(setq ess-customize-alist ; change inferior-ess-primary-prompt
|
||||
(append ess-customize-alist '((inferior-ess-primary-prompt . "^"))))
|
||||
(setq ess-customize-alist ; change inferior-ess-start-args
|
||||
(append ess-customize-alist '((inferior-ess-start-args . "-i"))))
|
||||
(let ((s-proj (getenv "S_PROJ"))
|
||||
(use-dialog-box (not (or ess-microsoft-p (eq system-type 'cygwin))))
|
||||
)
|
||||
(cd (when (fboundp 'w32-short-file-name)
|
||||
(w32-short-file-name (directory-file-name default-directory))))
|
||||
(setenv "S_PROJ" (when
|
||||
(fboundp 'w32-short-file-name)
|
||||
(w32-short-file-name default-directory)))
|
||||
(inferior-ess)
|
||||
(sleep-for 2) ; need to wait, else working too fast! The Splus
|
||||
; command in '(ddeESS [S+])' should follow the "$"
|
||||
; prompt. If not, then increase the sleep-for time!
|
||||
(setenv "S_PROJ" s-proj))
|
||||
(setq ess-customize-alist S+-customize-alist)
|
||||
(ess-setq-vars-local ess-customize-alist)
|
||||
;;; the next three lines belong in customize-alist, but can't be there
|
||||
;;; because of the broken ess-setq-vars-default usage in ess-inf.el
|
||||
(setq inferior-ess-ddeclient "ddeclient")
|
||||
(setq inferior-ess-client-name "S-PLUS")
|
||||
(setq inferior-ess-client-command "SCommand")
|
||||
;;; end of what belongs in customize-alist
|
||||
(setq comint-process-echoes nil)
|
||||
(setq comint-input-sender 'comint-simple-send)
|
||||
(goto-char (point-max))
|
||||
(insert (concat inferior-S+-program " "
|
||||
inferior-ess-start-args)) ; Note: there is no final "&".
|
||||
;; Without the "&", the results of !system.command come to '(ddeESS [S+])'
|
||||
;; With the "&", the results of !system.command in S get lost.
|
||||
(inferior-ess-send-input)
|
||||
(sleep-for ess-S+-startup-delay) ; Need to wait, else working too fast!
|
||||
; If the ess-current-process-name doesn't appear in the
|
||||
; Splus Commands window increase the sleep-for time!
|
||||
(setq ess-local-process-name ess-current-process-name)
|
||||
(ess-eval-linewise (concat "#" ess-current-process-name))
|
||||
(goto-char (point-min))
|
||||
(insert
|
||||
"This is a placeholder buffer. You can't type anything here.
|
||||
Use `C-x b RET' to return to your file.\n
|
||||
Anything sent to this process from an S-mode buffer goes
|
||||
directly to the associated Splus Commands window.\n
|
||||
The S-Plus Commands window must be visible.
|
||||
You may need to open the S-Plus Commands window manually (by clicking on
|
||||
Splus/Window/Commands Window).\n
|
||||
Any results of the !system.command typed at the S prompt in the
|
||||
Splus Commands window appear in this buffer.\n\n")
|
||||
(goto-char (point-max)) ; comint-mode-map makes '(ddeESS [S+])'
|
||||
;; (use-local-map comint-mode-map) ;a shell buffer after Splus is finished.
|
||||
(set-process-coding-system (get-buffer-process (current-buffer))
|
||||
'raw-text-dos 'raw-text-unix)
|
||||
(setq buffer-read-only t) ; force buffer to be read-only
|
||||
(setq mode-name "ddeESS")
|
||||
;; (ess-eval-linewise inferior-S+-editor-pager-command)
|
||||
(if inferior-ess-language-start
|
||||
(ess-eval-linewise inferior-ess-language-start))
|
||||
))
|
||||
|
||||
|
||||
(defalias 'S+6-existing 'S+-existing)
|
||||
(defun S+-existing (&optional proc-name)
|
||||
"Call 'S-PLUS [678].x for Windows', the 'GUI Thing' from StatSci. Do so by
|
||||
finding an existing S-Plus in an independent MS-Window (if there is one) and
|
||||
set up a '(ddeESS [S+])' buffer in emacs. If there is no existing
|
||||
S-Plus, then a new one will be opened in the default directory. The default
|
||||
is usually something like 'c:/Program Files/Insightful/splus70/users/yourname'
|
||||
for S-Plus before 8.0.4. Beginning with 8.0.4, S-Plus uses the default directory
|
||||
'c:/Documents and Settings/yourname/My Documents/S-PLUS Projects/Project1'.
|
||||
Beginning with TIBCO Spotfire S+ Version 8.1.1 for Microsft Windows, the default
|
||||
directory is 'c:/DOCUME~1/yourname/MYDOCU~1/SPOTFI~1/Project1'.
|
||||
If you have a HOME environment variable, it will open it there."
|
||||
(interactive)
|
||||
(let* ((inferior-S+-multipleinstances " & # ") ; Note: there is a final "&".
|
||||
(ess-S+-startup-delay 0)) ;; No delay for existing S-Plus
|
||||
;; Without the "&", there is a core dump.
|
||||
;; With the "&", the results of !system.command in S get lost.
|
||||
;; We are picking up an existing S-Plus process for sending to.
|
||||
;; It doesn't know about us, so nothing comes back.
|
||||
(S+-initiate proc-name))
|
||||
(with-current-buffer (car (buffer-list)) ; get the ESS buffer just created
|
||||
(setq buffer-read-only nil) ; permit writing in ESS buffer
|
||||
(goto-char (point-max))
|
||||
(beginning-of-line)
|
||||
(forward-line -1)
|
||||
(insert
|
||||
"This is S+-existing.
|
||||
Results of the !system.command typed at the S prompt in the
|
||||
Splus Commands window blink a DOS window and you won't see them.\n\n")
|
||||
(setq buffer-read-only t) ; restore ESS buffer to be read-only
|
||||
))
|
||||
|
||||
|
||||
;;; There are extra complications in Sqpe+6 (compared to S+3) because
|
||||
;;; (1) The StatSci supplied Sqpe.exe won't work without SHOME as an
|
||||
;;; environment variable and Sqpe does not take command line
|
||||
;;; arguments and
|
||||
;;; (2) Sqpe.exe comes up with options(interactive=FALSE), which means it
|
||||
;;; doesn't provide prompts by default, and we must change it to T so
|
||||
;;; it will provide prompts.
|
||||
;;;
|
||||
(defalias 'Sqpe+6 'Sqpe+)
|
||||
(defun Sqpe+ (&optional proc-name)
|
||||
"Call 'Sqpe' from 'S-PLUS [678].x for Windows', the 'Real Thing' from StatSci."
|
||||
(interactive)
|
||||
(setq ess-customize-alist Sqpe+-customize-alist)
|
||||
(let* ((shome-nil-p (equal (getenv "SHOME") nil))
|
||||
(use-dialog-box (not (or ess-microsoft-p (eq system-type 'cygwin))))
|
||||
)
|
||||
(if shome-nil-p (setenv "SHOME" inferior-Sqpe+-SHOME-name))
|
||||
(ess-write-to-dribble-buffer
|
||||
(format "\n(Sqpe+6): ess-dialect=%s, buf=%s\n" ess-dialect
|
||||
(current-buffer)))
|
||||
(setq ess-customize-alist ; change inferior-ess-primary-prompt
|
||||
(append ess-customize-alist '((inferior-ess-primary-prompt . "^"))))
|
||||
(inferior-ess)
|
||||
(setq ess-customize-alist Sqpe+-customize-alist) ; restore i-e-p-p in alist
|
||||
(ess-setq-vars-local ess-customize-alist) ; restore i-e-p-p in buffer
|
||||
(setq inferior-ess-prompt ; define with correct i-e-p-p
|
||||
;; Do not anchor to bol with `^' ; (copied from ess-inf.el)
|
||||
(concat "\\("
|
||||
inferior-ess-primary-prompt
|
||||
"\\|"
|
||||
inferior-ess-secondary-prompt
|
||||
"\\)"))
|
||||
(setq comint-prompt-regexp (concat "^" inferior-ess-prompt))
|
||||
; define with correct i-e-p-p
|
||||
(setq comint-input-sender 'inferior-ess-input-sender)
|
||||
(add-hook 'comint-output-filter-functions 'shell-strip-ctrl-m nil t)
|
||||
(goto-char (point-max))
|
||||
(insert "options(interactive=TRUE)")
|
||||
(inferior-ess-send-input)
|
||||
(setq mode-name "iESS(Sqpe)")
|
||||
;; (ess-eval-linewise inferior-S+-editor-pager-command)
|
||||
(if inferior-ess-language-start
|
||||
(ess-eval-linewise inferior-ess-language-start))
|
||||
(if shome-nil-p (setenv "SHOME" nil))))
|
||||
|
||||
;;;###autoload
|
||||
(add-to-list 'auto-mode-alist '("\\.sp\\'" . S-mode))
|
||||
;;;###autoload
|
||||
(add-to-list 'auto-mode-alist '("\\.[qsS]\\'" . S-mode))
|
||||
;;;###autoload
|
||||
(add-to-list 'auto-mode-alist '("\\.ssc\\'" . S-mode))
|
||||
;;;###autoload
|
||||
(add-to-list 'auto-mode-alist '("\\.SSC\\'" . S-mode))
|
||||
|
||||
(defalias 'S+6-mode 'S+-mode)
|
||||
(defun S+-mode (&optional proc-name)
|
||||
"Major mode for editing S+[678] source. See `ess-mode' for more help."
|
||||
(interactive)
|
||||
(setq ess-customize-alist S+-customize-alist)
|
||||
(ess-mode S+-customize-alist proc-name)
|
||||
(if ess-imenu-use-S (ess-imenu-S)))
|
||||
|
||||
(defalias 'S+6-transcript-mode 'S+-transcript-mode)
|
||||
(defun S+-transcript-mode ()
|
||||
"S-PLUS transcript mode."
|
||||
(interactive)
|
||||
(ess-transcript-mode S+-customize-alist))
|
||||
|
||||
(defun S+-msdos (&optional proc-name)
|
||||
"Verify that `inferior-S+-program' points to S-Plus 6 or
|
||||
S-Plus 7 or S-Plus 8. Start normally for S-Plus 6.1 and later.
|
||||
Inform the user to start S-Plus 6.0 from the icon and then
|
||||
connect to it with `S+-msdos-existing'. Give an error message
|
||||
if `inferior-S+-program' doesn't point to S-Plus 6 or
|
||||
S-Plus 7 or S-Plus 8."
|
||||
(interactive)
|
||||
(with-current-buffer (find-file-noselect
|
||||
(concat (executable-find inferior-S+-program)
|
||||
"/../../versions") t)
|
||||
(setq buffer-read-only 1)
|
||||
(forward-line)
|
||||
(if (not (search-backward-regexp "splus\t[678].[0-9]" (point-min) t))
|
||||
(error "The emacs variable `inferior-S+-program' does
|
||||
not point to S-Plus 6 or 7 or 8. Please add `splus[678]?/cmd'
|
||||
(expand the `[678]?' to match your setup) to your `exec-path' or
|
||||
specify the complete path to `Splus.exe' in the variable
|
||||
`inferior-S+-program' in your `.emacs' file.") ;;; " This comment keeps emacs font-lock from getting out of phase.
|
||||
|
||||
(progn
|
||||
(forward-line)
|
||||
(if (search-backward "splus\t6.0" (point-min) t)
|
||||
(error "S-Plus 6.0 for Microsoft Windows has a bug that
|
||||
prevents it from being started by emacs. Instead, you must start it
|
||||
by double-clicking an icon. Then you can connect to it with
|
||||
`S+-msdos-existing'. You should consider upgrading to a newer
|
||||
release of S-Plus.")
|
||||
(S+-msdos-initiate proc-name))) ;; normal start ;
|
||||
)))
|
||||
|
||||
(defalias 'S+6-msdos-initiate 'S+-msdos-initiate)
|
||||
(defun S+-msdos-initiate (&optional proc-name)
|
||||
"Call 'S-PLUS [678].x for Windows', the 'GUI Thing' from StatSci. Put
|
||||
S-Plus in an independent MS-Window (Splus persists even if the
|
||||
'(ddeESS [S+])' window is killed in emacs). Do this by creating a
|
||||
comint process that calls sh. Send a shell command in that sh buffer
|
||||
to call Splus. When it completes set up a shell as a placeholder in
|
||||
the '(ddeESS [S+])' buffer. The S-Plus options are correctly set.
|
||||
In particular, the S-Plus Commands window is opened if the
|
||||
Options/General Settings/Startup menu says it should be. There is a
|
||||
startup delay of `ess-S+-startup-delay' seconds during which the
|
||||
screen will not be refreshed. This delay is here to allow slow disks
|
||||
to start the Splus program."
|
||||
(interactive)
|
||||
(save-excursion
|
||||
(setq ess-customize-alist S+-customize-alist)
|
||||
(ess-write-to-dribble-buffer
|
||||
(format "\n(S+): ess-dialect=%s, buf=%s\n" ess-dialect
|
||||
(current-buffer)))
|
||||
(setq ess-customize-alist ; change inferior-ess-program
|
||||
(append ess-customize-alist '((inferior-ess-program
|
||||
. (getenv "COMSPEC")))))
|
||||
(setq ess-customize-alist ; change inferior-ess-primary-prompt
|
||||
(append ess-customize-alist '((inferior-ess-primary-prompt . "^"))))
|
||||
(setq ess-customize-alist ; change inferior-ess-start-args
|
||||
(append ess-customize-alist '((inferior-ess-start-args . ""))))
|
||||
(let ((s-proj (getenv "S_PROJ"))
|
||||
(use-dialog-box (not (or ess-microsoft-p (eq system-type 'cygwin))))
|
||||
)
|
||||
(cd (when (fboundp 'w32-short-file-name)
|
||||
(w32-short-file-name (directory-file-name default-directory))))
|
||||
(setenv "S_PROJ" (when
|
||||
(fboundp 'w32-short-file-name)
|
||||
(w32-short-file-name default-directory)))
|
||||
(inferior-ess)
|
||||
(sleep-for 2) ; need to wait, else working too fast! The Splus
|
||||
; command in '(ddeESS [S+])' should follow the "$"
|
||||
; prompt. If not, then increase the sleep-for time!
|
||||
(setenv "S_PROJ" s-proj))
|
||||
(setq ess-customize-alist S+-customize-alist)
|
||||
(ess-setq-vars-local ess-customize-alist)
|
||||
;;; the next three lines belong in customize-alist, but can't be there
|
||||
;;; because of the broken ess-setq-vars-default usage in ess-inf.el
|
||||
(setq inferior-ess-ddeclient "ddeclient")
|
||||
(setq inferior-ess-client-name "S-PLUS")
|
||||
(setq inferior-ess-client-command "SCommand")
|
||||
;;; end of what belongs in customize-alist
|
||||
(setq comint-input-sender 'comint-simple-send)
|
||||
(setq comint-process-echoes nil)
|
||||
(set-process-coding-system (get-buffer-process (current-buffer))
|
||||
'raw-text-dos 'raw-text-dos)
|
||||
(goto-char (point-max))
|
||||
(insert (concat inferior-S+-program " "
|
||||
inferior-ess-start-args)) ; Note: there is no final "&".
|
||||
;; Without the "&", the results of !system.command come to '(ddeESS [S+])'
|
||||
;; With the "&", the results of !system.command in S get lost.
|
||||
(inferior-ess-send-input)
|
||||
(sleep-for ess-S+-startup-delay) ; Need to wait, else working too fast!
|
||||
; If the ess-current-process-name doesn't appear in the
|
||||
; Splus Commands window increase the sleep-for time!
|
||||
;;; from msdos-minor-mode
|
||||
(setq comint-process-echoes t)
|
||||
(add-hook 'comint-output-filter-functions 'shell-strip-ctrl-m nil t)
|
||||
;;; end from msdos-minor-mode
|
||||
(setq ess-local-process-name ess-current-process-name)
|
||||
(ess-eval-linewise (concat "#" ess-current-process-name))
|
||||
(goto-char (point-min))
|
||||
(insert
|
||||
"This is a placeholder buffer. You can't type anything here.
|
||||
Use `C-x b RET' to return to your file.\n
|
||||
Anything sent to this process from an S-mode buffer goes
|
||||
directly to the associated Splus Commands window.\n
|
||||
The S-Plus Commands window must be visible.
|
||||
You may need to open the S-Plus Commands window manually
|
||||
(by clicking on Splus/Window/Commands Window).\n
|
||||
There is a `ess-S+-startup-delay' second delay when this program starts
|
||||
during which the emacs screen will be partially blank.\n
|
||||
Remember to 'q()' from S-Plus and
|
||||
then C-x C-q exit from the '(ddeESS [S+])' buffer,
|
||||
or take the risk of not being able to shut down your computer
|
||||
and suffering through scandisk.\n
|
||||
Any results of the !system.command typed at the S prompt in the
|
||||
Splus Commands window (are supposed to) appear in this buffer.\n\n")
|
||||
(goto-char (point-max)) ; comint-mode-map makes '(ddeESS [S+])'
|
||||
(use-local-map comint-mode-map) ; a shell buffer after Splus is finished.
|
||||
(setq buffer-read-only t) ; force buffer to be read-only
|
||||
(setq mode-name "ddeESS")
|
||||
;; (ess-eval-linewise inferior-S+-editor-pager-command)
|
||||
(if inferior-ess-language-start
|
||||
(ess-eval-linewise inferior-ess-language-start))
|
||||
))
|
||||
|
||||
(defalias 'S+6-msdos-existing 'S+-msdos-existing)
|
||||
(defun S+-msdos-existing (&optional proc-name)
|
||||
"Call 'S-PLUS [678].x for Windows', the 'GUI Thing' from StatSci. Do so by
|
||||
finding an existing S-Plus in an independent MS-Window (if there is one) and
|
||||
set up a '(ddeESS [S+])' buffer in emacs. If there is no existing
|
||||
S-Plus, then a new one will be opened in the default directory. The default
|
||||
is usually something like 'c:/Program Files/Insightful/splus70/users/yourname'
|
||||
for S-Plus before 8.0.4. Beginning with 8.0.4, S-Plus uses the default directory
|
||||
'c:/Documents and Settings/yourname/My Documents/S-PLUS Projects/Project1'.
|
||||
Beginning with TIBCO Spotfire S+ Version 8.1.1 for Microsft Windows, the default
|
||||
directory is 'c:/DOCUME~1/yourname/MYDOCU~1/SPOTFI~1/Project1'.
|
||||
If you have a HOME environment variable, it will open it there."
|
||||
(interactive)
|
||||
(let* ((inferior-S+-multipleinstances "")
|
||||
(ess-S+-startup-delay 0)) ;; No delay for existing S-Plus
|
||||
(S+-msdos-initiate proc-name))
|
||||
(with-current-buffer (car (buffer-list)) ; get the ESS buffer just created
|
||||
(setq buffer-read-only nil) ; permit writing in ESS buffer
|
||||
(goto-char (point-max))
|
||||
(beginning-of-line)
|
||||
(forward-line -1)
|
||||
(insert
|
||||
"This is S+-msdos-existing.
|
||||
Results of the !system.command typed at the S prompt in the
|
||||
Splus Commands window blink a DOS window and you won't see them.\n\n")
|
||||
(setq buffer-read-only t) ; restore ESS buffer to be read-only
|
||||
))
|
||||
|
||||
(defun ess-sqpe-versions-create (ess-SHOME-versions &optional x64)
|
||||
"Generate the `M-x splusxy' functions for starting other versions of
|
||||
Sqpe. `ESS-SHOME-VERSIONS' is normally taken from
|
||||
`ess-sqpe-versions', a variable that contains strings that determine which
|
||||
functions are created. This works by creating a temp buffer where the
|
||||
template function `Sqpe+template' is edited by replacing the string
|
||||
'Sqpe+template' by the version name. The list of functions actually
|
||||
created appears in the *ESS* buffer. If `X64' is not nil, then
|
||||
modify the function name to show \"-64bit\" in its name.
|
||||
|
||||
The result `ess-sqpe-versions-created' will store a list of the new
|
||||
Sqpe defuns, if any, that were created. The defuns will normally be
|
||||
placed on the menubar upon ESS initialisation."
|
||||
(let ((beg)
|
||||
(versions)
|
||||
(version)
|
||||
(eval-buf (get-buffer-create "*ess-temp-sqpe-evals*"))
|
||||
(ess-sqpe-versions-created)
|
||||
)
|
||||
;;
|
||||
(with-current-buffer eval-buf
|
||||
;; clear the buffer.
|
||||
(delete-region (point-min) (point-max))
|
||||
|
||||
;; Find which versions of Sqpe we want.
|
||||
(setq x64 (if x64 "-64bit"))
|
||||
(setq versions (ess-uniq-list ess-SHOME-versions))
|
||||
;; Iterate over each string in VERSIONS, creating a new defun each time.
|
||||
(while versions
|
||||
(setq version (car versions)
|
||||
versions (cdr versions))
|
||||
(if (file-executable-p version)
|
||||
(progn
|
||||
(setq beg (point))
|
||||
(setq version-function-name (concat (file-name-nondirectory version) x64))
|
||||
(prin1 (symbol-function 'Sqpe+template) eval-buf)
|
||||
(insert "\n\n")
|
||||
(goto-char beg)
|
||||
(while (search-forward "lambda" nil t 1)
|
||||
(replace-match
|
||||
(concat "defun " version-function-name)
|
||||
t t))
|
||||
(while (search-forward "ess-SHOME" nil t)
|
||||
(replace-match version t t))
|
||||
(goto-char (point-max))
|
||||
(setq ess-sqpe-versions-created
|
||||
(cons version-function-name
|
||||
ess-sqpe-versions-created))
|
||||
(ess-write-to-dribble-buffer
|
||||
(format
|
||||
"(Sqpe): ess-sqpe-versions-create making M-x defun %s for %s \n"
|
||||
version-function-name version))
|
||||
)))
|
||||
;; buffer has now been created with defuns, so eval them!
|
||||
(eval-buffer)
|
||||
(kill-buffer eval-buf))
|
||||
ess-sqpe-versions-created))
|
||||
|
||||
;; template function used by ess-sqpe-versions-create
|
||||
(defun Sqpe+template (&optional proc-name)
|
||||
"Call 'Sqpe' from 'S-PLUS for Windows ess-SHOME',
|
||||
the 'Real Thing' from StatSci.
|
||||
This function was generated by `ess-sqpe-versions-create'."
|
||||
(interactive)
|
||||
(setq ess-customize-alist Sqpe+-customize-alist)
|
||||
(let* ((use-dialog-box) ;; MS dialog box won't return a directory
|
||||
(shome-old (getenv "SHOME"))
|
||||
(inferior-Sqpe+-SHOME-name "ess-SHOME")
|
||||
(inferior-Sqpe+-program (concat "ess-SHOME" "/cmd/sqpe.exe")))
|
||||
(setenv "SHOME" "ess-SHOME")
|
||||
(ess-write-to-dribble-buffer
|
||||
(format "\n(Sqpe+template): ess-dialect=%s, buf=%s\n" ess-dialect
|
||||
(current-buffer)))
|
||||
(setq ess-customize-alist ; change inferior-ess-primary-prompt
|
||||
(append ess-customize-alist
|
||||
'((inferior-ess-primary-prompt . "^"))))
|
||||
(inferior-ess)
|
||||
(setq ess-customize-alist Sqpe+-customize-alist) ; restore i-e-p-p in alist
|
||||
(ess-setq-vars-local ess-customize-alist) ; restore i-e-p-p in buffer
|
||||
(setq inferior-ess-prompt ; define with correct i-e-p-p
|
||||
;; Do not anchor to bol with `^' ; (copied from ess-inf.el)
|
||||
(concat "\\("
|
||||
inferior-ess-primary-prompt
|
||||
"\\|"
|
||||
inferior-ess-secondary-prompt
|
||||
"\\)"))
|
||||
(setq comint-prompt-regexp (concat "^" inferior-ess-prompt))
|
||||
; define with correct i-e-p-p
|
||||
(setq comint-input-sender 'inferior-ess-input-sender)
|
||||
(add-hook 'comint-output-filter-functions 'shell-strip-ctrl-m nil t)
|
||||
(goto-char (point-max))
|
||||
(insert "options(interactive=TRUE)")
|
||||
(inferior-ess-send-input)
|
||||
(setq mode-name "iESS(Sqpe)")
|
||||
;; (ess-eval-linewise inferior-S+-editor-pager-command)
|
||||
(if inferior-ess-language-start
|
||||
(ess-eval-linewise inferior-ess-language-start))
|
||||
(setenv "SHOME" shome-old)))
|
||||
|
||||
|
||||
; Provide package
|
||||
|
||||
(provide 'ess-sp6w-d)
|
||||
|
||||
;;; ess-sp6w-d.el ends here
|
||||
1280
elpa/ess-20180701.100/ess-stata-lang.el
Normal file
1280
elpa/ess-20180701.100/ess-stata-lang.el
Normal file
File diff suppressed because it is too large
Load Diff
175
elpa/ess-20180701.100/ess-stata-mode.el
Normal file
175
elpa/ess-20180701.100/ess-stata-mode.el
Normal file
@@ -0,0 +1,175 @@
|
||||
;;; ess-stata-mode.el --- Stata customization
|
||||
|
||||
;; Copyright (C) 1997--1999 A. J. Rossini, Thomas Lumley
|
||||
;; Copyright (C) 1997--2004 A.J. Rossini, Richard M. Heiberger, Martin
|
||||
;; Maechler, Kurt Hornik, Rodney Sparapani, and Stephen Eglen.
|
||||
|
||||
;; Author: A.J. Rossini <rossini@biostat.washington.edu>
|
||||
;; Created: 9 Sep 1998
|
||||
;; Maintainer: ESS-core <ESS-core@r-project.org>
|
||||
|
||||
;; Keywords: languages
|
||||
|
||||
;; 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/
|
||||
|
||||
;;; Commentary:
|
||||
|
||||
;; This file defines all the Stata customizations for ess-mode. It is somewhat
|
||||
;; based on Stata-mode by Thomas Lumley <thomas@biostat.washington.edu>.
|
||||
|
||||
;;; Code:
|
||||
|
||||
(require 'ess-mode)
|
||||
(require 'ess-stata-lang)
|
||||
|
||||
(defvar STA-dialect-name "stata"
|
||||
"Name of 'dialect' for Stata.");easily changeable in a user's .emacs
|
||||
|
||||
(defvar STA-customize-alist
|
||||
'((ess-local-customize-alist . 'STA-customize-alist)
|
||||
(ess-language . "STA")
|
||||
(ess-dialect . STA-dialect-name)
|
||||
(ess-suffix . "ado")
|
||||
(ess-mode-editing-alist . STA-editing-alist)
|
||||
(ess-mode-syntax-table . STA-syntax-table)
|
||||
(ess-mode-edit . 'STA-mode)
|
||||
(ess-help-sec-regex . ess-help-STA-sec-regex)
|
||||
(ess-help-sec-keys-alist . ess-help-STA-sec-keys-alist)
|
||||
(ess-loop-timeout . 500000 )
|
||||
(ess-object-name-db-file . "ess-sta-namedb.el" )
|
||||
(ess-help-web-search-command . "http://www.stata.com/search/?q=%s&restrict=&btnG=Search&client=stata&num=&output=xml_no_dtd&site=stata&ie=&oe=UTF-8&sort=&proxystylesheet=stata")
|
||||
(ess-eval-linewise-function . #'stata-eval-linewise)
|
||||
(inferior-ess-font-lock-defaults . ess-STA-mode-font-lock-defaults)
|
||||
(inferior-ess-program . inferior-STA-program)
|
||||
(inferior-ess-objects-command . "describe\n")
|
||||
(inferior-ess-help-command . "help %s\n") ;; assumes set more off
|
||||
(inferior-ess-exit-command . "exit\n")
|
||||
;; --more-- is necessary here (hangs otherwise if startup stata.msg is big)
|
||||
(inferior-ess-primary-prompt . "[.:] \\|--more--")
|
||||
(inferior-ess-secondary-prompt . "--more--")
|
||||
(comint-use-prompt-regexp . t)
|
||||
(inferior-ess-start-file . inferior-STA-start-file) ;"~/.ess-stata")
|
||||
(inferior-ess-start-args . inferior-STA-start-args)
|
||||
(ess-get-help-topics-function . 'ess-get-STA-help-topics)
|
||||
(inferior-ess-search-list-command . "set more off\n search()\n")
|
||||
(comment-start . "/\* ")
|
||||
(comment-end . " \*/")
|
||||
(comment-start-skip . "/\\*+ *")
|
||||
(comment-use-syntax . t) ;; needed for multiline
|
||||
(ess-execute-screen-options-command . "set linesize %s\n")
|
||||
(ess-getwd-command . "pwd\n")
|
||||
(ess-setwd-command . "cd \"%s\"\n")
|
||||
(ess-load-command . "run \"%s\"\n"))
|
||||
"Variables to customize for Stata.")
|
||||
|
||||
|
||||
;;;###autoload
|
||||
(defun STA-mode (&optional proc-name)
|
||||
"Major mode for editing Stata source. See `ess-mode' for more help."
|
||||
(interactive)
|
||||
(setq ess-customize-alist STA-customize-alist)
|
||||
(ess-mode STA-customize-alist proc-name))
|
||||
|
||||
(fset 'stata-mode 'STA-mode)
|
||||
(fset 'Stata-mode 'STA-mode)
|
||||
|
||||
;;;###autoload
|
||||
(add-to-list 'auto-mode-alist '("\\.do\\'" . STA-mode))
|
||||
;;;###autoload
|
||||
(add-to-list 'auto-mode-alist '("\\.ado\\'" . STA-mode))
|
||||
|
||||
|
||||
(defun ess-sta-remove-comments (string)
|
||||
"Remove one-line comments before sending the STRING to process.
|
||||
|
||||
This function is placed in `ess-presend-filter-functions'.
|
||||
"
|
||||
(replace-regexp-in-string "/\\*.*\\*/\\|^//.*$" "" string))
|
||||
|
||||
;; (ess-sta-remove-comments "aaa /* sdfdsf */ bbb
|
||||
;; sdfsd
|
||||
;; ccc
|
||||
;; // sdfsf
|
||||
;; sdf /* sdfdsf */
|
||||
;; sdfsf
|
||||
;; " )
|
||||
|
||||
|
||||
(defvar ess-stata-post-run-hook nil
|
||||
"Functions run in process buffer after the initialization of
|
||||
stata process.")
|
||||
|
||||
(defun stata (&optional start-args)
|
||||
"Call Stata."
|
||||
(interactive "P")
|
||||
(setq ess-customize-alist STA-customize-alist)
|
||||
(ess-write-to-dribble-buffer
|
||||
(format "(STA): ess-dialect=%s , buf=%s \n"
|
||||
ess-dialect
|
||||
(current-buffer)))
|
||||
(let ((sta-start-args
|
||||
(concat inferior-STA-start-args
|
||||
(when start-args (read-string "Starting Args [possibly -k####] ? ")))))
|
||||
(inferior-ess sta-start-args)
|
||||
(let ((proc (get-process ess-local-process-name)))
|
||||
(while (process-get proc 'sec-prompt)
|
||||
;; get read of all --more-- if stata.msg is too long.
|
||||
(ess-send-string proc "q")
|
||||
(ess-wait-for-process proc t))
|
||||
(ess-send-string proc "set more off")
|
||||
(goto-char (point-max))
|
||||
(with-current-buffer (process-buffer proc)
|
||||
(add-hook 'ess-presend-filter-functions 'ess-sta-remove-comments nil 'local)
|
||||
(run-mode-hooks 'ess-stata-post-run-hook)))))
|
||||
|
||||
|
||||
(defun STA-transcript-mode ()
|
||||
"Stata transcript mode."
|
||||
(interactive)
|
||||
(ess-transcript-mode STA-customize-alist))
|
||||
|
||||
(defun ess--STA-retrive-topics-from-search ()
|
||||
(with-current-buffer (ess-command inferior-ess-search-list-command)
|
||||
(goto-char (point-min))
|
||||
(let (topics)
|
||||
(while (re-search-forward "(help \\(.+?\\)\\( if installed\\| for replacement.*\\)?)$" nil t)
|
||||
(setq topics
|
||||
(nconc (split-string (match-string-no-properties 1) ",\\|; +")
|
||||
topics)))
|
||||
(nreverse (delete-dups topics))
|
||||
)))
|
||||
|
||||
(defun ess-get-STA-help-topics (&optional name)
|
||||
"Return a list of current STA help topics associated with process NAME."
|
||||
(or (ess-process-get 'help-topics)
|
||||
(progn
|
||||
(ess-process-put 'help-topics (ess--STA-retrive-topics-from-search))
|
||||
(ess-process-get 'help-topics))))
|
||||
|
||||
(defun stata-eval-linewise (text &optional invisibly &rest args)
|
||||
;; The following is required to make sure things work!
|
||||
(let ((ess-eval-linewise-function nil)
|
||||
;; RAS: mindless replacement of semi-colons
|
||||
(text (if ess-sta-delimiter-friendly
|
||||
(ess-replace-in-string text ";" "\n")
|
||||
text)))
|
||||
(apply #'ess-eval-linewise text t args)))
|
||||
|
||||
; Provide package
|
||||
|
||||
(provide 'ess-stata-mode)
|
||||
|
||||
;;; ess-stata-mode.el ends here
|
||||
424
elpa/ess-20180701.100/ess-swv.el
Normal file
424
elpa/ess-20180701.100/ess-swv.el
Normal file
@@ -0,0 +1,424 @@
|
||||
;;; ess-swv.el --- Some simple functions for ESS and Sweave
|
||||
|
||||
;; Copyright (C) 2005 David Whiting, A.J. Rossini, Richard M. Heiberger, Martin
|
||||
;; Maechler, Kurt Hornik, Rodney Sparapani, and Stephen Eglen.
|
||||
;; Copyright (C) 2006-2008 A.J. Rossini, Richard M. Heiberger, Martin Maechler,
|
||||
;; Kurt Hornik, Rodney Sparapani, and Stephen Eglen.
|
||||
|
||||
;; Author: David Whiting <david.whiting@ncl.ac.uk>
|
||||
;; Created: 15 April 2005
|
||||
;; Maintainer: ESS-core <ESS-core@r-project.org>
|
||||
|
||||
;; Keywords: statistics, tools
|
||||
|
||||
;; 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/
|
||||
|
||||
;;; Commentary:
|
||||
|
||||
;;
|
||||
;; Some simple functions for ESS and Sweave
|
||||
;; david.whiting at ncl.ac.uk
|
||||
;; Wed Sep 1 14:55:52 CEST 2004
|
||||
|
||||
;; I have written some very simple elisp functions that I have found
|
||||
;; useful and thought others might like to see. I dabble with elisp
|
||||
;; occasionally at best so there are probably better ways to do what I
|
||||
;; have done, but so far this seems to work for me. There are several
|
||||
;; things that are hard-coded, I use Linux and I think that this would
|
||||
;; probably not work in Windows (not as it is now anyway).
|
||||
|
||||
;; With these functions and key bindings all I need to do is open a .Rnw
|
||||
;; file and, assuming R is running, I press:
|
||||
|
||||
;; M-n s to Sweave the file, then
|
||||
;; M-n l to run latex on the results of Sweave, then
|
||||
;; M-n p to make and display a postscript file , or
|
||||
;; M-n P to make and display a PDF version.
|
||||
|
||||
;; David Whiting to Anthony Rossini, Mar 30
|
||||
;; On Wed, Mar 30, 2005 at 11:51:26AM +0200, A.J. Rossini wrote:
|
||||
;; > I'm going to go ahead and add this stuff to the distribution tonight
|
||||
;; > if you don't mind. I'd forgotten about it!
|
||||
;; It would make me very happy indeed.
|
||||
;; > (however, need permission to do so).
|
||||
;; Permission granted!
|
||||
|
||||
;; Dave
|
||||
;; --
|
||||
;; David Whiting
|
||||
;; School of Clinical Medical Sciences, The Medical School
|
||||
;; University of Newcastle upon Tyne, NE2 4HH, UK.
|
||||
|
||||
|
||||
;;; TODO:
|
||||
;;;
|
||||
;;; 1. I want to be able to send ess-swv-latex a parameter to tell it
|
||||
;;; the number of times to run LaTeX (to get references updated
|
||||
;;; correctly).
|
||||
;;;
|
||||
;;; 2. Also need to add ess-swv-Bibtex.
|
||||
;;;
|
||||
;;; 3. Might be good to have a way to chain commands.
|
||||
;;;
|
||||
;;; 4. ADD to the ../doc/ess.texi !!
|
||||
|
||||
|
||||
;;; Code:
|
||||
|
||||
;;; Autoloads and Requires
|
||||
|
||||
(eval-when-compile
|
||||
(require 'ess-custom)
|
||||
(require 'ess))
|
||||
|
||||
(require 'ess-utils)
|
||||
(require 'ess-noweb-mode)
|
||||
(require 'ess-r-mode); for Rnw-mode
|
||||
(require 'easymenu)
|
||||
|
||||
(defvar TeX-command-list)
|
||||
(defvar TeX-command-default)
|
||||
(defvar TeX-file-extensions)
|
||||
(declare-function TeX-normal-mode "tex")
|
||||
|
||||
;; currently use exactly for "Sweave", "Stangle", "knit", and "purl"
|
||||
(defun ess-swv-run-in-R (cmd &optional choose-process block)
|
||||
"Run \\[cmd] on the current .Rnw file. Utility function not called by user."
|
||||
(let* ((rnw-buf (current-buffer)))
|
||||
(if choose-process ;; previous behavior
|
||||
(ess-force-buffer-current "R process to load into: ")
|
||||
;; else
|
||||
(update-ess-process-name-list)
|
||||
(cond ((= 0 (length ess-process-name-list))
|
||||
(message "no ESS processes running; starting R")
|
||||
(sit-for 1); so the user notices before the next msgs/prompt
|
||||
(run-ess-r)
|
||||
(set-buffer rnw-buf)
|
||||
)
|
||||
((not (string= "R" (ess-make-buffer-current))); e.g. Splus, need R
|
||||
(ess-force-buffer-current "R process to load into: "))
|
||||
))
|
||||
|
||||
(save-excursion
|
||||
;; (ess-execute (format "require(tools)")) ;; Make sure tools is loaded.
|
||||
(basic-save-buffer); do not Sweave/Stangle old version of file !
|
||||
(let* ((sprocess (ess-get-process ess-current-process-name))
|
||||
(sbuffer (process-buffer sprocess))
|
||||
(rnw-file (buffer-file-name))
|
||||
(Rnw-dir (file-name-directory rnw-file))
|
||||
(buf-coding (symbol-name buffer-file-coding-system))
|
||||
;; could consider other encodings, but utf-8 is "R standard" for non-ASCII:
|
||||
(cmd-args (concat "\"" rnw-file "\""
|
||||
(if (string-match "^utf-8" buf-coding)
|
||||
", encoding = \"utf-8\"")))
|
||||
(Sw-cmd
|
||||
(format ess-swv-processing-command cmd cmd-args)))
|
||||
(message "%s()ing %S" cmd rnw-file)
|
||||
;; need to block when we are running ess-swv-weave-PDF so we
|
||||
;; know when to start compiling the generated .tex file
|
||||
(if block
|
||||
(progn
|
||||
(ess-eval-linewise (concat Sw-cmd "\n") nil nil nil t)
|
||||
(message "Finished %s()ing %S" cmd rnw-file))
|
||||
(ess-execute Sw-cmd 'buffer nil nil)
|
||||
(switch-to-buffer rnw-buf)
|
||||
(ess-show-buffer (buffer-name sbuffer) nil))))))
|
||||
|
||||
(defcustom ess-swv-processing-command ".ess_weave(%s, %s)"
|
||||
"Command used by `ess-swv-run-in-R'.
|
||||
|
||||
First %s is literally replaced by the processing command (for
|
||||
example: Sweave) second %s is replaced with a string containing a
|
||||
processed file and possibly additional argument encoding (example:
|
||||
\"path/to/foo.Rnw\", encoding='utf-8')
|
||||
|
||||
.ess_weave changes the working directory to that of the supplied
|
||||
file.
|
||||
|
||||
If you want to simply call knitr or Sweave in global environment
|
||||
set this command to \"%s(%s)\"."
|
||||
:group 'ess-R
|
||||
:type 'string)
|
||||
|
||||
(defcustom ess-swv-processor 'sweave
|
||||
"Processor to use for weaving and tangling.
|
||||
Currently 'sweave or 'knitr"
|
||||
:group 'ess-R
|
||||
:type '(choice (const sweave) (const knitr)))
|
||||
|
||||
|
||||
(defun ess-swv-tangle ()
|
||||
"Run Stangle/purl on the current .Rnw file.
|
||||
Depending on the `ess-swv-processor' used."
|
||||
(interactive)
|
||||
(ess-swv-run-in-R (cond ((eq ess-swv-processor 'sweave) "Stangle")
|
||||
((eq ess-swv-processor 'knitr) "purl")
|
||||
(t (error "Not a valid processor %s" ess-swv-processor)))))
|
||||
|
||||
(defun ess-swv-weave (&optional choose)
|
||||
"Run Sweave/knit on the current .Rnw file.
|
||||
Depending on the `ess-swv-processor' used.
|
||||
|
||||
If CHOOSE is non-nil, offer a menu of available weavers.
|
||||
"
|
||||
(interactive "P")
|
||||
(let ((processor (if choose
|
||||
(ess-completing-read "Weaver" '("sweave" "knitr") nil t)
|
||||
(symbol-name ess-swv-processor))))
|
||||
(ess-swv-run-in-R (cond ((string= processor "sweave") "Sweave")
|
||||
((string= processor "knitr") "knit")
|
||||
(t (error "Not a valid processor %s" processor))))))
|
||||
|
||||
(defun ess-swv-sweave ()
|
||||
"Run Sweave on the current .Rnw file."
|
||||
(interactive)
|
||||
(ess-swv-run-in-R "Sweave"))
|
||||
|
||||
(defun ess-swv-stangle ()
|
||||
"Run Stangle on the current .Rnw file."
|
||||
(interactive)
|
||||
(ess-swv-run-in-R "Stangle"))
|
||||
|
||||
(defun ess-swv-knit ()
|
||||
"Run knit on the current .Rnw file."
|
||||
(interactive)
|
||||
(ess-swv-run-in-R "knit"))
|
||||
|
||||
(defun ess-swv-purl ()
|
||||
"Run purl on the current .Rnw file."
|
||||
(interactive)
|
||||
(ess-swv-run-in-R "purl"))
|
||||
|
||||
(defun ess-swv-weave-PDF (&optional choose)
|
||||
"Sweave/knit, compile TeX, and display PDF.
|
||||
Run Sweave or knit depending on `ess-swv-processor' used.
|
||||
|
||||
If CHOOSE is non-nil, offer a menu of available weavers.
|
||||
"
|
||||
(interactive "P")
|
||||
(let ((processor (if choose
|
||||
(ess-completing-read "Weaver" '("sweave" "knitr") nil t)
|
||||
(symbol-name ess-swv-processor))))
|
||||
(ess-swv-run-in-R (cond ((string= processor "sweave") "Sweave")
|
||||
((string= processor "knitr") "knit")
|
||||
(t (error "Not a valid processor %s" processor)))
|
||||
nil t)
|
||||
(ess-swv-PDF nil t)))
|
||||
|
||||
|
||||
(defun ess-swv-latex ()
|
||||
"Run LaTeX on the product of Sweave()ing the current file."
|
||||
(interactive)
|
||||
(save-excursion
|
||||
(let* ((namestem (file-name-sans-extension (buffer-file-name)))
|
||||
(latex-filename (concat namestem ".tex"))
|
||||
(tex-buf (get-buffer-create " *ESS-tex-output*")))
|
||||
(message "Running LaTeX on '%s' ..." latex-filename)
|
||||
(switch-to-buffer tex-buf)
|
||||
(call-process "latex" nil tex-buf 1 latex-filename)
|
||||
(switch-to-buffer (buffer-name))
|
||||
(display-buffer tex-buf)
|
||||
(message "Finished running LaTeX" ))))
|
||||
|
||||
|
||||
(defun ess-swv-PS ()
|
||||
"Create a postscript file from a dvi file (name based on the current
|
||||
Sweave file buffer name) and display it."
|
||||
(interactive)
|
||||
(let* ((buf (buffer-name))
|
||||
(namestem (file-name-sans-extension (buffer-file-name)))
|
||||
(dvi-filename (concat namestem ".dvi"))
|
||||
(psviewer (ess-get-ps-viewer)))
|
||||
(shell-command (concat "dvips -o temp.ps " dvi-filename))
|
||||
(shell-command (concat psviewer " temp.ps & "))
|
||||
(switch-to-buffer buf)
|
||||
))
|
||||
|
||||
(defun ess-swv-PDF (&optional pdflatex-cmd hide-compile-buffer)
|
||||
"From LaTeX file, create a PDF (via 'texi2pdf' or 'pdflatex', ...), by
|
||||
default using the first entry of `ess-swv-pdflatex-commands' and display it."
|
||||
(interactive)
|
||||
(setq pdflatex-cmd
|
||||
(or pdflatex-cmd
|
||||
(and (eq (length ess-swv-pdflatex-commands) 1)
|
||||
(car ess-swv-pdflatex-commands))
|
||||
(ess-completing-read "pdf latex command"
|
||||
ess-swv-pdflatex-commands ; <- collection to choose from
|
||||
nil 'confirm ; or 'confirm-after-completion
|
||||
nil nil (car ess-swv-pdflatex-commands))))
|
||||
(let* ((buf (buffer-name))
|
||||
(namestem (file-name-sans-extension (buffer-file-name)))
|
||||
(latex-filename (concat namestem ".tex"))
|
||||
(tex-buf (get-buffer-create "*ESS-tex-output*"))
|
||||
(pdfviewer (ess-get-pdf-viewer))
|
||||
(pdf-status)
|
||||
(cmdstr-win (format "start \"%s\" \"%s.pdf\"" pdfviewer namestem))
|
||||
(pdffile (format "%s.pdf" namestem))
|
||||
(cmd (if (stringp pdfviewer)
|
||||
(list pdfviewer pdffile)
|
||||
(append pdfviewer (list pdffile)))))
|
||||
|
||||
;;(shell-command (concat "pdflatex " latex-filename))
|
||||
(message "Running '%s' on '%s' ..." pdflatex-cmd latex-filename)
|
||||
(with-current-buffer tex-buf (erase-buffer))
|
||||
(setq pdf-status
|
||||
(call-process pdflatex-cmd nil tex-buf t
|
||||
(if (string= "texi2" (substring pdflatex-cmd 0 5))
|
||||
;; workaround (bug?): texi2pdf or texi2dvi *fail* to work with full path:
|
||||
(file-name-nondirectory latex-filename)
|
||||
latex-filename)))
|
||||
(if (not (= 0 pdf-status))
|
||||
(progn (message "** OOPS: error in '%s' (%d)!" pdflatex-cmd pdf-status)
|
||||
(display-buffer tex-buf))
|
||||
;; else: pdflatex probably ok
|
||||
;; (set-process-sentinel proc 'shell-command-sentinel)
|
||||
(if (and (and ess-microsoft-p
|
||||
;; Silence byte compiler warns about w32-fns
|
||||
(fboundp 'w32-shell-dos-semantics))
|
||||
(w32-shell-dos-semantics))
|
||||
(shell-command cmdstr-win)
|
||||
(message (mapconcat 'identity cmd " "))
|
||||
(apply 'start-process (car cmd) nil cmd))
|
||||
(unless hide-compile-buffer (display-buffer tex-buf))
|
||||
(message "%s finished with status %d" pdflatex-cmd pdf-status))))
|
||||
|
||||
|
||||
(defun ess-insert-Sexpr ()
|
||||
"Insert Sexpr{} into the buffer at point."
|
||||
(interactive)
|
||||
(insert "\\Sexpr{}")
|
||||
(backward-char))
|
||||
|
||||
|
||||
;;; back-compatible wrappers:
|
||||
(defun ess-makeSweave () "old *DEPRECATED* version of \\[ess-swv-weave]."
|
||||
(interactive) (ding)
|
||||
(message
|
||||
"** warning: ess-makeSweave is deprecated. Do use (ess-swv-weave) instead!")
|
||||
(ess-swv-weave))
|
||||
|
||||
(defun ess-makeLatex () "old *DEPRECATED* version of \\[ess-swv-latex]."
|
||||
(interactive) (ding)
|
||||
(message
|
||||
"** warning: ess-makeLatex is deprecated. Do use (ess-swv-latex) instead!")
|
||||
(ess-swv-latex))
|
||||
|
||||
(defun ess-makePS () "old *DEPRECATED* version of \\[ess-swv-PS]."
|
||||
(interactive) (ding)
|
||||
(message
|
||||
"** warning: ess-makePS is deprecated. Do use (ess-swv-PS) instead!")
|
||||
(ess-swv-PS))
|
||||
|
||||
(defun ess-makePDF () "old *DEPRECATED* version of \\[ess-swv-PDF]."
|
||||
(interactive) (ding)
|
||||
(message
|
||||
"** warning: ess-makePDF is deprecated. Do use (ess-swv-PDF) instead!")
|
||||
(ess-swv-PDF))
|
||||
|
||||
|
||||
;; AUCTeX integration. This is independent of this library, but it fits
|
||||
;; here nonetheless since it's an alternative way of Sweave'ing without
|
||||
;; starting iESS.
|
||||
|
||||
(defun ess-swv-add-TeX-commands ()
|
||||
"Add commands to AUCTeX's \\[TeX-command-list]."
|
||||
(unless (and (featurep 'tex-site) (featurep 'tex))
|
||||
(error "AUCTeX does not seem to be loaded"))
|
||||
(add-to-list 'TeX-command-list
|
||||
'("Sweave" "R CMD Sweave %t"
|
||||
TeX-run-command nil (latex-mode) :help
|
||||
"Run Sweave") t)
|
||||
(add-to-list 'TeX-command-list
|
||||
'("LaTeXSweave" "%l %(mode) %s"
|
||||
TeX-run-TeX nil (latex-mode) :help
|
||||
"Run LaTeX after Sweave") t)
|
||||
(setq TeX-command-default "Sweave")
|
||||
(mapc (lambda (suffix)
|
||||
(add-to-list 'TeX-file-extensions suffix))
|
||||
'("nw" "Snw" "Rnw")))
|
||||
|
||||
(defun ess-swv-remove-TeX-commands (x)
|
||||
"Helper function: check if car of X is one of the Sweave strings"
|
||||
(let ((swv-cmds '("Sweave" "LaTeXSweave")))
|
||||
(unless (member (car x) swv-cmds) x)))
|
||||
|
||||
(defun ess-swv-plug-into-AUCTeX ()
|
||||
"Add commands to AUCTeX's \\[TeX-command-list] to sweave the current noweb
|
||||
file and latex the result."
|
||||
(if ess-swv-plug-into-AUCTeX-p
|
||||
(add-hook 'Rnw-mode-hook 'ess-swv-add-TeX-commands)
|
||||
(remove-hook 'Rnw-mode-hook 'ess-swv-add-TeX-commands)
|
||||
(setq TeX-command-list (mapcar 'ess-swv-remove-TeX-commands TeX-command-list)
|
||||
;; this will remove the items, leaving nils, so remove them.
|
||||
TeX-command-list (delq nil TeX-command-list))))
|
||||
;; as ess-swv-plug-into-AUCTeX-p is customizable ... :
|
||||
(if ess-swv-plug-into-AUCTeX-p
|
||||
(eval-after-load "tex" '(ess-swv-plug-into-AUCTeX)))
|
||||
|
||||
(defun ess-swv-toggle-plug-into-AUCTeX ()
|
||||
"Toggle inclusion of commands to sweave noweb files and latex the results in
|
||||
\\[TeX-command-list] on and off. Commands are added via \\[Rnw-mode-hook]."
|
||||
(interactive)
|
||||
(unless (and (featurep 'tex-site) (featurep 'tex))
|
||||
(error "AUCTeX are not available"))
|
||||
(setq ess-swv-plug-into-AUCTeX-p (not ess-swv-plug-into-AUCTeX-p))
|
||||
(ess-swv-plug-into-AUCTeX)
|
||||
(TeX-normal-mode t)
|
||||
(if ess-swv-plug-into-AUCTeX-p
|
||||
(message "Sweave and LaTeXSweave are activated in AUCTeX.")
|
||||
(message "Sweave and LaTeXSweave are de-activated in AUCTeX.")))
|
||||
|
||||
|
||||
;;; Now bind some keys.
|
||||
(define-key ess-noweb-minor-mode-map "\M-ns" 'ess-swv-weave)
|
||||
(define-key ess-noweb-minor-mode-map "\M-nT" 'ess-swv-tangle)
|
||||
(define-key ess-noweb-minor-mode-map "\M-nl" 'ess-swv-latex)
|
||||
(define-key ess-noweb-minor-mode-map "\M-np" 'ess-swv-PS)
|
||||
(define-key ess-noweb-minor-mode-map "\M-nP" 'ess-swv-PDF)
|
||||
(define-key ess-noweb-minor-mode-map "\M-nr" 'ess-swv-knit)
|
||||
(define-key ess-noweb-minor-mode-map "\M-nu" 'ess-swv-purl)
|
||||
(define-key ess-noweb-minor-mode-map "\M-nv" 'ess-swv-weave-PDF)
|
||||
|
||||
(define-key ess-noweb-minor-mode-map "\M-nx" 'ess-insert-Sexpr)
|
||||
|
||||
;; AND add these to the noweb menu we have anyway ! :
|
||||
(easy-menu-define ess-swv-menu
|
||||
ess-noweb-minor-mode-menu
|
||||
"Submenu for use in `Rnw-mode'."
|
||||
|
||||
'("Sweaving, Tangling, ..."
|
||||
["Sweave" ess-swv-weave t]
|
||||
["Tangle" ess-swv-tangle t]
|
||||
["LaTeX" ess-swv-latex t]
|
||||
["PDF(LaTeX)" ess-swv-PDF t]
|
||||
["PS (dvips)" ess-swv-PS t]
|
||||
["Knit" ess-swv-knit t]
|
||||
["Purl" ess-swv-purl t]
|
||||
["View PDF" ess-swv-weave-PDF t]
|
||||
["Insert Sexpr" ess-insert-Sexpr t]
|
||||
["AUCTeX Interface" ess-swv-toggle-plug-into-AUCTeX
|
||||
:style toggle :selected ess-swv-plug-into-AUCTeX-p]
|
||||
))
|
||||
|
||||
(easy-menu-add-item ess-noweb-minor-mode-menu
|
||||
nil ;; <= path
|
||||
ess-swv-menu)
|
||||
|
||||
; provides
|
||||
|
||||
(provide 'ess-swv)
|
||||
|
||||
;;; ess-swv.el ends here
|
||||
181
elpa/ess-20180701.100/ess-toolbar.el
Normal file
181
elpa/ess-20180701.100/ess-toolbar.el
Normal file
@@ -0,0 +1,181 @@
|
||||
;;; ess-toolbar.el --- Support for a toolbar in ESS.
|
||||
|
||||
;; Copyright (C) 1997--2009 A.J. Rossini, Richard M. Heiberger, Martin
|
||||
;; Maechler, Kurt Hornik, Rodney Sparapani, and Stephen Eglen.
|
||||
|
||||
;; Author: Stephen Eglen
|
||||
;; Created: 2004-05-06
|
||||
;; Revised: 2009-03-16
|
||||
;; Maintainer: ESS-core <ESS-core@r-project.org>
|
||||
|
||||
;; 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/
|
||||
|
||||
;;; Commentary:
|
||||
|
||||
;; This code adds a toolbar to ESS modes for editing R and S code.
|
||||
;; Support can be added for other modes (e.g. STATA), just ask!
|
||||
;;
|
||||
;; This code is experimental. It has been tested only on Linux
|
||||
;; machines. All feedback appreciated.
|
||||
;;
|
||||
;; If your emacs can support images, the ESS toolbar should be loaded.
|
||||
;;
|
||||
;; If you see a toolbar, but no icons, check out the value of
|
||||
;; ess-icon-directory.
|
||||
;;
|
||||
;; The toolbar can be customized in several ways. To see options, do:
|
||||
;; M-x customize-group RET ess-toolbar RET
|
||||
;; If you change any of the variables, you _may_ need to restart Emacs
|
||||
;; to see any effect. See also the documentation for ess-toolbar-items
|
||||
;; if you wish to change its value.
|
||||
|
||||
;;; Technical issues.
|
||||
|
||||
;; 2009-03-16: toolbar code in Emacs 23 has changed slightly to 22,
|
||||
;; and presumably once Emacs 22 is no longer supported, this code can
|
||||
;; be cleaned up a bit (i.e. no need to set load-path.)
|
||||
|
||||
;;; Code:
|
||||
|
||||
(defgroup ess-toolbar nil
|
||||
"ESS: toolbar support."
|
||||
:group 'ess
|
||||
:link '(emacs-commentary-link :tag "Commentary" "ess-toolbar.el")
|
||||
:prefix "ess-")
|
||||
|
||||
(defcustom ess-use-toolbar
|
||||
(and (fboundp 'display-images-p) (display-images-p))
|
||||
"Non-nil means ESS should support the toolbar."
|
||||
:type 'boolean)
|
||||
|
||||
|
||||
(defcustom ess-toolbar-own-icons nil
|
||||
"Non-nil means that we only put our toolbar entries in ESS.
|
||||
Otherwise we get standard toolbar as well as ESS entries.
|
||||
The standard toolbar items are copied from the default toolbar."
|
||||
:type 'boolean)
|
||||
|
||||
(defcustom ess-toolbar-global nil
|
||||
"*Non-nil means that the ESS toolbar is available in all emacs buffers.
|
||||
Otherwise, the ESS toolbar is present only in R/S mode buffers.
|
||||
For beginners, this is probably better set to a non-nil value."
|
||||
:type 'boolean)
|
||||
|
||||
(defcustom ess-toolbar-items
|
||||
'( (R "startr")
|
||||
;;(S "spluslogo" "Start S process")
|
||||
(S "splus_letter_small")
|
||||
(ess-eval-line-and-step "rline")
|
||||
(ess-eval-region "rregion")
|
||||
(ess-eval-function-or-paragraph-and-step "rregion")
|
||||
(ess-load-file "rbuffer")
|
||||
(ess-eval-function "rfunction")
|
||||
(ess-switch-to-ESS "switch_ess"))
|
||||
"Items to be added to the ESS toolbar.
|
||||
Each list element has two items:
|
||||
1. the name of the function to run
|
||||
2. the icon to be used (without .xpm extension)
|
||||
|
||||
General toolbar items are also added to the ESS toolbar
|
||||
iff `ess-toolbar-own-icons' is nil.
|
||||
|
||||
Setting this variable with setq doesn't take effect once you have
|
||||
loaded ess-site, unless you follow it by a call to
|
||||
`ess-make-toolbar' afterwards. Instead, change its value using
|
||||
Custom, and then on all new ESS buffers you should see the
|
||||
toolbar has changed."
|
||||
:set (lambda (symbol value)
|
||||
(set-default symbol value)
|
||||
(if (fboundp 'ess-make-toolbar)
|
||||
(ess-make-toolbar)))
|
||||
:type '(repeat (list (function :tag "Function to run")
|
||||
(string :tag "Icon"))))
|
||||
|
||||
(defvar ess-icon-directory
|
||||
(expand-file-name "icons" ess-etc-directory)
|
||||
"*Location for ESS icons.
|
||||
This variable should be set automatically by the ESS install process.
|
||||
Icons should be found in ESS/etc/icons/ directory.
|
||||
If `ess-icon-directory' is invalid, please report a bug.")
|
||||
|
||||
(unless (file-directory-p ess-icon-directory)
|
||||
(ess-write-to-dribble-buffer
|
||||
"`ess-icon-directory' does not exist; using `ess-etc-directory'.\n")
|
||||
(setq ess-icon-directory ess-etc-directory))
|
||||
|
||||
(defvar ess-toolbar nil
|
||||
"Toolbar items to be added to ESS editing buffers.")
|
||||
|
||||
(defun ess-make-toolbar ()
|
||||
"Make the ESS toolbar."
|
||||
;; Under Emacs, only worth building the toolbar if tool-bar-map is
|
||||
;; available. e.g. when running Emacs within a terminal, tool-bar-map
|
||||
;; is not available, so no need to make the tool-bar.
|
||||
(when (boundp 'tool-bar-map)
|
||||
(setq ess-toolbar
|
||||
(if (or ess-toolbar-own-icons (null tool-bar-map))
|
||||
(make-sparse-keymap)
|
||||
(copy-keymap tool-bar-map)))
|
||||
(let ((tool-bar-map ess-toolbar)
|
||||
(load-path (list ess-icon-directory)))
|
||||
;; in Emacs 22, icons are found by examining load-path, bound here
|
||||
;; whereas Emacs 23 seems to want them in image-load-path, set at the
|
||||
;; bottom of this file.
|
||||
(mapc #'ess-add-icon ess-toolbar-items))))
|
||||
|
||||
(defun ess-add-icon (x)
|
||||
"Add an ESS item to the Emacs toolbar."
|
||||
;; By using tool-bar-add-item-from-menu instead of tool-bar-add-item
|
||||
;; we get the tooltips "for free" from ess-mode-map.
|
||||
(tool-bar-add-item-from-menu (car x) (cadr x) ess-mode-map))
|
||||
|
||||
(defun ess-add-toolbar ()
|
||||
"Add the ESS toolbar to a particular mode.
|
||||
The toolbar is added iff `ess-toolbar-global' is nil, else the toolbar
|
||||
is added globally when ess-toolbar.el is loaded."
|
||||
(if (and ess-toolbar (not ess-toolbar-global))
|
||||
(set (make-local-variable 'tool-bar-map) ess-toolbar)))
|
||||
|
||||
;; Make the toolbars. Each toolbar is hopefully made only when this file
|
||||
;; is loaded; we don't need it to be remade every time.
|
||||
(if ess-use-toolbar
|
||||
(progn
|
||||
(ess-make-toolbar)
|
||||
;; After making the toolbar, if ESS toolbar is needed globally,
|
||||
;; add it here.
|
||||
(if ess-toolbar-global
|
||||
(setq tool-bar-map ess-toolbar)
|
||||
(ess-write-to-dribble-buffer "Creating global Emacs toolbar"))
|
||||
|
||||
;; Check for toolbar support - needed iff ess-use-toolbar is non-nil.
|
||||
(or
|
||||
;; Emacs support for images:
|
||||
(and (fboundp 'display-images-p) (display-images-p))
|
||||
;; if above tests failed, give a warning.
|
||||
(progn
|
||||
(message "Toolbar support for ESS not available in this emacs.")
|
||||
;; Not sure if we want to delay startup of ESS.
|
||||
;;(sit-for 2)
|
||||
))
|
||||
))
|
||||
|
||||
;; Following needed for Emacs 23, not Emacs 22
|
||||
(when (boundp 'image-load-path)
|
||||
(add-to-list 'image-load-path ess-icon-directory))
|
||||
|
||||
(provide 'ess-toolbar)
|
||||
|
||||
;;; ess-toolbar.el ends here
|
||||
2872
elpa/ess-20180701.100/ess-tracebug.el
Normal file
2872
elpa/ess-20180701.100/ess-tracebug.el
Normal file
File diff suppressed because it is too large
Load Diff
304
elpa/ess-20180701.100/ess-trns.el
Normal file
304
elpa/ess-20180701.100/ess-trns.el
Normal file
@@ -0,0 +1,304 @@
|
||||
;;; ess-trns.el --- Support for manipulating S transcript files
|
||||
|
||||
;; Copyright (C) 1989--1994 Bates, Kademan, Ritter and Smith
|
||||
;; Copyright (C) 1997--2010 A.J. Rossini, Richard M. Heiberger, Martin
|
||||
;; Maechler, Kurt Hornik, Rodney Sparapani, and Stephen Eglen.
|
||||
;; Copyright (C) 2011--2012 A.J. Rossini, Richard M. Heiberger, Martin Maechler,
|
||||
;; Kurt Hornik, Rodney Sparapani, Stephen Eglen and Vitalie Spinu.
|
||||
|
||||
;; Author: David Smith <dsmith@stats.adelaide.edu.au>
|
||||
;; Maintainer: ESS-core <ESS-core@r-project.org>
|
||||
|
||||
;; 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/
|
||||
|
||||
|
||||
;;; Commentary:
|
||||
|
||||
;; Code for dealing with ESS transcripts.
|
||||
|
||||
;;; Code:
|
||||
|
||||
; Requires and autoloads
|
||||
|
||||
(require 'ess)
|
||||
(require 'ess-inf)
|
||||
(require 'comint)
|
||||
|
||||
; ess-transcript-mode
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;;; In this section:
|
||||
;;;;
|
||||
;;;; * The major mode ess-transcript-mode
|
||||
;;;; * Commands for ess-transcript-mode
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
;;*;; Major mode definition
|
||||
(defvar ess-transcript-mode-map nil "Keymap for `ess-transcript-mode'.")
|
||||
(unless ess-transcript-mode-map
|
||||
(setq ess-transcript-mode-map (make-sparse-keymap))
|
||||
|
||||
(define-key ess-transcript-mode-map "\C-c\C-s" 'ess-switch-process)
|
||||
(define-key ess-transcript-mode-map "\C-c\C-r" 'ess-eval-region)
|
||||
(define-key ess-transcript-mode-map "\C-c\M-r" 'ess-eval-region-and-go)
|
||||
;; (define-key ess-transcript-mode-map "\M-\C-x" 'ess-eval-function)
|
||||
;; (define-key ess-transcript-mode-map "\C-c\M-f" 'ess-eval-function-and-go)
|
||||
;; (define-key ess-transcript-mode-map "\C-c\C-j" 'ess-eval-line)
|
||||
;; (define-key ess-transcript-mode-map "\C-c\M-j" 'ess-eval-line-and-go)
|
||||
|
||||
(define-key ess-transcript-mode-map "\C-c\C-k" 'ess-force-buffer-current)
|
||||
(define-key ess-transcript-mode-map "\C-c\C-q" 'ess-quit)
|
||||
|
||||
(define-key ess-transcript-mode-map "\C-c\C-j" 'ess-transcript-send-command)
|
||||
(define-key ess-transcript-mode-map "\C-c\M-j" 'ess-transcript-send-command-and-move)
|
||||
(define-key ess-transcript-mode-map "\M-\C-a" 'ess-goto-end-of-function-or-para)
|
||||
(define-key ess-transcript-mode-map "\M-\C-e" 'ess-goto-end-of-function-or-para)
|
||||
(define-key ess-transcript-mode-map "\C-c\C-y" 'ess-switch-to-ESS)
|
||||
(define-key ess-transcript-mode-map "\C-c\C-z" 'ess-switch-to-end-of-ESS)
|
||||
(define-key ess-transcript-mode-map "\C-c\C-v" 'ess-display-help-on-object)
|
||||
(define-key ess-transcript-mode-map "\C-c\C-d" 'ess-dump-object-into-edit-buffer)
|
||||
(define-key ess-transcript-mode-map "\C-c\t" 'ess-complete-object-name-deprecated)
|
||||
(define-key ess-transcript-mode-map "\C-a" 'comint-bol)
|
||||
(define-key ess-transcript-mode-map "\M-\t" 'comint-replace-by-expanded-filename)
|
||||
(define-key ess-transcript-mode-map "\M-?" 'comint-dynamic-list-completions)
|
||||
(define-key ess-transcript-mode-map "\C-c\C-k" 'ess-request-a-process)
|
||||
(define-key ess-transcript-mode-map "{" 'skeleton-pair-insert-maybe)
|
||||
(define-key ess-transcript-mode-map "}" 'skeleton-pair-insert-maybe)
|
||||
(define-key ess-transcript-mode-map "\e\C-h" 'ess-mark-function)
|
||||
(define-key ess-transcript-mode-map "\e\C-q" 'ess-indent-exp)
|
||||
;(define-key ess-transcript-mode-map "\177" 'backward-delete-char-untabify)
|
||||
(define-key ess-transcript-mode-map "\t" 'ess-indent-command)
|
||||
|
||||
(define-key ess-transcript-mode-map "\C-c\C-p" 'comint-previous-prompt)
|
||||
(define-key ess-transcript-mode-map "\C-c\C-n" 'comint-next-prompt)
|
||||
;; (define-key ess-transcript-mode-map "\C-c\C-n" 'ess-eval-line-and-step)
|
||||
|
||||
(define-key ess-transcript-mode-map "\r" 'ess-transcript-send-command-and-move)
|
||||
(define-key ess-transcript-mode-map "\M-\r" 'ess-transcript-send-command)
|
||||
(define-key ess-transcript-mode-map "\C-c\r" 'ess-transcript-copy-command)
|
||||
(define-key ess-transcript-mode-map "\C-c\C-w" 'ess-transcript-DO-clean-region)
|
||||
(define-key ess-transcript-mode-map "\C-c\M-c" 'ess-transcript-clean-buffer)
|
||||
)
|
||||
|
||||
(easy-menu-define
|
||||
ess-transcript-mode-menu ess-transcript-mode-map
|
||||
"Menu for use in S transcript mode."
|
||||
'("ESS-trans"
|
||||
["What is this? (beta)" ess-mouse-me t]
|
||||
["Describe" describe-mode t]
|
||||
["About" (ess-goto-info "Transcript Mode") t]
|
||||
["Send bug report" ess-submit-bug-report t]
|
||||
"------"
|
||||
["Mark cmd group" mark-paragraph t]
|
||||
["Previous prompt" comint-previous-prompt t]
|
||||
["Next prompt" comint-next-prompt t]
|
||||
"------"
|
||||
["Send and move" ess-transcript-send-command-and-move t]
|
||||
["Copy command" ess-transcript-copy-command t]
|
||||
["Send command" ess-transcript-send-command t]
|
||||
["Clean Region" ess-transcript-DO-clean-region t]
|
||||
["Clean Whole Buffer" ess-transcript-clean-buffer t]
|
||||
["Switch S process" ess-switch-process t]
|
||||
))
|
||||
|
||||
(if (featurep 'ess-trans)
|
||||
(define-key ess-transcript-mode-map [menu-bar ess-trans]
|
||||
(cons "ess-trans" ess-transcript-mode-menu))
|
||||
(eval-after-load "ess-trans"
|
||||
'(define-key ess-transcript-mode-map
|
||||
[menu-bar ess-trans]
|
||||
(cons "ess-trans"
|
||||
ess-transcript-mode-menu))))
|
||||
;;;###autoload
|
||||
(defun ess-transcript-mode (alist &optional proc)
|
||||
"Major mode for manipulating {ESS} transcript files.
|
||||
|
||||
Type \\[ess-transcript-send-command] to send a command in the
|
||||
transcript to the current S 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 S commands. Other keybindings are:
|
||||
|
||||
\\{ess-transcript-mode-map}"
|
||||
(kill-all-local-variables)
|
||||
(setq buffer-read-only t) ;; to protect the buffer.
|
||||
(ess-setq-vars-local alist); (current-buffer))
|
||||
(setq major-mode 'ess-transcript-mode)
|
||||
(setq mode-name "ESS Transcript")
|
||||
(use-local-map ess-transcript-mode-map)
|
||||
(set-syntax-table (or inferior-ess-mode-syntax-table
|
||||
ess-mode-syntax-table))
|
||||
(setq mode-line-process
|
||||
'(" [" ess-local-process-name "]"))
|
||||
(make-local-variable 'ess-local-process-name)
|
||||
(setq ess-local-process-name nil)
|
||||
(unless inferior-ess-prompt ;; For S languages it is set in custom-alist
|
||||
(setq inferior-ess-prompt
|
||||
;; Do not anchor to bol with `^'
|
||||
(concat "\\("
|
||||
inferior-ess-primary-prompt
|
||||
"\\|"
|
||||
inferior-ess-secondary-prompt
|
||||
"\\)")))
|
||||
(make-local-variable 'paragraph-start)
|
||||
(setq paragraph-start (concat "^" inferior-ess-prompt "\\|^\^L"))
|
||||
(make-local-variable 'paragraph-separate)
|
||||
(setq paragraph-separate "^\^L")
|
||||
(make-local-variable 'comint-use-prompt-regexp)
|
||||
(setq comint-use-prompt-regexp t)
|
||||
(make-local-variable 'comint-prompt-regexp)
|
||||
(setq comint-prompt-regexp (concat "^" inferior-ess-prompt))
|
||||
|
||||
;; font-lock support
|
||||
|
||||
(when inferior-ess-font-lock-keywords ;; new system
|
||||
(setq inferior-ess-font-lock-defaults
|
||||
(ess--extract-default-fl-keywords inferior-ess-font-lock-keywords)))
|
||||
|
||||
(set (make-local-variable 'font-lock-defaults)
|
||||
'(inferior-ess-font-lock-defaults nil nil ((?\. . "w") (?\_ . "w") (?' . "."))))
|
||||
|
||||
;;; Keep <tabs> out of the code.
|
||||
(make-local-variable 'indent-tabs-mode)
|
||||
(setq indent-tabs-mode nil)
|
||||
|
||||
(run-mode-hooks 'ess-transcript-mode-hook))
|
||||
|
||||
;;*;; Commands used in S transcript mode
|
||||
|
||||
(defun ess-transcript-send-command ()
|
||||
"Send the command at point in the transcript to the ESS process.
|
||||
The line should begin with a prompt. The ESS process buffer is displayed if it
|
||||
is not already."
|
||||
(interactive)
|
||||
(let* ((proc (or ess-local-process-name
|
||||
(ess-request-a-process "Evaluate into which process? " t)))
|
||||
(ess-buf (ess-get-process-buffer proc)))
|
||||
(setq ess-local-process-name proc)
|
||||
(if (get-buffer-window ess-buf) nil
|
||||
(display-buffer ess-buf t))
|
||||
(let ((input (inferior-ess-get-old-input)))
|
||||
(with-current-buffer ess-buf
|
||||
(goto-char (point-max))
|
||||
(ess-eval-linewise input)))))
|
||||
|
||||
(defun ess-transcript-send-command-and-move ()
|
||||
"Send the command on this line, and move point to the next command."
|
||||
(interactive)
|
||||
;; (ess-transcript-send-command) ;; This doesn't work properly
|
||||
;; replacement code begins
|
||||
(let* ((proc (or ess-local-process-name
|
||||
(ess-request-a-process "Evaluate into which process? " t)))
|
||||
(ess-buf (ess-get-process-buffer proc)))
|
||||
(setq ess-local-process-name proc)
|
||||
(if (get-buffer-window ess-buf) nil
|
||||
(display-buffer ess-buf t))
|
||||
(let ((input (inferior-ess-get-old-input)))
|
||||
(with-current-buffer ess-buf
|
||||
(goto-char (point-max))
|
||||
(ess-eval-linewise input nil nil nil 1))))
|
||||
;; replacement code ends
|
||||
(goto-char ess-temp-point)
|
||||
(comint-next-prompt 1))
|
||||
|
||||
(defun ess-transcript-copy-command ()
|
||||
"Copy the command at point to the command line of the ESS process."
|
||||
(interactive)
|
||||
(let* ((proc (or ess-local-process-name
|
||||
(ess-request-a-process "Evaluate into which process? " t)))
|
||||
(ess-buf (process-buffer (get-process proc)))
|
||||
(input (inferior-ess-get-old-input)))
|
||||
(setq ess-local-process-name proc)
|
||||
(if (get-buffer-window ess-buf) nil
|
||||
(display-buffer ess-buf t))
|
||||
(with-current-buffer ess-buf
|
||||
(goto-char (point-max))
|
||||
(insert input)))
|
||||
(ess-switch-to-end-of-ESS))
|
||||
|
||||
;;;###autoload
|
||||
(defun ess-transcript-clean-region (beg end even-if-read-only)
|
||||
"Strip the transcript in the region, leaving only (R/S/Lsp/..) commands.
|
||||
Deletes any lines not beginning with a prompt, and then removes the
|
||||
prompt from those lines that remain. Prefix argument means to
|
||||
clean even if the buffer is \\[read-only]."
|
||||
(interactive "r\nP")
|
||||
(unless inferior-ess-prompt
|
||||
(error "Cannot clean ESS transcript region in this mode!
|
||||
That only works in ess-transcript-mode or inferior-ess-mode ('*R*' etc)."
|
||||
;; Maybe call ess-clean-region-in-new-transcript ?"))
|
||||
))
|
||||
(let ((do-toggle (and buffer-read-only even-if-read-only))
|
||||
(ess-prompt-rx (if inferior-ess-secondary-prompt
|
||||
(concat "^\\(\\("
|
||||
inferior-ess-prompt
|
||||
"\\)\\|\\("
|
||||
inferior-ess-secondary-prompt
|
||||
"\\)\\)")
|
||||
(concat "^" inferior-ess-prompt))))
|
||||
(save-excursion
|
||||
(if do-toggle (setq buffer-read-only nil))
|
||||
(save-restriction
|
||||
(deactivate-mark)
|
||||
(narrow-to-region beg end)
|
||||
(goto-char (point-min))
|
||||
(delete-non-matching-lines ess-prompt-rx)
|
||||
(goto-char (point-min))
|
||||
;; (replace-regexp * * ) :
|
||||
(while (re-search-forward ess-prompt-rx nil t)
|
||||
(replace-match "" nil nil)))
|
||||
|
||||
(if do-toggle (setq buffer-read-only t)))))
|
||||
|
||||
|
||||
;; unfinished idea :-----------------------
|
||||
|
||||
;; (defun ess-clean-region-in-new-transcript (beg end)
|
||||
;; "Copy the region into a new ess-transcript buffer, and clean it there,
|
||||
;; using \\[ess-transcript-clean-region]."
|
||||
;; (interactive "r")
|
||||
|
||||
;; (let ((bname (buffer-file-name)))
|
||||
;; (setq bname (if bname .. ..))
|
||||
;; (let
|
||||
;; (fbase (if fname (file-name-sans-extension (file-name-nondirectory fname))
|
||||
;; (buffer-name)))
|
||||
;;
|
||||
;; ;; the buffer name should be like a file name
|
||||
;; (buf-nam ....)
|
||||
;; (trns-buf (get-buffer-create fbase))
|
||||
;; (pop-to-buffer trns-buf)
|
||||
;; (ess-transcript-mode .....)
|
||||
;; )))
|
||||
|
||||
|
||||
|
||||
|
||||
(defun ess-transcript-DO-clean-region (beg end)
|
||||
"Clean the current via \\[ess-transcript-clean-region] even if the buffer is read-only."
|
||||
(interactive "r")
|
||||
(ess-transcript-clean-region beg end 'In-ANY-case))
|
||||
|
||||
(defun ess-transcript-clean-buffer ()
|
||||
"Cleanup the whole buffer.
|
||||
Use point-min/max to obey `narrow-to-region'."
|
||||
(interactive)
|
||||
(ess-transcript-clean-region (point-min) (point-max) 'In-ANY-case))
|
||||
|
||||
(provide 'ess-trns)
|
||||
|
||||
;;; ess-trns.el ends here
|
||||
1602
elpa/ess-20180701.100/ess-utils.el
Normal file
1602
elpa/ess-20180701.100/ess-utils.el
Normal file
File diff suppressed because it is too large
Load Diff
79
elpa/ess-20180701.100/ess-vst-d.el
Normal file
79
elpa/ess-20180701.100/ess-vst-d.el
Normal file
@@ -0,0 +1,79 @@
|
||||
;;; ess-vst-d.el --- ViSta customization
|
||||
|
||||
;; Copyright (C) 1997 A. J. Rossini
|
||||
;; Copyright (C) 1997--2004 A.J. Rossini, Richard M. Heiberger, Martin
|
||||
;; Maechler, Kurt Hornik, Rodney Sparapani, and Stephen Eglen.
|
||||
|
||||
;; Author: A.J. Rossini <rossini@u.washington.edu>
|
||||
;; Created: 26 Aug 1997
|
||||
;; Maintainer: ESS-core <ESS-core@r-project.org>
|
||||
|
||||
;; Keywords: languages
|
||||
|
||||
;; 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/
|
||||
|
||||
;;; Commentary:
|
||||
|
||||
;; This file extends the XLispStat configuration for ViSta.
|
||||
|
||||
;;; Code:
|
||||
|
||||
;;; Requires and Autoloads:
|
||||
|
||||
(require 'ess-lsp-l)
|
||||
|
||||
(defvar VST-customize-alist
|
||||
'((ess-customize-alist . VST-customize-alist )
|
||||
(ess-language . "XLS" )
|
||||
(ess-dialect . "ViSta" )
|
||||
(ess-loop-timeout . ess-XLS-loop-timeout)
|
||||
(ess-object-name-db-file . "ess-xls-namedb.el" )
|
||||
(ess-help-sec-regex . " ")
|
||||
(ess-help-sec-keys-alist . " ")
|
||||
(inferior-ess-primary-prompt . "> ?" )
|
||||
(comint-use-prompt-regexp . t)
|
||||
(inferior-ess-program . inferior-VST-program)
|
||||
(inferior-ess-help-command . "(help '%s)\n" )
|
||||
(inferior-ess-objects-command . "(variables)\n" )
|
||||
(inferior-ess-exit-command . "(exit)\n" )
|
||||
(inferior-ess-start-file . nil) ;"~/.ess-VST")
|
||||
;;(inferior-ess-start-args . nil)
|
||||
)
|
||||
"Variables to customize for XLS.")
|
||||
|
||||
|
||||
(defun VST-mode (&optional proc-name)
|
||||
"Major mode for editing ViSta source. NOT EVEN STARTED."
|
||||
(interactive)
|
||||
(setq ess-customize-alist VST-customize-alist)
|
||||
(lisp-mode))
|
||||
|
||||
|
||||
(defun ViSta ()
|
||||
"Call 'ViSta', the extend XLispStat statistical system, from Forrest Young."
|
||||
|
||||
(interactive)
|
||||
(setq ess-customize-alist VST-customize-alist)
|
||||
(ess-write-to-dribble-buffer
|
||||
(format "(ViSta): ess-dialect=%s , buf=%s\n"
|
||||
ess-dialect (current-buffer)))
|
||||
(inferior-ess))
|
||||
|
||||
; Provide package
|
||||
|
||||
(provide 'ess-vst-d)
|
||||
|
||||
;;; ess-vst-d.el ends here
|
||||
101
elpa/ess-20180701.100/ess-xls-d.el
Normal file
101
elpa/ess-20180701.100/ess-xls-d.el
Normal file
@@ -0,0 +1,101 @@
|
||||
;;; ess-xls-d.el --- XLispStat customization for ESS.
|
||||
|
||||
;; Copyright (C) 1997 A. J. Rossini
|
||||
;; Copyright (C) 1998--2004 A.J. Rossini, Richard M. Heiberger, Martin
|
||||
;; Maechler, Kurt Hornik, Rodney Sparapani, and Stephen Eglen.
|
||||
|
||||
;; Author: A.J. Rossini <rossini@stat.sc.edu>
|
||||
;; Created: 12 Jun 1997
|
||||
;; Maintainer: ESS-core <ESS-core@r-project.org>
|
||||
|
||||
;; Keywords: statistics, languages
|
||||
|
||||
;; 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/
|
||||
|
||||
;;; Commentary:
|
||||
|
||||
;; This file defines all the XLispStat customizations for ESS. See
|
||||
;; ess-lsp-l.el for general Lisp modifications.
|
||||
|
||||
;;; Code:
|
||||
|
||||
;;; Requires and Autoloads:
|
||||
|
||||
(require 'ess-lsp-l)
|
||||
|
||||
(defvar ess-help-XLS-sec-keys-alist
|
||||
'((?a . "Args:"))
|
||||
"Sparse online XLS help.")
|
||||
|
||||
(defvar XLS-editing-alist Lisp-editing-alist)
|
||||
|
||||
(defvar XLS-customize-alist
|
||||
'((ess-local-customize-alist . 'XLS-customize-alist)
|
||||
(ess-language . "XLS" )
|
||||
(ess-dialect . "XLS" )
|
||||
(ess-mode-editing-alist . XLS-editing-alist )
|
||||
(ess-loop-timeout . ess-XLS-loop-timeout)
|
||||
(ess-object-name-db-file . "ess-xls-namedb.el" )
|
||||
(ess-help-sec-regex . "^[A-Z. ---]+:$")
|
||||
(ess-help-sec-keys-alist . ess-help-XLS-sec-keys-alist)
|
||||
(inferior-ess-primary-prompt . "> ?" )
|
||||
(inferior-ess-secondary-prompt . "^" )
|
||||
(comint-use-prompt-regexp . t)
|
||||
(inferior-ess-program . inferior-XLS-program)
|
||||
(inferior-ess-help-command . "(help '%s)\n" )
|
||||
(inferior-ess-objects-command . "(variables)\n" )
|
||||
(inferior-ess-exit-command . "(exit)\n" )
|
||||
;;(inferior-ess-start-args . ""))
|
||||
(inferior-ess-start-file . nil))
|
||||
"Variables to customize for XLS.")
|
||||
|
||||
;;; The functions of interest (mode, inferior mode)
|
||||
|
||||
;;;###autoload
|
||||
(defun XLS-mode (&optional proc-name)
|
||||
"Major mode for editing XLispStat source. NOT EVEN STARTED."
|
||||
(interactive)
|
||||
(setq ess-customize-alist XLS-customize-alist)
|
||||
(ess-mode XLS-customize-alist proc-name)
|
||||
(setq major-mode 'XLS-mode))
|
||||
|
||||
;;;###autoload
|
||||
(add-to-list 'auto-mode-alist '("\\.lsp\\'" . XLS-mode))
|
||||
|
||||
(fset 'xlispstat-mode 'XLS-mode)
|
||||
|
||||
(defun XLS ()
|
||||
"Call 'XLispStat', the Lisp statistical system from Luke Tierney."
|
||||
|
||||
(interactive)
|
||||
(setq ess-customize-alist XLS-customize-alist)
|
||||
(ess-write-to-dribble-buffer
|
||||
(format "(XLS): ess-dialect=%s , buf=%s\n"
|
||||
ess-dialect (current-buffer)))
|
||||
(inferior-ess))
|
||||
|
||||
(defun xls-transcript-mode ()
|
||||
"Does the right thing."
|
||||
(interactive)
|
||||
(ess-transcript-mode XLS-customize-alist))
|
||||
|
||||
(fset 'XLS-transcript-mode 'xls-transcript-mode)
|
||||
|
||||
; Provide package
|
||||
|
||||
(provide 'ess-xls-d)
|
||||
|
||||
;;; ess-xls-d.el ends here
|
||||
106
elpa/ess-20180701.100/ess.el
Normal file
106
elpa/ess-20180701.100/ess.el
Normal file
@@ -0,0 +1,106 @@
|
||||
;;; ess.el --- Emacs Speaks Statistics: statistical programming within Emacs
|
||||
|
||||
;; Copyright (C) 1989--1996 Bates, Kademan, Ritter and Smith
|
||||
;; Copyright (C) 1997--2010 A.J. Rossini, Richard M. Heiberger, Martin
|
||||
;; Maechler, Kurt Hornik, Rodney Sparapani, and Stephen Eglen.
|
||||
;; Copyright (C) 2011--2018 A.J. Rossini, Richard M. Heiberger, Martin
|
||||
;; Maechler, Kurt Hornik, Rodney Sparapani, Stephen Eglen,
|
||||
;; Vitalie Spinu, and Lionel Henry.
|
||||
|
||||
;; Author: Doug Bates
|
||||
;; Ed Kademan
|
||||
;; Frank Ritter
|
||||
;; David Smith
|
||||
;; Created: October 14, 1991
|
||||
;; Maintainer: ESS-core <ESS-core@r-project.org>
|
||||
;; Keywords: statistics, languages
|
||||
;; URL: http://ess.r-project.org/
|
||||
;; Package-Requires: ((julia-mode "0.3"))
|
||||
|
||||
;; 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/
|
||||
|
||||
;;; Commentary:
|
||||
|
||||
;; PURPOSE
|
||||
;;
|
||||
;; Interface to the S, SAS, and XLisp dialects of statistical
|
||||
;; programming languages, with potential extensions to other
|
||||
;; languages. Designed to be extendable to most other interactive
|
||||
;; statistical programming situations.
|
||||
|
||||
;; BRIEF OVERVIEW
|
||||
;;
|
||||
;; Supports structured editing of S, SAS, and XLisp (statistics
|
||||
;; programming languages) functions that are integrated with a
|
||||
;; running process in a buffer.
|
||||
|
||||
;; THE ESS MAILING LIST
|
||||
;;
|
||||
;; There is an informal mailing list for discussions of ESS. Alpha
|
||||
;; and beta releases of ESS are also announced here. Send mail
|
||||
;; to ess-help-request@r-project.org to join.
|
||||
|
||||
;; OVERVIEW OF ESS
|
||||
;;
|
||||
;; S is a statistics programming language developed at Bell Labs
|
||||
;; particularly suited for descriptive and exploratory statistics.
|
||||
;; s-mode is built on top of comint (the general command interpreter
|
||||
;; mode written by Olin Shivers), and so comint.el (or comint.elc)
|
||||
;; should be either loaded or in your load path when you invoke it.
|
||||
;;
|
||||
;; Aside from the general features offered by comint such as
|
||||
;; command history editing and job control, inferior S mode
|
||||
;; allows you to dump and load S objects into and from external
|
||||
;; files, and to display help on functions. It also provides
|
||||
;; name completion while you do these. For more detailed
|
||||
;; information see the documentation strings for inferior-ess,
|
||||
;; inferior-ess-mode, ess-mode, and comint-mode. There are also
|
||||
;; many variables and hooks available for customizing (see
|
||||
;; the variables below that have document strings that start
|
||||
;; with an "*").
|
||||
|
||||
;; INSTALLATION
|
||||
;; See README and S-site for details.
|
||||
|
||||
;; GETTING RELEASES OF ESS
|
||||
;; ===> http://ess.r-project.org
|
||||
;;
|
||||
|
||||
;; CREDITS.
|
||||
;; Thanks to shiba@shun.isac.co.jp (Ken'ichi "Modal" Shibayama) for
|
||||
;; the indenting code.
|
||||
;; Thanks also to maechler@stat.math.ethz.ch (Martin Maechler) for
|
||||
;; suggestions and bug fixes.
|
||||
;; ess-eval-line-and-step is based on a function by Rod Ball
|
||||
;; (rod@marcam.dsir.govt.nz)
|
||||
;; Also thanks from David Smith to the previous authors for all their
|
||||
;; help and suggestions.
|
||||
;; And thanks from Richard M. Heiberger, Kurt Hornik, Martin
|
||||
;; Maechler, and A.J. Rossini to David Smith.
|
||||
|
||||
;; BUG REPORTS
|
||||
;; Please report bugs to ess-bugs@r-project.org
|
||||
;; Comments, suggestions, words of praise and large cash donations
|
||||
;; are also more than welcome, but should generally be split between
|
||||
;; all authors :-).
|
||||
|
||||
;;; Code:
|
||||
|
||||
(require 'ess-site)
|
||||
|
||||
(provide 'ess)
|
||||
|
||||
;;; ess.el ends here
|
||||
4824
elpa/ess-20180701.100/ess.info
Normal file
4824
elpa/ess-20180701.100/ess.info
Normal file
File diff suppressed because it is too large
Load Diff
227
elpa/ess-20180701.100/essd-els.el
Normal file
227
elpa/ess-20180701.100/essd-els.el
Normal file
@@ -0,0 +1,227 @@
|
||||
;;; essd-els.el --- S-PLUS 3.x at another location customization
|
||||
|
||||
;; Copyright (C) 1998 Richard M. Heiberger
|
||||
;; Copyright (C) 1999--2005 A.J. Rossini, Richard M. Heiberger, Martin
|
||||
;; Maechler, Kurt Hornik, Rodney Sparapani, and Stephen Eglen.
|
||||
|
||||
;; Author: Richard M. Heiberger <rmh@temple.edu>
|
||||
;; Created: December 1998
|
||||
|
||||
;; Maintainer: ESS-core <ESS-core@r-project.org>
|
||||
|
||||
;; Keywords: languages
|
||||
|
||||
;; 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/
|
||||
|
||||
;;; Commentary:
|
||||
|
||||
;; This file defines all the S-PLUS 3.x customizations for ess-mode.
|
||||
|
||||
;;; Code:
|
||||
|
||||
(require 'ess-arc-d)
|
||||
(require 'ess-julia)
|
||||
(require 'ess-omg-d)
|
||||
(require 'ess-s-lang)
|
||||
(require 'ess-s3-d)
|
||||
(require 'ess-s4-d)
|
||||
(require 'ess-sas-d)
|
||||
(require 'ess-sp3-d)
|
||||
(require 'ess-sp4-d)
|
||||
(require 'ess-sp5-d)
|
||||
(require 'ess-sp6-d)
|
||||
(require 'ess-sp6w-d)
|
||||
(require 'ess-stata-mode)
|
||||
(require 'ess-utils)
|
||||
(require 'ess-vst-d)
|
||||
(require 'ess-xls-d)
|
||||
|
||||
(defvar S+elsewhere-dialect-name "S+6"
|
||||
"Name of 'dialect' for S-PLUS at another location.")
|
||||
;easily changeable in a user's .emacs
|
||||
|
||||
(defcustom inferior-ess-remote-pager nil
|
||||
"Remote pager to use for reporting help files and similar things.
|
||||
The default value is nil."
|
||||
:group 'ess-proc
|
||||
:type '(choice (const nil) string))
|
||||
|
||||
|
||||
(defvar S+elsewhere-customize-alist
|
||||
(append
|
||||
'((ess-local-customize-alist . 'S+elsewhere-customize-alist)
|
||||
(ess-dialect . S+elsewhere-dialect-name)
|
||||
(ess-loop-timeout . ess-S-loop-timeout);fixme: dialect spec.
|
||||
(ess-object-name-db-file . "ess-spelsewhere-namedb.el" )
|
||||
(inferior-ess-program . inferior-S-elsewhere-program)
|
||||
(inferior-ess-help-command . "help(\"%s\", pager=\"cat\", window=F)\n")
|
||||
|
||||
(inferior-ess-start-file . nil) ;"~/.ess-S+3")
|
||||
(inferior-ess-start-args . "-i")
|
||||
(ess-STERM . "iESS")
|
||||
)
|
||||
S+common-cust-alist)
|
||||
"Variables to customize for S+elsewhere")
|
||||
|
||||
(defun S+elsewhere (&optional proc-name)
|
||||
"Call 'S-PLUS 3.x', the 'Real Thing' from StatSci."
|
||||
(interactive)
|
||||
(setq ess-customize-alist S+elsewhere-customize-alist)
|
||||
(ess-write-to-dribble-buffer
|
||||
(format "\n(S+elsewhere): ess-dialect=%s, buf=%s\n" ess-dialect
|
||||
(current-buffer)))
|
||||
(inferior-ess)
|
||||
(if inferior-ess-language-start
|
||||
(ess-eval-linewise inferior-ess-language-start)))
|
||||
;; git commit 104c4d7c56bc239ea245562763caa317bc3a1a84
|
||||
(make-obsolete 'S+elsewhere #'ess-remote "2000")
|
||||
|
||||
(defun S+elsewhere-mode (&optional proc-name)
|
||||
"Major mode for editing S+3 source. See `ess-mode' for more help."
|
||||
(interactive)
|
||||
(setq ess-customize-alist S+elsewhere-customize-alist)
|
||||
(ess-mode S+elsewhere-customize-alist proc-name))
|
||||
|
||||
(defun S+elsewhere-transcript-mode ()
|
||||
"S-PLUS 3.x transcript mode."
|
||||
(interactive)
|
||||
(ess-transcript-mode S+elsewhere-customize-alist))
|
||||
|
||||
;; This REALLY shouldn't need an editing mode. Just a transcript and
|
||||
;; an inferior process handler.
|
||||
|
||||
(defun ess-change-alist (item value alist)
|
||||
"Modify ALIST to set VALUE to ITEM.
|
||||
If there is a pair whose car is ITEM, replace its cdr by VALUE.
|
||||
If there is not such pair, create new pair (ITEM . VALUE) and
|
||||
return new alist whose car is the new pair and cdr is ALIST.
|
||||
\[tomo's ELIS like function]"
|
||||
(let ((pair (assoc item alist)))
|
||||
(if pair
|
||||
(progn
|
||||
(setcdr pair value)
|
||||
alist)
|
||||
(cons (cons item value) alist))))
|
||||
|
||||
|
||||
(defun ess-select-alist-dialect (&optional dialect)
|
||||
"Query user for an ESS dialect and return the matching customize-alist."
|
||||
(interactive)
|
||||
(let* ((dialects '("R" "S+" "julia" "arc" "vst" "omg" "s3" "s4" "stata" "sp3" "sp4"
|
||||
"sqpe4" "sp5" "sqpe" "XLS" "SAS"))
|
||||
(dialect (or dialect
|
||||
(ess-completing-read "Dialect" dialects nil t))))
|
||||
(cond
|
||||
((string= dialect "julia") ess-julia-customize-alist)
|
||||
((string= dialect "arc") ARC-customize-alist)
|
||||
((string= dialect "vst") VST-customize-alist)
|
||||
((string= dialect "omg") OMG-customize-alist)
|
||||
((string= dialect "s3") S3-customize-alist)
|
||||
((string= dialect "s4") S4-customize-alist)
|
||||
((string= dialect "stata") STA-customize-alist)
|
||||
((string= dialect "R") ess-r-customize-alist)
|
||||
((string= dialect "sp3") S+3-customize-alist)
|
||||
((string= dialect "sp4") S+4-customize-alist)
|
||||
((string= dialect "sqpe4") Sqpe+4-customize-alist)
|
||||
((string= dialect "sp5") S+5-customize-alist)
|
||||
((string= dialect "S+") S+-customize-alist)
|
||||
((string= dialect "sqpe") Sqpe+-customize-alist)
|
||||
((string= dialect "XLS") XLS-customize-alist)
|
||||
((string= dialect "SAS") SAS-customize-alist);was S+elsewhere-customize-alist?
|
||||
(t S+elsewhere-customize-alist)
|
||||
)))
|
||||
|
||||
(defun ess-add-ess-process ()
|
||||
"Execute this command from within a buffer running a process to add
|
||||
the process to `ess-process-name-alist' and to make it the
|
||||
`ess-current-process-name'. This command will normally be run in a
|
||||
telnet buffer connected to another computer or in a shell or comint
|
||||
buffer on the local computer."
|
||||
(interactive)
|
||||
(let ((proc (get-buffer-process (buffer-name))))
|
||||
(if (not proc)
|
||||
(error "No process is associated with this buffer.")
|
||||
(set-process-filter proc 'inferior-ess-output-filter)
|
||||
(setq ess-current-process-name (process-name proc))
|
||||
(add-to-list 'ess-process-name-list
|
||||
(list ess-current-process-name)))))
|
||||
|
||||
(defvar ess-remote nil
|
||||
"Indicator, t in ess-remote buffers.")
|
||||
|
||||
(defun ess-remote (&optional proc-name dialect)
|
||||
"Execute this command from within a buffer running a process. It
|
||||
runs `ess-add-ess-process' to add the process 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 execute `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"
|
||||
|
||||
(interactive)
|
||||
(ess-add-ess-process)
|
||||
;; Need to select a remote-customize-alist
|
||||
(let ((ess-customize-alist (ess-select-alist-dialect dialect)))
|
||||
(ess-write-to-dribble-buffer
|
||||
(format "\n(ESS-remote): ess-dialect=%s, buf=%s\n" ess-dialect
|
||||
(current-buffer)))
|
||||
(ess-setq-vars-local ess-customize-alist)
|
||||
(inferior-ess-mode)
|
||||
(set (make-local-variable 'ess-remote) t)
|
||||
(setq ess-local-process-name (or proc-name ess-current-process-name))
|
||||
|
||||
(goto-char (point-max))
|
||||
|
||||
(when (equal ess-dialect "R")
|
||||
;; ugly fix for evn variable. What can we do :(
|
||||
(ess-eval-linewise (format "options(pager='%s')\n"
|
||||
(or inferior-ess-remote-pager inferior-ess-pager))
|
||||
nil nil nil 'wait)
|
||||
(inferior-ess-r-load-ESSR))
|
||||
|
||||
(when (equal ess-dialect "S+")
|
||||
(ess-command ess-S+--injected-code))
|
||||
|
||||
(when (equal ess-language "SAS")
|
||||
(font-lock-mode 0)
|
||||
(SAS-log-mode)
|
||||
(shell-mode)
|
||||
(setq buffer-read-only nil)
|
||||
(font-lock-mode 1))
|
||||
|
||||
(ess-process-put 'funargs-cache (make-hash-table :test 'equal))
|
||||
(ess-process-put 'funargs-pre-cache nil)
|
||||
(ess-load-extras)
|
||||
|
||||
(when inferior-ess-language-start
|
||||
(ess-eval-linewise inferior-ess-language-start
|
||||
nil nil nil 'wait-prompt))))
|
||||
|
||||
|
||||
; Provide package
|
||||
|
||||
(provide 'essd-els)
|
||||
|
||||
;;; essd-els.el ends here
|
||||
18
elpa/ess-20180701.100/etc/ESSR/BUILDESSR
Executable file
18
elpa/ess-20180701.100/etc/ESSR/BUILDESSR
Executable file
@@ -0,0 +1,18 @@
|
||||
#!/usr/bin/Rscript
|
||||
## -*- mode: R -*-
|
||||
## code to build ESSR environemnt.
|
||||
## Assume that current directory is etc/ESSR
|
||||
## run "./BUILDESSR destdir" to create ESSR_<version>.rda in destdir
|
||||
## where <version> is picked form ./VERSION file
|
||||
|
||||
|
||||
args <- commandArgs(TRUE)
|
||||
dir <- if(length(args)) args[[1]] else "."
|
||||
ver <- scan("./VERSION", what = "character", quiet = TRUE)
|
||||
rda_file <- sprintf("%s/ESSR_%s.rda", dir, ver)
|
||||
|
||||
## exactly as in inferior-ess-r-load-ESSR in ess-r-d.el
|
||||
source('./R/.load.R', local=TRUE)
|
||||
ESSR <- load.ESSR('./R/')
|
||||
|
||||
save(ESSR, file = rda_file)
|
||||
23
elpa/ess-20180701.100/etc/ESSR/LOADREMOTE
Normal file
23
elpa/ess-20180701.100/etc/ESSR/LOADREMOTE
Normal file
@@ -0,0 +1,23 @@
|
||||
## -*- mode: R -*-
|
||||
## loading code which is first sent to R on remote sessions
|
||||
local({
|
||||
curver <- '%s'
|
||||
## MM: ok for Windows?
|
||||
## VS: Should be fine (who is using win remote anyways?)
|
||||
.c.dir <- '~/.config/ESSR'
|
||||
verfile <- file.path(.c.dir, 'VERSION')
|
||||
envfile <- file.path(.c.dir, 'ESSR.rda')
|
||||
ver <- if(file.exists(verfile)) scan(verfile, what = "string") else "0.0"
|
||||
tryCatch({
|
||||
if(ver < curver) {
|
||||
url <- paste('https://vitalie.spinu.info/ESSR/ESSR_', curver, '.rda', sep = '')
|
||||
if(!file.exists(.c.dir))
|
||||
dir.create(.c.dir, recursive = TRUE)
|
||||
utils::download.file(url, envfile)
|
||||
cat(curver, file = verfile)
|
||||
}
|
||||
load(envfile)
|
||||
attach(ESSR)
|
||||
print(TRUE)
|
||||
} , error = function(e) print(FALSE))
|
||||
})
|
||||
138
elpa/ess-20180701.100/etc/ESSR/R/.basic.R
Normal file
138
elpa/ess-20180701.100/etc/ESSR/R/.basic.R
Normal file
@@ -0,0 +1,138 @@
|
||||
#### Essential functionality needed by ESS
|
||||
|
||||
## Should work on *all* vesions of R.
|
||||
## Do not use _ in names, nor :: , nor 1L etc, as they
|
||||
## cannot be parsed in old R versions
|
||||
|
||||
|
||||
## loading ESSR.rda might fail, so re-assign here:
|
||||
.ess.Rversion <-
|
||||
if( exists("getRversion", mode="function") ){
|
||||
getRversion()
|
||||
} else {
|
||||
paste(R.version$major, R.version$minor, sep=".")
|
||||
}
|
||||
|
||||
.ess.R.has.utils <- (.ess.Rversion >= "1.9.0")
|
||||
.ess.utils.name <- paste("package",
|
||||
if(.ess.Rversion >= "1.9.0") "utils" else "base",
|
||||
sep = ":")
|
||||
|
||||
## Instead of modern utils::help use one that works in R 1.0.0:
|
||||
.ess.findFUN <- get("find", .ess.utils.name)
|
||||
|
||||
|
||||
### HELP
|
||||
.ess.help <- function(..., help.type = getOption("help_type")) {
|
||||
if (is.null(help.type)) {
|
||||
help.type <- "text"
|
||||
}
|
||||
|
||||
## - get("help", ..) searching in global env works with devtools redefines
|
||||
## - Redefining to .ess.help this way is necessary because
|
||||
## utils:::print.help_files_with_topic (used internally when there's
|
||||
## more than one a package) uses the quoted call
|
||||
## MM: don't understand; more specifically?
|
||||
.ess.help <- function(...) {
|
||||
do.call(get("help", envir = .GlobalEnv), list(...))
|
||||
}
|
||||
|
||||
if (.ess.Rversion > "2.10") {
|
||||
## Abbreviating help_type to avoid underscore
|
||||
.ess.help(..., help = help.type)
|
||||
} else {
|
||||
.ess.help(..., htmlhelp = help.type == "html")
|
||||
}
|
||||
}
|
||||
|
||||
.ess.getHelpAliases <- function(){
|
||||
readrds <-
|
||||
if(.ess.Rversion >= '2.13.0') readRDS
|
||||
else .readRDS
|
||||
rds.files <- paste(searchpaths(), "/help/aliases.rds", sep = "")
|
||||
unlist(lapply(rds.files,
|
||||
function(f){
|
||||
if( file.exists(f) )
|
||||
try(names(readrds(f)))
|
||||
}),
|
||||
use.names = FALSE)
|
||||
}
|
||||
|
||||
### SOURCING
|
||||
.ess.eval <- function(string, visibly = TRUE, output = FALSE,
|
||||
max.deparse.length = 300,
|
||||
file = tempfile("ESS"), local = NULL)
|
||||
{
|
||||
if (is.null(local)) {
|
||||
local <- if (.ess.Rversion > '2.13') parent.frame() else FALSE
|
||||
}
|
||||
|
||||
## create FILE, put string into it. Then source.
|
||||
## arguments are like in source and .ess.source
|
||||
cat(string, file = file)
|
||||
## The following on.exit infloops in R 3.3.0
|
||||
## https://github.com/emacs-ess/ESS/issues/334
|
||||
## https://bugs.r-project.org/bugzilla/show_bug.cgi?id=16971
|
||||
## So we are cleanning it in .ess.source instead.
|
||||
## on.exit(file.remove(file))
|
||||
.ess.source(file, visibly = visibly, output = output,
|
||||
max.deparse.length = max.deparse.length,
|
||||
local = local, fake.source = TRUE)
|
||||
}
|
||||
|
||||
.ess.strip.error <- function(msg, srcfile) {
|
||||
pattern <- paste0(srcfile, ":[0-9]+:[0-9]+: ")
|
||||
sub(pattern, "", msg)
|
||||
}
|
||||
|
||||
.ess.file.remove <- function(file){
|
||||
if (base::file.exists(file)) base::file.remove(file)
|
||||
else FALSE
|
||||
}
|
||||
|
||||
.ess.source <- function(file, visibly = TRUE, output = FALSE,
|
||||
max.deparse.length = 300, local = NULL,
|
||||
fake.source = FALSE, keep.source = TRUE,
|
||||
message.prefix = "") {
|
||||
if (is.null(local)) {
|
||||
local <- if (.ess.Rversion > "2.13")
|
||||
parent.frame()
|
||||
else FALSE
|
||||
}
|
||||
|
||||
ss <-
|
||||
if (.ess.Rversion >= "2.8")
|
||||
base::source
|
||||
else function(..., keep.source) base::source(...)
|
||||
|
||||
on.exit({
|
||||
if (fake.source)
|
||||
.ess.file.remove(file)
|
||||
})
|
||||
|
||||
out <- ss(file, echo = visibly, local = local, print.eval = output,
|
||||
max.deparse.length = max.deparse.length, keep.source = keep.source)
|
||||
|
||||
if(!fake.source)
|
||||
cat(sprintf("%sSourced file %s\n", message.prefix, file))
|
||||
|
||||
## Return value for org-babel
|
||||
invisible(out$value)
|
||||
}
|
||||
|
||||
if(.ess.Rversion < "1.8")
|
||||
## (works for "1.7.2"): bquote() was new in 1.8.0
|
||||
bquote <- function(expr, where=parent.frame()){
|
||||
unquote <- function(e)
|
||||
if (is.pairlist(e)) as.pairlist(lapply(e, unquote))
|
||||
else if (length(e) <= 1) e
|
||||
else if (e[[1]] == as.name(".")) eval(e[[2]], where)
|
||||
else as.call(lapply(e, unquote))
|
||||
|
||||
unquote(substitute(expr))
|
||||
}
|
||||
|
||||
|
||||
## Local Variables:
|
||||
## eval: (ess-set-style 'RRR t)
|
||||
## End:
|
||||
58
elpa/ess-20180701.100/etc/ESSR/R/.load.R
Normal file
58
elpa/ess-20180701.100/etc/ESSR/R/.load.R
Normal file
@@ -0,0 +1,58 @@
|
||||
## Do not use _ in names, nor :: as they cannot be parsed in old R versions
|
||||
|
||||
## load .base.R and all other files into ESSR environment; then attach ESSR
|
||||
load.ESSR <- function(dir){
|
||||
.source <-
|
||||
if(any("keep.source" == names(formals(sys.source))))
|
||||
sys.source
|
||||
else
|
||||
function(..., keep.source) sys.source(...)
|
||||
|
||||
Rver <-
|
||||
if(exists("getRversion", mode="function")) getRversion()
|
||||
else paste(R.version$major, R.version$minor, sep=".")
|
||||
|
||||
oldR <- Rver <= "1.3.0"
|
||||
|
||||
ESSR <-
|
||||
if(oldR) ## really old library() revert order a bit
|
||||
attach(NULL, name = "ESSR")
|
||||
else if(length(nn <- names(formals(new.env))) && any(nn == "parent"))
|
||||
new.env(parent =
|
||||
if(Rver >= "1.9.0") getNamespace("utils")
|
||||
else .BaseNamespaceEnv)
|
||||
else
|
||||
new.env()
|
||||
|
||||
assign(".ess.Rversion", Rver, envir = ESSR)
|
||||
|
||||
ESSRver <- scan(paste(dirname(dir), "/VERSION", sep = ""),
|
||||
what = "character", quiet = TRUE)
|
||||
assign(".ess.ESSRversion", ESSRver, envir = ESSR)
|
||||
|
||||
|
||||
## .basic.R:
|
||||
try(.source(paste(dir,'/.basic.R', sep = ""), envir = ESSR, keep.source = FALSE))
|
||||
|
||||
## all others try(*) as it will fail in old R
|
||||
if(!oldR) # no sense if(oldR)
|
||||
for( f in dir(dir, pattern='\\.R$', full.names=TRUE) )
|
||||
try(.source(f, envir = ESSR, keep.source = FALSE))
|
||||
|
||||
if(Rver >= "2.4.0")
|
||||
attach(ESSR)
|
||||
else if(!oldR) { ## borrow from older library()
|
||||
e <- attach(NULL, name = "ESSR")
|
||||
.Internal(lib.fixup(ESSR, e))
|
||||
} else { ## if(oldR), use as in that old library():
|
||||
.Internal(lib.fixup(ESSR, .GlobalEnv))
|
||||
}
|
||||
|
||||
## BUILDESSR needs this:
|
||||
invisible(ESSR)
|
||||
}
|
||||
|
||||
|
||||
## Local Variables:
|
||||
## eval: (ess-set-style 'RRR t)
|
||||
## End:
|
||||
147
elpa/ess-20180701.100/etc/ESSR/R/completion.R
Normal file
147
elpa/ess-20180701.100/etc/ESSR/R/completion.R
Normal file
@@ -0,0 +1,147 @@
|
||||
## Do *NOT* use 1L -- it gives parse errors in historical versions of R
|
||||
|
||||
.ess_eval <- function(str, env = globalenv()) {
|
||||
## don't remove; really need eval(parse( here!!
|
||||
tryCatch(base::eval(base::parse(text=str), envir = env),
|
||||
error=function(e) NULL) ## also works for special objects containing @:$ etc
|
||||
}
|
||||
|
||||
.ess_nonull <- function(x, default = "") {
|
||||
if (is.null(x)) default
|
||||
else x
|
||||
}
|
||||
|
||||
.ess_srcref <- function(name, pkg) {
|
||||
if (!is.null(pkg) && requireNamespace(pkg)) {
|
||||
env <- asNamespace(pkg)
|
||||
} else {
|
||||
env <- globalenv()
|
||||
}
|
||||
fn <- .ess_eval(name, env)
|
||||
out <- "()\n"
|
||||
if (is.function(fn) && !is.null(utils::getSrcref(fn))) {
|
||||
file <- utils::getSrcFilename(fn, full.names = TRUE)
|
||||
if (file != "") {
|
||||
line <- .ess_nonull(utils::getSrcLocation(fn, "line"), 1)
|
||||
col <- .ess_nonull(utils::getSrcLocation(fn, "column"), 1)
|
||||
out <- sprintf("(\"%s\" %d %d)\n", file, line, col - 1)
|
||||
}
|
||||
}
|
||||
cat(out)
|
||||
}
|
||||
|
||||
.ess_fn_pkg <- function(fn_name) {
|
||||
fn <- .ess_eval(fn_name)
|
||||
env_name <- base::environmentName(base::environment(fn))
|
||||
out <- if (base::is.primitive(fn)) { # environment() does not work on primitives.
|
||||
"base"
|
||||
} else if (base::is.function(fn) && env_name != "R_GlobalEnv") {
|
||||
env_name
|
||||
} else {
|
||||
""
|
||||
}
|
||||
base::cat(base::sprintf("%s\n", out))
|
||||
}
|
||||
|
||||
.ess_funargs <- function(funname) {
|
||||
if(.ess.Rversion > '2.14.1') {
|
||||
## temporarily disable JIT compilation and errors
|
||||
comp <- compiler::enableJIT(0)
|
||||
op <- options(error=NULL)
|
||||
on.exit({ options(op); compiler::enableJIT(comp) })
|
||||
}
|
||||
fun <- .ess_eval(funname)
|
||||
if(is.function(fun)) {
|
||||
special <- grepl('[:$@[]', funname)
|
||||
args <- if(!special){
|
||||
fundef <- paste(funname, '.default',sep='')
|
||||
do.call('argsAnywhere', list(fundef))
|
||||
}
|
||||
|
||||
if(is.null(args))
|
||||
args <- args(fun)
|
||||
if(is.null(args))
|
||||
args <- do.call('argsAnywhere', list(funname))
|
||||
|
||||
fmls <- formals(args)
|
||||
fmls_names <- names(fmls)
|
||||
fmls <- gsub('\"', '\\\"',
|
||||
gsub("\\", "\\\\", as.character(fmls),fixed = TRUE),
|
||||
fixed=TRUE)
|
||||
args_alist <-
|
||||
sprintf("'(%s)",
|
||||
paste("(\"", fmls_names, "\" . \"", fmls, "\")",
|
||||
sep = '', collapse = ' '))
|
||||
allargs <-
|
||||
if(special) fmls_names
|
||||
else tryCatch(gsub('=', '', utils:::functionArgs(funname, ''), fixed = TRUE),
|
||||
error=function(e) NULL)
|
||||
allargs <- sprintf("'(\"%s\")",
|
||||
paste(allargs, collapse = '\" "'))
|
||||
envname <- environmentName(environment(fun))
|
||||
if(envname == "R_GlobalEnv") envname <- ""
|
||||
cat(sprintf('(list \"%s\" %s %s)\n',
|
||||
envname, args_alist, allargs))
|
||||
}
|
||||
}
|
||||
|
||||
.ess_get_completions <- function(string, end){
|
||||
if(.ess.Rversion > '2.14.1'){
|
||||
comp <- compiler::enableJIT(0)
|
||||
op <- options(error=NULL)
|
||||
on.exit({ options(op); compiler::enableJIT(comp) })
|
||||
}
|
||||
utils:::.assignLinebuffer(string)
|
||||
utils:::.assignEnd(end)
|
||||
utils:::.guessTokenFromLine()
|
||||
utils:::.completeToken()
|
||||
c(get('token', envir=utils:::.CompletionEnv),
|
||||
utils:::.retrieveCompletions())
|
||||
}
|
||||
|
||||
.ess_arg_help <- function(arg, func){
|
||||
op <- options(error=NULL)
|
||||
on.exit(options(op))
|
||||
fguess <-
|
||||
if(is.null(func)) get('fguess', envir=utils:::.CompletionEnv)
|
||||
else func
|
||||
findArgHelp <- function(fun, arg){
|
||||
file <- help(fun, try.all.packages=FALSE)[[1]]
|
||||
hlp <- utils:::.getHelpFile(file)
|
||||
id <- grep('arguments', tools:::RdTags(hlp), fixed=TRUE)
|
||||
if(length(id)){
|
||||
arg_section <- hlp[[id[[1]]]]
|
||||
items <- grep('item', tools:::RdTags(arg_section), fixed=TRUE)
|
||||
## cat('items:', items, fill=TRUE)
|
||||
if(length(items)){
|
||||
arg_section <- arg_section[items]
|
||||
args <- unlist(lapply(arg_section,
|
||||
function(el) paste(unlist(el[[1]][[1]], TRUE, FALSE), collapse='')))
|
||||
fits <- grep(arg, args, fixed=TRUE)
|
||||
## cat('args', args, 'fits', fill=TRUE)
|
||||
if(length(fits))
|
||||
paste(unlist(arg_section[[fits[1]]][[2]], TRUE, FALSE), collapse='')
|
||||
}
|
||||
}
|
||||
}
|
||||
funcs <- c(fguess, tryCatch(methods(fguess),
|
||||
warning=function(w) {NULL},
|
||||
error=function(e) {NULL}))
|
||||
if(length(funcs) > 1 && length(pos <- grep('default', funcs))){
|
||||
funcs <- c(funcs[[pos[[1]]]], funcs[-pos[[1]]])
|
||||
}
|
||||
i <- 1; found <- FALSE
|
||||
out <- 'No help found'
|
||||
while(i <= length(funcs) && is.null(out <-
|
||||
tryCatch(findArgHelp(funcs[[i]], arg),
|
||||
warning=function(w) {NULL},
|
||||
error=function(e) {NULL})
|
||||
))
|
||||
i <- i + 1
|
||||
cat('\n\n', as.character(out), '\n')
|
||||
};
|
||||
|
||||
|
||||
## Local Variables:
|
||||
## eval: (ess-set-style 'RRR t)
|
||||
## End:
|
||||
228
elpa/ess-20180701.100/etc/ESSR/R/debug.R
Normal file
228
elpa/ess-20180701.100/etc/ESSR/R/debug.R
Normal file
@@ -0,0 +1,228 @@
|
||||
### BREAKPOINTS
|
||||
.ESSBP. <- new.env()
|
||||
|
||||
### DEBUG/UNDEBUG
|
||||
.ess_find_funcs <- function(env)
|
||||
{
|
||||
objs <- ls(envir = env, all.names = TRUE)
|
||||
objs[sapply(objs, exists, envir = env,
|
||||
mode = 'function', inherits = FALSE)]
|
||||
}
|
||||
|
||||
.ess_all_functions <- function(packages = c(), env = NULL)
|
||||
{
|
||||
if(is.null(env))
|
||||
env <- parent.frame()
|
||||
empty <- emptyenv()
|
||||
coll <- list()
|
||||
for(p in packages){
|
||||
## package might not be attached
|
||||
try(
|
||||
{
|
||||
objNS <- .ess_find_funcs(asNamespace(p))
|
||||
objPKG <- .ess_find_funcs(as.environment(paste0('package:', p)))
|
||||
objNS <- setdiff(objNS, objPKG)
|
||||
if(length(objPKG))
|
||||
coll[[length(coll) + 1]] <- paste0(p, ':::', objNS)
|
||||
}, silent = TRUE)
|
||||
}
|
||||
while(!identical(empty, env)){
|
||||
coll[[length(coll) + 1]] <- .ess_find_funcs(env)
|
||||
env <- parent.env(env)
|
||||
}
|
||||
grep('^\\.ess', unlist(coll, use.names = FALSE),
|
||||
invert = TRUE, value = TRUE)
|
||||
}
|
||||
|
||||
.ess_dbg_flag_for_debuging <- function(fname){
|
||||
all <- utils::getAnywhere(fname)
|
||||
if(length(all$obj) == 0){
|
||||
msg <- sprintf("No functions names '%s' found", fname)
|
||||
} else {
|
||||
msg <- sprintf("Flagged '%s' for debugging", fname)
|
||||
tryCatch(lapply(all$obj, debug),
|
||||
error = function(e){
|
||||
msg <- paste0("Error: ", e$message)
|
||||
})
|
||||
}
|
||||
cat(msg)
|
||||
.ess_mpi_message(msg)
|
||||
}
|
||||
|
||||
.ess_dbg_getTracedAndDebugged <- function()
|
||||
{
|
||||
packages <- base::.packages()
|
||||
tr_state <- tracingState(FALSE)
|
||||
on.exit(tracingState(tr_state))
|
||||
generics <- methods::getGenerics()
|
||||
all_traced <- c()
|
||||
for(i in seq_along(generics)){
|
||||
genf <- methods::getGeneric(generics[[i]],
|
||||
package=generics@package[[i]])
|
||||
if(!is.null(genf)){ ## might happen !! v.2.13
|
||||
menv <- methods::getMethodsForDispatch(genf)
|
||||
traced <- unlist(eapply(menv, is, 'traceable', all.names=TRUE))
|
||||
if(length(traced) && any(traced))
|
||||
all_traced <- c(paste(generics[[i]],':',
|
||||
names(traced)[traced],sep=''), all_traced)
|
||||
tfn <- getFunction(generics[[i]], mustFind=FALSE, where = .GlobalEnv)
|
||||
if(!is.null(tfn ) && is(tfn, 'traceable')) # if the default is traced, it does not appear in the menv :()
|
||||
all_traced <- c(generics[[i]], all_traced)
|
||||
}
|
||||
}
|
||||
debugged_pkg <- unlist(lapply(packages, function(pkgname){
|
||||
ns <- asNamespace(pkgname)
|
||||
funcs <- .ess_find_funcs(ns)
|
||||
dbged <- funcs[unlist(lapply(funcs,
|
||||
function(f){
|
||||
isdebugged(get(f, envir = ns, inherits = FALSE))
|
||||
}))]
|
||||
if(length(dbged))
|
||||
paste0(pkgname, ':::`', dbged, '`')
|
||||
}))
|
||||
env <- parent.frame()
|
||||
## traced function don't appear here. Not realy needed and would affect performance.
|
||||
all <- .ess_all_functions(packages = packages, env = env)
|
||||
which_deb <- lapply(all, function(nm){
|
||||
## if isdebugged is called with string it doess find
|
||||
tryCatch(isdebugged(get(nm, envir = env)),
|
||||
error = function(e) FALSE)
|
||||
## try(eval(substitute(isdebugged(nm), list(nm = as.name(nm)))), silent = T)
|
||||
})
|
||||
debugged <- all[which(unlist(which_deb, recursive=FALSE, use.names=FALSE))]
|
||||
unique(c(debugged_pkg, debugged, all_traced))
|
||||
}
|
||||
|
||||
.ess_dbg_UntraceOrUndebug <- function(name, env = parent.frame())
|
||||
{
|
||||
tr_state <- tracingState(FALSE)
|
||||
on.exit(tracingState(tr_state))
|
||||
if( grepl('::', name) ){
|
||||
## foo:::bar name
|
||||
eval(parse(text = sprintf('undebug(%s)', name)))
|
||||
}else{
|
||||
## name is a name of a function to be undebugged or has a form
|
||||
## name:Class1#Class2#Class3 for traced methods
|
||||
name <- strsplit(name, ':', fixed = TRUE)[[1]]
|
||||
if( length(name)>1 ){
|
||||
## a method
|
||||
fun <- name[[1]]
|
||||
sig <- strsplit(paste(name[-1], collapse=''), '#', fixed=TRUE)[[1]]
|
||||
untrace(fun, signature = sig)
|
||||
}else{
|
||||
## function
|
||||
if( is(getFunction(name, where = parent.frame()), 'traceable') )
|
||||
untrace(name)
|
||||
else if(grepl(":", name))
|
||||
undebug(name)
|
||||
else
|
||||
undebug(get(name, envir = env))
|
||||
}}
|
||||
}
|
||||
|
||||
.ess_dbg_UndebugALL <- function(funcs)
|
||||
{
|
||||
tr_state <- tracingState(FALSE)
|
||||
on.exit(tracingState(tr_state))
|
||||
env <- parent.frame()
|
||||
invisible(lapply(funcs, function( nm ) {
|
||||
## ugly tryCatch, but there might be several names pointing to the
|
||||
## same function, like foo:::bar and bar. An alternative would be
|
||||
## to call .ess_dbg_getTracedAndDebugged each time but that might
|
||||
## be ery slow
|
||||
try(.ess_dbg_UntraceOrUndebug(nm, env = env), TRUE)
|
||||
}))
|
||||
}
|
||||
|
||||
### WATCH
|
||||
.ess_watch_expressions <- list()
|
||||
|
||||
.ess_watch_eval <- function()
|
||||
{
|
||||
env <- as.environment("ESSR")
|
||||
exps <- get('.ess_watch_expressions', envir = env)
|
||||
if(length(exps) == 0) {
|
||||
## using old style so this can be parsed by R 1.9.1 (e.g):
|
||||
cat('\n# Watch list is empty!\n',
|
||||
'# a append new expression',
|
||||
'# i insert new expression',
|
||||
'# k kill',
|
||||
'# e edit the expression',
|
||||
'# r rename',
|
||||
'# n/p navigate',
|
||||
'# u/d,U move the expression up/down',
|
||||
'# q kill the buffer',
|
||||
sep="\n")
|
||||
} else {
|
||||
.parent_frame <- parent.frame()
|
||||
.essWEnames <- allNames(exps)
|
||||
len0p <- !nzchar(.essWEnames)
|
||||
.essWEnames[len0p] <- seq_along(len0p)[len0p]
|
||||
for(i in seq_along(exps)) {
|
||||
cat('\n@---- ', .essWEnames[[i]], ' ',
|
||||
rep.int('-', max(0, 35 - nchar(.essWEnames[[i]]))), '-@\n', sep = '')
|
||||
cat(paste('@---:', deparse(exps[[i]][[1]])), ' \n', sep = '')
|
||||
tryCatch(print(eval(exps[[i]],
|
||||
envir = .parent_frame)),
|
||||
error = function(e) cat('Error:', e$message, '\n' ),
|
||||
warning = function(w) cat('warning: ', w$message, '\n' ))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.ess_watch_assign_expressions <- function(elist){
|
||||
assign(".ess_watch_expressions", elist, envir = as.environment("ESSR"))
|
||||
}
|
||||
|
||||
.ess_log_eval <- function(log_name)
|
||||
{
|
||||
env <- as.environment("ESSR")
|
||||
if(!exists(log_name, envir = env, inherits = FALSE))
|
||||
assign(log_name, list(), envir = env)
|
||||
log <- get(log_name, envir = env, inherits = FALSE)
|
||||
.essWEnames <- allNames(.ess_watch_expressions)
|
||||
cur_log <- list()
|
||||
.parent_frame <- parent.frame()
|
||||
for(i in seq_along(.ess_watch_expressions)) {
|
||||
capture.output( {
|
||||
cur_log[[i]] <-
|
||||
tryCatch(eval(.ess_watch_expressions[[i]]),
|
||||
envir = .parent_frame,
|
||||
error = function(e) paste('Error:', e$message, '\n'),
|
||||
warning = function(w) paste('warning: ', w$message, '\n'))
|
||||
if(is.null(cur_log[i][[1]]))
|
||||
cur_log[i] <- list(NULL)
|
||||
})
|
||||
}
|
||||
names(cur_log) <- .essWEnames
|
||||
assign(log_name, c(log, list(cur_log)), envir = env)
|
||||
invisible(NULL)
|
||||
}
|
||||
|
||||
.ess_package_attached <- function(pack_name){
|
||||
as.logical(match(paste0("package:", pack_name), search()))
|
||||
}
|
||||
|
||||
## magrittr debug_pipe
|
||||
.ess_pipe_browser <- function(x){
|
||||
if(is.list(x))
|
||||
evalq({
|
||||
browser(skipCalls = 2)
|
||||
x
|
||||
}, envir = x)
|
||||
else if(is.environment(x))
|
||||
## enclos argumentn has no effect for unclear reason, need to hack
|
||||
eval(bquote({
|
||||
x <- .(environment())
|
||||
browser(skipCalls = 2)
|
||||
x
|
||||
}), envir = x)
|
||||
else {
|
||||
browser(skipCalls = 0)
|
||||
x
|
||||
}
|
||||
}
|
||||
|
||||
## Local Variables:
|
||||
## eval: (ess-set-style 'RRR t)
|
||||
## End:
|
||||
131
elpa/ess-20180701.100/etc/ESSR/R/misc.R
Normal file
131
elpa/ess-20180701.100/etc/ESSR/R/misc.R
Normal file
@@ -0,0 +1,131 @@
|
||||
.ess_weave <- function(command, file, encoding = NULL){
|
||||
cmd_symb <- substitute(command)
|
||||
if (grepl('knit|purl', deparse(cmd_symb))) require(knitr)
|
||||
od <- getwd()
|
||||
on.exit(setwd(od))
|
||||
setwd(dirname(file))
|
||||
frame <- parent.frame()
|
||||
if (is.null(encoding))
|
||||
eval(bquote(.(cmd_symb)(.(file))), envir = frame)
|
||||
else
|
||||
eval(bquote(.(cmd_symb)(.(file), encoding = .(encoding))), envir = frame)
|
||||
}
|
||||
|
||||
.ess_knit <- function(file, output = NULL){
|
||||
library(knitr)
|
||||
frame <- parent.frame()
|
||||
od <- getwd()
|
||||
on.exit(setwd(od))
|
||||
setwd(dirname(file))
|
||||
## this bquote is really needed for data.table := operator to work correctly
|
||||
eval(bquote(knit(.(file), output = .(output))), envir = frame)
|
||||
}
|
||||
|
||||
.ess_sweave <- function(file, output = NULL){
|
||||
od <- getwd()
|
||||
frame <- parent.frame()
|
||||
on.exit(setwd(od))
|
||||
setwd(dirname(file))
|
||||
eval(bquote(Sweave(.(file), output = .(output))), envir = frame)
|
||||
}
|
||||
|
||||
## Users might find it useful. So don't prefix with .ess.
|
||||
htsummary <- function(x, hlength = 4, tlength = 4, digits = 3) {
|
||||
## fixme: simplify and generalize
|
||||
snames <- c("mean", "sd", "min", "max", "nlev", "NAs")
|
||||
d <- " "
|
||||
num_sumr <- function(x){
|
||||
c(f(mean(x, na.rm = TRUE)),
|
||||
f(sd(x, na.rm = TRUE)),
|
||||
f(min(x, na.rm = TRUE)),
|
||||
f(max(x, na.rm = TRUE)),
|
||||
d,
|
||||
f(sum(is.na(x), na.rm = TRUE)))
|
||||
}
|
||||
f <- function(x) format(x, digits = digits)
|
||||
|
||||
if (is.data.frame(x) | is.matrix(x)) {
|
||||
if (nrow(x) <= tlength + hlength){
|
||||
print(x)
|
||||
} else {
|
||||
if (is.matrix(x))
|
||||
x <- data.frame(unclass(x))
|
||||
## conversion needed, to avoid problems with derived classes suchs
|
||||
## as data.table
|
||||
h <- as.data.frame(head(x, hlength))
|
||||
t <- as.data.frame(tail(x, tlength))
|
||||
for (i in 1:ncol(x)) {
|
||||
h[[i]] <- f(h[[i]])
|
||||
t[[i]] <- f(t[[i]])
|
||||
}
|
||||
## summaries
|
||||
sumr <- sapply(x, function(c){
|
||||
if (is.logical(c))
|
||||
## treat logical as numeric; it's harmless
|
||||
c <- as.integer(c)
|
||||
if (is.numeric(c))
|
||||
num_sumr(c)
|
||||
else if (is.factor(c)) c(d, d, d, d, nlevels(c), sum(is.na(c)))
|
||||
else rep.int(d, length(snames))
|
||||
})
|
||||
sumr <- as.data.frame(sumr)
|
||||
row.names(sumr) <- snames
|
||||
dots <- rep("...", ncol(x))
|
||||
empty <- rep.int(" ", ncol(x))
|
||||
lines <- rep.int(" ", ncol(x))
|
||||
df <- rbind(h, ... = dots, t, `_____` = lines, sumr, ` ` = empty)
|
||||
print(df)
|
||||
}
|
||||
} else {
|
||||
cat("head(", hlength, "):\n", sep = "")
|
||||
print(head(x, hlength))
|
||||
if (length(x) > tlength + hlength){
|
||||
cat("\ntail(", tlength, "):\n", sep = "")
|
||||
print(tail(x, tlength))
|
||||
}
|
||||
cat("_____\n")
|
||||
if (is.numeric(x) || is.logical(x))
|
||||
print(structure(num_sumr(x), names = snames), quote = FALSE)
|
||||
else if (is.factor(x)){
|
||||
cat("NAs: ", sum(is.na(x), na.rm = TRUE), "\n")
|
||||
cat("levels: \n")
|
||||
print(levels(x))
|
||||
}
|
||||
}
|
||||
invisible(NULL)
|
||||
}
|
||||
|
||||
.ess_vignettes <- function(all=FALSE) {
|
||||
vs <- unclass(browseVignettes(all = all))
|
||||
vs <- vs[sapply(vs, length) > 0]
|
||||
|
||||
mat2elist <- function(mat) {
|
||||
if (!is.null(dim(mat))){
|
||||
apply(mat, 1, function(r)
|
||||
sprintf("(list \"%s\")",
|
||||
paste0(gsub("\"", "\\\\\"",
|
||||
as.vector(r[c("Title", "Dir", "PDF",
|
||||
"File", "R")])),
|
||||
collapse = "\" \"")))
|
||||
}
|
||||
}
|
||||
cat("(list \n",
|
||||
paste0(mapply(function(el, name) {
|
||||
sprintf("(list \"%s\" %s)",
|
||||
name, paste0(mat2elist(el), collapse = "\n"))
|
||||
},
|
||||
vs, names(vs)), collapse = "\n"), ")\n")
|
||||
}
|
||||
|
||||
.ess_Rd2txt <- function(rd) {
|
||||
fun <- tools::Rd2txt
|
||||
if (length(formals(fun)["stages"]))# newer R version
|
||||
fun(rd, stages = c("build", "install", "render"))
|
||||
else
|
||||
fun(rd)
|
||||
}
|
||||
|
||||
|
||||
## Local Variables:
|
||||
## eval: (ess-set-style 'RRR t)
|
||||
## End:
|
||||
23
elpa/ess-20180701.100/etc/ESSR/R/mpi.R
Normal file
23
elpa/ess-20180701.100/etc/ESSR/R/mpi.R
Normal file
@@ -0,0 +1,23 @@
|
||||
## simple Message Parsing Inerface
|
||||
|
||||
.ess_mpi_send <- function(head, ...){
|
||||
payload <- paste(..., sep = "")
|
||||
cat(sprintf("%s%s", head, payload))
|
||||
}
|
||||
|
||||
.ess_mpi_message <- function(msg){
|
||||
.ess_mpi_send("message", msg)
|
||||
}
|
||||
|
||||
.ess_mpi_y_or_n <- function(prompt, callback){
|
||||
.ess_mpi_send("y-or-n", prompt, callback)
|
||||
}
|
||||
|
||||
.ess_mpi_eval <- function(expr, callback){
|
||||
.ess_mpi_send("eval", expr, callback)
|
||||
}
|
||||
|
||||
.ess_mpi_error <- function(msg) {
|
||||
.ess_mpi_send("error", msg)
|
||||
}
|
||||
|
||||
410
elpa/ess-20180701.100/etc/ESSR/R/ns-eval.R
Normal file
410
elpa/ess-20180701.100/etc/ESSR/R/ns-eval.R
Normal file
@@ -0,0 +1,410 @@
|
||||
## NOTE ON S3 METHODS: New S3 methods are not automatically registered. You can
|
||||
## register them manually after you have inserted method_name.my_class into your
|
||||
## package environment using ess-developer, like follows:
|
||||
##
|
||||
## registerS3method("method_name", "my_class", my_package:::method_name.my_class)
|
||||
##
|
||||
## If an S3 methods already exists in a package, ESS-developer will do the right
|
||||
## thing.
|
||||
|
||||
## evaluate the STRING by saving into a file and calling .ess.ns_source
|
||||
.ess.ns_eval <- function(string, visibly, output, package,
|
||||
file = tempfile("ESSDev"), verbose = FALSE,
|
||||
fallback_env = NULL) {
|
||||
cat(string, file = file)
|
||||
on.exit(.ess.file.remove(file))
|
||||
.ess.ns_source(file, visibly, output, package = package,
|
||||
verbose = verbose, fake.source = TRUE,
|
||||
fallback_env = fallback_env)
|
||||
}
|
||||
|
||||
##' Source FILE into an environment. After having a look at each new object in
|
||||
##' the environment, decide what to do with it. Handles plain objects,
|
||||
##' functions, existing S3 methods, S4 classes and methods.
|
||||
##' @param fallback_env environment to assign objects which don't exist in the
|
||||
##' package namespace
|
||||
.ess.ns_source <- function(file, visibly, output, expr,
|
||||
package = "", verbose = FALSE,
|
||||
fake.source = FALSE,
|
||||
fallback_env = NULL) {
|
||||
oldopts <- options(warn = 2)
|
||||
on.exit(options(oldopts))
|
||||
pname <- paste("package:", package, sep = "")
|
||||
envpkg <- tryCatch(as.environment(pname), error = function(cond) NULL)
|
||||
if (is.null(envpkg))
|
||||
if (require(package, quietly = TRUE, character.only = TRUE)) {
|
||||
envpkg <- tryCatch(as.environment(pname), error = function(cond) NULL)
|
||||
} else {
|
||||
## no such package; source in current environment
|
||||
return(.ess.source(file, visibly = visibly,
|
||||
output = output, local = fallback_env,
|
||||
fake.source = fake.source))
|
||||
}
|
||||
|
||||
envns <- tryCatch(asNamespace(package), error = function(cond) NULL)
|
||||
if (is.null(envns))
|
||||
stop(gettextf("Can't find a namespace environment corresponding to package name '%s\"",
|
||||
package), domain = NA)
|
||||
|
||||
## Here we know that both envns and envpkg exists and are environments
|
||||
if (is.null(fallback_env))
|
||||
fallback_env <- .ess.ns_insert_essenv(envns)
|
||||
|
||||
## Get all Imports envs where we propagate objects
|
||||
pkgEnvNames <- Filter(.ess.is_package, search())
|
||||
packages <- lapply(pkgEnvNames, function(envName) substring(envName, 9))
|
||||
importsEnvs <- lapply(packages, function(pkgName) parent.env(asNamespace(pkgName)))
|
||||
|
||||
## Evaluate the FILE into new ENV
|
||||
env <- .ess.ns_evalSource(file, visibly, output, substitute(expr), package, fake.source)
|
||||
envPackage <- getPackageName(env, FALSE)
|
||||
if (nzchar(envPackage) && envPackage != package)
|
||||
warning(gettextf("Supplied package, %s, differs from package inferred from source, %s",
|
||||
sQuote(package), sQuote(envPackage)), domain = NA)
|
||||
|
||||
## Get all sourced objects, methods and classes
|
||||
allObjects <- objects(envir = env, all.names = TRUE)
|
||||
allObjects <- allObjects[!(allObjects %in% c(".cacheOnAssign", ".packageName"))]
|
||||
MetaPattern <- methods:::.TableMetaPattern()
|
||||
ClassPattern <- methods:::.ClassMetaPattern()
|
||||
allPlainObjects <- allObjects[!(grepl(MetaPattern, allObjects) |
|
||||
grepl(ClassPattern, allObjects))]
|
||||
allMethodTables <- allObjects[grepl(MetaPattern, allObjects)]
|
||||
allClassDefs <- allObjects[grepl(ClassPattern, allObjects)]
|
||||
|
||||
## PLAIN OBJECTS and FUNCTIONS:
|
||||
funcNs <- funcPkg <- newFunc <- newNs <- newObjects <- newPkg <- objectsNs <- objectsPkg <- character()
|
||||
dependentPkgs <- list()
|
||||
|
||||
for (this in allPlainObjects) {
|
||||
thisEnv <- get(this, envir = env)
|
||||
thisNs <- NULL
|
||||
|
||||
## NS
|
||||
if (exists(this, envir = envns, inherits = FALSE)){
|
||||
thisNs <- get(this, envir = envns)
|
||||
if(is.function(thisNs) || is.function(thisEnv)){
|
||||
if(is.function(thisNs) && is.function(thisEnv)){
|
||||
if(.ess.differs(thisEnv, thisNs)){
|
||||
environment(thisEnv) <- environment(thisNs)
|
||||
.ess.assign(this, thisEnv, envns)
|
||||
funcNs <- c(funcNs, this)
|
||||
if(exists(".__S3MethodsTable__.", envir = envns, inherits = FALSE)){
|
||||
S3_table <- get(".__S3MethodsTable__.", envir = envns)
|
||||
if(exists(this, envir = S3_table, inherits = FALSE))
|
||||
.ess.assign(this, thisEnv, S3_table)
|
||||
}
|
||||
}
|
||||
}else{
|
||||
newNs <- c(newNs, this)
|
||||
}
|
||||
}else{
|
||||
if(!identical(thisEnv, thisNs)){
|
||||
.ess.assign(this, thisEnv, envns)
|
||||
objectsNs <- c(objectsNs, this)
|
||||
}
|
||||
}
|
||||
}else{
|
||||
newNs <- c(newNs, this)
|
||||
}
|
||||
|
||||
## PKG
|
||||
if (exists(this, envir = envpkg, inherits = FALSE)){
|
||||
thisPkg <- get(this, envir = envpkg)
|
||||
if(is.function(thisPkg) || is.function(thisEnv)){
|
||||
if(is.function(thisPkg) && is.function(thisEnv)){
|
||||
if(.ess.differs(thisPkg, thisEnv)){
|
||||
environment(thisEnv) <- environment(thisPkg)
|
||||
.ess.assign(this, thisEnv, envpkg)
|
||||
funcPkg <- c(funcPkg, this)
|
||||
}
|
||||
}else{
|
||||
newPkg <- c(newPkg, this)
|
||||
}
|
||||
}else{
|
||||
if(!identical(thisPkg, thisEnv)){
|
||||
.ess.assign(this, thisEnv, envpkg)
|
||||
objectsPkg <- c(objectsPkg, this)
|
||||
}
|
||||
}
|
||||
}else{
|
||||
newPkg <- c(newPkg, this)
|
||||
}
|
||||
|
||||
if (!is.null(thisNs)) {
|
||||
isDependent <- .ess.ns_propagate(thisEnv, this, importsEnvs)
|
||||
newDeps <- stats::setNames(list(packages[isDependent]), this)
|
||||
dependentPkgs <- c(dependentPkgs, newDeps)
|
||||
}
|
||||
}
|
||||
|
||||
## deal with new plain objects and functions
|
||||
for(this in intersect(newPkg, newNs)){
|
||||
thisEnv <- get(this, envir = env, inherits = FALSE)
|
||||
if(exists(this, envir = fallback_env, inherits = FALSE)){
|
||||
thisGl <- get(this, envir = fallback_env)
|
||||
if(.ess.differs(thisEnv, thisGl)){
|
||||
if(is.function(thisEnv)){
|
||||
environment(thisEnv) <- envns
|
||||
newFunc <- c(newFunc, this)
|
||||
}else{
|
||||
newObjects <- c(newObjects, this)
|
||||
}
|
||||
.ess.assign(this, thisEnv, fallback_env)
|
||||
}
|
||||
}else{
|
||||
if(is.function(thisEnv)){
|
||||
environment(thisEnv) <- envns
|
||||
newFunc <- c(newFunc, this)
|
||||
}else{
|
||||
newObjects <- c(newObjects, this)
|
||||
}
|
||||
.ess.assign(this, thisEnv, fallback_env)
|
||||
}
|
||||
}
|
||||
|
||||
if(length(funcNs))
|
||||
objectsNs <- c(objectsNs, sprintf("FUN[%s]", paste(funcNs, collapse = ", ")))
|
||||
if(length(funcPkg))
|
||||
objectsPkg <- c(objectsPkg, sprintf("FUN[%s]", paste(funcPkg, collapse = ", ")))
|
||||
if(length(newFunc))
|
||||
newObjects <- c(newObjects, sprintf("FUN[%s]", paste(newFunc, collapse = ", ")))
|
||||
|
||||
## CLASSES
|
||||
classesPkg <- classesNs <- newClasses <- character()
|
||||
for(this in allClassDefs){
|
||||
newPkg <- newNs <- FALSE
|
||||
thisEnv <- get(this, envir = env)
|
||||
if(exists(this, envir = envpkg, inherits = FALSE)){
|
||||
if(!.ess.identicalClass(thisEnv, get(this, envir = envpkg))){
|
||||
.ess.assign(this, thisEnv, envir = envpkg)
|
||||
classesPkg <- c(classesPkg, this)
|
||||
}
|
||||
}else{
|
||||
newPkg <- TRUE
|
||||
}
|
||||
if(exists(this, envir = envns, inherits = FALSE)){
|
||||
if(!.ess.identicalClass(thisEnv, get(this, envir = envns))){
|
||||
.ess.assign(this, thisEnv, envir = envns)
|
||||
classesNs <- c(classesNs, this)
|
||||
}
|
||||
}else{
|
||||
newNs <- TRUE
|
||||
}
|
||||
if(newNs && newPkg){
|
||||
if(exists(this, envir = fallback_env, inherits = FALSE)){
|
||||
if(!.ess.identicalClass(thisEnv, get(this, envir = fallback_env))){
|
||||
.ess.assign(this, thisEnv, envir = fallback_env)
|
||||
newClasses <- c(newClasses, this)
|
||||
}
|
||||
}else{
|
||||
.ess.assign(this, thisEnv, envir = fallback_env)
|
||||
newClasses <- c(newClasses, this)
|
||||
}
|
||||
}
|
||||
}
|
||||
if(length(classesPkg))
|
||||
objectsPkg <- gettextf("CLS[%s]", sub(ClassPattern, "", paste(classesPkg, collapse = ", ")))
|
||||
if(length(classesNs))
|
||||
objectsNs <- gettextf("CLS[%s]", sub(ClassPattern, "", paste(classesNs, collapse = ", ")))
|
||||
if(length(newClasses))
|
||||
newObjects <- gettextf("CLS[%s]", sub(ClassPattern, "", paste(newClasses, collapse = ", ")))
|
||||
|
||||
## METHODS:
|
||||
## Method internals: For efficiency reasons setMethod() caches
|
||||
## method definition into a global table which you can get with
|
||||
## 'getMethodsForDispatch' function, and when a method is dispatched that
|
||||
## table is used. When ess-developer is used to source method definitions the
|
||||
## two copies of the functions are identical up to the environment. The
|
||||
## environment of the cached object has namespace:foo as it's parent but the
|
||||
## environment of the object in local table is precisely namspace:foo. This
|
||||
## does not cause any difference in evaluation.
|
||||
methodNames <- allMethodTables
|
||||
methods <- sub(methods:::.TableMetaPrefix(), "", methodNames)
|
||||
methods <- sub(":.*", "", methods)
|
||||
methodsNs <- newMethods <- character()
|
||||
for (i in seq_along(methods)){
|
||||
table <- methodNames[[i]]
|
||||
tableEnv <- get(table, envir = env)
|
||||
if(exists(table, envir = envns, inherits = FALSE)){
|
||||
inserted <- .ess.ns_insertMethods(tableEnv, get(table, envir = envns), envns)
|
||||
if(length(inserted))
|
||||
methodsNs <- c(methodsNs, gettextf("%s{%s}", methods[[i]], paste(inserted, collapse = ", ")))
|
||||
}else if(exists(table, envir = fallback_env, inherits = FALSE)){
|
||||
inserted <- .ess.ns_insertMethods(tableEnv, get(table, envir = fallback_env), envns)
|
||||
if(length(inserted))
|
||||
newMethods <- c(newMethods, gettextf("%s{%s}", methods[[i]], paste(inserted, collapse = ", ")))
|
||||
}else{
|
||||
.ess.assign(table, tableEnv, envir = fallback_env)
|
||||
newMethods <- c(newMethods, gettextf("%s{%s}", methods[[i]], paste(objects(envir = tableEnv, all.names = T), collapse = ", ")))
|
||||
}
|
||||
}
|
||||
if(length(methodsNs))
|
||||
objectsNs <- c(objectsNs, gettextf("METH[%s]", paste(methodsNs, collapse = ", ")))
|
||||
if(length(newMethods))
|
||||
newObjects <- c(newObjects, gettextf("METH[%s]", paste(newMethods, collapse = ", ")))
|
||||
|
||||
if (verbose) {
|
||||
msgs <- unlist(list(
|
||||
if(length(objectsPkg))
|
||||
sprintf("PKG: %s", paste(objectsPkg, collapse = ", ")),
|
||||
if(length(objectsNs))
|
||||
sprintf("NS: %s", paste(objectsNs, collapse = ", ")),
|
||||
if(length(dependentPkgs))
|
||||
.ess.ns_format_deps(dependentPkgs),
|
||||
if(length(newObjects)) {
|
||||
env_name <- .ess.ns_env_name(fallback_env)
|
||||
sprintf("%s: %s", env_name, paste(newObjects, collapse = ", "))
|
||||
}))
|
||||
if(length(msgs))
|
||||
.ess_mpi_message(paste(msgs, collapse = " "))
|
||||
|
||||
}
|
||||
|
||||
invisible(env)
|
||||
}
|
||||
|
||||
.ess.ns_insertMethods <- function(tableEnv, tablePkg, envns) {
|
||||
inserted <- character()
|
||||
for(m in ls(envir = tableEnv, all.names = T)){
|
||||
if(exists(m, envir = tablePkg, inherits = FALSE)){
|
||||
thisEnv <- get(m, envir = tableEnv)
|
||||
thisPkg <- get(m, envir = tablePkg)
|
||||
if(is(thisEnv, "MethodDefinition") && is(thisPkg, "MethodDefinition") &&
|
||||
.ess.differs(thisEnv@.Data, thisPkg@.Data)){
|
||||
environment(thisEnv@.Data) <- envns
|
||||
## environment of cached method in getMethodsForDispatch table is still env
|
||||
## not a problem as such, but might confuse users
|
||||
.ess.assign(m, thisEnv, tablePkg)
|
||||
inserted <- c(inserted, m)
|
||||
}}}
|
||||
inserted
|
||||
}
|
||||
|
||||
## our version of R's evalSource
|
||||
.ess.ns_evalSource <- function(file, visibly, output, expr, package = "",
|
||||
fake.source = FALSE) {
|
||||
envns <- tryCatch(asNamespace(package), error = function(cond) NULL)
|
||||
if(is.null(envns))
|
||||
stop(gettextf("Package \"%s\" is not attached and no namespace found for it",
|
||||
package), domain = NA)
|
||||
env <- new.env(parent = envns)
|
||||
env[[".packageName"]] <- package
|
||||
methods:::setCacheOnAssign(env, TRUE)
|
||||
if (missing(file))
|
||||
eval(expr, envir = env)
|
||||
else if (is(file, "character"))
|
||||
for (f in file) {
|
||||
.ess.source(f, local = env, visibly = visibly,
|
||||
output = output, keep.source = TRUE,
|
||||
max.deparse.length = 300,
|
||||
fake.source = fake.source,
|
||||
message.prefix = sprintf("[%s] ", package))
|
||||
}
|
||||
else stop(gettextf("Invalid file argument: got an object of class \"%s\"",
|
||||
class(file)[[1]]), domain = NA)
|
||||
env
|
||||
}
|
||||
|
||||
.ess.assign <- function(x, value, envir) {
|
||||
## Cannot add bindings to locked environments
|
||||
exists <- exists(x, envir = envir, inherits = FALSE)
|
||||
if (exists && bindingIsLocked(x, envir)) {
|
||||
unlockBinding(x, envir)
|
||||
assign(x, value, envir = envir, inherits = FALSE)
|
||||
op <- options(warn = -1)
|
||||
on.exit(options(op))
|
||||
lockBinding(x, envir)
|
||||
} else if (exists || !environmentIsLocked(envir)) {
|
||||
assign(x, value, envir = envir, inherits = FALSE)
|
||||
} else {
|
||||
warning(sprintf("Cannot assign `%s` in locked environment", x),
|
||||
call. = FALSE)
|
||||
}
|
||||
invisible(NULL)
|
||||
}
|
||||
|
||||
.ess.identicalClass <- function(cls1, cls2, printInfo = FALSE) {
|
||||
slots1 <- slotNames(class(cls1))
|
||||
slots2 <- slotNames(class(cls2))
|
||||
if(identical(slots1, slots2)){
|
||||
vK <- grep("versionKey", slots1)
|
||||
if(length(vK))
|
||||
slots1 <- slots2 <- slots1[-vK]
|
||||
out <- sapply(slots1, function(nm) identical(slot(cls1, nm), slot(cls2, nm)))
|
||||
if(printInfo) print(out)
|
||||
all(out)
|
||||
}
|
||||
}
|
||||
|
||||
.ess.differs <- function(f1, f2) {
|
||||
if (is.function(f1) && is.function(f2)){
|
||||
!(identical(body(f1), body(f2)) && identical(args(f1), args(f2)))
|
||||
}else
|
||||
!identical(f1, f2)
|
||||
}
|
||||
|
||||
.ess.is_package <- function(envName) {
|
||||
isPkg <- identical(substring(envName, 0, 8), "package:")
|
||||
isPkg && (envName != "package:base")
|
||||
}
|
||||
|
||||
.ess.ns_propagate <- function(obj, name, importsEnvs) {
|
||||
containsObj <- vapply(importsEnvs, logical(1), FUN = function(envs) {
|
||||
name %in% names(envs)
|
||||
})
|
||||
|
||||
lapply(importsEnvs[containsObj], .ess.assign,
|
||||
x = name, value = obj)
|
||||
|
||||
containsObj
|
||||
}
|
||||
|
||||
.ess.ns_format_deps <- function(dependentPkgs) {
|
||||
pkgs <- unique(unlist(dependentPkgs, use.names = FALSE))
|
||||
|
||||
lapply(pkgs, function(pkg) {
|
||||
isDep <- vapply(dependentPkgs, function(deps) pkg %in% deps, logical(1))
|
||||
pkgDependentObjs <- names(dependentPkgs[isDep])
|
||||
sprintf("DEP:%s [%s] ", pkg, paste(pkgDependentObjs, collapse = ", "))
|
||||
})
|
||||
}
|
||||
|
||||
.ess.ns_env_name <- function(env) {
|
||||
name <- environmentName(env)
|
||||
name <-
|
||||
if (name == "") "Local"
|
||||
else if (grepl("^essenv:", name)) "NEW"
|
||||
else name
|
||||
name
|
||||
}
|
||||
|
||||
.ess.ns_insert_essenv <- function(nsenv) {
|
||||
if (is.character(nsenv))
|
||||
nsenv <- base::asNamespace(nsenv)
|
||||
stopifnot(isNamespace(nsenv))
|
||||
if (identical(nsenv, .BaseNamespaceEnv))
|
||||
return(.GlobalEnv)
|
||||
essenv_name <- sprintf("essenv:%s", environmentName(nsenv))
|
||||
nsenv_parent <- parent.env(nsenv)
|
||||
if (environmentName(nsenv_parent) == essenv_name) {
|
||||
return(nsenv_parent)
|
||||
}
|
||||
essenv <- new.env(parent = nsenv_parent)
|
||||
attr(essenv, "name") <- essenv_name
|
||||
nssym <- ".__NAMESPACE__."
|
||||
nssym_val <- get(nssym, envir = nsenv, inherits = FALSE)
|
||||
unlockBinding(nssym, nsenv)
|
||||
nsenv[[nssym]] <- NULL
|
||||
on.exit({
|
||||
nsenv[[nssym]] <- nssym_val
|
||||
lockBinding(nssym, nsenv)
|
||||
})
|
||||
parent.env(nsenv) <- essenv
|
||||
essenv
|
||||
}
|
||||
|
||||
|
||||
## Local Variables:
|
||||
## eval: (ess-set-style 'RRR t)
|
||||
## End:
|
||||
26
elpa/ess-20180701.100/etc/ESSR/R/pkg.R
Normal file
26
elpa/ess-20180701.100/etc/ESSR/R/pkg.R
Normal file
@@ -0,0 +1,26 @@
|
||||
|
||||
.ess_keep <- function(.x, .f, ...) {
|
||||
is_true <- vapply(.x, .f, logical(1), ...)
|
||||
.x[is_true]
|
||||
}
|
||||
|
||||
.ess_devtools_functions <- function() {
|
||||
if (!requireNamespace("devtools")) {
|
||||
.ess_mpi_error("devtools is not installed")
|
||||
stop("internal error")
|
||||
}
|
||||
devtools_env <- asNamespace("devtools")
|
||||
exports <- getNamespaceExports("devtools")
|
||||
funs_exported <- as.list(devtools_env)[exports]
|
||||
|
||||
is_first_arg <- function(f, arg) {
|
||||
args <- names(formals(f))
|
||||
length(args) && args[[1]] == arg
|
||||
}
|
||||
|
||||
funs_pkg <- .ess_keep(funs_exported, is.function)
|
||||
funs_pkg <- .ess_keep(funs_pkg, is_first_arg, "pkg")
|
||||
funs_names <- sort(names(funs_pkg))
|
||||
|
||||
funs_names
|
||||
}
|
||||
1
elpa/ess-20180701.100/etc/ESSR/VERSION
Normal file
1
elpa/ess-20180701.100/etc/ESSR/VERSION
Normal file
@@ -0,0 +1 @@
|
||||
1.2.1
|
||||
69
elpa/ess-20180701.100/etc/Makefile
Normal file
69
elpa/ess-20180701.100/etc/Makefile
Normal file
@@ -0,0 +1,69 @@
|
||||
### Makefile - for scripts and icons (./etc) of ESS distribution.
|
||||
###
|
||||
|
||||
## Before making changes here, please take a look at Makeconf
|
||||
include ../Makeconf
|
||||
|
||||
# In ../Makefile we already construct the ESSR-VERSION file :
|
||||
# ESSR_VERSION = $(shell cat ESSR-VERSION)
|
||||
|
||||
#ETCFILES = $(wildcard BACKBUG[S5].BAT backbug[s5] *.S sas-keys.*)
|
||||
#ETCFILES = ESSR.R ess-developer.R SVN-REVISION *.S sas-keys.* ess-sas-sh-command
|
||||
ETCFILES_1 = *.S sas-keys.* ess-sas-sh-command *.jl
|
||||
isRELEASE=$(shell test -f .IS.RELEASE && echo 'yes')
|
||||
ifeq ($(isRELEASE),yes)
|
||||
ETCFILES = .IS.RELEASE git-ref $(ETCFILES_1)
|
||||
else
|
||||
ETCFILES = $(ETCFILES_1)
|
||||
endif
|
||||
|
||||
#ICONS = $(wildcard icons/*.xpm)
|
||||
ICONS = icons/*.xpm
|
||||
|
||||
ESSR_UTIL_FILES = ESSR/LOADREMOTE ESSR/VERSION
|
||||
ESSR_CODE_FILES = ESSR/R/*.R ESSR/R/.*.R
|
||||
# ESSR_tarball = ESSR_$(ESSR_VERSION).tar.gz
|
||||
|
||||
all: #ESSR-VERSION $(ESSR_tarball) library/ESSR
|
||||
|
||||
show-etc:
|
||||
@echo $(ETCFILES)
|
||||
ls -l $(ETCFILES)
|
||||
|
||||
|
||||
## happens "above" as it is need also in ../lisp/ :
|
||||
# ESSR-VERSION: $(ESSR_FILES)
|
||||
# (cd .. ; make etc/ESSR-VERSION)
|
||||
|
||||
# $(ESSR_tarball): $(ESSR_FILES)
|
||||
# R CMD build ESSR
|
||||
# library/ESSR: $(ESSR_tarball)
|
||||
# R CMD INSTALL -l library ESSR
|
||||
|
||||
# rel: $(ESSR_tarball)
|
||||
# [ x$$USER = xmaechler ] || (echo 'must be maechler'; exit 1 )
|
||||
# $(INSTALL) $(ESSR_tarball) $(UPLOAD_DIR)/pkgs/src/contrib
|
||||
|
||||
install :
|
||||
$(INSTALLDIR) $(ETCDIR)/icons
|
||||
$(INSTALLDIR) $(ETCDIR)/ESSR/R
|
||||
$(INSTALL) $(ETCFILES) $(ETCDIR)
|
||||
$(INSTALL) $(ICONS) $(ETCDIR)/icons
|
||||
$(INSTALL) $(ESSR_UTIL_FILES) $(ETCDIR)/ESSR
|
||||
$(INSTALL) $(ESSR_CODE_FILES) $(ETCDIR)/ESSR/R
|
||||
chmod +x $(ETCDIR)/ess-sas-sh-command
|
||||
|
||||
uninstall :
|
||||
-cd $(ETCDIR) && $(UNINSTALL) $(ETCFILES)
|
||||
-cd $(ETCDIR) && $(UNINSTALL) $(ICONS)
|
||||
-cd $(ETCDIR) && $(UNINSTALL) $(ESSR_UTIL_FILES)
|
||||
-cd $(ETCDIR) && $(UNINSTALL) $(ESSR_CODE_FILES)
|
||||
|
||||
|
||||
|
||||
## 'clean' shall remove *exactly* those things that are *not* in version control
|
||||
clean distclean:
|
||||
rm -rf SVN-REVISION
|
||||
## 'distclean' removes also things in VC (svn, when they are remade by "make"):
|
||||
# distclean: clean
|
||||
# rm -rf ESSR_*.tar.gz
|
||||
945
elpa/ess-20180701.100/etc/R-ESS-bugs.R
Normal file
945
elpa/ess-20180701.100/etc/R-ESS-bugs.R
Normal file
@@ -0,0 +1,945 @@
|
||||
#### File showing off things that go wrong or *went* wrong in the past #### -- with R-mode (mostly coded in ../lisp/ess-mode.el )
|
||||
|
||||
### NOTE: this file is indented with RRR style !!!!!
|
||||
### but do not change indentations anymore of anything in here:
|
||||
### expressions are written as we *want* them, not as ESS currently puts them
|
||||
|
||||
options(keep.source = FALSE) # so we see R's deparse() + print() indentation
|
||||
|
||||
|
||||
### --- 1 --------- extraneous comment chars : This seems fixed
|
||||
|
||||
## From: Robert Gentleman <rgentlem@fhcrc.org>
|
||||
## To: Martin Maechler <maechler@stat.math.ethz.ch>
|
||||
## Subject: ESS buglet
|
||||
## Date: Sun, 01 Jul 2007 21:41:24 -0700
|
||||
|
||||
## Hi Martin,
|
||||
## It seems that the following buglet exists (at least in what ever
|
||||
## version I am using)
|
||||
|
||||
##a silly comment
|
||||
##and a second one
|
||||
foo <- function(x=a, abc = list("def", a=1,3,3), more.args, and, bla,
|
||||
blu, bl,
|
||||
another, plus, yet.another, and_mbasd,
|
||||
lots = NULL,
|
||||
more = NULL,
|
||||
args = NULL) {
|
||||
x
|
||||
}
|
||||
|
||||
##- when the line before a function def is a comment, and adding args,
|
||||
##- then new lines, when generated have a comment char at the beginning of
|
||||
##- the line. It is slightly annoying as I have to remove the comment char.
|
||||
##-
|
||||
##- If I add a blank line after the comment line, then the problem does not
|
||||
##- occur.
|
||||
## and another ''anonymous'' function:
|
||||
function(x=a, abc = list("def", a=c(1,3,3)), more.args, and, bla, blu,
|
||||
blo, Abc,
|
||||
def,
|
||||
another, and_another, and_this) {
|
||||
...; ...
|
||||
}
|
||||
|
||||
## This is a "TRUE" example (from Matrix/tests/ ):
|
||||
NA.or.True <- function(x) is.na(x) | x
|
||||
|
||||
abc <- function(x, y, ...) this.is.just.a.one.liner(x,y, z=TRUE, ...)
|
||||
|
||||
## A more-liner function with no "{...}" -- this one even works (but not all!)
|
||||
mindiff <- function(df) df[which.min(df$diff),
|
||||
which.max(df$daff)]
|
||||
|
||||
## Two functions in one line - can I "send" just one of them? {no, not "simply"}
|
||||
f1 <- function(x) be.friendly(x, force=TRUE); f2 <- function(x,y) x*sin(pi*x)
|
||||
|
||||
### --- 2 ----------------------------------------------------------------
|
||||
### --- Suggestion (Jenny Brian): --> Create a (defun ess-eval-multiline .)
|
||||
## Here is useful valid R "test code":
|
||||
|
||||
## From 'example(plot.default)' :
|
||||
|
||||
Speed <- cars$speed
|
||||
Distance <- cars$dist
|
||||
plot(Speed, Distance, panel.first = grid(8,8),
|
||||
pch = 0, cex = 1.2, col = "blue")
|
||||
pp <- plot(Speed, Distance, panel.first = grid(8,8),
|
||||
pch = 0, cex = 1.2, col = "blue")
|
||||
plot(Speed, Distance,
|
||||
panel.first = lines(lowess(Speed, Distance), lty = "dashed"),
|
||||
pch = 0, cex = 1.2, col = "blue")
|
||||
|
||||
## Note: We now at least C-c C-c {ess-eval-function-or-paragraph-and-step}
|
||||
|
||||
### --- 3 ----------------------------------------------------------------
|
||||
###--- This one (from the Matrix package) is for testing ess-roxy...,
|
||||
## i.e., C-c C-o
|
||||
|
||||
## not exported but used more than once for "dimnames<-" method :
|
||||
## -- or do only once for all "Matrix" classes ??
|
||||
dimnamesGets <- function (x, value) {
|
||||
d <- dim(x)
|
||||
if (!is.list(value) || length(value) != 2 ||
|
||||
!(is.null(v1 <- value[[1]]) || length(v1) == d[1]) ||
|
||||
!(is.null(v2 <- value[[2]]) || length(v2) == d[2]))
|
||||
stop(gettextf("invalid dimnames given for '%s' object", class(x)))
|
||||
x@Dimnames <- list(if(!is.null(v1)) as.character(v1),
|
||||
if(!is.null(v2)) as.character(v2))
|
||||
x
|
||||
}
|
||||
|
||||
### --- 4 ----------------------------------------------------------------
|
||||
### continued statements
|
||||
a <- function(ch) {
|
||||
if(ch == Inf) {
|
||||
E.cond <- numeric(nb)
|
||||
}
|
||||
else {
|
||||
indic <- ifelse(jinf+1 <= 1 & jsup >= 1,1,0)
|
||||
E.cond <- ch*(-pbinom(jinf,ni,prb) + 1-pbinom(js.n,ni,prb)) +
|
||||
ifelse(ni == 1, prb*indic,
|
||||
mu*(pbinom(js.n-1,pmax(ni-1,1),prb) -
|
||||
pbinom(jinf-1,pmax(ni-1,1),prb))) / sV -
|
||||
### ^-- now here (better)
|
||||
mu/sV*(pbinom(js.n,ni,prb) - pbinom(jinf,ni,prb))
|
||||
### ^-- now here (ok; more indentation would also be ok)
|
||||
indic2 <- ifelse(jinf+1 <= 1 & jsup >= 1 & ni == 2,1,0)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
### --- 5 ----------------------------------------------------------------
|
||||
### The beginning of function is not found correctly, and hence
|
||||
### all "ess-*-function" (C-M-a, C-M-e, ...) fail:
|
||||
|
||||
setMeneric <-
|
||||
## It is clearly allowed to have comments here.
|
||||
## S version 4, and John Chambers in particular like it.
|
||||
##
|
||||
## BUG: M-C-e or M-C-a fails from ``here'' --
|
||||
## --- effectively because of ess-beginning-of-function fails
|
||||
## and that really relies on finding ess-function-pattern;
|
||||
## i.e., ess-R-function-pattern in ~/emacs/ess/lisp/ess-cust.el
|
||||
##
|
||||
function(name, def = NULL, group = list(), valueClass = character(),
|
||||
where = topenv(parent.frame()), genericFunction = NULL)
|
||||
{
|
||||
## comments in here are at least kept via "source" attribute
|
||||
if(exists(name, "package:base") &&
|
||||
typeof(get(name, "package:base")) != "closure") {
|
||||
FALSE
|
||||
}
|
||||
"ABC"
|
||||
}
|
||||
|
||||
### --- 6 ----------------------------------------------------------------
|
||||
## In one-liners without "{ ... }" body, the end-of-function is also
|
||||
## not correctly found:
|
||||
## Use C-M-e to see: In these two, the "end-of-function" is after
|
||||
## 'class' :
|
||||
## ---- these all work now (ESS version 5.3.8) :
|
||||
## no it doesn't VS[10-03-2012|ESS 12.03]:
|
||||
onelinerFails <- function(x, ...) class(x)
|
||||
|
||||
onelinerFailsToo <-
|
||||
function(x, ...)
|
||||
class(x)
|
||||
|
||||
onelinerWorks <- function(x, ...) { class(x) }
|
||||
|
||||
onelinerWorksToo <-
|
||||
function(x, ...) {
|
||||
class(x)
|
||||
}
|
||||
|
||||
### --- 7 ----------------------------------------------------------------
|
||||
## idem:
|
||||
## this has one line more before 'function' than "typically:"
|
||||
setMethod("[", signature(x = "dgTMatrix", i = "numeric", j = "missing",
|
||||
drop = "logical"),
|
||||
function (x, i, j, ..., drop) { ## select rows
|
||||
storage.mode(i) <- "integer"
|
||||
xi <- x@i + 1:1 # 1-indexing
|
||||
## ...................
|
||||
if (drop && any(nd == 1)) drop(as(x,"matrix")) else x
|
||||
})
|
||||
|
||||
### --- 8 ----------------------------------------------------------------
|
||||
## idem:
|
||||
## all bellow are ok VS[10-03-2012|ESS 12.03]:
|
||||
"dimnames<-.data.frame" <- function(x, value) {
|
||||
d <- dim(x)
|
||||
if(!is.list(value) || length(value) != 2
|
||||
|| d[[1]] != length(value[[1]])
|
||||
|| d[[2]] != length(value[[2]]))
|
||||
stop("invalid 'dimnames' given for data frame")
|
||||
row.names(x) <- as.character(value[[1]]) # checks validity
|
||||
names(x) <- as.character(value[[2]])
|
||||
x
|
||||
}
|
||||
|
||||
'[.foo' <- function(x, i, value)
|
||||
{
|
||||
###
|
||||
y <- x
|
||||
y[i] <- value
|
||||
y
|
||||
}
|
||||
|
||||
'[[.bar' <- function(x, i, value)
|
||||
{
|
||||
## bla bla bla
|
||||
y <- as.foo(x) ; y[[i]] <- value
|
||||
y
|
||||
}
|
||||
|
||||
"[<-.foobar" <- function(x,i,j,value) {
|
||||
## just something
|
||||
x
|
||||
}
|
||||
|
||||
"names<-.foobar" <- function(x, value) {
|
||||
## just something else
|
||||
x
|
||||
}
|
||||
|
||||
`[<-.data.frame` <- function(x, i, j, value)
|
||||
{
|
||||
nA <- nargs() # value is never missing, so 3 or 4.
|
||||
|
||||
###..........
|
||||
|
||||
class(x) <- cl
|
||||
x
|
||||
}
|
||||
|
||||
"[[<-.data.frame"<- function(x, i, j, value)
|
||||
{
|
||||
cl <- oldClass(x)
|
||||
## delete class: Version 3 idiom
|
||||
## to avoid any special methods for [[<-
|
||||
class(x) <- NULL
|
||||
|
||||
###...........
|
||||
|
||||
class(x) <- cl
|
||||
x
|
||||
}
|
||||
|
||||
|
||||
"$<-.data.frame" <- function(x, i, value)
|
||||
{
|
||||
cl <- oldClass(x)
|
||||
## delete class: Version 3 idiom
|
||||
## to avoid any special methods for [[<-
|
||||
|
||||
###...........
|
||||
|
||||
class(x) <- cl
|
||||
return(x)
|
||||
}
|
||||
|
||||
## swanky functions:
|
||||
`swank:quit-inspector` <- function(slimeConnection, sldbState) {
|
||||
resetInspector(slimeConnection)
|
||||
FALSE
|
||||
}
|
||||
|
||||
'swank:quit-inspector' <- function(slimeConnection, sldbState) {
|
||||
resetInspector(slimeConnection)
|
||||
FALSE
|
||||
}
|
||||
|
||||
|
||||
### --- 9 ----------------------------------------------------------------
|
||||
## VS[03-2012|12.03]:FIXED:
|
||||
|
||||
## From: "Sebastian P. Luque" <spluque@gmail.com>
|
||||
## To: ess-bugs@stat.math.ethz.ch
|
||||
## Subject: [ESS-bugs] ess-mode 5.12; `ess-indent-line' error
|
||||
## Date: Tue, 17 Aug 2010 13:08:25 -0500
|
||||
|
||||
## With the following input, and point on the line with "Table 8.3":
|
||||
## it was the parenthetical expression at the beg of line
|
||||
|
||||
if (require(lme4)) {
|
||||
## Model in p. 213
|
||||
(fm1 <- lmer(logFEV1 ~ age + log(height) + age0 + log(height0) + (age | id),
|
||||
data=fev1, subset=logFEV1 > -0.5))
|
||||
## Table 8.3
|
||||
VarCorr(fm1)$id * 100
|
||||
|
||||
## Model in p. 216
|
||||
(fm2 <- update(fm1, . ~ . - (age | id) + (log(height) | id)))
|
||||
}
|
||||
|
||||
### -----
|
||||
## hitting TAB (`ess-indent-command'), which calls `ess-indent-line' I get
|
||||
## the following trace:
|
||||
|
||||
## ....: (scan-error "Containing expression ends prematurely" 20 20)
|
||||
## scan-sexps(177 -2)
|
||||
## forward-sexp(-2)
|
||||
## ...
|
||||
## ess-continued-statement-p()
|
||||
## ......
|
||||
|
||||
## Interestingly, if the lines 2-4 are absent, then the problem is gone.
|
||||
## The problem is also there in ESS 5.11.
|
||||
|
||||
## I'll try to find out what is going on in `ess-continued-statement-p' but
|
||||
## given that I'm not very familiar with the stuff in ess-mode.el, I'm
|
||||
## submitting the report in case somebody can detect the issue sooner.
|
||||
|
||||
## another example: hitting Tab at }else line
|
||||
.essDev_differs <- function(f1, f2){
|
||||
if (is.function(f1) && is.function(f2)){
|
||||
!(identical(body(f1), body(f2)) && identical(args(f1), args(f2)))
|
||||
}else
|
||||
!identical(f1, f2)
|
||||
}
|
||||
|
||||
|
||||
|
||||
### --- 10 ---------------------------------------------------------------
|
||||
## indent at 0 after }else:
|
||||
## VS:[03-2012|12.03]:FIXED:
|
||||
if (is.function(f1) && is.function(f2)){
|
||||
!(identical(body(f1), body(f2)) && identical(args(f1), args(f2)))
|
||||
}else
|
||||
!identical(f1, f2)
|
||||
|
||||
|
||||
### --- 11 ---------------------------------------------------------------
|
||||
## --------------- C-c C-c was finding the wrong "beginning of function"
|
||||
## [:FIXED:, 2011-05-28]
|
||||
foobar <- function(...) {}
|
||||
rm(list=ls())
|
||||
|
||||
##--------> consequence of the above experiments:
|
||||
## the 2nd form is numerically "uniformly better" than the first
|
||||
##--------> 2011-05-27: Change Frank's psiInv() to
|
||||
## psiInv = function(t,theta)
|
||||
## -log1p(exp(-theta)*expm1((1-t)*theta)/expm1(-theta))
|
||||
|
||||
### --- 12 ---------------------------------------------------------------
|
||||
##--- In the following block, in the first line, C-c C-c does *NOT* behave
|
||||
## VS[10-03-2012|ESS 12.03]: works fine for me:
|
||||
th <- 48 # now do ls() and see what happened ... the horror !!!
|
||||
d <- 3
|
||||
cpF <- list("Frank", list(th, 1:d))
|
||||
cop <- acF <- cpF$copula
|
||||
|
||||
### --- 13 ---------------------------------------------------------------
|
||||
## VS[05-05-2012|ESS 12.04]: looks like :FIXED:
|
||||
|
||||
## From: Aleksandar Blagotic <aca.blagotic@gmail.com>
|
||||
## To: <ess-help@stat.math.ethz.ch>
|
||||
## Subject: [ESS] R-mode: forward-sexp: Scan error: "Unbalanced parentheses"
|
||||
## Date: Tue, 6 Dec 2011 01:24:11 +0100
|
||||
#
|
||||
## Let's presuppose that I have a function like this:
|
||||
#
|
||||
fn <- function(x, ...){
|
||||
re <- "^#{1,6} [[:print:]]+$"
|
||||
grepl(re, x, ...)
|
||||
}
|
||||
## As soon as I put my cursor at the end of the line with regexp, and
|
||||
## press RET, I get this error:
|
||||
|
||||
## forward-sexp: Scan error: "Unbalanced parentheses"
|
||||
##
|
||||
##-------
|
||||
## Rodney S: I can reproduce it ...
|
||||
## Martin M: I can NOT reproduce it, neither with 'emacs -Q';
|
||||
## tried both ESS 5.14 and ESS from svn
|
||||
## VS[03-2012|12.03]: Cannot reproduce it either, solved?
|
||||
|
||||
|
||||
### --- 14 ---------------------------------------------------------------
|
||||
## check the behavior of ess-arg-function-offset-new-line
|
||||
|
||||
a <- some.function(
|
||||
arg1,
|
||||
arg2)
|
||||
## ^--- RRR has ess-arg-function-offset-new-line (4) ==> should indent here
|
||||
|
||||
a <- some.function(arg1,
|
||||
arg2)
|
||||
## ^--- here
|
||||
|
||||
|
||||
### --- 15 --------------------------------------------------------------
|
||||
## VS[05-05-2012|ESS 12.04]:FIXED:
|
||||
## indentation of the 3rd line is wrong
|
||||
for(s in seq(10, 50, len = 5))
|
||||
for(a in seq(.5, 1, len = 5))
|
||||
pt_dif_plot(s, a)
|
||||
## ^-- here
|
||||
|
||||
### --- 16 ----
|
||||
## VS[05-05-2012|ESS 12.04]:FIXED:
|
||||
## MM[2014-04-28]: added '}' before else (=> "{" after if(.))
|
||||
## so parse(<file>) works at all!
|
||||
## Gives error unbalanced para at else lines and indentation is wrong
|
||||
## error: Point is not in a function according to 'ess-function-pattern'.
|
||||
getOrCreateForm <- function(bindName, whereEnv)
|
||||
if(exists(bindName, envir = get(".forms", envir = whereEnv))) {
|
||||
get(bindName, envir = whereEnv)
|
||||
### ^-- here
|
||||
} else
|
||||
new("protoForm")
|
||||
### ^-- here
|
||||
|
||||
|
||||
|
||||
parentContainer <-
|
||||
if(is.null(.getPrototype(.Object@host))) { emptyenv()
|
||||
} else sdf
|
||||
### ^-- here
|
||||
|
||||
parentContainer <-
|
||||
if(is.null(.getPrototype(.Object@host))) emptyenv()
|
||||
else sdf
|
||||
### ^-- here
|
||||
|
||||
### --- 17 ---
|
||||
## Indentation ----- "expression" is special
|
||||
expremmion <- c(1, 3,
|
||||
9876)# was always ok
|
||||
## Had wrong indentation here:
|
||||
expression <- c(2343,
|
||||
23874, 239487)
|
||||
|
||||
## or here:
|
||||
foo <- function(x) {
|
||||
expression <- c(2343,
|
||||
23874, 239487)
|
||||
10 + expression
|
||||
}
|
||||
|
||||
## Where as here, we *do* want the indentation to
|
||||
## *NOT* go all the way to the right:
|
||||
|
||||
{
|
||||
my.long.Expression <- expression(
|
||||
x[a[j]] == exp(theta[1] + theta[2]^2),
|
||||
x[b[i]] == sin(theta[3] ~~ theta[4])
|
||||
)
|
||||
ausdruck <- expression
|
||||
my.long.Expr...... <- ausdruck(
|
||||
x[a[j]] == exp(theta[1] + theta[2]^2),
|
||||
)
|
||||
}
|
||||
|
||||
## VS[18-08-2012]: redundant feature. This is a feature for long subexpressions
|
||||
## imidiately folowing new line. Documented in ess-arg-function-offset-new-line
|
||||
|
||||
### --- 18 ---
|
||||
## M-C-a (beginning of function)
|
||||
## ----- anywhere inside the following function, M-C-a must go to beginning
|
||||
Ops.x.x <- function(e1, e2)
|
||||
{
|
||||
d <- dimCheck(e1,e2)
|
||||
if((dens1 <- extends(c1 <- class(e1), "denseMatrix")))
|
||||
gen1 <- extends(c1, "generalMatrix")
|
||||
if((dens2 <- extends(c2 <- class(e2), "denseMatrix")))
|
||||
gen2 <- extends(c2, "generalMatrix")
|
||||
if(dens1 && dens2) { ## both inherit from ddense*
|
||||
geM <- TRUE
|
||||
if(!gen1) {
|
||||
if(!gen2) { ## consider preserving "triangular" / "symmetric"
|
||||
geM <- FALSE
|
||||
le <- prod(d)
|
||||
isPacked <- function(x) length(x@x) < le
|
||||
}
|
||||
}
|
||||
## now, in all cases @x should be matching & correct {only "uplo" part is used}
|
||||
r <- callGeneric(e1@x, e2@x)
|
||||
if(geM)
|
||||
new(paste0(.M.kind(r), "geMatrix"), x = r, Dim = d, Dimnames = dimnames(e1))
|
||||
else
|
||||
new(paste0(.M.kind(r), Mclass), x = r, Dim = d, .....)
|
||||
}
|
||||
else {
|
||||
r <- ....
|
||||
|
||||
## criterion "2 * nnz(.) < ." as in sparseDefault() in Matrix() [./Matrix.R] :
|
||||
if(2 * nnzero(r, na.counted = TRUE) < prod(d))
|
||||
as(r, "sparseMatrix") else r
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
### --- 19 ---
|
||||
## indentation with regexp (bug in ess-backward-to-noncomment)
|
||||
parse_roc <- function(lines, match = "^\\s*+\' ?") {
|
||||
lines <- lines[str_detect(lines, match)]
|
||||
if (length(lines) == 0) return(NULL)
|
||||
### ^-- here (2014-11: fixed)
|
||||
}
|
||||
|
||||
|
||||
### --- 20 ---
|
||||
## continuation indentation must be consistent in/out {}:
|
||||
|
||||
{
|
||||
a <- ggplot(data = overtime.by.month,
|
||||
aes(x="", y=Percent, fill = Overtime)) +
|
||||
geom_bar(width = 1) +
|
||||
xlab('') +
|
||||
ylab(sub.txt) +
|
||||
labs(title = title.txt) +
|
||||
facet_wrap(~Year.Month)
|
||||
}
|
||||
|
||||
a <- ggplot(data = overtime.by.month,
|
||||
aes(x="", y=Percent, fill = Overtime)) +
|
||||
geom_bar(width = 1) +
|
||||
xlab('') +
|
||||
ylab(sub.txt) +
|
||||
labs(title = title.txt) +
|
||||
facet_wrap(~Year.Month)
|
||||
### ^-- face_wrap must be here
|
||||
|
||||
|
||||
### --- 20b ---
|
||||
## From https://github.com/emacs-ess/ESS/issues/120
|
||||
|
||||
mean(rnorm(100, mean = runif(1, 1, 10)), na.rm =TRUE) +
|
||||
2
|
||||
## ^--- 2 is here
|
||||
|
||||
mean(rnorm(100, mean = runif(1, 1, 10)),
|
||||
na.rm =TRUE) +
|
||||
2
|
||||
## ^--- 2 is here
|
||||
|
||||
mean(rnorm(100,
|
||||
mean = runif(1, 1, 10)), na.rm=TRUE) +
|
||||
2
|
||||
## ^--- 2 is here
|
||||
|
||||
### --- 21 ---
|
||||
|
||||
## From: Marius Hofert <marius.hofert@math.ethz.ch>
|
||||
## Date: Fri, 15 Mar 2013 21:00:45 +0100
|
||||
## Hi,
|
||||
## The following bug happens in ESS 12.09-2 [rev. 5395 (2013-01-10)]. Put the
|
||||
## cursor in the line before the function head and hit C-c C-c.
|
||||
|
||||
foo <- function(x)
|
||||
x # bar
|
||||
x <- 1:10
|
||||
|
||||
## I'll see
|
||||
## > + > [1] 1 2 3 4 5 6 7 8 9 10
|
||||
## ESS 15.03: Error in eval(expr, .... : object 'x' not found
|
||||
|
||||
foo <- function(x) x*x
|
||||
bar <- function(y) y
|
||||
## via C-c C-c leads to "Error: object 'bar' not found". -- fixed
|
||||
|
||||
|
||||
### --- 22 ----
|
||||
## now correct indentation (inspite of # {was same reason as 19})
|
||||
if (!grepl("#", x))
|
||||
return(res)
|
||||
|
||||
### --- 23 ----
|
||||
### three ways to indent closing parent depending on context:
|
||||
foo <-
|
||||
function_call(
|
||||
a,
|
||||
b,
|
||||
c
|
||||
)
|
||||
### ^-- ) is here now
|
||||
|
||||
foo <- function_call(
|
||||
a,
|
||||
b,
|
||||
c
|
||||
)
|
||||
### ")" is at column 0
|
||||
|
||||
foo <- function_call(a,
|
||||
b,
|
||||
c
|
||||
)
|
||||
### ^-- ) is here
|
||||
|
||||
### --- 24 ---
|
||||
### shift comma in function calls
|
||||
|
||||
foo <- function_call(a
|
||||
, b
|
||||
, c
|
||||
### ^-- c is here
|
||||
)
|
||||
### ^-- ) is here
|
||||
|
||||
### --- 25 ---
|
||||
## if/else in function calls and nested
|
||||
|
||||
function_call(abc =
|
||||
if (test)
|
||||
do_something
|
||||
else
|
||||
do_something_else)
|
||||
|
||||
function_call(
|
||||
abc =
|
||||
if (test)
|
||||
do_something
|
||||
else
|
||||
do_something_else)
|
||||
|
||||
|
||||
function_call(abc = if (test)
|
||||
do_something
|
||||
else
|
||||
do_something_else)
|
||||
|
||||
## real example is smooth.spline() source code [still (2015-04-08) wrong / bug!]
|
||||
ss <- function (x, all.knots, nknots, ...)
|
||||
{
|
||||
if (all.knots) {
|
||||
if (!missing(nknots) && !is.null(nknots))
|
||||
warning("'all.knots' is TRUE; 'nknots' specification is disregarded")
|
||||
nknots <- nx
|
||||
} else if (is.null(nknots)) # <- for back compatibility
|
||||
nknots <- .nknots.smspl(nx)
|
||||
else {
|
||||
### ^ want 'else' there
|
||||
if (is.function(nknots))
|
||||
nknots <- nknots(nx)
|
||||
else if (!is.numeric(nknots))
|
||||
stop("'nknots' must be numeric (in {1,..,n})")
|
||||
if (nknots < 1)
|
||||
stop("'nknots' must be at least 1")
|
||||
else if (nknots > nx)
|
||||
stop("cannot use more inner knots than unique 'x' values")
|
||||
}
|
||||
### ^-- want '}' there
|
||||
}
|
||||
|
||||
## "if" conditional is an exception of the continuation rules:
|
||||
## Here, we do not want subsequently further indentation of the c1 || c2 || c3
|
||||
## part:
|
||||
t2 <- function(x) {
|
||||
if(long.expression.of.some.size(x, pi) ||
|
||||
another.longish.expression(sin(x)*exp(x)) ||
|
||||
a.third.condition.under.which.A.is.chosen)
|
||||
### ^-- here
|
||||
A
|
||||
else
|
||||
B
|
||||
}
|
||||
|
||||
|
||||
r <-
|
||||
(some.function (x, 2342) +
|
||||
another.f (x^3) + sdfsdf - sdfsdf +
|
||||
and(x) + the(x) - last(x)*part(3))
|
||||
|
||||
|
||||
### --- 26 ----
|
||||
## This is formally correct R, though help(parse) mentions the line-length limit of
|
||||
## 4095 __when reading from the console__
|
||||
## ESS gives syntax errors ("Error: unexpected ','" ...) when evaluating this
|
||||
## because line length >= 4096 :
|
||||
##
|
||||
x <- c(1, 3.075819, 1.515999, 2.156169, 1.480742, 1.765485, 1.460206, 1.603707, 1.427429, 1.504712, 1.334528, 1.48297, 1.355308, 1.383867, 1.319241, 1.36065, 1.307467, 1.365596, 1.255259, 1.352741, 1.239381, 3.15342, 1.799889, 2.258497, 1.688312, 1.906779, 1.548203, 1.724785, 1.500873, 1.573442, 1.417137, 1.540805, 1.395945, 1.472596, 1.394247, 1.377487, 1.337394, 1.369354, 1.333378, 1.3181, 1.313813, 1.315528, 2.12777, 2.718898, 1.993509, 2.220433, 1.820585, 1.97782, 1.672455, 1.770151, 1.587478, 1.685352, 1.539295, 1.584536, 1.499487, 1.50702, 1.41952, 1.449058, 1.393042, 1.432999, 1.369964, 1.400997, 1.333824, 2.950549, 2.145387, 2.382224, 1.927077, 2.032489, 1.8371, 1.877833, 1.710891, 1.756053, 1.620778, 1.657761, 1.558978, 1.56257, 1.508633, 1.534406, 1.46709, 1.468734, 1.432529, 1.455283, 1.386975, 1.417532, 2.229573, 2.494447, 2.016117, 2.190061, 1.877996, 1.978964, 1.767284, 1.836948, 1.677372, 1.743316, 1.616383, 1.655964, 1.55484, 1.594831, 1.502185, 1.543723, 1.467005, 1.491123, 1.44402, 1.446915, 1.401578, 2.580264, 2.109121, 2.240741, 1.944719, 2.043397, 1.821808, 1.89725, 1.748788, 1.786988, 1.659333, 1.697012, 1.610622, 1.616503, 1.538529, 1.562024, 1.499964, 1.529344, 1.474519, 1.483264, 1.441552, 1.434448, 2.165233, 2.320281, 2.007836, 2.086471, 1.884052, 1.950563, 1.76926, 1.843328, 1.708941, 1.741039, 1.627206, 1.644755, 1.580563, 1.593402, 1.527312, 1.568418, 1.501462, 1.502542, 1.464583, 1.467921, 1.431141, 2.340443, 2.048262, 2.161097, 1.926082, 1.995422, 1.81446, 1.853165, 1.738533, 1.784456, 1.679444, 1.696463, 1.612931, 1.629483, 1.548186, 1.580026, 1.52198, 1.531111, 1.482914, 1.484824, 1.442726, 1.447838, 2.093386, 2.185793, 1.948989, 2.02804, 1.867137, 1.907732, 1.771923, 1.800413, 1.691612, 1.720603, 1.642705, 1.649769, 1.589028, 1.598955, 1.539759, 1.55096, 1.503965, 1.50703, 1.471349, 1.469791, 1.436959, 2.218315, 1.997369, 2.041128, 1.887059, 1.928524, 1.79626, 1.827538, 1.716748, 1.735696, 1.658329, 1.664211, 1.599286, 1.611511, 1.553925, 1.562637, 1.516805, 1.529894, 1.476064, 1.482474, 1.453253, 1.458467, 2.0247, 2.07899, 1.921976, 1.949376, 1.824629, 1.851671, 1.744713, 1.765647, 1.683525, 1.685592, 1.625113, 1.624961, 1.571921, 1.581223, 1.535257, 1.537464, 1.497165, 1.504879, 1.468682, 1.469319, 1.448344, 2.092315, 1.941412, 1.969843, 1.844093, 1.866133, 1.766145, 1.783829, 1.703613, 1.709714, 1.646078, 1.654264, 1.594523, 1.598488, 1.545105, 1.555356, 1.514627, 1.521353, 1.483958, 1.487677, 1.449191, 1.459721, 1.958987, 1.985144, 1.87739, 1.879643, 1.786823, 1.799642, 1.720015, 1.724688, 1.663539, 1.662997, 1.609267, 1.615124, 1.56746, 1.562026, 1.520586, 1.52503, 1.493008, 1.502496, 1.471983, 1.468546, 1.435064, 1.994706, 1.880348, 1.894254, 1.805827, 1.815965, 1.744296, 1.743389, 1.665481, 1.681644, 1.624466, 1.626109, 1.584028, 1.5818, 1.54376, 1.547237, 1.504878, 1.515087, 1.479032, 1.47936, 1.450758, 1.45073, 1.892685, 1.91087, 1.825301, 1.827176, 1.745363, 1.746115, 1.693373, 1.701692, 1.648247, 1.637112, 1.594648, 1.592013, 1.554849, 1.55013, 1.522186, 1.520901, 1.492606, 1.493072, 1.460868, 1.46733, 1.440956, 1.92771, 1.835696, 1.841979, 1.775991, 1.766092, 1.703807, 1.708791, 1.654985, 1.655917, 1.602388, 1.611867, 1.570765, 1.573368, 1.53419, 1.529033, 1.506767, 1.503596, 1.481126, 1.471806, 1.444917, 1.451682, 1.850262, 1.855034, 1.778997, 1.789995, 1.718871, 1.717326, 1.667357, 1.666291, 1.619743, 1.631475, 1.582624, 1.58766, 1.546302, 1.545063, 1.512222, 1.517888, 1.489127, 1.487271, 1.466722, 1.463618, 1.444137, 1.8709, 1.794033, 1.80121, 1.736376, 1.740201, 1.673776, 1.682541, 1.638153, 1.642294, 1.604417, 1.597721, 1.559534, 1.559108, 1.533942, 1.529348, 1.499517, 1.501586, 1.473147, 1.473031, 1.457615, 1.452348, 1.805753, 1.812952, 1.746549, 1.747222, 1.696924, 1.694957, 1.652157, 1.650568, 1.607807, 1.613666, 1.577295, 1.570712, 1.543704, 1.538272, 1.515369, 1.517113, 1.487451, 1.491593, 1.464514, 1.464658, 1.439359, 1.823222, 1.758781, 1.767358, 1.70872, 1.712926, 1.666956, 1.667838, 1.62077, 1.621445, 1.592891, 1.58549, 1.55603, 1.559042, 1.521501, 1.523342, 2, 3, 4)
|
||||
|
||||
### --- 27 ----
|
||||
## Indentation after open brace
|
||||
.a.lst <-
|
||||
list(ex1 = function(p) {
|
||||
cMah <- qchisq(0.975, p)
|
||||
function(d) as.numeric(d < cMah)
|
||||
### ^--- now here (less indented than prev.)
|
||||
},
|
||||
ex2 = function(p) {
|
||||
cM <- qchisq(0.95, p)
|
||||
function(d) as.numeric(d < cM)
|
||||
### ^--- here
|
||||
})
|
||||
### ^--- '}' here
|
||||
|
||||
|
||||
.a.lst <- list(ex1 = function(p) {
|
||||
cMah <- qchisq(0.975, p)
|
||||
function(d) as.numeric(d < cMah)
|
||||
}, ## <- now at column 0 {also the next line}
|
||||
ex2 = function(p) {
|
||||
cM <- qchisq(0.95, p)
|
||||
function(d) as.numeric(d < cM)
|
||||
})
|
||||
|
||||
|
||||
.a.lst <- list(list(aa = {
|
||||
bbb
|
||||
### ^--- here
|
||||
},
|
||||
aaa = function(p) {
|
||||
qchisq(0.95, p)
|
||||
### ^--- here
|
||||
},
|
||||
aaaa = {
|
||||
cccc
|
||||
### ^--- here
|
||||
}))
|
||||
|
||||
list(function(p){
|
||||
abc
|
||||
### ^-- here
|
||||
## <-- Press [Tab] before/at the first '#': should *NOT* insert '...='
|
||||
})
|
||||
### at column 0
|
||||
|
||||
(ab) {
|
||||
sfdsf
|
||||
### ^-- here
|
||||
}
|
||||
|
||||
### --- 27b --- [new, 2015-04-09]
|
||||
print.MethodsFunction <- function(x, byclass = attr(x, "byclass"), ...)
|
||||
{
|
||||
info <- attr(x, "info")
|
||||
values <- if (byclass) {
|
||||
unique(info$generic)
|
||||
} else {
|
||||
visible <- ifelse(info$visible, "", "*")
|
||||
paste0(rownames(info), visible)
|
||||
### ^-- both lines above should start here
|
||||
}
|
||||
### ^-- "}" here
|
||||
|
||||
## 2nd version:
|
||||
val <-
|
||||
if (byclass) {
|
||||
unique(info$generic)
|
||||
} else {
|
||||
visible <- ifelse(info$visible, "", "*")
|
||||
paste0(rownames(info), visible)
|
||||
### ^-- both lines above should start here
|
||||
}
|
||||
### ^-- "}" here
|
||||
invisible(x)
|
||||
}
|
||||
|
||||
|
||||
|
||||
### --- 28 --- [2015-02-17; still unfixed, 2015-11-21]
|
||||
## Indentation of end-line comments (to column 40 = 'indent-column')
|
||||
## {this is part of "real" code in Rmpfr/R/hjk.R}:
|
||||
hjk <- function(x,n) { # <--- C-M-q "on {" -- does *no longer* indent the "# .."
|
||||
##-- Setting steps and stepsize -----
|
||||
nsteps <- floor(log2(1/tol)) # number of steps
|
||||
steps <- 2^c(-(0:(nsteps-1))) # decreasing step size
|
||||
dir <- diag(1, n, n) # orthogonal directions
|
||||
|
||||
x <- par # start point
|
||||
fx <- f(x) # smallest value so far
|
||||
fcount <- 1 # counts number of function calls
|
||||
|
||||
if (info) cat(sprintf("step nofc %-12s | %20s\n",
|
||||
"fmin", "xpar"))
|
||||
|
||||
##-- Start the main loop ------------
|
||||
ns <- 0
|
||||
while (ns < nsteps && fcount < maxfeval && abs(fx) < target) {
|
||||
ns <- ns + 1
|
||||
hjs <- .hjsearch(x, f, steps[ns], dir, fcount, maxfeval, target)
|
||||
}
|
||||
hjs
|
||||
}
|
||||
|
||||
### --- 29 ---
|
||||
foreach(a = 1:3) %do% {
|
||||
a^2
|
||||
### ^--- here
|
||||
}
|
||||
|
||||
foreach(a = 1:3) %:%
|
||||
foreach(b = 10:13) %dopar% {
|
||||
### ^--- here
|
||||
a + b
|
||||
### ^---- here
|
||||
}
|
||||
### ^--- here
|
||||
|
||||
read.csv('file.csv') %>%
|
||||
mutate(X = X+2, Y = Y/2) %>%
|
||||
### ^--- here
|
||||
filter(X < 5)
|
||||
### ^-- here (*was* indented earlier)
|
||||
|
||||
|
||||
### --- 30 ---
|
||||
## a) ok:
|
||||
{
|
||||
r <- array(if (d[3L] == 3L)
|
||||
rgb(t(x[,,1L]), t(x[,,2L]), t(x[,,3L]), maxColorValue = max)
|
||||
else if (d[3L] == 4L)
|
||||
rgb(t(x[,,1L]), t(x[,,2L]), t(x[,,3L]), t(x[,,4L]), maxColorValue = max)
|
||||
else stop("foo"),
|
||||
dim = d[1:2])
|
||||
}
|
||||
|
||||
## b) ok :
|
||||
{
|
||||
obj <- obj && (condition1 || class2 %in% .BasicClasses ||
|
||||
condition3)
|
||||
}
|
||||
|
||||
## c) ok:
|
||||
{
|
||||
if (any(abs(d) < .001*abs(dd) |
|
||||
(is.na(d) & x == y)))
|
||||
TRUE
|
||||
}
|
||||
|
||||
|
||||
### --- 31 --------
|
||||
## C-s "recog"; M-C-a -- should go to beginning of function, does not
|
||||
|
||||
glmmTMB <- function (formula, data = NULL)
|
||||
{
|
||||
## glFormula <- function(formula, data=NULL, family = gaussian,
|
||||
## subset, weights, na.action, offset,
|
||||
## contrasts = NULL, mustart, etastart,
|
||||
## control = glmerControl(), ...) {
|
||||
|
||||
## FIXME: check for offsets in ziformula/dispformula, throw an error
|
||||
|
||||
call <- mf <- mc <- match.call()
|
||||
|
||||
if (is.null(family$family)) {
|
||||
print(family)
|
||||
stop("'family' not recognized")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
### --- 32 --- 2015-11-07 --- indentation again! --------
|
||||
{
|
||||
yl <- if(strictlim) {
|
||||
ylim
|
||||
}
|
||||
else {
|
||||
range(y, ylim)
|
||||
}
|
||||
## room below for weights
|
||||
dy <- 4*dy
|
||||
}
|
||||
## -- 32 b)
|
||||
{
|
||||
yl <- if(strictlim) {
|
||||
ylim
|
||||
}
|
||||
else
|
||||
range(y, ylim)
|
||||
## continue
|
||||
}
|
||||
## -- 32 c)
|
||||
{
|
||||
U <- if(is.matrix(x))
|
||||
apply(x, 2, foo) / (nrow(x) + 1)
|
||||
else
|
||||
foo(x) / (length(x) + 1)
|
||||
}
|
||||
## 'else' now aligns with 'if' (and their code too)
|
||||
|
||||
### --- 33 -- Treat `<<-` as `<-`
|
||||
{
|
||||
f(X <-
|
||||
callme(arg))
|
||||
f(X <<-
|
||||
callme(arg))
|
||||
}
|
||||
## the 2nd callme() now indents like the first
|
||||
|
||||
|
||||
### --- 34 --- "eval-function" (e.g. C-c C-c) fails with this
|
||||
|
||||
##' checking pretty():
|
||||
chkPretty <- function(x, n = 5, min.n = NULL, ..., max.D = 1) {
|
||||
if(is.null(min.n)) {
|
||||
## work with both pretty.default() and greDevices::prettyDate()
|
||||
## *AND* these have a different default for 'min.n' we must be "extra smart":
|
||||
min.n <-
|
||||
if(inherits(x, "Date") || inherits(x, "POSIXt"))
|
||||
n %/% 2 # grDevices:::prettyDate
|
||||
else
|
||||
n %/% 3 # pretty.default
|
||||
}
|
||||
pr <- pretty(x, n=n, min.n=min.n, ...)
|
||||
## if debugging: pr <- grDevices:::prettyDate(x, n=n, min.n=min.n, ...)
|
||||
stopifnot(length(pr) >= (min.n+1),
|
||||
abs(length(pr) - (n+1)) <= max.D,
|
||||
## must be equidistant [may need fuzz, i.e., signif(.) ?]:
|
||||
length(pr) == 1 || length(unique(diff(pr))) == 1,
|
||||
## pretty(x, *) must cover range of x:
|
||||
min(pr) <= min(x), max(x) <= max(pr))
|
||||
invisible(pr)
|
||||
}
|
||||
|
||||
|
||||
### --- 35 --- indentation of conditional function definitions:
|
||||
## from a robustbase vignette:
|
||||
{
|
||||
## calculate robustness weights
|
||||
lwgts <- Mwgt(lresid, lctrl$tuning.psi, lctrl$psi)
|
||||
## function to calculate robustified leverages
|
||||
tfun <-
|
||||
if (is.function(attr(estlist$design, 'gen')))
|
||||
function(i) {
|
||||
if (all(is.na(wi <- lwgts[i,]))) wi
|
||||
else .lmrob.hat(lXs[,,i,lcdn[2]],wi)
|
||||
}
|
||||
else
|
||||
### \-<-- 'else' (and all below) should indent 4 more, 'else' matching the above 'if'
|
||||
function(i) {
|
||||
if (all(is.na(wi <- lwgts[i,]))) wi else .lmrob.hat(lX, wi)
|
||||
}
|
||||
}
|
||||
|
||||
### --- 36 --- indentation of '#' inside string plus a '#' after that, issue #446
|
||||
A <- f("abc") +
|
||||
f("abc") + f("abc") +
|
||||
f("abc # abc") +
|
||||
## The above is now ok,
|
||||
f("abc # abc") + # <- comment w/o quotes or hashtag -- fixed now: next line was indented to beginning of line
|
||||
f("ABCDEF") +
|
||||
f(g(h("abc # def"), "foo ## bar")) +
|
||||
f("another")
|
||||
|
||||
|
||||
### --- 37 ----------Github issue #432 ---- now fixed
|
||||
## Indentation after string with "*"
|
||||
fo4 <- function(x, ...) {
|
||||
if(length(x) > 0)
|
||||
warning("Result gave strings of *different* #{characters}")
|
||||
x
|
||||
## 'x' was wrongly indented --here: ^
|
||||
}
|
||||
|
||||
### --- 38 ----------Mario Bouguin to ESS-bugs, Nov 21, 2017 ----
|
||||
scored <- read.csv(scored_path, comment.char="#")
|
||||
## writes
|
||||
## When I'm on the line and execute ess-eval-region-or-function-or-paragraph-and-step (i.e. C-c C-c), R only receives this:
|
||||
##
|
||||
## > scored <- read.csv(scored_path, comment.char="
|
||||
## +
|
||||
## MM: but I don't see this, so told him to upgrade ESS (he had 16.10, Windows)
|
||||
|
||||
|
||||
|
||||
|
||||
### Local Variables:
|
||||
### page-delimiter: "^### --- [1-9]"
|
||||
### End:
|
||||
91
elpa/ess-20180701.100/etc/R-ESS-bugs.el
Normal file
91
elpa/ess-20180701.100/etc/R-ESS-bugs.el
Normal file
@@ -0,0 +1,91 @@
|
||||
;;;; Things that go wrong or *went* wrong in the past
|
||||
;;;; (from list side) see R-ESS-bugs.R for the R's side.
|
||||
|
||||
|
||||
;;;; 1 ess-get-words-from-vector stumbles over \"
|
||||
(ess-get-words-from-vector "c('aaa','bbb\"ccc', 'dddd')\n")
|
||||
;;-> (" " "ccc" "dddd"): SOLVED
|
||||
|
||||
|
||||
;;;; 2 ess-get-words-from-vector disregards max.print
|
||||
;; options(max.print=1000) (warning added to the docs)
|
||||
(length (ess-get-words-from-vector "as.character(1:10000)\n"))
|
||||
;;-> 1001 with "max.print" at the end; added a comment in the function doc
|
||||
|
||||
;;;; 3 Inferior-ess-primary-prompt does not capture "+ + > "
|
||||
;; this hangs emacs; SOLVED
|
||||
(ess-command "tf<-function(N){
|
||||
N}\n")
|
||||
|
||||
;;;; 4 ess-command detects the prompt prematurely
|
||||
;; this outputs str(iris) in the inferior buffer; SOLVED
|
||||
(ess-command "
|
||||
lm_test <- function (formula, data, subset, weights, na.action, method = 'qr',
|
||||
model = TRUE, x = FALSE, y = FALSE, qr = TRUE, singular.ok = TRUE,
|
||||
contrasts = NULL, offset, ...)
|
||||
{
|
||||
cl <- match.call()
|
||||
mf <- match.call(expand.dots = FALSE)
|
||||
m <- match(c('formula', 'data', 'subset', 'weights', 'na.action',
|
||||
'offset'), names(mf), 0L)
|
||||
mf <- mf[c(1L, m)]
|
||||
mf$drop.unused.levels <- TRUE
|
||||
mf[[1L]] <- as.name('model.frame')
|
||||
mf <- eval(mf, parent.frame())
|
||||
if (method == 'model.frame')
|
||||
return(mf)
|
||||
else if (method != 'qr')
|
||||
warning(gettextf('method is not supported. Using',
|
||||
method), domain = NA)
|
||||
mt <- attr(mf, 'terms')
|
||||
y <- model.response(mf, 'numeric')
|
||||
w <- as.vector(model.weights(mf))
|
||||
if (!is.null(w) && !is.numeric(w))
|
||||
stop('weights must be a numeric vector')
|
||||
offset <- as.vector(model.offset(mf))
|
||||
if (!is.null(offset)) {
|
||||
if (length(offset) != NROW(y))
|
||||
stop(gettextf('number of offsets is %d, should equal %d (number of observations)',
|
||||
length(offset), NROW(y)), domain = NA)
|
||||
}
|
||||
if (is.empty.model(mt)) {
|
||||
x <- NULL
|
||||
z <- list(coefficients = if (is.matrix(y)) matrix(, 0,
|
||||
3) else numeric(0L), residuals = y, fitted.values = 0 *
|
||||
y, weights = w, rank = 0L, df.residual = if (!is.null(w)) sum(w !=
|
||||
0) else if (is.matrix(y)) nrow(y) else length(y))
|
||||
if (!is.null(offset)) {
|
||||
z$fitted.values <- offset
|
||||
z$residuals <- y - offset
|
||||
}
|
||||
}
|
||||
else {
|
||||
x <- model.matrix(mt, mf, contrasts)
|
||||
z <- if (is.null(w))
|
||||
lm.fit(x, y, offset = offset, singular.ok = singular.ok,
|
||||
...)
|
||||
else lm.wfit(x, y, w, offset = offset, singular.ok = singular.ok,
|
||||
...)
|
||||
}
|
||||
class(z) <- c(if (is.matrix(y)) 'mlm', 'lm')
|
||||
z$na.action <- attr(mf, 'na.action')
|
||||
z$offset <- offset
|
||||
z$contrasts <- attr(x, 'contrasts')
|
||||
z$xlevels <- .getXlevels(mt, mf)
|
||||
z$call <- cl
|
||||
z$terms <- mt
|
||||
if (model)
|
||||
z$model <- mf
|
||||
if (ret.x)
|
||||
z$x <- x
|
||||
if (ret.y)
|
||||
z$y <- y
|
||||
if (!qr)
|
||||
z$qr <- NULL
|
||||
z
|
||||
}
|
||||
str(iris)
|
||||
")
|
||||
|
||||
;;;; 5 double prompt > > used to stall emacs; SOLVED
|
||||
(ess-command "\n\n\n")
|
||||
71
elpa/ess-20180701.100/etc/R-error-patterns.R
Normal file
71
elpa/ess-20180701.100/etc/R-error-patterns.R
Normal file
@@ -0,0 +1,71 @@
|
||||
|
||||
## 1
|
||||
Error: chunk 7 (label = OP4)
|
||||
Error in disp.Rnw:656:31: unexpected symbol
|
||||
655: par(mgp = c(2.5, 1, 1), mar = c(0, 0, 0, 0),
|
||||
656: plt= c(0.08, 0.9, 0.25, 0.p9
|
||||
))
|
||||
|
||||
## 2
|
||||
Browse[2]> Error in x %*% y (from models.R#46) :
|
||||
Cholmod error 'X and/or Y have wrong dimensions' at file ../MatrixOps/cholmod_sdmult.c, line 90
|
||||
|
||||
## 3
|
||||
Error in source("~/works/protoClasses/R/funcs.R") (from hierarchy.R#6) :
|
||||
~/works/protoClasses/R/funcs.R:1797:5: unexpected '[['
|
||||
1796: b[[2]] <- quote(browser())
|
||||
1797: [[
|
||||
^
|
||||
## 4
|
||||
source("basicModel.R")
|
||||
Error in source("basicModel.R") : basicModel.R:95:1: unexpected symbol
|
||||
94:
|
||||
95: ixQ
|
||||
^
|
||||
|
||||
## 5.a
|
||||
> + Error in source(file = "/home/vitoshka/works/pbm/R/S4.R") (from #1) :
|
||||
/home/vitoshka/works/pbm/R/S4.R:36:62: unexpected ')'
|
||||
35: }, list(vname = as.name(".pix_v")),
|
||||
36: pname = as.name(".pix_p"))))
|
||||
^
|
||||
|
||||
## 5.b
|
||||
> + Error in source(file = "/home/vitoshka/works/pbm/R/S4.R") (from #1) :
|
||||
c:/home/vitoshka/works/pbm/R/S4.R:36:62: unexpected ')'
|
||||
35: }, list(vname = as.name(".pix_v")),
|
||||
36: pname = as.name(".pix_p"))))
|
||||
^
|
||||
|
||||
## 6 first line is not a pattern!
|
||||
+ . + Error in base::source(file = file, echo = echo, local = local, print.eval = print.eval, (from #95) :
|
||||
/tmp/model_mixture.R@4:5:13: unexpected symbol
|
||||
4: Mq$DATA$ixs$clust <- data$ixQ
|
||||
5: Mq
|
||||
|
||||
## 7 don't highlight dates
|
||||
id lat lon obs_date
|
||||
Min. : 1.00 Min. :21.57 Min. :-179.88 01/02/1997 04:16:53: 1
|
||||
1st Qu.: 99.25 1st Qu.:24.36 1st Qu.:-147.38 01/02/1997 05:56:25: 1
|
||||
Median :197.50 Median :25.64 Median :-119.64 01/04/1997 17:41:54: 1
|
||||
Mean :197.50 Mean :27.21 Mean : -21.52 01/05/1997 17:20:07: 1
|
||||
3rd Qu.:295.75 3rd Qu.:27.41 3rd Qu.: 153.66 01/06/1997 04:31:13: 1
|
||||
Max. :394.00 Max. :39.84 Max. : 179.93 01/06/1997 06:12:56: 1
|
||||
(Other) :388
|
||||
## 8 valgrind errors
|
||||
==25269== Invalid read of size 8
|
||||
==25269== at 0x9EC363C: inner_product<double const*, double const*, double> (stl_numeric.h:183)
|
||||
==25269== by 0x9EC363C: distance(RcppParallel::RMatrix<double> const&, unsigned long, unsigned long, DistType) (rwmd.cpp:21)
|
||||
==25269== by 0x9EC90C9: RelaxedWordMoverDistanceSparse::operator()(unsigned long, unsigned long) (rwmd.cpp:137)
|
||||
|
||||
## 9 testhat new patterns
|
||||
test_embeddings.R:20: failure: average embedding works
|
||||
embed_vocab(vocab, embs) not equal to embs[, 1:N].
|
||||
Attributes: < Length mismatch: comparison on first 1 components >
|
||||
|
||||
test_embeddings.R:59: error: average embedding works with missing values
|
||||
no 'dimnames' attribute for array
|
||||
1: expect_equal(e[, "dd"], e[, "ee"]) at /store/Dropbox/dev/mlvocab/tests/testthat/test_embeddings.R:59
|
||||
2: quasi_label(enquo(object), label) at /tmp/Rtmp6McxD6/R.INSTALL70c948e315c6/testthat/R/expect-equality.R:51
|
||||
3: eval_bare(get_expr(quo), get_env(quo)) at /tmp/Rtmp6McxD6/R.INSTALL70c948e315c6/testthat/R/expectation.R:90
|
||||
|
||||
30
elpa/ess-20180701.100/etc/completion_ideas.R
Normal file
30
elpa/ess-20180701.100/etc/completion_ideas.R
Normal file
@@ -0,0 +1,30 @@
|
||||
|
||||
## inspired by:
|
||||
## https://github.com/rstudio/rstudio/pull/191
|
||||
|
||||
## nested calls should work
|
||||
df[a][, |]
|
||||
|
||||
## matrix, list, environments
|
||||
l <- list(aaaa = 1111, bbbb = 2222)
|
||||
l[a|] ## -> "aaaa" (quoted!)
|
||||
|
||||
## data table
|
||||
dt <- data.table(aaaa = 1111, bbbb = 22222)
|
||||
dt[, a|] # -> aaaa (unquoted!)
|
||||
|
||||
## attributes
|
||||
x <- ""
|
||||
attr(x, "foo") <- function(alpha, beta) {}
|
||||
attr(x, "foo")(al| # -> "alpha"
|
||||
|
||||
## chains
|
||||
mtcars %>% dplyr::select(mp| #-> mpg (unquoted))
|
||||
|
||||
## models
|
||||
lm(mpg ~ cy| , data = mtcars) #-> cyl
|
||||
|
||||
## "by" keyword in data.table, inner_join, etc
|
||||
inner_join(foo, bar, by = c(| # provides completions for variables in foo when
|
||||
# on the left side of an =, and bar when on the
|
||||
# right side of an =.
|
||||
107
elpa/ess-20180701.100/etc/ess-julia.jl
Normal file
107
elpa/ess-20180701.100/etc/ess-julia.jl
Normal file
@@ -0,0 +1,107 @@
|
||||
module ESS
|
||||
|
||||
function all_help_topics()
|
||||
## There are not clear topics anymore. Approximate those with a very general apropos(" ")
|
||||
apropos(" ")
|
||||
end
|
||||
|
||||
function help(topic::AbstractString)
|
||||
VERSION >= v"0.4-" ?
|
||||
eval(current_module(), parse("@doc $topic")) :
|
||||
Base.Help.help(topic)
|
||||
end
|
||||
|
||||
## modified version of function show(io::IO, m::Method)
|
||||
function fun_args(m::Method)
|
||||
tv, decls, file, line = Base.arg_decl_parts(m)
|
||||
io = STDOUT::IO
|
||||
if !isempty(tv)
|
||||
Base.show_delim_array(io, tv, '{', ',', '}', false)
|
||||
end
|
||||
print(io, "(")
|
||||
join(io, [escape_string(isempty(d[2]) ? d[1] : d[1]*"::"*d[2]) for d in decls], ",", ",")
|
||||
print(io, ")")
|
||||
end
|
||||
|
||||
## modified versionof show(io::IO, mt::MethodTable)
|
||||
function fun_args(f::Function)
|
||||
mt = Base.MethodList(methods(f).mt)
|
||||
mod = Base.function_module(f)
|
||||
if mod == Main
|
||||
mod = "nil"
|
||||
end
|
||||
print("(list \"$mod\" nil '(")
|
||||
for d in mt
|
||||
print("\"")
|
||||
## method
|
||||
fun_args(d)
|
||||
print("\" ")
|
||||
end
|
||||
print("))")
|
||||
end
|
||||
|
||||
function fun_args(s::AbstractString)
|
||||
try
|
||||
m = eval(current_module(), parse(s))
|
||||
if ! isa(m, String)
|
||||
fun_args(m)
|
||||
end
|
||||
catch
|
||||
print("(list nil nil nil)")
|
||||
end
|
||||
end
|
||||
|
||||
function fun_args(t::DataType)
|
||||
print("(list nil nil '(")
|
||||
for d = fieldnames(t)
|
||||
print("\"$d\" ")
|
||||
end
|
||||
print("))")
|
||||
end
|
||||
|
||||
|
||||
### OBJECT COMPLETION
|
||||
# Must print an output of the form:
|
||||
#
|
||||
# Cache Module
|
||||
# Write Module
|
||||
# add Function
|
||||
# free Function
|
||||
function components(m::Module)
|
||||
for v in sort(names(m))
|
||||
s = string(v)
|
||||
if isdefined(m,v)
|
||||
println(rpad(s, 30), summary(eval(m,v)))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function components(t::DataType)
|
||||
for v in sort(fieldnames(t))
|
||||
println(rpad(string(v), 30), "field")
|
||||
end
|
||||
end
|
||||
|
||||
function components(v)
|
||||
t = typeof(v)
|
||||
if isa(t, DataType)
|
||||
return components(t)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
### MISC
|
||||
function main_modules(m::Module)
|
||||
for nm in names(m)
|
||||
if isdefined(m, nm)
|
||||
mod = eval(m, nm)
|
||||
if isa(mod, Module)
|
||||
print("\"$nm\" ")
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
main_modules() = main_modules(current_module())
|
||||
|
||||
end
|
||||
56
elpa/ess-20180701.100/etc/gpl-check
Executable file
56
elpa/ess-20180701.100/etc/gpl-check
Executable file
@@ -0,0 +1,56 @@
|
||||
#!/bin/sh
|
||||
|
||||
if [ $# -eq 0 -o "$1" = "-h" -o "$1" = "-help" -o "$1" = "--help" ]
|
||||
then
|
||||
echo "usage: gpl-check [-h|-help|--help|-2|-3|-u|-n] file1 [file2 ...]"
|
||||
echo " -h|-help|--help print this help"
|
||||
echo " -2 print file names found with GPLv2+"
|
||||
echo " -3 print file names found with GPLv3+"
|
||||
echo " -u print file names found with a GPL of unknown version"
|
||||
echo " -n print file names with no GPL found"
|
||||
echo " file1 [file2 ...] list of files to check"
|
||||
else
|
||||
GPLV2=0
|
||||
GPLV3=0
|
||||
GPLVUNK=0
|
||||
NOGPL=0
|
||||
|
||||
for i
|
||||
do
|
||||
case $i in
|
||||
-2) GPLV2=1;;
|
||||
-3) GPLV3=1;;
|
||||
-23) GPLV2=1;GPLV3=1;;
|
||||
-u) GPLVUNK=1;;
|
||||
-n) NOGPL=1;;
|
||||
-nu|-un) GPLVUNK=1;NOGPL=1;;
|
||||
*) if [ $GPLV2 -eq 0 -a $GPLV3 -eq 0 -a $GPLVUNK -eq 0 -a $NOGPL -eq 0 ]
|
||||
then
|
||||
GPLV2=1
|
||||
GPLV3=1
|
||||
GPLVUNK=1
|
||||
NOGPL=1
|
||||
fi
|
||||
if grep -l 'either version 2, or' $i > /dev/null
|
||||
then
|
||||
if [ $GPLV2 -eq 1 ]
|
||||
then echo "$i GPLv2+"
|
||||
fi
|
||||
elif grep -l 'either version 3' $i > /dev/null
|
||||
then
|
||||
if [ $GPLV3 -eq 1 ]
|
||||
then echo "$i GPLv3+"
|
||||
fi
|
||||
elif grep -l 'GNU General Public License' $i > /dev/null
|
||||
then
|
||||
if [ $GPLVUNK -eq 1 ]
|
||||
then echo "$i GPLv unknown"
|
||||
fi
|
||||
else
|
||||
if [ $NOGPL -eq 1 ]
|
||||
then echo "$i no GPL"
|
||||
fi
|
||||
fi;;
|
||||
esac
|
||||
done
|
||||
fi
|
||||
31
elpa/ess-20180701.100/etc/icons/README
Normal file
31
elpa/ess-20180701.100/etc/icons/README
Normal file
@@ -0,0 +1,31 @@
|
||||
|
||||
Creating pixmaps:
|
||||
|
||||
* spluslogo.xpm was dontated by David Smith at Insightful.
|
||||
|
||||
* Other icons were created by SJE, using mostly `kiconedit' and
|
||||
hand-editing.
|
||||
|
||||
* Transparency
|
||||
Need to add backgrounToolBarColor for XEmacs to show okay.
|
||||
e.g. /usr/share/xemacs-21.4.12/etc/toolbar/folder-cap-up.xpm
|
||||
has header:
|
||||
"X c Gray75 s backgroundToolBarColor",
|
||||
whereas I have set "c None" to indicate the background pixel; this line
|
||||
seems to work for both toolbars:
|
||||
". c None s backgroundToolBarColor",
|
||||
|
||||
* splus_letters_small.xpm
|
||||
|
||||
2010-05-18 & -21: SJE made this new Splus icon from the
|
||||
splus_letters_large.xpm (then image001.png from Louis Bajuk-Yorgan
|
||||
@tibco.com) file that Rich provided. I had to move the
|
||||
cross over to the left by one pixel, to then allow the image to be
|
||||
cropped to 48x48 (cropping performed in gimp). kiconedit was then
|
||||
used to rescale the icon to 24x24. Finally, background transparency
|
||||
added manually to the file, as noted above.
|
||||
|
||||
2010-05-21: updated file based on new image from TIBCO. Original
|
||||
51x38 cropped to 50x38 in xv, then shrunk to 25x19 in kiconedit.
|
||||
Transparency added, and removed a lot of the extra white pixels into
|
||||
background colours manually in kiconedit.
|
||||
30
elpa/ess-20180701.100/etc/icons/rbuffer.xpm
Normal file
30
elpa/ess-20180701.100/etc/icons/rbuffer.xpm
Normal file
@@ -0,0 +1,30 @@
|
||||
/* XPM */
|
||||
static char *rbuffer[]={
|
||||
"24 24 3 1",
|
||||
". c None s backgroundToolBarColor",
|
||||
"a c #000000",
|
||||
"# c #1532ed",
|
||||
"........................",
|
||||
"...............#........",
|
||||
"...............##.......",
|
||||
".....#############......",
|
||||
".....##############.....",
|
||||
".....#############......",
|
||||
"...............##.......",
|
||||
"...............#........",
|
||||
"........................",
|
||||
"........................",
|
||||
"........................",
|
||||
"...aaaaaaaaaaaaaaaaaa...",
|
||||
"........................",
|
||||
"........................",
|
||||
"...aaaaaaaaaaaaaaaaaa...",
|
||||
"........................",
|
||||
"........................",
|
||||
"...aaaaaaaaaaaaaaaaaa...",
|
||||
"........................",
|
||||
"........................",
|
||||
"...aaaaaaaaaaaaaaaaaa...",
|
||||
"........................",
|
||||
"........................",
|
||||
"...aaaaaaaaaaaaaaaaaa..."};
|
||||
45
elpa/ess-20180701.100/etc/icons/rfunction.xpm
Normal file
45
elpa/ess-20180701.100/etc/icons/rfunction.xpm
Normal file
@@ -0,0 +1,45 @@
|
||||
/* XPM */
|
||||
static char *rfunction[]={
|
||||
"24 24 18 1",
|
||||
"B c #000000",
|
||||
"k c #181818",
|
||||
"Q c #1f1f1f",
|
||||
"z c #232323",
|
||||
"L c #313131",
|
||||
"Z c #3c3c3c",
|
||||
"O c #404040",
|
||||
"a c #5e5e5e",
|
||||
"W c #676767",
|
||||
"U c #757575",
|
||||
"N c #848484",
|
||||
"P c #969696",
|
||||
"0 c #a0a0a0",
|
||||
". c None s backgroundToolBarColor",
|
||||
"G c #b9b9b9",
|
||||
"I c #c6c6c6",
|
||||
"T c #d5d5d5",
|
||||
"# c #1532ed",
|
||||
"........................",
|
||||
"...............#........",
|
||||
"...............##.......",
|
||||
".....#############......",
|
||||
".....##############.....",
|
||||
".....#############......",
|
||||
"...............##.......",
|
||||
"...............#........",
|
||||
"........................",
|
||||
"........................",
|
||||
"........................",
|
||||
"..............az..zU....",
|
||||
"....ILBBz...GkP....aO...",
|
||||
"....zU......BG......LP..",
|
||||
"....BG.....UO.......0z..",
|
||||
"..BBBBBBP..zP.......GB..",
|
||||
"....BG.....BG........BI.",
|
||||
"....BG.....BG........BI.",
|
||||
"....BG.....LP.......GB..",
|
||||
"....BG.....NO.......PL..",
|
||||
"....BG......Q0......z0..",
|
||||
"....BG......TQU0..0ZW...",
|
||||
"..............NL..Z0....",
|
||||
"........................"};
|
||||
30
elpa/ess-20180701.100/etc/icons/rline.xpm
Normal file
30
elpa/ess-20180701.100/etc/icons/rline.xpm
Normal file
@@ -0,0 +1,30 @@
|
||||
/* XPM */
|
||||
static char *rline[]={
|
||||
"24 24 3 1",
|
||||
". c None s backgroundToolBarColor",
|
||||
"a c #000000",
|
||||
"# c #1532ed",
|
||||
"........................",
|
||||
"...............#........",
|
||||
"...............##.......",
|
||||
".....#############......",
|
||||
".....##############.....",
|
||||
".....#############......",
|
||||
"...............##.......",
|
||||
"...............#........",
|
||||
"........................",
|
||||
"........................",
|
||||
"........................",
|
||||
"........................",
|
||||
"........................",
|
||||
"........................",
|
||||
"........................",
|
||||
"........................",
|
||||
"........................",
|
||||
"...aaaaaaaaaaaaaaaaaa...",
|
||||
"........................",
|
||||
"........................",
|
||||
"........................",
|
||||
"........................",
|
||||
"........................",
|
||||
"........................"};
|
||||
30
elpa/ess-20180701.100/etc/icons/rregion.xpm
Normal file
30
elpa/ess-20180701.100/etc/icons/rregion.xpm
Normal file
@@ -0,0 +1,30 @@
|
||||
/* XPM */
|
||||
static char *rregion[]={
|
||||
"24 24 3 1",
|
||||
". c None s backgroundToolBarColor",
|
||||
"a c #000000",
|
||||
"# c #1532ed",
|
||||
"........................",
|
||||
"...............#........",
|
||||
"...............##.......",
|
||||
".....#############......",
|
||||
".....##############.....",
|
||||
".....#############......",
|
||||
"...............##.......",
|
||||
"...............#........",
|
||||
"........................",
|
||||
"........................",
|
||||
"........................",
|
||||
"........................",
|
||||
"........................",
|
||||
"........................",
|
||||
"...aaaaaaaaaaaaaaaaaa...",
|
||||
"........................",
|
||||
"........................",
|
||||
"...aaaaaaaaaaaaaaaaaa...",
|
||||
"........................",
|
||||
"........................",
|
||||
"...aaaaaaaaaaaaaaaaaa...",
|
||||
"........................",
|
||||
"........................",
|
||||
"........................"};
|
||||
173
elpa/ess-20180701.100/etc/icons/splus_letter_small.xpm
Normal file
173
elpa/ess-20180701.100/etc/icons/splus_letter_small.xpm
Normal file
@@ -0,0 +1,173 @@
|
||||
/* XPM */
|
||||
static char *dummy[]={
|
||||
"25 19 151 2",
|
||||
"Qt c None s backgroundToolBarColor",
|
||||
"#M c #044b83",
|
||||
"#R c #044c86",
|
||||
"#t c #044c87",
|
||||
"ae c #044d87",
|
||||
"an c #044e7f",
|
||||
".o c #044e81",
|
||||
"#l c #044e8d",
|
||||
"ak c #044f84",
|
||||
".B c #044f88",
|
||||
"#m c #044f8e",
|
||||
"am c #045188",
|
||||
".j c #04518b",
|
||||
".O c #045191",
|
||||
"#6 c #04528f",
|
||||
"#O c #045388",
|
||||
".k c #04538c",
|
||||
"#U c #04538e",
|
||||
"#Y c #045392",
|
||||
".l c #045489",
|
||||
"## c #04548c",
|
||||
"#i c #045490",
|
||||
"#v c #045492",
|
||||
"#. c #04558e",
|
||||
"#C c #045593",
|
||||
"#k c #04568d",
|
||||
"#B c #045695",
|
||||
"#G c #045698",
|
||||
".Y c #045795",
|
||||
".R c #045890",
|
||||
"#j c #04598f",
|
||||
".4 c #045995",
|
||||
"aj c #054e7b",
|
||||
"al c #054e89",
|
||||
"#h c #054e8d",
|
||||
"#S c #055188",
|
||||
"#V c #05518d",
|
||||
".m c #055282",
|
||||
".K c #055284",
|
||||
".5 c #055583",
|
||||
".t c #055791",
|
||||
"#u c #055894",
|
||||
".n c #064e86",
|
||||
"#s c #074d76",
|
||||
".p c #074e83",
|
||||
"a. c #074f89",
|
||||
"#a c #074f8a",
|
||||
"af c #075389",
|
||||
"#9 c #07548e",
|
||||
".A c #075592",
|
||||
".F c #075594",
|
||||
"#1 c #075a99",
|
||||
".c c #094d79",
|
||||
".9 c #094f89",
|
||||
".J c #095681",
|
||||
"#A c #0b568d",
|
||||
".s c #0c4f85",
|
||||
"#5 c #0c5188",
|
||||
"#w c #0d5486",
|
||||
".b c #0e4e7d",
|
||||
".N c #105287",
|
||||
".X c #105685",
|
||||
"#H c #115789",
|
||||
"#Z c #13508a",
|
||||
"#2 c #135287",
|
||||
"#F c #195c8a",
|
||||
".i c #1a5c8b",
|
||||
"#8 c #1b5684",
|
||||
"ai c #1b5a81",
|
||||
"ad c #1c5d87",
|
||||
"#P c #1d5c8c",
|
||||
"#r c #1d5f8a",
|
||||
"#N c #1f5b7d",
|
||||
"ao c #1f5c85",
|
||||
"#0 c #205a86",
|
||||
"#n c #206292",
|
||||
".u c #216794",
|
||||
".d c #245b81",
|
||||
".G c #256390",
|
||||
".3 c #265f85",
|
||||
"a# c #266287",
|
||||
"#x c #296286",
|
||||
"#b c #2a5f96",
|
||||
"#g c #2b6395",
|
||||
".a c #2c658f",
|
||||
".Q c #307195",
|
||||
".E c #326897",
|
||||
".S c #356f98",
|
||||
".Z c #35789b",
|
||||
"ag c #396c94",
|
||||
"#I c #3a6a78",
|
||||
"#z c #3f7497",
|
||||
".1 c #3f7c9e",
|
||||
"#J c #427585",
|
||||
"aa c #42768f",
|
||||
"#X c #447ca1",
|
||||
".C c #457b9a",
|
||||
".z c #457ba8",
|
||||
"ac c #48778f",
|
||||
".q c #4e86b0",
|
||||
"#7 c #4f86b5",
|
||||
".6 c #50829b",
|
||||
"#q c #538db5",
|
||||
"#D c #538eb3",
|
||||
".e c #547f91",
|
||||
"ab c #5487a1",
|
||||
"#T c #58859c",
|
||||
"ah c #5983a7",
|
||||
"#c c #5a7d99",
|
||||
".2 c #5b809c",
|
||||
".P c #5d94bb",
|
||||
"#K c #6c91a0",
|
||||
"#4 c #6c99ba",
|
||||
"#L c #6c9cb7",
|
||||
"#o c #7097a7",
|
||||
"ap c #739eb3",
|
||||
".v c #73a7c0",
|
||||
".0 c #7cacc3",
|
||||
"#y c #7faac6",
|
||||
".# c #82a0a8",
|
||||
"#Q c #84aec8",
|
||||
".I c #86a8bd",
|
||||
".L c #89b3cd",
|
||||
"#d c #8aa7b6",
|
||||
"as c #8db2cc",
|
||||
".y c #8db9cd",
|
||||
".h c #8eb5c9",
|
||||
".8 c #8eb9d3",
|
||||
"#W c #8fb2c9",
|
||||
"at c #91b7c8",
|
||||
"#3 c #94b4cb",
|
||||
"ar c #95b7cb",
|
||||
".T c #979798",
|
||||
".U c #99999a",
|
||||
"#f c #99b9cd",
|
||||
".g c #9b9b9b",
|
||||
".V c #9c9c9c",
|
||||
".r c #9cc2d4",
|
||||
".w c #a7c8d0",
|
||||
".x c #a9c8d1",
|
||||
"#p c #a9cbda",
|
||||
".f c #abc5cd",
|
||||
"#E c #abcad6",
|
||||
"aq c #b1d0e0",
|
||||
"au c #b3d2e2",
|
||||
".7 c #b8cfd6",
|
||||
"#e c #baced7",
|
||||
".W c #d4e0e4",
|
||||
".H c #d7e7ed",
|
||||
".M c #dae6ef",
|
||||
".D c #eef8f8",
|
||||
"QtQtQtQt.#.a.b.c.d.e.fQtQtQtQtQtQtQtQt.g.gQtQtQtQt",
|
||||
"QtQt.h.i.j.k.l.m.n.o.p.qQtQtQtQtQtQtQt.g.gQtQtQtQt",
|
||||
"Qt.r.s.t.u.v.w.x.y.z.A.B.CQtQtQtQtQtQt.g.gQtQtQtQt",
|
||||
".D.E.F.G.HQtQtQtQtQt.I.J.K.LQtQtQtQtQt.g.gQtQtQtQt",
|
||||
".M.N.O.PQtQtQtQtQtQtQt.Q.R.SQt.g.T.U.g.g.g.V.V.g.g",
|
||||
".W.X.Y.ZQtQtQtQtQtQtQt.0.1.2Qt.g.g.g.g.g.g.g.g.g.g",
|
||||
"Qt.3.4.5.6.7QtQtQtQtQtQtQtQtQtQtQtQtQt.g.gQtQtQtQt",
|
||||
"Qt.8.9#.###a#b#c#d#eQtQtQtQtQtQtQtQtQt.g.gQtQtQtQt",
|
||||
"QtQt#f#g#h#i#j#k#l#m#n#oQtQtQtQtQtQtQt.g.gQtQtQtQt",
|
||||
"QtQtQtQt#p#q#r#s#t#u#v#w#xQtQtQtQtQtQt.g.gQtQtQtQt",
|
||||
"QtQtQtQtQtQtQtQt#y#z#A#B#C#DQtQtQtQtQtQtQtQtQtQtQt",
|
||||
"QtQtQtQtQtQtQtQtQtQt#E#F#G#HQtQtQtQtQtQtQtQtQtQtQt",
|
||||
"#I#J#KQtQtQtQtQtQtQtQt#L.B#MQtQtQtQtQtQtQtQtQtQtQt",
|
||||
"#N#O#PQtQtQtQtQtQtQtQt#Q#R#SQtQtQtQtQtQtQtQtQtQtQt",
|
||||
"#T#U#V#WQtQtQtQtQtQtQt#X#Y#ZQtQtQtQtQtQtQtQtQtQtQt",
|
||||
"Qt#0#1#2#3QtQtQtQtQt#4#5#6#7QtQtQtQtQtQtQtQtQtQtQt",
|
||||
"QtQt#8#9a.a#aaabacadaeafagQtQtQtQtQtQtQtQtQtQtQtQt",
|
||||
"QtQtQtahaiajakalamanaoapQtQtQtQtQtQtQtQtQtQtQtQtQt",
|
||||
"QtQtQtQtQtaqarasatauQtQtQtQtQtQtQtQtQtQtQtQtQtQtQt"};
|
||||
BIN
elpa/ess-20180701.100/etc/icons/splus_letters_large.png
Normal file
BIN
elpa/ess-20180701.100/etc/icons/splus_letters_large.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 4.2 KiB |
281
elpa/ess-20180701.100/etc/icons/splus_letters_large.xpm
Normal file
281
elpa/ess-20180701.100/etc/icons/splus_letters_large.xpm
Normal file
@@ -0,0 +1,281 @@
|
||||
/* XPM */
|
||||
static char *splus_letters_large[] = {
|
||||
/* width height num_colors chars_per_pixel */
|
||||
" 51 38 236 2",
|
||||
/* colors */
|
||||
".. c #043e74",
|
||||
".# c #74a29c",
|
||||
".a c #547a74",
|
||||
".b c #bcb2b9",
|
||||
".c c #0c6a9c",
|
||||
".d c #045282",
|
||||
".e c #bcdae8",
|
||||
".f c #94c2cc",
|
||||
".g c #245678",
|
||||
".h c #e4e2e3",
|
||||
".i c #94a2a4",
|
||||
".j c #04528f",
|
||||
".k c #5c8aa4",
|
||||
".l c #346688",
|
||||
".m c #848a8c",
|
||||
".n c #04427c",
|
||||
".o c #e4f4fc",
|
||||
".p c #94b4b4",
|
||||
".q c #cceef4",
|
||||
".r c #045e99",
|
||||
".s c #4c7a88",
|
||||
".t c #a4d6f0",
|
||||
".u c #6c8e94",
|
||||
".v c #f4f2e4",
|
||||
".w c #7cb2d4",
|
||||
".x c #b4b2b4",
|
||||
".y c #145274",
|
||||
".z c #044c74",
|
||||
".A c #acc2d4",
|
||||
".B c #dcdddc",
|
||||
".C c #34729c",
|
||||
".D c #c4c6c4",
|
||||
".E c #144e84",
|
||||
".F c #94b4cc",
|
||||
".G c #fcfaeb",
|
||||
".H c #245a88",
|
||||
".I c #5496b9",
|
||||
".J c #044a80",
|
||||
".K c #c4e6f1",
|
||||
".L c #9cc6ec",
|
||||
".M c #347aac",
|
||||
".N c #6c96a8",
|
||||
".O c #145a80",
|
||||
".P c #6ca2c8",
|
||||
".Q c #045a91",
|
||||
".R c #d4fafc",
|
||||
".S c #145e8c",
|
||||
".T c #144264",
|
||||
".U c #446e89",
|
||||
".V c #949594",
|
||||
".W c #5c7e84",
|
||||
".X c #548ec4",
|
||||
".Y c #e4fdfc",
|
||||
".Z c #044a8c",
|
||||
".0 c #e4eef2",
|
||||
".1 c #a4a3a4",
|
||||
".2 c #346aa0",
|
||||
".3 c #dceef4",
|
||||
".4 c #bcd2d4",
|
||||
".5 c #f4faf9",
|
||||
".6 c #74aacc",
|
||||
".7 c #044669",
|
||||
".8 c #246696",
|
||||
".9 c #045a84",
|
||||
"#. c #ccdedc",
|
||||
"## c #9ccad8",
|
||||
"#a c #a4b6b7",
|
||||
"#b c #144a6e",
|
||||
"#c c #94bacc",
|
||||
"#d c #346288",
|
||||
"#e c #6c9bbc",
|
||||
"#f c #bcbebc",
|
||||
"#g c #c4e2ec",
|
||||
"#h c #0c548c",
|
||||
"#i c #7c9e9c",
|
||||
"#j c #f4f2f4",
|
||||
"#k c #14527c",
|
||||
"#l c #0c4c7f",
|
||||
"#m c #0c5379",
|
||||
"#n c #c4dae4",
|
||||
"#o c #245e7c",
|
||||
"#p c #6492a4",
|
||||
"#q c #346e94",
|
||||
"#r c #ecf4f2",
|
||||
"#s c #44829c",
|
||||
"#t c #b4cad0",
|
||||
"#u c #145a8e",
|
||||
"#v c #447490",
|
||||
"#w c #246294",
|
||||
"#x c #448abc",
|
||||
"#y c #fcfefb",
|
||||
"#z c #2c6f9a",
|
||||
"#A c #a4bacc",
|
||||
"#B c #bcbaba",
|
||||
"#C c #94a6c0",
|
||||
"#D c #04569c",
|
||||
"#E c #648aa0",
|
||||
"#F c #d4f6fc",
|
||||
"#G c #8cb2c4",
|
||||
"#H c #acbabc",
|
||||
"#I c #d4e8f0",
|
||||
"#J c #84aabc",
|
||||
"#K c #1c5b82",
|
||||
"#L c #7ca2c1",
|
||||
"#M c #5486a4",
|
||||
"#N c #ecebe9",
|
||||
"#O c #0c5fa4",
|
||||
"#P c #9cbdce",
|
||||
"#Q c #accee4",
|
||||
"#R c #0c4270",
|
||||
"#S c #6c6e6c",
|
||||
"#T c #a4c4cc",
|
||||
"#U c #0c467c",
|
||||
"#V c #9cb6b4",
|
||||
"#W c #d4eef8",
|
||||
"#X c #447c98",
|
||||
"#Y c #b4d4e8",
|
||||
"#Z c #6c92a4",
|
||||
"#0 c #0c4b6f",
|
||||
"#1 c #cccccc",
|
||||
"#2 c #2c5e8c",
|
||||
"#3 c #649cc0",
|
||||
"#4 c #cce7f1",
|
||||
"#5 c #a4cee8",
|
||||
"#6 c #4482ac",
|
||||
"#7 c #d4d6d4",
|
||||
"#8 c #648abc",
|
||||
"#9 c #9c9b9c",
|
||||
"a. c #acadac",
|
||||
"a# c #547a98",
|
||||
"aa c #34627c",
|
||||
"ab c #1c669c",
|
||||
"ac c #84badc",
|
||||
"ad c #bcced4",
|
||||
"ae c #6c8ea4",
|
||||
"af c #bcd4e8",
|
||||
"ag c #dcf6fc",
|
||||
"ah c #8cbad4",
|
||||
"ai c #7c9bb1",
|
||||
"aj c #9cc6dc",
|
||||
"ak c #3c6a84",
|
||||
"al c #7496a7",
|
||||
"am c #1c5e94",
|
||||
"an c #5c90b8",
|
||||
"ao c #b4dee4",
|
||||
"ap c #4c728c",
|
||||
"aq c #4c86ac",
|
||||
"ar c #dce6e9",
|
||||
"as c #8caebc",
|
||||
"at c #94aec0",
|
||||
"au c #7ca2a8",
|
||||
"av c #5c96c4",
|
||||
"aw c #0c5a90",
|
||||
"ax c #2c668c",
|
||||
"ay c #2c5e70",
|
||||
"az c #5c86a4",
|
||||
"aA c #ece6dc",
|
||||
"aB c #8c8d8f",
|
||||
"aC c #748c8c",
|
||||
"aD c #fcf6ec",
|
||||
"aE c #84b6cc",
|
||||
"aF c #1c5470",
|
||||
"aG c #3c7aa4",
|
||||
"aH c #74a6c4",
|
||||
"aI c #7cacc8",
|
||||
"aJ c #a4cbd7",
|
||||
"aK c #1c4e6c",
|
||||
"aL c #749bc1",
|
||||
"aM c #c4c2c4",
|
||||
"aN c #fcf6f5",
|
||||
"aO c #1c5682",
|
||||
"aP c #b4cbe1",
|
||||
"aQ c #747274",
|
||||
"aR c #4c7a9c",
|
||||
"aS c #04468c",
|
||||
"aT c #94b2c4",
|
||||
"aU c #0462a4",
|
||||
"aV c #84a6b4",
|
||||
"aW c #9ccaf4",
|
||||
"aX c #6c9ab4",
|
||||
"aY c #dcfbfc",
|
||||
"aZ c #14629c",
|
||||
"a0 c #14466c",
|
||||
"a1 c #ecfdfc",
|
||||
"a2 c #dcf2fc",
|
||||
"a3 c #0c5384",
|
||||
"a4 c #c4dcf4",
|
||||
"a5 c #ecf5fc",
|
||||
"a6 c #44749c",
|
||||
"a7 c #2c6ea4",
|
||||
"a8 c #648eac",
|
||||
"a9 c #8cb6d4",
|
||||
"b. c #7ca6cc",
|
||||
"b# c #eceef4",
|
||||
"ba c #a4c6dc",
|
||||
"bb c #9cb2c4",
|
||||
"bc c #b4daf4",
|
||||
"bd c #9ca29c",
|
||||
"be c #c4d2dc",
|
||||
"bf c #3c6e90",
|
||||
"bg c #b4babb",
|
||||
"bh c #4c82a4",
|
||||
"bi c #045a9c",
|
||||
"bj c #044674",
|
||||
"bk c #0c5a84",
|
||||
"bl c #4c829c",
|
||||
"bm c #5486b4",
|
||||
"bn c #044272",
|
||||
"bo c #bcb6b8",
|
||||
"bp c #045684",
|
||||
"bq c #bcdee7",
|
||||
"br c #245a7c",
|
||||
"bs c #e4e6e4",
|
||||
"bt c #045691",
|
||||
"bu c #5c8ea9",
|
||||
"bv c #04467e",
|
||||
"bw c #ccf2f9",
|
||||
"bx c #04629c",
|
||||
"by c #f4f6ec",
|
||||
"bz c #b4b6b5",
|
||||
"bA c #fcfeec",
|
||||
"bB c #245e88",
|
||||
"bC c #044e81",
|
||||
"bD c #9ccae4",
|
||||
"bE c #347ea4",
|
||||
"bF c #5c828c",
|
||||
"bG c #044e8d",
|
||||
"bH c #346e9c",
|
||||
"bI c #dcf2ec",
|
||||
"bJ c #0c6298",
|
||||
"bK c #f4fefc",
|
||||
"bL c #74aec4",
|
||||
"bM c #a4babc",
|
||||
"bN c #94bed4",
|
||||
"bO c #f4f6f4",
|
||||
"bP c #145680",
|
||||
/* pixels */
|
||||
".mbgbobo.bbo#Bbg#aaVa8.l#ba0.7a0br.U.N.p#abg#Bbobobo#B#Bbo.b.bbz#B#Bbg#Bbz#B.V#SaQ#SaB.x#B#B#B#Bbg#B#B",
|
||||
".x.5#yaN#y#yar#a.Way#l#h#hbtaw.d#l#K.gay.uada5#ybO#j#y#yaN#yaN#y#y#y#y#y#y#y#1.V#9.V#BbO#y#y#y#y#y#y#y",
|
||||
"#B#y#ybKagbDaq#u.JbGbtbtbt.QbpbC#h.d.JbC.JbP.X.ta1bK#y#y#y#y#y#y#y#y#y#y#y#y.D#9#9#9#BbO#y#y#y#y#y#y#y",
|
||||
"bo.G#y.oas.lbj.Jbt.Qbt.J.J.9bk.JbvbG.d.dbtbvbvbf#Ta1#y#y#yaN#y#y#y#y#y#y#y#y.D.V#9.V#BbO#y#y#y#y#y#y#y",
|
||||
"#B#y.Yah.8bv.QbJ.j#m#K#X#palal.Na8#qaO#l#Dbt.j.J#zaja1#yaN#y#y#y#y#y#y#y#y#y.D#9#9#9#faN#y#y#y#y#y#y#y",
|
||||
"bg#ybqa6...jbi.J.S#3.tbw.Y.Ya1aY.Rbw.Lbm#ubGbtbC.7ap#n#y#y#yaN#y#y#y#y#y#y#y.D#9.V#9#B#y#y#y#y#y#y#y#y",
|
||||
"bza1b..J.ZbibC.g.F.0#y#y.G#y#y#ybK#y#yb##CaF.d.c.da3.Pa2#yaN.G#y#y#y#y#y#y#y.D#9#9.V#BbO#y#y#y#y#y#y#y",
|
||||
"bz#Ia6..aZ.jbG#ea1#y#y#y#y#y#y#y#y#y#y#y.oaE.y.z.rbjax#Y#yaD.v#N.h.hbsbs.hbs.x#9#9#9.x.h#Nbs.hbs.hbs#j",
|
||||
"#Ha4aObG#DbG#ubabK#y.G#y#y#y#y.5#yaNaNaN#y#W#s.JbxbtbC.6a1#yaAa.#9.1#9.1.1#9#9#9#9#9bd#9.1.1.1#9#9.1.B",
|
||||
"#H.AaObGbGbtab#5bK#y#y.G#y#y#y#y#y#yaN.G#ya1bL.zbt.dbnaz.3#y.h.1aB.V#9aB.V#9#9#9#9#9#9#9.V.V#9.V.V#9.B",
|
||||
"#H#AaO.Q#DbtbkaEa1#y#y.G#y#y#yaN#yaN#yaNaN#y##.O.z#m#Rap#n#ybs.1.V.1#9#9#9.1#9.Vbd#9#9#9#9#9#9.1.V.1.B",
|
||||
"bg#t#KbC.rbt.d#s#WbK#y#y#y#yaN#yaN#y#yaNaNbK#gaIaHaIaibb#I#y#r#1#1#1.D#1#1#1.x#9#9#9a..D#1#1#1#1#1#1b#",
|
||||
"bgaraabjbi.Qbp#mbuaJbI#y#y#y#y#yaNaN#y#y#y#ybK#y#y#y#y#y#y#y#y#y#y#y#y#y#y#y#1#9.V#9#fbO#y#y#y#y#y#y#y",
|
||||
"bga5.kbCbt.rbx.z.7ak#Z#Pa4.0#y#y#y#y#y#y#y#j#y#y.5#y#y#y#yaN#y#y#y#y#y#y#y#y#f#9#9.V#B#y#y#y#y#y#y#y#y",
|
||||
"bo#y#Qa7.Zbt.r.Q.QbC.Z#h.2#8#C#A.4ar#r#y#y#yaNaN#y#y#y#y#y#yaN#y#y#y#y#y#y#yaM.V#9.V#fbO#y#y#y#y#y#y#y",
|
||||
"bo#y.YaIam..bv.Qbtbtbt#laS#Ra0aKaka#ae#c.ea2bK#y#y#yaN.G#y#y.5#y#y#y#y#y#y#y.D#9bd#9#faN#y#y#y#y#y#y#y",
|
||||
"bo.G#ya5at#d#UaS#D#Dbi.r.r.QbtbtbG.Z.Z.jaban.f#.bO#y#y#y#y#y.5#y#y#y#y#y#y#y.D.V#9.VbobO#y#y#y#y#y#y#y",
|
||||
"boaN#y#ya1bcaLax#U.JbCbGbp.Q.9bt.j.j.j.j.J.zaK.U#Pa2bK#y#y#y#y#y#yaN#y#y#y#y.D.VaBaBbzbO#y#y#y#y#y#y#y",
|
||||
"#B#y#y#yaNbK.oaf#Jan.C.ObCbC.d.d.j.jbi.rbi.j#l#0#KaX#I#y.5.G.G#y#y#y#y#y#y#y#1.xa..1.D#y#y#y#y#y#y#y#y",
|
||||
"bo#y#yaN.5#y#y#ybK#FaW.Paq#o#b.7bv.J#hbt.j.jaZawbnaFaEa1.5aN#y#y#y#y#y#y#y#y.h#7.h.B.h#y#y#y#y#y#y#y#y",
|
||||
"#B#y.G.G#y.G#y.G#y#y.Y#IaoaJ#GaXaq#w#0.Jbtbi#Dbibi.J.MaobK.G.G#y#y#y#y#y#y#yaN#y#yaN#y#yaN#y#y#y#y#y#y",
|
||||
"bg#y#y#y#y#yaN#y#y#ybKbKbKbKbKa1.3#Y.F.kbBbC.dbiaU.jbv#3.o#yaD#y#y#y#y#y#y#y#y#y#y#y#y#y#y#y#y#y#y#y#y",
|
||||
"#HbK#y.5#y#y.G.G.G#y#y#y#y#y#y#y#y#y#y.0#Tbha3.j#Dbibv#zaf#y.G#y#y#y#y#y#y#y#y#y#y#y#y#y#y#y#y#y#y#y#y",
|
||||
"#Ha1a1a1a1#y.GaN#y#y#y#y#y#y.GaN#y.G#y#y#y.K#Mbj.jbi.jbP#c#y#y#y#y#y#y#y#y#y#y#y#y#y#y#y#y#y#y#y#y#y#y",
|
||||
".a.##i.#au#t#y#yaN#y#y#y#y#y.GaN.G.G.GbA#y#y#P.O.jbt.jbv#LbK#y#y#y#y#y#y#y#y#y#y#y#y#y#y#y#y#y#y#y#y#y",
|
||||
".T#0#0#0aK#EbK#y#y.G#y#y#y#y#y#y#y#y.G#y#y#y#gaG.JbC.jbn#ebK#y#y#y#y#y#y#y#y#y#y#y#y#y#y#y#y#y#y#y#y#y",
|
||||
"br#m.QbC.JaR.3#yaNaN#y#y#y#y#y#y#y#yaN.GaD.G#Wbhbv.j.Q.JaXbK#y#y#y#y#y#y#y#y#y#y#y#y#y#y#y#y#y#y#y#y#y",
|
||||
"#v#0.d.j.J.8#Q#y#y.G#y#y#y#ybK#y#yaN#y#ybObK.ebHbvbtbt#l#LbK#y#y#y#y#y#y#y#y#y#y#y#y#y#y#y#y#y#y#y#y#y",
|
||||
".NbP.j.r.d#h#LbK#y#y#y#y#ybK#ybKbK#y#y#y#y#y#P.ObGbt.Z.Ea9#y#y#y#y#y#y#y#y#y#y#y#y#y#y#y#y#y#y#y#y#y#y",
|
||||
"at.s.Jbt#D.ZaxbabO#y#y#ybK#y#y#y#y#y#y#y#y#4an.Jbt#D.n.2#Y#y#y#y#y#y#y#y#y#y#y#y#y#y#y#y#y#y#y#y#y#y#y",
|
||||
"bMaT#k.Z#D#O.n.UbeaN#y#y#y#y#y#y#y#y#y#y.0ai.gbC#DbibGav#F#y.G#y#y#y#y#y#y#y#y#y#y#y#y#y#y#y#y#y#y#y#y",
|
||||
"#B.0#Ebnbp#ObGbG.8.PbcaYa1a1.YbKbKbKaYaW#x#h.Zbibtbj.2#Q#y#yaN#y#y#y#y#y#y#y#y#y#y#y#y#y#y#y#y#y#y#y#y",
|
||||
"bo#y.e#X.J.j.r#DaS#hbHbFaCau.p#V.iaC.sam.JbG.r#Dbv.HbN.5.5aNaN#y#y#y#y#y#y#y#y#y#y#y#y#y#y#y#y#y#y#y#y",
|
||||
"#B#ybKaPa#a0.EbC#h.d.zbC#mawaw#u.S.d.J.d.jbCbC#b#d#G.o#y#j#y#y#y#y#y#y#y#y#y#y#y#y#y#y#y#y#y#y#y#y#y#y",
|
||||
"bzbObKa1.KaL#2#la3bCbC.d.j.jbGbvbGbtbt.jbCbj.yblaJ.YbKbKbK#y#y#y#y#y#y#y#y#y#y#y#y#y#y#y#y#y#y#y#y#y#y",
|
||||
"#B#yaN#y#ya5aPaiak#o#mbj.zbC#h.j.d.d.z.7br#M#P#I#y#yaN#y#y#y#y#y#y#y#y#y#y#y#y#y#y#y#y#y#y#y#y#y#y#y#y",
|
||||
"#B#y#y#yaN#y.5ag.K.t.w.I#6.Ca7a7#zbE.Iacbc.q.Y#y#y#y#y.G#y.5bK#y#y#y#y#y#y#y#y#y#y#y#y#y#y#y#y#y#y#y#y",
|
||||
"bo#y#y#y#y.5#y#y#y#y#y#ybO#r#r.5by.5#y#y#y#y#y#y#y#y#y#y#y#ybO#y#y#y#y#y#y#y#y#y#y#y#y#y#y#y#y#y#y#y#y"
|
||||
};
|
||||
37
elpa/ess-20180701.100/etc/icons/spluslogo.xpm
Normal file
37
elpa/ess-20180701.100/etc/icons/spluslogo.xpm
Normal file
@@ -0,0 +1,37 @@
|
||||
/* XPM */
|
||||
static char *spluslogo[]={
|
||||
"24 24 10 1",
|
||||
"a c None s backgroundToolBarColor",
|
||||
"g c #000000",
|
||||
"h c #838383",
|
||||
"# c #ce3000",
|
||||
"f c #ce3062",
|
||||
"e c #ce6262",
|
||||
". c #ce629b",
|
||||
"b c #cecece",
|
||||
"d c #ffcece",
|
||||
"c c #ffceff",
|
||||
".##aaaa###aa#aab#a#ba.##",
|
||||
"#a#caaa#db#a#aab#a#bd#a#",
|
||||
"##caaaa#b#.a#aad#a#ba##c",
|
||||
"a.#a##a##.ca#aab#a#daa.#",
|
||||
"ea#aaaa#daaa#aab#a#bbea#",
|
||||
"##.aaaa#daaa###a.f#ac##.",
|
||||
"aaaaaaaaaaaaaaaaaaaaaaaa",
|
||||
"aaaaaaaaaaaaaaaaaaaaaaaa",
|
||||
"aaaaaggga###ahhhaaaaaaaa",
|
||||
"aaaaaggga###ahhhaaaaaaaa",
|
||||
"aaaaaggga###ahhhaaaaaaaa",
|
||||
"aaaaaaaaaaaaaaaaaaaaaaaa",
|
||||
"aaaaa###ahhhaaaahhhaaaaa",
|
||||
"aaaaa###ahhhaaaahhhaaaaa",
|
||||
"aaaaa###ahhhaaaahhhaaaaa",
|
||||
"aaaaaaaaaaaaaaaaaaaaaaaa",
|
||||
"aaaaahhhaaaahhha###aaaaa",
|
||||
"aaaaahhhaaaahhha###aaaaa",
|
||||
"aaaaahhhaaaahhha###aaaaa",
|
||||
"aaaaaaaaaaaaaaaaaaaaaaaa",
|
||||
"aaaaaaaahhha###agggaaaaa",
|
||||
"aaaaaaaahhha###agggaaaaa",
|
||||
"aaaaaaaahhha###agggaaaaa",
|
||||
"aaaaaaaaaaaaaaaaaaaaaaaa"};
|
||||
44
elpa/ess-20180701.100/etc/icons/spluslogo.xpm.safe
Normal file
44
elpa/ess-20180701.100/etc/icons/spluslogo.xpm.safe
Normal file
@@ -0,0 +1,44 @@
|
||||
/* XPM */
|
||||
static char *spluslogo[] = {
|
||||
/* width height num_colors chars_per_pixel */
|
||||
" 24 24 13 1",
|
||||
/* colors */
|
||||
". c #000000",
|
||||
"# c #303062",
|
||||
"a c #494949",
|
||||
"b c #626262",
|
||||
"c c #838383",
|
||||
"d c #ce3000",
|
||||
"e c #ce3062",
|
||||
"f c #ce6262",
|
||||
"g c #ce629b",
|
||||
"h c #cecece",
|
||||
"i c #ffcece",
|
||||
"j c #ffceff",
|
||||
"k c None",
|
||||
/* pixels */
|
||||
"gddkkkkdddiidkkhdkdhkgdd",
|
||||
"dkdjkkkdihdidkkhdkdhidkd",
|
||||
"ddjkkkkdhdgidkkidkdhkddj",
|
||||
"kgdkddkddgjidkkhdkdikkgd",
|
||||
"fkdiiikdikkidkkhdkdhhfkd",
|
||||
"ddgkkkkdikkidddkgedkjddg",
|
||||
"kkkkkkkkkkkkkkkkkkkkkkkk",
|
||||
"kkkkkkkkkkkkkkkkkkkkkkkk",
|
||||
"kkkkk...kdddkccckkkkkkkk",
|
||||
"kkkkk...kdddkccckkkkkkkk",
|
||||
"kkkkk...kdddkccckkkkkkkk",
|
||||
"kkkkkkkkkkkkkkkkkkkkkkkk",
|
||||
"kkkkkdddkccckkkkccckkkkk",
|
||||
"kkkkkdddkccckkkkccckkkkk",
|
||||
"kkkkkdddkccckkkkccckkkkk",
|
||||
"kkkkkkkkkkkkkkkkkkkkkkkk",
|
||||
"kkkkkccckkkkccckdddkkkkk",
|
||||
"kkkkkccckkkkccckdddkkkkk",
|
||||
"kkkkkccckkkkccckdddkkkkk",
|
||||
"kkkkkkkkkkkkkkkkkkkkkkkk",
|
||||
"kkkkkkkkccckdddk...kkkkk",
|
||||
"kkkkkkkkccckdddk...kkkkk",
|
||||
"kkkkkkkkccckdddk...kkkkk",
|
||||
"kkkkkkkkkkkkkkkkkkkkkkkk"
|
||||
};
|
||||
161
elpa/ess-20180701.100/etc/icons/startr.xpm
Normal file
161
elpa/ess-20180701.100/etc/icons/startr.xpm
Normal file
@@ -0,0 +1,161 @@
|
||||
/* XPM */
|
||||
static char *rlogo3[] = {
|
||||
/* width height num_colors chars_per_pixel */
|
||||
" 24 24 130 2",
|
||||
/* colors */
|
||||
".. c None s backgroundToolBarColor",
|
||||
".# c #747684",
|
||||
".a c #acaeac",
|
||||
".b c #8492bc",
|
||||
".c c #94a2c4",
|
||||
".d c #c4cacc",
|
||||
".e c #84868c",
|
||||
".f c #3c424c",
|
||||
".g c #949aac",
|
||||
".h c #bcbec4",
|
||||
".i c #545e74",
|
||||
".j c #d4dae4",
|
||||
".k c #94a2d4",
|
||||
".l c #8492c4",
|
||||
".m c #7486ac",
|
||||
".n c #a4b2d4",
|
||||
".o c #ccd2e4",
|
||||
".p c #9caacc",
|
||||
".q c #8c9ac4",
|
||||
".r c #848eac",
|
||||
".s c #444e64",
|
||||
".t c #949acc",
|
||||
".u c #bcc2ec",
|
||||
".v c #dce2e4",
|
||||
".w c #b4bad4",
|
||||
".x c #5c6674",
|
||||
".y c #d4daec",
|
||||
".z c #9ca2d4",
|
||||
".A c #acbae4",
|
||||
".B c #7c82a4",
|
||||
".C c #6c769c",
|
||||
".D c #d4d2d4",
|
||||
".E c #8c92c4",
|
||||
".F c #7c8eac",
|
||||
".G c #a4b2dc",
|
||||
".H c #545664",
|
||||
".I c #8c92ac",
|
||||
".J c #8c8e94",
|
||||
".K c #949abc",
|
||||
".L c #5c5e74",
|
||||
".M c #7c86ac",
|
||||
".N c #747ea4",
|
||||
".O c #242a34",
|
||||
".P c #9ca2bc",
|
||||
".Q c #8c8a8c",
|
||||
".R c #6c6e7c",
|
||||
".S c #7482b4",
|
||||
".T c #9c9aa4",
|
||||
".U c #b4bedc",
|
||||
".V c #dcdedc",
|
||||
".W c #94a6d4",
|
||||
".X c #8496c4",
|
||||
".Y c #acb2cc",
|
||||
".Z c #ccd2f4",
|
||||
".0 c #8c9ad4",
|
||||
".1 c #848ebc",
|
||||
".2 c #949ed4",
|
||||
".3 c #9ca6dc",
|
||||
".4 c #7c8abc",
|
||||
".5 c #7482a4",
|
||||
".6 c #3c3a3c",
|
||||
".7 c #9ca6bc",
|
||||
".8 c #747a8c",
|
||||
".9 c #acaebc",
|
||||
"#. c #8496b4",
|
||||
"## c #c4cadc",
|
||||
"#a c #545e84",
|
||||
"#b c #747aa4",
|
||||
"#c c #64728c",
|
||||
"#d c #ccd6ec",
|
||||
"#e c #9caadc",
|
||||
"#f c #8c9ecc",
|
||||
"#g c #949ec4",
|
||||
"#h c #bcc6f4",
|
||||
"#i c #9ca6cc",
|
||||
"#j c #8c96c4",
|
||||
"#k c #8c96bc",
|
||||
"#l c #5c6274",
|
||||
"#m c #7c8ab4",
|
||||
"#n c #4c4e6c",
|
||||
"#o c #9c9ea4",
|
||||
"#p c #acb6d4",
|
||||
"#q c #acaeb4",
|
||||
"#r c #848694",
|
||||
"#s c #3c465c",
|
||||
"#t c #bcbecc",
|
||||
"#u c #545e7c",
|
||||
"#v c #d4dee4",
|
||||
"#w c #6c7aa4",
|
||||
"#x c #94a2dc",
|
||||
"#y c #8492cc",
|
||||
"#z c #7486b4",
|
||||
"#A c #646a84",
|
||||
"#B c #9caad4",
|
||||
"#C c #8c9acc",
|
||||
"#D c #848eb4",
|
||||
"#E c #4c4e54",
|
||||
"#F c #bcc6e4",
|
||||
"#G c #5c668c",
|
||||
"#H c #d4deec",
|
||||
"#I c #7c82ac",
|
||||
"#J c #6c7a9c",
|
||||
"#K c #a4aac4",
|
||||
"#L c #d4d6dc",
|
||||
"#M c #a4b2e4",
|
||||
"#N c #545674",
|
||||
"#O c #b4bac4",
|
||||
"#P c #8c96b4",
|
||||
"#Q c #c4c6cc",
|
||||
"#R c #7c86b4",
|
||||
"#S c #2c2e3c",
|
||||
"#T c #bcc2d4",
|
||||
"#U c #ccced4",
|
||||
"#V c #6c727c",
|
||||
"#W c #c4cedc",
|
||||
"#X c #4c526c",
|
||||
"#Y c #747eac",
|
||||
"#Z c #9ca2c4",
|
||||
"#0 c #8c8a94",
|
||||
"#1 c #dcdee4",
|
||||
"#2 c #94a6dc",
|
||||
"#3 c #8496cc",
|
||||
"#4 c #acb2d4",
|
||||
"#5 c #848ec4",
|
||||
"#6 c #dcdef4",
|
||||
"#7 c #7482ac",
|
||||
"#8 c #949ecc",
|
||||
"#9 c #9ca6d4",
|
||||
"a. c #8c96cc",
|
||||
"a# c #5c627c",
|
||||
/* pixels */
|
||||
"................................................",
|
||||
"................................................",
|
||||
".....d.y#H#v.j#v.j#v.y#v#v.j.j#W#F#p............",
|
||||
"....#4.b#J#w#I.P#i#g#Z#8#Z#j#R#Y#ma.#P.j........",
|
||||
".....Y.l.5.X.u.P.i#n.s#n#u#b#8.X.4.4.M#r........",
|
||||
".....Y#y#z.3.G#X.Q.Q.Q#0.J#r#a.b#ja..E.C........",
|
||||
".....Y#y.m.k#8.x.............Y#m.4.2.z.H.T......",
|
||||
".....Y.E.S.k#8#l...............q#z.0.3#N.g......",
|
||||
".....Y.l#z#9.ta#..............#B#Y.k.G.L#Q......",
|
||||
".....Y.E.m.2.t.C............#6.I.F#d.I#s........",
|
||||
".....Y.l#za..l.g#L#1.v#1.o#U#K#P###T#S#o........",
|
||||
".....Y.X#7a.#j.b#C.p.c#..N.C.K#W#r.O.6.D........",
|
||||
".....Y#y#7.2.Z.o.I.B.I#9#f#x#h#s#E#q............",
|
||||
".....Y#j#7.W.u.i.6.f#X#A#j#2#e#X#T..............",
|
||||
".....Y#y.m.k#8#l......#O#G#j#f.F.w..............",
|
||||
".....Y#y#I#x#8#l.........9.N.l#R.1#J#Q..........",
|
||||
".....Y#5#z.k#8#l........#O#c#D#5#5.b.I.V........",
|
||||
"....#4.l#R.k.t#l...........9.N.l#3.E.C.g........",
|
||||
".....Y#y.m#x#8.x.............g.b#3#C.1.C#U......",
|
||||
"....#4.E#k.A#i#l.............7#Y.X#M.p.B.g......",
|
||||
".....Y.1.c.U.K.i..............#G#m.n#p.r.i......",
|
||||
"....#t.8#V#A.R.e...............h.8.R.R.R.#.a....",
|
||||
"................................................",
|
||||
"................................................"
|
||||
};
|
||||
40
elpa/ess-20180701.100/etc/icons/switch_ess.xpm
Normal file
40
elpa/ess-20180701.100/etc/icons/switch_ess.xpm
Normal file
@@ -0,0 +1,40 @@
|
||||
/* XPM */
|
||||
static char *switch_ess[]={
|
||||
"24 24 13 1",
|
||||
". c None s backgroundToolBarColor",
|
||||
"a c #000000",
|
||||
"e c #131313",
|
||||
"# c #1532ed",
|
||||
"d c #313131",
|
||||
"k c #434343",
|
||||
"j c #535353",
|
||||
"h c #707070",
|
||||
"b c #878787",
|
||||
"i c #949494",
|
||||
"g c #a0a0a0",
|
||||
"f c #bfbfbf",
|
||||
"c c #c3c3c3",
|
||||
"........................",
|
||||
"........................",
|
||||
"........................",
|
||||
"........................",
|
||||
"..###...................",
|
||||
"..###...................",
|
||||
"..###...................",
|
||||
"..###.aaaab.cdedc.cdedc.",
|
||||
"..###.af....ag....ag....",
|
||||
"..###.af....ba....ba....",
|
||||
"..###.aaad...fah...fah..",
|
||||
"..###.af.......ga....ga.",
|
||||
"..###.af....i..jk.i..jk.",
|
||||
"..###.aaaak.jeej..jeej..",
|
||||
"..###...................",
|
||||
"..###...................",
|
||||
"..###...................",
|
||||
"..###...........#.......",
|
||||
"..###...........##......",
|
||||
"..#################.....",
|
||||
"..##################....",
|
||||
"...################.....",
|
||||
"................##......",
|
||||
"................#......."};
|
||||
112
elpa/ess-20180701.100/etc/icons/switchr.xpm
Normal file
112
elpa/ess-20180701.100/etc/icons/switchr.xpm
Normal file
@@ -0,0 +1,112 @@
|
||||
/* XPM */
|
||||
static char *rt4[]={
|
||||
"24 24 85 2",
|
||||
"Qt c None s backgroundToolBarColor",
|
||||
".V c #14162c",
|
||||
".A c #1c263c",
|
||||
"#d c #24263c",
|
||||
".K c #242e44",
|
||||
".H c #2c3244",
|
||||
"#o c #2c3644",
|
||||
".Q c #34364c",
|
||||
".Z c #3c3e54",
|
||||
".N c #3c4264",
|
||||
".q c #444664",
|
||||
".p c #444a64",
|
||||
"#. c #444e64",
|
||||
".r c #4c4e6c",
|
||||
".w c #4c566c",
|
||||
"#m c #545e74",
|
||||
"#j c #546284",
|
||||
".B c #54628c",
|
||||
"#e c #5c6284",
|
||||
".4 c #5c6a9c",
|
||||
"#k c #646a8c",
|
||||
"#p c #646e8c",
|
||||
".5 c #646e9c",
|
||||
".S c #647294",
|
||||
".b c #647a94",
|
||||
".c c #6c769c",
|
||||
".h c #6c7aa4",
|
||||
".3 c #6c7ea4",
|
||||
".k c #747ea4",
|
||||
".O c #7482b4",
|
||||
".u c #7482bc",
|
||||
".i c #7486b4",
|
||||
".X c #7c82a4",
|
||||
".d c #7c86a4",
|
||||
".g c #7c86ac",
|
||||
"#b c #7c86b4",
|
||||
".E c #7c86bc",
|
||||
"#h c #7c8abc",
|
||||
".L c #7c8ac4",
|
||||
".a c #7c8eb4",
|
||||
"## c #848eac",
|
||||
".# c #848ebc",
|
||||
".2 c #8492b4",
|
||||
".m c #8492bc",
|
||||
".l c #8492c4",
|
||||
".I c #8492cc",
|
||||
".t c #8496c4",
|
||||
".f c #8c92b4",
|
||||
".v c #8c92c4",
|
||||
".W c #8c92cc",
|
||||
".7 c #8c96a4",
|
||||
".e c #8c96bc",
|
||||
".F c #8c96c4",
|
||||
"#l c #8c96cc",
|
||||
".y c #8c9ac4",
|
||||
".C c #8c9ad4",
|
||||
"#f c #8c9ed4",
|
||||
".1 c #949ac4",
|
||||
".0 c #949ad4",
|
||||
".D c #949ecc",
|
||||
"#g c #94a2d4",
|
||||
".Y c #9ca6c4",
|
||||
".j c #9caadc",
|
||||
"#a c #9caae4",
|
||||
".J c #a4aae4",
|
||||
".T c #a4aed4",
|
||||
".P c #a4aee4",
|
||||
"#i c #a4b2ec",
|
||||
".9 c #acaebc",
|
||||
".s c #acb2e4",
|
||||
"#n c #acb2ec",
|
||||
".G c #acb6e4",
|
||||
".M c #b4baf4",
|
||||
".o c #b4bedc",
|
||||
"#c c #b4bef4",
|
||||
"#s c #b4c6ec",
|
||||
".n c #bcc2ec",
|
||||
".z c #bcc2fc",
|
||||
".U c #c4cef4",
|
||||
".6 c #ccd2ec",
|
||||
".8 c #ccd2fc",
|
||||
".R c #ccd6ec",
|
||||
"#r c #d4defc",
|
||||
"#q c #d4e2fc",
|
||||
".x c #1532ed",
|
||||
"QtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQt",
|
||||
"QtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQt",
|
||||
"QtQtQtQtQtQtQt.#.a.b.c.d.e.e.e.f.g.h.i.j.kQtQtQt",
|
||||
"QtQtQtQtQtQtQt.l.i.m.n.o.p.q.q.r.g.s.t.u.v.wQtQt",
|
||||
"QtQt.x.x.xQtQt.m.i.y.z.AQtQtQtQtQt.B.#.C.D.rQtQt",
|
||||
"QtQt.x.x.xQtQt.m.E.F.G.HQtQtQtQtQtQt.m.I.J.rQtQt",
|
||||
"QtQt.x.x.xQtQt.#.i.t.s.KQtQtQtQtQtQt.D.L.M.NQtQt",
|
||||
"QtQt.x.x.xQtQt.#.O.y.P.QQtQtQtQtQt.R.S.T.U.VQtQt",
|
||||
"QtQt.x.x.xQtQt.#.i.t.W.FQtQtQtQtQt.X.Y.U.ZQtQtQt",
|
||||
"QtQt.x.x.xQtQt.#.i.m.0.1.t.2.3.4.5.6.7.VQtQtQtQt",
|
||||
"QtQt.x.x.xQtQt.#.i.l.8.9.Q#.##.P#a.GQtQtQtQtQtQt",
|
||||
"QtQt.x.x.xQtQt.##b.t#c#dQtQtQt#e#f#g.SQtQtQtQtQt",
|
||||
"QtQt.x.x.xQtQt.##h.t#i.KQtQtQtQt#b.m#h.aQtQtQtQt",
|
||||
"QtQt.x.x.xQtQt.#.O.t#i.KQtQtQtQt#j.#.l.l#kQtQtQt",
|
||||
"QtQt.x.x.xQtQt.F.O.y.s.HQtQtQtQtQt#b.l#l.##mQtQt",
|
||||
"QtQt.x.x.xQtQt.##b.F#n#oQtQtQtQtQt#j.F#f.m#pQtQt",
|
||||
"QtQt.x.x.xQtQt.#.t#q#r.KQtQtQtQtQtQt.i#s#q.YQtQt",
|
||||
"QtQt.x.x.xQtQtQtQtQtQtQtQtQtQtQt.xQtQtQtQtQtQtQt",
|
||||
"QtQt.x.x.xQtQtQtQtQtQtQtQtQtQtQt.x.xQtQtQtQtQtQt",
|
||||
"QtQt.x.x.x.x.x.x.x.x.x.x.x.x.x.x.x.x.xQtQtQtQtQt",
|
||||
"QtQt.x.x.x.x.x.x.x.x.x.x.x.x.x.x.x.x.x.xQtQtQtQt",
|
||||
"QtQtQt.x.x.x.x.x.x.x.x.x.x.x.x.x.x.x.xQtQtQtQtQt",
|
||||
"QtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQt.x.xQtQtQtQtQtQt",
|
||||
"QtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQt.xQtQtQtQtQtQtQt"};
|
||||
32
elpa/ess-20180701.100/etc/icons/switchs.xpm
Normal file
32
elpa/ess-20180701.100/etc/icons/switchs.xpm
Normal file
@@ -0,0 +1,32 @@
|
||||
/* XPM */
|
||||
static char *switchs[]={
|
||||
"24 24 5 1",
|
||||
". c None",
|
||||
"# c #000000",
|
||||
"c c #1532ed",
|
||||
"b c #838383",
|
||||
"a c #ce3000",
|
||||
"........................",
|
||||
"........###.aaa.bbb.....",
|
||||
"........###.aaa.bbb.....",
|
||||
"........###.aaa.bbb.....",
|
||||
"..ccc...................",
|
||||
"..ccc...aaa.bbb....bbb..",
|
||||
"..ccc...aaa.bbb....bbb..",
|
||||
"..ccc...aaa.bbb....bbb..",
|
||||
"..ccc...................",
|
||||
"..ccc...bbb....bbb.aaa..",
|
||||
"..ccc...bbb....bbb.aaa..",
|
||||
"..ccc...bbb....bbb.aaa..",
|
||||
"..ccc...................",
|
||||
"..ccc......bbb.aaa.###..",
|
||||
"..ccc......bbb.aaa.###..",
|
||||
"..ccc......bbb.aaa.###..",
|
||||
"..ccc...................",
|
||||
"..ccc...........c.......",
|
||||
"..ccc...........cc......",
|
||||
"..ccccccccccccccccc.....",
|
||||
"..cccccccccccccccccc....",
|
||||
"...cccccccccccccccc.....",
|
||||
"................cc......",
|
||||
"................c......."};
|
||||
3
elpa/ess-20180701.100/etc/pkg-Maintainers
Normal file
3
elpa/ess-20180701.100/etc/pkg-Maintainers
Normal file
@@ -0,0 +1,3 @@
|
||||
Debian: Dirk Eddelbuettel <edd@debian.org>
|
||||
RPM: Tom Moertel <tom@moertel.com>
|
||||
SuSe: Detlef Steuer <steuer@hsu-hh.de>
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user