diff -Nru ess-16.10/ANNOUNCE ess-17.11/ANNOUNCE --- ess-16.10/ANNOUNCE 1970-01-01 00:00:00.000000000 +0000 +++ ess-17.11/ANNOUNCE 2017-11-13 14:13:21.000000000 +0000 @@ -0,0 +1,1068 @@ +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. + +1.1 Getting the Latest Version +============================== + +The latest released version of ESS is always available on the web at: +ESS web page (http://ess.r-project.org) or StatLib +(http://lib.stat.cmu.edu/general/ESS/) + +1.1.1 Git for ESS development +----------------------------- + +For development and experimentation on new ESS features, there is now a +GitHub branch for ESS, available at . + +1.2 Current Features +==================== + + * Languages Supported: + * S family (R and S+ AKA S-PLUS) + * SAS + * OpenBUGS/JAGS + * Stata + * Julia + * Editing source code (S family, SAS, OpenBUGS/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, OpenBUGS/JAGS) + * Use of imenu to provide links to appropriate functions + * Interacting with the process (S family, SAS, Stata, Julia) + * Command-line editing + * Searchable Command history + * Command-line completion of S 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 + +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). + +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! + +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 ; contributions +to the list may be mailed to . 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. + +1.6 Reporting Bugs +================== + +Please send bug reports, suggestions etc. to + + 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. + +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) + +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. + +1.9 New Features +================ + +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 + + Changes and New Features in 15.09: + + * ESS[R]: The indentation logic has been refactored. It should be + faster, more consistent and more flexible. There are three types + of indentation settings, those starting with 'ess-offset-' give the + actual offsets, those starting with 'ess-indent-' are control + (commonly Boolean) variables, and those starting with 'ess-align-' + are vertical alignment overrides which inhibit default offsets in + specific situations. See 'ess-style-alist' for detailed + description of the new indentation system and provided default + indentation styles. + + * ESS[R]: Deprecation of old indentation settings. As a consequence + of the indentation re-factoring 'ess-brace-imaginary-offset', + 'ess-expression-offset' and all delimiter-specific offsets are + deprecated. The settings for indentation of continued statements + have been replaced by 'ess-offset-continuations'. It can be set to + either 'cascade' or 'straight' (the default). + 'ess-arg-function-offset' has been replaced by + 'ess-indent-from-lhs' and has been generalised to assignments. + This setting now works with both statement blocks and expressions + and only takes effect for offsets set to 'prev-call' and + 'open-delim' in order to produce a consistent indentation. + + * ESS: A test framework has been set up. + + * ESS[R]: A new RStudio style is provided to mimic as closely as + possible R files indented via RStudio. To reproduce the setup of + some of the RStudio users, the RStudio- style with + 'ess-offset-arguments' set to 'prev-line' is also provided. In + addition, the new RRR+ style is equivalent to RRR except it indents + blocks in function calls relatively to the opening delimiter. This + style does not try to save horizontal space and produces more + indentation. + + * ESS[R]: Roxygen fields will now be indented on paragraph refilling + in order to make the documentation more readable. You can also + refill commented lines in the 'examples' field without squashing + the surrounding code in the comments. + + * ESS[R]: ESS can now format your code! This is controlled through + the settings 'ess-fill-calls' and 'ess-fill-continuations'. When + activated, '(fill-paragraph)' formats your calls and your + formulas/continuations while making sure they don't go past + 'fill-column'. Repeated refills cycle through different styles + (see the docstrings for more details). By default, the refilled + region blinks. Set 'ess-blink-filling' to nil to prevent this. + + * ESS[R]: Fix occasional missing error location fontification in + inferior buffers. + + * ESS[R]: ess-developer now correctly assigned the environment of new + functions to the package namespace. + + * ESS[Julia]: ?[topic] now works in the *julia* buffer. Note that + support for editing Julia code now depends on 'julia-mode.el' from + the Julia project. If you install ESS from the official + tarball/zip file, 'julia-mode.el' is already included. Otherwise, + if you install ESS by running 'make', then the latest version of + 'julia-mode.el' is downloaded (and so you need an active internet + connection to install) during the installation process. + Alternatively, if you run ESS without running 'make', then ensure + that you have the 'julia-mode.el', which you can get easily from + MELPA for example. + + * iESS: For naming inferior processes, ESS can use 'projectile''s + project root and it does so when + 'ess-gen-proc-buffer-name-function' is set to + 'ess-gen-proc-buffer-name:projectile-or-simple' as by default, or + to another value beginning with + 'ess-gen-proc-buffer-name:projectile-*'. + + Changes and New Features in 15.03-1: + * ESS[R]: An indentation bug has been fixed (github issue 163) + * ESS[R]: On windows, if 'ess-prefer-higher-bit' is non-nil (the + default), then R-newest will try to run a 64 bit (rather than 32 + bit) version of R. + + Changes and New Features in 15.03: + * ESS[R]: Full native support for 'company-mode'. + * ESS[R]: More efficient caching algorithm for R completion. + * ESS: New offset variable 'ess-close-paren-offset' to control the + indentation of the closing parentheses. + * ESS[R]: Ask for CRAN mirror only once per emacs session. + * ESS[R]: Detect 'library' and 'require' calls for better completion + caching. + * Buffer display is now customizable ('ess-show-buffer-action'). + * Use 'y-or-n-p' instead of 'yes-or-no-p' throughout. + * More support for ODS in ess-sas-graph-view. + * Makefiles are now both UNIX and GNU friendly. + * ESS[R]: Simplify directory lookup in 'ess-developer' (#137). + * Make closed paren indentation consistent + + Bug Fixes in 15.03: + * Fix open brace indentation bug (#27 in ess/R-ESS-bugs.R). + * Fix git version lookup + * Don't check directory modtime in R dialect. + * Declare all ess macros for edebug. + * Add 'ess-smart-comma' to eldoc message functions. + * Inform users when retrieving RDA aliases. + * Line ending in '~' is also a continuation line. + * Filing roxy paragraphs works as expected now. + * In 'ess-developer-add-package', remove incorrect 'wait' argument + from 'ess-get-words-from-vector' call. + * Fix #96, #117, #120, #125, #134, #137. + * Fix ess-quit-r. Call base::q() even if it is masked. + * Fix 'ess-show-buffer' to always display the buffer in another + window. + * Makefile: Fix cd bug for directories with spaces in them + * 'ess-kill-buffer-and-go' modified to not restart R + + Changes / Selected Bug Fixes in 14.09: + * ESS[Julia]: Executable is changed to 'julia'. + * ESS[Julia]: Completion and help system was adjusted to Julia + v.0.3.0. Julia v.0.2.x is no more supported. + * ESS[R]: Running R with 'gdb' debugger now works as expected + * iESS: Inferior ESS buffers are now derived from 'comint-mode' + * ESS[R]: 'ess-execute-screen-options' uses correct screen width in + terminal sessions + * ESS: 'ess-build-tags-for-directory' works when no TAGS file name + was provided + * ESS: 'ess-offset-statement-continued' is now respected everywhere + except inside of the 'if' test condition. + * ESS: New variable 'ess-offset-statement-first-continued' for + indentation of the first line in multiline statements. + * ESSR: Starting ',' in multiline statements indentation is now + ignored to achieve a more pleasant alignment. + * ESSR: Improved behavior of 'RET' in roxygen blocks. + * ESS[R]: command cleaning with 'C-u C-u C-y' was broken with lines + containing " + " + * ESS[R]: fixed "empty watch window bug" + * ESS[R]: don't ask for help location on ac-quick-help (request of + github #81) + * ESS[R]: "importClassesFrom" and "importMethodsFrom" were added to + the list of two-parameter roxygen commands + * ESS[R]: fix vignetes display and hyperlinks (were broken in + 13.09-1) + * ESS[Julia]: recognize function names ending with ! + * ESS[Julia]: fix indentation of "for" comprehension syntax within + brackets. + + Changes / Selected Bug Fixes in 13.09-1: + * ess-remote and TRAMP: R support code is now downloaded in binary + form instead of being injected from local machine. The R code is + stored in '~/.config/ESSR/' directory on the remote machine + * TRAMP: PAGER environment variable is now correctly set to + 'inferior-ess-pager' + * retrieval of help topics on remote machines is fixed + * org-babel: source references of R code executed from org files + correctly point to source references in original org files (version + 8.2.1 or higher of org-mode is required for this feature) + * 'ess-execute' is now bound to 'C-c C-e C-e' in 'ess-extra-map'. + * completion works again in 'ess-execute' + * ESS[R]: 'head' and 'tail' methods were replaced by 'htsummary' in + 'ess-R-describe-object-at-point-commands' + * ESS[roxygen]: evaluation commands now work in roxygen blocks. + Leading comments are automatically removed before the evaluation + * ESS[transcript]: 'Clean Region' now works with multiline + statements; 'ess-transcript-clean-region' etc. correctly treat + multiline statements, i.e., no longer forgets the lines typically + preceded by '+' + * ESS[SAS]: Three features/fixes with special thanks to Matthew + Fidler https://github.com/emacs-ess/ESS/pulls/mlf176f2 + (https://github.com/emacs-ess/ESS/pulls/mlf176f2). Turn on SAS log + mode when appropriate. Indent comments and CARDS statement more + appropriately. + * ESS[SAS]: 'ess-sas-edit-keys-toggle' default returns to 'nil' + * ESS[R]: support for 'prettify-symbols-mode': contribution from + Rudiger Sonderfeld + * ESS[SWV]: knitr now evaluates in the current frame + * ESS[developer]: ess-developer doesn't kill open DESCRIPTION files + anymore + * ESS[roxygen]: 'ess-roxy-preview-HTML' is now on 'C-c C-o C-w' and + 'ess-roxy-preview-text' is now on 'C-c C-o C-t' + * ESS: installation with 'make install' was simplified and should + work out of the box on most *nix systems + * ESS installation instructions simplified + * fixed font-lock bug introduced in 13.09 that was causing very slow + process output + + Changes/New Features in 13.09: + * font-lock in process buffers doesn't "spill" over prompts. Missing + closing string delimiters should not cause wrong fontification of + the following command input. + * ESS[julia]: full features M-TAB completion and auto-complete + support, which now works for modules, structures and data types. + * ESS[julia]: a much better eldoc showing arguments of methods and + data type constructors + * ESS-developer: + - ESS-developer work-flow pattern has been streamlined: + ESS-developer is now automatically activated on per-file basis + if the file is part of a developed package + 'ess-developer-packages'. The old behavior (activation on + per-process basis) is still available on 'M-x ess-developer' + in a process buffer. + - integration with 'devtools' package. New command + 'ess-developer-load-package' calls 'load_all' on the package + containing current file. 'ess-developer-add-package' now + offers IDO menu completions with available loading methods, + currently 'library', and 'load_all'. Loading command can be + customized with 'ess-developer-load-on-add-commands'. + * 'TAB' now indents region if region is active (a contribution of + Matthew Fidler in pull #41) + * 'M-x ess-version' now reports full loading path and recognizes git + and ELPA versions. + * warning and error keyword are now highlighted with + 'font-lock-warning-face' as they should be, (for quite some time + these keywords have been hijacked by compilation mode + fontification). + * eldoc: Eldoc now recognizes multiple processes. If current process + is busy, or current buffer is not associated with a process, eldoc + picks its completions from the first available free process. + * org-babel: evaluation is now org-friendly + * help: new help buffers now try to reuse ess-help buffers. This + behavior is controlled by 'ess-help-reuse-window' custom variable. + * help: ?foo pops IDO menu on multiple help files (so far it worked + only for 'C-c C-v') + * remote evaluation is considerably faster now on slow connections + * ESS[R] tracebug R source references regular expressions are + (mostly) language agnostic. + * 'ess-function-call-face' inherits from + 'font-lock-function-name-face' rather than + 'font-lock-builtin-face'. + * 'ess-inject-source' now accepts 'function-and-buffer' option. + * Documentation: The "New Features" section (and 'NEWS') now + represent recent changes: within the last year or so. All changes + can be found in the new news.html (news.html) (or 'NEWS' and + 'ONEWS'). + * ESS[R] 'ess-rep-regexp' should no longer inf.loop (rarely!), and + hence 'M-x ess-fix-miscellaneous' should neither. + + Changes/New Features in 13.05: + * ESS[gretl]: Support for 'gretl' (both editing and sub-process + interaction). A contribution of Ahmadou Dicko. + * ESS: process output display is 4-10 times faster due to new caching + and only occasional emacs re-display (for the moment this + functionality is available only when 'ess-tracebug' is active). + * ESS: 'C-c `' is now bound to 'ess-show-traceback' and 'C-c ~' is + bound to 'ess-show-call-stack'. + * ESS[R]: ESS stores function in 'ESSR' environment to avoid kludging + users' global environment and accidental deletion. + * ESS[R]: new variable 'ess-swv-processing-command' to control + weaving and tangling. + * ESS[R]: 'ess-default-style' has been changed (from 'DEFAULT') to + 'RRR'. Use something like '(setq ess-default-style 'DEFAULT)' or + '(setq ess-indent-level 2)' in your '~/.emacs' equivalent _before_ + loading ESS, if you do not like this new "incompatible" default + style. + * ESS[julia]: ESS stores its functions in 'ESS' module. + * ESS[julia]: Eldoc is now supported in julia modes + * ESS[julia]: Adjusted error reference detection and interactive help + to julia internal changes + * ESS[R]: 'ess-use-tracebug''s default has been changed to 't'. Set + it to nil if you want to keep the previous behavior. + * ESS[tracebug]: Electric debug keys have been removed [breaking + change] The functionality was replaced with 'ess-debug-minor-mode' + and 'ess-debug-minor-mode-map'. + * ESS[tracebug]: 'ess-tracebug-map' is an alias to 'ess-dev-map' 'C-c + C-t'. + * ESS[tracebug]: 'ess-bp-toggle-state' ('C-c C-t o') can now be used + during the debug session to toggle breakpoints on the fly + (suggestion by Ross Boylan). + * ESS[tracebug]: 'ess-debug-flag-for-debugging' and + 'ess-debug-unflag-for-debugging' work correctly from the debugging + contexts. These commands also recognize non-exported functions for + the packages listed in 'ess-developer-packages' ('C-c C-t C-a'). + + * ESS[R]: Eldoc (activated by 'ess-use-eldoc') has become more + sophisticated, and hence also more intruding in the interface + between the Statistics softare, e.g., R, and the user. + + Note that you can turn off ElDoc, by placing '(setq ess-use-eldoc + nil)' in your '~/.emacs' file, prior to loading ESS, + + * ESS[SAS]: long over-looked 'SAS-mode-hook' appears! + * ESS[SAS]: 'ess-sas-edit-keys-toggle' now defaults to 't' since + 'sas-indent-line' is still broken, i.e. 'TAB' is now bound to + 'ess-sas-tab-to-tab-stop' by default + + Changes/Bug Fixes in 12.09-2: + * ESS: new 'ess-switch-to-end-of-proc-buffer' variable that controls + whether 'C-c C-z' switches to the end of process buffer. The + default is 't'. You can use prefix argument to 'C-c C-z' to toggle + this variable. + * ESS: fix in 'ess-eval-linewise' that was causing emacs to hang + during R debugging with 'ess-eval-visibly' equal to 't'. + * ESS: fix in 'ess-eval-linewise' that was causing emacs to recenter + the prompt in visible window + * ESS[tracebug]: A better handling of "Selection" prompts and debug + related singlekey commands. + * ESS: fix a bug in 'ess-switch-process' that was causing '*new*' + selection to fail. + * ESS[R]: Solve missing 'ess-local-process-name' bug in R-dired. + * ESS[SWV]: 'ess-swv-PDF' doesn't ask for a command to run if there + is only one command in 'ess-swv-pdflatex-commands'. + * ESS[SWV]: 'ess-swv-weave' gained an universal argument to allow for + an interactive choice between available weavers (sweave, knitr). + * ESS: 'ess-eval-*-and-step' functions go to next empty line at eob, + instead of staying at the last line. + + Changes/New Features in 12.09-1: + * ESS _Breaking Changes in Keys_: + + - New keymaps: 'ess-doc-map' bound to 'C-c C-d'; 'ess-extra-map' + bound to 'C-c C-e'; 'ess-dump-object-into-edit-buffer' was + moved on 'C-c C-e C-d' + - roxygen map was moved on 'C-c C-o' and 'ess-roxy-update-entry' + now resides on 'C-c C-o C-o' + - ess-handy-commands is not bound anymore + - 'ess-dev-map' (including 'ess-tracebug' and 'ess-developer') + moved on 'C-c C-t' + - 'C-c C-y' is deprecated in favor of 'C-c C-z C-z' + * ESS[R] new command 'ess-describe-object-at-point' bound to 'C-c C-d + C-e' (repeat 'C-e' or 'e' to cycle). It was inspired by Erik + Iverson's 'ess-R-object-tooltip'. Customize + 'ess-describe-at-point-method' to use tooltip instead of an + electric buffer. + * ESS: New command 'ess-build-tags-for-directory' bound to 'C-c C-e + C-t' for building dialect specific tag tables. After building tags + use 'M-.' to navigate to function and objects definitions. By + default 'C-c C-e C-t' builds tags based on imenu regular + expressions and also include other common languages '.c, .o, .cpp' + etc. But it relies on external 'find' and 'etags' commands. If + 'ess-build-tags-command' is defined (for 'R'), the inferior process + is asked to build tags instead. + * ESS: 'ess-switch-process' offers '*new*' alternative to start a new + process instead of switching to one of the currently running + processes. + * ESS: Switching between processes ('C-c C-s') uses buffer names + instead of the internal process names. Use 'M-x rename-buffer' + command to conveniently rename your process buffers. + * ESS: Process buffers can be automatically named on process creation + according to user specified scheme. Default schemes are *proc*, + *proc:dir* and *proc:abbr-long-dir* where 'proc' stands for the + internal process name and 'dir' stands for the directory where the + process was started in. The default is *proc*. For customization + see 'ess-gen-proc-buffer-name-function'. + * ESS: 'ess-eval-visibly-p' is deprecated in favor of + 'ess-eval-visibly'. + * ESS: New evaluation pattern 'nowait'. In addition to old 'nil' and + 't' values, 'ess-eval-visibly' accepts 'nowait' for a visible + evaluation with no waiting for the process. See 'ess-eval-visibly' + for details on evaluation patterns. + * ESS: New "Process" menu entry with process related commands and + configuration + * iESS: Process buffer is now automatically shown on errors + * ESS: New 'ess-switch-to-inferior-or-script-buffer' command bound to + 'C-c C-z' in both script and process buffers. If invoked form + process buffer it switches to the most recent buffer of the same + dialect. It is a single key command. + * ESSR-help: On multiple help pages with the same name, 'C-c C-v' now + asks for user resolution directly in emacs. + * ESS[R] ess-roxy: new variable 'ess-roxy-re' for fontification of + cases where the number of leading '#' differs from 'ess-roxy-str'. + * ESS[R] Eldoc was considerably enhanced. It now finds hidden + default S3 methods and displays non-default methods' arguments + after trailing ||. + * ESS[R]: New 'ess-display-demos' command bound to 'C-c C-d o' and + 'C-c C-d C-o' + * ESS: New 'ess-help-web-search' command bound to 'C-c C-d w' and + 'C-c C-d C-w' to facilitate interactive search of web resources. + Implemented for 'R', 'Stata' and 'Julia'. See also + 'ess-help-web-search-command'. + * ESS: ess-pdf-viewer-pref accepts now command line arguments + * ESS[Rnw]: Add knitr support. Customize 'ess-swv-processor' for the + default processor. + * ESS[Rnw]: More thorough renaming of remaining 'noweb-*' to + 'ess-noweb-*'. + * ESS[Rnw] new commands 'ess-eval-chunk-and-step' and + 'ess-eval-chunk' bound to 'M-n C-c' and 'M-n C-M-x' to mirror + standard ess commands in C-c map. + * ESS[R] Auto-completion: new variable 'ess-ac-R-argument-suffix' to + customize the insertion of trailing "=". Defaults to " = ". + * ESS[Julia]: Added index, apropos and web-search to julia. + * ESS help: More evaluation commands were added to ess-help mode + ('C-c C-c', 'C-M-x' etc) + + Bug Fixes in 12.09-1: + * iESShelp: Multiple help pages with the same name are properly + handled on 'C-c C-v' + * iESSremote: Evaluation with ESS remote no longer freezes emacs. + * iESS: 'comint-previous-prompt' 'C-c C-p' no longer stops on + secondary prompt "+". + * iESS[R], iESS(Sqpe) [S] on Windows: The 'options("editor")' is now + initialized to 'emacsclient' instead of the previous 'gnuclient'. + The user may need to add the line '(server-start)' to the emacs + initialization file. 'emacsclient' has been included with emacs + since GNU Emacs 22.1. + * ESS[Rnw] Fixed "connection to R" bug (in 12.09 only). + * ESS[Rnw] Explicit 'ess-swv-stangle' and 'ess-swv-sweave' functions. + * ESS[Rnw] Fixed completion and smart underscore problems cause by + unmatched "\"' + * ESS[R] is more careful with the 'R' code injection. It now happens + only once at the start of the session. + * ESS[R]: Fixed auto-scrolling the comint buffer on evaluation. + * ESS[Julia]: Solve several indentation and word navigation problems. + * ESS[Julia]: Help system works again. + + Changes/New Features in 12.09: + + * Due to XEmacs lacking some features that ESS requires, ESS support + of XEmacs ends with ESS 12.04-4. This decision will be re-visited + in the future as XEmacs continues to sync with GNU Emacs. + + * ESS[R]: On Windows, there is now a new customizable variable + (currently called 'ess-directory-containing-R') to tell ESS where + to look for the 'Rterm.exe' executables. The name of the variable + and the values it can take are both in beta and subject to change. + Prior to this variable, ESS searched only in the default + installation directory. Setting this variable now tells ESS how to + find 'Rterm.exe' executables when they are installed somewhere + else. + + * ESS[julia]: _new_ mode for editing julia code ('*.jl'). Start with + 'M-x julia'. + + Full interaction interface, imenu and basic error referencing are + available. + + * ESS[R] noweb: 'noweb-mode' and 'noweb-font-lock-mode' have been + renamed to 'ess-noweb-mode' and 'ess-noweb-font-lock-mode' to avoid + conflicts with the "real" 'noweb-mode'. + + * ESS[R] noweb: The long standing font-lock bug has been solved in + 'ess-noweb' interface. + + * ESS: Basic evaluation keys are now bound to 'ess-eval-region-*-' + functions: + + - 'C-M-x' is bound to 'ess-eval-region-or-function-or-paragraph' + - 'C-c C-c' is bound to + 'ess-eval-region-or-function-or-paragraph-and-step' + - 'C-RET' is bound to 'ess-eval-region-or-line-and-step' + + Each of these functions first evaluates the region whenever the + region is active. + + * ESS: 'C-M-a'/'C-M-e' now step to beginning/end of paragraph if no + function has been detected. + + * ESS: 'ess-eval-*-and-step' family of functions are now smarter, and + don't step to end of buffer or end of chunk code ('@') when at the + end of the code. + + * ESS: 'ess-handy-commands' function is bound to 'C-c h' + + * ESS: ESS is now _blinking_ the evaluated region. Set + 'ess-blink-region' to nil to deactivate; 'ess-blink-delay' gives + the duration of the blink. Evaluated region is "blinked" in + 'highlight' face. + + * ESS[R-help] New key 'a' for "apropos()" in help buffers. Also + available through 'C-c h'. + + * ESS[R-help] All R commands of type foo?bar and foo??bar are + recognized and redirected into appropriate *ESS-help* buffers. + + * ESS[R]: New customization interface for _font-lock_. + + ESS font-lock operates with predefined keywords. Default keywords + are listed in 'ess-R-font-lock-keywords' and + 'inferior-R-font-lock-keywords', which see. The user can easily + customize those by adding new keywords. These variables can also + be interactively accessed and saved through 'ESS/Font-lock' + submenu. + + Several new fontification keywords have been added. Most notably + the keywords for highlighting of function calls, numbers and + operators. + + * ESS[R]: auto-complete is now activated by default whenever + auto-complete package is detected. Set 'ess-use-auto-complete' to + nil to deactivate. + * ESS[R]: R AC sources are no longer auto-starting at 0 characters + but at the default 'ac-auto-start' characters. + * ESS no longer redefines default ac-sources, but only appends + 'ac-source-filename' to it. + * ESS: 'ac-source-R' now concatenates " = " to function arguments. + + * ESS: Menus for ESS and iESS have been reorganized and enriched with + _Tracebug_ and _Developer_ submenus. + + * ESS[R]: 'ess-developer' and 'ess-tracebug' commands are available + by default in 'ess-dev-map' which is bound to 'C-c d' in ESS and + iESS maps. + + * ESS[R]: 'eldoc' truncates long lines whenever + 'eldoc-echo-area-use-multiline-p' is non-nil (the default). Set + this variable to t if you insist on multiline eldoc. See also + 'ess-eldoc-abbreviation-style'. + + * ESS[R]: completion code pre-caches arguments of heavy generics such + as 'plot' and 'print' to eliminated the undesirable delay on first + request. + + * iESS: Prompts in inferior buffers are now highlighted uniformly + with 'comint-highlight-prompt' face. + + * ESS[R]: R process no longer wait for the completion of input in + inferior buffer. Thus, long running commands like 'Sys.sleep(5)' + no longer stall emacs. + + * ESS: [R, S, Stata, Julia] have specialized 'ess-X-post-run-hook's, + which are run at the end of subprocess initialization. + + * ESS[Stata]: All interactive evaluation commands work as expected. + On-line comments are removed before the evaluation and multiline + comments are skipped on 'C-c C-c' and other interactive commands. + + * ESS no longer auto-connects to a subprocess with a different + dialect than the current buffer's one. + + * ESS: 'ess-arg-function-offset-new-line' is now a list for all the + ESS indentation styles, which results in the following indentation + after an open "(": + + a <- some.function(other.function( + arg1, + arg2) + + * ESS[SAS]: Improved MS RTF support for GNU Emacs; try + 'ess-sas-rtf-portrait' and 'ess-sas-rtf-landscape'. + + Changes/Bug Fixes in 12.04-3: + * ESS: basic support for package.el compatibility + * ESS[R]: correct indentation of & and | continuation lines + * 'M-x ess-version' shows the svn revision even after 'make install' + * ESS[SAS]: improved XEmacs support + * iESS[R]: better finding of previous prompt + * ESS[Stata]: adjusted prompt for mata mode + * ESS[R]: resolved name clashes with cl.el + * ESS[R]: removed dependence on obsolete package assoc + * New 'make' target 'lisp', to build the lisp-only part, i.e., not + building the docs. + + Changes/New Features in 12.04-1: + * iESS[Stata]: New interactive help invocation. + * iESS[Stata]: New custom variable 'inferior-STA-start-file'. + * iESS[Stata]: 'inferior-STA-program-name' is now "stata" and can be + customized. + * ESS[Stata] New sections in stata help files Syntax('s-S'), + Remarks('r'), Title('t'). + + Bug Fixes in 12.04-1: + * ESS[R]: Better 'ess-tracebug' error handling. + * ESS[R]: Corrected 'ess-eldoc' help string filtering and improved + argument caching. + * ESS[R]: Indentation of non-block if/else/for/while lines fixed. + * 'M-x ess-version' should work better. + * ESS: Filename completion now again works inside strings. + * iESS[Stata]: Fixed prompt detection issue. + * ESS[Rd]: R is autostarted also from here, when needed. + + Changes/New Features in 12.04: + * ESS: Reverting new behavior of 12.03, 'TAB' in 'ess-mode' no longer + completes by default. If you want smart 'TAB' completion in R and + S scripts, similarly to iESS behavior, set the variable + 'ess-tab-complete-in-script' to 't'. Also see + 'ess-first-tab-never-complete' for how to customize where first + 'TAB' is allowed to complete. + * ESS: completion is consistently bound to 'M-TAB' (aka 'M-C-i') in + both Emacs23 and Emacs24. + * ESS: The variable 'ess-arg-function-offset-new-line' introduced in + ESS(12.03) now accepts a list with the first element a number to + indicate that the offset should be computed from the indent of the + previous line. For example setting it to '(2) results in: + + a <- some.function( + arg1, + arg2) + + Changes/New Features in 12.03: + * ESS indentation: new offset variable + 'ess-arg-function-offset-new-line' controlling for the indentation + of lines immediately following open '('. This is useful to shift + backwards function arguments after a long function call expression: + + a <- some.function( + arg1, + arg2) + + instead of the old + + a <- some.function( + arg1, + arg2) + + If '(' is not followed by new line the behavior is unchanged: + + a <- some.function(arg1, + arg2) + + This variable should be set as part of indentation style lists, or + in ess-mode hook. + * ESS[R]: 'C-c .' sets (indentation) style. + * ESS: In ESS buffers 'yank'('C-y') command accepts double argument + 'C-u C-u' to paste commands only. It deletes any lines not + beginning with a prompt, and then removes the prompt from those + lines that remain. Useful to paste code from emails, + documentation, inferior ESS buffers or transcript files. + * Documentation: ESS user manual has been rearranged and completed + with several new chapters and sections to reflect newly added + features ("Completion", "Developing with ESS", "ESS tracebug", "ESS + developer", "ESS ElDoc", "IDO Completion" and "Evaluating Code") + * RefCard: Reference card was updated to include new features. + * Eldoc: Eldoc was rewritten and is activated by default. See + 'ess-use-eldoc', 'ess-eldoc-show-on-symbol', + 'ess-eldoc-abbreviation-style' variables for how to change the + default behavior. _Note:_ 'skeleton-pair-insert-maybe' prohibits + eldoc display, on '(' insertion. + * ESS[R]: Eldoc shows arguments of a generic function whenever found. + * ESS: 'TAB' in 'ess-mode' now indents and completes, if there is + nothing to indent. Set 'ess-first-tab-never-completes-p' to 't' to + make 'TAB' never complete on first invocation. Completion + mechanism is similar to the completion in the 'inferior-ess-mode' - + a filename expansion is tried, if not found ESS completes the + symbol by querying the process. + * ESS for emacs version 24 or higher: ESS is fully compatible with + the emacs 24 completion scheme, i.e. all the completion is done by + 'completion-at-point'. Also in accordance with emacs conventions, + ESS doesn't bind 'M-TAB' for emacs 24 or higher. 'M-TAB' calls the + default 'complete-symbol'. + + * ESS[R]: Out of the box integration with 'Auto Completion' mode + http://cx4a.org/software/auto-complete + (http://cx4a.org/software/auto-complete) . Three AC sources + 'ac-source-R-args', 'ac-source-R-objects' and 'ac-source-R' are + provided. The last one combines the previous two and makes them + play nicely together. Set 'ess-use-auto-complete' to 't' to start + using it. Refer to documentation string of 'ac-use-auto-complete' + for further information. + * ESS[R]: New unified and fast argument completion system, comprised + of 'ess-funname.start', 'ess-function-arguments', + 'ess-get-object-at-point'. Eldoc and auto-completion integration + are using this system. + * ESS: 'ess-switch-to-end-of-ESS'('C-c C-z'), and + 'ess-switch-to-ESS'('C-c C-y'): Automatically start the process + whenever needed. + * ESS[R]: 'roxy' knows about previewing text version of the + documentation. Bound to 'C-c C-e t'. + * ESS[R]: Solved the "nil filename" bug in roxygen support. + * ESS[R]: 'ess-tracebug' is now part of ESS: + + New Features: + + - Source injection: Tracebug now can inject source references on + the fly during code evaluation, i.e. you don't have to source + your file, but just evaluate your code in normal fashion. + Variable 'ess-tracebug-inject-source-p' controls this behavior + - if t, always inject source reference, if ''function', inject + only for functions (this is the default), if 'nil', never + inject. + + During the source injection the value of 'ess-eval-visibly' is + ignored. + - Org-mode support: Visual debugger is now aware of the + temporary org source editing buffer ('C-c '') and jumps + through this buffers if still alive, or in original org buffer + otherwise. + - New keys in watch mode: '?' and 'd' + - Two new hooks: ess-tracebug-enter-hook and + ess-tracebug-exit-hook + + * ESS[R]: New package 'ess-developer' to evaluate 'R' code directly + in the package environment and namespace. It can be toggled on and + off with 'C-c d t'. When 'ess-developer' is on all ESS evaluation + commands are redefined to evaluate code in appropriate + environments. Add package names to the list of your development + packages with 'C-d a', and remove with 'C-d r'. Source the current + file with 'C-d s'.Evaluation function which depend on + '`ess-eval-region'' ask for the package to source the code into, + 'ess-eval-function' and alternatives search for the function name + in the development packages' environment and namespace and insert + the definition accordingly. See the documentation section + "Developing with ESS/ESS developer" for more details. + + * ESS[R] help system: + + New Features: + + - 'q' quits window instead of calling + 'ess-switch-to-end-of-ESS'. This is consistent with emacs + behavior help and other special buffers (_breaking change_). + - 'k' kills window without asking for the name (pointed by Sam + Steingold) + - Help map inherits from 'special-mode-map' as sugested by Sam + Steingold. + - Package index: new function 'ess-display-index' bound to 'i' + in help mode map. + - Package vignettes: new function 'ess-display-vignettes' bound + to 'v' in help mode map. + - Display help in HTML browser: new function + 'ess-display-help-in-browser' bound to 'w' in help mode map. + It depends on 'R''s 'browser' option. + - New custom variable 'ess-help-pop-to-buffer': if non-nil ESS + help buffers are given focus on display. The default is 't' + (_breaking change_). + - New menu entries for the above functions. + - Bogus help buffers are no longer generated by default, i.e. + buffers of the form "No documentation for 'foo' in specified + packages and libraries: you could try '??foo' ". + 'ess-help-kill-bogus-buffers' now defaults to 't'. Beware, + there may be instances where the default is unsatisfactory + such as debugging and/or during R development. Thanks to Ross + Boylan for making the suggestion, Sam Steingold for reminding + us of this variable and Martin Maechler for the warning. + * ESS now uses 'IDO' completing read functionality for all the + interactive requests. It uses ido completion mechanism whenever + available, and falls back on classical completing-read otherwise. + You can set 'ess-use-ido' to nil if you don't want the IDO + completion. See the documentation string of 'ess-use-ido' for more + information about 'IDO' and ESS configuration. + + * ESS[S]: "','" is bound to ess-smart-comma: If comma is invoked at + the process marker of an ESS inferior buffer, request and execute a + command from '`ess-handy-commands'' list. If + 'ess-R-smart-operators' is t '`ess-smart-comma' also inserts " " + after comma. + * ESS[S], notably 'R': Variable '`ess-handy-commands'' stores an + alist of useful commands which are called by 'ess-smart-comma' in + the inferior buffer. + + Currently containing: + + change-directory + 'ess-change-directory' + help-index + 'ess-display-index' + help-object + 'ess-display-help-on-object' + vignettes + 'ess-display-vignettes' + objects[ls] + 'ess-execute-objects' + search + 'ess-execute-search' + set-width + 'ess-execute-screen-options' + install.packages + 'ess-install.packages' + library + 'ess-library' + setRepos + 'ess-setRepositories' + sos + 'ess-sos' + + Handy commands: 'ess-library', 'ess-install.packages', etc - ask + for item with completion and execute the correspond command. + 'ess-sos' is a interface to 'findFn' function in package 'sos'. If + package 'sos' is not found, ask user for interactive install. + + * ESS: New dynamic mode line indicator: Process status is + automatically reflected in all mode-lines of associated with the + process buffers. Particularly useful for displaying debug status + of 'ess-tracebug' and developer status of 'ess-developer' in all + associated buffers. + + * ESS: New 'ess-completing-read' mechanism: ESS uses 'ido' + completions whenever possible. Variable 'ess-use-ido' controls + whether to use ido completion or not. Active by default. + + * ESS now supports comint fields for output and input detection. + This feature is not used by default, but might be useful in the + future. + + * ESS[S]: New custom variable 'inferior-ess-S-prompt' to customize + prompt detection regular expression in the inferior ESS buffers. + You can customize this variable to enhance comint navigation + ('comint-previous-prompt' and 'comint-next-prompt') the inferior + buffers. + + * ESS[R]: Internal 'R' completion retrieval + ('ess-R-complete-object-name') was rewritten and is faster now. + + * ESS is using process plist to store process specific variables, as + opposed to buffer local variables as it was using before. The use + of buffer local variables to store process variables is + discouraged. + + * ESS: new functions to manipulate process plists: 'ess-process-get' + and 'ess-process-set'. + + * ESS: Internal process waiting mechanism was completely rewritten. + ESS no more relies on prompt regular expressions for the prompt + detection. The only requirement on the primary process prompt is + to end in '> '. This could be overwritten by setting + 'inferor-ess-primary-prompt'. + + * ESS[S], notably 'R': Saved command history: ESS-HISTORY-FILE now + accepts 't' (default), 'nil', or a file name. By setting it to + 'nil' no command line history is saved anymore. + ESS-HISTORY-DIRECTORY now allows to have the history all saved in + one "central" file. + * ESS[R]: more Roxygen improvements. + * ESS[R]: 'C-c .' to set (indentation) style. + + * ESS[R]: Functions with non-standard names (for example + 'aaa-bbb:cc') are properly handled by font-lock and evaluation + routines. + * ESS[R]:Several regexp bugs (described in etc/R-ESS-bugs.el) were + fixed in 'ess-get-words-from-vector' and 'ess-command'. + diff -Nru ess-16.10/ChangeLog ess-17.11/ChangeLog --- ess-16.10/ChangeLog 2016-10-22 16:03:27.000000000 +0000 +++ ess-17.11/ChangeLog 2017-11-13 14:13:15.000000000 +0000 @@ -1,3 +1,11 @@ +2017-11-13 ESS Maintainers + + * Version 17.11 released. + +2017-01-19 Stefan Monnier + + * .gitignore: Add ELPA's ess-autoloads.el. + 2016-10-22 ESS Maintainers * Version 16.10 released. diff -Nru ess-16.10/debian/changelog ess-17.11/debian/changelog --- ess-16.10/debian/changelog 2017-11-22 16:28:36.000000000 +0000 +++ ess-17.11/debian/changelog 2017-11-22 16:28:36.000000000 +0000 @@ -1,10 +1,29 @@ -ess (16.10-1xenial0) xenial; urgency=medium +ess (17.11-2xenial0) xenial; urgency=medium - * Compilation for Ubuntu 16.04 LTS + * Compilation for Ubuntu 16.04.3 LTS * debian/control, revert to a version of emacsen-common that is available - -- Michael Rutter Mon, 24 Oct 2016 22:08:37 +0000 + -- Michael Rutter Wed, 22 Nov 2017 16:21:47 +0000 + +ess (17.11-2) unstable; urgency=medium + + * lisp/ess-utils.el: Synced with updated upstream per issue #465 + * lisp/ess-site.el: Ditto (Closes: #882042) + + -- Dirk Eddelbuettel Mon, 20 Nov 2017 17:08:32 -0600 + +ess (17.11-1) unstable; urgency=medium + + * New upstream version released today + + * debian/emacsen-install: Improvement suggested in #850041 install + * debian/control: Increased Standards-Version: to current version + + * debian/control: Increased Standards-Version: to current version + * debian/compat: Increased to 9 + + -- Dirk Eddelbuettel Mon, 13 Nov 2017 20:29:44 -0600 ess (16.10-1) unstable; urgency=medium diff -Nru ess-16.10/debian/compat ess-17.11/debian/compat --- ess-16.10/debian/compat 2017-11-22 16:28:36.000000000 +0000 +++ ess-17.11/debian/compat 2017-11-22 16:28:36.000000000 +0000 @@ -1 +1 @@ -7 +9 diff -Nru ess-16.10/debian/control ess-17.11/debian/control --- ess-16.10/debian/control 2017-11-22 16:28:36.000000000 +0000 +++ ess-17.11/debian/control 2017-11-22 16:28:36.000000000 +0000 @@ -2,7 +2,7 @@ Section: gnu-r Priority: optional Maintainer: Dirk Eddelbuettel -Standards-Version: 3.9.8 +Standards-Version: 4.1.1 Build-Depends: debhelper (>= 7.0.0) Build-Depends-Indep: texlive-base, texlive-latex-base, texlive-latex-recommended, texlive-latex-extra, texlive-generic-recommended, texlive-extra-utils, texlive-fonts-recommended, texinfo, autotools-dev Homepage: http://ess.r-project.org diff -Nru ess-16.10/debian/emacsen-install ess-17.11/debian/emacsen-install --- ess-16.10/debian/emacsen-install 2017-11-22 16:28:36.000000000 +0000 +++ ess-17.11/debian/emacsen-install 2017-11-13 14:13:15.000000000 +0000 @@ -8,13 +8,14 @@ FLAVOR=$1 PACKAGE=ess -if [ ${FLAVOR} = emacs ]; then exit 0; fi - -if [ ${FLAVOR} = xemacs21 ]; then exit 0; fi - -if [ ${FLAVOR} = emacs22 ]; then exit 0; fi - -if [ ${FLAVOR} = emacs23 ]; then exit 0; fi +# edd 03 Jan 2017 cf #850041 +#if [ ${FLAVOR} = emacs ]; then exit 0; fi +#if [ ${FLAVOR} = xemacs21 ]; then exit 0; fi +#if [ ${FLAVOR} = emacs22 ]; then exit 0; fi +#if [ ${FLAVOR} = emacs23 ]; then exit 0; fi +case ${FLAVOR} in xemacs*|emacs|emacs2[1-3]) + exit 0;; +esac echo install/${PACKAGE}: Handling install for emacsen flavor ${FLAVOR} diff -Nru ess-16.10/doc/announc.texi ess-17.11/doc/announc.texi --- ess-16.10/doc/announc.texi 2014-10-28 18:15:42.000000000 +0000 +++ ess-17.11/doc/announc.texi 2017-11-13 14:13:15.000000000 +0000 @@ -17,7 +17,7 @@ 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, Mac OS X and +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 Binary files /tmp/tmpCr6fs_/WAh2Sjb543/ess-16.10/doc/ess.pdf and /tmp/tmpCr6fs_/oL1nr6q8Sc/ess-17.11/doc/ess.pdf differ diff -Nru ess-16.10/doc/ess.texi ess-17.11/doc/ess.texi --- ess-16.10/doc/ess.texi 2016-10-22 16:03:27.000000000 +0000 +++ ess-17.11/doc/ess.texi 2017-11-13 14:13:15.000000000 +0000 @@ -1785,26 +1785,29 @@ @end table @menu -* Styles:: Changing indentation styles +* Styles:: Changing styles for indentation and alignment @end menu @node Styles -@subsection Changing indentation styles +@subsection Changing styles for code indentation and alignment -The combined value of nine variables that control indentation are +The combined value of twelve variables (4 of three groups @code{ess-indent-*}, +@code{ess-offset-*} and @code{ess-align-*}) that control indentation etc are collectively termed a @i{style}. ESS provides several styles covering the common styles of indentation: @code{DEFAULT}, @code{OWN}, @code{GNU}, -@code{BSD}, @code{K&R}, @code{C++}, @code{RRR}, @code{CLB}. The +@code{BSD}, @code{K&R}, @code{C++}, @code{RRR}, @code{RRR+}, +@code{Rstudio}, @code{Rstudio-}, and @code{CLB}. The variable @code{ess-style-alist} lists the value of each indentation -variable per style. +variable per style (and its documentation contains more). @deffn Command ess-set-style -@kindex C-c . -@kbd{C-c .} Sets the formatting style in this buffer to be one of the -predefined styles, including @code{GNU}, @code{BSD}, @code{K&R}, -@code{CLB}, and @code{C++}. The @code{DEFAULT} style uses the default -values for the indenting variables; The @code{OWN} style allows you to -use your own private values of the indentation variable, see below. +@kindex C-c C-e s +@kindex C-c C-e C-s +@kbd{C-c C-e C-s} (or @kbd{C-c C-e s}) sets the formatting style in this +buffer to be one of the predefined styles, see above. The @code{DEFAULT} +style uses the default values for the indenting variables; The @code{OWN} +style allows you to use your own private values of the indentation +variable, see below. @example (setq ess-default-style 'C++) @end example @@ -1812,7 +1815,7 @@ @defvr {User Option} ess-default-style The default value of @code{ess-style}. See the variable -@code{ess-style-alist} for how these groups (DEFAULT, OWN, GNU, BSD, +@code{ess-style-alist} for how these groups (DEFAULT, OWN, GNU, RRR, @dots{}) map onto different settings for variables. @end defvr @@ -2870,7 +2873,7 @@ @section Namespaced Evaluation @cindex ess developer -In non package files evaluation commands (@xref{Evaluating code}) send +In non package files evaluation commands, @xref{Evaluating code}, send portions of the current buffer environment (@code{R_GlobalEnv}. When developing packages, ESS sends code to the corresponding package namespace and (for visible objects) into package environment (visible on @@ -2901,7 +2904,7 @@ @deffn Command ess-r-set-evaluation-env @var{arg} @kindex C-c C-t C-s -@kbd{C-c C-t C-s} Set or unset the current evaluation environment (a package). +@kbd{C-c C-t C-s} Set or unset the current evaluation environment (a package). @end deffn @node Extras diff -Nru ess-16.10/doc/help-sas.texi ess-17.11/doc/help-sas.texi --- ess-16.10/doc/help-sas.texi 2014-10-28 18:15:42.000000000 +0000 +++ ess-17.11/doc/help-sas.texi 2017-11-13 14:13:15.000000000 +0000 @@ -108,7 +108,7 @@ your shell. It defaults to @code{'sh} unless you are running Windows or Mac Classic. Under Windows, it will default to @code{'sh} if you are using a @UNIX{}-imitating shell; otherwise @code{'ms-dos} for an @acronym{MS-DOS} -shell. On Mac OS X, it will default to @code{'sh}, but under Mac Classic, +shell. On macOS, it will default to @code{'sh}, but under Mac Classic, it defaults to @code{'apple-script}. You will also set this to @code{'sh} if the @SAS{} batch job needs to run on a remote machine rather than your local machine. This works transparently if you are editing the remote file diff -Nru ess-16.10/doc/html/ess.html ess-17.11/doc/html/ess.html --- ess-16.10/doc/html/ess.html 1970-01-01 00:00:00.000000000 +0000 +++ ess-17.11/doc/html/ess.html 2017-11-13 14:13:23.000000000 +0000 @@ -0,0 +1,7683 @@ + + + + +ESS – Emacs Speaks Statistics + + + + + + + + + + + + + + + + + +

ESS – Emacs Speaks Statistics

+ + + + + + + + + + + + + + + + + + +

Table of Contents

+ +
+ + +
+ + + +

ESS — Emacs Speaks Statistics

+ + +
+

+Next: , Up: (dir)   [Contents][Index]

+
+ +

ESS: Emacs Speaks Statistics

+ +

ESS version +17.11 +

+
+
by  A.J. Rossini,
+    R.M. Heiberger,
+    K. Hornik,
+    M. Maechler,
+    R.A. Sparapani,
+    S.J. Eglen,
+    S.P. Luque,
+    H. Redestig,
+    V. Spinu,
+and L. Henry.
+
+ +
+

Emacs Speaks Statistics (ESS) provides an intelligent, consistent +interface between the user and the software. ESS interfaces with SAS, +S-PLUS, R, BUGS/JAGS and other statistical analysis packages on Unix, +Linux and Microsoft Windows. ESS is itself a package within the emacs +text editor and uses emacs features 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. +

+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+

+Next: , Previous: , Up: Top   [Contents][Index]

+
+ +

1 Introduction to ESS

+ + +

The S family (S, Splus and R) and SAS statistical analysis packages +provide sophisticated statistical and graphical routines for manipulating +data. Emacs Speaks Statistics (ESS) is based on the merger +of two pre-cursors, S-mode and SAS-mode, which provided support for the +S family and SAS respectively. Later on, Stata-mode was also incorporated. +

+

ESS provides a common, generic, and useful interface, through emacs, to +many statistical packages. It currently supports the S family, SAS, BUGS/JAGS, +and Stata with the level of support roughly in that order. +

+

A bit of notation before we begin. emacs refers to both +GNU Emacs by the Free Software Foundation, as well as +XEmacs by the XEmacs Project. The emacs major +mode ESS[language], where language can take values such as +S, SAS, or XLS. The inferior process interface +(the connection between emacs and the running process) referred to as inferior ESS +(iESS), is denoted in the modeline by ESS[dialect], where +dialect can take values such as S3, S4, S+3, +S+4, S+5, S+6, S+7, R, XLS, VST, SAS. +

+

Currently, the documentation contains many references to ‘S’ +where actually any supported (statistics) language is meant, i.e., ‘S’ +could also mean ‘R’ or ‘SAS’. +

+ + + +

For exclusively interactive users of S, ESS provides a number of +features to make life easier. There is an easy to use command history +mechanism, including a quick prefix-search history. To reduce typing, +command-line completion is provided for all S objects and “hot +keys” are provided for common S function calls. Help files are +easily accessible, and a paging mechanism is provided to view them. +Finally, an incidental (but very useful) side-effect of ESS is that a +transcript of your session is kept for later saving or editing. +

+ +

No special knowledge of Emacs is necessary when using S +interactively under ESS. +

+ +

For those that use S in the typical edit–test–revise cycle when +programming S functions, ESS provides for editing of S functions +in Emacs edit buffers. Unlike the typical use of S where the editor +is restarted every time an object is edited, ESS uses the current Emacs +session for editing. In practical terms, this means that you can edit +more than one function at once, and that the ESS process is still +available for use while editing. Error checking is performed on +functions loaded back into S, and a mechanism to jump directly to the +error is provided. ESS also provides for maintaining text versions of +your S functions in specified source directories. +

+ + + + + + + + +
+ +
+

+Next: , Up: Introduction   [Contents][Index]

+
+ +

1.1 Why should I use ESS?

+ +

Statistical packages are powerful software systems for manipulating and +analyzing data, but their user interfaces often leave something something +to be desired: they offer weak editor functionality and they differ +among themselves so markedly that you have to re-learn how to do those +things for each package. ESS is a package which is designed to make +editing and interacting with statistical packages more uniform, +user-friendly and give you the power of emacs as well. +

+ + + + + +
+ +
+

+Up: Features   [Contents][Index]

+
+ +

1.1.1 Features Overview

+
    +
  • Languages Supported: +
      +
    • S family (R and S+ AKA S-PLUS) +
    • SAS +
    • OpenBUGS/JAGS +
    • Stata +
    • Julia +
    +
  • Editing source code (S family, SAS, OpenBUGS/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, OpenBUGS/JAGS) +
    • Use of imenu to provide links to appropriate functions +
    +
  • Interacting with the process (S family, SAS, Stata, Julia) +
      +
    • Command-line editing +
    • Searchable Command history +
    • Command-line completion of S 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 +
    +
+ + +

ESS provides several features which make it easier to interact with the +ESS process (a connection between your buffer and the statistical +package which is waiting for you to input commands). These include: +

+
    +
  • Command-line editing for fixing mistakes in commands before they are +entered. The ‘-e’ flag for S-plus provides something similar to +this, but here you have the full range of Emacs commands rather than a +limited subset. However, other packages do not +necessarily have features like this built-in. +See Command-line editing. + +
  • Searchable command history for recalling previously-submitted +commands. This provides all the features of the ‘Splus -e’ history +mechanism, plus added features such as history searching. +See Command History. + +
  • Command-line completion of both object and file names for quick +entry. This is similar to tcsh’s facility for filenames; here it +also applies to object names and list components. +See Completion. + +
  • Hot-keys for quick entry of commonly-used commands in ‘S’ such as +objects() and search(). +See Hot keys. + +
  • Transcript recording for a complete record of all the actions in an +S session. +See Transcript. + +
  • Interface to the help system, with a specialized mode for viewing S +help files. +See Help. + +
+ +

If you commonly create or modify S functions, you will have found +the standard facilities for this (the ‘fix()’ function, for +example) severely limiting. Using S’s standard features, one can only +edit one function at a time, and you can’t continue to use S while +editing. ESS corrects these problems by introducing the following +features: +

+
    +
  • Object editing. ESS allows you to edit more than one function +simultaneously in dedicated Emacs buffers. The ESS process may +continue to be used while functions are being edited. +See Edit buffer. + +
  • A specialized editing mode for S code, which provides syntactic +indentation and highlighting. +See Indenting. + +
  • Facilities for loading and error-checking source files, including a +keystroke to jump straight to the position of an error in a source file. +See Error Checking. + +
  • Source code revision maintenance, which allows you to keep historic +versions of S source files. +See Source Files. + +
  • Facilities for evaluating S code such as portions of source +files, or line-by-line evaluation of files (useful for debugging). +See Evaluating code. +
+ +

Finally, ESS provides features for re-submitting commands from saved +transcript files, including: +

+
    +
  • Evaluation of previously entered commands, stripping away +unnecessary prompts. +See Transcript resubmit. + +
+ +
+ +
+

+Next: , Previous: , Up: Introduction   [Contents][Index]

+
+ +

1.2 New features in ESS

+ + +

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 +
+ + +

Changes and New Features in 15.09: +

    +
  • ESS[R]: The indentation logic has been refactored. +It should be faster, more consistent and more flexible. There are three +types of indentation settings, those starting with ess-offset- +give the actual offsets, those starting with ess-indent- are +control (commonly Boolean) variables, and those starting with +ess-align- are vertical alignment overrides which inhibit default +offsets in specific situations. See ess-style-alist for detailed +description of the new indentation system and provided default +indentation styles. + +
  • ESS[R]: Deprecation of old indentation settings. +As a consequence of the indentation re-factoring +ess-brace-imaginary-offset, ess-expression-offset and all +delimiter-specific offsets are deprecated. The settings for indentation +of continued statements have been replaced by +ess-offset-continuations. It can be set to either cascade +or straight (the default). ess-arg-function-offset has +been replaced by ess-indent-from-lhs and has been generalised to +assignments. This setting now works with both statement blocks and +expressions and only takes effect for offsets set to prev-call +and open-delim in order to produce a consistent indentation. + +
  • ESS: A test framework has been set up. + +
  • ESS[R]: A new RStudio style is provided to mimic as closely +as possible R files indented via RStudio. To reproduce the setup of some +of the RStudio users, the RStudio- style with +ess-offset-arguments set to prev-line is also provided. In +addition, the new RRR+ style is equivalent to RRR except it indents +blocks in function calls relatively to the opening delimiter. This style +does not try to save horizontal space and produces more indentation. + +
  • ESS[R]: Roxygen fields will now be indented on paragraph +refilling in order to make the documentation more readable. You can also +refill commented lines in the examples field without squashing +the surrounding code in the comments. + +
  • ESS[R]: ESS can now format your code! This is controlled +through the settings ess-fill-calls and +ess-fill-continuations. When activated, (fill-paragraph) +formats your calls and your formulas/continuations while making sure +they don’t go past fill-column. Repeated refills cycle through +different styles (see the docstrings for more details). By default, the +refilled region blinks. Set ess-blink-filling to nil to prevent +this. + +
  • ESS[R]: Fix occasional missing error location fontification +in inferior buffers. + +
  • ESS[R]: ess-developer now correctly assigned the environment +of new functions to the package namespace. + + +
  • ESS[Julia]: ?[topic] now works in the *julia* buffer. +Note that support for editing Julia code now depends on +julia-mode.el from the Julia project. If you install ESS from +the official tarball/zip file, julia-mode.el is already included. +Otherwise, if you install ESS by +running make, then the latest version of julia-mode.el is +downloaded (and so you need an active internet connection to install) +during the installation process. Alternatively, if you run ESS without +running make, then ensure that you have the julia-mode.el, +which you can get easily from MELPA for example. + + +
  • iESS: For naming inferior processes, ESS can use projectile’s +project root and it does so when ess-gen-proc-buffer-name-function is +set to ess-gen-proc-buffer-name:projectile-or-simple as by default, +or to another value beginning with ess-gen-proc-buffer-name:projectile-*. + +
+ + +

Changes and New Features in 15.03-1: +

    +
  • ESS[R]: An indentation bug has been fixed (github issue 163) +
  • ESS[R]: On windows, if ‘ess-prefer-higher-bit’ is non-nil (the +default), then R-newest will try to run a 64 bit (rather than 32 bit) +version of R. +
+ +

Changes and New Features in 15.03: +

    +
  • ESS[R]: Full native support for ‘company-mode‘. +
  • ESS[R]: More efficient caching algorithm for R completion. +
  • ESS: New offset variable ‘ess-close-paren-offset‘ to control +the indentation of the closing parentheses. +
  • ESS[R]: Ask for CRAN mirror only once per emacs session. +
  • ESS[R]: Detect library and require calls +for better completion caching. +
  • Buffer display is now customizable (ess-show-buffer-action). +
  • Use y-or-n-p instead of yes-or-no-p throughout. +
  • More support for ODS in ess-sas-graph-view. +
  • Makefiles are now both UNIX and GNU friendly. +
  • ESS[R]: Simplify directory lookup in ess-developer (#137). +
  • Make closed paren indentation consistent +
+ +

Bug Fixes in 15.03: +

    +
  • Fix open brace indentation bug (#27 in ess/R-ESS-bugs.R). +
  • Fix git version lookup +
  • Don’t check directory modtime in R dialect. +
  • Declare all ess macros for edebug. +
  • Add ess-smart-comma to eldoc message functions. +
  • Inform users when retrieving RDA aliases. +
  • Line ending in ’~’ is also a continuation line. +
  • Filing roxy paragraphs works as expected now. +
  • In ess-developer-add-package, remove incorrect ‘wait‘ +argument from ess-get-words-from-vector call. +
  • Fix #96, #117, #120, #125, #134, #137. +
  • Fix ess-quit-r. Call base::q() even if it is masked. +
  • Fix ‘ess-show-buffer‘ to always display the buffer in another window. +
  • Makefile: Fix cd bug for directories with spaces in them +
  • ess-kill-buffer-and-go modified to not restart R +
+ +

Changes / Selected Bug Fixes in 14.09: +

    +
  • ESS[Julia]: Executable is changed to julia. +
  • ESS[Julia]: Completion and help system was adjusted to Julia +v.0.3.0. Julia v.0.2.x is no more supported. +
  • ESS[R]: Running R with gdb debugger now works as expected +
  • iESS: Inferior ESS buffers are now derived from comint-mode +
  • ESS[R]: ess-execute-screen-options uses correct screen +width in terminal sessions +
  • ESS: ess-build-tags-for-directory works when no TAGS file +name was provided +
  • ESS: ess-offset-statement-continued is now respected everywhere +except inside of the if test condition. +
  • ESS: New variable ess-offset-statement-first-continued for +indentation of the first line in multiline statements. +
  • ESSR: Starting , in multiline statements indentation is now +ignored to achieve a more pleasant alignment. +
  • ESSR: Improved behavior of RET in roxygen blocks. +
  • ESS[R]: command cleaning with C-u C-u C-y was broken with +lines containing " + " +
  • ESS[R]: fixed "empty watch window bug" +
  • ESS[R]: don’t ask for help location on ac-quick-help (request of github #81) +
  • ESS[R]: "importClassesFrom" and "importMethodsFrom" were added to +the list of two-parameter roxygen commands +
  • ESS[R]: fix vignetes display and hyperlinks (were broken in 13.09-1) +
  • ESS[Julia]: recognize function names ending with ! +
  • ESS[Julia]: fix indentation of "for" comprehension syntax within brackets. +
+ +

Changes / Selected Bug Fixes in 13.09-1: +

    +
  • ess-remote and TRAMP: R support code is now downloaded in binary form instead +of being injected from local machine. The R code is stored in +~/.config/ESSR/ directory on the remote machine +
  • TRAMP: PAGER environment variable is now correctly set to inferior-ess-pager +
  • retrieval of help topics on remote machines is fixed +
  • org-babel: source references of R code executed from org files correctly point +to source references in original org files (version 8.2.1 or higher of +org-mode is required for this feature) +
  • ess-execute is now bound to C-c C-e C-e in ess-extra-map. +
  • completion works again in ess-execute +
  • ESS[R]: head and tail methods were replaced by htsummary in +ess-R-describe-object-at-point-commands +
  • ESS[roxygen]: evaluation commands now work in roxygen blocks. +Leading comments are automatically removed before the evaluation +
  • ESS[transcript]: ’Clean Region’ now works with multiline statements; + ess-transcript-clean-region etc. correctly treat + multiline statements, i.e., no longer forgets the lines typically + preceded by ’+’ +
  • ESS[SAS]: Three features/fixes with special thanks to Matthew Fidler +https://github.com/emacs-ess/ESS/pulls/mlf176f2. Turn on SAS log mode +when appropriate. Indent comments and CARDS statement more appropriately. +
  • ESS[SAS]: ess-sas-edit-keys-toggle default returns to nil +
  • ESS[R]: support for prettify-symbols-mode: +contribution from Rudiger Sonderfeld https://github.com/emacs-ess/ESS/pull/65 +
  • ESS[SWV]: knitr now evaluates in the current frame +
  • ESS[developer]: ess-developer doesn’t kill open DESCRIPTION files anymore +
  • ESS[roxygen]: ess-roxy-preview-HTML is now on C-c C-o C-w and + ess-roxy-preview-text is now on C-c C-o C-t +
  • ESS: installation with make install was simplified and should work +out of the box on most *nix systems +
  • ESS installation instructions simplified +
  • fixed font-lock bug introduced in 13.09 that was causing very slow process output +
+ +

Changes/New Features in 13.09: +

    +
  • font-lock in process buffers doesn’t "spill" over prompts. +Missing closing string delimiters should not cause wrong fontification +of the following command input. +
  • ESS[julia]: full features M-TAB completion and auto-complete support, +which now works for modules, structures and data types. +
  • ESS[julia]: a much better eldoc showing arguments of +methods and data type constructors +
  • ESS-developer: +
      +
    • - ESS-developer work-flow pattern has been streamlined: + ESS-developer is now automatically activated on per-file basis if the + file is part of a developed package ess-developer-packages. The + old behavior (activation on per-process basis) is still available on + M-x ess-developer in a process buffer. +
    • - integration with devtools package. New command + ess-developer-load-package calls load_all on the package + containing current file. ess-developer-add-package now offers IDO + menu completions with available loading methods, currently + library, and load_all. Loading command can be customized + with ess-developer-load-on-add-commands. +
    +
  • TAB now indents region if region is active +(a contribution of Matthew Fidler in pull #41) +
  • M-x ess-version now reports full loading path +and recognizes git and ELPA versions. +
  • warning and error keyword are now highlighted with +font-lock-warning-face as they should be, (for quite some time +these keywords have been hijacked by compilation mode fontification). +
  • eldoc: Eldoc now recognizes multiple processes. +If current process is busy, or current buffer is not associated with a +process, eldoc picks its completions from the first available free +process. +
  • org-babel: evaluation is now org-friendly +
  • help: new help buffers now try to reuse ess-help buffers. +This behavior is controlled by ess-help-reuse-window custom +variable. +
  • help: ?foo pops IDO menu on multiple help files +(so far it worked only for C-c C-v) +
  • remote evaluation is considerably faster now on slow connections +
  • ESS[R] tracebug R source references regular expressions +are (mostly) language agnostic. +
  • ess-function-call-face inherits from +font-lock-function-name-face rather than font-lock-builtin-face. +
  • ess-inject-source now accepts function-and-buffer option. +
  • Documentation: The “New Features” +section (and NEWS) now represent recent changes: within the last +year or so. All changes can be found in the new news.html (or NEWS and ONEWS). +
  • ESS[R] ess-rep-regexp should no longer inf.loop (rarely!), +and hence M-x ess-fix-miscellaneous should neither. +
+ +

Changes/New Features in 13.05: +

    +
  • ESS[gretl]: Support for gretl (both editing and +sub-process interaction). A contribution of Ahmadou Dicko. +
  • ESS: process output display is 4-10 times faster due to new caching +and only occasional emacs re-display (for the moment this functionality +is available only when ess-tracebug is active). +
  • ESS: C-c ` is now bound to ess-show-traceback and +C-c ~ is bound to ess-show-call-stack. +
  • ESS[R]: ESS stores function in ’ESSR’ environment to +avoid kludging users’ global environment and accidental deletion. +
  • ESS[R]: new variable ess-swv-processing-command to control +weaving and tangling. +
  • ESS[R]: ess-default-style has been changed + (from DEFAULT) to RRR. Use something like + (setq ess-default-style 'DEFAULT) or + (setq ess-indent-level 2) in your ~/.emacs equivalent + before loading ESS, if you do not like this new “incompatible” + default style. +
  • ESS[julia]: ESS stores its functions in ’ESS’ module. +
  • ESS[julia]: Eldoc is now supported in julia modes +
  • ESS[julia]: Adjusted error reference detection and interactive help +to julia internal changes +
  • ESS[R]: ess-use-tracebug’s default has been changed to + t. Set it to nil if you want to keep the previous behavior. +
  • ESS[tracebug]: Electric debug keys have been removed [breaking change] +The functionality was replaced with ess-debug-minor-mode and +ess-debug-minor-mode-map. +
  • ESS[tracebug]: ess-tracebug-map is an alias to + ess-dev-map C-c C-t. +
  • ESS[tracebug]: ess-bp-toggle-state (C-c C-t o) + can now be used during the debug session to toggle breakpoints on the fly + (suggestion by Ross Boylan). +
  • ESS[tracebug]: ess-debug-flag-for-debugging and +ess-debug-unflag-for-debugging work correctly from the debugging + contexts. These commands also recognize non-exported functions for the + packages listed in ess-developer-packages (C-c C-t C-a). + +
  • ESS[R]: Eldoc (activated by ess-use-eldoc) has + become more sophisticated, and hence also more intruding in the interface + between the Statistics softare, e.g., R, and the user. + +

    Note that you can turn off ElDoc, by placing (setq ess-use-eldoc nil) + in your ~/.emacs file, prior to loading ESS, +

    +
  • ESS[SAS]: long over-looked SAS-mode-hook appears! +
  • ESS[SAS]: ess-sas-edit-keys-toggle now defaults to t +since sas-indent-line is still broken, i.e. TAB is now +bound to ess-sas-tab-to-tab-stop by default +
+ + +

Changes/Bug Fixes in 12.09-2: +

    +
  • ESS: new ess-switch-to-end-of-proc-buffer variable that controls + whether C-c C-z switches to the end of process buffer. The + default is t. You can use prefix argument to C-c C-z to + toggle this variable. +
  • ESS: fix in ess-eval-linewise that was causing emacs +to hang during R debugging with ess-eval-visibly equal to +t. +
  • ESS: fix in ess-eval-linewise that was causing emacs to recenter +the prompt in visible window +
  • ESS[tracebug]: A better handling of “Selection” prompts +and debug related singlekey commands. +
  • ESS: fix a bug in ess-switch-process that was causing +*new* selection to fail. +
  • ESS[R]: Solve missing ess-local-process-name bug in R-dired. +
  • ESS[SWV]: ess-swv-PDF doesn’t ask for a command to run if +there is only one command in ess-swv-pdflatex-commands. +
  • ESS[SWV]: ess-swv-weave gained an universal argument to +allow for an interactive choice between available weavers (sweave, +knitr). +
  • ESS: ess-eval-*-and-step functions go to next empty +line at eob, instead of staying at the last line. +
+ + +

Changes/New Features in 12.09-1: +

    +
  • ESS Breaking Changes in Keys: + +
      +
    • - New keymaps: +ess-doc-map bound to C-c C-d; ess-extra-map bound +to C-c C-e; ess-dump-object-into-edit-buffer was moved on +C-c C-e C-d +
    • - roxygen map was moved on C-c C-o and +ess-roxy-update-entry now resides on C-c C-o C-o +
    • - ess-handy-commands is not bound anymore +
    • - ess-dev-map (including ess-tracebug and ess-developer) +moved on C-c C-t +
    • - C-c C-y is deprecated in favor of C-c C-z C-z +
    +
  • ESS[R] new command ess-describe-object-at-point +bound to C-c C-d C-e (repeat C-e or e to cycle). It +was inspired by Erik Iverson’s ess-R-object-tooltip. Customize +ess-describe-at-point-method to use tooltip instead of an +electric buffer. +
  • ESS: New command ess-build-tags-for-directory +bound to C-c C-e C-t for building dialect specific tag +tables. After building tags use M-. to navigate to +function and objects definitions. By default C-c C-e C-t builds +tags based on imenu regular expressions and also include other common +languages .c, .o, .cpp etc. But it relies on external find +and etags commands. If ess-build-tags-command is defined +(for R), the inferior process is asked to build tags instead. +
  • ESS: ess-switch-process offers *new* alternative +to start a new process instead of switching to one of the currently +running processes. +
  • ESS: Switching between processes (C-c C-s) uses buffer names instead +of the internal process names. Use M-x rename-buffer command to +conveniently rename your process buffers. +
  • ESS: Process buffers can be automatically named on process creation +according to user specified scheme. Default schemes are *proc*, +*proc:dir* and *proc:abbr-long-dir* where proc stands for the +internal process name and dir stands for the directory where the +process was started in. The default is *proc*. For customization see +ess-gen-proc-buffer-name-function. +
  • ESS: ess-eval-visibly-p is deprecated in favor of ess-eval-visibly. +
  • ESS: New evaluation pattern nowait. +In addition to old nil and t values, +ess-eval-visibly accepts nowait for a visible evaluation +with no waiting for the process. See ess-eval-visibly for details +on evaluation patterns. +
  • ESS: New “Process” menu entry with process related commands and configuration +
  • iESS: Process buffer is now automatically shown on errors +
  • ESS: New ess-switch-to-inferior-or-script-buffer command bound to C-c C-z +in both script and process buffers. If invoked form process buffer it +switches to the most recent buffer of the same dialect. It is a single +key command. +
  • ESSR-help: On multiple help pages with the same name, C-c C-v +now asks for user resolution directly in emacs. +
  • ESS[R] ess-roxy: new variable ess-roxy-re for fontification +of cases where the number of leading # differs from +ess-roxy-str. +
  • ESS[R] Eldoc was considerably enhanced. +It now finds hidden default S3 methods and displays non-default methods’ +arguments after trailing ||. +
  • ESS[R]: New ess-display-demos command bound to C-c C-d o and C-c C-d C-o +
  • ESS: New ess-help-web-search command bound to C-c C-d w and C-c C-d C-w +to facilitate interactive search of web resources. Implemented for R, +Stata and Julia. See also ess-help-web-search-command. +
  • ESS: ess-pdf-viewer-pref accepts now command line arguments +
  • ESS[Rnw]: Add knitr support. +Customize ess-swv-processor for the default processor. +
  • ESS[Rnw]: More thorough renaming of remaining +noweb-* to ess-noweb-*. +
  • ESS[Rnw] new commands ess-eval-chunk-and-step and ess-eval-chunk +bound to M-n C-c and M-n C-M-x to mirror standard ess +commands in C-c map. +
  • ESS[R] Auto-completion: new variable +ess-ac-R-argument-suffix to customize the insertion of trailing +"=". Defaults to “ = “. +
  • ESS[Julia]: Added index, apropos and web-search to julia. +
  • ESS help: More evaluation commands were added to ess-help mode (C-c C-c, C-M-x etc) +
+ +

Bug Fixes in 12.09-1: +

    +
  • iESShelp: Multiple help pages with the same name are properly handled on C-c C-v +
  • iESSremote: Evaluation with ESS remote no longer freezes emacs. +
  • iESS: comint-previous-prompt C-c C-p no longer stops on secondary prompt “+”. +
  • iESS[R], iESS(Sqpe) [S] on Windows: +The options("editor") is now initialized to emacsclient +instead of the previous gnuclient. The user may need to add the +line (server-start) to the emacs initialization +file. emacsclient has been included with emacs since GNU Emacs +22.1. +
  • ESS[Rnw] Fixed “connection to R” bug (in 12.09 only). +
  • ESS[Rnw] Explicit ess-swv-stangle and ess-swv-sweave +functions. +
  • ESS[Rnw] Fixed completion and smart underscore problems cause by unmatched “\”’ +
  • ESS[R] is more careful with the R code injection. +It now happens only once at the start of the session. +
  • ESS[R]: Fixed auto-scrolling the comint buffer on evaluation. +
  • ESS[Julia]: Solve several indentation and word navigation problems. +
  • ESS[Julia]: Help system works again. +
+ +

Changes/New Features in 12.09: +

+
    +
  • Due to XEmacs lacking some features that ESS requires, ESS support of XEmacs +ends with ESS 12.04-4. This decision will be re-visited in the future as +XEmacs continues to sync with GNU Emacs. + +
  • ESS[R]: On Windows, there is now a new customizable variable +(currently called ess-directory-containing-R) to tell ESS where +to look for the Rterm.exe executables. The name of the variable +and the values it can take are both in beta and subject to change. Prior +to this variable, ESS searched only in the default installation +directory. Setting this variable now tells ESS how to find +Rterm.exe executables when they are installed somewhere else. + +
  • ESS[julia]: new mode +for editing julia code (*.jl). Start with M-x julia. + +

    Full interaction interface, imenu and basic error referencing are available. +

    + +
  • ESS[R] noweb: noweb-mode and noweb-font-lock-mode have +been renamed to ess-noweb-mode and +ess-noweb-font-lock-mode to avoid conflicts with the “real” noweb-mode. + +
  • ESS[R] noweb: The long standing font-lock bug has been solved +in ess-noweb interface. + + +
  • ESS: Basic evaluation keys are now bound to ess-eval-region-*- functions: + +
      +
    • - C-M-x is bound to ess-eval-region-or-function-or-paragraph +
    • - C-c C-c is bound to ess-eval-region-or-function-or-paragraph-and-step +
    • - C-RET is bound to ess-eval-region-or-line-and-step +
    + +

    Each of these functions first evaluates the region whenever the region +is active. +

    +
  • ESS: C-M-a/C-M-e now step to beginning/end of +paragraph if no function has been detected. + +
  • ESS: ess-eval-*-and-step family of functions are now smarter, +and don’t step to end of buffer or end of chunk code (@) when at +the end of the code. + +
  • ESS: ess-handy-commands function is bound to C-c h + +
  • ESS: ESS is now blinking the evaluated region. +Set ess-blink-region to nil to deactivate; ess-blink-delay +gives the duration of the blink. Evaluated region is “blinked” in +highlight face. + +
  • ESS[R-help] New key a for “apropos()” in help buffers. Also available +through C-c h. + +
  • ESS[R-help] All R commands of type foo?bar and foo??bar are recognized +and redirected into appropriate *ESS-help* buffers. + +
  • ESS[R]: New customization interface for font-lock. + +

    ESS font-lock operates with predefined keywords. Default keywords are +listed in ess-R-font-lock-keywords and +inferior-R-font-lock-keywords, which see. The user can easily +customize those by adding new keywords. These variables can also be +interactively accessed and saved through ESS/Font-lock submenu. +

    +

    Several new fontification keywords have been added. Most notably the +keywords for highlighting of function calls, numbers and operators. +

    +
  • ESS[R]: auto-complete is now activated by default whenever +auto-complete package is detected. Set ess-use-auto-complete to +nil to deactivate. +
  • ESS[R]: R AC sources are no longer auto-starting at 0 characters +but at the default ac-auto-start characters. +
  • ESS no longer redefines default ac-sources, +but only appends ac-source-filename to it. +
  • ESS: ac-source-R now concatenates “ = “ to function arguments. + +
  • ESS: Menus for ESS and iESS have been reorganized and enriched with +Tracebug and Developer submenus. + +
  • ESS[R]: ess-developer and ess-tracebug commands are available by default +in ess-dev-map which is bound to C-c d in ESS and iESS maps. + +
  • ESS[R]: eldoc truncates long lines whenever eldoc-echo-area-use-multiline-p +is non-nil (the default). Set this variable to t if you insist on multiline eldoc. +See also ess-eldoc-abbreviation-style. + +
  • ESS[R]: completion code pre-caches arguments +of heavy generics such as plot and print to eliminated the +undesirable delay on first request. + +
  • iESS: Prompts in inferior buffers are now highlighted uniformly with +comint-highlight-prompt face. + +
  • ESS[R]: R process no longer wait for the completion of input in inferior buffer. +Thus, long running commands like Sys.sleep(5) no longer stall emacs. + +
  • ESS: [R, S, Stata, Julia] have specialized ess-X-post-run-hooks, which +are run at the end of subprocess initialization. + +
  • ESS[Stata]: All interactive evaluation commands work as expected. +On-line comments are removed before the evaluation and multiline +comments are skipped on C-c C-c and other interactive commands. + +
  • ESS no longer auto-connects to a subprocess with a different dialect than +the current buffer’s one. + +
  • ESS: ess-arg-function-offset-new-line is now a list for all +the ESS indentation styles, which results in the following indentation +after an open “(”: + +
      a <- some.function(other.function(
    +     arg1,
    +     arg2)
    +
    +
  • ESS[SAS]: Improved MS RTF support for GNU Emacs; try + ess-sas-rtf-portrait and ess-sas-rtf-landscape. +
+ +

Changes/Bug Fixes in 12.04-3: +

    +
  • ESS: basic support for package.el compatibility +
  • ESS[R]: correct indentation of & and | continuation lines +
  • M-x ess-version shows the svn revision even after make install +
  • ESS[SAS]: improved XEmacs support +
  • iESS[R]: better finding of previous prompt +
  • ESS[Stata]: adjusted prompt for mata mode +
  • ESS[R]: resolved name clashes with cl.el +
  • ESS[R]: removed dependence on obsolete package assoc +
  • New make target lisp, to build the lisp-only part, i.e., not building the docs. +
+ +

Changes/New Features in 12.04-1: +

    +
  • iESS[Stata]: New interactive help invocation. +
  • iESS[Stata]: New custom variable inferior-STA-start-file. +
  • iESS[Stata]: inferior-STA-program-name is now “stata” +and can be customized. +
  • ESS[Stata] New sections in stata help files +Syntax(s-S), Remarks(r), Title(t). +
+ +

Bug Fixes in 12.04-1: +

    +
  • ESS[R]: Better ess-tracebug error handling. +
  • ESS[R]: Corrected ess-eldoc help string filtering +and improved argument caching. +
  • ESS[R]: Indentation of non-block if/else/for/while lines fixed. +
  • M-x ess-version should work better. +
  • ESS: Filename completion now again works inside strings. +
  • iESS[Stata]: Fixed prompt detection issue. +
  • ESS[Rd]: R is autostarted also from here, when needed. +
+ +

Changes/New Features in 12.04: +

    +
  • ESS: Reverting new behavior of 12.03, TAB in ess-mode +no longer completes by default. If you want smart TAB completion +in R and S scripts, similarly to iESS behavior, set the variable +ess-tab-complete-in-script to t. Also see +ess-first-tab-never-complete for how to customize where first +TAB is allowed to complete. +
  • ESS: completion is consistently bound to M-TAB (aka M-C-i) +in both Emacs23 and Emacs24. +
  • ESS: The variable ess-arg-function-offset-new-line +introduced in ESS(12.03) now accepts a list with the first element a +number to indicate that the offset should be computed from the indent of +the previous line. For example setting it to ’(2) results in: + +
      a <- some.function(
    +    arg1,
    +    arg2)
    +
    + +
+ +

Changes/New Features in 12.03: +

    +
  • ESS indentation: new offset variable ess-arg-function-offset-new-line +controlling for the indentation of lines immediately following open +’(’. This is useful to shift backwards function arguments after a long +function call expression: + +
      a <- some.function(
    +         arg1,
    +         arg2)
    +
    + +

    instead of the old +

    +
      a <- some.function(
    +                     arg1,
    +                     arg2)
    +
    +

    If ’(’ is not followed by new line the behavior is unchanged: +

    +
      a <- some.function(arg1,
    +                     arg2)
    +
    +

    This variable should be set as part of indentation style lists, or in +ess-mode hook. +

  • ESS[R]: C-c . sets (indentation) style. +
  • ESS: In ESS buffers yank(C-y) command accepts + double argument C-u C-u to paste commands only. It deletes any +lines not beginning with a prompt, and then removes the prompt from +those lines that remain. Useful to paste code from emails, +documentation, inferior ESS buffers or transcript files. +
  • Documentation: ESS user manual has been rearranged and +completed with several new chapters and sections to reflect newly added +features (“Completion”, “Developing with ESS”, “ESS tracebug”, +“ESS developer”, “ESS ElDoc”, “IDO Completion” and “Evaluating +Code”) +
  • RefCard: Reference card was updated to include new features. +
  • Eldoc: Eldoc was rewritten and is activated by default. +See ess-use-eldoc, ess-eldoc-show-on-symbol, +ess-eldoc-abbreviation-style variables for how to change the default +behavior. Note: skeleton-pair-insert-maybe prohibits eldoc +display, on ( insertion. +
  • ESS[R]: Eldoc shows arguments of a generic function whenever found. +
  • ESS: TAB in ess-mode now indents and completes, +if there is nothing to indent. Set +ess-first-tab-never-completes-p to t to make TAB +never complete on first invocation. Completion mechanism is similar to +the completion in the inferior-ess-mode – a filename expansion +is tried, if not found ESS completes the symbol by querying the +process. +
  • ESS for emacs version 24 or higher: ESS is fully compatible with +the emacs 24 completion scheme, i.e. all the completion is done by +completion-at-point. Also in accordance with emacs conventions, +ESS doesn’t bind M-TAB for emacs 24 or higher. M-TAB calls the +default complete-symbol. + +
  • ESS[R]: Out of the box integration with Auto +Completion mode http://cx4a.org/software/auto-complete . Three AC +sources ac-source-R-args, ac-source-R-objects and +ac-source-R are provided. The last one combines the previous two +and makes them play nicely together. Set ess-use-auto-complete to +t to start using it. Refer to documentation string of +ac-use-auto-complete for further information. +
  • ESS[R]: New unified and fast argument completion system, +comprised of ess-funname.start, ess-function-arguments, +ess-get-object-at-point. Eldoc and auto-completion integration +are using this system. +
  • ESS: ess-switch-to-end-of-ESS(C-c C-z), +and ess-switch-to-ESS(C-c C-y): Automatically start the +process whenever needed. +
  • ESS[R]: roxy knows about previewing text version of the +documentation. Bound to C-c C-e t. +
  • ESS[R]: Solved the “nil filename” bug in roxygen support. +
  • ESS[R]: ess-tracebug is now part of ESS: + +

    New Features: +

    +
      +
    • - Source injection: Tracebug now can inject source references on the +fly during code evaluation, i.e. you don’t have to source your file, but +just evaluate your code in normal fashion. Variable +ess-tracebug-inject-source-p controls this behavior - if t, +always inject source reference, if 'function, inject only for +functions (this is the default), if nil, never inject. + +

      During the source injection the value of ess-eval-visibly is +ignored. +

    • - Org-mode support: Visual debugger is now aware of the +temporary org source editing buffer (C-c ') and jumps through this +buffers if still alive, or in original org buffer otherwise. +
    • - New keys in watch mode: ? and d +
    • - Two new hooks: ess-tracebug-enter-hook and ess-tracebug-exit-hook +
    + +
  • ESS[R]: New package ess-developer to evaluate R +code directly in the package environment and namespace. It can be +toggled on and off with C-c d t. When ess-developer is on +all ESS evaluation commands are redefined to evaluate code in +appropriate environments. Add package names to the list of your +development packages with C-d a, and remove with C-d +r. Source the current file with C-d s.Evaluation function which +depend on `ess-eval-region' ask for the package to source the +code into, ess-eval-function and alternatives search for the +function name in the development packages’ environment and namespace and +insert the definition accordingly. See the documentation section +“Developing with ESS/ESS developer” for more details. + +
  • ESS[R] help system: + +

    New Features: +

    +
      +
    • - q quits window instead of calling ess-switch-to-end-of-ESS. +This is consistent with emacs behavior help and other special buffers (breaking change). +
    • - k kills window without asking for the name (pointed by Sam Steingold) +
    • - Help map inherits from special-mode-map as sugested by Sam Steingold. +
    • - Package index: new function ess-display-index bound to +i in help mode map. +
    • - Package vignettes: new function ess-display-vignettes bound to +v in help mode map. +
    • - Display help in HTML browser: new function ess-display-help-in-browser bound to +w in help mode map. It depends on R’s browser +option. +
    • - New custom variable ess-help-pop-to-buffer: if non-nil +ESS help buffers are given focus on display. The default is +t (breaking change). +
    • - New menu entries for the above functions. +
    • - Bogus help buffers are no longer generated by default, i.e. +buffers of the form “No documentation for ’foo’ in specified packages and libraries: +you could try ’??foo’ ”. ess-help-kill-bogus-buffers now defaults to +t. Beware, there may be instances where the default is unsatisfactory +such as debugging and/or during R development. Thanks to Ross Boylan for +making the suggestion, Sam Steingold for reminding us of this variable and +Martin Maechler for the warning. +
    +
  • ESS now uses IDO completing read functionality +for all the interactive requests. It uses ido completion +mechanism whenever available, and falls back on classical +completing-read otherwise. You can set ess-use-ido to nil if you +don’t want the IDO completion. See the documentation string of +ess-use-ido for more information about IDO and ESS +configuration. + +
  • ESS[S]: “,“ is bound to ess-smart-comma: +If comma is invoked at the process marker of an ESS inferior +buffer, request and execute a command from `ess-handy-commands' +list. If ess-R-smart-operators is t `ess-smart-comma +also inserts “ “ after comma. +
  • ESS[S], notably R: Variable `ess-handy-commands' +stores an alist of useful commands which are called by ess-smart-comma in +the inferior buffer. + +

    Currently containing: +

    +
    +
    change-directory
    +

    ess-change-directory +

    +
    help-index
    +

    ess-display-index +

    +
    help-object
    +

    ess-display-help-on-object +

    +
    vignettes
    +

    ess-display-vignettes +

    +
    objects[ls]
    +

    ess-execute-objects +

    +
    search
    +

    ess-execute-search +

    +
    set-width
    +

    ess-execute-screen-options +

    +
    install.packages
    +

    ess-install.packages +

    +
    library
    +

    ess-library +

    +
    setRepos
    +

    ess-setRepositories +

    +
    sos
    +

    ess-sos +

    +
    + +

    Handy commands: ess-library, ess-install.packages, etc - +ask for item with completion and execute the correspond +command. ess-sos is a interface to findFn function in +package sos. If package sos is not found, ask user for +interactive install. +

    +
  • ESS: New dynamic mode line indicator: Process status is automatically +reflected in all mode-lines of associated with the process +buffers. Particularly useful for displaying debug status of +ess-tracebug and developer status of ess-developer in all +associated buffers. + +
  • ESS: New ess-completing-read mechanism: ESS uses +ido completions whenever possible. Variable ess-use-ido +controls whether to use ido completion or not. Active by default. + +
  • ESS now supports comint fields for output and input +detection. This feature is not used by default, but might be useful in +the future. + +
  • ESS[S]: New custom variable inferior-ess-S-prompt to +customize prompt detection regular expression in the inferior ESS +buffers. You can customize this variable to enhance comint navigation +(comint-previous-prompt and comint-next-prompt) the +inferior buffers. + +
  • ESS[R]: Internal R completion retrieval +(ess-R-complete-object-name) was rewritten and is faster now. + +
  • ESS is using process plist to store process specific variables, +as opposed to buffer local variables as it was using before. The use of +buffer local variables to store process variables is discouraged. + +
  • ESS: new functions to manipulate process plists: +ess-process-get and ess-process-set. + +
  • ESS: Internal process waiting mechanism was completely rewritten. ESS +no more relies on prompt regular expressions for the prompt +detection. The only requirement on the primary process prompt is to end +in > . This could be overwritten by setting +inferor-ess-primary-prompt. + +
  • ESS[S], notably R: Saved command history: + ess-history-file now accepts t (default), nil, or a + file name. By setting it to nil no command line history is saved + anymore. ess-history-directory now allows to have the history + all saved in one “central” file. +
  • ESS[R]: more Roxygen improvements. +
  • ESS[R]: C-c . to set (indentation) style. + +
  • ESS[R]: Functions with non-standard names (for example ’aaa-bbb:cc’) are +properly handled by font-lock and evaluation routines. +
  • ESS[R]:Several regexp bugs (described in etc/R-ESS-bugs.el) were +fixed in ess-get-words-from-vector and ess-command. +
+ + +
+ +
+

+Next: , Previous: , Up: Introduction   [Contents][Index]

+
+ +

1.3 Authors of and contributors to ESS

+ + + + + +

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 +

+ + +
+ +
+

+Next: , Previous: , Up: Introduction   [Contents][Index]

+
+ +

1.4 Getting the latest version of ESS

+ +

The latest released version of ESS is always available on the web at: +ESS web page or +StatLib +

+ + +

1.4.1 Git for ESS development

+

For development and experimentation on new ESS features, there is now a +GitHub branch for ESS, available at https://github.com/emacs-ess/ESS. +

+ + + +
+ +
+

+Previous: , Up: Introduction   [Contents][Index]

+
+ +

1.5 How to read this manual

+ +

If you need to install ESS, read Installation for details on what +needs to be done before proceeding to the next chapter. +

+

In this manual we use the standard notation for describing the +keystrokes used to invoke certain commands. C-<chr> means hold +the CONTROL key while typing the character <chr>. M-<chr> means +hold the META or EDIT or ALT key down while typing <chr>. If there is no +META, EDIT or ALT key, instead press and release the ESC key and then +type <chr>. +

+

All ESS commands can be invoked by typing M-x command. Most of +the useful commands are bound to keystrokes for ease of use. Also, the +most popular commands are also available through the emacs menubar, and +finally, if available, a small subset are provided on the toolbar. +Where possible, keybindings are similar to other modes in emacs to +strive for a consistent user interface within emacs, regardless of the +details of which programming language is being edited, or process being +run. +

+

Some commands, such as M-x R can accept an optional ‘prefix’ +argument. To specify the prefix argument, you would type C-u +before giving the command. e.g. If you type C-u M-x R, you will +be asked for command line options that you wish to invoke the R process +with. +

+

Emacs is often referred to as a ‘self-documenting’ text editor. This +applies to ESS in two ways. First, limited documentation about each ESS +command can be obtained by typing C-h f. For example, if you type +C-h f ess-eval-region, documentation for that command will appear +in a separate *Help* buffer. Second, a complete list of keybindings +that are available in each ESS mode and brief description of that mode +is available by typing C-h m within an ESS buffer. +

+

Emacs is a versatile editor written in both C and lisp; ESS is written +in the Emacs lisp dialect (termed ‘elisp’) and thus benefits from the +flexible nature of lisp. In particular, many aspects of ESS behaviour +can be changed by suitable customization of lisp variables. This manual +mentions some of the most frequent variables. A full list of them +however is available by using the Custom facility within emacs. (Type +M-x customize-group RET ess RET to get started.) +Customization provides details of common user variables you can +change to customize ESS to your taste, but it is recommended that you +defer this section until you are more familiar with ESS. +

+
+ +
+

+Next: , Previous: , Up: Top   [Contents][Index]

+
+ +

2 Installing ESS on your system

+ + +

The following section details those steps necessary to get ESS running +on your system. +

+ + + + + + + + +
+ +
+

+Next: , Up: Installation   [Contents][Index]

+
+ +

2.1 Step by step instructions

+ +
    +
  1. Download the latest zip or tgz archive from ESS +downloads +area and unpack it into a directory where you would like ESS to +reside. We will denote this directory as /path/to/ESS/ hereafter. + +

    Alternatively you can use git to fetch the most +recent development version to your local machine with: +

    +
    +
    git clone https://github.com/emacs-ess/ESS.git /path/to/ESS
    +
    + +
  2. Optionally, compile elisp files and build the documentation with: +
    +
    cd /path/to/ESS/
    +make
    +
    +

    Without this step, info, pdf and html documentation and reference card +will not be available. +

    +
  3. Optionally, install into your local machine with +make install. You might need administrative privileges: + +
    +
    make install
    +
    + +

    The files are installed into /usr/share/emacs directory. For this step to +run correctly on macOS, you will need to adjust the PREFIX +path in Makeconf. The necessary code and instructions are +commented in that file. +

    +
  4. If you have performed the make install step from above, just add + +
    +
    (require 'ess-site)
    +
    + +

    to your ~/.emacs file. Otherwise, you should add +/path/to/ESS/lisp/ to your emacs load path and then load ESS with +the following lines in your ~/.emacs: +

    +
    +
    (add-to-list 'load-path "/path/to/ESS/lisp/")
    +(load "ess-site")
    +
    + +
  5. Restart your Emacs and check that ESS was loaded from a correct +location with M-x ess-version. +
+ +

Note for Windows and macOS users: The most straightforward +way to install Emacs on your machine is by downloading +the Emacs binary by Vincent Goulet; either +Emacs Modified for macOS +or from +Emacs Modified for Windows. +

+ +

Note for XEmacs users: Due to XEmacs lacking some features +that ESS requires, ESS support of XEmacs ends with ESS 12.04-4. This +decision will be re-visited in the future as XEmacs continues to sync +with GNU Emacs. +

+ +
+ + + +

2.2 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. +

+
+ +
+

+Next: , Previous: , Up: Installation   [Contents][Index]

+
+ +

2.3 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! +

+ +
+ +
+

+Previous: , Up: Installation   [Contents][Index]

+
+ +

2.4 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). +

+ + + + + + + +
+ +
+

+Next: , Previous: , Up: Top   [Contents][Index]

+
+ +

3 Interacting with statistical programs

+ +

As well as using ESS to edit your source files for statistical programs, +you can use ESS to run these statistical programs. In this chapter, we +mostly will refer by example to running S from within emacs. The emacs +convention is to name such processes running under its control as +‘inferior processes’. This term can be slightly misleading, in which +case these processes can be thought of ‘interactive processes’. Either +way, we use the term ‘iESS’ to refer to the Emacs mode used to interact +with statistical programs. +

+ + + + + + + + + +
+ + + +

3.1 Starting an ESS process

+ + + +

To start an S session on Unix or on Windows when you +use the Cygwin bash shell, simply type M-x S RET. +

+

To start an S session on Windows when you +use the MSDOS prompt shell, simply type M-x S+6-msdos RET. +

+ + + + + + + +

S will then (by default) ask the question +

+
S starting data directory?
+
+

Enter the name of the directory you wish to start S from (that is, +the directory you would have cd’d to before starting S from +the shell). This directory should have a .Data subdirectory. +

+

You will then be popped into a buffer + + +with name ‘*S*’ which will be used +for interacting with the ESS process, and you can start entering commands. +

+ +
+ + + +

3.2 Running more than one ESS process

+ + +

ESS allows you to run more than one ESS process simultaneously in the +same session. Each process has a name and a number; the initial process + +(process 1) is simply named (using S-PLUS as an example) ‘S+3:1’. +The name of the process is shown in the mode line in square brackets +(for example, ‘[S+3:2]’); this is useful if the process buffer is +renamed. Without a prefix argument, M-x S starts a new ESS +process, using the first available process number. With a prefix +argument (for R), C-u M-x R allows for the specification of +command line options. +

+ +

You can switch to any active ESS process with the command +‘M-x ess-request-a-process’. Just enter the name of the process +you require; completion is provided over the names of all running S +processes. This is a good command to consider binding to a global key. +

+ + +
+ + + +

3.3 ESS processes on Remote Computers

+ + + + + +

ESS works with processes on remote computers as easily as with processes +on the local machine. The recommended way to access a statistical +program on remote computer is to start it with tramp. Require tramp in your .emacs file: +

+

(require 'tramp) +

+

Now start an ssh session with ‘C-x C-f /ssh:user@host: RET’. Tramp +should open a dired buffer in your remote home directory. Now call your +favorite ESS process (R, Julia, stata etc) as you +would usually do on local machine: M-x R. +

+

Alternatively you can start your process normally (M-x R). After +you are asked for starting directory, simply type ‘/ssh:user@host: +RET’. R process will be started on the remote machine. +

+

To simplify the process even further create a "config" file in your +.ssh/ folder and add an account. For example if you use amazon +EC2, it might look like following: +

+
   Host amazon
+      Hostname ec2-54-215-203-181.us-west-1.compute.amazonaws.com
+      User ubuntu
+      IdentityFile ~/.ssh/my_amazon_key.pem
+      ForwardX11 yes
+
+

With this configuration /ssh:amazon: is enough to start a +connection. The ForwardX11 is needed if you want to see R graphic device +showing on the current machine +

+

Other ways to setup a remote ESS connection are through ess-remote. +

+
    +
  1. Start a new shell, telnet or ssh buffer and connect to the remote computer +(e.g. use, ‘M-x shell’, ‘M-x telnet’ or ‘M-x ssh’; ssh.el is available at +http://www.splode.com/~friedman/software/emacs-lisp/src/ssh.el). + +
  2. Start the ESS process on the remote machine, for example with one of +the commands ‘Splus’, or ‘R’, or ‘sas -stdio’. + +
  3. Start ‘M-x ess-remote’. +You will be prompted for a program name with completion. Choose +one. Your process is now known to ESS. All the usual ESS commands +(‘C-c C-n’ and its relatives) now work with the S language +processes. For SAS you need to use a different command ‘C-c i’ +(that is a regular ‘i’, not a ‘C-i’) to send lines from your +myfile.sas to the remote SAS process. ‘C-c i’ sends lines +over invisibly. +With ess-remote you get teletype behavior—the data input, the +log, and the listing all appear in the same buffer. To make this work, +you need to end every PROC and DATA step with a "RUN;" statement. The +"RUN;" statement is what tells SAS that it should process the preceding +input statements. + +
  4. Graphics (interactive) on the remote machine. If you run X11 +(See X11, X Windows) +on both the local and remote machines then you should be able to +display the graphs locally by setting the ‘DISPLAY’ environment +variable appropriately. Windows users can download ‘xfree86’ +from cygwin. + +
  5. Graphics (static) on the remote machine. +If you don’t run the X window system on the local machine, then you can write +graphics to a file on the remote machine, and display the file in +a graphics viewer on the local machine. Most statistical software can +write one or more of postscript, GIF, or JPEG files. +Depending on the versions of emacs and the operating system that you +are running, emacs itself may display ‘.gif’ and ‘.jpg’ +files. Otherwise, a graphics file viewer will be needed. +Ghostscript/ghostview may be downloaded to display ‘.ps’ and +‘.eps’ files. Viewers for GIF and JPEG are usually included with +operating systems. See ESS(SAS)--Function keys for batch processing, +for more information on using the F12 key for displaying graphics files +with SAS. +
+ +

Should you or a colleague inadvertently start a statistical process in +an ordinary ‘*shell*’ buffer, the ‘ess-remote’ command can +be used to convert it to an ESS buffer and allow you to use the ESS +commands with it. +

+

We have two older commands, now deprecated, for accessing ESS processes +on remote computers. +See S+elsewhere and ESS-elsewhere. +

+ +
+ + + +

3.4 S+elsewhere and ESS-elsewhere

+ +

These commands are now deprecated. We recommend ‘ess-remote’. We +have two versions of the elsewhere function. ‘S+elsewhere’ is +specific for the S-Plus program. The more general function +‘ESS-elsewhere’ is not as stable. +

+
    +
  1. Enter ‘M-x S+elsewhere’. +You will be prompted for a starting directory. I usually give it my +project directory on the local machine, say ‘~myname/myproject/’ + +

    Or enter ‘M-x ESS-elsewhere’. You will be prompted for an ESS +program and for a starting directory. I usually give it my project +directory on the local machine, say ‘~myname/myproject/’ +

    +
  2. The ‘*S+3*’ buffer will appear with a prompt from the +local operating system (the unix prompt on a unix workstation or with +cygwin bash on a PC, or the msdos prompt on a PC without bash). emacs +may freeze because the cursor is at the wrong place. Unfreeze it with +‘C-g’ then move the cursor to the end with ‘M->’. +With ‘S+elsewhere’ the buffer name is based on the name of the ESS program. +
  3. Enter +‘telnet myname@other.machine’ (or ‘ssh myname@other.machine’). +You will be prompted for your password on the remote machine. +Use +‘M-x send-invisible’ +before typing the password itself. + +
  4. Before starting the ESS process, type ‘stty -echo nl’ +at the unix prompt. The ‘-echo’ turns off the echo, the +‘nl’ turns off the newline that you see as ‘^M’. + +
  5. You are now talking to the unix prompt on the other machine in the +‘*S+3*’ buffer. cd into the directory for the current project and start +the ESS process by entering +‘Splus’ or ‘R’ or ‘sas -stdio’ +as appropriate. If you can login remotely to your Windows 2000, then +you should be able to run ‘Sqpe’ on the Windows machine. I haven’t +tested this and no-one has reported their tests to me. You will not be +able to run the GUI through this text-only connection. + +
  6. Once you get the S or R or SAS prompt, then you are completely connected. +All the ‘C-c C-n’ and related commands work correctly in sending +commands from ‘myfile.s’ or ‘myfile.r’ on the PC to the +‘*S+3*’ buffer running the S or R or SAS program on the remote machine. + +
  7. Graphics on the remote machine works fine. If you run the X window +system on the remote unix machine you should be able to display them in +‘xfree86’ on your PC. If you don’t run X Windows, or X11, then you can write +graphics to the postscript device and copy it to your PC with dired and +display it with ghostscript. +
+ + +
+ + + +

3.5 Changing the startup actions

+ +

If you do not wish ESS to prompt for a starting directory when starting +a new process, set the variable ess-ask-for-ess-directory to + +nil. In this case, the starting directory will be set using +one of the following methods: +

+
    +
  1. If the variable ess-directory-function stores the name of a +function, the value returned by this function is used. The default for +this variable is nil. + +
  2. Otherwise, if the variable ess-directory stores the name of a +directory (ending in a slash), this value is used. The default for this +variable is nil. + +
  3. Otherwise, the working directory of the current buffer is used. + +
+ +

If ess-ask-for-ess-directory has a non-nil value (as it +does by default) then the value determined by the above rules provides +the default when prompting for the starting directory. Incidentally, +ess-directory is an ideal variable to set in +ess-pre-run-hook. +

+

If you like to keep a record of your S sessions, set the variable +ess-ask-about-transfile to t, and you will be asked for a +filename for the transcript before the ESS process starts. +

+
+
User Option: ess-ask-about-transfile
+

If non-nil, as for a file name in which to save the session +transcript. +

+ + +

Enter the name of a file in which to save the transcript at the prompt. +If the file doesn’t exist it will be created (and you should give it a +file name ending in ‘.St’); if the file already exists the +transcript will be appended to the file. (Note: if you don’t set this +variable but you still want to save the transcript, you can still do it +later — see Saving transcripts.) +

+

Once these questions are answered (if they are asked at all) the S +process itself is started by calling the program name specified in the +variable inferior-ess-program. + +If you need to pass any arguments to this program, they may be specified +in the variable inferior-S_program_name-args (e.g. if +inferior-ess-program is "S+" then the variable to set is +inferior-S+-args. + +It is not normally necessary to pass arguments to the S program; in +particular do not pass the ‘-e’ option to Splus, since ESS +provides its own command history mechanism. +

+

By default, the new process will be displayed in the same window in the +current frame. If you wish your S process to appear in a separate +variable, customize the variable inferior-ess-own-frame. +Alternatively, change inferior-ess-same-window if you wish the +process to appear within another window of the current frame. +

+
+ +
+

+Next: , Previous: , Up: Top   [Contents][Index]

+
+ +

4 Interacting with the ESS process

+ + + + +

The primary function of the ESS package is to provide an easy-to-use +front end to the S interpreter. This is achieved by running the S +process from within an Emacs buffer, called hereafter inferior +buffer, which has an active inferior-ess-mode. The features of +Inferior S mode are similar to those provided by the standard Emacs +shell mode (see Shell Mode in The Gnu Emacs Reference Manual). +Command-line completion of S objects and a number of ‘hot keys’ for +commonly-used S commands are also provided for ease of typing. +

+ + + + + + + + + + + +
+ + + +

4.1 Entering commands and fixing mistakes

+ + +

Sending a command to the ESS process is as simple as typing it in +and pressing the RETURN key: +

+
+
Command: inferior-ess-send-input
+
+

RET Send the command on the current line to the ESS process. +

+ +

If you make a typing error before pressing RET all the usual Emacs +editing commands are available to correct it (see Basic +editing commands in The GNU Emacs Reference Manual). Once the +command has been corrected you can press RETURN (even if the +cursor is not at the end of the line) to send the corrected command to +the ESS process. +

+

Emacs provides some other commands which are useful for fixing mistakes: +

+
+
C-c C-w
+
+

backward-kill-word Deletes the previous word (such as an object +name) on the command line. +

+
+
C-c C-u
+
+

comint-kill-input Deletes everything from the prompt to point. +Use this to abandon a command you have not yet sent to the ESS process. +

+
+
C-c C-a
+
+

comint-bol Move to the beginning of the line, and then skip +forwards past the prompt, if any. +

+
+ +

See Shell Mode in The Gnu Emacs Reference Manual, for other +commands relevant to entering input. +

+ +
+ + + +

4.2 Manipulating the transcript

+ +

Most of the time, the cursor spends most of its time at the bottom of +the ESS process buffer, entering commands. However all the input +and output from the current (and previous) ESS sessions is stored in +the process buffer (we call this the transcript) and often we want to + +move back up through the buffer, to look at the output from previous +commands for example. +

+

Within the process buffer, a paragraph + +is defined as the prompt, the command after the prompt, and the output +from the command. Thus M-{ and M-} move you backwards and +forwards, respectively, through commands in the transcript. A +particularly useful command is M-h (mark-paragraph) which +will allow you to mark a command and its entire output (for deletion, +perhaps). For more information about paragraph commands, +see Paragraphs in The GNU Emacs +Reference Manual. +

+

If an ESS process finishes and you restart it in the same process +buffer, the output from the new ESS process appears after the output +from the first ESS process separated by a form-feed (‘^L’) +character. Thus pages in the ESS + +process buffer correspond to ESS sessions. Thus, for example, you may +use C-x [ and C-x ] to move backward and forwards through +ESS sessions in a single ESS process buffer. For more information about +page commands, see Pages in The GNU Emacs +Reference Manual. +

+ + + + + + + +
+ + + +

4.2.1 Manipulating the output from the last command

+ +

Viewing the output of the command you have just entered is a common +occurrence and ESS provides a number of facilities for doing this. +Whenever a command produces a longish output, it is possible that the +window will scroll, leaving the next prompt near the middle of the +window. The first part of the command output may have scrolled off the +top of the window, even though the entire output would fit in the window +if the prompt were near the bottom of the window. If this happens, you +can use the following comint commands: +

+

comint-show-maximum-output to move to the end +of the buffer, and place cursor on bottom line of window to make more of +the last output visible. To make this happen automatically for all +inputs, set the variable comint-scroll-to-bottom-on-input to +t or 'this. If the first part of the output is still not +visible, use + +C-c C-r (comint-show-output), + +which moves cursor to the previous command line and places it at the +top of the window. +

+

Finally, if you want to discard the last command output altogether, use + +C-c C-o (comint-delete-output), + +which deletes everything from the last command to the current prompt. +Use this command judiciously to keep your transcript to a more +manageable size. +

+
+ +
+

+Next: , Previous: , Up: Transcript   [Contents][Index]

+
+ +

4.2.2 Viewing older commands

+ +

If you want to view the output from more historic commands than the +previous command, commands are also provided to move backwards and +forwards through previously entered commands in the process buffer: +

+
+
C-c C-p
+
+

comint-previous-input Moves point to the preceding command in the +process buffer. +

+
+
C-c C-n
+
+

comint-next-input Moves point to the next command in the process +buffer. +

+
+ +

Note that these two commands are analogous to C-p and C-n +but apply to command lines rather than text lines. And just like +C-p and C-n, passing a prefix argument to these commands +means to move to the ARG’th next (or previous) command. (These +commands are also discussed in Shell History +Copying in The GNU Emacs Reference Manual.) +

+

There are also two similar commands (not bound to any keys by default) +which move to preceding or succeeding commands, but which first prompt +for a regular expression (see Syntax of Regular +Expression in The GNU Emacs Reference Manual), and then moves to +the next (previous) command matching the pattern. +

+
+
comint-backward-matching-input regexp arg
+
+
+
comint-forward-matching-input regexp arg
+
+

Search backward (forward) through the transcript buffer for the +arg’th previous (next) command matching regexp. arg +is the prefix argument; regexp is prompted for in the minibuffer. +

+
+ +
+ + + +

4.2.3 Re-submitting commands from the transcript

+ +

When moving through the transcript, you may wish to re-execute some of +the commands you find there. ESS provides three commands to do this; +these commands may be used whenever the cursor is within a command line +in the transcript (if the cursor is within some command output, +an error is signalled). Note all three commands involve the RETURN +key. +

+
+
RET
+

inferior-ess-send-input See Command-line editing. +

+
+
C-c RET
+
+

comint-copy-old-input Copy the command under the cursor to the +current command line, but don’t execute it. Leaves the cursor on the +command line so that the copied command may be edited. +

+
+ +

When the cursor is not after the current prompt, the RETURN key +has a slightly different behavior than usual. Pressing RET on any +line containing a command that you entered (i.e. a line beginning with a +prompt) sends that command to the ESS process once again. If you +wish to edit the command before executing it, use C-c RET instead; +it copies the command to the current prompt but does not execute it, +allowing you to edit it before submitting it. +

+

These commands work even if the current line is a continuation line +(i.e. the prompt is ‘+’ instead of ‘>’) — in this case all +the lines that form the multi-line command are concatenated together and +the resulting command is sent to the ESS process (currently this is +the only way to resubmit a multi-line command to the ESS process in +one go). If the current line does + +not begin with a prompt, an error is signalled. This feature, coupled +with the command-based motion commands described above, could be used as +a primitive history mechanism. ESS provides a more sophisticated +mechanism, however, which is described in Command History. +

+
+ +
+

+Previous: , Up: Transcript   [Contents][Index]

+
+ +

4.2.4 Keeping a record of your S session

+ +

To keep a record of your S session in a disk file, use the Emacs +command C-x C-w (write-file) to attach a file to the ESS +process buffer. The name of the process buffer will (probably) change +to the name of the file, but this is not a problem. You can still use +S as usual; just remember to save the file before you quit Emacs +with C-x C-s. You can make ESS prompt you for a filename in which +to save the transcript every time you start S by setting the +variable + +ess-ask-about-transfile to t; See Customizing startup. + +We recommend you save your transcripts with filenames that end in +‘.St’. There is a special mode (ESS transcript mode — +see Transcript Mode) for editing transcript files which is +automatically selected for files with this suffix. +

+ +

S transcripts can get very large, so some judicious editing is +appropriate if you are saving it in a file. Use C-c C-o whenever +a command produces excessively long output (printing large arrays, for +example). Delete erroneous commands (and the resulting error messages +or other output) by moving to the command (or its output) and typing +M-h C-w. Also, remember that C-c C-x (and other hot keys) +may be used for commands whose output you do not wish to appear in the +transcript. These suggestions are appropriate even if you are not +saving your transcript to disk, since the larger the transcript, the +more memory your Emacs process will use on the host machine. +

+

Finally, if you intend to produce S source code (suitable for using +with source() or inclusion in an S function) from a +transcript, then the command ess-transcript-clean-region may be +of use. see Transcript Mode +

+ +
+ +
+

+Next: , Previous: , Up: Entering commands   [Contents][Index]

+
+ +

4.3 Command History

+ + + + +

ESS provides easy-to-use facilities for re-executing or editing previous +commands. An input history of the last few commands is maintained (by +default the last 500 commands are stored, although this can be changed by +setting the variable comint-input-ring-size in + +inferior-ess-mode-hook.) The simplest history commands simply +select the next and previous commands in the input history: +

+
+
M-p
+
+

comint-previous-input Select the previous command in the input +history. +

+
+
M-n
+
+

comint-next-input Select the next command in the input history. +

+
+ +

For example, pressing M-p once will re-enter the last command into +the process buffer after the prompt but does not send it to the ESS +process, thus allowing editing or correction of the command before the +ESS process sees it. Once corrections have been made, press +RET to send the edited command to the ESS process. +

+

If you want to select a particular command from the history by matching +it against a regular expression (see Syntax of Regular +Expression in The GNU Emacs Reference Manual), to search for a +particular variable name for example, these commands are also available: +

+
+
M-r
+
+

comint-history-isearch-backward-regexp Prompt for a regular +expression, and search backwards through the input history for a command +matching the expression. +

+
+
+ +

A common type of search is to find the last command that began with a +particular sequence of characters; the following two commands provide an +easy way to do this: +

+
+
C-c M-r
+
+

comint-previous-matching-input-from-input Select the previous +command in the history which matches the string typed so far. +

+
+
C-c M-s
+
+

comint-next-matching-input-from-input Select the next command in +the history which matches the string typed so far. +

+
+ +

Instead of prompting for a regular expression to match against, as they +instead select commands starting with those characters already entered. +For instance, if you wanted to re-execute the last attach() +command, you may only need to type att and then C-c M-r and +RET. +

+

See Shell History Ring in The GNU Emacs Reference +Manual, for a more detailed discussion of the history mechanism, +and do experiment with the In/Out menu to explore the possibilities. +

+

Many ESS users like to have even easier access to these, and recommend +to add something like +

+
  (eval-after-load "comint"
+   '(progn
+      (define-key comint-mode-map [up]
+        'comint-previous-matching-input-from-input)
+      (define-key comint-mode-map [down]
+        'comint-next-matching-input-from-input)
+
+      ;; also recommended for ESS use --
+      (setq comint-scroll-to-bottom-on-output 'others)
+      (setq comint-scroll-show-maximum-output t)
+      ;; somewhat extreme, almost disabling writing in *R*, *shell* buffers above prompt:
+      (setq comint-scroll-to-bottom-on-input 'this)
+      ))
+
+

to your .emacs file, +where the last two settings are typically desirable for the situation where +you work with a script (e.g., code.R) and send code chunks to the +process buffer (e.g. *R*). +Note however that these settings influence all comint-using emacs +modes, not just the ESS ones, and for that reason, these customization +cannot be part of ESS itself. +

+ + + + +
+ + + +

4.3.1 Saving the command history

+ +

The ess-history-file variable, which is t by default, +together with ess-history-directory, governs if and where the +command history is saved and restored between sessions. +By default, ess-history-directory is nil, and the command +history will be stored (as text file) in the ess-directory, e.g., as +.Rhistory. +

+

Experienced ESS users often work exclusively with script files rather than +in a (e.g., *R) console session, and may not want to save any +history files, and hence have: +

+
+
  (setq ess-history-file nil)
+
+ +

or will only want one global command history file and have: +

+
+
  (setq ess-history-directory "~/.R/")
+
+ +

in your .emacs file. +

+
+ +
+

+Next: , Previous: , Up: Entering commands   [Contents][Index]

+
+ +

4.4 References to historical commands

+ +

Instead of searching through the command history using the command +described in the previous section, you can alternatively refer to a +historical command directly using a notation very similar to that used +in csh. History references are introduced by a ‘!’ or +‘^’ character and have meanings as follows: +

+
+
!!
+

The immediately previous command +

+
+
!-N
+

The Nth previous command +

+
+
!text
+

The last command beginning with the string ‘text’ +

+
+
!?text
+

The last command containing the string ‘text’ +

+
+ +

In addition, you may follow the reference with a word designator +to select particular words of the input. A word is defined as a +sequence of characters separated by whitespace. (You can modify this +definition by setting the value of comint-delimiter-argument-list +to a list of characters that are allowed to separate words and + +themselves form words.) Words are numbered beginning with zero. The +word designator usually begins with a ‘:’ (colon) character; +however it may be omitted if the word reference begins with a ‘^’, +‘$’, ‘*’ or ‘-’. If the word is to be selected from the +previous command, the second ‘!’ character can be omitted from the +event specification. For instance, ‘!!:1’ and ‘!:1’ both +refer to the first word of the previous command, while ‘!!$’ and +‘!$’ both refer to the last word in the previous command. The +format of word designators is as follows: +

+
+
0
+

The zeroth word (i.e. the first one on the command line) +

+
+
n
+

The nth word, where n is a number +

+
+
^
+

The first word (i.e. the second one on the command line) +

+
+
$
+

The last word +

+
+
x-y
+

A range of words; ‘-y’ abbreviates ‘0-y’ +

+
+
*
+

All the words except the zeroth word, or nothing if the command had just +one word (the zeroth) +

+
+
x*
+

Abbreviates x-$ +

+
+
x-
+

Like ‘x*’, but omitting the last word +

+
+ +

In addition, you may surround the entire reference except for the first +‘!’ by braces to allow it to be followed by other (non-whitespace) +characters (which will be appended to the expanded reference). +

+

Finally, ESS also provides quick substitution; a reference like +‘^old^new^’ means “the last command, but with the first occurrence +of the string ‘old’ replaced with the string ‘new’” (the last +‘^’ is optional). Similarly, ‘^old^’ means “the last +command, with the first occurrence of the string ‘old’ deleted” +(again, the last ‘^’ is optional). +

+

To convert a history reference as described above to an input suitable +for S, you need to expand the history reference, using the +TAB key. For this to work, the cursor must be preceded by a space +(otherwise it would try to complete an object name) and not be within a +string (otherwise it would try to complete a filename). So to expand +the history reference, type SPC TAB. This will convert the +history reference into an S command from the history, which you can +then edit or press RET to execute. +

+

For example, to execute the last command that referenced the variable +data, type !?data SPC TAB RET. +

+
+ + + +

4.5 Hot keys for common commands

+ +

ESS provides a number of commands for executing the commonly used +functions. These commands below are basically information-gaining +commands (such as objects() or search()) which tend to +clutter up your transcript and for this reason some of the hot keys +display their output in a temporary buffer instead of the process buffer +by default. This behavior is controlled by the following option: +

+
+
User Option: ess-execute-in-process-buffer
+

If non-nil, means that these commands will produce their output +in the process buffer instead. +

+ +

In any case, passing a prefix argument to the commands (with C-u) +will reverse the meaning of ess-execute-in-process-buffer for +that command, i.e. the output will be displayed in the process buffer if +it usually goes to a temporary buffer, and vice-versa. These are the +hot keys that behave in this way: +

+
+
Command: ess-execute-objects posn
+
+ + +

C-c C-x Sends the objects() command to the ESS process. A +prefix argument specifies the position on the search list (use a +negative argument to toggle ess-execute-in-process-buffer as +well). A quick way to see what objects are in your working directory. +A prefix argument of 2 or more means get objects for that position. A +negative prefix argument posn gets the objects for that position, +as well as toggling ess-execute-in-process-buffer. +

+ +
+
Command: ess-execute-search invert
+
+ + +

C-c C-s Sends the inferior-ess-search-list-command command +to the ess-language process; search() in S. Prefix +invert toggles ess-execute-in-process-buffer. +

+ +

ess-execute may seem pointless when you could just type the +command in anyway, but it proves useful for ‘spot’ calculations which +would otherwise clutter your transcript, or for evaluating an expression +while partway through entering a command. You can also use this command +to generate new hot keys using the Emacs keyboard macro facilities; +see Keyboard Macros in The GNU +Emacs Reference Manual. + + +

+

The following hot keys do not use ess-execute-in-process-buffer +to decide where to display the output — they either always display in +the process buffer or in a separate buffer, as indicated: +

+ +
+
Command: ess-load-file filename
+
+

C-c C-l Prompts for a file (filename) to load into the ESS +process using source(). If there is an error during loading, you +can jump to the error in the file with the following function. +

+ +
+
Command: ess-parse-errors arg reset
+
+ +

C-c ` or C-x ` Visits next next-error message and +corresponding source code. If all the error messages parsed so far have +been processed already, the message buffer is checked for new ones. A +prefix arg specifies how many error messages to move; negative +means move back to previous error messages. Just C-u as a prefix +means reparse the error message buffer and start at the first error. +The reset argument specifies restarting from the beginning. +

+

See Error Checking, for more details. +

+ +
+
Command: ess-display-help-on-object object command
+
+

C-c C-v Pops up a help buffer for an S object or +function. If command is supplied, it is used instead of +inferior-ess-help-command. See Help for more details. +

+ +
+
Command: ess-quit
+
+ + + + + + + +

C-c C-q Issue an exiting command to the inferior process, +additionally also running ess-cleanup for disposing of any +temporary buffers (such as help buffers and edit buffers) that may have +been created. Use this command when you have finished your S +session instead of simply quitting at the inferior process prompt, +otherwise you will need to issue the command ess-cleanup +explicitly to make sure that all the files that need to be saved have +been saved, and that all the temporary buffers have been killed. +

+ + +
+ +
+

+Next: , Previous: , Up: Entering commands   [Contents][Index]

+
+ +

4.6 Is the Statistical Process running under ESS?

+ + + +

For the S languages (S, S-Plus, R) ESS sets an option in the current +process that programs in the language can check to determine the +environment in which they are currently running. +

+

ESS sets options(STERM="iESS") for S language processes running +in an inferior iESS[S] or iESS[R] buffer. +

+

ESS sets options(STERM="ddeESS") for independent S-Plus for +Windows processes running in the GUI and communicating with ESS via the +DDE (Microsoft Dynamic Data Exchange) protocol through a +ddeESS[S] buffer. +

+

Other values of options()$STERM that we recommend are: +

+
    +
  • length: Fixed length xterm or telnet window. +
  • scrollable: Unlimited length xterm or telnet window. +
  • server: S-Plus Stat Server. +
  • BATCH: BATCH. +
  • Rgui: R GUI. +
  • Commands: S-Plus GUI without DDE interface to ESS. +
+ +

Additional values may be recommended in the future as new interaction +protocols are created. Unlike the values iESS and ddeESS, +ESS can’t set these other values since the S language program is not +under the control of ESS. +

+
+ + + +

4.7 Using emacsclient

+ + +

When starting R or S under Unix, ESS sets +options(editor="emacsclient"). (Under Microsoft Windows, it will +use gnuclient.exe rather than emacsclient, but the same principle +applies.) Within your R session, for example, if you have a function +called iterator, typing fix(iterator), will show that +function in a temporary Emacs buffer. You can then correct the +function. When you kill the buffer, the definition of the function is +updated. Using edit() rather than fix() means that the +function is not updated. Finally, the S function page(x) will +also show a text representation of the object x in a temporary +Emacs buffer. +

+ +
+ +
+

+Previous: , Up: Entering commands   [Contents][Index]

+
+ +

4.8 Other commands provided by inferior-ESS

+ +

The following commands are also available in the process buffer: +

+
+
Command: comint-interrupt-subjob
+
+ + +

C-c C-c Sends a Control-C signal to the ESS process. This has the +effect of aborting the current command. +

+ +
+
Command: ess-switch-to-inferior-or-script-buffer toggle-eob
+
+

C-c C-z When in process buffer, return to the most recent script +buffer. When in a script buffer pop to the associated process buffer. +This is a single key command, that is C-c C-z C-z from a script +buffer returns to the original buffer. +

+

If toggle-eob is given, the value of +ess-switch-to-end-of-proc-buffer is toggled. +

+ +
+
User Option: ess-switch-to-end-of-proc-buffer
+

If non-nil, ess-switch-to-inferior-or-script-buffer goes +to end of process buffer. +

+ +

Other commands available in Inferior S mode are discussed in +Shell Mode in The Gnu Emacs Reference Manual. +

+ +
+ +
+

+Next: , Previous: , Up: Top   [Contents][Index]

+
+ +

5 Sending code to the ESS process

+ +

Other commands are also available for evaluating portions of code in the +S process. These commands cause the selected code to be evaluated +directly by the ESS process as if you had typed them in at the +command line; the source() function is not used. You may choose +whether both the commands and their output appear in the process buffer +(as if you had typed in the commands yourself) or if the output alone is +echoed. The behavior is controlled by the variable: +

+
+
User Option: ess-eval-visibly
+

Non-nil means ess-eval-* commands display commands and +output in the process buffer. Default is t. +

+ +

Passing a prefix (C-u) vis to any of the following commands, +however, reverses the meaning of ess-eval-visibly for that +command only — for example C-u C-c C-j +suppresses the current line of S (or other) code in the ESS process buffer. +This method of evaluation is an +alternative to S’s source() function + + + +when you want the input as well as the output to be displayed. (You can +sort of do this with source() when the option echo=T is +set, except that prompts do not get displayed. ESS puts prompts in the +right places.) +

+

Primary commands for evaluating code are: + +

+
+
Command: ess-eval-region-or-line-and-step vis
+

Send the highlighted region or current line and step to next line of +code. +

+ +
+
Command: ess-eval-region-or-function-or-paragraph vis
+
+

C-M-x Sends the current selected region or function or paragraph. +

+ +
+
Command: ess-eval-region-or-function-or-paragraph-and-step vis
+
+

C-c C-c Like ess-eval-region-or-function-or-paragraph but +steps to next line of code. +

+ +

Other, not so often used, evaluation commands are: +

+
+
Command: ess-eval-line vis
+
+

C-c C-j Sends the current line to the ESS process. +

+ +
+
Command: ess-eval-line-and-go vis
+
+

C-c M-j Like ess-eval-line but additionally switches point +to the ESS process. +

+ +
+
Command: ess-eval-function vis no-error
+
+

C-c C-f Sends the S function containing point to the ESS +process. +

+ +
+
Command: ess-eval-function-and-go vis
+
+

C-c M-f Like ess-eval-function but additionally switches +point to the ESS process. +

+ +
+
Command: ess-eval-region start end toggle message
+
+

C-c C-r Sends the current region to the ESS process. +

+ +
+
Command: ess-eval-region-and-go start end vis
+
+

C-c M-r Like ess-eval-region but additionally switches +point to the ESS process. +

+ +
+
Command: ess-eval-buffer vis
+
+

C-c C-b Sends the current buffer to the ESS process. +

+ +
+
Command: ess-eval-buffer-and-go vis
+
+

C-c M-b Like ess-eval-buffer but additionally switches +point to the ESS process. +

+ +

All the above ess-eval-* commands are useful for evaluating small +amounts of code and observing the results in the process buffer for +debugging purposes, or for generating transcripts from source files. +When editing S functions, it is generally preferable to use C-c +C-l to update the function’s value. In particular, +ess-eval-buffer is now largely obsolete. +

+

A useful way to work is to divide the frame into two windows; one +containing the source code and the other containing the process buffer. +If you wish to make the process buffer scroll automatically when the +output reaches the bottom of the window, you will need to set the +variable comint-scroll-to-bottom-on-output to 'others or +t. +

+ +
+ +
+

+Next: , Previous: , Up: Top   [Contents][Index]

+
+ +

6 Manipulating saved transcript files

+ +

Inferior S mode records the transcript (the list of all commands +executed, and their output) in the process buffer, which can be saved as +a transcript file, which should normally have the suffix +.St. The most obvious use for a transcript file is as a static +record of the actions you have performed in a particular S session. +Sometimes, however, you may wish to re-execute commands recorded in the +transcript file by submitting them to a running ESS process. This +is what Transcript Mode is for. +

+

If you load file a with the suffix .St into Emacs, it is placed +in S Transcript Mode. Transcript Mode is similar to Inferior S mode +(see Entering commands): + + +paragraphs are defined as a command and its output, and you can move +though commands either with the paragraph commands or with C-c C-p +and C-c C-n. +

+ + + + + +
+ +
+

+Next: , Up: Transcript Mode   [Contents][Index]

+
+ +

6.1 Resubmitting commands from the transcript file

+ +

Three commands are provided to re-submit command lines from the +transcript file to a running ESS process. They are: +

+
+
Command: ess-transcript-send-command
+
+

M-RET Sends the current command line to the ESS process, and +execute it. +

+ +
+
Command: ess-transcript-copy-command
+
+

C-c RET Copy the current command to the ESS process, and switch to +it (ready to edit the copied command). +

+ +
+
Command: ess-transcript-send-command-and-move
+
+

RET Sends the current command to the ESS process, and move to the +next command line. This command is useful for submitting a series of +commands. +

+ +

Note that the first two commands are similar to those on the same keys +in inferior S Mode. In all three cases, the commands should be +executed when the cursor is on a command line in the transcript; the +prompt is automatically removed before the command is submitted. +

+
+ +
+

+Previous: , Up: Transcript Mode   [Contents][Index]

+
+ +

6.2 Cleaning transcript files

+ +

Yet another use for transcript files is to extract the command lines for +inclusion in an S source file or function. Transcript mode provides +one command which does just this: +

+
+
Command: ess-transcript-clean-region beg end even-if-read-only
+
+

C-c C-w Strip the transcript in the region (given by beg and +end), leaving only commands. Deletes any lines not beginning with +a prompt, and then removes the prompt from those lines that remain. +Prefix argument even-if-read-only means to clean even if the +buffer is read-only. Don’t forget to remove any erroneous commands +first! +

+ +

The remaining command lines may then be copied to a source file or edit +buffer for inclusion in a function definition, or may be evaluated +directly (see Evaluating code) using the code evaluation commands +from S mode, also available in S Transcript Mode. +

+ +
+ +
+

+Next: , Previous: , Up: Top   [Contents][Index]

+
+ +

7 Editing objects and functions

+ + +

ESS provides facilities for editing S objects within your Emacs +session. Most editing is performed on S functions, although in +theory you may edit datasets as well. Edit buffers are always +associated with files, although you may choose to make these files +temporary if you wish. Alternatively, you may make use of a simple yet +powerful mechanism for maintaining backups of text representations of +S functions. Error-checking is performed when S code is loaded +into the ESS process. +

+ + + + + + + + + + +
+ +
+

+Next: , Up: Editing objects   [Contents][Index]

+
+ +

7.1 Creating or modifying S objects

+ + +

To edit an S object, type +

+
+
Command: ess-dump-object-into-edit-buffer object
+
+

C-c C-e C-d Edit an S object in its own edit buffer. +

+ +

from within the ESS process buffer (*S*). You will then be +prompted for an object to edit: you may either type in the name of an +existing object (for which completion is available using the TAB +key), + +or you may enter the name of a new object. + + +A buffer will be created containing the text representation of the +requested object or, if you entered the name of a non-existent object at +the prompt and the variable ess-function-template + +is non-nil, you will be presented with a template defined by that +variable, which defaults to a skeleton function construct. +

+

You may then edit the function as required. The edit buffer generated +by ess-dump-object-into-edit-buffer is placed in the ESS +major mode which provides a number of commands to facilitate editing +S source code. Commands are provided to intelligently indent S +code, evaluate portions of S code and to move around S code +constructs. +

+ + +

Note: when you dump a file with C-c C-e C-d, ESS first checks +to see whether there already exists an edit buffer containing that +object and, if so, pops you directly to that buffer. If not, ESS next +checks whether there is a file in the appropriate place with the +appropriate name (see Source Files) and if so, reads in that file. +You can use this facility to return to an object you were editing in a +previous session (and which possibly was never loaded to the S +session). Finally, if both these tests fail, the ESS process is +consulted and a dump() command issued. + +If you want to force ESS to ask the ESS process for the object’s +definition (say, to reformat an unmodified buffer or to revert back to +S’s idea of the object’s definition) pass a prefix argument to +ess-dump-object-into-edit-buffer by typing C-u C-c C-e C-d. +

+
+ +
+

+Next: , Previous: , Up: Editing objects   [Contents][Index]

+
+ +

7.2 Loading source files into the ESS process

+ +

The best way to get information — particularly function definitions +— into S is to load them in as source file, using S’s +source function. You have already seen how to create source +files using C-c C-e C-d; ESS provides a complementary command for +loading source files (even files not created with ESS!) into the ESS +process, namely ess-load-file (C-c C-l). + + +see Hot keys. +

+

After typing C-c C-l you will prompt for the name of the file to +load into S; usually this is the current buffer’s file which is the +default value (selected by simply pressing RET at the prompt). +You will be asked to save the buffer first if it has been modified (this +happens automatically if the buffer was generated with C-c C-e +C-d). The file will then be loaded, and if it loads successfully you +will be returned to the ESS process. +

+
+ +
+

+Next: , Previous: , Up: Editing objects   [Contents][Index]

+
+ +

7.3 Detecting errors in source files

+ + +

If any errors occur when loading a file with C-c C-l, ESS will +inform you of this fact. In this case, you can jump directly to the +line in the source file which caused the error by typing C-c ` +(ess-parse-errors). + + +You will be returned to the offending file (loading it into a buffer if +necessary) with point at the line S reported as containing the +error. You may then correct the error, and reload the file. Note that +none of the commands in an S source file will take effect if any +part of the file contains errors. +

+

Sometimes the error is not caused by a syntax error (loading a +non-existent file for example). In this case typing C-c ` will +simply display a buffer containing S’s error message. You can force +this behavior (and avoid jumping to the file when there is a +syntax error) by passing a prefix argument to ess-parse-errors +with C-u C-c `. +

+
+ + + +

7.4 Indenting and formatting S code

+ +

ESS provides a sophisticated mechanism for indenting S source +code (thanks to Ken’ichi Shibayama). Compound statements (delimited by +‘{’ and ‘}’) are indented relative to their enclosing block. +In addition, the braces have been electrified to automatically indent to +the correct position when inserted, and optionally insert a newline at +the appropriate place as well. Lines which continue an incomplete +expression are indented relative to the first line of the expression. +Function definitions, if statements, calls to expression() +and loop constructs are all recognized and indented appropriately. User +variables are provided to control the amount of indentation in each +case, and there are also a number of predefined indentation styles to +choose from. +

+ +

Comments are also handled specially by ESS, using an idea borrowed from +the Emacs-Lisp indentation style. By default, +comments beginning with ‘###’ +are aligned to the beginning of the line. Comments beginning with +‘##’ are aligned to the current level of indentation for the block +containing the comment. Finally, comments beginning with ‘#’ are +aligned to a column on the right (the 40th column by default, but this +value is controlled by the variable comment-column,) + +or just after the expression on the line containing the comment if it +extends beyond the indentation column. You turn off the default +behavior by adding the line +(setq ess-indent-with-fancy-comments nil) to your .emacs file. + +

+

ESS also supports Roxygen entries which is R documentation maintained in +the source code as comments See Roxygen. +

+

The indentation commands provided by ESS are: + + +

+
+
Command: ess-indent-or-complete
+
+

TAB Indents the current line as S code. +

+

Try to indent first, and if code is already properly indented, complete +instead. In ess-mode, only tries completion if +ess-tab-complete-in-script is non-nil. See also +ess-first-tab-never-complete. +

+ +
+
User Option: ess-tab-complete-in-script
+

If non-nil, TAB in script buffers tries to complete if +there is nothing to indent. +

+ +
+
User Option: ess-first-tab-never-complete
+

If non-nil, TAB never tries to complete in ess-mode. The +default 'symbol does not try to complete if the next char is a valid +symbol constituent. There are more options, see the help (C-h v). +

+ +
+
Command: ess-indent-exp
+
+ + +

TAB Indents each line in the S (compound) expression which +follows point. Very useful for beautifying your S code. +

+ +
+
Command: ess-electric-brace
+
+ +

{ } The braces automatically indent to the correct +position when typed. +

+ +

The following Emacs command are also helpful: +

+
+
RET
+
LFD
+
+

newline-and-indent Insert a newline, and indent the next line. +(Note that most keyboards nowadays do not have a LINEFEED key, but +RET and C-j are equivalent.) +

+
+
M-;
+
+

indent-for-comment Indents an existing comment line +appropriately, or inserts an appropriate comment marker. +

+
+ + + + + +
+ +
+

+Up: Indenting   [Contents][Index]

+
+ +

7.4.1 Changing styles for code indentation and alignment

+ +

The combined value of twelve variables (4 of three groups ess-indent-*, +ess-offset-* and ess-align-*) that control indentation etc are +collectively termed a style. ESS provides several styles covering the +common styles of indentation: DEFAULT, OWN, GNU, +BSD, K&R, C++, RRR, RRR+, +Rstudio, Rstudio-, and CLB. The +variable ess-style-alist lists the value of each indentation +variable per style (and its documentation contains more). +

+
+
Command: ess-set-style
+
+ +

C-c C-e C-s (or C-c C-e s) sets the formatting style in this +buffer to be one of the predefined styles, see above. The DEFAULT +style uses the default values for the indenting variables; The OWN +style allows you to use your own private values of the indentation +variable, see below. +

+
(setq ess-default-style 'C++)
+
+
+ +
+
User Option: ess-default-style
+

The default value of ess-style. See the variable +ess-style-alist for how these groups (DEFAULT, OWN, GNU, RRR, +…) map onto different settings for variables. +

+ +
+
User Option: ess-style-alist
+

Predefined formatting styles for ESS code. Values for all groups, +except OWN, are fixed. To change the value of variables in the OWN +group, customize the variable ess-own-style-list. The default +style in use is controlled by ess-default-style. +

+ +

The styles DEFAULT and OWN are initially identical. If +you wish to edit some of the default values, set +ess-default-style to 'OWN and change +ess-own-style-list. +See Customization, for convenient ways to set both these variables. +

+

If you prefer not to use the custom facility, you can change individual +indentation variables within a hook, for example: +

+
+
(defun myindent-ess-hook ()
+  (setq ess-indent-level 4))
+(add-hook 'ess-mode-hook 'myindent-ess-hook)
+
+ +

In the rare case that you’d like to add an entire new indentation style +of your own, copy the definition of ess-own-style-list to a new +variable and ensure that the last line of the :set declaration +calls ess-add-style with a unique name for your style +(e.g. 'MINE). Finally, add (setq ess-default-style 'MINE) +to use your new style. +

+
+ +
+

+Next: , Previous: , Up: Editing objects   [Contents][Index]

+
+ +

7.5 Commands for motion, completion and more

+ +

A number of commands are provided to move across function definitions +in the edit buffer: +

+
+
Command: ess-goto-beginning-of-function-or-para
+
+ +

ESC C-a aka C-M-a If inside a function go to the beginning +of it, otherwise go to the beginning of paragraph. +

+ +
+
Command: ess-goto-end-of-function-or-para
+
+ +

ESC C-e aka C-M-e Move point to the end of the function +containing point. +

+ +
+
Command: ess-mark-function
+
+ +

ESC C-h aka C-M-h Place point at the beginning of the S +function containing point, and mark at the end. +

+ +

Don’t forget the usual Emacs commands for moving over balanced +expressions and parentheses: See Lists and +Sexps in The GNU Emacs Reference Manual. +

+ +

Completion is provided in the edit buffer in a similar fashion to the +process buffer: TAB first indents, and if there is nothing to +indent, completes the object or file name; M-? lists file +completions. See See Completion, for more. +

+

Finally, C-c C-z (ess-switch-to-inferior-or-script-buffer) +returns you to the iESS process buffer, if done from a script +buffer, placing point at the end of the buffer. If this is done from +the iESS process buffer, point is taken to the script buffer. +

+

In addition some commands available in the process buffer are also +available in the script buffer. You can still read help files with +C-c C-v, edit another function with C-c C-e C-d and of +course C-c C-l can be used to load a source file into S. +

+ +
+ + + +

7.6 Maintaining S source files

+ +

Every edit buffer in ESS is associated with a dump file on disk. +Dump files are created whenever you type C-c C-e C-d +(ess-dump-object-into-edit-buffer), and may either be deleted +after use, or kept as a backup file or as a means of keeping several +versions of an S function. + +

+
+
User Option: ess-delete-dump-files
+

If non-nil, dump files created with C-c C-e C-d are deleted +immediately after they are created by the ess-process. +

+ +

Since immediately after S dumps an object’s definition to a disk +file the source code on disk corresponds exactly to S’s idea of the +object’s definition, the disk file isn’t needed; deleting it now has the +advantage that if you don’t modify the file (say, because you +just wanted to look at the definition of one of the standard S +functions) the source dump file won’t be left around when you kill the +buffer. Note that this variable only applies to files generated with +S’s dump function; it doesn’t apply to source files which already +exist. The default value is t. +

+
+
User Option: ess-keep-dump-files
+

Variable controlling whether to delete dump files after a successful +load. If ‘nil’: always delete. If ‘ask’, confirm to delete. +If ‘check’, confirm to delete, except for files created with +ess-dump-object-into-edit-buffer. Anything else, never delete. +This variable only affects the behaviour of ess-load-file. Dump +files are never deleted if an error occurs during the load. +

+ +

After an object has been successfully (i.e. without error) loaded +back into S with C-c C-l, the disk file again corresponds +exactly (well, almost — see below) to S’s record of the object’s +definition, and so some people prefer to delete the disk file rather +than unnecessarily use up space. This option allows you to do just +that. +

+ + + +

If the value of ess-keep-dump-files is t, dump files are +never deleted after they are loaded. Thus you can maintain a complete +text record of the functions you have edited within ESS. Backup files +are kept as usual, and so by using the Emacs numbered backup facility — +see Single or Numbered +Backups in The Gnu Emacs Reference Manual, you can keep a historic +record of function definitions. Another possibility is to maintain the +files with a version-control system such as RCS See Version Control in The Gnu Emacs Reference +Manual. As long as a dump file exists in the appropriate place for a +particular object, editing that object with C-c C-e C-d finds that +file for editing (unless a prefix argument is given) — the ESS +process is not consulted. Thus you can keep comments outside the +function definition as a means of documentation that does not clutter +the S object itself. Another useful feature is that you may format +the code in any fashion you please without S re-indenting the code +every time you edit it. These features are particularly useful for +project-based work. +

+

If the value of ess-keep-dump-files is nil, the dump file is always +silently deleted after a successful load with C-c C-l. While this +is useful for files that were created with C-c C-e C-d it also applies +to any other file you load (say, a source file of function +definitions), and so can be dangerous to use unless you are careful. +Note that since ess-keep-dump-files is buffer-local, you can make +sure particular files are not deleted by setting it to t in the +Local Variables section of the file See Local Variables in Files in The Gnu Emacs +Reference Manual. +

+

A safer option is to set ess-keep-dump-files to ask; this +means that ESS will always ask for confirmation before deleting the +file. Since this can get annoying if you always want to delete dump +files created with C-c C-e C-d, but not any other files, setting +ess-keep-dump-files to check (the default value) will +silently delete dump files created with C-c C-e C-d in the current +Emacs session, but query for any other file. Note that in any case you +will only be asked for confirmation once per file, and your answer is +remembered for the rest of the Emacs session. +

+

Note that in all cases, if an error (such as a syntax error) is detected +while loading the file with C-c C-l, the dump file is never +deleted. This is so that you can edit the file in a new Emacs session +if you happen to quit Emacs before correcting the error. +

+ +

Dump buffers are always autosaved, regardless of the value of +ess-keep-dump-files. +

+
+ +
+

+Previous: , Up: Editing objects   [Contents][Index]

+
+ +

7.7 Names and locations of dump files

+ + +

Every dump file should be given a unique file name, usually the dumped +object name with some additions. +

+
+
User Option: ess-dump-filename-template
+

Template for filenames of dumped objects. %s is replaced by the +object name. +

+ +

By default, dump file names are the user name, followed by ‘.’ and +the object and ending with ‘.S’. Thus if user joe dumps the +object myfun the dump file will have name joe.myfun.S. +The username part is included to avoid clashes when dumping into a +publicly-writable directory, such as /tmp; you may wish to remove +this part if you are dumping into a directory owned by you. +

+ +

You may also specify the directory in which dump files are written: +

+
+
User Option: ess-source-directory
+

Directory name (ending in a slash) where S dump files are to be written. +

+ +

By default, dump files are always written to /tmp, which is fine +when ess-keep-dump-files is nil. If you are keeping dump +files, then you will probably want to keep them somewhere in your home +directory, say ~/S-source. This could be achieved by including +the following line in your .emacs file: + +

+
(setq ess-source-directory (expand-file-name "~/S-source/"))
+
+ +

If you would prefer to keep your dump files in separate directories +depending on the value of some variable, ESS provides a facility for +this also. By setting ess-source-directory to a lambda +expression which evaluates to a directory name, you have a great deal of +flexibility in selecting the directory for a particular source file to +appear in. The lambda expression is evaluated with the process buffer +as the current buffer and so you can use the variables local to that +buffer to make your choice. For example, the following expression +causes source files to be saved in the subdirectory Src of the +directory the ESS process was run in. +

+
+
(setq ess-source-directory
+      (lambda ()
+         (concat ess-directory "Src/")))
+
+ +

+(ess-directory is a buffer-local variable in process buffers +which records the directory the ESS process was run from.) This is +useful if you keep your dump files and you often edit objects with the +same name in different ESS processes. Alternatively, if you often +change your S working directory during an S session, you may +like to keep dump files in some subdirectory of the directory pointed to +by the first element of the current search list. This way you can edit +objects of the same name in different directories during the one S +session: + + +

+
(setq ess-source-directory
+   (lambda ()
+       (file-name-as-directory
+        (expand-file-name (concat
+                           (car ess-search-list)
+                           "/.Src")))))
+
+ + +

If the directory generated by the lambda function does not exist but can +be created, you will be asked whether you wish to create the directory. +If you choose not to, or the directory cannot be created, you will not +be able to edit functions. +

+
+ +
+

+Next: , Previous: , Up: Top   [Contents][Index]

+
+ +

8 Reading help files

+ + +

ESS provides an easy-to-use facility for reading S help files from +within Emacs. From within the ESS process buffer or any ESS edit +buffer, typing C-c C-v (ess-display-help-on-object) + +will prompt you for the name of an object for which you would like +documentation. Completion is provided over all objects which have help +files. +

+

If the requested object has documentation, you will be popped into a +buffer (named *help(obj-name)*) containing the help file. +This buffer is placed in a special ‘S Help’ mode which disables the +usual editing commands but which provides a number of keys for paging +through the help file. +

+

Help commands: +

+
+
?
+
+

ess-describe-help-mode Pops up a help buffer with a list of the +commands available in S help mode. +

+
+
h
+
+

ess-display-help-on-object Pop up a help buffer for a different +object. +

+
+ +

Paging commands: + +

+
+
b
+
DEL
+

scroll-down Move one page backwards through the help file. +

+
+
SPC
+

scroll-up Move one page forwards through the help file. +

+
+
>
+
<
+

end-of-buffer Move to the beginning and end of the help file, +respectively. +

+
+ +

Section-based motion commands: +

+
+
n
+
p
+
+ +

ess-skip-to-previous-section and ess-skip-to-next-section +Move to the next and previous section header in the help file, +respectively. A section header consists of a number of capitalized +words, followed by a colon. +

+
+ +

In addition, the s key followed by one of the following letters +will jump to a particular section in the help file. +Note that R uses capitalized instead of all-capital section headers, +e.g., ‘Description:’ instead of ‘DESCRIPTION:’ and also +only some versions of S(-plus) have +sections ‘BACKGROUND’, ‘BUGS’, ‘OPTIONAL ARGUMENTS’, +‘REQUIRED ARGUMENTS’, and ‘SIDE EFFECTS’. +

+

Do use s ? to get the current list of active key bindings. + +

+
+
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: +

+
+
<
+

Jumps to beginning of file +

+
+
>
+

Jumps to end of file +

+
+
?
+

Pops up a help buffer with a list of the defined section motion keys. +

+
+ +

Evaluation: +

+
+
l
+
+

ess-eval-line-and-step Evaluates the current line in the ESS +process, and moves to the next line. Useful for running examples in +help files. +

+
+
r
+
+

ess-eval-region Send the contents of the current region to the +ESS process. Useful for running examples in help files. +

+
+ +

Quit commands: +

+
+
q
+
+

ess-help-quit Return to previously selected buffer, and bury the +help buffer. +

+
+
k
+

kill-buffer Return to previously selected buffer, and kills the +help buffer. +

+
+
x
+

ess-kill-buffer-and-go Return to the ESS process, killing this +help buffer. +

+
+ +

Miscellaneous: +

+
+
i
+

ess-display-index Prompt for a package and display it’s help +index. +

+
+
v
+

ess-display-vignettes Display all available vignettes. +

+
+
w
+

ess-display-help-in-browser Display current help page with the +web browser. +

+
+
/
+

isearch-forward Same as C-s. +

+
+ +

In addition, all of the ESS commands available in the edit buffers are +also available in S help mode (see Edit buffer). Of course, the +usual (non-editing) Emacs commands are available, and for convenience +the digits and - act as prefix arguments. +

+

If a help buffer already exists for an object for which help is +requested, that buffer is popped to immediately; the ESS process is +not consulted at all. If the contents of the help file have changed, +you either need to kill the help buffer first, or pass a prefix argument +(with C-u) to ess-display-help-on-object. +

+

Help buffers are marked as temporary buffers in ESS, and are deleted +when ess-quit or ess-cleanup are called. +

+

Help buffers normally appear in another window within the current +frame. If you wish help buffers to appear in their own frame (either +one per help buffer, or one for all help buffers), you can customize the +variable ess-help-own-frame. +

+ + + + +
+ +
+

+Next: , Previous: , Up: Top   [Contents][Index]

+
+ +

9 Completion

+ + + + + + + + +
+ + + +

9.1 Completion of object names

+ + + + +

The TAB key is for completion. The value of the variable +ess-first-tab-never-complete controls when completion is allowed +controls when completion is allowed to occur. In ess-mode +TAB first tries to indent, and if there is nothing to indent, +complete the object name instead. +

+
+
TAB
+
+

comint-dynamic-complete Complete the S object name or +filename before point. +

+
+ +

When the cursor is just after a partially-completed object name, +pressing TAB provides completion in a similar fashion to +tcsh + +except that completion is performed over all known S object names +instead of file names. ESS maintains a list of all objects known to S +at any given time, which basically consists of all objects (functions +and datasets) in every attached directory listed by the search() +command + +along with the component objects of attached data frames + +(if your version of S supports them). +

+

For example, consider the three functions (available in Splus version +3.0) called binomplot(), binom.test() and +binomial(). Typing bin TAB after the S prompt will +insert the characters ‘om’, completing the longest prefix +(‘binom’) which distinguishes these three commands. Pressing +TAB once more provides a list of the three commands which have +this prefix, allowing you to add more characters (say, ‘.’) which +specify the function you desire. After entering more characters +pressing TAB yet again will complete the object name up to +uniqueness, etc. If you just wish to see what completions exist without +adding any extra characters, type M-?. +

+
+
Command: ess-list-object-completions
+
+

M-? List all possible completions of the object name at point. +

+ +

ESS also provides completion over the components of named lists and +environments (after ‘$’), S4 classes slots (after @), package and +namespace objects (after :: and :::). + +

+ +

Completion is also provided over file names, which is particularly +useful when using S functions such as get() or scan() +which require fully expanded file names. +

+ +

In the Inferior ESS buffer, if the cursor is not in a string and does +not follow a (partial) object name, the TAB key has a third use: +it expands history references. See History expansion. +

+ + + + + +

Efficiency in completion is gained by maintaining a cache of objects +currently known to S; when a new object becomes available or is deleted, +only one component of the cache corresponding to the associated +directory needs to be refreshed. If ESS ever becomes confused about +what objects are available for completion (such as when if refuses to +complete an object you know is there), the command M-x +ess-resynch + +forces the entire cache to be refreshed, which should fix the +problem. +

+
+ +
+

+Next: , Previous: , Up: Completion   [Contents][Index]

+
+ +

9.2 Completion of function arguments

+ +

When inside a function call (i.e. following ‘(’), TAB +completion also provides function arguments. If function is a generic, +completion will provide all the arguments of S3 methods known to +R. +

+

A related functionality is See ESS ElDoc, which displays function +arguments in the echo area whenever the point is inside a function call. +

+
+ +
+

+Next: , Previous: , Up: Completion   [Contents][Index]

+
+ +

9.3 Minibuffer completion

+ + + +

From version 12.03, ESS uses IDO mechanism (part of default +emacs) for minibuffer completion if ido.el package is available +and the value of ess-use-ido it t (the default). The +completion command ess-completing-read falls back on classic +completion-read interface if this feature is not available for +whatever reason. +

+
+ +
+

+Next: , Previous: , Up: Completion   [Contents][Index]

+
+ +

9.4 Integration with auto-complete package

+ + + + +

ESS provides three sources for Auto Completion mode: +ac-source-R-args, ac-source-R-objects and +ac-source-R. The last one combines the previous two and makes them +play nicely together. See auto-complete package documentation +(http://cx4a.org/software/auto-complete/) for how to modify and +install your own completion sources. +

+

For the default auto-complete ESS configuration, install the latest +version of auto-complete package. ESS automatically detect the +package and activates auto-complete in ESS buffers. +

+ +

To deactivate AC, place the following into your init file: +

+
+
(setq ess-use-auto-complete nil)
+
+ +

Or, to activate auto-completion only in the ess-mode buffers: +

+
+
(setq ess-use-auto-complete 'script-only)
+
+ +

ESS provides AC help both for arguments and objects (default keys +C-? or <f1>). You can bind M-h to display quick help +pop-ups: +

+
+
(define-key ac-completing-map (kbd "M-h") 'ac-quick-help)
+
+ +

AC binds M-n, and M-p for the navigation in the +completion menu, which might be inconvenient if you want it to use in +the inferior R. Bind it to something else: +

+
+
(define-key ac-completing-map "\M-n" nil) ;; was ac-next
+(define-key ac-completing-map "\M-p" nil) ;; was ac-previous
+(define-key ac-completing-map "\M-," 'ac-next)
+(define-key ac-completing-map "\M-k" 'ac-previous)
+
+ +
+ +
+

+Previous: , Up: Completion   [Contents][Index]

+
+ +

9.5 Icicles

+ +

Another option for comprehensively handling completion in Emacs is via +Icicles (http://www.emacswiki.org/emacs/Icicles). It allows +users to have completions shown temporarily in the standard +‘*Completions*’ buffer, and interactively select completion +candidates using several methods. As of version 2013.04.04, Icicles +provides support for completion in ESS. Please consult Icicles +documentation, which is easily accessible via customize-group +Icicles, for more details on installation and customization options. +

+

Once installed, Icicles can be activated by evaluating (maybe place in +~/.emacs): +

+
+
(require 'icicles)
+(icy-mode 1)
+
+ +

Icicles can be toggled at any moment by typing M-x icy. +

+

When Icicles is on, TAB offers completion, provided the conditions +determined by ess-first-tab-never-complete allow it. Typing +M-TAB will attempt completion regardless. Typing M-? in +ESS or iESS modes brings up the relevant completion +candidates from which to choose. Minibuffer input filters the available +candidates. Use TAB for prefix completion or S-TAB for +substring or regexp completion. Use S-SPC to match an additional +pattern (repeatable). You can cycle among the matching candidates, +choosing with RET or mouse-2. +

+ +
+ +
+

+Next: , Previous: , Up: Top   [Contents][Index]

+
+ +

10 Developing with ESS

+ +

ESS provides several tools to help you with the development of your R +packages: +

+ + + + + + +
+ + + +

10.1 ESS tracebug

+ + + +

ESS tracebug offers visual debugging, interactive error +navigation, interactive backtrace, breakpoint manipulation, control over +R error actions, watch window and interactive flagging/unflagging of +functions for debugging. +

+

From ESS13.05 ess-tracebug is on by default. You can toggle it on +and off with M-x ess-tracebug. To disable startup +activation of ess-tracebug set ess-use-tracebug to nil. +

+

Tracebug functionality can be found on ess-dev-map, bound to +C-c C-t. Additionally, when subprocess is in a debugging state +ess-debug-minor-mode is active and the following additional +shortcuts are available: +

+
* Interactive Debugging (`ess-debug-minor-mode-map'):
+
+ M-C   . Continue                  . `ess-debug-command-continue'
+ M-C-C . Continue multi            . `ess-debug-command-continue-multi'
+ M-N   . Next step                 . `ess-debug-command-next'
+ M-C-N . Next step multi           . `ess-debug-command-next-multi'
+ M-U   . Up frame                  . `ess-debug-command-up'
+ M-Q   . Quit debugging            . `ess-debug-command-quit'
+
+
+ +

These are all the tracebug commands defined in ess-dev-map +(C-c C-t ? to show this table): +

+
+* Breakpoints (`ess-dev-map'):
+
+ b   . Set BP (repeat to cycle BP type) . `ess-bp-set'
+ B   . Set conditional BP               . `ess-bp-set-conditional'
+ k   . Kill BP                          . `ess-bp-kil'
+ K   . Kill all BPs                     . `ess-bp-kill-all'
+ o   . Toggle BP state                  . `ess-bp-toggle-state'
+ l   . Set logger BP                    . `ess-bp-set-logger'
+ n   . Goto next BP                     . `ess-bp-next'
+ p   . Goto previous BP                 . `ess-bp-previous'
+
+  (C- prefixed equivalents are also defined)
+
+* Debugging (`ess-dev-map'):
+ `   . Show traceback                       . `ess-show-traceback' (also on C-c `)
+ ~   . Show callstack                       . `ess-show-call-stack' (also on C-c ~)
+ e   . Toggle error action (repeat to cycle). `ess-debug-toggle-error-action'
+ d   . Flag for debugging                   . `ess-debug-flag-for-debugging'
+ u   . Unflag for debugging                 . `ess-debug-unflag-for-debugging'
+ w   . Watch window                         . `ess-watch'
+
+  (C- prefixed equivalents are also defined)
+
+* Navigation to errors (general emacs functionality):
+
+ C-x `, M-g n   . `next-error'
+ M-g p          . `previous-error'
+
+* Misc:
+
+?   . Show this help		. `ess-tracebug-show-help'
+
+
+

To configure how electric watch window splits the display see +ess-watch-width-threshold and ess-watch-height-threshold +variables. +

+

A more detailed ess-tracebug documentation with screenshots is available +at http://code.google.com/p/ess-tracebug/. +

+

A short tutorial is at http://code.google.com/p/ess-tracebug/wiki/GettingStarted. +

+ +

Note: Currently, ess-tracebug does not detect some of R’s debug +related messages in non-English locales. To set your R messages to +English add the following line to your .Rprofile init file: +

+
   Sys.setlocale("LC_MESSAGES", "C")
+
+
+ + + +

10.2 Editing documentation

+ +

ESS provides two ways of writing documentation for R objects. Either +using the standard R documentation system or using in-source +documentation written as structured comment fields for use with the +Roxygen package. +

+ + + + + +
+ + + +

10.2.1 Editing R documentation (Rd) files

+ +

R objects are documented in files written in the R +documentation (“Rd”), a simple markup language closely resembling +(La)TeX, which can be processed into a variety of formats, including +LaTeX, HTML, and plain text. Rd format is described in +section “Rd format” of the “Writing R Extensions” manual in the R +distribution. ESS has several features that facilitate editing Rd files. +

+

Visiting an Rd file as characterized by its extension Rd will +activate Rd Mode, which provides several facilities for making editing R +documentation files more convenient, by helping with indentation, +insertions, even doing some of the typing for you (with Abbrev Mode), +and by showing Rd keywords, strings, etc. in different faces (with +Font Lock Mode). +

+

Note that R also accepts Rd files with extension rd; to activate +ESS[Rd] support for this extension, you may need to add +

+
+
(add-to-list 'auto-mode-alist '("\\.rd\\'" . Rd-mode))
+
+ +

to one of your Emacs startup files. +

+

In Rd mode, the following special Emacs commands can be used in addition +to the standard Emacs commands. +

+
+
C-h m
+

Describe the features of Rd mode. +

+
+
LFD
+
RET
+

Reindent the current line, insert a newline and indent the new line +(reindent-then-newline-and-indent). An abbrev before point is +expanded if abbrev-mode is non-nil. +

+
+
TAB
+

Indent current line based on its contents and on previous lines. +(indent-according-to-mode). +

+
+
C-c C-e
+

Insert a “skeleton” with Rd markup for at least all mandatory entries +in Rd files (Rd-mode-insert-skeleton). Note that many users +might prefer to use the R function prompt on an existing R object +to generate a non-empty Rd “shell” documenting the object (which +already has all information filled in which can be obtained from the +object). +

+
+
C-c C-f
+

Insert “font” specifiers for some of the Rd markup commands markup +available for emphasizing or quoting text, including markup for URLs and +email addresses (Rd-font). C-c C-f is only a prefix; see +e.g. C-c C-f TAB for the available bindings. Note that +currently, not all of the Rd text markup as described in section +“Marking text” of “Writing R Extensions” can be accessed via +C-c C-f. +

+
+
C-c C-j
+

Insert a suitably indented ‘\item{’ on the next line +(Rd-mode-insert-item). +

+
+
C-c C-p
+

Preview a plain text version (“help file”, see Help) generated +from the Rd file (Rd-preview-help). +

+
+ +

In addition, when editing Rd files one can interact with a running R +process in a similar way as when editing R language files. E.g., +C-c C-v provides access to on-line help, and C-c C-n sends +the current line to the R process for evaluation. This interaction is +particularly useful when editing the examples in the Rd file. See +C-h m for all available commands. +

+

Rd mode also provides access to abbreviations for most of the Rd markup +commands. Type M-x list-abbrevs with Abbrev mode turned on to +list all available abbrevs. Note that all Rd abbrevs start with a grave +accent. +

+

Rd mode can be customized via the following variables. +

+
+
User Option: Rd-mode-hook
+

Hook to be run when Rd mode is entered. +

+ +
+
User Option: Rd-indent-level
+

The indentation of Rd code with respect to containing blocks. Default +is 2. +

+ +
+
User Option: Rd-to-help-command
+

The shell command used for converting Rd source to help text. Default +is ‘R CMD Rd2txt’. +

+ +

To automatically turn on the abbrev and font-lock features of Rd mode, +add the following lines to one of your Emacs startup files: +

+
+
(add-hook 'Rd-mode-hook
+          (lambda ()
+           (abbrev-mode 1)
+           (font-lock-mode 1)))
+
+ +
+ + + +

10.2.2 Editing Roxygen documentation

+ + + + +

The Roxygen R package makes it possible to keep the intended contents +for Rd files as structured comments in the R source files. Roxygen can +then parse R files and generate appropriate Rd files from these +comments, fill the usage fields as well as updating NAMESPACE +files. See the Roxygen documentation found via http://roxygen.org +for more information on its usage. An example of an Roxygen entry for a +simple R function can look like this: +

+
+
##' Description of the function
+##'
+##' Further details about this function
+##' @title A title
+##' @param me all parameters must be listed and documented
+##' @return Description of the return value
+##' @author The author
+myfun <- function(me)
+  cat("Hello", me, "\n")
+
+

The entry is immediately preceding the object to document and all lines +start with the Roxygen prefix string, in this case ##'. ESS +provides support to edit these documentation entries by providing line +filling, navigation, template generation etc. Syntax highlighting is +provided for Emacs but not for XEmacs. +

+

Roxygen is customized by the variables in the customization group “Ess +Roxy”. Customizables include the Roxygen prefix, use of folding +to toggle visibility of Roxygen entries and the Roxygen template. +

+

All ESS Roxygen support is defined in ess-roxy.el which is loaded +by default in ESS. The following special Emacs commands are provided. +

+
+
Command: ess-roxy-update-entry
+
+

C-c C-o C-o Generate a Roxygen template or update the parameter +list in Roxygen entry at point (or above the function at the +point). Documented parameters that are not in the function are placed +last in the list, parameters that are not documented and not in the +definition are dropped. Parameter descriptions are filled if +ess-roxy-fill-param-p is non-nil. +

+ +
+
Command: ess-roxy-toggle-roxy-region beg end
+
+

C-c C-o C-c Toggle the presence of the leading Roxygen string on +all lines in the marked region (between beg and +end. Convenient for transferring text to Roxygen entries and to +evaluate example fields. +

+ +
+
Command: ess-roxy-preview-Rd name-file
+
+

C-c C-o C-r Use the attached R process to parse the entry at point +to obtain the Rd code. Convenient for previewing and checking +syntax. When used with the prefix argument name-file, +i.e. C-u C-c C-e C-r, place the content in a buffer associated +with a Rd file with the same name as the documentation. Requires the +Roxygen package to be installed. +

+ +
+
Command: ess-roxy-preview-HTML visit-instead-of-open
+
+

C-c C-o C-t Use the attached R process to parse the entry at to +generate HTML for the entry and open it in a browser. When used with the +prefix argument visit-instead-of-open, i.e. C-u C-c C-e C-t, +visit the generated HTML file instead. Requires the Roxygen and tools +packages to be installed. +

+ +
+
Command: ess-roxy-previous-entry
+
+

C-c C-o p Go to start of the Roxygen entry above point. +

+ +
+
Command: ess-roxy-next-entry
+
+

C-c C-o n Go to end of the Roxygen entry above point. +

+ +
+
Command: ess-roxy-hide-all
+
+

C-c C-o C-h Use the hideshow mode to fold away the visibility of +all Roxygen entries. Hide-show support must be enabled for this binding +to get defined. +

+ +

ESS also advises the following standard editing functions in order to +make Roxygen editing more intuitive: +

+
+
TAB
+
+

ess-R-complete-object-name Complete Roxygen tag at +point. E.g. doing TAB when the point is at the end of @par +completes to @param. +

+
+
M-h
+
+

mark-paragraph If the transient mark mode is active, place mark +and point at start end end of the field at point and activate the mark. +

+
+
TAB
+
+

ess-indent-command If hide-show support is enabled, fold away the +visibility of the Roxygen entry at point. +

+
+
M-q
+
+

fill-paragraph Fill the Roxygen field at point. +

+
+
C-a
+
+

move-beginning-of-line Move to the point directly to the right of +the Roxygen start string. +

+
+
RET
+
+

newline-and-indent Insert a new line and the Roxygen prefix +string. +

+
+ +
+ + + +

10.3 Namespaced Evaluation

+ + +

In non package files evaluation commands, See Evaluating code, send +portions of the current buffer environment (R_GlobalEnv. When +developing packages, ESS sends code to the corresponding package +namespace and (for visible objects) into package environment (visible on +search path). All objects that are assigned are displayed in the +minibuffer alongside the environment in which they are assigned. +

+

Here is a short overview of how namespace and package environments work +in R. All objects defined in a package ’foo’ are stored in an +environment called ’namespace:foo’. Parent environment of +’namespace:foo’ is an environment ’imports:foo’ which contains copies of +all objects from other packages which ’foo’ imports. Parent environment +of ’imports:foo’ is the ’namespace:base’. Parent environment of +’namespace:base’ is .GlobalEnv. Thus functions and methods stored in +’namespace:foo’ see all the objects in .GlobalEnv unless shadowed by +objects in ’imports:foo’, ’namespace:base’, or ’namespace:foo’ +itself. There is another environment associated with ’foo’ - +’package:foo’. This environment stores *copies* of exported objects from +’namespace:foo’ and is placed on the search() path, i.e. if ’foo’ is +loaded and if you start with .GlobalEnv and iteratively call +parent.env() you will get eventually to ’package:foo’. Thus all methods +and functions defined in .GlobalEnv can "see" objects in ’package:foo’ +environment. See also +http://cran.r-project.org/doc/manuals/R-ints.html#Namespaces. +

+

Ocasionally you want to evaluate into a package from a non-package file, +or the other way around, evaluate into GlobalEnv from inside a +package. In such cases C-c C-t C-s is your friend. +

+
+
Command: ess-r-set-evaluation-env arg
+
+

C-c C-t C-s Set or unset the current evaluation environment (a package). +

+ +
+ +
+

+Next: , Previous: , Up: Top   [Contents][Index]

+
+ +

11 Other ESS features and tools

+ +

ESS has a few extra features, which didn’t fit anywhere else. +

+ + + + + + + + + + + + + + +
+ +
+

+Next: , Up: Extras   [Contents][Index]

+
+ +

11.1 ElDoc

+ +

In ElDoc mode, the echo area displays function’s arguments at +point. From ESS version 12.03, ElDoc is active by default in +ess-mode and inferior-ess-mode buffers. To activate it +only in ess-mode buffers, place the following into your init +file: +

+
+
(setq ess-use-eldoc 'script-only)
+
+ +
+
User Option: ess-use-eldoc
+

If ‘t’, activate eldoc in ess-mode and inferior-ess-mode buffers. +If ‘'script-only’ activate in ess-mode buffers only. Set +ess-use-eldoc to nil to stop using ElDoc +altogether. +

+ +
+
User Option: ess-eldoc-show-on-symbol
+

This variable controls whether the help is shown only inside function +calls. If set to ‘t’, ElDoc shows help string whenever the +point is on a symbol, otherwise (the default), shows only when the point +is in a function call, i.e. after ‘'('’. +

+ +
+
User Option: ess-eldoc-abbreviation-style
+

The variable determines how the doc string should be abbreviated to fit +into minibuffer. Posible values are ‘nil’, ‘mild’, +‘normal’, ‘strong’ and ‘aggressive’. Please see the +documentation of the variable for more details. The default filter is +‘normal’. +

+ +

Ess-eldoc also honors the value of +eldoc-echo-area-use-multiline-p, which if set to ‘nil’, will +cause the truncation of doc string indifferent of the value of +ess-eldoc-abbreviation-style. This way you can combine different +filter levels with the truncation. +

+
+ +
+

+Next: , Previous: , Up: Extras   [Contents][Index]

+
+ +

11.2 Handy commands

+ + + + + + +
+
Command: ess-handy-commands
+

Request and execute a command from ess-handy-commands list. +

+ +
+
User Option: ess-handy-commands
+

An alist of custom ESS commands available for call by +ess-handy-commands and ess-smart-comma function. +

+

Currently contains: +

+
+
change-directory
+

ess-change-directory +

+
help-index
+

ess-display-index +

+
help-object
+

ess-display-help-on-object +

+
vignettes
+

ess-display-vignettes +

+
objects[ls]
+

ess-execute-objects +

+
search
+

ess-execute-search +

+
set-width
+

ess-execute-screen-options +

+
install.packages
+

ess-install.packages +

+
library
+

ess-library +

+
setRepos
+

ess-setRepositories +

+
sos
+

ess-sos +

+
+
+ + +

Handy commands: ess-library, ess-install.packages, etc - +ask for item with completion and execute the correspond +command. ess-sos is a interface to findFn function in +package sos. If package sos is not found, ask user for +interactive install. +

+ +
+ +
+

+Next: , Previous: , Up: Extras   [Contents][Index]

+
+ +

11.3 Syntactic highlighting of buffers

+ +

ESS provides Font-Lock (see Using Multiple Typefaces in The Gnu Emacs Reference Manual) patterns for Inferior S Mode, S +Mode, and S Transcript Mode buffers. + + +

+

Syntax highlighting within ESS buffers is controlled by: +

+
+
User Option: ess-font-lock-mode
+

Non-‘nil’ means we use font lock support for ESS buffers. Default +is ‘t’, to use font lock support. If you change the value of this +variable, restart Emacs for it to take effect. +

+ + +

The font-lock patterns are defined by the following variables, which you +may modify if desired: +

+
+
User Option: inferior-R-font-lock-keywords
+

Font-lock patterns for inferior *R* processes. (There is a +corresponding inferior-S-font-lock-keywords for *S* processes.) +The default value highlights prompts, inputs, assignments, output +messages, vector and matrix labels, and literals such as ‘NA’ and +TRUE. +

+ +
+
User Option: ess-R-font-lock-keywords
+

Font-lock patterns for ESS R programming mode. (There is a +corresponding ess-S-font-lock-keywords for S buffers.) The +default value highlights function names, literals, assignments, source +functions and reserved words. +

+ + + +
+ +
+

+Next: , Previous: , Up: Extras   [Contents][Index]

+
+ +

11.4 Parenthesis matching

+ +

Emacs and XEmacs have facilities for highlighting the parenthesis +matching the parenthesis at point. This feature is very useful when +trying to examine which parentheses match each other. This highlighting +also indicates when parentheses are not matching. Depending on what +version of emacs you use, one of the following should work in your +initialisation file: +

+
+
(paren-set-mode 'paren) ;for XEmacs
+(show-paren-mode t) ;for Emacs
+
+ + +
+ +
+

+Next: , Previous: , Up: Extras   [Contents][Index]

+
+ +

11.5 Using graphics with ESS

+ + +

One of the main features of the S package is its ability to +generate high-resolution graphics plots, and ESS provides a number of +features for dealing with such plots. +

+ + + + + + +
+ +
+

+Next: , Up: Graphics   [Contents][Index]

+
+ +

11.5.1 Using ESS with the printer() driver

+ +

This is the simplest (and least desirable) method of using graphics +within ESS. S’s printer() device driver produces crude character +based plots which can be contained within the ESS process buffer +itself. To start using character graphics, issue the S command +

+
printer(width=79)
+
+ +

(the width=79 argument prevents Emacs line-wrapping at column +80 on an 80-column terminal. Use a different value for a terminal with +a different number of columns.) Plotting commands do not generate +graphics immediately, but are stored until the show() command +is issued, which displays the current figure. +

+
+ +
+

+Next: , Previous: , Up: Graphics   [Contents][Index]

+
+ +

11.5.2 Using ESS with windowing devices

+ + +

Of course, the ideal way to use graphics with ESS is to use a windowing +system. Under X Windows, or X11, this requires that the DISPLAY environment +variable be appropriately set. +

+
+ +
+

+Previous: , Up: Graphics   [Contents][Index]

+
+ +

11.5.3 Java Graphics Device

+ + + +

S+6.1 and newer on Windows contains a java library that supports graphics. Send +the commands: +

+
+
library(winjava)
+java.graph()
+
+ +

to start the graphics driver. This allows you to use ESS for both +interaction and graphics within S-PLUS. (Thanks to Tim Hesterberg for +this information.) +

+
+ +
+

+Next: , Previous: , Up: Extras   [Contents][Index]

+
+ +

11.6 Imenu

+ +

Imenu is an Emacs tool for providing mode-specific buffer indexes. In +some of the ESS editing modes (currently SAS and S), support for Imenu +is provided. For example, in S mode buffers, the menubar should display +an item called "Imenu-S". Within this menubar you will then be offered +bookmarks to particular parts of your source file (such as the starting +point of each function definition). +

+

Imenu works by searching your buffer for lines that match what ESS +thinks is the beginning of a suitable entry, e.g. the beginning of a +function definition. To examine the regular expression that ESS uses, +check the value of imenu-generic-expression. This value is set +by various ESS variables such as ess-imenu-S-generic-expression. +

+
+ +
+

+Next: , Previous: , Up: Extras   [Contents][Index]

+
+ +

11.7 Toolbar

+ +

The R and S editing modes have support for a toolbar. This toolbar +provides icons to act as shortcuts for starting new S/R processes, or +for evaluating regions of your source buffers. The toolbar should be +present if your emacs can display images. See Customization, for ways +to change the toolbar. +

+
+ +
+

+Next: , Previous: , Up: Extras   [Contents][Index]

+
+ +

11.8 TAGS

+ +

The Emacs tags facility can be used to navigate around your files +containing definitions of S functions. This facility is independent of +ESS usage, but is written here since ESS users may wish to take +advantage of TAGS facility. Read more about emacs tags in an emacs +manual. +

+

Etags, the program that generates the TAGS file, does not yet know the +syntax to recognise function definitions in S files. Hence, you will +need to provide a regexp that matches your function definitions. Here +is an example call (broken over two lines; type as one line) that should +be appropriate. +

+
+
etags --language=none
+--regex='/\([^ \t]+\)[ \t]*<-[ \t]*function/\1/' *.R
+
+ +

This will find entries in your source file of the form: +

+
+
some.name <- function
+
+ +

with the function name starting in column 0. Windows users may need to +change the single quotes to double quotes. +

+

R version 2.9.0 introduced a front-end script for finding R tags, which +calls the ‘rtags()’ function. By default, this script will +recursively search the directories for relevant tags in R/C/Rd files. +To use this script from the command line, try the following to get +started: +

+
+
R CMD rtags --help
+
+ +

For further details, see http://developer.r-project.org/rtags.html +

+
+ +
+

+Next: , Previous: , Up: Extras   [Contents][Index]

+
+ +

11.9 Rdired

+ +

Ess-rdired provides a dired-like buffer for viewing, editing and +plotting objects in your current R session. If you are used to using +the dired (directory editor) facility in Emacs, this mode gives you +similar functionality for R objects. +

+

Start an R session with M-x R and then store a few +variables, such as: +

+
+
s <- sin(seq(from=0, to=8*pi, length=100))
+x <- c(1, 4, 9)
+y <- rnorm(20)
+z <- TRUE
+
+ +

Then use M-x ess-rdired to create a buffer listing the +objects in your current environment and display it in a new window: +

+
            mode length
+  s      numeric    100
+  x      numeric      3
+  y      numeric     20
+  z      logical      1
+
+ +

Type C-h m or ? to get a list of the keybindings for this +mode. For example, with your point on the line of a variable, ‘p’ will +plot the object, ‘v’ will view it, and ‘d’ will mark the object for +deletion (‘x’ will actually perform the deletion). +

+ +
+ +
+

+Next: , Previous: , Up: Extras   [Contents][Index]

+
+ +

11.10 Rutils

+ +

Ess-rutils builds up on ess-rdired, providing key bindings for +performing basic R functions in the inferior-ESS process buffer, such as +loading and managing packages, object manipulation (listing, viewing, +and deleting), and alternatives to help.start() and +RSiteSearch() that use the browse-url Emacs function. +The library can be loaded using M-x load-file, but the easiest is +to include: +

+
+
(require 'ess-rutils)
+
+ +

in your .emacs. Once R is started with M-x R, and if the value of +the customizable variable ess-rutils-keys is true, several key +bindings become available in iESS process buffers: +

+
+
Command: ess-rutils-local-pkgs
+
+

C-c C-. l List all packages in all available libraries. +

+ +
+
Command: ess-rutils-repos-pkgs
+
+

C-c C-. r List available packages from repositories listed by +getOptions(``repos'') in the current R session. +

+ +
+
Command: ess-rutils-update-pkgs lib repos
+
+

C-c C-. u Update packages in a particular library lib and +repository repos. +

+ +
+
Command: ess-rutils-apropos
+
+

C-c C-. a Search for a string using apropos. +

+ +
+
Command: ess-rutils-rm-all
+
+

C-c C-. m Remove all R objects. +

+ +
+
Command: ess-rutils-objs
+
+

C-c C-. o Manipulate R objects; wrapper for ess-rdired. +

+ +
+
Command: ess-rutils-load-wkspc
+
+

C-c C-. w Load a workspace file into R. +

+ +
+
Command: ess-rutils-save-wkspc
+
+

C-c C-. s Save a workspace file. +

+ +
+
Command: ess-change-directory
+
+

C-c C-. d Change the working directory for the current R session. +

+ +
+
Command: ess-rutils-html-docs
+
+

C-c C-. H Use browse-url to navigate R html +documentation. +

+ +

See the submenu ‘Rutils’ under the iESS menu for alternative access +to these functions. The function ess-rutils-rsitesearch is +provided without a particular key binding. This function is useful in +any Emacs buffer, so can be bound to a user-defined key: +

+
+
(eval-after-load "ess-rutils"
+  '(global-set-key [(control c) (f6)] 'ess-rutils-rsitesearch))
+
+ + +

Functions for listing objects and packages +(ess-rutils-local-pkgs, ess-rutils-repos-pkgs, and +ess-rutils-objs) show results in a separate buffer and window, +in ess-rutils-mode, providing useful key bindings in this mode +(type ? in this buffer for a description). +

+ +
+ +
+

+Next: , Previous: , Up: Extras   [Contents][Index]

+
+ +

11.11 Interaction with Org mode

+ +

Org-mode (http://orgmode.org) now supports reproducible research +and literate programming in many languages (including R) – see chapter +14 of the Org manual +(http://orgmode.org/org.html#Working-With-Source-Code). For ESS +users, this offers a document-based work environment within which to +embed ESS usage. R code lives in code blocks of an Org document, from +which it can be edited in ess-mode, evaluated, extracted ("tangled") to +pure code files. The code can also be exported ("woven") with the +surrounding text to several formats including HTML and LaTeX. Results of +evaluation including figures can be captured in the Org document, and +data can be passed from the Org document (e.g. from a table) to the ESS +R process. (This section contributed by Dan Davison and Eric Schulte.) +

+ +
+ +
+

+Previous: , Up: Extras   [Contents][Index]

+
+ +

11.12 Support for Sweave in ESS and AUCTeX

+ +

ESS provides support for writing and processing Sweave +(http://www.statistik.lmu.de/~leisch/Sweave), building up on +Emacs’ ess-noweb-mode for literate programming. When working on an Sweave +document, the following key bindings are available: +

+
+
Command: ess-swv-weave choose
+
+

M-n s Run Sweave on the current .Rnw file. If choose is +non-‘nil’, offer a menu of available weavers. +

+ +
+
Command: ess-swv-latex
+
+

M-n l Run LaTeX after Sweave’ing. +

+ +
+
Command: ess-swv-PS
+

M-n p Generate and display a postscript file after LaTeX’ing. +

+ +
+
Command: ess-swv-PDF pdflatex-cmd
+
+

M-n P Generate and display a PDF file after LaTeX’ing. Optional +argument pdflatex-cmd is the command to use, which by default, is +the command used to generate the PDF file is the first element of +ess-swv-pdflatex-commands. +

+ +
+
User Option: ess-swv-pdflatex-commands
+

Commands used by ess-swv-PDF to run a version of pdflatex; the +first entry is the default command. +

+ +

Sweave’ing with ess-swv-weave starts an inferior-ESS process, if +one is not available. Other commands are available from the +‘Sweaving, Tangling, ...’ submenu of the Noweb menu. +

+

AUCTeX (http://www.gnu.org/software/auctex) users may prefer to +set the variable ess-swv-plug-into-AUCTeX-p (available from the +“ESS Sweave” customization group) to t. Alternatively, the same can +be achieved by activating the entry “AUCTeX Interface” from the +‘Sweaving, Tangling, ...’ submenu, which toggles this variable on +or off. When the interface is activated, new entries for Sweave’ing and +LaTeX’ing thereafter are available from AUCTeX’s “Command” menu. +Sweave’ing can, thus, be done by C-c C-c Sweave RET without an +inferior-ESS process. Similarly, LaTeX’ing can be done by C-c C-c +LaTeXSweave RET. In both cases, the process can be monitored with +C-c C-l (TeX-recenter-output-buffer). Open the viewer with +C-c C-v (TeX-view), as usual in AUCTeX. +

+
+ +
+

+Next: , Previous: , Up: Top   [Contents][Index]

+
+ +

12 Overview of ESS features for the S family

+ + + + + + + + + +
+ + + +

12.1 ESS[S]–Editing files

+ +

ESS[S] is the mode for editing S language files. This mode handles: +

+
    +
  • - proper indenting, generated by both [Tab] and [Return]. +
  • - color and font choices based on syntax. +
  • - ability to send the contents of an entire buffer, a highlighted + region, an S function, or a single line to an inferior S process, if + one is currently running. +
  • - ability to switch between processes which would be the target of the + buffer (for the above). +
  • - The ability to request help from an S process for variables and + functions, and to have the results sent into a separate buffer. +
  • - completion of object names and file names. +
+ +

ESS[S] mode should be automatically turned on when loading a file with +the suffices found in ess-site (*.R, *.S, *.s, etc). Alternatively, +type M-x R-mode to put the current buffer into R mode. However, one +will have to start up an inferior process to take advantage of the +interactive features. +

+
+ + + +

12.2 iESS[S]–Inferior ESS processes

+

iESS (inferior ESS) is the mode for interfacing with active +statistical processes (programs). This mode handles: +

+
    +
  • - proper indenting, generated by both [Tab] and [Return]. +
  • - color and font highlighting based on syntax. +
  • - ability to resubmit the contents of a multi-line command + to the executing process with a single keystroke [RET]. +
  • - The ability to request help from the current process for variables + and functions, and to have the results sent into a separate buffer. +
  • - completion of object names and file names. +
  • - interactive history mechanism. +
  • - transcript recording and editing. +
+ +

To start up iESS mode, use: +

+
   M-x S+3
+   M-x S4
+   M-x S+5
+   M-x S+6
+   M-x R
+
+ +

(for S-PLUS 3.x, S4, S+5, S+6 or S+7, and R, respectively. This assumes that +you have access to each). Usually the site will have defined one of +these programs (by default S+6) to the simpler name: +

+

M-x S +

+ +

In the (rare) case that you wish to pass command line arguments to the +starting S+6 process, set the variable inferior-Splus-args. +

+

Note that R has some extremely useful command line arguments. For +example, --vanilla will ensure R starts up without loading in any init +files. To enter a command line argument, call R using a "prefix +argument", by +

+

C-u M-x R +

+

and when ESS prompts for "Starting Args ? ", enter (for example): +

+

--vanilla +

+

Then that R process will be started up using R --vanilla. If you +wish to always call R with certain arguments, set the variable +inferior-R-args accordingly. +

+ +

If you have other versions of R or S-Plus available on the system, ESS +is also able to start those versions. How this exactly works depend on +which OS you are using, as described in the following paragraphs. The +general principle, regardless of OS, is that ESS searches the paths +listed in the variable exec-path for R binaries. If ESS cannot +find your R binaries, on Unix you can change the unix environment +variable PATH, as this variable is used to set exec-path. +

+

R on Unix systems: If you have "R-1.8.1" on your exec-path, it +can be started using M-x R-1.8.1. By default, ESS will find +versions of R beginning "R-1" or "R-2". If your versions of R are +called other names, consider renaming them with a symbolic link or +change the variable ess-r-versions. To see which functions have +been created for starting different versions of R, type M-x R- and +then hit [Tab]. These other versions of R can also be started from the +"ESS->Start Process->Other" menu. +

+

R on Windows systems: If you have "rw1081" on your exec-path, it +can be started using M-x rw1081. By default, ESS will find +versions of R located in directories parallel to the version of R in +your PATH. If your versions of R are called other names, you +will need to change the variable ess-rterm-versions. To see +which functions have been created for starting different versions of R, +type M-x rw and then hit [Tab]. These other versions of +R can also be started from the "ESS->Start Process->Other" menu. +

+

Once ESS has found these extra versions of R, it will then create a new +function, called M-x R-newest, which will call the newest version +of R that it found. (ESS examines the date in the first line of +information from R --version to determine which is newest.) +

+

S on Unix systems: If you have "Splus7" on your exec-path, it can +be started using M-x Splus7. By default, ESS will find all +executables beginning "Splus" on your path. If your versions of S are +called other names, consider renaming them with a symbolic link or +change the variable ess-s-versions. To see which functions have +been created for starting different versions of Splus, type M-x +Splus and then hit [Tab]. These other versions of Splus can also be +started from the "ESS->Start Process->Other" menu. +

+

A second mechanism is also available for running other versions of Splus. +The variable ess-s-versions-list is a list of lists; each sublist +should be of the form: (DEFUN-NAME PATH ARGS). DEFUN-NAME is the name +of the new emacs function you wish to create to start the new S process; +PATH is the full path to the version of S you want to run; ARGS is an +optional string of command-line arguments to pass to the S process. +Here is an example setting: +

+
(setq ess-s-versions-list
+      '( ("Splus64" "/usr/local/bin/Splus64")
+         ("Splus64-j" "/usr/local/bin/Splus64" "-j")))
+
+

which will then allow you to do M-x Splus64-j to start Splus64 +with the corresponding command line arguments. +

+ +

If you change the value of either ess-s-versions or +ess-s-versions-list, you should put them in your .emacs before +ess-site is loaded, since the new emacs functions are created when ESS +is loaded. +

+ + + +

Sqpe (S-Plus running inside an emacs buffer) on Windows systems: If you +have an older version of S-Plus (S-Plus 6.1 for example) on your system, +ir can be started inside an emacs buffer with M-x splus61. By +default, ESS will find versions of S-Plus located in the installation +directories that Insightful uses by default. If your versions of S-Plus +are anywhere else, you will need to change the variable +ess-SHOME-versions. To see which functions have been created for +starting different versions of S-Plus, type M-x spl and then hit +[Tab]. These other versions of S-Plus can also be started from the +"ESS->Start Process->Other" menu. +

+ +
+ + + +

12.3 ESS-help–assistance with viewing help

+ +

ESS has built-in facilities for viewing help files from S. See Help. +

+ +
+ + + +

12.4 Philosophies for using ESS[S]

+ +

The first is preferred, and configured for. The second one can be +retrieved again, by changing emacs variables. +

+

1: (preferred by the current group of developers): The source code is + real. The objects are realizations of the source code. Source + for EVERY user modified object is placed in a particular directory + or directories, for later editing and retrieval. +

+

2: (older version): S objects are real. Source code is a temporary + realization of the objects. Dumped buffers should not be saved. + _We_strongly_discourage_this_approach_. However, if you insist, + add the following lines to your .emacs file: +

+
(setq ess-keep-dump-files 'nil)
+(setq ess-delete-dump-files t)
+(setq ess-mode-silently-save nil)
+
+

The second saves a small amount of disk space. The first allows for +better portability as well as external version control for code. +

+
+ + + +

12.5 Scenarios for use (possibilities–based on actual usage)

+ +

We present some basic suggestions for using ESS to interact with S. +These are just a subset of approaches, many better approaches are +possible. Contributions of examples of how you work with ESS are +appreciated (especially since it helps us determine priorities on +future enhancements)! (comments as to what should be happening are +prefixed by "##"). +

+
1:  ##    Data Analysis Example (source code is real)
+    ## Load the file you want to work with
+    C-x C-f myfile.s
+
+    ## Edit as appropriate, and then start up S-PLUS 3.x
+    M-x S+3
+
+    ## A new buffer *S+3:1* will appear.  Splus will have been started
+    ## in this buffer.  The buffer is in iESS [S+3:1] mode.
+
+    ## Split the screen and go back to the file editing buffer.
+    C-x 2 C-x b myfile.s
+
+    ## Send regions, lines, or the entire file contents to S-PLUS.  For regions,
+    ## highlight a region with keystrokes or mouse and then send with:
+    C-c C-r
+
+    ## Re-edit myfile.s as necessary to correct any difficulties.  Add
+    ## new commands here.  Send them to S by region with C-c C-r, or
+    ## one line at a time with C-c C-n.
+
+    ## Save the revised myfile.s with C-x C-s.
+
+    ## Save the entire *S+3:1* interaction buffer with C-c C-s.  You
+    ## will be prompted for a file name.  The recommended name is
+    ## myfile.St.  With the *.St suffix, the file will come up in ESS
+    ## Transcript mode the next time it is accessed from Emacs.
+
+
+
+2:  ## Program revision example (source code is real)
+
+    ## Start up S-PLUS 3.x in a process buffer (this will be *S+3:1*)
+    M-x S+3
+
+    ## Load the file you want to work with
+    C-x C-f myfile.s
+
+    ## edit program, functions, and code in myfile.s, and send revised
+    ## functions to S when ready with
+    C-c C-f
+    ## or highlighted regions with
+    C-c C-r
+    ## or individual lines with
+    C-c C-n
+    ## or load the entire buffer with
+    C-c C-l
+
+    ## save the revised myfile.s when you have finished
+    C-c C-s
+
+
+
+3:  ## Program revision example (S object is real)
+
+    ## Start up S-PLUS 3.x in a process buffer (this will be *S+3:1*)
+    M-x S+3
+
+    ## Dump an existing S object my.function into a buffer to work with
+    C-c C-d my.function
+    ## a new buffer named yourloginname.my.function.S will be created with
+    ## an editable copy of the object.  The buffer is associated with the
+    ## pathname /tmp/yourloginname.my.function.S and will amlost certainly not
+    ## exist after you log off.
+
+    ## enter program, functions, and code into work buffer, and send
+    ## entire contents to S-PLUS when ready
+    C-c C-b
+
+    ## Go to *S+3:1* buffer, which is the process buffer, and examine
+    ## the results.
+    C-c C-y
+    ## The sequence C-c C-y is a shortcut for:  C-x b *S+3:1*
+
+    ## Return to the work buffer (may/may not be prefixed)
+    C-x C-b yourloginname.my.function.S
+    ## Fix the function that didn’t work, and resubmit by placing the
+    ## cursor somewhere in the function and
+    C-c C-f
+    ## Or you could’ve selected a region (using the mouse, or keyboard
+    ## via setting point/mark) and
+    C-c C-r
+    ## Or you could step through, line by line, using
+    C-c C-n
+    ## Or just send a single line (without moving to the next) using
+    C-c C-j
+    ## To fix that error in syntax for the "rchisq" command, get help
+    ## by
+    C-c C-v rchisq
+
+
+4:    Data Analysis (S object is real)
+    ## Start up S-PLUS 3.x, in a process buffer (this will be *S+3:1*)
+    M-x S+3
+
+    ## Work in the process buffer.  When you find an object that needs
+    ## to be changed (this could be a data frame, or a variable, or a
+    ## function), dump it to a buffer:
+    C-c C-d my.cool.function
+
+    ## Edit the function as appropriate, and dump back in to the
+    ## process buffer
+    C-c C-b
+
+    ## Return to the S-PLUS process buffer
+    C-c C-y
+    ## Continue working.
+
+    ## When you need help, use
+    C-c C-v rchisq
+    ## instead of entering:   help("rchisq")
+
+ + +
+ + + +

12.6 Customization Examples and Solutions to Problems

+ +

1. Suppose that you are primarily an SPLUS 3.4 user, occasionally + using S version 4, and sick and tired of the buffer-name *S+3* + we’ve stuck you with. Simply edit the "ess-dialect" alist entry in + the ess-sp3-d.el and ess-s4-d.el files to be "S" instead of "S4" and + "S+3". This will ensure that all the inferior process buffer names + are "*S*". +

+

2. Suppose that you WANT to have the first buffer name indexed by + ":1", in the same manner as your S-PLUS processes 2,3,4, and 5 (for + you heavy simulation people). Then + add after your (require ’ess-site) or (load "ess-site") command + in your .emacs file, the line: +

+
(setq ess-plain-first-buffername nil)
+
+ +

3. Fontlocking sometimes fails to behave nicely upon errors. When + Splus dumps, a mis-matched " (double-quote) can result in the + wrong font-lock face being used for the remainder of the buffer. +

+

Solution: add a " at the end of the "Dumped..." statement, to + revert the font-lock face back to normal. +

+

4. When you change directory within a *R* or *S* session using the +setwd() command, emacs does not recognise that you have changed the +current directory. +

+

Solution: Use M-x ess-change-directory. This will prompt you for +the directory to change to. It will then change directory within the +*S* buffer, and also update the emacs variable default-directory. +Alternatively, if you have already executed setwd(), press M-RET +within the *S* buffer so that Emacs can update default-directory. +

+
+ +
+

+Next: , Previous: , Up: Top   [Contents][Index]

+
+ +

13 ESS for SAS

+ + + + + + + + + + + + +

ESS[SAS] was designed for use with SAS. It is descended from emacs +macros developed by John Sall for editing SAS programs and SAS-mode by +Tom Cook. Those editing features and new advanced features are part of +ESS[SAS]. The user interface of ESS[SAS] has similarities with ESS[S] +and the SAS Display Manager. +

+
+ + + +

13.1 ESS[SAS]–Design philosophy

+ +

ESS[SAS] was designed to aid the user in writing and maintaining SAS +programs, such as foo.sas. Both interactive and batch +submission of SAS programs is supported. +

+

ESS[SAS] was written with two primary goals. +

    +
  1. The emacs text editor provides a powerful and flexible development +environment for programming languages. These features are a boon to all +programmers and, with the help of ESS[SAS], to SAS users as well. +
  2. Although a departure from SAS Display Manager, ESS[SAS] provides +similar key definitions to give novice ESS[SAS] users a head start. +Also, inconvenient SAS Display Manager features, like remote submission +and syntax highlighting, are provided transparently; appealing to +advanced ESS[SAS] users. +
+ +
+ + + +

13.2 ESS[SAS]–Editing files

+ +

ESS[SAS] is the mode for editing SAS language files. This mode handles: +

+
    +
  • proper indenting, generated by both TAB and RET. +
  • color and font choices based on syntax. +
  • ability to save and submit the file you are working on as a batch +SAS process with a single keypress and to continue editing while it is runs +in the background. +
  • capability of killing the batch SAS process through the *shell* buffer or +allow the SAS process to keep on running after you exit emacs. +
  • single keypress navigation of .sas, .log and .lst files +(.log and .lst files are refreshed with each keypress). +
  • ability to send the contents of an entire buffer, a highlighted region, +or a single line to an interactive SAS process. +
  • ability to switch between processes which would be the target of the +buffer (for the above). +
+ +

ESS[SAS] is automatically turned on when editing a file with a .sas +suffix (or other extension, if specified via auto-mode-alist). The function +keys can be enabled to use the same function keys that +the SAS Display Manager does. The interactive capabilities of ESS require you +to start an inferior SAS process with M-x SAS +(See iESS(SAS)--Interactive SAS processes.) +

+

At this writing, the indenting and syntax highlighting are generally +correct. Known issues: for multiple line * or %* comments, only the +first line is highlighted; for .log files, only the first line of a +NOTE:, WARNING: or ERROR: message is highlighted; unmatched +single/double quotes in CARDS data lines are NOT ignored; in an +iterative DO statement, TO and BY are not highlighted. +

+
+ + + +

13.3 ESS[SAS]–TAB key

+ +

Two options. The TAB key is bound by default to +sas-indent-line. This function is used to syntactically indent +SAS code so PROC and RUN are in the left margin, +other statements are indented sas-indent-width spaces from the +margin, continuation lines are indented sas-indent-width spaces +in from the beginning column of that statement. This is the type of +functionality that emacs provides in most programming language modes. +This functionality is activated by placing the following line in your +initialization file prior to a require/load: +

+
(setq ess-sas-edit-keys-toggle nil)
+
+ +

ESS provides an alternate behavior for TAB that makes it +behave as it does in SAS Display Manager, i.e. move the cursor to +the next stop. The alternate behavior also provides a "TAB" +backwards, C-TAB, that moves the cursor to the stop to +the left and deletes any characters between them. This functionality +is obtained by placing the following line in your initialization file +prior to a require/load: +

+
(setq ess-sas-edit-keys-toggle t)
+
+

Under the alternate behavior, TAB is bound to M-x tab-to-tab-stop +and the stops are defined by ess-sas-tab-stop-list. +

+
+ + + +

13.4 ESS[SAS]–Batch SAS processes

+ +

Submission of a SAS batch job is dependent on your environment. +ess-sas-submit-method is determined by your operating system and +your shell. It defaults to 'sh unless you are running Windows or +Mac Classic. Under Windows, it will default to 'sh if you are using +a UNIX-imitating shell; otherwise 'ms-dos for an MS-DOS +shell. On macOS, it will default to 'sh, but under Mac Classic, +it defaults to 'apple-script. You will also set this to 'sh +if the SAS batch job needs to run on a remote machine rather than your +local machine. This works transparently if you are editing the remote file +via ange-ftp/EFS or tramp. Note that +ess-sas-shell-buffer-remote-init is a Local Variable that defaults +to "ssh" which will be used to open the buffer on the remote host +and it is assumed that no password is necessary, i.e. you are using +ssh-agent/ssh-add or the equivalent (see the discussion about +Local Variables below if you need to change the default). +

+

However, if you are editing the file locally and transferring it back and +forth with Kermit, you need some additional steps. First, start Kermit +locally before remotely logging in. Open a local copy of the file with the +ess-kermit-prefix character prepended (the default is "#"). +Execute the command M-x ess-kermit-get which automatically brings +the contents of the remote file into your local copy. If you transfer +files with Kermit manually in a *shell* buffer, then note that the +Kermit escape sequence is C-q C-\ c rather than C-\ c which +it would be in an ordinary terminal application, i.e. not in an emacs +buffer. Lastly, note that the remote Kermit command is specified by +ess-kermit-command. +

+

The command used by the SUBMIT function key (F3 or F8) +to submit a batch SAS job, whether local or remote, is +ess-sas-submit-command which defaults to sas-program. +sas-program is "invoke SAS using program file" for Mac +Classic and "sas" otherwise. However, you may have to alter +ess-sas-submit-command for a particular program, so it is defined as +buffer-local. Conveniently, it can be set at the end of the program: +

+
endsas;
+Local variables:
+ess-sas-submit-command: "sas8"
+End:
+
+ +

The command line is also made of ess-sas-submit-pre-command, +ess-sas-submit-post-command and ess-sas-submit-command-options +(the last of which is also buffer-local). +Here are some examples for your ~/.emacs or ~/.xemacs/init.el +file (you may also use M-x customize-variable): +

+
;'sh default
+(setq ess-sas-submit-pre-command "nohup")
+;'sh default
+(setq ess-sas-submit-post-command "-rsasuser &")
+;'sh example
+(setq-default ess-sas-submit-command "/usr/local/sas/sas")
+;'ms-dos default
+(setq ess-sas-submit-pre-command "start")
+;'ms-dos default
+(setq ess-sas-submit-post-command "-rsasuser -icon")
+;Windows example
+(setq-default ess-sas-submit-command "c:/progra~1/sas/sas.exe")
+;Windows example
+(setq-default ess-sas-submit-command "c:\\progra~1\\sas\\sas.exe")
+
+ +

There is a built-in delay before a batch SAS job is submitted when using +a UNIX-imitating shell under Windows. This is necessary in many cases +since the shell might not be ready to receive a command. This delay is +currently set high enough so as not to be a problem. But, there may be +cases when it needs to be set higher, or could be set much lower to +speed things up. You can over-ride the default in your ~/.emacs or ~/.xemacs/init.el file by: +

+
(setq ess-sleep-for 0.2)
+
+ +

For example, (setq ess-sas-global-unix-keys t) keys shown, +(setq ess-sas-global-pc-keys t) in parentheses; +ESS[SAS] function keys are presented in the next section. +Open the file you want to work with C-x C-f foo.sas. +foo.sas will be in ESS[SAS] mode. Edit as appropriate, then save and +submit the batch SAS job. +

+
F3 (F8)
+
+

The job runs in the *shell* buffer while you continue to edit +foo.sas. If ess-sas-submit-method is 'sh, then the +message buffer will display the shell notification when the +job is complete. The 'sh setting also allows you to +terminate the SAS batch job before it is finished. +

+
F8 (F3)
+
+

Terminating a SAS batch in the *shell* buffer. +

+
kill PID
+
+

You may want to visit the .log (whether the job is still running +or it is finished) and check for error messages. The .log will be +refreshed and you will be placed in it’s buffer. You will be +taken to the first error message, if any. +

+
F5 (F6)
+
+

Goto the next error message, if any. +

+
F5 (F6)
+
+

Now, ‘refresh’ the .lst and go to it’s buffer. +

+
F6 (F7)
+
+

If you wish to make changes, go to the .sas file with. +

+
F4 (F5)
+
+

Make your editing changes and submit again. +

+
F3 (F8)
+
+ +
+ + + +

13.5 ESS[SAS]–Function keys for batch processing

+ +

The setup of function keys for SAS batch processing +is unavoidably complex, but the usage of function keys is simple. +There are five distinct options: +

+

Option 1 (default). Function keys in ESS[SAS] are not bound to elisp +commands. This is in accordance with the GNU Elisp Coding Standards +(GECS) which do not allow function keys to be bound so that they are +available to the user. +

+

Options 2-5. Since GECS does not allow function keys to be bound by +modes, these keys are often unused. So, ESS[SAS] provides users with +the option of binding elisp commands to these keys. Users who are +familiar with SAS will, most likely, want to duplicate the function key +capabilities of the SAS Display Manager. There are four options (noted +in parentheses). +

+
    +
  1. SAS Display Manager has different function key definitions for +UNIX (2, 4) and Windows (3, 5); ESS[SAS] can use either. +
  2. The ESS[SAS] function key definitions can be active in all buffers +(global: 4, 5) or limited (local: 2, 3) only to buffers with files that +are associated with ESS[SAS] as specified in your auto-mode-alist. +
+ +

The distinction between local and global is subtle. If you want the +ESS[SAS] definitions to work when you are in the *shell* buffer or when +editing files other than the file extensions that ESS[SAS] recognizes, +you will most likely want to use the global definitions. If you want +your function keys to understand SAS batch commands when you are editing +SAS files, and to behave normally when editing other files, then you +will choose the local definitions. The option can be chosen by the +person installing ESS for a site or by an individual. +

+
    +
  1. For a site installation or an individual, place ONLY ONE of +the following lines in your initialization file prior to a +require/load. ESS[SAS] function keys are available +in ESS[SAS] if you choose either 2 or 3 and in all modes if you +choose 4 or 5: +
    +
    ;;2; (setq ess-sas-local-unix-keys t)
    +;;3; (setq ess-sas-local-pc-keys t)
    +;;4; (setq ess-sas-global-unix-keys t)
    +;;5; (setq ess-sas-global-pc-keys t)
    +
    + +

    The names -unix- and -pc- have nothing to do with the operating system +that you are running. Rather, they mimic the definitions that the SAS +Display Manager uses by default on those platforms. +

    +
  2. If your site installation has configured the keys contrary to your +liking, then you must call the appropriate function. +
    +
     (load "ess-site") ;; local-unix-keys
    + (ess-sas-global-pc-keys)
    +
    +
+ +

Finally, we get to what the function keys actually do. You may recognize +some of the nicknames as SAS Display Manager commands (they are in all +capitals). +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
UNIXPCNickname
F2F2refresh
revert the current buffer with the file of the same + name if the file is newer than the buffer
F3F8SUBMIT
save the current .sas file (which is either the .sas + file in the current buffer or the .sas file associated + with the .lst or .log file in the current buffer) + and submit the file as a batch SAS job
F4F5PROGRAM
switch buffer to .sas file
F5F6LOG
switch buffer to .log file, ‘refresh’ and goto next + error message, if any
F6F7OUTPUT
switch buffer to .lst file and ‘refresh
F7F4filetype-1
switch buffer to ‘filetype-1’ (defaults to .txt) file + and ‘refresh
F8F3shell
switch buffer to *shell*
F9F9VIEWTABLE
open an interactive PROC FSEDIT session on the SAS + dataset near point
F10F10toggle-log
toggle ESS[SAS] for .log files; useful for certain + debugging situations
F11F11filetype-2
switch buffer to ‘filetype-2’ (defaults to .dat) file + and ‘refresh
F12F12viewgraph
open a GSASFILE near point for viewing either in emacs + or with an external viewer
C-F1C-F1rtf-portrait
create an MS RTF portrait file from the current buffer + with a file extension of .rtf
C-F2C-F2rtf-landscape
create an MS RTF landscape file from the current buffer + with a file extension of .rtf
C-F3C-F8submit-region
write region to ess-temp.sas and submit
C-F5C-F6append-to-log
append ess-temp.log to the current .log file
C-F6C-F7append-to-output
append ess-temp.lst to the current .lst file
C-F9C-F9INSIGHT
open an interactive PROC INSIGHT session on the SAS + dataset near point
C-F10C-F10toggle-listing
toggle ESS[SAS] for .lst files; useful for toggling + read-only
+ +

SUBMIT, PROGRAM, LOG and OUTPUT need no further +explanation since they mimic the SAS Display Manager commands and +related function key definitions. However, six other keys have been +provided for convenience and are described below. +

+

shell’ switches you to the *shell* buffer where you can +interact with your operating system. This is especially helpful if you +would like to kill a SAS batch job. You can specify a different buffer +name to associate with a SAS batch job (besides *shell*) with the +buffer-local variable ess-sas-shell-buffer. This allows you to have +multiple buffers running SAS batch jobs on multiple local/remote +computers that may rely on different methods specified by the buffer-local +variable ess-sas-submit-method. +

+

F2 performs the ‘refresh’ operation on the current buffer. +‘refresh’ compares the buffer’s last modified date/time with the +file’s last modified date/time and replaces the buffer with the file if the +file is newer. This is the same operation that is automatically performed +when LOG, OUTPUT, ‘filetype-1’ or F11 are pressed. +

+

filetype-1’ switches you to a file with the same file name as your .sas +file, but with a different extension (.txt by default) and performs +‘refresh’. You can over-ride the default extension; for example in your +~/.emacs or ~/.xemacs/init.el file: +

+
(setq ess-sas-suffix-1 "csv") ; for example
+
+ +

F9 will prompt you for the name of a permanent SAS dataset near +point to be opened for viewing by PROC FSEDIT. You can control the +SAS batch command-line with ess-sas-data-view-submit-options. +For controlling the SAS batch commands, you have the global variables +ess-sas-data-view-libname and +ess-sas-data-view-fsview-command as well as the buffer-local +variable ess-sas-data-view-fsview-statement. If you have your +SAS LIBNAME defined in ~/autoexec.sas, then the defaults +for these variables should be sufficient. +

+

Similarly, C-F9 will prompt you for the name of a permanent +SAS dataset near point to be opened for viewing by PROC INSIGHT. +You can control the SAS batch command-line with +ess-sas-data-view-submit-options. For controlling the SAS batch +commands, you have the global variables ess-sas-data-view-libname +and ess-sas-data-view-insight-command as well as the buffer-local +variable ess-sas-data-view-insight-statement. +

+

F10 toggles ESS[SAS] mode for .log files which is off by default +(technically, it is SAS-log-mode, but it looks the same). The syntax +highlighting can be helpful in certain debugging situations, but large +.log files may take a long time to highlight. +

+

F11 is the same as ‘filetype-1’ except it is .dat by default. +

+

F12 will prompt you for the name of a GSASFILE near the point in .log to +be opened for viewing either with emacs or with an external viewer. +Depending on your version of emacs and the operating system you are +using, emacs may support .gif and .jpg files internally. You may need +to change the following variables for your own situation. +ess-sas-graph-view-suffix-regexp is a regular expression of supported +file types defined via file name extensions. +ess-sas-graph-view-viewer-default is the default external viewer for +your platform. ess-sas-graph-view-viewer-alist is an alist of +exceptions to the default; i.e. file types and their associated +viewers which will be used rather than the default viewer. +

+
(setq ess-sas-graph-view-suffix-regexp (concat "[.]\\([eE]?[pP][sS]\\|"
+"[pP][dD][fF]\\|[gG][iI][fF]\\|[jJ][pP][eE]?[gG]\\|"
+"[tT][iI][fF][fF]?\\)")) ;; default
+(setq ess-sas-graph-view-viewer-default "kodakimg") ;; Windows default
+(setq ess-sas-graph-view-viewer-default "sdtimage") ;; Solaris default
+(setq ess-sas-graph-view-viewer-alist
+  '(("[eE]?[pP][sS]" . "gv") ("[pP][dD][fF]" . "gv")) ;; default w/ gv
+
+ +

C-F2 produces US landscape by default, however, it can produce A4 +landscape (first line for "global" key mapping, second for "local"): +

+
(global-set-key [(control f2)] 'ess-sas-rtf-a4-landscape)
+(define-key sas-mode-local-map [(control f2)] 'ess-sas-rtf-a4-landscape)
+
+ + +
+ + + +

13.6 iESS[SAS]–Interactive SAS processes

+ +

Inferior ESS (iESS) is the method for interfacing with interactive +statistical processes (programs). iESS[SAS] is what is needed for +interactive SAS programming. iESS[SAS] works best +with the SAS command-line option settings +"-stdio -linesize 80 -noovp -nosyntaxcheck" +(the default of inferior-SAS-args). +

+
+
-stdio
+            required to make the redirection of stdio work
+-linesize 80
+            keeps output lines from folding on standard terminals
+-noovp
+            prevents error messages from printing 3 times
+-nosyntaxcheck
+            permits recovery after syntax errors
+
+ +

To start up iESS[SAS] mode, use: +

+
   M-x SAS
+
+ +

The *SAS:1.log* buffer in ESStr mode corresponds to the file +foo.log in SAS batch usage and to the ‘SAS: LOG’ window in the +SAS Display Manager. All commands submitted to SAS, informative +messages, warnings, and errors appear here. +

+

The *SAS:1.lst* buffer in ESSlst mode corresponds to the file +foo.lst in SAS batch usage and to the ‘SAS: OUTPUT’ window in the +SAS Display Manager. All printed output appears in this window. +

+

The *SAS:1* buffer exists solely as a communications buffer. +The user should never use this buffer directly. +Files are edited in the foo.sas buffer. The C-c C-r key in +ESS[SAS] is the functional equivalent of bringing a file into the +‘SAS: PROGRAM EDITOR’ window followed by SUBMIT. +

+

For example, open the file you want to work with. +

+
C-x C-f foo.sas
+
+

foo.sas will be in ESS[SAS] mode. Edit as appropriate, and then start +up SAS with the cursor in the foo.sas buffer. +

+
M-x SAS
+
+

Four buffers will appear on screen: +

+ + + + + +
BufferModeDescription
foo.sasESS[SAS]your source file
*SAS:1*iESS[SAS:1]iESS communication buffer
*SAS:1.log*Shell ESStr []SAS log information
*SAS:1.lst*Shell ESSlst []SAS listing information
+

If you would prefer each of the four buffers to appear in its +own individual frame, you can arrange for that. Place the +cursor in the buffer displaying foo.sas. Enter the +sequence C-c C-w. The cursor will normally be in buffer +foo.sas. If not, put it there and C-x b foo.sas. +

+

Send regions, lines, or the entire file contents to SAS +(regions are most useful: a highlighted region will normally +begin with the keywords DATA or PROC and end with +RUN;), C-c C-r. +

+

Information appears in the log buffer, analysis results in the +listing buffer. In case of errors, make the corrections in the +foo.sas buffer and resubmit with another C-c C-r. +

+

At the end of the session you may save the log and listing +buffers with the usual C-x C-s commands. You will be prompted +for a file name. Typically, the names foo.log and foo.lst +will be used. You will almost certainly want to edit the saved +files before including them in a report. The files are +read-only by default. You can make them writable by the emacs +command C-x C-q. +

+

At the end of the session, the input file foo.sas will +typically have been revised. You can save it. It can be used +later as the beginning of another iESS[SAS] session. It can +also be used as a batch input file to SAS. +

+

The *SAS:1* buffer is strictly for ESS use. The user should +never need to read it or write to it. Refer to the .lst and +.log buffers for monitoring output! +

+

Troubleshooting: See iESS(SAS)--Common problems. +

+
+ + + +

13.7 iESS[SAS]–Common problems

+ +
    +
  1. iESS[SAS] does not work on Windows. In order to run SAS inside +an emacs buffer, it is necessary to start SAS with the -stdio option. +SAS does not support the -stdio option on Windows. +
  2. If M-x SAS gives errors upon startup, check the following: +
      +
    • you are running Windows: see 1. +
    • ess-sas-sh-command (from the ESS etc directory) needs to be +executable; too check, type M-x dired; if not, fix it as follows, +type M-:, then at the minibuffer prompt ‘Eval:, +type (set-file-modes "ess-sas-sh-command" 493). +
    • sas isn’t in your executable path; to verify, type +M-: and at the minibuffer prompt ‘Eval:’, type +(executable-find "sas") +
    +
  3. M-x SAS starts SAS Display Manager. Probably, the command sas +on your system calls a shell script. In that case you will need to locate +the real sas executable and link to it. +You can execute the UNIX command: +
    +
    find / -name sas -print
    +
    +

    Now place a soft link to the real sas executable in your ~/bin +directory, with for example +

    +
    cd ~/bin
    +ln -s /usr/local/sas9/sas sas
    +
    +
+

Check your PATH environment variable to confirm that +~/bin appears before the directory in which the sas +shell script appears. +

+ +
+ + + +

13.8 ESS[SAS]–Graphics

+ +

Output from a SAS/GRAPH PROC can be displayed in a SAS/GRAPH +window for SAS batch on Windows or for both SAS batch and interactive +with XWindows on UNIX. If you need to create graphics files and view +them with F12, then include the following (either in +foo.sas or in ~/autoexec.sas): +

+
filename gsasfile 'graphics.ps';
+goptions device=ps gsfname=gsasfile gsfmode=append;
+
+

PROC PLOT graphs can be viewed in the listing buffer. You may +wish to control the vertical spacing to allow the entire plot +to be visible on screen, for example: +

+
proc plot;
+    plot a*b / vpos=25;
+run;
+
+ +
+ +
+

+Previous: , Up: ESS for SAS   [Contents][Index]

+
+ +

13.9 ESS[SAS]–Windows

+ +
    +
  • iESS[SAS] does not work on Windows. See iESS(SAS)--Common problems. + +
  • ESS[SAS] mode for editing SAS language files works very well. +See ESS(SAS)--Editing files. + +
  • There are two execution options for SAS on Windows. +You can use batch. See ESS(SAS)--Batch SAS processes. + +

    Or you can mark regions with the mouse and submit the code with +‘submit-region’ or paste them into SAS Display Manager. +

    +
+ + +
+ +
+

+Next: , Previous: , Up: Top   [Contents][Index]

+
+ +

14 ESS for BUGS

+ + + + + + +

ESS[BUGS] was originally designed for use with BUGS software. Later, +it evolved to support JAGS as a dialect of the BUGS language via +ESS[JAGS], however, ESS[JAGS] is documented in the section Help +for JAGS. ESS[BUGS] provides 5 features. First, BUGS syntax is +described to allow for proper fontification of statements, +distributions, functions, commands and comments in BUGS model files, +command files and log files. Second, ESS creates templates for the +command file from the model file so that a BUGS batch process can be +defined by a single file. Third, ESS provides a BUGS batch script +that allows ESS to set BUGS batch parameters. Fourth, key sequences +are defined to create a command file and submit a BUGS batch process. +Lastly, interactive submission of BUGS commands is also supported. +

+
+ + + +

14.1 ESS[BUGS]–Model files

+ +

Model files with the .bug extension are edited in ESS[BUGS] +mode if (require 'ess-bugs-d) was performed. Model files with +the .jag extension are edited in ESS[JAGS] mode if +(require 'ess-jags-d) was performed. Three keys are bound for +your use in ESS[BUGS], F2, C-c C-c and =. F2 +performs the same action as it does in ESS[SAS], +See ESS(SAS)--Function keys for batch processing. C-c C-c +performs the function ess-bugs-next-action which you will use a +lot. Pressing it in an empty buffer for a model file will produce a +template for you. = inserts the set operator, <-. +

+ +
+ + + +

14.2 ESS[BUGS]–Command files

+ +

To avoid extension name collision, .bmd is used for BUGS +command files and .jmd for JAGS command files. When you have +finished editing your model file and press C-c C-c, a command +file is created if one does not already exist. +When you are finished editing your command file, pressing C-c C-c +again will submit your command file as a batch job. +

+
+ + + +

14.3 ESS[BUGS]–Log files

+ +

To avoid extension name collision, .bog is used for BUGS log +files. The command line generated by ESS creates the +.bog transcript file. +Similarly, .jog is used for JAGS log files. +

+ +
+ +
+

+Next: , Previous: , Up: Top   [Contents][Index]

+
+ +

15 ESS for JAGS

+ + + + + + +

ESS[BUGS] was originally designed for use with BUGS software. +Later, it evolved to support JAGS as a dialect of the +BUGS language via ESS[JAGS]. Since BUGS and JAGS are quite +similar, ESS[BUGS] and ESS[JAGS] are necessarily similar. +ESS[JAGS] provides 4 features. First, JAGS syntax is described to +allow for proper fontification of statements, distributions, +functions, commands and comments in JAGS model files, command files +and log files. Second, ESS creates templates for the command file +from the model file so that a JAGS batch process can be defined by a +single file. Third, ESS provides a JAGS batch script that allows ESS +to set JAGS batch parameters. Fourth, key sequences are defined to +create a command file and submit a JAGS batch process. +

+
+ + + +

15.1 ESS[JAGS]–Model files

+ +

Model files with the .bug extension are edited in ESS[BUGS] mode +if (require 'ess-bugs-d) was performed or edited in ESS[JAGS] mode +if (require 'ess-jags-d). +Three keys are bound for your use in ESS[BUGS], F2, C-c C-c and =. +F2 performs the same action as it does in ESS[SAS], +See ESS(SAS)--Function keys for batch processing. C-c C-c performs the +function ess-bugs-next-action which you will use a lot. Pressing it +in an empty buffer for a model file will produce a template for you. = +inserts the set operator, <-. +

+

ESS[JAGS] does not support "replacement" variables which were part of +ESS[BUGS]. Although, "replacement" variables are an extremely convenient +feature, creating the elisp code for their operation was challenging. So, a +more elisp-ish approach was adopted for ESS[JAGS]: elisp local variables. +These variables are +created as part of the template, i.e. with the first press of C-c C-c +in an empty buffer. For your .bug file, they are named +ess-jags-chains, ess-jags-monitor, ess-jags-thin, +ess-jags-burnin and ess-jags-update; +they appear in the Local Variables section. When you are +finished editing your model file, pressing C-c C-c will perform +the necessary actions to build your command file for you. +

+

The ess-jags-chains variable is the number of chains that +you want to initialize and sample from; defaults to 1. +The ess-jags-monitor variable is a list of variables +that you want monitored: encase each variable in double quotes. +When you press C-c C-c, the +appropriate statements are created in the command file to monitor the +list of variables. By default, no variables are explicitly monitored +which means JAGS will implicitly monitor all “default” variables. +The ess-jags-thin variable is the thinning parameter. +By default, the thinning parameter is set to 1, i.e. no thinning. +The ess-jags-burnin variable is the number of initial samples +to discard. By default, the burnin parameter is set to 10000. +The ess-jags-update variable is the number of post-burnin samples +to keep. By default, the update parameter is set to 10000. Both +ess-jags-burnin and ess-jags-update are multiplied by +ess-jags-thin since JAGS does not do it automatically. +

+
+ + + +

15.2 ESS[JAGS]–Command files

+ +

To avoid extension name collision, .bmd is used for BUGS +command files and .jmd for JAGS command files. For your +.jmd file, there is only one variable, ess-jags-command, +in the Local Variables section. When you have +finished editing your model file and press C-c C-c, a command +file is created if one does not already exist. +When you are finished editing your command file, pressing C-c C-c +again will submit your command file as a batch job. +The ess-jags-command variable allows you to specify a different +JAGS program to use to run your model; defaults to “jags”. +

+
+ + + +

15.3 ESS[JAGS]–Log files

+ +

The .jog extension is used for JAGS log +files. You may find F2 useful to refresh the .jog if the batch +process over-writes or appends it. +

+ + +
+ +
+

+Next: , Previous: , Up: Top   [Contents][Index]

+
+ +

16 Bugs and Bug Reporting, Mailing Lists

+ + + + + + + + +
+ + + +

16.1 Bugs

+ +
    +
  • Commands like ess-display-help-on-object and list completion +cannot be used while the user is entering a multi-line command. The +only real fix in this situation is to use another ESS process. + +
  • The ess-eval- commands can leave point in the ESS process +buffer in the wrong place when point is at the same position as the last +process output. This proves difficult to fix, in general, as we need to +consider all windows with window-point at the right place. + +
  • It’s possible to clear the modification flag (say, by saving the buffer) +with the edit buffer not having been loaded into S. + +
  • Backup files can sometimes be left behind, even when +ess-keep-dump-files is nil. + +
  • Passing an incomplete S expression to ess-execute causes ESS +to hang. + +
  • The function-based commands don’t always work as expected on functions +whose body is not a parenthesized or compound expression, and don’t even +recognize anonymous functions (i.e. functions not assigned to any +variable). + +
  • Multi-line commands could be handled better by the command history +mechanism. + +
  • Changes to the continutation prompt in R (e.g. +options(continue = " ")) are not automatically detected by ESS. +Hence, for now, the best thing is not to change the continuation prompt. +If you do change the continuation prompt, you will need to change +accordingly the value of inferior-ess-secondary-prompt in +R-customize-alist. + +
+ +
+ +
+

+Next: , Previous: , Up: Mailing lists/bug reports   [Contents][Index]

+
+ +

16.2 Reporting Bugs

+ + +

Please send bug reports, suggestions etc. to +ESS-bugs@r-project.org +

+

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. +

+
+ + + +

16.3 Mailing Lists

+ + +

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. +
+ +
+ + + +

16.4 Help with emacs

+ +

Emacs is a complex editor with many abilities that we do not have space +to describe here. If you have problems with other features of emacs +(e.g. printing), there are several sources to consult, including the +emacs FAQs (try M-x xemacs-www-faq or M-x view-emacs-FAQ) +and EmacsWiki (http://www.emacswiki.org). Please consult them +before asking on the mailing list about issues that are not specific to +ESS. +

+ + + +
+ +
+

+Next: , Previous: , Up: Top   [Contents][Index]

+
+ +

Appendix A Customizing ESS

+ + +

ESS can be easily customized to your taste simply by including the +appropriate lines in your .emacs file. There are numerous +variables which affect the behavior of ESS in certain situations which +can be modified to your liking. Keybindings may be set or changed to +your preferences, and for per-buffer customizations hooks are also +available. +

+

Most of these variables can be viewed and set using the Custom facility +within Emacs. Type M-x customize-group RET ess RET to see all the +ESS variables that can be customized. Variables are grouped by subject +to make it easy to find related variables. +

+ + +
+ +
+

+Previous: , Up: Top   [Contents][Index]

+
+ +

Indices

+ + + + + + + + +
+ + + +

Key index

+
Jump to:   , +   +{ +   +} +   +
+C +   +E +   +M +   +R +   +T +   +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Index Entry  Section

,
,: Handy commands

{
{: Indenting

}
}: Indenting

C
C-c C-. a: Rutils
C-c C-. d: Rutils
C-c C-. H: Rutils
C-c C-. l: Rutils
C-c C-. m: Rutils
C-c C-. o: Rutils
C-c C-. r: Rutils
C-c C-. s: Rutils
C-c C-. u: Rutils
C-c C-. w: Rutils
C-C C-b: Evaluating code
C-c C-c: Other
C-C C-c: Evaluating code
C-c C-e C-d: Edit buffer
C-c C-e C-s: Styles
C-c C-e s: Styles
C-C C-f: Evaluating code
C-C C-j: Evaluating code
C-c C-l: Hot keys
C-c C-o C-c: Roxygen
C-c C-o C-h: Roxygen
C-c C-o C-o: Roxygen
C-c C-o C-r: Roxygen
C-c C-o C-t: Roxygen
C-c C-o n: Roxygen
C-c C-o p: Roxygen
C-c C-q: Hot keys
C-C C-r: Evaluating code
C-c C-s: Hot keys
C-c C-t C-s: Namespaced Evaluation
C-c C-v: Hot keys
C-c C-w: Clean
C-c C-x: Hot keys
C-c C-z: Other
C-C M-b: Evaluating code
C-C M-f: Evaluating code
C-C M-j: Evaluating code
C-C M-r: Evaluating code
C-c RET: Resubmit
C-c `: Hot keys
C-c `: Error Checking
C-j: Indenting
C-M-a: Other edit buffer commands
C-M-e: Other edit buffer commands
C-M-h: Other edit buffer commands
C-M-q: Indenting
C-M-x: Evaluating code
C-x `: Hot keys

E
ESC C-a: Other edit buffer commands
ESC C-e: Other edit buffer commands
ESC C-h: Other edit buffer commands
ESC C-q: Indenting

M
M-;: Indenting
M-?: Object names
M-C-q: Indenting
M-n l: Sweave and AUCTeX
M-n P: Sweave and AUCTeX
M-n s: Sweave and AUCTeX
M-RET: Resubmit

R
RET: Command-line editing
RET: Resubmit

T
TAB: Indenting

+
Jump to:   , +   +{ +   +} +   +
+C +   +E +   +M +   +R +   +T +   +
+ +
+ +
+

+Next: , Previous: , Up: Indices   [Contents][Index]

+
+ +

Function and program index

+
Jump to:   B +   +C +   +D +   +E +   +F +   +I +   +M +   +N +   +O +   +P +   +Q +   +S +   +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Index Entry  Section

B
backward-kill-word: Command-line editing

C
comint-backward-matching-input: Process buffer motion
comint-bol: Command-line editing
comint-copy-old-input: Transcript resubmit
comint-delete-output: Last command
comint-dynamic-complete: Object names
comint-forward-matching-input: Process buffer motion
comint-history-isearch-backward-regexp: Command History
comint-interrupt-subjob: Other
comint-kill-input: Command-line editing
comint-next-input: Process buffer motion
comint-next-input: Command History
comint-next-matching-input-from-input: Command History
comint-previous-input: Process buffer motion
comint-previous-input: Command History
comint-previous-matching-input-from-input: Command History
comint-show-output: Last command

D
dump(): Edit buffer

E
ess-change-directory: Rutils
ess-cleanup: Hot keys
ess-cleanup: Help
ess-describe-help-mode: Help
ess-display-help-on-object: Hot keys
ess-display-help-on-object: Help
ess-display-help-on-object: Help
ess-dump-object-into-edit-buffer: Edit buffer
ess-electric-brace: Indenting
ess-eval-buffer: Evaluating code
ess-eval-buffer-and-go: Evaluating code
ess-eval-function: Evaluating code
ess-eval-function-and-go: Evaluating code
ess-eval-line: Evaluating code
ess-eval-line-and-go: Evaluating code
ess-eval-line-and-step: Help
ess-eval-region: Evaluating code
ess-eval-region: Help
ess-eval-region-and-go: Evaluating code
ess-eval-region-or-function-or-paragraph: Evaluating code
ess-eval-region-or-function-or-paragraph-and-step: Evaluating code
ess-eval-region-or-line-and-step: Evaluating code
ess-execute-objects: Hot keys
ess-execute-search: Hot keys
ess-goto-beginning-of-function-or-para: Other edit buffer commands
ess-goto-end-of-function-or-para: Other edit buffer commands
ess-handy-commands: Handy commands
ess-handy-commands: Handy commands
ess-indent-command: Roxygen
ess-indent-exp: Indenting
ess-indent-or-complete: Indenting
ess-list-object-completions: Object names
ess-load-file: Hot keys
ess-load-file: Loading
ess-mark-function: Other edit buffer commands
ess-parse-errors: Hot keys
ess-parse-errors: Error Checking
ess-quit: Hot keys
ess-quit: Help
ess-R-complete-object-name: Roxygen
ess-r-set-evaluation-env: Namespaced Evaluation
ess-remote: ESS processes on Remote Computers
ess-request-a-process: Multiple ESS processes
ess-resynch: Object names
ess-roxy-hide-all: Roxygen
ess-roxy-next-entry: Roxygen
ess-roxy-preview-HTML: Roxygen
ess-roxy-preview-Rd: Roxygen
ess-roxy-previous-entry: Roxygen
ess-roxy-toggle-roxy-region: Roxygen
ess-roxy-update-entry: Roxygen
ess-rutils-apropos: Rutils
ess-rutils-html-docs: Rutils
ess-rutils-load-wkspc: Rutils
ess-rutils-local-pkgs: Rutils
ess-rutils-objs: Rutils
ess-rutils-repos-pkgs: Rutils
ess-rutils-rm-all: Rutils
ess-rutils-rsitesearch: Rutils
ess-rutils-save-wkspc: Rutils
ess-rutils-update-pkgs: Rutils
ess-set-style: Styles
ess-skip-to-help-section: Help
ess-skip-to-next-section: Help
ess-skip-to-previous-section: Help
ess-smart-comma: Handy commands
ess-submit-bug-report: Reporting Bugs
ess-switch-to-end-of-ESS: Help
ess-switch-to-inferior-or-script-buffer: Other
ess-swv-latex: Sweave and AUCTeX
ess-swv-PDF: Sweave and AUCTeX
ess-swv-PS: Sweave and AUCTeX
ess-swv-weave: Sweave and AUCTeX
ess-tracebug: ESS tracebug
ess-transcript-clean-region: Clean
ess-transcript-copy-command: Resubmit
ess-transcript-send-command: Resubmit
ess-transcript-send-command-and-move: Resubmit
ess-use-ido, ess-completing-read: Minibuffer completion

F
fill-paragraph: Roxygen

I
inferior-ess-send-input: Command-line editing

M
mark-paragraph: Roxygen
move-beginning-of-line: Roxygen

N
newline-and-indent: Roxygen

O
objects(): Hot keys

P
printer(): printer

Q
q(): Hot keys

S
S: Starting up
search(): Hot keys
search(): Object names
source(): Evaluating code
source(): Loading
STERM: Statistical Process running in ESS?

+
Jump to:   B +   +C +   +D +   +E +   +F +   +I +   +M +   +N +   +O +   +P +   +Q +   +S +   +
+ +
+ + + +

Variable index

+
Jump to:   A +   +C +   +E +   +I +   +R +   +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Index Entry  Section

A
ac-source-R: Auto-complete
ac-source-R-args: Auto-complete
ac-source-R-objects: Auto-complete

C
comint-delimiter-argument-list: History expansion
comint-input-ring-size: Command History
comment-column: Indenting

E
ess-ask-about-transfile: Customizing startup
ess-ask-about-transfile: Saving transcripts
ess-ask-for-ess-directory: Customizing startup
ess-default-style: Styles
ess-delete-dump-files: Source Files
ess-directory: Source Directories
ess-dump-filename-template: Source Directories
ess-eldoc-abbreviation-style: ESS ElDoc
ess-eldoc-show-on-symbol: ESS ElDoc
ess-eval-visibly: Evaluating code
ess-execute-in-process-buffer: Hot keys
ess-first-tab-never-complete: Indenting
ess-first-tab-never-complete: Object names
ess-font-lock-mode: Highlighting
ess-function-template: Edit buffer
ess-handy-commands: Handy commands
ess-handy-commands: Handy commands
ess-indent-with-fancy-comments: Indenting
ess-keep-dump-files: Source Files
ess-R-font-lock-keywords: Highlighting
ess-search-list: Source Directories
ess-source-directory: Source Directories
ess-style-alist: Styles
ess-switch-to-end-of-proc-buffer: Other
ess-swv-pdflatex-commands: Sweave and AUCTeX
ess-tab-complete-in-script: Indenting
ess-use-eldoc: ESS ElDoc

I
inferior-ess-program: Customizing startup
inferior-R-font-lock-keywords: Highlighting

R
Rd-indent-level: R documentation files
Rd-mode-hook: R documentation files
Rd-to-help-command: R documentation files

+
Jump to:   A +   +C +   +E +   +I +   +R +   +
+ +
+ +
+

+Previous: , Up: Indices   [Contents][Index]

+
+ +

Concept Index

+
Jump to:   . +   +
+A +   +B +   +C +   +D +   +E +   +F +   +G +   +H +   +I +   +K +   +L +   +M +   +N +   +O +   +P +   +Q +   +R +   +S +   +T +   +U +   +W +   +X +   +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Index Entry  Section

.
.emacs file: Source Directories

A
aborting S commands: Other
arguments to S program: Customizing startup
authors: Credits
auto-complete: Auto-complete
autosaving: Source Files

B
bug reports: Reporting Bugs
bugs: Bugs

C
cleaning up: Hot keys
comint: Credits
command history: Command History
command line arguments: iESS(S)--Inferior ESS processes
command-line completion: Object names
command-line editing: Command-line editing
commands: Entering commands
comments: Source Files
comments in S: Indenting
completion in edit buffer: Other edit buffer commands
completion of object names: Object names
completion on file names: Object names
completion on lists: Object names
completion, when prompted for object names: Edit buffer
creating new objects: Edit buffer
credits: Credits
customization: Customization

D
data frames: Object names
deleting output: Last command
directories: Starting up
dump file directories: Source Directories
dump file names: Source Directories
dump files: Edit buffer
dump files: Source Files

E
echoing commands when evaluating: Evaluating code
edit buffer: Edit buffer
editing commands: Command History
editing functions: Editing objects
editing transcripts: Saving transcripts
ElDoc: ESS ElDoc
emacsclient: Emacsclient
entering commands: Entering commands
errors: Error Checking
ess developer: Namespaced Evaluation
ESS process buffer: Starting up
ESS process directory: Starting up
ESS tracebug: ESS tracebug
ESS-elsewhere: ESS processes on Remote Computers
ess-roxy: Roxygen
evaluating code with echoed commands: Evaluating code
evaluating S expressions: Evaluating code

F
font-lock mode: Highlighting
formatting source code: Indenting

G
graphics: Graphics

H
Handy commands: Handy commands
help files: Help
highlighting: Highlighting
historic backups: Source Files
hot keys: Hot keys

I
icicles: Icicles
IDO completions: Minibuffer completion
indenting: Indenting
installation: Installation
interactive use of S: Introduction
interrupting S commands: Other
introduction: Introduction

K
keyboard short cuts: Hot keys
killing temporary buffers: Hot keys
killing the ESS process: Hot keys

L
lists, completion on: Object names

M
motion in transcript mode: Transcript Mode
multi-line commands, resubmitting: Transcript resubmit
multiple ESS processes: Multiple ESS processes

N
new objects, creating: Edit buffer

O
objects: Hot keys

P
pages in the process buffer: Transcript
paging commands in help buffers: Help
paragraphs in the process buffer: Transcript
parsing errors: Error Checking
process buffer: Starting up
process names: Multiple ESS processes
programming in S: Introduction
project work in S: Source Files

Q
quitting from ESS: Hot keys

R
re-executing commands: Command History
reading long command outputs: Last command
remote Computers: ESS processes on Remote Computers
reverting function definitions: Edit buffer
roxy: Roxygen
Roxygen: Roxygen
running S: Starting up

S
S+elsewhere: ESS processes on Remote Computers
search list: Hot keys
search list: Source Directories
sending input: Entering commands
starting directory: Starting up
starting ESS: Starting up
STERM: Statistical Process running in ESS?

T
tcsh: Object names
temporary buffers: Help
temporary buffers, killing: Hot keys
transcript: Transcript
transcript file: Customizing startup
transcript file names: Saving transcripts
transcript mode motion: Transcript Mode
transcripts of S sessions: Introduction

U
using S interactively: Introduction

W
winjava: winjava
working directory: Starting up
working directory: Source Directories

X
X Windows: X11

+
Jump to:   . +   +
+A +   +B +   +C +   +D +   +E +   +F +   +G +   +H +   +I +   +K +   +L +   +M +   +N +   +O +   +P +   +Q +   +R +   +S +   +T +   +U +   +W +   +X +   +
+ + +
+ + + + + diff -Nru ess-16.10/doc/html/news.html ess-17.11/doc/html/news.html --- ess-16.10/doc/html/news.html 1970-01-01 00:00:00.000000000 +0000 +++ ess-17.11/doc/html/news.html 2017-11-13 14:13:24.000000000 +0000 @@ -0,0 +1,2070 @@ + + + + +ESS – Emacs Speaks Statistics + + + + + + + + + + + + + +

ESS – Emacs Speaks Statistics

+ + + + + + + + + + + + + + + +

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 +
+ + +

Changes and New Features in 15.09: +

    +
  • ESS[R]: The indentation logic has been refactored. +It should be faster, more consistent and more flexible. There are three +types of indentation settings, those starting with ess-offset- +give the actual offsets, those starting with ess-indent- are +control (commonly Boolean) variables, and those starting with +ess-align- are vertical alignment overrides which inhibit default +offsets in specific situations. See ess-style-alist for detailed +description of the new indentation system and provided default +indentation styles. + +
  • ESS[R]: Deprecation of old indentation settings. +As a consequence of the indentation re-factoring +ess-brace-imaginary-offset, ess-expression-offset and all +delimiter-specific offsets are deprecated. The settings for indentation +of continued statements have been replaced by +ess-offset-continuations. It can be set to either cascade +or straight (the default). ess-arg-function-offset has +been replaced by ess-indent-from-lhs and has been generalised to +assignments. This setting now works with both statement blocks and +expressions and only takes effect for offsets set to prev-call +and open-delim in order to produce a consistent indentation. + +
  • ESS: A test framework has been set up. + +
  • ESS[R]: A new RStudio style is provided to mimic as closely +as possible R files indented via RStudio. To reproduce the setup of some +of the RStudio users, the RStudio- style with +ess-offset-arguments set to prev-line is also provided. In +addition, the new RRR+ style is equivalent to RRR except it indents +blocks in function calls relatively to the opening delimiter. This style +does not try to save horizontal space and produces more indentation. + +
  • ESS[R]: Roxygen fields will now be indented on paragraph +refilling in order to make the documentation more readable. You can also +refill commented lines in the examples field without squashing +the surrounding code in the comments. + +
  • ESS[R]: ESS can now format your code! This is controlled +through the settings ess-fill-calls and +ess-fill-continuations. When activated, (fill-paragraph) +formats your calls and your formulas/continuations while making sure +they don’t go past fill-column. Repeated refills cycle through +different styles (see the docstrings for more details). By default, the +refilled region blinks. Set ess-blink-filling to nil to prevent +this. + +
  • ESS[R]: Fix occasional missing error location fontification +in inferior buffers. + +
  • ESS[R]: ess-developer now correctly assigned the environment +of new functions to the package namespace. + + +
  • ESS[Julia]: ?[topic] now works in the *julia* buffer. +Note that support for editing Julia code now depends on +julia-mode.el from the Julia project. If you install ESS from +the official tarball/zip file, julia-mode.el is already included. +Otherwise, if you install ESS by +running make, then the latest version of julia-mode.el is +downloaded (and so you need an active internet connection to install) +during the installation process. Alternatively, if you run ESS without +running make, then ensure that you have the julia-mode.el, +which you can get easily from MELPA for example. + + +
  • iESS: For naming inferior processes, ESS can use projectile’s +project root and it does so when ess-gen-proc-buffer-name-function is +set to ess-gen-proc-buffer-name:projectile-or-simple as by default, +or to another value beginning with ess-gen-proc-buffer-name:projectile-*. + +
+ + +

Changes and New Features in 15.03-1: +

    +
  • ESS[R]: An indentation bug has been fixed (github issue 163) +
  • ESS[R]: On windows, if ‘ess-prefer-higher-bit’ is non-nil (the +default), then R-newest will try to run a 64 bit (rather than 32 bit) +version of R. +
+ +

Changes and New Features in 15.03: +

    +
  • ESS[R]: Full native support for ‘company-mode‘. +
  • ESS[R]: More efficient caching algorithm for R completion. +
  • ESS: New offset variable ‘ess-close-paren-offset‘ to control +the indentation of the closing parentheses. +
  • ESS[R]: Ask for CRAN mirror only once per emacs session. +
  • ESS[R]: Detect library and require calls +for better completion caching. +
  • Buffer display is now customizable (ess-show-buffer-action). +
  • Use y-or-n-p instead of yes-or-no-p throughout. +
  • More support for ODS in ess-sas-graph-view. +
  • Makefiles are now both UNIX and GNU friendly. +
  • ESS[R]: Simplify directory lookup in ess-developer (#137). +
  • Make closed paren indentation consistent +
+ +

Bug Fixes in 15.03: +

    +
  • Fix open brace indentation bug (#27 in ess/R-ESS-bugs.R). +
  • Fix git version lookup +
  • Don’t check directory modtime in R dialect. +
  • Declare all ess macros for edebug. +
  • Add ess-smart-comma to eldoc message functions. +
  • Inform users when retrieving RDA aliases. +
  • Line ending in ’~’ is also a continuation line. +
  • Filing roxy paragraphs works as expected now. +
  • In ess-developer-add-package, remove incorrect ‘wait‘ +argument from ess-get-words-from-vector call. +
  • Fix #96, #117, #120, #125, #134, #137. +
  • Fix ess-quit-r. Call base::q() even if it is masked. +
  • Fix ‘ess-show-buffer‘ to always display the buffer in another window. +
  • Makefile: Fix cd bug for directories with spaces in them +
  • ess-kill-buffer-and-go modified to not restart R +
+ +

Changes / Selected Bug Fixes in 14.09: +

    +
  • ESS[Julia]: Executable is changed to julia. +
  • ESS[Julia]: Completion and help system was adjusted to Julia +v.0.3.0. Julia v.0.2.x is no more supported. +
  • ESS[R]: Running R with gdb debugger now works as expected +
  • iESS: Inferior ESS buffers are now derived from comint-mode +
  • ESS[R]: ess-execute-screen-options uses correct screen +width in terminal sessions +
  • ESS: ess-build-tags-for-directory works when no TAGS file +name was provided +
  • ESS: ess-offset-statement-continued is now respected everywhere +except inside of the if test condition. +
  • ESS: New variable ess-offset-statement-first-continued for +indentation of the first line in multiline statements. +
  • ESSR: Starting , in multiline statements indentation is now +ignored to achieve a more pleasant alignment. +
  • ESSR: Improved behavior of RET in roxygen blocks. +
  • ESS[R]: command cleaning with C-u C-u C-y was broken with +lines containing " + " +
  • ESS[R]: fixed "empty watch window bug" +
  • ESS[R]: don’t ask for help location on ac-quick-help (request of github #81) +
  • ESS[R]: "importClassesFrom" and "importMethodsFrom" were added to +the list of two-parameter roxygen commands +
  • ESS[R]: fix vignetes display and hyperlinks (were broken in 13.09-1) +
  • ESS[Julia]: recognize function names ending with ! +
  • ESS[Julia]: fix indentation of "for" comprehension syntax within brackets. +
+ +

Changes / Selected Bug Fixes in 13.09-1: +

    +
  • ess-remote and TRAMP: R support code is now downloaded in binary form instead +of being injected from local machine. The R code is stored in +~/.config/ESSR/ directory on the remote machine +
  • TRAMP: PAGER environment variable is now correctly set to inferior-ess-pager +
  • retrieval of help topics on remote machines is fixed +
  • org-babel: source references of R code executed from org files correctly point +to source references in original org files (version 8.2.1 or higher of +org-mode is required for this feature) +
  • ess-execute is now bound to C-c C-e C-e in ess-extra-map. +
  • completion works again in ess-execute +
  • ESS[R]: head and tail methods were replaced by htsummary in +ess-R-describe-object-at-point-commands +
  • ESS[roxygen]: evaluation commands now work in roxygen blocks. +Leading comments are automatically removed before the evaluation +
  • ESS[transcript]: ’Clean Region’ now works with multiline statements; + ess-transcript-clean-region etc. correctly treat + multiline statements, i.e., no longer forgets the lines typically + preceded by ’+’ +
  • ESS[SAS]: Three features/fixes with special thanks to Matthew Fidler +https://github.com/emacs-ess/ESS/pulls/mlf176f2. Turn on SAS log mode +when appropriate. Indent comments and CARDS statement more appropriately. +
  • ESS[SAS]: ess-sas-edit-keys-toggle default returns to nil +
  • ESS[R]: support for prettify-symbols-mode: +contribution from Rudiger Sonderfeld https://github.com/emacs-ess/ESS/pull/65 +
  • ESS[SWV]: knitr now evaluates in the current frame +
  • ESS[developer]: ess-developer doesn’t kill open DESCRIPTION files anymore +
  • ESS[roxygen]: ess-roxy-preview-HTML is now on C-c C-o C-w and + ess-roxy-preview-text is now on C-c C-o C-t +
  • ESS: installation with make install was simplified and should work +out of the box on most *nix systems +
  • ESS installation instructions simplified +
  • fixed font-lock bug introduced in 13.09 that was causing very slow process output +
+ +

Changes/New Features in 13.09: +

    +
  • font-lock in process buffers doesn’t "spill" over prompts. +Missing closing string delimiters should not cause wrong fontification +of the following command input. +
  • ESS[julia]: full features M-TAB completion and auto-complete support, +which now works for modules, structures and data types. +
  • ESS[julia]: a much better eldoc showing arguments of +methods and data type constructors +
  • ESS-developer: +
      +
    • - ESS-developer work-flow pattern has been streamlined: + ESS-developer is now automatically activated on per-file basis if the + file is part of a developed package ess-developer-packages. The + old behavior (activation on per-process basis) is still available on + M-x ess-developer in a process buffer. +
    • - integration with devtools package. New command + ess-developer-load-package calls load_all on the package + containing current file. ess-developer-add-package now offers IDO + menu completions with available loading methods, currently + library, and load_all. Loading command can be customized + with ess-developer-load-on-add-commands. +
    +
  • TAB now indents region if region is active +(a contribution of Matthew Fidler in pull #41) +
  • M-x ess-version now reports full loading path +and recognizes git and ELPA versions. +
  • warning and error keyword are now highlighted with +font-lock-warning-face as they should be, (for quite some time +these keywords have been hijacked by compilation mode fontification). +
  • eldoc: Eldoc now recognizes multiple processes. +If current process is busy, or current buffer is not associated with a +process, eldoc picks its completions from the first available free +process. +
  • org-babel: evaluation is now org-friendly +
  • help: new help buffers now try to reuse ess-help buffers. +This behavior is controlled by ess-help-reuse-window custom +variable. +
  • help: ?foo pops IDO menu on multiple help files +(so far it worked only for C-c C-v) +
  • remote evaluation is considerably faster now on slow connections +
  • ESS[R] tracebug R source references regular expressions +are (mostly) language agnostic. +
  • ess-function-call-face inherits from +font-lock-function-name-face rather than font-lock-builtin-face. +
  • ess-inject-source now accepts function-and-buffer option. +
  • Documentation: The “New Features” +section (and NEWS) now represent recent changes: within the last +year or so. All changes can be found in the new news.html (or NEWS and ONEWS). +
  • ESS[R] ess-rep-regexp should no longer inf.loop (rarely!), +and hence M-x ess-fix-miscellaneous should neither. +
+ +

Changes/New Features in 13.05: +

    +
  • ESS[gretl]: Support for gretl (both editing and +sub-process interaction). A contribution of Ahmadou Dicko. +
  • ESS: process output display is 4-10 times faster due to new caching +and only occasional emacs re-display (for the moment this functionality +is available only when ess-tracebug is active). +
  • ESS: C-c ` is now bound to ess-show-traceback and +C-c ~ is bound to ess-show-call-stack. +
  • ESS[R]: ESS stores function in ’ESSR’ environment to +avoid kludging users’ global environment and accidental deletion. +
  • ESS[R]: new variable ess-swv-processing-command to control +weaving and tangling. +
  • ESS[R]: ess-default-style has been changed + (from DEFAULT) to RRR. Use something like + (setq ess-default-style 'DEFAULT) or + (setq ess-indent-level 2) in your ~/.emacs equivalent + before loading ESS, if you do not like this new “incompatible” + default style. +
  • ESS[julia]: ESS stores its functions in ’ESS’ module. +
  • ESS[julia]: Eldoc is now supported in julia modes +
  • ESS[julia]: Adjusted error reference detection and interactive help +to julia internal changes +
  • ESS[R]: ess-use-tracebug’s default has been changed to + t. Set it to nil if you want to keep the previous behavior. +
  • ESS[tracebug]: Electric debug keys have been removed [breaking change] +The functionality was replaced with ess-debug-minor-mode and +ess-debug-minor-mode-map. +
  • ESS[tracebug]: ess-tracebug-map is an alias to + ess-dev-map C-c C-t. +
  • ESS[tracebug]: ess-bp-toggle-state (C-c C-t o) + can now be used during the debug session to toggle breakpoints on the fly + (suggestion by Ross Boylan). +
  • ESS[tracebug]: ess-debug-flag-for-debugging and +ess-debug-unflag-for-debugging work correctly from the debugging + contexts. These commands also recognize non-exported functions for the + packages listed in ess-developer-packages (C-c C-t C-a). + +
  • ESS[R]: Eldoc (activated by ess-use-eldoc) has + become more sophisticated, and hence also more intruding in the interface + between the Statistics softare, e.g., R, and the user. + +

    Note that you can turn off ElDoc, by placing (setq ess-use-eldoc nil) + in your ~/.emacs file, prior to loading ESS, +

    +
  • ESS[SAS]: long over-looked SAS-mode-hook appears! +
  • ESS[SAS]: ess-sas-edit-keys-toggle now defaults to t +since sas-indent-line is still broken, i.e. TAB is now +bound to ess-sas-tab-to-tab-stop by default +
+ + +

Changes/Bug Fixes in 12.09-2: +

    +
  • ESS: new ess-switch-to-end-of-proc-buffer variable that controls + whether C-c C-z switches to the end of process buffer. The + default is t. You can use prefix argument to C-c C-z to + toggle this variable. +
  • ESS: fix in ess-eval-linewise that was causing emacs +to hang during R debugging with ess-eval-visibly equal to +t. +
  • ESS: fix in ess-eval-linewise that was causing emacs to recenter +the prompt in visible window +
  • ESS[tracebug]: A better handling of “Selection” prompts +and debug related singlekey commands. +
  • ESS: fix a bug in ess-switch-process that was causing +*new* selection to fail. +
  • ESS[R]: Solve missing ess-local-process-name bug in R-dired. +
  • ESS[SWV]: ess-swv-PDF doesn’t ask for a command to run if +there is only one command in ess-swv-pdflatex-commands. +
  • ESS[SWV]: ess-swv-weave gained an universal argument to +allow for an interactive choice between available weavers (sweave, +knitr). +
  • ESS: ess-eval-*-and-step functions go to next empty +line at eob, instead of staying at the last line. +
+ + +

Changes/New Features in 12.09-1: +

    +
  • ESS Breaking Changes in Keys: + +
      +
    • - New keymaps: +ess-doc-map bound to C-c C-d; ess-extra-map bound +to C-c C-e; ess-dump-object-into-edit-buffer was moved on +C-c C-e C-d +
    • - roxygen map was moved on C-c C-o and +ess-roxy-update-entry now resides on C-c C-o C-o +
    • - ess-handy-commands is not bound anymore +
    • - ess-dev-map (including ess-tracebug and ess-developer) +moved on C-c C-t +
    • - C-c C-y is deprecated in favor of C-c C-z C-z +
    +
  • ESS[R] new command ess-describe-object-at-point +bound to C-c C-d C-e (repeat C-e or e to cycle). It +was inspired by Erik Iverson’s ess-R-object-tooltip. Customize +ess-describe-at-point-method to use tooltip instead of an +electric buffer. +
  • ESS: New command ess-build-tags-for-directory +bound to C-c C-e C-t for building dialect specific tag +tables. After building tags use M-. to navigate to +function and objects definitions. By default C-c C-e C-t builds +tags based on imenu regular expressions and also include other common +languages .c, .o, .cpp etc. But it relies on external find +and etags commands. If ess-build-tags-command is defined +(for R), the inferior process is asked to build tags instead. +
  • ESS: ess-switch-process offers *new* alternative +to start a new process instead of switching to one of the currently +running processes. +
  • ESS: Switching between processes (C-c C-s) uses buffer names instead +of the internal process names. Use M-x rename-buffer command to +conveniently rename your process buffers. +
  • ESS: Process buffers can be automatically named on process creation +according to user specified scheme. Default schemes are *proc*, +*proc:dir* and *proc:abbr-long-dir* where proc stands for the +internal process name and dir stands for the directory where the +process was started in. The default is *proc*. For customization see +ess-gen-proc-buffer-name-function. +
  • ESS: ess-eval-visibly-p is deprecated in favor of ess-eval-visibly. +
  • ESS: New evaluation pattern nowait. +In addition to old nil and t values, +ess-eval-visibly accepts nowait for a visible evaluation +with no waiting for the process. See ess-eval-visibly for details +on evaluation patterns. +
  • ESS: New “Process” menu entry with process related commands and configuration +
  • iESS: Process buffer is now automatically shown on errors +
  • ESS: New ess-switch-to-inferior-or-script-buffer command bound to C-c C-z +in both script and process buffers. If invoked form process buffer it +switches to the most recent buffer of the same dialect. It is a single +key command. +
  • ESSR-help: On multiple help pages with the same name, C-c C-v +now asks for user resolution directly in emacs. +
  • ESS[R] ess-roxy: new variable ess-roxy-re for fontification +of cases where the number of leading # differs from +ess-roxy-str. +
  • ESS[R] Eldoc was considerably enhanced. +It now finds hidden default S3 methods and displays non-default methods’ +arguments after trailing ||. +
  • ESS[R]: New ess-display-demos command bound to C-c C-d o and C-c C-d C-o +
  • ESS: New ess-help-web-search command bound to C-c C-d w and C-c C-d C-w +to facilitate interactive search of web resources. Implemented for R, +Stata and Julia. See also ess-help-web-search-command. +
  • ESS: ess-pdf-viewer-pref accepts now command line arguments +
  • ESS[Rnw]: Add knitr support. +Customize ess-swv-processor for the default processor. +
  • ESS[Rnw]: More thorough renaming of remaining +noweb-* to ess-noweb-*. +
  • ESS[Rnw] new commands ess-eval-chunk-and-step and ess-eval-chunk +bound to M-n C-c and M-n C-M-x to mirror standard ess +commands in C-c map. +
  • ESS[R] Auto-completion: new variable +ess-ac-R-argument-suffix to customize the insertion of trailing +"=". Defaults to “ = “. +
  • ESS[Julia]: Added index, apropos and web-search to julia. +
  • ESS help: More evaluation commands were added to ess-help mode (C-c C-c, C-M-x etc) +
+ +

Bug Fixes in 12.09-1: +

    +
  • iESShelp: Multiple help pages with the same name are properly handled on C-c C-v +
  • iESSremote: Evaluation with ESS remote no longer freezes emacs. +
  • iESS: comint-previous-prompt C-c C-p no longer stops on secondary prompt “+”. +
  • iESS[R], iESS(Sqpe) [S] on Windows: +The options("editor") is now initialized to emacsclient +instead of the previous gnuclient. The user may need to add the +line (server-start) to the emacs initialization +file. emacsclient has been included with emacs since GNU Emacs +22.1. +
  • ESS[Rnw] Fixed “connection to R” bug (in 12.09 only). +
  • ESS[Rnw] Explicit ess-swv-stangle and ess-swv-sweave +functions. +
  • ESS[Rnw] Fixed completion and smart underscore problems cause by unmatched “\”’ +
  • ESS[R] is more careful with the R code injection. +It now happens only once at the start of the session. +
  • ESS[R]: Fixed auto-scrolling the comint buffer on evaluation. +
  • ESS[Julia]: Solve several indentation and word navigation problems. +
  • ESS[Julia]: Help system works again. +
+ +

Changes/New Features in 12.09: +

+
    +
  • Due to XEmacs lacking some features that ESS requires, ESS support of XEmacs +ends with ESS 12.04-4. This decision will be re-visited in the future as +XEmacs continues to sync with GNU Emacs. + +
  • ESS[R]: On Windows, there is now a new customizable variable +(currently called ess-directory-containing-R) to tell ESS where +to look for the Rterm.exe executables. The name of the variable +and the values it can take are both in beta and subject to change. Prior +to this variable, ESS searched only in the default installation +directory. Setting this variable now tells ESS how to find +Rterm.exe executables when they are installed somewhere else. + +
  • ESS[julia]: new mode +for editing julia code (*.jl). Start with M-x julia. + +

    Full interaction interface, imenu and basic error referencing are available. +

    + +
  • ESS[R] noweb: noweb-mode and noweb-font-lock-mode have +been renamed to ess-noweb-mode and +ess-noweb-font-lock-mode to avoid conflicts with the “real” noweb-mode. + +
  • ESS[R] noweb: The long standing font-lock bug has been solved +in ess-noweb interface. + + +
  • ESS: Basic evaluation keys are now bound to ess-eval-region-*- functions: + +
      +
    • - C-M-x is bound to ess-eval-region-or-function-or-paragraph +
    • - C-c C-c is bound to ess-eval-region-or-function-or-paragraph-and-step +
    • - C-RET is bound to ess-eval-region-or-line-and-step +
    + +

    Each of these functions first evaluates the region whenever the region +is active. +

    +
  • ESS: C-M-a/C-M-e now step to beginning/end of +paragraph if no function has been detected. + +
  • ESS: ess-eval-*-and-step family of functions are now smarter, +and don’t step to end of buffer or end of chunk code (@) when at +the end of the code. + +
  • ESS: ess-handy-commands function is bound to C-c h + +
  • ESS: ESS is now blinking the evaluated region. +Set ess-blink-region to nil to deactivate; ess-blink-delay +gives the duration of the blink. Evaluated region is “blinked” in +highlight face. + +
  • ESS[R-help] New key a for “apropos()” in help buffers. Also available +through C-c h. + +
  • ESS[R-help] All R commands of type foo?bar and foo??bar are recognized +and redirected into appropriate *ESS-help* buffers. + +
  • ESS[R]: New customization interface for font-lock. + +

    ESS font-lock operates with predefined keywords. Default keywords are +listed in ess-R-font-lock-keywords and +inferior-R-font-lock-keywords, which see. The user can easily +customize those by adding new keywords. These variables can also be +interactively accessed and saved through ESS/Font-lock submenu. +

    +

    Several new fontification keywords have been added. Most notably the +keywords for highlighting of function calls, numbers and operators. +

    +
  • ESS[R]: auto-complete is now activated by default whenever +auto-complete package is detected. Set ess-use-auto-complete to +nil to deactivate. +
  • ESS[R]: R AC sources are no longer auto-starting at 0 characters +but at the default ac-auto-start characters. +
  • ESS no longer redefines default ac-sources, +but only appends ac-source-filename to it. +
  • ESS: ac-source-R now concatenates “ = “ to function arguments. + +
  • ESS: Menus for ESS and iESS have been reorganized and enriched with +Tracebug and Developer submenus. + +
  • ESS[R]: ess-developer and ess-tracebug commands are available by default +in ess-dev-map which is bound to C-c d in ESS and iESS maps. + +
  • ESS[R]: eldoc truncates long lines whenever eldoc-echo-area-use-multiline-p +is non-nil (the default). Set this variable to t if you insist on multiline eldoc. +See also ess-eldoc-abbreviation-style. + +
  • ESS[R]: completion code pre-caches arguments +of heavy generics such as plot and print to eliminated the +undesirable delay on first request. + +
  • iESS: Prompts in inferior buffers are now highlighted uniformly with +comint-highlight-prompt face. + +
  • ESS[R]: R process no longer wait for the completion of input in inferior buffer. +Thus, long running commands like Sys.sleep(5) no longer stall emacs. + +
  • ESS: [R, S, Stata, Julia] have specialized ess-X-post-run-hooks, which +are run at the end of subprocess initialization. + +
  • ESS[Stata]: All interactive evaluation commands work as expected. +On-line comments are removed before the evaluation and multiline +comments are skipped on C-c C-c and other interactive commands. + +
  • ESS no longer auto-connects to a subprocess with a different dialect than +the current buffer’s one. + +
  • ESS: ess-arg-function-offset-new-line is now a list for all +the ESS indentation styles, which results in the following indentation +after an open “(”: + +
      a <- some.function(other.function(
    +     arg1,
    +     arg2)
    +
    +
  • ESS[SAS]: Improved MS RTF support for GNU Emacs; try + ess-sas-rtf-portrait and ess-sas-rtf-landscape. +
+ +

Changes/Bug Fixes in 12.04-3: +

    +
  • ESS: basic support for package.el compatibility +
  • ESS[R]: correct indentation of & and | continuation lines +
  • M-x ess-version shows the svn revision even after make install +
  • ESS[SAS]: improved XEmacs support +
  • iESS[R]: better finding of previous prompt +
  • ESS[Stata]: adjusted prompt for mata mode +
  • ESS[R]: resolved name clashes with cl.el +
  • ESS[R]: removed dependence on obsolete package assoc +
  • New make target lisp, to build the lisp-only part, i.e., not building the docs. +
+ +

Changes/New Features in 12.04-1: +

    +
  • iESS[Stata]: New interactive help invocation. +
  • iESS[Stata]: New custom variable inferior-STA-start-file. +
  • iESS[Stata]: inferior-STA-program-name is now “stata” +and can be customized. +
  • ESS[Stata] New sections in stata help files +Syntax(s-S), Remarks(r), Title(t). +
+ +

Bug Fixes in 12.04-1: +

    +
  • ESS[R]: Better ess-tracebug error handling. +
  • ESS[R]: Corrected ess-eldoc help string filtering +and improved argument caching. +
  • ESS[R]: Indentation of non-block if/else/for/while lines fixed. +
  • M-x ess-version should work better. +
  • ESS: Filename completion now again works inside strings. +
  • iESS[Stata]: Fixed prompt detection issue. +
  • ESS[Rd]: R is autostarted also from here, when needed. +
+ +

Changes/New Features in 12.04: +

    +
  • ESS: Reverting new behavior of 12.03, TAB in ess-mode +no longer completes by default. If you want smart TAB completion +in R and S scripts, similarly to iESS behavior, set the variable +ess-tab-complete-in-script to t. Also see +ess-first-tab-never-complete for how to customize where first +TAB is allowed to complete. +
  • ESS: completion is consistently bound to M-TAB (aka M-C-i) +in both Emacs23 and Emacs24. +
  • ESS: The variable ess-arg-function-offset-new-line +introduced in ESS(12.03) now accepts a list with the first element a +number to indicate that the offset should be computed from the indent of +the previous line. For example setting it to ’(2) results in: + +
      a <- some.function(
    +    arg1,
    +    arg2)
    +
    + +
+ +

Changes/New Features in 12.03: +

    +
  • ESS indentation: new offset variable ess-arg-function-offset-new-line +controlling for the indentation of lines immediately following open +’(’. This is useful to shift backwards function arguments after a long +function call expression: + +
      a <- some.function(
    +         arg1,
    +         arg2)
    +
    + +

    instead of the old +

    +
      a <- some.function(
    +                     arg1,
    +                     arg2)
    +
    +

    If ’(’ is not followed by new line the behavior is unchanged: +

    +
      a <- some.function(arg1,
    +                     arg2)
    +
    +

    This variable should be set as part of indentation style lists, or in +ess-mode hook. +

  • ESS[R]: C-c . sets (indentation) style. +
  • ESS: In ESS buffers yank(C-y) command accepts + double argument C-u C-u to paste commands only. It deletes any +lines not beginning with a prompt, and then removes the prompt from +those lines that remain. Useful to paste code from emails, +documentation, inferior ESS buffers or transcript files. +
  • Documentation: ESS user manual has been rearranged and +completed with several new chapters and sections to reflect newly added +features (“Completion”, “Developing with ESS”, “ESS tracebug”, +“ESS developer”, “ESS ElDoc”, “IDO Completion” and “Evaluating +Code”) +
  • RefCard: Reference card was updated to include new features. +
  • Eldoc: Eldoc was rewritten and is activated by default. +See ess-use-eldoc, ess-eldoc-show-on-symbol, +ess-eldoc-abbreviation-style variables for how to change the default +behavior. Note: skeleton-pair-insert-maybe prohibits eldoc +display, on ( insertion. +
  • ESS[R]: Eldoc shows arguments of a generic function whenever found. +
  • ESS: TAB in ess-mode now indents and completes, +if there is nothing to indent. Set +ess-first-tab-never-completes-p to t to make TAB +never complete on first invocation. Completion mechanism is similar to +the completion in the inferior-ess-mode – a filename expansion +is tried, if not found ESS completes the symbol by querying the +process. +
  • ESS for emacs version 24 or higher: ESS is fully compatible with +the emacs 24 completion scheme, i.e. all the completion is done by +completion-at-point. Also in accordance with emacs conventions, +ESS doesn’t bind M-TAB for emacs 24 or higher. M-TAB calls the +default complete-symbol. + +
  • ESS[R]: Out of the box integration with Auto +Completion mode http://cx4a.org/software/auto-complete . Three AC +sources ac-source-R-args, ac-source-R-objects and +ac-source-R are provided. The last one combines the previous two +and makes them play nicely together. Set ess-use-auto-complete to +t to start using it. Refer to documentation string of +ac-use-auto-complete for further information. +
  • ESS[R]: New unified and fast argument completion system, +comprised of ess-funname.start, ess-function-arguments, +ess-get-object-at-point. Eldoc and auto-completion integration +are using this system. +
  • ESS: ess-switch-to-end-of-ESS(C-c C-z), +and ess-switch-to-ESS(C-c C-y): Automatically start the +process whenever needed. +
  • ESS[R]: roxy knows about previewing text version of the +documentation. Bound to C-c C-e t. +
  • ESS[R]: Solved the “nil filename” bug in roxygen support. +
  • ESS[R]: ess-tracebug is now part of ESS: + +

    New Features: +

    +
      +
    • - Source injection: Tracebug now can inject source references on the +fly during code evaluation, i.e. you don’t have to source your file, but +just evaluate your code in normal fashion. Variable +ess-tracebug-inject-source-p controls this behavior - if t, +always inject source reference, if 'function, inject only for +functions (this is the default), if nil, never inject. + +

      During the source injection the value of ess-eval-visibly is +ignored. +

    • - Org-mode support: Visual debugger is now aware of the +temporary org source editing buffer (C-c ') and jumps through this +buffers if still alive, or in original org buffer otherwise. +
    • - New keys in watch mode: ? and d +
    • - Two new hooks: ess-tracebug-enter-hook and ess-tracebug-exit-hook +
    + +
  • ESS[R]: New package ess-developer to evaluate R +code directly in the package environment and namespace. It can be +toggled on and off with C-c d t. When ess-developer is on +all ESS evaluation commands are redefined to evaluate code in +appropriate environments. Add package names to the list of your +development packages with C-d a, and remove with C-d +r. Source the current file with C-d s.Evaluation function which +depend on `ess-eval-region' ask for the package to source the +code into, ess-eval-function and alternatives search for the +function name in the development packages’ environment and namespace and +insert the definition accordingly. See the documentation section +“Developing with ESS/ESS developer” for more details. + +
  • ESS[R] help system: + +

    New Features: +

    +
      +
    • - q quits window instead of calling ess-switch-to-end-of-ESS. +This is consistent with emacs behavior help and other special buffers (breaking change). +
    • - k kills window without asking for the name (pointed by Sam Steingold) +
    • - Help map inherits from special-mode-map as sugested by Sam Steingold. +
    • - Package index: new function ess-display-index bound to +i in help mode map. +
    • - Package vignettes: new function ess-display-vignettes bound to +v in help mode map. +
    • - Display help in HTML browser: new function ess-display-help-in-browser bound to +w in help mode map. It depends on R’s browser +option. +
    • - New custom variable ess-help-pop-to-buffer: if non-nil +ESS help buffers are given focus on display. The default is +t (breaking change). +
    • - New menu entries for the above functions. +
    • - Bogus help buffers are no longer generated by default, i.e. +buffers of the form “No documentation for ’foo’ in specified packages and libraries: +you could try ’??foo’ ”. ess-help-kill-bogus-buffers now defaults to +t. Beware, there may be instances where the default is unsatisfactory +such as debugging and/or during R development. Thanks to Ross Boylan for +making the suggestion, Sam Steingold for reminding us of this variable and +Martin Maechler for the warning. +
    +
  • ESS now uses IDO completing read functionality +for all the interactive requests. It uses ido completion +mechanism whenever available, and falls back on classical +completing-read otherwise. You can set ess-use-ido to nil if you +don’t want the IDO completion. See the documentation string of +ess-use-ido for more information about IDO and ESS +configuration. + +
  • ESS[S]: “,“ is bound to ess-smart-comma: +If comma is invoked at the process marker of an ESS inferior +buffer, request and execute a command from `ess-handy-commands' +list. If ess-R-smart-operators is t `ess-smart-comma +also inserts “ “ after comma. +
  • ESS[S], notably R: Variable `ess-handy-commands' +stores an alist of useful commands which are called by ess-smart-comma in +the inferior buffer. + +

    Currently containing: +

    +
    +
    change-directory
    +

    ess-change-directory +

    +
    help-index
    +

    ess-display-index +

    +
    help-object
    +

    ess-display-help-on-object +

    +
    vignettes
    +

    ess-display-vignettes +

    +
    objects[ls]
    +

    ess-execute-objects +

    +
    search
    +

    ess-execute-search +

    +
    set-width
    +

    ess-execute-screen-options +

    +
    install.packages
    +

    ess-install.packages +

    +
    library
    +

    ess-library +

    +
    setRepos
    +

    ess-setRepositories +

    +
    sos
    +

    ess-sos +

    +
    + +

    Handy commands: ess-library, ess-install.packages, etc - +ask for item with completion and execute the correspond +command. ess-sos is a interface to findFn function in +package sos. If package sos is not found, ask user for +interactive install. +

    +
  • ESS: New dynamic mode line indicator: Process status is automatically +reflected in all mode-lines of associated with the process +buffers. Particularly useful for displaying debug status of +ess-tracebug and developer status of ess-developer in all +associated buffers. + +
  • ESS: New ess-completing-read mechanism: ESS uses +ido completions whenever possible. Variable ess-use-ido +controls whether to use ido completion or not. Active by default. + +
  • ESS now supports comint fields for output and input +detection. This feature is not used by default, but might be useful in +the future. + +
  • ESS[S]: New custom variable inferior-ess-S-prompt to +customize prompt detection regular expression in the inferior ESS +buffers. You can customize this variable to enhance comint navigation +(comint-previous-prompt and comint-next-prompt) the +inferior buffers. + +
  • ESS[R]: Internal R completion retrieval +(ess-R-complete-object-name) was rewritten and is faster now. + +
  • ESS is using process plist to store process specific variables, +as opposed to buffer local variables as it was using before. The use of +buffer local variables to store process variables is discouraged. + +
  • ESS: new functions to manipulate process plists: +ess-process-get and ess-process-set. + +
  • ESS: Internal process waiting mechanism was completely rewritten. ESS +no more relies on prompt regular expressions for the prompt +detection. The only requirement on the primary process prompt is to end +in > . This could be overwritten by setting +inferor-ess-primary-prompt. + +
  • ESS[S], notably R: Saved command history: + ess-history-file now accepts t (default), nil, or a + file name. By setting it to nil no command line history is saved + anymore. ess-history-directory now allows to have the history + all saved in one “central” file. +
  • ESS[R]: more Roxygen improvements. +
  • ESS[R]: C-c . to set (indentation) style. + +
  • ESS[R]: Functions with non-standard names (for example ’aaa-bbb:cc’) are +properly handled by font-lock and evaluation routines. +
  • ESS[R]:Several regexp bugs (described in etc/R-ESS-bugs.el) were +fixed in ess-get-words-from-vector and ess-command. +
+ + +

Changes/New Features in 5.14: +

    +
  • ESS[BUGS/JAGS]: Batch BUGS is back! For recent OpenBUGS +versions, 3.0.8+, a batch BUGS script is once again available, +but for Linux only. Therefore, since it seems that BUGS and JAGS must +co-exist (rather than a transition from BUGS to JAGS), .bug files are +now in ESS[BUGS] mode and .jag files are in ESS[JAGS] mode. ESS[BUGS] now +works like ESS[JAGS] rather than the original mode ESS[BUGS] mode which +was difficult to maintain. Although, ESS[BUGS] appears to work, +there still may be some features missing as well as bugs. + +
  • ESS[R]: New customizable variable ess-swv-plug-into-AUCTeX-p +Commands to Sweave current file and LaTeX the result are now available +to AUCTeX users, if this variable is set to t. + +
  • ESS[S]: C-c C-c +(ess-eval-function-or-paragraph-and-step) is now skipping over +comments as the other paragraph functions do. +It (and similar functions) should no longer wrongly find +‘function()’ beginnings inside comments or strings. + +
  • ESS[SAS]: improved by better support for GNU Emacs +
+ +

Changes/New Features in 5.13: +

    +
  • ESS[R]: On Windows, for R 2.12.0 and later, the Rterm executables + (in subdirectories i386 / x64) now are found as well as for earlier R versions. +
  • ESS[S+]: on Windows, both 32- and 64-bit versions of S+ (“S-PLUS”) + are found now and made available on the menu. +
  • ESS[R]: When prompting for a starting directory, the R version is + (always?) correct now. +
  • ESS[R]: on non-Windows platforms, the use-dialog-box + variable is no longer temporarily changed (to nil for R-x.y.z version + functions and to t for R itself), but rather the user + customization is obeyed. +
  • ESS[R]: more Roxygen improvements. +
  • ‘Rd-preview-help’ now generates preview buffers with navigation +facilities the same as regular help buffers. +
  • ESS: New functions and keys C-c [up] / [down] + for evaluating the buffer “from beginning till here”. +
+ +

Changes/New Features in 5.12: +

    +
  • ESS[SAS] Font-locking: + update of PROCs keywords (up to SAS 9.22); error/warnings. +
  • ESS[R]: Roxygen improvements: S4 classes; + also optionally keep spaces when filling arguments +
  • ESS[Rd]: support new keywords: + section-name \subsection plus a dozen “new” keywords; should match R + 2.12.x now. +
  • ess-display-help-on-object (C-c C-v) + now caches the list of topics, thus speeding up the improvement + feature introduced in 5.9. +
+ +

Changes/New Features in 5.11: +

    +
  • Filename completion within buffers now adds only trailing +characters to complete the filename, rather than expanding to an +absolute file path. This filename completion is bound to the TAB key. + +
  • M-n P in Sweave buffers now prompts for the command to run +instead of using pdflatex unconditionally, offering completion from +customizable collection ess-swv-pdflatex-commands, the first of +which is taken as default and that defaults to texi2pdf. +
  • M-RET is now also bound in S language (R and S+) buffers +to ess-use-this-dir. It sends setwd(..) to the S process +to set the working directory to the one of the source file. +
+ +

Changes/New Features in 5.10: +

    +
  • M-RET in *S* buffers is now bound to +ess-dirs. This function will set Emacs’s current +directory to be the same as the *S* process. This is useful if you use +setwd() within a *S* process. +
+ +

Changes/New Features in 5.9: +

    +
  • Toolbar: The toolbar now has an icon for starting Splus. +
  • Indentation: New documentation and code has been added to make it +easier to change how ESS indents code. In particular, see +ess-default-style, ess-own-style-list and the documention +subsection “Changing indentation styles”. +
  • ess-display-help-on-object (C-c C-v) now offers + completion candidates for help file aliases, in addition to object + names. +
  • Font locking: is now turned on + even without window-system is nil, whenever + ess-font-lock-mode is non-nil, i.e., by default. +
  • ESS script editing: ess-eval-deactivate-mark default is now t, + as suggested by Leo Alekseyev and subsequent “unanimous” ESS-help + discussion. +
  • ESS[R]: Editing support for “#!” (Rscript / littler) editing, + thanks to Jeffrey Arnold. +
  • ESS[R]: Now finds all R versions, both 64-bit and 32-bit, on some + 64-bit Windows machines. Please report back to ess-core success or failure + on your 64-bit Windows machine. +
  • ESS Manual now more visually pleasing; http://ess.r-project.org/Manual/ess.html +
  • ESS[R]: Roxygen on XEmacs no longer font locks for now + (as it required missing features and hence broke ESS startup, there). +
  • ESS[R]: Roxygen has a sub-menu on the [ESS] menu. +
  • ESS[R]: Function ess-rutils-htmldocs in + ess-rutils.el offers an alternative to help.start() for + navigating R documentation, using the browse-url Emacs + function. +
+ +

Changes/New Features in 5.8: +

    +
  • ESS[R]: New ess-rutils.el with utilities for listing, loading, +installing, and updating packages, as well as object manipulation +(listing, viewing, and deleting). It also provides an alternative to +RSiteSearch() that uses the browse-url function, so +results can be viewed in an Emacs web browser. +
  • ESS[R]: much more extensive Roxygen interface, via ess-roxy.el + from Henning Redestig. Ess-roxy supports filling of roxygen fields, + generation and updating roxygen templates, completion of roxygen tags, + basic navigation (marking and moving between entries), folding using + hs-minor-mode and preview of the Rd file. +
  • Emacs lisp files have got better names (partly, for now). +
+ +

Changes/New Features in 5.7: +

    +
  • ESS[R]: loading a source file (C-c C-l) now works in + Windows, similarly to other platforms; + (further; it had accidentally been broken in ESS 5.6 on all platforms) +
+ +

Changes/New Features in 5.6: +

    +
  • ESS[R]: help() calls have to differ from old default, with newer + versions of R; currently via .help.ESS <- function(...) hack. +
+ +

Changes/New Features in 5.4: +

    +
  • ESS[SAS]: The long overdue change +from make-regexp to regexp-opt for font-locking is +complete. The new regexp-opt is now the default since +it is better than the old code in many ways (and especially more +maintainable). However, there are certainly some special +cases missed (bug reports and patches welcome!). +Setting ess-sas-run-regexp-opt to nil will result +in the old code being used. +
  • ESS[BUGS] and ESS[JAGS]: typing = now results in + <-. +
  • ESS[R] function arguments “show” (ess-r-args-show) now + uses the new (tooltip-show-at-point) contributed by Erik Iverson. +
  • Toolbar icons now also work in (beta) Emacs 23. +
  • ESS[S]: New function ess-change-directory for setting both + emacs’ current directory and the directory of an *R* or *S* buffer. +
  • ESS[S] when transient-mark-mode is true, the mark is now kept, + rather than deactivated, thanks to a patch from David Reitter. +
+ +

Changes/New Features in 5.3.11: +

    +
  • ESS[SAS]: work around bug in Emacs 22.2 & 22.3 which fails to + set case-fold fontification automatically. +
  • Rd mode: support new keyword ’Rdversion’ +
  • ESS[R]: now again works with Emacs 21.x +
+ +

Changes/New Features in 5.3.10: +

    +
  • Fixed noweb-mode bug accidentally introduced into 5.3.9 +
  • In noweb-mode, e.g., Rnw-mode, electric “<” also inserts closing “@". + Further, the code chunk boundaries are better kept up-to-date, such that + code[R] <-> text[LaTeX] minor mode switching should happen more reliably. +
  • In noweb-mode, fix a buglet in rare [Enter] or [Tab] behavior; further, + by default disable the former ‘[[’ .. ‘]]’ code-protection-when-filling + behavior which has been found to be buggy. +
+ +

Changes/New Features in 5.3.9: +

    +
  • ESS[SAS]: evince PDF viewer now supported as well; search order: +evince, Xpdf, Adobe/Acrobat Reader +
  • ESS[R]: added support for Roxygen, potentially to be extended. +
  • ESS[S] (and R): inferior (*R*) and transcript modes no longer +fontify language keywords (such as for, in, etc). +
  • iESS[Stata]: Customize the ess-sta-delimiter-friendly setting +to t to convert embedded semi-colons to newlines for Stata processing. +
  • Sweave fix for embedded blanks in PDF reader and PDF files +
  • Several fixes for Major Mode Convention violations in ess-mode +and noweb-mode. +
  • ESS[JAGS]: M-x comment-region now available! +
  • ESS[S] The ess-swv-* commands (and keybindings) are now in +a submenu of the “Noweb” menu, when editing Sweave files. +
+ +

Changes/New Features in 5.3.8: +

    +
  • ESS[JAGS]: more separation from ESS[BUGS] (as much as is currently planned); +now C-c C-c on an empty .jmd creates a template as it should; +symbolic links are created for CODA output so BOA is happy: +from index.txt to .ind and chain#.txt to #.out +
  • ESS[SAS]: buffer-local ess-sas-submit-command and +ess-sas-submit-command-options now recognized by ess-sas-submit-region +
  • ESS[S]: When trying to evaluate code in an S language buffer and + there is no associated process, now start R automatically instead of + signalling an error. Also, restart R if there is an associated process + which is not running. However, do not start R just via the “electric” + ( (ess-r-args-auto-show). +
  • ESS[S]: For (one-line) functions withOUT ’{ .. }’ bodys, the end + of function is now correctly found more often. This notably improves + C-c C-c (ess-eval-function-or-paragraph-and-step). +
  • ESS[JAGS]: cleanup/re-organization of elisp code; +symbolic links for CODA output are now only created by the new +JAGS system command in version 1.0.3; specify whether +this command is available via ess-jags-system; if not +present, then no links are created so that the *shell* +buffer does not become unresponsive during the batch run +
+ +

Changes/New Features in 5.3.7: +

    +
  • ESS: ess-default-style now *is* customizable, i.e., + changing its value in ~/.emacs now does have the desired effect. +
  • ESS: ess-font-lock-mode is a new variable (default: t) +which controls whether font-locking is enabled in ESS buffers. +
  • ESS[R]: for XEmacs on Windows; another tweak to find R versions +
  • ESS[SAS]: font-locking updated for ODS and SAS Bayesian Procedures; +a more consistent handling of SAS options by +ess-sas-submit-command-options which is buffer-local; portable +snooze for MS Windows via customize-able ess-sleep-for (floats welcome); +Xpdf now supported as a PDF viewer +
  • ESS[Rnw]: now also works with “emacs -nw” and Emacs 22. +
  • ESS[JAGS]: now requires JAGS 1.0 (see the new ESS for JAGS help +section for more information): both need work; suggestions welcome +
  • ESS[R]: [TAB] completion now uses the R-internal completion +mechanism (for R >= 2.5.0). +
  • ESS[R] ([S]): interpretation of “_” as assignment has +been removed in ess-continued-statement-p for R and S. +
  • several internal code cleanups. +
  • ESS[R]: An experimental version of a new command Rgui +on MS Windows to send lines directly from emacs +to Rgui is available in file lisp/essd-rgui.el. +Preliminary documentation is in file doc/rgui-doc.txt. +
+ +

Changes/New Features in 5.3.6: +

    +
  • ESS: for XEmacs, using “gnuclient” (without a “-q”) works for + things like fix() after M-x gnuserv-start has been done. +
  • ESS[R]: M-x R-newest should now work in more situations on MS + Windows, e.g., when R has been installed in a non-default "ProgramFiles" + directory tree. In these cases, there’s no need to specify the name (and + full path) of the R program anymore. +
  • ESS[R]: For XEmacs, startup (with new tooltip code) works again. +
+ +

Changes/New Features in 5.3.5: +

    +
  • ESS[R] a new defun is available, M-x R-newest, which will start +the newest version of R that it can find on your system. +
  • ESS[R] add Sven Hartenstein’s “R function arguments tips” + functionality, via new file ../lisp/essd-r-args.el. + Note that this includes an “electric "("” behavior inside R-mode + which is active by default and can be customized via + ess-r-args-electric-paren; i.e., use (setq + ess-r-args-electric-paren nil) to turn it off. Further, + ess-r-args-show-as allows to switch to the “tooltip” mode. +
  • ESS: functions ess-get-pdf-viewer and *-ps-viewer; built on new + customizable variables ess-pdf-viewer-pref and + ess-ps-viewer-pref; currently used in ess-swv-PDF and + *-PS. +
  • ESS[R] Improved ess-swv-PDF to run pdf viewer only if + pdflatex was ok +
  • ESS[R] Improved ess-swv-weave to start R automatically if + none is running. +
  • ESS: Do no longer ask which ESS process to use if there + is only one. +
+ +

Changes/New Features in 5.3.4: +

    +
  • ESS[R] now better work with options(error=recover); and the +new default of CHM help files on windows. +
  • ESS[R] some more cleanup in the “sweave” functions +
  • miscellaneous fixes +
+ +

Changes/New Features in 5.3.3: +

    +
  • ESS[S] fix buglet (5.3.2 only) which left command prompt in +“execute buffer” and hence help files. +
  • new customizable variable ess-display-buffer-reuse-frames +set to true (which changes default behavior) such that execution or +help *frames* are reused. +
+ +

Changes/New Features in 5.3.2: +

    +
  • Classic BUGS now supported by (require 'essd-bugs) with ESS[BUGS] + and JAGS by (require 'essd-jags) with ESS[JAGS]. But, only one + of them can be used at a time since they don’t play nice together. Also, + C-c C-c is now bound to the function ess-bugs-next-action + (F12 has been retired). And finally, note that essl-bug.el + is deprecated and the replacement is essl-bugs.el. +
  • ESS[R] Improved some of the “Sweave-make” + functions (yet scarcely documented) in ess-swv.el. +
  • ESS[S] No longer mess with .Last.value (nor in other “languages”). +
+ +

Changes/New Features in 5.3.1: +

    +
  • See the docs for 2 ways to install ESS for XEmacs +
      +
    1. by uncommenting the XEmacs part of + Section 1 of Makeconf and performing make install +
    2. by unpacking either + ess-5.3.1.tgz or ess-5.3.1.zip into + PREFIX/lib/xemacs/site-packages on unix or + PREFIX\XEmacs\site-packages on windows +
    +
  • ESS[R]: fixed bugs so that Rterm.exe can be found by XEmacs +
  • ESS[S]: ess-toggle-S-assign-key is slightly changed; in + particular, the default ess-assign-key is now C-x =. +
  • ESS[R]: M-x R-site-search is a new (slightly experimental) + utility similar to R’s RSiteSearch(..) but with the advantage of + using Emacs’ preferred browser, see browse-url-browser-function +
+ +

Changes/New Features in 5.3.0: +

    +
  • ESS[BUGS]: sanely re-format statistical output, .bog, +from scientific notation to numbers rounded with 4 decimal places +with M-x ess-bugs-sci-round-to-4-dp. +
  • The keys for navigating among section headings in help buffers +worked, but only for one language per session; they should now work for +multiple languages. (They were also broken on Windows machines.) +
  • ESS[S] long standing buglets in the internal logic for loading +lisp code on Windows. Particularly fixed behavior in help mode with S-plus +GUI. +
  • New variable, ess-use-inferior-program-name-in-buffer-name, +which enables using the executable name instead of the dialect name for +R. Feature request. +
  • ESS[S] ess-execute-screen-options +now also works correctly when there is more than one window *side-by-side* +in the same frame and runs in the correct buffer also when there is more +than one S buffer. +
  • iESS[S] new functions ess-eval-paragraph-and-step and + ess-eval-function-or-paragraph-and-step are bound to keys + C-c C-p and C-c C-c respectively and to the menu in + ESS-mode; also bound in the help mode (for evaluating examples). +
  • ESS[S] new function ess-toggle-S-assign-key allows to +assign the “ <- ” insertion to an arbitrary key. +
+ +

Changes/New Features in 5.2.12: +

    +
  • ESS[SAS]: M-; fixed, but the XEmacs function comment-dwim +may be broken, if so, use M-x comment-region and M-x +uncomment-region instead; only valid PROCs are fontified which is very +helpful finding syntax errors (currently supported: BASE, ETS, FSP, GRAPH, +IML, INSIGHT and STAT); the “feature” where F-keys take you to an +empty buffer when the requested destination is a file that does not exist +has been fixed, now the request results in a no-op. +Further, sas-mode now also works in simple terminals. +
  • Rterm/Cygwin combination works under Microsoft Windows. +
  • ESS[R]: internal calls use baseenv() instead of NULL and +define ’baseenv’ where needed. +
  • New experimental support for installing ESS. See the file +lisp/ess-install.el. +
+ +

Changes/New Features in 5.2.11: +

    +
  • ESS Info entry and dir handled more effectively for GNU Emacs users +
  • ESS[SAS]: temporary files created for batch submission of a +region are now named based on the current file; see ess-sas-file-root +for details; all lag and dif functions now fontified correctly +
  • iESS[SAS]: fixed a few nagging bugs, however, still does not appear to +work at this time; please let us know if you have any ideas. +
  • ESS[S]: Support for running other versions of Splus has been +added for unix. Two new variables, ess-s-versions and +ess-s-versions-list, are used to tell ESS what other versions of +Splus you would like to run. +
+ +

Changes/New Features in 5.2.10: +

    +
  • ESS[R]: ess-r-versions can no longer be customized (since the +customization was not taking effect unless customizations were loaded +before ESS). Its value has been changed so that it will also find R +executables beginning “R-devel” and “R-patched”. If you wish to +change this variable, it must be set in your .emacs before ESS is +loaded. +
  • Installation with GNU Make enhanced: unix and unix-like +operating systems will now be able to install ESS for all +users in either a GNU Emacs site-lisp or an XEmacs package +configuration by editing lisp/ess-site.el and Makeconf +accordingly, then issuing make install +
  • ESS[S]: Filename completion (inside strings) now also works in +XEmacs for R and S-plus. +
+ +

Changes/New Features in 5.2.9: +

    +
  • ESS[R] for Windows: the \ directory character bug +with respect to ess-load-file has been eradicated. +
  • iESS[SAS]: C-c C-r and C-c C-b once again +work as intended and documented. +
  • ESS[S]: M-x ess-fix-EQ-assign is a bit more agressive. +
  • ESS[S]: Imenu now also shows setAs(), etc. +
  • ESS[R]: R function pattern enhanced with underlying code such that + M-C-a (ess-beginning-of-function) etc now work for many more + cases, including S4 method definitions. +
  • iESS[R]: myOwnhelp(1) no longer wrongly triggers help(1). +
  • ESS[R]: Improved detection of bogus help buffers: valid help + buffers containing with the string “no documentation”(e.g. contour) + were being treated as bogus. +
  • ESS[R]: In R help buffers, if options("help.try.all.packages" = + TRUE) then ?rlm will list which packages rlm is defined in. This help + buffer is not bogus, but instead is now relabelled “*help[R](rlm in + packages)*”. +
  • ESS[STA]: add “//” as comment starting character to syntax-table. +
+ +

Changes/New Features in 5.2.8: +

    +
  • iESS: [Tab] completes file names “inside string” as in +earlier (<= 5.2.3) ESS versions. +
+ +

Changes/New Features in 5.2.7: +

    +
  • If you use Custom to change the variable ess-toolbar-items, +the new toolbar is used in all subsequent ESS buffers. +
  • ESS[SAS]: new feature: if ess-sas-log-max >0 and +your .log grows to more than ess-sas-log-max bytes, just +the first ess-sas-log-max bytes are refreshed; this is helpful when your .sas program +generates lots of error messages and gets too big for emacs to display +
  • ESS[R/S]: M-; in R/S editing modes will now indent with +either one or two hashes depending on context. +
  • ESS[R]: David Whiting’s Sweave extensions (to ’noweb’) +are now available (from ess-swv.el loaded by default). +
+ +

Changes/New Features in 5.2.6: +

    +
  • Removed non-ASCII characters in a few files. +
  • ESS[R]: now works better when UTF-8 locale is active; in + particular, you get correct directional quotes in R’s startup message + for R-devel (unstable development version of R 2.1.0) when using + environment variables LANGUAGE=en@quot LC_ALL=en_US.UTF-8 +
  • ESS[SAS]: toggling of .log mode improved (F10); toggling of +.lst mode now also available (C-F10); killing all buffers associated +with .sas program no longer bound to C-F10 since its a bit overzealous. +
  • S-Plus 7 for Windows is now recognized. +
  • ESS[S] (incl. R): in auto-fill mode, strings are not wrapped anymore. +
  • ESS[S] (incl. R): font-lock now correctly differs between R and S, +e.g., for "_"; both now fontify warning(.) and S does terminate() additionally. +
  • Support for ‘bell’ aka ‘beep’ aka ‘ding’ aka ‘alarm’ in all inferior +modes: When \a is output “to the the console” at the beginning of a line, +the bell is rung. +
+ +

Changes/New Features in 5.2.5: +

    +
  • ESS[R]: C-c C-q or ‘Quit S’ from the menu now should work +(again and less klunkily) and do not append ‘-exited’ to the +buffer name. Further, the behavior of (ess-cleanup), called from +ess-quit, now depends on the new customizable variable +ess-S-quit-kill-buffers-p which defaults to nil. +Consequently, the question “Delete all buffers associated +with ..?” will not be asked anymore by default. +
  • ESS[SAS] – ess-ebcdic-to-ascii-search-and-replace will now work +with the recode application as well which is available on many platforms +
  • ESS[S] (incl. R): Name completion for slots of S4 objects now works! +
+ +

Changes/New Features in 5.2.4: +

    +
  • The documentation now includes an overview of how to use the emacs +TAGS facility for S functions. (The distribution also used to contain a +directory etc/other/Tags where a ~1990 version of etags.c was +distributed; this is no longer relevant and so has been deleted.) +
  • ESS[SAS] – When you are working with EBCDIC files on an ASCII +platform, .log NOTEs may display as gibberish since the EBCDIC +characters are not converted to ASCII prior to their display. So, +the function ess-ebcdic-to-ascii-search-and-replace is provided for +convenience and is bound to C-F11. This function requires the +dd command (only available on unix or unix-like platforms). +
  • ESS: Completion of object names is now always done dynamically rather +than allowing the option of using a pre-computed database (by +ess-create-object-name-db) since modern computers seem fast +enough for dynamic completion. (We expect few users, if any, have +been using the pre-computed database method.) +
  • ESS: object completion in iESS buffers running on Windows was +very slow (for GNU Emacs, but not XEmacs) and has now been fixed. +Further, it was more or less broken for all versions of S-plus 6.x, +and has been fixed to work everywhere but with the Windows’ GUI of +S-plus. The list of objects now shows unique names also when an +object appears more than once in the search path. +
  • ESS[R]: Completion of object names now also includes those +starting with “.”. +
+ +

Changes/New Features in 5.2.3: +

    +
  • ESS: When new inferior ESS processes are created, by default they +will replace the current buffer (this restores behavior from pre +5.2.0). If you wish new ESS processes to start in another window of the +current frame, set inferior-ess-same-window to nil. +
  • New variables inferior-Splus-args and inferior-R-args provide a +way to pass command line arguments to starting S and R processes. +
+ +

Changes/New Features in 5.2.2: +

    +
  • bug-fixes for 5.2.1 (require ’executable), html docs, etc. +
  • ess-lisp-directory/../doc/info added to Info-directory-list +if ess-info not found by info +
  • ESS[R]: If you have other versions of R on your +exec-path, such as "R-1.8.1" with Unix or "rw1081" with Windows, +ESS will find them and create appropriate functions, such as +M-x R-1.8.1 or M-x rw1081, for calling them. +By default only Unix programs beginning "R-1" and +"R-2" and Windows programs parallel to the +version of R in your exec-path will be found, +but see ess-r-versions and ess-rterm-versions for ways to find other +versions of R. +
  • ESS[R]: Other versions of R, such as "R-1.8.1" on Unix and "rw1081" on +Windows, are added to the +"ESS / Start Process / Other" menu. +
  • ESS[S]: If you have other versions of S-Plus on your Windows computer, +such as S-Plus 6.1 or S-Plus 4.5, ESS will find them and create appropriate +functions, such as M-x splus61, for calling the console version (Sqpe) +inside an emacs buffer. By default only +programs installed in the default location will be found, but see +ess-SHOME-versions for ways to find other versions of S-Plus. +
  • ESS[S]: Other versions of Sqpe on Windows, such as "splus61", +are added to the +"ESS / Start Process / Other" menu. +
  • ESS[R]: (bug fix) ess-quit (bound to C-c C-q) should now quit the +inferior R process, when issued from either the inferior buffer, or from +a .R buffer. +
+ +

Changes/New Features in 5.2.1: +

    +
  • ESS[S] (R and S-plus): now have toolbar support +with icons to evaluate code in the inferior process or to switch +there. This code is experimental and likely to change as XEmacs/Emacs +issues get resolved. The toolbar should be enabled if your Emacs +displays images, but can be disabled with the variable ess-use-toolbar. +Thanks to David Smith from Insightful for the S-plus logo. +
  • ESS[SAS]: ess-sas-graph-view (F12) enhanced; you can specify +external file viewers for each graphics file type via the alist +ess-sas-graph-view-viewer-alist; also .jpg/.gif are now handled +by image-mode on XEmacs, if available, otherwise by graphics +primitives as before +
+ +

Changes/New Features in 5.2.0: +

    +
  • ESS[BUGS]: new info documentation! now supports interactive +processing thanks to Aki Vehtari; +new architecture-independent unix support as well as support for BUGS v. 0.5 +
  • ESS[SAS]: convert .log to .sas with ess-sas-transcript; +info documentation improved; Local Variable bug fixes; +SAS/IML statements/functions now highlighted; files edited +remotely by ange-ftp/EFS/tramp are recognized and pressing +SUBMIT opens a buffer on the remote host via the local variable +ess-sas-shell-buffer-remote-init which defaults to "ssh"; +changed the definition of the variable ess-sas-edit-keys-toggle +to boolean rather than 0/1; added the function ess-electric-run-semicolon +which automatically reverse indents lines containing only "run;"; +C-F1 creates MS RTF portrait from the current buffer; +C-F2 creates MS RTF landscape from the current buffer; +C-F9 opens a SAS DATASET with PROC INSIGHT rather than PROC FSVIEW; +"inferior" aliases for SAS batch: C-c C-r for submit region, +C-c C-b for submit buffer, C-c C-x for goto .log; C-c C-y for goto .lst +
  • ESS[S]: Pressing underscore ("_") once inserts " <- " (as before); +pressing underscore twice inserts a literal underscore. To stop this +smart behaviour, add "(ess-toggle-underscore nil)" to your .emacs after +ess-site has been loaded; +ess-dump-filename-template-proto (new name!) now can be +customized successfully (for S language dialects); +Support for Imenu has been improved; set ess-imenu-use-S to non-nil to +get an "Imenu-S" item on your menubar; +ess-help: Now using nice underlines (instead of ‘nuke-* ^H_’) +
  • ESS[R]: After (require ’essa-r), M-x ess-r-var allows to load +numbers from any Emacs buffer into an existing *R* process; +M-x ess-rdired gives a “directory editor” of R objects; +fixed ess-retr-lastvalue-command, i.e. .Last.value bug +(thanks to David Brahm) +
  • ESS: Support for creating new window frames has been added to +ESS. Inferior ESS processes can be created in dedicated frames by +setting inferior-ess-own-frame to t. ESS help buffers can also open in +new frames; see the documentation for ess-help-own-frame for details. +(Thanks to Kevin Rodgers for contributing code.) +
+ +

Changes/New Features in 5.1.24: +

    +
  • The version number is now correct even inside ESS/Emacs +
+ +

Changes/New Features in 5.1.23: +

    +
  • Minor more Makefile clean up. +
+ +

Changes/New Features in 5.1.22: +

    +
  • Besides info documentation, PDF and HTML +documentation are also provided (instead of built using "make") and available +on the web as well; see ESS web page and StatLib +
  • Now that info documentation is available, the +README.* files are no longer supported. However, they +are still distributed for what it’s worth. +
  • ESS is now an XEmacs package! See +XEmacs Installation HOWTO +for details (specifically, items 10-15). +
  • ESS[SAS]: more user-friendly enhancements for remote +SAS batch jobs with Kermit file transfers (LOG and OUTPUT +function key features now supported). Multiple shells +now supported so you can run SAS on different computers +from different buffers by setting the buffer-local variable +ess-sas-shell-buffer to unique buffer names. +
  • Major re-vamping of Makefile/Makeconf. +
+ +

Changes/New Features in 5.1.21: +

    +
  • ESS[SAS]: info documentation now available!, see +ESS->Help for SAS; F12 opens GSASFILE nearest point for viewing +either within emacs, when available, or via an external viewer; +more syntax highlighting keywords; more enhancements for remote +SAS batch jobs with Kermit; new framework for remote SAS interactive +jobs, see ess-remote +
  • ESS[S]: info documentation now available!, see +ESS->Help for the S family +
  • Makefile: tag now independent of rel; info files +made by doc/Makefile and installed in new info sub-directory +
+ +

Changes/New Features in 5.1.20: +

    +
  • New ‘options()$STERM’ in the S dialects (S, S-Plus, R). +The S program can determine the environment in which it is +currently running. ESS sets the option to ‘iESS’ or ‘ddeESS’ +when it starts an S language process. We recommend other specific +values for S language processes that ESS does not start. +
  • New ‘ess-mouse-me’ function, assigned to S-mouse-3 by default. +User may click on a word or region and then choose from the +menu to display the item, or a summary, or a plot, etc. +This feature is still under development. +
  • GNU Emacs 21.1 is now supported (fixed for S dialects, SAS & BUGS), +(some from Stephen Eglen). +
  • XEmacs 21.x is now supported (fixed w32-using-nt bug) +
  • XEmacs on Win (NT) is better supported. +
  • Workaround for bug in Sqpe+6 (S-PLUS 6 for Win). +
  • should now work even when imenu is not available (for old XEmacsen). +
  • ESS[SAS]: XEmacs-Imenu fix; C-TAB is globalized along with your +function-key definitions, if specified; you can specify your SAS +library definitions outside of autoexec.sas for ess-sas-data-view +with SAS code placed in the variable ess-sas-data-view-libname, +also the dataset name is defaulted to the nearest permanent dataset +to point; Speedbar support now works for permanent datasets, please +ignore first./last.; new font-locking is now the default with more +improvements for font-locking PROCs, macro statements, * ; and %* ; +comments; you can toggle sas-log-mode with F10 which will font-lock +your .log (if it isn’t too big); submit remote .sas files accessed +with ange-ftp, EFS or Tramp (Kermit is experimental) by setting +ess-sas-submit-method to ’sh; ess-sas-submit-command and +ess-sas-submit-command-options are buffer-local so you can have +local file variable sections at the end of your .sas files to +request different executables or specify special options and the +local file variables are re-read at submit instead of only at file +open so that if you make a change it is picked up immediately; +
  • ESS[BUGS]: font-lock with ‘in’ fixed. +
  • for STATA: font-lock bug fixed. +
  • for Rd mode: C-c C-v and ‘switch-process’ in menu. +further, C-c C-f prefix (Rd-font) for inserting or surrounding a word +by things such as \code{.}, \code{\link{.}}, \emph{.} etc. +
  • new functions (ess-directory-function) and (ess-narrow-to-defun) +ess-directory <-> default-directory logic (Jeff Mincy). +
  • Re-organized Makefile and fixed a few bugs. +
+ +

Changes/New Features in 5.1.19: +

    +
  • S+6 now supported (Tony Rossini (Unix) and Rich Heiberger (Windows)) +
  • New BUGS support through ESS[BUGS] mode (Rodney Sparapani) +Templates assist you in writing .bug and .cmd code (.cmd and .log +are replaced by .bmd and .bog to avoid emacs extension collisions). +Substitution" parameters facilitate "automagic" generation of +data...in" and "init...in" filenames, "const N=" from your data +file and "monitor()/stats()" commands. Activated by pressing F12. +
  • Fixes for ‘ess-smart-underscore’ SAS breakage (Rich Heiberger) +
  • You can change between PC and Unix, local and global SAS function-key +definitions interactively (Rich Heiberger) +
  • C-Submit a highlighted region to SAS batch (Rodney Sparapani) +
  • New and improved SAS syntax highlighting (Rodney Sparapani) +To get the new functionality, set ess-sas-run-make-regexp to nil. +Also available in .log files via F10. +
  • Open a permanent SAS dataset for viewing via F9 (Rodney Sparapani) +You must have the library defined in autoexec.sas for it to work. +
  • User-friendly defaults for ‘sas-program’, ‘ess-sas-batch-pre-command’ +and ‘ess-sas-batch-post-command’ as well Customize support for these +and other ESS[SAS] variables (Rodney Sparapani) +
  • ‘ess-sas-suffix-2’ now defaults to .dat via F11 (Rodney Sparapani) +
  • Emacs/XEmacs, Unix/Windows issues collectively handled in ess-emcs.el +
  • defadvice solves problem of missing *ESS* (thanks to Jeff Mincy) +
  • Improved manual a bit by including things that were only in ‘README’. +
+ +

Changes/New Features in 5.1.18: +

    +
  • New ‘ess-smart-underscore’ function, now assigned to "_" by default. +Inserts ‘ess-S-assign’ (customizable " <- "), unless inside string +and comments where plain "_" is used instead. (MM) +
  • Fixes for longstanding interactive SAS breakage (RMH) +
+ +

Changes/New Features in 5.1.17: +

    +
  • Documentation for Windows Installation (Rich Heiberger) +
  • removal of ess-vars, finalization of customize support (in the +sense that there is no more use of ess-vars, but that we need to +fix ess-cust) (AJ Rossini) +
  • Many small (and large) fixes/contributions (MMaechler) +
  • addition of the "S-equal" variable and provide M-x ess-add-MM-keys +a way to remap "_" to ‘ess-S-assign’, typically " <- ", but +customizable. (MMaechler) +
+ +

Changes/New Features in 5.1.16: +

    +
  • BUG FIXES +
  • Better SAS support +
+ +

Changes/New Features in 5.1.15: +

    +
  • BUG FIXES +
+ +

Changes/New Features in 5.1.14: +

    +
  • Yet more fixes to SAS mode, (Rich Heiberger and Rodney Sparapani) +
  • Customize support (for most Emacsen which support it) (AJRossini) +
  • ARC and ViSta support out of the box, and fixes for XLispStat (AJRossini) +
+ +

Changes/New Features in 5.1.13: +

    +
  • Version numbering finally all depending on the ./VERSION file, +thanks to Martin Maechler. +
  • Yet more fixes to SAS mode, thanks to Rich Heiberger. +
+ +

Changes/New Features in 5.1.12: +

    +
  • Splus 5.1 stabilized, thanks to Martin Maechler, Bill Venables, +Chuck Taylor, and others. +
  • More fixes to SAS mode, thanks to Rodney Sparapani +and Rich Heiberger. +
+ +

Changes/New Features in 5.1.11: +

    +
  • More fixes to Stata mode, thanks to +Brendan Halpin. +
  • fixed bugs in ESS-elsewhere, thanks to many testers +
  • README.SPLUS4WIN has DETAILED instructions for S-PLUS 2000, thanks +to David Brahm. +
  • Fixes to SAS mode, thanks to Rodney Sparapani +
+ +

Changes/New Features in 5.1.10: +

    +
  • More fixes to Stata mode +
  • primitive generic version of ESS-elsewhere +
  • Small fixes to SAS/Stata. +
+ +

Changes/New Features in 5.1.9: +

    +
  • Stata mode works +
  • Literate Data Analysis using Noweb works +
+ +

Changes/New Features in 5.1.8: +

    +
  • Bug fixes +
  • R documentation mode defaults changed +
+ +

Changes/New Features in 5.1.2: +

    +
  • able to use inferior iESS mode to +communicate directly with a running S-Plus 4.x process using the +Microsoft DDE protocol. We use the familiar (from Unix ESS) C-c C-n +and related key sequences to send lines from the S-mode file to the +inferior S process. We continue to edit S input files in ESS[S] mode +and transcripts of previous S sessions in ESS Transcript mode. All +three modes know the S language, syntax, and indentation patterns and +provide the syntactic highlighting that eases the programming tasks. +
+ + + + + + + diff -Nru ess-16.10/doc/html/readme.html ess-17.11/doc/html/readme.html --- ess-16.10/doc/html/readme.html 1970-01-01 00:00:00.000000000 +0000 +++ ess-17.11/doc/html/readme.html 2017-11-13 14:13:23.000000000 +0000 @@ -0,0 +1,1647 @@ + + + + +ESS - Emacs Speaks Statistics + + + + + + + + + + + + + + +

ESS - Emacs Speaks Statistics

+ + + + + + + + + + + + + + + + +
+

+  

+
+ +

1 General Information: README

+ + +

This is the README file for the distribution of ESS version +17.11 +

+

ESS is a GNU Emacs and XEmacs mode for interactive statistical +programming and data analysis. Languages supported: the S family (S, +S-PLUS and R), SAS, BUGS/JAGS and Stata. ESS grew out of the +desire for bug fixes and extensions to S-mode and SAS-mode as well as a +consistent union of their features in one package. +

+

Installation instructions are provided in sections for both Unix and +Windows; see below. +

+

The current development team is led by Martin Maechler since August +2004. Former project leader A.J. (Tony) Rossini +(rossini@blindglobe.net) did the initial port to XEmacs and has +been the primary coder. Martin Maechler +(maechler@stat.math.ethz.ch) and Kurt Hornik +(Kurt.Hornik@R-project.org) have assisted with the S family and +XLispStat. Stephen Eglen (stephen@gnu.org) has worked mostly +on R support. Richard M. Heiberger (rmh@temple.edu) has +assisted with S/S-PLUS development for Windows. Richard and Rodney +A. Sparapani (rsparapa@mcw.edu) have done much of the work +improving SAS batch and interactive support. Rodney has also +extended ESS to support BUGS/JAGS and has an interest in improving +Stata support. +

+

We are grateful to the previous developers of S-mode (Doug Bates, Ed Kademan, +Frank Ritter, David M. Smith), SAS-mode (Tom Cook) and Stata-mode (Thomas +Lumley). +

+ + + + + + + + + + + + + + + +
+ +
+

+Next: , Previous: , Up: General Information  

+
+ +

1.1 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. +

+
+ +
+

+Next: , Previous: , Up: General Information  

+
+ +

1.2 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! +

+ +
+ +
+

+Next: , Previous: , Up: General Information  

+
+ +

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). +

+ + + + + + +
+ +
+

+Next: , Previous: , Up: General Information  

+
+ +

1.4 Getting the Latest Version

+ +

The latest released version of ESS is always available on the web at: +ESS web page or +StatLib +

+ + +

1.4.1 Git for ESS development

+

For development and experimentation on new ESS features, there is now a +GitHub branch for ESS, available at https://github.com/emacs-ess/ESS. +

+ + + +
+ +
+

+Next: , Previous: , Up: General Information  

+
+ +

1.5 Installation

+ +
    +
  1. Download the latest zip or tgz archive from ESS +downloads +area and unpack it into a directory where you would like ESS to +reside. We will denote this directory as /path/to/ESS/ hereafter. + +

    Alternatively you can use git to fetch the most +recent development version to your local machine with: +

    +
    +
    git clone https://github.com/emacs-ess/ESS.git /path/to/ESS
    +
    + +
  2. Optionally, compile elisp files and build the documentation with: +
    +
    cd /path/to/ESS/
    +make
    +
    +

    Without this step, info, pdf and html documentation and reference card +will not be available. +

    +
  3. Optionally, install into your local machine with +make install. You might need administrative privileges: + +
    +
    make install
    +
    + +

    The files are installed into /usr/share/emacs directory. For this step to +run correctly on macOS, you will need to adjust the PREFIX +path in Makeconf. The necessary code and instructions are +commented in that file. +

    +
  4. If you have performed the make install step from above, just add + +
    +
    (require 'ess-site)
    +
    + +

    to your ~/.emacs file. Otherwise, you should add +/path/to/ESS/lisp/ to your emacs load path and then load ESS with +the following lines in your ~/.emacs: +

    +
    +
    (add-to-list 'load-path "/path/to/ESS/lisp/")
    +(load "ess-site")
    +
    + +
  5. Restart your Emacs and check that ESS was loaded from a correct +location with M-x ess-version. +
+ +

Note for Windows and macOS users: The most straightforward +way to install Emacs on your machine is by downloading +the Emacs binary by Vincent Goulet; either +Emacs Modified for macOS +or from +Emacs Modified for Windows. +

+ +

Note for XEmacs users: Due to XEmacs lacking some features +that ESS requires, ESS support of XEmacs ends with ESS 12.04-4. This +decision will be re-visited in the future as XEmacs continues to sync +with GNU Emacs. +

+ +
+ +
+

+Next: , Previous: , Up: General Information  

+
+ +

1.6 Starting an ESS process

+

To start an S session on Unix or on Windows when you +use the Cygwin bash shell, simply type M-x S RET. +

+

To start an S session on Windows when you +use the MSDOS prompt shell, simply type M-x S+6-msdos RET. +

+
+ +
+

+Next: , Previous: , Up: General Information  

+
+ +

1.7 Current Features

+ +
    +
  • Languages Supported: +
      +
    • S family (R and S+ AKA S-PLUS) +
    • SAS +
    • OpenBUGS/JAGS +
    • Stata +
    • Julia +
    +
  • Editing source code (S family, SAS, OpenBUGS/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, OpenBUGS/JAGS) +
    • Use of imenu to provide links to appropriate functions +
    +
  • Interacting with the process (S family, SAS, Stata, Julia) +
      +
    • Command-line editing +
    • Searchable Command history +
    • Command-line completion of S 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 +
    +
+ + +
+ +
+

+Next: , Previous: , Up: General Information  

+
+ +

1.8 New Features

+ + +

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 +
+ + +

Changes and New Features in 15.09: +

    +
  • ESS[R]: The indentation logic has been refactored. +It should be faster, more consistent and more flexible. There are three +types of indentation settings, those starting with ess-offset- +give the actual offsets, those starting with ess-indent- are +control (commonly Boolean) variables, and those starting with +ess-align- are vertical alignment overrides which inhibit default +offsets in specific situations. See ess-style-alist for detailed +description of the new indentation system and provided default +indentation styles. + +
  • ESS[R]: Deprecation of old indentation settings. +As a consequence of the indentation re-factoring +ess-brace-imaginary-offset, ess-expression-offset and all +delimiter-specific offsets are deprecated. The settings for indentation +of continued statements have been replaced by +ess-offset-continuations. It can be set to either cascade +or straight (the default). ess-arg-function-offset has +been replaced by ess-indent-from-lhs and has been generalised to +assignments. This setting now works with both statement blocks and +expressions and only takes effect for offsets set to prev-call +and open-delim in order to produce a consistent indentation. + +
  • ESS: A test framework has been set up. + +
  • ESS[R]: A new RStudio style is provided to mimic as closely +as possible R files indented via RStudio. To reproduce the setup of some +of the RStudio users, the RStudio- style with +ess-offset-arguments set to prev-line is also provided. In +addition, the new RRR+ style is equivalent to RRR except it indents +blocks in function calls relatively to the opening delimiter. This style +does not try to save horizontal space and produces more indentation. + +
  • ESS[R]: Roxygen fields will now be indented on paragraph +refilling in order to make the documentation more readable. You can also +refill commented lines in the examples field without squashing +the surrounding code in the comments. + +
  • ESS[R]: ESS can now format your code! This is controlled +through the settings ess-fill-calls and +ess-fill-continuations. When activated, (fill-paragraph) +formats your calls and your formulas/continuations while making sure +they don’t go past fill-column. Repeated refills cycle through +different styles (see the docstrings for more details). By default, the +refilled region blinks. Set ess-blink-filling to nil to prevent +this. + +
  • ESS[R]: Fix occasional missing error location fontification +in inferior buffers. + +
  • ESS[R]: ess-developer now correctly assigned the environment +of new functions to the package namespace. + + +
  • ESS[Julia]: ?[topic] now works in the *julia* buffer. +Note that support for editing Julia code now depends on +julia-mode.el from the Julia project. If you install ESS from +the official tarball/zip file, julia-mode.el is already included. +Otherwise, if you install ESS by +running make, then the latest version of julia-mode.el is +downloaded (and so you need an active internet connection to install) +during the installation process. Alternatively, if you run ESS without +running make, then ensure that you have the julia-mode.el, +which you can get easily from MELPA for example. + + +
  • iESS: For naming inferior processes, ESS can use projectile’s +project root and it does so when ess-gen-proc-buffer-name-function is +set to ess-gen-proc-buffer-name:projectile-or-simple as by default, +or to another value beginning with ess-gen-proc-buffer-name:projectile-*. + +
+ + +

Changes and New Features in 15.03-1: +

    +
  • ESS[R]: An indentation bug has been fixed (github issue 163) +
  • ESS[R]: On windows, if ‘ess-prefer-higher-bit’ is non-nil (the +default), then R-newest will try to run a 64 bit (rather than 32 bit) +version of R. +
+ +

Changes and New Features in 15.03: +

    +
  • ESS[R]: Full native support for ‘company-mode‘. +
  • ESS[R]: More efficient caching algorithm for R completion. +
  • ESS: New offset variable ‘ess-close-paren-offset‘ to control +the indentation of the closing parentheses. +
  • ESS[R]: Ask for CRAN mirror only once per emacs session. +
  • ESS[R]: Detect library and require calls +for better completion caching. +
  • Buffer display is now customizable (ess-show-buffer-action). +
  • Use y-or-n-p instead of yes-or-no-p throughout. +
  • More support for ODS in ess-sas-graph-view. +
  • Makefiles are now both UNIX and GNU friendly. +
  • ESS[R]: Simplify directory lookup in ess-developer (#137). +
  • Make closed paren indentation consistent +
+ +

Bug Fixes in 15.03: +

    +
  • Fix open brace indentation bug (#27 in ess/R-ESS-bugs.R). +
  • Fix git version lookup +
  • Don’t check directory modtime in R dialect. +
  • Declare all ess macros for edebug. +
  • Add ess-smart-comma to eldoc message functions. +
  • Inform users when retrieving RDA aliases. +
  • Line ending in ’~’ is also a continuation line. +
  • Filing roxy paragraphs works as expected now. +
  • In ess-developer-add-package, remove incorrect ‘wait‘ +argument from ess-get-words-from-vector call. +
  • Fix #96, #117, #120, #125, #134, #137. +
  • Fix ess-quit-r. Call base::q() even if it is masked. +
  • Fix ‘ess-show-buffer‘ to always display the buffer in another window. +
  • Makefile: Fix cd bug for directories with spaces in them +
  • ess-kill-buffer-and-go modified to not restart R +
+ +

Changes / Selected Bug Fixes in 14.09: +

    +
  • ESS[Julia]: Executable is changed to julia. +
  • ESS[Julia]: Completion and help system was adjusted to Julia +v.0.3.0. Julia v.0.2.x is no more supported. +
  • ESS[R]: Running R with gdb debugger now works as expected +
  • iESS: Inferior ESS buffers are now derived from comint-mode +
  • ESS[R]: ess-execute-screen-options uses correct screen +width in terminal sessions +
  • ESS: ess-build-tags-for-directory works when no TAGS file +name was provided +
  • ESS: ess-offset-statement-continued is now respected everywhere +except inside of the if test condition. +
  • ESS: New variable ess-offset-statement-first-continued for +indentation of the first line in multiline statements. +
  • ESSR: Starting , in multiline statements indentation is now +ignored to achieve a more pleasant alignment. +
  • ESSR: Improved behavior of RET in roxygen blocks. +
  • ESS[R]: command cleaning with C-u C-u C-y was broken with +lines containing " + " +
  • ESS[R]: fixed "empty watch window bug" +
  • ESS[R]: don’t ask for help location on ac-quick-help (request of github #81) +
  • ESS[R]: "importClassesFrom" and "importMethodsFrom" were added to +the list of two-parameter roxygen commands +
  • ESS[R]: fix vignetes display and hyperlinks (were broken in 13.09-1) +
  • ESS[Julia]: recognize function names ending with ! +
  • ESS[Julia]: fix indentation of "for" comprehension syntax within brackets. +
+ +

Changes / Selected Bug Fixes in 13.09-1: +

    +
  • ess-remote and TRAMP: R support code is now downloaded in binary form instead +of being injected from local machine. The R code is stored in +~/.config/ESSR/ directory on the remote machine +
  • TRAMP: PAGER environment variable is now correctly set to inferior-ess-pager +
  • retrieval of help topics on remote machines is fixed +
  • org-babel: source references of R code executed from org files correctly point +to source references in original org files (version 8.2.1 or higher of +org-mode is required for this feature) +
  • ess-execute is now bound to C-c C-e C-e in ess-extra-map. +
  • completion works again in ess-execute +
  • ESS[R]: head and tail methods were replaced by htsummary in +ess-R-describe-object-at-point-commands +
  • ESS[roxygen]: evaluation commands now work in roxygen blocks. +Leading comments are automatically removed before the evaluation +
  • ESS[transcript]: ’Clean Region’ now works with multiline statements; + ess-transcript-clean-region etc. correctly treat + multiline statements, i.e., no longer forgets the lines typically + preceded by ’+’ +
  • ESS[SAS]: Three features/fixes with special thanks to Matthew Fidler +https://github.com/emacs-ess/ESS/pulls/mlf176f2. Turn on SAS log mode +when appropriate. Indent comments and CARDS statement more appropriately. +
  • ESS[SAS]: ess-sas-edit-keys-toggle default returns to nil +
  • ESS[R]: support for prettify-symbols-mode: +contribution from Rudiger Sonderfeld https://github.com/emacs-ess/ESS/pull/65 +
  • ESS[SWV]: knitr now evaluates in the current frame +
  • ESS[developer]: ess-developer doesn’t kill open DESCRIPTION files anymore +
  • ESS[roxygen]: ess-roxy-preview-HTML is now on C-c C-o C-w and + ess-roxy-preview-text is now on C-c C-o C-t +
  • ESS: installation with make install was simplified and should work +out of the box on most *nix systems +
  • ESS installation instructions simplified +
  • fixed font-lock bug introduced in 13.09 that was causing very slow process output +
+ +

Changes/New Features in 13.09: +

    +
  • font-lock in process buffers doesn’t "spill" over prompts. +Missing closing string delimiters should not cause wrong fontification +of the following command input. +
  • ESS[julia]: full features M-TAB completion and auto-complete support, +which now works for modules, structures and data types. +
  • ESS[julia]: a much better eldoc showing arguments of +methods and data type constructors +
  • ESS-developer: +
      +
    • - ESS-developer work-flow pattern has been streamlined: + ESS-developer is now automatically activated on per-file basis if the + file is part of a developed package ess-developer-packages. The + old behavior (activation on per-process basis) is still available on + M-x ess-developer in a process buffer. +
    • - integration with devtools package. New command + ess-developer-load-package calls load_all on the package + containing current file. ess-developer-add-package now offers IDO + menu completions with available loading methods, currently + library, and load_all. Loading command can be customized + with ess-developer-load-on-add-commands. +
    +
  • TAB now indents region if region is active +(a contribution of Matthew Fidler in pull #41) +
  • M-x ess-version now reports full loading path +and recognizes git and ELPA versions. +
  • warning and error keyword are now highlighted with +font-lock-warning-face as they should be, (for quite some time +these keywords have been hijacked by compilation mode fontification). +
  • eldoc: Eldoc now recognizes multiple processes. +If current process is busy, or current buffer is not associated with a +process, eldoc picks its completions from the first available free +process. +
  • org-babel: evaluation is now org-friendly +
  • help: new help buffers now try to reuse ess-help buffers. +This behavior is controlled by ess-help-reuse-window custom +variable. +
  • help: ?foo pops IDO menu on multiple help files +(so far it worked only for C-c C-v) +
  • remote evaluation is considerably faster now on slow connections +
  • ESS[R] tracebug R source references regular expressions +are (mostly) language agnostic. +
  • ess-function-call-face inherits from +font-lock-function-name-face rather than font-lock-builtin-face. +
  • ess-inject-source now accepts function-and-buffer option. +
  • Documentation: The “New Features” +section (and NEWS) now represent recent changes: within the last +year or so. All changes can be found in the new news.html (or NEWS and ONEWS). +
  • ESS[R] ess-rep-regexp should no longer inf.loop (rarely!), +and hence M-x ess-fix-miscellaneous should neither. +
+ +

Changes/New Features in 13.05: +

    +
  • ESS[gretl]: Support for gretl (both editing and +sub-process interaction). A contribution of Ahmadou Dicko. +
  • ESS: process output display is 4-10 times faster due to new caching +and only occasional emacs re-display (for the moment this functionality +is available only when ess-tracebug is active). +
  • ESS: C-c ` is now bound to ess-show-traceback and +C-c ~ is bound to ess-show-call-stack. +
  • ESS[R]: ESS stores function in ’ESSR’ environment to +avoid kludging users’ global environment and accidental deletion. +
  • ESS[R]: new variable ess-swv-processing-command to control +weaving and tangling. +
  • ESS[R]: ess-default-style has been changed + (from DEFAULT) to RRR. Use something like + (setq ess-default-style 'DEFAULT) or + (setq ess-indent-level 2) in your ~/.emacs equivalent + before loading ESS, if you do not like this new “incompatible” + default style. +
  • ESS[julia]: ESS stores its functions in ’ESS’ module. +
  • ESS[julia]: Eldoc is now supported in julia modes +
  • ESS[julia]: Adjusted error reference detection and interactive help +to julia internal changes +
  • ESS[R]: ess-use-tracebug’s default has been changed to + t. Set it to nil if you want to keep the previous behavior. +
  • ESS[tracebug]: Electric debug keys have been removed [breaking change] +The functionality was replaced with ess-debug-minor-mode and +ess-debug-minor-mode-map. +
  • ESS[tracebug]: ess-tracebug-map is an alias to + ess-dev-map C-c C-t. +
  • ESS[tracebug]: ess-bp-toggle-state (C-c C-t o) + can now be used during the debug session to toggle breakpoints on the fly + (suggestion by Ross Boylan). +
  • ESS[tracebug]: ess-debug-flag-for-debugging and +ess-debug-unflag-for-debugging work correctly from the debugging + contexts. These commands also recognize non-exported functions for the + packages listed in ess-developer-packages (C-c C-t C-a). + +
  • ESS[R]: Eldoc (activated by ess-use-eldoc) has + become more sophisticated, and hence also more intruding in the interface + between the Statistics softare, e.g., R, and the user. + +

    Note that you can turn off ElDoc, by placing (setq ess-use-eldoc nil) + in your ~/.emacs file, prior to loading ESS, +

    +
  • ESS[SAS]: long over-looked SAS-mode-hook appears! +
  • ESS[SAS]: ess-sas-edit-keys-toggle now defaults to t +since sas-indent-line is still broken, i.e. TAB is now +bound to ess-sas-tab-to-tab-stop by default +
+ + +

Changes/Bug Fixes in 12.09-2: +

    +
  • ESS: new ess-switch-to-end-of-proc-buffer variable that controls + whether C-c C-z switches to the end of process buffer. The + default is t. You can use prefix argument to C-c C-z to + toggle this variable. +
  • ESS: fix in ess-eval-linewise that was causing emacs +to hang during R debugging with ess-eval-visibly equal to +t. +
  • ESS: fix in ess-eval-linewise that was causing emacs to recenter +the prompt in visible window +
  • ESS[tracebug]: A better handling of “Selection” prompts +and debug related singlekey commands. +
  • ESS: fix a bug in ess-switch-process that was causing +*new* selection to fail. +
  • ESS[R]: Solve missing ess-local-process-name bug in R-dired. +
  • ESS[SWV]: ess-swv-PDF doesn’t ask for a command to run if +there is only one command in ess-swv-pdflatex-commands. +
  • ESS[SWV]: ess-swv-weave gained an universal argument to +allow for an interactive choice between available weavers (sweave, +knitr). +
  • ESS: ess-eval-*-and-step functions go to next empty +line at eob, instead of staying at the last line. +
+ + +

Changes/New Features in 12.09-1: +

    +
  • ESS Breaking Changes in Keys: + +
      +
    • - New keymaps: +ess-doc-map bound to C-c C-d; ess-extra-map bound +to C-c C-e; ess-dump-object-into-edit-buffer was moved on +C-c C-e C-d +
    • - roxygen map was moved on C-c C-o and +ess-roxy-update-entry now resides on C-c C-o C-o +
    • - ess-handy-commands is not bound anymore +
    • - ess-dev-map (including ess-tracebug and ess-developer) +moved on C-c C-t +
    • - C-c C-y is deprecated in favor of C-c C-z C-z +
    +
  • ESS[R] new command ess-describe-object-at-point +bound to C-c C-d C-e (repeat C-e or e to cycle). It +was inspired by Erik Iverson’s ess-R-object-tooltip. Customize +ess-describe-at-point-method to use tooltip instead of an +electric buffer. +
  • ESS: New command ess-build-tags-for-directory +bound to C-c C-e C-t for building dialect specific tag +tables. After building tags use M-. to navigate to +function and objects definitions. By default C-c C-e C-t builds +tags based on imenu regular expressions and also include other common +languages .c, .o, .cpp etc. But it relies on external find +and etags commands. If ess-build-tags-command is defined +(for R), the inferior process is asked to build tags instead. +
  • ESS: ess-switch-process offers *new* alternative +to start a new process instead of switching to one of the currently +running processes. +
  • ESS: Switching between processes (C-c C-s) uses buffer names instead +of the internal process names. Use M-x rename-buffer command to +conveniently rename your process buffers. +
  • ESS: Process buffers can be automatically named on process creation +according to user specified scheme. Default schemes are *proc*, +*proc:dir* and *proc:abbr-long-dir* where proc stands for the +internal process name and dir stands for the directory where the +process was started in. The default is *proc*. For customization see +ess-gen-proc-buffer-name-function. +
  • ESS: ess-eval-visibly-p is deprecated in favor of ess-eval-visibly. +
  • ESS: New evaluation pattern nowait. +In addition to old nil and t values, +ess-eval-visibly accepts nowait for a visible evaluation +with no waiting for the process. See ess-eval-visibly for details +on evaluation patterns. +
  • ESS: New “Process” menu entry with process related commands and configuration +
  • iESS: Process buffer is now automatically shown on errors +
  • ESS: New ess-switch-to-inferior-or-script-buffer command bound to C-c C-z +in both script and process buffers. If invoked form process buffer it +switches to the most recent buffer of the same dialect. It is a single +key command. +
  • ESSR-help: On multiple help pages with the same name, C-c C-v +now asks for user resolution directly in emacs. +
  • ESS[R] ess-roxy: new variable ess-roxy-re for fontification +of cases where the number of leading # differs from +ess-roxy-str. +
  • ESS[R] Eldoc was considerably enhanced. +It now finds hidden default S3 methods and displays non-default methods’ +arguments after trailing ||. +
  • ESS[R]: New ess-display-demos command bound to C-c C-d o and C-c C-d C-o +
  • ESS: New ess-help-web-search command bound to C-c C-d w and C-c C-d C-w +to facilitate interactive search of web resources. Implemented for R, +Stata and Julia. See also ess-help-web-search-command. +
  • ESS: ess-pdf-viewer-pref accepts now command line arguments +
  • ESS[Rnw]: Add knitr support. +Customize ess-swv-processor for the default processor. +
  • ESS[Rnw]: More thorough renaming of remaining +noweb-* to ess-noweb-*. +
  • ESS[Rnw] new commands ess-eval-chunk-and-step and ess-eval-chunk +bound to M-n C-c and M-n C-M-x to mirror standard ess +commands in C-c map. +
  • ESS[R] Auto-completion: new variable +ess-ac-R-argument-suffix to customize the insertion of trailing +"=". Defaults to “ = “. +
  • ESS[Julia]: Added index, apropos and web-search to julia. +
  • ESS help: More evaluation commands were added to ess-help mode (C-c C-c, C-M-x etc) +
+ +

Bug Fixes in 12.09-1: +

    +
  • iESShelp: Multiple help pages with the same name are properly handled on C-c C-v +
  • iESSremote: Evaluation with ESS remote no longer freezes emacs. +
  • iESS: comint-previous-prompt C-c C-p no longer stops on secondary prompt “+”. +
  • iESS[R], iESS(Sqpe) [S] on Windows: +The options("editor") is now initialized to emacsclient +instead of the previous gnuclient. The user may need to add the +line (server-start) to the emacs initialization +file. emacsclient has been included with emacs since GNU Emacs +22.1. +
  • ESS[Rnw] Fixed “connection to R” bug (in 12.09 only). +
  • ESS[Rnw] Explicit ess-swv-stangle and ess-swv-sweave +functions. +
  • ESS[Rnw] Fixed completion and smart underscore problems cause by unmatched “\”’ +
  • ESS[R] is more careful with the R code injection. +It now happens only once at the start of the session. +
  • ESS[R]: Fixed auto-scrolling the comint buffer on evaluation. +
  • ESS[Julia]: Solve several indentation and word navigation problems. +
  • ESS[Julia]: Help system works again. +
+ +

Changes/New Features in 12.09: +

+
    +
  • Due to XEmacs lacking some features that ESS requires, ESS support of XEmacs +ends with ESS 12.04-4. This decision will be re-visited in the future as +XEmacs continues to sync with GNU Emacs. + +
  • ESS[R]: On Windows, there is now a new customizable variable +(currently called ess-directory-containing-R) to tell ESS where +to look for the Rterm.exe executables. The name of the variable +and the values it can take are both in beta and subject to change. Prior +to this variable, ESS searched only in the default installation +directory. Setting this variable now tells ESS how to find +Rterm.exe executables when they are installed somewhere else. + +
  • ESS[julia]: new mode +for editing julia code (*.jl). Start with M-x julia. + +

    Full interaction interface, imenu and basic error referencing are available. +

    + +
  • ESS[R] noweb: noweb-mode and noweb-font-lock-mode have +been renamed to ess-noweb-mode and +ess-noweb-font-lock-mode to avoid conflicts with the “real” noweb-mode. + +
  • ESS[R] noweb: The long standing font-lock bug has been solved +in ess-noweb interface. + + +
  • ESS: Basic evaluation keys are now bound to ess-eval-region-*- functions: + +
      +
    • - C-M-x is bound to ess-eval-region-or-function-or-paragraph +
    • - C-c C-c is bound to ess-eval-region-or-function-or-paragraph-and-step +
    • - C-RET is bound to ess-eval-region-or-line-and-step +
    + +

    Each of these functions first evaluates the region whenever the region +is active. +

    +
  • ESS: C-M-a/C-M-e now step to beginning/end of +paragraph if no function has been detected. + +
  • ESS: ess-eval-*-and-step family of functions are now smarter, +and don’t step to end of buffer or end of chunk code (@) when at +the end of the code. + +
  • ESS: ess-handy-commands function is bound to C-c h + +
  • ESS: ESS is now blinking the evaluated region. +Set ess-blink-region to nil to deactivate; ess-blink-delay +gives the duration of the blink. Evaluated region is “blinked” in +highlight face. + +
  • ESS[R-help] New key a for “apropos()” in help buffers. Also available +through C-c h. + +
  • ESS[R-help] All R commands of type foo?bar and foo??bar are recognized +and redirected into appropriate *ESS-help* buffers. + +
  • ESS[R]: New customization interface for font-lock. + +

    ESS font-lock operates with predefined keywords. Default keywords are +listed in ess-R-font-lock-keywords and +inferior-R-font-lock-keywords, which see. The user can easily +customize those by adding new keywords. These variables can also be +interactively accessed and saved through ESS/Font-lock submenu. +

    +

    Several new fontification keywords have been added. Most notably the +keywords for highlighting of function calls, numbers and operators. +

    +
  • ESS[R]: auto-complete is now activated by default whenever +auto-complete package is detected. Set ess-use-auto-complete to +nil to deactivate. +
  • ESS[R]: R AC sources are no longer auto-starting at 0 characters +but at the default ac-auto-start characters. +
  • ESS no longer redefines default ac-sources, +but only appends ac-source-filename to it. +
  • ESS: ac-source-R now concatenates “ = “ to function arguments. + +
  • ESS: Menus for ESS and iESS have been reorganized and enriched with +Tracebug and Developer submenus. + +
  • ESS[R]: ess-developer and ess-tracebug commands are available by default +in ess-dev-map which is bound to C-c d in ESS and iESS maps. + +
  • ESS[R]: eldoc truncates long lines whenever eldoc-echo-area-use-multiline-p +is non-nil (the default). Set this variable to t if you insist on multiline eldoc. +See also ess-eldoc-abbreviation-style. + +
  • ESS[R]: completion code pre-caches arguments +of heavy generics such as plot and print to eliminated the +undesirable delay on first request. + +
  • iESS: Prompts in inferior buffers are now highlighted uniformly with +comint-highlight-prompt face. + +
  • ESS[R]: R process no longer wait for the completion of input in inferior buffer. +Thus, long running commands like Sys.sleep(5) no longer stall emacs. + +
  • ESS: [R, S, Stata, Julia] have specialized ess-X-post-run-hooks, which +are run at the end of subprocess initialization. + +
  • ESS[Stata]: All interactive evaluation commands work as expected. +On-line comments are removed before the evaluation and multiline +comments are skipped on C-c C-c and other interactive commands. + +
  • ESS no longer auto-connects to a subprocess with a different dialect than +the current buffer’s one. + +
  • ESS: ess-arg-function-offset-new-line is now a list for all +the ESS indentation styles, which results in the following indentation +after an open “(”: + +
      a <- some.function(other.function(
    +     arg1,
    +     arg2)
    +
    +
  • ESS[SAS]: Improved MS RTF support for GNU Emacs; try + ess-sas-rtf-portrait and ess-sas-rtf-landscape. +
+ +

Changes/Bug Fixes in 12.04-3: +

    +
  • ESS: basic support for package.el compatibility +
  • ESS[R]: correct indentation of & and | continuation lines +
  • M-x ess-version shows the svn revision even after make install +
  • ESS[SAS]: improved XEmacs support +
  • iESS[R]: better finding of previous prompt +
  • ESS[Stata]: adjusted prompt for mata mode +
  • ESS[R]: resolved name clashes with cl.el +
  • ESS[R]: removed dependence on obsolete package assoc +
  • New make target lisp, to build the lisp-only part, i.e., not building the docs. +
+ +

Changes/New Features in 12.04-1: +

    +
  • iESS[Stata]: New interactive help invocation. +
  • iESS[Stata]: New custom variable inferior-STA-start-file. +
  • iESS[Stata]: inferior-STA-program-name is now “stata” +and can be customized. +
  • ESS[Stata] New sections in stata help files +Syntax(s-S), Remarks(r), Title(t). +
+ +

Bug Fixes in 12.04-1: +

    +
  • ESS[R]: Better ess-tracebug error handling. +
  • ESS[R]: Corrected ess-eldoc help string filtering +and improved argument caching. +
  • ESS[R]: Indentation of non-block if/else/for/while lines fixed. +
  • M-x ess-version should work better. +
  • ESS: Filename completion now again works inside strings. +
  • iESS[Stata]: Fixed prompt detection issue. +
  • ESS[Rd]: R is autostarted also from here, when needed. +
+ +

Changes/New Features in 12.04: +

    +
  • ESS: Reverting new behavior of 12.03, TAB in ess-mode +no longer completes by default. If you want smart TAB completion +in R and S scripts, similarly to iESS behavior, set the variable +ess-tab-complete-in-script to t. Also see +ess-first-tab-never-complete for how to customize where first +TAB is allowed to complete. +
  • ESS: completion is consistently bound to M-TAB (aka M-C-i) +in both Emacs23 and Emacs24. +
  • ESS: The variable ess-arg-function-offset-new-line +introduced in ESS(12.03) now accepts a list with the first element a +number to indicate that the offset should be computed from the indent of +the previous line. For example setting it to ’(2) results in: + +
      a <- some.function(
    +    arg1,
    +    arg2)
    +
    + +
+ +

Changes/New Features in 12.03: +

    +
  • ESS indentation: new offset variable ess-arg-function-offset-new-line +controlling for the indentation of lines immediately following open +’(’. This is useful to shift backwards function arguments after a long +function call expression: + +
      a <- some.function(
    +         arg1,
    +         arg2)
    +
    + +

    instead of the old +

    +
      a <- some.function(
    +                     arg1,
    +                     arg2)
    +
    +

    If ’(’ is not followed by new line the behavior is unchanged: +

    +
      a <- some.function(arg1,
    +                     arg2)
    +
    +

    This variable should be set as part of indentation style lists, or in +ess-mode hook. +

  • ESS[R]: C-c . sets (indentation) style. +
  • ESS: In ESS buffers yank(C-y) command accepts + double argument C-u C-u to paste commands only. It deletes any +lines not beginning with a prompt, and then removes the prompt from +those lines that remain. Useful to paste code from emails, +documentation, inferior ESS buffers or transcript files. +
  • Documentation: ESS user manual has been rearranged and +completed with several new chapters and sections to reflect newly added +features (“Completion”, “Developing with ESS”, “ESS tracebug”, +“ESS developer”, “ESS ElDoc”, “IDO Completion” and “Evaluating +Code”) +
  • RefCard: Reference card was updated to include new features. +
  • Eldoc: Eldoc was rewritten and is activated by default. +See ess-use-eldoc, ess-eldoc-show-on-symbol, +ess-eldoc-abbreviation-style variables for how to change the default +behavior. Note: skeleton-pair-insert-maybe prohibits eldoc +display, on ( insertion. +
  • ESS[R]: Eldoc shows arguments of a generic function whenever found. +
  • ESS: TAB in ess-mode now indents and completes, +if there is nothing to indent. Set +ess-first-tab-never-completes-p to t to make TAB +never complete on first invocation. Completion mechanism is similar to +the completion in the inferior-ess-mode – a filename expansion +is tried, if not found ESS completes the symbol by querying the +process. +
  • ESS for emacs version 24 or higher: ESS is fully compatible with +the emacs 24 completion scheme, i.e. all the completion is done by +completion-at-point. Also in accordance with emacs conventions, +ESS doesn’t bind M-TAB for emacs 24 or higher. M-TAB calls the +default complete-symbol. + +
  • ESS[R]: Out of the box integration with Auto +Completion mode http://cx4a.org/software/auto-complete . Three AC +sources ac-source-R-args, ac-source-R-objects and +ac-source-R are provided. The last one combines the previous two +and makes them play nicely together. Set ess-use-auto-complete to +t to start using it. Refer to documentation string of +ac-use-auto-complete for further information. +
  • ESS[R]: New unified and fast argument completion system, +comprised of ess-funname.start, ess-function-arguments, +ess-get-object-at-point. Eldoc and auto-completion integration +are using this system. +
  • ESS: ess-switch-to-end-of-ESS(C-c C-z), +and ess-switch-to-ESS(C-c C-y): Automatically start the +process whenever needed. +
  • ESS[R]: roxy knows about previewing text version of the +documentation. Bound to C-c C-e t. +
  • ESS[R]: Solved the “nil filename” bug in roxygen support. +
  • ESS[R]: ess-tracebug is now part of ESS: + +

    New Features: +

    +
      +
    • - Source injection: Tracebug now can inject source references on the +fly during code evaluation, i.e. you don’t have to source your file, but +just evaluate your code in normal fashion. Variable +ess-tracebug-inject-source-p controls this behavior - if t, +always inject source reference, if 'function, inject only for +functions (this is the default), if nil, never inject. + +

      During the source injection the value of ess-eval-visibly is +ignored. +

    • - Org-mode support: Visual debugger is now aware of the +temporary org source editing buffer (C-c ') and jumps through this +buffers if still alive, or in original org buffer otherwise. +
    • - New keys in watch mode: ? and d +
    • - Two new hooks: ess-tracebug-enter-hook and ess-tracebug-exit-hook +
    + +
  • ESS[R]: New package ess-developer to evaluate R +code directly in the package environment and namespace. It can be +toggled on and off with C-c d t. When ess-developer is on +all ESS evaluation commands are redefined to evaluate code in +appropriate environments. Add package names to the list of your +development packages with C-d a, and remove with C-d +r. Source the current file with C-d s.Evaluation function which +depend on `ess-eval-region' ask for the package to source the +code into, ess-eval-function and alternatives search for the +function name in the development packages’ environment and namespace and +insert the definition accordingly. See the documentation section +“Developing with ESS/ESS developer” for more details. + +
  • ESS[R] help system: + +

    New Features: +

    +
      +
    • - q quits window instead of calling ess-switch-to-end-of-ESS. +This is consistent with emacs behavior help and other special buffers (breaking change). +
    • - k kills window without asking for the name (pointed by Sam Steingold) +
    • - Help map inherits from special-mode-map as sugested by Sam Steingold. +
    • - Package index: new function ess-display-index bound to +i in help mode map. +
    • - Package vignettes: new function ess-display-vignettes bound to +v in help mode map. +
    • - Display help in HTML browser: new function ess-display-help-in-browser bound to +w in help mode map. It depends on R’s browser +option. +
    • - New custom variable ess-help-pop-to-buffer: if non-nil +ESS help buffers are given focus on display. The default is +t (breaking change). +
    • - New menu entries for the above functions. +
    • - Bogus help buffers are no longer generated by default, i.e. +buffers of the form “No documentation for ’foo’ in specified packages and libraries: +you could try ’??foo’ ”. ess-help-kill-bogus-buffers now defaults to +t. Beware, there may be instances where the default is unsatisfactory +such as debugging and/or during R development. Thanks to Ross Boylan for +making the suggestion, Sam Steingold for reminding us of this variable and +Martin Maechler for the warning. +
    +
  • ESS now uses IDO completing read functionality +for all the interactive requests. It uses ido completion +mechanism whenever available, and falls back on classical +completing-read otherwise. You can set ess-use-ido to nil if you +don’t want the IDO completion. See the documentation string of +ess-use-ido for more information about IDO and ESS +configuration. + +
  • ESS[S]: “,“ is bound to ess-smart-comma: +If comma is invoked at the process marker of an ESS inferior +buffer, request and execute a command from `ess-handy-commands' +list. If ess-R-smart-operators is t `ess-smart-comma +also inserts “ “ after comma. +
  • ESS[S], notably R: Variable `ess-handy-commands' +stores an alist of useful commands which are called by ess-smart-comma in +the inferior buffer. + +

    Currently containing: +

    +
    +
    change-directory
    +

    ess-change-directory +

    +
    help-index
    +

    ess-display-index +

    +
    help-object
    +

    ess-display-help-on-object +

    +
    vignettes
    +

    ess-display-vignettes +

    +
    objects[ls]
    +

    ess-execute-objects +

    +
    search
    +

    ess-execute-search +

    +
    set-width
    +

    ess-execute-screen-options +

    +
    install.packages
    +

    ess-install.packages +

    +
    library
    +

    ess-library +

    +
    setRepos
    +

    ess-setRepositories +

    +
    sos
    +

    ess-sos +

    +
    + +

    Handy commands: ess-library, ess-install.packages, etc - +ask for item with completion and execute the correspond +command. ess-sos is a interface to findFn function in +package sos. If package sos is not found, ask user for +interactive install. +

    +
  • ESS: New dynamic mode line indicator: Process status is automatically +reflected in all mode-lines of associated with the process +buffers. Particularly useful for displaying debug status of +ess-tracebug and developer status of ess-developer in all +associated buffers. + +
  • ESS: New ess-completing-read mechanism: ESS uses +ido completions whenever possible. Variable ess-use-ido +controls whether to use ido completion or not. Active by default. + +
  • ESS now supports comint fields for output and input +detection. This feature is not used by default, but might be useful in +the future. + +
  • ESS[S]: New custom variable inferior-ess-S-prompt to +customize prompt detection regular expression in the inferior ESS +buffers. You can customize this variable to enhance comint navigation +(comint-previous-prompt and comint-next-prompt) the +inferior buffers. + +
  • ESS[R]: Internal R completion retrieval +(ess-R-complete-object-name) was rewritten and is faster now. + +
  • ESS is using process plist to store process specific variables, +as opposed to buffer local variables as it was using before. The use of +buffer local variables to store process variables is discouraged. + +
  • ESS: new functions to manipulate process plists: +ess-process-get and ess-process-set. + +
  • ESS: Internal process waiting mechanism was completely rewritten. ESS +no more relies on prompt regular expressions for the prompt +detection. The only requirement on the primary process prompt is to end +in > . This could be overwritten by setting +inferor-ess-primary-prompt. + +
  • ESS[S], notably R: Saved command history: + ess-history-file now accepts t (default), nil, or a + file name. By setting it to nil no command line history is saved + anymore. ess-history-directory now allows to have the history + all saved in one “central” file. +
  • ESS[R]: more Roxygen improvements. +
  • ESS[R]: C-c . to set (indentation) style. + +
  • ESS[R]: Functions with non-standard names (for example ’aaa-bbb:cc’) are +properly handled by font-lock and evaluation routines. +
  • ESS[R]:Several regexp bugs (described in etc/R-ESS-bugs.el) were +fixed in ess-get-words-from-vector and ess-command. +
+ + +
+ +
+

+Next: , Previous: , Up: General Information  

+
+ +

1.9 Reporting Bugs

+ +

Please send bug reports, suggestions etc. to +ESS-bugs@r-project.org +

+

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. +

+
+ +
+

+Next: , Previous: , Up: General Information  

+
+ +

1.10 Mailing Lists

+ + +

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. +
+ +
+ +
+

+Previous: , Up: General Information  

+
+ +

1.11 Authors

+ + + +
+ + + + + diff -Nru ess-16.10/doc/info/ess.info ess-17.11/doc/info/ess.info --- ess-16.10/doc/info/ess.info 1970-01-01 00:00:00.000000000 +0000 +++ ess-17.11/doc/info/ess.info 2017-11-13 14:13:20.000000000 +0000 @@ -0,0 +1,5692 @@ +This is ess.info, produced by makeinfo version 6.3 from ess.texi. + +INFO-DIR-SECTION Emacs +START-INFO-DIR-ENTRY +* ESS: (ess). Emacs Speaks Statistics (S/S+/R, SAS, BUGS/JAGS and Stata). +END-INFO-DIR-ENTRY + +ESS -- Emacs Speaks Statistics +****************************** + + +File: ess.info, Node: Top, Next: Introduction, Up: (dir) + +ESS: Emacs Speaks Statistics +**************************** + +ESS version 17.11 + + by A.J. Rossini, + R.M. Heiberger, + K. Hornik, + M. Maechler, + R.A. Sparapani, + S.J. Eglen, + S.P. Luque, + H. Redestig, + V. Spinu, + and L. Henry. + + Emacs Speaks Statistics (ESS) provides an intelligent, consistent + interface between the user and the software. ESS interfaces with + SAS, S-PLUS, R, BUGS/JAGS and other statistical analysis packages + on Unix, Linux and Microsoft Windows. ESS is itself a package + within the emacs text editor and uses emacs features 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. + +* Menu: + +* Introduction:: Overview of features provided by this package +* Installation:: Installing ESS on your system + +* Interactive ESS:: Interacting with statistical programs +* Entering commands:: Interacting with the ESS process +* Evaluating code:: Sending code to the ESS process +* Transcript Mode:: Manipulating saved transcript files +* Editing objects:: How to create/edit objects and functions +* Help:: Reading help files +* Completion:: Various completion mechanisms +* Developing with ESS:: Tools for package development and debugging +* Extras:: Other ESS features for the S family + +* ESS for S:: Overview of ESS features for the S family +* ESS for SAS:: +* ESS for BUGS:: +* ESS for JAGS:: +* Mailing lists/bug reports:: How to get assistance with ESS +* Customization:: Customizing ESS +* Indices:: + + +File: ess.info, Node: Introduction, Next: Installation, Prev: Top, Up: Top + +1 Introduction to ESS +********************* + +The S family (S, Splus and R) and SAS statistical analysis packages +provide sophisticated statistical and graphical routines for +manipulating data. Emacs Speaks Statistics (ESS) is based on the merger +of two pre-cursors, S-mode and SAS-mode, which provided support for the +S family and SAS respectively. Later on, Stata-mode was also +incorporated. + + ESS provides a common, generic, and useful interface, through emacs, +to many statistical packages. It currently supports the S family, SAS, +BUGS/JAGS, and Stata with the level of support roughly in that order. + + A bit of notation before we begin. _emacs_ refers to both _GNU +Emacs_ by the Free Software Foundation, as well as _XEmacs_ by the +XEmacs Project. The emacs major mode 'ESS[language]', where 'language' +can take values such as 'S', 'SAS', or 'XLS'. The inferior process +interface (the connection between emacs and the running process) +referred to as inferior ESS ('iESS'), is denoted in the modeline by +'ESS[dialect]', where 'dialect' can take values such as 'S3', 'S4', +'S+3', 'S+4', 'S+5', 'S+6', 'S+7', 'R', 'XLS', 'VST', 'SAS'. + + Currently, the documentation contains many references to ''S'' where +actually any supported (statistics) language is meant, i.e., 'S' could +also mean 'R' or 'SAS'. + + For exclusively interactive users of S, ESS provides a number of +features to make life easier. There is an easy to use command history +mechanism, including a quick prefix-search history. To reduce typing, +command-line completion is provided for all S objects and "hot keys" are +provided for common S function calls. Help files are easily accessible, +and a paging mechanism is provided to view them. Finally, an incidental +(but very useful) side-effect of ESS is that a transcript of your +session is kept for later saving or editing. + + No special knowledge of Emacs is necessary when using S interactively +under ESS. + + For those that use S in the typical edit-test-revise cycle when +programming S functions, ESS provides for editing of S functions in +Emacs edit buffers. Unlike the typical use of S where the editor is +restarted every time an object is edited, ESS uses the current Emacs +session for editing. In practical terms, this means that you can edit +more than one function at once, and that the ESS process is still +available for use while editing. Error checking is performed on +functions loaded back into S, and a mechanism to jump directly to the +error is provided. ESS also provides for maintaining text versions of +your S functions in specified source directories. + +* Menu: + +* Features:: Why should I use ESS? +* New features:: +* Credits:: Authors of and contributors to ESS +* Latest version:: Getting the latest version of ESS +* Manual:: How to read this manual + + +File: ess.info, Node: Features, Next: New features, Up: Introduction + +1.1 Why should I use ESS? +========================= + +Statistical packages are powerful software systems for manipulating and +analyzing data, but their user interfaces often leave something +something to be desired: they offer weak editor functionality and they +differ among themselves so markedly that you have to re-learn how to do +those things for each package. ESS is a package which is designed to +make editing and interacting with statistical packages more uniform, +user-friendly and give you the power of emacs as well. + +* Menu: + +* Current Features:: + + +File: ess.info, Node: Current Features, Up: Features + +1.1.1 Features Overview +----------------------- + + * Languages Supported: + * S family (R and S+ AKA S-PLUS) + * SAS + * OpenBUGS/JAGS + * Stata + * Julia + * Editing source code (S family, SAS, OpenBUGS/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, OpenBUGS/JAGS) + * Use of imenu to provide links to appropriate functions + * Interacting with the process (S family, SAS, Stata, Julia) + * Command-line editing + * Searchable Command history + * Command-line completion of S 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 + + ESS provides several features which make it easier to interact with +the ESS process (a connection between your buffer and the statistical +package which is waiting for you to input commands). These include: + + * Command-line editing for fixing mistakes in commands before they + are entered. The '-e' flag for S-plus provides something similar + to this, but here you have the full range of Emacs commands rather + than a limited subset. However, other packages do not necessarily + have features like this built-in. *Note Command-line editing::. + + * Searchable command history for recalling previously-submitted + commands. This provides all the features of the 'Splus -e' history + mechanism, plus added features such as history searching. *Note + Command History::. + + * Command-line completion of both object and file names for quick + entry. This is similar to 'tcsh''s facility for filenames; here it + also applies to object names and list components. *Note + Completion::. + + * Hot-keys for quick entry of commonly-used commands in 'S' such as + 'objects()' and 'search()'. *Note Hot keys::. + + * Transcript recording for a complete record of all the actions in an + S session. *Note Transcript::. + + * Interface to the help system, with a specialized mode for viewing S + help files. *Note Help::. + + If you commonly create or modify S functions, you will have found the +standard facilities for this (the 'fix()' function, for example) +severely limiting. Using S's standard features, one can only edit one +function at a time, and you can't continue to use S while editing. ESS +corrects these problems by introducing the following features: + + * Object editing. ESS allows you to edit more than one function + simultaneously in dedicated Emacs buffers. The ESS process may + continue to be used while functions are being edited. *Note Edit + buffer::. + + * A specialized editing mode for S code, which provides syntactic + indentation and highlighting. *Note Indenting::. + + * Facilities for loading and error-checking source files, including a + keystroke to jump straight to the position of an error in a source + file. *Note Error Checking::. + + * Source code revision maintenance, which allows you to keep historic + versions of S source files. *Note Source Files::. + + * Facilities for evaluating S code such as portions of source files, + or line-by-line evaluation of files (useful for debugging). *Note + Evaluating code::. + + Finally, ESS provides features for re-submitting commands from saved +transcript files, including: + + * Evaluation of previously entered commands, stripping away + unnecessary prompts. *Note Transcript resubmit::. + + +File: ess.info, Node: New features, Next: Credits, Prev: Features, Up: Introduction + +1.2 New features in ESS +======================= + +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 + + Changes and New Features in 15.09: + + * ESS[R]: The indentation logic has been refactored. It should be + faster, more consistent and more flexible. There are three types + of indentation settings, those starting with 'ess-offset-' give the + actual offsets, those starting with 'ess-indent-' are control + (commonly Boolean) variables, and those starting with 'ess-align-' + are vertical alignment overrides which inhibit default offsets in + specific situations. See 'ess-style-alist' for detailed + description of the new indentation system and provided default + indentation styles. + + * ESS[R]: Deprecation of old indentation settings. As a consequence + of the indentation re-factoring 'ess-brace-imaginary-offset', + 'ess-expression-offset' and all delimiter-specific offsets are + deprecated. The settings for indentation of continued statements + have been replaced by 'ess-offset-continuations'. It can be set to + either 'cascade' or 'straight' (the default). + 'ess-arg-function-offset' has been replaced by + 'ess-indent-from-lhs' and has been generalised to assignments. + This setting now works with both statement blocks and expressions + and only takes effect for offsets set to 'prev-call' and + 'open-delim' in order to produce a consistent indentation. + + * ESS: A test framework has been set up. + + * ESS[R]: A new RStudio style is provided to mimic as closely as + possible R files indented via RStudio. To reproduce the setup of + some of the RStudio users, the RStudio- style with + 'ess-offset-arguments' set to 'prev-line' is also provided. In + addition, the new RRR+ style is equivalent to RRR except it indents + blocks in function calls relatively to the opening delimiter. This + style does not try to save horizontal space and produces more + indentation. + + * ESS[R]: Roxygen fields will now be indented on paragraph refilling + in order to make the documentation more readable. You can also + refill commented lines in the 'examples' field without squashing + the surrounding code in the comments. + + * ESS[R]: ESS can now format your code! This is controlled through + the settings 'ess-fill-calls' and 'ess-fill-continuations'. When + activated, '(fill-paragraph)' formats your calls and your + formulas/continuations while making sure they don't go past + 'fill-column'. Repeated refills cycle through different styles + (see the docstrings for more details). By default, the refilled + region blinks. Set 'ess-blink-filling' to nil to prevent this. + + * ESS[R]: Fix occasional missing error location fontification in + inferior buffers. + + * ESS[R]: ess-developer now correctly assigned the environment of new + functions to the package namespace. + + * ESS[Julia]: ?[topic] now works in the *julia* buffer. Note that + support for editing Julia code now depends on 'julia-mode.el' from + the Julia project. If you install ESS from the official + tarball/zip file, 'julia-mode.el' is already included. Otherwise, + if you install ESS by running 'make', then the latest version of + 'julia-mode.el' is downloaded (and so you need an active internet + connection to install) during the installation process. + Alternatively, if you run ESS without running 'make', then ensure + that you have the 'julia-mode.el', which you can get easily from + MELPA for example. + + * iESS: For naming inferior processes, ESS can use 'projectile''s + project root and it does so when + 'ess-gen-proc-buffer-name-function' is set to + 'ess-gen-proc-buffer-name:projectile-or-simple' as by default, or + to another value beginning with + 'ess-gen-proc-buffer-name:projectile-*'. + + Changes and New Features in 15.03-1: + * ESS[R]: An indentation bug has been fixed (github issue 163) + * ESS[R]: On windows, if 'ess-prefer-higher-bit' is non-nil (the + default), then R-newest will try to run a 64 bit (rather than 32 + bit) version of R. + + Changes and New Features in 15.03: + * ESS[R]: Full native support for 'company-mode'. + * ESS[R]: More efficient caching algorithm for R completion. + * ESS: New offset variable 'ess-close-paren-offset' to control the + indentation of the closing parentheses. + * ESS[R]: Ask for CRAN mirror only once per emacs session. + * ESS[R]: Detect 'library' and 'require' calls for better completion + caching. + * Buffer display is now customizable ('ess-show-buffer-action'). + * Use 'y-or-n-p' instead of 'yes-or-no-p' throughout. + * More support for ODS in ess-sas-graph-view. + * Makefiles are now both UNIX and GNU friendly. + * ESS[R]: Simplify directory lookup in 'ess-developer' (#137). + * Make closed paren indentation consistent + + Bug Fixes in 15.03: + * Fix open brace indentation bug (#27 in ess/R-ESS-bugs.R). + * Fix git version lookup + * Don't check directory modtime in R dialect. + * Declare all ess macros for edebug. + * Add 'ess-smart-comma' to eldoc message functions. + * Inform users when retrieving RDA aliases. + * Line ending in '~' is also a continuation line. + * Filing roxy paragraphs works as expected now. + * In 'ess-developer-add-package', remove incorrect 'wait' argument + from 'ess-get-words-from-vector' call. + * Fix #96, #117, #120, #125, #134, #137. + * Fix ess-quit-r. Call base::q() even if it is masked. + * Fix 'ess-show-buffer' to always display the buffer in another + window. + * Makefile: Fix cd bug for directories with spaces in them + * 'ess-kill-buffer-and-go' modified to not restart R + + Changes / Selected Bug Fixes in 14.09: + * ESS[Julia]: Executable is changed to 'julia'. + * ESS[Julia]: Completion and help system was adjusted to Julia + v.0.3.0. Julia v.0.2.x is no more supported. + * ESS[R]: Running R with 'gdb' debugger now works as expected + * iESS: Inferior ESS buffers are now derived from 'comint-mode' + * ESS[R]: 'ess-execute-screen-options' uses correct screen width in + terminal sessions + * ESS: 'ess-build-tags-for-directory' works when no TAGS file name + was provided + * ESS: 'ess-offset-statement-continued' is now respected everywhere + except inside of the 'if' test condition. + * ESS: New variable 'ess-offset-statement-first-continued' for + indentation of the first line in multiline statements. + * ESSR: Starting ',' in multiline statements indentation is now + ignored to achieve a more pleasant alignment. + * ESSR: Improved behavior of 'RET' in roxygen blocks. + * ESS[R]: command cleaning with 'C-u C-u C-y' was broken with lines + containing " + " + * ESS[R]: fixed "empty watch window bug" + * ESS[R]: don't ask for help location on ac-quick-help (request of + github #81) + * ESS[R]: "importClassesFrom" and "importMethodsFrom" were added to + the list of two-parameter roxygen commands + * ESS[R]: fix vignetes display and hyperlinks (were broken in + 13.09-1) + * ESS[Julia]: recognize function names ending with ! + * ESS[Julia]: fix indentation of "for" comprehension syntax within + brackets. + + Changes / Selected Bug Fixes in 13.09-1: + * ess-remote and TRAMP: R support code is now downloaded in binary + form instead of being injected from local machine. The R code is + stored in '~/.config/ESSR/' directory on the remote machine + * TRAMP: PAGER environment variable is now correctly set to + 'inferior-ess-pager' + * retrieval of help topics on remote machines is fixed + * org-babel: source references of R code executed from org files + correctly point to source references in original org files (version + 8.2.1 or higher of org-mode is required for this feature) + * 'ess-execute' is now bound to 'C-c C-e C-e' in 'ess-extra-map'. + * completion works again in 'ess-execute' + * ESS[R]: 'head' and 'tail' methods were replaced by 'htsummary' in + 'ess-R-describe-object-at-point-commands' + * ESS[roxygen]: evaluation commands now work in roxygen blocks. + Leading comments are automatically removed before the evaluation + * ESS[transcript]: 'Clean Region' now works with multiline + statements; 'ess-transcript-clean-region' etc. correctly treat + multiline statements, i.e., no longer forgets the lines typically + preceded by '+' + * ESS[SAS]: Three features/fixes with special thanks to Matthew + Fidler https://github.com/emacs-ess/ESS/pulls/mlf176f2 + (https://github.com/emacs-ess/ESS/pulls/mlf176f2). Turn on SAS log + mode when appropriate. Indent comments and CARDS statement more + appropriately. + * ESS[SAS]: 'ess-sas-edit-keys-toggle' default returns to 'nil' + * ESS[R]: support for 'prettify-symbols-mode': contribution from + Rudiger Sonderfeld + * ESS[SWV]: knitr now evaluates in the current frame + * ESS[developer]: ess-developer doesn't kill open DESCRIPTION files + anymore + * ESS[roxygen]: 'ess-roxy-preview-HTML' is now on 'C-c C-o C-w' and + 'ess-roxy-preview-text' is now on 'C-c C-o C-t' + * ESS: installation with 'make install' was simplified and should + work out of the box on most *nix systems + * ESS installation instructions simplified + * fixed font-lock bug introduced in 13.09 that was causing very slow + process output + + Changes/New Features in 13.09: + * font-lock in process buffers doesn't "spill" over prompts. Missing + closing string delimiters should not cause wrong fontification of + the following command input. + * ESS[julia]: full features M-TAB completion and auto-complete + support, which now works for modules, structures and data types. + * ESS[julia]: a much better eldoc showing arguments of methods and + data type constructors + * ESS-developer: + - ESS-developer work-flow pattern has been streamlined: + ESS-developer is now automatically activated on per-file basis + if the file is part of a developed package + 'ess-developer-packages'. The old behavior (activation on + per-process basis) is still available on 'M-x ess-developer' + in a process buffer. + - integration with 'devtools' package. New command + 'ess-developer-load-package' calls 'load_all' on the package + containing current file. 'ess-developer-add-package' now + offers IDO menu completions with available loading methods, + currently 'library', and 'load_all'. Loading command can be + customized with 'ess-developer-load-on-add-commands'. + * 'TAB' now indents region if region is active (a contribution of + Matthew Fidler in pull #41) + * 'M-x ess-version' now reports full loading path and recognizes git + and ELPA versions. + * warning and error keyword are now highlighted with + 'font-lock-warning-face' as they should be, (for quite some time + these keywords have been hijacked by compilation mode + fontification). + * eldoc: Eldoc now recognizes multiple processes. If current process + is busy, or current buffer is not associated with a process, eldoc + picks its completions from the first available free process. + * org-babel: evaluation is now org-friendly + * help: new help buffers now try to reuse ess-help buffers. This + behavior is controlled by 'ess-help-reuse-window' custom variable. + * help: ?foo pops IDO menu on multiple help files (so far it worked + only for 'C-c C-v') + * remote evaluation is considerably faster now on slow connections + * ESS[R] tracebug R source references regular expressions are + (mostly) language agnostic. + * 'ess-function-call-face' inherits from + 'font-lock-function-name-face' rather than + 'font-lock-builtin-face'. + * 'ess-inject-source' now accepts 'function-and-buffer' option. + * Documentation: The "New Features" section (and 'NEWS') now + represent recent changes: within the last year or so. All changes + can be found in the new news.html (news.html) (or 'NEWS' and + 'ONEWS'). + * ESS[R] 'ess-rep-regexp' should no longer inf.loop (rarely!), and + hence 'M-x ess-fix-miscellaneous' should neither. + + Changes/New Features in 13.05: + * ESS[gretl]: Support for 'gretl' (both editing and sub-process + interaction). A contribution of Ahmadou Dicko. + * ESS: process output display is 4-10 times faster due to new caching + and only occasional emacs re-display (for the moment this + functionality is available only when 'ess-tracebug' is active). + * ESS: 'C-c `' is now bound to 'ess-show-traceback' and 'C-c ~' is + bound to 'ess-show-call-stack'. + * ESS[R]: ESS stores function in 'ESSR' environment to avoid kludging + users' global environment and accidental deletion. + * ESS[R]: new variable 'ess-swv-processing-command' to control + weaving and tangling. + * ESS[R]: 'ess-default-style' has been changed (from 'DEFAULT') to + 'RRR'. Use something like '(setq ess-default-style 'DEFAULT)' or + '(setq ess-indent-level 2)' in your '~/.emacs' equivalent _before_ + loading ESS, if you do not like this new "incompatible" default + style. + * ESS[julia]: ESS stores its functions in 'ESS' module. + * ESS[julia]: Eldoc is now supported in julia modes + * ESS[julia]: Adjusted error reference detection and interactive help + to julia internal changes + * ESS[R]: 'ess-use-tracebug''s default has been changed to 't'. Set + it to nil if you want to keep the previous behavior. + * ESS[tracebug]: Electric debug keys have been removed [breaking + change] The functionality was replaced with 'ess-debug-minor-mode' + and 'ess-debug-minor-mode-map'. + * ESS[tracebug]: 'ess-tracebug-map' is an alias to 'ess-dev-map' 'C-c + C-t'. + * ESS[tracebug]: 'ess-bp-toggle-state' ('C-c C-t o') can now be used + during the debug session to toggle breakpoints on the fly + (suggestion by Ross Boylan). + * ESS[tracebug]: 'ess-debug-flag-for-debugging' and + 'ess-debug-unflag-for-debugging' work correctly from the debugging + contexts. These commands also recognize non-exported functions for + the packages listed in 'ess-developer-packages' ('C-c C-t C-a'). + + * ESS[R]: Eldoc (activated by 'ess-use-eldoc') has become more + sophisticated, and hence also more intruding in the interface + between the Statistics softare, e.g., R, and the user. + + Note that you can turn off ElDoc, by placing '(setq ess-use-eldoc + nil)' in your '~/.emacs' file, prior to loading ESS, + + * ESS[SAS]: long over-looked 'SAS-mode-hook' appears! + * ESS[SAS]: 'ess-sas-edit-keys-toggle' now defaults to 't' since + 'sas-indent-line' is still broken, i.e. 'TAB' is now bound to + 'ess-sas-tab-to-tab-stop' by default + + Changes/Bug Fixes in 12.09-2: + * ESS: new 'ess-switch-to-end-of-proc-buffer' variable that controls + whether 'C-c C-z' switches to the end of process buffer. The + default is 't'. You can use prefix argument to 'C-c C-z' to toggle + this variable. + * ESS: fix in 'ess-eval-linewise' that was causing emacs to hang + during R debugging with 'ess-eval-visibly' equal to 't'. + * ESS: fix in 'ess-eval-linewise' that was causing emacs to recenter + the prompt in visible window + * ESS[tracebug]: A better handling of "Selection" prompts and debug + related singlekey commands. + * ESS: fix a bug in 'ess-switch-process' that was causing '*new*' + selection to fail. + * ESS[R]: Solve missing 'ess-local-process-name' bug in R-dired. + * ESS[SWV]: 'ess-swv-PDF' doesn't ask for a command to run if there + is only one command in 'ess-swv-pdflatex-commands'. + * ESS[SWV]: 'ess-swv-weave' gained an universal argument to allow for + an interactive choice between available weavers (sweave, knitr). + * ESS: 'ess-eval-*-and-step' functions go to next empty line at eob, + instead of staying at the last line. + + Changes/New Features in 12.09-1: + * ESS _Breaking Changes in Keys_: + + - New keymaps: 'ess-doc-map' bound to 'C-c C-d'; 'ess-extra-map' + bound to 'C-c C-e'; 'ess-dump-object-into-edit-buffer' was + moved on 'C-c C-e C-d' + - roxygen map was moved on 'C-c C-o' and 'ess-roxy-update-entry' + now resides on 'C-c C-o C-o' + - ess-handy-commands is not bound anymore + - 'ess-dev-map' (including 'ess-tracebug' and 'ess-developer') + moved on 'C-c C-t' + - 'C-c C-y' is deprecated in favor of 'C-c C-z C-z' + * ESS[R] new command 'ess-describe-object-at-point' bound to 'C-c C-d + C-e' (repeat 'C-e' or 'e' to cycle). It was inspired by Erik + Iverson's 'ess-R-object-tooltip'. Customize + 'ess-describe-at-point-method' to use tooltip instead of an + electric buffer. + * ESS: New command 'ess-build-tags-for-directory' bound to 'C-c C-e + C-t' for building dialect specific tag tables. After building tags + use 'M-.' to navigate to function and objects definitions. By + default 'C-c C-e C-t' builds tags based on imenu regular + expressions and also include other common languages '.c, .o, .cpp' + etc. But it relies on external 'find' and 'etags' commands. If + 'ess-build-tags-command' is defined (for 'R'), the inferior process + is asked to build tags instead. + * ESS: 'ess-switch-process' offers '*new*' alternative to start a new + process instead of switching to one of the currently running + processes. + * ESS: Switching between processes ('C-c C-s') uses buffer names + instead of the internal process names. Use 'M-x rename-buffer' + command to conveniently rename your process buffers. + * ESS: Process buffers can be automatically named on process creation + according to user specified scheme. Default schemes are *proc*, + *proc:dir* and *proc:abbr-long-dir* where 'proc' stands for the + internal process name and 'dir' stands for the directory where the + process was started in. The default is *proc*. For customization + see 'ess-gen-proc-buffer-name-function'. + * ESS: 'ess-eval-visibly-p' is deprecated in favor of + 'ess-eval-visibly'. + * ESS: New evaluation pattern 'nowait'. In addition to old 'nil' and + 't' values, 'ess-eval-visibly' accepts 'nowait' for a visible + evaluation with no waiting for the process. See 'ess-eval-visibly' + for details on evaluation patterns. + * ESS: New "Process" menu entry with process related commands and + configuration + * iESS: Process buffer is now automatically shown on errors + * ESS: New 'ess-switch-to-inferior-or-script-buffer' command bound to + 'C-c C-z' in both script and process buffers. If invoked form + process buffer it switches to the most recent buffer of the same + dialect. It is a single key command. + * ESSR-help: On multiple help pages with the same name, 'C-c C-v' now + asks for user resolution directly in emacs. + * ESS[R] ess-roxy: new variable 'ess-roxy-re' for fontification of + cases where the number of leading '#' differs from 'ess-roxy-str'. + * ESS[R] Eldoc was considerably enhanced. It now finds hidden + default S3 methods and displays non-default methods' arguments + after trailing ||. + * ESS[R]: New 'ess-display-demos' command bound to 'C-c C-d o' and + 'C-c C-d C-o' + * ESS: New 'ess-help-web-search' command bound to 'C-c C-d w' and + 'C-c C-d C-w' to facilitate interactive search of web resources. + Implemented for 'R', 'Stata' and 'Julia'. See also + 'ess-help-web-search-command'. + * ESS: ess-pdf-viewer-pref accepts now command line arguments + * ESS[Rnw]: Add knitr support. Customize 'ess-swv-processor' for the + default processor. + * ESS[Rnw]: More thorough renaming of remaining 'noweb-*' to + 'ess-noweb-*'. + * ESS[Rnw] new commands 'ess-eval-chunk-and-step' and + 'ess-eval-chunk' bound to 'M-n C-c' and 'M-n C-M-x' to mirror + standard ess commands in C-c map. + * ESS[R] Auto-completion: new variable 'ess-ac-R-argument-suffix' to + customize the insertion of trailing "=". Defaults to " = ". + * ESS[Julia]: Added index, apropos and web-search to julia. + * ESS help: More evaluation commands were added to ess-help mode + ('C-c C-c', 'C-M-x' etc) + + Bug Fixes in 12.09-1: + * iESShelp: Multiple help pages with the same name are properly + handled on 'C-c C-v' + * iESSremote: Evaluation with ESS remote no longer freezes emacs. + * iESS: 'comint-previous-prompt' 'C-c C-p' no longer stops on + secondary prompt "+". + * iESS[R], iESS(Sqpe) [S] on Windows: The 'options("editor")' is now + initialized to 'emacsclient' instead of the previous 'gnuclient'. + The user may need to add the line '(server-start)' to the emacs + initialization file. 'emacsclient' has been included with emacs + since GNU Emacs 22.1. + * ESS[Rnw] Fixed "connection to R" bug (in 12.09 only). + * ESS[Rnw] Explicit 'ess-swv-stangle' and 'ess-swv-sweave' functions. + * ESS[Rnw] Fixed completion and smart underscore problems cause by + unmatched "\"' + * ESS[R] is more careful with the 'R' code injection. It now happens + only once at the start of the session. + * ESS[R]: Fixed auto-scrolling the comint buffer on evaluation. + * ESS[Julia]: Solve several indentation and word navigation problems. + * ESS[Julia]: Help system works again. + + Changes/New Features in 12.09: + + * Due to XEmacs lacking some features that ESS requires, ESS support + of XEmacs ends with ESS 12.04-4. This decision will be re-visited + in the future as XEmacs continues to sync with GNU Emacs. + + * ESS[R]: On Windows, there is now a new customizable variable + (currently called 'ess-directory-containing-R') to tell ESS where + to look for the 'Rterm.exe' executables. The name of the variable + and the values it can take are both in beta and subject to change. + Prior to this variable, ESS searched only in the default + installation directory. Setting this variable now tells ESS how to + find 'Rterm.exe' executables when they are installed somewhere + else. + + * ESS[julia]: _new_ mode for editing julia code ('*.jl'). Start with + 'M-x julia'. + + Full interaction interface, imenu and basic error referencing are + available. + + * ESS[R] noweb: 'noweb-mode' and 'noweb-font-lock-mode' have been + renamed to 'ess-noweb-mode' and 'ess-noweb-font-lock-mode' to avoid + conflicts with the "real" 'noweb-mode'. + + * ESS[R] noweb: The long standing font-lock bug has been solved in + 'ess-noweb' interface. + + * ESS: Basic evaluation keys are now bound to 'ess-eval-region-*-' + functions: + + - 'C-M-x' is bound to 'ess-eval-region-or-function-or-paragraph' + - 'C-c C-c' is bound to + 'ess-eval-region-or-function-or-paragraph-and-step' + - 'C-RET' is bound to 'ess-eval-region-or-line-and-step' + + Each of these functions first evaluates the region whenever the + region is active. + + * ESS: 'C-M-a'/'C-M-e' now step to beginning/end of paragraph if no + function has been detected. + + * ESS: 'ess-eval-*-and-step' family of functions are now smarter, and + don't step to end of buffer or end of chunk code ('@') when at the + end of the code. + + * ESS: 'ess-handy-commands' function is bound to 'C-c h' + + * ESS: ESS is now _blinking_ the evaluated region. Set + 'ess-blink-region' to nil to deactivate; 'ess-blink-delay' gives + the duration of the blink. Evaluated region is "blinked" in + 'highlight' face. + + * ESS[R-help] New key 'a' for "apropos()" in help buffers. Also + available through 'C-c h'. + + * ESS[R-help] All R commands of type foo?bar and foo??bar are + recognized and redirected into appropriate *ESS-help* buffers. + + * ESS[R]: New customization interface for _font-lock_. + + ESS font-lock operates with predefined keywords. Default keywords + are listed in 'ess-R-font-lock-keywords' and + 'inferior-R-font-lock-keywords', which see. The user can easily + customize those by adding new keywords. These variables can also + be interactively accessed and saved through 'ESS/Font-lock' + submenu. + + Several new fontification keywords have been added. Most notably + the keywords for highlighting of function calls, numbers and + operators. + + * ESS[R]: auto-complete is now activated by default whenever + auto-complete package is detected. Set 'ess-use-auto-complete' to + nil to deactivate. + * ESS[R]: R AC sources are no longer auto-starting at 0 characters + but at the default 'ac-auto-start' characters. + * ESS no longer redefines default ac-sources, but only appends + 'ac-source-filename' to it. + * ESS: 'ac-source-R' now concatenates " = " to function arguments. + + * ESS: Menus for ESS and iESS have been reorganized and enriched with + _Tracebug_ and _Developer_ submenus. + + * ESS[R]: 'ess-developer' and 'ess-tracebug' commands are available + by default in 'ess-dev-map' which is bound to 'C-c d' in ESS and + iESS maps. + + * ESS[R]: 'eldoc' truncates long lines whenever + 'eldoc-echo-area-use-multiline-p' is non-nil (the default). Set + this variable to t if you insist on multiline eldoc. See also + 'ess-eldoc-abbreviation-style'. + + * ESS[R]: completion code pre-caches arguments of heavy generics such + as 'plot' and 'print' to eliminated the undesirable delay on first + request. + + * iESS: Prompts in inferior buffers are now highlighted uniformly + with 'comint-highlight-prompt' face. + + * ESS[R]: R process no longer wait for the completion of input in + inferior buffer. Thus, long running commands like 'Sys.sleep(5)' + no longer stall emacs. + + * ESS: [R, S, Stata, Julia] have specialized 'ess-X-post-run-hook's, + which are run at the end of subprocess initialization. + + * ESS[Stata]: All interactive evaluation commands work as expected. + On-line comments are removed before the evaluation and multiline + comments are skipped on 'C-c C-c' and other interactive commands. + + * ESS no longer auto-connects to a subprocess with a different + dialect than the current buffer's one. + + * ESS: 'ess-arg-function-offset-new-line' is now a list for all the + ESS indentation styles, which results in the following indentation + after an open "(": + + a <- some.function(other.function( + arg1, + arg2) + + * ESS[SAS]: Improved MS RTF support for GNU Emacs; try + 'ess-sas-rtf-portrait' and 'ess-sas-rtf-landscape'. + + Changes/Bug Fixes in 12.04-3: + * ESS: basic support for package.el compatibility + * ESS[R]: correct indentation of & and | continuation lines + * 'M-x ess-version' shows the svn revision even after 'make install' + * ESS[SAS]: improved XEmacs support + * iESS[R]: better finding of previous prompt + * ESS[Stata]: adjusted prompt for mata mode + * ESS[R]: resolved name clashes with cl.el + * ESS[R]: removed dependence on obsolete package assoc + * New 'make' target 'lisp', to build the lisp-only part, i.e., not + building the docs. + + Changes/New Features in 12.04-1: + * iESS[Stata]: New interactive help invocation. + * iESS[Stata]: New custom variable 'inferior-STA-start-file'. + * iESS[Stata]: 'inferior-STA-program-name' is now "stata" and can be + customized. + * ESS[Stata] New sections in stata help files Syntax('s-S'), + Remarks('r'), Title('t'). + + Bug Fixes in 12.04-1: + * ESS[R]: Better 'ess-tracebug' error handling. + * ESS[R]: Corrected 'ess-eldoc' help string filtering and improved + argument caching. + * ESS[R]: Indentation of non-block if/else/for/while lines fixed. + * 'M-x ess-version' should work better. + * ESS: Filename completion now again works inside strings. + * iESS[Stata]: Fixed prompt detection issue. + * ESS[Rd]: R is autostarted also from here, when needed. + + Changes/New Features in 12.04: + * ESS: Reverting new behavior of 12.03, 'TAB' in 'ess-mode' no longer + completes by default. If you want smart 'TAB' completion in R and + S scripts, similarly to iESS behavior, set the variable + 'ess-tab-complete-in-script' to 't'. Also see + 'ess-first-tab-never-complete' for how to customize where first + 'TAB' is allowed to complete. + * ESS: completion is consistently bound to 'M-TAB' (aka 'M-C-i') in + both Emacs23 and Emacs24. + * ESS: The variable 'ess-arg-function-offset-new-line' introduced in + ESS(12.03) now accepts a list with the first element a number to + indicate that the offset should be computed from the indent of the + previous line. For example setting it to '(2) results in: + + a <- some.function( + arg1, + arg2) + + Changes/New Features in 12.03: + * ESS indentation: new offset variable + 'ess-arg-function-offset-new-line' controlling for the indentation + of lines immediately following open '('. This is useful to shift + backwards function arguments after a long function call expression: + + a <- some.function( + arg1, + arg2) + + instead of the old + + a <- some.function( + arg1, + arg2) + + If '(' is not followed by new line the behavior is unchanged: + + a <- some.function(arg1, + arg2) + + This variable should be set as part of indentation style lists, or + in ess-mode hook. + * ESS[R]: 'C-c .' sets (indentation) style. + * ESS: In ESS buffers 'yank'('C-y') command accepts double argument + 'C-u C-u' to paste commands only. It deletes any lines not + beginning with a prompt, and then removes the prompt from those + lines that remain. Useful to paste code from emails, + documentation, inferior ESS buffers or transcript files. + * Documentation: ESS user manual has been rearranged and completed + with several new chapters and sections to reflect newly added + features ("Completion", "Developing with ESS", "ESS tracebug", "ESS + developer", "ESS ElDoc", "IDO Completion" and "Evaluating Code") + * RefCard: Reference card was updated to include new features. + * Eldoc: Eldoc was rewritten and is activated by default. See + 'ess-use-eldoc', 'ess-eldoc-show-on-symbol', + 'ess-eldoc-abbreviation-style' variables for how to change the + default behavior. _Note:_ 'skeleton-pair-insert-maybe' prohibits + eldoc display, on '(' insertion. + * ESS[R]: Eldoc shows arguments of a generic function whenever found. + * ESS: 'TAB' in 'ess-mode' now indents and completes, if there is + nothing to indent. Set 'ess-first-tab-never-completes-p' to 't' to + make 'TAB' never complete on first invocation. Completion + mechanism is similar to the completion in the 'inferior-ess-mode' - + a filename expansion is tried, if not found ESS completes the + symbol by querying the process. + * ESS for emacs version 24 or higher: ESS is fully compatible with + the emacs 24 completion scheme, i.e. all the completion is done by + 'completion-at-point'. Also in accordance with emacs conventions, + ESS doesn't bind 'M-TAB' for emacs 24 or higher. 'M-TAB' calls the + default 'complete-symbol'. + + * ESS[R]: Out of the box integration with 'Auto Completion' mode + http://cx4a.org/software/auto-complete + (http://cx4a.org/software/auto-complete) . Three AC sources + 'ac-source-R-args', 'ac-source-R-objects' and 'ac-source-R' are + provided. The last one combines the previous two and makes them + play nicely together. Set 'ess-use-auto-complete' to 't' to start + using it. Refer to documentation string of 'ac-use-auto-complete' + for further information. + * ESS[R]: New unified and fast argument completion system, comprised + of 'ess-funname.start', 'ess-function-arguments', + 'ess-get-object-at-point'. Eldoc and auto-completion integration + are using this system. + * ESS: 'ess-switch-to-end-of-ESS'('C-c C-z'), and + 'ess-switch-to-ESS'('C-c C-y'): Automatically start the process + whenever needed. + * ESS[R]: 'roxy' knows about previewing text version of the + documentation. Bound to 'C-c C-e t'. + * ESS[R]: Solved the "nil filename" bug in roxygen support. + * ESS[R]: 'ess-tracebug' is now part of ESS: + + New Features: + + - Source injection: Tracebug now can inject source references on + the fly during code evaluation, i.e. you don't have to source + your file, but just evaluate your code in normal fashion. + Variable 'ess-tracebug-inject-source-p' controls this behavior + - if t, always inject source reference, if ''function', inject + only for functions (this is the default), if 'nil', never + inject. + + During the source injection the value of 'ess-eval-visibly' is + ignored. + - Org-mode support: Visual debugger is now aware of the + temporary org source editing buffer ('C-c '') and jumps + through this buffers if still alive, or in original org buffer + otherwise. + - New keys in watch mode: '?' and 'd' + - Two new hooks: ess-tracebug-enter-hook and + ess-tracebug-exit-hook + + * ESS[R]: New package 'ess-developer' to evaluate 'R' code directly + in the package environment and namespace. It can be toggled on and + off with 'C-c d t'. When 'ess-developer' is on all ESS evaluation + commands are redefined to evaluate code in appropriate + environments. Add package names to the list of your development + packages with 'C-d a', and remove with 'C-d r'. Source the current + file with 'C-d s'.Evaluation function which depend on + '`ess-eval-region'' ask for the package to source the code into, + 'ess-eval-function' and alternatives search for the function name + in the development packages' environment and namespace and insert + the definition accordingly. See the documentation section + "Developing with ESS/ESS developer" for more details. + + * ESS[R] help system: + + New Features: + + - 'q' quits window instead of calling + 'ess-switch-to-end-of-ESS'. This is consistent with emacs + behavior help and other special buffers (_breaking change_). + - 'k' kills window without asking for the name (pointed by Sam + Steingold) + - Help map inherits from 'special-mode-map' as sugested by Sam + Steingold. + - Package index: new function 'ess-display-index' bound to 'i' + in help mode map. + - Package vignettes: new function 'ess-display-vignettes' bound + to 'v' in help mode map. + - Display help in HTML browser: new function + 'ess-display-help-in-browser' bound to 'w' in help mode map. + It depends on 'R''s 'browser' option. + - New custom variable 'ess-help-pop-to-buffer': if non-nil ESS + help buffers are given focus on display. The default is 't' + (_breaking change_). + - New menu entries for the above functions. + - Bogus help buffers are no longer generated by default, i.e. + buffers of the form "No documentation for 'foo' in specified + packages and libraries: you could try '??foo' ". + 'ess-help-kill-bogus-buffers' now defaults to 't'. Beware, + there may be instances where the default is unsatisfactory + such as debugging and/or during R development. Thanks to Ross + Boylan for making the suggestion, Sam Steingold for reminding + us of this variable and Martin Maechler for the warning. + * ESS now uses 'IDO' completing read functionality for all the + interactive requests. It uses ido completion mechanism whenever + available, and falls back on classical completing-read otherwise. + You can set 'ess-use-ido' to nil if you don't want the IDO + completion. See the documentation string of 'ess-use-ido' for more + information about 'IDO' and ESS configuration. + + * ESS[S]: "','" is bound to ess-smart-comma: If comma is invoked at + the process marker of an ESS inferior buffer, request and execute a + command from '`ess-handy-commands'' list. If + 'ess-R-smart-operators' is t '`ess-smart-comma' also inserts " " + after comma. + * ESS[S], notably 'R': Variable '`ess-handy-commands'' stores an + alist of useful commands which are called by 'ess-smart-comma' in + the inferior buffer. + + Currently containing: + + change-directory + 'ess-change-directory' + help-index + 'ess-display-index' + help-object + 'ess-display-help-on-object' + vignettes + 'ess-display-vignettes' + objects[ls] + 'ess-execute-objects' + search + 'ess-execute-search' + set-width + 'ess-execute-screen-options' + install.packages + 'ess-install.packages' + library + 'ess-library' + setRepos + 'ess-setRepositories' + sos + 'ess-sos' + + Handy commands: 'ess-library', 'ess-install.packages', etc - ask + for item with completion and execute the correspond command. + 'ess-sos' is a interface to 'findFn' function in package 'sos'. If + package 'sos' is not found, ask user for interactive install. + + * ESS: New dynamic mode line indicator: Process status is + automatically reflected in all mode-lines of associated with the + process buffers. Particularly useful for displaying debug status + of 'ess-tracebug' and developer status of 'ess-developer' in all + associated buffers. + + * ESS: New 'ess-completing-read' mechanism: ESS uses 'ido' + completions whenever possible. Variable 'ess-use-ido' controls + whether to use ido completion or not. Active by default. + + * ESS now supports comint fields for output and input detection. + This feature is not used by default, but might be useful in the + future. + + * ESS[S]: New custom variable 'inferior-ess-S-prompt' to customize + prompt detection regular expression in the inferior ESS buffers. + You can customize this variable to enhance comint navigation + ('comint-previous-prompt' and 'comint-next-prompt') the inferior + buffers. + + * ESS[R]: Internal 'R' completion retrieval + ('ess-R-complete-object-name') was rewritten and is faster now. + + * ESS is using process plist to store process specific variables, as + opposed to buffer local variables as it was using before. The use + of buffer local variables to store process variables is + discouraged. + + * ESS: new functions to manipulate process plists: 'ess-process-get' + and 'ess-process-set'. + + * ESS: Internal process waiting mechanism was completely rewritten. + ESS no more relies on prompt regular expressions for the prompt + detection. The only requirement on the primary process prompt is + to end in '> '. This could be overwritten by setting + 'inferor-ess-primary-prompt'. + + * ESS[S], notably 'R': Saved command history: ESS-HISTORY-FILE now + accepts 't' (default), 'nil', or a file name. By setting it to + 'nil' no command line history is saved anymore. + ESS-HISTORY-DIRECTORY now allows to have the history all saved in + one "central" file. + * ESS[R]: more Roxygen improvements. + * ESS[R]: 'C-c .' to set (indentation) style. + + * ESS[R]: Functions with non-standard names (for example + 'aaa-bbb:cc') are properly handled by font-lock and evaluation + routines. + * ESS[R]:Several regexp bugs (described in etc/R-ESS-bugs.el) were + fixed in 'ess-get-words-from-vector' and 'ess-command'. + + +File: ess.info, Node: Credits, Next: Latest version, Prev: New features, Up: Introduction + +1.3 Authors of and contributors to ESS +====================================== + +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) + + +File: ess.info, Node: Latest version, Next: Manual, Prev: Credits, Up: Introduction + +1.4 Getting the latest version of ESS +===================================== + +The latest released version of ESS is always available on the web at: +ESS web page (http://ess.r-project.org) or StatLib +(http://lib.stat.cmu.edu/general/ESS/) + +1.4.1 Git for ESS development +----------------------------- + +For development and experimentation on new ESS features, there is now a +GitHub branch for ESS, available at . + + +File: ess.info, Node: Manual, Prev: Latest version, Up: Introduction + +1.5 How to read this manual +=========================== + +If you need to install ESS, read *note Installation:: for details on +what needs to be done before proceeding to the next chapter. + + In this manual we use the standard notation for describing the +keystrokes used to invoke certain commands. 'C-' means hold the +CONTROL key while typing the character . 'M-' means hold the +META or EDIT or ALT key down while typing . If there is no META, +EDIT or ALT key, instead press and release the ESC key and then type +. + + All ESS commands can be invoked by typing 'M-x command'. Most of the +useful commands are bound to keystrokes for ease of use. Also, the most +popular commands are also available through the emacs menubar, and +finally, if available, a small subset are provided on the toolbar. +Where possible, keybindings are similar to other modes in emacs to +strive for a consistent user interface within emacs, regardless of the +details of which programming language is being edited, or process being +run. + + Some commands, such as 'M-x R' can accept an optional 'prefix' +argument. To specify the prefix argument, you would type 'C-u' before +giving the command. e.g. If you type 'C-u M-x R', you will be asked +for command line options that you wish to invoke the R process with. + + Emacs is often referred to as a 'self-documenting' text editor. This +applies to ESS in two ways. First, limited documentation about each ESS +command can be obtained by typing 'C-h f'. For example, if you type +'C-h f ess-eval-region', documentation for that command will appear in a +separate *Help* buffer. Second, a complete list of keybindings that are +available in each ESS mode and brief description of that mode is +available by typing 'C-h m' within an ESS buffer. + + Emacs is a versatile editor written in both C and lisp; ESS is +written in the Emacs lisp dialect (termed 'elisp') and thus benefits +from the flexible nature of lisp. In particular, many aspects of ESS +behaviour can be changed by suitable customization of lisp variables. +This manual mentions some of the most frequent variables. A full list +of them however is available by using the Custom facility within emacs. +(Type 'M-x customize-group RET ess RET' to get started.) *note +Customization:: provides details of common user variables you can change +to customize ESS to your taste, but it is recommended that you defer +this section until you are more familiar with ESS. + + +File: ess.info, Node: Installation, Next: Interactive ESS, Prev: Introduction, Up: Top + +2 Installing ESS on your system +******************************* + +The following section details those steps necessary to get ESS running +on your system. + +* Menu: + +* Step by step instructions:: +* License:: +* Stability:: +* Requirements:: + + +File: ess.info, Node: Step by step instructions, Next: License, Up: Installation + +2.1 Step by step instructions +============================= + + 1. Download the latest zip or tgz archive from ESS downloads area + (http://ess.r-project.org/index.php?Section=download) and unpack it + into a directory where you would like ESS to reside. We will + denote this directory as '/path/to/ESS/' hereafter. + + Alternatively you can use 'git' to fetch the most recent + development version to your local machine with: + + git clone https://github.com/emacs-ess/ESS.git /path/to/ESS + + 2. Optionally, compile elisp files and build the documentation with: + cd /path/to/ESS/ + make + Without this step, info, pdf and html documentation and reference + card will not be available. + + 3. Optionally, install into your local machine with 'make install'. + You might need administrative privileges: + + make install + + The files are installed into '/usr/share/emacs' directory. For + this step to run correctly on macOS, you will need to adjust the + 'PREFIX' path in 'Makeconf'. The necessary code and instructions + are commented in that file. + + 4. If you have performed the 'make install' step from above, just add + + (require 'ess-site) + + to your '~/.emacs' file. Otherwise, you should add + '/path/to/ESS/lisp/' to your emacs load path and then load ESS with + the following lines in your '~/.emacs': + + (add-to-list 'load-path "/path/to/ESS/lisp/") + (load "ess-site") + + 5. Restart your Emacs and check that ESS was loaded from a correct + location with 'M-x ess-version'. + + _Note for Windows and macOS users:_ The most straightforward way to +install Emacs on your machine is by downloading the Emacs binary by +Vincent Goulet; either Emacs Modified for macOS +(https://vigou3.github.io/emacs-modified-macos/) or from Emacs Modified +for Windows (https://vigou3.github.io/emacs-modified-windows/). + + _Note for XEmacs users:_ Due to XEmacs lacking some features that ESS +requires, ESS support of XEmacs ends with ESS 12.04-4. This decision +will be re-visited in the future as XEmacs continues to sync with GNU +Emacs. + + +File: ess.info, Node: License, Next: Stability, Prev: Step by step instructions, Up: Installation + +2.2 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: ess.info, Node: Stability, Next: Requirements, Prev: License, Up: Installation + +2.3 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: ess.info, Node: Requirements, Prev: Stability, Up: Installation + +2.4 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: ess.info, Node: Interactive ESS, Next: Entering commands, Prev: Installation, Up: Top + +3 Interacting with statistical programs +*************************************** + +As well as using ESS to edit your source files for statistical programs, +you can use ESS to run these statistical programs. In this chapter, we +mostly will refer by example to running S from within emacs. The emacs +convention is to name such processes running under its control as +'inferior processes'. This term can be slightly misleading, in which +case these processes can be thought of 'interactive processes'. Either +way, we use the term 'iESS' to refer to the Emacs mode used to interact +with statistical programs. + +* Menu: + +* Starting up:: +* Multiple ESS processes:: +* ESS processes on Remote Computers:: +* S+elsewhere and ESS-elsewhere:: +* Customizing startup:: + + +File: ess.info, Node: Starting up, Next: Multiple ESS processes, Up: Interactive ESS + +3.1 Starting an ESS process +=========================== + +To start an S session on Unix or on Windows when you use the Cygwin bash +shell, simply type 'M-x S RET'. + + To start an S session on Windows when you use the MSDOS prompt shell, +simply type 'M-x S+6-msdos RET'. + + S will then (by default) ask the question + S starting data directory? +Enter the name of the directory you wish to start S from (that is, the +directory you would have 'cd''d to before starting S from the shell). +This directory should have a '.Data' subdirectory. + + You will then be popped into a buffer with name '*S*' which will be +used for interacting with the ESS process, and you can start entering +commands. + + +File: ess.info, Node: Multiple ESS processes, Next: ESS processes on Remote Computers, Prev: Starting up, Up: Interactive ESS + +3.2 Running more than one ESS process +===================================== + +ESS allows you to run more than one ESS process simultaneously in the +same session. Each process has a name and a number; the initial process +(process 1) is simply named (using S-PLUS as an example) 'S+3:1'. The +name of the process is shown in the mode line in square brackets (for +example, '[S+3:2]'); this is useful if the process buffer is renamed. +Without a prefix argument, 'M-x S' starts a new ESS process, using the +first available process number. With a prefix argument (for R), 'C-u +M-x R' allows for the specification of command line options. + + You can switch to any active ESS process with the command 'M-x +ess-request-a-process'. Just enter the name of the process you require; +completion is provided over the names of all running S processes. This +is a good command to consider binding to a global key. + + +File: ess.info, Node: ESS processes on Remote Computers, Next: S+elsewhere and ESS-elsewhere, Prev: Multiple ESS processes, Up: Interactive ESS + +3.3 ESS processes on Remote Computers +===================================== + +ESS works with processes on remote computers as easily as with processes +on the local machine. The recommended way to access a statistical +program on remote computer is to start it with tramp. Require tramp in +your .emacs file: + + '(require 'tramp)' + + Now start an ssh session with 'C-x C-f /ssh:user@host: RET'. Tramp +should open a dired buffer in your remote home directory. Now call your +favorite ESS process ('R', 'Julia', 'stata' etc) as you would usually do +on local machine: 'M-x R'. + + Alternatively you can start your process normally ('M-x R'). After +you are asked for starting directory, simply type '/ssh:user@host: RET'. +R process will be started on the remote machine. + + To simplify the process even further create a "config" file in your +'.ssh/' folder and add an account. For example if you use amazon EC2, +it might look like following: + + Host amazon + Hostname ec2-54-215-203-181.us-west-1.compute.amazonaws.com + User ubuntu + IdentityFile ~/.ssh/my_amazon_key.pem + ForwardX11 yes + + With this configuration '/ssh:amazon:' is enough to start a +connection. The ForwardX11 is needed if you want to see R graphic +device showing on the current machine + + Other ways to setup a remote ESS connection are through 'ess-remote'. + + 1. Start a new shell, telnet or ssh buffer and connect to the remote + computer (e.g. use, 'M-x shell', 'M-x telnet' or 'M-x ssh'; ssh.el + is available at + ). + + 2. Start the ESS process on the remote machine, for example with one + of the commands 'Splus', or 'R', or 'sas -stdio'. + + 3. Start 'M-x ess-remote'. You will be prompted for a program name + with completion. Choose one. Your process is now known to ESS. + All the usual ESS commands ('C-c C-n' and its relatives) now work + with the S language processes. For SAS you need to use a different + command 'C-c i' (that is a regular 'i', not a 'C-i') to send lines + from your 'myfile.sas' to the remote SAS process. 'C-c i' sends + lines over invisibly. With ess-remote you get teletype + behavior--the data input, the log, and the listing all appear in + the same buffer. To make this work, you need to end every PROC and + DATA step with a "RUN;" statement. The "RUN;" statement is what + tells SAS that it should process the preceding input statements. + + 4. Graphics (interactive) on the remote machine. If you run X11 + (*Note X11::, X Windows) on both the local and remote machines then + you should be able to display the graphs locally by setting the + 'DISPLAY' environment variable appropriately. Windows users can + download 'xfree86' from cygwin. + + 5. Graphics (static) on the remote machine. If you don't run the X + window system on the local machine, then you can write graphics to + a file on the remote machine, and display the file in a graphics + viewer on the local machine. Most statistical software can write + one or more of postscript, GIF, or JPEG files. Depending on the + versions of emacs and the operating system that you are running, + emacs itself may display '.gif' and '.jpg' files. Otherwise, a + graphics file viewer will be needed. Ghostscript/ghostview may be + downloaded to display '.ps' and '.eps' files. Viewers for GIF and + JPEG are usually included with operating systems. *Note + ESS(SAS)--Function keys for batch processing::, for more + information on using the F12 key for displaying graphics files with + SAS. + + Should you or a colleague inadvertently start a statistical process +in an ordinary '*shell*' buffer, the 'ess-remote' command can be used to +convert it to an ESS buffer and allow you to use the ESS commands with +it. + + We have two older commands, now deprecated, for accessing ESS +processes on remote computers. *Note S+elsewhere and ESS-elsewhere::. + + +File: ess.info, Node: S+elsewhere and ESS-elsewhere, Next: Customizing startup, Prev: ESS processes on Remote Computers, Up: Interactive ESS + +3.4 S+elsewhere and ESS-elsewhere +================================= + +These commands are now deprecated. We recommend 'ess-remote'. We have +two versions of the elsewhere function. 'S+elsewhere' is specific for +the S-Plus program. The more general function 'ESS-elsewhere' is not as +stable. + + 1. Enter 'M-x S+elsewhere'. You will be prompted for a starting + directory. I usually give it my project directory on the local + machine, say '~myname/myproject/' + + Or enter 'M-x ESS-elsewhere'. You will be prompted for an ESS + program and for a starting directory. I usually give it my project + directory on the local machine, say '~myname/myproject/' + + 2. The '*S+3*' buffer will appear with a prompt from the local + operating system (the unix prompt on a unix workstation or with + cygwin bash on a PC, or the msdos prompt on a PC without bash). + emacs may freeze because the cursor is at the wrong place. + Unfreeze it with 'C-g' then move the cursor to the end with 'M->'. + With 'S+elsewhere' the buffer name is based on the name of the ESS + program. + 3. Enter 'telnet myname@other.machine' (or 'ssh + myname@other.machine'). You will be prompted for your password on + the remote machine. Use 'M-x send-invisible' before typing the + password itself. + + 4. Before starting the ESS process, type 'stty -echo nl' at the unix + prompt. The '-echo' turns off the echo, the 'nl' turns off the + newline that you see as '^M'. + + 5. You are now talking to the unix prompt on the other machine in the + '*S+3*' buffer. cd into the directory for the current project and + start the ESS process by entering 'Splus' or 'R' or 'sas -stdio' as + appropriate. If you can login remotely to your Windows 2000, then + you should be able to run 'Sqpe' on the Windows machine. I haven't + tested this and no-one has reported their tests to me. You will + not be able to run the GUI through this text-only connection. + + 6. Once you get the S or R or SAS prompt, then you are completely + connected. All the 'C-c C-n' and related commands work correctly + in sending commands from 'myfile.s' or 'myfile.r' on the PC to the + '*S+3*' buffer running the S or R or SAS program on the remote + machine. + + 7. Graphics on the remote machine works fine. If you run the X window + system on the remote unix machine you should be able to display + them in 'xfree86' on your PC. If you don't run X Windows, or X11, + then you can write graphics to the postscript device and copy it to + your PC with dired and display it with ghostscript. + + +File: ess.info, Node: Customizing startup, Prev: S+elsewhere and ESS-elsewhere, Up: Interactive ESS + +3.5 Changing the startup actions +================================ + +If you do not wish ESS to prompt for a starting directory when starting +a new process, set the variable 'ess-ask-for-ess-directory' to 'nil'. +In this case, the starting directory will be set using one of the +following methods: + + 1. If the variable 'ess-directory-function' stores the name of a + function, the value returned by this function is used. The default + for this variable is nil. + + 2. Otherwise, if the variable 'ess-directory' stores the name of a + directory (ending in a slash), this value is used. The default for + this variable is nil. + + 3. Otherwise, the working directory of the current buffer is used. + + If 'ess-ask-for-ess-directory' has a non-'nil' value (as it does by +default) then the value determined by the above rules provides the +default when prompting for the starting directory. Incidentally, +'ess-directory' is an ideal variable to set in 'ess-pre-run-hook'. + + If you like to keep a record of your S sessions, set the variable +'ess-ask-about-transfile' to 't', and you will be asked for a filename +for the transcript before the ESS process starts. + + -- User Option: ess-ask-about-transfile + If non-'nil', as for a file name in which to save the session + transcript. + + Enter the name of a file in which to save the transcript at the +prompt. If the file doesn't exist it will be created (and you should +give it a file name ending in '.St'); if the file already exists the +transcript will be appended to the file. (Note: if you don't set this +variable but you still want to save the transcript, you can still do it +later -- *note Saving transcripts::.) + + Once these questions are answered (if they are asked at all) the S +process itself is started by calling the program name specified in the +variable 'inferior-ess-program'. If you need to pass any arguments to +this program, they may be specified in the variable +'inferior-S_PROGRAM_NAME-args' (e.g. if 'inferior-ess-program' is +'"S+"' then the variable to set is 'inferior-S+-args'. It is not +normally necessary to pass arguments to the S program; in particular do +not pass the '-e' option to 'Splus', since ESS provides its own command +history mechanism. + + By default, the new process will be displayed in the same window in +the current frame. If you wish your S process to appear in a separate +variable, customize the variable 'inferior-ess-own-frame'. +Alternatively, change 'inferior-ess-same-window' if you wish the process +to appear within another window of the current frame. + + +File: ess.info, Node: Entering commands, Next: Evaluating code, Prev: Interactive ESS, Up: Top + +4 Interacting with the ESS process +********************************** + +The primary function of the ESS package is to provide an easy-to-use +front end to the S interpreter. This is achieved by running the S +process from within an Emacs buffer, called hereafter _inferior_ buffer, +which has an active 'inferior-ess-mode'. The features of Inferior S +mode are similar to those provided by the standard Emacs shell mode +(*note (emacs)Shell Mode::). Command-line completion of S objects and a +number of 'hot keys' for commonly-used S commands are also provided for +ease of typing. + +* Menu: + +* Command-line editing:: Entering commands and fixing mistakes +* Transcript:: Manipulating the transcript +* Command History:: Command History +* History expansion:: References to historical commands +* Hot keys:: Hot keys for common commands +* Statistical Process running in ESS?:: +* Emacsclient:: Using emacsclient +* Other:: Other commands provided by inferior-ESS + + +File: ess.info, Node: Command-line editing, Next: Transcript, Up: Entering commands + +4.1 Entering commands and fixing mistakes +========================================= + +Sending a command to the ESS process is as simple as typing it in and +pressing the key: + + -- Command: inferior-ess-send-input + 'RET' Send the command on the current line to the ESS process. + + If you make a typing error before pressing 'RET' all the usual Emacs +editing commands are available to correct it (*note Basic: +(emacs)Basic.). Once the command has been corrected you can press + (even if the cursor is not at the end of the line) to send the +corrected command to the ESS process. + + Emacs provides some other commands which are useful for fixing +mistakes: + +'C-c C-w' + 'backward-kill-word' Deletes the previous word (such as an object + name) on the command line. + +'C-c C-u' + 'comint-kill-input' Deletes everything from the prompt to point. + Use this to abandon a command you have not yet sent to the ESS + process. + +'C-c C-a' + 'comint-bol' Move to the beginning of the line, and then skip + forwards past the prompt, if any. + + *Note (emacs)Shell Mode::, for other commands relevant to entering +input. + + +File: ess.info, Node: Transcript, Next: Command History, Prev: Command-line editing, Up: Entering commands + +4.2 Manipulating the transcript +=============================== + +Most of the time, the cursor spends most of its time at the bottom of +the ESS process buffer, entering commands. However all the input and +output from the current (and previous) ESS sessions is stored in the +process buffer (we call this the transcript) and often we want to move +back up through the buffer, to look at the output from previous commands +for example. + + Within the process buffer, a paragraph is defined as the prompt, the +command after the prompt, and the output from the command. Thus 'M-{' +and 'M-}' move you backwards and forwards, respectively, through +commands in the transcript. A particularly useful command is 'M-h' +('mark-paragraph') which will allow you to mark a command and its entire +output (for deletion, perhaps). For more information about paragraph +commands, *note Paragraphs: (emacs)Paragraphs. + + If an ESS process finishes and you restart it in the same process +buffer, the output from the new ESS process appears after the output +from the first ESS process separated by a form-feed ('^L') character. +Thus pages in the ESS process buffer correspond to ESS sessions. Thus, +for example, you may use 'C-x [' and 'C-x ]' to move backward and +forwards through ESS sessions in a single ESS process buffer. For more +information about page commands, *note Pages: (emacs)Pages. + +* Menu: + +* Last command:: Manipulating the output from the last command +* Process buffer motion:: Viewing older commands +* Transcript resubmit:: Re-submitting commands from the transcript +* Saving transcripts:: Keeping a record of your S session + + +File: ess.info, Node: Last command, Next: Process buffer motion, Up: Transcript + +4.2.1 Manipulating the output from the last command +--------------------------------------------------- + +Viewing the output of the command you have just entered is a common +occurrence and ESS provides a number of facilities for doing this. +Whenever a command produces a longish output, it is possible that the +window will scroll, leaving the next prompt near the middle of the +window. The first part of the command output may have scrolled off the +top of the window, even though the entire output would fit in the window +if the prompt were near the bottom of the window. If this happens, you +can use the following comint commands: + + 'comint-show-maximum-output' to move to the end of the buffer, and +place cursor on bottom line of window to make more of the last output +visible. To make this happen automatically for all inputs, set the +variable 'comint-scroll-to-bottom-on-input' to 't' or ''this'. If the +first part of the output is still not visible, use 'C-c C-r' +('comint-show-output'), which moves cursor to the previous command line +and places it at the top of the window. + + Finally, if you want to discard the last command output altogether, +use 'C-c C-o' ('comint-delete-output'), which deletes everything from +the last command to the current prompt. Use this command judiciously to +keep your transcript to a more manageable size. + + +File: ess.info, Node: Process buffer motion, Next: Transcript resubmit, Prev: Last command, Up: Transcript + +4.2.2 Viewing older commands +---------------------------- + +If you want to view the output from more historic commands than the +previous command, commands are also provided to move backwards and +forwards through previously entered commands in the process buffer: + +'C-c C-p' + 'comint-previous-input' Moves point to the preceding command in the + process buffer. + +'C-c C-n' + 'comint-next-input' Moves point to the next command in the process + buffer. + +Note that these two commands are analogous to 'C-p' and 'C-n' but apply +to command lines rather than text lines. And just like 'C-p' and 'C-n', +passing a prefix argument to these commands means to move to the ARG'th +next (or previous) command. (These commands are also discussed in *note +Shell History Copying: (emacs)Shell History Copying.) + + There are also two similar commands (not bound to any keys by +default) which move to preceding or succeeding commands, but which first +prompt for a regular expression (*note Syntax of Regular Expression: +(emacs)Regexps.), and then moves to the next (previous) command matching +the pattern. + +'comint-backward-matching-input regexp arg' +'comint-forward-matching-input regexp arg' + Search backward (forward) through the transcript buffer for the + ARG'th previous (next) command matching REGEXP. ARG is the prefix + argument; REGEXP is prompted for in the minibuffer. + + +File: ess.info, Node: Transcript resubmit, Next: Saving transcripts, Prev: Process buffer motion, Up: Transcript + +4.2.3 Re-submitting commands from the transcript +------------------------------------------------ + +When moving through the transcript, you may wish to re-execute some of +the commands you find there. ESS provides three commands to do this; +these commands may be used whenever the cursor is within a command line +in the transcript (if the cursor is within some command _output_, an +error is signalled). Note all three commands involve the key. + +'RET' + 'inferior-ess-send-input' *Note Command-line editing::. + +'C-c RET' + 'comint-copy-old-input' Copy the command under the cursor to the + current command line, but don't execute it. Leaves the cursor on + the command line so that the copied command may be edited. + + When the cursor is not after the current prompt, the key has +a slightly different behavior than usual. Pressing 'RET' on any line +containing a command that you entered (i.e. a line beginning with a +prompt) sends that command to the ESS process once again. If you wish +to edit the command before executing it, use 'C-c RET' instead; it +copies the command to the current prompt but does not execute it, +allowing you to edit it before submitting it. + + These commands work even if the current line is a continuation line +(i.e. the prompt is '+' instead of '>') -- in this case all the lines +that form the multi-line command are concatenated together and the +resulting command is sent to the ESS process (currently this is the only +way to resubmit a multi-line command to the ESS process in one go). If +the current line does not begin with a prompt, an error is signalled. +This feature, coupled with the command-based motion commands described +above, could be used as a primitive history mechanism. ESS provides a +more sophisticated mechanism, however, which is described in *note +Command History::. + + +File: ess.info, Node: Saving transcripts, Prev: Transcript resubmit, Up: Transcript + +4.2.4 Keeping a record of your S session +---------------------------------------- + +To keep a record of your S session in a disk file, use the Emacs command +'C-x C-w' ('write-file') to attach a file to the ESS process buffer. +The name of the process buffer will (probably) change to the name of the +file, but this is not a problem. You can still use S as usual; just +remember to save the file before you quit Emacs with 'C-x C-s'. You can +make ESS prompt you for a filename in which to save the transcript every +time you start S by setting the variable 'ess-ask-about-transfile' to +'t'; *Note Customizing startup::. We recommend you save your +transcripts with filenames that end in '.St'. There is a special mode +(ESS transcript mode -- *note Transcript Mode::) for editing transcript +files which is automatically selected for files with this suffix. + + S transcripts can get very large, so some judicious editing is +appropriate if you are saving it in a file. Use 'C-c C-o' whenever a +command produces excessively long output (printing large arrays, for +example). Delete erroneous commands (and the resulting error messages +or other output) by moving to the command (or its output) and typing +'M-h C-w'. Also, remember that 'C-c C-x' (and other hot keys) may be +used for commands whose output you do not wish to appear in the +transcript. These suggestions are appropriate even if you are not +saving your transcript to disk, since the larger the transcript, the +more memory your Emacs process will use on the host machine. + + Finally, if you intend to produce S source code (suitable for using +with 'source()' or inclusion in an S function) from a transcript, then +the command 'ess-transcript-clean-region' may be of use. *note +Transcript Mode: Clean. + + +File: ess.info, Node: Command History, Next: History expansion, Prev: Transcript, Up: Entering commands + +4.3 Command History +=================== + +ESS provides easy-to-use facilities for re-executing or editing previous +commands. An input history of the last few commands is maintained (by +default the last 500 commands are stored, although this can be changed +by setting the variable 'comint-input-ring-size' in +'inferior-ess-mode-hook'.) The simplest history commands simply select +the next and previous commands in the input history: + +'M-p' + 'comint-previous-input' Select the previous command in the input + history. + +'M-n' + 'comint-next-input' Select the next command in the input history. + +For example, pressing 'M-p' once will re-enter the last command into the +process buffer after the prompt but does not send it to the ESS process, +thus allowing editing or correction of the command before the ESS +process sees it. Once corrections have been made, press 'RET' to send +the edited command to the ESS process. + + If you want to select a particular command from the history by +matching it against a regular expression (*note Syntax of Regular +Expression: (emacs)Regexps.), to search for a particular variable name +for example, these commands are also available: + +'M-r' + 'comint-history-isearch-backward-regexp' Prompt for a regular + expression, and search backwards through the input history for a + command matching the expression. + +A common type of search is to find the last command that began with a +particular sequence of characters; the following two commands provide an +easy way to do this: + +'C-c M-r' + 'comint-previous-matching-input-from-input' Select the previous + command in the history which matches the string typed so far. + +'C-c M-s' + 'comint-next-matching-input-from-input' Select the next command in + the history which matches the string typed so far. + +Instead of prompting for a regular expression to match against, as they +instead select commands starting with those characters already entered. +For instance, if you wanted to re-execute the last 'attach()' command, +you may only need to type 'att' and then 'C-c M-r' and 'RET'. + + *Note Shell History Ring: (emacs)Shell Ring, for a more detailed +discussion of the history mechanism, and do experiment with the 'In/Out' +menu to explore the possibilities. + + Many ESS users like to have even easier access to these, and +recommend to add something like + (eval-after-load "comint" + '(progn + (define-key comint-mode-map [up] + 'comint-previous-matching-input-from-input) + (define-key comint-mode-map [down] + 'comint-next-matching-input-from-input) + + ;; also recommended for ESS use -- + (setq comint-scroll-to-bottom-on-output 'others) + (setq comint-scroll-show-maximum-output t) + ;; somewhat extreme, almost disabling writing in *R*, *shell* buffers above prompt: + (setq comint-scroll-to-bottom-on-input 'this) + )) + to your '.emacs' file, where the last two settings are typically +desirable for the situation where you work with a script (e.g., +'code.R') and send code chunks to the process buffer (e.g. '*R*'). +Note however that these settings influence all 'comint'-using emacs +modes, not just the ESS ones, and for that reason, these customization +cannot be part of 'ESS' itself. + +* Menu: + +* Saving History:: + + +File: ess.info, Node: Saving History, Up: Command History + +4.3.1 Saving the command history +-------------------------------- + +The 'ess-history-file' variable, which is 't' by default, together with +'ess-history-directory', governs if and where the command history is +saved and restored between sessions. By default, +'ess-history-directory' is 'nil', and the command history will be stored +(as text file) in the 'ess-directory', e.g., as '.Rhistory'. + + Experienced ESS users often work exclusively with script files rather +than in a (e.g., '*R') console session, and may not want to save any +history files, and hence have: + + (setq ess-history-file nil) + +or will only want one global command history file and have: + + (setq ess-history-directory "~/.R/") + +in your '.emacs' file. + + +File: ess.info, Node: History expansion, Next: Hot keys, Prev: Command History, Up: Entering commands + +4.4 References to historical commands +===================================== + +Instead of searching through the command history using the command +described in the previous section, you can alternatively refer to a +historical command directly using a notation very similar to that used +in 'csh'. History references are introduced by a '!' or '^' character +and have meanings as follows: + +'!!' + The immediately previous command + +'!-N' + The Nth previous command + +'!text' + The last command beginning with the string 'text' + +'!?text' + The last command containing the string 'text' + + In addition, you may follow the reference with a "word designator" to +select particular "words" of the input. A word is defined as a sequence +of characters separated by whitespace. (You can modify this definition +by setting the value of 'comint-delimiter-argument-list' to a list of +characters that are allowed to separate words and themselves form +words.) Words are numbered beginning with zero. The word designator +usually begins with a ':' (colon) character; however it may be omitted +if the word reference begins with a '^', '$', '*' or '-'. If the word +is to be selected from the previous command, the second '!' character +can be omitted from the event specification. For instance, '!!:1' and +'!:1' both refer to the first word of the previous command, while '!!$' +and '!$' both refer to the last word in the previous command. The +format of word designators is as follows: + +'0' + The zeroth word (i.e. the first one on the command line) + +'N' + The Nth word, where N is a number + +'^' + The first word (i.e. the second one on the command line) + +'$' + The last word + +'X-Y' + A range of words; '-Y' abbreviates '0-Y' + +'*' + All the words except the zeroth word, or nothing if the command had + just one word (the zeroth) + +'X*' + Abbreviates X-$ + +'X-' + Like 'X*', but omitting the last word + + In addition, you may surround the entire reference except for the +first '!' by braces to allow it to be followed by other (non-whitespace) +characters (which will be appended to the expanded reference). + + Finally, ESS also provides quick substitution; a reference like +'^old^new^' means "the last command, but with the first occurrence of +the string 'old' replaced with the string 'new'" (the last '^' is +optional). Similarly, '^old^' means "the last command, with the first +occurrence of the string 'old' deleted" (again, the last '^' is +optional). + + To convert a history reference as described above to an input +suitable for S, you need to "expand" the history reference, using the + key. For this to work, the cursor must be preceded by a space +(otherwise it would try to complete an object name) and not be within a +string (otherwise it would try to complete a filename). So to expand +the history reference, type 'SPC TAB'. This will convert the history +reference into an S command from the history, which you can then edit or +press to execute. + + For example, to execute the last command that referenced the variable +'data', type '!?data SPC TAB RET'. + + +File: ess.info, Node: Hot keys, Next: Statistical Process running in ESS?, Prev: History expansion, Up: Entering commands + +4.5 Hot keys for common commands +================================ + +ESS provides a number of commands for executing the commonly used +functions. These commands below are basically information-gaining +commands (such as 'objects()' or 'search()') which tend to clutter up +your transcript and for this reason some of the hot keys display their +output in a temporary buffer instead of the process buffer by default. +This behavior is controlled by the following option: + + -- User Option: ess-execute-in-process-buffer + If non-'nil', means that these commands will produce their output + in the process buffer instead. + + In any case, passing a prefix argument to the commands (with 'C-u') +will reverse the meaning of 'ess-execute-in-process-buffer' for that +command, i.e. the output will be displayed in the process buffer if it +usually goes to a temporary buffer, and vice-versa. These are the hot +keys that behave in this way: + + -- Command: ess-execute-objects POSN + 'C-c C-x' Sends the 'objects()' command to the ESS process. A + prefix argument specifies the position on the search list (use a + negative argument to toggle 'ess-execute-in-process-buffer' as + well). A quick way to see what objects are in your working + directory. A prefix argument of 2 or more means get objects for + that position. A negative prefix argument POSN gets the objects + for that position, as well as toggling + 'ess-execute-in-process-buffer'. + + -- Command: ess-execute-search INVERT + 'C-c C-s' Sends the 'inferior-ess-search-list-command' command to + the 'ess-language' process; 'search()' in S. Prefix INVERT toggles + 'ess-execute-in-process-buffer'. + + 'ess-execute' may seem pointless when you could just type the command +in anyway, but it proves useful for 'spot' calculations which would +otherwise clutter your transcript, or for evaluating an expression while +partway through entering a command. You can also use this command to +generate new hot keys using the Emacs keyboard macro facilities; *note +Keyboard Macros: (emacs)Keyboard Macros. + + The following hot keys do not use 'ess-execute-in-process-buffer' to +decide where to display the output -- they either always display in the +process buffer or in a separate buffer, as indicated: + + -- Command: ess-load-file FILENAME + 'C-c C-l' Prompts for a file (FILENAME) to load into the ESS + process using 'source()'. If there is an error during loading, you + can jump to the error in the file with the following function. + + -- Command: ess-parse-errors ARG RESET + 'C-c `' or 'C-x `' Visits next 'next-error' message and + corresponding source code. If all the error messages parsed so far + have been processed already, the message buffer is checked for new + ones. A prefix ARG specifies how many error messages to move; + negative means move back to previous error messages. Just 'C-u' as + a prefix means reparse the error message buffer and start at the + first error. The RESET argument specifies restarting from the + beginning. + + *Note Error Checking::, for more details. + + -- Command: ess-display-help-on-object OBJECT COMMAND + 'C-c C-v' Pops up a help buffer for an S OBJECT or function. If + COMMAND is supplied, it is used instead of + 'inferior-ess-help-command'. See *note Help:: for more details. + + -- Command: ess-quit + 'C-c C-q' Issue an exiting command to the inferior process, + additionally also running 'ess-cleanup' for disposing of any + temporary buffers (such as help buffers and edit buffers) that may + have been created. Use this command when you have finished your S + session instead of simply quitting at the inferior process prompt, + otherwise you will need to issue the command 'ess-cleanup' + explicitly to make sure that all the files that need to be saved + have been saved, and that all the temporary buffers have been + killed. + + +File: ess.info, Node: Statistical Process running in ESS?, Next: Emacsclient, Prev: Hot keys, Up: Entering commands + +4.6 Is the Statistical Process running under ESS? +================================================= + +For the S languages (S, S-Plus, R) ESS sets an option in the current +process that programs in the language can check to determine the +environment in which they are currently running. + + ESS sets 'options(STERM="iESS")' for S language processes running in +an inferior 'iESS[S]' or 'iESS[R]' buffer. + + ESS sets 'options(STERM="ddeESS")' for independent S-Plus for Windows +processes running in the GUI and communicating with ESS via the DDE +(Microsoft Dynamic Data Exchange) protocol through a 'ddeESS[S]' buffer. + + Other values of 'options()$STERM' that we recommend are: + + * 'length': Fixed length xterm or telnet window. + * 'scrollable': Unlimited length xterm or telnet window. + * 'server': S-Plus Stat Server. + * 'BATCH': BATCH. + * 'Rgui': R GUI. + * 'Commands': S-Plus GUI without DDE interface to ESS. + + Additional values may be recommended in the future as new interaction +protocols are created. Unlike the values 'iESS' and 'ddeESS', ESS can't +set these other values since the S language program is not under the +control of ESS. + + +File: ess.info, Node: Emacsclient, Next: Other, Prev: Statistical Process running in ESS?, Up: Entering commands + +4.7 Using emacsclient +===================== + +When starting R or S under Unix, ESS sets +'options(editor="emacsclient")'. (Under Microsoft Windows, it will use +gnuclient.exe rather than emacsclient, but the same principle applies.) +Within your R session, for example, if you have a function called +'iterator', typing 'fix(iterator)', will show that function in a +temporary Emacs buffer. You can then correct the function. When you +kill the buffer, the definition of the function is updated. Using +'edit()' rather than 'fix()' means that the function is not updated. +Finally, the S function 'page(x)' will also show a text representation +of the object 'x' in a temporary Emacs buffer. + + +File: ess.info, Node: Other, Prev: Emacsclient, Up: Entering commands + +4.8 Other commands provided by inferior-ESS +=========================================== + +The following commands are also available in the process buffer: + + -- Command: comint-interrupt-subjob + 'C-c C-c' Sends a Control-C signal to the ESS process. This has + the effect of aborting the current command. + + -- Command: ess-switch-to-inferior-or-script-buffer TOGGLE-EOB + 'C-c C-z' When in process buffer, return to the most recent script + buffer. When in a script buffer pop to the associated process + buffer. This is a single key command, that is 'C-c C-z C-z' from a + script buffer returns to the original buffer. + + If TOGGLE-EOB is given, the value of + 'ess-switch-to-end-of-proc-buffer' is toggled. + + -- User Option: ess-switch-to-end-of-proc-buffer + If non-'nil', 'ess-switch-to-inferior-or-script-buffer' goes to end + of process buffer. + + Other commands available in Inferior S mode are discussed in *note +(emacs)Shell Mode::. + + +File: ess.info, Node: Evaluating code, Next: Transcript Mode, Prev: Entering commands, Up: Top + +5 Sending code to the ESS process +********************************* + +Other commands are also available for evaluating portions of code in the +S process. These commands cause the selected code to be evaluated +directly by the ESS process as if you had typed them in at the command +line; the 'source()' function is not used. You may choose whether both +the commands and their output appear in the process buffer (as if you +had typed in the commands yourself) or if the output alone is echoed. +The behavior is controlled by the variable: + + -- User Option: ess-eval-visibly + Non-'nil' means 'ess-eval-*' commands display commands and output + in the process buffer. Default is 't'. + + Passing a prefix ('C-u') VIS to any of the following commands, +however, reverses the meaning of 'ess-eval-visibly' for that command +only -- for example 'C-u C-c C-j' suppresses the current line of S (or +other) code in the ESS process buffer. This method of evaluation is an +alternative to S's 'source()' function when you want the input as well +as the output to be displayed. (You can sort of do this with 'source()' +when the option 'echo=T' is set, except that prompts do not get +displayed. ESS puts prompts in the right places.) + + Primary commands for evaluating code are: + + -- Command: ess-eval-region-or-line-and-step VIS + Send the highlighted region or current line and step to next line + of code. + + -- Command: ess-eval-region-or-function-or-paragraph VIS + 'C-M-x' Sends the current selected region or function or paragraph. + + -- Command: ess-eval-region-or-function-or-paragraph-and-step VIS + 'C-c C-c' Like 'ess-eval-region-or-function-or-paragraph' but steps + to next line of code. + + Other, not so often used, evaluation commands are: + + -- Command: ess-eval-line VIS + 'C-c C-j' Sends the current line to the ESS process. + + -- Command: ess-eval-line-and-go VIS + 'C-c M-j' Like 'ess-eval-line' but additionally switches point to + the ESS process. + + -- Command: ess-eval-function VIS NO-ERROR + 'C-c C-f' Sends the S function containing point to the ESS process. + + -- Command: ess-eval-function-and-go VIS + 'C-c M-f' Like 'ess-eval-function' but additionally switches point + to the ESS process. + + -- Command: ess-eval-region START END TOGGLE MESSAGE + 'C-c C-r' Sends the current region to the ESS process. + + -- Command: ess-eval-region-and-go START END VIS + 'C-c M-r' Like 'ess-eval-region' but additionally switches point to + the ESS process. + + -- Command: ess-eval-buffer VIS + 'C-c C-b' Sends the current buffer to the ESS process. + + -- Command: ess-eval-buffer-and-go VIS + 'C-c M-b' Like 'ess-eval-buffer' but additionally switches point to + the ESS process. + + All the above 'ess-eval-*' commands are useful for evaluating small +amounts of code and observing the results in the process buffer for +debugging purposes, or for generating transcripts from source files. +When editing S functions, it is generally preferable to use 'C-c C-l' to +update the function's value. In particular, 'ess-eval-buffer' is now +largely obsolete. + + A useful way to work is to divide the frame into two windows; one +containing the source code and the other containing the process buffer. +If you wish to make the process buffer scroll automatically when the +output reaches the bottom of the window, you will need to set the +variable 'comint-scroll-to-bottom-on-output' to ''others' or 't'. + + +File: ess.info, Node: Transcript Mode, Next: Editing objects, Prev: Evaluating code, Up: Top + +6 Manipulating saved transcript files +************************************* + +Inferior S mode records the transcript (the list of all commands +executed, and their output) in the process buffer, which can be saved as +a "transcript file", which should normally have the suffix '.St'. The +most obvious use for a transcript file is as a static record of the +actions you have performed in a particular S session. Sometimes, +however, you may wish to re-execute commands recorded in the transcript +file by submitting them to a running ESS process. This is what +Transcript Mode is for. + + If you load file a with the suffix '.St' into Emacs, it is placed in +S Transcript Mode. Transcript Mode is similar to Inferior S mode (*note +Entering commands::): paragraphs are defined as a command and its +output, and you can move though commands either with the paragraph +commands or with 'C-c C-p' and 'C-c C-n'. + +* Menu: + +* Resubmit:: Resubmitting commands from the transcript file +* Clean:: Cleaning transcript files + + +File: ess.info, Node: Resubmit, Next: Clean, Up: Transcript Mode + +6.1 Resubmitting commands from the transcript file +================================================== + +Three commands are provided to re-submit command lines from the +transcript file to a running ESS process. They are: + + -- Command: ess-transcript-send-command + 'M-RET' Sends the current command line to the ESS process, and + execute it. + + -- Command: ess-transcript-copy-command + 'C-c RET' Copy the current command to the ESS process, and switch + to it (ready to edit the copied command). + + -- Command: ess-transcript-send-command-and-move + 'RET' Sends the current command to the ESS process, and move to the + next command line. This command is useful for submitting a series + of commands. + +Note that the first two commands are similar to those on the same keys +in inferior S Mode. In all three cases, the commands should be executed +when the cursor is on a command line in the transcript; the prompt is +automatically removed before the command is submitted. + + +File: ess.info, Node: Clean, Prev: Resubmit, Up: Transcript Mode + +6.2 Cleaning transcript files +============================= + +Yet another use for transcript files is to extract the command lines for +inclusion in an S source file or function. Transcript mode provides one +command which does just this: + + -- Command: ess-transcript-clean-region BEG END EVEN-IF-READ-ONLY + 'C-c C-w' Strip the transcript in the region (given by BEG and + END), leaving only commands. Deletes any lines not beginning with + a prompt, and then removes the prompt from those lines that remain. + Prefix argument EVEN-IF-READ-ONLY means to clean even if the buffer + is read-only. Don't forget to remove any erroneous commands first! + +The remaining command lines may then be copied to a source file or edit +buffer for inclusion in a function definition, or may be evaluated +directly (*note Evaluating code::) using the code evaluation commands +from S mode, also available in S Transcript Mode. + + +File: ess.info, Node: Editing objects, Next: Help, Prev: Transcript Mode, Up: Top + +7 Editing objects and functions +******************************* + +ESS provides facilities for editing S objects within your Emacs session. +Most editing is performed on S functions, although in theory you may +edit datasets as well. Edit buffers are always associated with files, +although you may choose to make these files temporary if you wish. +Alternatively, you may make use of a simple yet powerful mechanism for +maintaining backups of text representations of S functions. +Error-checking is performed when S code is loaded into the ESS process. + +* Menu: + +* Edit buffer:: Edit objects in a specialized buffer +* Loading:: Loading source files into the ESS process +* Error Checking:: Detecting errors in source files +* Indenting:: Indenting and formatting S code +* Other edit buffer commands:: Commands for motion, completion and more +* Source Files:: Maintaining S source files +* Source Directories:: Names and locations of dump files + + +File: ess.info, Node: Edit buffer, Next: Loading, Up: Editing objects + +7.1 Creating or modifying S objects +=================================== + +To edit an S object, type + + -- Command: ess-dump-object-into-edit-buffer OBJECT + 'C-c C-e C-d' Edit an S OBJECT in its own edit buffer. + + from within the ESS process buffer ('*S*'). You will then be +prompted for an object to edit: you may either type in the name of an +existing object (for which completion is available using the 'TAB' key), +or you may enter the name of a new object. A buffer will be created +containing the text representation of the requested object or, if you +entered the name of a non-existent object at the prompt and the variable +'ess-function-template' is non-'nil', you will be presented with a +template defined by that variable, which defaults to a skeleton function +construct. + + You may then edit the function as required. The edit buffer +generated by 'ess-dump-object-into-edit-buffer' is placed in the 'ESS' +major mode which provides a number of commands to facilitate editing S +source code. Commands are provided to intelligently indent S code, +evaluate portions of S code and to move around S code constructs. + + Note: when you dump a file with 'C-c C-e C-d', ESS first checks to +see whether there already exists an edit buffer containing that object +and, if so, pops you directly to that buffer. If not, ESS next checks +whether there is a file in the appropriate place with the appropriate +name (*note Source Files::) and if so, reads in that file. You can use +this facility to return to an object you were editing in a previous +session (and which possibly was never loaded to the S session). +Finally, if both these tests fail, the ESS process is consulted and a +'dump()' command issued. If you want to force ESS to ask the ESS +process for the object's definition (say, to reformat an unmodified +buffer or to revert back to S's idea of the object's definition) pass a +prefix argument to 'ess-dump-object-into-edit-buffer' by typing 'C-u C-c +C-e C-d'. + + +File: ess.info, Node: Loading, Next: Error Checking, Prev: Edit buffer, Up: Editing objects + +7.2 Loading source files into the ESS process +============================================= + +The best way to get information -- particularly function definitions -- +into S is to load them in as source file, using S's 'source' function. +You have already seen how to create source files using 'C-c C-e C-d'; +ESS provides a complementary command for loading source files (even +files not created with ESS!) into the ESS process, namely +'ess-load-file' ('C-c C-l'). *note Hot keys::. + +After typing 'C-c C-l' you will prompt for the name of the file to load +into S; usually this is the current buffer's file which is the default +value (selected by simply pressing 'RET' at the prompt). You will be +asked to save the buffer first if it has been modified (this happens +automatically if the buffer was generated with 'C-c C-e C-d'). The file +will then be loaded, and if it loads successfully you will be returned +to the ESS process. + + +File: ess.info, Node: Error Checking, Next: Indenting, Prev: Loading, Up: Editing objects + +7.3 Detecting errors in source files +==================================== + +If any errors occur when loading a file with 'C-c C-l', ESS will inform +you of this fact. In this case, you can jump directly to the line in +the source file which caused the error by typing 'C-c `' +('ess-parse-errors'). You will be returned to the offending file +(loading it into a buffer if necessary) with point at the line S +reported as containing the error. You may then correct the error, and +reload the file. Note that none of the commands in an S source file +will take effect if any part of the file contains errors. + + Sometimes the error is not caused by a syntax error (loading a +non-existent file for example). In this case typing 'C-c `' will simply +display a buffer containing S's error message. You can force this +behavior (and avoid jumping to the file when there _is_ a syntax error) +by passing a prefix argument to 'ess-parse-errors' with 'C-u C-c `'. + + +File: ess.info, Node: Indenting, Next: Other edit buffer commands, Prev: Error Checking, Up: Editing objects + +7.4 Indenting and formatting S code +=================================== + +ESS provides a sophisticated mechanism for indenting S source code +(thanks to Ken'ichi Shibayama). Compound statements (delimited by '{' +and '}') are indented relative to their enclosing block. In addition, +the braces have been electrified to automatically indent to the correct +position when inserted, and optionally insert a newline at the +appropriate place as well. Lines which continue an incomplete +expression are indented relative to the first line of the expression. +Function definitions, 'if' statements, calls to 'expression()' and loop +constructs are all recognized and indented appropriately. User +variables are provided to control the amount of indentation in each +case, and there are also a number of predefined indentation styles to +choose from. + + Comments are also handled specially by ESS, using an idea borrowed +from the Emacs-Lisp indentation style. By default, comments beginning +with '###' are aligned to the beginning of the line. Comments beginning +with '##' are aligned to the current level of indentation for the block +containing the comment. Finally, comments beginning with '#' are +aligned to a column on the right (the 40th column by default, but this +value is controlled by the variable 'comment-column',) or just after the +expression on the line containing the comment if it extends beyond the +indentation column. You turn off the default behavior by adding the +line '(setq ess-indent-with-fancy-comments nil)' to your '.emacs' file. + + ESS also supports Roxygen entries which is R documentation maintained +in the source code as comments *Note Roxygen::. + + The indentation commands provided by ESS are: + + -- Command: ess-indent-or-complete + 'TAB' Indents the current line as S code. + + Try to indent first, and if code is already properly indented, + complete instead. In ess-mode, only tries completion if + 'ess-tab-complete-in-script' is non-nil. See also + 'ess-first-tab-never-complete'. + + -- User Option: ess-tab-complete-in-script + If non-'nil', 'TAB' in script buffers tries to complete if there is + nothing to indent. + + -- User Option: ess-first-tab-never-complete + If non-'nil', 'TAB' never tries to complete in ess-mode. The + default ''symbol' does not try to complete if the next char is a + valid symbol constituent. There are more options, see the help + ('C-h v'). + + -- Command: ess-indent-exp + 'TAB' Indents each line in the S (compound) expression which + follows point. Very useful for beautifying your S code. + + -- Command: ess-electric-brace + '{' '}' The braces automatically indent to the correct position + when typed. + + The following Emacs command are also helpful: + +'RET' +'LFD' + 'newline-and-indent' Insert a newline, and indent the next line. + (Note that most keyboards nowadays do not have a key, + but and 'C-j' are equivalent.) + +'M-;' + 'indent-for-comment' Indents an existing comment line + appropriately, or inserts an appropriate comment marker. + +* Menu: + +* Styles:: Changing styles for indentation and alignment + + +File: ess.info, Node: Styles, Up: Indenting + +7.4.1 Changing styles for code indentation and alignment +-------------------------------------------------------- + +The combined value of twelve variables (4 of three groups +'ess-indent-*', 'ess-offset-*' and 'ess-align-*') that control +indentation etc are collectively termed a style. ESS provides several +styles covering the common styles of indentation: 'DEFAULT', 'OWN', +'GNU', 'BSD', 'K&R', 'C++', 'RRR', 'RRR+', 'Rstudio', 'Rstudio-', and +'CLB'. The variable 'ess-style-alist' lists the value of each +indentation variable per style (and its documentation contains more). + + -- Command: ess-set-style + 'C-c C-e C-s' (or 'C-c C-e s') sets the formatting style in this + buffer to be one of the predefined styles, see above. The + 'DEFAULT' style uses the default values for the indenting + variables; The 'OWN' style allows you to use your own private + values of the indentation variable, see below. + (setq ess-default-style 'C++) + + -- User Option: ess-default-style + The default value of 'ess-style'. See the variable + 'ess-style-alist' for how these groups (DEFAULT, OWN, GNU, RRR, + ...) map onto different settings for variables. + + -- User Option: ess-style-alist + Predefined formatting styles for ESS code. Values for all groups, + except OWN, are fixed. To change the value of variables in the OWN + group, customize the variable 'ess-own-style-list'. The default + style in use is controlled by 'ess-default-style'. + + The styles 'DEFAULT' and 'OWN' are initially identical. If you wish +to edit some of the default values, set 'ess-default-style' to ''OWN' +and change 'ess-own-style-list'. *Note Customization::, for convenient +ways to set both these variables. + + If you prefer not to use the custom facility, you can change +individual indentation variables within a hook, for example: + + (defun myindent-ess-hook () + (setq ess-indent-level 4)) + (add-hook 'ess-mode-hook 'myindent-ess-hook) + + In the rare case that you'd like to add an entire new indentation +style of your own, copy the definition of 'ess-own-style-list' to a new +variable and ensure that the last line of the ':set' declaration calls +'ess-add-style' with a unique name for your style (e.g. ''MINE'). +Finally, add '(setq ess-default-style 'MINE)' to use your new style. + + +File: ess.info, Node: Other edit buffer commands, Next: Source Files, Prev: Indenting, Up: Editing objects + +7.5 Commands for motion, completion and more +============================================ + +A number of commands are provided to move across function definitions in +the edit buffer: + + -- Command: ess-goto-beginning-of-function-or-para + 'ESC C-a' aka 'C-M-a' If inside a function go to the beginning of + it, otherwise go to the beginning of paragraph. + + -- Command: ess-goto-end-of-function-or-para + 'ESC C-e' aka 'C-M-e' Move point to the end of the function + containing point. + + -- Command: ess-mark-function + 'ESC C-h' aka 'C-M-h' Place point at the beginning of the S + function containing point, and mark at the end. + +Don't forget the usual Emacs commands for moving over balanced +expressions and parentheses: *Note Lists and Sexps: (Emacs)Lists. + + Completion is provided in the edit buffer in a similar fashion to the +process buffer: first indents, and if there is nothing to indent, +completes the object or file name; 'M-?' lists file completions. See +*Note Completion::, for more. + + Finally, 'C-c C-z' ('ess-switch-to-inferior-or-script-buffer') +returns you to the 'iESS' process buffer, if done from a script buffer, +placing point at the end of the buffer. If this is done from the 'iESS' +process buffer, point is taken to the script buffer. + + In addition some commands available in the process buffer are also +available in the script buffer. You can still read help files with 'C-c +C-v', edit another function with 'C-c C-e C-d' and of course 'C-c C-l' +can be used to load a source file into S. + + +File: ess.info, Node: Source Files, Next: Source Directories, Prev: Other edit buffer commands, Up: Editing objects + +7.6 Maintaining S source files +============================== + +Every edit buffer in ESS is associated with a "dump file" on disk. Dump +files are created whenever you type 'C-c C-e C-d' +('ess-dump-object-into-edit-buffer'), and may either be deleted after +use, or kept as a backup file or as a means of keeping several versions +of an S function. + + -- User Option: ess-delete-dump-files + If non-'nil', dump files created with C-c C-e C-d are deleted + immediately after they are created by the ess-process. + + Since immediately after S dumps an object's definition to a disk file +the source code on disk corresponds exactly to S's idea of the object's +definition, the disk file isn't needed; deleting it now has the +advantage that if you _don't_ modify the file (say, because you just +wanted to look at the definition of one of the standard S functions) the +source dump file won't be left around when you kill the buffer. Note +that this variable only applies to files generated with S's 'dump' +function; it doesn't apply to source files which already exist. The +default value is 't'. + + -- User Option: ess-keep-dump-files + Variable controlling whether to delete dump files after a + successful load. If 'nil': always delete. If 'ask', confirm to + delete. If 'check', confirm to delete, except for files created + with 'ess-dump-object-into-edit-buffer'. Anything else, never + delete. This variable only affects the behaviour of + 'ess-load-file'. Dump files are never deleted if an error occurs + during the load. + + After an object has been successfully (i.e. without error) loaded +back into S with 'C-c C-l', the disk file again corresponds exactly +(well, almost -- see below) to S's record of the object's definition, +and so some people prefer to delete the disk file rather than +unnecessarily use up space. This option allows you to do just that. + + If the value of 'ess-keep-dump-files' is 't', dump files are never +deleted after they are loaded. Thus you can maintain a complete text +record of the functions you have edited within ESS. Backup files are +kept as usual, and so by using the Emacs numbered backup facility -- +*note Single or Numbered Backups: (emacs)Backup Names, you can keep a +historic record of function definitions. Another possibility is to +maintain the files with a version-control system such as RCS *Note +Version Control: (emacs)Version Control. As long as a dump file exists +in the appropriate place for a particular object, editing that object +with 'C-c C-e C-d' finds that file for editing (unless a prefix argument +is given) -- the ESS process is not consulted. Thus you can keep +comments _outside_ the function definition as a means of documentation +that does not clutter the S object itself. Another useful feature is +that you may format the code in any fashion you please without S +re-indenting the code every time you edit it. These features are +particularly useful for project-based work. + + If the value of 'ess-keep-dump-files' is nil, the dump file is always +silently deleted after a successful load with 'C-c C-l'. While this is +useful for files that were created with 'C-c C-e C-d' it also applies to +any other file you load (say, a source file of function definitions), +and so can be dangerous to use unless you are careful. Note that since +'ess-keep-dump-files' is buffer-local, you can make sure particular +files are not deleted by setting it to 't' in the Local Variables +section of the file *Note Local Variables in Files: (emacs)File +Variables. + + A safer option is to set 'ess-keep-dump-files' to 'ask'; this means +that ESS will always ask for confirmation before deleting the file. +Since this can get annoying if you always want to delete dump files +created with 'C-c C-e C-d', but not any other files, setting +'ess-keep-dump-files' to 'check' (the default value) will silently +delete dump files created with 'C-c C-e C-d' in the current Emacs +session, but query for any other file. Note that in any case you will +only be asked for confirmation once per file, and your answer is +remembered for the rest of the Emacs session. + + Note that in all cases, if an error (such as a syntax error) is +detected while loading the file with 'C-c C-l', the dump file is _never_ +deleted. This is so that you can edit the file in a new Emacs session +if you happen to quit Emacs before correcting the error. + + Dump buffers are always autosaved, regardless of the value of +'ess-keep-dump-files'. + + +File: ess.info, Node: Source Directories, Prev: Source Files, Up: Editing objects + +7.7 Names and locations of dump files +===================================== + +Every dump file should be given a unique file name, usually the dumped +object name with some additions. + + -- User Option: ess-dump-filename-template + Template for filenames of dumped objects. '%s' is replaced by the + object name. + +By default, dump file names are the user name, followed by '.' and the +object and ending with '.S'. Thus if user 'joe' dumps the object +'myfun' the dump file will have name 'joe.myfun.S'. The username part +is included to avoid clashes when dumping into a publicly-writable +directory, such as '/tmp'; you may wish to remove this part if you are +dumping into a directory owned by you. + + You may also specify the directory in which dump files are written: + + -- User Option: ess-source-directory + Directory name (ending in a slash) where S dump files are to be + written. + + By default, dump files are always written to '/tmp', which is fine +when 'ess-keep-dump-files' is 'nil'. If you are keeping dump files, +then you will probably want to keep them somewhere in your home +directory, say '~/S-source'. This could be achieved by including the +following line in your '.emacs' file: + (setq ess-source-directory (expand-file-name "~/S-source/")) + + If you would prefer to keep your dump files in separate directories +depending on the value of some variable, ESS provides a facility for +this also. By setting 'ess-source-directory' to a lambda expression +which evaluates to a directory name, you have a great deal of +flexibility in selecting the directory for a particular source file to +appear in. The lambda expression is evaluated with the process buffer +as the current buffer and so you can use the variables local to that +buffer to make your choice. For example, the following expression +causes source files to be saved in the subdirectory 'Src' of the +directory the ESS process was run in. + + (setq ess-source-directory + (lambda () + (concat ess-directory "Src/"))) + +('ess-directory' is a buffer-local variable in process buffers which +records the directory the ESS process was run from.) This is useful if +you keep your dump files and you often edit objects with the same name +in different ESS processes. Alternatively, if you often change your S +working directory during an S session, you may like to keep dump files +in some subdirectory of the directory pointed to by the first element of +the current search list. This way you can edit objects of the same name +in different directories during the one S session: + (setq ess-source-directory + (lambda () + (file-name-as-directory + (expand-file-name (concat + (car ess-search-list) + "/.Src"))))) + + If the directory generated by the lambda function does not exist but +can be created, you will be asked whether you wish to create the +directory. If you choose not to, or the directory cannot be created, +you will not be able to edit functions. + + +File: ess.info, Node: Help, Next: Completion, Prev: Editing objects, Up: Top + +8 Reading help files +******************** + +ESS provides an easy-to-use facility for reading S help files from +within Emacs. From within the ESS process buffer or any ESS edit +buffer, typing 'C-c C-v' ('ess-display-help-on-object') will prompt you +for the name of an object for which you would like documentation. +Completion is provided over all objects which have help files. + + If the requested object has documentation, you will be popped into a +buffer (named '*help(OBJ-NAME)*') containing the help file. This buffer +is placed in a special 'S Help' mode which disables the usual editing +commands but which provides a number of keys for paging through the help +file. + + Help commands: + +'?' + 'ess-describe-help-mode' Pops up a help buffer with a list of the + commands available in S help mode. + +'h' + 'ess-display-help-on-object' Pop up a help buffer for a different + object. + + Paging commands: + +'b' +'DEL' + 'scroll-down' Move one page backwards through the help file. + +'SPC' + 'scroll-up' Move one page forwards through the help file. + +'>' +'<' + 'end-of-buffer' Move to the beginning and end of the help file, + respectively. + + Section-based motion commands: + +'n' +'p' + 'ess-skip-to-previous-section' and 'ess-skip-to-next-section' Move + to the next and previous section header in the help file, + respectively. A section header consists of a number of capitalized + words, followed by a colon. + + In addition, the 's' key followed by one of the following letters +will jump to a particular section in the help file. Note that R uses +capitalized instead of all-capital section headers, e.g., 'Description:' +instead of 'DESCRIPTION:' and also only some versions of S(-plus) have +sections 'BACKGROUND', 'BUGS', 'OPTIONAL ARGUMENTS', 'REQUIRED +ARGUMENTS', and 'SIDE EFFECTS'. + + Do use 's ?' to get the current list of active key bindings. + +'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: + +'<' + Jumps to beginning of file + +'>' + Jumps to end of file + +'?' + Pops up a help buffer with a list of the defined section motion + keys. + + Evaluation: + +'l' + 'ess-eval-line-and-step' Evaluates the current line in the ESS + process, and moves to the next line. Useful for running examples + in help files. + +'r' + 'ess-eval-region' Send the contents of the current region to the + ESS process. Useful for running examples in help files. + + Quit commands: + +'q' + 'ess-help-quit' Return to previously selected buffer, and bury the + help buffer. + +'k' + 'kill-buffer' Return to previously selected buffer, and kills the + help buffer. + +'x' + 'ess-kill-buffer-and-go' Return to the ESS process, killing this + help buffer. + + Miscellaneous: + +'i' + 'ess-display-index' Prompt for a package and display it's help + index. + +'v' + 'ess-display-vignettes' Display all available vignettes. + +'w' + 'ess-display-help-in-browser' Display current help page with the + web browser. + +'/' + 'isearch-forward' Same as 'C-s'. + + In addition, all of the ESS commands available in the edit buffers +are also available in S help mode (*note Edit buffer::). Of course, the +usual (non-editing) Emacs commands are available, and for convenience +the digits and <-> act as prefix arguments. + + If a help buffer already exists for an object for which help is +requested, that buffer is popped to immediately; the ESS process is not +consulted at all. If the contents of the help file have changed, you +either need to kill the help buffer first, or pass a prefix argument +(with 'C-u') to 'ess-display-help-on-object'. + + Help buffers are marked as temporary buffers in ESS, and are deleted +when 'ess-quit' or 'ess-cleanup' are called. + + Help buffers normally appear in another window within the current +frame. If you wish help buffers to appear in their own frame (either +one per help buffer, or one for all help buffers), you can customize the +variable 'ess-help-own-frame'. + + +File: ess.info, Node: Completion, Next: Developing with ESS, Prev: Help, Up: Top + +9 Completion +************ + +* Menu: + +* Object names:: +* Function arguments:: +* Minibuffer completion:: +* Auto-complete:: +* Icicles:: + + +File: ess.info, Node: Object names, Next: Function arguments, Up: Completion + +9.1 Completion of object names +============================== + +The key is for completion. The value of the variable +'ess-first-tab-never-complete' controls when completion is allowed +controls when completion is allowed to occur. In 'ess-mode' first +tries to indent, and if there is nothing to indent, complete the object +name instead. + +'TAB' + 'comint-dynamic-complete' Complete the S object name or filename + before point. + + When the cursor is just after a partially-completed object name, +pressing provides completion in a similar fashion to 'tcsh' except +that completion is performed over all known S object names instead of +file names. ESS maintains a list of all objects known to S at any given +time, which basically consists of all objects (functions and datasets) +in every attached directory listed by the 'search()' command along with +the component objects of attached data frames (if your version of S +supports them). + + For example, consider the three functions (available in Splus version +3.0) called 'binomplot()', 'binom.test()' and 'binomial()'. Typing 'bin +TAB' after the S prompt will insert the characters 'om', completing the +longest prefix ('binom') which distinguishes these three commands. +Pressing 'TAB' once more provides a list of the three commands which +have this prefix, allowing you to add more characters (say, '.') which +specify the function you desire. After entering more characters +pressing 'TAB' yet again will complete the object name up to uniqueness, +etc. If you just wish to see what completions exist without adding any +extra characters, type 'M-?'. + + -- Command: ess-list-object-completions + 'M-?' List all possible completions of the object name at point. + + ESS also provides completion over the components of named lists and +environments (after '$'), S4 classes slots (after @), package and +namespace objects (after :: and :::). + + Completion is also provided over file names, which is particularly +useful when using S functions such as 'get()' or 'scan()' which require +fully expanded file names. + + In the Inferior ESS buffer, if the cursor is not in a string and does +not follow a (partial) object name, the key has a third use: it +expands history references. *Note History expansion::. + + Efficiency in completion is gained by maintaining a cache of objects +currently known to S; when a new object becomes available or is deleted, +only one component of the cache corresponding to the associated +directory needs to be refreshed. If ESS ever becomes confused about +what objects are available for completion (such as when if refuses to +complete an object you *know* is there), the command 'M-x ess-resynch' +forces the _entire_ cache to be refreshed, which should fix the problem. + + +File: ess.info, Node: Function arguments, Next: Minibuffer completion, Prev: Object names, Up: Completion + +9.2 Completion of function arguments +==================================== + +When inside a function call (i.e. following ''(''), 'TAB' completion +also provides function arguments. If function is a generic, completion +will provide all the arguments of 'S3' methods known to 'R'. + + A related functionality is *Note ESS ElDoc::, which displays function +arguments in the echo area whenever the point is inside a function call. + + +File: ess.info, Node: Minibuffer completion, Next: Auto-complete, Prev: Function arguments, Up: Completion + +9.3 Minibuffer completion +========================= + +From version 12.03, ESS uses 'IDO' mechanism (part of default emacs) for +minibuffer completion if 'ido.el' package is available and the value of +'ess-use-ido' it 't' (the default). The completion command +'ess-completing-read' falls back on classic 'completion-read' interface +if this feature is not available for whatever reason. + + +File: ess.info, Node: Auto-complete, Next: Icicles, Prev: Minibuffer completion, Up: Completion + +9.4 Integration with auto-complete package +========================================== + +ESS provides three sources for 'Auto Completion' mode: +'ac-source-R-args', 'ac-source-R-objects' and 'ac-source-R'. The last +one combines the previous two and makes them play nicely together. See +auto-complete package documentation +() for how to modify and +install your own completion sources. + + For the default auto-complete ESS configuration, install the latest +version of 'auto-complete' package. ESS automatically detect the +package and activates auto-complete in ESS buffers. + + To deactivate AC, place the following into your init file: + + (setq ess-use-auto-complete nil) + + Or, to activate auto-completion only in the 'ess-mode' buffers: + + (setq ess-use-auto-complete 'script-only) + + ESS provides AC help both for arguments and objects (default keys +'C-?' or ''). You can bind 'M-h' to display quick help pop-ups: + + (define-key ac-completing-map (kbd "M-h") 'ac-quick-help) + + 'AC' binds 'M-n', and 'M-p' for the navigation in the completion +menu, which might be inconvenient if you want it to use in the inferior +R. Bind it to something else: + + (define-key ac-completing-map "\M-n" nil) ;; was ac-next + (define-key ac-completing-map "\M-p" nil) ;; was ac-previous + (define-key ac-completing-map "\M-," 'ac-next) + (define-key ac-completing-map "\M-k" 'ac-previous) + + +File: ess.info, Node: Icicles, Prev: Auto-complete, Up: Completion + +9.5 Icicles +=========== + +Another option for comprehensively handling completion in Emacs is via +Icicles (). It allows users to +have completions shown temporarily in the standard '*Completions*' +buffer, and interactively select completion candidates using several +methods. As of version 2013.04.04, Icicles provides support for +completion in ESS. Please consult Icicles documentation, which is easily +accessible via 'customize-group Icicles', for more details on +installation and customization options. + + Once installed, Icicles can be activated by evaluating (maybe place +in '~/.emacs'): + + (require 'icicles) + (icy-mode 1) + + Icicles can be toggled at any moment by typing 'M-x icy'. + + When Icicles is on, 'TAB' offers completion, provided the conditions +determined by 'ess-first-tab-never-complete' allow it. Typing 'M-TAB' +will attempt completion regardless. Typing 'M-?' in 'ESS' or 'iESS' +modes brings up the relevant completion candidates from which to choose. +Minibuffer input filters the available candidates. Use 'TAB' for prefix +completion or 'S-TAB' for substring or regexp completion. Use 'S-SPC' +to match an additional pattern (repeatable). You can cycle among the +matching candidates, choosing with 'RET' or 'mouse-2'. + + +File: ess.info, Node: Developing with ESS, Next: Extras, Prev: Completion, Up: Top + +10 Developing with ESS +********************** + +ESS provides several tools to help you with the development of your R +packages: + +* Menu: + +* ESS tracebug:: Visual debugging, breakpoints, tracing, watch etc. +* Editing documentation:: Tools to edit R documentation +* Namespaced Evaluation:: Develop your packages on the fly + + +File: ess.info, Node: ESS tracebug, Next: Editing documentation, Up: Developing with ESS + +10.1 ESS tracebug +================= + +ESS 'tracebug' offers visual debugging, interactive error navigation, +interactive backtrace, breakpoint manipulation, control over R error +actions, watch window and interactive flagging/unflagging of functions +for debugging. + + From ESS13.05 'ess-tracebug' is on by default. You can toggle it on +and off with 'M-x' 'ess-tracebug'. To disable startup activation of +'ess-tracebug' set 'ess-use-tracebug' to nil. + + Tracebug functionality can be found on 'ess-dev-map', bound to 'C-c +C-t'. Additionally, when subprocess is in a debugging state +'ess-debug-minor-mode' is active and the following additional shortcuts +are available: + +* Interactive Debugging (`ess-debug-minor-mode-map'): + + M-C . Continue . `ess-debug-command-continue' + M-C-C . Continue multi . `ess-debug-command-continue-multi' + M-N . Next step . `ess-debug-command-next' + M-C-N . Next step multi . `ess-debug-command-next-multi' + M-U . Up frame . `ess-debug-command-up' + M-Q . Quit debugging . `ess-debug-command-quit' + + + These are all the tracebug commands defined in 'ess-dev-map' ('C-c +C-t ?' to show this table): + + +* Breakpoints (`ess-dev-map'): + + b . Set BP (repeat to cycle BP type) . `ess-bp-set' + B . Set conditional BP . `ess-bp-set-conditional' + k . Kill BP . `ess-bp-kil' + K . Kill all BPs . `ess-bp-kill-all' + o . Toggle BP state . `ess-bp-toggle-state' + l . Set logger BP . `ess-bp-set-logger' + n . Goto next BP . `ess-bp-next' + p . Goto previous BP . `ess-bp-previous' + + (C- prefixed equivalents are also defined) + +* Debugging (`ess-dev-map'): + ` . Show traceback . `ess-show-traceback' (also on C-c `) + ~ . Show callstack . `ess-show-call-stack' (also on C-c ~) + e . Toggle error action (repeat to cycle). `ess-debug-toggle-error-action' + d . Flag for debugging . `ess-debug-flag-for-debugging' + u . Unflag for debugging . `ess-debug-unflag-for-debugging' + w . Watch window . `ess-watch' + + (C- prefixed equivalents are also defined) + +* Navigation to errors (general emacs functionality): + + C-x `, M-g n . `next-error' + M-g p . `previous-error' + +* Misc: + +? . Show this help . `ess-tracebug-show-help' + + + To configure how electric watch window splits the display see +'ess-watch-width-threshold' and 'ess-watch-height-threshold' variables. + + A more detailed ess-tracebug documentation with screenshots is +available at . + + A short tutorial is at +. + + _Note:_ Currently, ess-tracebug does not detect some of R's debug +related messages in non-English locales. To set your R messages to +English add the following line to your .Rprofile init file: + + Sys.setlocale("LC_MESSAGES", "C") + + +File: ess.info, Node: Editing documentation, Next: Namespaced Evaluation, Prev: ESS tracebug, Up: Developing with ESS + +10.2 Editing documentation +========================== + +ESS provides two ways of writing documentation for R objects. Either +using the standard R documentation system or using in-source +documentation written as structured comment fields for use with the +Roxygen package. + +* Menu: + +* R documentation files:: Edit objects in a specialized buffer +* Roxygen:: Loading source files into the ESS process + + +File: ess.info, Node: R documentation files, Next: Roxygen, Up: Editing documentation + +10.2.1 Editing R documentation (Rd) files +----------------------------------------- + +R objects are documented in files written in the "R documentation" +("Rd"), a simple markup language closely resembling (La)TeX, which can +be processed into a variety of formats, including LaTeX, HTML, and plain +text. Rd format is described in section "Rd format" of the "Writing R +Extensions" manual in the R distribution. ESS has several features that +facilitate editing Rd files. + + Visiting an Rd file as characterized by its extension 'Rd' will +activate Rd Mode, which provides several facilities for making editing R +documentation files more convenient, by helping with indentation, +insertions, even doing some of the typing for you (with Abbrev Mode), +and by showing Rd keywords, strings, etc. in different faces (with Font +Lock Mode). + + Note that R also accepts Rd files with extension 'rd'; to activate +ESS[Rd] support for this extension, you may need to add + + (add-to-list 'auto-mode-alist '("\\.rd\\'" . Rd-mode)) + +to one of your Emacs startup files. + + In Rd mode, the following special Emacs commands can be used in +addition to the standard Emacs commands. + +'C-h m' + Describe the features of Rd mode. + +'LFD' +'RET' + Reindent the current line, insert a newline and indent the new line + ('reindent-then-newline-and-indent'). An abbrev before point is + expanded if 'abbrev-mode' is non-'nil'. + +'TAB' + Indent current line based on its contents and on previous lines. + ('indent-according-to-mode'). + +'C-c C-e' + Insert a "skeleton" with Rd markup for at least all mandatory + entries in Rd files ('Rd-mode-insert-skeleton'). Note that many + users might prefer to use the R function 'prompt' on an existing R + object to generate a non-empty Rd "shell" documenting the object + (which already has all information filled in which can be obtained + from the object). + +'C-c C-f' + Insert "font" specifiers for some of the Rd markup commands markup + available for emphasizing or quoting text, including markup for + URLs and email addresses ('Rd-font'). 'C-c C-f' is only a prefix; + see e.g. 'C-c C-f TAB' for the available bindings. Note that + currently, not all of the Rd text markup as described in section + "Marking text" of "Writing R Extensions" can be accessed via 'C-c + C-f'. + +'C-c C-j' + Insert a suitably indented '\item{' on the next line + ('Rd-mode-insert-item'). + +'C-c C-p' + Preview a plain text version ("help file", *note Help::) generated + from the Rd file ('Rd-preview-help'). + + In addition, when editing Rd files one can interact with a running R +process in a similar way as when editing R language files. E.g., 'C-c +C-v' provides access to on-line help, and 'C-c C-n' sends the current +line to the R process for evaluation. This interaction is particularly +useful when editing the examples in the Rd file. See 'C-h m' for all +available commands. + + Rd mode also provides access to abbreviations for most of the Rd +markup commands. Type 'M-x list-abbrevs' with Abbrev mode turned on to +list all available abbrevs. Note that all Rd abbrevs start with a grave +accent. + + Rd mode can be customized via the following variables. + + -- User Option: Rd-mode-hook + Hook to be run when Rd mode is entered. + + -- User Option: Rd-indent-level + The indentation of Rd code with respect to containing blocks. + Default is 2. + + -- User Option: Rd-to-help-command + The shell command used for converting Rd source to help text. + Default is 'R CMD Rd2txt'. + + To automatically turn on the abbrev and font-lock features of Rd +mode, add the following lines to one of your Emacs startup files: + + (add-hook 'Rd-mode-hook + (lambda () + (abbrev-mode 1) + (font-lock-mode 1))) + + +File: ess.info, Node: Roxygen, Prev: R documentation files, Up: Editing documentation + +10.2.2 Editing Roxygen documentation +------------------------------------ + +The Roxygen R package makes it possible to keep the intended contents +for Rd files as structured comments in the R source files. Roxygen can +then parse R files and generate appropriate Rd files from these +comments, fill the usage fields as well as updating 'NAMESPACE' files. +See the Roxygen documentation found via for more +information on its usage. An example of an Roxygen entry for a simple R +function can look like this: + + ##' Description of the function + ##' + ##' Further details about this function + ##' @title A title + ##' @param me all parameters must be listed and documented + ##' @return Description of the return value + ##' @author The author + myfun <- function(me) + cat("Hello", me, "\n") + The entry is immediately preceding the object to document and all +lines start with the Roxygen prefix string, in this case '##''. ESS +provides support to edit these documentation entries by providing line +filling, navigation, template generation etc. Syntax highlighting is +provided for Emacs but not for XEmacs. + + Roxygen is customized by the variables in the customization group +"Ess Roxy". Customizables include the Roxygen prefix, use of folding to +toggle visibility of Roxygen entries and the Roxygen template. + + All ESS Roxygen support is defined in 'ess-roxy.el' which is loaded +by default in ESS. The following special Emacs commands are provided. + + -- Command: ess-roxy-update-entry + 'C-c C-o C-o' Generate a Roxygen template or update the parameter + list in Roxygen entry at point (or above the function at the + point). Documented parameters that are not in the function are + placed last in the list, parameters that are not documented and not + in the definition are dropped. Parameter descriptions are filled + if 'ess-roxy-fill-param-p' is non-nil. + + -- Command: ess-roxy-toggle-roxy-region BEG END + 'C-c C-o C-c' Toggle the presence of the leading Roxygen string on + all lines in the marked region (between BEG and END. Convenient + for transferring text to Roxygen entries and to evaluate example + fields. + + -- Command: ess-roxy-preview-Rd NAME-FILE + 'C-c C-o C-r' Use the attached R process to parse the entry at + point to obtain the Rd code. Convenient for previewing and + checking syntax. When used with the prefix argument NAME-FILE, + i.e. 'C-u C-c C-e C-r', place the content in a buffer associated + with a Rd file with the same name as the documentation. Requires + the Roxygen package to be installed. + + -- Command: ess-roxy-preview-HTML VISIT-INSTEAD-OF-OPEN + 'C-c C-o C-t' Use the attached R process to parse the entry at to + generate HTML for the entry and open it in a browser. When used + with the prefix argument VISIT-INSTEAD-OF-OPEN, i.e. 'C-u C-c C-e + C-t', visit the generated HTML file instead. Requires the Roxygen + and tools packages to be installed. + + -- Command: ess-roxy-previous-entry + 'C-c C-o p' Go to start of the Roxygen entry above point. + + -- Command: ess-roxy-next-entry + 'C-c C-o n' Go to end of the Roxygen entry above point. + + -- Command: ess-roxy-hide-all + 'C-c C-o C-h' Use the hideshow mode to fold away the visibility of + all Roxygen entries. Hide-show support must be enabled for this + binding to get defined. + + ESS also advises the following standard editing functions in order to +make Roxygen editing more intuitive: + +'TAB' + 'ess-R-complete-object-name' Complete Roxygen tag at point. E.g. + doing 'TAB' when the point is at the end of '@par' completes to + '@param'. + +'M-h' + 'mark-paragraph' If the transient mark mode is active, place mark + and point at start end end of the field at point and activate the + mark. + +'TAB' + 'ess-indent-command' If hide-show support is enabled, fold away the + visibility of the Roxygen entry at point. + +'M-q' + 'fill-paragraph' Fill the Roxygen field at point. + +'C-a' + 'move-beginning-of-line' Move to the point directly to the right of + the Roxygen start string. + +'RET' + 'newline-and-indent' Insert a new line and the Roxygen prefix + string. + + +File: ess.info, Node: Namespaced Evaluation, Prev: Editing documentation, Up: Developing with ESS + +10.3 Namespaced Evaluation +========================== + +In non package files evaluation commands, *Note Evaluating code::, send +portions of the current buffer environment ('R_GlobalEnv'. When +developing packages, ESS sends code to the corresponding package +namespace and (for visible objects) into package environment (visible on +search path). All objects that are assigned are displayed in the +minibuffer alongside the environment in which they are assigned. + + Here is a short overview of how namespace and package environments +work in R. All objects defined in a package 'foo' are stored in an +environment called 'namespace:foo'. Parent environment of +'namespace:foo' is an environment 'imports:foo' which contains copies of +all objects from other packages which 'foo' imports. Parent environment +of 'imports:foo' is the 'namespace:base'. Parent environment of +'namespace:base' is .GlobalEnv. Thus functions and methods stored in +'namespace:foo' see all the objects in .GlobalEnv unless shadowed by +objects in 'imports:foo', 'namespace:base', or 'namespace:foo' itself. +There is another environment associated with 'foo' - 'package:foo'. +This environment stores *copies* of exported objects from +'namespace:foo' and is placed on the search() path, i.e. if 'foo' is +loaded and if you start with .GlobalEnv and iteratively call +parent.env() you will get eventually to 'package:foo'. Thus all methods +and functions defined in .GlobalEnv can "see" objects in 'package:foo' +environment. See also +. + + Ocasionally you want to evaluate into a package from a non-package +file, or the other way around, evaluate into 'GlobalEnv' from inside a +package. In such cases 'C-c C-t C-s' is your friend. + + -- Command: ess-r-set-evaluation-env ARG + 'C-c C-t C-s' Set or unset the current evaluation environment (a + package). + + +File: ess.info, Node: Extras, Next: ESS for S, Prev: Developing with ESS, Up: Top + +11 Other ESS features and tools +******************************* + +ESS has a few extra features, which didn't fit anywhere else. +* Menu: + +* ESS ElDoc:: Display function arguments in minibuffer +* Handy commands:: Usefully commands at your fingertips +* Highlighting:: Syntactic highlighting of buffers +* Parens:: Parenthesis matching +* Graphics:: Using graphics with ESS +* Imenu:: Support for Imenu in ESS +* Toolbar:: Support for toolbar in ESS +* TAGS:: Using TAGS for S files +* Rdired:: Directory editor for R objects +* Rutils:: R object/package management and help utilities +* Org:: Interaction with Org mode +* Sweave and AUCTeX:: Support for Sweave in ESS and AUCTeX + + +File: ess.info, Node: ESS ElDoc, Next: Handy commands, Up: Extras + +11.1 ElDoc +========== + +In 'ElDoc' mode, the echo area displays function's arguments at point. +From ESS version 12.03, ElDoc is active by default in 'ess-mode' and +'inferior-ess-mode' buffers. To activate it only in 'ess-mode' buffers, +place the following into your init file: + + (setq ess-use-eldoc 'script-only) + + -- User Option: ess-use-eldoc + If 't', activate eldoc in ess-mode and inferior-ess-mode buffers. + If ''script-only' activate in ess-mode buffers only. Set + 'ess-use-eldoc' to 'nil' to stop using 'ElDoc' altogether. + + -- User Option: ess-eldoc-show-on-symbol + This variable controls whether the help is shown only inside + function calls. If set to 't', 'ElDoc' shows help string whenever + the point is on a symbol, otherwise (the default), shows only when + the point is in a function call, i.e. after ''(''. + + -- User Option: ess-eldoc-abbreviation-style + The variable determines how the doc string should be abbreviated to + fit into minibuffer. Posible values are 'nil', 'mild', 'normal', + 'strong' and 'aggressive'. Please see the documentation of the + variable for more details. The default filter is 'normal'. + + Ess-eldoc also honors the value of 'eldoc-echo-area-use-multiline-p', +which if set to 'nil', will cause the truncation of doc string +indifferent of the value of 'ess-eldoc-abbreviation-style'. This way +you can combine different filter levels with the truncation. + + +File: ess.info, Node: Handy commands, Next: Highlighting, Prev: ESS ElDoc, Up: Extras + +11.2 Handy commands +=================== + + -- Command: ess-handy-commands + Request and execute a command from 'ess-handy-commands' list. + + -- User Option: ess-handy-commands + An alist of custom ESS commands available for call by + 'ess-handy-commands' and 'ess-smart-comma' function. + + Currently contains: + + change-directory + 'ess-change-directory' + help-index + 'ess-display-index' + help-object + 'ess-display-help-on-object' + vignettes + 'ess-display-vignettes' + objects[ls] + 'ess-execute-objects' + search + 'ess-execute-search' + set-width + 'ess-execute-screen-options' + install.packages + 'ess-install.packages' + library + 'ess-library' + setRepos + 'ess-setRepositories' + sos + 'ess-sos' + + Handy commands: 'ess-library', 'ess-install.packages', etc - ask for +item with completion and execute the correspond command. 'ess-sos' is a +interface to 'findFn' function in package 'sos'. If package 'sos' is +not found, ask user for interactive install. + + +File: ess.info, Node: Highlighting, Next: Parens, Prev: Handy commands, Up: Extras + +11.3 Syntactic highlighting of buffers +====================================== + +ESS provides Font-Lock (*note Using Multiple Typefaces: (emacs)Faces.) +patterns for Inferior S Mode, S Mode, and S Transcript Mode buffers. + + Syntax highlighting within ESS buffers is controlled by: + + -- User Option: ess-font-lock-mode + Non-'nil' means we use font lock support for ESS buffers. Default + is 't', to use font lock support. If you change the value of this + variable, restart Emacs for it to take effect. + + The font-lock patterns are defined by the following variables, which +you may modify if desired: + + -- User Option: inferior-R-font-lock-keywords + Font-lock patterns for inferior *R* processes. (There is a + corresponding 'inferior-S-font-lock-keywords' for *S* processes.) + The default value highlights prompts, inputs, assignments, output + messages, vector and matrix labels, and literals such as 'NA' and + 'TRUE'. + + -- User Option: ess-R-font-lock-keywords + Font-lock patterns for ESS R programming mode. (There is a + corresponding 'ess-S-font-lock-keywords' for S buffers.) The + default value highlights function names, literals, assignments, + source functions and reserved words. + + +File: ess.info, Node: Parens, Next: Graphics, Prev: Highlighting, Up: Extras + +11.4 Parenthesis matching +========================= + +Emacs and XEmacs have facilities for highlighting the parenthesis +matching the parenthesis at point. This feature is very useful when +trying to examine which parentheses match each other. This highlighting +also indicates when parentheses are not matching. Depending on what +version of emacs you use, one of the following should work in your +initialisation file: + + (paren-set-mode 'paren) ;for XEmacs + (show-paren-mode t) ;for Emacs + + +File: ess.info, Node: Graphics, Next: Imenu, Prev: Parens, Up: Extras + +11.5 Using graphics with ESS +============================ + +One of the main features of the 'S' package is its ability to generate +high-resolution graphics plots, and ESS provides a number of features +for dealing with such plots. + +* Menu: + +* printer:: The printer() graphics driver +* X11:: The X11() (and other X Windows based) driver +* winjava:: Java Graphics Device + + +File: ess.info, Node: printer, Next: X11, Up: Graphics + +11.5.1 Using ESS with the 'printer()' driver +-------------------------------------------- + +This is the simplest (and least desirable) method of using graphics +within ESS. S's 'printer()' device driver produces crude character based +plots which can be contained within the ESS process buffer itself. To +start using character graphics, issue the S command + printer(width=79) + (the 'width=79' argument prevents Emacs line-wrapping at column 80 on +an 80-column terminal. Use a different value for a terminal with a +different number of columns.) Plotting commands do not generate +graphics immediately, but are stored until the 'show()' command is +issued, which displays the current figure. + + +File: ess.info, Node: X11, Next: winjava, Prev: printer, Up: Graphics + +11.5.2 Using ESS with windowing devices +--------------------------------------- + +Of course, the ideal way to use graphics with ESS is to use a windowing +system. Under X Windows, or X11, this requires that the DISPLAY +environment variable be appropriately set. + + +File: ess.info, Node: winjava, Prev: X11, Up: Graphics + +11.5.3 Java Graphics Device +--------------------------- + +S+6.1 and newer on Windows contains a java library that supports +graphics. Send the commands: + + library(winjava) + java.graph() + +to start the graphics driver. This allows you to use ESS for both +interaction and graphics within S-PLUS. (Thanks to Tim Hesterberg for +this information.) + + +File: ess.info, Node: Imenu, Next: Toolbar, Prev: Graphics, Up: Extras + +11.6 Imenu +========== + +Imenu is an Emacs tool for providing mode-specific buffer indexes. In +some of the ESS editing modes (currently SAS and S), support for Imenu +is provided. For example, in S mode buffers, the menubar should display +an item called "Imenu-S". Within this menubar you will then be offered +bookmarks to particular parts of your source file (such as the starting +point of each function definition). + + Imenu works by searching your buffer for lines that match what ESS +thinks is the beginning of a suitable entry, e.g. the beginning of a +function definition. To examine the regular expression that ESS uses, +check the value of 'imenu-generic-expression'. This value is set by +various ESS variables such as 'ess-imenu-S-generic-expression'. + + +File: ess.info, Node: Toolbar, Next: TAGS, Prev: Imenu, Up: Extras + +11.7 Toolbar +============ + +The R and S editing modes have support for a toolbar. This toolbar +provides icons to act as shortcuts for starting new S/R processes, or +for evaluating regions of your source buffers. The toolbar should be +present if your emacs can display images. *Note Customization::, for +ways to change the toolbar. + + +File: ess.info, Node: TAGS, Next: Rdired, Prev: Toolbar, Up: Extras + +11.8 TAGS +========= + +The Emacs tags facility can be used to navigate around your files +containing definitions of S functions. This facility is independent of +ESS usage, but is written here since ESS users may wish to take +advantage of TAGS facility. Read more about emacs tags in an emacs +manual. + + Etags, the program that generates the TAGS file, does not yet know +the syntax to recognise function definitions in S files. Hence, you +will need to provide a regexp that matches your function definitions. +Here is an example call (broken over two lines; type as one line) that +should be appropriate. + + etags --language=none + --regex='/\([^ \t]+\)[ \t]*<-[ \t]*function/\1/' *.R + + This will find entries in your source file of the form: + + some.name <- function + + with the function name starting in column 0. Windows users may need +to change the single quotes to double quotes. + + R version 2.9.0 introduced a front-end script for finding R tags, +which calls the 'rtags()' function. By default, this script will +recursively search the directories for relevant tags in R/C/Rd files. +To use this script from the command line, try the following to get +started: + + R CMD rtags --help + + For further details, see + + +File: ess.info, Node: Rdired, Next: Rutils, Prev: TAGS, Up: Extras + +11.9 Rdired +=========== + +Ess-rdired provides a dired-like buffer for viewing, editing and +plotting objects in your current R session. If you are used to using +the dired (directory editor) facility in Emacs, this mode gives you +similar functionality for R objects. + + Start an R session with 'M-x R' and then store a few variables, such +as: + + s <- sin(seq(from=0, to=8*pi, length=100)) + x <- c(1, 4, 9) + y <- rnorm(20) + z <- TRUE + + Then use 'M-x ess-rdired' to create a buffer listing the objects in +your current environment and display it in a new window: + mode length + s numeric 100 + x numeric 3 + y numeric 20 + z logical 1 + + Type 'C-h m' or '?' to get a list of the keybindings for this mode. +For example, with your point on the line of a variable, 'p' will plot +the object, 'v' will view it, and 'd' will mark the object for deletion +('x' will actually perform the deletion). + + +File: ess.info, Node: Rutils, Next: Org, Prev: Rdired, Up: Extras + +11.10 Rutils +============ + +Ess-rutils builds up on ess-rdired, providing key bindings for +performing basic R functions in the inferior-ESS process buffer, such as +loading and managing packages, object manipulation (listing, viewing, +and deleting), and alternatives to 'help.start()' and 'RSiteSearch()' +that use the 'browse-url' Emacs function. The library can be loaded +using 'M-x load-file', but the easiest is to include: + + (require 'ess-rutils) + + in your .emacs. Once R is started with 'M-x R', and if the value of +the customizable variable 'ess-rutils-keys' is true, several key +bindings become available in iESS process buffers: + + -- Command: ess-rutils-local-pkgs + 'C-c C-. l' List all packages in all available libraries. + + -- Command: ess-rutils-repos-pkgs + 'C-c C-. r' List available packages from repositories listed by + 'getOptions(``repos'')' in the current R session. + + -- Command: ess-rutils-update-pkgs LIB REPOS + 'C-c C-. u' Update packages in a particular library LIB and + repository REPOS. + + -- Command: ess-rutils-apropos + 'C-c C-. a' Search for a string using apropos. + + -- Command: ess-rutils-rm-all + 'C-c C-. m' Remove all R objects. + + -- Command: ess-rutils-objs + 'C-c C-. o' Manipulate R objects; wrapper for 'ess-rdired'. + + -- Command: ess-rutils-load-wkspc + 'C-c C-. w' Load a workspace file into R. + + -- Command: ess-rutils-save-wkspc + 'C-c C-. s' Save a workspace file. + + -- Command: ess-change-directory + 'C-c C-. d' Change the working directory for the current R session. + + -- Command: ess-rutils-html-docs + 'C-c C-. H' Use 'browse-url' to navigate R html documentation. + + See the submenu 'Rutils' under the iESS menu for alternative access +to these functions. The function 'ess-rutils-rsitesearch' is provided +without a particular key binding. This function is useful in any Emacs +buffer, so can be bound to a user-defined key: + + (eval-after-load "ess-rutils" + '(global-set-key [(control c) (f6)] 'ess-rutils-rsitesearch)) + + Functions for listing objects and packages ('ess-rutils-local-pkgs', +'ess-rutils-repos-pkgs', and 'ess-rutils-objs') show results in a +separate buffer and window, in 'ess-rutils-mode', providing useful key +bindings in this mode (type '?' in this buffer for a description). + + +File: ess.info, Node: Org, Next: Sweave and AUCTeX, Prev: Rutils, Up: Extras + +11.11 Interaction with Org mode +=============================== + +Org-mode () now supports reproducible research and +literate programming in many languages (including R) - see chapter 14 of +the Org manual (). +For ESS users, this offers a document-based work environment within +which to embed ESS usage. R code lives in code blocks of an Org +document, from which it can be edited in ess-mode, evaluated, extracted +("tangled") to pure code files. The code can also be exported ("woven") +with the surrounding text to several formats including HTML and LaTeX. +Results of evaluation including figures can be captured in the Org +document, and data can be passed from the Org document (e.g. from a +table) to the ESS R process. (This section contributed by Dan Davison +and Eric Schulte.) + + +File: ess.info, Node: Sweave and AUCTeX, Prev: Org, Up: Extras + +11.12 Support for Sweave in ESS and AUCTeX +========================================== + +ESS provides support for writing and processing Sweave +(), building up on Emacs' +ess-noweb-mode for literate programming. When working on an Sweave +document, the following key bindings are available: + + -- Command: ess-swv-weave CHOOSE + 'M-n s' Run Sweave on the current .Rnw file. If CHOOSE is + non-'nil', offer a menu of available weavers. + + -- Command: ess-swv-latex + 'M-n l' Run LaTeX after Sweave'ing. + + -- Command: ess-swv-PS + 'M-n p' Generate and display a postscript file after LaTeX'ing. + + -- Command: ess-swv-PDF PDFLATEX-CMD + 'M-n P' Generate and display a PDF file after LaTeX'ing. Optional + argument PDFLATEX-CMD is the command to use, which by default, is + the command used to generate the PDF file is the first element of + 'ess-swv-pdflatex-commands'. + + -- User Option: ess-swv-pdflatex-commands + Commands used by 'ess-swv-PDF' to run a version of pdflatex; the + first entry is the default command. + + Sweave'ing with 'ess-swv-weave' starts an inferior-ESS process, if +one is not available. Other commands are available from the 'Sweaving, +Tangling, ...' submenu of the Noweb menu. + + AUCTeX () users may prefer to set +the variable 'ess-swv-plug-into-AUCTeX-p' (available from the "ESS +Sweave" customization group) to t. Alternatively, the same can be +achieved by activating the entry "AUCTeX Interface" from the 'Sweaving, +Tangling, ...' submenu, which toggles this variable on or off. When the +interface is activated, new entries for Sweave'ing and LaTeX'ing +thereafter are available from AUCTeX's "Command" menu. Sweave'ing can, +thus, be done by 'C-c C-c Sweave RET' without an inferior-ESS process. +Similarly, LaTeX'ing can be done by 'C-c C-c LaTeXSweave RET'. In both +cases, the process can be monitored with 'C-c C-l' +('TeX-recenter-output-buffer'). Open the viewer with 'C-c C-v' +('TeX-view'), as usual in AUCTeX. + + +File: ess.info, Node: ESS for S, Next: ESS for SAS, Prev: Extras, Up: Top + +12 Overview of ESS features for the S family +******************************************** + +* Menu: + +* ESS(S)--Editing files:: +* iESS(S)--Inferior ESS processes:: +* ESS-help--assistance with viewing help:: +* Philosophies for using ESS(S):: +* Scenarios for use (possibilities--based on actual usage):: +* Customization Examples and Solutions to Problems:: + + +File: ess.info, Node: ESS(S)--Editing files, Next: iESS(S)--Inferior ESS processes, Prev: ESS for S, Up: ESS for S + +12.1 ESS[S]-Editing files +========================= + +ESS[S] is the mode for editing S language files. This mode handles: + + - proper indenting, generated by both [Tab] and [Return]. + - color and font choices based on syntax. + - ability to send the contents of an entire buffer, a highlighted + region, an S function, or a single line to an inferior S process, + if one is currently running. + - ability to switch between processes which would be the target of + the buffer (for the above). + - The ability to request help from an S process for variables and + functions, and to have the results sent into a separate buffer. + - completion of object names and file names. + + ESS[S] mode should be automatically turned on when loading a file +with the suffices found in ess-site (*.R, *.S, *.s, etc). +Alternatively, type 'M-x R-mode' to put the current buffer into R mode. +However, one will have to start up an inferior process to take advantage +of the interactive features. + + +File: ess.info, Node: iESS(S)--Inferior ESS processes, Next: ESS-help--assistance with viewing help, Prev: ESS(S)--Editing files, Up: ESS for S + +12.2 iESS[S]-Inferior ESS processes +=================================== + +iESS (inferior ESS) is the mode for interfacing with active statistical +processes (programs). This mode handles: + + - proper indenting, generated by both [Tab] and [Return]. + - color and font highlighting based on syntax. + - ability to resubmit the contents of a multi-line command to the + executing process with a single keystroke [RET]. + - The ability to request help from the current process for variables + and functions, and to have the results sent into a separate buffer. + - completion of object names and file names. + - interactive history mechanism. + - transcript recording and editing. + + To start up iESS mode, use: + M-x S+3 + M-x S4 + M-x S+5 + M-x S+6 + M-x R + + (for S-PLUS 3.x, S4, S+5, S+6 or S+7, and R, respectively. This +assumes that you have access to each). Usually the site will have +defined one of these programs (by default S+6) to the simpler name: + + M-x S + + In the (rare) case that you wish to pass command line arguments to +the starting S+6 process, set the variable 'inferior-Splus-args'. + + Note that R has some extremely useful command line arguments. For +example, '--vanilla' will ensure R starts up without loading in any init +files. To enter a command line argument, call R using a "prefix +argument", by + + C-u M-x R + + and when ESS prompts for "Starting Args ? ", enter (for example): + + '--vanilla' + + Then that R process will be started up using 'R --vanilla'. If you +wish to always call R with certain arguments, set the variable +'inferior-R-args' accordingly. + + If you have other versions of R or S-Plus available on the system, +ESS is also able to start those versions. How this exactly works depend +on which OS you are using, as described in the following paragraphs. +The general principle, regardless of OS, is that ESS searches the paths +listed in the variable 'exec-path' for R binaries. If ESS cannot find +your R binaries, on Unix you can change the unix environment variable +'PATH', as this variable is used to set 'exec-path'. + + R on Unix systems: If you have "R-1.8.1" on your 'exec-path', it can +be started using 'M-x R-1.8.1'. By default, ESS will find versions of R +beginning "R-1" or "R-2". If your versions of R are called other names, +consider renaming them with a symbolic link or change the variable +'ess-r-versions'. To see which functions have been created for starting +different versions of R, type 'M-x R-' and then hit [Tab]. These other +versions of R can also be started from the "ESS->Start Process->Other" +menu. + + R on Windows systems: If you have "rw1081" on your 'exec-path', it +can be started using 'M-x rw1081'. By default, ESS will find versions +of R located in directories parallel to the version of R in your 'PATH'. +If your versions of R are called other names, you will need to change +the variable 'ess-rterm-versions'. To see which functions have been +created for starting different versions of R, type 'M-x rw' and then hit +[Tab]. These other versions of R can also be started from the +"ESS->Start Process->Other" menu. + + Once ESS has found these extra versions of R, it will then create a +new function, called 'M-x R-newest', which will call the newest version +of R that it found. (ESS examines the date in the first line of +information from 'R --version' to determine which is newest.) + + S on Unix systems: If you have "Splus7" on your 'exec-path', it can +be started using 'M-x Splus7'. By default, ESS will find all +executables beginning "Splus" on your path. If your versions of S are +called other names, consider renaming them with a symbolic link or +change the variable 'ess-s-versions'. To see which functions have been +created for starting different versions of Splus, type 'M-x Splus' and +then hit [Tab]. These other versions of Splus can also be started from +the "ESS->Start Process->Other" menu. + + A second mechanism is also available for running other versions of +Splus. The variable 'ess-s-versions-list' is a list of lists; each +sublist should be of the form: (DEFUN-NAME PATH ARGS). DEFUN-NAME is the +name of the new emacs function you wish to create to start the new S +process; PATH is the full path to the version of S you want to run; ARGS +is an optional string of command-line arguments to pass to the S +process. Here is an example setting: + (setq ess-s-versions-list + '( ("Splus64" "/usr/local/bin/Splus64") + ("Splus64-j" "/usr/local/bin/Splus64" "-j"))) + which will then allow you to do 'M-x Splus64-j' to start Splus64 with +the corresponding command line arguments. + + If you change the value of either 'ess-s-versions' or +'ess-s-versions-list', you should put them in your .emacs before +ess-site is loaded, since the new emacs functions are created when ESS +is loaded. + + Sqpe (S-Plus running inside an emacs buffer) on Windows systems: If +you have an older version of S-Plus (S-Plus 6.1 for example) on your +system, ir can be started inside an emacs buffer with 'M-x splus61'. By +default, ESS will find versions of S-Plus located in the installation +directories that Insightful uses by default. If your versions of S-Plus +are anywhere else, you will need to change the variable +'ess-SHOME-versions'. To see which functions have been created for +starting different versions of S-Plus, type 'M-x spl' and then hit +[Tab]. These other versions of S-Plus can also be started from the +"ESS->Start Process->Other" menu. + + +File: ess.info, Node: ESS-help--assistance with viewing help, Next: Philosophies for using ESS(S), Prev: iESS(S)--Inferior ESS processes, Up: ESS for S + +12.3 ESS-help-assistance with viewing help +========================================== + +ESS has built-in facilities for viewing help files from S. *Note Help::. + + +File: ess.info, Node: Philosophies for using ESS(S), Next: Scenarios for use (possibilities--based on actual usage), Prev: ESS-help--assistance with viewing help, Up: ESS for S + +12.4 Philosophies for using ESS[S] +================================== + +The first is preferred, and configured for. The second one can be +retrieved again, by changing emacs variables. + + 1: (preferred by the current group of developers): The source code is +real. The objects are realizations of the source code. Source for +EVERY user modified object is placed in a particular directory or +directories, for later editing and retrieval. + + 2: (older version): S objects are real. Source code is a temporary +realization of the objects. Dumped buffers should not be saved. +_We_strongly_discourage_this_approach_. However, if you insist, add the +following lines to your .emacs file: + (setq ess-keep-dump-files 'nil) + (setq ess-delete-dump-files t) + (setq ess-mode-silently-save nil) + The second saves a small amount of disk space. The first allows for +better portability as well as external version control for code. + + +File: ess.info, Node: Scenarios for use (possibilities--based on actual usage), Next: Customization Examples and Solutions to Problems, Prev: Philosophies for using ESS(S), Up: ESS for S + +12.5 Scenarios for use (possibilities-based on actual usage) +============================================================ + +We present some basic suggestions for using ESS to interact with S. +These are just a subset of approaches, many better approaches are +possible. Contributions of examples of how you work with ESS are +appreciated (especially since it helps us determine priorities on future +enhancements)! (comments as to what should be happening are prefixed by +"##"). + 1: ## Data Analysis Example (source code is real) + ## Load the file you want to work with + C-x C-f myfile.s + + ## Edit as appropriate, and then start up S-PLUS 3.x + M-x S+3 + + ## A new buffer *S+3:1* will appear. Splus will have been started + ## in this buffer. The buffer is in iESS [S+3:1] mode. + + ## Split the screen and go back to the file editing buffer. + C-x 2 C-x b myfile.s + + ## Send regions, lines, or the entire file contents to S-PLUS. For regions, + ## highlight a region with keystrokes or mouse and then send with: + C-c C-r + + ## Re-edit myfile.s as necessary to correct any difficulties. Add + ## new commands here. Send them to S by region with C-c C-r, or + ## one line at a time with C-c C-n. + + ## Save the revised myfile.s with C-x C-s. + + ## Save the entire *S+3:1* interaction buffer with C-c C-s. You + ## will be prompted for a file name. The recommended name is + ## myfile.St. With the *.St suffix, the file will come up in ESS + ## Transcript mode the next time it is accessed from Emacs. + + + + 2: ## Program revision example (source code is real) + + ## Start up S-PLUS 3.x in a process buffer (this will be *S+3:1*) + M-x S+3 + + ## Load the file you want to work with + C-x C-f myfile.s + + ## edit program, functions, and code in myfile.s, and send revised + ## functions to S when ready with + C-c C-f + ## or highlighted regions with + C-c C-r + ## or individual lines with + C-c C-n + ## or load the entire buffer with + C-c C-l + + ## save the revised myfile.s when you have finished + C-c C-s + + + + 3: ## Program revision example (S object is real) + + ## Start up S-PLUS 3.x in a process buffer (this will be *S+3:1*) + M-x S+3 + + ## Dump an existing S object my.function into a buffer to work with + C-c C-d my.function + ## a new buffer named yourloginname.my.function.S will be created with + ## an editable copy of the object. The buffer is associated with the + ## pathname /tmp/yourloginname.my.function.S and will amlost certainly not + ## exist after you log off. + + ## enter program, functions, and code into work buffer, and send + ## entire contents to S-PLUS when ready + C-c C-b + + ## Go to *S+3:1* buffer, which is the process buffer, and examine + ## the results. + C-c C-y + ## The sequence C-c C-y is a shortcut for: C-x b *S+3:1* + + ## Return to the work buffer (may/may not be prefixed) + C-x C-b yourloginname.my.function.S + ## Fix the function that didn't work, and resubmit by placing the + ## cursor somewhere in the function and + C-c C-f + ## Or you could've selected a region (using the mouse, or keyboard + ## via setting point/mark) and + C-c C-r + ## Or you could step through, line by line, using + C-c C-n + ## Or just send a single line (without moving to the next) using + C-c C-j + ## To fix that error in syntax for the "rchisq" command, get help + ## by + C-c C-v rchisq + + + 4: Data Analysis (S object is real) + ## Start up S-PLUS 3.x, in a process buffer (this will be *S+3:1*) + M-x S+3 + + ## Work in the process buffer. When you find an object that needs + ## to be changed (this could be a data frame, or a variable, or a + ## function), dump it to a buffer: + C-c C-d my.cool.function + + ## Edit the function as appropriate, and dump back in to the + ## process buffer + C-c C-b + + ## Return to the S-PLUS process buffer + C-c C-y + ## Continue working. + + ## When you need help, use + C-c C-v rchisq + ## instead of entering: help("rchisq") + + +File: ess.info, Node: Customization Examples and Solutions to Problems, Prev: Scenarios for use (possibilities--based on actual usage), Up: ESS for S + +12.6 Customization Examples and Solutions to Problems +===================================================== + +1. Suppose that you are primarily an SPLUS 3.4 user, occasionally using +S version 4, and sick and tired of the buffer-name *S+3* we've stuck you +with. Simply edit the "ess-dialect" alist entry in the ess-sp3-d.el and +ess-s4-d.el files to be "S" instead of "S4" and "S+3". This will ensure +that all the inferior process buffer names are "*S*". + + 2. Suppose that you WANT to have the first buffer name indexed by +":1", in the same manner as your S-PLUS processes 2,3,4, and 5 (for you +heavy simulation people). Then add after your (require 'ess-site) or +(load "ess-site") command in your .emacs file, the line: + (setq ess-plain-first-buffername nil) + + 3. Fontlocking sometimes fails to behave nicely upon errors. When +Splus dumps, a mis-matched " (double-quote) can result in the wrong +font-lock face being used for the remainder of the buffer. + + Solution: add a " at the end of the "Dumped..." statement, to revert +the font-lock face back to normal. + + 4. When you change directory within a *R* or *S* session using the +setwd() command, emacs does not recognise that you have changed the +current directory. + + Solution: Use 'M-x ess-change-directory'. This will prompt you for +the directory to change to. It will then change directory within the +*S* buffer, and also update the emacs variable 'default-directory'. +Alternatively, if you have already executed setwd(), press 'M-RET' +within the *S* buffer so that Emacs can update 'default-directory'. + + +File: ess.info, Node: ESS for SAS, Next: ESS for BUGS, Prev: ESS for S, Up: Top + +13 ESS for SAS +************** + +* Menu: + +* ESS(SAS)--Design philosophy:: +* ESS(SAS)--Editing files:: +* ESS(SAS)--TAB key:: +* ESS(SAS)--Batch SAS processes:: +* ESS(SAS)--Function keys for batch processing:: +* iESS(SAS)--Interactive SAS processes:: +* iESS(SAS)--Common problems:: +* ESS(SAS)--Graphics:: +* ESS(SAS)--Windows:: +ESS[SAS] was designed for use with SAS. It is descended from emacs +macros developed by John Sall for editing SAS programs and 'SAS-mode' by +Tom Cook. Those editing features and new advanced features are part of +ESS[SAS]. The user interface of ESS[SAS] has similarities with ESS[S] +and the SAS Display Manager. + + +File: ess.info, Node: ESS(SAS)--Design philosophy, Next: ESS(SAS)--Editing files, Prev: ESS for SAS, Up: ESS for SAS + +13.1 ESS[SAS]-Design philosophy +=============================== + +ESS[SAS] was designed to aid the user in writing and maintaining SAS +programs, such as 'FOO.sas'. Both interactive and batch submission of +SAS programs is supported. + + ESS[SAS] was written with two primary goals. + 1. The emacs text editor provides a powerful and flexible development + environment for programming languages. These features are a boon + to all programmers and, with the help of ESS[SAS], to SAS users as + well. + 2. Although a departure from SAS Display Manager, ESS[SAS] provides + similar key definitions to give novice ESS[SAS] users a head start. + Also, inconvenient SAS Display Manager features, like remote + submission and syntax highlighting, are provided transparently; + appealing to advanced ESS[SAS] users. + + +File: ess.info, Node: ESS(SAS)--Editing files, Next: ESS(SAS)--TAB key, Prev: ESS(SAS)--Design philosophy, Up: ESS for SAS + +13.2 ESS[SAS]-Editing files +=========================== + +ESS[SAS] is the mode for editing SAS language files. This mode handles: + + * proper indenting, generated by both and . + * color and font choices based on syntax. + * ability to save and submit the file you are working on as a batch + SAS process with a single keypress and to continue editing while it + is runs in the background. + * capability of killing the batch SAS process through the '*shell*' + buffer or allow the SAS process to keep on running after you exit + emacs. + * single keypress navigation of '.sas', '.log' and '.lst' files + ('.log' and '.lst' files are refreshed with each keypress). + * ability to send the contents of an entire buffer, a highlighted + region, or a single line to an interactive SAS process. + * ability to switch between processes which would be the target of + the buffer (for the above). + + ESS[SAS] is automatically turned on when editing a file with a '.sas' +suffix (or other extension, if specified via 'auto-mode-alist'). The +function keys can be enabled to use the same function keys that the SAS +Display Manager does. The interactive capabilities of ESS require you +to start an inferior SAS process with 'M-x SAS' (*Note +iESS(SAS)--Interactive SAS processes::.) + + At this writing, the indenting and syntax highlighting are generally +correct. Known issues: for multiple line '*' or '%*' comments, only the +first line is highlighted; for '.log' files, only the first line of a +'NOTE:', 'WARNING:' or 'ERROR:' message is highlighted; unmatched +single/double quotes in 'CARDS' data lines are *NOT* ignored; in an +iterative 'DO' statement, 'TO' and 'BY' are not highlighted. + + +File: ess.info, Node: ESS(SAS)--TAB key, Next: ESS(SAS)--Batch SAS processes, Prev: ESS(SAS)--Editing files, Up: ESS for SAS + +13.3 ESS[SAS]- key +======================= + +Two options. The key is bound by default to 'sas-indent-line'. +This function is used to syntactically indent SAS code so 'PROC' and +'RUN' are in the left margin, other statements are indented +'sas-indent-width' spaces from the margin, continuation lines are +indented 'sas-indent-width' spaces in from the beginning column of that +statement. This is the type of functionality that emacs provides in +most programming language modes. This functionality is activated by +placing the following line in your initialization file prior to a +'require'/'load': + (setq ess-sas-edit-keys-toggle nil) + + ESS provides an alternate behavior for that makes it behave as +it does in SAS Display Manager, i.e. move the cursor to the next stop. +The alternate behavior also provides a "TAB" backwards, 'C-', that +moves the cursor to the stop to the left and deletes any characters +between them. This functionality is obtained by placing the following +line in your initialization file prior to a 'require'/'load': + (setq ess-sas-edit-keys-toggle t) + Under the alternate behavior, is bound to 'M-x tab-to-tab-stop' +and the stops are defined by 'ess-sas-tab-stop-list'. + + +File: ess.info, Node: ESS(SAS)--Batch SAS processes, Next: ESS(SAS)--Function keys for batch processing, Prev: ESS(SAS)--TAB key, Up: ESS for SAS + +13.4 ESS[SAS]-Batch SAS processes +================================= + +Submission of a SAS batch job is dependent on your environment. +'ess-sas-submit-method' is determined by your operating system and your +shell. It defaults to ''sh' unless you are running Windows or Mac +Classic. Under Windows, it will default to ''sh' if you are using a +UNIX-imitating shell; otherwise ''ms-dos' for an MS-DOS shell. On +macOS, it will default to ''sh', but under Mac Classic, it defaults to +''apple-script'. You will also set this to ''sh' if the SAS batch job +needs to run on a remote machine rather than your local machine. This +works transparently if you are editing the remote file via ange-ftp/EFS +or tramp. Note that 'ess-sas-shell-buffer-remote-init' is a Local +Variable that defaults to '"ssh"' which will be used to open the buffer +on the remote host and it is assumed that no password is necessary, i.e. +you are using 'ssh-agent'/'ssh-add' or the equivalent (see the +discussion about Local Variables below if you need to change the +default). + + However, if you are editing the file locally and transferring it back +and forth with Kermit, you need some additional steps. First, start +Kermit locally before remotely logging in. Open a local copy of the +file with the 'ess-kermit-prefix' character prepended (the default is +'"#"'). Execute the command 'M-x ess-kermit-get' which automatically +brings the contents of the remote file into your local copy. If you +transfer files with Kermit manually in a '*shell*' buffer, then note +that the Kermit escape sequence is 'C-q C-\ c' rather than 'C-\ c' which +it would be in an ordinary terminal application, i.e. not in an emacs +buffer. Lastly, note that the remote Kermit command is specified by +'ess-kermit-command'. + + The command used by the 'SUBMIT' function key ( or ) to +submit a batch SAS job, whether local or remote, is +'ess-sas-submit-command' which defaults to 'sas-program'. 'sas-program' +is '"invoke SAS using program file"' for Mac Classic and '"sas"' +otherwise. However, you may have to alter 'ess-sas-submit-command' for +a particular program, so it is defined as buffer-local. Conveniently, +it can be set at the end of the program: + endsas; + Local variables: + ess-sas-submit-command: "sas8" + End: + + The command line is also made of 'ess-sas-submit-pre-command', +'ess-sas-submit-post-command' and 'ess-sas-submit-command-options' (the +last of which is also buffer-local). Here are some examples for your +'~/.emacs' or '~/.xemacs/init.el' file (you may also use +'M-x customize-variable'): + ;'sh default + (setq ess-sas-submit-pre-command "nohup") + ;'sh default + (setq ess-sas-submit-post-command "-rsasuser &") + ;'sh example + (setq-default ess-sas-submit-command "/usr/local/sas/sas") + ;'ms-dos default + (setq ess-sas-submit-pre-command "start") + ;'ms-dos default + (setq ess-sas-submit-post-command "-rsasuser -icon") + ;Windows example + (setq-default ess-sas-submit-command "c:/progra~1/sas/sas.exe") + ;Windows example + (setq-default ess-sas-submit-command "c:\\progra~1\\sas\\sas.exe") + + There is a built-in delay before a batch SAS job is submitted when +using a UNIX-imitating shell under Windows. This is necessary in many +cases since the shell might not be ready to receive a command. This +delay is currently set high enough so as not to be a problem. But, +there may be cases when it needs to be set higher, or could be set much +lower to speed things up. You can over-ride the default in your +'~/.emacs' or '~/.xemacs/init.el' file by: + (setq ess-sleep-for 0.2) + + For example, '(setq ess-sas-global-unix-keys t)' keys shown, '(setq +ess-sas-global-pc-keys t)' in parentheses; ESS[SAS] function keys are +presented in the next section. Open the file you want to work with +'C-x C-f foo.sas'. 'FOO.sas' will be in ESS[SAS] mode. Edit as +appropriate, then save and submit the batch SAS job. + () + The job runs in the '*shell*' buffer while you continue to edit +'FOO.sas'. If 'ess-sas-submit-method' is ''sh', then the message buffer +will display the shell notification when the job is complete. The ''sh' +setting also allows you to terminate the SAS batch job before it is +finished. + () + Terminating a SAS batch in the '*shell*' buffer. + kill PID + You may want to visit the '.log' (whether the job is still running or +it is finished) and check for error messages. The '.log' will be +refreshed and you will be placed in it's buffer. You will be taken to +the first error message, if any. + () + Goto the next error message, if any. + () + Now, 'refresh' the '.lst' and go to it's buffer. + () + If you wish to make changes, go to the '.sas' file with. + () + Make your editing changes and submit again. + () + + +File: ess.info, Node: ESS(SAS)--Function keys for batch processing, Next: iESS(SAS)--Interactive SAS processes, Prev: ESS(SAS)--Batch SAS processes, Up: ESS for SAS + +13.5 ESS[SAS]-Function keys for batch processing +================================================ + +The setup of function keys for SAS batch processing is unavoidably +complex, but the usage of function keys is simple. There are five +distinct options: + + Option 1 (default). Function keys in ESS[SAS] are not bound to elisp +commands. This is in accordance with the GNU Elisp Coding Standards +(GECS) which do not allow function keys to be bound so that they are +available to the user. + + Options 2-5. Since GECS does not allow function keys to be bound by +modes, these keys are often unused. So, ESS[SAS] provides users with +the option of binding elisp commands to these keys. Users who are +familiar with SAS will, most likely, want to duplicate the function key +capabilities of the SAS Display Manager. There are four options (noted +in parentheses). + + a. SAS Display Manager has different function key definitions for UNIX + (2, 4) and Windows (3, 5); ESS[SAS] can use either. + b. The ESS[SAS] function key definitions can be active in all buffers + (global: 4, 5) or limited (local: 2, 3) only to buffers with files + that are associated with ESS[SAS] as specified in your + 'auto-mode-alist'. + + The distinction between local and global is subtle. If you want the +ESS[SAS] definitions to work when you are in the '*shell*' buffer or +when editing files other than the file extensions that ESS[SAS] +recognizes, you will most likely want to use the global definitions. If +you want your function keys to understand SAS batch commands when you +are editing SAS files, and to behave normally when editing other files, +then you will choose the local definitions. The option can be chosen by +the person installing ESS for a site or by an individual. + + a. For a site installation or an individual, place *ONLY ONE* of the + following lines in your initialization file prior to a + 'require'/'load'. ESS[SAS] function keys are available in ESS[SAS] + if you choose either 2 or 3 and in all modes if you choose 4 or 5: + ;;2; (setq ess-sas-local-unix-keys t) + ;;3; (setq ess-sas-local-pc-keys t) + ;;4; (setq ess-sas-global-unix-keys t) + ;;5; (setq ess-sas-global-pc-keys t) + + The names '-unix-' and '-pc-' have nothing to do with the operating + system that you are running. Rather, they mimic the definitions + that the SAS Display Manager uses by default on those platforms. + + b. If your site installation has configured the keys contrary to your + liking, then you must call the appropriate function. + (load "ess-site") ;; local-unix-keys + (ess-sas-global-pc-keys) + + Finally, we get to what the function keys actually do. You may +recognize some of the nicknames as SAS Display Manager commands (they +are in all capitals). + +UNIX PC Nickname + 'refresh' + revert the current buffer with the file of the same name if the file is + newer than the buffer + 'SUBMIT' + save the current '.sas' file (which is either the '.sas' file in the + current buffer or the '.sas' file associated with the '.lst' or '.log' + file in the current buffer) and submit the file as a batch SAS job + 'PROGRAM' + switch buffer to '.sas' file + 'LOG' + switch buffer to '.log' file, 'refresh' and goto next error message, if + any + 'OUTPUT' + switch buffer to '.lst' file and 'refresh' + 'filetype-1' + switch buffer to 'filetype-1' (defaults to '.txt') file and 'refresh' + 'shell' + switch buffer to '*shell*' + 'VIEWTABLE' + open an interactive 'PROC FSEDIT' session on the SAS dataset near point + toggle-log + toggle ESS[SAS] for '.log' files; useful for certain debugging situations + 'filetype-2' + switch buffer to 'filetype-2' (defaults to '.dat') file and 'refresh' + viewgraph + open a 'GSASFILE' near point for viewing either in emacs or with an + external viewer +'C-' 'C-' rtf-portrait + create an MS RTF portrait file from the current buffer with a file + extension of '.rtf' +'C-' 'C-' rtf-landscape + create an MS RTF landscape file from the current buffer with a file + extension of '.rtf' +'C-' 'C-' submit-region + write region to 'ess-temp.sas' and submit +'C-' 'C-' append-to-log + append 'ess-temp.log' to the current '.log' file +'C-' 'C-' append-to-output + append 'ess-temp.lst' to the current '.lst' file +'C-' 'C-' 'INSIGHT' + open an interactive 'PROC INSIGHT' session on the SAS dataset near point +'C-''C-'toggle-listing + toggle ESS[SAS] for '.lst' files; useful for toggling read-only + + 'SUBMIT', 'PROGRAM', 'LOG' and 'OUTPUT' need no further explanation +since they mimic the SAS Display Manager commands and related function +key definitions. However, six other keys have been provided for +convenience and are described below. + + 'shell' switches you to the '*shell*' buffer where you can interact +with your operating system. This is especially helpful if you would +like to kill a SAS batch job. You can specify a different buffer name +to associate with a SAS batch job (besides '*shell*') with the +buffer-local variable 'ess-sas-shell-buffer'. This allows you to have +multiple buffers running SAS batch jobs on multiple local/remote +computers that may rely on different methods specified by the +buffer-local variable 'ess-sas-submit-method'. + + performs the 'refresh' operation on the current buffer. +'refresh' compares the buffer's last modified date/time with the file's +last modified date/time and replaces the buffer with the file if the +file is newer. This is the same operation that is automatically +performed when 'LOG', 'OUTPUT', 'filetype-1' or are pressed. + + 'filetype-1' switches you to a file with the same file name as your +'.sas' file, but with a different extension ('.txt' by default) and +performs 'refresh'. You can over-ride the default extension; for +example in your '~/.emacs' or '~/.xemacs/init.el' file: + (setq ess-sas-suffix-1 "csv") ; for example + + will prompt you for the name of a permanent SAS dataset near +point to be opened for viewing by 'PROC FSEDIT'. You can control the +SAS batch command-line with 'ess-sas-data-view-submit-options'. For +controlling the SAS batch commands, you have the global variables +'ess-sas-data-view-libname' and 'ess-sas-data-view-fsview-command' as +well as the buffer-local variable 'ess-sas-data-view-fsview-statement'. +If you have your SAS 'LIBNAME' defined in '~/autoexec.sas', then the +defaults for these variables should be sufficient. + + Similarly, 'C-' will prompt you for the name of a permanent SAS +dataset near point to be opened for viewing by 'PROC INSIGHT'. You can +control the SAS batch command-line with +'ess-sas-data-view-submit-options'. For controlling the SAS batch +commands, you have the global variables 'ess-sas-data-view-libname' and +'ess-sas-data-view-insight-command' as well as the buffer-local variable +'ess-sas-data-view-insight-statement'. + + toggles ESS[SAS] mode for '.log' files which is off by default +(technically, it is 'SAS-log-mode', but it looks the same). The syntax +highlighting can be helpful in certain debugging situations, but large +'.log' files may take a long time to highlight. + + is the same as 'filetype-1' except it is '.dat' by default. + + will prompt you for the name of a 'GSASFILE' near the point in +'.log' to be opened for viewing either with emacs or with an external +viewer. Depending on your version of emacs and the operating system you +are using, emacs may support '.gif' and '.jpg' files internally. You +may need to change the following variables for your own situation. +'ess-sas-graph-view-suffix-regexp' is a regular expression of supported +file types defined via file name extensions. +'ess-sas-graph-view-viewer-default' is the default external viewer for +your platform. 'ess-sas-graph-view-viewer-alist' is an alist of +exceptions to the default; i.e. file types and their associated viewers +which will be used rather than the default viewer. + (setq ess-sas-graph-view-suffix-regexp (concat "[.]\\([eE]?[pP][sS]\\|" + "[pP][dD][fF]\\|[gG][iI][fF]\\|[jJ][pP][eE]?[gG]\\|" + "[tT][iI][fF][fF]?\\)")) ;; default + (setq ess-sas-graph-view-viewer-default "kodakimg") ;; Windows default + (setq ess-sas-graph-view-viewer-default "sdtimage") ;; Solaris default + (setq ess-sas-graph-view-viewer-alist + '(("[eE]?[pP][sS]" . "gv") ("[pP][dD][fF]" . "gv")) ;; default w/ gv + + 'C-' produces US landscape by default, however, it can produce A4 +landscape (first line for "global" key mapping, second for "local"): + (global-set-key [(control f2)] 'ess-sas-rtf-a4-landscape) + (define-key sas-mode-local-map [(control f2)] 'ess-sas-rtf-a4-landscape) + + +File: ess.info, Node: iESS(SAS)--Interactive SAS processes, Next: iESS(SAS)--Common problems, Prev: ESS(SAS)--Function keys for batch processing, Up: ESS for SAS + +13.6 iESS[SAS]-Interactive SAS processes +======================================== + +Inferior ESS (iESS) is the method for interfacing with interactive +statistical processes (programs). iESS[SAS] is what is needed for +interactive SAS programming. iESS[SAS] works best with the SAS +command-line option settings '"-stdio -linesize 80 -noovp +-nosyntaxcheck"' (the default of 'inferior-SAS-args'). + + '-stdio' + required to make the redirection of stdio work + '-linesize 80' + keeps output lines from folding on standard terminals + '-noovp' + prevents error messages from printing 3 times + '-nosyntaxcheck' + permits recovery after syntax errors + + To start up iESS[SAS] mode, use: + M-x SAS + + The '*SAS:1.log*' buffer in 'ESStr' mode corresponds to the file +'FOO.log' in SAS batch usage and to the 'SAS: LOG' window in the SAS +Display Manager. All commands submitted to SAS, informative messages, +warnings, and errors appear here. + + The '*SAS:1.lst*' buffer in 'ESSlst' mode corresponds to the file +'FOO.lst' in SAS batch usage and to the 'SAS: OUTPUT' window in the SAS +Display Manager. All printed output appears in this window. + + The '*SAS:1*' buffer exists solely as a communications buffer. The +user should never use this buffer directly. Files are edited in the +'FOO.sas' buffer. The 'C-c C-r' key in ESS[SAS] is the functional +equivalent of bringing a file into the 'SAS: PROGRAM EDITOR' window +followed by 'SUBMIT'. + + For example, open the file you want to work with. + C-x C-f foo.sas + 'FOO.sas' will be in ESS[SAS] mode. Edit as appropriate, and then +start up SAS with the cursor in the 'FOO.sas' buffer. + M-x SAS + Four buffers will appear on screen: +Buffer Mode Description +'FOO.sas' 'ESS[SAS]' your source file +'*SAS:1*' 'iESS[SAS:1]' iESS communication buffer +'*SAS:1.log*' 'Shell ESStr SAS log information + []' +'*SAS:1.lst*' 'Shell ESSlst SAS listing information + []' + If you would prefer each of the four buffers to appear in its own +individual frame, you can arrange for that. Place the cursor in the +buffer displaying 'FOO.sas'. Enter the sequence 'C-c C-w'. The cursor +will normally be in buffer 'FOO.sas'. If not, put it there and +'C-x b FOO.sas'. + + Send regions, lines, or the entire file contents to SAS (regions are +most useful: a highlighted region will normally begin with the keywords +'DATA' or 'PROC' and end with 'RUN;'), 'C-c C-r'. + + Information appears in the log buffer, analysis results in the +listing buffer. In case of errors, make the corrections in the +'FOO.sas' buffer and resubmit with another 'C-c C-r'. + + At the end of the session you may save the log and listing buffers +with the usual 'C-x C-s' commands. You will be prompted for a file +name. Typically, the names 'FOO.log' and 'FOO.lst' will be used. You +will almost certainly want to edit the saved files before including them +in a report. The files are read-only by default. You can make them +writable by the emacs command 'C-x C-q'. + + At the end of the session, the input file 'FOO.sas' will typically +have been revised. You can save it. It can be used later as the +beginning of another iESS[SAS] session. It can also be used as a batch +input file to SAS. + + The '*SAS:1*' buffer is strictly for ESS use. The user should never +need to read it or write to it. Refer to the '.lst' and '.log' buffers +for monitoring output! + + Troubleshooting: *Note iESS(SAS)--Common problems::. + + +File: ess.info, Node: iESS(SAS)--Common problems, Next: ESS(SAS)--Graphics, Prev: iESS(SAS)--Interactive SAS processes, Up: ESS for SAS + +13.7 iESS[SAS]-Common problems +============================== + + 1. iESS[SAS] does not work on Windows. In order to run SAS inside an + emacs buffer, it is necessary to start SAS with the '-stdio' + option. SAS does not support the '-stdio' option on Windows. + 2. If 'M-x SAS' gives errors upon startup, check the following: + * you are running Windows: see 1. + * 'ess-sas-sh-command' (from the ESS 'etc' directory) needs to + be executable; too check, type 'M-x dired'; if not, fix it as + follows, type 'M-:', then at the minibuffer prompt 'Eval:', + type '(set-file-modes "ess-sas-sh-command" 493)'. + * 'sas' isn't in your executable path; to verify, type 'M-:' and + at the minibuffer prompt 'Eval:', type '(executable-find + "sas")' + 3. 'M-x SAS' starts SAS Display Manager. Probably, the command 'sas' + on your system calls a shell script. In that case you will need to + locate the real 'sas' executable and link to it. You can execute + the UNIX command: + find / -name sas -print + Now place a soft link to the real 'sas' executable in your '~/bin' + directory, with for example + cd ~/bin + ln -s /usr/local/sas9/sas sas + Check your 'PATH' environment variable to confirm that '~/bin' +appears before the directory in which the 'sas' shell script appears. + + +File: ess.info, Node: ESS(SAS)--Graphics, Next: ESS(SAS)--Windows, Prev: iESS(SAS)--Common problems, Up: ESS for SAS + +13.8 ESS[SAS]-Graphics +====================== + +Output from a SAS/GRAPH 'PROC' can be displayed in a SAS/GRAPH window +for SAS batch on Windows or for both SAS batch and interactive with +XWindows on UNIX. If you need to create graphics files and view them +with , then include the following (either in 'FOO.sas' or in +'~/autoexec.sas'): + filename gsasfile 'graphics.ps'; + goptions device=ps gsfname=gsasfile gsfmode=append; + 'PROC PLOT' graphs can be viewed in the listing buffer. You may wish +to control the vertical spacing to allow the entire plot to be visible +on screen, for example: + proc plot; + plot a*b / vpos=25; + run; + + +File: ess.info, Node: ESS(SAS)--Windows, Prev: ESS(SAS)--Graphics, Up: ESS for SAS + +13.9 ESS[SAS]-Windows +===================== + + * iESS[SAS] does not work on Windows. *Note iESS(SAS)--Common + problems::. + + * ESS[SAS] mode for editing SAS language files works very well. + *Note ESS(SAS)--Editing files::. + + * There are two execution options for SAS on Windows. You can use + batch. *Note ESS(SAS)--Batch SAS processes::. + + Or you can mark regions with the mouse and submit the code with + 'submit-region' or paste them into SAS Display Manager. + + +File: ess.info, Node: ESS for BUGS, Next: ESS for JAGS, Prev: ESS for SAS, Up: Top + +14 ESS for BUGS +*************** + +* Menu: + +* ESS(BUGS)--Model files:: +* ESS(BUGS)--Command files:: +* ESS(BUGS)--Log files:: +ESS[BUGS] was originally designed for use with BUGS software. Later, it +evolved to support JAGS as a dialect of the BUGS language via ESS[JAGS], +however, ESS[JAGS] is documented in the section Help for JAGS. ESS[BUGS] +provides 5 features. First, BUGS syntax is described to allow for +proper fontification of statements, distributions, functions, commands +and comments in BUGS model files, command files and log files. Second, +ESS creates templates for the command file from the model file so that a +BUGS batch process can be defined by a single file. Third, ESS provides +a BUGS batch script that allows ESS to set BUGS batch parameters. +Fourth, key sequences are defined to create a command file and submit a +BUGS batch process. Lastly, interactive submission of BUGS commands is +also supported. + + +File: ess.info, Node: ESS(BUGS)--Model files, Next: ESS(BUGS)--Command files, Prev: ESS for BUGS, Up: ESS for BUGS + +14.1 ESS[BUGS]-Model files +========================== + +Model files with the '.bug' extension are edited in ESS[BUGS] mode if +'(require 'ess-bugs-d)' was performed. Model files with the '.jag' +extension are edited in ESS[JAGS] mode if '(require 'ess-jags-d)' was +performed. Three keys are bound for your use in ESS[BUGS], 'F2', 'C-c +C-c' and '='. 'F2' performs the same action as it does in ESS[SAS], +*Note ESS(SAS)--Function keys for batch processing::. 'C-c C-c' +performs the function 'ess-bugs-next-action' which you will use a lot. +Pressing it in an empty buffer for a model file will produce a template +for you. '=' inserts the set operator, '<-'. + + +File: ess.info, Node: ESS(BUGS)--Command files, Next: ESS(BUGS)--Log files, Prev: ESS(BUGS)--Model files, Up: ESS for BUGS + +14.2 ESS[BUGS]-Command files +============================ + +To avoid extension name collision, '.bmd' is used for BUGS command files +and '.jmd' for JAGS command files. When you have finished editing your +model file and press 'C-c C-c', a command file is created if one does +not already exist. When you are finished editing your command file, +pressing 'C-c C-c' again will submit your command file as a batch job. + + +File: ess.info, Node: ESS(BUGS)--Log files, Prev: ESS(BUGS)--Command files, Up: ESS for BUGS + +14.3 ESS[BUGS]-Log files +======================== + +To avoid extension name collision, '.bog' is used for BUGS log files. +The command line generated by ESS creates the '.bog' transcript file. +Similarly, '.jog' is used for JAGS log files. + + +File: ess.info, Node: ESS for JAGS, Next: Mailing lists/bug reports, Prev: ESS for BUGS, Up: Top + +15 ESS for JAGS +*************** + +* Menu: + +* ESS(JAGS)--Model files:: +* ESS(JAGS)--Command files:: +* ESS(JAGS)--Log files:: +ESS[BUGS] was originally designed for use with BUGS software. Later, it +evolved to support JAGS as a dialect of the BUGS language via ESS[JAGS]. +Since BUGS and JAGS are quite similar, ESS[BUGS] and ESS[JAGS] are +necessarily similar. ESS[JAGS] provides 4 features. First, JAGS syntax +is described to allow for proper fontification of statements, +distributions, functions, commands and comments in JAGS model files, +command files and log files. Second, ESS creates templates for the +command file from the model file so that a JAGS batch process can be +defined by a single file. Third, ESS provides a JAGS batch script that +allows ESS to set JAGS batch parameters. Fourth, key sequences are +defined to create a command file and submit a JAGS batch process. + + +File: ess.info, Node: ESS(JAGS)--Model files, Next: ESS(JAGS)--Command files, Prev: ESS for JAGS, Up: ESS for JAGS + +15.1 ESS[JAGS]-Model files +========================== + +Model files with the '.bug' extension are edited in ESS[BUGS] mode if +'(require 'ess-bugs-d)' was performed or edited in ESS[JAGS] mode if +'(require 'ess-jags-d)'. Three keys are bound for your use in +ESS[BUGS], 'F2', 'C-c C-c' and '='. 'F2' performs the same action as it +does in ESS[SAS], *Note ESS(SAS)--Function keys for batch processing::. +'C-c C-c' performs the function 'ess-bugs-next-action' which you will +use a lot. Pressing it in an empty buffer for a model file will produce +a template for you. '=' inserts the set operator, '<-'. + + ESS[JAGS] does not support "replacement" variables which were part of +ESS[BUGS]. Although, "replacement" variables are an extremely +convenient feature, creating the elisp code for their operation was +challenging. So, a more elisp-ish approach was adopted for ESS[JAGS]: +elisp local variables. These variables are created as part of the +template, i.e. with the first press of 'C-c C-c' in an empty buffer. +For your '.bug' file, they are named 'ess-jags-chains', +'ess-jags-monitor', 'ess-jags-thin', 'ess-jags-burnin' and +'ess-jags-update'; they appear in the 'Local Variables' section. When +you are finished editing your model file, pressing 'C-c C-c' will +perform the necessary actions to build your command file for you. + + The 'ess-jags-chains' variable is the number of chains that you want +to initialize and sample from; defaults to 1. The 'ess-jags-monitor' +variable is a list of variables that you want monitored: encase each +variable in double quotes. When you press 'C-c C-c', the appropriate +statements are created in the command file to monitor the list of +variables. By default, no variables are explicitly monitored which +means JAGS will implicitly monitor all "default" variables. The +'ess-jags-thin' variable is the thinning parameter. By default, the +thinning parameter is set to 1, i.e. no thinning. The +'ess-jags-burnin' variable is the number of initial samples to discard. +By default, the burnin parameter is set to 10000. The 'ess-jags-update' +variable is the number of post-burnin samples to keep. By default, the +update parameter is set to 10000. Both 'ess-jags-burnin' and +'ess-jags-update' are multiplied by 'ess-jags-thin' since JAGS does not +do it automatically. + + +File: ess.info, Node: ESS(JAGS)--Command files, Next: ESS(JAGS)--Log files, Prev: ESS(JAGS)--Model files, Up: ESS for JAGS + +15.2 ESS[JAGS]-Command files +============================ + +To avoid extension name collision, '.bmd' is used for BUGS command files +and '.jmd' for JAGS command files. For your '.jmd' file, there is only +one variable, 'ess-jags-command', in the 'Local Variables' section. +When you have finished editing your model file and press 'C-c C-c', a +command file is created if one does not already exist. When you are +finished editing your command file, pressing 'C-c C-c' again will submit +your command file as a batch job. The 'ess-jags-command' variable +allows you to specify a different JAGS program to use to run your model; +defaults to "jags". + + +File: ess.info, Node: ESS(JAGS)--Log files, Prev: ESS(JAGS)--Command files, Up: ESS for JAGS + +15.3 ESS[JAGS]-Log files +======================== + +The '.jog' extension is used for JAGS log files. You may find 'F2' +useful to refresh the '.jog' if the batch process over-writes or appends +it. + + +File: ess.info, Node: Mailing lists/bug reports, Next: Customization, Prev: ESS for JAGS, Up: Top + +16 Bugs and Bug Reporting, Mailing Lists +**************************************** + +* Menu: + +* Bugs:: +* Reporting Bugs:: +* Mailing Lists:: +* Help with emacs:: + + +File: ess.info, Node: Bugs, Next: Reporting Bugs, Up: Mailing lists/bug reports + +16.1 Bugs +========= + + * Commands like 'ess-display-help-on-object' and list completion + cannot be used while the user is entering a multi-line command. + The only real fix in this situation is to use another ESS process. + + * The 'ess-eval-' commands can leave point in the ESS process buffer + in the wrong place when point is at the same position as the last + process output. This proves difficult to fix, in general, as we + need to consider all _windows_ with 'window-point' at the right + place. + + * It's possible to clear the modification flag (say, by saving the + buffer) with the edit buffer not having been loaded into S. + + * Backup files can sometimes be left behind, even when + 'ess-keep-dump-files' is 'nil'. + + * Passing an incomplete S expression to 'ess-execute' causes ESS to + hang. + + * The function-based commands don't always work as expected on + functions whose body is not a parenthesized or compound expression, + and don't even recognize anonymous functions (i.e. functions not + assigned to any variable). + + * Multi-line commands could be handled better by the command history + mechanism. + + * Changes to the continutation prompt in R (e.g. 'options(continue = + " ")') are not automatically detected by ESS. Hence, for now, the + best thing is not to change the continuation prompt. If you do + change the continuation prompt, you will need to change accordingly + the value of 'inferior-ess-secondary-prompt' in + 'R-customize-alist'. + + +File: ess.info, Node: Reporting Bugs, Next: Mailing Lists, Prev: Bugs, Up: Mailing lists/bug reports + +16.2 Reporting Bugs +=================== + +Please send bug reports, suggestions etc. to + + 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: ess.info, Node: Mailing Lists, Next: Help with emacs, Prev: Reporting Bugs, Up: Mailing lists/bug reports + +16.3 Mailing Lists +================== + +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 ; contributions +to the list may be mailed to . 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: ess.info, Node: Help with emacs, Prev: Mailing Lists, Up: Mailing lists/bug reports + +16.4 Help with emacs +==================== + +Emacs is a complex editor with many abilities that we do not have space +to describe here. If you have problems with other features of emacs +(e.g. printing), there are several sources to consult, including the +emacs FAQs (try 'M-x xemacs-www-faq' or 'M-x view-emacs-FAQ') and +EmacsWiki (). Please consult them before +asking on the mailing list about issues that are not specific to ESS. + + +File: ess.info, Node: Customization, Next: Indices, Prev: Mailing lists/bug reports, Up: Top + +Appendix A Customizing ESS +************************** + +ESS can be easily customized to your taste simply by including the +appropriate lines in your '.emacs' file. There are numerous variables +which affect the behavior of ESS in certain situations which can be +modified to your liking. Keybindings may be set or changed to your +preferences, and for per-buffer customizations hooks are also available. + + Most of these variables can be viewed and set using the Custom +facility within Emacs. Type 'M-x customize-group RET ess RET' to see +all the ESS variables that can be customized. Variables are grouped by +subject to make it easy to find related variables. + + +File: ess.info, Node: Indices, Prev: Customization, Up: Top + +Indices +******* + +* Menu: + +* Key index:: +* Function and program index:: +* Variable index:: +* Concept index:: + + +File: ess.info, Node: Key index, Next: Function and program index, Up: Indices + +Key index +========= + +[index] +* Menu: + +* ,: Handy commands. (line 6) +* {: Indenting. (line 58) +* }: Indenting. (line 58) +* C-c C-. a: Rutils. (line 31) +* C-c C-. d: Rutils. (line 46) +* C-c C-. H: Rutils. (line 49) +* C-c C-. l: Rutils. (line 20) +* C-c C-. m: Rutils. (line 34) +* C-c C-. o: Rutils. (line 37) +* C-c C-. r: Rutils. (line 23) +* C-c C-. s: Rutils. (line 43) +* C-c C-. u: Rutils. (line 27) +* C-c C-. w: Rutils. (line 40) +* C-C C-b: Evaluating code. (line 64) +* C-c C-c: Other. (line 9) +* C-C C-c: Evaluating code. (line 37) +* C-c C-e C-d: Edit buffer. (line 9) +* C-c C-e C-s: Styles. (line 15) +* C-c C-e s: Styles. (line 15) +* C-C C-f: Evaluating code. (line 50) +* C-C C-j: Evaluating code. (line 43) +* C-c C-l: Hot keys. (line 50) +* C-c C-o C-c: Roxygen. (line 45) +* C-c C-o C-h: Roxygen. (line 72) +* C-c C-o C-o: Roxygen. (line 37) +* C-c C-o C-r: Roxygen. (line 51) +* C-c C-o C-t: Roxygen. (line 59) +* C-c C-o n: Roxygen. (line 69) +* C-c C-o p: Roxygen. (line 66) +* C-c C-q: Hot keys. (line 72) +* C-C C-r: Evaluating code. (line 57) +* C-c C-s: Hot keys. (line 34) +* C-c C-t C-s: Namespaced Evaluation. + (line 36) +* C-c C-v: Hot keys. (line 67) +* C-c C-w: Clean. (line 11) +* C-c C-x: Hot keys. (line 24) +* C-c C-z: Other. (line 13) +* C-C M-b: Evaluating code. (line 67) +* C-C M-f: Evaluating code. (line 53) +* C-C M-j: Evaluating code. (line 46) +* C-C M-r: Evaluating code. (line 60) +* C-c RET: Resubmit. (line 14) +* C-c `: Hot keys. (line 55) +* C-c ` <1>: Error Checking. (line 9) +* C-j: Indenting. (line 65) +* C-M-a: Other edit buffer commands. + (line 10) +* C-M-e: Other edit buffer commands. + (line 14) +* C-M-h: Other edit buffer commands. + (line 18) +* C-M-q: Indenting. (line 54) +* C-M-x: Evaluating code. (line 34) +* C-x `: Hot keys. (line 55) +* ESC C-a: Other edit buffer commands. + (line 10) +* ESC C-e: Other edit buffer commands. + (line 14) +* ESC C-h: Other edit buffer commands. + (line 18) +* ESC C-q: Indenting. (line 54) +* M-;: Indenting. (line 70) +* M-?: Object names. (line 37) +* M-C-q: Indenting. (line 54) +* M-n l: Sweave and AUCTeX. (line 16) +* M-n P: Sweave and AUCTeX. (line 22) +* M-n s: Sweave and AUCTeX. (line 12) +* M-RET: Resubmit. (line 10) +* RET: Command-line editing. (line 10) +* RET <1>: Resubmit. (line 18) +* TAB: Indenting. (line 36) + + +File: ess.info, Node: Function and program index, Next: Variable index, Prev: Key index, Up: Indices + +Function and program index +========================== + +[index] +* Menu: + +* backward-kill-word: Command-line editing. + (line 22) +* comint-backward-matching-input: Process buffer motion. + (line 31) +* comint-bol: Command-line editing. + (line 31) +* comint-copy-old-input: Transcript resubmit. (line 16) +* comint-delete-output: Last command. (line 24) +* comint-dynamic-complete: Object names. (line 13) +* comint-forward-matching-input: Process buffer motion. + (line 32) +* comint-history-isearch-backward-regexp: Command History. (line 32) +* comint-interrupt-subjob: Other. (line 8) +* comint-kill-input: Command-line editing. + (line 26) +* comint-next-input: Process buffer motion. + (line 15) +* comint-next-input <1>: Command History. (line 18) +* comint-next-matching-input-from-input: Command History. (line 45) +* comint-previous-input: Process buffer motion. + (line 11) +* comint-previous-input <1>: Command History. (line 14) +* comint-previous-matching-input-from-input: Command History. (line 41) +* comint-show-output: Last command. (line 20) +* dump(): Edit buffer. (line 35) +* ess-change-directory: Rutils. (line 45) +* ess-cleanup: Hot keys. (line 72) +* ess-cleanup <1>: Help. (line 172) +* ess-describe-help-mode: Help. (line 21) +* ess-display-help-on-object: Hot keys. (line 66) +* ess-display-help-on-object <1>: Help. (line 8) +* ess-display-help-on-object <2>: Help. (line 25) +* ess-dump-object-into-edit-buffer: Edit buffer. (line 8) +* ess-electric-brace: Indenting. (line 57) +* ess-eval-buffer: Evaluating code. (line 63) +* ess-eval-buffer-and-go: Evaluating code. (line 66) +* ess-eval-function: Evaluating code. (line 49) +* ess-eval-function-and-go: Evaluating code. (line 52) +* ess-eval-line: Evaluating code. (line 42) +* ess-eval-line-and-go: Evaluating code. (line 45) +* ess-eval-line-and-step: Help. (line 115) +* ess-eval-region: Evaluating code. (line 56) +* ess-eval-region <1>: Help. (line 120) +* ess-eval-region-and-go: Evaluating code. (line 59) +* ess-eval-region-or-function-or-paragraph: Evaluating code. (line 33) +* ess-eval-region-or-function-or-paragraph-and-step: Evaluating code. + (line 36) +* ess-eval-region-or-line-and-step: Evaluating code. (line 29) +* ess-execute-objects: Hot keys. (line 23) +* ess-execute-search: Hot keys. (line 33) +* ess-goto-beginning-of-function-or-para: Other edit buffer commands. + (line 9) +* ess-goto-end-of-function-or-para: Other edit buffer commands. + (line 13) +* ess-handy-commands: Handy commands. (line 6) +* ess-handy-commands <1>: Handy commands. (line 6) +* ess-indent-command: Roxygen. (line 90) +* ess-indent-exp: Indenting. (line 53) +* ess-indent-or-complete: Indenting. (line 35) +* ess-list-object-completions: Object names. (line 36) +* ess-load-file: Hot keys. (line 49) +* ess-load-file <1>: Loading. (line 11) +* ess-mark-function: Other edit buffer commands. + (line 17) +* ess-parse-errors: Hot keys. (line 54) +* ess-parse-errors <1>: Error Checking. (line 9) +* ess-quit: Hot keys. (line 71) +* ess-quit <1>: Help. (line 172) +* ess-R-complete-object-name: Roxygen. (line 80) +* ess-r-set-evaluation-env: Namespaced Evaluation. + (line 35) +* ess-remote: ESS processes on Remote Computers. + (line 6) +* ess-request-a-process: Multiple ESS processes. + (line 15) +* ess-resynch: Object names. (line 56) +* ess-roxy-hide-all: Roxygen. (line 71) +* ess-roxy-next-entry: Roxygen. (line 68) +* ess-roxy-preview-HTML: Roxygen. (line 58) +* ess-roxy-preview-Rd: Roxygen. (line 50) +* ess-roxy-previous-entry: Roxygen. (line 65) +* ess-roxy-toggle-roxy-region: Roxygen. (line 44) +* ess-roxy-update-entry: Roxygen. (line 36) +* ess-rutils-apropos: Rutils. (line 30) +* ess-rutils-html-docs: Rutils. (line 48) +* ess-rutils-load-wkspc: Rutils. (line 39) +* ess-rutils-local-pkgs: Rutils. (line 19) +* ess-rutils-objs: Rutils. (line 36) +* ess-rutils-repos-pkgs: Rutils. (line 22) +* ess-rutils-rm-all: Rutils. (line 33) +* ess-rutils-rsitesearch: Rutils. (line 58) +* ess-rutils-save-wkspc: Rutils. (line 42) +* ess-rutils-update-pkgs: Rutils. (line 26) +* ess-set-style: Styles. (line 14) +* ess-skip-to-help-section: Help. (line 58) +* ess-skip-to-next-section: Help. (line 46) +* ess-skip-to-previous-section: Help. (line 46) +* ess-smart-comma: Handy commands. (line 6) +* ess-submit-bug-report: Reporting Bugs. (line 6) +* ess-switch-to-end-of-ESS: Help. (line 126) +* ess-switch-to-inferior-or-script-buffer: Other. (line 12) +* ess-swv-latex: Sweave and AUCTeX. (line 15) +* ess-swv-PDF: Sweave and AUCTeX. (line 21) +* ess-swv-PS: Sweave and AUCTeX. (line 18) +* ess-swv-weave: Sweave and AUCTeX. (line 11) +* ess-tracebug: ESS tracebug. (line 6) +* ess-transcript-clean-region: Clean. (line 10) +* ess-transcript-copy-command: Resubmit. (line 13) +* ess-transcript-send-command: Resubmit. (line 9) +* ess-transcript-send-command-and-move: Resubmit. (line 17) +* ess-use-ido, ess-completing-read: Minibuffer completion. + (line 6) +* fill-paragraph: Roxygen. (line 94) +* inferior-ess-send-input: Command-line editing. + (line 9) +* mark-paragraph: Roxygen. (line 85) +* move-beginning-of-line: Roxygen. (line 97) +* newline-and-indent: Roxygen. (line 101) +* objects(): Hot keys. (line 24) +* printer(): printer. (line 11) +* q(): Hot keys. (line 72) +* S: Starting up. (line 12) +* search(): Hot keys. (line 34) +* search() <1>: Object names. (line 21) +* source(): Evaluating code. (line 22) +* source() <1>: Loading. (line 11) +* STERM: Statistical Process running in ESS?. + (line 6) + + +File: ess.info, Node: Variable index, Next: Concept index, Prev: Function and program index, Up: Indices + +Variable index +============== + +[index] +* Menu: + +* ac-source-R: Auto-complete. (line 6) +* ac-source-R-args: Auto-complete. (line 6) +* ac-source-R-objects: Auto-complete. (line 6) +* comint-delimiter-argument-list: History expansion. (line 28) +* comint-input-ring-size: Command History. (line 9) +* comment-column: Indenting. (line 25) +* ess-ask-about-transfile: Customizing startup. (line 30) +* ess-ask-about-transfile <1>: Saving transcripts. (line 12) +* ess-ask-for-ess-directory: Customizing startup. (line 7) +* ess-default-style: Styles. (line 22) +* ess-delete-dump-files: Source Files. (line 12) +* ess-directory: Source Directories. (line 48) +* ess-dump-filename-template: Source Directories. (line 9) +* ess-eldoc-abbreviation-style: ESS ElDoc. (line 24) +* ess-eldoc-show-on-symbol: ESS ElDoc. (line 18) +* ess-eval-visibly: Evaluating code. (line 14) +* ess-execute-in-process-buffer: Hot keys. (line 13) +* ess-first-tab-never-complete: Indenting. (line 47) +* ess-first-tab-never-complete <1>: Object names. (line 6) +* ess-font-lock-mode: Highlighting. (line 11) +* ess-function-template: Edit buffer. (line 17) +* ess-handy-commands: Handy commands. (line 6) +* ess-handy-commands <1>: Handy commands. (line 9) +* ess-indent-with-fancy-comments: Indenting. (line 28) +* ess-keep-dump-files: Source Files. (line 26) +* ess-R-font-lock-keywords: Highlighting. (line 26) +* ess-search-list: Source Directories. (line 62) +* ess-source-directory: Source Directories. (line 22) +* ess-style-alist: Styles. (line 27) +* ess-switch-to-end-of-proc-buffer: Other. (line 21) +* ess-swv-pdflatex-commands: Sweave and AUCTeX. (line 27) +* ess-tab-complete-in-script: Indenting. (line 43) +* ess-use-eldoc: ESS ElDoc. (line 13) +* inferior-ess-program: Customizing startup. (line 43) +* inferior-R-font-lock-keywords: Highlighting. (line 19) +* Rd-indent-level: R documentation files. + (line 85) +* Rd-mode-hook: R documentation files. + (line 82) +* Rd-to-help-command: R documentation files. + (line 89) + + +File: ess.info, Node: Concept index, Prev: Variable index, Up: Indices + +Concept Index +============= + +[index] +* Menu: + +* .emacs file: Source Directories. (line 30) +* aborting S commands: Other. (line 9) +* arguments to S program: Customizing startup. (line 46) +* authors: Credits. (line 6) +* auto-complete: Auto-complete. (line 6) +* autosaving: Source Files. (line 83) +* bug reports: Reporting Bugs. (line 6) +* bugs: Bugs. (line 6) +* cleaning up: Hot keys. (line 72) +* comint: Credits. (line 6) +* command history: Command History. (line 6) +* command line arguments: iESS(S)--Inferior ESS processes. + (line 32) +* command-line completion: Object names. (line 6) +* command-line editing: Command-line editing. + (line 6) +* commands: Entering commands. (line 6) +* comments: Source Files. (line 41) +* comments in S: Indenting. (line 19) +* completion in edit buffer: Other edit buffer commands. + (line 24) +* completion of object names: Object names. (line 6) +* completion on file names: Object names. (line 43) +* completion on lists: Object names. (line 41) +* completion, when prompted for object names: Edit buffer. (line 14) +* creating new objects: Edit buffer. (line 14) +* credits: Credits. (line 6) +* customization: Customization. (line 6) +* data frames: Object names. (line 22) +* deleting output: Last command. (line 24) +* directories: Starting up. (line 12) +* dump file directories: Source Directories. (line 20) +* dump file names: Source Directories. (line 6) +* dump files: Edit buffer. (line 27) +* dump files <1>: Source Files. (line 10) +* echoing commands when evaluating: Evaluating code. (line 22) +* edit buffer: Edit buffer. (line 6) +* editing commands: Command History. (line 6) +* editing functions: Editing objects. (line 6) +* editing transcripts: Saving transcripts. (line 18) +* ElDoc: ESS ElDoc. (line 6) +* emacsclient: Emacsclient. (line 6) +* entering commands: Entering commands. (line 6) +* errors: Error Checking. (line 6) +* ess developer: Namespaced Evaluation. + (line 6) +* ESS process buffer: Starting up. (line 18) +* ESS process directory: Starting up. (line 12) +* ESS tracebug: ESS tracebug. (line 6) +* ESS-elsewhere: ESS processes on Remote Computers. + (line 6) +* ess-roxy: Roxygen. (line 6) +* evaluating code with echoed commands: Evaluating code. (line 22) +* evaluating S expressions: Evaluating code. (line 27) +* font-lock mode: Highlighting. (line 7) +* formatting source code: Indenting. (line 33) +* graphics: Graphics. (line 6) +* Handy commands: Handy commands. (line 6) +* help files: Help. (line 6) +* highlighting: Highlighting. (line 7) +* historic backups: Source Files. (line 41) +* hot keys: Hot keys. (line 43) +* icicles: Icicles. (line 6) +* IDO completions: Minibuffer completion. + (line 6) +* indenting: Indenting. (line 33) +* installation: Installation. (line 6) +* interactive use of S: Introduction. (line 30) +* interrupting S commands: Other. (line 9) +* introduction: Introduction. (line 6) +* keyboard short cuts: Hot keys. (line 43) +* killing temporary buffers: Hot keys. (line 72) +* killing the ESS process: Hot keys. (line 72) +* lists, completion on: Object names. (line 41) +* motion in transcript mode: Transcript Mode. (line 17) +* multi-line commands, resubmitting: Transcript resubmit. (line 33) +* multiple ESS processes: Multiple ESS processes. + (line 6) +* new objects, creating: Edit buffer. (line 14) +* objects: Hot keys. (line 24) +* pages in the process buffer: Transcript. (line 24) +* paging commands in help buffers: Help. (line 28) +* paragraphs in the process buffer: Transcript. (line 13) +* parsing errors: Error Checking. (line 6) +* process buffer: Starting up. (line 18) +* process names: Multiple ESS processes. + (line 8) +* programming in S: Introduction. (line 42) +* project work in S: Source Files. (line 41) +* quitting from ESS: Hot keys. (line 72) +* re-executing commands: Command History. (line 6) +* reading long command outputs: Last command. (line 19) +* remote Computers: ESS processes on Remote Computers. + (line 6) +* reverting function definitions: Edit buffer. (line 27) +* roxy: Roxygen. (line 6) +* Roxygen: Roxygen. (line 6) +* running S: Starting up. (line 6) +* S+elsewhere: ESS processes on Remote Computers. + (line 6) +* search list: Hot keys. (line 34) +* search list <1>: Source Directories. (line 55) +* sending input: Entering commands. (line 6) +* starting directory: Starting up. (line 12) +* starting ESS: Starting up. (line 6) +* STERM: Statistical Process running in ESS?. + (line 6) +* tcsh: Object names. (line 17) +* temporary buffers: Help. (line 171) +* temporary buffers, killing: Hot keys. (line 72) +* transcript: Transcript. (line 9) +* transcript file: Customizing startup. (line 34) +* transcript file names: Saving transcripts. (line 13) +* transcript mode motion: Transcript Mode. (line 17) +* transcripts of S sessions: Introduction. (line 39) +* using S interactively: Introduction. (line 30) +* winjava: winjava. (line 6) +* working directory: Starting up. (line 12) +* working directory <1>: Source Directories. (line 55) +* X Windows: X11. (line 6) + + + +Tag Table: +Node: Top268 +Node: Introduction2303 +Node: Features5264 +Node: Current Features5897 +Node: New features10170 +Node: Credits55228 +Node: Latest version58795 +Node: Manual59330 +Node: Installation61875 +Node: Step by step instructions62205 +Node: License64428 +Node: Stability65091 +Node: Requirements65588 +Node: Interactive ESS66269 +Node: Starting up67123 +Node: Multiple ESS processes67906 +Node: ESS processes on Remote Computers68940 +Node: S+elsewhere and ESS-elsewhere73096 +Node: Customizing startup75871 +Node: Entering commands78551 +Node: Command-line editing79709 +Node: Transcript80946 +Node: Last command82723 +Node: Process buffer motion84159 +Node: Transcript resubmit85662 +Node: Saving transcripts87636 +Node: Command History89489 +Node: Saving History92939 +Node: History expansion93735 +Node: Hot keys96946 +Node: Statistical Process running in ESS?101021 +Node: Emacsclient102300 +Node: Other103107 +Node: Evaluating code104159 +Node: Transcript Mode107708 +Node: Resubmit108857 +Node: Clean109920 +Node: Editing objects110916 +Node: Edit buffer112034 +Node: Loading114083 +Node: Error Checking115110 +Node: Indenting116159 +Node: Styles119429 +Node: Other edit buffer commands121803 +Node: Source Files123459 +Node: Source Directories128069 +Node: Help131211 +Node: Completion135506 +Node: Object names135727 +Node: Function arguments138585 +Node: Minibuffer completion139124 +Node: Auto-complete139623 +Node: Icicles141170 +Node: Developing with ESS142536 +Node: ESS tracebug142982 +Node: Editing documentation146154 +Node: R documentation files146704 +Node: Roxygen150624 +Node: Namespaced Evaluation154959 +Node: Extras156955 +Node: ESS ElDoc157938 +Node: Handy commands159461 +Node: Highlighting160656 +Node: Parens161985 +Node: Graphics162566 +Node: printer163075 +Node: X11163831 +Node: winjava164170 +Node: Imenu164582 +Node: Toolbar165423 +Node: TAGS165831 +Node: Rdired167183 +Node: Rutils168235 +Node: Org170611 +Node: Sweave and AUCTeX171553 +Node: ESS for S173677 +Node: ESS(S)--Editing files174112 +Node: iESS(S)--Inferior ESS processes175229 +Node: ESS-help--assistance with viewing help180897 +Node: Philosophies for using ESS(S)181217 +Node: Scenarios for use (possibilities--based on actual usage)182336 +Node: Customization Examples and Solutions to Problems187019 +Node: ESS for SAS188756 +Node: ESS(SAS)--Design philosophy189479 +Node: ESS(SAS)--Editing files190432 +Node: ESS(SAS)--TAB key192286 +Node: ESS(SAS)--Batch SAS processes193652 +Node: ESS(SAS)--Function keys for batch processing198678 +Node: iESS(SAS)--Interactive SAS processes208164 +Node: iESS(SAS)--Common problems211918 +Node: ESS(SAS)--Graphics213442 +Node: ESS(SAS)--Windows214225 +Node: ESS for BUGS214803 +Node: ESS(BUGS)--Model files215818 +Node: ESS(BUGS)--Command files216598 +Node: ESS(BUGS)--Log files217143 +Node: ESS for JAGS217480 +Node: ESS(JAGS)--Model files218468 +Node: ESS(JAGS)--Command files220902 +Node: ESS(JAGS)--Log files221677 +Node: Mailing lists/bug reports221973 +Node: Bugs222237 +Node: Reporting Bugs223862 +Node: Mailing Lists224671 +Node: Help with emacs225418 +Node: Customization225973 +Node: Indices226736 +Node: Key index226911 +Node: Function and program index232262 +Node: Variable index241683 +Node: Concept index244814 + +End Tag Table diff -Nru ess-16.10/doc/installation.texi ess-17.11/doc/installation.texi --- ess-16.10/doc/installation.texi 2015-04-01 10:29:23.000000000 +0000 +++ ess-17.11/doc/installation.texi 2017-11-13 14:13:15.000000000 +0000 @@ -1,20 +1,20 @@ @c This file is not used anymore and is the same as installation.texi -@c @section Unix (Linux/Mac OS X/Solaris/etc.) Installation +@c @section Unix (Linux/macOS/Solaris/etc.) Installation @enumerate -@item Download the latest zip or tgz archive from ESS +@item Download the latest zip or tgz archive from ESS @uref{http://ess.r-project.org/index.php?Section=download, downloads area} and unpack it into a directory where you would like ESS to reside. We will denote this directory as @file{/path/to/ESS/} hereafter. Alternatively you can use @code{git} to fetch the most recent development version to your local machine with: -@comment +@comment @comment @example @comment svn checkout https://svn.r-project.org/ESS/trunk /path/to/ESS @comment @end example -@comment -@comment or +@comment +@comment or @example git clone https://github.com/emacs-ess/ESS.git /path/to/ESS @@ -36,7 +36,7 @@ @end example The files are installed into @code{/usr/share/emacs} directory. For this step to -run correctly on Mac OS X, you will need to adjust the @file{PREFIX} +run correctly on macOS, you will need to adjust the @file{PREFIX} path in @file{Makeconf}. The necessary code and instructions are commented in that file. @@ -59,11 +59,13 @@ location with @code{M-x ess-version}. @end enumerate - -@emph{Note for Windows and Mac OS X users:} The most straightforward +@c -- NOTE: keep in sync with more important ../../ESS-web/php/download.php +@emph{Note for Windows and macOS users:} The most straightforward way to install Emacs on your machine is by downloading -@uref{http://vgoulet.act.ulaval.ca/en/emacs/, all-in-one} Emacs binary -by Vincent Goulet. +the Emacs binary by Vincent Goulet; either +@uref{https://vigou3.github.io/emacs-modified-macos/, Emacs Modified for macOS} +or from +@uref{https://vigou3.github.io/emacs-modified-windows/, Emacs Modified for Windows}. @emph{Note for XEmacs users:} Due to XEmacs lacking some features diff -Nru ess-16.10/doc/inst_tar.texi ess-17.11/doc/inst_tar.texi --- ess-16.10/doc/inst_tar.texi 2014-10-28 18:15:42.000000000 +0000 +++ ess-17.11/doc/inst_tar.texi 2017-11-13 14:13:15.000000000 +0000 @@ -245,7 +245,7 @@ variable, you can add the following to your emacs initialization file (and restart emacs): @example -(setq inferior-R-program-name "c:/progra~1/R/R-2.2.1/bin/Rterm.exe") +(setq inferior-ess-r-program-name "c:/progra~1/R/R-2.2.1/bin/Rterm.exe") @end example This assumes that you have installed R-2.2.1 in the default location. Change the path otherwise to point to other locations. diff -Nru ess-16.10/doc/newfeat.texi ess-17.11/doc/newfeat.texi --- ess-16.10/doc/newfeat.texi 2016-10-22 16:03:27.000000000 +0000 +++ ess-17.11/doc/newfeat.texi 2017-11-13 14:13:15.000000000 +0000 @@ -1,6 +1,41 @@ @comment @itemize @w{} @comment @item +Changes and New Features in 17.11: +@itemize @bullet + +@item The ESS initialisation process has been streamlined. You can now +load the R and Stata modes independently from the rest of ESS. Just put +@code{(require 'ess-r-mode)} or @code{(require 'ess-stata-mode)} in your +init file. This is for experienced Emacs users as this requires setting +up autoloads for @code{.R} files manually. We will keep maintaining +@code{ess-site} for easy loading of all ESS features. + +@item 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. + +@item @ESS{[R]}: New command @code{ess-r-package-use-dir}. It sets the +working directory of the current process to the current package directory. + +@item @ESS{[R]} Lookup for references in inferior buffers has been +improved. New variable @code{ess-r-package-source-roots} contains +package sub-directories which are searched recursively during the file +lookup point. Directories in @code{ess-tracebug-search-path} are now +also searched recursively. + +@item @ESS{[R]} Namespaced evaluation is now automatically enabled only +in the @code{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. + +@end itemize + + Changes and New Features in 16.10: @itemize @bullet diff -Nru ess-16.10/doc/README.additions ess-17.11/doc/README.additions --- ess-16.10/doc/README.additions 2014-10-28 18:15:42.000000000 +0000 +++ ess-17.11/doc/README.additions 1970-01-01 00:00:00.000000000 +0000 @@ -1,18 +0,0 @@ --*- text -*- - -The purpose of this file is to describe how to add new dialects and -languages to ESS. - -The code is divided into 4 types of functionality. - -ess-*.el : described the underlying mechansim -essl-*.el : language specific considerations -ess-*-d.el : describe dialect and process specific modifications. - This should also contain the language specific interface - functions. -essdd*.el : modes for writing documentation. - - -This will be finished for 5.2. - - diff -Nru ess-16.10/doc/README.elsewhere ess-17.11/doc/README.elsewhere --- ess-16.10/doc/README.elsewhere 2014-10-28 18:15:42.000000000 +0000 +++ ess-17.11/doc/README.elsewhere 1970-01-01 00:00:00.000000000 +0000 @@ -1,46 +0,0 @@ --*- text -*- - -($Revision: 1.1 $) - -ESS: Running an ESS Subprocess which is ELSEWHERE. -================================================== - - M-x ESS-elsewhere - -will prompt you for the language you'd like to run. You need to -provide it _EXPLICITLY_ (at least until we figure out a good -completion mechanism, sigh...). - -No extraneous spaces, no extraneous whatever. Type it exactly. - -Now, since the prompt is "wrong", you need to switch to the correct -buffer; there might be a "time-out" by the process waiting for a -correct prompt. The correct prompt will never appear. I promise. -Unless you've got a weird setup. Now, you need to switch to the -correct buffer. This would be *R...*, or *S...*, or *Stata...*, etc, -depending on the language. Use: - - C-x C-b - -to switch. - -Now you should see a Bourne (or Bash) shell prompt (...$). Log in to -the machine you want, and start up the corresponding process, i.e. - - telnet my-machine-with-R.com - -(log in). - - R - -and then you are off and running. - -It'll be cleaned up. - -I promise. - - - - - - diff -Nru ess-16.10/doc/README.Microsoft ess-17.11/doc/README.Microsoft --- ess-16.10/doc/README.Microsoft 2014-10-28 18:15:42.000000000 +0000 +++ ess-17.11/doc/README.Microsoft 1970-01-01 00:00:00.000000000 +0000 @@ -1,64 +0,0 @@ -Introduction -============ - -S-PLUS use -========== - -SAS use -======= - -Microsoft problems -================== - - See the file `README.SPLUS4WIN' as well, for more information and -details. - - * (RMH) system freeze and ctrl-m, a solution for some cases. - - Frequently, when the *shell* buffer freezes while running - either COMMAND.COM or a DOS or Windows program initiated by - command.com, it can be unfrozen by entering the key sequence C-q - C-m RET into the frozen buffer. - - What I think is happening is the coding-system got confused. - Command.com is waiting for the C-m C-l sequence and it only sees - the C-l, which it knows is not the end of the line. When - we manually give the C-m, followed by RET, it is happy and - completes parsing the line. - - For example, from a *shell* buffer running bash (with ps in the - path): - - command.com ps C-q C-m RET exit C-q C-m RET - - command.com /c date RET C-q C-m RET - - command.com /c date C-q C-m RET - - * (RMH) Changes in ess-r-d.el for Windows - - One of the design goals in ESS was to make it almost - unnecessary for users to make modifications to the ess-*.el files. - We have split the R function into two clones. R-unix is the old - R function. It uses the starting argument "-no-readline ". - R-microsoft is designed for Windows. It uses the starting - argument "-ess ". We detect the operating system and fset the - name R to whichever is appropriate. No user changes are - required. M-x R always works. - - * (RMH) msdos.el - - Start an msdos shell inside an NTemacs that normally uses - bash as its shell. It should have been easy, but had many - parameters that needed to be set. I am sending a copy of - this to the Ntemacs mailing list. I think this function - should be merged into the Ntemacs distribution, but for the moment - I am attributing it to us. - - -S-PLUS problems -=============== - -SAS-problems -============ - diff -Nru ess-16.10/doc/README.Microsoft.texi ess-17.11/doc/README.Microsoft.texi --- ess-16.10/doc/README.Microsoft.texi 2014-10-28 18:15:42.000000000 +0000 +++ ess-17.11/doc/README.Microsoft.texi 1970-01-01 00:00:00.000000000 +0000 @@ -1,59 +0,0 @@ -\input texinfo @c -*-texinfo-*- -@comment %**start of header -@setfilename readme.info -@settitle ESS --- Comments on Microsoft/ESS Integration -@comment %**end of header -@comment $Id: README.Microsoft.texi,v 1.1 2000/06/29 18:35:08 rossini Exp $ - -@node General Installation and Use -@comment node-name, next, previous, up -@section Introduction - -@include ms-inst.texi - - -@node S-PLUS use -@comment node-name, next, previous, up -@section S-PLUS use - -@include help-sp.texi - -@node SAS use -@comment node-name, next, previous, up -@section SAS use - -@include help-sas.texi - - -@node Microsoft Specific Problems -@comment node-name, next, previous, up -@section Microsoft problems - -@include bugs-ms.texi - - -@node S-PLUS Specific Problems -@comment node-name, next, previous, up -@section S-PLUS problems - -@include bugs-s.texi - - -@node SAS Specific Problems -@comment node-name, next, previous, up -@section SAS-problems - -@include bugs-sas.texi - - -@bye -@c Remember to delete these lines before creating the info file. -@iftex -@lucidbook -@bindingoffset = 0.5in -@parindent = 0pt -@end iftex - -@comment Local Variables: -@comment TeX-master: "README.Microsoft.texi" -@comment End: diff -Nru ess-16.10/doc/README.noweb.ESS ess-17.11/doc/README.noweb.ESS --- ess-16.10/doc/README.noweb.ESS 2014-10-28 18:15:42.000000000 +0000 +++ ess-17.11/doc/README.noweb.ESS 1970-01-01 00:00:00.000000000 +0000 @@ -1,52 +0,0 @@ -Hello again - -Its a while since I contacted you, but I have got somewhere. I'm still working -on the version of noweb-mode.el that is distributed with noweb itself, but I'm -getting places. I've made it more reliable: moving text used to confuse it -horribly, but it shouldn't any more. And although I couldn't reproduce those -`hot icons' in your noweb-mode, I used the << and >> of the chunk name to do -the same job. - -I've also got tangling sorted. Well, it works for me. I haven't tested the -line numbering and tab-resetting options yet, but I can tangle chunks and -scraps (which I, recidivist that I am, refer to as threads: I can't help -thinking that a web woven from threads will be prettier than one woven from -scraps). Unfortunately, I couldn't see a reasonable way of breaking this out -of the noweb-mode package. So my tangling won't work with your noweb-mode, -you'll have to use mine. At least until you can incorporate the relevant -functions into yours. - -I've also got the beginnings of an ess-noweb.el. For example, `ess-eval-chunk' - simply runs `ess-eval-buffer' on the buffer that the chunk was tangled into. -I've been using it successfully for about a week now, although not for -anything particularly fancy. It adds the tangling options to the ESS menus, -but only makes them active if noweb-mode is active. - -Here are the three relevant files (noweb-mode.el, noweb-font-lock-mode.el and -ess-noweb.el). Give them a spin and see what you think. - -Wait up, you need my ess-site.el as well, cos that's were the menus are -defined. - - -Mark - -P.S. - -Incidentally, you mentioned that you were keen on version control, and -preferred CVS to RCS. I'm trying to sort out version control on my stuff here -at the moment, but was not convinced at all by CVS: it does far too many -things that are not needed by a statistician. All the multiple developer stuff -should be superfluous for tracking data: one person should be responsible for -managing the file at any given time. So I'm going with a bare minimum -approach: RCS, and shell scripts to hide most of the options. Just check -things in, with automatic checking out so that the programs can always find -the data they need, snapshots, and restoring. All done with symbolic links, so -that the same files can be in several projects at the same time (RCS handles -symbolic links ABOMINABLY, but the shell scripts can get around this.) My -theory is that if the system is sufficiently simple, people *might* use it, -but anything that requires too much thought will be a non-starter. What -draw-backs do you see in this way of doing things ? Why would you do it -differently ? - - Binary files /tmp/tmpCr6fs_/WAh2Sjb543/ess-16.10/doc/readme.pdf and /tmp/tmpCr6fs_/oL1nr6q8Sc/ess-17.11/doc/readme.pdf differ diff -Nru ess-16.10/doc/README.S ess-17.11/doc/README.S --- ess-16.10/doc/README.S 2014-10-28 18:15:42.000000000 +0000 +++ ess-17.11/doc/README.S 1970-01-01 00:00:00.000000000 +0000 @@ -1,303 +0,0 @@ --*- text -*- - -($Revision: 5.2 $) - -ESS: Using The S family of statistical languages -================================================ - -ESS (originally S-mode) was initially designed for use with S and -S-PLUS(tm); hence, this family of statistical languages currently has -the most support. We denote by _S_, any of the currently available -members of the family, including S 3.x, S 4.x, S-PLUS 3.x, S-PLUS 4.x, -S-PLUS 5.x, and R. In addition, we denote by _Emacs_, one of the GNU -family of editors, either Emacs (as developed and maintained by the -Free Software Foundation) or XEmacs (which is a derivative work). - -The following is covered in this document: -- general Emacs features. -- Editing files. -- running an S process as an inferior process to Emacs -- using transcripts. -- Scenarios for use (possibilities, based on actual usage) -- Philosophies - -New in 5.1.2 and later: use under Microsoft Windows OS's with NTEmacs. -See the file README.SPLUS4WIN for more details. - -Emacs: General features -======================= - -We assume that you are familiar with Emacs terminology and syntax: -file, buffer, region, description of keys etc. If not, please read -the New Users guide (found in the info pages, "C-h i" (by pressing -control h, i) or Tutorial, "C-h t"). - -To find the key-sequences for commands, view the keymap (C-h b) or -view help for the current mode (C-h m). - -ESS[S]: Editing Files -===================== - -ESS[S] is the mode for editing S language files. This mode handles: - -- proper indenting, generated by both [Tab] and [Return]. -- color and font choices based on syntax. -- ability to send the contents of an entire buffer, a highlighted - region, an S function, or a single line to an inferior S process, if - one is currently running. -- ability to switch between processes which would be the target of the - buffer (for the above). -- The ability to request help from an S process for variables and - functions, and to have the results sent into a separate buffer. -- completion of object names and file names. - -ESS[S] mode should be automatically turned on when loading a file with -the suffices found in ess-site (*.R, *.S, *.s, etc). However, one -will have to start up an inferior process to take advantage of the -interactive features. - - -iESS: Inferior ESS processes. -============================= - -iESS (inferior ESS) is the mode for interfacing with active -statistical processes (programs). This mode handles: - -- proper indenting, generated by both [Tab] and [Return]. -- color and font highlighting based on syntax. -- ability to resubmit the contents of a multi-line command - to the executing process with a single keystroke [RET]. -- The ability to request help from the current process for variables - and functions, and to have the results sent into a separate buffer. -- completion of object names and file names. -- interactive history mechanism -- transcript recording and editing - -To start up iESS mode, use: - M-x S+3 - M-x S4 - M-x R - -(for S-PLUS 3.x, S4, and R, respectively. This assumes that you have -access to each). Usually the site will have defined one of these programs -(by default S+3) to the simpler name: - - M-x S - -Note that R has some extremely useful command line arguments, --v and -n. To enter these, call R using a "prefix argument", by - - C-u M-x R - -and when ESS prompts for "Starting Args ? ", enter (for example): - - -v 10000 -n 5000 - -Then that R process will be started up using "R -v 10000 -n 5000". - -New for ESS 5.1.2 (and later): "S-elsewhere" command - - The idea of "M-x S-elsewhere" is that we open a telnet (or rlogin) - to another machine, call the buffer "*S-elsewhere*", and then run S - on the other machine in that buffer. We do that by defining "sh" as - the inferior-S-elsewhere-program-name. Emacs sets it up in a - "*S-elsewhere*" iESS buffer. The user does a telnet or login from - that buffer to the other machine and then starts S on the other - machine. The usual C-c C-n commands from myfile.s on the local - machine get sent through the buffer "*S-elsewhere*" to be executed - by S on the other machine. - - -ESS-trans: Handling and Reusing Transcripts -=========================================== - -- edit transcript -- color and font highlighting based on syntax. -- resubmit multi-line commands to an active process buffer -- The ability to request help from an S process for variables and - functions, and to have the results sent into a separate buffer. -- ability to switch between processes which would be the target of the - buffer (for the above). - - - -ESS-help: assistance with viewing help -====================================== - -- move between help sections -- send examples to S for evaluation - - -Philosophies for using ESS -========================== - -The first is preferred, and configured for. The second one can be -retrieved again, by changing emacs variables. - -1: (preferred by the current group of developers): The source code is - real. The objects are realizations of the source code. Source - for EVERY user modified object is placed in a particular directory - or directories, for later editing and retrieval. - -2: (older version): S objects are real. Source code is a temporary - realization of the objects. Dumped buffers should not be saved. - _We_strongly_discourage_this_approach_. However, if you insist, - add the following lines to your .emacs file: - - (setq ess-keep-dump-files 'nil) - (setq ess-delete-dump-files t) - (setq ess-mode-silently-save nil) - -The second saves a small amount of disk space. The first allows for -better portability as well as external version control for code. - - -Scenarios for use -================= - -We present some basic suggestions for using ESS to interact with S. -These are just a subset of approaches, many better approaches are -possible. Contributions of examples of how you work with ESS are -appreciated (especially since it helps us determine priorities on -future enhancements)! (comments as to what should be happening are -prefixed by "##"). - -1: ## Data Analysis Example (source code is real) - ## Load the file you want to work with - C-x C-f myfile.s - - ## Edit as appropriate, and then start up S-PLUS 3.x - M-x S+3 - - ## A new buffer *S+3:1* will appear. Splus will have been started - ## in this buffer. The buffer is in iESS [S+3:1] mode. - - ## Split the screen and go back to the file editing buffer. - C-x 2 C-x b myfile.s - - ## Send regions, lines, or the entire file contents to S-PLUS. For regions, - ## highlight a region with keystrokes or mouse and then send with: - C-c C-r - - ## Re-edit myfile.s as necessary to correct any difficulties. Add - ## new commands here. Send them to S by region with C-c C-r, or - ## one line at a time with C-c C-n. - - ## Save the revised myfile.s with C-x C-s. - - ## Save the entire *S+3:1* interaction buffer with C-c C-s. You - ## will be prompted for a file name. The recommended name is - ## myfile.St. With the *.St suffix, the file will come up in ESS - ## Transcript mode the next time it is accessed from Emacs. - - - -2: ## Program revision example (source code is real) - - ## Start up S-PLUS 3.x in a process buffer (this will be *S+3:1*) - M-x S+3 - - ## Load the file you want to work with - C-x C-f myfile.s - - ## edit program, functions, and code in myfile.s, and send revised - ## functions to S when ready with - C-c C-f - ## or highlighted regions with - C-c C-r - ## or individual lines with - C-c C-n - ## or load the entire buffer with - C-c C-l - - ## save the revised myfile.s when you have finished - C-c C-s - - - -3: ## Program revision example (S object is real) - - ## Start up S-PLUS 3.x in a process buffer (this will be *S+3:1*) - M-x S+3 - - ## Dump an existing S object my.function into a buffer to work with - C-c C-d my.function - ## a new buffer named yourloginname.my.function.S will be created with - ## an editable copy of the object. The buffer is associated with the - ## pathname /tmp/yourloginname.my.function.S and will amlost certainly not - ## exist after you log off. - - ## enter program, functions, and code into work buffer, and send - ## entire contents to S-PLUS when ready - C-c C-b - - ## Go to *S+3:1* buffer, which is the process buffer, and examine - ## the results. - C-c C-y - ## The sequence C-c C-y is a shortcut for: C-x b *S+3:1* - - ## Return to the work buffer (may/may not be prefixed) - C-x C-b yourloginname.my.function.S - ## Fix the function that didn't work, and resubmit by placing the - ## cursor somewhere in the function and - C-c C-f - ## Or you could've selected a region (using the mouse, or keyboard - ## via setting point/mark) and - C-c C-r - ## Or you could step through, line by line, using - C-c C-n - ## Or just send a single line (without moving to the next) using - C-c C-j - ## To fix that error in syntax for the "rchisq" command, get help - ## by - C-c C-v rchisq - - -4: Data Analysis (S object is real) - ## Start up S-PLUS 3.x, in a process buffer (this will be *S+3:1*) - M-x S+3 - - ## Work in the process buffer. When you find an object that needs - ## to be changed (this could be a data frame, or a variable, or a - ## function), dump it to a buffer: - C-c C-d my.cool.function - - ## Edit the function as appropriate, and dump back in to the - ## process buffer - C-c C-b - - ## Return to the S-PLUS process buffer - C-c C-y - ## Continue working. - - ## When you need help, use - C-c C-v rchisq - ## instead of entering: help("rchisq") - - - -Customization Examples and Solutions to Problems -================================================ - -1. Suppose that you are primarily an SPLUS 3.4 user, occasionally - using S version 4, and sick and tired of the buffer-name *S+3* - we've stuck you with. Simply edit the "ess-dialect" alist entry in - the ess-s3-d.el and ess-s4-d.el files to be "S" instead of "S4" and - "S+3". This will insure that all the inferior process buffer names - are "*S*". - -2. Suppose that you WANT to have the first buffer name indexed by - ":1", in the same manner as your S-PLUS processes 2,3,4, and 5 (for - you heavy simulation people). Then uncomment the line in ess-site - (or add after your (require 'ess-site) or (load "ess-site") command - in your .emacs file, the line: - - (setq ess-plain-first-buffername nil) - ) - -3. Fontlocking sometimes fails to behave nicely upon errors. When - Splus dumps, a mis-matched " (double-quote) can result in the - wrong font-lock face being used for the remainder of the buffer. - - Solution: add a " at the end of the "Dumped..." statement, to - revert the font-lock face back to normal. diff -Nru ess-16.10/doc/README.SAS ess-17.11/doc/README.SAS --- ess-16.10/doc/README.SAS 2014-10-28 18:15:42.000000000 +0000 +++ ess-17.11/doc/README.SAS 1970-01-01 00:00:00.000000000 +0000 @@ -1,475 +0,0 @@ --*- indented-text -*- - -($Revision: 5.4 $) - -ESS: Using SAS -============== - -The SAS module in ESS (ESS[SAS]) is currently undergoing development. -It is functional and pretty stable. Please send any suggestions and -bug reports to ess-bugs@stat.math.ethz.ch. - -ESS (originally S-mode) was initially designed for use with S and -S-PLUS(tm). ESS has been extended to support other languages, -including SAS(tm). The editing of SAS files is based on -the stable, old SAS mode by Cook -(ftp://ftp.biostat.wisc.edu/pub/cook/sas-mode/sas.tar.gz). Those -editing features and new advanced features are part of ESS[SAS]. -The user interface with ESS[SAS] is similar in behavior to the -interface for S (unlike Cook's SAS mode) and to the windowing -interface that SAS itself uses. - -We denote by _Emacs_ one of the GNU family of editors, either Emacs -(as developed and maintained by the Free Software Foundation) or -XEmacs (which is a derivative work). - -The following is covered in this document: -- general Emacs features. -- Editing files. -- running an interactive SAS process as an inferior process to Emacs -- running a batch SAS process in a shell buffer -- Scenarios for use (possibilities, based on actual usage) -- using transcripts. -- Design Philosophy - - -Emacs: General features -======================= - -We assume that you are familiar with Emacs terminology and syntax: -file, buffer, region, description of keys etc. If not, please read -the New Users guide (found in the info pages, "C-h i" (by pressing -control h, i) or Tutorial, "C-h t"). - - -ESS[SAS]: Editing Files -======================= - -ESS[SAS] is the mode for editing SAS language files. This mode handles: - -- proper indenting, generated by both [Tab] and [Return]. -- color and font choices based on syntax. -- ability to send the contents of an entire buffer, a highlighted region, - or a single line to an inferior SAS process, if one is currently running. -- ability to switch between processes which would be the target of the - buffer (for the above). -- ability to save and submit the file you are working on as a batch SAS - process with a single keypress and to continue editing while it is running -- capability of killing the batch SAS process through the shell buffer or - allow the SAS process to keep on running after you exit Emacs -- single keypress navigation of .sas, .log and .lst files (.log and .lst - files are automatically refreshed with each keypress) - -ESS[SAS], the mode for editing SAS language files, is automatically -turned on when editing a file with a ".sas" suffix (or other, if -specified in ess-site). The batch processing keypress commands are -enabled by default to use the same function keys that the SAS Display -Manager uses. The interactive capabilities of ESS require you to -start an inferior SAS process with M-x SAS (described below). - -At this writing (ESS release 5.2), the indenting and syntactic -highlighting are usually correct. - - -ESS[SAS]: Function keys for batch processing -============================================ - -The description of the setup for function keys for batch processing of -SAS files is unavoidably more complex than we wish it were. The actual -use of the function keys is simple. There are five distinct options: - -1. (default) Function keys in ESS[SAS] modes do whatever they normally -do in other emacs modes. Many users will have defined some of the -keys [f2]-f[8] in their .emacs or _emacs file, or will have -installation-wide definitions in their site-start.el file. By -default, ESS does not override those definitions. This default is -intended to make ESS[SAS] mode behave similarly to other emacs modes. - -2,3,4,5. -Users who are primarily familiar with SAS, and who are learning emacs -as a way to approach SAS, will likely want to duplicate the function -key capabilities that SAS Institute provides with its Display Manager. -There are still options. SAS provides different function key -definitions with its PC and Unix products; ESS can use either. The -ESS[SAS] function key definitions can be active in all buffers -(global) or limited (local) only to buffers that have SAS-related file -extensions: .sas, .log, .lst, and "Type-1" which defaults to .txt. -The distinction between local and global appears subtle. If you want -the ESS[SAS] definitions to work when you are in *shell* or when -editing files other than the file extensions that SAS recognizes, you -will most likely want to use the global definitions. -If you want your function keys to understand SAS batch commands when you -are editing SAS files, and to behave normally when editing other files, -then you will choose the local definitions. - -The option can be chosen by the person installing ESS for a site or by -an individual. - -The site manager can uncomment only one of the following lines. -ESS[SAS] Function keys are available in ESS[SAS] and related modes if you -uncomment either of the following lines in your ess-site.el: -;;2; (setq ess-sas-local-unix-keys t) -;;3; (setq ess-sas-local-pc-keys t) -ESS[SAS] Function keys are available in all Emacs modes if you -uncomment either of the following lines in your ess-site.el: -;;4; (setq ess-sas-global-unix-keys t) -;;5; (setq ess-sas-global-pc-keys t) -The names -unix- and -pc- have nothing to do with the operating system -that you are running. Rather they mimic the definitions that the SAS -Display Manager uses by default on those platforms. - -The option can be selected by an individual by adding a line to the -.emacs (or _emacs) file, immediately following the - (load "ess-site") -line. If your site manager has chosen an option 2,3,4,5 you don't -want, you must turn it off before selecting a different option. To -turn off an option, add the appropriate line (uncommented) to your -.emacs (_emacs) file. -;;2; (setq ess-sas-local-unix-keys nil) -;;3; (setq ess-sas-local-pc-keys nil) -;;4; (setq ess-sas-global-unix-keys nil) -;;5; (setq ess-sas-global-pc-keys nil) - -Finally we get to what the function keys do. - -Unix PC -F2 F2 Refresh:revert the buffer with the file if the file on disk is newer - than the file currently in the buffer. -F3 F8 Submit: save the current .sas buffer (which may be the .sas - file associated with the .lst or .log file you - are actually looking at) to a file and submit - the file to a background SAS job. -F4 F5 Program:switch buffer to .sas file. -F5 F6 Log: switch buffer to .log file, "refresh" and - goto next error message, if any. -F6 F7 Listing:switch buffer to .lst file and "refresh". -F7 F4 Type-1: switch buffer to Type-1 (defaults to .txt) file and "refresh". -F8 F3 Shell: switch buffer to shell. - -Keys [f3]-[f8] mimic SAS Display Manager keys. One other key has been -provided for convenience. F2 performs the "refresh" operation on the -current buffer. "refresh" compares the buffer date stamp with the -file date stamp and replaces the buffer with the file if the file is -newer. This is the same operation that is automatically performed -when Log, Listing, or Type-1 are pressed. Type-1 takes you to a file -with a user-specified extension; .txt by default. You can over-ride -the default, by specifying a different extension in your .emacs file: -(setq ess-sas-suffix-1 '.txt') - - -ESS[SAS]: TAB key -================= - -Again, two options. - -The TAB key is bound by default to sas-indent-line. This function is -used to syntactically indent SAS code so PROC and RUN are in the left -margin, other statements are indented 4 spaces from the margin, -continuation lines are indented 4 spaces in from the beginning column -of that statement. This is the type of functionality that Emacs -provides in most programming language modes. This functionality is -equivalent to uncommenting the following line in ess-site.el: -;;; (setq ess-sas-edit-keys-toggle 0) - -ESS provides an alternate behavior for the TAB key that makes it -behave as it does on non-emacs terminals, i.e. move the cursor to the -next tab stop. The alternate behavior also provides a backwards TAB -key: C-TAB. This functionality is obtained by uncommenting the -following line in ess-site.el: -;;; (setq ess-sas-edit-keys-toggle 1) -Under the alternate behavior, the TAB key is bound to tab-to-tab-stop -and the tab stops are set by default at multiples of 4. - - -iESS: Inferior ESS processes -============================ - -iESS (inferior ESS) is the mode for interfacing with active -statistical processes (programs). - -To start up iESS[SAS] mode, use: - M-x SAS - -We plan to add -- The ability to request help from a process for variables and - functions, and to have the results sent into a separate buffer. -- completion of object names and file names. - - -ESS[SAS]: Batch processes -========================= - -The default command used by the Submmit funciton key (F3 or F8) to submit -a batch SAS job is simply "sas". If necessary, you can over-ride this in -your .emacs file something like one of the following: -;;; (setq ess-sas-submit-command "nohup nice sas") ;; Unix -;;; (setq ess-sas-submit-command "c:/progra~1/sas/sas.exe") ;; Windows -;;; (setq ess-sas-submit-command "invoke SAS using program file") ;; Mac -Note that when you are specifying a path under Windows, you should -avoid spaces (that is use "progra~1", not "Program Files") and you -should use forward slashes "/". There may be occasions when you want -to run a particular buffer under a different version of SAS or specify -different options on the command line. In that case, you can -over-ride ess-sas-submit-command in your local buffer with file -variables or other means. - -There is a built-in delay before a batch SAS job is submitted when using -a Unix shell under either Unix or Windows. This is necessary in many cases -since the shell might not be ready to receive a command. This delay is -currently set high enough so as not to be a problem on any system. But, -there may be cases when it needs to be set higher, or could be set much -lower to speed things up. You can over-ride the default in your .emacs -file by (the default of 5 seconds is shown): -(setq ess-sleep-for 5) - - -Scenarios for use -================= - -We present one scenario for using ESS to interact with SAS. -Contributions of examples of how you work with ESS are appreciated -(especially since it helps us determine priorities on future -enhancements)! (comments as to what should be happening are prefixed -by "##"). - -Batch SAS (-unix-keys illustrated, pc-keys in the comments) - ## Find the file you want to work with - C-x C-f myfile.sas - ## myfile.sas will be in ESS[SAS] mode - - ## Edit as appropriate, then save and submit the batch SAS job. - ## -pc- F8 - F3 - - ## The job runs in the shell buffer while you continue to edit - ## myfile.sas. If you are running a Unix shell under Unix or - ## Windows, the message buffer will notify you with a shell - ## notification when the job is complete. If so, then you - ## will also have the option of terminating the batch job - ## before it is finished. - ## -pc- F3 - F8 - - ## In any case, you may want to visit the .log while the process - ## is still running (unix only) or when it is done and check for - ## error messages - ## (you will be taken to the next error message, if any). - ## The .log will be refreshed and you will be placed in it's buffer. - ## -pc- F6 - F5 - - ## Now, refresh the .lst and go to it's buffer. - ## -pc- F7 - F6 - - ## If you wish to make changes, go to the .sas file with - ## -pc- F5 - F4 - ## and make your editing changes. The go back to the submit instruction. - - -Interactive SAS - ## Find the file you want to work with - C-x C-f myfile.sas - ## myfile.sas will be in ESS[SAS] mode - - ## Edit as appropriate, and then start up SAS with the cursor in - ## the myfile.sas buffer - M-x SAS - - ## Four buffers will appear on screen: - ## myfile.sas in ESS[SAS] mode # your source file - ## *SAS:1* in iESS [SAS:1] mode # ESS communication buffer - ## *SAS:1.log* in Shell [] ESStr mode # SAS log information - ## *SAS:1.lst* in Shell [] ESSlst mode # SAS listing information - - ## If you would prefer each of the four buffers to appear in its - ## own individual frame, you can arrange for that. Place the - ## cursor in the buffer displaying myfile.sas. Enter the - ## sequence: - C-c C-w - - ## The cursor will normally be in buffer myfile.sas. - ## If not, put it there: - C-x b myfile.sas - - ## Send regions, lines, or the entire file contents to SAS - ## (regions are most useful). A highlighted region will normally - ## begin with the keywords 'DATA' or 'PROC' and end with the - ## keyword 'RUN;' - C-c C-r - - ## Information appears in the log buffer, analysis results in the - ## listing buffer. In case of errors, make the corrections in the - ## myfile.sas buffer and resubmit with another C-c C-r - - ## PROC GPLOT graphs will normally be produced in a postscript - ## file and be viewed later. Include the lines - /* required gsoptions for batch files */ - /* comment out these lines for interactive use on X-terminals*/ - filename grafout 'temp.ps'; - goptions device=ps gsfname=grafout gsfmode=append gaccess=sasgastd; - ## in myfile.sas. - - ## PROC PLOT graphs can be viewed in the listing buffer. You may - ## wish to control the vertical spacing to allow the entire plot - ## to be visible on screen, for example, by - proc plot; plot a*b / vpos=25; - - ## At the end of the session you may save the log and listing - ## buffers with the usual C-x C-s commands. You will be prompted - ## for a file name. Typically, the names myfile.log and mfile.lst - ## will be used. You will almost certainly want to edit the saved - ## files before including them in a report. The files are - ## read-only by default. You can make them writable by the Emacs - ## command C-x C-q. - - ## At the end of the session, the input file myfile.sas will - ## typically have been revised. You can save it. It can be used - ## later as the beginning of another iESS[SAS] session. It can - ## also be used as a batch input file to SAS. - - ## The *SAS:1* buffer is strictly for ESS use. The user should - ## never need to read it or write to it. Refer to the .lst and - ## .log buffers for monitoring output! - - -Here is a typical myfile.sas: - - title 'Analysis of Case 0502'; - - data case0502; - infile '/home/public/stat/Data/case0502.asc' - firstobs=2; - input percent code; - run; - - proc glm; - class code; - model percent=code /ss1; - run; - - - -Recommended autoexec.sas -======================== - -The default settings of the inferior-SAS-args in ess-sas-d.el -are "-stdio -linesize 80 -noovp -nosyntaxcheck" -with the interpretations: - -stdio required to make the redirection of stdio work - -linesize 80 keeps output lines from folding on standard terminals - -noovp prevents error messages from printing 3 times - -nosyntaxcheck permits recovery after syntax errors - -In addition there are several parameters that can't be set in the -command line. For these, we recommend the following line appear in -your autoexec.sas in your home directory: - - options noovp pagesize=60 linesize=80 formdlim=' '; - -Interpretations - - noovp prevents error messages from printing 3 time - pagesize=60 standard printed page length instead of window length - linesize=80 keeps output lines from folding on standard terminals - formdlim=' ' blank replaces "C-l" formfeeds to prevent mostly - empty pages - -The noovp and linesize=80 appear in both the inferior-SAS-args and in -the autoexec.sas. The redundancy means that these options are in -effect for SAS batch usage and SAS window manager usage as well as for -ESS[SAS] usage. - - - -Using Transcripts -================= - -Not yet available. The intent is that a marked section of a log file -from a previous SAS run can be resubmitted to SAS. The user would -highlight a region from 'PROC' to 'RUN;' and then send it to the -inferior SAS process with the [RET] key. ESS would automatically -clean the region (remove line numbers) and send the entire region over -as a single request to SAS. - - -Design Philosophy -================= - -ESS[SAS] mode was designed to aid the user in writing and maintaining -input command files, such as myfile.sas, for SAS. These are files -containing SAS statements. In a batch environment such files would be -submitted to SAS by the operating system command: - sas myfile.sas -In a SAS window environment, these files would be brought into the -"SAS: PROGRAM EDITOR" window and then submitted with the 'Local' 'Submit' -menu commands. - -The *SAS:1.log* buffer in ESStr mode corresponds to the file -myfile.log in SAS batch usage and to the "SAS: LOG" window in the SAS -window environment. All commands submitted to SAS, informative -messages, warnings, and errors appear here. - -The *SAS:1.lst* buffer in ESSlst mode corresponds to the file -myfile.lst in SAS batch usage and to the "SAS: OUTPUT" window in the -SAS window environment. All data related printed output from the -PROCs appear in this window. - -The iESS [SAS:1] buffer exists solely as a communications buffer. -Files are edited in the myfile.sas buffer. The C-c C-r key in -ESS[SAS] mode is the functional equivalent of bringing a file into the -"SAS: PROGRAM EDITOR" window followed by the 'Local' 'Submit' menu -commands. The user should never use this buffer directly. - - -The ESS[SAS] mode was written with two primary goals. - -1. Using Emacs, a window environment becomes available for dial-up -users who do not have access to the SAS window environment. - -2. The authors prefer the Emacs environment for editing and managing -input and output files, even on computer systems which run the SAS -window environment. - -A secondary goal was also realized. - -3. With an X-windows terminal connected by ppp at 14400 baud to a -Unix system running SAS, iESS[SAS] interaction with SAS was hundreds -of times faster than the SAS window system. The savings come because -the ESS windows are subunits of a text-based xterm window, rather than -the remotely managed graphical windows provided by SAS. (The timings -are SAS timings from the log files. The SAS windows times include -window management and communications times as well as calculation -times. The iESS times include only the calculations by the SAS -computing engine.) - - -Some Frequently Seen Problems -============================= - -1. If M-x SAS gives weird errors upon startup, check the following: - - ess-sas-sh-command (in the ESS source directory) needs to be - executable (solution: "chmod ugo+rx ess-sas-sh-command"). - - sas isn't in your executable path (verify using "which sas" from - a shell command-line) - - you need a copy of SAS (we can't solve this) - -2. M-x SAS starts up SAS in the window system (motif, for example), - instead of starting it up in the emacs buffers. - - Probably the unix command "sas" on your system calls a local - script which in turn calls the sas executable. The fix is to - call the sas executable directly. - - Change the line in ess-sas-sh command from: - sas $stdout 2>$stderr $@ - to a call to the complete path name of the sas executable on - your system, for example: - /usr/local/sas612/sas $stdout 2>$stderr $@ - - To find the complete path name on your system, you can - execute the line (from the unix prompt): - find / -name 'sas' -exec ls -ld {} \; - and expect a response similar to the following - -rwxr-xr-x 1 sas sas 2441216 Sep 9 1997 /usr/local/sas612/sas diff -Nru ess-16.10/doc/README.SPLUS4COMMAND ess-17.11/doc/README.SPLUS4COMMAND --- ess-16.10/doc/README.SPLUS4COMMAND 2014-10-28 18:15:42.000000000 +0000 +++ ess-17.11/doc/README.SPLUS4COMMAND 1970-01-01 00:00:00.000000000 +0000 @@ -1,52 +0,0 @@ -I finally got the S-Plus 4.x Commands window to appear in the *S+4* -buffer. - - http://astro.ocis.temple.edu/~rmh/essd-sp4com.el - -There are four functions in the file essd-sp4com.el. - -1. The primary user command is `M-x S+4-command'. This starts up the -S-Plus GUI and sinks the output from the Commands window to the *S+4* -buffer. The user then enters commands in the buffer myfile.s, sends -them to S-Plus with C-c C-n and reads S output in the *S+4* buffer. - -`S+4-command' works by using the file S-transcript.st in the current -directory as a communication file. S-Plus sinks its output to that -file. *S+4* uses 'tail -f' to read the file. The author of tail was -very clever. The ls or dir of the file S-transcript.st shows it to -have 0 bytes. Windows does not place a positive byte count on it -until after the file is closed by the process writing to it. tail -sneaks around the back and manages to read the file contents from the -cache where it lives before the file is closed. - -2. The second user command is `M-x S+4-tail'. S+4-command calls -S+4-tail, so the user may not need to call it directly. S+4-tail asks -the user for permission to delete the previous instance of -S-transcript.st. You must say yes to continue. Should you say no, -you will be given the opportunity to rename the file and then continue -by re-issuing the command `M-x S+4-tail'. - - -The internal functions are: - -3. `ess-mark-pop-up' is based on `dired-mark-pop-up'. It is used to -query you about deleting the file. - -4.`S+4-command-startup' is almost identical to `S+4'. The only real -difference is that it starts S-Plus with the "&" and `S+4' does not -use the "&". - - -;;; The advantages: -;;; * S text output is in an emacs buffer and therefore searchable -;;; using emacs commands. -;;; * All GUI graphics and buttons are accessible. -;;; -;;; The characteristics of this version of the ESS interface: -;;; * We can't type in the *S+4* buffer. -;;; * Prompts do NOT appear in the *S+4* buffer. -;;; * All error messages appear only in the S-Plus Commands window, -;;; NOT in the *S+4* buffer. -;;; * We can type in the S-Plus Commands window, but no results -;;; appear there, all results appear in the *S+4* buffer. -;;; * Echoed input is reformatted by S-Plus. diff -Nru ess-16.10/doc/README.SPLUS4WIN ess-17.11/doc/README.SPLUS4WIN --- ess-16.10/doc/README.SPLUS4WIN 2014-10-28 18:15:42.000000000 +0000 +++ ess-17.11/doc/README.SPLUS4WIN 1970-01-01 00:00:00.000000000 +0000 @@ -1,328 +0,0 @@ --*- text -*- - -ESS: Using S-Plus 4.x for Windows -================================= - -(also see detailed help at the end, for more information) - -Beginning with ESS 5.1.2 we are able to use inferior iESS mode to -communicate directly with a running S-Plus 4.x process using the -Microsoft DDE protocol. We use the familiar (from Unix ESS) C-c C-n -and related key sequences to send lines from the S-mode file to the -inferior S process. We continue to edit S input files in ESS[S] mode -and transcripts of previous S sessions in ESS Transcript mode. All -three modes know the S language, syntax, and indentation patterns and -provide the syntactic highlighting that eases the programming tasks. - -ESS (originally S-mode) was initially designed for use with S and -S-PLUS(tm) on the Unix computers with interprocess communication using -the Unix standard input and standard output protocols. S-Plus 4.x was -designed for the Microsoft Windows 95/98/NT and uses DDE as the -interprocess communications protocol. The protocols are very -different. - -See the document README.S for detailed information on: -- general Emacs features. -- Editing files. -- using transcripts. -- Philosophies -- Scenarios for use (possibilities, based on actual usage) - -The following are not identical in MS Windows to the similarly named -sections in README.S and are covered in this document: -- running an S process as an inferior process to Emacs -- ESS-help: assistance with viewing help - - -INSTALLATION -============ - -The easiest way to install ESS on Windows machines is to place the -unzipped directory tree on the machine in, for specificity, - c:/emacs/ess-5.1.21/ -Then add the following line to your ~/_emacs (or ~/.emacs) file: - (load-file "c:/emacs/ess-5.1.21/lisp/ess-site.el") - -For improved startup efficiency (but not execution efficiency) you can -follow the more elaborate installation procedures described in -README.S. These procedures depend on your already having installed -/bin/sh and make, programs that come with the Unix-like utilities from -Cygwin: - http://sourceware.cygnus.com/cygwin/ - - -iESS: Inferior ESS processes -============================ - -iESS (inferior ESS) is the mode for interfacing with active -statistical processes (programs). This mode behaves very differently -with S-Plus 4.x for Windows than it does for the Unix versions of -S-Plus. - -S-Plus 4.x for Windows is full-featured Windows program. It has GUI -subwindows, icons, menus, buttons, and Windows-style interprocess -communication. By contrast Unix versions of S-Plus have only the -equivalent of the Commands window (running in an ordinary xterm (or -other shell window)) and the Graphics windows. - -iESS for S-Plus 4.x is completely compatible with all the Windows -features. At this time it has been used extensively with NTemacs 20.3.l - http://www.cs.washington.edu/homes/voelker/ntemacs.html - http://www.cs.washington.edu/homes/voelker/ntemacs/ftp/ -iESS uses the ddeclient program included as part of the NTemacs distribution. -We recommend that the user install bash as the shell under emacs. - http://sourceware.cygnus.com/cygwin/ -Our programs do work should the user choose to use one of the Windows -shells (command.com on 95/98, or cmd.exe on NT). - -The starting key sequence depends on the shell the user prefers: - - bash users: The S-Plus user starts S-Plus from within emacs with - "M-x S" (or with "M-x S+4"). - - msdos users: The S-Plus user starts S-Plus from within emacs with - "M-x S+4-msdos". msdos users MUST remember to close S-Plus cleanly - and then close the *S+4 ddeclient* buffer with `exit', or take the - risk of not being able to shut down the computer cleanly. - -Either of these emacs command sequences starts the usual S-Plus 4.x -window. There may be a slight delay before the emacs window can be -used. The S-Plus window must have a visible Commands window placed on -the left side of the S-Plus window. We recommend placing the S-Plus -window on the left side of the screen and the emacs window on the -right side of the screen. This placement permits activity in the -S-Plus commands window to be monitored while lines are sent over from -the active emacs window. - -The user then sends individual lines or groups of lines to the S-Plus -process using the emacs command C-c C-n (for lines), C-c C-r (for -regions), C-c C-b (for the entire buffer). The lines magically appear -in the S-Plus Commands window, as if they had been typed manually or -been sent by mouse copy and paste commands. The results of the -commands appear in the S-Plus Commands window. No results come back -to the emacs process (this is the major difference between the Unix -and Windows actions of ESS). - -An entire file can be sent over with C-c C-l. In this case, only the -command `source("filename")' appears in the S-Plus Commands window. -No input statements or output from the commands appear. All global -assignments have been made. - -In order to create an S transcript it is necessary to - -(1) highlight a region in the S-Plus Commands window (the easiest way - is to use the Ctrl+A keystroke or the "Edit/Select All" menu - command) and then copy Ctrl+C it. Ctrl+C is a standard Windows - keystroke. - -(2) open an ESS Transcript file, for example myfile.st, in emacs. The - suffix ".st" stands for S Transcript. When a myfile.st file is - created or read it always comes in as a read-only file. This is a - protection to keep the user from accidentally changing an - historical file. Make it writable with C-x C-q and the paste the - copied region using C-y (the standard emacs yank command (which - corresponds to the Windows paste)). - -Caution: switching from the emacs window to the S-Plus window causes -finger confusion as the keystroke commands are not the same. - -Once the transcript has been created in an emacs buffer it has most of -the standard iESS (inferior ESS) mode features, including sending -lines back to the active statistical process (program). This features -include: - -- proper indenting, generated by both [Tab] and [Return]. -- color and font highlighting based on syntax. -- ability to resubmit the contents of a multi-line command - to the executing process with a single keystroke [RET]. -- transcript recording and editing - - -Optional Ways to Start S-Plus 4.x with emacs -============================================ - -1. If you already have an S-Plus 4.x window and wish to add emacs - access to that window, then you can start an emacs iESS buffer with - "M-x S+4-existing" (bash users) or "M-x S+4-msdos-existing" (msdos users). - -2. If you really like the S-Plus to run inside an emacs *S+4* buffer, - just the way it does in Unix, then you can start an emacs iESS - buffer with "M-x Sqpe+4". There is no interactive graphics - available in this arrangement. Postscript graphics to a file are - available. None of the GUI menus and buttons are available. - - -ESS-help: assistance with viewing help -====================================== - -The key sequence C-c C-v entered from any ESS buffer sends a help -request to the running S-Plus. Help files in S-Plus 4.x for StatSci -distributed functions use the Windows Help mechanism. They do not -appear in emacs buffers. - - -Recommended Settings on first use of a new _Data directory -========================================================== - -The first time you use S-Plus in a new directory you must do some setup. - -- Click Window/Commands Window - -- Click Options/General Settings/Startup. - Click Select Data Dialog off. - Click Command Line on. - Click Object Browser on. - -Assuming you have downloaded and are using the gnuserv/gnuclient -programs: - http://www.cs.washington.edu/homes/voelker/ntemacs/contrib/gnuserv.zip -- Click Options/General.Settings/Computations. - Change Editor to gnuclient. - Change Pager to gnuclientw. -Note these are different. The behavioral difference is that gnuclient -will freeze S-Plus until "C-x #" is typed to the emacs buffer. -This is the correct behavior when you are using the S function edit(). -With emacs as your editor, you are less likely to need the edit() function. - -- Click Options/Command Line Options/Options/Key Scroll/Page Keys. - -- Click Options/Graph Options/Options/Auto Pages/Every Graph. - -- Click Options/"Save Window Size/Properties as Default" - - -History of M-x S+4 and related functions -======================================== - -In May 1998, Brian Ripley wrote an early version of an interface -between ESS and S-Plus using the DDE concept. The original version -demonstrated feasability of the concept. It was limited to a single -line (that is, C-c C-n worked correctly when the S statement was -complete on a single line). The region and buffer commands C-c C-r -and C-c C-b did not work. - -In December 1998, Richard Heiberger completely rewrote the DDE -interaction to use the ddeclient program that was first distributed -with NTemacs 20.3.1. He further developed the remaining functions -to the point where all ESS functions now work with S-Plus 4.x on the -Windows operating systems. - - -Detailed Help For S-PLUS 2000 and the License Manager -(Thanks to David Brahm, ) -===================================================== - -Found the solution to getting Sqpe-mode to work with the license manager - I -set S_ELMHOST in Emacs with (setenv "S_ELMHOST" "123.45.67.890"), instead of -trying to make it a command-line argument. Thus I was also able to reduce -the number of modifications to "ess-sp4-d.el". I still change the delay time -by hand (from 30 seconds to 10); I wish this were a variable so I could just -put (setq-default inferior-ess-delay 10) in my .emacs. - -I've attached my new installation instructions, with these modifications. - --- David Brahm - -How to Install S-Plus, Emacs, ESS, and Cygwin on NT. (David Brahm 11/9/99) - -1) S-Plus: ->From MathSoft (800)569-0123 -Desktop icon "C:\Program Files\sp2000\cmd\splus.exe" u:/splus/init.s - s_proj=p:/home/s s_elmhost=123.45.67.890 - Start in P:\Home\S -U:/Splus/init.s contains: - library("Lib", first=T, lib.loc="u:\\Splus") -U:/Splus/Lib contains directories: _Data, _Prefs, Flat, and Source -Resize S-Plus window to match Emacs window. -In Options > General > Startup, check "Command Line" - Options > "Save Window Size/Properties as Default" - -2) Emacs: - get "em2041.zip" - for FAQ -Extract (with WinZip) to C:\, thus creating C:/emacs-20.4 -Double-click on C:/emacs-20.4/bin/addpm.exe, copy icon to desktop. -In "Emacs" icon shortcut, change to Start in P:/Home -Create file C:/emacs-20.4/site-lisp/site-start.el (see below). -User can put additional customization in P:/Home/.emacs - -3) ESS: - get "ess-5.1.21.zip" -Extract to C:\emacs-20.4, thus creating C:/emacs-20.4/ess-5.1.21 -In C:/emacs-20.4/ess-5.1.21/lisp/ess-sp4-d.el: - Change (sleep-for 30) to (sleep-for 10) (twice) - -4) Cygwin: - get "full.exe" (or "usertools.exe") -Double-click on full.exe and accept all defaults, installing to C:/Cygnus -Make directories C:/bin and C:/tmp -Copy C:/Cygnus/Cygwin-B20/H-i586-cygwin32/bin/sh.exe to C:/bin -Right-click My Computer > Properties > Environment, and append this to Path: - ";c:\bin;c:\Cygnus\Cygwin-B20\H-i586-cygwin32\bin" - *or* put this line into C:/autoexec.bat: - set PATH=c:\bin;c:\Cygnus\Cygwin-B20\H-i586-cygwin32\bin -W95/98 only: If an error "Out of environment space" occurs, add to -config.sys: - shell=C:\command.com /e:4096 /p - - -Here is my site-start.el file: -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;;; -(setenv "HOME" "P:/Home") -(setenv "PATH" - "C:/Cygnus/Cygwin-b20/H-i586-cygwin32/bin;C:/Progra~1/sp2000/cmd") - -; ESS and customization: -(load "C:/Emacs-20.4/ess-5.1.21/lisp/ess-site") -(setenv "SHELL" "C:/Cygnus/Cygwin-b20/H-i586-cygwin32/bin/bash") -(setenv "S_ELMHOST" "123.45.67.890") -(setenv "S_FIRST" "source(\"U:/Splus/init.s\")") ; Initialization file -(setenv "SHOME" "C:/Progra~1/sp2000") -(setq-default inferior-Sqpe+4-program-name "c:/Progra~1/sp2000/cmd/Sqpe") -(setq ess-ask-for-ess-directory nil) -(setq ess-directory "P:/Home/S/") -(setq ess-execute-in-process-buffer t) -(make-local-variable 'comment-indent-function) -(setq-default comment-indent-function 'ess-comment-indent) -(fset 'run-s "\C-x2\M-xS\C-m") -(global-set-key "\M-s" 'run-s) ; ESC-s runs "run-s" which starts S - -; Window size: -(set-frame-size (selected-frame) 80 56) - -; Always auto-fill: -(setq-default auto-fill-function 'do-auto-fill) -(setq-default fill-column 79) - -; Macros and set-keys: -(global-set-key "\C-u" 'query-replace-regexp) -(load "hscroll") -(defun flat (tabw) "Turns off line-wrap; prefix sets tab width." - (interactive "p") - (turn-on-hscroll) ; (setq truncate-lines 1) - (if (> tabw 1) (setq tab-width tabw)) - (redraw-display)) -(global-set-key "\C-c\C-f" 'flat) - -; Fonts (uncomment the next line for a bolder font): -; (set-default-font "-adobe-courier-bold-r-normal--*-140-*-*-m-*-iso8859-1") -(global-font-lock-mode t) -(custom-set-variables) -(custom-set-faces - '(font-lock-comment-face - ((((class color) (background light)) (:foreground "Firebrick")))) - '(font-lock-string-face - ((((class color) (background light)) (:foreground "SeaGreen")))) - '(font-lock-keyword-face - ((((class color) (background light)) (:foreground "MediumBlue")))) - '(font-lock-constant-face - ((((class color) (background light)) (:foreground "VioletRed")))) - '(font-lock-type-face - ((((class color) (background light)) (:foreground "Goldenrod")))) - '(font-lock-variable-name-face - ((((class color) (background light)) (:foreground "Blue")))) - '(font-lock-function-name-face - ((((class color) (background light)) (:foreground "VioletRed")))) -) - diff -Nru ess-16.10/doc/README.Windows ess-17.11/doc/README.Windows --- ess-16.10/doc/README.Windows 2014-10-28 18:15:42.000000000 +0000 +++ ess-17.11/doc/README.Windows 1970-01-01 00:00:00.000000000 +0000 @@ -1,205 +0,0 @@ ----------------------------------------------------- -Short guide to install ESS under Windows (28-4-2001) -by Emmanuel Paradis ----------------------------------------------------- - -The following notes are for a Windows system (mainly NT, but this applies -to 95/98 too) which has none of Emacs, gnuserv, or ESS installed. Sections -1 and 2 are about getting and installing Emacs, sections 3-6 are about -getting and installing ESS, section 7 is about getting and installing -gnuserv, and section 8 gives a few hints on how to start with ESS. - -It is assumed that all packages are or will be installed in D:\ (if you -choose another location, change accordingly). It is preferable to install -these packages (including R) in locations independent of each others, so -that they can be updated easily. - -1. Download a precompiled copy of Emacs v. 20.7 for Windows on Intel machines: - - ftp://ftp.gnu.org/gnu/windows/emacs/20.7/emacs-20.7-fullbin-i386.tar.gz - -This is a 13 Mb file that includes precompiled binaries of Emacs, and lisp -sources (useful for understanding how packages work, and how they can best -be setup or customized). - -2. Unpack the downloaded file in a directory, e.g., "D:\", then execute the -file "D:\emacs-20.7\bin\addpm.exe". Emacs is then installed on your Windows -machine, and a shortcut should have been added to your Start menu. -Installing Emacs may not be so straightforward depending on the setup of -your system. For instance, it may be better to turn virus checkers off -(Norton Anti-Virus 2001 breaks this, for example; McAfee virus scanner -seems to interact badly with Emacs too). There is a very detailed FAQ for -Emacs on Windows at: - - http://www.gnu.org/software/emacs/windows/ntemacs.html - -Section 3 of this FAQ details the installation process of Emacs under -Windows. There are also lots of useful informations on how to customize Emacs. - -It is also recommended to change the default starting directory for Emacs -to your own personal directory to help protect you from accidentally -changing files in the Emacs directory. Do so by right-clicking on the Emacs -short-cut, go to the "Shortcut" tab, and then change the value in "Start in:". - -3. Download ESS v. 5.1.18 at: - - http://ess.stat.wisc.edu/pub/ESS/ESS-5.1.18.tar.gz - -It is a 558 Kb file. - -4. Unpack the downloaded file in its own directory, e.g. "D:\" (of course, -keeping the tree structure of the zip archive). Avoid unpacking this -archive in the Emacs (sub)-directory(ies) so that you can upgrade Emacs and -ESS independently in the future. - -Also, a useful thing is to rename the current R directory so that it does -not have the version number in it, for instance "r". This will avoid the -need to change the settings explained below when you install future -versions of R (you can of course keep previous versions of R in directories -named "r.old", or "rw1021", "rw1020", ... if you have more than two -versions). In the followings, it will be assumed this has been done. - -5. Edit the file "D:\ess-5.1.18\lisp\ess-site.el". In this file, the -semicolons indicate comments. Find the line #250 (easy with Emacs...) which -is like this: - -;;(setq-default inferior-R-program-name "Rterm") ; msdos systems - -This line tells ESS where to find the R executable. Thus, uncomment the -line, and write with "Rterm" the path to Rterm.exe, for instance, -if you installed R v. 1.2.2 for Windows in D:\, and renamed the directory -"rw1022" to "r" as above, the line becomes: - -(setq-default inferior-R-program-name "D:/r/bin/Rterm") ; msdos systems - -You must use forwardslashes /.Of course, you may delete "; msdos systems". -If you installed R -in C:\Program Files (and did not rename its directory), then the line must be: - -(setq-default inferior-R-program-name "C:/Progra~1/rw1022/bin/Rterm") - -taking care to use the DOS name of the directory. - -==> If Rterm.exe is already in the PATH of your system, you do not need to -modify this line in ess-site.el, just uncomment it. - -Under Windows 9x, it seems that Rterm.exe needs to be in the PATH, thus add -"D:\r\bin;" to your PATH. Another possibility is to specify the exec-path -in your .emacs file by adding this line: - - (custom-set-variables '(exec-path (quote ("D:/r/bin" "c:/other/paths")))) - -==> You may use "Rgui" instead of "Rterm", but R's outputs will be -displayed in the Rgui console rather than within Emacs (as is the case with -Rterm). - -6. Edit or create a file called ".emacs" (or "_emacs"). You can read some -infos on "What is a .emacs file?" at: - - http://www.gnu.org/software/emacs/windows/faq3.html#what-startup - -When Emacs is started, it looks for the .emacs file in your HOME directory. -HOME is an environment variable which can be set in several ways. Under -Windows NT, open the Control Panel, go to the System panel, and click the -"Environment" tab, then add (or modify) the appropriate environment -variable. (This procedure gives the possibility to set HOME on a per-user -basis.) Under Windows 95, you can set the HOME environment variable in your -autoexec.bat file (you will need to reboot then). If no HOME has been set, -Emacs will look for .emacs in C:\. - -Once HOME has been set, add in .emacs the following line: - - (load-file "d:/ess-5.1.18/lisp/ess-site.el") - -==> A few precisions on how to create the file .emacs under Windows. -Explorer does not accept to (re-)name a file without prefix (but _emacs is -possible); you can do it with Notepad, but this editor normally adds the -.txt suffix when you name a file. To avoid this, type the name in the 'Save -as...' sub-menu within quotes "", e.g. ".emacs" instead of .emacs (the -latter will result in .emacs.txt). Yet another possibility is to create the -file with any name (say, titi.txt), then go to a DOS command prompt, and type: - - rename titi.txt .emacs - -7. ESS is now configured to run with R and Emacs, but it is very useful to -install gnuserv, a small program that allows file associations with Emacs -(thus loading files into an already running Emacs, or if none, one is -launched). More information are at: - - http://www.gnu.org/software/emacs/windows/faq3.html#assoc - -where there is also a link to download gnuserv at: - - http://www.gnu.org/software/emacs/windows/ntemacs/contrib/gnuserv-2.1p1.zip - -Unpack the dowloaded file, e.g. in D:\, and add in .emacs the following -three lines: - - (load-file "d:/gnuserv/gnuserv.el") - (require 'gnuserv) - (gnuserv-start) - -You also need to have the gnuserv executables and runemacs.exe in your path -(under Windows NT, this is done by editing the PATH environment variable in -the System panel of the Control Panel; under Windows 9x by modifying the -PATH in the autoexec.bat file), in our example, one needs to add -"D:\emacs-20.7\bin;D:\gnuserv;" to the PATH. - -Now, open Explorer, select "options" in the menu "view", select the "file -types" tab, click on "New type...", fill the fields (specifying, of course, -the .R extension), and under "actions", click "New...", a new window is -then open. Under "action" type "open", and in the second field type - - D:\gnuserv\gnuclientw.exe "%1" - -where the "%1" allows filenames with blanks in them to be treated as one -argument when sent to Emacs. Close all windows by clicking "Ok". - -==> While you create the R file type, you can specify other "actions", such -as "edit" and associate Notepad (or any other editor) with it. This will -allow you to edit your R files either with Emacs/ESS (press Enter when the -file is selected, or double-click on it), or Notepad (right-click on the -file and select "edit"). You can also allow quick view of the R files by -ticking the appropriate box under the list of "actions". - -==> If you do not want to install gnuserv, you can edit several R files in -the same running Emacs by opening them from Emacs (Ctrl-x Ctrl-f, which is -noted C-x C-f in Emacs's terminology). In this case, you may (or not) -create an R file type as described above, and associate the "open" action -with "runemacs.exe". - -8. When you open a *.R file, this opens Emacs and ESS. To run R under -Emacs, type Alt-x R (M-x R), and then Enter. Within Emacs, you switch -between the different files, buffers, processes, ... with the "Buffers" -menu or by typing Ctrl and the right button of the mouse. When you edit an -R file you can evaluate the R expressions with the "ESS" menu by selecting -"eval buffer" (or by typing C-c C-b). Browse this "ESS" menu to see the -possibilities: you can evaluate just a line, or a region you have selected -with the mouse, etc. - -Emacs can be customized in several ways that help to edit R files. You can -have a look at the Emacs-FAQ within Emacs by the menu Help|Manuals|Emacs -FAQ (or C-h F). Here are a few customizations I found useful. These lines -must be added in the .emacs file. - -(setq gnuserv-frame (selected-frame)) ;; open the file in the - ;; current Emacs frame -(show-paren-mode 1) ;; parentheses highlighting -(global-font-lock-mode 1) ;; syntax highlighting -(setq font-lock-maximum-decoration t) ;; have it maximum!! -(setq frame-title-format "%b") ;; put the name of the current - ;; buffer as the frame name - -The first line forces Emacs to open a new file in the current frame (rather -than opening a new frame outside the current one). The parentheses -highlighting is extremely useful when writting a program (even a simple -one): when the cursor is on a parenthesis, this highlights in grey both -this one and its match. If the match is not found, then the highlight is -blue. When first used, this customization may seem a bit irritating, but -its usefulness may become quickly apparent. - -Finally, you can have a look at a list of the many functionalities of ESS -in the menu ESS|Describe (or C-h m). - - -EP diff -Nru ess-16.10/doc/README.XLispStat ess-17.11/doc/README.XLispStat --- ess-16.10/doc/README.XLispStat 2014-10-28 18:15:42.000000000 +0000 +++ ess-17.11/doc/README.XLispStat 1970-01-01 00:00:00.000000000 +0000 @@ -1,132 +0,0 @@ --*- indented-text -*- - -$Revision: 5.1 $ - - -ESS: Using the XLispStat family of statistical languages -======================================================== - -This module is currently undergoing development. It is not as stable -as the S language support. However, it should be functional, if -slightly buggy. Please send any suggestions and bug reports to -ess-bugs@stat.math.ethz.ch. - -ESS (originally S-mode) was initially designed for use with S and -S-PLUS(tm). However, it has been recently extended to support other -languages, including XLispStat. If you are looking for a stable, old -XLispStat mode, we suggest ILISP and the recent modifications. -However, those features and new advanced features are being merged -with the development of ESS[XLS], which is similar in behavior to the -interface for S (unlike ILISP). We denote by _XLS_ the LispStat -languages XLispStat and ViSta (though the ViSta program is called by -ViSta). We denote by _Emacs_, one of the GNU family of editors, -either Emacs (as developed and maintained by the Free Software -Foundation) or XEmacs (which a derivative work). - -The following is covered in this document: -- Editing files. -- running an XLS process as an inferior process to Emacs (we - include -- using transcripts. -- Scenarios for use (possibilities, based on actual usage) -- Philosophies - -We assume that you are familiar with Emacs terminology and syntax: -file, buffer, region, description of keys etc. If not, please read -the New Users guide (found in the info pages, "C-h i" (by pressing -control h, i) or Tutorial, "C-h t"). - - -ESS[XLS]: Editing Files -===================== - -ESS[XLS] is the mode for editing XLS language files. This mode handles: - -- proper indenting, generated by both [Tab] and [Return]. -- color and font choices based on syntax. -- ability to send the contents of a single buffer, regions, lines, and - functions to an inferior process, if one is currently running. -- ability to switch between processes which would be the target of the - buffer (for the above). -- The ability to request help from a process for variables and - functions, and to have the results sent into a separate buffer. - -It should be automatically turned on when loading a file with the -suffix *.lsp or as set in ess-site.el. However, one will have to -start up an inferior process to take advantage of the interactive -features. - - -iESS: Inferior ESS processes. -============================= - -iESS (inferior ESS) is the mode for interfacing with active -statistical processes (programs). This mode handles: - -- proper indenting, generated by both [Tab] and [Return]. -- color and font highlighting based on syntax. -- ability to send the contents of a single buffer, regions, lines, and - functions to an inferior process, if one is currently running. -- The ability to request help from a process for variables and - functions, and to have the results sent into a separate buffer. -- interactive history mechanism -- transcript recording and editing - -To start up this mode, use: - M-x XLS - - -ESS-help: assistance with viewing help -====================================== - -- obtain help files in a separate buffer for later viewing. -- send examples to XLS for evaluation. - - -Scenarios for use -================= - -We present some basic suggestions for using ESS to interact with XLS. -These are just a subset of approaches, many better approaches are -possible. Contributions of examples of how you work with ESS are -appreciated (especially since it helps us determine priorities on -future enhancements)! (comments as to what should be happening are -prefixed by "##"). - -1: ## Start up XLispStat, in a process buffer (this will be *XLS:1*) - M-x XLS - ## Load a buffer to work from - C-x C-f todays_work.lsp - ## enter program, functions, and code into work buffer, and send - ## entire contents to XLispStat when ready - C-c C-b - ## Go to *XLS:1* buffer, which is the process buffer, and examine - ## the results. - C-c C-y - ## the above is a shortcut for: C-x b *XLS:1* - ## Return to the work buffer (may/may not be prefixed) - C-x C-b 971103work.S - ## Fix the function that didn't work, and resubmit by placing the - ## cursor somewhere in the function and - C-c C-f - ## Or you could've selected a region (using the mouse, or keyboard - ## via setting point/mark) and - C-c C-r - ## Or you could step through, line by line, using - C-c C-n - ## Or just send a single line (without moving to the next) using - C-c [RETURN] - ## where [RETURN] is the return key. - ## To fix that error in syntax for the "normal-rand" command, get - ## help by - C-c C-v normal-rand - -2: ## Load the file you want to work with - C-x C-f file.lsp - ## Edit as appropriate, and then start up XLispStat - M-x XLS - ## Go back to the file editing buffer - C-x b file.lsp - ## send regions, lines, or the entire file contents to XLispStat - ## (the last one is demonstrated below) - C-c C-b diff -Nru ess-16.10/doc/refcard/refcard.aux ess-17.11/doc/refcard/refcard.aux --- ess-16.10/doc/refcard/refcard.aux 1970-01-01 00:00:00.000000000 +0000 +++ ess-17.11/doc/refcard/refcard.aux 2017-11-13 14:13:28.000000000 +0000 @@ -0,0 +1 @@ +\relax diff -Nru ess-16.10/doc/refcard/refcard.log ess-17.11/doc/refcard/refcard.log --- ess-16.10/doc/refcard/refcard.log 1970-01-01 00:00:00.000000000 +0000 +++ ess-17.11/doc/refcard/refcard.log 2017-11-13 14:13:28.000000000 +0000 @@ -0,0 +1,218 @@ +This is pdfTeX, Version 3.14159265-2.6-1.40.17 (TeX Live 2016) (preloaded format=pdflatex 2016.8.4) 13 NOV 2017 15:13 +entering extended mode + restricted \write18 enabled. + %&-line parsing enabled. +**refcard +(./refcard.tex +LaTeX2e <2016/03/31> +Babel <3.9r> and hyphenation patterns for 83 language(s) loaded. +(/hg/s/linux/9/app/teTeX/08.16/texmf-dist/tex/latex/base/article.cls +Document Class: article 2014/09/29 v1.4h Standard LaTeX document class +(/hg/s/linux/9/app/teTeX/08.16/texmf-dist/tex/latex/base/size10.clo +File: size10.clo 2014/09/29 v1.4h Standard LaTeX file (size option) +) +\c@part=\count79 +\c@section=\count80 +\c@subsection=\count81 +\c@subsubsection=\count82 +\c@paragraph=\count83 +\c@subparagraph=\count84 +\c@figure=\count85 +\c@table=\count86 +\abovecaptionskip=\skip41 +\belowcaptionskip=\skip42 +\bibindent=\dimen102 +) +(/hg/s/linux/9/app/teTeX/08.16/texmf-dist/tex/latex/tools/multicol.sty +Package: multicol 2016/04/07 v1.8p multicolumn formatting (FMi) +\c@tracingmulticols=\count87 +\mult@box=\box26 +\multicol@leftmargin=\dimen103 +\c@unbalance=\count88 +\c@collectmore=\count89 +\doublecol@number=\count90 +\multicoltolerance=\count91 +\multicolpretolerance=\count92 +\full@width=\dimen104 +\page@free=\dimen105 +\premulticols=\dimen106 +\postmulticols=\dimen107 +\multicolsep=\skip43 +\multicolbaselineskip=\skip44 +\partial@page=\box27 +\last@line=\box28 +\maxbalancingoverflow=\dimen108 +\mult@rightbox=\box29 +\mult@grightbox=\box30 +\mult@gfirstbox=\box31 +\mult@firstbox=\box32 +\@tempa=\box33 +\@tempa=\box34 +\@tempa=\box35 +\@tempa=\box36 +\@tempa=\box37 +\@tempa=\box38 +\@tempa=\box39 +\@tempa=\box40 +\@tempa=\box41 +\@tempa=\box42 +\@tempa=\box43 +\@tempa=\box44 +\@tempa=\box45 +\@tempa=\box46 +\@tempa=\box47 +\@tempa=\box48 +\@tempa=\box49 +\c@columnbadness=\count93 +\c@finalcolumnbadness=\count94 +\last@try=\dimen109 +\multicolovershoot=\dimen110 +\multicolundershoot=\dimen111 +\mult@nat@firstbox=\box50 +\colbreak@box=\box51 +\mc@col@check@num=\count95 +) +(/u/sfs/tex/tex/latex/parskip.sty) +(/hg/s/linux/9/app/teTeX/08.16/texmf-dist/tex/latex/tools/verbatim.sty +Package: verbatim 2014/10/28 v1.5q LaTeX2e package for verbatim enhancements +\every@verbatim=\toks14 +\verbatim@line=\toks15 +\verbatim@in@stream=\read1 +) +(/hg/s/linux/9/app/teTeX/08.16/texmf-dist/tex/latex/preprint/fullpage.sty +Package: fullpage 1999/02/23 1.1 (PWD) +\FP@margin=\skip45 +) +No file refcard.aux. +\openout1 = `refcard.aux'. + +LaTeX Font Info: Checking defaults for OML/cmm/m/it on input line 26. +LaTeX Font Info: ... okay on input line 26. +LaTeX Font Info: Checking defaults for T1/cmr/m/n on input line 26. +LaTeX Font Info: ... okay on input line 26. +LaTeX Font Info: Checking defaults for OT1/cmr/m/n on input line 26. +LaTeX Font Info: ... okay on input line 26. +LaTeX Font Info: Checking defaults for OMS/cmsy/m/n on input line 26. +LaTeX Font Info: ... okay on input line 26. +LaTeX Font Info: Checking defaults for OMX/cmex/m/n on input line 26. +LaTeX Font Info: ... okay on input line 26. +LaTeX Font Info: Checking defaults for U/cmr/m/n on input line 26. +LaTeX Font Info: ... okay on input line 26. +LaTeX Font Info: External font `cmex10' loaded for size +(Font) <7> on input line 59. +LaTeX Font Info: External font `cmex10' loaded for size +(Font) <5> on input line 59. +LaTeX Font Info: Font shape `OT1/cmtt/bx/n' in size <10> not available +(Font) Font shape `OT1/cmtt/m/n' tried instead on input line 75. + +Overfull \hbox (9.23132pt too wide) in paragraph at lines 75--88 +[] + [] + + +Overfull \hbox (11.87013pt too wide) in paragraph at lines 97--111 +[] + [] + + +Underfull \hbox (badness 10000) in paragraph at lines 97--111 + + [] + + +Underfull \hbox (badness 10000) in paragraph at lines 118--124 + + [] + +LaTeX Font Info: Try loading font information for OMS+cmtt on input line 146 +. +(/u/sfs/tex/tex/latex/R_latex/omscmtt.fd +File: omscmtt.fd +) +LaTeX Font Info: Font shape `OMS/cmtt/m/n' in size <10> not available +(Font) Font shape `OMS/cmsy/m/n' tried instead on input line 146. + +Overfull \hbox (6.9257pt too wide) in paragraph at lines 142--154 +[][] + [] + + +Overfull \hbox (14.05339pt too wide) in paragraph at lines 155--170 +[]$[]$ + [] + + +Overfull \hbox (49.64578pt too wide) in paragraph at lines 155--170 +[] + [] + + +Underfull \hbox (badness 10000) in paragraph at lines 171--179 + + [] + + +Overfull \hbox (51.25189pt too wide) in paragraph at lines 192--201 +[][] + [] + + +Overfull \hbox (28.4812pt too wide) in paragraph at lines 204--213 +[][] + [] + +[1 + +{/hg/s/linux/9/app/teTeX/08.16/texmf-var/fonts/map/pdftex/updmap/pdftex.map}] +Overfull \hbox (5.63393pt too wide) in paragraph at lines 229--248 +[][] + [] + + +Underfull \hbox (badness 10000) in paragraph at lines 229--248 + + [] + + +Overfull \hbox (14.11595pt too wide) in paragraph at lines 253--267 +[][] + [] + + +Underfull \hbox (badness 6961) in paragraph at lines 293--295 +[]\OT1/cmr/m/n/10 Evaluate your code into the pack-age (in + [] + +[2] (./refcard.aux) ) +Here is how much of TeX's memory you used: + 427 strings out of 493014 + 5664 string characters out of 6130583 + 97445 words of memory out of 5000000 + 4029 multiletter control sequences out of 15000+600000 + 6660 words of font info for 25 fonts, out of 8000000 for 9000 + 1141 hyphenation exceptions out of 8191 + 23i,12n,17p,144b,288s stack positions out of 5000i,500n,10000p,200000b,80000s + +Output written on refcard.pdf (2 pages, 164293 bytes). +PDF statistics: + 71 PDF objects out of 1000 (max. 8388607) + 51 compressed objects within 1 object stream + 0 named destinations out of 1000 (max. 500000) + 1 words of extra memory for PDF output out of 10000 (max. 10000000) + Binary files /tmp/tmpCr6fs_/WAh2Sjb543/ess-16.10/doc/refcard/refcard.pdf and /tmp/tmpCr6fs_/oL1nr6q8Sc/ess-17.11/doc/refcard/refcard.pdf differ diff -Nru ess-16.10/doc/requires.texi ess-17.11/doc/requires.texi --- ess-16.10/doc/requires.texi 2016-10-22 16:03:27.000000000 +0000 +++ ess-17.11/doc/requires.texi 2017-11-13 14:13:15.000000000 +0000 @@ -2,17 +2,19 @@ statistical packages: R/S-PLUS, SAS, Stata, OpenBUGS and JAGS. ESS supports current, and recent, stable versions of GNU Emacs -(currently, the 24.x and 25.x series; alpha/beta/pre-release -versions are NOT SUPPORTED). Non-Windows users beware: GNU Emacs 24.3 is -preferable to 24.1 or 24.2: these broken builds suffer from bug 12463 -@uref{http://debbugs.gnu.org/cgi/bugreport.cgi?bug=12463} which -will cause Emacs to get progressively slower over time. +(currently, 24.3 or higher; alpha/beta/pre-release +@c (currently, the 24.x and 25.x series; alpha/beta/pre-release +versions are NOT SUPPORTED). +@c Non-Windows users beware: GNU Emacs 24.3 is +@c preferable to 24.1 or 24.2: these broken builds suffer from bug 12463 +@c @uref{http://debbugs.gnu.org/cgi/bugreport.cgi?bug=12463} which +@c will cause Emacs to get progressively slower over time. @c XEmacs currently does not allow all ESS @c features. Basic ESS functionality however is supported for the time being @c (XEmacs stable 21.4.14 or higher). Due to XEmacs lacking some features that ESS requires, ESS -support of XEmacs ended with ESS 12.04-4. +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 @@ -38,7 +40,7 @@ @c @item Solaris/x86 (all but BUGS and S-PLUS) @c @c cannot confirm this right now @item SGI (all) @c @item MS Windows 98/NT/2000/XP (R, S-PLUS, SAS interactive only, and BUGS) -@c @item Apple Mac OS X 10.4-5 (R, JAGS, Stata) +@c @item Apple macOS 10.4-5 (R, JAGS, Stata) @c @end itemize @c with the following versions of emacs diff -Nru ess-16.10/doc/TODO ess-17.11/doc/TODO --- ess-16.10/doc/TODO 2014-10-28 18:15:42.000000000 +0000 +++ ess-17.11/doc/TODO 2017-11-13 14:13:15.000000000 +0000 @@ -890,11 +890,6 @@ (RS) I don't know if this was fixed, but I haven't had any problems with indenting recently. -* (AJR) SAS fontlocking of comments needs to be fixed. - (RS) I believe this is done. We made a few changes, but the biggest - problem was that Emacs 19.34 was misbehaving. - See ess-sas-run-make-regexp above. - * (KH) explicit statement: I have only one remark (one of my usual ones). I'd like to be able to diff -Nru ess-16.10/doc/Why_R_mode_not_S_mode.txt ess-17.11/doc/Why_R_mode_not_S_mode.txt --- ess-16.10/doc/Why_R_mode_not_S_mode.txt 2014-10-28 18:15:42.000000000 +0000 +++ ess-17.11/doc/Why_R_mode_not_S_mode.txt 1970-01-01 00:00:00.000000000 +0000 @@ -1,56 +0,0 @@ - -O.k., here are now some general remarks. Tony asked - - Also, why are you interested in writing an R-mode, rather than - modifying the S-mode? I'm curious as to what features you feel are - needed? or is it simply a matter of avoiding code bloat? - -Let me try to answer that. - -* Apparently, S-mode currently is not maintained. This is a real -problem. I don't know if Richard Stallman (hereafter, RMS) is currently -aware of how well R is progressing. I am sure he would eventually love -to include it into the `GNU' distribution, and I am also sure that he -will like to include support for it in GNU Emacs. This means that code -will have to be cleaned (and copyrights transferred etc). No -maintainer, and code which is not `clean' ... no inclusion. - -* Another crucial problem is terminology. If the documentation keeps -talking about sending to an S process etc, and it is in fact an R -process ... I am not sure how users feel about that. I am also not -sure how much Ross & Robert want R to be treated as markedly different -from S, or what the authors of S-mode think of that. - -* I've encountered a similar situation with MATLAB and Octave. An Emacs -MATLAB mode had been around for quite a while. Eventually, John Eaton -(the author of Octave) modified this to work under Octave, too (which is -harder because there are syntactic differences as well). This did not -work satisfactorily. Two more hacked-up MATLAB mode versions appeared -(one by me). So, John wrote a new Octave mode based on F77 mode. Of -course, this was not the optimal thing either. Eventually I ended up -writing octave-mode (plus I/O stuff etc) from scratch. This code will -now be included in the next version (19.35) of GNU Emacs, and from what -I heard also runs without problems under XEmacs (which I cannot confirm -because I use GNU Emacs). - -In a way, the situation Octave/MATLAB is very similar to R/S. It might -have been possible to have a joint mode, but it turned out to be more -convenient otherwise. - -* Another thing is, what happens if we start putting even more effort -into improving R support in S-mode. Will this eventually be merged into -the `proper' S-mode distribution? - -* Thus, the question is whether it is both possible and feasible to have -a package which FULLY works under R and S AND solves the obvious -documentation problems. - -(And of course, we know that there are major differences in the I/O -system, for example.) - -Please let me know what you both think about this. - --k - -PS. From the length of this message it should already be clear that I -am willing to put some time into this :-) diff -Nru ess-16.10/doc/Why_S-mode_Rocks.DMS ess-17.11/doc/Why_S-mode_Rocks.DMS --- ess-16.10/doc/Why_S-mode_Rocks.DMS 2014-10-28 18:15:42.000000000 +0000 +++ ess-17.11/doc/Why_S-mode_Rocks.DMS 1970-01-01 00:00:00.000000000 +0000 @@ -1,44 +0,0 @@ -From: David M Smith -To: s-news@utstat.toronto.edu -Subject: Emacs S-mode -Date: Mon, 5 Feb 96 10:03:48 GMT - -Without wishing to inflame this somewhat evangelical debate even -further, but since it seems several people are wondering, I thought -I'd point out just what benefits are available in using S-mode under -Emacs compared to the usual Unix "Splus -e" or S-plus for Windows: - - * Much improved command-line and history facility, including - recall of commands containing a particular string, and - saving of history between sessions - - * Completion of S object names with the TAB key (like - tcsh/bash) to reduce typing - - * Automatic recording of session transcripts (input and - output) and facility for re-executing commands from saved - transcripts - - * A specialised mode for editing S functions, including - automatic indentation, coloured syntax highlighting, and - error location. You can easily edit more than one function - at a time (and continue to use the S command line in the - meantime), and do partial or line-by-line evaluation of - functions for testing/debugging - - * Facility for running more than one S session simultaneously - -If it seems like these facilities would make your life that little bit -better, and you have the time to invest in learning Emacs and -installing S-mode, then it may be time well invested. If, when using -S-plus, you never think to yourself "Gee, I wish doing *this* was -easier!" then it's probably not worth it. Nonetheless, more -information about S-mode is available from - - http://www.maths.lancs.ac.uk:2080/~maa036/elisp/S-mode/ - -# Dave - --- -David M. Smith, Department of Mathematics and Statistics, Lancaster University - x3952 http://www.maths.lancs.ac.uk:2080/~maa036/ diff -Nru ess-16.10/ess-autoloads.el ess-17.11/ess-autoloads.el --- ess-16.10/ess-autoloads.el 2016-05-07 16:45:06.000000000 +0000 +++ ess-17.11/ess-autoloads.el 2017-11-13 14:13:15.000000000 +0000 @@ -55,6 +55,7 @@ to R, put them in the variable `inferior-R-args'." t) (autoload 'R-mode "ess-site.el" "Major mode for editing R source." t) +(autoload 'r-mode "ess-site.el" "Major mode for editing R source." t) (add-to-list 'auto-mode-alist '("\\.R$" . R-mode)) (autoload 'S "ess-site" "Call 'S'." t) diff -Nru ess-16.10/etc/ess-julia.jl ess-17.11/etc/ess-julia.jl --- ess-16.10/etc/ess-julia.jl 2016-10-22 16:03:27.000000000 +0000 +++ ess-17.11/etc/ess-julia.jl 2017-11-13 14:13:16.000000000 +0000 @@ -18,39 +18,32 @@ if !isempty(tv) Base.show_delim_array(io, tv, '{', ',', '}', false) end - li = m.func.code - e = Base.uncompressed_ast(li) - argnames = e.args[1] print(io, "(") - print_joined(io, [escape_string(isempty(d[2]) ? d[1] : d[1]*"::"*d[2]) for d in decls], ",", ",") + join(io, [escape_string(isempty(d[2]) ? d[1] : d[1]*"::"*d[2]) for d in decls], ",", ",") print(io, ")") end -VERSION >= v"0.4-" && (Base.function_module(f::Function)=f.env.module) - ## modified versionof show(io::IO, mt::MethodTable) function fun_args(f::Function) - mt = f.env + mt = Base.MethodList(methods(f).mt) mod = Base.function_module(f) if mod == Main mod = "nil" end print("(list \"$mod\" nil '(") - d = mt.defs - while d != nothing && d != () + for d in mt print("\"") ## method fun_args(d) print("\" ") - d = d.next end print("))") end -function fun_args(s::ASCIIString) +function fun_args(s::AbstractString) try m = eval(current_module(), parse(s)) - if typeof(m) != ASCIIString + if ! isa(m, String) fun_args(m) end catch diff -Nru ess-16.10/etc/ESSR/LOADREMOTE ess-17.11/etc/ESSR/LOADREMOTE --- ess-16.10/etc/ESSR/LOADREMOTE 2014-10-28 18:15:42.000000000 +0000 +++ ess-17.11/etc/ESSR/LOADREMOTE 2017-11-13 14:13:15.000000000 +0000 @@ -10,7 +10,7 @@ ver <- if(file.exists(verfile)) scan(verfile, what = "string") else "0.0" tryCatch({ if(ver < curver) { - url <- paste('http://vitalie.spinu.info/ESSR/ESSR_', curver, '.rda', sep = '') + 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) diff -Nru ess-16.10/etc/ESSR/R/.basic.R ess-17.11/etc/ESSR/R/.basic.R --- ess-16.10/etc/ESSR/R/.basic.R 2016-10-22 16:03:27.000000000 +0000 +++ ess-17.11/etc/ESSR/R/.basic.R 2017-11-13 14:13:15.000000000 +0000 @@ -28,10 +28,11 @@ help.type <- "text" } - ## - Searching in global env makes sure it works with devtools + ## - get("help", ..) searching in global env works with devtools redefines ## - Redefining to .ess.help this way is necessary because - ## `print.help_files_with_topic` (used internally when there's + ## 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(...)) } @@ -95,29 +96,24 @@ message.prefix = "") { if (is.null(local)) { - local <- if (.ess.Rversion > '2.13') parent.frame() else FALSE - } + 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) + else + cat(sprintf("%sSourced file %s\n", message.prefix, file)) - ss <- # drop 'keep.source' for older versions - if(.ess.Rversion >= "2.8") base::source - else function(..., keep.source) base::source(...) - - out <- tryCatch(ss(file, echo = visibly, local = local, print.eval = output, - max.deparse.length = max.deparse.length, - keep.source = keep.source), - error = function(x) { - if(fake.source) { - .ess.file.remove(file) - } - msg <- .ess.strip.error(x$message, file) - stop(msg, call. = FALSE) - }) + }) - if (fake.source) { - .ess.file.remove(file) - } else { - cat(sprintf("%sSourced file %s\n", message.prefix, file)) - } + out <- ss(file, echo = visibly, local = local, print.eval = output, + max.deparse.length = max.deparse.length, keep.source = keep.source) ## Return value for org-babel invisible(out$value) diff -Nru ess-16.10/etc/ESSR/R/completion.R ess-17.11/etc/ESSR/R/completion.R --- ess-16.10/etc/ESSR/R/completion.R 2016-05-07 16:45:06.000000000 +0000 +++ ess-17.11/etc/ESSR/R/completion.R 2017-11-13 14:13:16.000000000 +0000 @@ -2,7 +2,8 @@ .ess_funargs <- function(funname) { if(.ess.Rversion > '2.14.1') { - comp <- compiler::enableJIT(0) + ## temporarily disable JIT compilation and errors + comp <- compiler::enableJIT(0) op <- options(error=NULL) on.exit({ options(op); compiler::enableJIT(comp) }) } diff -Nru ess-16.10/etc/ESSR/R/mpi.R ess-17.11/etc/ESSR/R/mpi.R --- ess-16.10/etc/ESSR/R/mpi.R 2016-10-22 16:03:27.000000000 +0000 +++ ess-17.11/etc/ESSR/R/mpi.R 2017-11-13 14:13:16.000000000 +0000 @@ -5,8 +5,8 @@ cat(sprintf("%s%s", head, payload)) } -.ess_mpi_message <- function(msg, ...){ - .ess_mpi_send("message", sprintf(msg, ...)) +.ess_mpi_message <- function(msg){ + .ess_mpi_send("message", msg) } .ess_mpi_y_or_n <- function(prompt, callback){ @@ -17,7 +17,7 @@ .ess_mpi_send("eval", expr, callback) } -.ess_mpi_error <- function(msg, ...) { - .ess_mpi_send("error", sprintf(msg, ...)) +.ess_mpi_error <- function(msg) { + .ess_mpi_send("error", msg) } diff -Nru ess-16.10/etc/ess-roxy-tests.R ess-17.11/etc/ess-roxy-tests.R --- ess-16.10/etc/ess-roxy-tests.R 2015-09-19 03:25:42.000000000 +0000 +++ ess-17.11/etc/ess-roxy-tests.R 2017-11-13 14:13:16.000000000 +0000 @@ -1,3 +1,7 @@ + +## Without this def. roxygen (i.e. C-c C-o C-t or C-c C-o C-r) will fail +setGeneric("slplot", function(object, ...) { plot(object, ...) }) + ##' \code{loadings(object)} and then design your own plotting method. ##' @title Side by side scores and loadings plot ##' @usage slplot(object, pcs=c(1,2), scoresLoadings=c(TRUE, TRUE), @@ -18,12 +22,12 @@ ##' .. content for \description{} (no empty lines) .. ##' ##' .. content for \details{} .. -##' @title -##' @param a -##' @param b -##' @param d -##' @param asd -##' @return +##' @title Must have a title +##' @param a any +##' @param b any +##' @param d any +##' @param asd any +##' @return invisible ##' @author Henning Redestig trickyInArgsComments <- function(a,#comment b,#hejhopp trams @@ -33,12 +37,11 @@ ##' .. content for \description{} (no empty lines) .. ##' -##' .. content for \details{} .. -##' @title -##' @param a -##' @param b +##' @title Function example where arguments have defaults +##' @param a any +##' @param b string ##' @param cc -##' @return +##' @return invisible ##' @author Henning Redestig withdef <- function(a, b=c("asd","ffd", "asd", "ffd", "asd", diff -Nru ess-16.10/etc/git-ref ess-17.11/etc/git-ref --- ess-16.10/etc/git-ref 1970-01-01 00:00:00.000000000 +0000 +++ ess-17.11/etc/git-ref 2017-11-13 14:13:29.000000000 +0000 @@ -0,0 +1 @@ +d03efb64579f diff -Nru ess-16.10/etc/R_error_patterns.R ess-17.11/etc/R_error_patterns.R --- ess-16.10/etc/R_error_patterns.R 2014-10-28 18:15:42.000000000 +0000 +++ ess-17.11/etc/R_error_patterns.R 2017-11-13 14:13:16.000000000 +0000 @@ -58,3 +58,10 @@ 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 (stl_numeric.h:183) +==25269== by 0x9EC363C: distance(RcppParallel::RMatrix const&, unsigned long, unsigned long, DistType) (rwmd.cpp:21) +==25269== by 0x9EC90C9: RelaxedWordMoverDistanceSparse::operator()(unsigned long, unsigned long) (rwmd.cpp:137) + diff -Nru ess-16.10/etc/R-ESS-bugs.R ess-17.11/etc/R-ESS-bugs.R --- ess-16.10/etc/R-ESS-bugs.R 2016-10-22 16:03:27.000000000 +0000 +++ ess-17.11/etc/R-ESS-bugs.R 2017-11-13 14:13:16.000000000 +0000 @@ -908,6 +908,25 @@ } } +### --- 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: ^ +} ### Local Variables: diff -Nru ess-16.10/.gitignore ess-17.11/.gitignore --- ess-16.10/.gitignore 2015-09-19 03:25:42.000000000 +0000 +++ ess-17.11/.gitignore 2017-11-13 14:13:15.000000000 +0000 @@ -27,3 +27,4 @@ ess-[1-9]*.[0-9][0-9]-[0-9] ess-[1-9]*.[0-9][0-9]-[0-9][-.]??? lisp/julia-mode.el +lisp/ess-autoloads.el diff -Nru ess-16.10/lisp/ChangeLog ess-17.11/lisp/ChangeLog --- ess-16.10/lisp/ChangeLog 2015-12-11 12:17:11.000000000 +0000 +++ ess-17.11/lisp/ChangeLog 2017-11-13 14:13:16.000000000 +0000 @@ -1,5 +1,25 @@ +2017-01-19 Stefan Monnier + + * ess-toolbar.el: Remove redundant ":group 'ess-toolbar". + + * ess-site.el (Rd-mode-hook): Fix buffer-local setting of create-lockfiles. + (ess-restore-asm-extns): Use remq instead of remassoc. + + * ess-rd.el (Rd-active-mark): Remove. + (Rd-font): Use region-active-p instead. + + * ess-mode.el (ess-mode-menu): Use :help. + + * ess-menu.el: Remove empty file. + + * ess-inf.el (ess-eval-region-or-function-or-paragraph) + (ess-eval-region-or-function-or-paragraph-and-step) + (ess-eval-region-or-line-and-step): Use use-region-p. + + * ess-compat.el: Get rid of support for XEmacs and old Emacsen. + 2015-11-18 - + * ess-sas-d.el (SAS): fix for issue #249: SAS has no prompt 2015-04-07 Stephen Eglen @@ -674,7 +694,7 @@ * ess-mode.el (ess-mode): (ess-load-extras) - * ess-eldoc.el (ess-eldoc): moved the code into ess-r-d.el. + * ess-eldoc.el (ess-eldoc): moved the code into ess-r-mode.el. * ess-developer.el: moved documentation into the user manual diff -Nru ess-16.10/lisp/ess-bugs-d.el ess-17.11/lisp/ess-bugs-d.el --- ess-16.10/lisp/ess-bugs-d.el 2014-10-28 18:15:42.000000000 +0000 +++ ess-17.11/lisp/ess-bugs-d.el 2017-11-13 14:13:16.000000000 +0000 @@ -259,6 +259,39 @@ (add-hook 'comint-output-filter-functions 'ess-bugs-exit-notify-sh)) ) +(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) diff -Nru ess-16.10/lisp/ess-compat.el ess-17.11/lisp/ess-compat.el --- ess-16.10/lisp/ess-compat.el 2015-09-19 03:25:42.000000000 +0000 +++ ess-17.11/lisp/ess-compat.el 2017-11-13 14:13:16.000000000 +0000 @@ -1,6 +1,6 @@ -;;; ess-compat.el --- simple determination of Emacs/XEmacs and version #. +;;; ess-compat.el --- simple determination of Emacs and version #. -;; Copyright (C) 2000--2005 A.J. Rossini, Richard M. Heiberger, Martin +;; Copyright (C) 2000--2017 A.J. Rossini, Richard M. Heiberger, Martin ;; Maechler, Kurt Hornik, Rodney Sparapani, and Stephen Eglen. ;; Author: A.J. Rossini @@ -28,271 +28,47 @@ ;;; Commentary: ;; This file contains functions for easily determining features of the -;; version of Emacs that we are using. In particular, it look for -;; version number, customize support, as well as Emacs/XEmacs, for -;; flaggin support later on. +;; version of Emacs that we are using. ;;; Code: -;;; Define a function to make it easier to check which version we're -;;; running. -;; no longer in use; 2013-12-30: -(defun ess-running-emacs-version-or-newer (major minor) - (or (> emacs-major-version major) - (and (= emacs-major-version major) - (>= emacs-minor-version minor)))) - - ;(defvar ess-running-xemacs (string-match "XEmacs\\|Lucid" emacs-version)) - -(defvar ess-local-custom-available (featurep 'custom) - "Value is nil if custom.el not available, t if available. -Only a concern with earlier versions of Emacs.") - -;; FIXME: When emacs is started from Cygwin shell in Windows, -;; we have (equal window-system 'x) -and should use "--ess" in *d-r.el -(defvar ess-microsoft-p (or (eq system-type 'ms-dos) - (eq system-type 'windows-nt)) - "Value is t if the OS is one of Microsoft's, nil otherwise.") - - -;; These definitions are for Emacs versions < 20.4 or XEmacs -;; These are taken verbatim from the file emacs-20.6/lisp/w32-fns.el -;; -;; Note: 20.3 and 19.x NTemacs users are strongly encouraged to upgrade to -;; version 20.4 or higher. NTemacs 20.2 is not supported by ESS. - -;; XEmacs 20.x needs this -(if (not (fboundp 'find-buffer-visiting)) - (fset 'find-buffer-visiting 'get-file-buffer)) -;; XEmacs <= 21.4.15 needs this: -(defalias 'ess-line-beginning-position - (if (fboundp 'line-beginning-position) - 'line-beginning-position - 'point-at-bol)) - -(if (and (not (featurep 'xemacs)) - (string-match "XEmacs\\|Lucid" emacs-version)) - (provide 'xemacs)) - -;; XEmacs 21.x and Emacs 20.x need this -(cond ((fboundp 'replace-regexp-in-string) - (defalias 'ess-replace-regexp-in-string 'replace-regexp-in-string)) - ((featurep 'xemacs) - (defun ess-replace-regexp-in-string(regexp replace string) - "Mimic GNU Emacs function replace-regexp-in-string with XEmacs' replace-in-string" - (replace-in-string string regexp replace))) - - ;; GNU emacs <= 20 -- take Emacs' 21(.3)'s definition: - (t (defun ess-replace-regexp-in-string (regexp rep string &optional - fixedcase literal subexp start) - "Replace all matches for REGEXP with REP in STRING. - -Return a new string containing the replacements. - -Optional arguments FIXEDCASE, LITERAL and SUBEXP are like the -arguments with the same names of function `replace-match'. If START -is non-nil, start replacements at that index in STRING. - -REP is either a string used as the NEWTEXT arg of `replace-match' or a -function. If it is a function it is applied to each match to generate -the replacement passed to `replace-match'; the match-data at this -point are such that match 0 is the function's argument. - -To replace only the first match (if any), make REGEXP match up to \\' -and replace a sub-expression, e.g. - (ess-replace-regexp-in-string \"\\(foo\\).*\\'\" \"bar\" \" foo foo\" nil nil 1) - => \" bar foo\" -" - - ;; To avoid excessive consing from multiple matches in long strings, - ;; don't just call `replace-match' continually. Walk down the - ;; string looking for matches of REGEXP and building up a (reversed) - ;; list MATCHES. This comprises segments of STRING which weren't - ;; matched interspersed with replacements for segments that were. - ;; [For a `large' number of replacments it's more efficient to - ;; operate in a temporary buffer; we can't tell from the function's - ;; args whether to choose the buffer-based implementation, though it - ;; might be reasonable to do so for long enough STRING.] - (let ((l (length string)) - (start (or start 0)) - matches str mb me) - (save-match-data - (while (and (< start l) (string-match regexp string start)) - (setq mb (match-beginning 0) - me (match-end 0)) - ;; If we matched the empty string, make sure we advance by one char - (when (= me mb) (setq me (min l (1+ mb)))) - ;; Generate a replacement for the matched substring. - ;; Operate only on the substring to minimize string consing. - ;; Set up match data for the substring for replacement; - ;; presumably this is likely to be faster than munging the - ;; match data directly in Lisp. - (string-match regexp (setq str (substring string mb me))) - (setq matches - (cons (replace-match (if (stringp rep) - rep - (funcall rep (match-string 0 str))) - fixedcase literal str subexp) - (cons (substring string start mb) ; unmatched prefix - matches))) - (setq start me)) - ;; Reconstruct a string from the pieces. - (setq matches (cons (substring string start l) matches)) ; leftover - (apply #'concat (nreverse matches))))) - ) - ) - -;; remassoc exists as a built-in function in xemacs, but -;; not in GNU emacs -;; -(if (not (functionp 'remassoc)) - (defun remassoc (key a) - "remove an association pair from an alist" - (if a - (let ((pair (car a))) - (if (equal (car pair) key) - (cdr a) - (cons pair (remassoc key (cdr a)))))))) - -(if (not (fboundp 'w32-using-nt)) - (defun w32-using-nt () - "Return non-nil if literally running on Windows NT (i.e., not Windows 9X)." - (and (eq system-type 'windows-nt) (getenv "SystemRoot")))) - -(if (and (featurep 'xemacs) - (fboundp 'extent-at) - (fboundp 'make-extent) - (fboundp 'set-extent-property)) - (defun ess-xemacs-insert-glyph (gl) - "Insert a glyph at the left edge of point." - (let ((prop 'myimage) ;; myimage is an arbitrary name, chosen to - ;; (hopefully) not conflict with any other - ;; properties. Change it if necessary. - extent) - ;; First, check to see if one of our extents already exists at - ;; point. For ease-of-programming, we are creating and using our - ;; own extents (multiple extents are allowed to exist/overlap at the - ;; same point, and it's quite possible for other applications to - ;; embed extents in the current buffer without your knowledge). - ;; Basically, if an extent, with the property stored in "prop", - ;; exists at point, we assume that it is one of ours, and we re-use - ;; it (this is why it is important for the property stored in "prop" - ;; to be unique, and only used by us). - (if (not (setq extent (extent-at (point) (current-buffer) prop))) - (progn - ;; If an extent does not already exist, create a zero-length - ;; extent, and give it our special property. - (setq extent (make-extent (point) (point) (current-buffer))) - (set-extent-property extent prop t) - )) - ;; Display the glyph by storing it as the extent's "begin-glyph". - (set-extent-property extent 'begin-glyph gl)))) - -;; XEmacs and NTemacs 19.x need these -(if (not (boundp 'w32-system-shells)) - (defvar w32-system-shells '("cmd" "cmd.exe" "command" "command.com" - "4nt" "4nt.exe" "4dos" "4dos.exe" - "ndos" "ndos.exe") - "List of strings recognized as Windows NT/9X system shells.") - ) - -(if (not (fboundp 'w32-system-shell-p)) - (defun w32-system-shell-p (shell-name) - (and shell-name - (member (downcase (file-name-nondirectory shell-name)) - w32-system-shells))) - ) - -(if (not (fboundp 'w32-shell-name)) - (defun w32-shell-name () - "Return the name of the shell being used." - (or (and (boundp 'explicit-shell-file-name) explicit-shell-file-name) - (getenv "ESHELL") - (getenv "SHELL") - (and (w32-using-nt) "cmd.exe") - "command.com")) - ) - -;; XEmacs and NTemacs 20.3 need this -(if (not (fboundp 'w32-shell-dos-semantics)) (defun w32-shell-dos-semantics () - "Return t if the interactive shell being used expects msdos shell semantics." - (or (w32-system-shell-p (w32-shell-name)) - (and (member (downcase (file-name-nondirectory (w32-shell-name))) - '("cmdproxy" "cmdproxy.exe")) - (w32-system-shell-p (getenv "COMSPEC"))))) - ) - -;; XEmacs need this (unless configured with --with-mule=yes) -(if (not (boundp 'enable-multibyte-characters)) - (defvar enable-multibyte-characters nil - "Non-nil means the buffer contents are regarded as multi-byte characters. - This concept is handled completely differently on Xemacs.")) - -(defvar ess-has-tooltip - (and (not (featurep 'xemacs)) - (>= emacs-major-version 21)) - "non-nil if 'tooltip can be required; typically nil for Xemacs.") - -;; XEmacs on Windows needs this -(if (and ess-microsoft-p - (not (fboundp 'w32-short-file-name))) - (cond ((fboundp 'win32-short-file-name) - (fset 'w32-short-file-name 'win32-short-file-name)) - ((fboundp 'mswindows-short-file-name) - (fset 'w32-short-file-name 'mswindows-short-file-name)) - (t - (warn "None of 'w32-short-file-name, 'win32-short-file-name, -or 'mswindows-short-file-name are defined! -You will have to manually set ess-program-files (in ess-custom.el) to -the correct \"8.3\"-style directory name.")))) - - (defun ess-sleep () - "Put emacs to sleep for `ess-sleep-for-shell' seconds (floats work). -Sometimes its necessary to wait for a shell prompt." - (if (featurep 'xemacs) (sleep-for ess-sleep-for-shell) - (sleep-for 0 (truncate (* ess-sleep-for-shell 1000))))) - -(unless (fboundp 'use-region-p) - ;; emacs 23 needs this - (defun use-region-p () - "Return t if the region is active and it is appropriate to act on it. -This is used by commands that act specially on the region under -Transient Mark mode. - -The return value is t if Transient Mark mode is enabled and the -mark is active; furthermore, if `use-empty-active-region' is nil, -the region must not be empty. Otherwise, the return value is nil. - -For some commands, it may be appropriate to ignore the value of -`use-empty-active-region'; in that case, use `region-active-p'." - (and (region-active-p) - (or use-empty-active-region (> (region-end) (region-beginning))))) - - (defun region-active-p () - "Return t if Transient Mark mode is enabled and the mark is active. - -Some commands act specially on the region when Transient Mark -mode is enabled. Usually, such commands should use -`use-region-p' instead of this function, because `use-region-p' -also checks the value of `use-empty-active-region'." - (and transient-mark-mode mark-active))) + ;; FIXME: Not a "compatibility" thing any more, so move to ess-utils.el. + "Put emacs to sleep for `ess-sleep-for-shell' seconds (floats work)." + (sleep-for ess-sleep-for-shell)) + +;; for emacs <= 24.2 : +(unless (fboundp 'defvar-local) + (defmacro defvar-local (var val &optional docstring) + "Define VAR as a buffer-local variable with default value VAL. +Like `defvar' but additionally marks the variable as being automatically +buffer-local wherever it is set." + (declare (debug defvar) (doc-string 3)) + ;; Can't use backquote here, it's too early in the bootstrap. + (list 'progn (list 'defvar var val docstring) + (list 'make-variable-buffer-local (list 'quote var))))) + +(unless (fboundp 'setq-local) + (defmacro setq-local (var val) + "Set variable VAR to value VAL in current buffer." + ;; Can't use backquote here, it's too early in the bootstrap. + (list 'set (list 'make-local-variable (list 'quote var)) val))) (provide 'ess-compat) ; Local variables section -;;; This file is automatically placed in Outline minor mode. -;;; The file is structured as follows: -;;; Chapters: ^L ; -;;; Sections: ;;*;; -;;; Subsections: ;;;*;;; -;;; Components: defuns, defvars, defconsts -;;; Random code beginning with a ;;;;* comment -;;; Local variables: -;;; mode: emacs-lisp -;;; mode: outline-minor -;;; outline-regexp: "\^L\\|\\`;\\|;;\\*\\|;;;\\*\\|(def[cvu]\\|(setq\\|;;;;\\*" -;;; End: +;; This file is automatically placed in Outline minor mode. +;; The file is structured as follows: +;; Chapters: ^L ; +;; Sections: ;;*;; +;; Subsections: ;;;*;;; +;; Components: defuns, defvars, defconsts +;; Random code beginning with a ;;;;* comment +;; Local variables: +;; mode: emacs-lisp +;; mode: outline-minor +;; outline-regexp: "\^L\\|\\`;\\|;;\\*\\|;;;\\*\\|(def[cvu]\\|(setq\\|;;;;\\*" +;; End: ;;; ess-compat.el ends here diff -Nru ess-16.10/lisp/ess-custom.el ess-17.11/lisp/ess-custom.el --- ess-16.10/lisp/ess-custom.el 2016-10-22 16:03:27.000000000 +0000 +++ ess-17.11/lisp/ess-custom.el 2017-11-10 14:12:58.000000000 +0000 @@ -32,6 +32,12 @@ (require 'executable) (require 'font-lock) +;; FIXME: When Emacs is started from Cygwin shell in Windows, +;; we have (equal window-system 'x) -and should use "--ess" in *d-r.el +(defvar ess-microsoft-p (memq system-type '(ms-dos windows-nt)) + "Value is t if the OS is one of Microsoft's, nil otherwise.") + + ;; Customization Groups (defgroup ess nil @@ -132,7 +138,7 @@ :prefix "ess-") ;; Variables (not user-changeable) -(defvar ess-version "16.10" ;; updated by 'make' +(defvar ess-version "17.11" ;; updated by 'make' "Version of ESS currently loaded.") (defvar ess-revision nil ;; set @@ -189,7 +195,7 @@ ;; (defcustom ess-handy-commands '(("change-directory" . ess-change-directory) - ("install.packages" . ess-install.packages) + ("install.packages" . ess-install-library) ("library" . ess-library) ("objects[ls]" . ess-execute-objects) ("help-apropos" . ess-display-help-apropos) @@ -204,12 +210,15 @@ "An alist of custom ESS commands available for call by `ess-handy-commands' and `ess-smart-comma' function." :group 'ess - :type (if (featurep 'emacs) 'alist 'list)) + :type 'alist) (defvar ess--local-handy-commands nil "Store handy commands locally") (make-variable-buffer-local 'ess--local-handy-commands) +(defvar ess-install-library-function nil + "Dialect-specific function to install a library.") +(make-variable-buffer-local 'ess-install-library-function) (defcustom ess-describe-at-point-method nil @@ -223,7 +232,7 @@ :type '(choice (const :tag "buffer" :value nil ) (const tooltip)) ) -(defcustom ess-R-describe-object-at-point-commands +(defcustom ess-r-describe-object-at-point-commands '(("str(%s)") ("htsummary(%s, hlength = 20, tlength = 20)") ("summary(%s, maxsum = 20)")) @@ -234,6 +243,9 @@ implementation." :group 'R :type 'alist) +(defvaralias + 'ess-R-describe-object-at-point-commands + 'ess-r-describe-object-at-point-commands) (defcustom ess-S-describe-object-at-point-commands @@ -312,14 +324,6 @@ ;;; SJE -- why use "Initial-dialect"? If we use nil, it matches "None" ;;; in the custom choice. -;; (defcustom ess-etc-directory -;; (expand-file-name (concat ess-lisp-directory "/../etc/")) -;; "*Location of the ESS etc/ directory. -;; The ESS etc directory stores various auxillary files that are useful -;; for ESS, such as icons." -;; :group 'ess -;; :type 'directory) - (defcustom ess-directory-function nil "Function to return the directory that ESS is run from. If nil or if the function returns nil then you get `ess-directory'." @@ -333,12 +337,13 @@ :group 'ess :type '(choice (const nil) function)) -(defcustom ess-directory nil +(defcustom ess-startup-directory nil "The directory ESS is run from. It must end in a slash. Provided as a default if `ess-ask-for-ess-directory' is non-nil. A nil value means use the current buffer's default directory." :group 'ess :type '(choice (const nil) directory)) +(defvaralias 'ess-directory 'ess-startup-directory) (defcustom ess-history-directory nil "Directory to pick up `ess-history-file' from. @@ -510,16 +515,17 @@ (defvar ess-smart-operators () "List of smart operators to be used in ESS and IESS modes. Not to be set by users. It is redefined by mode specific -settings, such as `ess-R-smart-operators'.") +settings, such as `ess-r-smart-operators'.") (make-variable-buffer-local 'ess-smart-operators) -(defvar ess-R-smart-operators nil +(defvar ess-r-smart-operators nil "If nil, don't use any of smart operators. If t, use all. If an axplicit list of operators, use only those operators. In current verion of ESS, it controls the behavior of ess-smart-comma only, but will be enriched in the near future.") +(defvaralias 'ess-R-smart-operators 'ess-r-smart-operators) (defvar ess-no-skip-regexp "[ \t\n]*\\'" "If `ess-next-code-line' sees this line, it doesn't jump over. @@ -558,11 +564,7 @@ :group 'ess-edit :type 'boolean) -;;; SJE -- this is set in ess-site.el to be "always", so I changed -;;; value t to be "always", so that ess-site.el does not need editing. -;;; However, this is a bit messy, and would be nicer if ess-site.el -;;; value was t rather than "always". -(defcustom ess-keep-dump-files 'ask +(defcustom ess-keep-dump-files t "Variable controlling whether to delete dump files after a successful load. If nil: always delete. If `ask', confirm to delete. If `check', confirm to delete, except for files created with ess-dump-object-into-edit-buffer. @@ -1468,7 +1470,8 @@ "inheritParams" "importFrom" "importClassesFrom" "importMethodsFrom" "useDynLib" - "rdname" "section" "slot") + "rdname" "section" "slot" "description" + "md") "The tags used in roxygen fields that require a parameter. Used to decide highlighting and tag completion." :group 'ess-roxy @@ -1597,7 +1600,7 @@ ;;*;; Regular expressions ;; -- Note: Some variables not-to-customize moved to ./ess-mode.el : -;; ess-set-function-start +;; ess-r-set-function-start ;; Fixme: the following is just for S dialects : (defcustom ess-dumped-missing-re @@ -1651,11 +1654,12 @@ :type 'integer) -(defcustom inferior-R-program-name +(defcustom inferior-ess-r-program-name (if ess-microsoft-p "Rterm" "R") "Program name for invoking an inferior ESS with \\[R]." :group 'ess-R :type 'string) +(defvaralias 'inferior-R-program-name 'inferior-ess-r-program-name) (defcustom inferior-R-args "" "String of arguments (see 'R --help') used when starting R, @@ -1684,11 +1688,12 @@ :group 'ess-Stata :type 'string) -(defcustom inferior-R-objects-command "print(objects(pos=%d, all.names=TRUE), max=1e6)\n" +(defcustom inferior-ess-r-objects-command "print(objects(pos=%d, all.names=TRUE), max=1e6)\n" "Format string for R command to get a list of objects at position %d. Used in e.g., \\[ess-execute-objects] or \\[ess-display-help-on-object]." :group 'ess-command :type 'string) +(defvaralias 'inferior-R-objects-command 'inferior-ess-r-objects-command) (defcustom ess-getwd-command nil "Command string retriving the working directory from the process.") @@ -2047,40 +2052,27 @@ ;;; These variables are currently used only with the S language files for ;;; S S-Plus R. -(defcustom R-editor - (if ess-microsoft-p "emacsclient.exe" - (if (equal system-type 'Apple-Macintosh) nil - (if (featurep 'xemacs) "gnuclient" "emacsclient"))) ;; unix +(defcustom ess-r-editor "emacsclient" "Editor called by R process with 'edit()' command." :group 'ess :type 'string) +(defvaralias 'R-editor 'ess-r-editor) -(defcustom R-pager 'nil ; Usually nil is correct as ESS and page() cooperate. +(defcustom ess-r-pager 'nil ; Usually nil is correct as ESS and page() cooperate. "Pager called by R process with 'page()' command." :group 'ess :type '(choice (const nil) string)) +(defvaralias 'R-pager 'ess-r-pager) -;; FIXME: For GNU emacs, "emacsclient" (without ".exe") also works on Windoze -;; (if (>= emacs-major-version 22) "emacsclient" ; for all platforms -(defcustom S-editor - (if ess-microsoft-p "emacsclient.exe" - (if (equal system-type 'Apple-Macintosh) nil - ;; unix: - (if (featurep 'xemacs) "gnuclient" "emacsclient"))) +(defcustom S-editor "emacsclient" "Editor called by S process with 'edit()' command." :group 'ess :type 'string) (defcustom S-pager - (if ess-microsoft-p "emacsclientw.exe" - (if (equal system-type 'Apple-Macintosh) nil - (if (featurep 'xemacs) "gnuclient" "emacsclient"))) + (if ess-microsoft-p "emacsclientw.exe" "emacsclient") "Pager called by S process with 'page()' command." - ;; Change made to provide a better help(function) experience with - ;; S+6 and xemacs - ;; gnuclient -q will open a buffer with an HTML help file - ;; you can view it with M-x browse-url-of-buffer :group 'ess :type 'string) @@ -2118,22 +2110,21 @@ :group 'ess-proc :type 'string) -(make-variable-buffer-local 'inferior-ess-ddeclient) - (defcustom inferior-ess-client-name nil "Name of ESS program ddeclient talks to." :group 'ess-proc :type 'string) -(make-variable-buffer-local 'inferior-ess-client-name) - (defcustom inferior-ess-client-command nil "ddeclient command sent to the ESS program." :group 'ess-proc :type '(choice (const nil) string)) +(make-variable-buffer-local 'inferior-ess-client-name) +(make-variable-buffer-local 'inferior-ess-ddeclient) (make-variable-buffer-local 'inferior-ess-client-command) + ;;;;; user settable defaults (defvar inferior-S-program-name inferior-S+3-program-name "*Program name for invoking an inferior ESS with S().") @@ -2444,26 +2435,6 @@ :group 'ess-command :type 'string) -(defvar ess-cmd-delay nil - "*Set to a positive number if ESS will include delays proportional to -`ess-cmd-delay' in some places. These delays are introduced to -prevent timeouts in certain processes, such as completion. - -This variable has no effect from ESS12.03 -") -(make-variable-buffer-local 'ess-cmd-delay) - -(defvar ess-R-cmd-delay nil - "Used to initialize `ess-cmd-delay'. - -This variable has no effect from ESS12.03 -") - -(defvar ess-S+-cmd-delay 1.0 - "Used to initialize `ess-cmd-delay'. -This variable has no effect from ESS12.03 -") - ;;*;; Regular expressions (defvar inferior-ess-prompt nil "The regular expression used for recognizing prompts. @@ -2488,9 +2459,10 @@ "\\(attach(\\([^)]\\|$\\)\\|detach(\\|library(\\|source(\\)" "The regexp for matching the S commands that change the search path.") -(defvar ess-R-change-sp-regexp +(defvar ess-r-change-sp-regexp "\\(attach(\\([^)]\\|$\\)\\|detach(\\|library(\\|require(\\|source(\\)" "The regexp for matching the R commands that change the search path.") +(defvaralias 'ess-R-change-sp-regexp 'ess-r-change-sp-regexp) ;;*;; Process-dependent variables @@ -2812,7 +2784,7 @@ 'font-lock-warning-face) "Inferior-ess problems or errors.") -(defcustom inferior-R-font-lock-keywords +(defcustom inferior-ess-r-font-lock-keywords '((ess-S-fl-keyword:prompt . t) ;; comint does that, but misses some prompts ;; (ess-S-fl-keyword:input-line) ;; comint boguously highlights input with text props, no use for this (ess-R-fl-keyword:messages . t) @@ -2840,6 +2812,7 @@ :group 'ess-R :type 'alist ) +(defvaralias 'inferior-R-font-lock-keywords 'inferior-ess-r-font-lock-keywords) (defvar ess-S-common-font-lock-keywords nil @@ -2996,7 +2969,7 @@ (defvar ess-eldoc-function nil "Holds a dialect specific eldoc function, -See `ess-R-eldoc-function' and `ess-julia-eldoc-function' for examples.") +See `ess-r-eldoc-function' and `ess-julia-eldoc-function' for examples.") (defcustom ess-r-args-noargsmsg "No args found." "Message returned if \\[ess-r-args-get] cannot find a list of arguments." @@ -3035,7 +3008,7 @@ ;;*;; Variables relating to ess-help-mode -;;-- ess-help-S-.. and ess-help-R-.. : in ess-s-l.el (are used in ess-inf). +;;-- ess-help-S-.. and ess-help-R-.. : in ess-s-lang.el (are used in ess-inf). (defvar ess-help-sec-keys-alist nil "Alist of (key . string) pairs for use in section searching.") @@ -3125,6 +3098,9 @@ (make-variable-buffer-local 'ess-listing-minor-mode) +(defvar ess--enable-experimental-projects nil + "Enable experimental project support in ESS") + (provide 'ess-custom) ; Local variables section diff -Nru ess-16.10/lisp/ess-debug.el ess-17.11/lisp/ess-debug.el --- ess-16.10/lisp/ess-debug.el 2014-10-28 18:15:42.000000000 +0000 +++ ess-17.11/lisp/ess-debug.el 2017-11-13 14:13:16.000000000 +0000 @@ -29,7 +29,7 @@ ;;; Commentary: ;; Strictly for debugging and development. usage is: -;; xemacs -no-site-file -no-init-file -load ess-debug.el -f S4 +;; emacs -Q -l ess-debug.el -f S4 ;; (or similar!) ;; ;; The whole point of this file is to enable debugging from a vanilla diff -Nru ess-16.10/lisp/essd-els.el ess-17.11/lisp/essd-els.el --- ess-16.10/lisp/essd-els.el 2016-10-22 16:03:27.000000000 +0000 +++ ess-17.11/lisp/essd-els.el 2017-11-13 14:13:17.000000000 +0000 @@ -32,7 +32,8 @@ ;;; Code: -(require 'ess-s-l) +(require 'ess-s-lang) +(require 'ess-utils) (autoload 'inferior-ess "ess-inf" "Run an ESS process.") (autoload 'ess-mode "ess-mode" "Edit an ESS process.") diff -Nru ess-16.10/lisp/ess.el ess-17.11/lisp/ess.el --- ess-16.10/lisp/ess.el 2016-10-22 16:03:27.000000000 +0000 +++ ess-17.11/lisp/ess.el 2017-11-13 14:13:17.000000000 +0000 @@ -126,8 +126,9 @@ (require 'ess-custom) (require 'ess-mode) (require 'ess-inf) +;; We can't use cl-lib whilst supporting Emacs <= 24.2 users +(with-no-warnings (require 'cl)) -(require 'cl) ; ess-mode: editing S/R/XLS/SAS source @@ -175,381 +176,6 @@ ;;==> ess-inf.el has its OWN autoload's ! - ; Miscellaneous "ESS globals" - -(defun ess-version-string () - (let* (;;(svn-fname (concat ess-etc-directory "SVN-REVISION")) - ;; (svn-rev - ;; (when (file-exists-p svn-fname) - ;; ;; then it has two lines that look like - ;; ;; |Revision: 4803 - ;; ;; |Last Changed Date: 2012-04-16 - ;; (with-current-buffer (find-file-noselect svn-fname) - ;; (goto-char (point-min)) - ;; (when (re-search-forward "Revision: \\(.*\\)\n.*: \\(.*\\)" nil t) - ;; (concat "svn: " (match-string 1) " (" (match-string 2) ")"))))) - (ess-dir (file-name-directory ess-lisp-directory)) ; if() the top-level 'ess/' - (is-release (file-exists-p (concat ess-etc-directory ".IS.RELEASE"))) - (rel-string (if is-release "Released ")) - (git-ref-fn (concat ess-dir ".git/HEAD")) - (git-ref (when (file-exists-p git-ref-fn) - (with-current-buffer (find-file-noselect git-ref-fn) - (goto-char (point-min)) - (when (re-search-forward "ref: \\(.*\\)\n" nil t) - (match-string 1))))) - (git-fname (if git-ref - (concat ess-dir ".git/" git-ref) - ;; for release - (concat ess-etc-directory "git-ref"))) - (git-rev (when (file-exists-p git-fname) - (with-current-buffer (find-file-noselect git-fname) - (goto-char (point-min)) - (concat "git: "(buffer-substring 1 (point-at-eol)))))) - (elpa-fname (concat ess-dir "ess-pkg.el")) - (elpa-rev (when (file-exists-p elpa-fname) - ;; get it from ELPA dir name, (probably won't work if installed manually) - (concat "elpa: " - (replace-regexp-in-string "ess-" "" - (file-name-nondirectory - (substring ess-dir 1 -1))))))) - ;; set the "global" ess-revision: - (setq ess-revision (format "%s%s%s" - (or rel-string "") ;;(or svn-rev "") - (or git-rev "") - (or elpa-rev ""))) - (when (string= ess-revision "") - (setq ess-revision "")) - (concat ess-version " [" ess-revision "]"))) - - -(defun ess-version () - (interactive) - (message (format "ess-version: %s (loaded from %s)" - (ess-version-string) - (file-name-directory ess-lisp-directory)))) - -;;; Set up for menus, if necessary -;;; --> is done in ess-mode.el, ess-inf.el, etc - - ; ESS yank -(defun ess-yank-cleaned-commands () - "Yank and strip the code, leaving only (R/S/Lsp/..) commands. -Deletes any lines not beginning with a prompt, and then removes -the prompt from those lines that remain. - -Invoke this command with C-u C-u C-y." - (setq yank-window-start (window-start)) - (let ((beg (point))) - (push-mark beg) - (setq this-command t) - (insert-for-yank (current-kill 0)) - (ess-transcript-clean-region beg (point) nil) - (if (eq (point) beg) - (message "No commands found")) - (if (eq this-command t) - (setq this-command 'yank)) - )) - -(defun ess-yank (&optional ARG) - "With double prefix (C-u C-u) call `ess-yank-cleaned-commands" - (interactive "*P") - (if (equal '(16) ARG) - (ess-yank-cleaned-commands) - (let* ((remapped (command-remapping 'yank (point))) - (command (cond ((eq remapped 'ess-yank) 'yank) - ((null remapped) 'yank) - (t remapped)))) - (funcall command ARG)))) - -(put 'ess-yank 'delete-selection 'yank) - - ; ESS Completion -(defun ess-completing-read (prompt collection &optional predicate - require-match initial-input hist def) - "Read a string in the minibuffer, with completion. -Use `ido-completing-read' if IDO interface is present, or fall -back on classical `completing-read' otherwise. Meaning of -arguments is as in `completing-read' (PROMPT is automatically -suffixed with ': ' and (default %s) when needed). If HIST -is null use `ess--completing-hist' as history. - -See also `ess-use-ido'. -" - (let ((use-ido (and ess-use-ido (featurep 'ido)))) - (setq hist (or hist 'ess--completing-hist)) - (when (and def (not use-ido)) ;; ido places in front and highlights the default - (setq prompt (format "%s(default %s)" prompt def))) - (setq prompt (concat prompt ": ")) - (if use-ido - (let ((reset-ido (and use-ido (not ido-mode))) ;people not using ido but having it) - (ido-current-directory nil) - (ido-directory-nonreadable nil) - (ido-directory-too-big nil) - (ido-context-switch-command 'ignore) - (ido-enable-flex-matching ess-ido-flex-matching) ;it's fast and useful, may be get into options - (ido-choice-list (copy-sequence collection)) ;ido removes the match (reported) - sel) - (unwind-protect - (progn - (ido-init-completion-maps) - (add-hook 'minibuffer-setup-hook 'ido-minibuffer-setup) - (add-hook 'choose-completion-string-functions 'ido-choose-completion-string) - (setq sel (ido-read-internal 'list prompt hist def require-match initial-input)) - (when hist ;; ido does not push into hist the whole match if C-SPC or RET is used (reported) - (unless (string= sel (car (symbol-value hist))) - (set hist (cons sel (symbol-value hist)))))) - (when reset-ido - (remove-hook 'minibuffer-setup-hook 'ido-minibuffer-setup) - (remove-hook 'choose-completion-string-functions 'ido-choose-completion-string))) - sel) - ;; else usual completion - (when (and (featurep 'xemacs) ;; xemacs workaround - (not (listp (car collection)))) - (setq collection (mapcar 'list collection))) - (completing-read prompt collection predicate require-match initial-input hist def) - ))) - -(defun ess-load-extras (&optional inferior) - "Load all the extra features depending on custom settings." - - (let ((mode (if inferior 'inferior-ess-mode 'ess-mode)) - (isR (string-match "^R" ess-dialect))) - - ;; auto-complete - (when (and (boundp 'ac-sources) - (if inferior - (eq ess-use-auto-complete t) - ess-use-auto-complete)) - (add-to-list 'ac-modes mode) - ;; files should be in front; ugly, but needed - (when ess-ac-sources - (setq ac-sources - (delq 'ac-source-filename ac-sources)) - (mapcar (lambda (el) (add-to-list 'ac-sources el)) - ess-ac-sources) - (add-to-list 'ac-sources 'ac-source-filename))) - - ;; company - (when (and (boundp 'company-backends) - (if inferior - (eq ess-use-company t) - ess-use-company)) - (when ess-company-backends - (set (make-local-variable 'company-backends) - (copy-list (append ess-company-backends company-backends))) - (delq 'company-capf company-backends))) - - ;; eldoc) - (require 'eldoc) - (when (and ess-eldoc-function ;; if mode provide this, it suports eldoc - (or (and (not inferior) ess-use-eldoc) - (and inferior (eq ess-use-eldoc t)))) - (when (> eldoc-idle-delay 0.4) ;; default is too slow for paren help - (set (make-local-variable 'eldoc-idle-delay) 0.1)) - (set (make-local-variable 'eldoc-documentation-function) ess-eldoc-function) - (turn-on-eldoc-mode)) - - ;; tracebug - (when (and ess-use-tracebug inferior isR) - (ess-tracebug 1)))) - - - -;; not in use since 2004 -;; (defun ess-load-object-name-db-file () -;; "Load object database file if present, mention if not." -;; (if (string= ess-language "S") -;; (progn -;; (make-local-variable 'ess-object-name-db) -;; (condition-case () -;; (load ess-object-name-db-file) -;; (error -;; ;;(message "%s does not exist. Consider running ess-create-object-name-db." -;; ;; ess-object-name-db-file) -;; ;; (ding) -;; (sit-for 1)))))) - -;;; xemacs process-put and process-get workarounds: -;;; !!!! remove this when xemacs starts supporting them!!! - -(when (featurep 'xemacs) - (defvar process-plist-map (make-hash-table :test 'eq :weakness 'key) - "Property list information for process, when XEmacs doesn't provide this. -See `process-plist' and `set-process-plist'.") - - (defun-when-void process-plist (process) - "Return the property list of PROCESS." - (check-argument-type #'processp process) - (gethash process process-plist-map)) - - (defun-when-void set-process-plist (process plist) - "Set the property list of PROCESS to PLIST." - (check-argument-type #'processp process) - (check-argument-type #'valid-plist-p plist) - (puthash process plist process-plist-map)) - - - (defun-when-void process-get (process propname) - "Return the value of PROCESS' PROPNAME property. -This is the last value stored with `(process-put PROCESS PROPNAME VALUE)'." - (plist-get (process-plist process) propname)) - - (defun-when-void process-put (process propname value) - "Change PROCESS' PROPNAME property to VALUE. -It can be retrieved with `(process-get PROCESS PROPNAME)'." - (set-process-plist process - (plist-put (process-plist process) propname value))) - ) - -;;; Running these must be done "every time" before use, since -;;; they depend on a customizable variable. - -;; trying different viewers; thanks to an original patch for -;; ess-swv.el from Leo : -(defun ess-get-ps-viewer () - "Get external PostScript viewer to be used from ESS. -Use `ess-ps-viewer-pref' when that is executably found by \\[executable-find]. -Otherwise try a list of fixed known viewers." - (file-name-nondirectory - (or (and ess-ps-viewer-pref ; -> ./ess-custom.el - (executable-find ess-ps-viewer-pref)) - (executable-find "gv") - (executable-find "evince") - (executable-find "kghostview")))) - -(defun ess-get-pdf-viewer () - "Get external PDF viewer to be used from ESS. -Use `ess-pdf-viewer-pref' when that is executably found by \\[executable-find]. -Otherwise try a list of fixed known viewers. -" - (let ((viewer (or ess-pdf-viewer-pref - ;; (and (stringp ess-pdf-viewer-pref) ; -> ./ess-custom.el - ;; (executable-find ess-pdf-viewer-pref)) - (executable-find "evince") - (executable-find "kpdf") - (executable-find "okular") - (executable-find "xpdf") - (executable-find "acroread") - (executable-find "xdg-open") - ;; this one is wrong, (ok for time being as it is used only in swv) - (car (ess-get-words-from-vector "getOption(\"pdfviewer\")\n")) - ))) - (when (stringp viewer) - (setq viewer (file-name-nondirectory viewer))) - viewer)) - - - - - - ; Buffer local customization stuff - -;; Parse a line into its constituent parts (words separated by -;; whitespace). Return a list of the words. -;; Taken from rlogin.el, from the comint package, from XEmacs 20.3. -(defun ess-line-to-list-of-words (line) - (if (listp line) - line - (let ((list nil) - (posn 0)) - ;; (match-data (match-data))) - (while (string-match "[^ \t\n]+" line posn) - (setq list (cons (substring line (match-beginning 0) (match-end 0)) - list)) - (setq posn (match-end 0))) - (store-match-data (match-data)) - (nreverse list)))) - - -(defvar ess--make-local-vars-permenent nil - "If this varialbe is non-nil in a buffer make all variable permannet. -Used in noweb modes.") -(make-variable-buffer-local 'ess--make-local-vars-permenent) -(put 'ess--make-local-vars-permenent 'permanent-local t) - -(defun ess-setq-vars-local (alist &optional buf) - "Set language variables from ALIST, in buffer BUF, if desired." - (if buf (set-buffer buf)) - ;; (setq alist (reverse alist)) ;; It should really be in reverse order; - (mapc (lambda (pair) - (make-local-variable (car pair)) - (set (car pair) (eval (cdr pair))) - (when ess--make-local-vars-permenent - (put (car pair) 'permanent-local t)) ;; hack for Rnw - ) - alist) - (ess-write-to-dribble-buffer - (format "(ess-setq-vars-LOCAL): language=%s, dialect=%s, buf=%s, comint..echoes=%s, comint..sender=%s\n" - ess-language ess-dialect buf comint-process-echoes comint-input-sender))) - -(defun ess-setq-vars-default (alist &optional buf) - "Set language variables from ALIST, in buffer BUF, if desired." - (ess-write-to-dribble-buffer - (format "ess-setq-vars-default 0: ess-language=%s, -dialect=%s, buf=%s, comint..echoes=%s, comint..sender=%s\n" - ess-language ess-dialect buf comint-process-echoes comint-input-sender)) - (if buf (set-buffer buf)) - (mapc (lambda (pair) - (set-default (car pair) (eval (cdr pair)))) - alist) - (ess-write-to-dribble-buffer - (format "ess-setq-vars-default 1: ess-language=%s, -dialect=%s, buf=%s, comint..echoes=%s, comint..sender=%s\n" - ess-language ess-dialect buf comint-process-echoes comint-input-sender)) - ) - -;;; versions thanks to Barry Margolin . -;;; unfortunately, requires 'cl. Whoops. -;;(defun ess-setq-vars (var-alist &optional buf) -;; "Set language variables from alist, in buffer `buf', if desired." -;; (if buf (set-buffer buf)) -;; (dolist (pair var-alist) -;; (set (car pair) (eval (cdr pair)))) -;; (ess-write-to-dribble-buffer -;; (format "(ess-setq-vars): ess-language=%s, buf=%s \n" -;; ess-language buf))) -;;(defun ess-setq-vars-default (var-alist &optional buf) -;; "Set language variables from alist, in buffer `buf', if desired." -;; (if buf (set-buffer buf)) -;; (dolist (pair var-alist) -;; (set-default (car pair) (eval (cdr pair)))) -;; (ess-write-to-dribble-buffer -;; (format "(ess-setq-vars-default): ess-language=%s, buf=%s \n" -;; ess-language buf))) - -;; Toby Speight -;;> ;; untested -;;> (let ((l ess-r-customize-alist)) ; or whatever -;;> (while l -;;> (set (car (car l)) (cdr (car l))) ; set, not setq! -;;> (setq l (cdr l)))) -;; -;; -;;If they are to be buffer-local, you may need to -;; -;;> ;; untested -;;> (set (make-local-variable (car (car l))) (cdr (car l))) -;; - - -;; Erik Naggum -;; -;;(mapcar (lambda (pair) (set (car pair) (cdr pair))) -;; ess-r-customize-alist) -;; -;;if you want to evaluate these things along the way, which it appears that -;;you want, try: -;; -;;(mapcar (lambda (pair) (set (car pair) (eval (cdr pair)))) -;; ess-r-customize-alist) - -;; jsa@alexandria.organon.com (Jon S Anthony) -;;(mapcar (lambda (x) -;; (set-variable (car x) (cdr x))) -;; ess-r-customize-alist) - - - - ; Run load hook and provide package - (run-hooks 'ess-mode-load-hook) (provide 'ess) diff -Nru ess-16.10/lisp/ess-font-lock.el ess-17.11/lisp/ess-font-lock.el --- ess-16.10/lisp/ess-font-lock.el 2016-05-07 16:45:06.000000000 +0000 +++ ess-17.11/lisp/ess-font-lock.el 2017-11-13 14:13:16.000000000 +0000 @@ -33,6 +33,8 @@ (require 'font-lock) (require 'paren) + +;; FIXME: What is this doing here!? (if (fboundp 'show-paren-mode) (show-paren-mode 1)) ;;; Emacs 20.x notes: @@ -50,11 +52,11 @@ (defun ess-font-lock-rmh () "Set font-lock colors to Richard Heiberger's usual choice." + ;; FIXME: Turn it into a Custom theme! (interactive) - (if (featurep 'xemacs) nil - (set-foreground-color "Black") - (set-background-color "lightcyan")) + (set-foreground-color "Black") + (set-background-color "lightcyan") (set-face-background 'mode-line "lightskyblue") (set-face-foreground 'mode-line "midnightblue") @@ -69,11 +71,11 @@ (defun ess-font-lock-blue () "Set font-lock colors to Richard Heiberger's blue color scheme." + ;; FIXME: Turn it into a Custom theme! (interactive) - (if (featurep 'xemacs) nil - (set-foreground-color "Black") - (set-background-color "LightBlue")) + (set-foreground-color "Black") + (set-background-color "LightBlue") (set-face-foreground 'mode-line "LightBlue") (set-face-background 'mode-line "DarkSlateBlue") @@ -88,11 +90,11 @@ (defun ess-font-lock-wheat () "Set font-lock colors to Richard Heiberger's wheat color scheme." + ;; FIXME: Turn it into a Custom theme! (interactive) - (if (featurep 'xemacs) nil - (set-foreground-color "Black") - (set-background-color "Wheat")) + (set-foreground-color "Black") + (set-background-color "Wheat") (set-face-foreground 'mode-line "Wheat") (set-face-background 'mode-line "Sienna") @@ -108,11 +110,11 @@ (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) - (if (featurep 'xemacs) nil - (set-foreground-color "Black") - (set-background-color "white")) + (set-foreground-color "Black") + (set-background-color "white") (set-face-foreground 'mode-line "gray10") (set-face-background 'mode-line "gray90") @@ -137,6 +139,7 @@ (defun ess-font-lock-db () "Set font-lock colors (leave fore-/back-ground alone) courtesy David Brahm " + ;; FIXME: Turn it into a Custom theme! (interactive) (set-face-foreground 'font-lock-comment-face "Firebrick") ; #... %... (set-face-foreground 'font-lock-string-face "SeaGreen") ; "..." "..." diff -Nru ess-16.10/lisp/ess-gretl.el ess-17.11/lisp/ess-gretl.el --- ess-16.10/lisp/ess-gretl.el 2016-05-07 16:45:06.000000000 +0000 +++ ess-17.11/lisp/ess-gretl.el 2017-11-13 14:13:16.000000000 +0000 @@ -37,6 +37,7 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; (require 'compile); for compilation-* below +(require 'ess-r-mode) ;;; Code: @@ -506,20 +507,19 @@ (ess-language . "gretl") (ess-dialect . "gretl") (ess-suffix . "inp") - (ess-dump-filename-template . (ess-replace-regexp-in-string + (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-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-cmd-delay . ess-R-cmd-delay) - (ess-function-pattern . ess-R-function-pattern) + (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) + (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? @@ -585,7 +585,7 @@ 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-R-program-name : + ;; get settings, notably inferior-ess-r-program-name : ;; (if (null inferior-gretl-program-name) ;; (error "'inferior-gretl-program-name' does not point to 'gretl-release-basic' executable") (setq ess-customize-alist gretl-customize-alist) diff -Nru ess-16.10/lisp/ess-help.el ess-17.11/lisp/ess-help.el --- ess-16.10/lisp/ess-help.el 2016-10-22 16:03:27.000000000 +0000 +++ ess-17.11/lisp/ess-help.el 2017-11-13 14:13:16.000000000 +0000 @@ -1,6 +1,6 @@ ;;; ess-help.el --- Support for viewing ESS help files -;; Copyright (C) 1989-1994 Bates, Kademan, Ritter and Smith +;; Copyright (C) 1989-1994, 2017 Bates, Kademan, Ritter and Smith ;; Copyright (C) 1997, A.J. Rossini ;; Copyright (C) 1998--2001 A.J. Rossini, Martin Maechler, Kurt Hornik and ;; Richard M. Heiberger . @@ -43,9 +43,9 @@ (require 'ess-inf) (require 'info)) -(require 'ess) (require 'ess-mode) -(require 'cl) +;; We can't use cl-lib whilst supporting Emacs <= 24.2 users +(with-no-warnings (require 'cl)) ; ess-help-mode ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; @@ -433,8 +433,6 @@ (with-parsed-tramp-file-name default-directory nil (tramp-make-tramp-file-name method user host (nth 1 el2))) (nth 1 el2)))) - ;; (if xemacs-p - ;; (insert (format "Dir: %s \t%s\n" (concat path "/doc/") (nth 2 el2))) (insert-text-button "Pdf" 'mouse-face 'highlight 'action (if remote @@ -578,7 +576,9 @@ (let ((map (make-keymap))); Full keymap, in order to (suppress-keymap map) ; suppress all usual "printing" characters (when (boundp 'special-mode-map) - (set-keymap-parent map special-mode-map)) + (set-keymap-parent map (make-composed-keymap + button-buffer-map + special-mode-map))) (define-key map "q" 'quit-window) (define-key map "\C-m" 'next-line) ;; (define-key map "s" ess-help-sec-map) @@ -713,8 +713,7 @@ (let ((old-point (point)) (case-fold-search nil)) (goto-char (point-min)) - (let ((the-sec (cdr (assoc (if (featurep 'xemacs) last-command-char last-command-event) - ess-help-sec-keys-alist)))) + (let ((the-sec (cdr (assoc last-command-event ess-help-sec-keys-alist)))) (if (not the-sec) (error "Invalid section key: %c" last-command-event) (if (re-search-forward (concat "^" the-sec) nil t) @@ -916,7 +915,7 @@ Customize `ess-describe-at-point-method' if you wan to display the description in a tooltip. -See also `ess-R-describe-object-at-point-commands' (and similar +See also `ess-r-describe-object-at-point-commands' (and similar option for other dialects)." (interactive) (if (not ess-describe-object-at-point-commands) diff -Nru ess-16.10/lisp/ess-inf.el ess-17.11/lisp/ess-inf.el --- ess-16.10/lisp/ess-inf.el 2016-10-22 16:03:27.000000000 +0000 +++ ess-17.11/lisp/ess-inf.el 2017-11-13 14:13:16.000000000 +0000 @@ -116,25 +116,17 @@ (format "(inf-ess 1): lang=%s, dialect=%s, tmp-dialect=%s, buf=%s\n" ess-language ess-dialect temp-ess-dialect (current-buffer))) (let* ((process-environment process-environment) - (defdir (or (and ess-directory-function (funcall ess-directory-function)) - ess-directory default-directory)) - + ;; Use temp-ess-dialect if not R, R program name otherwise (temp-dialect (if ess-use-inferior-program-name-in-buffer-name ;VS[23-02-2013]: fixme: this should not be here (if (string-equal temp-ess-dialect "R") - inferior-R-program-name - temp-ess-dialect) ; use temp-ess-dialect - ; if not R, R program name - ; otherwise. + inferior-ess-r-program-name + temp-ess-dialect) temp-ess-dialect)) (temp-lang temp-ess-lang) - (procname (let ((ntry 0) ;; find the next non-existent process N (*R:N*) - (done nil)) - (while (not done) - (setq ntry (1+ ntry) - done (not - (get-process (ess-proc-name - ntry - temp-dialect))))) + ;; Find the next non-existent process N (*R:N*) + (procname (let ((ntry 1)) + (while (get-process (ess-proc-name ntry temp-dialect)) + (setq ntry (1+ ntry))) (ess-proc-name ntry temp-dialect))) (buf-name-str (funcall ess-gen-proc-buffer-name-function procname)) startdir buf method) @@ -147,53 +139,44 @@ ;; 1) try to use current buffer, if inferior-ess-mode but no process ((and (not (comint-check-proc (current-buffer))) (eq major-mode 'inferior-ess-mode)) - (setq startdir (if ess-ask-for-ess-directory - (ess-get-directory defdir temp-dialect procname) - defdir) - buf (current-buffer) - ;; don't change existing buffer name in this case; It is very - ;; commong to restart the process in the same buffer. - buf-name-str (buffer-name) - method 1)) + (setq startdir (inferior-ess--maybe-prompt-startup-directory procname temp-dialect)) + (setq buf (current-buffer)) + ;; don't change existing buffer name in this case; It is very + ;; commong to restart the process in the same buffer. + (setq buf-name-str (buffer-name)) + (setq method 1)) ;; 2) Take the *R:N* buffer if already exists (and contains dead proc!) ;; fixme: buffer name might have been changed, iterate over all ;; inferior-ess buffers ((get-buffer buf-name-str) - (setq buf (get-buffer buf-name-str) - method 2)) + (setq buf (get-buffer buf-name-str)) + (setq method 2)) ;; 3) Pick up a transcript file or create a new buffer (t - (setq startdir (if ess-ask-for-ess-directory - (ess-get-directory defdir temp-dialect procname) - defdir) - buf (if ess-ask-about-transfile - (let ((transfilename (read-file-name "Use transcript file (default none):" - startdir ""))) - (if (string= transfilename "") - (get-buffer-create buf-name-str) - (find-file-noselect (expand-file-name transfilename)))) - (get-buffer-create buf-name-str)) - method 3))) + (setq startdir (inferior-ess--maybe-prompt-startup-directory procname temp-dialect)) + (setq buf (if ess-ask-about-transfile + (let ((transfilename (read-file-name "Use transcript file (default none):" + startdir ""))) + (if (string= transfilename "") + (get-buffer-create buf-name-str) + (find-file-noselect (expand-file-name transfilename)))) + (get-buffer-create buf-name-str))) + (setq method 3))) (ess-write-to-dribble-buffer (format "(inf-ess 2.0) Method #%d start=%s buf=%s\n" method startdir buf)) - (set-buffer buf) ;; Now that we have the buffer, set buffer-local variables. - (ess-setq-vars-local ess-customize-alist) ; buf) + (set-buffer buf) + (ess-setq-vars-local ess-customize-alist) - ;; Write out debug info (ess-write-to-dribble-buffer (format "(inf-ess 2.1): ess-language=%s, ess-dialect=%s buf=%s \n" ess-language ess-dialect (current-buffer))) - ;; initialize. - (if startdir (setq default-directory startdir)) - - ;; the following was part of ess-multi; - + (when startdir (setq default-directory startdir)) (let* ((ess-directory (or startdir ess-directory)) (infargs (or ess-start-args @@ -591,21 +574,49 @@ ;;*;; Requester functions called at startup -(defun ess-get-directory (default dialect procname) - (let ((prog-version (cond ((string= dialect "R") - (concat ", " inferior-R-version)) ; notably for the R-X.Y versions - (inferior-ess-program - (concat ", " inferior-ess-program )) - (t "")))) - (ess-prompt-for-directory - (directory-file-name default) - (format "ESS (*%s*%s) starting data directory? " - procname prog-version) - ;; (format "ESS [%s {%s(%s)}: '%s'] starting data directory? " - ;; ;;FIXME: maybe rather tmp-dialect (+ evt drop ess-language?)? - ;; procname ess-language ess-dialect prog-version) - ))) - +;; FIXME EMACS 25.1: +;; Deprecate `ess-directory-function' in favour of `project-find-functions'? +(defun inferior-ess--get-startup-directory () + (let ((dir (or (and ess--enable-experimental-projects + (fboundp 'project-current) + (cdr (project-current))) + (and ess-directory-function + (funcall ess-directory-function)) + ess-startup-directory + default-directory))) + (directory-file-name dir))) + +;; FIXME: Move all that R stuff elsewhere +(defun inferior-ess-r--adjust-startup-directory (dir dialect) + (if (string= dialect "R") + (let* ((project-dir (cdr (ess-r-package-project))) + (tests-dir (expand-file-name (file-name-as-directory "tests") + project-dir))) + ;; Prefer the `tests' directory but only if the package + ;; directory was selected in the first place + (if (and project-dir + (string= project-dir dir) + (string= default-directory tests-dir)) + tests-dir + dir)) + dir)) + +(defun inferior-ess--maybe-prompt-startup-directory (procname dialect) + (let ((default-dir (inferior-ess-r--adjust-startup-directory + (inferior-ess--get-startup-directory) + dialect))) + (if ess-ask-for-ess-directory + (let* ((prog (cond ((string= dialect "R") + ;; Includes R-X.Y versions + (concat ", " inferior-R-version)) + (inferior-ess-program + (concat ", " inferior-ess-program )) + (t ""))) + (prompt (format "%s starting project directory? " + procname + prog))) + (ess-prompt-for-directory default-dir prompt)) + default-dir))) (defun ess-prompt-for-directory (default prompt) "`prompt' for a directory, using `default' as the usual." @@ -727,7 +738,7 @@ ;;- ;; "f" : existing file {file name completion} ! ;;- (setq inferior-ess-program filename)) ;; the inferior-ess-program is initialized in the customize..alist, -;; e.g. from inferior-R-program-name ... --> should change rather these. +;; e.g. from inferior-ess-r-program-name ... --> should change rather these. ;; However these really depend on the current ess-language! ;; Plan: 1) must know and use ess-language ;; 2) change the appropriate inferior--program-name @@ -1163,22 +1174,23 @@ If SEC-PROMPT is non-nil return if secondary prompt is detected regardless of whether primary prompt was detected or not. If WAIT is non-nil wait for WAIT seconds for process output before -the prompt check, default 0.001s. When FORCE-REDISPLAY is non-nil +the prompt check, default 0.002s. When FORCE-REDISPLAY is non-nil force redisplay. You better use WAIT >= 0.1 if you need FORCE-REDISPLAY to avoid excesive redisplay." (setq proc (or proc (get-process ess-local-process-name))) (unless (eq (process-status proc) 'run) - (ess-error "ESS process has died unexpectedly.")) - (setq wait (or wait 0.002)) ;;xemacs is stuck if it's 0 here + (ess-error "ESS process has died unexpectedly")) + ;; 2ms is a good default for remotes + (setq wait (or wait 0.002)) (let ((start-time (float-time))) (save-excursion (while (or (accept-process-output proc wait) - (if (and sec-prompt (process-get proc 'sec-prompt)) - nil - (if force-redisplay (redisplay 'force)) + (unless (and sec-prompt (process-get proc 'sec-prompt)) (process-get proc 'busy))) - (if (> (- (float-time) start-time) .5) - (setq wait .5)))))) + (when force-redisplay + (redisplay 'force)) + (when (> (- (float-time) start-time) .5) + (setq wait .5)))))) (defun inferior-ess-ordinary-filter (proc string) (inferior-ess-set-status proc string t) @@ -1415,10 +1427,10 @@ OUT-BUFFER exists save the output in that buffer. OUT-BUFFER is erased before use. CMD should have a terminating newline. Guarantees that the value of `.Last.value' will be preserved. -When optional third arg SLEEP is non-nil, `(sleep-for (* a -SLEEP))' will be used in a few places where `a' is proportional -to `ess-cmd-delay'. WAIT and FORCE-REDISPLAY are as in -`ess-wait-for-process' and are passed to `ess-wait-for-process'. + +SLEEP is deprecated and no longer has any effect. WAIT and +FORCE-REDISPLAY are as in `ess-wait-for-process' and are passed +to `ess-wait-for-process'. PROC should be a process, if nil the process name is taken from `ess-local-process-name'. This command doesn't set 'last-eval @@ -1798,8 +1810,7 @@ Prefix arg VIS toggles visibility of ess-code as for `ess-eval-region'." (interactive "P") - (if (and transient-mark-mode mark-active ;; xemacs doesn't have use-region-p - (> (region-end) (region-beginning))) + (if (use-region-p) (ess-eval-region (region-beginning) (region-end) vis) (ess-eval-function-or-paragraph vis))) @@ -1812,8 +1823,7 @@ Prefix arg VIS toggles visibility of ess-code as for `ess-eval-region'." (interactive "P") - (if (and transient-mark-mode mark-active ;; xemacs doesn't have use-region-p - (> (region-end) (region-beginning))) + (if (use-region-p) (let ((end (region-end))) (ess-eval-region (region-beginning) end vis) (goto-char end)) @@ -1892,8 +1902,7 @@ evaluation of the line. " (interactive "P") - (if (and transient-mark-mode mark-active ;; xemacs doesn't have use-region-p - (> (region-end) (region-beginning))) + (if (use-region-p) (ess-eval-region (region-beginning) (region-end) vis) (ess-eval-line-and-step))) @@ -1997,7 +2006,7 @@ (define-key map "\C-c\034" 'ess-abort) ; \C-c\C-backslash (define-key map "\C-c\C-z" 'ess-switch-to-inferior-or-script-buffer) ; mask comint map (define-key map "\C-d" 'delete-char) ; EOF no good in S - (if (and (featurep 'emacs) (>= emacs-major-version 24)) + (if (>= emacs-major-version 24) (define-key map "\t" 'completion-at-point) (define-key map "\t" 'comint-dynamic-complete) (define-key map "\M-\t" 'comint-dynamic-complete)) @@ -2059,16 +2068,6 @@ )) - -(defun inferior-ess-mode-xemacs-menu () - "Hook to install `ess-mode' menu for XEmacs (w/ easymenu)." - (if 'inferior-ess-mode - (easy-menu-add inferior-ess-mode-menu) - (easy-menu-remove inferior-ess-mode-menu))) - -(if (string-match "XEmacs" emacs-version) - (add-hook 'inferior-ess-mode-hook 'inferior-ess-mode-xemacs-menu)) - (defvar ess-mode-minibuffer-map (let ((map (make-sparse-keymap))) (set-keymap-parent map minibuffer-local-map) @@ -2451,7 +2450,7 @@ Also sets the \"length\" option to 99999. When INVISIBLY is non-nil, don't echo to R subprocess. -This is a good thing to put in `ess-R-post-run-hook' or +This is a good thing to put in `ess-r-post-run-hook' or `ess-S+-post-run-hook'." (interactive) (if (null ess-execute-screen-options-command) @@ -2523,14 +2522,32 @@ also running \\[ess-cleanup]." (interactive) (ess-force-buffer-current "Process to quit: " nil 'no-autostart) + (ess-interrupt) (ess-make-buffer-current) (:override - (let ((sprocess (ess-get-process ess-current-process-name))) - (if (not sprocess) (error "No ESS process running")) + (let ((proc (ess-get-process))) (ess-cleanup) - (goto-char (marker-position (process-mark sprocess))) + (goto-char (marker-position (process-mark proc))) (insert inferior-ess-exit-command) - (process-send-string sprocess inferior-ess-exit-command)))) + (process-send-string proc inferior-ess-exit-command)))) + +(defun ess-interrupt () + "Interrupt the inferior process. +This sends an interrupt and quits a debugging session." + (interactive) + (inferior-ess-force) + (let ((proc (ess-get-process))) + ;; Interrupt current task before reloading. Useful if the process is + ;; prompting for input, for instance in R in case of a crash + (interrupt-process proc comint-ptyp) + ;; Workaround for Windows terminals + (unless (memq system-type '(gnu/linux darwin)) + (process-send-string nil "\n")) + (ess-wait-for-process proc) + ;; Quit debugging session before reloading + (when (ess-debug-active-p) + (ess-debug-command-quit) + (ess-wait-for-process proc)))) (defun ess-abort () "Kill the ESS process, without executing .Last or terminating devices. @@ -2574,11 +2591,30 @@ (ess-defgeneric inferior-ess-reload (&optional start-args) "Reload the inferior process." (interactive) - (let ((dir (ess-get-working-directory)) - (ess-ask-for-ess-directory nil)) - (:override - (error "Unimplemented for this dialect")) - (ess-set-working-directory dir))) + (inferior-ess-force) + ;; Interrupt early so we can get working directory + (ess-interrupt) + (save-window-excursion + ;; Make sure we don't ask for directory again + ;; Use current working directory as default + (let ((project-find-functions nil) + (ess-directory-function nil) + (ess-startup-directory (ess-get-working-directory)) + (ess-ask-for-ess-directory nil)) + (ess-quit 'no-save) + (inferior-ess--wait-for-exit (ess-get-process)) + (:override + (error "Unimplemented for this dialect"))))) + +(defun inferior-ess--wait-for-exit (proc) + "Wait for process exit. +This should be used instead of `ess-wait-for-process' for waiting +after issuing a quit command as the latter assumes a live process." + (let ((start-time (float-time))) + (while (eq (process-status proc) 'run) + (accept-process-output proc 0.002) + (when (> (- (float-time) start-time) 1) + (error "Timeout while quitting process"))))) (defun ess-kill-buffer-function () "Function run just before an ESS process buffer is killed." diff -Nru ess-16.10/lisp/ess-install.el ess-17.11/lisp/ess-install.el --- ess-16.10/lisp/ess-install.el 2014-10-28 18:15:42.000000000 +0000 +++ ess-17.11/lisp/ess-install.el 2017-11-13 14:13:16.000000000 +0000 @@ -49,7 +49,7 @@ ;; within Windows explorer and selecting "Extract all". On unix, use ;; "unzip ess-5.2.12.zip". ;; -;; 4. Start a new emacs (or xemacs). +;; 4. Start a new Emacs. ;; ;; 5. In the new emacs, you need to open the file "ess-install.el" which ;; is part of ESS. To do this, type: @@ -113,8 +113,8 @@ "Byte compile the ESS files. This will probably generate warnings, but they can hopefully be ignored." - ;; To do byte compilation, XEmacs seems to want the files on its - ;; load-path so that it can do the (require 'xyz) statements. + ;; To do byte compilation, we want the files on the + ;; load-path so that we can process the (require 'xyz) statements. (add-to-list 'load-path ess-lisp-dir) (byte-recompile-directory ess-lisp-dir 0)) @@ -122,10 +122,10 @@ ;; i.e. need to change c:\\some\\dir\\ess-site.el to ;; c:/some/dir/ess-site.el ;; To do this, we have to load in ess-replace-in-string, from -;; the file ess-inf.el +;; the file ess-utils.el (save-window-excursion - (find-file (concat ess-lisp-dir "ess-inf.el")) + (find-file (concat ess-lisp-dir "ess-utils.el")) (goto-char (point-min)) (search-forward-regexp "^(defun ess-replace-in-string " nil t) (eval-defun nil) @@ -152,14 +152,6 @@ ;; Only one highlight region is needed, whereas two are provided here, ;; so this code could be simplified. But we may want it again later. -;; Highlighting uses overlays. If this is for XEmacs, we need to load -;; the overlay library, available in version 19.15 -(and (not (fboundp 'make-overlay)) - (condition-case nil - (require 'overlay) - ('error - (error "Fm needs overlay emulation (available in XEmacs 19.15)")))) - ;; We keep a vector with several different overlays to do our highlighting. (defvar ess-highlight-overlays [nil nil]) diff -Nru ess-16.10/lisp/ess-julia.el ess-17.11/lisp/ess-julia.el --- ess-16.10/lisp/ess-julia.el 2016-10-22 16:03:27.000000000 +0000 +++ ess-17.11/lisp/ess-julia.el 2017-11-13 14:13:16.000000000 +0000 @@ -42,8 +42,9 @@ ;; ;;; Code: -(require 'compile); for compilation-* below +(require 'compile) (require 'ess-utils) +(require 'ess-r-mode) ;;;--- ALL the following only if julia-mode is found and loaded correctly : ---------- (condition-case nil @@ -117,6 +118,13 @@ ;;; 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)) @@ -257,7 +265,7 @@ (ess-process-live-p) (not (ess-process-get 'busy))) (let ((funname (or (and ess-eldoc-show-on-symbol ;; aggressive completion - (ess-symbol-at-point)) + (symbol-name (ess-symbol-at-point))) (car (ess--funname.start))))) (when funname (let* ((args (copy-sequence (nth 2 (ess-function-arguments funname)))) @@ -271,8 +279,8 @@ (setq doc (concat doc " " (pop args)))) (when (and args (< (length doc) W)) - (setq doc (concat doc " {--}")))) - doc))))) + (setq doc (concat doc " {--}"))) + doc)))))) ;;; IMENU @@ -308,7 +316,7 @@ (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-R-objects-command) + ;; (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") @@ -317,18 +325,17 @@ (ess-suffix . "jl") (ess-ac-sources . '(ac-source-ess-julia-objects)) (ess-company-backends . '(company-ess-julia-objects)) - (ess-dump-filename-template . (ess-replace-regexp-in-string - "S$" ess-suffix ; in the one from custom: - ess-dump-filename-template-proto)) + (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-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-cmd-delay . ess-R-cmd-delay) - (ess-function-pattern . ess-R-function-pattern) + (ess-function-pattern . ess-r-function-pattern) (ess-object-name-db-file . "ess-jl-namedb.el" ) - (ess-smart-operators . ess-R-smart-operators) + (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? @@ -336,8 +343,8 @@ (inferior-ess-start-args . "") (inferior-ess-language-start . nil) (ess-STERM . "iESS") - (ess-editor . R-editor) - (ess-pager . R-pager) + (ess-editor . ess-r-editor) + (ess-pager . ess-r-pager) (ess-getwd-command . "pwd()\n") (ess-setwd-command . "cd(expanduser(\"%s\"))\n") ) @@ -408,6 +415,7 @@ (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) @@ -416,6 +424,11 @@ (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)) diff -Nru ess-16.10/lisp/ess-menu.el ess-17.11/lisp/ess-menu.el --- ess-16.10/lisp/ess-menu.el 2014-10-28 18:15:42.000000000 +0000 +++ ess-17.11/lisp/ess-menu.el 1970-01-01 00:00:00.000000000 +0000 @@ -1,162 +0,0 @@ -;;; ess-menu.el --- Menu and Speedbar support for statistical -;;; programming and analysis - -;; Copyright (C) 2000--2005 A.J. Rossini, Richard M. Heiberger, Martin -;; Maechler, Kurt Hornik, Rodney Sparapani, and Stephen Eglen. - -;; Author: A.J. Rossini -;; Created: September 4, 2000 -;; Maintainer: ESS Core Team - -;; Keywords: statistics, languages - -;; Summary: general functions 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: - - ;;*;; Requires and autoloads -;;;===================================================== - -(require 'ess-custom) -(if (and (featurep 'xemacs); need this, since require in XEmacs has only 2 arg - (not (require 'imenu "imenu.elc"))) - (message "** warning: 'imenu not available for this version of XEmacs")) - -;;(defgroup ess-menu nil -;; "ESS: object menu systems." -;; :group 'ess -;; :prefix "ess-") - - - ;;; Function Menu (func-menu) for XEmacs: - -;; (if ess-funcmenu-use-p -;; (defvar fume-function-name-regexp-S -;; (append -;; '((s-mode . fume-function-name-regexp-smode) -;; (r-mode . fume-function-name-regexp-smode)) -;; fume-function-name-regexp-alist) -;; "Expression to get function names")) - - ;;; Imenu for Emacs/XEmacs... - -;;; XLS imenu support - -;; (defun ess-imenu-XLS (&optional arg) -;; "XLispStat Language Imenu support for ESS." -;; (interactive) -;; (setq imenu-generic-expression -;; '( (nil "New one needed" 1))) -;; (imenu-add-to-menubar "XLS-fcts")) - -;; (defun imenu-example--XLS-extract-index-name () -;; ;; Example of a candidate for `imenu-extract-index-name-function'. -;; ;; This will generate a flat index of definitions in a lisp file. -;; (save-match-data -;; (and (looking-at "(def") -;; (condition-case nil -;; (progn -;; (down-list 1) -;; (forward-sexp 2) -;; (let ((beg (point)) -;; (end (progn (forward-sexp -1) (point)))) -;; (buffer-substring beg end))) -;; (error nil))))) - -;; (defun imenu-example--create-XLS-index () -;; ;; Example of a candidate for `imenu-create-index-function'. -;; ;; It will generate a nested index of definitions. -;; (let ((index-alist '()) -;; (index-var-alist '()) -;; (index-type-alist '()) -;; (index-unknown-alist '()) -;; prev-pos) -;; (goto-char (point-max)) -;; (imenu-progress-message prev-pos 0) -;; ;; Search for the function -;; (while (beginning-of-defun) -;; (imenu-progress-message prev-pos nil t) -;; (save-match-data -;; (and (looking-at "(def") -;; (save-excursion -;; (down-list 1) -;; (cond -;; ((looking-at "def\\(var\\|const\\)") -;; (forward-sexp 2) -;; (push (imenu-example--name-and-position) -;; index-var-alist)) -;; ((looking-at "def\\(un\\|subst\\|macro\\|advice\\)") -;; (forward-sexp 2) -;; (push (imenu-example--name-and-position) -;; index-alist)) -;; ((looking-at "def\\(type\\|struct\\|class\\|ine-condition\\)") -;; (forward-sexp 2) -;; (if (= (char-after (1- (point))) ?\)) -;; (progn -;; (forward-sexp -1) -;; (down-list 1) -;; (forward-sexp 1))) -;; (push (imenu-example--name-and-position) -;; index-type-alist)) -;; (t -;; (forward-sexp 2) -;; (push (imenu-example--name-and-position) -;; index-unknown-alist))))))) -;; (imenu-progress-message prev-pos 100) -;; (and index-var-alist -;; (push (cons "Variables" index-var-alist) -;; index-alist)) -;; (and index-type-alist -;; (push (cons "Types" index-type-alist) -;; index-alist)) -;; (and index-unknown-alist -;; (push (cons "Syntax-unknown" index-unknown-alist) -;; index-alist)) -;; index-alist)) - -;; (defun ess-imenu-STA (&optional arg) -;; "Stata Language Imenu support for ESS." -;; (interactive) -;; (setq imenu-generic-expression -;; '( (nil "New one needed" 1))) -;; (imenu-add-to-menubar "Stata-fcts")) - - ; Run load hook and provide package - -(provide 'ess-menu) - - ; Local variables section - -;;; This file is automatically placed in Outline minor mode. -;;; The file is structured as follows: -;;; Chapters: ^L ; -;;; Sections: ;;*;; -;;; Subsections: ;;;*;;; -;;; Components: defuns, defvars, defconsts -;;; Random code beginning with a ;;;;* comment - -;;; Local variables: -;;; mode: emacs-lisp -;;; mode: outline-minor -;;; outline-regexp: "\^L\\|\\`;\\|;;\\*\\|;;;\\*\\|(def[cvu]\\|(setq\\|;;;;\\*" -;;; End: - -;;; ess-menu.el ends here diff -Nru ess-16.10/lisp/ess-mode.el ess-17.11/lisp/ess-mode.el --- ess-16.10/lisp/ess-mode.el 2016-10-22 16:03:27.000000000 +0000 +++ ess-17.11/lisp/ess-mode.el 2017-11-13 14:13:16.000000000 +0000 @@ -3,7 +3,7 @@ ;; Copyright (C) 1989-1994 Doug Bates, Ed Kademan, Frank Ritter, David 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, +;; Copyright (C) 2011--2017 A.J. Rossini, Richard M. Heiberger, Martin Maechler, ;; Kurt Hornik, Rodney Sparapani, Stephen Eglen and Vitalie Spinu. ;; Author: David Smith @@ -32,22 +32,20 @@ ;;; Code: -(require 'cl) -(require 'ess-generics) +;; We can't use cl-lib whilst supporting Emacs <= 24.2 users +(with-no-warnings (require 'cl)) +(require 'ess-custom) (require 'ess-utils) +(require 'ess-generics) +(require 'ess-inf) -(autoload 'ess-turn-on-eldoc "ess-r-d" "" nil) -(autoload 'SAS-menu "ess-sas-d.el" "(autoload)" t) +;; FIXME: should this be optional? +(require 'ess-noweb-mode) -(defun ess-line-end-position (&optional N) - "return the 'point' at the end of N lines. N defaults to 1, i.e., current line." - (save-excursion - (end-of-line N) - (point))) +(autoload 'SAS-menu "ess-sas-d.el" "(autoload)" t) + ; ESS mode - -;;; ESS mode ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;; In this section: ;;;; @@ -59,12 +57,11 @@ ;;*;; Major mode definition - (defvar ess-mode-map (let ((map (make-sparse-keymap))) ;; By popular demand: - (define-key map "\C-m" 'ess-newline-and-indent); = [RETURN] + (define-key map (kbd "RET") 'ess-newline-and-indent) (define-key map [remap yank] 'ess-yank) (define-key map "\C-c\C-r" 'ess-eval-region) @@ -83,7 +80,7 @@ (define-key map "\C-c\C-j" 'ess-eval-line) (define-key map [(control return)] 'ess-eval-region-or-line-and-step) (define-key map "\C-c\M-j" 'ess-eval-line-and-go) - ;; the next three can only work in S/R - mode {FIXME} + ;; FIXME: The next three can only work in S/R - mode (define-key map "\C-\M-a" 'ess-goto-beginning-of-function-or-para) (define-key map "\C-\M-e" 'ess-goto-end-of-function-or-para) (define-key map "\C-xnd" 'ess-narrow-to-defun-or-para) @@ -91,36 +88,25 @@ (define-key map "\C-c\C-y" 'ess-switch-to-ESS-deprecated) (define-key map "\C-c\C-z" 'ess-switch-to-inferior-or-script-buffer) (define-key map "\C-c\C-l" 'ess-load-file) - (define-key map "\C-c\M-l" 'ess-load-file); alias, as in 'iESS' where C-c C-l is comint-list-* + ;;; Make an alias because C-c C-l is taken up by comint in inferiors + (define-key map "\C-c\M-l" 'ess-load-file) (define-key map "\C-c\C-v" 'ess-display-help-on-object) - ;;(define-key map "\C-c5\C-d"'ess-dump-object-into-edit-buffer-other-frame) - (define-key map "\C-c\C-s" 'ess-switch-process) ; use a - ;; different process for the buffer. - ;; (define-key map "\C-c\C-t" 'ess-execute-in-tb) + (define-key map "\C-c\C-s" 'ess-switch-process) (define-key map "\C-c\t" 'ess-complete-object-name-deprecated) - ;;M (define-key map "\C-c\t" 'comint-dynamic-complete-filename) - (unless (and (featurep 'emacs) (>= emacs-major-version 24)) + (unless (>= emacs-major-version 24) (define-key map "\M-\t" 'comint-dynamic-complete)) (define-key map "\M-?" 'ess-list-object-completions) - ;; wrong here (define-key map "\C-c\C-k" 'ess-request-a-process) (define-key map "\C-c\C-k" 'ess-force-buffer-current) (define-key map "\C-c`" 'ess-show-traceback) (define-key map [(control ?c) ?~] 'ess-show-call-stack) - (define-key map "\C-c." (lambda () (interactive) (message "ess-set-style moved to C-c C-e C-s. Sorry for the inconvenience"))) (define-key map "{" 'ess-electric-brace) (define-key map "}" 'ess-electric-brace) (define-key map "\C-\M-q" 'ess-indent-exp) (define-key map "\C-\M-h" 'ess-mark-function-or-para) - (if (featurep 'xemacs) ;; work around Xemacs bug (\C-\M-h redefines M-BS): - (define-key map [(meta backspace)] 'backward-kill-word)) - ;;(define-key map [delete] 'backward-delete-char-untabify) (define-key map "\t" 'ess-indent-or-complete) (define-key map "\C-c\C-q" 'ess-quit) (define-key map "\M-\r" 'ess-use-this-dir) - - ;; smart operators; most likely will go in the future into a separate local map (define-key map "," 'ess-smart-comma) - (define-key map "\C-c\C-d" 'ess-doc-map) (define-key map "\C-c\C-e" 'ess-extra-map) (define-key map "\C-c\C-t" 'ess-dev-map) @@ -132,22 +118,6 @@ 'ess-indent-new-comment-line ess-mode-map global-map) -(defvar ess-eval-map - (let ((map (make-sparse-keymap))) - ;; (define-key map "\C-r" 'ess-eval-region) - ;; (define-key map "\M-r" 'ess-eval-region-and-go) - ;; (define-key map "\C-b" 'ess-eval-buffer) - ;; (define-key map "\M-b" 'ess-eval-buffer-and-go) - ;; (define-key map "\C-f" 'ess-eval-function) - ;; (define-key map "\M-f" 'ess-eval-function-and-go) - ;; (define-key map "\C-x" 'ess-eval-function) - ;; (define-key map "\C-n" 'ess-eval-line-and-step) - ;; (define-key map "\C-j" 'ess-eval-line) - ;; (define-key map "\M-j" 'ess-eval-line-and-go) - map) - "Keymap for ess-eval functions.") -(make-obsolete-variable 'ess-eval-map nil "ESS[12.09.1]") - (defvar ess-extra-map (let (ess-extra-map) (define-prefix-command 'ess-extra-map) @@ -171,9 +141,6 @@ ess-extra-map) "ESS extra map") - -(require 'ess-noweb-mode) - (easy-menu-define ess-mode-menu ess-mode-map "Menu for use in `ess-mode'." @@ -192,9 +159,8 @@ ["Switch Process" ess-switch-process t] ["Recreate R and S versions known to ESS" (ess-r-s-versions-creation+menu) t] ("Start Process" - ;; SJE - :help not yet recognised in XEmacs. - ["R" R t] ;; :help "Start a new R process" :active t - ["S" S t] ;; :help "Start a new S process" :active t + ["R" R :help "Start a new R process" :active t] + ["S" S :help "Start a new S process" :active t] ["Sqpe" Sqpe ess-microsoft-p] ;; :help "Start a new Sqpe process" :active t ["S+6-exisiting" S+6-existing ess-microsoft-p] ;; :help "Access an existing S process" :active t ["SAS" SAS-menu t] ;; :help "Start a new SAS process" :active t @@ -274,17 +240,7 @@ ["Describe" describe-mode t] ["About editing" (ess-goto-info "Editing") t] ["Read ESS info" (ess-goto-info "") t] - ["Send bug report" ess-submit-bug-report t] - )) - -(defun ess-mode-xemacs-menu () - "Hook to install `ess-mode' menu for XEmacs (w/ easymenu)." - (if 'ess-mode - (easy-menu-add ess-mode-menu) - (easy-menu-remove ess-mode-menu))) - -(if (featurep 'xemacs) - (add-hook 'ess-mode-hook 'ess-mode-xemacs-menu)) + ["Send bug report" ess-submit-bug-report t])) (defun ess-mode (&optional alist proc-name is-derived) "Major mode for editing ESS source. @@ -372,6 +328,7 @@ (unless is-derived (kill-all-local-variables)) ;; NOTICE THIS! *** NOTICE THIS! *** NOTICE THIS! *** (ess-setq-vars-local alist) + ;; fixme: This is dialect-specific ;; must happen here, since the mode map is set up too early: (if ess-r-args-electric-paren (define-key ess-mode-map "(" 'ess-r-args-auto-show)) (ess-write-to-dribble-buffer @@ -409,27 +366,18 @@ ess--local-mode-line-process-indicator "]")) ;; completion - (if (and (featurep 'emacs) - (>= emacs-major-version 24)) + (if (>= emacs-major-version 24) (add-hook 'completion-at-point-functions 'ess-filename-completion nil 'local) (add-hook 'comint-dynamic-complete-functions 'ess-complete-filename nil 'local) - (delq t comint-dynamic-complete-functions) - ) + (delq t comint-dynamic-complete-functions)) (set (make-local-variable 'comint-completion-addsuffix) (cons "/" "")) - ;; timer + (add-hook 'ess-idle-timer-functions 'ess-synchronize-dirs nil 'local) -;;; extras (ess-load-extras) - ;; SJE Tue 28 Dec 2004: do not attempt to load object name db. - ;; (ess-load-object-name-db-file) - (if (> emacs-major-version 21) - (run-mode-hooks 'ess-mode-hook) - ;; old emacs 21.x - (run-hooks 'ess-mode-hook)) + (run-mode-hooks 'ess-mode-hook) (ess-write-to-dribble-buffer "\nFinished setting up ESS-mode.\n")) - (defun ess--get-mode-line-indicator () "Get `ess--mode-line-process-indicator' from process buffer. Internal function to be used for dynamic mode-line dysplay in @@ -442,104 +390,59 @@ "none")) "none")) - -;;*;; User commands in ess-mode +;;*;; Dispatching infrastructure for dialects -;;;*;;; Handy commands +(defvar ess--make-local-vars-permanent nil + "If this variable is non-nil in a buffer make all variable permannet. +Used in noweb modes.") +(make-variable-buffer-local 'ess--make-local-vars-permanent) +(put 'ess--make-local-vars-permanent 'permanent-local t) + +(defun ess-setq-vars-local (alist &optional buf) + "Set language variables from ALIST, in buffer BUF, if desired." + (if buf (set-buffer buf)) + (mapc (lambda (pair) + (make-local-variable (car pair)) + (set (car pair) (eval (cdr pair))) + (when ess--make-local-vars-permanent + (put (car pair) 'permanent-local t)) ;; hack for Rnw + ) + alist) + (ess-write-to-dribble-buffer + (format "(ess-setq-vars-LOCAL): language=%s, dialect=%s, buf=%s, comint..echoes=%s, comint..sender=%s\n" + ess-language ess-dialect buf comint-process-echoes comint-input-sender))) -(defun ess-execute-in-tb () - "Like `ess-execute', but always evaluates in temp buffer." - (interactive) - (let ((ess-execute-in-process-buffer nil)) - (call-interactively 'ess-execute))) +(defun ess-setq-vars-default (alist &optional buf) + "Set language variables from ALIST, in buffer BUF, if desired." + (ess-write-to-dribble-buffer + (format "ess-setq-vars-default 0: ess-language=%s, -dialect=%s, buf=%s, comint..echoes=%s, comint..sender=%s\n" + ess-language ess-dialect buf comint-process-echoes comint-input-sender)) + (if buf (set-buffer buf)) + (mapc (lambda (pair) + (set-default (car pair) (eval (cdr pair)))) + alist) + (ess-write-to-dribble-buffer + (format "ess-setq-vars-default 1: ess-language=%s, -dialect=%s, buf=%s, comint..echoes=%s, comint..sender=%s\n" + ess-language ess-dialect buf comint-process-echoes comint-input-sender))) -(defun ess-goto-line (line) - (save-restriction - (widen) - (goto-char (point-min)) - (forward-line (1- line)))) + +;;*;; User commands in ess-mode -(defun ess-containing-sexp-position () - (cadr (syntax-ppss))) +;;;*;;; Miscellaneous -(defun ess-code-end-position () - "Like (line-end-position) but stops at comments" - (save-excursion - (or (and (re-search-forward "#" (line-end-position) t) - (match-beginning 0)) - (line-end-position)))) - -;;;*;;; Buffer motion/manipulation commands - -(defvar ess-set-function-start - ;; setAs, setGeneric; setMethod, setReplaceMethod, setGroupMethod - "^set[MGAR][Ma-z]+\\s-?(" - ) - -;; common R and S -;; SJE: 2007-07-16 add to quieten byte-compiler. -(defvar ess-function-pattern nil - "Regexp to match the beginning of a function in S buffers.") - -(defvar ess-R-symbol-pattern - "\\(\\sw\\|\\s_\\)" - "The regular expression for matching an R symbol") - -(defvar ess-R-name-pattern - (concat "\\(" ess-R-symbol-pattern "+\\|\\(`\\).+`\\)") - "The regular expression for matching a R name.") - -(let* - ((Q "\\s\"") ; quote - (repl "\\(<-\\)?") ; replacement (function) - (Sym-0 "\\(\\sw\\|\\s_\\)") ; symbol - (Symb (concat Sym-0 "+")) - (xSymb "[^ \t\n\"']+") ;; (concat "\\[?\\[?" Sym-0 "*")); symbol / [ / [[ / [symbol / [[symbol - ;; FIXME: allow '%foo%' but only when quoted; don't allow [_0-9] at beg. - (_or_ "\\)\\|\\(") ; OR - (space "\\(\\s-\\|\n\\)*") ; white space - - (part-1 (concat - "\\(" ;;--------outer Either------- - "\\(\\(" ; EITHER - Q xSymb Q ; any function name between quotes - _or_ - "\\(^\\|[ ]\\)" Symb ; (beginning of name) + ess-R-symbol-pattern - "\\)\\)")) ; END EITHER OR - - (set-S4-exp - (concat - "^set\\(As\\|Method\\|Generic\\|GroupMethod\\|ReplaceMethod\\)(" ; S4 ... - Q xSymb Q "," space - ;; and now often `` signature(......), : '' - ".*" ;; <<< FIXME ??? - )) - - (part-2 (concat - "\\|" ;;--------outer Or --------- - set-S4-exp - "\\)" ;;--------end outer Either/Or------- - - "\\(" space "\\s<.*\\s>\\)*" ; whitespace, comment - ;; FIXME: in principle we should skip 'definition *= *' here - space "function\\s-*(" ; whitespace, function keyword, parenthesis - )) - ) +(defun ess-install-library () + "Install library/package for current dialect. +Currently works only for R." + (interactive) + (cond + ((fboundp ess-install-library-function) + (funcall ess-install-library-function)) + (t + (error "Sorry, not available for %s" ess-dialect)))) - (defvar ess-R-function-pattern - (concat part-1 - "\\s-*\\(<-\\|=\\)" ; whitespace, assign - part-2) - "The regular expression for matching the beginning of an R function.") - - (defvar ess-S-function-pattern - (concat part-1 - "\\s-*\\(<-\\|_\\|=\\)" ; whitespace, assign (incl. "_") - part-2) - "The regular expression for matching the beginning of an S function.") - ); {end let} +;;;*;;; Motion / manipulation commands (defun ess-beginning-of-function (&optional no-error) "Leave (and return) the point at the beginning of the current ESS function. @@ -547,7 +450,7 @@ it cannot find a function beginning." ;; FIXME: should not throw error in accordance with beginning-of-defun and ;; beginning-of-defun-function specification - + ;; FIXME: should __WORK__ in the crucial case: large function w/ internal function defs (interactive) (let ((init-point (point)) (in-set-S4 nil) @@ -574,7 +477,7 @@ init-point (- end init-point))) (if (and (> end 1) (re-search-backward ;; in case of setMethod() etc .. - ess-set-function-start + ess-r-set-function-start ;; at most 1 line earlier {2 is too much: finds previous sometimes} (+ 1 (ess-line-end-position -1)) t)) @@ -615,7 +518,7 @@ (ess-write-to-dribble-buffer (format "\tMatch,Pt:(%d,%d),%d\n" (match-beginning 0) (match-end 0) beg)) - (setq in-set-S4 (looking-at ess-set-function-start)) + (setq in-set-S4 (looking-at ess-r-set-function-start)) (forward-list 1) ; get over arguments ;; The following used to bomb "Unbalanced parentheses", n1, n2 @@ -637,7 +540,7 @@ (setq beginning (ess-beginning-of-function no-error))) (if beginning ;; *hack* only for S (R || S+): are we in setMethod(..) etc? - (let ((in-set-S4 (looking-at ess-set-function-start)) + (let ((in-set-S4 (looking-at ess-r-set-function-start)) (end-pos) (npos)) (ess-write-to-dribble-buffer (format "ess-END-of-fun: S4=%s, beginning = %d\n" in-set-S4 beginning)) @@ -711,151 +614,36 @@ (t (indent-new-comment-line)))) - -;;*;; Loading files - -(defun ess-check-modifications nil - "Check whether loading this file would overwrite some ESS objects -which have been modified more recently than this file, and confirm -if this is the case." - ;; FIXME: this should really cycle through all top-level assignments in - ;; the buffer - ;;VS[02-04-2012|ESS 12.03]: this is sooo ugly - (when (> (length ess-change-sp-regexp) 0) - (and (buffer-file-name) ess-filenames-map - (let ((sourcemod (nth 5 (file-attributes (buffer-file-name)))) - (objname)) - (save-excursion - (goto-char (point-min)) - ;; Get name of assigned object, if we can find it - (setq objname - (and - (re-search-forward - "^\\s *\"?\\(\\(\\sw\\|\\s_\\)+\\)\"?\\s *[<_]" - nil - t) - (buffer-substring (match-beginning 1) - (match-end 1))))) - (and - sourcemod ; the file may have been deleted - objname ; may not have been able to - ; find name - (ess-modtime-gt (ess-object-modtime objname) sourcemod) - (not (y-or-n-p - - (format - "The ESS object %s is newer than this file. Continue?" - objname))) - (error "Aborted")))))) - -(defun ess-check-source (fname) - "If file FNAME has an unsaved buffer, offer to save it. -Returns t if the buffer existed and was modified, but was not saved." - (let ((buff (get-file-buffer fname))) - ;; RMH: Corrections noted below are needed for C-c C-l to work - ;; correctly when issued from *S* buffer. - ;; The following barfs since - ;; 1. `if' does not accept a buffer argument, `not' does. - ;; 2. (buffer-file-name) is not necessarily defined for *S* - ;;(if buff - ;; (let ((deleted (not (file-exists-p (buffer-file-name))))) - ;; Next 2 lines are RMH's solution: - (if (not(not buff)) - (let ((deleted (not (file-exists-p fname)))) - (if (and deleted (not (buffer-modified-p buff))) - ;; Buffer has been silently deleted, so silently save - (with-current-buffer buff - (set-buffer-modified-p t) - (save-buffer)) - (if (and (buffer-modified-p buff) - (or ess-mode-silently-save - (y-or-n-p - (format "Save buffer %s first? " - (buffer-name buff))))) - (with-current-buffer buff - (save-buffer)))) - (buffer-modified-p buff))))) - -(defvar ess-error-regexp "^\\(Syntax error: .*\\) at line \\([0-9]*\\), file \\(.*\\)$" - "Regexp to search for errors.") - -(defun ess-parse-errors (&optional showerr reset) - "Jump to error in last loaded ESS source file. -With prefix argument, only shows the errors ESS reported." - ;; reset argument is for compatibility with emacs next-error (tracebug - ;; rebinds ess-parse-errors to next-error), This silences the compiler. - (interactive "P") - (ess-make-buffer-current) - (let ((errbuff (get-buffer ess-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 - ;; FIXME: R does not give "useful" error messages - - ;; ----- by default: We (ESS) could try to use a more useful one, via - ;; options(error=essErrorHandler) - ess-error-regexp - nil - t) - (let* ((filename (buffer-substring (match-beginning 3) (match-end 3))) - (fbuffer (get-file-buffer filename)) - (linenum - (string-to-number - (buffer-substring (match-beginning 2) (match-end 2)))) - (errmess (buffer-substring (match-beginning 1) (match-end 1)))) - (if showerr - (ess-display-temp-buffer errbuff) - (if fbuffer nil - (setq fbuffer (find-file-noselect filename)) - (with-current-buffer fbuffer - (ess-mode))) - (pop-to-buffer fbuffer) - (ess-goto-line linenum)) - (princ errmess t)) - (message "Not a syntax error.") - (ess-display-temp-buffer errbuff))))) +;;;*;;; Formatting / indentation - -;;*;; ESS code formatting/indentation - -;;;*;;; User commands +(defun ess-set-style (&optional style quiet) + "Set up the `ess-mode' style variables from the `ess-style' variable +or if STYLE argument is given, use that. It makes the ESS indentation +style variables buffer local." -(defun ess-electric-brace (arg) - "Insert character and correct line's indentation." - (interactive "P") - ;; skeleton-pair takes precedence - (if (fboundp 'skeleton-pair-insert-maybe) - (skeleton-pair-insert-maybe "{") - ;; else - (let (insertpos) - (if (and (not arg) - (eolp) - (or (save-excursion - (skip-chars-backward " \t") - (bolp)) - (if ess-auto-newline (progn (ess-indent-line) (newline) t) nil))) - (progn - (insert (if (featurep 'xemacs) (event-to-character last-command-event) last-command-event)) - (ess-indent-line) - (if ess-auto-newline - (progn - (newline) - ;; (newline) may have done auto-fill - (setq insertpos (- (point) 2)) - (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)))))) + (interactive) + (let ((ess-styles (mapcar 'symbol-name (mapcar 'car ess-style-alist)))) + (unless style + (setq style + (intern (ess-completing-read "Set ESS mode indentation style" + ess-styles nil t nil nil ess-default-style)))) + (setq style (or style ess-style)) + (make-local-variable 'ess-style) + (if (memq (symbol-name style) ess-styles) + (setq ess-style style) + (error (format "Bad ESS style: %s" style))) + (if (not quiet) + (message "ESS-style: %s" ess-style)) + ;; finally, set the indentation style variables making each one local + (mapc (lambda (ess-style-pair) + (make-local-variable (car ess-style-pair)) + (set (car ess-style-pair) + (cdr ess-style-pair))) + (cdr (assq ess-style ess-style-alist))) + ess-style)) -;; fixeme: move into ess-indent-or-complete, indentation functions are overly +;; FIXME: Move into ess-indent-or-complete, indentation functions are overly ;; scattered around (defun ess-indent-command (&optional whole-exp) "Indent current line as ESS code, or in some cases insert a tab character. @@ -917,7 +705,7 @@ (and (eq ess-first-tab-never-complete 'symbol-or-paren-or-punct) (not (looking-at "\\w\\|\\s_\\|\\s)\\|\\s."))) )) - (if (and (featurep 'emacs) (>= emacs-major-version 24)) + (if (>= emacs-major-version 24) (completion-at-point) (comint-dynamic-complete) ))))) @@ -945,39 +733,144 @@ ;; else S and R default behavior (ess-r-indent-line))) +(defun ess-electric-brace (arg) + "Insert character and correct line's indentation." + (interactive "P") + ;; skeleton-pair takes precedence + (if (fboundp 'skeleton-pair-insert-maybe) + (skeleton-pair-insert-maybe "{") + ;; else + (let (insertpos) + (if (and (not arg) + (eolp) + (or (save-excursion + (skip-chars-backward " \t") + (bolp)) + (if ess-auto-newline (progn (ess-indent-line) (newline) t) nil))) + (progn + (insert last-command-event) + (ess-indent-line) + (if ess-auto-newline + (progn + (newline) + ;; (newline) may have done auto-fill + (setq insertpos (- (point) 2)) + (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)))))) + -;;;*;;; Predefined indentation styles +;;*;; Loading files -(defun ess-set-style (&optional style quiet) - "Set up the `ess-mode' style variables from the `ess-style' variable -or if STYLE argument is given, use that. It makes the ESS indentation -style variables buffer local." +(defun ess-check-modifications nil + "Check whether loading this file would overwrite some ESS objects +which have been modified more recently than this file, and confirm +if this is the case." + ;; FIXME: this should really cycle through all top-level assignments in + ;; the buffer + ;;VS[02-04-2012|ESS 12.03]: this is sooo ugly + (when (> (length ess-change-sp-regexp) 0) + (and (buffer-file-name) ess-filenames-map + (let ((sourcemod (nth 5 (file-attributes (buffer-file-name)))) + (objname)) + (save-excursion + (goto-char (point-min)) + ;; Get name of assigned object, if we can find it + (setq objname + (and + (re-search-forward + "^\\s *\"?\\(\\(\\sw\\|\\s_\\)+\\)\"?\\s *[<_]" + nil + t) + (buffer-substring (match-beginning 1) + (match-end 1))))) + (and + sourcemod ; the file may have been deleted + objname ; may not have been able to + ; find name + (ess-modtime-gt (ess-object-modtime objname) sourcemod) + (not (y-or-n-p - (interactive) - (let ((ess-styles (mapcar 'symbol-name (mapcar 'car ess-style-alist)))) - (unless style - (setq style - (intern (ess-completing-read "Set ESS mode indentation style" - ess-styles nil t nil nil ess-default-style)))) - (setq style (or style ess-style)) - (make-local-variable 'ess-style) - (if (memq (symbol-name style) ess-styles) - (setq ess-style style) - (error (format "Bad ESS style: %s" style))) - (if (not quiet) - (message "ESS-style: %s" ess-style)) - ;; finally, set the indentation style variables making each one local - (mapc (lambda (ess-style-pair) - (make-local-variable (car ess-style-pair)) - (set (car ess-style-pair) - (cdr ess-style-pair))) - (cdr (assq ess-style ess-style-alist))) - ess-style)) + (format + "The ESS object %s is newer than this file. Continue?" + objname))) + (error "Aborted")))))) + +(defun ess-check-source (fname) + "If file FNAME has an unsaved buffer, offer to save it. +Returns t if the buffer existed and was modified, but was not saved." + (let ((buff (get-file-buffer fname))) + ;; RMH: Corrections noted below are needed for C-c C-l to work + ;; correctly when issued from *S* buffer. + ;; The following barfs since + ;; 1. `if' does not accept a buffer argument, `not' does. + ;; 2. (buffer-file-name) is not necessarily defined for *S* + ;;(if buff + ;; (let ((deleted (not (file-exists-p (buffer-file-name))))) + ;; Next 2 lines are RMH's solution: + (if (not(not buff)) + (let ((deleted (not (file-exists-p fname)))) + (if (and deleted (not (buffer-modified-p buff))) + ;; Buffer has been silently deleted, so silently save + (with-current-buffer buff + (set-buffer-modified-p t) + (save-buffer)) + (if (and (buffer-modified-p buff) + (or ess-mode-silently-save + (y-or-n-p + (format "Save buffer %s first? " + (buffer-name buff))))) + (with-current-buffer buff + (save-buffer)))) + (buffer-modified-p buff))))) + +(defvar ess-error-regexp "^\\(Syntax error: .*\\) at line \\([0-9]*\\), file \\(.*\\)$" + "Regexp to search for errors.") + +(defun ess-parse-errors (&optional showerr reset) + "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." + (interactive "P") + (ess-make-buffer-current) + (let ((errbuff (get-buffer ess-error-buffer-name))) + (when (not errbuff) + (error "You need to do a load first!")) + (set-buffer errbuff) + (goto-char (point-max)) + ;; FIXME: R does not give "useful" error messages by default. We + ;; could try to use a more useful one, via + ;; options(error=essErrorHandler) + (cond ((re-search-backward ess-error-regexp nil t) + (let* ((filename (buffer-substring (match-beginning 3) (match-end 3))) + (fbuffer (get-file-buffer filename)) + (linenum + (string-to-number + (buffer-substring (match-beginning 2) (match-end 2)))) + (errmess (buffer-substring (match-beginning 1) (match-end 1)))) + (if showerr + (ess-display-temp-buffer errbuff) + (if fbuffer nil + (setq fbuffer (find-file-noselect filename)) + (with-current-buffer fbuffer + (ess-mode))) + (pop-to-buffer fbuffer) + (ess-goto-line linenum)) + (princ errmess t))) + (t + (message "Not a syntax error.") + (ess-display-temp-buffer errbuff))))) ;;*;; Creating and manipulating dump buffers -;;;*;;; The user command (defun ess-dump-object-into-edit-buffer (object) "Edit an ESS object in its own buffer. @@ -1093,10 +986,46 @@ (down-list 1) (error nil))))))) -;; AJR: XEmacs, makes sense to dump into "other frame". -(defun ess-dump-object-into-edit-buffer-other-frame (object) - "Edit an ESS object in its own frame." - (switch-to-buffer-other-frame (ess-dump-object-into-edit-buffer object))) +(defun ess-version () + (interactive) + (message (format "ess-version: %s (loaded from %s)" + (ess-version-string) + (file-name-directory ess-lisp-directory)))) + +(defun ess-version-string () + (let* ((ess-dir (file-name-directory ess-lisp-directory)) ; if() the top-level 'ess/' + (is-release (file-exists-p (concat ess-etc-directory ".IS.RELEASE"))) + (rel-string (if is-release "Released ")) + (git-ref-fn (concat ess-dir ".git/HEAD")) + (git-ref (when (file-exists-p git-ref-fn) + (with-current-buffer (find-file-noselect git-ref-fn) + (goto-char (point-min)) + (when (re-search-forward "ref: \\(.*\\)\n" nil t) + (match-string 1))))) + (git-fname (if git-ref + (concat ess-dir ".git/" git-ref) + ;; For release + (concat ess-etc-directory "git-ref"))) + (git-rev (when (file-exists-p git-fname) + (with-current-buffer (find-file-noselect git-fname) + (goto-char (point-min)) + (concat "git: "(buffer-substring 1 (point-at-eol)))))) + (elpa-fname (concat ess-dir "ess-pkg.el")) + (elpa-rev (when (file-exists-p elpa-fname) + ;; Get it from ELPA dir name, (probably won't work if installed manually) + (concat "elpa: " + (replace-regexp-in-string "ess-" "" + (file-name-nondirectory + (substring ess-dir 1 -1))))))) + ;; Set the "global" ess-revision: + (setq ess-revision (format "%s%s%s" + (or rel-string "") + (or git-rev "") + (or elpa-rev ""))) + (when (string= ess-revision "") + (setq ess-revision "")) + (concat ess-version " [" ess-revision "]"))) + (provide 'ess-mode) diff -Nru ess-16.10/lisp/ess-mouse.el ess-17.11/lisp/ess-mouse.el --- ess-16.10/lisp/ess-mouse.el 2016-05-07 16:45:06.000000000 +0000 +++ ess-17.11/lisp/ess-mouse.el 2017-11-13 14:13:16.000000000 +0000 @@ -219,18 +219,10 @@ (if (equal ess-language "S") (setq mouse-me-menu-commands ess-S-mouse-me-menu-commands-alist))) -;; (if (not (featurep 'xemacs)) -;; (progn -;; ;;gnu emacs ;; (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))) -;; ;; xemacs -;; (define-key ess-mode-map [(shift button3)] 'ess-mouse-me) -;; (define-key inferior-ess-mode-map [(shift button3)] 'ess-mouse-me) -;; (defun ess-S-mouse-me-ess-transcript-mode () -;; (define-key ess-transcript-mode-map [(shift button3)] 'ess-mouse-me))) +;; (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) @@ -240,19 +232,19 @@ ; Local variables section -;;; This file is automatically placed in Outline minor mode. -;;; The file is structured as follows: -;;; Chapters: ^L ; -;;; Sections: ;;*;; -;;; Subsections: ;;;*;;; -;;; Components: defuns, defvars, defconsts -;;; Random code beginning with a ;;;;* comment - -;;; Local variables: -;;; mode: emacs-lisp -;;; outline-minor-mode: nil -;;; mode: outline-minor -;;; outline-regexp: "\^L\\|\\`;\\|;;\\*\\|;;;\\*\\|(def[cvu]\\|(setq\\|;;;;\\*" -;;; End: +;; This file is automatically placed in Outline minor mode. +;; The file is structured as follows: +;; Chapters: ^L ; +;; Sections: ;;*;; +;; Subsections: ;;;*;;; +;; Components: defuns, defvars, defconsts +;; Random code beginning with a ;;;;* comment + +;; Local variables: +;; mode: emacs-lisp +;; outline-minor-mode: nil +;; mode: outline-minor +;; outline-regexp: "\^L\\|\\`;\\|;;\\*\\|;;;\\*\\|(def[cvu]\\|(setq\\|;;;;\\*" +;; End: ;;; ess-mouse.el ends here diff -Nru ess-16.10/lisp/ess-noweb.el ess-17.11/lisp/ess-noweb.el --- ess-16.10/lisp/ess-noweb.el 2014-10-28 18:15:42.000000000 +0000 +++ ess-17.11/lisp/ess-noweb.el 2017-11-13 14:13:16.000000000 +0000 @@ -44,9 +44,6 @@ (defvar ess-noweb-use-font-lock font-lock-mode "Set to t if you want to use font-locking in ESS noweb buffers.") -;; this helps with XEmacs barfing, sigh... -;; but is *NOT* okay to do *globally*: (setq global-font-lock-mode t) - (if ess-noweb-use-font-lock (require 'ess-noweb-font-lock-mode)) @@ -97,17 +94,17 @@ ;;*;; 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: -;;; <>= -;;; code for thing1 -;;; @ -;;; Documentation -;;; <>= -;;; continuing code for thing1 -;;; @ -;;; +;; +;; Threads are code chunks which fit into the same "buffer" (I'm (AJR) +;; abusing terminology, but what I mean is things like: +;; <>= +;; code for thing1 +;; @ +;; Documentation +;; <>= +;; continuing code for thing1 +;; @ +;; (defun ess-eval-thread (vis) "Tangle all chunks in the current chunk-thread and send to the ESS process. @@ -132,19 +129,19 @@ ; Local variables section -;;; This file is automatically placed in Outline minor mode. -;;; The file is structured as follows: -;;; Chapters: ^L ; -;;; Sections: ;;*;; -;;; Subsections: ;;;*;;; -;;; Components: defuns, defvars, defconsts -;;; Random code beginning with a ;;;;* comment - -;;; Local variables: -;;; mode: emacs-lisp -;;; outline-minor-mode: nil -;;; mode: outline-minor -;;; outline-regexp: "\^L\\|\\`;\\|;;\\*\\|;;;\\*\\|(def[cvu]\\|(setq\\|;;;;\\*" -;;; End: +;; This file is automatically placed in Outline minor mode. +;; The file is structured as follows: +;; Chapters: ^L ; +;; Sections: ;;*;; +;; Subsections: ;;;*;;; +;; Components: defuns, defvars, defconsts +;; Random code beginning with a ;;;;* comment + +;; Local variables: +;; mode: emacs-lisp +;; outline-minor-mode: nil +;; mode: outline-minor +;; outline-regexp: "\^L\\|\\`;\\|;;\\*\\|;;;\\*\\|(def[cvu]\\|(setq\\|;;;;\\*" +;; End: ;;; ess-noweb.el ends here diff -Nru ess-16.10/lisp/ess-noweb-font-lock-mode.el ess-17.11/lisp/ess-noweb-font-lock-mode.el --- ess-16.10/lisp/ess-noweb-font-lock-mode.el 2015-10-26 22:19:50.000000000 +0000 +++ ess-17.11/lisp/ess-noweb-font-lock-mode.el 2017-11-13 14:13:16.000000000 +0000 @@ -195,17 +195,15 @@ font-lock-unfontify-buffer-function)) (setq font-lock-fontify-buffer-function 'nwfl-donowt) (setq font-lock-unfontify-buffer-function 'nwfl-donowt)) - (mapcar '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)) + (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) - (when (< emacs-major-version 21) ; needed for emacs < 21.1 only : - (make-local-hook 'after-change-functions)) (add-hook 'after-change-functions 'font-lock-after-change-function nil t) (add-hook 'ess-noweb-font-lock-mode-hook 'ess-noweb-font-lock-mode-fn) @@ -269,8 +267,8 @@ (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 + (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))) diff -Nru ess-16.10/lisp/ess-noweb-mode.el ess-17.11/lisp/ess-noweb-mode.el --- ess-16.10/lisp/ess-noweb-mode.el 2014-10-28 18:15:42.000000000 +0000 +++ ess-17.11/lisp/ess-noweb-mode.el 2017-11-13 14:13:16.000000000 +0000 @@ -88,9 +88,8 @@ ;;; Code: ;; Want to use these now in order to cater for all obscure kinds of emacsen -(eval-and-compile - (require 'ess-compat) - (autoload 'ess-write-to-dribble-buffer "ess")) +(require 'ess-compat) +(autoload 'ess-write-to-dribble-buffer "ess") ;;; Variables @@ -230,9 +229,7 @@ (ess-noweb-indent-line)) (defvar ess-noweb-mode-prefix-map - (let ((map (if (featurep 'xemacs) - (make-keymap) ;; XEmacs/Emacs problems... - (make-sparse-keymap)))) + (let ((map (make-sparse-keymap))) (define-key map "\C-\M-x" 'ess-eval-chunk) (define-key map "\C-c" 'ess-eval-chunk-and-step) (define-key map "\C-n" 'ess-noweb-next-chunk) @@ -343,20 +340,6 @@ (cons (cons 'ess-noweb-mode ess-noweb-minor-mode-map) minor-mode-map-alist))) -;; Old XEmacs hacks. -(defun ess-noweb-mode-xemacs-menu () - "Hook to install ess-noweb-mode menu for XEmacs (w/ easymenu)." - (if 'ess-noweb-mode - (easy-menu-add ess-noweb-minor-mode-menu) - (easy-menu-remove ess-noweb-minor-mode-menu) - )) - -(if (string-match "XEmacs" emacs-version) - (progn - (add-hook 'ess-noweb-select-mode-hook 'ess-noweb-mode-xemacs-menu) - ;; Next line handles some random problems... - (easy-menu-add ess-noweb-minor-mode-menu))) - (defun ess-noweb-minor-mode (&optional arg) "Minor meta mode for editing noweb files. See ess-noweb-mode." (interactive) @@ -431,7 +414,7 @@ ;; ess-noweb-mode on (cond (ess-noweb-mode ;Setup the minor-mode - (mapcar 'ess-noweb-make-variable-permanent-local + (mapc 'ess-noweb-make-variable-permanent-local '(ess-noweb-mode ess-local-process-name ;; also made permanent in ess-mode, but let it be ess-dialect @@ -448,9 +431,8 @@ ess-noweb-default-code-mode ess-noweb-last-chunk-index)) (ess-noweb-update-chunk-vector) - (if (equal 0 (ess-noweb-find-chunk-index-buffer)) - (setq ess-noweb-last-chunk-index 1) - (setq ess-noweb-last-chunk-index 0)) + (setq ess-noweb-last-chunk-index + (if (equal 0 (ess-noweb-find-chunk-index-buffer)) 1 0)) (if font-lock-mode (progn (font-lock-mode -1) @@ -458,10 +440,6 @@ (ess-noweb-font-lock-mode 1))) (add-hook 'post-command-hook 'ess-noweb-post-command-function) - (when (or (<= emacs-major-version 20) - (featurep 'xemacs)) ;; Xemacs or very old GNU Emacs - (make-local-hook 'after-change-functions) - (make-local-hook 'before-change-functions)) (add-hook 'after-change-functions 'ess-noweb-after-change-function nil t) (add-hook 'before-change-functions 'ess-noweb-before-change-function nil t) @@ -478,12 +456,8 @@ (t (remove-hook 'post-command-hook 'ess-noweb-post-command-function) - (if (fboundp 'remove-local-hook) - (progn - (remove-local-hook 'after-change-functions 'ess-noweb-after-change-function) - (remove-local-hook 'before-change-functions 'ess-noweb-before-change-function)) - (remove-hook 'after-change-functions 'ess-noweb-after-change-function t) - (remove-hook 'before-change-functions 'ess-noweb-before-change-function t)) + (remove-hook 'after-change-functions 'ess-noweb-after-change-function t) + (remove-hook 'before-change-functions 'ess-noweb-before-change-function t) (remove-hook 'ess-noweb-select-doc-mode-hook 'ess-noweb-auto-fill-doc-mode) (remove-hook 'ess-noweb-select-code-mode-hook 'ess-noweb-auto-fill-code-mode) @@ -1619,31 +1593,21 @@ (if (string-match "mode:[ \t]*\\([^\t ]*\\)" this-line) (setq ess-noweb-code-mode - (if (featurep 'xemacs) - (match-string 1 this-line) - (match-string-no-properties 1 this-line)) - )) + (match-string-no-properties 1 this-line))) (if (string-match "ess-noweb-line-number-format:[ \t]*\"\\([^\"]*\\)\"" this-line) (setq ess-noweb-line-number-format - (if (featurep 'xemacs) - (match-string 1 this-line) - (match-string-no-properties 1 this-line)) - )) + (match-string-no-properties 1 this-line))) (if (string-match "ess-noweb-line-number-skip-lines:[ \t]*\\([^\t ]*\\)" this-line) (setq ess-noweb-line-number-skip-lines (string-to-number - (if (featurep 'xemacs) - (match-string 1 this-line) - (match-string-no-properties 1 this-line))))) + (match-string-no-properties 1 this-line)))) (if (string-match "ess-noweb-tab-width:[ \t]*\\([^\t ]*\\)" this-line) (setq ess-noweb-tab-width (string-to-number - (if (featurep 'xemacs) - (match-string 1 this-line) - (match-string-no-properties 1 this-line))))) + (match-string-no-properties 1 this-line)))) (beginning-of-line 2))))))) (defun ess-noweb-reset-thread-local-variables () diff -Nru ess-16.10/lisp/ess-omg-d.el ess-17.11/lisp/ess-omg-d.el --- ess-16.10/lisp/ess-omg-d.el 2014-10-28 18:15:42.000000000 +0000 +++ ess-17.11/lisp/ess-omg-d.el 2017-11-13 14:13:16.000000000 +0000 @@ -47,7 +47,7 @@ (ess-dialect . "omegahat") (ess-suffix . "omg") (ess-loop-timeout . 5000) - (ess-dump-filename-template . (ess-replace-regexp-in-string + (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) diff -Nru ess-16.10/lisp/ess-omg-l.el ess-17.11/lisp/ess-omg-l.el --- ess-16.10/lisp/ess-omg-l.el 2016-10-22 16:03:27.000000000 +0000 +++ ess-17.11/lisp/ess-omg-l.el 2017-11-13 14:13:16.000000000 +0000 @@ -293,7 +293,7 @@ "Font-lock patterns used in `OMG' buffers.") -;;; Changes from S to S-PLUS 3.x. (standard S3 should be in ess-s-l.el !). +;;; 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:") diff -Nru ess-16.10/lisp/ess-r-a.el ess-17.11/lisp/ess-r-a.el --- ess-16.10/lisp/ess-r-a.el 2014-10-28 18:15:42.000000000 +0000 +++ ess-17.11/lisp/ess-r-a.el 2017-11-13 14:13:16.000000000 +0000 @@ -28,7 +28,7 @@ ;; 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-d, the primary +;; interesting, then they might be migrated to ess-r-mode, the primary ;; ESS R mode tools. ;;; Code: diff -Nru ess-16.10/lisp/ess-r-args.el ess-17.11/lisp/ess-r-args.el --- ess-16.10/lisp/ess-r-args.el 2016-03-03 13:50:29.000000000 +0000 +++ ess-17.11/lisp/ess-r-args.el 2017-11-13 14:13:16.000000000 +0000 @@ -32,13 +32,6 @@ ;; installation, configuration and troubleshooting, please visit ;; http://www.svenhartenstein.de/emacs-ess.php -;; Users of XEmacs (or maybe non-GNU-Emacs users): The code below must -;; be slightly adapted in order to work in XEmacs (i.e. comment out -;; the delete-trailing-whitespace function call by putting a semicolon -;; at the beginning of the line). Furthermore, the tooltip option does -;; NOT work in XEmacs (yet) (and will probably only ever work if the -;; ESS-core team will adapt the code for XEmacs compatibility). - ;; == Requirements == ;; * ESS mode must be loaded and running. @@ -46,8 +39,6 @@ ;; * For the tooltip option to work, Emacs must not run within a ;; terminal but (directly) under the X window system (in case of ;; GNU/Linux). -;; * The tooltip option currently requires GNU Emacs (i.e. not XEmacs -;; or a similar other derivate). ;; == Installation == @@ -179,12 +170,9 @@ ;;; Code: -(eval-and-compile - (require 'ess-custom)) - +(require 'ess-custom) (eval-when-compile - (if ess-has-tooltip - (require 'tooltip))); for tooltip-show + (require 'tooltip)); for tooltip-show (require 'ess) @@ -228,8 +216,7 @@ (setq function (ess-r-args-current-function))) (ess-message ".... function='%s'" function) (when function - (let* ((tt (and (equal ess-r-args-show-as 'tooltip) - ess-has-tooltip)) + (let* ((tt (equal ess-r-args-show-as 'tooltip)) (args (concat ess-r-args-show-prefix (ess-r-args-get function (not tt))))) (ess-message "(ess-r-args-show): args='%s'" args) diff -Nru ess-16.10/lisp/ess-r-completion.el ess-17.11/lisp/ess-r-completion.el --- ess-16.10/lisp/ess-r-completion.el 2016-10-22 16:03:27.000000000 +0000 +++ ess-17.11/lisp/ess-r-completion.el 2017-11-13 14:13:16.000000000 +0000 @@ -30,11 +30,10 @@ ;;; ElDoc -(eval-when-compile - (require 'cl)) +(require 'cl) (require 'ess-utils) -(defun ess-R-eldoc-function () +(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." @@ -134,11 +133,11 @@ ;;; OBJECTS -(defun ess-R-object-completion () +(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--funname.start))) - (completions (ess-R-get-rcompletions funstart)) + (completions (ess-r-get-rcompletions funstart)) (token (pop completions))) (when completions (list (- (point) (length token)) (point) @@ -149,12 +148,12 @@ (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, +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-r-complete-object-name) (ess-internal-complete-object-name)) ;; else give a message on second invocation (when (string-match "complete" (symbol-name last-command)) @@ -232,7 +231,7 @@ ;; always return a non-nil value to prevent history expansions (or (comint-dynamic-simple-complete pattern components) 'none)))) -(defun ess-R-get-rcompletions (&optional start end prefix allow-3-dots) +(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 @@ -255,11 +254,11 @@ (ess-get-words-from-vector cmd))) -(defun ess-R-complete-object-name () +(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)) + (let ((possible-completions (ess-r-get-rcompletions)) token-string) ;; If there are no possible-completions, should return nil, so ;; that when this function is called from @@ -276,7 +275,7 @@ (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)) + (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 @@ -311,7 +310,7 @@ (define-obsolete-variable-alias 'ess-ac-R-argument-suffix 'ess-R-argument-suffix "15.3") -(defvar ess-R--funargs-pre-cache +(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") @@ -335,7 +334,7 @@ ;;; HELP -(defun ess-R-get-object-help-string (sym) +(defun ess-r-get-object-help-string (sym) "Help string for ac." (let ((proc (ess-get-next-available-process))) (if (null proc) @@ -351,7 +350,7 @@ (goto-char (point-min)) (buffer-string)))))) -(defun ess-R-get-arg-help-string (sym &optional proc) +(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)))) @@ -380,7 +379,7 @@ (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))))) + (doc-buffer (company-doc-buffer (ess-r-get-object-help-string arg))))) (defun company-R-args (command &optional arg &rest ignored) (interactive (list 'interactive)) @@ -405,12 +404,12 @@ (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))) + (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))))) + (doc-buffer (company-doc-buffer (ess-r-get-arg-help-string arg))))) ;;; AC SOURCES @@ -442,15 +441,15 @@ (defun ess-ac-help (sym) (if (string-match-p "= *\\'" sym) - (ess-R-get-arg-help-string sym) - (ess-R-get-object-help-string 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)) + (document . ess-r-get-object-help-string)) "Auto-completion source for R objects") (defun ess-ac-objects (&optional no-kill) @@ -467,7 +466,7 @@ ;; (requires . 0) (candidates . ess-ac-args) ;; (action . ess-ac-action-args) - (document . ess-R-get-arg-help-string)) + (document . ess-r-get-arg-help-string)) "Auto-completion source for R function arguments") (defun ess-ac-args () diff -Nru ess-16.10/lisp/ess-r-d.el ess-17.11/lisp/ess-r-d.el --- ess-16.10/lisp/ess-r-d.el 2016-10-22 16:03:27.000000000 +0000 +++ ess-17.11/lisp/ess-r-d.el 1970-01-01 00:00:00.000000000 +0000 @@ -1,2244 +0,0 @@ -;;; ess-r-d.el --- R customization - -;; Copyright (C) 1997--2010 A.J. Rossini, Richard M. Heiberger, Martin -;; Maechler, Kurt Hornik, Rodney Sparapani, and Stephen Eglen. -;; Copyright (C) 2011--2015 A.J. Rossini, Richard M. Heiberger, Martin Maechler, -;; Kurt Hornik, Rodney Sparapani, Stephen Eglen and Vitalie Spinu. - -;; Author: A.J. Rossini -;; Created: 12 Jun 1997 -;; Maintainer: ESS-core - -;; 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: - -;; This file defines all the R customizations for ESS. See ess-s-l.el -;; for general S language customizations. - -;;; Code: - -;;; Autoloads and Requires - -(ess-message "[ess-r-d:] (require 'ess-s-l)") -(require 'cl) -(require 'ess-s-l) -(require 'eldoc) -(require 'ess-utils) -(require 'ess-r-package) -(require 'ess-help) -(require 'ess-roxy) -(require 'ess-tracebug) -(require 'compile); for compilation-* below -(require 'easymenu) -(require 'ess-r-completion) -(require 'ess-r-syntax) - -(autoload 'ess-r-args-show "ess-r-args" "(Autoload)" t) -(autoload 'ess-r-args-auto-show "ess-r-args" "(Autoload)" t) -(autoload 'ess-help-underline "ess-help" "(Autoload)" t) -(autoload 'ess--flush-help-into-current-buffer "ess-help" "(Autoload)" t) - - -;;*;; Mode definition - -;;;*;;; UI (Keymaps / Menus) - -(defvar ess-dev-map - (let (ess-dev-map) - (define-prefix-command 'ess-dev-map) - ;; Note: some of these comand are automatically redefined by those in - (define-key ess-dev-map "\C-s" '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 "\C-l" '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 "\C-w" 'ess-watch) - (define-key ess-dev-map "w" 'ess-watch) - (define-key ess-dev-map "\C-d" 'ess-debug-flag-for-debugging) - (define-key ess-dev-map "d" 'ess-debug-flag-for-debugging) - (define-key ess-dev-map "\C-u" 'ess-debug-unflag-for-debugging) - (define-key ess-dev-map "u" 'ess-debug-unflag-for-debugging) - (define-key ess-dev-map [(control ?D)] 'ess-debug-unflag-for-debugging) - (define-key ess-dev-map "\C-b" 'ess-bp-set) - (define-key ess-dev-map "b" 'ess-bp-set) - (define-key ess-dev-map [(control ?B)] 'ess-bp-set-conditional) - (define-key ess-dev-map "B" 'ess-bp-set-conditional) - (define-key ess-dev-map "\C-L" 'ess-bp-set-logger) - (define-key ess-dev-map "L" 'ess-bp-set-logger) - (define-key ess-dev-map "\C-o" 'ess-bp-toggle-state) - (define-key ess-dev-map "o" 'ess-bp-toggle-state) - (define-key ess-dev-map "\C-k" 'ess-bp-kill) - (define-key ess-dev-map "k" 'ess-bp-kill) - (define-key ess-dev-map "\C-K" 'ess-bp-kill-all) - (define-key ess-dev-map "K" 'ess-bp-kill-all) - (define-key ess-dev-map "\C-n" '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 "\C-p" 'ess-bp-previous) - (define-key ess-dev-map "p" 'ess-bp-previous) - (define-key ess-dev-map "\C-e" '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.") - -(defvar ess-r-package-dev-map - (let (ess-r-package-dev-map) - (define-prefix-command 'ess-r-package-dev-map) - (define-key ess-r-package-dev-map "\C-s" 'ess-r-package-set-package) - (define-key ess-r-package-dev-map "s" 'ess-r-package-set-package) - (define-key ess-r-package-dev-map "\C-a" 'ess-r-devtools-ask) - (define-key ess-r-package-dev-map "a" 'ess-r-devtools-ask) - (define-key ess-r-package-dev-map "\C-c" 'ess-r-devtools-check-package) - (define-key ess-r-package-dev-map "c" 'ess-r-devtools-check-package) - (define-key ess-r-package-dev-map "\C-d" 'ess-r-devtools-document-package) - (define-key ess-r-package-dev-map "d" 'ess-r-devtools-document-package) - (define-key ess-r-package-dev-map "\C-i" 'ess-r-devtools-install-package) - (define-key ess-r-package-dev-map "i" 'ess-r-devtools-install-package) - (define-key ess-r-package-dev-map "\C-l" 'ess-r-devtools-load-package) - (define-key ess-r-package-dev-map "l" 'ess-r-devtools-load-package) - (define-key ess-r-package-dev-map "\C-r" 'ess-r-devtools-revdep-check-package) - (define-key ess-r-package-dev-map "r" 'ess-r-devtools-revdep-check-package) - (define-key ess-r-package-dev-map "\C-t" 'ess-r-devtools-test-package) - (define-key ess-r-package-dev-map "t" 'ess-r-devtools-test-package) - (define-key ess-r-package-dev-map "\C-u" 'ess-r-devtools-unload-package) - (define-key ess-r-package-dev-map "u" 'ess-r-devtools-unload-package) - ess-r-package-dev-map)) - -(easy-menu-define ess-roxygen-menu nil - "Roxygen submenu." - '("Roxygen" - :visible (and ess-dialect (string-match "^R" ess-dialect)) - ["Update/Generate Template" ess-roxy-update-entry t] - ["Preview Rd" ess-roxy-preview-Rd t] - ["Preview HTML" ess-roxy-preview-HTML t] - ["Preview text" ess-roxy-preview-text t] - ["Hide all" ess-roxy-hide-all t] - ["Toggle Roxygen Prefix" ess-roxy-toggle-roxy-region t])) - -(easy-menu-define ess-tracebug-menu nil - "Tracebug submenu." - '("Tracebug" - :visible (and ess-dialect (string-match "^R" ess-dialect)) - ;; :enable ess-local-process-name - ["Active?" ess-toggle-tracebug - :style toggle - :selected (or (and (ess-process-live-p) - (ess-process-get 'tracebug)) - ess-use-tracebug)] - ["Show traceback" ess-show-traceback (ess-process-live-p)] - ["Show call stack" ess-show-call-stack (ess-process-live-p)] - ["Watch" ess-watch (and (ess-process-live-p) - (ess-process-get 'tracebug))] - ["Error action cycle" ess-debug-toggle-error-action (and (ess-process-live-p) - (ess-process-get 'tracebug))] - "----" - ["Flag for debugging" ess-debug-flag-for-debugging ess-local-process-name] - ["Unflag for debugging" ess-debug-unflag-for-debugging ess-local-process-name] - "----" - ["Set BP" ess-bp-set t] - ["Set conditional BP" ess-bp-set-conditional t] - ["Set logger BP" ess-bp-set-logger t] - ["Kill BP" ess-bp-kill t] - ["Kill all BPs" ess-bp-kill-all t] - ["Next BP" ess-bp-next t] - ["Previous BP" ess-bp-previous t] - "-----" - ["About" ess-tracebug-show-help t])) - -(easy-menu-define ess-r-package-menu nil - "Package Development submenu." - '("Package development" - :visible (and ess-dialect (string-match "^R" ess-dialect)) - ["Active?" ess-r-package-mode - :style toggle - :selected ess-r-package-mode] - ["Select package for evaluation" ess-r-set-evaluation-env t])) - -(easy-menu-add-item ess-mode-menu nil ess-roxygen-menu "end-dev") -(easy-menu-add-item ess-mode-menu nil ess-r-package-menu "end-dev") -(easy-menu-add-item ess-mode-menu nil ess-tracebug-menu "end-dev") - -(easy-menu-add-item inferior-ess-mode-menu nil ess-r-package-menu "end-dev") -(easy-menu-add-item inferior-ess-mode-menu nil ess-tracebug-menu "end-dev") - - -;; Inherit from the S syntax table: -(setq ess-r-syntax-table (copy-syntax-table S-syntax-table)) - -;; Letting Emacs treat backquoted names and %ops% as strings solves -;; many problems with regard to nested strings and quotes -(modify-syntax-entry ?` "\"" ess-r-syntax-table) -(modify-syntax-entry ?% "\"" ess-r-syntax-table) - -;; Underscore is valid in R symbols -(modify-syntax-entry ?_ "_" ess-r-syntax-table) -(modify-syntax-entry ?: "." ess-r-syntax-table) -(modify-syntax-entry ?@ "." ess-r-syntax-table) -(modify-syntax-entry ?$ "." ess-r-syntax-table) - -;; TOTHINK: Prevent string delimiting characters from messing up output in the -;; inferior buffer -(setq inferior-ess-r-syntax-table (copy-syntax-table ess-r-syntax-table)) -;; (modify-syntax-entry ?\' "." inferior-ess-r-syntax-table) -;; (modify-syntax-entry ?\" "." inferior-ess-r-syntax-table) -;; (modify-syntax-entry ?` "." inferior-ess-r-syntax-table) -(modify-syntax-entry ?% "." inferior-ess-r-syntax-table) - -(defvar ess-r-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.") - -(defun ess-r-font-lock-syntactic-face-function (state) - (let ((string-end (save-excursion - (and (nth 3 state) - (ess-goto-char (nth 8 state)) - (ess-forward-sexp) - (point))))) - (when (eq (nth 3 state) ?`) - (put-text-property (nth 8 state) string-end 'ess-r-backquoted t)) - (cond - ((eq (nth 3 state) ?%) - 'ess-%op%-face) - ((save-excursion - (and (ess-goto-char string-end) - (ess-looking-at "<-") - (ess-goto-char (match-end 0)) - (ess-looking-at "function\\b" t))) - font-lock-function-name-face) - ((save-excursion - (and (ess-goto-char string-end) - (ess-looking-at "("))) - ess-function-call-face) - ((eq (nth 3 state) ?`) - 'ess-backquoted-face) - ((nth 3 state) - font-lock-string-face) - (t - font-lock-comment-face)))) - - -(ess-message "[ess-r-d:] (autoload ..) & (def** ..)") - - -(defvar ess-r-customize-alist - (append - '((ess-local-customize-alist . 'ess-r-customize-alist) - (ess-eldoc-function . #'ess-R-eldoc-function) - (ess-dialect . "R") - (ess-suffix . "R") - (ess-ac-sources . '(ac-source-R)) - (ess-company-backends . '((company-R-args company-R-objects :separate))) - (ess-build-tags-command . "rtags('%s', recursive = TRUE, pattern = '\\\\.[RrSs](rw)?$',ofile = '%s')") - (ess-traceback-command . "local({cat(geterrmessage(), \"---------------------------------- \n\", fill=TRUE);try(traceback(), silent=TRUE)})\n") - (ess-call-stack-command . "traceback(1)\n") - (ess-build-eval-message-function . #'ess-r-build-eval-message) - (ess-dump-filename-template . (ess-replace-regexp-in-string - "S$" ess-suffix ; in the one from custom: - ess-dump-filename-template-proto)) - (ess-build-help-command-function . #'ess-r-build-help-command) - (ess-help-web-search-command . 'ess-R-sos) - (ess-mode-syntax-table . ess-r-syntax-table) - (ess-mode-completion-syntax-table . ess-r-completion-syntax-table) - (ess-mode-editing-alist . 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-cmd-delay . ess-R-cmd-delay) - (ess-function-pattern . ess-R-function-pattern) - (ess-object-name-db-file . "ess-r-namedb.el" ) - (ess-smart-operators . ess-R-smart-operators) - (inferior-ess-program . inferior-R-program-name) - (inferior-ess-objects-command . inferior-R-objects-command) - (inferior-ess-font-lock-keywords . 'inferior-R-font-lock-keywords) - (inferior-ess-search-list-command . "search()\n") - ;;(inferior-ess-help-command . "help(\"%s\", htmlhelp=FALSE)\n") - (inferior-ess-help-command . inferior-ess-r-help-command) - (inferior-ess-help-filetype . nil) - (inferior-ess-exit-command . "q()") - (inferior-ess-exit-prompt . "Save workspace image? [y/n/c]: ") - ;;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-mode-syntax-table . inferior-ess-r-syntax-table) - (ess-error-regexp-alist . ess-R-error-regexp-alist) - (ess-describe-object-at-point-commands . 'ess-R-describe-object-at-point-commands) - (ess-STERM . "iESS") - (ess-editor . R-editor) - (ess-pager . R-pager) - (prettify-symbols-alist . '(("<-" . ?←) - ("<<-" . ?↞) - ("->" . ?→) - ("->>" . ?↠))) - (font-lock-syntactic-face-function . #'ess-r-font-lock-syntactic-face-function)) - S-common-cust-alist) - "Variables to customize for R -- set up later than emacs initialization.") - -(defalias 'R-customize-alist 'ess-r-customize-alist) - -(defvar R-editing-alist - ;; copy the S-alist and modify : - (let ((S-alist (copy-alist S-editing-alist))) - (setcdr (assoc 'ess-font-lock-defaults S-alist) - '(ess--extract-default-fl-keywords ess-R-font-lock-keywords)) - (setcdr (assoc 'ess-font-lock-keywords S-alist) - (quote 'ess-R-font-lock-keywords)) - (setcdr (assoc 'ess-mode-syntax-table S-alist) - (quote ess-r-syntax-table)) - S-alist) - "General options for editing R source files.") - - -(defvar ess-R-error-regexp-alist '(R R1 R2 R3 R4 R-recover) - "List of symbols which are looked up in `compilation-error-regexp-alist-alist'.") - -;; takes precidence over R1 below in english locales, and allows spaces in file path -(add-to-list 'compilation-error-regexp-alist-alist - '(R "\\(\\(?: at \\|(@\\)\\([^#\n]+\\)[#:]\\([0-9]+\\)\\)" 2 3 nil 2 1)) - -(add-to-list 'compilation-error-regexp-alist-alist - '(R1 " \\([^ \t\n]+\\)#\\([0-9]+\\)[: ]" 1 2 nil 2)) - -(add-to-list 'compilation-error-regexp-alist-alist - '(R2 "(\\(\\w+ \\([^())\n]+\\)#\\([0-9]+\\)\\))" 2 3 nil 2 1)) - -;; (add-to-list 'compilation-error-regexp-alist-alist -;; '(R2 "\\(?:^ +\\(.*?\\):\\([0-9]+\\):\\([0-9]+\\):\\)" 1 2 nil 2 1)) -;; (add-to-list 'compilation-error-regexp-alist-alist -;; '(R3 "\\(?:Error.*: .*\n? +\\)\\(.*\\):\\([0-9]+\\):\\([0-9]+\\):" 1 2 3 2 1)) - -;; precede R4 and allowes spaces in file path -(add-to-list 'compilation-error-regexp-alist-alist - ;; start with bol,: but don't start with digit - '(R3 "\\(?:^ +\\|: +\\)\\([^-+[:digit:]\n]:?[^:\n]*\\):\\([0-9]+\\):\\([0-9]+\\):" 1 2 3 2 1)) - -(add-to-list 'compilation-error-regexp-alist-alist - ;; don't start with digit, don't contain spaces - '(R4 "\\([^-+ [:digit:]][^: \t\n]+\\):\\([0-9]+\\):\\([0-9]+\\):" 1 2 3 2 1)) - -(add-to-list 'compilation-error-regexp-alist-alist - '(R-recover " *[0-9]+: +\\([^:\n\t]+?\\)#\\([0-9]+:\\)" 1 2 nil 2 1)) - -;; gnu C errors -;; (add-to-list 'compilation-error-regexp-alist-alist -;; '(R_C "^\\([^-+ [:digit:]][^: \t\n]+\\):\\([0-9]+\\):\\([0-9]+\\):" 2 3 nil 2 1)) - -(let ((r-ver '("R-1" "R-2" "R-3" "R-devel" "R-patched"))) - (defvar ess-r-versions - (if (eq system-type 'darwin) (append r-ver '("R32" "R64")) r-ver) - "List of partial strings for versions of R 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 R is made available. For example, if the -file \"R-1.8.1\" is found and this variable includes the string -\"R-1\", a function called `M-x R-1.8.1' will be available to run that -version of R. -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 R. -If you set this variable, you need to restart Emacs (and set this variable -before ess-site is loaded) for it to take effect.")) - - -;;;*;;; Mode init - -(defvar ess-R-post-run-hook nil - "Functions run in process buffer after the initialization of R - process.") - -(defun ess-r-mode-p () - "Check whether we have a buffer running in R mode. - -This is to get around the lack of proper derived modes in ESS." - (and (eq major-mode 'ess-mode) - (string= ess-dialect "R"))) - -;;;### autoload -(defun R (&optional start-args) - "Call 'R', the 'GNU S' system from the R Foundation. -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 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." - (interactive "P") - (ess-write-to-dribble-buffer ;; for debugging only - (format - "\n(R): ess-dialect=%s, buf=%s, start-arg=%s\n current-prefix-arg=%s\n" - ess-dialect (current-buffer) start-args current-prefix-arg)) - (let* ((r-always-arg - (if (or ess-microsoft-p (eq system-type 'cygwin)) - "--ess " - ;; else: "unix alike" - (if (not ess-R-readline) "--no-readline "))) - (start-args - (cond ((stringp start-args) - start-args) - ((and start-args - (listp start-args) - (every 'stringp start-args)) - (mapconcat 'identity start-args " ")) - (start-args - (read-string - (concat "Starting Args" - (if r-always-arg - (concat " [other than '" r-always-arg "']")) - " ? "))))) - (r-start-args - (concat r-always-arg - inferior-R-args " " ; add space just in case - start-args)) - (cust-alist (copy-alist ess-r-customize-alist)) - (gdbp (string-match-p "gdb" r-start-args)) - use-dialog-box) - - (when gdbp - (setcdr (assoc 'inferior-ess-secondary-prompt cust-alist) - (format "\\(%s\\)\\|\\((gdb) \\)" - (cdr (assoc 'inferior-ess-secondary-prompt cust-alist))))) - - (when (or ess-microsoft-p - (eq system-type 'cygwin)) - (setq use-dialog-box nil) - (when ess-microsoft-p ;; default-process-coding-system would break UTF locales on Unix - (setq default-process-coding-system '(undecided-dos . undecided-dos)))) - - (inferior-ess r-start-args cust-alist gdbp) - - (ess-process-put 'funargs-pre-cache ess-R--funargs-pre-cache) - - (remove-hook 'completion-at-point-functions 'ess-filename-completion 'local) ;; should be first - (add-hook 'completion-at-point-functions 'ess-R-object-completion nil 'local) - (add-hook 'completion-at-point-functions 'ess-filename-completion nil 'local) - (setq comint-input-sender 'inferior-ess-r-input-sender) - - (if gdbp - (progn - ;; We need to use callback, because R might start with a gdb process - (ess-process-put 'callbacks '(R-initialize-on-start)) - ;; trigger the callback - (process-send-string (get-process ess-local-process-name) "\n")) - (ess-wait-for-process) - (R-initialize-on-start)) - - (ess-write-to-dribble-buffer - (format "(R): inferior-ess-language-start=%s\n" - inferior-ess-language-start)))) - -(defun R-initialize-on-start (&optional proc string) - "This function is run after the first R prompt. -Executed in process buffer." - (interactive) - - ;; (when ess-can-eval-in-background - ;; (ess-async-command-delayed - ;; "invisible(installed.packages())\n" nil (get-process ess-local-process-name) - ;; ;; "invisible(Sys.sleep(10))\n" nil (get-process ess-local-process-name) ;; test only - ;; (lambda (proc) (process-put proc 'packages-cached? t)))) - - ;; sometimes needed (MM w/ Emacs 25.1, on F24 where PAGER is 'more'): - ;; carefully set "pager" option "when needed": - (ess-eval-linewise - (format - "if(identical(getOption('pager'), file.path(R.home('bin'), 'pager'))) # rather take the ESS one - options(pager='%s')\n" inferior-ess-pager) - ;; Even more careful / sophisticated : - ;; "if(identical(getOption('pager'), file.path(R.home('bin'), 'pager')) && - ;; grepl('\\', .P <- Sys.getenv('PAGER'))) { # rather take the ESS one - ;; cat('$PAGER has more: ', sQuote(.P), '\\n --> setting R`s pager option():\\n') - ;; options(pager='%s')\n}\n" inferior-ess-pager) - nil nil nil 'wait) - (inferior-ess-r-load-ESSR) - - (when inferior-ess-language-start - (ess-eval-linewise inferior-ess-language-start - nil nil nil 'wait-prompt)) - - (with-ess-process-buffer nil - (add-hook 'ess-presend-filter-functions 'ess-R-scan-for-library-call nil 'local) - (run-mode-hooks 'ess-R-post-run-hook))) - - -;; (defun ess--R-cache-installed-packages () -;; "Run by `ess-delayed-init' in R process buffer. -;; Useses internal R caching of installed packages." -;; (ess-command "invisible(installed.packages())\n" -;; nil nil nil .2 nil 'redisplay) -;; (ess-process-put 'packages-cached? t) -;; ) - -;;;### autoload -(defun R-mode (&optional proc-name) - "Major mode for editing R source. See `ess-mode' for more help." - (interactive "P") - (setq ess-customize-alist ess-r-customize-alist) - ;;(setq imenu-generic-expression R-imenu-generic-expression) - (ess-mode ess-r-customize-alist proc-name) - ;; for emacs < 24 - (add-hook 'comint-dynamic-complete-functions 'ess-complete-object-name t 'local) - ;; for emacs >= 24 - (remove-hook 'completion-at-point-functions 'ess-filename-completion 'local) ;; should be first - (add-hook 'completion-at-point-functions 'ess-R-object-completion nil 'local) - (add-hook 'completion-at-point-functions 'ess-filename-completion nil 'local) - - (if (fboundp 'ess-add-toolbar) (ess-add-toolbar)) - ;; ECB needs seminatic stuff. - ;; (if (featurep 'semantic) - ;; (setq semantic-toplevel-bovine-table r-toplevel-bovine-table)) - (when (and ess-imenu-use-S (require 'ess-menu)) - (setq imenu-generic-expression ess-imenu-generic-expression) - (imenu-add-to-menubar "Imenu-R")) - - ;; useful for swankr/slime: - (set (make-local-variable 'beginning-of-defun-function) - (lambda (&optional arg) - (skip-chars-backward " \t\n") - (ess-beginning-of-function 'no-error))) - (set (make-local-variable 'end-of-defun-function) - 'ess-end-of-function) - - (ess-roxy-mode t) - (ad-activate 'fill-paragraph) - (ad-activate 'move-beginning-of-line) - (ad-activate 'back-to-indentation) - (ad-activate 'ess-eval-line-and-step) - (when ess-roxy-hide-show-p - (ad-activate 'ess-indent-command)) - - (run-hooks 'R-mode-hook)) - -(fset 'r-mode 'R-mode) - - -;;*;; Miscellaneous - -(defun ess-R-arch-2-bit (arch) - "Translate R's architecture shortcuts/directory names to 'bits', - i.e., \"32\" or \"64\" (for now)." - (if (string= arch "i386") "32" - ;; else: - "64")) - -(defun ess-rterm-arch-version (long-path &optional give-cons) - "Find an architecture-specific name for LONG-PATH, an absolute (long name) path - to R on Windows. Returns either Name, a string, or a (Name . Path) cons, such as - (\"R-2.12.1-64bit\" . \"C:/Program Files/R/R-2.12.1/bin/x64/Rterm.exe\") - -\"R-x.y.z/bin/Rterm.exe\" will return \"R-x.y.z\", for R-2.11.x and older. -\"R-x.y.z/bin/i386/Rterm.exe\" will return \"R-x.y.z-32bit\", for R-2.12.x and newer. -\"R-x.y.z/bin/x64/Rterm.exe\" will return \"R-x.y.z-64bit\", for R-2.12.x and newer." - (let* ((dir (directory-file-name (file-name-directory long-path))) - (dir2 (directory-file-name (file-name-directory dir))) - (v-1up (file-name-nondirectory dir));; one level up - (v-2up (file-name-nondirectory dir2));; two levels up; don't want "bin" ... - (v-3up (file-name-nondirectory ;; three levels up; no "bin" for i386, x64 ... - (directory-file-name (file-name-directory dir2)))) - (val (if (string= v-2up "bin") - (concat v-3up "-" (ess-R-arch-2-bit v-1up) "bit") - ;; pre R-2.12.x, or when there's no extra arch-specific sub directory: - v-2up))) - (if give-cons - (cons val long-path) - val))) - - -(defun ess-r-versions-create () - "Generate the `M-x R-x.y.z' functions for starting other versions of R. -On MS Windows, this works using `ess-rterm-version-paths'; otherwise, -see `ess-r-versions' for strings that determine which functions are created. - -The result is a list of the new R defuns, if any, that were created. The -defuns will normally be placed on the menubar and stored as -`ess-r-versions-created' upon ESS initialisation." - - (if (not ess-r-versions) - nil ;nothing to return - ;; else, if ess-r-versions is non-nil, let's try to find those R versions. - ;; This works by creating a temp buffer where the template function is - ;; edited so that X.Y is replaced by the version name - (let (versions - r-versions-created - (eval-buf (get-buffer-create "*ess-temp-r-evals*")) - (template - ;; This is the template function used for creating M-x R-X.Y. - (concat - "(defun R-X.Y (&optional start-args) - \"Call the R version 'R-X.Y' using ESS. -This function was generated by `ess-r-versions-create'.\" - (interactive \"P\") - (let ((inferior-R-version \"R-X.Y\") - (inferior-R-program-name \"" - (if ess-microsoft-p "Rterm" "R") "-X.Y\")) - (R start-args))) -"))) - - (with-current-buffer eval-buf - ;; clear the buffer. - (delete-region (point-min) (point-max)) - - ;; Find which versions of R we want. Remove the pathname, leaving just - ;; the name of the executable. - (setq versions - (if ess-microsoft-p - (mapcar (lambda(v) (ess-rterm-arch-version v 'give-cons)) - ess-rterm-version-paths) - ;; ^^^^^^^^^^^^^^^^^^^^^^^ from ./ess-site.el at start - ;; else (non-MS): - (ess-uniq-list - (mapcar 'file-name-nondirectory - (apply 'nconc - (mapcar 'ess-find-exec-completions - ess-r-versions)))))) - (setq r-versions-created ; also for returning at end. - (if ess-microsoft-p - (mapcar 'car versions) - versions)) - (ess-write-to-dribble-buffer - (format "(R): ess-r-versions-create making M-x defuns for \n %s\n" - (mapconcat 'identity r-versions-created "\n "))) - - ;; Iterate over each string in VERSIONS, creating a new defun each time. - (while versions - (let* ((version (car versions)) - (ver (if ess-microsoft-p (car version) version)) - (beg (point))) - - (setq versions (cdr versions)) - (insert template) - (goto-char beg) - (while (search-forward "R-X.Y" nil t) ;; in all cases - (replace-match ver t t)) - (when ess-microsoft-p - (goto-char beg) - (while (search-forward "Rterm-X.Y" nil t) - (replace-match (w32-short-file-name (cdr version)) t t))) - (goto-char (point-max)))) - ;; buffer has now been created with defuns, so eval them! - (eval-buffer)) - (unless (and (boundp 'ess-debugging) ess-debugging) - (kill-buffer eval-buf)) - - r-versions-created))) - -(defvar ess-newest-R nil - "Stores the newest version of R that has been found. Used as a cache, -within ess-find-newest-R. Do not use this value directly, but -instead call the function \\[ess-find-newest-R].") - - -(defcustom ess-prefer-higher-bit t - "Non-nil means prefer higher bit architectures of R. -e.g. prefer 64 bit over 32 bit. This is currently used only -by the code on Windows for finding the newest version of R." - :group 'ess-R - :type 'boolean) - -(defun ess-rterm-prefer-higher-bit () - "Optionally remove 32bit Rterms from being candidate for R-newest. -Return the list of candidates for being R-newest. Filtering is done -iff `ess-prefer-higher-bit' is non-nil. -This is used only by Windows when running `ess-find-newest-R'." - (if ess-prefer-higher-bit - ;; filter out 32 bit elements - (let ((filtered - (delq nil - (mapcar (lambda (x) (unless (string-match "/i386/Rterm.exe" x) x)) - ess-rterm-version-paths)))) - (if (null filtered) - ;; if none survived filtering, keep the original list - ess-rterm-version-paths - filtered)) - ess-rterm-version-paths)) - - -(defun ess-find-newest-R () - "Find the newest version of R on the system. Once the value is found, -cache it in the variable `ess-newest-R' for future use as finding the -newest version of R can be potentially time-consuming." - (or ess-newest-R - (progn (message "Finding all versions of R on your system...") - ;;(sleep-for 3) - nil) - (setq ess-newest-R - (ess-newest-r - (if ess-microsoft-p - (ess-rterm-prefer-higher-bit) - (add-to-list 'ess-r-versions-created - inferior-R-program-name)))))) - -(defun ess-check-R-program-name () - "Check if `inferior-R-program-name' points to an executable version of R. -If not, try to find the newest version of R elsewhere on the system, and -update `inferior-R-program-name' accordingly." - (unless (executable-find inferior-R-program-name) - ;; need to check if we can find another name. - (let ((newest (ess-find-newest-R))) - (if newest - (setq inferior-R-program-name newest) - (message "Sorry, no version of R could be found on your system."))))) - -(defun R-newest (&optional start-args) - "Find the newest version of R available, and run it. -Subsequent calls to R-newest will run that version, rather than searching -again for the newest version. Providing an optional prefix arg (C-u) will -prompt for command line arguments." - (interactive "P") - (let ((rnewest (ess-find-newest-R))) - (if (not rnewest) - (error "No version of R could be found.") - ;; Else: we have a working version of R. - ;; Have to be careful to avoid recursion... - (message (concat "Newest version of R is " rnewest)) - (fset 'R-newest - (intern - (if ess-microsoft-p - (ess-rterm-arch-version rnewest) - rnewest))) - ;;(fset 'R-newest (intern rnewest)) - (R-newest start-args)))) - -;; (ess-r-version-date "R-2.5.1") (ess-r-version-date "R-patched") -;; (ess-r-version-date "R-1.2.1") (ess-r-version-date "R-1.8.1") -;; Windows: -;; (ess-r-version-date "C:/Program Files (x86)/R/R-2.11.1/bin/Rterm.exe") -;; Note that for R-devel, ver-string is something like -;; R version 2.6.0 Under development (unstable) (2007-07-14 r42234) -;; Antique examples are 'R 1.0.1 (April 14, 2000)' or 'R 1.5.1 (2002-06-17).' -(defun ess-r-version-date (rver) - "Return the date of the version of R named RVER. -The date is returned as a date string. If the version of R could -not be found from the output of the RVER program, \"-1\" is -returned." - (let ((date "-1") - (ver-string (shell-command-to-string - ;; here, MS Windows (shell-command) needs a short name: - (concat (if ess-microsoft-p (w32-short-file-name rver) rver) - " --version")))) - (when (string-match - "R \\(version \\)?[1-9][^\n]+ (\\(2[0-9-]+\\)\\( r[0-9]+\\)?)" - ver-string) - (setq date (match-string 2 ver-string))) - (cons date rver))) - -(defun ess-current-R-version () - "Get the version of R currently running in the ESS buffer as a string" - (ess-make-buffer-current) - (car (ess-get-words-from-vector "as.character(.ess.Rversion)\n"))) - -(defun ess-current-R-at-least (version) - "Is the version of R (in the ESS buffer) at least (\">=\") VERSION ? -Examples: (ess-current-R-at-least '2.7.0) - or (ess-current-R-at-least \"2.5.1\")" - (ess-make-buffer-current) - (string= "TRUE" - (car (ess-get-words-from-vector - (format "as.character(.ess.Rversion >= \"%s\")\n" version))))) - -(defvar ess-temp-newest nil) - -(defun ess-newest-r (rvers) - "Check all the versions of RVERS to see which is the newest. -Return the name of the newest version of R." - (let ((rtimes (mapcar 'ess-r-version-date rvers))) - ;; SJE: 2007-07-13 -- following line is a temp var to check that - ;; the newest version of R is found correctly. - ;; (nowadays gives a compile warning) - (setq ess-temp-newest rtimes) - (ess-find-newest-date rtimes))) - -;; Test case for following defun: -;; (setq a '( ("2003-10-04" . "R-1.7") -;; ("2006-11-19" . "R-2.2") -;; ("2007-07-01" . "R-dev") -;; ("-1" . "R-broken") -;; ("2005-12-30" . "R-2.0"))) -;; (ess-find-newest-date a) -(defun ess-find-newest-date (rvers) - "Find the newest version of R given in the a-list RVERS. -Each element of RVERS is a dotted pair (date . R-version), where -date is given as e.g.\"2007-11-30\" so that we can compare dates -as strings. If a date is listed as \"-1\", that version of R -could not be found. - -If the value returned is nil, no valid newest version of R could be found." - (let (new-r this-r - (new-time "0")) - (while rvers - (setq this-r (car rvers) - rvers (cdr rvers)) - (when (string< new-time (car this-r)) - (setq new-time (car this-r) - new-r (cdr this-r)))) - new-r)) - - -(defun ess-find-rterm (&optional ess-R-root-dir bin-Rterm-exe) - "Find the full path of all occurences of Rterm.exe under the ESS-R-ROOT-DIR. -If ESS-R-ROOT-DIR is nil, construct it by looking for an occurence of Rterm.exe -in the exec-path. If there are no occurences of Rterm.exe in the exec-path, -then use `ess-program-files' (which evaluates to something like \"c:/progra~1/R/\" -in English locales) which is the default location for the R distribution. -If BIN-RTERM-EXE is nil, then use \"bin/Rterm.exe\"." - (if (not ess-R-root-dir) - (let ((Rpath (executable-find "Rterm"))) - (setq ess-R-root-dir - (expand-file-name - (if Rpath - (concat (file-name-directory Rpath) "../../") - (concat ess-program-files "/R/")))) - (ess-write-to-dribble-buffer - (format "(ess-find-rterm): ess-R-root-dir = '%s'\n" ess-R-root-dir)))) - - (if (not bin-Rterm-exe) (setq bin-Rterm-exe "bin/Rterm.exe")) - - (when (file-directory-p ess-R-root-dir) ; otherwise file-name-all-.. errors - (setq ess-R-root-dir - (ess-replace-regexp-in-string "[\\]" "/" ess-R-root-dir)) - (let ((R-ver - (ess-drop-non-directories - (ess-flatten-list - (mapcar (lambda (r-prefix) - (file-name-all-completions r-prefix ess-R-root-dir)) - (append '("rw") ess-r-versions)))))) - (mapcar (lambda (dir) - (let ((R-path - (concat ess-R-root-dir - (ess-replace-regexp-in-string "[\\]" "/" dir) - bin-Rterm-exe))) - (if (file-exists-p R-path) R-path))) - R-ver)))) - -;;;### autoload -(defun Rnw-mode () - "Major mode for editing Sweave(R) source. -See `ess-noweb-mode' and `R-mode' for more help." - (interactive) - (require 'ess-noweb);; << probably someplace else - (setq ess--make-local-vars-permanent t) - (ess-noweb-mode 1); turn it on - (ess-noweb-set-doc-mode 'latex-mode) - (ess-noweb-set-code-mode 'R-mode) - (setq ess--local-handy-commands - (append '(("weave" . ess-swv-weave) - ("tangle" . ess-swv-tangle)) - ess-handy-commands) - ess-dialect "R" - ess-language "S") - (put 'ess--local-handy-commands 'permanent-local t) - (run-hooks 'Rnw-mode-hook)) - -(fset 'Snw-mode 'Rnw-mode); just a synonym (for now or ever) - -(autoload 'ess-transcript-mode "ess-trns" - "Major mode for editing S transcript files." t) - -(defun R-transcript-mode () - "Does the right thing." - (interactive) - (ess-transcript-mode ess-r-customize-alist)) - -(fset 'r-transcript-mode 'R-transcript-mode) - -(defun R-fix-T-F (&optional from quietly) - "Fix T/F into TRUE and FALSE *cautiously*, i.e. not in comments and strings; - starting from the current position (point)." - (interactive "d\nP"); point and prefix (C-u) - (save-excursion - (goto-char from) - (ess-rep-regexp "\\(\\([][=,()]\\|<-\\) *\\)T\\>" "\\1TRUE" - 'fixcase nil (not quietly)) - (goto-char from) - (ess-rep-regexp "\\(\\([][=,()]\\|<-\\) *\\)F\\>" "\\1FALSE" - 'fixcase nil (not quietly)))) - -;; From: Sebastian Luque -;; To: ess-help@stat.math.ethz.ch -;; Date: Mon, 01 May 2006 19:17:49 -0500 - -;; Without knowing how to tell R to use w3m from within Emacs, and after -;; switching to Konqueror's window for the millionth time, I wrote the -;; following function: - -;; This emulates some of the functionality of RSiteSearch() and tests ok in -;; my system GNU Emacs 22.0.50.1 (i486-pc-linux-gnu, X toolkit, Xaw3d scroll -;; bars) of 2006-04-27 on pacem, modified by Debian. This has the benefit of -;; displaying results with whatever you've told browse-url to use; in my -;; case, w3m with the emacs-w3m package. - -;; My elisp skills are rather poor, so comments and suggestions for -;; improvement are welcome. -;; -- -;; Seb - - -;; MM _FIXME_: This only works correctly for Emacs 22.0.50 (alpha) -;; for 21.x it has problems in the (completing-read-multiple .) -;; at the end -(defun R-site-search (string) - "Search the R archives for STRING, using default criteria. If -called with a prefix, options are available for - 1) matches per page, - 2) sections of the archives to search (separated by value of `crm-default-separator'), - 3) for displaying results in long or short formats, and - 4) for sorting by any given field. -Completion is available for supplying options." - (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" "short") - 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))) - ;; else: without prefix use defaults: - (browse-url (concat site okstring "&max=20&result=normal&sort=score" - "&idxname=Rhelp02a&idxname=functions&idxname=docs"))))) - -(defvar ess--packages-cache nil - "Cache var to store package names. Used by - `ess-install.packages'.") - -(defvar ess--CRAN-mirror nil - "CRAN mirror name cache.") - -(defun ess-R-install.packages (&optional update pack) - "Prompt and install R package. With argument, update cached packages list." - (interactive "P") - (when (equal "@CRAN@" (car (ess-get-words-from-vector "getOption('repos')[['CRAN']]\n"))) - (ess-setCRANMiror ess--CRAN-mirror) - (ess-wait-for-process (get-process ess-current-process-name)) - (unless pack (setq update t))) - (when (or update - (not ess--packages-cache)) - (message "Fetching R packages ... ") - (setq ess--packages-cache - (ess-get-words-from-vector "print(rownames(available.packages()), max=1e6)\n"))) - (let* ((ess-eval-visibly-p t) - (pack (or pack - (ess-completing-read "Package to install" ess--packages-cache)))) - (process-send-string (get-process ess-current-process-name) - (format "install.packages('%s')\n" pack)) - (display-buffer (buffer-name (process-buffer (get-process ess-current-process-name)))))) - -(define-obsolete-function-alias 'ess-install.packages 'ess-R-install.packages "ESS[12.09-1]") - -(defun ess-install-library () - "Install library/package for current dialect. -Currently works only for R." - (interactive) - (if (not (string-match "^R" ess-dialect)) - (message "Sorry, not available for %s" ess-dialect) - (ess-R-install.packages))) - - -(defun ess-setRepositories () - "Call setRepositories()" - (interactive) - (if (not (string-match "^R" ess-dialect)) - (message "Sorry, not available for %s" ess-dialect) - (ess-eval-linewise "setRepositories(FALSE)\n"))) - -(defun ess-setCRANMiror (&optional mirror) - "Set cran mirror" - (interactive) - (let ((mirror-cmd "local({r <- getOption('repos'); r['CRAN'] <- '%s';options(repos=r)})\n")) - (if mirror - (ess-command (format mirror-cmd mirror)) - (let* ((M1 (ess-get-words-from-vector "local({out <- getCRANmirrors(local.only=TRUE); print(paste(out$Name,'[',out$URL,']', sep=''))})\n")) - (M2 (mapcar (lambda (el) - (string-match "\\(.*\\)\\[\\(.*\\)\\]$" el) - (propertize (match-string 1 el) 'URL (match-string 2 el))) - M1)) - (mirror (ess-completing-read "Choose CRAN mirror" M2 nil t))) - (when mirror - (setq mirror (get-text-property 0 'URL mirror)) - (setq ess--CRAN-mirror mirror) - (ess-command (format mirror-cmd mirror)))))) - (message "CRAN mirror: %s" (car (ess-get-words-from-vector "getOption('repos')[['CRAN']]\n")))) - -(defun ess-R-sos (cmd) - "Interface to findFn in the library sos." - ;(interactive (list (read-from-minibuffer "Web search for:" nil nil t nil (current-word)))) - (interactive "sfindFn: ") - (unless (equal "TRUE" (car (ess-get-words-from-vector "as.character(suppressPackageStartupMessages(require(sos)))\n"))) - (if (y-or-n-p "Library 'sos' is not installed. Install? ") - (progn (ess-eval-linewise "install.packages('sos')\n") - (ess-eval-linewise "library(sos)\n")) - (signal 'quit nil))) - (message nil) - (ess-eval-linewise (format "findFn(\"%s\", maxPages=10)" cmd))) - -(define-obsolete-function-alias 'ess-sos 'ess-R-sos "ESS[12.09-1]") - -(defun ess-R-scan-for-library-call (string) - "Detect `library/require' calls in string and update tracking vars. -Placed into `ess-presend-filter-functions' for R dialects." - (when (string-match-p "\\blibrary(\\|\\brequire(" string) - (ess--mark-search-list-as-changed)) - string) - -(defun ess-load-library () - "Prompt and load dialect specific library/package/module. - -Note that add-ons in R are called 'packages' and the name of this -function has nothing to do with R package mechanism, but it -rather serves a generic, dialect independent purpose. It is also -similar to `load-library' emacs function." - (interactive) - (if (not (string-match "^R" ess-dialect)) - (message "Sorry, not available for %s" ess-dialect) - (let ((ess-eval-visibly-p t) - (packs (ess-get-words-from-vector "print(.packages(T), max=1e6)\n")) - pack) - (setq pack (ess-completing-read "Load" packs)) - (ess-eval-linewise (format "library('%s')\n" pack)) - (ess--mark-search-list-as-changed) - (display-buffer (buffer-name (process-buffer (get-process ess-current-process-name))))))) - -(define-obsolete-function-alias 'ess-library 'ess-load-library "ESS[12.09-1]") - -;;; smart-comma was a bad idea -(eval-after-load "eldoc" - '(eldoc-add-command "ess-smart-comma")) - - -;;*;; Interaction with R - -;;;*;;; Evaluation - -(defun ess-r-arg (param value &optional wrap) - (let ((value (if wrap - (concat "'" value "'") - value))) - (concat ", " param " = " value))) - -(defun ess-r-build-args (visibly output namespace) - (let ((visibly (ess-r-arg "visibly" (if visibly "TRUE" "FALSE"))) - (output (ess-r-arg "output" (if output "TRUE" "FALSE"))) - (pkg (when namespace (ess-r-arg "package" namespace t))) - (verbose (when (and namespace - ess-r-namespaced-load-verbose) - (ess-r-arg "verbose" "TRUE")))) - (concat visibly output pkg verbose))) - -(ess-defmethod R ess-build-eval-command (string &optional visibly output file namespace) - (let* ((namespace (unless ess-debug-minor-mode - (or namespace (ess-r-get-evaluation-env)))) - (cmd (if namespace ".ess.ns_eval" ".ess.eval")) - (file (when file (ess-r-arg "file" file t))) - (args (ess-r-build-args visibly output namespace))) - (concat cmd "(\"" string "\"" args file ")\n"))) - -(ess-defmethod R ess-build-load-command (file &optional visibly output namespace) - (let* ((namespace (or namespace (ess-r-get-evaluation-env))) - (cmd (if namespace ".ess.ns_source" ".ess.source")) - (args (ess-r-build-args visibly output namespace))) - (concat cmd "('" file "'" args ")\n"))) - -(defun ess-r-build-eval-message (message) - (let ((env (cond (ess-debug-minor-mode - (substring-no-properties ess-debug-indicator 1)) - ((ess-r-get-evaluation-env))))) - (if env - (format "[%s] %s" env message) - message))) - -(defvar-local ess-r-evaluation-env nil - "Environment into which code should be evaluated. -When this variable is nil, code is evaluated in the current -environment. Currently only packages can be set as evaluation -environments. Use `ess-r-set-evaluation-env' to set this -variable.") - -(defun ess-r-get-evaluation-env () - "Get current evaluation env." - (or ess-r-evaluation-env - (and ess-current-process-name - (ess-get-process-variable 'ess-r-evaluation-env)))) - -(defvar ess-r-prompt-for-attached-pkgs-only nil - "If nil provide completion for all installed R packages. -If non-nil, only look for attached packages.") - -(defun ess-r-set-evaluation-env (&optional arg) - "Select a package namespace for evaluation of R code. - -Call interactively with a prefix argument to disable evaluation -in a namespace. When calling from a function, ARG can be a -string giving the package to select, any other non-nil value to -disable, or nil to prompt for a package. - -If `ess-r-prompt-for-attached-pkgs-only' is non-nil, prompt only for -attached packages." - (interactive "P") - (let ((env (cond ((stringp arg) arg) - ((null arg) (ess-r--select-package-name)) - (t "*none*")))) - (if (equal env "*none*") - (let ((cur-env (ess-r-get-evaluation-env))) - ;; fixme: does not work if env is set at process level - (setq ess-r-evaluation-env nil) - (delq 'ess-r--evaluation-env-mode-line ess--local-mode-line-process-indicator) - (message (format "Evaluation in %s disabled" (propertize cur-env 'face font-lock-function-name-face)))) - (setq ess-r-evaluation-env env) - (add-to-list 'ess--local-mode-line-process-indicator 'ess-r--evaluation-env-mode-line t) - (message (format "Evaluating in %s" (propertize env 'face font-lock-function-name-face)))) - (force-mode-line-update))) - -(defvar-local ess-r--evaluation-env-mode-line - '(:eval (let ((env (ess-r-get-evaluation-env))) - (if env - (format " %s" - (propertize (if (equal env (car (ess-r-package-get-info))) - "pkg" - env) - 'face 'mode-line-emphasis)) - "")))) -(put 'ess-r--evaluation-env-mode-line 'risky-local-variable t) - -(defvar ess-r-namespaced-load-verbose t - "Whether to display information on namespaced loading. - -When t, loading a file into a namespaced will output information -about which objects are exported and which stay hidden in the -namespace.") - -(defvar ess-r-namespaced-load-only-existing t - "Whether to load only objects already existing in a namespace.") - -(ess-defmethod R ess-load-file (file) - (cond - ;; Namespaced evaluation - ((ess-r-get-evaluation-env) - (ess-r-load-file-namespaced file)) - ;; Evaluation into current env via .ess.source() - (t - (let ((command (ess-build-load-command file nil t))) - (ess-send-string (ess-get-process) command))))) - -(defun ess-r-load-file-namespaced (&optional file) - "Load FILE into a package namespace. - -This prompts for a package when no package is currently -selected (see `ess-r-set-evaluation-env')." - (interactive) - (ess-force-buffer-current "R process to use: ") - (let* ((pkg-name (ess-r-get-evaluation-env)) - (command (ess-build-load-command file nil t pkg-name))) - (ess-send-string (ess-get-process) command))) - -(ess-defmethod R ess-send-region (proc start end visibly message type) - (cond - ;; Namespaced evaluation - ((ess-r-get-evaluation-env) - (ess-r-send-region-namespaced proc start end visibly message)) - ;; Evaluation into current env - (t - (ess-send-string proc (buffer-substring start end) visibly message type)))) - -(defun ess-r-send-region-namespaced (proc beg end &optional visibly message) - "Ask for for the package and devSource region into it." - (let* ((pkg-name (or (ess-r-get-evaluation-env) - (ess-r-set-evaluation-env)))) - (message (ess-r-build-eval-message (or message "Eval region")))) - (ess-send-string proc (buffer-substring start end) visibly message)) - - -;;;*;;; Help - -(defun ess-r-namespaced-object-p (object) - (string-match "^[[:alnum:].]+::" object)) - -(defun ess-r-build-help-command--qualified (object) - (when (ess-r-namespaced-object-p object) - (let* ((pkg-name (substring object (match-beginning 0) (- (match-end 0) 2))) - (object (concat "'" (substring object (match-end 0)) "'")) - (pkg (ess-r-arg "package" pkg-name t))) - (concat ".ess.help(" object pkg ")\n")))) - -(defun ess-r-build-help-command--get-package-dir (object dont-ask) - ;; Ugly hack to avoid tcl/tk dialogues - (let ((pkgs (ess-get-words-from-vector - (format "as.character(help('%s'))\n" object)))) - (when (> (length pkgs) 1) - (if dont-ask - (car pkgs) - (ess-completing-read "Choose location" pkgs nil t))))) - -(defun ess-r-build-help-command--unqualified (object dont-ask) - (if (eq ess-help-type 'index) - ;; we are in index page, qualify with namespace - (ess-r-build-help-command--qualified (format "%s::%s" ess-help-object object)) - (let ((pkg-dir (ess-r-build-help-command--get-package-dir object dont-ask)) - (command (format inferior-ess-r-help-command object))) - (if pkg-dir - ;; Invoking `print.help_files_with_topic' - (format "do.call(structure, c('%s', attributes(%s)))\n" pkg-dir command) - command)))) - -(defun ess-r-build-help-command (object &optional dont-ask) - (or (ess-r-build-help-command--qualified object) - (ess-r-build-help-command--unqualified object dont-ask))) - -(defconst inferior-ess-r--input-help (format "^ *help *(%s)" ess-help-arg-regexp)) -(defconst inferior-ess-r--input-?-help-regexp "^ *\\(?:\\(?1:[a-zA-Z ]*?\\?\\{1,2\\}\\) *\\(?2:.+\\)\\)") -(defconst inferior-ess-r--page-regexp (format "^ *page *(%s)" ess-help-arg-regexp)) - -(defvar ess-help-r--last-help-type nil - "Variable holding the last known help type. If it changes, -we flush the cache.") - -(defun ess-help-r--check-last-help-type () - (let ((help-type (ess-string-command "getOption('help_type')\n"))) - (when (not (string= help-type ess-help-r--last-help-type)) - (let ((help-buffers (ess-help-get-local-help-buffers))) - (mapc #'kill-buffer help-buffers)) - (setq ess-help-r--last-help-type help-type)))) - -(defun ess-help-r--process-help-input (proc string) - (let ((help-match (and (string-match inferior-ess-r--input-help string) - (match-string 2 string))) - (help-?-match (and (string-match inferior-ess-r--input-?-help-regexp string) - string)) - (page-match (and (string-match inferior-ess-r--page-regexp string) - (match-string 2 string)))) - (when (or help-match help-?-match page-match) - (ess-help-r--check-last-help-type) - (cond (help-match - (ess-display-help-on-object help-match) - (process-send-string proc "\n")) - (help-?-match - (ess-help-r--display-help-? proc string help-?-match) - (process-send-string proc "\n")) - (page-match - (switch-to-buffer-other-window - (ess-command (concat page-match "\n") - (get-buffer-create (concat page-match ".rt")))) - (R-transcript-mode) - (process-send-string proc "\n"))) - t))) - -(defun ess-help-r--display-help-? (proc string help-?-match) - (cond ((string-match "\\?\\?\\(.+\\)" help-?-match) - (ess--display-indexed-help-page (concat help-?-match "\n") - "^\\([^ \t\n]+::[^ \t\n]+\\)[ \t\n]+" - (format "*ess-apropos[%s](%s)*" - ess-current-process-name (match-string 1 help-?-match)) - 'appropos)) - ((string-match "^ *\\? *\\([^ \t]+\\)$" help-?-match) - (ess-display-help-on-object (match-string 1 help-?-match))) - ;; Anything else we send to process almost unchanged - (t - (let ((help-?-match (and (string-match inferior-ess-r--input-?-help-regexp string) - (format "%s%s" (match-string 1 string) - (ess-help-r--sanitize-topic (match-string 2 string)))))) - (ess-display-help-on-object help-?-match "%s\n"))))) - -(defun ess-help-r--sanitize-topic (string) - ;; Enclose help topics into `` to avoid ?while ?if etc hangs - (if (string-match "\\([^:]*:+\\)\\(.*\\)$" string) ; treat foo::bar corectly - (format "%s`%s`" (match-string 1 string) (match-string 2 string)) - (format "`%s`" string))) - -;;;*;;; Utils for inferior R process - -(defun inferior-ess-r-input-sender (proc string) - (save-current-buffer - (or (ess-help-r--process-help-input proc string) - (inferior-ess-input-sender proc string)))) - -(defun inferior-ess-r-load-ESSR () - "Load/INSTALL/Update ESSR." - (let* ((pkg-dir (expand-file-name "ESSR" ess-etc-directory)) - (src-dir (expand-file-name "R" pkg-dir))) - - (if (not (or (and (boundp 'ess-remote) ess-remote) - (file-remote-p (ess-get-process-variable 'default-directory)))) - (inferior-ess-r-load-ESSR--local pkg-dir src-dir) - (inferior-ess-r-load-ESSR--remote pkg-dir src-dir)))) - -(defun inferior-ess-r-load-ESSR--local (pkg-dir src-dir) - (let ((cmd (format "local({ - source('%s/.load.R', local=TRUE) #define load.ESSR - load.ESSR('%s') - })\n" - src-dir src-dir))) - (ess-write-to-dribble-buffer (format "load-ESSR cmd:\n%s\n" cmd)) - (with-current-buffer (ess-command cmd) - (let ((msg (buffer-string))) - (when (> (length msg) 1) - (message (format "load ESSR: %s" msg))))))) - -(defun inferior-ess-r-load-ESSR--remote (pkg-dir src-dir) - (let* ((verfile (expand-file-name "VERSION" pkg-dir)) - (loadremote (expand-file-name "LOADREMOTE" pkg-dir)) - (version (if (file-exists-p verfile) - (with-temp-buffer - (insert-file-contents verfile) - (buffer-string)) - (error "Cannot find ESSR source code"))) - (r-load-code (with-temp-buffer - (insert-file-contents loadremote) - (buffer-string)))) - (ess-write-to-dribble-buffer (format "version file: %s\nloadremote file: %s\n" - verfile loadremote)) - (unless (ess-boolean-command (format r-load-code version) nil 0.1) - (let ((errmsg (with-current-buffer " *ess-command-output*" (buffer-string))) - (files (directory-files src-dir t "\\.R$"))) - (ess-write-to-dribble-buffer (format "error loading ESSR.rda: \n%s\n" errmsg)) - ;; should not happen, unless extrem conditions (ancient R or failed download)) - (message "Failed to download ESSR.rda (see *ESS* buffer). Injecting ESSR code from local machine") - (ess-command (format ".ess.ESSRversion <- '%s'\n" version)) ; cannot do this at R level - (mapc #'ess--inject-code-from-file files))))) - -(ess-defmethod R ess-quit (&optional no-save) - (let (cmd - ;;Q response - (sprocess (ess-get-process ess-current-process-name))) - (if (not sprocess) (error "No ESS process running")) - ;;Q (setq response (completing-read "Save workspace image? " - ;;Q '( ( "yes".1) ("no" . 1) ("cancel" . 1)) - ;;Q nil t)) - ;;Q (if (string-equal response "") - ;;Q (setq response "default")); which will ask again (in most situations) - ;;Q (unless (string-equal response "cancel") - (ess-cleanup) - ;;Q (setq cmd (format "q(\"%s\")\n" response)) - (setq cmd (format "base::q('%s')\n" (if no-save "no" "default"))) - (goto-char (marker-position (process-mark sprocess))) - (process-send-string sprocess cmd))) - -(defcustom inferior-ess-r-reload-hook nil - "Hook run when reloading the R inferior buffer." - :type 'hook - :group 'ess-R) - -(ess-defmethod R inferior-ess-reload (&optional start-args) - (inferior-ess-r-force) - (let ((pkg-info ess-r-package-info) - (r-proc (ess-get-process))) - (with-ess-process-buffer nil - (ess-quit 'no-save) - (while (memq (process-status r-proc) '(run busy)) - (accept-process-output r-proc 0.002)) - (R start-args) - (run-hooks 'inferior-ess-r-reload-hook)))) - -(defun inferior-ess-r-force (&optional prompt force no-autostart ask-if-1) - (setq ess-dialect "R") - (ess-force-buffer-current prompt force no-autostart ask-if-1)) - - -;;*;; Editing Tools - -;;;*;;; Indentation Engine - -;; Written by Lionel Henry in mid 2015 - -(defun ess-r-indent-line () - "Indent current line as ESS R 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)) - (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. - (when (> (- (point-max) pos) (point)) - (goto-char (- (point-max) pos)))) - shift-amt)) - -(defun ess-r-indent-exp () - (save-excursion - (when current-prefix-arg - (ess-climb-to-top-level)) - (let* ((bounds (ess-continuations-bounds)) - (end (cadr bounds)) - (beg (if current-prefix-arg - (car bounds) - (forward-line) - (point)))) - (indent-region beg end)))) - -(defun ess-indent-call (&optional start) - (save-excursion - (when (ess-escape-calls) - (setq start (or start (point))) - (skip-chars-forward "^[(") - (forward-char) - (ess-up-list) - (indent-region start (point))))) - -(defun ess-offset (offset) - (setq offset (eval (intern (concat "ess-offset-" (symbol-name offset))))) - (when (and (not (eq offset nil)) - (listp offset) - (or (numberp (cadr offset)) - (eq (cadr offset) t) - (error "Malformed offset"))) - (setq offset (cadr offset))) - (cond ((numberp offset) - offset) - ((null offset) - 0) - (t - ess-indent-level))) - -(defun ess-offset-type (offset) - (setq offset (eval (intern (concat "ess-offset-" (symbol-name offset))))) - (if (listp offset) - (car offset) - offset)) - -(defun ess-overridden-blocks () - (append (when (memq 'fun-decl ess-align-blocks) - (list (car ess-prefixed-block-patterns))) - (when (memq 'control-flow ess-align-blocks) - (append (cdr ess-prefixed-block-patterns) - '("}?[ \t]*else"))))) - -(defun ess-calculate-indent (&optional parse-start) - "Return appropriate indentation for current line as ESS 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)) - (state (syntax-ppss)) - (containing-sexp (cadr state)) - (prev-containing-sexp (car (last (butlast (nth 9 state)))))) - (ess-back-to-indentation) - (cond - ;; Strings - ((ess-within-string-p state) - (current-indentation)) - ;; Comments - ((ess-calculate-indent--comments)) - ;; Indentation of commas - ((looking-at ",") - (ess-calculate-indent--comma)) - ;; Arguments: Closing - ((ess-call-closing-p) - (ess-calculate-indent--call-closing-delim)) - ;; Block: Contents (easy cases) - ((ess-calculate-indent--block-relatively)) - ;; Block: Prefixed block - ((ess-calculate-indent--prefixed-block-curly)) - ;; Continuations - ((ess-calculate-indent--continued)) - ;; Block: Overridden contents - ((ess-calculate-indent--aligned-block)) - ;; Block: Opening - ((ess-block-opening-p) - (ess-calculate-indent--block-opening)) - ;; Bare line - ((and (null containing-sexp) - (not (ess-unbraced-block-p))) - 0) - ;; Block: Closing - ((ess-block-closing-p) - (ess-calculate-indent--block 0)) - ;; Block: Contents - ((ess-block-p) - (ess-calculate-indent--block)) - ;; Arguments: Nested calls override - ((ess-calculate-indent--nested-calls)) - ;; Arguments: Contents - (t - (ess-calculate-indent--args)))))) - -(defun ess-calculate-indent--comments () - (when ess-indent-with-fancy-comments - (cond - ;; ### or #! - ((or (looking-at "###") - (and (looking-at "#!") - (= 1 (line-number-at-pos)))) - 0) - ;; Single # comment - ((looking-at "#[^#']") - comment-column)))) - -(defun ess-calculate-indent--comma () - (when (ess-within-call-p) - (let ((indent (save-excursion - (ess-calculate-indent--args))) - (unindent (progn (skip-chars-forward " \t") - ;; return number of skiped chars - (skip-chars-forward ", \t")))) - (- indent unindent)))) - -(defun ess-calculate-indent--call-closing-delim () - (cond ((save-excursion - (ess-skip-blanks-backward t) - (eq (char-before) ?,)) - (ess-calculate-indent--args nil)) - ((save-excursion - (and (ess-ahead-operator-p) - (or (ess-ahead-definition-op-p) - (not ess-align-continuations-in-calls)))) - (ess-calculate-indent--continued)) - (t - (ess-calculate-indent--args 0)))) - -(defun ess-calculate-indent--block-opening () - (cond - ;; Block is an argument in a function call - ((when containing-sexp - (ess-at-containing-sexp - (ess-behind-call-opening-p "[[(]"))) - (ess-calculate-indent--block 0)) - ;; Top-level block - ((null containing-sexp) 0) - ;; Block is embedded in another block - ((ess-at-containing-sexp - (equal (char-after) ?\{) - (+ (current-indentation) - (ess-offset 'block)))))) - -(defun ess-calculate-indent--aligned-block () - ;; Check for `else' opening - (if (and (memq 'control-flow ess-align-blocks) - (looking-at "else\\b") - (ess-climb-if-else)) - (progn - (when (looking-at "else\\b") - (ess-skip-curly-backward)) - (current-column)) - ;; Check for braced and unbraced blocks - (ess-save-excursion-when-nil - (let ((offset (if (looking-at "[{})]") - 0 (ess-offset 'block)))) - (when (and (cond - ;; Unbraced blocks - ((ess-climb-block-prefix)) - ;; Braced blocks - (containing-sexp - (when (ess-at-containing-sexp - (looking-at "{")) - (ess-escape-prefixed-block)))) - (some 'looking-at (ess-overridden-blocks))) - (+ (current-column) offset)))))) - -(defun ess-calculate-indent--block-relatively () - (ess-save-excursion-when-nil - (let ((offset (if (looking-at "[})]") 0 (ess-offset 'block))) - (start-line (line-number-at-pos))) - (cond - ;; Braceless block continuations: only when not in a call - ((ess-save-excursion-when-nil - (and (not (looking-at "{")) - (ess-goto-char (ess-unbraced-block-p)) - (not (looking-at "function\\b")) - (or (null containing-sexp) - (ess-at-containing-sexp - (not (looking-at "(")))))) - (ess-maybe-climb-broken-else 'same-line) - (ess-skip-curly-backward) - (+ (current-column) - (ess-offset 'block))) - ;; Don't indent relatively other continuations - ((ess-ahead-continuation-p) - nil) - ;; If a block already contains an indented line, we can indent - ;; relatively from that first line - ((ess-save-excursion-when-nil - (and (not (looking-at "}")) - containing-sexp - (goto-char containing-sexp) - (looking-at "{") - (progn - (forward-line) - (ess-back-to-indentation) - (/= (line-number-at-pos) start-line)) - (not (looking-at "[ \t]*\\(#\\|$\\)")) - (save-excursion - (or (ess-jump-expression) - (ess-jump-continuations)) - (< (line-number-at-pos) start-line)))) - (current-column)) - ;; If a block is not part of a call, we can indent relatively - ;; from the opening {. First check that enclosing { is first - ;; thing on line - ((and containing-sexp - (not (ess-unbraced-block-p)) - (goto-char containing-sexp) - (ess-block-opening-p) - (equal (point) (save-excursion - (ess-back-to-indentation) - (point)))) - (+ (current-column) offset)))))) - -(defun ess-arg-block-p () - (unless (or (null containing-sexp) - ;; Unbraced blocks in a { block are not arg blocks - (and (ess-unbraced-block-p) - (ess-at-containing-sexp - (looking-at "{")))) - (cond - ;; Unbraced body - ((ess-at-indent-point - (and (ess-unbraced-block-p) - (goto-char containing-sexp) - (ess-behind-call-opening-p "[[(]"))) - 'body) - ;; Indentation of opening brace as argument - ((ess-at-containing-sexp - (ess-behind-call-opening-p "[[(]")) - 'opening) - ;; Indentation of body or closing brace as argument - ((ess-at-containing-sexp - (and (or (looking-at "{") - (ess-behind-block-paren-p)) - prev-containing-sexp - (goto-char prev-containing-sexp) - (ess-behind-call-opening-p "[[(]"))) - 'body)))) - -(defun ess-calculate-indent--block (&optional offset) - (let ((arg-block (ess-arg-block-p))) - (cond (arg-block - (ess-calculate-indent--arg-block offset arg-block)) - (t - ;; Block is not part of an arguments list. Climb over any - ;; block opening (function declaration, etc) to indent from - ;; starting indentation. - (or (ess-climb-block-prefix) - (and (goto-char containing-sexp) - (ess-climb-block-prefix))) - (+ (current-indentation) (or offset (ess-offset 'block))))))) - -(defun ess-calculate-indent--arg-block (offset arg-block) - (let* ((block-type (cond ((or (ess-at-containing-sexp - (and (eq arg-block 'body) - (ess-climb-block-prefix "function"))) - (ess-at-indent-point - (and (eq arg-block 'opening) - (ess-backward-sexp 2) - (looking-at "function\\b")))) - 'fun-decl) - ((ess-at-indent-point - (ess-unbraced-block-p)) - 'unbraced) - ((ess-at-containing-sexp - (not (ess-ahead-attached-name-p))) - 'bare-block) - (t))) - (call-pos (if (and (not (eq block-type 'unbraced)) - (not (eq arg-block 'opening))) - (goto-char prev-containing-sexp) - (prog1 containing-sexp - (goto-char indent-point))))) - (ess-calculate-indent--args offset (ess-offset-type 'block) - call-pos indent-point block-type))) - -;; This function is currently the speed bottleneck of the indentation -;; engine. This is due to the need to call (ess-maximum-args-indent) -;; to check if some previous arguments have been pushed off from their -;; natural indentation: we need to check the whole call. This is very -;; inefficient especially when indenting a region containing a large -;; function call (e.g. some dplyr's data cleaning code). Should be -;; solved by implementing a cache as in (syntax-ppss), though it's -;; probably not worth the work. -(defun ess-calculate-indent--args (&optional offset type call-pos to block) - (let* ((call-pos (or call-pos containing-sexp)) - (max-col (prog1 (unless (eq type 'prev-line) - (ess-maximum-args-indent call-pos to)) - (goto-char call-pos))) - (override (and ess-align-arguments-in-calls - (save-excursion - (ess-climb-object) - (some 'looking-at ess-align-arguments-in-calls)))) - (type-sym (cond (block 'block) - ((looking-at "[[:blank:]]*[([][[:blank:]]*\\($\\|#\\)") - 'arguments-newline) - (t 'arguments))) - (type (or type - (and override 'open-delim) - (ess-offset-type type-sym))) - (offset (or offset - (and (not block) (eq type 'open-delim) 0) - (ess-offset type-sym))) - (indent - (cond - ;; Indent from opening delimiter - ((eq type 'open-delim) - (ess-calculate-indent--args-open-delim)) - ;; Indent from attached name - ((eq type 'prev-call) - (ess-calculate-indent--args-prev-call)) - ;; Indent from previous line indentation - ((eq type 'prev-line) - (ess-calculate-indent--args-prev-line)) - (t - (error "Malformed offset"))))) - (if max-col - (ess-adjust-argument-indent indent offset max-col block) - (+ indent offset)))) - -(defun ess-calculate-indent--args-open-delim () - (forward-char) - (current-column)) - -(defun ess-calculate-indent--args-prev-call () - ;; Handle brackets chains such as ][ (cf data.table) - (ess-climb-chained-delims) - ;; Handle call chains - (if ess-indent-from-chain-start - (while (and (ess-backward-sexp) - (when (looking-back "[[(][ \t,]*" (line-beginning-position)) - (goto-char (match-beginning 0))))) - (ess-backward-sexp)) - (when ess-indent-from-lhs - (ess-climb-lhs)) - (if (and nil - (eq block 'fun-decl) - (not (eq arg-block 'opening)) - (not (eq (ess-offset-type type-sym) 'open-delim))) - (+ (ess-offset 'block) (current-column)) - (current-column))) - -(defun ess-calculate-indent--args-prev-line () - (ess-at-indent-point - (cond - ;; Closing delimiters are actually not indented at - ;; prev-line, but at opening-line - ((looking-at "[]})]") - (ess-up-list -1) - (when (looking-at "{") - (ess-climb-block-prefix)) - (current-indentation)) - ;; Function blocks need special treatment - ((and (eq type 'prev-line) - (eq block 'fun-decl)) - (goto-char containing-sexp) - (ess-climb-block-prefix) - (current-indentation)) - ;; Regular case - (t - ;; Find next non-empty line to indent from - (while (and (= (forward-line -1) 0) - (looking-at "[ \t]*\\($\\|#\\)"))) - (goto-char (ess-code-end-position)) - ;; Climb relevant structures - (unless (ess-climb-block-prefix) - (when (eq (char-before) ?,) - (forward-char -1)) - (ess-climb-expression) - (ess-climb-continuations)) - ;; The following ensures that only the first line - ;; counts. Otherwise consecutive statements would get - ;; increasingly more indented. - (when (and block - containing-sexp - (not (eq block 'unbraced)) - (save-excursion - (/= (line-number-at-pos) - (progn (goto-char containing-sexp) - (line-number-at-pos))))) - (setq offset 0)) - (current-indentation))))) - -;; Indentation of arguments needs to keep track of how previous -;; arguments are indented. If one of those has a smaller indentation, -;; we push off the current line from its natural indentation. For -;; block arguments, we still need to push off this column so we ignore -;; it. -(defun ess-adjust-argument-indent (base offset max-col push) - (if push - (+ (min base max-col) offset) - (min (+ base offset) max-col))) - -;; When previous arguments are shifted to the left (can happen in -;; several situations) compared to their natural indentation, the -;; following lines should not get indented past them. The following -;; function checks the minimum indentation for all arguments of the -;; current function call or bracket indexing. -(defun ess-maximum-args-indent (&optional from to) - (let* ((to (or to (point))) - (to-line (line-number-at-pos to)) - (from-line (progn - (goto-char (1+ (or from containing-sexp))) - (line-number-at-pos))) - (prev-pos (1- (point))) - max-col) - (while (< (line-number-at-pos) to-line) - (forward-line) - (ess-back-to-indentation) - ;; Ignore the line with the function call, the line to be - ;; indented, and empty lines. - (unless (or (>= (line-number-at-pos) to-line) - (looking-at "[ \t]*\\($\\|#\\)")) - (let ((indent (cond - ;; First line: minimum indent is right after ( - ((= (line-number-at-pos) from-line) - (save-excursion - (goto-char (1+ containing-sexp)) - (current-column))) - ;; Handle lines starting with a comma - ((save-excursion - (looking-at ",")) - (+ (current-indentation) 2)) - (t - (current-indentation))))) - (setq max-col (min indent (or max-col indent)))))) - max-col)) - -;; Move to leftmost side of a call (either the first letter of its -;; name or its closing delim) -(defun ess-move-to-leftmost-side () - (when (or (looking-at "[({]") - (ess-behind-call-p)) - (ess-save-excursion-when-nil - (let ((start-col (current-column))) - (skip-chars-forward "^{[(") - (forward-char) - (ess-up-list) - (forward-char -1) - (< (current-column) start-col))))) - -(defun ess-max-col () - (let ((max-col (point))) - (save-excursion - (while (< (point) indent-point) - (unless (and ess-indent-with-fancy-comments - (looking-at "### ")) - (setq max-col (min max-col (current-column)))) - (forward-line) - (ess-back-to-indentation))) - max-col)) - -(defun ess-calculate-indent--prefixed-block-curly () - (when (looking-at "{") - (ess-save-excursion-when-nil - (let ((block-type (ess-climb-block-prefix))) - (cond ((ess-save-excursion-when-nil - (and (memq 'fun-decl-opening ess-indent-from-lhs) - (string= block-type "function") - (ess-climb-operator) - (ess-behind-assignment-op-p) - (ess-climb-expression))) - (current-column)) - ((= (save-excursion - (back-to-indentation) - (point)) - (point)) - (ess-calculate-indent--continued))))))) - -(defun ess-calculate-indent--continued () - "If a continuation line, return an indent of this line, -otherwise nil." - (save-excursion - (let* ((start-line (line-number-at-pos)) - (prev-pos 0) - (cascade (eq (ess-offset-type 'continued) 'cascade)) - (climbed (ess-climb-continuations cascade)) - max-col) - (when climbed - (cond - ;; Overridden calls - ((and ess-align-continuations-in-calls - (not (eq climbed 'def-op)) - containing-sexp - (save-excursion - (goto-char containing-sexp) - (looking-at "[[(]"))) - (setq max-col (ess-max-col)) - (ess-move-to-leftmost-side) - (+ (min (current-column) max-col) - (if (eq climbed 'def-op) - (ess-offset 'continued) - 0))) - ;; Regular case - (t - (let ((first-indent (or (eq climbed 'def-op) - (save-excursion - (when (ess-ahead-closing-p) - (ess-climb-expression)) - (not (ess-climb-continuations cascade)))))) - ;; Record all indentation levels between indent-point and - ;; the line we climbed. Some lines may have been pushed off - ;; their natural indentation. These become the new - ;; reference. - (setq max-col (ess-max-col)) - ;; Indenting continuations from the front of closing - ;; delimiters looks better - (when - (ess-ahead-closing-p) - (backward-char)) - (+ (min (current-column) max-col) - (cond - ((eq (ess-offset-type 'continued) 'cascade) - (ess-offset 'continued)) - (first-indent - (ess-offset 'continued)) - (t - 0)))))))))) - -(defun ess-calculate-indent--nested-calls () - (when ess-align-nested-calls - (let ((calls (mapconcat 'identity ess-align-nested-calls "\\|")) - match) - (save-excursion - (and containing-sexp - (looking-at (concat "\\(" calls "\\)(")) - (setq match (match-string 1)) - (goto-char containing-sexp) - (looking-at "(") - (ess-backward-sexp) - (looking-at (concat match "(")) - (current-column)))))) - - -;;;*;;; Call filling engine - -;; Unroll arguments to a single line until closing marker is found. -(defun ess-fill--unroll-lines (bounds &optional jump-cont) - (let* ((last-pos (point-min)) - (containing-sexp (ess-containing-sexp-position)) - prefix-break) - (goto-char (car bounds)) - (goto-char (ess-code-end-position)) - (while (and (/= (point) last-pos) - (< (line-end-position) - (cadr bounds)) - (not prefix-break)) - (setq last-pos (point)) - ;; Check whether we ended up in a sub call. In this case, jump - ;; over it, otherwise, join lines. - (let ((contained-sexp (ess-containing-sexp-position))) - (cond ((and contained-sexp - containing-sexp - (not (= containing-sexp contained-sexp))) - (goto-char (1+ contained-sexp)) - (ess-up-list)) - ;; Jump over continued statements - ((and jump-cont (ess-ahead-operator-p 'strict)) - (ess-climb-token) - (ess-jump-continuations)) - ;; Jump over comments - ((looking-at "#") - (forward-line) - (ess-indent-line)) - (t - (join-line 1)))) - (goto-char (ess-code-end-position))) - (goto-char (car bounds)))) - -(defvar ess-fill--orig-pos nil - "Original position of cursor.") - -(defvar ess-fill--orig-state nil - "Backup of original code to cycle back to original state.") - -(defvar ess-fill--second-state nil - "Backup of code produce by very first cycling. If this is equal - to orig-state, no need to cycle back to original state.") - -(defvar ess-fill--style-level nil - "Filling style used in last cycle.") - -(defun ess-fill--substring (bounds) - (buffer-substring (car bounds) (marker-position (cadr bounds)))) - -;; Detect repeated commands -(defun ess-fill-style (type bounds) - (let ((max-level - ;; This part will be simpler once we have the style alist - (cond ((eq type 'calls) - ;; No third style either when ess-offset-arguments is - ;; set to 'open-delim, or when ess-fill-calls-newlines - ;; is nil and no numeric prefix is given - (if (and (not (eq (ess-offset-type 'arguments) - 'open-delim)) - (or ess-fill-calls-newlines - (numberp current-prefix-arg))) - 3 - 2)) - ((eq type 'continuations) - 2)))) - (if (not (memq last-command '(fill-paragraph-or-region - fill-paragraph))) - (progn - ;; Record original state on first cycling - (setq ess-fill--orig-state (ess-fill--substring bounds)) - (setq ess-fill--orig-pos (point)) - (setq ess-fill--second-state nil) - (setq ess-fill--style-level 1)) - ;; Also record state on second cycling - (when (and (= ess-fill--style-level 1) - (null ess-fill--second-state)) - (setq ess-fill--second-state (ess-fill--substring bounds))) - (cond ((>= ess-fill--style-level max-level) - (let ((same-last-and-orig (string= (ess-fill--substring bounds) - ess-fill--orig-state)) - (same-2nd-and-orig (string= ess-fill--orig-state - ess-fill--second-state))) - ;; Avoid cycling to the same state twice - (cond ((and same-last-and-orig - same-2nd-and-orig) - (setq ess-fill--style-level 2)) - ((or same-last-and-orig - same-2nd-and-orig) - (setq ess-fill--style-level 1)) - (t - (setq ess-fill--style-level 0))))) - (ess-fill--style-level - (setq ess-fill--style-level (1+ ess-fill--style-level)))))) - ess-fill--style-level) - -(defun ess-fill-args (&optional style) - (let ((start-pos (point-min)) - (orig-col (current-column)) - (orig-line (line-number-at-pos)) - (bounds (ess-args-bounds 'marker)) - ;; Set undo boundaries manually - (undo-inhibit-record-point t) - last-pos last-newline prefix-break - infinite) - (when (not bounds) - (error "Could not find function bounds")) - (setq style (or style (ess-fill-style 'calls bounds))) - (if (= style 0) - (progn - (delete-region (car bounds) (marker-position (cadr bounds))) - (insert ess-fill--orig-state) - ;; Restore the point manually. (save-excursion) wouldn't - ;; work here because we delete the text rather than just - ;; modifying it. - (goto-char ess-fill--orig-pos) - (message "Back to original formatting")) - (when ess-blink-refilling - (ess-blink-region (nth 2 bounds) - (1+ (marker-position (cadr bounds))))) - (undo-boundary) - (save-excursion - (ess-fill--unroll-lines bounds t) - (cond - ;; Some styles start with first argument on a newline - ((and (memq style '(2 4)) - ess-fill-calls-newlines - (not (looking-at "[ \t]*#"))) - (newline-and-indent)) - ;; Third level, start a newline after N arguments - ((and (= style 3) - (not (looking-at "[ \t]*#"))) - (let ((i (if (numberp current-prefix-arg) - current-prefix-arg - 1))) - (while (and (> i 0) - (ess-jump-arg) - (ess-jump-char ",")) - (setq i (1- i)))) - (newline-and-indent))) - (ess-fill-args--roll-lines) - ;; Reindent surrounding context - (ess-indent-call (car bounds))) - ;; Signal marker for garbage collection - (set-marker (cadr bounds) nil) - (undo-boundary)))) - -(defun ess-fill-args--roll-lines () - (while (and (not (looking-at "[])]")) - (/= (point) (or last-pos 1)) - (not infinite)) - (setq prefix-break nil) - ;; Record start-pos as future breaking point to avoid breaking - ;; at `=' sign - (while (looking-at "[ \t]*[\n#]") - (forward-line) - (ess-back-to-indentation)) - (setq start-pos (point)) - (while (and (< (current-column) fill-column) - (not (looking-at "[])]")) - (/= (point) (or last-pos 1)) - ;; Break after one pass if prefix is active - (not prefix-break)) - (when (memq style '(2 3)) - (setq prefix-break t)) - (ess-jump-token ",") - (setq last-pos (point)) - ;; Jump expression and any continuations. Reindent all lines - ;; that were jumped over - (let ((cur-line (line-number-at-pos)) - end-line) - (cond ((ess-jump-arg) - (setq last-newline nil)) - ((ess-token-after= ",") - (setq last-newline nil) - (setq last-pos (1- (point))))) - (save-excursion - (when (< cur-line (line-number-at-pos)) - (setq end-line (line-number-at-pos)) - (ess-goto-line (1+ cur-line)) - (while (and (<= (line-number-at-pos) end-line) - (/= (point) (point-max))) - (ess-indent-line) - (forward-line)))))) - (when (or (>= (current-column) fill-column) - prefix-break - ;; Ensures closing delim on a newline - (and (= style 4) - (looking-at "[ \t]*[])]") - (setq last-pos (point)))) - (if (and last-pos (/= last-pos start-pos)) - (goto-char last-pos) - (ess-jump-char ",")) - (cond ((looking-at "[ \t]*[#\n]") - (forward-line) - (ess-indent-line) - (setq last-newline nil)) - ;; With levels 2 and 3, closing delim goes on a newline - ((looking-at "[ \t]*[])]") - (when (and (memq style '(2 3 4)) - ess-fill-calls-newlines - (not last-newline)) - (newline-and-indent) - ;; Prevent indenting infinitely - (setq last-newline t))) - ((not last-newline) - (newline-and-indent) - (setq last-newline t)) - (t - (setq infinite t)))))) - -(defun ess-fill-continuations (&optional style) - (let ((bounds (ess-continuations-bounds 'marker)) - (undo-inhibit-record-point t) - (last-pos (point-min)) - last-newline infinite) - (when (not bounds) - (error "Could not find statements bounds")) - (setq style (or style (ess-fill-style 'continuations bounds))) - (if (= style 0) - (progn - (delete-region (car bounds) (marker-position (cadr bounds))) - (insert ess-fill--orig-state) - (goto-char ess-fill--orig-pos) - (message "Back to original formatting")) - (when ess-blink-refilling - (ess-blink-region (car bounds) (marker-position (cadr bounds)))) - (undo-boundary) - (save-excursion - (ess-fill--unroll-lines bounds) - (while (and (< (point) (cadr bounds)) - (/= (point) (or last-pos 1)) - (not infinite)) - (setq last-pos (point)) - (when (and (ess-jump-expression) - (indent-according-to-mode) - (not (> (current-column) fill-column))) - (setq last-newline nil)) - (ess-jump-operator) - (if (or (and (> (current-column) fill-column) - (goto-char last-pos)) - (= style 2)) - (progn - (ess-jump-operator) - (unless (= (point) (cadr bounds)) - (when last-newline - (setq infinite t)) - (newline-and-indent) - (setq last-newline t))) - (setq last-newline nil))) - (ess-indent-call (car bounds))) - (set-marker (cadr bounds) nil) - (undo-boundary)))) - -(provide 'ess-r-d) - - ; Local variables section - -;;; This file is automatically placed in Outline minor mode. -;;; The file is structured as follows: -;;; Chapters: ^L ; -;;; Sections: ;;*;; -;;; Subsections: ;;;*;;; -;;; Components: defuns, defvars, defconsts -;;; Random code beginning with a ;;;;* comment - -;;; Local variables: -;;; mode: emacs-lisp -;;; outline-minor-mode: nil -;;; mode: outline-minor -;;; outline-regexp: "\^L\\|\\`;\\|;;\\*\\|;;;\\*\\|(def[cvu]\\|(setq\\|;;;;\\*" -;;; End: - -;;; ess-r-d.el ends here diff -Nru ess-16.10/lisp/ess-rd.el ess-17.11/lisp/ess-rd.el --- ess-16.10/lisp/ess-rd.el 2016-05-07 16:45:06.000000000 +0000 +++ ess-17.11/lisp/ess-rd.el 2017-11-13 14:13:16.000000000 +0000 @@ -28,6 +28,7 @@ ;; To stave off byte compiler errors (eval-when-compile (require 'ess-help)) +(require 'ess-utils) (defvar essddr-version "0.9-1" "Current version of ess-rd.el.") @@ -36,17 +37,6 @@ "ESS Core Team " "Current maintainer of ess-rd.el.") -(defun Rd-active-mark () nil) ;silence compiler. -(if (featurep 'xemacs) - ;; Special support for XEmacs (curtesy of auctex): - (defun Rd-active-mark () - (and zmacs-regions (mark))) - - ;; else: special support for GNU Emacs - (defun Rd-active-mark () - (and transient-mark-mode mark-active)) - ) - (autoload 'ess-eval-region "ess-inf" "[autoload]" t) (autoload 'ess-eval-line-and-step "ess-inf" "[autoload]" t) (autoload 'ess-switch-process "ess-inf" "[autoload]" t) @@ -143,7 +133,7 @@ ;; "Alpha" "Gamma" "alpha" "beta" "epsilon" "lambda" "mu" "pi" "sigma" ;; "ge" "le" "left" "right" ;; - "CRANpkg" "R" "RdOpts" "S3method" "S4method" "Sexpr" "acronym" + "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" @@ -151,6 +141,10 @@ "newcommand" "option" "out" "pkg" "sQuote" "renewcommand" "samp" "strong" "tab" "url" "var" "verb" + ;; System macros (from /share/Rd/macros/system.Rd ): + "CRANpkg" "PR" "sspace" "doi" + "packageTitle" "packageDescription" "packageAuthor" + "packageMaintainer" "packageDESCRIPTION" "packageIndices" )) ;; Need to fix Rd-bold-face problem. @@ -308,6 +302,14 @@ '(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 + (unless (featurep 'xemacs) + (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) @@ -460,7 +462,7 @@ (set-buffer "*Help*") (insert help)))) - ((Rd-active-mark) + ((region-active-p) (save-excursion (cond ((> (mark) (point)) (insert before) @@ -508,8 +510,9 @@ ;; (ess--flush-help-into-current-buffer file "tools::Rd2txt(\"%s\")\n") ;; instead of all this : (ess-setq-vars-local ess-r-customize-alist) - (setq ess-help-sec-regex ess-help-R-sec-regex - ess-help-sec-keys-alist ess-help-R-sec-keys-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) @@ -537,6 +540,8 @@ ;; Provide ourself +(provide 'ess-rd) +;; Legacy feature (provide 'essddr) ;; ess-rd.el ends here diff -Nru ess-16.10/lisp/ess-rdired.el ess-17.11/lisp/ess-rdired.el --- ess-16.10/lisp/ess-rdired.el 2015-09-19 03:25:42.000000000 +0000 +++ ess-17.11/lisp/ess-rdired.el 2017-11-13 14:13:16.000000000 +0000 @@ -63,8 +63,6 @@ ;; and can be altered to provide other information if you so need it. ;; (Martin Maechler suggested providing output from str() here.) -;; Tested on Emacs 21.2, 21.3 pretest and XEmacs 21.1.14, using R 1.6. - ;; Todo - compare functionality with ess-mouse-me (ess-mous.el). ;; Todo - How to select alternative environments? Currently only @@ -93,7 +91,7 @@ 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('object.size(get(\"%s\"))', 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) @@ -147,10 +145,7 @@ (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) - (if (featurep 'xemacs) - (define-key ess-rdired-mode-map [button2] 'ess-rdired-mouse-view) - (define-key ess-rdired-mode-map [mouse-2] 'ess-rdired-mouse-view) - ) + (define-key ess-rdired-mode-map [mouse-2] 'ess-rdired-mouse-view) ess-rdired-mode-map)) (defun ess-rdired-mode () @@ -468,13 +463,8 @@ (interactive "e") (let (window pos) (save-excursion - (if (featurep 'xemacs) - ;; XEmacs - (setq window (event-window event) - pos (event-point event)) - ;; Emacs - (setq window (posn-window (event-end event)) - pos (posn-point (event-end event)))) + (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)) diff -Nru ess-16.10/lisp/ess-r-gui.el ess-17.11/lisp/ess-r-gui.el --- ess-16.10/lisp/ess-r-gui.el 2016-10-22 16:03:27.000000000 +0000 +++ ess-17.11/lisp/ess-r-gui.el 2017-11-13 14:13:16.000000000 +0000 @@ -24,15 +24,16 @@ ;;; 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" +;; 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' @@ -109,17 +110,16 @@ '((ess-local-customize-alist . 'Rgui-customize-alist) (ess-dialect . "R") (ess-suffix . "R") - (ess-dump-filename-template . (ess-replace-regexp-in-string + (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 . 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-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-cmd-delay . ess-R-cmd-delay) - (ess-function-pattern . ess-R-function-pattern) + (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) @@ -130,8 +130,8 @@ (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-name) - (inferior-ess-objects-command . inferior-R-objects-command) - (inferior-ess-font-lock-keywords . 'inferior-R-font-lock-keywords) + (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") ;;? @@ -144,7 +144,7 @@ (inferior-ess-start-args . "") (inferior-ess-ddeclient . "execdde") (ess-STERM . "ddeSS") - (ess-editor . R-editor) + (ess-editor . ess-r-editor) (ess-pager . Rgui-pager) ) S-common-cust-alist) diff -Nru ess-16.10/lisp/ess-r-mode.el ess-17.11/lisp/ess-r-mode.el --- ess-16.10/lisp/ess-r-mode.el 1970-01-01 00:00:00.000000000 +0000 +++ ess-17.11/lisp/ess-r-mode.el 2017-11-13 14:13:16.000000000 +0000 @@ -0,0 +1,2238 @@ +;;; ess-r-mode.el --- R customization + +;; Copyright (C) 1997--2010 A.J. Rossini, Richard M. Heiberger, Martin +;; Maechler, Kurt Hornik, Rodney Sparapani, and Stephen Eglen. +;; Copyright (C) 2011--2017 A.J. Rossini, Richard M. Heiberger, Martin Maechler, +;; Kurt Hornik, Rodney Sparapani, Stephen Eglen and Vitalie Spinu. + +;; Author: A.J. Rossini +;; Created: 12 Jun 1997 +;; Maintainer: ESS-core + +;; 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: + +;; This file defines all the R customizations for ESS. See ess-s-lang.el +;; for general S language customizations. + +;;; Code: + +(with-no-warnings (require 'cl)) ; instead of cl-lib so we support Emacs 24.2 +(require 'compile) +(require 'easymenu) +(require 'eldoc) +(require 'ess-mode) +(require 'ess-help) +(require 'ess-s-lang) +(require 'ess-roxy) +(require 'ess-r-completion) +(require 'ess-r-syntax) +(require 'ess-r-package) + +(ess-message "[ess-r-mode:] (require 'ess-s-lang)") +(autoload 'ess-r-args-show "ess-r-args" "(Autoload)" t) +(autoload 'ess-r-args-auto-show "ess-r-args" "(Autoload)" t) + + +;;*;; Mode definition + +;;;*;;; UI (Keymaps / Menus) + +(defvar ess-dev-map + (let (ess-dev-map) + (define-prefix-command 'ess-dev-map) + ;; Note: some of these comand are automatically redefined by those in + (define-key ess-dev-map "\C-s" '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 "\C-l" '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 "\C-w" 'ess-watch) + (define-key ess-dev-map "w" 'ess-watch) + (define-key ess-dev-map "\C-d" 'ess-debug-flag-for-debugging) + (define-key ess-dev-map "d" 'ess-debug-flag-for-debugging) + (define-key ess-dev-map "\C-u" 'ess-debug-unflag-for-debugging) + (define-key ess-dev-map "u" 'ess-debug-unflag-for-debugging) + (define-key ess-dev-map [(control ?D)] 'ess-debug-unflag-for-debugging) + (define-key ess-dev-map "\C-b" 'ess-bp-set) + (define-key ess-dev-map "b" 'ess-bp-set) + (define-key ess-dev-map [(control ?B)] 'ess-bp-set-conditional) + (define-key ess-dev-map "B" 'ess-bp-set-conditional) + (define-key ess-dev-map "\C-L" 'ess-bp-set-logger) + (define-key ess-dev-map "L" 'ess-bp-set-logger) + (define-key ess-dev-map "\C-o" 'ess-bp-toggle-state) + (define-key ess-dev-map "o" 'ess-bp-toggle-state) + (define-key ess-dev-map "\C-k" 'ess-bp-kill) + (define-key ess-dev-map "k" 'ess-bp-kill) + (define-key ess-dev-map "\C-K" 'ess-bp-kill-all) + (define-key ess-dev-map "K" 'ess-bp-kill-all) + (define-key ess-dev-map "\C-n" '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 "\C-p" 'ess-bp-previous) + (define-key ess-dev-map "p" 'ess-bp-previous) + (define-key ess-dev-map "\C-e" '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.") + +(defvar ess-r-package-dev-map + (let (ess-r-package-dev-map) + (define-prefix-command 'ess-r-package-dev-map) + (define-key ess-r-package-dev-map "\C-s" 'ess-r-package-set-package) + (define-key ess-r-package-dev-map "s" 'ess-r-package-set-package) + (define-key ess-r-package-dev-map "\C-a" 'ess-r-devtools-ask) + (define-key ess-r-package-dev-map "a" 'ess-r-devtools-ask) + (define-key ess-r-package-dev-map "\C-c" 'ess-r-devtools-check-package) + (define-key ess-r-package-dev-map "c" 'ess-r-devtools-check-package) + (define-key ess-r-package-dev-map "\C-d" 'ess-r-devtools-document-package) + (define-key ess-r-package-dev-map "d" 'ess-r-devtools-document-package) + (define-key ess-r-package-dev-map "\C-i" 'ess-r-devtools-install-package) + (define-key ess-r-package-dev-map "i" 'ess-r-devtools-install-package) + (define-key ess-r-package-dev-map "\C-l" 'ess-r-devtools-load-package) + (define-key ess-r-package-dev-map "l" 'ess-r-devtools-load-package) + (define-key ess-r-package-dev-map "\C-r" 'ess-r-devtools-revdep-check-package) + (define-key ess-r-package-dev-map "r" 'ess-r-devtools-revdep-check-package) + (define-key ess-r-package-dev-map "\C-t" 'ess-r-devtools-test-package) + (define-key ess-r-package-dev-map "t" 'ess-r-devtools-test-package) + (define-key ess-r-package-dev-map "\C-u" 'ess-r-devtools-unload-package) + (define-key ess-r-package-dev-map "u" 'ess-r-devtools-unload-package) + ess-r-package-dev-map)) + +(easy-menu-define ess-roxygen-menu nil + "Roxygen submenu." + '("Roxygen" + :visible (and ess-dialect (string-match "^R" ess-dialect)) + ["Update/Generate Template" ess-roxy-update-entry t] + ["Preview Rd" ess-roxy-preview-Rd t] + ["Preview HTML" ess-roxy-preview-HTML t] + ["Preview text" ess-roxy-preview-text t] + ["Hide all" ess-roxy-hide-all t] + ["Toggle Roxygen Prefix" ess-roxy-toggle-roxy-region t])) + +(easy-menu-define ess-tracebug-menu nil + "Tracebug submenu." + '("Tracebug" + :visible (and ess-dialect (string-match "^R" ess-dialect)) + ;; :enable ess-local-process-name + ["Active?" ess-toggle-tracebug + :style toggle + :selected (or (and (ess-process-live-p) + (ess-process-get 'tracebug)) + ess-use-tracebug)] + ["Show traceback" ess-show-traceback (ess-process-live-p)] + ["Show call stack" ess-show-call-stack (ess-process-live-p)] + ["Watch" ess-watch (and (ess-process-live-p) + (ess-process-get 'tracebug))] + ["Error action cycle" ess-debug-toggle-error-action (and (ess-process-live-p) + (ess-process-get 'tracebug))] + "----" + ["Flag for debugging" ess-debug-flag-for-debugging ess-local-process-name] + ["Unflag for debugging" ess-debug-unflag-for-debugging ess-local-process-name] + "----" + ["Set BP" ess-bp-set t] + ["Set conditional BP" ess-bp-set-conditional t] + ["Set logger BP" ess-bp-set-logger t] + ["Kill BP" ess-bp-kill t] + ["Kill all BPs" ess-bp-kill-all t] + ["Next BP" ess-bp-next t] + ["Previous BP" ess-bp-previous t] + "-----" + ["About" ess-tracebug-show-help t])) + +(easy-menu-define ess-r-package-menu nil + "Package Development submenu." + '("Package development" + :visible (and ess-dialect (string-match "^R" ess-dialect)) + ["Active?" ess-r-package-mode + :style toggle + :selected ess-r-package-mode] + ["Select package for evaluation" ess-r-set-evaluation-env t])) + +(easy-menu-add-item ess-mode-menu nil ess-roxygen-menu "end-dev") +(easy-menu-add-item ess-mode-menu nil ess-r-package-menu "end-dev") +(easy-menu-add-item ess-mode-menu nil ess-tracebug-menu "end-dev") +(easy-menu-add-item inferior-ess-mode-menu nil ess-r-package-menu "end-dev") +(easy-menu-add-item inferior-ess-mode-menu nil ess-tracebug-menu "end-dev") + + +;; Inherit from the S syntax table: +(defvar ess-r-syntax-table (copy-syntax-table S-syntax-table)) + +;; Letting Emacs treat backquoted names and %ops% as strings solves +;; many problems with regard to nested strings and quotes +(modify-syntax-entry ?` "\"" ess-r-syntax-table) +(modify-syntax-entry ?% "\"" ess-r-syntax-table) + +;; Underscore is valid in R symbols +(modify-syntax-entry ?_ "_" ess-r-syntax-table) +(modify-syntax-entry ?: "." ess-r-syntax-table) +(modify-syntax-entry ?@ "." ess-r-syntax-table) +(modify-syntax-entry ?$ "." ess-r-syntax-table) + +;; TOTHINK: Prevent string delimiting characters from messing up output in the +;; inferior buffer +(defvar inferior-ess-r-syntax-table (copy-syntax-table ess-r-syntax-table)) +;; (modify-syntax-entry ?\' "." inferior-ess-r-syntax-table) +;; (modify-syntax-entry ?\" "." inferior-ess-r-syntax-table) +;; (modify-syntax-entry ?` "." inferior-ess-r-syntax-table) +(modify-syntax-entry ?% "." inferior-ess-r-syntax-table) + +(defvar ess-r-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.") + +(defun ess-r-font-lock-syntactic-face-function (state) + (let ((string-end (save-excursion + (and (nth 3 state) + (ess-goto-char (nth 8 state)) + (ess-forward-sexp) + (point))))) + (when (eq (nth 3 state) ?`) + (put-text-property (nth 8 state) string-end 'ess-r-backquoted t)) + (cond + ((eq (nth 3 state) ?%) + 'ess-%op%-face) + ((save-excursion + (and (ess-goto-char string-end) + (ess-looking-at "<-") + (ess-goto-char (match-end 0)) + (ess-looking-at "function\\b" t))) + font-lock-function-name-face) + ((save-excursion + (and (ess-goto-char string-end) + (ess-looking-at "("))) + ess-function-call-face) + ((eq (nth 3 state) ?`) + 'ess-backquoted-face) + ((nth 3 state) + font-lock-string-face) + (t + font-lock-comment-face)))) + + +(ess-message "[ess-r-mode:] (autoload ..) & (def** ..)") + + +(defvar ess-r-customize-alist + (append + '((ess-local-customize-alist . 'ess-r-customize-alist) + (ess-dialect . "R") + (ess-suffix . "R") + (ess-ac-sources . ess-r-ac-sources) + (ess-company-backends . ess-r-company-backends) + (ess-build-tags-command . ess-r-build-tags-command) + (ess-traceback-command . ess-r-traceback-command) + (ess-call-stack-command . ess-r-call-stack-command) + (ess-mode-completion-syntax-table . ess-r-completion-syntax-table) + (ess-build-eval-message-function . #'ess-r-build-eval-message) + (ess-format-eval-command-function . #'ess-r-format-eval-command) + (ess-format-load-command-function . #'ess-r-format-load-command) + (ess-send-region-function . #'ess-r-send-region) + (ess-load-file-function . #'ess-r-load-file) + (ess-make-source-refd-command-function . #'ess-r-make-source-refd-command) + (ess-format-eval-message-function . #'ess-r-format-eval-message) + (ess-install-library-function . #'ess-r-install-library) + (ess-eldoc-function . #'ess-r-eldoc-function) + (ess-help-web-search-command . #'ess-r-sos) + (ess-build-help-command-function . #'ess-r-build-help-command) + (ess-dump-filename-template . ess-r-dump-filename-template) + (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-r-loop-timeout) + (ess-function-pattern . ess-r-function-pattern) + (ess-object-name-db-file . "ess-r-namedb.el") + (ess-smart-operators . ess-r-smart-operators) + (inferior-ess-program . inferior-ess-r-program-name) + (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 . inferior-ess-r-help-command) + (inferior-ess-help-filetype . nil) + (inferior-ess-exit-command . "q()") + (inferior-ess-exit-prompt . "Save workspace image? [y/n/c]: ") + (inferior-ess-start-file . nil) + (inferior-ess-start-args . "") + (ess-error-regexp-alist . ess-r-error-regexp-alist) + (ess-describe-object-at-point-commands . 'ess-r-describe-object-at-point-commands) + (ess-STERM . "iESS") + (ess-editor . ess-r-editor) + (ess-pager . ess-r-pager) + (ess-mode-syntax-table . ess-r-syntax-table) + (font-lock-syntactic-face-function . #'ess-r-font-lock-syntactic-face-function) + (prettify-symbols-alist . '(("<-" . ?←) + ("<<-" . ?↞) + ("->" . ?→) + ("->>" . ?↠)))) + S-common-cust-alist) + "Variables to customize for R -- set up later than emacs initialization.") + +(defalias 'R-customize-alist 'ess-r-customize-alist) + +(defvar ess-r-build-tags-command + "rtags('%s', recursive = TRUE, pattern = '\\\\.[RrSs](rw)?$',ofile = '%s')") + +(defvar ess-r-traceback-command + "local({cat(geterrmessage(), \ +'---------------------------------- \n', \ +fill=TRUE); try(traceback(), silent=TRUE)})\n") + +(defvar ess-r-call-stack-command "traceback(1)\n") + +(defvar ess-r-dump-filename-template + (replace-regexp-in-string + "S$" "R" ess-dump-filename-template-proto)) + +(defvar ess-r-ac-sources + '(ac-source-R)) + +(defvar ess-r-company-backends + '((company-R-args company-R-objects))) + +(defvar ess-r-loop-timeout + 2000000) + +(defvar ess-r-editing-alist + ;; copy the S-alist and modify : + (let ((S-alist (copy-alist S-editing-alist))) + (setcdr (assoc 'ess-font-lock-defaults S-alist) + '(ess--extract-default-fl-keywords ess-R-font-lock-keywords)) + (setcdr (assoc 'ess-font-lock-keywords S-alist) + (quote 'ess-R-font-lock-keywords)) + (setcdr (assoc 'ess-mode-syntax-table S-alist) + (quote ess-r-syntax-table)) + S-alist) + "General options for editing R source files.") + +(defconst ess-help-r-sec-regex "^[A-Z][A-Za-z].+:$" + "Reg(ular) Ex(pression) of section headers in help file.") + +(defconst ess-help-r-sec-keys-alist + '((?a . "\\s *Arguments:") + (?d . "\\s *Description:") + (?D . "\\s *Details:") + (?t . "\\s *Details:") + (?e . "\\s *Examples:") + (?n . "\\s *Note:") + (?r . "\\s *References:") + (?s . "\\s *See Also:") + (?u . "\\s *Usage:") + (?v . "\\s *Value[s]?") ; + ) + "Alist of (key . string) pairs for use in help section searching.") + +(defvar ess-r-error-regexp-alist '(R R1 R2 R3 R4 R-recover) + "List of symbols which are looked up in `compilation-error-regexp-alist-alist'.") + +;; Takes precidence over R1 below in english locales, and allows spaces in file path +(add-to-list 'compilation-error-regexp-alist-alist + '(R "\\(\\(?: at \\|(@\\)\\([^#\n]+\\)[#:]\\([0-9]+\\)\\)" 2 3 nil 2 1)) + +(add-to-list 'compilation-error-regexp-alist-alist + '(R1 " \\([^ \t\n]+\\)#\\([0-9]+\\)[: ]" 1 2 nil 2)) + +(add-to-list 'compilation-error-regexp-alist-alist + '(R2 "(\\(\\w+ \\([^())\n]+\\)#\\([0-9]+\\)\\))" 2 3 nil 2 1)) + +;; Precedes R4 and allows spaces in file path +(add-to-list 'compilation-error-regexp-alist-alist + ;; Start with bol,: but don't start with digit + '(R3 "\\(?:^ +\\|: +\\)\\([^-+[:digit:]\n]:?[^:\n]*\\):\\([0-9]+\\):\\([0-9]+\\):" 1 2 3 2 1)) + +(add-to-list 'compilation-error-regexp-alist-alist + ;; Don't start with digit, don't contain spaces + '(R4 "\\([^-+ [:digit:]][^: \t\n]+\\):\\([0-9]+\\):\\([0-9]+\\):" 1 2 3 2 1)) + +(add-to-list 'compilation-error-regexp-alist-alist + '(R-recover " *[0-9]+: +\\([^:\n\t]+?\\)#\\([0-9]+:\\)" 1 2 nil 2 1)) + +;; gnu C errors +;; (add-to-list 'compilation-error-regexp-alist-alist +;; '(R_C "^\\([^-+ [:digit:]][^: \t\n]+\\):\\([0-9]+\\):\\([0-9]+\\):" 2 3 nil 2 1)) + +(let ((r-ver '("R-1" "R-2" "R-3" "R-devel" "R-patched"))) + (defvar ess-r-versions + (if (eq system-type 'darwin) (append r-ver '("R32" "R64")) r-ver) + "List of partial strings for versions of R 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 R is made available. For example, if the +file \"R-1.8.1\" is found and this variable includes the string +\"R-1\", a function called `M-x R-1.8.1' will be available to run that +version of R. +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 R. +If you set this variable, you need to restart Emacs (and set this variable +before ess-site is loaded) for it to take effect.")) + +;; Create functions for calling different (older or newer than default) +;; versions of R and S(qpe). +(defvar ess-versions-created nil + "List of strings of all S- and R-versions found on the system.") + +;; is currently used (updated) by ess-find-newest-R +(defvar ess-r-versions-created nil + "List of strings of all R-versions found on the system.") + +(defun ess-r-s-versions-creation () + "(Re)Create ESS R-<..> commands FILENAME sans final \"extension\". +The extension, in a file name, is the part that follows the last `.'." + (interactive) + ;; Create ess-versions-created, ess-r-versions-created, and on + ;; Windows, ess-rterm-version-paths + (let ((R-newest-list '("R-newest")) + (ess-s-versions-created + (if ess-microsoft-p + (nconc + (ess-sqpe-versions-create ess-SHOME-versions) ;; 32-bit + (ess-sqpe-versions-create ess-SHOME-versions-64 "-64-bit")) ;; 64-bit + (ess-s-versions-create)))) + (if ess-microsoft-p + (setq ess-rterm-version-paths + (ess-flatten-list + (ess-uniq-list + (if (not ess-directory-containing-R) + (if (getenv "ProgramW6432") + (let ((P-1 (getenv "ProgramFiles(x86)")) + (P-2 (getenv "ProgramW6432"))) + (nconc + ;; Always 32 on 64 bit OS, nil on 32 bit OS + (ess-find-rterm (concat P-1 "/R/") "bin/Rterm.exe") + (ess-find-rterm (concat P-1 "/R/") "bin/i386/Rterm.exe") + + ;; Keep this both for symmetry and because it can happen: + (ess-find-rterm (concat P-1 "/R/") "bin/x64/Rterm.exe") + + ;; Always 64 on 64 bit OS, nil on 32 bit OS + (ess-find-rterm (concat P-2 "/R/") "bin/Rterm.exe") + (ess-find-rterm (concat P-2 "/R/") "bin/i386/Rterm.exe") + (ess-find-rterm (concat P-2 "/R/") "bin/x64/Rterm.exe"))) + (let ((PF (getenv "ProgramFiles"))) + (nconc + ;; Always 32 on 32 bit OS, depends on 32 or 64 process on 64 bit OS + (ess-find-rterm (concat PF "/R/") "bin/Rterm.exe") + (ess-find-rterm (concat PF "/R/") "bin/i386/Rterm.exe") + (ess-find-rterm (concat PF "/R/") "bin/x64/Rterm.exe")))) + (let ((PF ess-directory-containing-R)) + (nconc + (ess-find-rterm (concat PF "/R/") "bin/Rterm.exe") + (ess-find-rterm (concat PF "/R/") "bin/i386/Rterm.exe") + (ess-find-rterm (concat PF "/R/") "bin/x64/Rterm.exe")))))))) + (ess-message "[ess-site:] (let ... before (ess-r-versions-create) ...") + + (setq ess-r-versions-created ;; For Unix *and* Windows, using either + (ess-r-versions-create)) ;; ess-r-versions or ess-rterm-version-paths (above!) + + ;; Add the new defuns, if any, to the menu. + ;; Check that each variable exists, before adding. + ;; e.g. ess-sqpe-versions-created will not be created on Unix. + (setq ess-versions-created + (ess-flatten-list + (mapcar (lambda(x) (if (boundp x) (symbol-value x) nil)) + '(R-newest-list + ess-r-versions-created + ess-s-versions-created)))))) + +(defun ess-r-s-versions-creation+menu () + "Call `\\[ess-r-s-versions-creation] creaing `ess-versions-created' and +update the \"Start Process\" menu." + (interactive) + (ess-message "[ess-site:] before (ess-r-s-versions-creation) ...") + (ess-r-s-versions-creation) + + (when ess-versions-created + ;; new-menu will be a list of 3-vectors, of the form: + ;; ["R-1.8.1" R-1.8.1 t] + (let ((new-menu (mapcar (lambda(x) (vector x (intern x) t)) + ess-versions-created))) + (easy-menu-add-item ess-mode-menu '("Start Process") + (cons "Other" new-menu)))) + ess-versions-created) + + + +;;;*;;; Mode init + +(defvar ess-r-post-run-hook nil + "Functions run in process buffer after the initialization of R + process.") +(defalias 'ess-R-post-run-hook 'ess-r-post-run-hook) + +(defun ess-r-mode-p () + "Check whether we have a buffer running in R mode. + +This is to get around the lack of proper derived modes in ESS." + (and (eq major-mode 'ess-mode) + (string= ess-dialect "R"))) + +;;;### autoload +(defun R (&optional start-args) + "Call 'R', the 'GNU S' system from the R Foundation. +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 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." + (interactive "P") + (ess-write-to-dribble-buffer ;; for debugging only + (format + "\n(R): ess-dialect=%s, buf=%s, start-arg=%s\n current-prefix-arg=%s\n" + ess-dialect (current-buffer) start-args current-prefix-arg)) + (let* ((r-always-arg + (if (or ess-microsoft-p (eq system-type 'cygwin)) + "--ess " + ;; else: "unix alike" + (if (not ess-R-readline) "--no-readline "))) + (start-args + (cond ((stringp start-args) + start-args) + ((and start-args + (listp start-args) + (every 'stringp start-args)) + (mapconcat 'identity start-args " ")) + (start-args + (read-string + (concat "Starting Args" + (if r-always-arg + (concat " [other than '" r-always-arg "']")) + " ? "))))) + (r-start-args + (concat r-always-arg + inferior-R-args " " ; add space just in case + start-args)) + (cust-alist (copy-alist ess-r-customize-alist)) + (gdbp (string-match-p "gdb" r-start-args)) + use-dialog-box) + + (when gdbp + (setcdr (assoc 'inferior-ess-secondary-prompt cust-alist) + (format "\\(%s\\)\\|\\((gdb) \\)" + (cdr (assoc 'inferior-ess-secondary-prompt cust-alist))))) + + (when (or ess-microsoft-p + (eq system-type 'cygwin)) + (setq use-dialog-box nil) + (when ess-microsoft-p ;; default-process-coding-system would break UTF locales on Unix + (setq default-process-coding-system '(undecided-dos . undecided-dos)))) + + (inferior-ess r-start-args cust-alist gdbp) + + (ess-process-put 'funargs-pre-cache ess-r--funargs-pre-cache) + + (remove-hook 'completion-at-point-functions 'ess-filename-completion 'local) ;; should be first + (add-hook 'completion-at-point-functions 'ess-r-object-completion nil 'local) + (add-hook 'completion-at-point-functions 'ess-filename-completion nil 'local) + (setq comint-input-sender 'inferior-ess-r-input-sender) + + (if gdbp + (progn + ;; We need to use callback, because R might start with a gdb process + (ess-process-put 'callbacks '(R-initialize-on-start)) + ;; trigger the callback + (process-send-string (get-process ess-local-process-name) "\n")) + (ess-wait-for-process) + (R-initialize-on-start)) + + (ess-write-to-dribble-buffer + (format "(R): inferior-ess-language-start=%s\n" + inferior-ess-language-start)))) + +(defun R-initialize-on-start (&optional proc string) + "This function is run after the first R prompt. +Executed in process buffer." + (interactive) + ;; sometimes needed (MM w/ Emacs 25.1, on F24 where PAGER is 'more'): + ;; carefully set "pager" option "when needed": + (ess-eval-linewise + (format + "if (identical(getOption('pager'), file.path(R.home('bin'), 'pager'))) options(pager='%s') # rather take the ESS one \n" + inferior-ess-pager) + nil nil nil 'wait) + (inferior-ess-r-load-ESSR) + (when inferior-ess-language-start + (ess-eval-linewise inferior-ess-language-start + nil nil nil 'wait-prompt)) + (with-ess-process-buffer nil + (add-hook 'ess-presend-filter-functions 'ess-R-scan-for-library-call nil 'local) + (run-mode-hooks 'ess-r-post-run-hook))) + +;;;### autoload +(defun R-mode (&optional proc-name) + "Major mode for editing R source. See `ess-mode' for more help." + (interactive "P") + (setq ess-customize-alist ess-r-customize-alist) + ;;(setq imenu-generic-expression R-imenu-generic-expression) + (ess-mode ess-r-customize-alist proc-name) + ;; for emacs < 24 + (add-hook 'comint-dynamic-complete-functions 'ess-complete-object-name t 'local) + ;; for emacs >= 24 + (remove-hook 'completion-at-point-functions 'ess-filename-completion 'local) ;; should be first + (add-hook 'completion-at-point-functions 'ess-r-object-completion nil 'local) + (add-hook 'completion-at-point-functions 'ess-filename-completion nil 'local) + + (if (fboundp 'ess-add-toolbar) (ess-add-toolbar)) + (when ess-imenu-use-S + (setq imenu-generic-expression ess-imenu-generic-expression) + (imenu-add-to-menubar "Imenu-R")) + + ;; useful for swankr/slime: + (set (make-local-variable 'beginning-of-defun-function) + (lambda (&optional arg) + (skip-chars-backward " \t\n") + (ess-beginning-of-function 'no-error))) + (set (make-local-variable 'end-of-defun-function) + 'ess-end-of-function) + + (ess-roxy-mode t) + (ad-activate 'fill-paragraph) + (ad-activate 'move-beginning-of-line) + (ad-activate 'back-to-indentation) + (ad-activate 'ess-eval-line-and-step) + + ;; FIXME: Why advice our own function? + (when ess-roxy-hide-show-p + (ad-activate 'ess-indent-command)) + + (run-hooks 'R-mode-hook)) + +(fset 'r-mode 'R-mode) +(fset 'ess-r-mode 'R-mode) + + +;;*;; Miscellaneous + +(defun ess-R-arch-2-bit (arch) + "Translate R's architecture shortcuts/directory names to 'bits', + i.e., \"32\" or \"64\" (for now)." + (if (string= arch "i386") "32" + ;; else: + "64")) + +(defun ess-rterm-arch-version (long-path &optional give-cons) + "Find an architecture-specific name for LONG-PATH, an absolute (long name) path + to R on Windows. Returns either Name, a string, or a (Name . Path) cons, such as + (\"R-2.12.1-64bit\" . \"C:/Program Files/R/R-2.12.1/bin/x64/Rterm.exe\") + +\"R-x.y.z/bin/Rterm.exe\" will return \"R-x.y.z\", for R-2.11.x and older. +\"R-x.y.z/bin/i386/Rterm.exe\" will return \"R-x.y.z-32bit\", for R-2.12.x and newer. +\"R-x.y.z/bin/x64/Rterm.exe\" will return \"R-x.y.z-64bit\", for R-2.12.x and newer." + (let* ((dir (directory-file-name (file-name-directory long-path))) + (dir2 (directory-file-name (file-name-directory dir))) + (v-1up (file-name-nondirectory dir));; one level up + (v-2up (file-name-nondirectory dir2));; two levels up; don't want "bin" ... + (v-3up (file-name-nondirectory ;; three levels up; no "bin" for i386, x64 ... + (directory-file-name (file-name-directory dir2)))) + (val (if (string= v-2up "bin") + (concat v-3up "-" (ess-R-arch-2-bit v-1up) "bit") + ;; pre R-2.12.x, or when there's no extra arch-specific sub directory: + v-2up))) + (if give-cons + (cons val long-path) + val))) + + +(defun ess-r-versions-create () + "Generate the `M-x R-x.y.z' functions for starting other versions of R. +On MS Windows, this works using `ess-rterm-version-paths'; otherwise, +see `ess-r-versions' for strings that determine which functions are created. + +The result is a list of the new R defuns, if any, that were created. The +defuns will normally be placed on the menubar and stored as +`ess-r-versions-created' upon ESS initialisation." + + (if (not ess-r-versions) + nil ;nothing to return + ;; else, if ess-r-versions is non-nil, let's try to find those R versions. + ;; This works by creating a temp buffer where the template function is + ;; edited so that X.Y is replaced by the version name + (let (versions + r-versions-created + (eval-buf (get-buffer-create "*ess-temp-r-evals*")) + (template + ;; This is the template function used for creating M-x R-X.Y. + (concat + "(defun R-X.Y (&optional start-args) + \"Call the R version 'R-X.Y' using ESS. +This function was generated by `ess-r-versions-create'.\" + (interactive \"P\") + (let ((inferior-R-version \"R-X.Y\") + (inferior-ess-r-program-name \"" + (if ess-microsoft-p "Rterm" "R") "-X.Y\")) + (R start-args))) +"))) + + (with-current-buffer eval-buf + ;; clear the buffer. + (delete-region (point-min) (point-max)) + + ;; Find which versions of R we want. Remove the pathname, leaving just + ;; the name of the executable. + (setq versions + (if ess-microsoft-p + (mapcar (lambda(v) (ess-rterm-arch-version v 'give-cons)) + ess-rterm-version-paths) + ;; ^^^^^^^^^^^^^^^^^^^^^^^ from ./ess-site.el at start + ;; else (non-MS): + (ess-uniq-list + (mapcar 'file-name-nondirectory + (apply 'nconc + (mapcar 'ess-find-exec-completions + ess-r-versions)))))) + (setq r-versions-created ; also for returning at end. + (if ess-microsoft-p + (mapcar 'car versions) + versions)) + (ess-write-to-dribble-buffer + (format "(R): ess-r-versions-create making M-x defuns for \n %s\n" + (mapconcat 'identity r-versions-created "\n "))) + + ;; Iterate over each string in VERSIONS, creating a new defun each time. + (while versions + (let* ((version (car versions)) + (ver (if ess-microsoft-p (car version) version)) + (beg (point))) + + (setq versions (cdr versions)) + (insert template) + (goto-char beg) + (while (search-forward "R-X.Y" nil t) ;; in all cases + (replace-match ver t t)) + (when ess-microsoft-p + (goto-char beg) + (while (search-forward "Rterm-X.Y" nil t) + (replace-match (w32-short-file-name (cdr version)) t t))) + (goto-char (point-max)))) + ;; buffer has now been created with defuns, so eval them! + (eval-buffer)) + (unless (and (boundp 'ess-debugging) ess-debugging) + (kill-buffer eval-buf)) + + r-versions-created))) + +(defvar ess-newest-R nil + "Stores the newest version of R that has been found. Used as a cache, +within ess-find-newest-R. Do not use this value directly, but +instead call the function \\[ess-find-newest-R].") + + +(defcustom ess-prefer-higher-bit t + "Non-nil means prefer higher bit architectures of R. +e.g. prefer 64 bit over 32 bit. This is currently used only +by the code on Windows for finding the newest version of R." + :group 'ess-R + :type 'boolean) + +(defun ess-rterm-prefer-higher-bit () + "Optionally remove 32bit Rterms from being candidate for R-newest. +Return the list of candidates for being R-newest. Filtering is done +iff `ess-prefer-higher-bit' is non-nil. +This is used only by Windows when running `ess-find-newest-R'." + (if ess-prefer-higher-bit + ;; filter out 32 bit elements + (let ((filtered + (delq nil + (mapcar (lambda (x) (unless (string-match "/i386/Rterm.exe" x) x)) + ess-rterm-version-paths)))) + (if (null filtered) + ;; if none survived filtering, keep the original list + ess-rterm-version-paths + filtered)) + ess-rterm-version-paths)) + + +(defun ess-find-newest-R () + "Find the newest version of R on the system. Once the value is found, +cache it in the variable `ess-newest-R' for future use as finding the +newest version of R can be potentially time-consuming." + (or ess-newest-R + (progn (message "Finding all versions of R on your system...") + ;;(sleep-for 3) + nil) + (setq ess-newest-R + (ess-newest-r + (if ess-microsoft-p + (ess-rterm-prefer-higher-bit) + (add-to-list 'ess-r-versions-created + inferior-ess-r-program-name)))))) + +(defun ess-check-R-program-name () + "Check if `inferior-ess-r-program-name' points to an executable version of R. +If not, try to find the newest version of R elsewhere on the system, and +update `inferior-ess-r-program-name' accordingly." + (unless (executable-find inferior-ess-r-program-name) + ;; need to check if we can find another name. + (let ((newest (ess-find-newest-R))) + (if newest + (setq inferior-ess-r-program-name newest) + (message "Sorry, no version of R could be found on your system."))))) + +(defun R-newest (&optional start-args) + "Find the newest version of R available, and run it. +Subsequent calls to R-newest will run that version, rather than searching +again for the newest version. Providing an optional prefix arg (C-u) will +prompt for command line arguments." + (interactive "P") + (let ((rnewest (ess-find-newest-R))) + (if (not rnewest) + (error "No version of R could be found.") + ;; Else: we have a working version of R. + ;; Have to be careful to avoid recursion... + (message (concat "Newest version of R is " rnewest)) + (fset 'R-newest + (intern + (if ess-microsoft-p + (ess-rterm-arch-version rnewest) + rnewest))) + ;;(fset 'R-newest (intern rnewest)) + (R-newest start-args)))) + +;; (ess-r-version-date "R-2.5.1") (ess-r-version-date "R-patched") +;; (ess-r-version-date "R-1.2.1") (ess-r-version-date "R-1.8.1") +;; Windows: +;; (ess-r-version-date "C:/Program Files (x86)/R/R-2.11.1/bin/Rterm.exe") +;; Note that for R-devel, ver-string is something like +;; R version 2.6.0 Under development (unstable) (2007-07-14 r42234) +;; Antique examples are 'R 1.0.1 (April 14, 2000)' or 'R 1.5.1 (2002-06-17).' +(defun ess-r-version-date (rver) + "Return the date of the version of R named RVER. +The date is returned as a date string. If the version of R could +not be found from the output of the RVER program, \"-1\" is +returned." + (let ((date "-1") + (ver-string (shell-command-to-string + ;; here, MS Windows (shell-command) needs a short name: + (concat (if ess-microsoft-p (w32-short-file-name rver) rver) + " --version")))) + (when (string-match + "R \\(version \\)?[1-9][^\n]+ (\\(2[0-9-]+\\)\\( r[0-9]+\\)?)" + ver-string) + (setq date (match-string 2 ver-string))) + (cons date rver))) + +(defun ess-current-R-version () + "Get the version of R currently running in the ESS buffer as a string" + (ess-make-buffer-current) + (car (ess-get-words-from-vector "as.character(.ess.Rversion)\n"))) + +(defun ess-current-R-at-least (version) + "Is the version of R (in the ESS buffer) at least (\">=\") VERSION ? +Examples: (ess-current-R-at-least '2.7.0) + or (ess-current-R-at-least \"2.5.1\")" + (ess-make-buffer-current) + (string= "TRUE" + (car (ess-get-words-from-vector + (format "as.character(.ess.Rversion >= \"%s\")\n" version))))) + +(defvar ess-temp-newest nil) + +(defun ess-newest-r (rvers) + "Check all the versions of RVERS to see which is the newest. +Return the name of the newest version of R." + (let ((rtimes (mapcar 'ess-r-version-date rvers))) + ;; SJE: 2007-07-13 -- following line is a temp var to check that + ;; the newest version of R is found correctly. + ;; (nowadays gives a compile warning) + (setq ess-temp-newest rtimes) + (ess-find-newest-date rtimes))) + +;; Test case for following defun: +;; (setq a '( ("2003-10-04" . "R-1.7") +;; ("2006-11-19" . "R-2.2") +;; ("2007-07-01" . "R-dev") +;; ("-1" . "R-broken") +;; ("2005-12-30" . "R-2.0"))) +;; (ess-find-newest-date a) +(defun ess-find-newest-date (rvers) + "Find the newest version of R given in the a-list RVERS. +Each element of RVERS is a dotted pair (date . R-version), where +date is given as e.g.\"2007-11-30\" so that we can compare dates +as strings. If a date is listed as \"-1\", that version of R +could not be found. + +If the value returned is nil, no valid newest version of R could be found." + (let (new-r this-r + (new-time "0")) + (while rvers + (setq this-r (car rvers) + rvers (cdr rvers)) + (when (string< new-time (car this-r)) + (setq new-time (car this-r) + new-r (cdr this-r)))) + new-r)) + +(defun ess-find-rterm (&optional ess-R-root-dir bin-Rterm-exe) + "Find the full path of all occurences of Rterm.exe under the ESS-R-ROOT-DIR. +If ESS-R-ROOT-DIR is nil, construct it by looking for an occurence of Rterm.exe +in the exec-path. If there are no occurences of Rterm.exe in the exec-path, +then use `ess-program-files' (which evaluates to something like \"c:/progra~1/R/\" +in English locales) which is the default location for the R distribution. +If BIN-RTERM-EXE is nil, then use \"bin/Rterm.exe\"." + (if (not ess-R-root-dir) + (let ((Rpath (executable-find "Rterm"))) + (setq ess-R-root-dir + (expand-file-name + (if Rpath + (concat (file-name-directory Rpath) "../../") + (concat ess-program-files "/R/")))) + (ess-write-to-dribble-buffer + (format "(ess-find-rterm): ess-R-root-dir = '%s'\n" ess-R-root-dir)))) + + (if (not bin-Rterm-exe) (setq bin-Rterm-exe "bin/Rterm.exe")) + + (when (file-directory-p ess-R-root-dir) ; otherwise file-name-all-.. errors + (setq ess-R-root-dir + (replace-regexp-in-string "[\\]" "/" ess-R-root-dir)) + (let ((R-ver + (ess-drop-non-directories + (ess-flatten-list + (mapcar (lambda (r-prefix) + (file-name-all-completions r-prefix ess-R-root-dir)) + (append '("rw") ess-r-versions)))))) + (mapcar (lambda (dir) + (let ((R-path + (concat ess-R-root-dir + (replace-regexp-in-string "[\\]" "/" dir) + bin-Rterm-exe))) + (if (file-exists-p R-path) R-path))) + R-ver)))) + +;;;###autoload +(defun Rnw-mode () + "Major mode for editing Sweave(R) source. +See `ess-noweb-mode' and `R-mode' for more help." + (interactive) + (require 'ess-noweb);; << probably someplace else + (setq ess--make-local-vars-permanent t) + (ess-noweb-mode 1); turn it on + (ess-noweb-set-doc-mode 'latex-mode) + (ess-noweb-set-code-mode 'R-mode) + (setq ess--local-handy-commands + (append '(("weave" . ess-swv-weave) + ("tangle" . ess-swv-tangle)) + ess-handy-commands) + ess-dialect "R" + ess-language "S") + (put 'ess--local-handy-commands 'permanent-local t) + (run-hooks 'Rnw-mode-hook)) + +(fset 'Snw-mode 'Rnw-mode); just a synonym (for now or ever) + +(autoload 'ess-transcript-mode "ess-trns" + "Major mode for editing S transcript files." t) + +(defun R-transcript-mode () + "Does the right thing." + (interactive) + (ess-transcript-mode ess-r-customize-alist)) + +(fset 'r-transcript-mode 'R-transcript-mode) + +(defun R-fix-T-F (&optional from quietly) + "Fix T/F into TRUE and FALSE *cautiously*, i.e. not in comments and strings; + starting from the current position (point)." + (interactive "d\nP"); point and prefix (C-u) + (save-excursion + (goto-char from) + (ess-rep-regexp "\\(\\([][=,()]\\|<-\\) *\\)T\\>" "\\1TRUE" + 'fixcase nil (not quietly)) + (goto-char from) + (ess-rep-regexp "\\(\\([][=,()]\\|<-\\) *\\)F\\>" "\\1FALSE" + 'fixcase nil (not quietly)))) + +(defvar ess--packages-cache nil + "Cache var to store package names. Used by + `ess-r-install-library'.") + +(defvar ess--CRAN-mirror nil + "CRAN mirror name cache.") + +(defun ess-r-install-library (&optional update pack) + "Prompt and install R package. With argument, update cached packages list." + (interactive "P") + (inferior-ess-r-force) + (when (equal "@CRAN@" (car (ess-get-words-from-vector "getOption('repos')[['CRAN']]\n"))) + (ess-setCRANMiror ess--CRAN-mirror) + (ess-wait-for-process (get-process ess-current-process-name)) + (unless pack (setq update t))) + (when (or update + (not ess--packages-cache)) + (message "Fetching R packages ... ") + (setq ess--packages-cache + (ess-get-words-from-vector "print(rownames(available.packages()), max=1e6)\n"))) + (let* ((ess-eval-visibly-p t) + (pack (or pack + (ess-completing-read "Package to install" ess--packages-cache)))) + (process-send-string (get-process ess-current-process-name) + (format "install.packages('%s')\n" pack)) + (display-buffer (buffer-name (process-buffer (get-process ess-current-process-name)))))) + +(defun ess-setRepositories () + "Call setRepositories()" + (interactive) + (if (not (string-match "^R" ess-dialect)) + (message "Sorry, not available for %s" ess-dialect) + (ess-eval-linewise "setRepositories(FALSE)\n"))) + +(defun ess-setCRANMiror (&optional mirror) + "Set cran mirror" + (interactive) + (let ((mirror-cmd "local({r <- getOption('repos'); r['CRAN'] <- '%s';options(repos=r)})\n")) + (if mirror + (ess-command (format mirror-cmd mirror)) + (let* ((M1 (ess-get-words-from-vector "local({out <- getCRANmirrors(local.only=TRUE); print(paste(out$Name,'[',out$URL,']', sep=''))})\n")) + (M2 (mapcar (lambda (el) + (string-match "\\(.*\\)\\[\\(.*\\)\\]$" el) + (propertize (match-string 1 el) 'URL (match-string 2 el))) + M1)) + (mirror (ess-completing-read "Choose CRAN mirror" M2 nil t))) + (when mirror + (setq mirror (get-text-property 0 'URL mirror)) + (setq ess--CRAN-mirror mirror) + (ess-command (format mirror-cmd mirror)))))) + (message "CRAN mirror: %s" (car (ess-get-words-from-vector "getOption('repos')[['CRAN']]\n")))) + +(defun ess-r-sos (cmd) + "Interface to findFn in the library sos." + (interactive "sfindFn: ") + (unless (ess-boolean-command "print(requireNamespace('sos', quietly = TRUE))\n") + (if (y-or-n-p "Library 'sos' is not installed. Install? ") + (ess-eval-linewise "install.packages('sos')\n") + (signal 'quit nil))) + (message nil) + (ess-eval-linewise (format "sos::findFn(\"%s\", maxPages=10)" cmd))) + +(defun ess-R-scan-for-library-call (string) + "Detect `library/require' calls in string and update tracking vars. +Placed into `ess-presend-filter-functions' for R dialects." + (when (string-match-p "\\blibrary(\\|\\brequire(" string) + (ess--mark-search-list-as-changed)) + string) + +(defun ess-load-library () + "Prompt and load dialect specific library/package/module. + +Note that add-ons in R are called 'packages' and the name of this +function has nothing to do with R package mechanism, but it +rather serves a generic, dialect independent purpose. It is also +similar to `load-library' emacs function." + (interactive) + (if (not (string-match "^R" ess-dialect)) + (message "Sorry, not available for %s" ess-dialect) + (let ((ess-eval-visibly-p t) +;;; FIXME? .packages() does not cache; installed.packages() does but is slower first time + (packs (ess-get-words-from-vector "print(.packages(T), max=1e6)\n")) + pack) + (setq pack (ess-completing-read "Load" packs)) + (ess-eval-linewise (format "library('%s')\n" pack)) + (ess--mark-search-list-as-changed) + (display-buffer (buffer-name (process-buffer (get-process ess-current-process-name))))))) + +(define-obsolete-function-alias 'ess-library 'ess-load-library "ESS[12.09-1]") + +;;; smart-comma was a bad idea +(eval-after-load "eldoc" + '(eldoc-add-command "ess-smart-comma")) + + +;;*;; Interaction with R + +;;;*;;; Evaluation + +(defun ess-r-arg (param value &optional wrap) + (let ((value (if wrap + (concat "'" value "'") + value))) + (concat ", " param " = " value))) + +(defun ess-r-build-args (visibly output namespace) + (let ((visibly (ess-r-arg "visibly" (if visibly "TRUE" "FALSE"))) + (output (ess-r-arg "output" (if output "TRUE" "FALSE"))) + (pkg (when namespace (ess-r-arg "package" namespace t))) + (verbose (when (and namespace + ess-r-namespaced-load-verbose) + (ess-r-arg "verbose" "TRUE")))) + (concat visibly output pkg verbose))) + +(ess-defmethod R ess-build-eval-command (string &optional visibly output file namespace) + (let* ((namespace (unless ess-debug-minor-mode + (or namespace (ess-r-get-evaluation-env)))) + (cmd (if namespace ".ess.ns_eval" ".ess.eval")) + (file (when file (ess-r-arg "file" file t))) + (args (ess-r-build-args visibly output namespace))) + (concat cmd "(\"" string "\"" args file ")\n"))) + +(ess-defmethod R ess-build-load-command (file &optional visibly output namespace) + (let* ((namespace (or namespace (ess-r-get-evaluation-env))) + (cmd (if namespace ".ess.ns_source" ".ess.source")) + (args (ess-r-build-args visibly output namespace))) + (concat cmd "('" file "'" args ")\n"))) + +(defun ess-r-build-eval-message (message) + (let ((env (cond (ess-debug-minor-mode + (substring-no-properties ess-debug-indicator 1)) + ((ess-r-get-evaluation-env))))) + (if env + (format "[%s] %s" env message) + message))) + +(defvar-local ess-r-evaluation-env nil + "Environment into which code should be evaluated. +When this variable is nil, code is evaluated in the current +environment. Currently only packages can be set as evaluation +environments. Use `ess-r-set-evaluation-env' to set this +variable.") + +(defun ess-r-get-evaluation-env () + "Get current evaluation env." + (or ess-r-evaluation-env + (and ess-current-process-name + (ess-get-process-variable 'ess-r-evaluation-env)))) + +(defvar ess-r-prompt-for-attached-pkgs-only nil + "If nil provide completion for all installed R packages. +If non-nil, only look for attached packages.") + +(defun ess-r-set-evaluation-env (&optional arg) + "Select a package namespace for evaluation of R code. + +Call interactively with a prefix argument to disable evaluation +in a namespace. When calling from a function, ARG can be a +string giving the package to select, any other non-nil value to +disable, or nil to prompt for a package. + +If `ess-r-prompt-for-attached-pkgs-only' is non-nil, prompt only for +attached packages." + (interactive "P") + (let ((env (cond ((stringp arg) arg) + ((null arg) (ess-r--select-package-name)) + (t "*none*")))) + (if (equal env "*none*") + (let ((cur-env (ess-r-get-evaluation-env))) + ;; fixme: does not work if env is set at process level + (setq ess-r-evaluation-env nil) + (delq 'ess-r--evaluation-env-mode-line ess--local-mode-line-process-indicator) + (message (format "Evaluation in %s disabled" (propertize cur-env 'face font-lock-function-name-face)))) + (setq ess-r-evaluation-env env) + (add-to-list 'ess--local-mode-line-process-indicator 'ess-r--evaluation-env-mode-line t) + (message (format "Evaluating in %s" (propertize env 'face font-lock-function-name-face)))) + (force-mode-line-update))) + +(defvar-local ess-r--evaluation-env-mode-line + '(:eval (let ((env (ess-r-get-evaluation-env))) + (if env + (format " %s" + (propertize (if (equal env (ess-r-package-name)) + "pkg" + env) + 'face 'mode-line-emphasis)) + "")))) +(put 'ess-r--evaluation-env-mode-line 'risky-local-variable t) + +(defvar ess-r-namespaced-load-verbose t + "Whether to display information on namespaced loading. + +When t, loading a file into a namespaced will output information +about which objects are exported and which stay hidden in the +namespace.") + +(defvar ess-r-namespaced-load-only-existing t + "Whether to load only objects already existing in a namespace.") + +(ess-defmethod R ess-load-file (file) + (cond + ;; Namespaced evaluation + ((ess-r-get-evaluation-env) + (ess-r-load-file-namespaced file)) + ;; Evaluation into current env via .ess.source() + (t + (let ((command (ess-build-load-command file nil t))) + (ess-send-string (ess-get-process) command))))) + +(defun ess-r-load-file-namespaced (&optional file) + "Load FILE into a package namespace. + +This prompts for a package when no package is currently +selected (see `ess-r-set-evaluation-env')." + (interactive) + (ess-force-buffer-current "R process to use: ") + (let* ((pkg-name (ess-r-get-evaluation-env)) + (command (ess-build-load-command file nil t pkg-name))) + (ess-send-string (ess-get-process) command))) + +(ess-defmethod R ess-send-region (proc start end visibly message type) + (cond + ;; Namespaced evaluation + ((ess-r-get-evaluation-env) + (ess-r-send-region-namespaced proc start end visibly message)) + ;; Evaluation into current env + (t + (ess-send-string proc (buffer-substring start end) visibly message type)))) + +(defun ess-r-send-region-namespaced (proc beg end &optional visibly message) + "Ask for for the package and devSource region into it." + (let* ((pkg-name (or (ess-r-get-evaluation-env) + (ess-r-set-evaluation-env)))) + (message (ess-r-build-eval-message (or message "Eval region")))) + (ess-send-string proc (buffer-substring start end) visibly message)) + + +;;;*;;; Help + +(defun ess-r-namespaced-object-p (object) + (string-match "^[[:alnum:].]+::" object)) + +(defun ess-r-build-help-command--qualified (object) + (when (ess-r-namespaced-object-p object) + (let* ((pkg-name (substring object (match-beginning 0) (- (match-end 0) 2))) + (object (concat "'" (substring object (match-end 0)) "'")) + (pkg (ess-r-arg "package" pkg-name t))) + (concat ".ess.help(" object pkg ")\n")))) + +(defun ess-r-build-help-command--get-package-dir (object dont-ask) + ;; Ugly hack to avoid tcl/tk dialogues + (let ((pkgs (ess-get-words-from-vector + (format "as.character(help('%s'))\n" object)))) + (when (> (length pkgs) 1) + (if dont-ask + (car pkgs) + (ess-completing-read "Choose location" pkgs nil t))))) + +(defun ess-r-build-help-command--unqualified (object dont-ask) + (if (eq ess-help-type 'index) + ;; we are in index page, qualify with namespace + (ess-r-build-help-command--qualified (format "%s::%s" ess-help-object object)) + (let ((pkg-dir (ess-r-build-help-command--get-package-dir object dont-ask)) + (command (format inferior-ess-r-help-command object))) + (if pkg-dir + ;; Invoking `print.help_files_with_topic' + (format "do.call(structure, c('%s', attributes(%s)))\n" pkg-dir command) + command)))) + +(defun ess-r-build-help-command (object &optional dont-ask) + (or (ess-r-build-help-command--qualified object) + (ess-r-build-help-command--unqualified object dont-ask))) + +(defconst inferior-ess-r--input-help (format "^ *help *(%s)" ess-help-arg-regexp)) +(defconst inferior-ess-r--input-?-help-regexp "^ *\\(?:\\(?1:[a-zA-Z ]*?\\?\\{1,2\\}\\) *\\(?2:.+\\)\\)") +(defconst inferior-ess-r--page-regexp (format "^ *page *(%s)" ess-help-arg-regexp)) + +(defvar ess-help-r--last-help-type nil + "Variable holding the last known help type. If it changes, +we flush the cache.") + +(defun ess-help-r--check-last-help-type () + (let ((help-type (ess-string-command "getOption('help_type')\n"))) + (when (not (string= help-type ess-help-r--last-help-type)) + (let ((help-buffers (ess-help-get-local-help-buffers))) + (mapc #'kill-buffer help-buffers)) + (setq ess-help-r--last-help-type help-type)))) + +(defun ess-help-r--process-help-input (proc string) + (let ((help-match (and (string-match inferior-ess-r--input-help string) + (match-string 2 string))) + (help-?-match (and (string-match inferior-ess-r--input-?-help-regexp string) + string)) + (page-match (and (string-match inferior-ess-r--page-regexp string) + (match-string 2 string)))) + (when (or help-match help-?-match page-match) + (ess-help-r--check-last-help-type) + (cond (help-match + (ess-display-help-on-object help-match) + (process-send-string proc "\n")) + (help-?-match + (ess-help-r--display-help-? proc string help-?-match) + (process-send-string proc "\n")) + (page-match + (switch-to-buffer-other-window + (ess-command (concat page-match "\n") + (get-buffer-create (concat page-match ".rt")))) + (R-transcript-mode) + (process-send-string proc "\n"))) + t))) + +(defun ess-help-r--display-help-? (proc string help-?-match) + (cond ((string-match "\\?\\?\\(.+\\)" help-?-match) + (ess--display-indexed-help-page (concat help-?-match "\n") + "^\\([^ \t\n]+::[^ \t\n]+\\)[ \t\n]+" + (format "*ess-apropos[%s](%s)*" + ess-current-process-name (match-string 1 help-?-match)) + 'appropos)) + ((string-match "^ *\\? *\\([^ \t]+\\)$" help-?-match) + (ess-display-help-on-object (match-string 1 help-?-match))) + ;; Anything else we send to process almost unchanged + (t + (let ((help-?-match (and (string-match inferior-ess-r--input-?-help-regexp string) + (format "%s%s" (match-string 1 string) + (ess-help-r--sanitize-topic (match-string 2 string)))))) + (ess-display-help-on-object help-?-match "%s\n"))))) + +(defun ess-help-r--sanitize-topic (string) + ;; Enclose help topics into `` to avoid ?while ?if etc hangs + (if (string-match "\\([^:]*:+\\)\\(.*\\)$" string) ; treat foo::bar corectly + (format "%s`%s`" (match-string 1 string) (match-string 2 string)) + (format "`%s`" string))) + + +;;;*;;; Utils for inferior R process + +(defun inferior-ess-r-input-sender (proc string) + (save-current-buffer + (or (ess-help-r--process-help-input proc string) + (inferior-ess-input-sender proc string)))) + +(defun inferior-ess-r-load-ESSR () + "Load/INSTALL/Update ESSR." + (let* ((pkg-dir (expand-file-name "ESSR" ess-etc-directory)) + (src-dir (expand-file-name "R" pkg-dir))) + + (if (not (or (and (boundp 'ess-remote) ess-remote) + (file-remote-p (ess-get-process-variable 'default-directory)))) + (inferior-ess-r-load-ESSR--local pkg-dir src-dir) + (inferior-ess-r-load-ESSR--remote pkg-dir src-dir)))) + +(defun inferior-ess-r-load-ESSR--local (pkg-dir src-dir) + (let ((cmd (format "local({ + source('%s/.load.R', local=TRUE) #define load.ESSR + load.ESSR('%s') + })\n" + src-dir src-dir))) + (ess-write-to-dribble-buffer (format "load-ESSR cmd:\n%s\n" cmd)) + (with-current-buffer (ess-command cmd) + (let ((msg (buffer-string))) + (when (> (length msg) 1) + (message (format "load ESSR: %s" msg))))))) + +(defun inferior-ess-r-load-ESSR--remote (pkg-dir src-dir) + (let* ((verfile (expand-file-name "VERSION" pkg-dir)) + (loadremote (expand-file-name "LOADREMOTE" pkg-dir)) + (version (if (file-exists-p verfile) + (with-temp-buffer + (insert-file-contents verfile) + (buffer-string)) + (error "Cannot find ESSR source code"))) + (r-load-code (with-temp-buffer + (insert-file-contents loadremote) + (buffer-string)))) + (ess-write-to-dribble-buffer (format "version file: %s\nloadremote file: %s\n" + verfile loadremote)) + (unless (ess-boolean-command (format r-load-code version) nil 0.1) + (let ((errmsg (with-current-buffer " *ess-command-output*" (buffer-string))) + (files (directory-files src-dir t "\\.R$"))) + (ess-write-to-dribble-buffer (format "error loading ESSR.rda: \n%s\n" errmsg)) + ;; should not happen, unless extrem conditions (ancient R or failed download)) + (message "Failed to download ESSR.rda (see *ESS* buffer). Injecting ESSR code from local machine") + (ess-command (format ".ess.ESSRversion <- '%s'\n" version)) ; cannot do this at R level + (mapc #'ess--inject-code-from-file files))))) + +(ess-defmethod R ess-quit (&optional no-save) + (let (cmd + (sprocess (ess-get-process ess-current-process-name))) + (when (not sprocess) (error "No ESS process running")) + (ess-cleanup) + (setq cmd (format "base::q('%s')\n" (if no-save "no" "default"))) + (goto-char (marker-position (process-mark sprocess))) + (process-send-string sprocess cmd))) + +(defcustom inferior-ess-r-reload-hook nil + "Hook run when reloading the R inferior buffer." + :type 'hook + :group 'ess-R) + +(ess-defmethod R inferior-ess-reload (&optional start-args) + (R start-args) + (run-hooks 'inferior-ess-r-reload-hook)) + +(defun inferior-ess-r-force (&optional prompt force no-autostart ask-if-1) + (setq ess-dialect "R") + (ess-force-buffer-current prompt force no-autostart ask-if-1)) + + +;;*;; Editing Tools + +;;;*;;; Indentation Engine + +;; Written by Lionel Henry in mid 2015 + +(defun ess-r-indent-line () + "Indent current line as ESS R 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)) + (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. + (when (> (- (point-max) pos) (point)) + (goto-char (- (point-max) pos)))) + shift-amt)) + +(defun ess-r-indent-exp () + (save-excursion + (when current-prefix-arg + (ess-climb-to-top-level)) + (let* ((bounds (ess-continuations-bounds)) + (end (cadr bounds)) + (beg (if current-prefix-arg + (car bounds) + (forward-line) + (point)))) + (indent-region beg end)))) + +(defun ess-indent-call (&optional start) + (save-excursion + (when (ess-escape-calls) + (setq start (or start (point))) + (skip-chars-forward "^[(") + (forward-char) + (ess-up-list) + (indent-region start (point))))) + +(defun ess-offset (offset) + (setq offset (eval (intern (concat "ess-offset-" (symbol-name offset))))) + (when (and (not (eq offset nil)) + (listp offset) + (or (numberp (cadr offset)) + (eq (cadr offset) t) + (error "Malformed offset"))) + (setq offset (cadr offset))) + (cond ((numberp offset) + offset) + ((null offset) + 0) + (t + ess-indent-level))) + +(defun ess-offset-type (offset) + (setq offset (eval (intern (concat "ess-offset-" (symbol-name offset))))) + (if (listp offset) + (car offset) + offset)) + +(defun ess-overridden-blocks () + (append (when (memq 'fun-decl ess-align-blocks) + (list (car ess-prefixed-block-patterns))) + (when (memq 'control-flow ess-align-blocks) + (append (cdr ess-prefixed-block-patterns) + '("}?[ \t]*else"))))) + +(defun ess-calculate-indent (&optional parse-start) + "Return appropriate indentation for current line as ESS 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)) + (state (syntax-ppss)) + (containing-sexp (cadr state)) + (prev-containing-sexp (car (last (butlast (nth 9 state)))))) + (ess-back-to-indentation) + (cond + ;; Strings + ((ess-within-string-p state) + (current-indentation)) + ;; Comments + ((ess-calculate-indent--comments)) + ;; Indentation of commas + ((looking-at ",") + (ess-calculate-indent--comma)) + ;; Arguments: Closing + ((ess-call-closing-p) + (ess-calculate-indent--call-closing-delim)) + ;; Block: Contents (easy cases) + ((ess-calculate-indent--block-relatively)) + ;; Block: Prefixed block + ((ess-calculate-indent--prefixed-block-curly)) + ;; Continuations + ((ess-calculate-indent--continued)) + ;; Block: Overridden contents + ((ess-calculate-indent--aligned-block)) + ;; Block: Opening + ((ess-block-opening-p) + (ess-calculate-indent--block-opening)) + ;; Bare line + ((and (null containing-sexp) + (not (ess-unbraced-block-p))) + 0) + ;; Block: Closing + ((ess-block-closing-p) + (ess-calculate-indent--block 0)) + ;; Block: Contents + ((ess-block-p) + (ess-calculate-indent--block)) + ;; Arguments: Nested calls override + ((ess-calculate-indent--nested-calls)) + ;; Arguments: Contents + (t + (ess-calculate-indent--args)))))) + +(defun ess-calculate-indent--comments () + (when ess-indent-with-fancy-comments + (cond + ;; ### or #! + ((or (looking-at "###") + (and (looking-at "#!") + (= 1 (line-number-at-pos)))) + 0) + ;; Single # comment + ((looking-at "#[^#']") + comment-column)))) + +(defun ess-calculate-indent--comma () + (when (ess-within-call-p) + (let ((indent (save-excursion + (ess-calculate-indent--args))) + (unindent (progn (skip-chars-forward " \t") + ;; return number of skiped chars + (skip-chars-forward ", \t")))) + (- indent unindent)))) + +(defun ess-calculate-indent--call-closing-delim () + (cond ((save-excursion + (ess-skip-blanks-backward t) + (eq (char-before) ?,)) + (ess-calculate-indent--args nil)) + ((save-excursion + (and (ess-ahead-operator-p) + (or (ess-ahead-definition-op-p) + (not ess-align-continuations-in-calls)))) + (ess-calculate-indent--continued)) + (t + (ess-calculate-indent--args 0)))) + +(defun ess-calculate-indent--block-opening () + (cond + ;; Block is an argument in a function call + ((when containing-sexp + (ess-at-containing-sexp + (ess-behind-call-opening-p "[[(]"))) + (ess-calculate-indent--block 0)) + ;; Top-level block + ((null containing-sexp) 0) + ;; Block is embedded in another block + ((ess-at-containing-sexp + (equal (char-after) ?\{) + (+ (current-indentation) + (ess-offset 'block)))))) + +(defun ess-calculate-indent--aligned-block () + ;; Check for `else' opening + (if (and (memq 'control-flow ess-align-blocks) + (looking-at "else\\b") + (ess-climb-if-else)) + (progn + (when (looking-at "else\\b") + (ess-skip-curly-backward)) + (current-column)) + ;; Check for braced and unbraced blocks + (ess-save-excursion-when-nil + (let ((offset (if (looking-at "[{})]") + 0 (ess-offset 'block)))) + (when (and (cond + ;; Unbraced blocks + ((ess-climb-block-prefix)) + ;; Braced blocks + (containing-sexp + (when (ess-at-containing-sexp + (looking-at "{")) + (ess-escape-prefixed-block)))) + (some 'looking-at (ess-overridden-blocks))) + (+ (current-column) offset)))))) + +(defun ess-calculate-indent--block-relatively () + (ess-save-excursion-when-nil + (let ((offset (if (looking-at "[})]") 0 (ess-offset 'block))) + (start-line (line-number-at-pos))) + (cond + ;; Braceless block continuations: only when not in a call + ((ess-save-excursion-when-nil + (and (not (looking-at "{")) + (ess-goto-char (ess-unbraced-block-p)) + (not (looking-at "function\\b")) + (or (null containing-sexp) + (ess-at-containing-sexp + (not (looking-at "(")))))) + (ess-maybe-climb-broken-else 'same-line) + (ess-skip-curly-backward) + (+ (current-column) + (ess-offset 'block))) + ;; Don't indent relatively other continuations + ((ess-ahead-continuation-p) + nil) + ;; If a block already contains an indented line, we can indent + ;; relatively from that first line + ((ess-save-excursion-when-nil + (and (not (looking-at "}")) + containing-sexp + (goto-char containing-sexp) + (looking-at "{") + (progn + (forward-line) + (ess-back-to-indentation) + (/= (line-number-at-pos) start-line)) + (not (looking-at "[ \t]*\\(#\\|$\\)")) + (save-excursion + (or (ess-jump-expression) + (ess-jump-continuations)) + (< (line-number-at-pos) start-line)))) + (current-column)) + ;; If a block is not part of a call, we can indent relatively + ;; from the opening {. First check that enclosing { is first + ;; thing on line + ((and containing-sexp + (not (ess-unbraced-block-p)) + (goto-char containing-sexp) + (ess-block-opening-p) + (equal (point) (save-excursion + (ess-back-to-indentation) + (point)))) + (+ (current-column) offset)))))) + +(defun ess-arg-block-p () + (unless (or (null containing-sexp) + ;; Unbraced blocks in a { block are not arg blocks + (and (ess-unbraced-block-p) + (ess-at-containing-sexp + (looking-at "{")))) + (cond + ;; Unbraced body + ((ess-at-indent-point + (and (ess-unbraced-block-p) + (goto-char containing-sexp) + (ess-behind-call-opening-p "[[(]"))) + 'body) + ;; Indentation of opening brace as argument + ((ess-at-containing-sexp + (ess-behind-call-opening-p "[[(]")) + 'opening) + ;; Indentation of body or closing brace as argument + ((ess-at-containing-sexp + (and (or (looking-at "{") + (ess-behind-block-paren-p)) + prev-containing-sexp + (goto-char prev-containing-sexp) + (ess-behind-call-opening-p "[[(]"))) + 'body)))) + +(defun ess-calculate-indent--block (&optional offset) + (let ((arg-block (ess-arg-block-p))) + (cond (arg-block + (ess-calculate-indent--arg-block offset arg-block)) + (t + ;; Block is not part of an arguments list. Climb over any + ;; block opening (function declaration, etc) to indent from + ;; starting indentation. + (or (ess-climb-block-prefix) + (and (goto-char containing-sexp) + (ess-climb-block-prefix))) + (+ (current-indentation) (or offset (ess-offset 'block))))))) + +(defun ess-calculate-indent--arg-block (offset arg-block) + (let* ((block-type (cond ((or (ess-at-containing-sexp + (and (eq arg-block 'body) + (ess-climb-block-prefix "function"))) + (ess-at-indent-point + (and (eq arg-block 'opening) + (ess-backward-sexp 2) + (looking-at "function\\b")))) + 'fun-decl) + ((ess-at-indent-point + (ess-unbraced-block-p)) + 'unbraced) + ((ess-at-containing-sexp + (not (ess-ahead-attached-name-p))) + 'bare-block) + (t))) + (call-pos (if (and (not (eq block-type 'unbraced)) + (not (eq arg-block 'opening))) + (goto-char prev-containing-sexp) + (prog1 containing-sexp + (goto-char indent-point))))) + (ess-calculate-indent--args offset (ess-offset-type 'block) + call-pos indent-point block-type))) + +;; This function is currently the speed bottleneck of the indentation +;; engine. This is due to the need to call (ess-maximum-args-indent) +;; to check if some previous arguments have been pushed off from their +;; natural indentation: we need to check the whole call. This is very +;; inefficient especially when indenting a region containing a large +;; function call (e.g. some dplyr's data cleaning code). Should be +;; solved by implementing a cache as in (syntax-ppss), though it's +;; probably not worth the work. +(defun ess-calculate-indent--args (&optional offset type call-pos to block) + (let* ((call-pos (or call-pos containing-sexp)) + (max-col (prog1 (unless (eq type 'prev-line) + (ess-maximum-args-indent call-pos to)) + (goto-char call-pos))) + (override (and ess-align-arguments-in-calls + (save-excursion + (ess-climb-object) + (some 'looking-at ess-align-arguments-in-calls)))) + (type-sym (cond (block 'block) + ((looking-at "[[:blank:]]*[([][[:blank:]]*\\($\\|#\\)") + 'arguments-newline) + (t 'arguments))) + (type (or type + (and override 'open-delim) + (ess-offset-type type-sym))) + (offset (or offset + (and (not block) (eq type 'open-delim) 0) + (ess-offset type-sym))) + (indent + (cond + ;; Indent from opening delimiter + ((eq type 'open-delim) + (ess-calculate-indent--args-open-delim)) + ;; Indent from attached name + ((eq type 'prev-call) + (ess-calculate-indent--args-prev-call)) + ;; Indent from previous line indentation + ((eq type 'prev-line) + (ess-calculate-indent--args-prev-line)) + (t + (error "Malformed offset"))))) + (if max-col + (ess-adjust-argument-indent indent offset max-col block) + (+ indent offset)))) + +(defun ess-calculate-indent--args-open-delim () + (forward-char) + (current-column)) + +(defun ess-calculate-indent--args-prev-call () + ;; Handle brackets chains such as ][ (cf data.table) + (ess-climb-chained-delims) + ;; Handle call chains + (if ess-indent-from-chain-start + (while (and (ess-backward-sexp) + (when (looking-back "[[(][ \t,]*" (line-beginning-position)) + (goto-char (match-beginning 0))))) + (ess-backward-sexp)) + (when ess-indent-from-lhs + (ess-climb-lhs)) + (if (and nil + (eq block 'fun-decl) + (not (eq arg-block 'opening)) + (not (eq (ess-offset-type type-sym) 'open-delim))) + (+ (ess-offset 'block) (current-column)) + (current-column))) + +(defun ess-calculate-indent--args-prev-line () + (ess-at-indent-point + (cond + ;; Closing delimiters are actually not indented at + ;; prev-line, but at opening-line + ((looking-at "[]})]") + (ess-up-list -1) + (when (looking-at "{") + (ess-climb-block-prefix)) + (current-indentation)) + ;; Function blocks need special treatment + ((and (eq type 'prev-line) + (eq block 'fun-decl)) + (goto-char containing-sexp) + (ess-climb-block-prefix) + (current-indentation)) + ;; Regular case + (t + ;; Find next non-empty line to indent from + (while (and (= (forward-line -1) 0) + (looking-at "[ \t]*\\($\\|#\\)"))) + (goto-char (ess-code-end-position)) + ;; Climb relevant structures + (unless (ess-climb-block-prefix) + (when (eq (char-before) ?,) + (forward-char -1)) + (ess-climb-expression) + (ess-climb-continuations)) + ;; The following ensures that only the first line + ;; counts. Otherwise consecutive statements would get + ;; increasingly more indented. + (when (and block + containing-sexp + (not (eq block 'unbraced)) + (save-excursion + (/= (line-number-at-pos) + (progn (goto-char containing-sexp) + (line-number-at-pos))))) + (setq offset 0)) + (current-indentation))))) + +;; Indentation of arguments needs to keep track of how previous +;; arguments are indented. If one of those has a smaller indentation, +;; we push off the current line from its natural indentation. For +;; block arguments, we still need to push off this column so we ignore +;; it. +(defun ess-adjust-argument-indent (base offset max-col push) + (if push + (+ (min base max-col) offset) + (min (+ base offset) max-col))) + +;; When previous arguments are shifted to the left (can happen in +;; several situations) compared to their natural indentation, the +;; following lines should not get indented past them. The following +;; function checks the minimum indentation for all arguments of the +;; current function call or bracket indexing. +(defun ess-maximum-args-indent (&optional from to) + (let* ((to (or to (point))) + (to-line (line-number-at-pos to)) + (from-line (progn + (goto-char (1+ (or from containing-sexp))) + (line-number-at-pos))) + (prev-pos (1- (point))) + max-col) + (while (< (line-number-at-pos) to-line) + (forward-line) + (ess-back-to-indentation) + ;; Ignore the line with the function call, the line to be + ;; indented, and empty lines. + (unless (or (>= (line-number-at-pos) to-line) + (looking-at "[ \t]*\\($\\|#\\)")) + (let ((indent (cond + ;; First line: minimum indent is right after ( + ((= (line-number-at-pos) from-line) + (save-excursion + (goto-char (1+ containing-sexp)) + (current-column))) + ;; Handle lines starting with a comma + ((save-excursion + (looking-at ",")) + (+ (current-indentation) 2)) + (t + (current-indentation))))) + (setq max-col (min indent (or max-col indent)))))) + max-col)) + +;; Move to leftmost side of a call (either the first letter of its +;; name or its closing delim) +(defun ess-move-to-leftmost-side () + (when (or (looking-at "[({]") + (ess-behind-call-p)) + (ess-save-excursion-when-nil + (let ((start-col (current-column))) + (skip-chars-forward "^{[(") + (forward-char) + (ess-up-list) + (forward-char -1) + (< (current-column) start-col))))) + +(defun ess-max-col () + (let ((max-col (point))) + (save-excursion + (while (< (point) indent-point) + (unless (and ess-indent-with-fancy-comments + (looking-at "### ")) + (setq max-col (min max-col (current-column)))) + (forward-line) + (ess-back-to-indentation))) + max-col)) + +(defun ess-calculate-indent--prefixed-block-curly () + (when (looking-at "{") + (ess-save-excursion-when-nil + (let ((block-type (ess-climb-block-prefix))) + (cond ((ess-save-excursion-when-nil + (and (memq 'fun-decl-opening ess-indent-from-lhs) + (string= block-type "function") + (ess-climb-operator) + (ess-behind-assignment-op-p) + (ess-climb-expression))) + (current-column)) + ((= (save-excursion + (back-to-indentation) + (point)) + (point)) + (ess-calculate-indent--continued))))))) + +(defun ess-calculate-indent--continued () + "If a continuation line, return an indent of this line, +otherwise nil." + (save-excursion + (let* ((start-line (line-number-at-pos)) + (prev-pos 0) + (cascade (eq (ess-offset-type 'continued) 'cascade)) + (climbed (ess-climb-continuations cascade)) + max-col) + (when climbed + (cond + ;; Overridden calls + ((and ess-align-continuations-in-calls + (not (eq climbed 'def-op)) + containing-sexp + (save-excursion + (goto-char containing-sexp) + (looking-at "[[(]"))) + (setq max-col (ess-max-col)) + (ess-move-to-leftmost-side) + (+ (min (current-column) max-col) + (if (eq climbed 'def-op) + (ess-offset 'continued) + 0))) + ;; Regular case + (t + (let ((first-indent (or (eq climbed 'def-op) + (save-excursion + (when (ess-ahead-closing-p) + (ess-climb-expression)) + (not (ess-climb-continuations cascade)))))) + ;; Record all indentation levels between indent-point and + ;; the line we climbed. Some lines may have been pushed off + ;; their natural indentation. These become the new + ;; reference. + (setq max-col (ess-max-col)) + ;; Indenting continuations from the front of closing + ;; delimiters looks better + (when + (ess-ahead-closing-p) + (backward-char)) + (+ (min (current-column) max-col) + (cond + ((eq (ess-offset-type 'continued) 'cascade) + (ess-offset 'continued)) + (first-indent + (ess-offset 'continued)) + (t + 0)))))))))) + +(defun ess-calculate-indent--nested-calls () + (when ess-align-nested-calls + (let ((calls (mapconcat 'identity ess-align-nested-calls "\\|")) + match) + (save-excursion + (and containing-sexp + (looking-at (concat "\\(" calls "\\)(")) + (setq match (match-string 1)) + (goto-char containing-sexp) + (looking-at "(") + (ess-backward-sexp) + (looking-at (concat match "(")) + (current-column)))))) + + +;;;*;;; Call filling engine + +;; Unroll arguments to a single line until closing marker is found. +(defun ess-fill--unroll-lines (bounds &optional jump-cont) + (let* ((last-pos (point-min)) + (containing-sexp (ess-containing-sexp-position)) + prefix-break) + (goto-char (car bounds)) + (goto-char (ess-code-end-position)) + (while (and (/= (point) last-pos) + (< (line-end-position) + (cadr bounds)) + (not prefix-break)) + (setq last-pos (point)) + ;; Check whether we ended up in a sub call. In this case, jump + ;; over it, otherwise, join lines. + (let ((contained-sexp (ess-containing-sexp-position))) + (cond ((and contained-sexp + containing-sexp + (not (= containing-sexp contained-sexp))) + (goto-char (1+ contained-sexp)) + (ess-up-list)) + ;; Jump over continued statements + ((and jump-cont (ess-ahead-operator-p 'strict)) + (ess-climb-token) + (ess-jump-continuations)) + ;; Jump over comments + ((looking-at "#") + (forward-line) + (ess-indent-line)) + (t + (join-line 1)))) + (goto-char (ess-code-end-position))) + (goto-char (car bounds)))) + +(defvar ess-fill--orig-pos nil + "Original position of cursor.") + +(defvar ess-fill--orig-state nil + "Backup of original code to cycle back to original state.") + +(defvar ess-fill--second-state nil + "Backup of code produce by very first cycling. If this is equal + to orig-state, no need to cycle back to original state.") + +(defvar ess-fill--style-level nil + "Filling style used in last cycle.") + +(defun ess-fill--substring (bounds) + (buffer-substring (car bounds) (marker-position (cadr bounds)))) + +;; Detect repeated commands +(defun ess-fill-style (type bounds) + (let ((max-level + ;; This part will be simpler once we have the style alist + (cond ((eq type 'calls) + ;; No third style either when ess-offset-arguments is + ;; set to 'open-delim, or when ess-fill-calls-newlines + ;; is nil and no numeric prefix is given + (if (and (not (eq (ess-offset-type 'arguments) + 'open-delim)) + (or ess-fill-calls-newlines + (numberp current-prefix-arg))) + 3 + 2)) + ((eq type 'continuations) + 2)))) + (if (not (memq last-command '(fill-paragraph-or-region + fill-paragraph))) + (progn + ;; Record original state on first cycling + (setq ess-fill--orig-state (ess-fill--substring bounds)) + (setq ess-fill--orig-pos (point)) + (setq ess-fill--second-state nil) + (setq ess-fill--style-level 1)) + ;; Also record state on second cycling + (when (and (= ess-fill--style-level 1) + (null ess-fill--second-state)) + (setq ess-fill--second-state (ess-fill--substring bounds))) + (cond ((>= ess-fill--style-level max-level) + (let ((same-last-and-orig (string= (ess-fill--substring bounds) + ess-fill--orig-state)) + (same-2nd-and-orig (string= ess-fill--orig-state + ess-fill--second-state))) + ;; Avoid cycling to the same state twice + (cond ((and same-last-and-orig + same-2nd-and-orig) + (setq ess-fill--style-level 2)) + ((or same-last-and-orig + same-2nd-and-orig) + (setq ess-fill--style-level 1)) + (t + (setq ess-fill--style-level 0))))) + (ess-fill--style-level + (setq ess-fill--style-level (1+ ess-fill--style-level)))))) + ess-fill--style-level) + +(defun ess-fill-args (&optional style) + (let ((start-pos (point-min)) + (orig-col (current-column)) + (orig-line (line-number-at-pos)) + (bounds (ess-args-bounds 'marker)) + ;; Set undo boundaries manually + (undo-inhibit-record-point t) + last-pos last-newline prefix-break + infinite) + (when (not bounds) + (error "Could not find function bounds")) + (setq style (or style (ess-fill-style 'calls bounds))) + (if (= style 0) + (progn + (delete-region (car bounds) (marker-position (cadr bounds))) + (insert ess-fill--orig-state) + ;; Restore the point manually. (save-excursion) wouldn't + ;; work here because we delete the text rather than just + ;; modifying it. + (goto-char ess-fill--orig-pos) + (message "Back to original formatting")) + (when ess-blink-refilling + (ess-blink-region (nth 2 bounds) + (1+ (marker-position (cadr bounds))))) + (undo-boundary) + (save-excursion + (ess-fill--unroll-lines bounds t) + (cond + ;; Some styles start with first argument on a newline + ((and (memq style '(2 4)) + ess-fill-calls-newlines + (not (looking-at "[ \t]*#"))) + (newline-and-indent)) + ;; Third level, start a newline after N arguments + ((and (= style 3) + (not (looking-at "[ \t]*#"))) + (let ((i (if (numberp current-prefix-arg) + current-prefix-arg + 1))) + (while (and (> i 0) + (ess-jump-arg) + (ess-jump-char ",")) + (setq i (1- i)))) + (newline-and-indent))) + (ess-fill-args--roll-lines) + ;; Reindent surrounding context + (ess-indent-call (car bounds))) + ;; Signal marker for garbage collection + (set-marker (cadr bounds) nil) + (undo-boundary)))) + +(defun ess-fill-args--roll-lines () + (while (and (not (looking-at "[])]")) + (/= (point) (or last-pos 1)) + (not infinite)) + (setq prefix-break nil) + ;; Record start-pos as future breaking point to avoid breaking + ;; at `=' sign + (while (looking-at "[ \t]*[\n#]") + (forward-line) + (ess-back-to-indentation)) + (setq start-pos (point)) + (while (and (< (current-column) fill-column) + (not (looking-at "[])]")) + (/= (point) (or last-pos 1)) + ;; Break after one pass if prefix is active + (not prefix-break)) + (when (memq style '(2 3)) + (setq prefix-break t)) + (ess-jump-token ",") + (setq last-pos (point)) + ;; Jump expression and any continuations. Reindent all lines + ;; that were jumped over + (let ((cur-line (line-number-at-pos)) + end-line) + (cond ((ess-jump-arg) + (setq last-newline nil)) + ((ess-token-after= ",") + (setq last-newline nil) + (setq last-pos (1- (point))))) + (save-excursion + (when (< cur-line (line-number-at-pos)) + (setq end-line (line-number-at-pos)) + (ess-goto-line (1+ cur-line)) + (while (and (<= (line-number-at-pos) end-line) + (/= (point) (point-max))) + (ess-indent-line) + (forward-line)))))) + (when (or (>= (current-column) fill-column) + prefix-break + ;; Ensures closing delim on a newline + (and (= style 4) + (looking-at "[ \t]*[])]") + (setq last-pos (point)))) + (if (and last-pos (/= last-pos start-pos)) + (goto-char last-pos) + (ess-jump-char ",")) + (cond ((looking-at "[ \t]*[#\n]") + (forward-line) + (ess-indent-line) + (setq last-newline nil)) + ;; With levels 2 and 3, closing delim goes on a newline + ((looking-at "[ \t]*[])]") + (when (and (memq style '(2 3 4)) + ess-fill-calls-newlines + (not last-newline)) + (newline-and-indent) + ;; Prevent indenting infinitely + (setq last-newline t))) + ((not last-newline) + (newline-and-indent) + (setq last-newline t)) + (t + (setq infinite t)))))) + +(defun ess-fill-continuations (&optional style) + (let ((bounds (ess-continuations-bounds 'marker)) + (undo-inhibit-record-point t) + (last-pos (point-min)) + last-newline infinite) + (when (not bounds) + (error "Could not find statements bounds")) + (setq style (or style (ess-fill-style 'continuations bounds))) + (if (= style 0) + (progn + (delete-region (car bounds) (marker-position (cadr bounds))) + (insert ess-fill--orig-state) + (goto-char ess-fill--orig-pos) + (message "Back to original formatting")) + (when ess-blink-refilling + (ess-blink-region (car bounds) (marker-position (cadr bounds)))) + (undo-boundary) + (save-excursion + (ess-fill--unroll-lines bounds) + (while (and (< (point) (cadr bounds)) + (/= (point) (or last-pos 1)) + (not infinite)) + (setq last-pos (point)) + (when (and (ess-jump-expression) + (indent-according-to-mode) + (not (> (current-column) fill-column))) + (setq last-newline nil)) + (ess-jump-operator) + (if (or (and (> (current-column) fill-column) + (goto-char last-pos)) + (= style 2)) + (progn + (ess-jump-operator) + (unless (= (point) (cadr bounds)) + (when last-newline + (setq infinite t)) + (newline-and-indent) + (setq last-newline t))) + (setq last-newline nil))) + (ess-indent-call (car bounds))) + (set-marker (cadr bounds) nil) + (undo-boundary)))) + +(provide 'ess-r-mode) + + ; Local variables section + +;;; This file is automatically placed in Outline minor mode. +;;; The file is structured as follows: +;;; Chapters: ^L ; +;;; Sections: ;;*;; +;;; Subsections: ;;;*;;; +;;; Components: defuns, defvars, defconsts +;;; Random code beginning with a ;;;;* comment + +;;; Local variables: +;;; mode: emacs-lisp +;;; outline-minor-mode: nil +;;; mode: outline-minor +;;; outline-regexp: "\^L\\|\\`;\\|;;\\*\\|;;;\\*\\|(def[cvu]\\|(setq\\|;;;;\\*" +;;; End: + +;;; ess-r-mode.el ends here diff -Nru ess-16.10/lisp/ess-roxy.el ess-17.11/lisp/ess-roxy.el --- ess-16.10/lisp/ess-roxy.el 2016-10-22 16:03:27.000000000 +0000 +++ ess-17.11/lisp/ess-roxy.el 2017-11-13 14:13:16.000000000 +0000 @@ -1,6 +1,6 @@ ;;; ess-roxy.el --- convenient editing of in-code roxygen documentation ;; -;; Copyright (C) 2009--2012 Henning Redestig, A.J. Rossini, Richard +;; Copyright (C) 2009--2017 Henning Redestig, A.J. Rossini, Richard ;; M. Heiberger, Martin Maechler, Kurt Hornik, Rodney Sparapani, Stephen ;; Eglen and Vitalie Spinu. ;; @@ -64,10 +64,12 @@ (require 'ess-utils) (require 'ess-custom) +(require 'ess-utils) (require 'hideshow) (require 'outline) (eval-when-compile - (require 'cl)) + ;; We can't use cl-lib whilst supporting Emacs <= 24.2 users + (with-no-warnings (require 'cl))) (autoload 'Rd-preview-help "ess-rd" "[autoload]" t) (require 'essddr "ess-rd.el") @@ -201,9 +203,8 @@ :keymap ess-roxy-mode-map (if ess-roxy-mode (progn - (unless (featurep 'xemacs) - (font-lock-add-keywords nil ess-roxy-font-lock-keywords)) - (if (and (featurep 'emacs) (>= emacs-major-version 24)) + (font-lock-add-keywords nil ess-roxy-font-lock-keywords) + (if (>= emacs-major-version 24) (add-to-list 'completion-at-point-functions 'ess-roxy-tag-completion) (add-to-list 'comint-dynamic-complete-functions 'ess-roxy-complete-tag)) ;; Hideshow Integration @@ -226,8 +227,7 @@ (bound-and-true-p hs-minor-mode)) (hs-show-all) (hs-minor-mode)) - (unless (featurep 'xemacs) - (font-lock-remove-keywords nil ess-roxy-font-lock-keywords)) + (font-lock-remove-keywords nil ess-roxy-font-lock-keywords) (setq-local syntax-propertize-function nil) (setq-local font-lock-fontify-region-function nil) (setq-local font-lock-unfontify-region-function nil) @@ -446,7 +446,6 @@ (let ((line-n (count-lines 1 (point)))) (goto-char (ess-roxy-beg-of-field)) (not (equal line-n (count-lines 1 (point))))))) - (ess-roxy-should-indent-line-p) (ess-back-to-roxy) (delete-region (point) (progn (skip-chars-forward " \t") (point))) (insert (make-string ess-indent-offset ? )))) @@ -677,15 +676,24 @@ "Use a (possibly newly) connected R session and the roxygen package `ess-roxy-package' to generate the Rd code for entry at point, place it in a temporary buffer and return that buffer." - (let ((beg (ess-roxy-beg-of-entry)) + (let* ((beg (ess-roxy-beg-of-entry)) (tmpf (make-temp-file "ess-roxy")) (roxy-buf (get-buffer-create " *RoxygenPreview*")) + (R-old-roxy + (concat + "..results <- roxygen2:::roc_process(rd_roclet(), parse.files(P), \"\");" + "cat(vapply(..results, function(x) roxygen2:::rd_out_cache$compute(x, format(x)), character(1)))" )) + (R-new-roxy + (concat + "..results <- roc_proc_text(rd_roclet(), readChar(P, file.info(P)$size));" + "cat(vapply(..results, format, character(1)))" )) (out-rd-roclet (cond ((string= "roxygen" ess-roxy-package) "make.Rd2.roclet()$parse") ;; must not line break strings to avoid getting +s in the output ((string= "roxygen2" ess-roxy-package) - "(function(P) { if(compareVersion(paste(packageVersion('roxygen2')), '3.0.0') < 0) { ..results <- roxygen2:::roc_process(rd_roclet(), parse.files(P), \"\");cat(vapply(..results, FUN.VALUE=character(1), function(x) { roxygen2:::rd_out_cache$compute(x, format(x))})) } else {..results <- roc_proc_text(rd_roclet(), readChar(P, file.info(P)$size));cat(vapply(..results, format, FUN.VALUE = character(1))) } })") + (concat "(function(P) { if(packageVersion('roxygen2') < '3.0.0') {" + R-old-roxy "} else {" R-new-roxy "} })")) (t (error "need to hard code the roclet output call for roxygen package '%s'" ess-roxy-package)))) ) @@ -757,7 +765,14 @@ (goto-char 1) (search-forward-regexp "name{\\(.+\\)}") (set-visited-file-name (concat (match-string 1) ".Rd")))) - (Rd-mode))) + (Rd-mode) + ;; why should the following be needed here? [[currently has no effect !!]] + ;; usually in a *.Rd file fontification happens automatically + (if (fboundp 'font-lock-ensure) + (font-lock-ensure) + ;; emacs <= 24.x.y: + (font-lock-fontify-buffer)))) + (defun ess-roxy-guess-str (&optional not-here) "guess the prefix used in the current roxygen block. If diff -Nru ess-16.10/lisp/ess-r-package.el ess-17.11/lisp/ess-r-package.el --- ess-16.10/lisp/ess-r-package.el 2016-10-22 16:03:27.000000000 +0000 +++ ess-17.11/lisp/ess-r-package.el 2017-11-13 14:13:16.000000000 +0000 @@ -38,7 +38,7 @@ :group 'ess-r-package :type 'boolean) -(defvar-local ess-r-package-info nil +(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 @@ -61,24 +61,78 @@ "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 +\(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 UI +(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." + ;; FIXME Emacs 25.1: Use `when-let' + (let ((project (ess-r-package-project dir))) + (when project + (symbol-name (car ess-r-package--project-cache))))) + (defun ess-r-package-get-info () - "Get current package info. -Return a cons cell of two strings whose CAR is a package name and -CDR is a package directory. The package is determined by (in this -order) the buffer-local value of `ess-r-package-info', -whether the current file is part of a package, or the value of -`ess-r-package-info' in the attached process buffer." - (or ess-r-package-info - (ess-r-package--local-package-info) - (with-ess-process-buffer t - ess-r-package-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." + ;; FIXME Emacs 25.1: Use `when-let' + (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-package-use-dir () + "Set process directory to current package directory." + (interactive) + (let ((dir (cdr (ess-r-package-project)))) + (ess-use-dir dir))) (defun ess-r-package-set-package () "Set a package for ESS r-package commands." @@ -94,15 +148,15 @@ (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-info pkg-info)) - (setq ess-r-package-info pkg-info))) + (add-file-local-variable 'ess-r-package--project-cache pkg-info)) + (setq ess-r-package--project-cache pkg-info))) (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 (car (ess-r-package-get-info)))) + (current-pkg (ess-r-package-name))) (let ((env (ess-r-get-evaluation-env))) (when env (setq pkgs (append '("*none*") pkgs)) @@ -112,22 +166,28 @@ (defun ess-r-package-set-namespaced-evaluation () (when ess-r-package-auto-set-evaluation-env - (let ((pkg (car (ess-r-package-get-info)))) - (when pkg - (ess-r-set-evaluation-env pkg))))) + (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))) + (subpath (substring subpath 0 2))) + (string= subpath (file-name-as-directory "R")))) + (ess-r-set-evaluation-env (ess-r-package-name)))))) (add-hook 'R-mode-hook 'ess-r-package-set-namespaced-evaluation) (defun ess-r-package-send-process (command &optional msg alt default-alt) (inferior-ess-r-force) - (let* ((pkg-info (or (ess-r-package-get-info) + (let* ((pkg-info (or (ess-r-package-project) (ess-r-package-set-package))) - (name (car pkg-info)) + (name (ess-r-package-name)) (path (concat "'" (cdr pkg-info) "'")) (args (ess-r-command--process-alt-args alt default-alt))) (message msg name) (with-ess-process-buffer nil - (setq ess-r-package-info pkg-info)) + (setq ess-r-package--project-cache ess-r-package--project-cache)) (ess-eval-linewise (format command (concat path args))))) (defun ess-r-command--process-alt-args (alt &optional default-alt) @@ -142,23 +202,15 @@ ;;;*;;; Package Detection -(defun ess-r-package--local-package-info () - "Parses DESCRIPTION file in PATH (R specific so far). PATH -defaults to the value returned by -`ess-r-package--find-package-path'." - (let ((pkg-path (ess-r-package--find-package-path))) - (setq ess-r-package-info - (if pkg-path - (cons (ess-r-package--find-package-name pkg-path) pkg-path) - ;; cache non-package files as well - '(nil))))) - -(defun ess-r-package--find-package-path () +(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 (if (buffer-file-name) - (file-name-directory (buffer-file-name)) - default-directory)) + (let* ((path (cond + (dir) + ((buffer-file-name) + (file-name-directory (buffer-file-name))) + (t + default-directory))) (pkg-path (when path (or @@ -179,17 +231,6 @@ (when pkg-path (directory-file-name pkg-path)))) -(defun ess--parent-dir (path n) - "Return Nth parent of PATH." - (let ((opath path)) - (while (and path (> n 0)) - (setq path (file-name-directory (directory-file-name opath))) - (if (equal path opath) - (setq path nil) - (setq opath path - n (1- n)))) - path)) - (defun ess-r-package--find-package-name (path) (let ((file (expand-file-name ess-r-package-root-file path)) (case-fold-search t)) @@ -198,7 +239,7 @@ (insert-file-contents file) (goto-char (point-min)) (when (re-search-forward "package: \\(.*\\)" nil t) - (match-string 1)))))) + (intern (match-string 1))))))) ;;;*;;; Devtools Integration @@ -349,7 +390,8 @@ :type 'hook) (defcustom ess-r-package-mode-line - '(:eval (let* ((pkg-name (car (ess-r-package-get-info)))) + ;; 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 @@ -372,8 +414,10 @@ :lighter ess-r-package-mode-line (cond (ess-r-package-mode + (add-hook 'project-find-functions #'ess-r-package-project) (run-hooks 'ess-r-package-enter-hook)) (t + (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) @@ -384,8 +428,9 @@ (not (memq major-mode '(minibuffer-inactive-mode fundamental-mode))) (or (buffer-file-name) default-directory)) - (let ((pkg-info (ess-r-package-get-info))) - (when (car pkg-info) + ;; FIXME Emacs 25.1: Use `when-let' + (let ((pkg-info (ess-r-package-project))) + (when pkg-info (ess-r-package-mode 1))))) diff -Nru ess-16.10/lisp/ess-r-syntax.el ess-17.11/lisp/ess-r-syntax.el --- ess-16.10/lisp/ess-r-syntax.el 2016-10-22 16:03:27.000000000 +0000 +++ ess-17.11/lisp/ess-r-syntax.el 2017-11-13 14:13:16.000000000 +0000 @@ -27,8 +27,10 @@ ;;; Code: +(require 'ess-utils) (require 'regexp-opt) -(require 'cl-lib) + +(with-no-warnings (require 'cl)) ; instead of cl-lib so we support Emacs 24.2 ;;*;; Utils @@ -187,7 +189,7 @@ ;; backward (defun ess-climb-token--operator () (when (pcase (char-before) - ((or ?+ ?/ ?^ ?~ ?? ?!) + ((or `?+ `?/ `?^ `?~ `?? `?!) (ess-backward-char)) (`?= (prog1 (ess-backward-char) @@ -196,7 +198,7 @@ (ess-climb-token--char ?:) (ess-climb-token--char ?>) (ess-climb-token--char ?<)))) - ((or ?& ?| ?* ?@ ?$) + ((or `?& `?| `?* `?@ `?$) (prog1 (ess-backward-char) (ess-climb-token--char (char-after)))) (`?< @@ -348,7 +350,7 @@ (mapc (lambda (delims) (while (and (ess-token-after= nil delims) (eq (char-before) (string-to-char - (car delim)))) + (car delims)))) (ess-backward-char))) '(("[" "[[") ("]" "]]"))))) (ess-token-after= '("," ";")) @@ -362,7 +364,7 @@ (let ((refined-type (pcase (ess-token-type token) ;; Parameter assignment - ("=" + (`"=" (save-excursion (goto-char (ess-token-start token)) (let ((containing-sexp (ess-containing-sexp-position))) @@ -375,14 +377,14 @@ (ess-token-before= '("," "("))))) "param-assign")))) ;; Quoted identifiers - ("string" + (`"string" (when (or ;; Quoted parameter names (ess-refined-token= (ess-token-after) "param-assign") ;; Quoted call names (ess-token-after= "(")) "identifier")) - ((or "(" ")") + ((or `"(" `")") (or (save-excursion (if (ess-token-close-delimiter-p token) (ess-climb-paired-delims nil token) @@ -395,7 +397,7 @@ (ess-climb-paired-delims ")" token) (when (ess-token-before= '("identifier" "string" ")" "]" "]]" "}")) "argslist-delimiter"))))) - ((or "{" "}") + ((or `"{" `"}") (save-excursion (unless (ess-climb-paired-delims "}" token) (goto-char (ess-token-start token))) @@ -890,7 +892,7 @@ (forward-char) (backward-sexp) (not (looking-back - (concat ess-R-name-pattern "[[:blank:]]*") + (concat ess-r-name-pattern "[[:blank:]]*") (line-beginning-position))))))) (defun ess-block-p () @@ -1272,13 +1274,13 @@ :expr nil))) (when (ess-while (and (<= (plist-get state :moved) 1) (or (ess-save-excursion-when-nil - (and (ess-climb-operator) - (ess-climb-continuations--update-state state 'op) - (ess-climb-expression ignore-ifelse))) + (and (ess-climb-operator) + (ess-climb-continuations--update-state state cascade 'op) + (ess-climb-expression ignore-ifelse))) (ess-climb-unary-operator)) (/= (plist-get state :last-pos) (point))) - (ess-climb-continuations--update-state state nil) - (plist-put state :last-pos (point))) + (ess-climb-continuations--update-state state cascade nil) + (plist-put state :last-pos (point))) (when (and (plist-get state :prev-point) (or (= (plist-get state :moved) 3) (not (plist-get state :expr)))) @@ -1287,7 +1289,7 @@ 'def-op (< (line-number-at-pos) (plist-get state :start-line)))))) -(defun ess-climb-continuations--update-state (state &optional op) +(defun ess-climb-continuations--update-state (state cascade &optional op) ;; Climbing multi-line expressions should not count as moving up (when op (plist-put state :expr (ess-ahead-closing-p))) @@ -1541,7 +1543,7 @@ (skip-chars-forward " \t") ;; Jump over backquoted names (cond ((and (eq (char-after) ?`) - (looking-back ess-R-symbol-pattern + (looking-back ess-r-symbol-pattern (1- (point)))) (forward-char) (setq climbed t)) diff -Nru ess-16.10/lisp/ess-rutils.el ess-17.11/lisp/ess-rutils.el --- ess-16.10/lisp/ess-rutils.el 2014-10-28 18:15:42.000000000 +0000 +++ ess-17.11/lisp/ess-rutils.el 2017-11-13 14:13:16.000000000 +0000 @@ -321,7 +321,7 @@ 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 (ess-replace-regexp-in-string " +" "+" string))) + (okstring (replace-regexp-in-string " +" "+" string))) (if current-prefix-arg (let ((mpp (concat "&max=" @@ -426,23 +426,11 @@ ["Browse HTML" ess-rutils-html-docs t] ["Apropos" ess-rutils-apropos t])) -(when (featurep 'xemacs) - (defun ess-rutils-mode-xemacs-menu () - "Hook to install `ess-rutils-mode' menu for XEmacs (with easymenu)." - (if 'inferior-ess-mode - ;; Why does using nil for 2nd arg put menu at top level? - (easy-menu-add-item inferior-ess-mode-menu nil - ess-rutils-mode-menu) - (easy-menu-remove-item inferior-ess-mode-menu nil - ess-rutils-mode-menu))) - (add-hook 'inferior-ess-mode-hook 'ess-rutils-mode-xemacs-menu t)) - -(unless (featurep 'xemacs) - (easy-menu-add-item inferior-ess-mode-menu nil - ess-rutils-mode-menu)) +(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 +(add-hook 'ess-r-post-run-hook (lambda () (ess--inject-code-from-file ess-rutils-rhtml-fn)) t) diff -Nru ess-16.10/lisp/ess-s3-d.el ess-17.11/lisp/ess-s3-d.el --- ess-16.10/lisp/ess-s3-d.el 2014-10-28 18:15:42.000000000 +0000 +++ ess-17.11/lisp/ess-s3-d.el 2017-11-13 14:13:16.000000000 +0000 @@ -33,7 +33,7 @@ (autoload 'inferior-ess "ess-inf" "Run an ESS process.") -(require 'ess-s-l) +(require 'ess-s-lang) (defvar S3-customize-alist (append diff -Nru ess-16.10/lisp/ess-s4-d.el ess-17.11/lisp/ess-s4-d.el --- ess-16.10/lisp/ess-s4-d.el 2014-10-28 18:15:42.000000000 +0000 +++ ess-17.11/lisp/ess-s4-d.el 2017-11-13 14:13:16.000000000 +0000 @@ -36,7 +36,7 @@ (autoload 'inferior-ess "ess-inf" "Run an ESS process.") -(require 'ess-s-l) +(require 'ess-s-lang) ;; Some of this is based on files from: ;; Copyright (C) 1996, John M. Chambers. diff -Nru ess-16.10/lisp/ess-sas-a.el ess-17.11/lisp/ess-sas-a.el --- ess-16.10/lisp/ess-sas-a.el 2015-09-19 03:25:42.000000000 +0000 +++ ess-17.11/lisp/ess-sas-a.el 2017-11-13 14:13:16.000000000 +0000 @@ -119,9 +119,8 @@ :group 'ess-sas :type 'integer) -(defcustom ess-sas-rtf-font-name "Bitstream Vera Sans Mono" -; (if (featurep 'xemacs) "Lucida Sans Typewriter" "Bitstream Vera Sans Mono") - "*Name of font to create MS RTF with" +(defcustom ess-sas-rtf-font-name "Courier" ; "Bitstream Vera Sans Mono" + "Name of font with which to create MS RTF." :group 'ess-sas :type 'string) @@ -169,11 +168,7 @@ (make-variable-buffer-local 'ess-sas-submit-command-options) (defvar ess-sas-submit-method - (if ess-microsoft-p - (if (w32-shell-dos-semantics) 'ms-dos 'sh) - (if (or (equal system-type 'Apple-Macintosh) - (and ess-sas-submit-mac-virtual-pc (equal system-type 'darwin))) - 'apple-script 'sh)) + (if (and ess-microsoft-p (w32-shell-dos-semantics)) 'ms-dos 'sh) "Method used by `ess-sas-submit'. The default is based on the value of the emacs variable `system-type' and, on Windows, the function `w32-shell-dos-semantics'. @@ -513,81 +508,70 @@ (defun ess-sas-graph-view () "Open a GSASFILE for viewing." (interactive) -;; (ess-sas-goto-shell t) + ;; (ess-sas-goto-shell t) (ess-sas-cd) (ess-sas-goto-log 'no-error-check) - (save-excursion (let ( - (ess-tmp-length (length ess-sas-graph-view-viewer-alist)) - (ess-tmp-counter 0) - (ess-tmp-graph nil) - (ess-tmp-graph-alist nil) - (ess-tmp-glyph nil) - (ess-tmp-graph-regexp - (concat "[cCub][oOty][rRpt][dDue][sSt][ ][wW][rR][iI][tT][tT][eE][nN][ ]+[tT][oO][ ]\n?[ ]*\\(.*" -;; (concat "[ ][rR][eE][cC][oO][rR][dD][sS][ ][wW][rR][iI][tT][tT][eE][nN][ ]+[tT][oO][ ]\n?[ ]*\\(.*" - ess-sas-graph-view-suffix-regexp "\\)"))) - ; (concat "['\"]\\(.*" ess-sas-graph-suffix-regexp "\\)['\"]"))) - - (save-match-data - (search-backward-regexp "[ \t=]" nil t) - - (save-excursion - (setq ess-tmp-graph (ess-search-except ess-tmp-graph-regexp))) - - (if (not ess-tmp-graph) - (setq ess-tmp-graph (ess-search-except ess-tmp-graph-regexp nil t))) - - (setq ess-tmp-graph (read-string "GSASFILE: " - (or ess-tmp-graph ess-sas-file-path))) - - (if (fboundp 'ess-xemacs-insert-glyph) (progn - (if (string-match "[.][gG][iI][fF]" ess-tmp-graph) - (setq ess-tmp-glyph 'gif) - ;;else - (if (string-match "[.][jJ][pP][eE]?[gG]" ess-tmp-graph) - (setq ess-tmp-glyph 'jpeg))))) - - ;;GNU Emacs graphics file image viewing mode loaded? - (if (and (boundp 'auto-image-file-mode) auto-image-file-mode - (string-match "[.][jJ][pP][eE]?[gG]" ess-tmp-graph)) - (find-file ess-tmp-graph) - ;;else XEmacs graphics file image viewing mode loaded? - (if (and (fboundp 'image-mode) - (string-match "[.]\\([jJ][pP][eE]?[gG]\\|[gG][iI][fF]\\)" - ess-tmp-graph)) - (find-file ess-tmp-graph) - ;;else XEmacs graphics file image viewing primitives loaded? - (if ess-tmp-glyph (progn - (switch-to-buffer (file-name-nondirectory ess-tmp-graph)) - (ess-xemacs-insert-glyph - (make-glyph (vector ess-tmp-glyph :file ess-tmp-graph)))) - - ;;else use the appropriate graphics file image viewer - (while (< ess-tmp-counter ess-tmp-length) - (setq ess-tmp-graph-alist - (nth ess-tmp-counter ess-sas-graph-view-viewer-alist)) - (setq ess-tmp-graph-regexp (car ess-tmp-graph-alist)) - - (if (string-match - (concat "[.]" ess-tmp-graph-regexp) ess-tmp-graph) - (progn - (ess-sas-goto-shell t) - (insert ess-sas-submit-pre-command " " - (cdr ess-tmp-graph-alist) " " ess-tmp-graph - (if (equal ess-sas-submit-method 'sh) " &")) - (setq ess-tmp-glyph 'alist) - (setq ess-tmp-counter ess-tmp-length)) - ;;else - (setq ess-tmp-counter (+ ess-tmp-counter 1)))) - - (if (not ess-tmp-glyph) (progn - (ess-sas-goto-shell t) - (insert ess-sas-submit-pre-command " " - ess-sas-graph-view-viewer-default " " ess-tmp-graph - (if (equal ess-sas-submit-method 'sh) " &")))) + (save-excursion + (let ( + (ess-tmp-length (length ess-sas-graph-view-viewer-alist)) + (ess-tmp-counter 0) + (ess-tmp-graph nil) + (ess-tmp-graph-alist nil) + (ess-tmp-glyph nil) + (ess-tmp-graph-regexp + (concat "[cCub][oOty][rRpt][dDue][sSt][ ][wW][rR][iI][tT][tT][eE][nN][ ]+[tT][oO][ ]\n?[ ]*\\(.*" + ;; (concat "[ ][rR][eE][cC][oO][rR][dD][sS][ ][wW][rR][iI][tT][tT][eE][nN][ ]+[tT][oO][ ]\n?[ ]*\\(.*" + ess-sas-graph-view-suffix-regexp "\\)"))) + ; (concat "['\"]\\(.*" ess-sas-graph-suffix-regexp "\\)['\"]"))) + + (save-match-data + (search-backward-regexp "[ \t=]" nil t) + + (save-excursion + (setq ess-tmp-graph (ess-search-except ess-tmp-graph-regexp))) + + (if (not ess-tmp-graph) + (setq ess-tmp-graph (ess-search-except ess-tmp-graph-regexp nil t))) + + (setq ess-tmp-graph (read-string "GSASFILE: " + (or ess-tmp-graph ess-sas-file-path))) + + ;;GNU Emacs graphics file image viewing mode loaded? + (if (and (boundp 'auto-image-file-mode) auto-image-file-mode + (string-match "[.][jJ][pP][eE]?[gG]" ess-tmp-graph)) + (find-file ess-tmp-graph) + ;;else XEmacs graphics file image viewing mode loaded? + (if (and (fboundp 'image-mode) + (string-match "[.]\\([jJ][pP][eE]?[gG]\\|[gG][iI][fF]\\)" + ess-tmp-graph)) + (find-file ess-tmp-graph) + ;;else use the appropriate graphics file image viewer + (while (< ess-tmp-counter ess-tmp-length) + (setq ess-tmp-graph-alist + (nth ess-tmp-counter ess-sas-graph-view-viewer-alist)) + (setq ess-tmp-graph-regexp (car ess-tmp-graph-alist)) + + (if (string-match + (concat "[.]" ess-tmp-graph-regexp) ess-tmp-graph) + (progn + (ess-sas-goto-shell t) + (insert ess-sas-submit-pre-command " " + (cdr ess-tmp-graph-alist) " " ess-tmp-graph + (if (equal ess-sas-submit-method 'sh) " &")) + (setq ess-tmp-glyph 'alist) + (setq ess-tmp-counter ess-tmp-length)) + ;;else + (setq ess-tmp-counter (+ ess-tmp-counter 1)))) + + (if (not ess-tmp-glyph) + (progn + (ess-sas-goto-shell t) + (insert ess-sas-submit-pre-command " " + ess-sas-graph-view-viewer-default " " ess-tmp-graph + (if (equal ess-sas-submit-method 'sh) " &")))) - (comint-send-input)))))))) + (comint-send-input))))))) (defun ess-sas-file-path (&optional force) "Define `ess-sas-file-path' to be the current buffer depending on suffix." @@ -735,16 +719,16 @@ (and (goto-char (point-min)) (search-forward-regexp ess-sas-error nil t))) t - ; this feature never worked quite right (and was XEmacs only to boot) - ; after highlighting an error message, moving point would cause an unwanted - ; highlighting between point and mark; why god, why?!? - ; - ; (if (and (boundp 'zmacs-regions) zmacs-regions) - ; (progn - ; (if ess-sas-pop-mark (pop-mark) - ; (setq ess-sas-pop-mark t)) - ; (push-mark (match-beginning 0) t) - ; (zmacs-activate-region))) + ;; this feature never worked quite right (and was XEmacs only to boot) + ;; after highlighting an error message, moving point would cause an + ;; unwanted highlighting between point and mark; why god, why?!? + ;; + ;; (if (and (boundp 'zmacs-regions) zmacs-regions) + ;; (progn + ;; (if ess-sas-pop-mark (pop-mark) + ;; (setq ess-sas-pop-mark t)) + ;; (push-mark (match-beginning 0) t) + ;; (zmacs-activate-region))) (goto-char ess-sas-save-point))))) (defun ess-sas-goto-lst () @@ -870,38 +854,6 @@ (kill-buffer nil) ) -(if (featurep 'xemacs) (condition-case nil - (progn - (require 'rtf-support) - (when (featurep 'rtf-support) - -(defun ess-sas-rtf-portrait (&optional ess-tmp-font-size) -"Creates an MS RTF portrait file from the current buffer." - (interactive) - (ess-sas-file-path t) - (ess-revert-wisely) - - (if (equal ess-tmp-font-size nil) - (setq ess-tmp-font-size "21")) - - (let - ((ess-temp-rtf-file (replace-in-string ess-sas-file-path "[.][^.]*$" ".rtf"))) - ;(expand-file-name (buffer-name)) "[.][^.]*$" ".rtf"))) - (rtf-export ess-temp-rtf-file) - (ess-sas-goto "rtf" t) - (goto-char (point-min)) - (replace-regexp "\\\\fmodern .*;" (concat "\\\\fmodern " ess-sas-rtf-font-name ";")) - (goto-line 2) - (if (string-match ess-sas-suffix-regexp ess-sas-file-path) - (insert "\\margl720\\margr720\\margt720\\margb720\n")) - (goto-char (point-min)) - - (while (replace-regexp "\\\\fs[0-9]+" (concat "\\\\fs" ess-tmp-font-size)) nil) - - (save-buffer) - (kill-buffer (current-buffer)))) -)) - (error nil)) ; else (defun ess-sas-rtf-portrait (&optional ess-tmp-font-size) "Creates an MS RTF portrait file from the current buffer." @@ -927,7 +879,6 @@ (save-buffer) (kill-buffer (current-buffer))) -) (defun ess-rtf-replace-chars () "Convert a text file to an MS RTF file." @@ -1293,10 +1244,8 @@ (if arg (progn - (if (and (equal emacs-major-version 19) (equal emacs-minor-version 28)) - (define-key sas-mode-local-map [C-tab] 'ess-sas-backward-delete-tab) - ;;else - (define-key sas-mode-local-map [(control tab)] 'ess-sas-backward-delete-tab)) + (define-key sas-mode-local-map [(control tab)] + 'ess-sas-backward-delete-tab) (define-key sas-mode-local-map [return] 'newline) (define-key sas-mode-local-map "\t" 'ess-sas-tab-to-tab-stop)) ;;else @@ -1324,9 +1273,8 @@ (defun ess-sas-global-pc-keys () "PC-like SAS key definitions" (interactive) - (when (or (not (featurep 'xemacs)) (featurep 'rtf-support)) - (global-set-key [(control f1)] 'ess-sas-rtf-portrait) - (global-set-key [(control f2)] 'ess-sas-rtf-landscape)) + (global-set-key [(control f1)] 'ess-sas-rtf-portrait) + (global-set-key [(control f2)] 'ess-sas-rtf-landscape) (global-set-key (quote [f2]) 'ess-revert-wisely) (global-set-key (quote [f3]) 'ess-sas-goto-shell) (global-set-key (quote [f4]) 'ess-sas-goto-file-1) @@ -1344,12 +1292,8 @@ ;; (global-set-key (quote [f11]) 'ess-sas-goto-file-2) ;; (global-set-key [(control f11)] 'ess-ebcdic-to-ascii-search-and-replace) (global-set-key (quote [f12]) 'ess-sas-graph-view) - (if (and ess-sas-edit-keys-toggle - (equal emacs-major-version 19) (equal emacs-minor-version 28)) - (global-set-key [C-tab] 'ess-sas-backward-delete-tab) - ;else - (global-set-key [(control tab)] 'ess-sas-backward-delete-tab)) - ;(define-key sas-mode-local-map "\C-c\C-p" 'ess-sas-file-path) + (global-set-key [(control tab)] 'ess-sas-backward-delete-tab) + ;; (define-key sas-mode-local-map "\C-c\C-p" 'ess-sas-file-path) (setq ess-sas-global-pc-keys t) (setq ess-sas-global-unix-keys nil) (setq ess-sas-local-pc-keys nil) @@ -1362,9 +1306,8 @@ (defun ess-sas-global-unix-keys () "Unix/Mainframe-like SAS key definitions" (interactive) - (when (or (not (featurep 'xemacs)) (featurep 'rtf-support)) - (global-set-key [(control f1)] 'ess-sas-rtf-portrait) - (global-set-key [(control f2)] 'ess-sas-rtf-landscape)) + (global-set-key [(control f1)] 'ess-sas-rtf-portrait) + (global-set-key [(control f2)] 'ess-sas-rtf-landscape) (global-set-key (quote [f2]) 'ess-revert-wisely) (global-set-key (quote [f3]) 'ess-sas-submit) (global-set-key [(control f3)] 'ess-sas-submit-region) @@ -1382,12 +1325,8 @@ ;; (global-set-key (quote [f11]) 'ess-sas-goto-file-2) ;; (global-set-key [(control f11)] 'ess-ebcdic-to-ascii-search-and-replace) (global-set-key (quote [f12]) 'ess-sas-graph-view) - (if (and ess-sas-edit-keys-toggle - (equal emacs-major-version 19) (equal emacs-minor-version 28)) - (global-set-key [C-tab] 'ess-sas-backward-delete-tab) - ;else - (global-set-key [(control tab)] 'ess-sas-backward-delete-tab)) - ;(define-key sas-mode-local-map "\C-c\C-p" 'ess-sas-file-path) + (global-set-key [(control tab)] 'ess-sas-backward-delete-tab) + ;;(define-key sas-mode-local-map "\C-c\C-p" 'ess-sas-file-path) (setq ess-sas-global-pc-keys nil) (setq ess-sas-global-unix-keys t) (setq ess-sas-local-pc-keys nil) @@ -1401,9 +1340,8 @@ (defun ess-sas-local-pc-keys () "PC-like SAS key definitions." (interactive) - (when (or (not (featurep 'xemacs)) (featurep 'rtf-support)) - (define-key sas-mode-local-map [(control f1)] 'ess-sas-rtf-portrait) - (define-key sas-mode-local-map [(control f2)] 'ess-sas-rtf-landscape)) + (define-key sas-mode-local-map [(control f1)] 'ess-sas-rtf-portrait) + (define-key sas-mode-local-map [(control f2)] 'ess-sas-rtf-landscape) (define-key sas-mode-local-map (quote [f2]) 'ess-revert-wisely) (define-key sas-mode-local-map (quote [f3]) 'ess-sas-goto-shell) (define-key sas-mode-local-map (quote [f4]) 'ess-sas-goto-file-1) @@ -1435,9 +1373,8 @@ (defun ess-sas-local-unix-keys () "Unix/Mainframe-like SAS key definitions" (interactive) - (when (or (not (featurep 'xemacs)) (featurep 'rtf-support)) - (define-key sas-mode-local-map [(control f1)] 'ess-sas-rtf-portrait) - (define-key sas-mode-local-map [(control f2)] 'ess-sas-rtf-landscape)) + (define-key sas-mode-local-map [(control f1)] 'ess-sas-rtf-portrait) + (define-key sas-mode-local-map [(control f2)] 'ess-sas-rtf-landscape) (define-key sas-mode-local-map (quote [f2]) 'ess-revert-wisely) (define-key sas-mode-local-map (quote [f3]) 'ess-sas-submit) (define-key sas-mode-local-map [(control f3)] 'ess-sas-submit-region) @@ -1466,19 +1403,19 @@ ; Local variables section -;;; This file is automatically placed in Outline minor mode. -;;; The file is structured as follows: -;;; Chapters: ^L ; -;;; Sections: ;;*;; -;;; Subsections: ;;;*;;; -;;; Components: defuns, defvars, defconsts -;;; Random code beginning with a ;;;;* comment - -;;; Local variables: -;;; mode: emacs-lisp -;;; outline-minor-mode: nil -;;; mode: outline-minor -;;; outline-regexp: "\^L\\|\\`;\\|;;\\*\\|;;;\\*\\|(def[cvu]\\|(setq\\|;;;;\\*" -;;; End: +;; This file is automatically placed in Outline minor mode. +;; The file is structured as follows: +;; Chapters: ^L ; +;; Sections: ;;*;; +;; Subsections: ;;;*;;; +;; Components: defuns, defvars, defconsts +;; Random code beginning with a ;;;;* comment + +;; Local variables: +;; mode: emacs-lisp +;; outline-minor-mode: nil +;; mode: outline-minor +;; outline-regexp: "\^L\\|\\`;\\|;;\\*\\|;;;\\*\\|(def[cvu]\\|(setq\\|;;;;\\*" +;; End: ;;; ess-sas-a.el ends here diff -Nru ess-16.10/lisp/ess-sas-d.el ess-17.11/lisp/ess-sas-d.el --- ess-16.10/lisp/ess-sas-d.el 2016-05-07 16:45:06.000000000 +0000 +++ ess-17.11/lisp/ess-sas-d.el 2017-11-13 14:13:16.000000000 +0000 @@ -318,25 +318,29 @@ (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) ; Local variables section -;;; This file is automatically placed in Outline minor mode. -;;; The file is structured as follows: -;;; Chapters: ^L ; -;;; Sections: ;;*;; -;;; Subsections: ;;;*;;; -;;; Components: defuns, defvars, defconsts -;;; Random code beginning with a ;;;;* comment - -;;; Local variables: -;;; mode: emacs-lisp -;;; outline-minor-mode: nil -;;; mode: outline-minor -;;; outline-regexp: "\^L\\|\\`;\\|;;\\*\\|;;;\\*\\|(def[cvu]\\|(setq\\|;;;;\\*" -;;; End: +;; This file is automatically placed in Outline minor mode. +;; The file is structured as follows: +;; Chapters: ^L ; +;; Sections: ;;*;; +;; Subsections: ;;;*;;; +;; Components: defuns, defvars, defconsts +;; Random code beginning with a ;;;;* comment + +;; Local variables: +;; mode: emacs-lisp +;; outline-minor-mode: nil +;; mode: outline-minor +;; outline-regexp: "\^L\\|\\`;\\|;;\\*\\|;;;\\*\\|(def[cvu]\\|(setq\\|;;;;\\*" +;; End: ;;; ess-sas-d.el ends here diff -Nru ess-16.10/lisp/ess-sas-l.el ess-17.11/lisp/ess-sas-l.el --- ess-16.10/lisp/ess-sas-l.el 2016-05-07 16:45:06.000000000 +0000 +++ ess-17.11/lisp/ess-sas-l.el 2017-11-13 14:13:16.000000000 +0000 @@ -180,8 +180,7 @@ :type 'boolean) ;; user can specify the sas program name -(defcustom sas-program - (if (equal system-type 'Apple-Macintosh) "invoke SAS using program file" "sas") +(defcustom sas-program "sas" "*Command to invoke SAS, default for buffer-local `ess-sas-submit-command'." :group 'ess-sas :type 'string) diff -Nru ess-16.10/lisp/ess-site.el ess-17.11/lisp/ess-site.el --- ess-16.10/lisp/ess-site.el 2015-09-19 03:25:42.000000000 +0000 +++ ess-17.11/lisp/ess-site.el 2017-11-22 16:28:36.000000000 +0000 @@ -46,212 +46,126 @@ ;; ;; will work. ;; -;; with XEmacs, this is simply: -;; -;; (add-path "/path/to/ess/lisp-directory") -;; ;; with Emacs (and in general): ;; -;; (setq load-path (cons "/path/to/ess/lisp-directory" load-path)) +;; (add-to-list 'load-path "/path/to/ess/lisp-directory") ;;; Code: -;; provide here; otherwise we'll get infinite loops of (require ..): +;; Provide here; otherwise we'll get infinite loops of (require ..): (provide 'ess-site) -;;(require 'ess-sp6-d) -;;;; 1. Load path, autoloads, and major modes +;;;; Load path, autoloads, and major modes ;;;; ======================================== -;;; -;;; (1.1) 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. - -(eval-and-compile +;; +;; 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. - ;; Not important in XEmacs, if unpacking from ../xemacs/site-lisp/ - ;; directory. +;; DEBUG: (setq ess-show-load-messages t); instead of nil above - ;; WARNING: with Emacs 20.2 (and 20.3 in one case), - ;; ======= MUST USE ONE OF THE NON-DEFAULT SETTINGS BELOW +;; 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.") - ;; NOTE again: MOST people should NOT change anything here !!! - ;; ==== ==== ================ +(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.") - ;; A nice default - (defvar ess-lisp-directory - (directory-file-name - (file-name-directory - (if (and (boundp 'load-file-name) load-file-name) ;; A nice default - (file-truename load-file-name) - (locate-library "ess-site") ))) - "Directory containing ess-site.el(c) and other ESS lisp files.") - - - ;; NON DEFAULTS: - ;;(defvar ess-lisp-directory - ;;(directory-file-name "/usr/local/lib/xemacs/site-lisp/ess-/lisp")) - ;; >> or replace "ess-" above by "ESS" which would be a symbolic link.. - ;; >> This way, your .emacs (or default.el or site-start.el) - ;; >> won't have to change with each version of ESS - - ;; example of "local" or personal use - ;;(defvar ess-lisp-directory - ;;(directory-file-name "/stat2/faculty/rossini/ESS/lisp")) - - ;;) - - ;; emacs 19.28 and 19.29 don't have functions we need. - (if (not (fboundp 'file-name-sans-extension)) - ;; take the definition from emacs-20.6/lisp/files.el: - (defun file-name-sans-extension (filename) - "Return FILENAME sans final \"extension\". -The extension, in a file name, is the part that follows the last `.'." - (save-match-data - (let ((file (file-name-sans-versions - (file-name-nondirectory filename))) - directory) - (if (string-match "\\.[^.]*\\'" file) - (if (setq directory (file-name-directory filename)) - (expand-file-name (substring file 0 (match-beginning 0)) - directory) - (substring file 0 (match-beginning 0))) - filename))))) - - (add-to-list 'load-path (file-name-as-directory ess-lisp-directory)) - - ;; Need these as early as here [also in ./ess-comp.el] : - (if (not (boundp 'ess-show-load-messages)) - (defvar ess-show-load-messages nil - "If t, show many more \"loading ..\" messages.")) - (if (not (fboundp 'ess-message)) - (defun ess-message (format-string &rest args) - "Shortcut for \\[message] only if `ess-show-load-messages' is non-nil." - (if ess-show-load-messages (message format-string args))) - )); eval-*-compile -;; DEBUG: (setq ess-show-load-messages t); instead of nil above +;; 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)) +(require 'ess-utils) + +(ess-message (format "[ess-site:] ess-lisp-directory = '%s'" ess-lisp-directory)) + -(ess-message - (format "[ess-site:] ess-lisp-directory = '%s'" ess-lisp-directory)) +(defun ess-require (feature &rest args) + (let ((feature-name (symbol-name feature))) + (ess-message (concat "[ess-site:] require '" feature-name)) + (apply 'require feature args))) ;; load code to figure out what version/strain of Emacs we are running ;; must come *AFTER* load-path is set ! -;;; The following require sets ess-local-custom-available to -;;; true if custom is provided at this point. -(require 'ess-compat) -;;; If it is not provided, but we think it will be available when necessary, -;;; then we can use the following line (uncommented) to make sure that -;;; it will be used. If you have to ask, then you don't need this. -;;(setq ess-local-custom-available t) - -;; SJE Thu 13 May 2004 -;; Maybe ess-etc-directory should not be defcustom, since its value -;; depends on ess-lisp-directory, and is needed by other modes that are -;; loaded before the custom code. -(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.") +(ess-require 'ess-compat) -(defvar ess-etc-directory-list - '("../etc/ess/" "../etc/" "../../etc/ess/" "./etc/") - "List of directories, relative to `ess-lisp-directory', to search for etc.") - -(while (and (listp ess-etc-directory-list) (consp ess-etc-directory-list)) - (setq ess-etc-directory - (expand-file-name (concat ess-lisp-directory "/" - (car ess-etc-directory-list)))) - (if (file-directory-p ess-etc-directory) - (setq ess-etc-directory-list nil) - (setq ess-etc-directory nil) - (setq ess-etc-directory-list (cdr ess-etc-directory-list)) - (when (null ess-etc-directory-list) - (beep 0) (beep 0) - (message (concat - "ERROR:ess-site.el:ess-etc-directory\n" - "Relative to ess-lisp-directory, one of the following must exist:\n" - "../etc/ess, ../etc, ../../etc/ess or ./etc")) - (sit-for 4)))) - -;;-- no longer used thanks to the (unless ...) clause below -- -;; (defvar ess-info-directory nil -;; "*Location of the ESS info/ directory. -;; The ESS info directory stores the ESS info files.") - - -;;(1.2) If ess.info is not found, then ess-lisp-directory/../doc/info is added -;; resurrecting Stephen's version with a bug-fix & xemacs compatibility -(if (fboundp 'locate-file) (progn -(unless (locate-file "ess.info" - (if (featurep 'xemacs) - Info-directory-list - Info-default-directory-list)) - (add-to-list (if (featurep 'xemacs) - 'Info-directory-list 'Info-default-directory-list) - (expand-file-name "../doc/info/" ess-lisp-directory))))) - - -;; ALWAYS: -(ess-message "[ess-site:] require 'ess *ITSELF* ...") -(require 'ess); -> loads ess-custom.el and more -(ess-message "[ess-site:] .. after requiring 'ess ...") - - -;;; (1.3) Files ending in .q and .S are considered to be S source files -;;; Files ending in .St are considered to be S transcript files -;;; -;;; NB: in standard Emacs, files ending in .s are assembler files. If you -;;; want to use assembler. If a user wants to -;;; restore the default modes for assembly file extensions, the -;;; following can go into ~/.emacs or ~/.xemacs/init.el -;;; -;;; (add-hook 'ess-mode-hook 'ess-restore-asm-extns) -;;; (add-hook 'inferior-ess-mode-hook 'ess-restore-asm-extns) +;; 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 +(ess-require 'ess) + + +;;; Loading popular dialects (they should become optional in the future) + +;; R and Julia +(ess-require 'ess-r-mode) +(ess-require 'ess-julia) + +;; S-PLUS (MathSoft/StatSci/Insightful/TIBCO) +(ess-require 'ess-sp3-d) +(if ess-microsoft-p + (ess-require 'ess-sp6w-d) + (ess-require 'ess-sp6-d)) + +;; S-elsewhere, on another machine by telnet +(ess-require 'essd-els) + +;; Stata, SAS and batch BUGS +(ess-require 'ess-stata-mode) +(ess-require 'ess-sas-d) +(ess-require 'ess-bugs-l) + +(ess-write-to-dribble-buffer + (format "[ess-site.el]: ess-customize-alist=%s \n" + ess-customize-alist)) + +;;; Literate Data Analysis +(ess-require 'ess-noweb) +(ess-require 'ess-swv) + +(ess-write-to-dribble-buffer + (format "[ess-site.el _2_]: ess-customize-alist=%s \n" + ess-customize-alist)) + +;;; Speedbar and mouse +(ess-require 'ess-mouse) + +;;; Toolbar support +(ess-require 'ess-toolbar) + +(ess-require 'ido nil t) -(autoload 'Rd-mode "ess-rd" "Major mode for editing R documentation." 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 -(if (featurep 'xemacs) nil - ;; (add-hook 'Rd-mode-hook (lambda () - ;; (set (make-local-variable create-lockfiles) nil))) - - (make-local-variable 'create-lockfiles) - - (add-hook 'Rd-mode-hook (lambda () (setq create-lockfiles nil))) -) - -;; This is thanks to Ed L Cashin , 03 Mar 2004 : -(defun ess-restore-asm-extns () - "Remove the S-Plus mode association for .s and .S files added by ESS. -Putting the following in ~/.emacs restores emacs' default association -between .s or .S files and assembly mode. - - (add-hook 'ess-mode-hook 'ess-restore-asm-extns) - (add-hook 'inferior-ess-mode-hook 'ess-restore-asm-extns)" - (interactive) - (when (assoc "\\.[qsS]\\'" auto-mode-alist) - (setq auto-mode-alist - (remassoc "\\.[qsS]\\'" auto-mode-alist)) - ;; put .q extention back - ;; (add-to-list is in xemacs and GNU emacs) - ;; R-mode when in a R/ subdirectory, otherwise S-mode: - (add-to-list 'auto-mode-alist '("/R/.*\\.q\\'" . R-mode)) - (add-to-list 'auto-mode-alist '("\\.q\\'" . S-mode)) - )) +;;; Site Specific setup +;;;; =============================================== + +(autoload 'Rd-mode "ess-rd" "Major mode for editing R documentation." t) ;; Be careful when editing the following. MISTAKES WILL RESULT IN ;; *.sty BEING TREATED AS ESS[S], rather than LaTeX-mode! -(if (assoc "\\.[rR]\\'" auto-mode-alist) nil +(unless (assoc "\\.[rR]\\'" auto-mode-alist) (setq auto-mode-alist (append '(("\\.sp\\'" . S-mode) ;; re: Don MacQueen @@ -288,190 +202,9 @@ ) auto-mode-alist))) -;; Rscript and littler interpreters recognized. XEmacs entries can -;; be regexps, which complicates matters as "r" on its own matches -;; other interpeters like "perl". +;; Rscript and littler interpreters recognized. (add-to-list 'interpreter-mode-alist '("Rscript" . r-mode)) -(add-to-list 'interpreter-mode-alist - (cons (if (featurep 'xemacs) "r$" "r") 'r-mode)) - - -;; (1.4) Customize the dialects for your setup. - -;;; AS OF ESS 5.1.14, if you are using Emacs 20.x, x>3, or XEmacs -;;; 21.x, x>0, you can now use the "Customize" facility for -;;; customization. - -;;;; Choices for *(), where * is from inferior-*-program.... -;;; Most sites will not need to use these customized program-names. They are -;;; provided for cases where the program is not on the standard default path. -;;; If the program doesn't get located correctly by the default use of -;;; M-x S+3 (for example), then put the path name for your system into the -;;; the variable inferior-S+3-program-name. If for any reason you want the -;;; default use of M-x S to refer to a different program than S+3, then -;;; redefine inferior-S-program-name. - -;;(setq-default inferior-S3-program-name "/disk05/s/S") -;;(setq-default inferior-S+3-program-name "Splus34") -;;(setq-default inferior-S4-program-name "/disk05/s4/S") -;;(setq-default inferior-S+4-program-name "Splus") -;;(setq-default inferior-S+5-program-name "Splus5") -;;(setq-default inferior-S+-program-name "Splus7") ; unix systems ; or -;;(setq-default inferior-S+-program-name "Splus") ; unix systems -;; -;; If you wish to call other versions of R on a Unix system, ESS -;; should auto-detect other versions of R, according to matches to the -;; variable `ess-r-versions' as described in its docstring. Consider -;; changing that variable rather than changing inferior-R-program-name -;; if your version of R is not already auto-detected. -;;(setq-default inferior-R-program-name "R") ; unix systems -;;(setq-default inferior-R-program-name "Rterm") ; MS Windows, see below for path as well -;;(setq-default inferior-R-program-name "C:\\Program Files\\R\\R-2.5.0\\bin\\Rterm.exe") -;;(setq-default inferior-XLS-program-name "xlispstat") -;;(setq-default inferior-ARC-program-name "arc") -;;(setq-default inferior-VST-program-name "vista") -;;(setq-default inferior-SAS-program-name "sas") -;;(setq-default inferior-OMG-program-name "/home/rossini/src/anoncvs/Omegahat/org/omegahat/bin/omegahat") -(setq-default inferior-OMG-program-name "omegahat") - -;;; The line below is the ESS default and sends the commands window -;;; to emacs, giving the user the opportunity to -;;; (1) edit the output into a clean ess-transcript file before printing, or -;;; (2) print a region of the file. -;;(setq-default inferior-S+4-print-command "S_PRINT_COMMAND=emacsclientw.exe") - -;;; The editor and pager output from S+4 and Sqpe+4 are sent by -;;; StatSci default to notepad, effectively using the definition: -;;(setq-default inferior-S+4-editor-pager-command -;; "options(editor='notepad', pager='notepad')") -;;; -;;; ESS sends the output from both commands to an emacs buffer using -;;; the definition: -;;(setq-default inferior-S+4-editor-pager-command -;; "options(editor='emacsclient.exe', pager='emacsclientw.exe')") - -;;; These commands are for running the PC version of Sqpe of S+4 and -;;; S+6 in an emacs buffer, using the same technology as ESS uses for -;;; Unix S-Plus. Interactive graphics with javagraph are available -;;; in this mode beginning with S-Plus 6.1. -;;; See ess-sp4-d.el or ess-sp6w-d.el - -;;; -----> configuration now via custom, see ./ess-custom.el and look for -;;; inferior-Sqpe+... e.g. inferior-Sqpe+6-program-name - -;;; These ddeclient values will be buffer-local on MS-Windows 9x/NT -(setq-default inferior-ess-ddeclient "Initial") -(setq-default inferior-ess-client-name "Initial") -(setq-default inferior-ess-client-command "Initial") - -;;; S-Plus 6 for Windows startup time depends on the amount of RAM and -;;; the processor speed. ESS needs to build a delay into the M-x S+6 -;;; sequence to allow time for S-Plus 6 to open the Commands window. -;;; We then send several lines to the Commands window before returning -;;; control to the user. On a 300 MHz machine with 96MB of RAM the -;;; delay is 60 seconds. On a ???? MHz machine with 523MB the delay is -;;; 10 seconds. The user may need to adjust this number. -(defvar ess-S+6-startup-delay 15 ;; <- 2005-01-03; MM - "*Number of seconds to wait for the Commands window to appear before -sending `inferior-ess-language-start' to S-Plus.") - - -;;; see essd-els.el - -;;(setq-default inferior-S-elsewhere-program-name "sh") -;;(setq-default inferior-S-elsewhere-program-name "ssh") -;;; You might consider using ssh, if you can! (and if you really do -;;; this, use ssh-agent, etc, for securing your sessions). - - -;;;; Choice for S(). -;;(setq-default inferior-S-program-name inferior-S+3-program-name) - - - - - -;; (1.5) Require the needed dialects for your setup. - -(ess-message "[ess-site:] Before requiring dialect 'ess-*-d ....") -(ess-message "[ess-site:] require 'ess-r-d ...") -(require 'ess-r-d) ;; R -(require 'ess-julia) -;; (ess-message "[ess-site:] require 'ess-s4-d ...") -;; (require 'ess-s4-d) ; has become VERY RARE .. - -;;(ess-message "[ess-site:] require 'ess-s3-d ...") -;;(require 'ess-s3-d) ; THIS IS RARE. You probably do not have this. - -;; "sp" refers to S-PLUS (MathSoft/StatSci/Insightful/TIBCO): -(ess-message "[ess-site:] require 'ess-sp3-d ...") -(require 'ess-sp3-d) - -(if ess-microsoft-p - (progn - ;; (ess-message "[ess-site:] require 'ess-sp4-d ...") - ;; (require 'ess-sp4-d) - (ess-message "[ess-site:] require 'ess-sp6w-d ...") - (require 'ess-sp6w-d)) - ;; else: decent OS - ;; (ess-message "[ess-site:] require 'ess-sp5-d ...") - ;; (require 'ess-sp5-d) - (ess-message "[ess-site:] require 'ess-sp6-d ...") - (require 'ess-sp6-d)) - -(ess-message "[ess-site:] require 'ess-sta-d ...") -(require 'ess-sta-d) ;; for Stata. -;; (ess-message "[ess-site:] require 'ess-xls-d ...") -;; (require 'ess-xls-d) ;; XLispStat -;; (ess-message "[ess-site:] require 'ess-vst-d ...") -;; (require 'ess-vst-d) ;; ViSta -;; (ess-message "[ess-site:] require 'ess-arc-d ...") -;; (require 'ess-arc-d) ;; Arc -(ess-message "[ess-site:] require 'ess-sas-d ...") -(require 'ess-sas-d) -(ess-message "[ess-site:] require 'essd-els ...") -(require 'essd-els) ;; S-elsewhere, on another machine by telnet -;; (ess-message "[ess-site:] require 'ess-omg-d ...") -;; (require 'ess-omg-d) ;; for omegahat -(ess-message "[ess-site:] require 'ess-bugs-l ...") -(require 'ess-bugs-l) ;; for batch BUGS - -(ess-write-to-dribble-buffer - (format "[ess-site.el]: ess-customize-alist=%s \n" - ess-customize-alist)) - -;;; (1.7) Literate Data Analysis -(require 'ess-noweb) -(require 'ess-swv); for Sweave - -(ess-write-to-dribble-buffer - (format "[ess-site.el _2_]: ess-customize-alist=%s \n" - ess-customize-alist)) - -;; (1.8) Speedbar and mouse - -(ess-message "[ess-site:] require 'ess-menu ...") -(require 'ess-menu) -(require 'ess-mouse) - -;; (1.9) Toolbar support - -;; To remove toolbar support under ESS, add "(setq ess-use-toolbar nil)" -;; to your ~/.emacs or ~/.xemacs/init.el before (require 'ess-site) -(ess-message "[ess-site:] require 'ess-toolbar ...") -(require 'ess-toolbar) - -;;; 2. Site Specific setup -;;;; =============================================== - -;;; Set this to the name of the program you use to run S or S-PLUS. It -;;; can be an absolute pathname, if you wish. -;;(setq inferior-ess-program "Splus") -;;(setq inferior-ess-program (concat (getenv "SHOME") "/Splus")) - - -;;; 2.1 Backwards compatibility (roll your own!) -;;; What you want S and R to call... +(add-to-list 'interpreter-mode-alist '("r" . r-mode)) (autoload 'ess-transcript-mode "ess-trns" "Major mode for editing S transcript files." t) @@ -480,313 +213,33 @@ (autoload 'ess-rdired "ess-rdired" "View *R* objects in a dired-like buffer." t) +(eval-after-load "ess-r-mode" + '(progn + (ess-message "[ess-site:] before creating ess-versions-* ...") + (ess-r-s-versions-creation+menu) + (ess-message "[ess-site:] after ess-versions-created ..."))) -;;; 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) - -;;; Create functions for calling different (older or newer than default) -;;; versions of R and S(qpe). -(defvar ess-versions-created nil - "List of strings of all S- and R-versions found on the system.") - -;; is currently used (updated) by ess-find-newest-R -(defvar ess-r-versions-created nil - "List of strings of all R-versions found on the system.") - -(defun ess-r-s-versions-creation () - "(Re)Create ESS R-<..> commands FILENAME sans final \"extension\". -The extension, in a file name, is the part that follows the last `.'." - - (interactive) - (ess-message "[ess-site:] before creating ess-versions-* ...") - ;; Create ess-versions-created, - ;; ess-r-versions-created, - ;; and on Windows, ess-rterm-version-paths ----------------------------------------- - (let ((R-newest-list '("R-newest")) - (ess-s-versions-created (if ess-microsoft-p - (nconc - (ess-sqpe-versions-create ess-SHOME-versions) ;; 32-bit - (ess-sqpe-versions-create ess-SHOME-versions-64 "-64-bit")) ;; 64-bit - (ess-s-versions-create)))) ;; use ess-s-versions - (if ess-microsoft-p - (setq ess-rterm-version-paths ;; (ess-find-rterm)) - (ess-flatten-list - (ess-uniq-list - (if (not ess-directory-containing-R) - (if (getenv "ProgramW6432") - (let ((P-1 (getenv "ProgramFiles(x86)")) - (P-2 (getenv "ProgramW6432"))) - (nconc - ;; always 32 on 64 bit OS, nil on 32 bit OS - (ess-find-rterm (concat P-1 "/R/") "bin/Rterm.exe") - (ess-find-rterm (concat P-1 "/R/") "bin/i386/Rterm.exe") - ;; keep this both for symmetry and because it can happen: - (ess-find-rterm (concat P-1 "/R/") "bin/x64/Rterm.exe") - - ;; always 64 on 64 bit OS, nil on 32 bit OS - (ess-find-rterm (concat P-2 "/R/") "bin/Rterm.exe") - (ess-find-rterm (concat P-2 "/R/") "bin/i386/Rterm.exe") - (ess-find-rterm (concat P-2 "/R/") "bin/x64/Rterm.exe") - )) - (let ((PF (getenv "ProgramFiles"))) - (nconc - ;; always 32 on 32 bit OS, depends on 32 or 64 process on 64 bit OS - (ess-find-rterm (concat PF "/R/") "bin/Rterm.exe") - (ess-find-rterm (concat PF "/R/") "bin/i386/Rterm.exe") - (ess-find-rterm (concat PF "/R/") "bin/x64/Rterm.exe") - )) - ) - (let ((PF ess-directory-containing-R)) - (nconc - (ess-find-rterm (concat PF "/R/") "bin/Rterm.exe") - (ess-find-rterm (concat PF "/R/") "bin/i386/Rterm.exe") - (ess-find-rterm (concat PF "/R/") "bin/x64/Rterm.exe") - )) - ))))) - (ess-message "[ess-site:] (let ... before (ess-r-versions-create) ...") - - (setq ess-r-versions-created ;; for Unix *and* Windows, using either - (ess-r-versions-create));; ess-r-versions or ess-rterm-version-paths (above!) - - ;; Add the new defuns, if any, to the menu. - ;; Check that each variable exists, before adding. - ;; e.g. ess-sqpe-versions-created will not be created on Unix. - (setq ess-versions-created - (ess-flatten-list - (mapcar (lambda(x) (if (boundp x) (symbol-value x) nil)) - '(R-newest-list - ess-r-versions-created - ess-s-versions-created)))))) - -(defun ess-r-s-versions-creation+menu () - "Call `\\[ess-r-s-versions-creation] creaing `ess-versions-created' and -update the \"Start Process\" menu." - (interactive) - (ess-message "[ess-site:] before (ess-r-s-versions-creation) ...") - (ess-r-s-versions-creation) - - (when ess-versions-created - ;; new-menu will be a list of 3-vectors, of the form: - ;; ["R-1.8.1" R-1.8.1 t] - (let ((new-menu (mapcar (lambda(x) (vector x (intern x) t)) - ess-versions-created))) - (easy-menu-add-item ess-mode-menu '("Start Process") - (cons "Other" new-menu)))) - - (ess-message "[ess-site:] after ess-versions-created ...") - ;; return - ess-versions-created) - -;; call it -(ess-r-s-versions-creation+menu) - - -;; Check to see that inferior-R-program-name points to a working version +;; Check to see that inferior-ess-r-program-name points to a working version ;; of R; if not, try to find the newest version: (ess-check-R-program-name) ;; -> (ess-find-newest-R) if needed, in ./ess-r-d.el (ess-message "[ess-site:] after ess-check-R-prog... ...") -;;; 3. Customization (and examples) for your site -;;;; =============================================== - +(ess-message "[ess-site:] *very* end ...") -;;; (3.01) SOME PEOPLE (who will remain nameless) worry that novices -;;; won't like fancy buffer names for their first (and only :-) -;;; process. To number all processes: -;;(setq ess-plain-first-buffername nil) - -;;; (3.02) Some people have requested using the program name as part -;;; of the buffer. Turned on for R. -;;(setq ess-use-inferior-program-name-in-buffer-name t) - - -;;; (3.1) Font-lock -;; The following two expressions automatically enable font-lock-mode -;; for ess-mode and inferior-ess-mode buffers. - -;; no longer requiring (window-system) here: -(when ess-font-lock-mode - (add-hook 'ess-mode-hook 'turn-on-font-lock t) - (add-hook 'ess-transcript-mode-hook 'turn-on-font-lock t) - (add-hook 'Rd-mode-hook 'turn-on-font-lock t) - (add-hook 'inferior-ess-mode-hook 'turn-on-font-lock t)) - - -;;; (3.2) Framepop. Windows produced by ess-execute-objects etc. are -;;; often unnecessarily large. The framepop package makes such -;;; windows appear in a separate, shrink-wrapped frame. This will -;;; also affect other "temporary" windows such as those produced by -;;; C-h k, etc. To enable: -;;; -;;; Works only with Emacs at this time. -;; (cond (window-system -;; (require 'framepop))) - -;;; (3.3) ess-keep-dump-files. -;;; Documentation: -;;; *Variable controlling whether to delete dump files after a successful load. -;;; If nil: always delete. If `ask', confirm to delete. If `check', confirm -;;; to delete, except for files created with ess-dump-object-into-edit-buffer. -;;; Anything else (for example `always'): always keep and never delete. -;;; This variable only affects the behavior -;;; of ess-load-file. Dump files are never deleted if an error occurs -;;; during the load. -;;; -;;; RH sez: I find the default `always' keep to be imperative. The previous -;;; default was to throw away -;;; files at the wrong time (I think it was something like, if you M-x -;;; ess-load a file twice, while you are working on it, the file is -;;; deleted). I believe source is real and the ESS object is temporary. -;;; The previous default behavior is dangerous for people who believe this way. -;;; It made sense only for people who believe the object is real -;;; and the source file temporary. -(setq ess-keep-dump-files "always") - -;;; (3.4) ess-ask-for-ess-directory -;;; If t, will ask for the directory to use. If nil, assumes the -;;; default (usually, the users home directory...). -;;now rather in ./ess-custom.el : (setq ess-ask-for-ess-directory t) - -;;; (3.5) ess-directory default (correlated with above) -;;; The default location for running the subprocess is configurable. -;;; By default, that is the default-directory (a lisp variable which -;;; initially contains the directory from which the inferior ESS -;;; statistical package/process is started). -;;; For example, the following function (added to the pre-run-hook, by -;;; the line following it) will set the default directory to be your -;;; home directory: -;;; -;;(defun ajr:ess-set-directory () -;; "Set ess-directory to home." -;; (setq-default ess-directory (file-name-as-directory (getenv "HOME")))) -;;(add-hook 'ess-pre-run-hook 'ajr:ess-set-directory) -;;; -;;; If you replace the setq-default line with: -;;; -;; (setq-default ess-directory (file-name-as-directory -;; (concat (getenv "HOME") "/ess/"))) -;;; -;;; then it will always start up in the directory "ess" in your home -;;; directory. -;;; -;;; The default is to have ess to start up in the current buffer's -;;; directory (the one in which you started the inferior ESS -;;; statistical package/process). This is obtained -;;; by setting ess-directory to nil, i.e. -;; (setq-default ess-directory nil) ; this is the default. - -(when ess-microsoft-p - (add-hook 'ess-post-run-hook - (lambda() - (when (string= ess-dialect "R") - (ess-eval-linewise "options(chmhelp=FALSE, help_type=\"text\")" - nil nil nil 'wait))))) - - -;;; 3.6 Example of formatting changes - -;;; Formatting and indentation patterns are defined in ess-custom.el, please -;;; see ess-custom.el for exact definitions of these variable settings. -;;; To change them (eg, follow changes suggested by Terry Therneau), -;;; you need one or both of the following lines: -;;; -;;(setq ess-indent-with-fancy-comments nil) -;;(setq ess-default-style 'CLB) - -;;; 4.0 SAS configuration - -;;; Beginning with ESS 5.1.13, we have editing options in SAS-mode. -;;; The default behavior is as it was in prior releases. -;;; -;;; There are two sets of alternatives. -;;; 1. Editing SAS-mode files. -;;; 1a. Default: TAB is bound to sas-indent-line. -;;; Current line is correctly indented as SAS code. Equivalent to -;;;(setq ess-sas-edit-keys-toggle nil) ;; default TAB in sas-mode -;;; 1b. Optional: TAB is bound to tab-to-tab-stop and inserts up to 4 -;;; columns at a time. C-TAB moves backwards and deletes characters -;;; up to 4 columns at a time. -;;; The following line is for the optional behavior. -;;;(setq ess-sas-edit-keys-toggle t) ;; optional TAB and C-TAB in sas-mode -;;; Use the function call (ess-sas-edit-keys-toggle) -;;; to change the setting after the first SAS-mode buffer has been created. -;;; 1c. You can also define C-TAB in all modes by Option 2b (below). -;;; -;;; 2. Managing submitted SAS jobs with function keys. -;;; 2a. Default: To define the function keys in ESS[SAS] mode only, -;;; you will need, at most, one of the following two lines. -;;;(setq ess-sas-local-unix-keys t) ;; F2-F12 bound in ESS[SAS] mode -;;;(setq ess-sas-local-pc-keys t) ;; F2-F12 bound in ESS[SAS] mode -;;; -;;; 2b. Options: To define the function keys in all modes, -;;; you will need, at most, one of the following two lines. -;;;(setq ess-sas-global-unix-keys t) ;; F2-F12 bound in all modes -;;;(setq ess-sas-global-pc-keys t) ;; F2-F12 bound in all modes -;;; -;;; 3. If it is more convenient to have "*Async Shell Command*" -;;; in same-window-buffer-names, then: -;;;(ess-same-window-async) -;;; -;;;(defvar sas-program "sas" "*Name of program which runs sas.") -;;; -;;;(defvar sas-indent-width 4 "*Amount to indent sas statements") - -(ess-message "[ido:]") -(if (featurep 'emacs) - (require 'ido nil t)) ; Local variables section -(ess-message "[ess-site:] *very* end ...") -;;; This file is automatically placed in Outline minor mode. -;;; The file is structured as follows: -;;; Chapters: ^L ; -;;; Sections: ;;*;; -;;; Subsections: ;;;*;;; -;;; Components: defuns, defvars, defconsts -;;; Random code beginning with a ;;;;* comment -;;; Local variables: -;;; mode: emacs-lisp -;;; mode: outline-minor -;;; outline-regexp: "\^L\\|\\`;\\|;;\\*\\|;;;\\*\\|(def[cvu]\\|(setq\\|;;;;\\*" -;;; End: +;; This file is automatically placed in Outline minor mode. +;; The file is structured as follows: +;; Chapters: ^L ; +;; Sections: ;;*;; +;; Subsections: ;;;*;;; +;; Components: defuns, defvars, defconsts +;; Random code beginning with a ;;;;* comment +;; Local variables: +;; mode: emacs-lisp +;; mode: outline-minor +;; outline-regexp: "\^L\\|\\`;\\|;;\\*\\|;;;\\*\\|(def[cvu]\\|(setq\\|;;;;\\*" +;; End: ;;; ess-site.el ends here diff -Nru ess-16.10/lisp/ess-s-lang.el ess-17.11/lisp/ess-s-lang.el --- ess-16.10/lisp/ess-s-lang.el 1970-01-01 00:00:00.000000000 +0000 +++ ess-17.11/lisp/ess-s-lang.el 2017-11-13 14:13:16.000000000 +0000 @@ -0,0 +1,925 @@ +;;; 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 +;; Created: 26 Aug 1997 +;; Maintainer: ESS-core + +;; 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) +(ess-message "[ess-s-lang:] (def** ) only ...") + + ; 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) ;customizable + (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 -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.") + +;;; S-mode extras of Martin Maechler, Statistik, ETH Zurich. +;;; See also ./ess-utils.el + +;; Seth's idea; see ess-toggle-S-assign-key below +(defvar ess-S-assign-key [?\C-=] ;; = "\C-c=" ; old-default: "_" + "This key is mapped to insert `ess-S-assign' (by default '<-'), +when \\[ess-toggle-S-assign-key] is called.") + +(defvar ess-S-assign-key-last nil + "This caches the previous value (binding) of `ess-S-assign-key'. It allows + \\[ess-toggle-S-assign-key] to toggle back to the previous definition.") + + ; 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)))))))))) + + +(defun ess-use-this-dir (&optional no-force-current) + "Set the current process directory to `default-directory'. +If that buffer has no associated *R* process, use +\\[ess-force-buffer-current], unless prefix argument +NO-FORCE-CURRENT is non-nil." + (interactive "P") + (ess-use-dir default-directory)) + +(defun ess-use-dir (dir &optional no-force-current) + (interactive "P") + (unless (string= ess-language "S") + ;; FIXME: generalize this for Stata, SAS, Xlispstat... -- then move to ess-mode.el + (error "ESS setting working directory in *%s* not yet implemented for language %s" + ess-local-process-name + ess-language)) + (unless no-force-current + (ess-force-buffer-current "R process to use: ")) + (if ess-local-process-name + (let ((cmd (format "setwd('%s')\n" dir))) + (ess-command cmd) + (message "Directory of *%s* process set to %s" + ess-local-process-name dir)) + (message "No *%s* process associated with this buffer." ess-dialect))) + + +;;*;; 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]\\)\\(<" (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___ + )) + +;; This is by Seth Falcon, modeled after ess-toggle-underscore (see below). +(defun ess-toggle-S-assign-key (force) + "Possibly bind the key in `ess-S-assign-key' to inserting `ess-S-assign'. +If `ess-S-assign-key' is \"_\", simply use \\[ess-toggle-underscore]. +Otherwise, unless the prefix argument FORCE is set, +toggle between the new and the previous assignment." + (interactive "P") + (require 'ess-mode) + (require 'ess-inf) + (let ((current-action (lookup-key ess-mode-map ess-S-assign-key)) + (insert-S-assign (lambda() (interactive) + (delete-horizontal-space) (insert ess-S-assign)))) + (if (and (stringp ess-S-assign-key) + (string= ess-S-assign-key "_")) + (ess-toggle-underscore force) + ;; else "do things here" + (let* ((current-is-S-assign (eq current-action insert-S-assign)) + (new-action (if force insert-S-assign + ;; else "not force" (default): + (if (or current-is-S-assign + (eq ess-S-assign-key-last insert-S-assign)) + ess-S-assign-key-last + insert-S-assign)))) + (message "[ess-toggle-S-assign-key:] current: '%s', new: '%s'" + current-action new-action) + (define-key ess-mode-map ess-S-assign-key new-action) + (define-key inferior-ess-mode-map ess-S-assign-key new-action) + (if (not (and force current-is-S-assign)) + (setq ess-S-assign-key-last current-action)))))) + +(defvar polymode-mode) +(defun ess-smart-S-assign () + "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." + (interactive) + ;;(insert (if (ess-inside-string-or-comment-p (point)) "_" ess-S-assign)) + (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) + ;; else: + (ess-insert-S-assign)))) +(defalias 'ess-smart-underscore 'ess-smart-S-assign) + +(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)))) + +;;; Setting / Unsetting the smart S-assign-key behavior ----------------- + +;; Two basic building blocks, used below: +(defun ess--unset-smart-S-assign-key () + (define-key ess-mode-map "_" nil) + (define-key inferior-ess-mode-map "_" nil) + (define-key ess-mode-map ess-smart-S-assign-key nil); 'self-insert-command + (define-key inferior-ess-mode-map ess-smart-S-assign-key nil)) +(defun ess--activate-smart-S-assign-key () + (define-key ess-mode-map ess-smart-S-assign-key 'ess-smart-S-assign) + (define-key inferior-ess-mode-map ess-smart-S-assign-key 'ess-smart-S-assign)) + + +;; Written such that whimps can have (ess-disable-smart-S-assign) in .emacs : +(defun ess-disable-smart-S-assign (activate) + "Disable or activate (if prefix argument ACTIVATE is set) the smart assignment +operator `ess-S-assign'. That, typically \" <- \", can be customized." + (interactive "P") + (if activate + (ess--activate-smart-S-assign-key) + (ess--unset-smart-S-assign-key))) +(defalias 'ess-disable-smart-underscore 'ess-disable-smart-S-assign) + +(defun ess-toggle-S-assign (force) + "Set the `ess-smart-S-assign-key' (by default \"_\" + [underscore]) key to \\[ess-smart-S-assign] or back to +`ess-smart-S-assign-key'. Toggle the current definition, unless +FORCE is non-nil, where \\[ess-smart-S-assign] is set +unconditionally. + +If you as per default have `ess-smart-S-assign-key' set to +underscore, note that using \"C-q _\" will always just insert the +underscore character." + (interactive "P") + (let ((current-key (lookup-key ess-mode-map ess-smart-S-assign-key)) + (default-key (lookup-key ess-mode-map "_"))) + (if (and (or default-key current-key) + ;; (stringp current-key) (string= current-key ess-S-assign) + (not force)) + (ess--unset-smart-S-assign-key) + ;; else : "force" or current-key is "nil", i.e. default + (ess--activate-smart-S-assign-key)))) +(defalias 'ess-toggle-underscore 'ess-toggle-S-assign) +;; NOTA BENE: "_" is smart *by default* : +;; ----- The user can always customize `ess-S-assign' ... +(ess-toggle-S-assign 'force-to-S-assign) + +(defun ess-add-MM-keys () + "Define MM's user keys, currently \\\\[ess-insert-function-outline], and + \\\\[ess-execute-screen-options]." + (interactive) + (require 'ess-mode); typically unnecessary + (require 'ess-inf); dito + (define-key ess-mode-map "\C-cf" 'ess-insert-function-outline) + (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) + +(provide 'ess-s-lang) + + ; Local variables section + +;;; This file is automatically placed in Outline minor mode. +;;; The file is structured as follows: +;;; Chapters: ^L ; +;;; Sections: ;;*;; +;;; Subsections: ;;;*;;; +;;; Components: defuns, defvars, defconsts +;;; Random code beginning with a ;;;;* comment + +;;; Local variables: +;;; mode: emacs-lisp +;;; outline-minor-mode: nil +;;; mode: outline-minor +;;; outline-regexp: "\^L\\|\\`;\\|;;\\*\\|;;;\\*\\|(def[cvu]\\|(setq\\|;;;;\\*" +;;; End: + +;;; ess-s-lang.el ends here diff -Nru ess-16.10/lisp/ess-s-l.el ess-17.11/lisp/ess-s-l.el --- ess-16.10/lisp/ess-s-l.el 2016-05-07 16:45:06.000000000 +0000 +++ ess-17.11/lisp/ess-s-l.el 1970-01-01 00:00:00.000000000 +0000 @@ -1,928 +0,0 @@ -;;; ess-s-l.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 -;; Created: 26 Aug 1997 -;; Maintainer: ESS-core - -;; 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 - -(ess-message "[ess-s-l:] (def** ) only ...") - - ; 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) ;customizable - (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 -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-cmd-delay . (if (featurep 'xemacs); needs much less delay - (* 0.1 ess-S+-cmd-delay) - ess-S+-cmd-delay)) - (ess-function-pattern . ess-S-function-pattern) - (ess-function-template . " <- \n#\nfunction()\n{\n\n}\n") - (ess-dump-filename-template . (ess-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-l!). - -(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.") - -;; R -(defconst ess-help-R-sec-keys-alist - '((?a . "\\s *Arguments:") - (?d . "\\s *Description:") - (?D . "\\s *Details:") - (?t . "\\s *Details:") - (?e . "\\s *Examples:") - (?n . "\\s *Note:") - (?r . "\\s *References:") - (?s . "\\s *See Also:") - (?u . "\\s *Usage:") - (?v . "\\s *Value[s]?") ; - ) - "Alist of (key . string) pairs for use in help section searching.") - - -(defconst ess-help-S+-sec-regex "^[A-Z. ---]+:$" - "Reg(ular) Ex(pression) of section headers in help file.") - -(defconst ess-help-R-sec-regex "^[A-Z][A-Za-z].+:$" - "Reg(ular) Ex(pression) of section headers in help file.") - -;;; S-mode extras of Martin Maechler, Statistik, ETH Zurich. -;;; See also ./ess-utils.el - -(defvar ess-function-outline-file - (concat ess-etc-directory "/function-outline.S") - "The file name of the ess-function outline that is to be inserted at point, -when \\[ess-insert-function-outline] is used. -Placeholders (substituted `at runtime'): $A$ for `Author', $D$ for `Date'.") - -;; Use the user's own ~/S/emacs-fun.outline if (s)he has one : --- -(let ((outline-file (concat (getenv "HOME") "/S/function-outline.S"))) - (if (file-exists-p outline-file) - (setq ess-function-outline-file outline-file))) - -;; Seth's idea; see ess-toggle-S-assign-key below -(defvar ess-S-assign-key [?\C-=] ;; = "\C-c=" ; old-default: "_" - "This key is mapped to insert `ess-S-assign' (by default '<-'), -when \\[ess-toggle-S-assign-key] is called.") - -(defvar ess-S-assign-key-last nil - "This caches the previous value (binding) of `ess-S-assign-key'. It allows - \\[ess-toggle-S-assign-key] to toggle back to the previous definition.") - - ; 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)))))))))) - -(defun ess-insert-function-outline () - "Insert an S function definition `outline' at point. -Uses the file given by the variable `ess-function-outline-file'." - (interactive) - (let ((oldpos (point))) - (save-excursion - (insert-file-contents ess-function-outline-file) - (if (search-forward "$A$" nil t) - (replace-match (user-full-name) 'not-upcase 'literal)) - (goto-char oldpos) - (if (search-forward "$D$" nil t) - (replace-match (ess-time-string 'clock) 'not-upcase 'literal))) - (goto-char (1+ oldpos)))) - - -;; typically bound to M-Enter -(defun ess-use-this-dir (&optional no-force-current) - "Synchronise the current directory of the S or R process to the one of the current -buffer. If that buffer has no associated *R* process, use \\[ess-force-buffer-current], -unless prefix argument NO-FORCE-CURRENT is non-nil." - (interactive "P") - (unless no-force-current (ess-force-buffer-current "R process to use: ")) - (if ess-local-process-name - (let ((cmd (format "setwd('%s')\n" default-directory)) - ) - (unless (string= ess-language "S") - ;; FIXME: generalize this for Stata, SAS, Xlispstat... -- then move to ess-mode.el - (error - "ESS setting working directory in *%s* not yet implemented for language %s" - ess-local-process-name ess-language)) - (ess-command cmd) - (message "Directory of *%s* process set to %s" - ess-local-process-name default-directory)) - ;; no local process - (message "No *%s* process associated with this buffer." ess-dialect))) - - -;;*;; 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-d) - (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]\\)\\(<" (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___ - )) - -;; This is by Seth Falcon, modeled after ess-toggle-underscore (see below). -(defun ess-toggle-S-assign-key (force) - "Possibly bind the key in `ess-S-assign-key' to inserting `ess-S-assign'. -If `ess-S-assign-key' is \"_\", simply use \\[ess-toggle-underscore]. -Otherwise, unless the prefix argument FORCE is set, -toggle between the new and the previous assignment." - (interactive "P") - (require 'ess-mode) - (require 'ess-inf) - (let ((current-action (lookup-key ess-mode-map ess-S-assign-key)) - (insert-S-assign (lambda() (interactive) - (delete-horizontal-space) (insert ess-S-assign)))) - (if (and (stringp ess-S-assign-key) - (string= ess-S-assign-key "_")) - (ess-toggle-underscore force) - ;; else "do things here" - (let* ((current-is-S-assign (eq current-action insert-S-assign)) - (new-action (if force insert-S-assign - ;; else "not force" (default): - (if (or current-is-S-assign - (eq ess-S-assign-key-last insert-S-assign)) - ess-S-assign-key-last - insert-S-assign)))) - (message "[ess-toggle-S-assign-key:] current: '%s', new: '%s'" - current-action new-action) - (define-key ess-mode-map ess-S-assign-key new-action) - (define-key inferior-ess-mode-map ess-S-assign-key new-action) - (if (not (and force current-is-S-assign)) - (setq ess-S-assign-key-last current-action)))))) - -(defvar polymode-mode) -(defun ess-smart-S-assign () - "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." - (interactive) - ;;(insert (if (ess-inside-string-or-comment-p (point)) "_" ess-S-assign)) - (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) - ;; else: - (ess-insert-S-assign)))) -(defalias 'ess-smart-underscore 'ess-smart-S-assign) - -(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)))) - -;;; Setting / Unsetting the smart S-assign-key behavior ----------------- - -;; Two basic building blocks, used below: -(defun ess--unset-smart-S-assign-key () - (define-key ess-mode-map "_" nil) - (define-key inferior-ess-mode-map "_" nil) - (define-key ess-mode-map ess-smart-S-assign-key nil); 'self-insert-command - (define-key inferior-ess-mode-map ess-smart-S-assign-key nil)) -(defun ess--activate-smart-S-assign-key () - (define-key ess-mode-map ess-smart-S-assign-key 'ess-smart-S-assign) - (define-key inferior-ess-mode-map ess-smart-S-assign-key 'ess-smart-S-assign)) - - -;; Written such that whimps can have (ess-disable-smart-S-assign) in .emacs : -(defun ess-disable-smart-S-assign (activate) - "Disable or activate (if prefix argument ACTIVATE is set) the smart assignment -operator `ess-S-assign'. That, typically \" <- \", can be customized." - (interactive "P") - (if activate - (ess--activate-smart-S-assign-key) - (ess--unset-smart-S-assign-key))) -(defalias 'ess-disable-smart-underscore 'ess-disable-smart-S-assign) - -(defun ess-toggle-S-assign (force) - "Set the `ess-smart-S-assign-key' (by default \"_\" - [underscore]) key to \\[ess-smart-S-assign] or back to -`ess-smart-S-assign-key'. Toggle the current definition, unless -FORCE is non-nil, where \\[ess-smart-S-assign] is set -unconditionally. - -If you as per default have `ess-smart-S-assign-key' set to -underscore, note that using \"C-q _\" will always just insert the -underscore character." - (interactive "P") - (let ((current-key (lookup-key ess-mode-map ess-smart-S-assign-key)) - (default-key (lookup-key ess-mode-map "_"))) - (if (and (or default-key current-key) - ;; (stringp current-key) (string= current-key ess-S-assign) - (not force)) - (ess--unset-smart-S-assign-key) - ;; else : "force" or current-key is "nil", i.e. default - (ess--activate-smart-S-assign-key)))) -(defalias 'ess-toggle-underscore 'ess-toggle-S-assign) -;; NOTA BENE: "_" is smart *by default* : -;; ----- The user can always customize `ess-S-assign' ... -(ess-toggle-S-assign 'force-to-S-assign) - -(defun ess-add-MM-keys () - "Define MM's user keys, currently \\\\[ess-insert-function-outline], and - \\\\[ess-execute-screen-options]." - (interactive) - (require 'ess-mode); typically unnecessary - (require 'ess-inf); dito - (define-key ess-mode-map "\C-cf" 'ess-insert-function-outline) - (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)))) - - -(provide 'ess-s-l) - - ; Local variables section - -;;; This file is automatically placed in Outline minor mode. -;;; The file is structured as follows: -;;; Chapters: ^L ; -;;; Sections: ;;*;; -;;; Subsections: ;;;*;;; -;;; Components: defuns, defvars, defconsts -;;; Random code beginning with a ;;;;* comment - -;;; Local variables: -;;; mode: emacs-lisp -;;; outline-minor-mode: nil -;;; mode: outline-minor -;;; outline-regexp: "\^L\\|\\`;\\|;;\\*\\|;;;\\*\\|(def[cvu]\\|(setq\\|;;;;\\*" -;;; End: - -;;; ess-s-l.el ends here diff -Nru ess-16.10/lisp/ess-sp3-d.el ess-17.11/lisp/ess-sp3-d.el --- ess-16.10/lisp/ess-sp3-d.el 2014-10-28 18:15:42.000000000 +0000 +++ ess-17.11/lisp/ess-sp3-d.el 2017-11-13 14:13:16.000000000 +0000 @@ -33,7 +33,7 @@ (autoload 'inferior-ess "ess-inf" "Run an ESS process.") (autoload 'ess-mode "ess-mode" "Edit an ESS process.") -(require 'ess-s-l) +(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 diff -Nru ess-16.10/lisp/ess-sp4-d.el ess-17.11/lisp/ess-sp4-d.el --- ess-16.10/lisp/ess-sp4-d.el 2016-05-07 16:45:06.000000000 +0000 +++ ess-17.11/lisp/ess-sp4-d.el 2017-11-13 14:13:16.000000000 +0000 @@ -36,7 +36,7 @@ (require 'ess-mode) (require 'ess-inf) -(require 'ess-s-l) +(require 'ess-s-lang) (require 'ess-dde) (defvar S+4-dialect-name "S+4" diff -Nru ess-16.10/lisp/ess-sp5-d.el ess-17.11/lisp/ess-sp5-d.el --- ess-16.10/lisp/ess-sp5-d.el 2014-10-28 18:15:42.000000000 +0000 +++ ess-17.11/lisp/ess-sp5-d.el 2017-11-13 14:13:16.000000000 +0000 @@ -39,7 +39,7 @@ (autoload 'inferior-ess "ess-inf" "Run an ESS process.") (autoload 'ess-mode "ess-mode" "Edit an ESS process.") -(require 'ess-s-l) +(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... diff -Nru ess-16.10/lisp/ess-sp6-d.el ess-17.11/lisp/ess-sp6-d.el --- ess-16.10/lisp/ess-sp6-d.el 2016-05-07 16:45:06.000000000 +0000 +++ ess-17.11/lisp/ess-sp6-d.el 2017-11-13 14:13:16.000000000 +0000 @@ -38,7 +38,7 @@ (require 'ess-mode) (require 'ess-inf) -(require 'ess-s-l) +(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. @@ -74,7 +74,7 @@ '((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-function-pattern . ess-r-function-pattern) (ess-object-name-db-file . "ess-sp6-namedb.el") (inferior-ess-program . inferior-S+-program-name) diff -Nru ess-16.10/lisp/ess-sp6w-d.el ess-17.11/lisp/ess-sp6w-d.el --- ess-16.10/lisp/ess-sp6w-d.el 2016-05-07 16:45:06.000000000 +0000 +++ ess-17.11/lisp/ess-sp6w-d.el 2017-11-13 14:13:16.000000000 +0000 @@ -36,7 +36,7 @@ ;;; Requires and Autoloads: -(require 'ess-s-l) +(require 'ess-s-lang) ;;NO: this is autoloaded from other places (require 'ess-dde) (autoload 'inferior-ess "ess-inf" "Run an ESS process.") diff -Nru ess-16.10/lisp/ess-sta-d.el ess-17.11/lisp/ess-sta-d.el --- ess-16.10/lisp/ess-sta-d.el 2016-05-07 16:45:06.000000000 +0000 +++ ess-17.11/lisp/ess-sta-d.el 1970-01-01 00:00:00.000000000 +0000 @@ -1,187 +0,0 @@ -;;; ess-sta-d.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 -;; Created: 9 Sep 1998 -;; Maintainer: ESS-core - -;; 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 . - -;;; Code: - -(autoload 'inferior-ess "ess-inf" "Run an ESS process.") -(autoload 'ess-mode "ess-mode" "Edit an ESS process.") - -(require 'ess-utils) -(require 'ess-sta-l) - -(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-name) - (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") - ) - "Variables to customize for Stata.") - - -(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) - - -(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-sta-d) - - ; Local variables section - -;;; This file is automatically placed in Outline minor mode. -;;; The file is structured as follows: -;;; Chapters: ^L ; -;;; Sections: ;;*;; -;;; Subsections: ;;;*;;; -;;; Components: defuns, defvars, defconsts -;;; Random code beginning with a ;;;;* comment - -;;; Local variables: -;;; mode: emacs-lisp -;;; outline-minor-mode: nil -;;; mode: outline-minor -;;; outline-regexp: "\^L\\|\\`;\\|;;\\*\\|;;;\\*\\|(def[cvu]\\|(setq\\|;;;;\\*" -;;; End: - -;;; ess-sta-d.el ends here diff -Nru ess-16.10/lisp/ess-sta-l.el ess-17.11/lisp/ess-sta-l.el --- ess-16.10/lisp/ess-sta-l.el 2016-03-03 13:50:54.000000000 +0000 +++ ess-17.11/lisp/ess-sta-l.el 1970-01-01 00:00:00.000000000 +0000 @@ -1,1307 +0,0 @@ -;;; ess-sta-l.el --- Stata customization - -;; Copyright (C) 1999--2000, Thomas Lumley, A. J. Rossini, Brendan Halpin. -;; Copyright (C) 1997--2004 A.J. Rossini, Richard M. Heiberger, Martin -;; Maechler, Kurt Hornik, Rodney Sparapani, and Stephen Eglen. - -;; Author: Thomas Lumley , -;; Brendan Halpin -;; Created: 2 Nov 1997 -;; Maintainer: ESS-core - -;; Keywords: languages - -;; 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: - -;; This is based upon Version 0.4 of Stata mode. - -;; Stata modes. Emacs modes for using the Stata statistical package -;; Modified from S-mode, comint-mode -;; -;; (c) thomas lumley 1997 -;; -;; version 0.4 20/7/97 -;; -;; 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. -;; -;; (for the GNU GPL see above) - - -;;; Code: - -(require 'make-regexp) ; it's now local to the directory. -;;(load-library "make-regexp") ;; this is necessary for -;; ado-set-font-lock-keywords -;; only needed in Emacs >= 22.x and newish Xemacsen: -(unless (boundp 'c-emacs-features) - (require 'cc-vars));; for syntax-table - - ;(setq max-lisp-eval-depth 500) -(eval-when-compile - (setq max-lisp-eval-depth (max 600 max-lisp-eval-depth))) - -(defconst ess-help-STA-sec-keys-alist - '((?d . "Description") - (?e . "Examples") - (?o . "Options") - (?s . "Also see") - (?S . "Syntax") - (?r . "Remarks") - (?t . "Title")) - "Help section keys. -`key' indicates the keystroke to use to search for the section heading -`string' in an Stata help file. `string' is used as part of a -regexp-search, and so specials should be quoted. -") - -(defconst ess-help-STA-sec-regex "^[A-Z a-z]+:?\n-+\\|http:" - "Reg(ular) Ex(pression) of section headers in help file.") - -(defvar STA-syntax-table - (let ((tbl (make-syntax-table))) - (modify-syntax-entry ?\\ "." tbl) ;nullify escape meaning - (modify-syntax-entry ?\$ "." tbl) - (modify-syntax-entry ?` "(\'" tbl) - (modify-syntax-entry ?\' ")`" tbl) - ;;--------- begin cut-and-paste from lisp/progmodes/c-langs.el - (cond - ;; XEmacs 19, 20, 21 - ((memq '8-bit c-emacs-features) - (modify-syntax-entry ?/ ". 1456" tbl) - (modify-syntax-entry ?* ". 23" tbl)) - ;; Emacs 19, 20, 21 - ((memq '1-bit c-emacs-features) - (modify-syntax-entry ?/ ". 124b" tbl) - (modify-syntax-entry ?* ". 23" tbl)) - ;; incompatible - (t (error "CC Mode is incompatible with this version of Emacs")) - ) - (modify-syntax-entry ?\n "> b" tbl) - ;; Give CR the same syntax as newline, for selective-display - (modify-syntax-entry ?\^m "> b" tbl) - ;;--------- end cut-and-paste ------------------ - (modify-syntax-entry ?+ "." tbl) - (modify-syntax-entry ?- "." tbl) - (modify-syntax-entry ?= "." tbl) - (modify-syntax-entry ?% "." tbl) - (modify-syntax-entry ?< "." tbl) - (modify-syntax-entry ?> "." tbl) - (modify-syntax-entry ?& "." tbl) - (modify-syntax-entry ?| "." tbl) - (modify-syntax-entry ?~ "." tbl) - - tbl) - "Syntax table for Stata code.") - -(defun ado-set-font-lock-keywords () - "Create font lock keywords for Stata syntax. This is from the -ado-mode of Bill Rising , and uses make-regexp." - ;; (make-local-variable 'ado-font-lock-keywords) - (interactive) - (list - ;; special highlighting - ;; program definitions - (eval-when-compile - (make-regexps - '(("^\\*!.*") font-lock-keyword-face) - )) - (eval-when-compile - (make-regexps - "^" - '(( - "pr" "pro" "prog" "progr" "progra" "program" - ) font-lock-keyword-face) - "[ \t]+" - '(( - "de" "def" "defi" "defin" "define" - "di" "dir" - "drop" - "l" "li" "lis" "list" - ) font-lock-type-face nil) - "[ \t]+" - '(("[_a-z]+[_a-z0-9]*") font-lock-keyword-face nil) - )) - (eval-when-compile - (make-regexps - '(("^[ \t]*version") font-lock-reference-face) - "[ \t]*" - '(("1.0 2.0 2.1 3.0 3.1 4.0 5.0 6 6.0") font-lock-type-face) - )) - (eval-when-compile - (make-regexps - "^" - '(("end" "pause" - ) font-lock-keyword-face) - "[ /t]*.*$" - )) - ;; delimit command - (eval-when-compile - (make-regexps - '(("^[ \t]*#delimit") font-lock-reference-face) - "\\s-*" - '(("\\(cr\\|;\\)\\s-*$") font-lock-type-face nil) - )) - ;; set command (with endless options!) - (eval-when-compile - (make-regexps - '(("^[ \t]*set") font-lock-reference-face) - "[ \t]+" - '(("adosize" "ANSI" - "b" "be" "bee" "beep" "checksum" "contents" - "d" "di" "dis" "disp" "displ" "displa" "display" - "g" "gr" "gra" "grap" "graph" "graphi" "graphic" "graphics" - "help" - "IBM" - "l" "le" "lev" "leve" "level" - "linesize" - "lo" "log" - "mat" "mats" "matsi" "matsiz" "matsize" - "maxobs" "maxvar" - "mem" "memo" "memor" "memory" - "mo" "mor" "more" - "obs" - "ou" "out" "outp" "outpu" "output" - "pagesize" - "r" "rm" "rms" "rmsg" - "se" "see" "seed" "seed0" "shell" - "te" "tex" "text" "texts" "textsi" "textsiz" "textsize" - "tr" "tra" "trac" "trace" - "t" "ty" "typ" "type" "video" - "vir" "virt" "virtu" "virtua" "virtual" - ) - font-lock-reference-face t) - "[ \t]*" - '(("[a-zA-Z0-9]*") font-lock-type-face) - )) - ;; the constraint commands - (eval-when-compile - (make-regexps - "[ \t]+" - '(( - "cons" "const" "constr" "constra" "constrai" "constrain" "constraint" - ) font-lock-reference-face) - "[ \t]+" - '(( - "d" - "de" "def" "defi" "defin" "define" - "di" "dir" - "drop" - "l" "li" "lis" "list" - ) - font-lock-type-face) - "\\b" - )) - ;; the confirm commands - could be a mess! - (eval-when-compile - (make-regexps - "[ \t]+" - '(( - "conf" "confi" "confir" "confirm" - ) font-lock-reference-face) - "[ \t]+" - '(( - "e" "ex" "exi" "exis" "exist" "existe" "existen" "existenc" "existence" - "f" "fi" "fil" "file" - "n" "nu" "num" "numb" "numbe" "number" - "v" "va" "var" "vari" "varia" "variab" "variabl" "variable" - ) font-lock-type-face) - "\\b" - )) - (eval-when-compile - (make-regexps - "[ \t]+" - '(( - "conf" "confi" "confir" "confirm" - ) font-lock-reference-face) - "[ \t]+" - '(( - "integer" - ) font-lock-type-face) - "[ \t]+" - '(( - "n" "nu" "num" "numb" "numbe" "number" - ) font-lock-type-face) - "\\b" - )) - (eval-when-compile - (make-regexps - "[ \t]+" - '(( - "conf" "confi" "confir" "confirm" - ) font-lock-reference-face) - "[ \t]+" - '(( - "n" "ne" "new" - ) font-lock-type-face) - "[ \t]+" - '(( - "f" "fi" "fil" "file" - "v" "va" "var" "vari" "varia" "variab" "variabl" "variable" - ) font-lock-type-face) - "\\b" - )) - (eval-when-compile - (make-regexps - "[ \t]+" - '(( - "conf" "confi" "confir" "confirm" - ) font-lock-reference-face) - "[ \t]+" - '(( - "byte" "double" "float" "int" "long" - "numeric" - "str" "stri" "strin" "string" - ) font-lock-type-face) - "[ \t]+" - '(( - "v" "va" "var" "vari" "varia" "variab" "variabl" "variable" - ) font-lock-type-face) - "\\b" - )) - ;;; the str# won't quite look right, but that's the breaks for using - ;;; a tool like this... - (eval-when-compile - (make-regexps - "[ \t]+" - '(( - "conf" "confi" "confir" "confirm" - ) font-lock-reference-face) - "[ \t]+" - '(( - "str" - ) font-lock-type-face) - "[1-9]+[0-9]*[ \t]+" - '(( - "v" "va" "var" "vari" "varia" "variab" "variabl" "variable" - ) font-lock-type-face) - "\\b" - )) - ;; the estimates commands - (eval-when-compile - (make-regexps - "[ \t]+" - '(( - "est" "esti" "estim" "estima" "estimat" "estimate" "estimates" - ) font-lock-reference-face) - "[ \t]+" - '(( - "clear" - "di" "dir" "dis" "disp" "displ" "displa" "display" - "drop" - "h" "ho" "hol" "hold" - "li" "lis" "list" - "loc" "loca" "local" - "mat" "matr" "matri" "matrix" - "post" - "repost" - "sca" "scal" "scala" "scalar" - "u" "un" "unh" "unho" "unhol" "unhold" - ) - font-lock-type-face) - "\\b" - )) - ;; the gph commands - (eval-when-compile - (make-regexps - "[ \t]+" - '(( - "gph" - ) font-lock-reference-face) - "[ \t]+" - '(( - "arc" - "box" - "clear" "close" - "font" - "line" - "open" - "pen" "point" - "text" - "vline" "vpoint" "vpoly" "vtext" - ) - font-lock-type-face) - "\\b" - )) - - ;; some of the matrix commands - (eval-when-compile - (make-regexps - "[ \t]+" - '(("mat" "matr" "matri" "matrix") font-lock-reference-face) - "[ \t]+" - '(("ac" "acc" "accu" "accum" - "cole" "coleq" - "coln" "colna" "colnam" "cloname" "colnames" - "d" "def" "defi" "defin" "define" - "di" "dir" "dispCns" "drop" "drop _all" - "glsa" "glsac" "glsacc" "glsaccu" "glsaccum" - "l" "li" "lis" "list" "makeCns" "mlou" "mlout" "post" - "rowe" "roweq" - "rown" "rowna" "rownam" "rowname" "rownames" - "sco" "scor" "score" - "sub" "subs" "subst" "substi" "substit" "substitu" "substitut" "substitute" - "svd" "syme" "symei" "symeig" "symeige" "symeigen" - "veca" "vecac" "vecacc" "vecaccu" "vecaccum" - ) - font-lock-type-face) - "\\b" - )) - ;; the ml commands - (eval-when-compile - (make-regexps - "[ \t]+" - '(("ml") font-lock-reference-face) - "[ \t]+" - '(("b" "be" "beg" "begi" "begin" - "check" "count" - "de" "dep" "depn" "depna" "depnam" "depname" "depnames" - "di" "dis" "disp" "displ" "displa" "display" - "f" "fu" "fun" "func" "funct" "functi" "functio" "function" - "gr" "gra" "grap" "graph" - "init" - "max" "maxi" "maxim" "maximi" "maximiz" "maximize" - "me" "met" "meth" "metho" "method" - "ml" "mlo" "mlou" "mlout" - "mo" "mod" "mode" "model" - "pl" "plo" "plot" - "po" "pos" "post" - "q" "qu" "que" "quer" "query" - "re" "rep" "repo" "repor" "report" - "sa" "sam" "samp" "sampl" "sample" - "se" "sea" "sear" "searc" "search" - "trace") - font-lock-type-face) - "\\b" - )) - ;; the net commands - (eval-when-compile - (make-regexps - "[ \t]+" - '(("net") font-lock-reference-face) - "[ \t]+" - '(( - "cd" - "d" "de" "des" "desc" "descr" "descri" "describ" "describe" - "from" "get" "install" - "link" - "q" "qu" "que" "quer" "query") - font-lock-type-face) - "\\b" - )) - (eval-when-compile - (make-regexps - "[ \t]+" - '(("net") font-lock-reference-face) - "[ \t]+" - '(("set") font-lock-reference-face) - "[ \t]+" - '(("ado" "other") font-lock-type-face) - "\\b" - )) - (eval-when-compile - (make-regexps - "[ \t]+" - '(("ado") font-lock-reference-face) - "[ \t]+" - '(("d" "de" "des" "desc" "descr" "descri" "describ" "describe" - "dir" - "uninstall") - font-lock-type-face) - "\\b" - )) - ;; the reshape commands - (eval-when-compile - (make-regexps - "[ \t]+" - '(("reshape") font-lock-keyword-face) - "[ \t]+" - '(( - "clear" - "error" - "i" "j" - "long" - "wide" - "xi" "xij") - font-lock-type-face) - "\\b" - )) - ;; the return commands - (eval-when-compile - (make-regexps - "[ \t]+" - '(("ret" "retu" "retur" "return") font-lock-reference-face) - "[ \t]+" - '(("add" "clear" "local" "matrix" "scalar") font-lock-type-face) - "\\b" - )) - (eval-when-compile - (make-regexps - "[ \t]+" - '(("sret" "sretu" "sretur" "sreturn") font-lock-reference-face) - "[ \t]+" - '(("clear" "local") font-lock-type-face) - "\\b" - )) - ;; the sts commands - (eval-when-compile - (make-regexps - "[ \t]+" - '(("sts") font-lock-reference-face) - "[ \t]+" - '(( - "g" - "gen" "gene" "gener" "genera" "generat" "generate" - "gr" "gra" "grap" "graph" - "l" "li" "lis" "list" - "t" "te" "tes" "test" - ) - font-lock-type-face) - "\\b" - )) - ;; the sw commands - (eval-when-compile - (make-regexps - "[ \t]+" - '(("sw") font-lock-reference-face) - "[ \t]+" - '(( - "cloglog" "cnreg" "cox" "ereg" "gamma" "glm" "gompertz" "hetprob" - "llogist" "lnormal" "logistic" "logit" "ologit" "oprobit" - "poisson" "probit" "qreg" "reg" "regr" "regre" "regres" "regress" - "scobit" "tobit" "weibull" - ) - font-lock-type-face) - "\\b" - )) - ;; the window commands - (eval-when-compile - (make-regexps - "[ \t]+" - '(( - "win" "wind" "windo" "window" - ) font-lock-reference-face) - "[ \t]+" - '(( - "d" - "di" "dia" "dial" "dialo" "dialog" - "dir" "drop" - "fo" "fop" "fope" "fopen" - "fs" "fsa" "fsav" "fsave" - "l" "list" - "push" - "stop" "stopb" "stopbo" "stopbox" - ) font-lock-type-face) - "\\b" - )) - ;; the window controls - (eval-when-compile - (make-regexps - "[ \t]+" - '(( - "win" "wind" "windo" "window" - ) font-lock-reference-face) - "[ \t]+" - '(( - "c" "co" "con" "cont" "contr" "contro" "control" - ) font-lock-reference-face) - '(( - "button" "check" "clear" - "edit" - "mcombo" "msimple" - "radbegin" - "radend" - "radio" - "scombo" - "ssimple" - "static" - ) font-lock-type-face) - "\\b" - )) - ;; the window manage commands - (eval-when-compile - (make-regexps - "[ \t]+" - '(( - "win" "wind" "windo" "window" - ) font-lock-reference-face) - "[ \t]+" - '(( - "man" "mana" "manag" "manage" - ) font-lock-reference-face) - "[ \t]+" - '(( - "forward" - "minimize" - "prefs load" - "prefs save" - "prefs default" - "print graph" - "print log" - "restore" - "update variable" - ) - font-lock-type-face) - "\\b" - )) - ;; the window menu commands - (eval-when-compile - (make-regexps - "[ \t]+" - '(( - "win" "wind" "windo" "window" - ) font-lock-reference-face) - "[ \t]+" - '(( - "m" "me" "men" "menu" - ) font-lock-reference-face) - "[ \t]+" - '(( - "append popout" - "append string" - "append separator" - "clear" - "popout" - "set" - ) - font-lock-type-face) - "\\b" - )) - ;; the xwindow commands - (eval-when-compile - (make-regexps - "[ \t]+" - '(( - "xwin" "xwind" "xwindo" "xwindow" - ) font-lock-reference-face) - "[ \t]+" - '(( - "de" "def" "defi" "defin" "define" - "di" "dir" - "drop" - "l" "li" "lis" "list" - ) - font-lock-type-face) - "\\b" - )) - - ;; all the endless Stata keywords (not in a good order) - ;; first those keywords which must start line - ;; note that these will look like text if preceded by a comment - ;; (but comments shouldn't be before the command, anyway) - - (eval-when-compile - (make-regexps - "^[ \t]+" - '(( - "cap" "capt" "captu" "captur" "capture" - "char" "err" "erro" "error" "e" "ex" "exi" "exit" - "par" "pars" "parse" - "set" - ) font-lock-reference-face) - "\\b" - )) - ;; here are some keywords which appear in the middle of lines - ;; note that the really short abbreviations could make a mess of things - ;; - ;; These are split to allow compiling! - (eval-when-compile - (make-regexps - "\\b" - '(( - "_huber" "_qreg" "_robust" - "acprplot" "adjust" - "adopath" "alpha" - "an" "ano" "anov" "anova" "arch" - "areg" "arima" - "as" "ass" "asse" "asser" "assert" - "avplot" "avplots" - "bcskew0" - "be" "bee" "beep" - "biprobit" "bitest" "bitesti" "blogit" - "boxcox" "bprobit" "br" "break" "brier" - "bro" "brow" "brows" "browse" - "bsqreg" "bstat" "by" - "canon" "cat" "cc" "cci" "cchart" "centile" "cf" "ci" "cii" - "clogi" "clogit" "clogitp" "cloglog" - "close" "cmdtool" - "cnr" "cnre" "cnreg" "cnsreg" "codebook" "compare" - "copy" - "cor" "corc" "corr" "corre" "correl" "correla" "correlat" "correlate" - "corrgram" - "cou" "coun" "count" - "cox" "cprplot" "_crcswxx" "cs" "csi" - "ct" "ctset" "cttost" - "cumul" "cusum") - font-lock-reference-face) - "\\b" - )) - (eval-when-compile - (make-regexps - "[ \t]+" - '(( - "d" "de" "des" "desc" "descr" "descri" "describ" "describe" - "dfbeta" "dfuller" "di" - "dir" "dis" "disp" "disp_res" "disp_s" - "displ" "displa" "display" - "do" "dotplot" - "dprobit" "ds" "dstdize" "dwstat" - "eivreg" "eq" "ereg" - "fac" "fact" "facto" "factor" - "fit" "for" "fpredict" - "fracplot" "fracpoly" "fsl" - ) font-lock-reference-face) - "\\b" - )) - (eval-when-compile - (make-regexps - "[ \t]+" - '(( - "gettoken" "gladder" "glm" "glmpred" "glogit" "gnbreg" "gompertz" - "gphdot" "gphpen" "graph" "gprobit" "greigen" "grmeanby" - "hadimvo" "hausman" "heckman" "heckprob" "hetprob" "hettest" "hilite" - "hist" "hlu" "hotel" - "iqreg" "istdize" "iis" - "ins" "insp" "inspe" "inspec" "inspect" - "integ" "intreg" "ir" "iri" "ivreg" - "kap" "kappa" "kapwgt" "kdensity" "ksm" "ksmirnov" "ktau" - "kwallis" - ) font-lock-reference-face) - "\\b" - )) - (eval-when-compile - (make-regexps - "[ \t]+" - '(( - "l" "ladder" "lfit" "lincom" "linktest" - "li" "lis" "list" - "log" - "logistic" - "logi" "logit" - "loneway" "lookfor" - "lo" "loo" "look" "looku" "lookup" - "lpredict" "lroc" "lrtest" "ls" "lsens" "lstat" "ltable" "lv" "lvr2plot" - "man" "matcproc" "mcc" "mcci" - "means" - "mlog" "mlogi" "mlogit" - "mor" "more" - "mvreg" "mx_param" - "n" "nbreg" "newey" "news" - "nl" "nlinit" - "no" "noi" "nois" "noisi" "noisil" "noisily" - "note" "notes" - "nptrend" "numlist" - "olog" "ologi" "ologit" - "ologitp" - "on" "one" "onew" "onewa" "oneway" - "oprob" "oprobi" "oprobit" - "oprobitp" - "orthog" "orthpoly" - "ovtest") - font-lock-reference-face) - "\\b" - )) - (eval-when-compile - (make-regexps - "[ \t]+" - '(("pac" "pchart" "pchi" "pcorr" "pergram" - "pl" "plo" "plot" - "pnorm" "poisgof" "poisson" "pperron" - "prais" - "prob" "probi" "probit" - "prtest" "prtesti" - "pwcorr" "pwd" - "q" "qchi" "qnorm" "qqplot" "qreg" "quadchk" "quantile" - "qu" "que" "quer" "query" - "qui" "quie" "quiet" "quietl" "quietly" - "ranksum" "rchart" "regdw" "regph" - "reg" "reg3" "regr" "regre" "regres" "regress" "reshape" - "rot" "rota" "rotat" "rotate" - "rreg" - "run" "runtest" "rvfplot" "rvpplot" - ) font-lock-reference-face) - "\\b" - )) - (eval-when-compile - (make-regexps - "[ \t]+" - '(( - "sampsi" "sconfirm" - "sco" "scobit" "scor" "score" - "sdtest" "sdtesti" "search" "serrbar" - "sfrancia" "shell" "shelltool" "shewhart" "signrank" "signtest" - "sktest" "slog" "spearman" "spikeplt" "sqreg" - "st" "st_is" "st_show" "st_ct" - "stcox" "stcoxkm" "stcurv" "stdes" - "stem" - "stereg" "stir" "stmc" "stmh" "stphplot" "stphtest" - "strate" "streg" - "sts" "stse" "stset" "stsum" "stvary" "stweib" - "su" "sum" "summ" "summa" "summar" "summari" "summariz" "summarize" - "sureg" - "svydes" "svyintrg" "svyivreg" "svylc" "svylogit" - "svymean" "svymean" "svymlog" "svyolog" "svyoprob" "svypois" "svyprobt" - "svyprop" "svyratio" "svyreg" "svyset" "svytab" "svytest" "svytotal" - "swilk" "symmetry" "symmi" "symplot" "syntax" "sysdir" - ) font-lock-reference-face) - "\\b" - )) - (eval-when-compile - (make-regexps - "[ \t]+" - '(( - "ta" "tab" - "tab1" "tab2" - "tabdisp" - "tabi" - "table" - "tabu" "tabul" "tabula" "tabulat" "tabulate" - "te" "tes" "test" - "testnl" "testparm" "tis" - "tob" "tobi" "tobit" - "token" "tokeni" "tokeniz" "tokenize" - "touch" "tsreport" "tsset" "tsunab" "ttest" "ttesti" - "ty" "typ" "type" - "unab" "using" - "vce" - "verinst" "vif" "vwls" - "weibull" "which" "who" "wntestb" "wntestq" - "xchart" "xcorr" - "xtclog" "xtdes" "xtgee" "xtgls" "xthaus" "xtintreg" - "xtlogit" "xtnbreg" "xtpois" "xtprobit" - "xtrchh" "xtreg" "xtsum" "xttab" "xttest0" "xttobit" "xttrans" - "zip" "zinb" - ) font-lock-reference-face) - "\\b" - )) - - ;; conditional statements - ;; if might not work right ('cuz it is also a keyword) - (eval-when-compile - (make-regexps - "^[ \t]*\\sw+[ \t]*" - '(("if" - ) font-lock-reference-face t t) - "\\b" - )) - - (eval-when-compile - (make-regexps - "^[ \t]*" - '(("if" "while" - ) font-lock-reference-face t t) - "[ \t]+.*{" - )) - ;; else statement (which must just have a {) - (eval-when-compile - (make-regexps - "^[ \t]*" - '(("else" - ) font-lock-reference-face) - "[ \t]*{" - )) - - ;; short version of list --- which can get fooled if used as a var - (eval-when-compile - (make-regexps - '(("^[ \t]*l\\b" - ) font-lock-reference-face) - )) - - ;; all the Stata options - ;; commonly used options - (eval-when-compile - (make-regexps - "[ \t]+" - '(("byte" "int" "long" "str[1-9]+[0-9]?" "float" "double" - "width" "maxobs" "maxvar" - ) font-lock-type-face) - "[ \t]+" - )) - ;; special local variables (used in parsing) - (eval-when-compile - (make-regexps - "^[ \t]+\\(local\\)+[ \t]+" - '(("varlist" "exp" "weight" "if" "in" "using" "options" - ) font-lock-type-face nil t t) - "\\b" - )) - - ;; things used with display - ;; since these are often split across lines, and Stata commands are hard - ;; to delimit, this will highlight even if out of context - - (eval-when-compile - (make-regexps - "[ \t]+" - '(( - "_c" "_co" "_con" "_cont" "_conti" "_contin" "_continu" "_continue" - "_n" "_ne" "_new" "_newl" "_newli" "_newlin" "_newline" - "_quote" - "_r" "_re" "_req" "_requ" "_reque" "_reques" "_request" - ) - font-lock-type-face) - "\\b" - )) - (eval-when-compile - (make-regexps - "[ \t]+" - '(( - "_col" "_colu" "_colum" "_column" - "_d" "_du" "_dup" - "_s" "_sk" "_ski" "_skip" - ) - font-lock-type-face) - "([1-9]+[0-9]*)\\b" - )) - (eval-when-compile - (make-regexps - "\\bin[ \t]+" - '(( - "b" "bl" "blu" "blue" - "g" "gr" "gre" "gree" "green" - "r" "re" "red" - "w" "wh" "whi" "whit" "white" - "y" "ye" "yel" "yell" "yello" "yellow" - ) font-lock-type-face) - "\\b" - )) - - ;; labels - (eval-when-compile - (make-regexps - "[ \t]+" - '(("lab" "labe" "label" - ) font-lock-reference-face t) - "[ \t]+" - '(( - "da" "dat" "data" - "de" "def" "defi" "defin" "define" - "di" "dir" - "drop" - "l" "li" "lis" "list" - "save" - "val" "valu" "value" "values" - "var" "vari" "varia" "variab" "variabl" "variable" - ) font-lock-type-face nil t t) - "[ \t]" - )) - - ;; all Stata data-altering stuff - (eval-when-compile - (make-regexps - "\\b" - '(( - "_pctile" "_predict" - "aorder" "append" - "bcskew0" "bsample" "bs" "bstrap" - "cd" "chdir" "clear" "compress" - "contract" "convert" "cross" - "dec" "deco" "decod" "decode" - "discard" "drop" "dydx" - "ed" "edi" "edit" "egen" - "en" "enc" "enco" "encod" "encode" - "erase" - "expand" - "fillin" - "form" "forma" "format" - "fracgen" "fracpred" - "g" "ge" "gen" "gene" "gener" "genera" "generat" "generate" - "gsort" - "impute" - "infile" "infix" "input" "insheet" "integ" "ipolate" - "joinby" - "keep" - "lnskew0" - ) font-lock-keyword-face) - "\\b" - )) - (eval-when-compile - (make-regexps - "\\b" - '(( - "mark" "markout" "marksample" - "matname" - "mer" "merg" "merge" - "mkdir" "mkmat" "mkspline" - "mleval" "mlmatsum" "mlsum""mlvecsum" - "modify" "mov" "move" - "mvdecode" "mvencode" "nlpred" "nobreak" "order" - "ou" "out" "outf" "outfi" "outfil" "outfile" - "outs" "outsh" "outshe" "outshee" "outsheet" - "pctile" - "post" "postclose" "postfile" - "pre" "pred" "predi" "predic" "predict" - "preserve" "range" - "recast" "recode" - "ren" "rena" "renam" "rename" - "renpfix" "replace" "restore" "rm" - "sappend" - "sa" "sav" "save" - "sample" "sdrop" - "separate" - "simul" "sinfile" "smerge" - "smooth" "snapspan" - "so" "sor" "sort" - "ssave" "ssort" "stack" - "stbase" "stfill" "stgen" "stjoin" "stsplit" "sttocc" "sttoct" - "suse" "svmat" - "tsfill" "tsrevar" - "u" "us" "use" - "xi" "xi:" "xtile" "xpose" - "xtdata" "xtpred" - ) font-lock-keyword-face) - "\\b" - )) - - ;; assignment of macros - (eval-when-compile - (make-regexps - "^[ \t]*" - '(("global" "local" "scalar" - ) font-lock-reference-face) - '(("\\([ \t]+[a-zA-Z_]+[a-zA-Z_0-9]*\\b\\)?" - ) font-lock-variable-name-face t) - )) - ;; choosing temp names - (eval-when-compile - (make-regexps - "^[ \t]*" - '(("tempname" "tempfile" "tempvar" - ) font-lock-reference-face) - '(("\\([ \t]+[a-zA-Z_]+[a-zA-Z_0-9`']*\\)+" - ) font-lock-type-face t) - )) - ;; all variable/macro stuff (put late so it will override) - ;; internal constants - (eval-when-compile - (make-regexps - "[^a-zA-Z]" - '(("_merge" "_n" "_pi" "_rc" "_N" - ) font-lock-variable-name-face) - "[^a-zA-Z]" - )) - ;; some generated vars - (eval-when-compile - (make-regexps - '(("_result([1-9]+)" - ) font-lock-variable-name-face) - )) - ;; global macros - (eval-when-compile - (make-regexps - '(("\\$[a-zA-Z_*]+[a-zA-Z_0-9]*" - ) font-lock-variable-name-face t) - )) - ;; local macros - (eval-when-compile - (make-regexps - "`+" - '(("[a-zA-Z_`*]+[a-zA-Z_0-9]*" ;has glitch interior ` is highlighted - ) font-lock-variable-name-face t) - "'+" - )) - ;; other macro commands - (eval-when-compile - (make-regexps - "[ \t]*" - '(( - "ma" "mac" "macr" "macro" - ) font-lock-reference-face) - "[ \t]+" - '(( - "de" "def" "define" - "di" "dir" - "drop" - "l" "li" "lis" "list" - "s" "sh" "shi" "shif" "shift" - ) - font-lock-type-face) - "[ \t]+" - )) - ;; stata 'functions' i.e. things which require () after them - (eval-when-compile - (make-regexps - "\\b" - '(("_caller" - "abs" "acos" "asin" "atan" "autocode" - "Binomial" - "binorm" - "chiprob" "comb" "cond" "cos" - "d" "date" "digamma" "day" - "dofh" "dofm" "dofq" "dofw" "dofy" "dow" "doy" - "e" "exp" - "float" "fprob" "gammap" "get" "group" - "h" "halfyear" "halfyearly" "hofd" - "ibeta" "index" "int" - "invbinomial" "invchi" "invfprob" "invgammap" "invnchi" "invnorm" "invt" - "length" "ln" "lnfact" "lngamma" "log" "log10" "lower" "ltrim" - "m" "matrix" "max" "mdy" "min" "missing" "mod" "mofd" "month" "monthly" - "nchi" "normd" "normprob" "npnchi" - "q" "qofd" "quarter" "quarterly" - "r" "real" "recode" "reldif" "replay" "return" "round" "rtrim" - "s" "scalar" "sign" "sin" "sqrt" "string" "substr" "sum" - "tan" "tprob" "trigamma" "trim" - "uniform" "uniform0" "upper" - "w" "week" "weekly" "wofd" - "y" "year" "yearly" "yh" "ym" "yofd" "yq" "yw" - ) - font-lock-reference-face t) - "(" - )) - ;; stata 'functions' i.e. things which require [] after them - (eval-when-compile - (make-regexps - "\\b" - '(("_b" "_coef" "_se") - font-lock-reference-face t) - "\\[" - )) - ;; common Stata options which require a () after them - (eval-when-compile - (make-regexps - "[, \t]+" - '(("bands" "by" "connect" "density" "gap" "iterate" "ltolerance" "margin" - "psize" "saving" "tlabel" "tolerance" - "xlabel" "xscale" "ylabel" "yscale") - font-lock-type-face t) - "(" - )) - ;; egen 'function' options - (eval-when-compile - (make-regexps - "[ \t]*egen[ \t]+.*=[ \t]*" - '(("count" "diff" "fill" "group" "iqr" - "ma" "max" "mean" "median" "min" "mtr" "pctile" - "rank" "rfirst" "rlast" "rmax" "rmean" "rmin" "rmiss" "robs" "rsd" "rsum" - "sd" "std" "sum") - font-lock-reference-face t) - "(.*)" - )) - ;; All Custom ado files which are 'reliable' and which are not file killers - ;; this might be a useless endeavor --- but I cannot generate tag files - ;; all the s-extensions are listed under Stata's name (since they alter - ;; data and will be moved tot he utils directory - (eval-when-compile - (make-regexps - "[ \t]*" - '(("addnote" "anypath" "autolab" "checkvar" "ck1icd9" "ckicd9" - "datetoe" "dattomdy" "den2dem" "dishis" "dtapath" "dupclean" "echo" - "exdupbil" "ezip2hsa" "getdate" "getlbl" "getnames" "getobs" "gplur" - "icd9" "issorted" "isfile" "jultoe" "jultof" "jultomdy" "knowndup" - "labeldir" "linker" - "markit" "makewide" "missize" "mpcounts" - "nodups" "notefile" "prov2zip" - "qcolsum" "qorder" - "random" "readraw" "readzip" "repart" - "setup" "stdrate" - "timeslot" - "wdatetoe" "wdatomdy" "zip2ezip" - "_addext" "_brclean" "_brckado" "_brdlog" - "_ckbad" "_ckdunno" "_ckdupl" "_ckmiss" "_ckok" "_ckwarn" - "_delimit" "_filenm" "_lookup" "_mk_ck" - ) font-lock-function-name-face) - "\\b" - )) - )) - - -(defvar ess-STA-mode-font-lock-defaults (ado-set-font-lock-keywords) - "Set the Stata mode font-lock keywords to Bill Rising's ado-mode keywords.") - -(defvar STA-editing-alist - '((paragraph-start . (concat "[ \t\f]*$\\|" page-delimiter)) - (paragraph-separate . (concat "[ \t\f]*$\\|" page-delimiter)) - (paragraph-ignore-fill-prefix . t) - (require-final-newline . mode-require-final-newline) - (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 . STA-syntax-table) - (font-lock-defaults . '(ess-STA-mode-font-lock-defaults - nil nil ((?\. . "w"))))) - "General options for editing Stata do and ado source files.") - -;; YOU USED TO HAVE TO (with Thomas's version): -;;;;; Add the following to your .emacs file -;; -;;(autoload 'stata "~/ess-sta-l.el" "inferior stata mode" t ) -;;(autoload 'stata-help "stata" "stata help mode" t) -;;(autoload 'stata-mode "~/ess-sta-l.el" "stata mode" t) -;; -;;(if (assoc "\\.do$" auto-mode-alist) nil -;; (setq auto-mode-alist -;; (append -;; '(("\\.do$" . stata-mode) -;; ("\\.ado$" . stata-mode)) -;; auto-mode-alist))) -;; - - -;; QUESTIONS TO ASK THOMAS: -;; 1 - are 'help' and 'lookup' the same? -;; 2 - what is the point of the review buffer? -;; 3 - how to quit? - -;; -;; NOTE: all of Thomas's functions have been left here, to be removed -;; or merged into real locations as we work on this. -;; - - -;;;;;;;;; Things to change - -(defvar stata-switches "-q" - "*Switches to apply to stata invocation.") - -(defvar stata-profile "~/.stataprofile" - "File to read on startup (nil for no file).") - -(define-obsolete-function-alias 'stata-help 'ess-display-help-on-object "ESS[15.09]") -(define-obsolete-function-alias 'stata-lookup 'ess-display-help-apropos "ESS[16.03]") - -;; fixme? Hook this on C-c C-s /ess-execute-search does an R search() right now/ -(defun stata-variables () - "Stata variable list in other buffer." - (interactive) - (let* ((stata-process (get-process "stata")) - (stata-buffer (if stata-process - (process-buffer stata-process) - (error "Stata is not running."))) - oldpf oldpb oldpm) - (set-buffer stata-buffer) - (setq oldpf (process-filter stata-process)) - (setq oldpb (process-buffer stata-process)) - (setq oldpm (marker-position (process-mark stata-process))) - (save-excursion - (if stata-process nil (error "Stata is not running.")) - (beginning-of-line) - (if (looking-at ". ") nil (error "Stata not ready.")) - (save-excursion - (set-process-buffer stata-process - (get-buffer-create "*stata variables*")) - (set-process-filter stata-process 'inferior-ess-ordinary-filter) - (set-buffer "*stata variables*") - (setq buffer-read-only nil) - (erase-buffer) - (process-send-string stata-process "desc \n ") - (stata-prompt-wait stata-process) - (setq buffer-read-only t) - (set-buffer stata-buffer) - (set-process-buffer stata-process oldpb) - (set-marker (process-mark stata-process) oldpm) - (set-process-filter stata-process oldpf))) - (display-buffer "*stata variables*") - (goto-char (point-max)))) - -;;;; -;;; This doesn't do anything at the moment. I have vague plans of -;;; implementing a menu interface using emacs -;;; -(defun stata-watch-for-menu-filter (proc string) - (if (string-match "^!!!window!!!" string) - (stata-handle-menu-code proc string) - (comint-output-filter proc string))) - -(defun stata-handle-menu-code (proc string) - (let ((old-buffer (current-buffer))) - (unwind-protect - (let (moving) - (set-buffer (process-buffer proc)) - (setq moving (= (point) - (process-mark proc))) - (save-excursion - ;; Insert the text, moving the process-marker. - (goto-char (process-mark proc)) - (insert "Handling menu code\n") - (set-marker (process-mark proc) (point))) - (if moving (goto-char (process-mark proc)))) - (set-buffer old-buffer)))) - -;;;; - -(defun stata-prompt-wait (proc &optional start-of-output) - "Wait for a prompt to appear at BOL of current buffer. -PROC is the stata 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 50) - (goto-char (marker-position (process-mark proc))) - (beginning-of-line) - (if (< (point) start-of-output) (goto-char start-of-output)) - (not (looking-at "^. ")))))) - -(defun stata-help-mode () - "Major mode for displaying Stata help in a read-only buffer. -Active commands are Help (\\[stata-help]) and hyperlink -(\\[stata-rehelp] or mouse-2)." - (interactive) - (setq major-mode 'stata-help-mode) - (setq mode-name "Stata help") - ;;(use-local-map stata-help-mode-map) - (setq buffer-read-only t)) - -;;; Suggested function from Brendan Halpin: -(defvar ess-STA-delimit-do-file "delimit-do.do") - -(defun ess-STA-delimit-do () - (save-excursion - (let ((commands (buffer-substring-no-properties (region-beginning) - (region-end)))) - (set-buffer (get-buffer-create ess-STA-delimit-do-file)) - (delete-region (point-min) (point-max)) - (insert "#delimit ;\n" - commands - "\n#delimit cr\n") - (write-file ess-STA-delimit-do-file nil) - (comint-send-string "Stata" - (format "do %s \n" ess-STA-delimit-do-file))))) -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - - -(provide 'ess-sta-l) - - ; Local variables section - -;;; This file is automatically placed in Outline minor mode. -;;; The file is structured as follows: -;;; Chapters: ^L ; -;;; Sections: ;;*;; -;;; Subsections: ;;;*;;; -;;; Components: defuns, defvars, defconsts -;;; Random code beginning with a ;;;;* comment - -;;; Local variables: -;;; mode: emacs-lisp -;;; outline-minor-mode: nil -;;; mode: outline-minor -;;; outline-regexp: "\^L\\|\\`;\\|;;\\*\\|;;;\\*\\|(def[cvu]\\|(setq\\|;;;;\\*" -;;; End: - -;;; ess-sta-l.el ends here diff -Nru ess-16.10/lisp/ess-stata-lang.el ess-17.11/lisp/ess-stata-lang.el --- ess-16.10/lisp/ess-stata-lang.el 1970-01-01 00:00:00.000000000 +0000 +++ ess-17.11/lisp/ess-stata-lang.el 2017-11-13 14:13:16.000000000 +0000 @@ -0,0 +1,1297 @@ +;;; ess-stata-lang.el --- Stata customization + +;; Copyright (C) 1999--2000, Thomas Lumley, A. J. Rossini, Brendan Halpin. +;; Copyright (C) 1997--2004 A.J. Rossini, Richard M. Heiberger, Martin +;; Maechler, Kurt Hornik, Rodney Sparapani, and Stephen Eglen. + +;; Author: Thomas Lumley , +;; Brendan Halpin +;; Created: 2 Nov 1997 +;; Maintainer: ESS-core + +;; Keywords: languages + +;; 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: + +;; This is based upon Version 0.4 of Stata mode. + +;; Stata modes. Emacs modes for using the Stata statistical package +;; Modified from S-mode, comint-mode +;; +;; (c) thomas lumley 1997 +;; +;; version 0.4 20/7/97 +;; +;; 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. +;; +;; (for the GNU GPL see above) + + +;;; Code: + +(require 'make-regexp) ; it's now local to the directory. +;;(load-library "make-regexp") ;; this is necessary for +;; ado-set-font-lock-keywords +;; only needed in Emacs >= 22.x and newish Xemacsen: +(unless (boundp 'c-emacs-features) + (require 'cc-vars));; for syntax-table + + ;(setq max-lisp-eval-depth 500) +(eval-when-compile + (setq max-lisp-eval-depth (max 600 max-lisp-eval-depth))) + +(defconst ess-help-STA-sec-keys-alist + '((?d . "Description") + (?e . "Examples") + (?o . "Options") + (?s . "Also see") + (?S . "Syntax") + (?r . "Remarks") + (?t . "Title")) + "Help section keys. +`key' indicates the keystroke to use to search for the section heading +`string' in an Stata help file. `string' is used as part of a +regexp-search, and so specials should be quoted. +") + +(defconst ess-help-STA-sec-regex "^[A-Z a-z]+:?\n-+\\|http:" + "Reg(ular) Ex(pression) of section headers in help file.") + +(defvar STA-syntax-table + (let ((tbl (make-syntax-table))) + (modify-syntax-entry ?\\ "." tbl) ;nullify escape meaning + (modify-syntax-entry ?\$ "." tbl) + (modify-syntax-entry ?` "(\'" tbl) + (modify-syntax-entry ?\' ")`" tbl) + ;;--------- begin cut-and-paste from lisp/progmodes/c-langs.el + (modify-syntax-entry ?/ ". 124b" tbl) + (modify-syntax-entry ?* ". 23" tbl) + (modify-syntax-entry ?\n "> b" tbl) + ;; Give CR the same syntax as newline, for selective-display + (modify-syntax-entry ?\^m "> b" tbl) + ;;--------- end cut-and-paste ------------------ + (modify-syntax-entry ?+ "." tbl) + (modify-syntax-entry ?- "." tbl) + (modify-syntax-entry ?= "." tbl) + (modify-syntax-entry ?% "." tbl) + (modify-syntax-entry ?< "." tbl) + (modify-syntax-entry ?> "." tbl) + (modify-syntax-entry ?& "." tbl) + (modify-syntax-entry ?| "." tbl) + (modify-syntax-entry ?~ "." tbl) + + tbl) + "Syntax table for Stata code.") + +(defun ado-set-font-lock-keywords () + "Create font lock keywords for Stata syntax. This is from the +ado-mode of Bill Rising , and uses make-regexp." + ;; (make-local-variable 'ado-font-lock-keywords) + (interactive) + (list + ;; special highlighting + ;; program definitions + (eval-when-compile + (make-regexps + '(("^\\*!.*") font-lock-keyword-face) + )) + (eval-when-compile + (make-regexps + "^" + '(( + "pr" "pro" "prog" "progr" "progra" "program" + ) font-lock-keyword-face) + "[ \t]+" + '(( + "de" "def" "defi" "defin" "define" + "di" "dir" + "drop" + "l" "li" "lis" "list" + ) font-lock-type-face nil) + "[ \t]+" + '(("[_a-z]+[_a-z0-9]*") font-lock-keyword-face nil) + )) + (eval-when-compile + (make-regexps + '(("^[ \t]*version") font-lock-reference-face) + "[ \t]*" + '(("1.0 2.0 2.1 3.0 3.1 4.0 5.0 6 6.0") font-lock-type-face) + )) + (eval-when-compile + (make-regexps + "^" + '(("end" "pause" + ) font-lock-keyword-face) + "[ /t]*.*$" + )) + ;; delimit command + (eval-when-compile + (make-regexps + '(("^[ \t]*#delimit") font-lock-reference-face) + "\\s-*" + '(("\\(cr\\|;\\)\\s-*$") font-lock-type-face nil) + )) + ;; set command (with endless options!) + (eval-when-compile + (make-regexps + '(("^[ \t]*set") font-lock-reference-face) + "[ \t]+" + '(("adosize" "ANSI" + "b" "be" "bee" "beep" "checksum" "contents" + "d" "di" "dis" "disp" "displ" "displa" "display" + "g" "gr" "gra" "grap" "graph" "graphi" "graphic" "graphics" + "help" + "IBM" + "l" "le" "lev" "leve" "level" + "linesize" + "lo" "log" + "mat" "mats" "matsi" "matsiz" "matsize" + "maxobs" "maxvar" + "mem" "memo" "memor" "memory" + "mo" "mor" "more" + "obs" + "ou" "out" "outp" "outpu" "output" + "pagesize" + "r" "rm" "rms" "rmsg" + "se" "see" "seed" "seed0" "shell" + "te" "tex" "text" "texts" "textsi" "textsiz" "textsize" + "tr" "tra" "trac" "trace" + "t" "ty" "typ" "type" "video" + "vir" "virt" "virtu" "virtua" "virtual" + ) + font-lock-reference-face t) + "[ \t]*" + '(("[a-zA-Z0-9]*") font-lock-type-face) + )) + ;; the constraint commands + (eval-when-compile + (make-regexps + "[ \t]+" + '(( + "cons" "const" "constr" "constra" "constrai" "constrain" "constraint" + ) font-lock-reference-face) + "[ \t]+" + '(( + "d" + "de" "def" "defi" "defin" "define" + "di" "dir" + "drop" + "l" "li" "lis" "list" + ) + font-lock-type-face) + "\\b" + )) + ;; the confirm commands - could be a mess! + (eval-when-compile + (make-regexps + "[ \t]+" + '(( + "conf" "confi" "confir" "confirm" + ) font-lock-reference-face) + "[ \t]+" + '(( + "e" "ex" "exi" "exis" "exist" "existe" "existen" "existenc" "existence" + "f" "fi" "fil" "file" + "n" "nu" "num" "numb" "numbe" "number" + "v" "va" "var" "vari" "varia" "variab" "variabl" "variable" + ) font-lock-type-face) + "\\b" + )) + (eval-when-compile + (make-regexps + "[ \t]+" + '(( + "conf" "confi" "confir" "confirm" + ) font-lock-reference-face) + "[ \t]+" + '(( + "integer" + ) font-lock-type-face) + "[ \t]+" + '(( + "n" "nu" "num" "numb" "numbe" "number" + ) font-lock-type-face) + "\\b" + )) + (eval-when-compile + (make-regexps + "[ \t]+" + '(( + "conf" "confi" "confir" "confirm" + ) font-lock-reference-face) + "[ \t]+" + '(( + "n" "ne" "new" + ) font-lock-type-face) + "[ \t]+" + '(( + "f" "fi" "fil" "file" + "v" "va" "var" "vari" "varia" "variab" "variabl" "variable" + ) font-lock-type-face) + "\\b" + )) + (eval-when-compile + (make-regexps + "[ \t]+" + '(( + "conf" "confi" "confir" "confirm" + ) font-lock-reference-face) + "[ \t]+" + '(( + "byte" "double" "float" "int" "long" + "numeric" + "str" "stri" "strin" "string" + ) font-lock-type-face) + "[ \t]+" + '(( + "v" "va" "var" "vari" "varia" "variab" "variabl" "variable" + ) font-lock-type-face) + "\\b" + )) + ;;; the str# won't quite look right, but that's the breaks for using + ;;; a tool like this... + (eval-when-compile + (make-regexps + "[ \t]+" + '(( + "conf" "confi" "confir" "confirm" + ) font-lock-reference-face) + "[ \t]+" + '(( + "str" + ) font-lock-type-face) + "[1-9]+[0-9]*[ \t]+" + '(( + "v" "va" "var" "vari" "varia" "variab" "variabl" "variable" + ) font-lock-type-face) + "\\b" + )) + ;; the estimates commands + (eval-when-compile + (make-regexps + "[ \t]+" + '(( + "est" "esti" "estim" "estima" "estimat" "estimate" "estimates" + ) font-lock-reference-face) + "[ \t]+" + '(( + "clear" + "di" "dir" "dis" "disp" "displ" "displa" "display" + "drop" + "h" "ho" "hol" "hold" + "li" "lis" "list" + "loc" "loca" "local" + "mat" "matr" "matri" "matrix" + "post" + "repost" + "sca" "scal" "scala" "scalar" + "u" "un" "unh" "unho" "unhol" "unhold" + ) + font-lock-type-face) + "\\b" + )) + ;; the gph commands + (eval-when-compile + (make-regexps + "[ \t]+" + '(( + "gph" + ) font-lock-reference-face) + "[ \t]+" + '(( + "arc" + "box" + "clear" "close" + "font" + "line" + "open" + "pen" "point" + "text" + "vline" "vpoint" "vpoly" "vtext" + ) + font-lock-type-face) + "\\b" + )) + + ;; some of the matrix commands + (eval-when-compile + (make-regexps + "[ \t]+" + '(("mat" "matr" "matri" "matrix") font-lock-reference-face) + "[ \t]+" + '(("ac" "acc" "accu" "accum" + "cole" "coleq" + "coln" "colna" "colnam" "cloname" "colnames" + "d" "def" "defi" "defin" "define" + "di" "dir" "dispCns" "drop" "drop _all" + "glsa" "glsac" "glsacc" "glsaccu" "glsaccum" + "l" "li" "lis" "list" "makeCns" "mlou" "mlout" "post" + "rowe" "roweq" + "rown" "rowna" "rownam" "rowname" "rownames" + "sco" "scor" "score" + "sub" "subs" "subst" "substi" "substit" "substitu" "substitut" "substitute" + "svd" "syme" "symei" "symeig" "symeige" "symeigen" + "veca" "vecac" "vecacc" "vecaccu" "vecaccum" + ) + font-lock-type-face) + "\\b" + )) + ;; the ml commands + (eval-when-compile + (make-regexps + "[ \t]+" + '(("ml") font-lock-reference-face) + "[ \t]+" + '(("b" "be" "beg" "begi" "begin" + "check" "count" + "de" "dep" "depn" "depna" "depnam" "depname" "depnames" + "di" "dis" "disp" "displ" "displa" "display" + "f" "fu" "fun" "func" "funct" "functi" "functio" "function" + "gr" "gra" "grap" "graph" + "init" + "max" "maxi" "maxim" "maximi" "maximiz" "maximize" + "me" "met" "meth" "metho" "method" + "ml" "mlo" "mlou" "mlout" + "mo" "mod" "mode" "model" + "pl" "plo" "plot" + "po" "pos" "post" + "q" "qu" "que" "quer" "query" + "re" "rep" "repo" "repor" "report" + "sa" "sam" "samp" "sampl" "sample" + "se" "sea" "sear" "searc" "search" + "trace") + font-lock-type-face) + "\\b" + )) + ;; the net commands + (eval-when-compile + (make-regexps + "[ \t]+" + '(("net") font-lock-reference-face) + "[ \t]+" + '(( + "cd" + "d" "de" "des" "desc" "descr" "descri" "describ" "describe" + "from" "get" "install" + "link" + "q" "qu" "que" "quer" "query") + font-lock-type-face) + "\\b" + )) + (eval-when-compile + (make-regexps + "[ \t]+" + '(("net") font-lock-reference-face) + "[ \t]+" + '(("set") font-lock-reference-face) + "[ \t]+" + '(("ado" "other") font-lock-type-face) + "\\b" + )) + (eval-when-compile + (make-regexps + "[ \t]+" + '(("ado") font-lock-reference-face) + "[ \t]+" + '(("d" "de" "des" "desc" "descr" "descri" "describ" "describe" + "dir" + "uninstall") + font-lock-type-face) + "\\b" + )) + ;; the reshape commands + (eval-when-compile + (make-regexps + "[ \t]+" + '(("reshape") font-lock-keyword-face) + "[ \t]+" + '(( + "clear" + "error" + "i" "j" + "long" + "wide" + "xi" "xij") + font-lock-type-face) + "\\b" + )) + ;; the return commands + (eval-when-compile + (make-regexps + "[ \t]+" + '(("ret" "retu" "retur" "return") font-lock-reference-face) + "[ \t]+" + '(("add" "clear" "local" "matrix" "scalar") font-lock-type-face) + "\\b" + )) + (eval-when-compile + (make-regexps + "[ \t]+" + '(("sret" "sretu" "sretur" "sreturn") font-lock-reference-face) + "[ \t]+" + '(("clear" "local") font-lock-type-face) + "\\b" + )) + ;; the sts commands + (eval-when-compile + (make-regexps + "[ \t]+" + '(("sts") font-lock-reference-face) + "[ \t]+" + '(( + "g" + "gen" "gene" "gener" "genera" "generat" "generate" + "gr" "gra" "grap" "graph" + "l" "li" "lis" "list" + "t" "te" "tes" "test" + ) + font-lock-type-face) + "\\b" + )) + ;; the sw commands + (eval-when-compile + (make-regexps + "[ \t]+" + '(("sw") font-lock-reference-face) + "[ \t]+" + '(( + "cloglog" "cnreg" "cox" "ereg" "gamma" "glm" "gompertz" "hetprob" + "llogist" "lnormal" "logistic" "logit" "ologit" "oprobit" + "poisson" "probit" "qreg" "reg" "regr" "regre" "regres" "regress" + "scobit" "tobit" "weibull" + ) + font-lock-type-face) + "\\b" + )) + ;; the window commands + (eval-when-compile + (make-regexps + "[ \t]+" + '(( + "win" "wind" "windo" "window" + ) font-lock-reference-face) + "[ \t]+" + '(( + "d" + "di" "dia" "dial" "dialo" "dialog" + "dir" "drop" + "fo" "fop" "fope" "fopen" + "fs" "fsa" "fsav" "fsave" + "l" "list" + "push" + "stop" "stopb" "stopbo" "stopbox" + ) font-lock-type-face) + "\\b" + )) + ;; the window controls + (eval-when-compile + (make-regexps + "[ \t]+" + '(( + "win" "wind" "windo" "window" + ) font-lock-reference-face) + "[ \t]+" + '(( + "c" "co" "con" "cont" "contr" "contro" "control" + ) font-lock-reference-face) + '(( + "button" "check" "clear" + "edit" + "mcombo" "msimple" + "radbegin" + "radend" + "radio" + "scombo" + "ssimple" + "static" + ) font-lock-type-face) + "\\b" + )) + ;; the window manage commands + (eval-when-compile + (make-regexps + "[ \t]+" + '(( + "win" "wind" "windo" "window" + ) font-lock-reference-face) + "[ \t]+" + '(( + "man" "mana" "manag" "manage" + ) font-lock-reference-face) + "[ \t]+" + '(( + "forward" + "minimize" + "prefs load" + "prefs save" + "prefs default" + "print graph" + "print log" + "restore" + "update variable" + ) + font-lock-type-face) + "\\b" + )) + ;; the window menu commands + (eval-when-compile + (make-regexps + "[ \t]+" + '(( + "win" "wind" "windo" "window" + ) font-lock-reference-face) + "[ \t]+" + '(( + "m" "me" "men" "menu" + ) font-lock-reference-face) + "[ \t]+" + '(( + "append popout" + "append string" + "append separator" + "clear" + "popout" + "set" + ) + font-lock-type-face) + "\\b" + )) + ;; the xwindow commands + (eval-when-compile + (make-regexps + "[ \t]+" + '(( + "xwin" "xwind" "xwindo" "xwindow" + ) font-lock-reference-face) + "[ \t]+" + '(( + "de" "def" "defi" "defin" "define" + "di" "dir" + "drop" + "l" "li" "lis" "list" + ) + font-lock-type-face) + "\\b" + )) + + ;; all the endless Stata keywords (not in a good order) + ;; first those keywords which must start line + ;; note that these will look like text if preceded by a comment + ;; (but comments shouldn't be before the command, anyway) + + (eval-when-compile + (make-regexps + "^[ \t]+" + '(( + "cap" "capt" "captu" "captur" "capture" + "char" "err" "erro" "error" "e" "ex" "exi" "exit" + "par" "pars" "parse" + "set" + ) font-lock-reference-face) + "\\b" + )) + ;; here are some keywords which appear in the middle of lines + ;; note that the really short abbreviations could make a mess of things + ;; + ;; These are split to allow compiling! + (eval-when-compile + (make-regexps + "\\b" + '(( + "_huber" "_qreg" "_robust" + "acprplot" "adjust" + "adopath" "alpha" + "an" "ano" "anov" "anova" "arch" + "areg" "arima" + "as" "ass" "asse" "asser" "assert" + "avplot" "avplots" + "bcskew0" + "be" "bee" "beep" + "biprobit" "bitest" "bitesti" "blogit" + "boxcox" "bprobit" "br" "break" "brier" + "bro" "brow" "brows" "browse" + "bsqreg" "bstat" "by" + "canon" "cat" "cc" "cci" "cchart" "centile" "cf" "ci" "cii" + "clogi" "clogit" "clogitp" "cloglog" + "close" "cmdtool" + "cnr" "cnre" "cnreg" "cnsreg" "codebook" "compare" + "copy" + "cor" "corc" "corr" "corre" "correl" "correla" "correlat" "correlate" + "corrgram" + "cou" "coun" "count" + "cox" "cprplot" "_crcswxx" "cs" "csi" + "ct" "ctset" "cttost" + "cumul" "cusum") + font-lock-reference-face) + "\\b" + )) + (eval-when-compile + (make-regexps + "[ \t]+" + '(( + "d" "de" "des" "desc" "descr" "descri" "describ" "describe" + "dfbeta" "dfuller" "di" + "dir" "dis" "disp" "disp_res" "disp_s" + "displ" "displa" "display" + "do" "dotplot" + "dprobit" "ds" "dstdize" "dwstat" + "eivreg" "eq" "ereg" + "fac" "fact" "facto" "factor" + "fit" "for" "fpredict" + "fracplot" "fracpoly" "fsl" + ) font-lock-reference-face) + "\\b" + )) + (eval-when-compile + (make-regexps + "[ \t]+" + '(( + "gettoken" "gladder" "glm" "glmpred" "glogit" "gnbreg" "gompertz" + "gphdot" "gphpen" "graph" "gprobit" "greigen" "grmeanby" + "hadimvo" "hausman" "heckman" "heckprob" "hetprob" "hettest" "hilite" + "hist" "hlu" "hotel" + "iqreg" "istdize" "iis" + "ins" "insp" "inspe" "inspec" "inspect" + "integ" "intreg" "ir" "iri" "ivreg" + "kap" "kappa" "kapwgt" "kdensity" "ksm" "ksmirnov" "ktau" + "kwallis" + ) font-lock-reference-face) + "\\b" + )) + (eval-when-compile + (make-regexps + "[ \t]+" + '(( + "l" "ladder" "lfit" "lincom" "linktest" + "li" "lis" "list" + "log" + "logistic" + "logi" "logit" + "loneway" "lookfor" + "lo" "loo" "look" "looku" "lookup" + "lpredict" "lroc" "lrtest" "ls" "lsens" "lstat" "ltable" "lv" "lvr2plot" + "man" "matcproc" "mcc" "mcci" + "means" + "mlog" "mlogi" "mlogit" + "mor" "more" + "mvreg" "mx_param" + "n" "nbreg" "newey" "news" + "nl" "nlinit" + "no" "noi" "nois" "noisi" "noisil" "noisily" + "note" "notes" + "nptrend" "numlist" + "olog" "ologi" "ologit" + "ologitp" + "on" "one" "onew" "onewa" "oneway" + "oprob" "oprobi" "oprobit" + "oprobitp" + "orthog" "orthpoly" + "ovtest") + font-lock-reference-face) + "\\b" + )) + (eval-when-compile + (make-regexps + "[ \t]+" + '(("pac" "pchart" "pchi" "pcorr" "pergram" + "pl" "plo" "plot" + "pnorm" "poisgof" "poisson" "pperron" + "prais" + "prob" "probi" "probit" + "prtest" "prtesti" + "pwcorr" "pwd" + "q" "qchi" "qnorm" "qqplot" "qreg" "quadchk" "quantile" + "qu" "que" "quer" "query" + "qui" "quie" "quiet" "quietl" "quietly" + "ranksum" "rchart" "regdw" "regph" + "reg" "reg3" "regr" "regre" "regres" "regress" "reshape" + "rot" "rota" "rotat" "rotate" + "rreg" + "run" "runtest" "rvfplot" "rvpplot" + ) font-lock-reference-face) + "\\b" + )) + (eval-when-compile + (make-regexps + "[ \t]+" + '(( + "sampsi" "sconfirm" + "sco" "scobit" "scor" "score" + "sdtest" "sdtesti" "search" "serrbar" + "sfrancia" "shell" "shelltool" "shewhart" "signrank" "signtest" + "sktest" "slog" "spearman" "spikeplt" "sqreg" + "st" "st_is" "st_show" "st_ct" + "stcox" "stcoxkm" "stcurv" "stdes" + "stem" + "stereg" "stir" "stmc" "stmh" "stphplot" "stphtest" + "strate" "streg" + "sts" "stse" "stset" "stsum" "stvary" "stweib" + "su" "sum" "summ" "summa" "summar" "summari" "summariz" "summarize" + "sureg" + "svydes" "svyintrg" "svyivreg" "svylc" "svylogit" + "svymean" "svymean" "svymlog" "svyolog" "svyoprob" "svypois" "svyprobt" + "svyprop" "svyratio" "svyreg" "svyset" "svytab" "svytest" "svytotal" + "swilk" "symmetry" "symmi" "symplot" "syntax" "sysdir" + ) font-lock-reference-face) + "\\b" + )) + (eval-when-compile + (make-regexps + "[ \t]+" + '(( + "ta" "tab" + "tab1" "tab2" + "tabdisp" + "tabi" + "table" + "tabu" "tabul" "tabula" "tabulat" "tabulate" + "te" "tes" "test" + "testnl" "testparm" "tis" + "tob" "tobi" "tobit" + "token" "tokeni" "tokeniz" "tokenize" + "touch" "tsreport" "tsset" "tsunab" "ttest" "ttesti" + "ty" "typ" "type" + "unab" "using" + "vce" + "verinst" "vif" "vwls" + "weibull" "which" "who" "wntestb" "wntestq" + "xchart" "xcorr" + "xtclog" "xtdes" "xtgee" "xtgls" "xthaus" "xtintreg" + "xtlogit" "xtnbreg" "xtpois" "xtprobit" + "xtrchh" "xtreg" "xtsum" "xttab" "xttest0" "xttobit" "xttrans" + "zip" "zinb" + ) font-lock-reference-face) + "\\b" + )) + + ;; conditional statements + ;; if might not work right ('cuz it is also a keyword) + (eval-when-compile + (make-regexps + "^[ \t]*\\sw+[ \t]*" + '(("if" + ) font-lock-reference-face t t) + "\\b" + )) + + (eval-when-compile + (make-regexps + "^[ \t]*" + '(("if" "while" + ) font-lock-reference-face t t) + "[ \t]+.*{" + )) + ;; else statement (which must just have a {) + (eval-when-compile + (make-regexps + "^[ \t]*" + '(("else" + ) font-lock-reference-face) + "[ \t]*{" + )) + + ;; short version of list --- which can get fooled if used as a var + (eval-when-compile + (make-regexps + '(("^[ \t]*l\\b" + ) font-lock-reference-face) + )) + + ;; all the Stata options + ;; commonly used options + (eval-when-compile + (make-regexps + "[ \t]+" + '(("byte" "int" "long" "str[1-9]+[0-9]?" "float" "double" + "width" "maxobs" "maxvar" + ) font-lock-type-face) + "[ \t]+" + )) + ;; special local variables (used in parsing) + (eval-when-compile + (make-regexps + "^[ \t]+\\(local\\)+[ \t]+" + '(("varlist" "exp" "weight" "if" "in" "using" "options" + ) font-lock-type-face nil t t) + "\\b" + )) + + ;; things used with display + ;; since these are often split across lines, and Stata commands are hard + ;; to delimit, this will highlight even if out of context + + (eval-when-compile + (make-regexps + "[ \t]+" + '(( + "_c" "_co" "_con" "_cont" "_conti" "_contin" "_continu" "_continue" + "_n" "_ne" "_new" "_newl" "_newli" "_newlin" "_newline" + "_quote" + "_r" "_re" "_req" "_requ" "_reque" "_reques" "_request" + ) + font-lock-type-face) + "\\b" + )) + (eval-when-compile + (make-regexps + "[ \t]+" + '(( + "_col" "_colu" "_colum" "_column" + "_d" "_du" "_dup" + "_s" "_sk" "_ski" "_skip" + ) + font-lock-type-face) + "([1-9]+[0-9]*)\\b" + )) + (eval-when-compile + (make-regexps + "\\bin[ \t]+" + '(( + "b" "bl" "blu" "blue" + "g" "gr" "gre" "gree" "green" + "r" "re" "red" + "w" "wh" "whi" "whit" "white" + "y" "ye" "yel" "yell" "yello" "yellow" + ) font-lock-type-face) + "\\b" + )) + + ;; labels + (eval-when-compile + (make-regexps + "[ \t]+" + '(("lab" "labe" "label" + ) font-lock-reference-face t) + "[ \t]+" + '(( + "da" "dat" "data" + "de" "def" "defi" "defin" "define" + "di" "dir" + "drop" + "l" "li" "lis" "list" + "save" + "val" "valu" "value" "values" + "var" "vari" "varia" "variab" "variabl" "variable" + ) font-lock-type-face nil t t) + "[ \t]" + )) + + ;; all Stata data-altering stuff + (eval-when-compile + (make-regexps + "\\b" + '(( + "_pctile" "_predict" + "aorder" "append" + "bcskew0" "bsample" "bs" "bstrap" + "cd" "chdir" "clear" "compress" + "contract" "convert" "cross" + "dec" "deco" "decod" "decode" + "discard" "drop" "dydx" + "ed" "edi" "edit" "egen" + "en" "enc" "enco" "encod" "encode" + "erase" + "expand" + "fillin" + "form" "forma" "format" + "fracgen" "fracpred" + "g" "ge" "gen" "gene" "gener" "genera" "generat" "generate" + "gsort" + "impute" + "infile" "infix" "input" "insheet" "integ" "ipolate" + "joinby" + "keep" + "lnskew0" + ) font-lock-keyword-face) + "\\b" + )) + (eval-when-compile + (make-regexps + "\\b" + '(( + "mark" "markout" "marksample" + "matname" + "mer" "merg" "merge" + "mkdir" "mkmat" "mkspline" + "mleval" "mlmatsum" "mlsum""mlvecsum" + "modify" "mov" "move" + "mvdecode" "mvencode" "nlpred" "nobreak" "order" + "ou" "out" "outf" "outfi" "outfil" "outfile" + "outs" "outsh" "outshe" "outshee" "outsheet" + "pctile" + "post" "postclose" "postfile" + "pre" "pred" "predi" "predic" "predict" + "preserve" "range" + "recast" "recode" + "ren" "rena" "renam" "rename" + "renpfix" "replace" "restore" "rm" + "sappend" + "sa" "sav" "save" + "sample" "sdrop" + "separate" + "simul" "sinfile" "smerge" + "smooth" "snapspan" + "so" "sor" "sort" + "ssave" "ssort" "stack" + "stbase" "stfill" "stgen" "stjoin" "stsplit" "sttocc" "sttoct" + "suse" "svmat" + "tsfill" "tsrevar" + "u" "us" "use" + "xi" "xi:" "xtile" "xpose" + "xtdata" "xtpred" + ) font-lock-keyword-face) + "\\b" + )) + + ;; assignment of macros + (eval-when-compile + (make-regexps + "^[ \t]*" + '(("global" "local" "scalar" + ) font-lock-reference-face) + '(("\\([ \t]+[a-zA-Z_]+[a-zA-Z_0-9]*\\b\\)?" + ) font-lock-variable-name-face t) + )) + ;; choosing temp names + (eval-when-compile + (make-regexps + "^[ \t]*" + '(("tempname" "tempfile" "tempvar" + ) font-lock-reference-face) + '(("\\([ \t]+[a-zA-Z_]+[a-zA-Z_0-9`']*\\)+" + ) font-lock-type-face t) + )) + ;; all variable/macro stuff (put late so it will override) + ;; internal constants + (eval-when-compile + (make-regexps + "[^a-zA-Z]" + '(("_merge" "_n" "_pi" "_rc" "_N" + ) font-lock-variable-name-face) + "[^a-zA-Z]" + )) + ;; some generated vars + (eval-when-compile + (make-regexps + '(("_result([1-9]+)" + ) font-lock-variable-name-face) + )) + ;; global macros + (eval-when-compile + (make-regexps + '(("\\$[a-zA-Z_*]+[a-zA-Z_0-9]*" + ) font-lock-variable-name-face t) + )) + ;; local macros + (eval-when-compile + (make-regexps + "`+" + '(("[a-zA-Z_`*]+[a-zA-Z_0-9]*" ;has glitch interior ` is highlighted + ) font-lock-variable-name-face t) + "'+" + )) + ;; other macro commands + (eval-when-compile + (make-regexps + "[ \t]*" + '(( + "ma" "mac" "macr" "macro" + ) font-lock-reference-face) + "[ \t]+" + '(( + "de" "def" "define" + "di" "dir" + "drop" + "l" "li" "lis" "list" + "s" "sh" "shi" "shif" "shift" + ) + font-lock-type-face) + "[ \t]+" + )) + ;; stata 'functions' i.e. things which require () after them + (eval-when-compile + (make-regexps + "\\b" + '(("_caller" + "abs" "acos" "asin" "atan" "autocode" + "Binomial" + "binorm" + "chiprob" "comb" "cond" "cos" + "d" "date" "digamma" "day" + "dofh" "dofm" "dofq" "dofw" "dofy" "dow" "doy" + "e" "exp" + "float" "fprob" "gammap" "get" "group" + "h" "halfyear" "halfyearly" "hofd" + "ibeta" "index" "int" + "invbinomial" "invchi" "invfprob" "invgammap" "invnchi" "invnorm" "invt" + "length" "ln" "lnfact" "lngamma" "log" "log10" "lower" "ltrim" + "m" "matrix" "max" "mdy" "min" "missing" "mod" "mofd" "month" "monthly" + "nchi" "normd" "normprob" "npnchi" + "q" "qofd" "quarter" "quarterly" + "r" "real" "recode" "reldif" "replay" "return" "round" "rtrim" + "s" "scalar" "sign" "sin" "sqrt" "string" "substr" "sum" + "tan" "tprob" "trigamma" "trim" + "uniform" "uniform0" "upper" + "w" "week" "weekly" "wofd" + "y" "year" "yearly" "yh" "ym" "yofd" "yq" "yw" + ) + font-lock-reference-face t) + "(" + )) + ;; stata 'functions' i.e. things which require [] after them + (eval-when-compile + (make-regexps + "\\b" + '(("_b" "_coef" "_se") + font-lock-reference-face t) + "\\[" + )) + ;; common Stata options which require a () after them + (eval-when-compile + (make-regexps + "[, \t]+" + '(("bands" "by" "connect" "density" "gap" "iterate" "ltolerance" "margin" + "psize" "saving" "tlabel" "tolerance" + "xlabel" "xscale" "ylabel" "yscale") + font-lock-type-face t) + "(" + )) + ;; egen 'function' options + (eval-when-compile + (make-regexps + "[ \t]*egen[ \t]+.*=[ \t]*" + '(("count" "diff" "fill" "group" "iqr" + "ma" "max" "mean" "median" "min" "mtr" "pctile" + "rank" "rfirst" "rlast" "rmax" "rmean" "rmin" "rmiss" "robs" "rsd" "rsum" + "sd" "std" "sum") + font-lock-reference-face t) + "(.*)" + )) + ;; All Custom ado files which are 'reliable' and which are not file killers + ;; this might be a useless endeavor --- but I cannot generate tag files + ;; all the s-extensions are listed under Stata's name (since they alter + ;; data and will be moved to the utils directory + (eval-when-compile + (make-regexps + "[ \t]*" + '(("addnote" "anypath" "autolab" "checkvar" "ck1icd9" "ckicd9" + "datetoe" "dattomdy" "den2dem" "dishis" "dtapath" "dupclean" "echo" + "exdupbil" "ezip2hsa" "getdate" "getlbl" "getnames" "getobs" "gplur" + "icd9" "issorted" "isfile" "jultoe" "jultof" "jultomdy" "knowndup" + "labeldir" "linker" + "markit" "makewide" "missize" "mpcounts" + "nodups" "notefile" "prov2zip" + "qcolsum" "qorder" + "random" "readraw" "readzip" "repart" + "setup" "stdrate" + "timeslot" + "wdatetoe" "wdatomdy" "zip2ezip" + "_addext" "_brclean" "_brckado" "_brdlog" + "_ckbad" "_ckdunno" "_ckdupl" "_ckmiss" "_ckok" "_ckwarn" + "_delimit" "_filenm" "_lookup" "_mk_ck" + ) font-lock-function-name-face) + "\\b" + )) + )) + + +(defvar ess-STA-mode-font-lock-defaults (ado-set-font-lock-keywords) + "Set the Stata mode font-lock keywords to Bill Rising's ado-mode keywords.") + +(defvar STA-editing-alist + '((paragraph-start . (concat "[ \t\f]*$\\|" page-delimiter)) + (paragraph-separate . (concat "[ \t\f]*$\\|" page-delimiter)) + (paragraph-ignore-fill-prefix . t) + (require-final-newline . mode-require-final-newline) + (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 . STA-syntax-table) + (font-lock-defaults . '(ess-STA-mode-font-lock-defaults + nil nil ((?\. . "w"))))) + "General options for editing Stata do and ado source files.") + +;; YOU USED TO HAVE TO (with Thomas's version): +;;;;; Add the following to your .emacs file +;; +;;(autoload 'stata "~/ess-sta-l.el" "inferior stata mode" t ) +;;(autoload 'stata-help "stata" "stata help mode" t) +;;(autoload 'stata-mode "~/ess-sta-l.el" "stata mode" t) +;; +;;(if (assoc "\\.do$" auto-mode-alist) nil +;; (setq auto-mode-alist +;; (append +;; '(("\\.do$" . stata-mode) +;; ("\\.ado$" . stata-mode)) +;; auto-mode-alist))) +;; + + +;; QUESTIONS TO ASK THOMAS: +;; 1 - are 'help' and 'lookup' the same? +;; 2 - what is the point of the review buffer? +;; 3 - how to quit? + +;; +;; NOTE: all of Thomas's functions have been left here, to be removed +;; or merged into real locations as we work on this. +;; + + +;;;;;;;;; Things to change + +(defvar stata-switches "-q" + "*Switches to apply to stata invocation.") + +(defvar stata-profile "~/.stataprofile" + "File to read on startup (nil for no file).") + +(define-obsolete-function-alias 'stata-help 'ess-display-help-on-object "ESS[15.09]") +(define-obsolete-function-alias 'stata-lookup 'ess-display-help-apropos "ESS[16.03]") + +;; fixme? Hook this on C-c C-s /ess-execute-search does an R search() right now/ +(defun stata-variables () + "Stata variable list in other buffer." + (interactive) + (let* ((stata-process (get-process "stata")) + (stata-buffer (if stata-process + (process-buffer stata-process) + (error "Stata is not running."))) + oldpf oldpb oldpm) + (set-buffer stata-buffer) + (setq oldpf (process-filter stata-process)) + (setq oldpb (process-buffer stata-process)) + (setq oldpm (marker-position (process-mark stata-process))) + (save-excursion + (if stata-process nil (error "Stata is not running.")) + (beginning-of-line) + (if (looking-at ". ") nil (error "Stata not ready.")) + (save-excursion + (set-process-buffer stata-process + (get-buffer-create "*stata variables*")) + (set-process-filter stata-process 'inferior-ess-ordinary-filter) + (set-buffer "*stata variables*") + (setq buffer-read-only nil) + (erase-buffer) + (process-send-string stata-process "desc \n ") + (stata-prompt-wait stata-process) + (setq buffer-read-only t) + (set-buffer stata-buffer) + (set-process-buffer stata-process oldpb) + (set-marker (process-mark stata-process) oldpm) + (set-process-filter stata-process oldpf))) + (display-buffer "*stata variables*") + (goto-char (point-max)))) + +;;;; +;;; This doesn't do anything at the moment. I have vague plans of +;;; implementing a menu interface using emacs +;;; +(defun stata-watch-for-menu-filter (proc string) + (if (string-match "^!!!window!!!" string) + (stata-handle-menu-code proc string) + (comint-output-filter proc string))) + +(defun stata-handle-menu-code (proc string) + (let ((old-buffer (current-buffer))) + (unwind-protect + (let (moving) + (set-buffer (process-buffer proc)) + (setq moving (= (point) + (process-mark proc))) + (save-excursion + ;; Insert the text, moving the process-marker. + (goto-char (process-mark proc)) + (insert "Handling menu code\n") + (set-marker (process-mark proc) (point))) + (if moving (goto-char (process-mark proc)))) + (set-buffer old-buffer)))) + +;;;; + +(defun stata-prompt-wait (proc &optional start-of-output) + "Wait for a prompt to appear at BOL of current buffer. +PROC is the stata 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 50) + (goto-char (marker-position (process-mark proc))) + (beginning-of-line) + (if (< (point) start-of-output) (goto-char start-of-output)) + (not (looking-at "^. ")))))) + +(defun stata-help-mode () + "Major mode for displaying Stata help in a read-only buffer. +Active commands are Help (\\[stata-help]) and hyperlink +(\\[stata-rehelp] or mouse-2)." + (interactive) + (setq major-mode 'stata-help-mode) + (setq mode-name "Stata help") + ;;(use-local-map stata-help-mode-map) + (setq buffer-read-only t)) + +;;; Suggested function from Brendan Halpin: +(defvar ess-STA-delimit-do-file "delimit-do.do") + +(defun ess-STA-delimit-do () + (save-excursion + (let ((commands (buffer-substring-no-properties (region-beginning) + (region-end)))) + (set-buffer (get-buffer-create ess-STA-delimit-do-file)) + (delete-region (point-min) (point-max)) + (insert "#delimit ;\n" + commands + "\n#delimit cr\n") + (write-file ess-STA-delimit-do-file nil) + (comint-send-string "Stata" + (format "do %s \n" ess-STA-delimit-do-file))))) +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + + +(provide 'ess-stata-lang) + + ; Local variables section + +;;; This file is automatically placed in Outline minor mode. +;;; The file is structured as follows: +;;; Chapters: ^L ; +;;; Sections: ;;*;; +;;; Subsections: ;;;*;;; +;;; Components: defuns, defvars, defconsts +;;; Random code beginning with a ;;;;* comment + +;;; Local variables: +;;; mode: emacs-lisp +;;; outline-minor-mode: nil +;;; mode: outline-minor +;;; outline-regexp: "\^L\\|\\`;\\|;;\\*\\|;;;\\*\\|(def[cvu]\\|(setq\\|;;;;\\*" +;;; End: + +;;; ess-stata-lang.el ends here diff -Nru ess-16.10/lisp/ess-stata-mode.el ess-17.11/lisp/ess-stata-mode.el --- ess-16.10/lisp/ess-stata-mode.el 1970-01-01 00:00:00.000000000 +0000 +++ ess-17.11/lisp/ess-stata-mode.el 2017-11-13 14:13:16.000000000 +0000 @@ -0,0 +1,187 @@ +;;; 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 +;; Created: 9 Sep 1998 +;; Maintainer: ESS-core + +;; 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 . + +;;; Code: + +(autoload 'inferior-ess "ess-inf" "Run an ESS process.") +(autoload 'ess-mode "ess-mode" "Edit an ESS process.") + +(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-name) + (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") + ) + "Variables to customize for Stata.") + + +(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) + + +(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) + + ; Local variables section + +;;; This file is automatically placed in Outline minor mode. +;;; The file is structured as follows: +;;; Chapters: ^L ; +;;; Sections: ;;*;; +;;; Subsections: ;;;*;;; +;;; Components: defuns, defvars, defconsts +;;; Random code beginning with a ;;;;* comment + +;;; Local variables: +;;; mode: emacs-lisp +;;; outline-minor-mode: nil +;;; mode: outline-minor +;;; outline-regexp: "\^L\\|\\`;\\|;;\\*\\|;;;\\*\\|(def[cvu]\\|(setq\\|;;;;\\*" +;;; End: + +;;; ess-stata-mode.el ends here diff -Nru ess-16.10/lisp/ess-swv.el ess-17.11/lisp/ess-swv.el --- ess-16.10/lisp/ess-swv.el 2015-12-11 12:17:11.000000000 +0000 +++ ess-17.11/lisp/ess-swv.el 2017-11-13 14:13:17.000000000 +0000 @@ -82,10 +82,11 @@ (eval-when-compile (require 'ess-custom) - (require 'ess) - ) + (require 'ess)) + +(require 'ess-utils) (require 'ess-noweb-mode) -(require 'ess-r-d); for Rnw-mode +(require 'ess-r-mode); for Rnw-mode (require 'easymenu) ;; currently use exactly for "Sweave", "Stangle", "knit", and "purl" @@ -404,19 +405,9 @@ :style toggle :selected ess-swv-plug-into-AUCTeX-p] )) -(if (featurep 'xemacs) - (add-hook 'Rnw-mode-hook - (lambda () - ;; This adds to top menu: - ;; (easy-menu-add ess-swv-menu ess-noweb-minor-mode-map) - ;; But that's using an unnecessary extra level -- FIXME - (easy-menu-add-item ess-noweb-minor-mode-menu - '("Sweave");; 'nil' adds to top - ess-swv-menu))) - ;; normal GNU Emacs: - (easy-menu-add-item ess-noweb-minor-mode-menu - nil ;; <= path - ess-swv-menu)) +(easy-menu-add-item ess-noweb-minor-mode-menu + nil ;; <= path + ess-swv-menu) ; provides @@ -424,19 +415,19 @@ ; Local variables section -;;; This file is automatically placed in Outline minor mode. -;;; The file is structured as follows: -;;; Chapters: ^L ; -;;; Sections: ;;*;; -;;; Subsections: ;;;*;;; -;;; Components: defuns, defvars, defconsts -;;; Random code beginning with a ;;;;* comment - -;;; Local variables: -;;; mode: emacs-lisp -;;; outline-minor-mode: nil -;;; mode: outline-minor -;;; outline-regexp: "\^L\\|\\`;\\|;;\\*\\|;;;\\*\\|(def[cvu]\\|(setq\\|;;;;\\*" -;;; End: +;; This file is automatically placed in Outline minor mode. +;; The file is structured as follows: +;; Chapters: ^L ; +;; Sections: ;;*;; +;; Subsections: ;;;*;;; +;; Components: defuns, defvars, defconsts +;; Random code beginning with a ;;;;* comment + +;; Local variables: +;; mode: emacs-lisp +;; outline-minor-mode: nil +;; mode: outline-minor +;; outline-regexp: "\^L\\|\\`;\\|;;\\*\\|;;;\\*\\|(def[cvu]\\|(setq\\|;;;;\\*" +;; End: ;;; ess-swv.el ends here diff -Nru ess-16.10/lisp/ess-toolbar.el ess-17.11/lisp/ess-toolbar.el --- ess-16.10/lisp/ess-toolbar.el 2014-10-28 18:15:42.000000000 +0000 +++ ess-17.11/lisp/ess-toolbar.el 2017-11-13 14:13:17.000000000 +0000 @@ -45,13 +45,6 @@ ;;; Technical issues. -;; Emacs vs XEmacs. -;; Of course, Emacs and XEmacs have different interfaces and handle -;; the toolbars in different ways. The code here is rough, but -;; hopefully soon a compatibility toolbar library will be released -;; that will make the toolbar code more portable. So, for now the -;; code should be regarded as proof of concept. - ;; 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.) @@ -65,28 +58,21 @@ :prefix "ess-") (defcustom ess-use-toolbar - (if (featurep 'xemacs) - (memq (device-type) '(x gtk mswindows)) - (and (fboundp 'display-images-p) (display-images-p))) - "*Non-nil means ESS should support the toolbar. -Currently works only under Emacs 21 and maybe XEmacs 21.4." - :group 'ess-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. + "Non-nil means that we only put our toolbar entries in ESS. Otherwise we get standard toolbar as well as ESS entries. -Under Emacs, the standard toolbar items are copied from the default toolbar. -Under XEmacs, the items stored in `ess-toolbar-xemacs-general' are added." - :group 'ess-toolbar +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." - :group 'ess-toolbar :type 'boolean) (defcustom ess-toolbar-items @@ -114,7 +100,6 @@ `ess-make-toolbar' afterwards. Instead, change its value using Custom, and then on all new ESS buffers you should see the toolbar has changed." - :group 'ess-toolbar :set (lambda (symbol value) (set-default symbol value) (if (fboundp 'ess-make-toolbar) @@ -124,7 +109,7 @@ (string :tag "Tooltip")))) (defvar ess-icon-directory - (expand-file-name (concat (file-name-as-directory ess-etc-directory) "icons")) + (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. @@ -140,76 +125,33 @@ (defun ess-make-toolbar () "Make the ESS toolbar." - (if (featurep 'xemacs) - (ess-make-toolbar-xemacs) - ;; 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. - (if (boundp 'tool-bar-map) - (ess-make-toolbar-emacs)))) - -(defun ess-make-toolbar-emacs () - "Make the ESS toolbar under Emacs." - (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-emacs ess-toolbar-items))) + ;; 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-emacs (x) +(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-icon-xemacs (x) - "Return a 4-vector containing the spec for an ESS toolbar entry in XEmacs." - (vector - (toolbar-make-button-list - (expand-file-name (concat (cadr x) ".xpm") ess-icon-directory)) - (car x) ;function - t - (nth 2 x) ;doc string - )) - -(defvar ess-toolbar-xemacs-general - (list - [toolbar-file-icon toolbar-open t "Open a file"] - [toolbar-disk-icon toolbar-save t "Save buffer"] - [toolbar-printer-icon generic-print-buffer t "Print buffer"] - [toolbar-cut-icon toolbar-cut t "Kill region"] - [toolbar-copy-icon toolbar-copy t "Copy region"] - [toolbar-paste-icon toolbar-paste t "Paste from clipboard"] - [toolbar-undo-icon toolbar-undo t "Undo edit"] - [toolbar-replace-icon toolbar-replace t "Search & Replace"] - [:style 3d] - ) - "General Xemacs icons to be added iff `ess-toolbar-own-icons' is non-nil. -These toolbar items were taken from the list that John Fox's code provided. -Each vector is of length four specifying: 1 - icon; 2 - function to call; -3 - whether to activate; 4 - doc string.") - -(defun ess-make-toolbar-xemacs () - "Set up the ESS toolbar for XEmacs." - (setq ess-toolbar - (append (if ess-toolbar-own-icons nil ess-toolbar-xemacs-general) - (mapcar 'ess-add-icon-xemacs ess-toolbar-items))) - ) - (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)) - (if (featurep 'xemacs) - (set-specifier default-toolbar ess-toolbar (current-buffer)) - ;; Support for Emacs - (set (make-local-variable 'tool-bar-map) ess-toolbar)))) + (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. @@ -219,21 +161,11 @@ ;; After making the toolbar, if ESS toolbar is needed globally, ;; add it here. (if ess-toolbar-global - (if (featurep 'xemacs) - ;; Xemacs - (progn - (set-specifier default-toolbar ess-toolbar) - (ess-write-to-dribble-buffer "Creating global XEmacs toolbar")) - ;; Emacs - (setq tool-bar-map ess-toolbar) - (ess-write-to-dribble-buffer "Creating global Emacs toolbar")) - ) + (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 - ;; XEmacs test for image support, adapted from vm-version.el: - (and (featurep 'xemacs) (memq (device-type) '(x gtk mswindows))) - ;; ;; Emacs support for images: (and (fboundp 'display-images-p) (display-images-p)) ;; if above tests failed, give a warning. diff -Nru ess-16.10/lisp/ess-tracebug.el ess-17.11/lisp/ess-tracebug.el --- ess-16.10/lisp/ess-tracebug.el 2016-10-22 16:03:27.000000000 +0000 +++ ess-17.11/lisp/ess-tracebug.el 2017-11-13 14:13:17.000000000 +0000 @@ -1,6 +1,6 @@ ;; ess-tracebug.el --- Tracing and debugging facilities for ESS. ;; -;; Copyright (C) 2011--2015 A.J. Rossini, Richard M. Heiberger, Martin Maechler, +;; Copyright (C) 2011--2017 A.J. Rossini, Richard M. Heiberger, Martin Maechler, ;; Kurt Hornik, Rodney Sparapani, Stephen Eglen and Vitalie Spinu. ;; ;; Filename: ess-tracebug.el @@ -51,11 +51,12 @@ ;; ;;; Code: -(eval-when-compile - (require 'tramp) - (require 'compile) - (require 'overlay) - (require 'cl)) +(require 'tramp) +(require 'compile) +(require 'overlay) +;; We can't use cl-lib whilst supporting Emacs <= 24.2 users +(with-no-warnings (require 'cl)) +(require 'ess-utils) (autoload 'ess-helpobjs-at-point "ess-help" "[autoload]" nil) ;;todo: rename and put into a more neutral place (defvar text-scale-mode-amount) @@ -67,6 +68,16 @@ :link '(emacs-library-link :tag "Source Lisp File" "ess-tracebug.el") :group 'ess) +(defvar ess-tracebug-indicator " TB" + "String to be displayed in mode-line alongside the process + name. Indicates that ess-tracebug-mode is turned on. ") + +;; (defvar ess--tracebug-p nil +;; "Non nil if ess-tracebug is turned on for current process. +;; Function `ess-tracebug' toggles on/off this variable.") +;; (make-variable-buffer-local 'ess--tracebug-p) +;; (add-to-list 'minor-mode-alist '(ess--tracebug-p ess-tracebug-indicator)) + (defcustom ess-tracebug-prefix nil "*Key to be used as prefix for all ess-tracebug commands. @@ -120,7 +131,7 @@ :group 'ess-tracebug :type 'hook) -(autoload 'ess-dev-map "ess-r-d" "[autoload]" nil) +(autoload 'ess-dev-map "ess-r-mode" "[autoload]" nil) (defvaralias 'ess-tracebug-map 'ess-dev-map) (defvar ess--tracebug-eval-index 0 @@ -603,7 +614,7 @@ (ess-dirs) (message nil) (make-local-variable 'compilation-error-regexp-alist) - (setq compilation-error-regexp-alist ess-R-error-regexp-alist) + (setq compilation-error-regexp-alist ess-r-error-regexp-alist) (make-local-variable 'compilation-search-path) (setq compilation-search-path ess-tracebug-search-path) (ess-setq-vars-local alist) @@ -1119,6 +1130,11 @@ (and (ess-process-live-p) (ess-process-get 'is-recover))) +(defun ess-debug-active-p () + (and (ess-process-live-p) + (or (ess-process-get 'dbg-active) + (ess-process-get 'is-recover)))) + (defvar ess--dbg-regexp-reference "debug \\w+ +\\(.+\\)#\\([0-9]+\\):") (defvar ess--dbg-regexp-jump "debug \\w+ ") ;; debug at ,debug bei ,etc (defvar ess--dbg-regexp-skip @@ -1472,10 +1488,12 @@ If FILENAME is not found at all, ask the user where to find it if `ess--dbg-ask-for-file' is non-nil. Search the directories in `ess-tracebug-search-path'." - (let ((dirs ess-tracebug-search-path) - (spec-dir default-directory) - buffsym buffer thisdir fmts name buffername) - (setq dirs (cons spec-dir dirs)) ;; current does not have priority!! todo:should be R working dir + (let ((dirs (append + (ess-r-package-source-dirs) + (cl-loop for d in ess-tracebug-search-path + append (ess-r-package--all-source-dirs d)))) + buffsym buffer fmts name buffername) + (setq dirs (cons default-directory dirs)) ;; TODO: should be R working dir ;; 1. search already open buffers for match (associated file might not even exist yet) (dolist (bf (buffer-list)) (with-current-buffer bf @@ -1493,13 +1511,11 @@ dirs (cons (file-name-directory filename) dirs) filename (file-name-nondirectory filename))) ;; 3. Now search the path. - (while (and (null buffer) - dirs ) - (setq thisdir (car dirs)) - (setq name (expand-file-name filename thisdir) - buffer (and (file-exists-p name) - (find-file-noselect name))) - (setq dirs (cdr dirs))) + (while (and (null buffer) dirs) + (let ((thisdir (pop dirs))) + (setq name (expand-file-name filename thisdir) + buffer (and (file-exists-p name) + (find-file-noselect name))))) ;; 4. Ask for file if not found (tothink: maybe remove this part?) (if (and (null buffer) ess-debug-ask-for-file) @@ -1650,6 +1666,9 @@ "Digit commands in selection mode. If suplied ev must be a proper key event or a string representing the digit." (interactive) + (inferior-ess-force) + (unless (ess--dbg-is-recover-p) + (error "Recover is not active")) (unless ev (setq ev last-command-event)) (let* ((ev-char (if (stringp ev) @@ -1659,70 +1678,68 @@ (mark-pos (marker-position (process-mark proc))) (comint-prompt-read-only nil) prompt depth) - (if (process-get proc 'is-recover) - (with-current-buffer (process-buffer proc) - (goto-char mark-pos) - (save-excursion - (when (re-search-backward "\\(?: \\|^\\)\\([0-9]+\\):[^\t]+Selection:" ess--tb-last-input t) - (setq depth (string-to-number (match-string 1))) - (when (> depth 9) - (setq ev-char (ess-completing-read "Selection" (mapcar 'number-to-string - (number-sequence depth 0 -1)) - nil t ev-char nil))))) - (setq prompt (delete-and-extract-region (point-at-bol) mark-pos)) - (insert (concat prompt ev-char "\n")) - (ess-send-string proc ev-char) - (move-marker (process-mark proc) (max-char))) - (error "Recover is not active")))) + (with-current-buffer (process-buffer proc) + (goto-char mark-pos) + (save-excursion + (when (re-search-backward "\\(?: \\|^\\)\\([0-9]+\\):[^\t]+Selection:" ess--tb-last-input t) + (setq depth (string-to-number (match-string 1))) + (when (> depth 9) + (setq ev-char (ess-completing-read "Selection" (mapcar 'number-to-string + (number-sequence depth 0 -1)) + nil t ev-char nil))))) + (setq prompt (delete-and-extract-region (point-at-bol) mark-pos)) + (insert (concat prompt ev-char "\n")) + (ess-send-string proc ev-char) + (move-marker (process-mark proc) (max-char))))) (defun ess-debug-command-next (&optional ev) "Step next in debug mode. Equivalent to 'n' at the R prompt." (interactive) - (if (not (ess--dbg-is-active-p)) - (error "Debugger is not active") - (if (ess--dbg-is-recover-p) - (ess-send-string (get-process ess-current-process-name) "0") - (ess-send-string (get-process ess-current-process-name) "n")))) + (inferior-ess-force) + (unless (ess--dbg-is-active-p) + (error "Debugger is not active")) + (if (ess--dbg-is-recover-p) + (ess-send-string (ess-get-process) "0") + (ess-send-string (ess-get-process) "n"))) (defun ess-debug-command-next-multi (&optional ev N) "Ask for N and step (n) N times in debug mode." (interactive) - (if (not (ess--dbg-is-active-p)) - (error "Debugger is not active") - (let ((N (or N (read-number "Number of steps: " 10))) - (proc (get-process ess-local-process-name)) - (ess--suppress-next-output? t)) - (while (and (ess--dbg-is-active-p) (> N 0)) - (ess-debug-command-next) - (ess-wait-for-process proc) - (setq N (1- N)))) - (ess-debug-command-next))) + (inferior-ess-force) + (unless (ess--dbg-is-active-p) + (error "Debugger is not active")) + (let ((N (or N (read-number "Number of steps: " 10))) + (ess--suppress-next-output? t)) + (while (and (ess--dbg-is-active-p) (> N 0)) + (ess-debug-command-next) + (ess-wait-for-process) + (setq N (1- N)))) + (ess-debug-command-next)) (defun ess-debug-command-continue-multi (&optional ev N) "Ask for N, and continue (c) N times in debug mode." (interactive) - (if (not (ess--dbg-is-active-p)) - (error "Debugger is not active") - (let ((N (or N (read-number "Number of continuations: " 10))) - (proc (get-process ess-local-process-name)) - (ess--suppress-next-output? t)) - (while (and (ess--dbg-is-active-p) (> N 1)) - (ess-debug-command-continue) - (ess-wait-for-process proc) - (setq N (1- N)))) - (ess-debug-command-continue))) - + (inferior-ess-force) + (unless (ess--dbg-is-active-p) + (error "Debugger is not active")) + (let ((N (or N (read-number "Number of continuations: " 10))) + (ess--suppress-next-output? t)) + (while (and (ess--dbg-is-active-p) (> N 1)) + (ess-debug-command-continue) + (ess-wait-for-process) + (setq N (1- N)))) + (ess-debug-command-continue)) (defun ess-debug-command-up (&optional ev) "Step up one call frame. Equivalent to 'n' at the R prompt." (interactive) - (if (not (ess--dbg-is-active-p)) - (error "Debugger is not active") - (let ((proc (get-process ess-local-process-name))) - (ess-send-string proc - "try(browserSetDebug(), silent=T)\nc\n")))) + (inferior-ess-force) + (unless (ess--dbg-is-active-p) + (error "Debugger is not active")) + (let ((up-cmd "try(browserSetDebug(), silent=T)\nc\n")) + (ess-send-string (ess-get-process) up-cmd))) ;; (defun ess-debug-previous-error (&optional ev) ;; "Go to previous reference during the debug process. @@ -1733,36 +1750,29 @@ (defun ess-debug-command-quit (&optional ev) "Quits the browser/debug in R process. - Equivalent to 'Q' at the R prompt." +Equivalent of `Q' at the R prompt." (interactive) - (let ((proc (get-process ess-current-process-name) )) - (if (not (or (process-get proc 'dbg-active) - (process-get proc 'is-recover))) - (error "Debugger is not active") - (when (ess--dbg-is-recover-p) - (ess-send-string proc "0") + (inferior-ess-force) + (cond ((ess--dbg-is-recover-p) + (ess-send-string (ess-get-process) "0")) ;; if recover is called in a loop the following stalls emacs ;; (ess-wait-for-process proc nil 0.05) - ) - (if (and (process-get proc 'dbg-active) - (not (process-get proc 'is-recover))); still in debug mode - (ess-send-string proc "Q"))))) + ((ess--dbg-is-active-p) + (ess-send-string (ess-get-process) "Q")) + (t + (error "Debugger is not active")))) (defun ess-debug-command-continue (&optional ev) "Continue the code execution. - Equivalent of 'c' at the R prompt." +Equivalent of `c' at the R prompt." (interactive) - (let ((proc (get-process ess-current-process-name))) - (if (not (or (process-get proc 'dbg-active) - (process-get proc 'is-recover))) - (error "Debugger is not active") - (when (ess--dbg-is-recover-p) - (ess-send-string proc "0") - ;; (ess-wait-for-process proc nil 0.05) <- when in a loop, gets stuck - ) ;; get out of recover mode - (if (and (process-get proc 'dbg-active) ; still in debug mode - (not (process-get proc 'is-recover))); still in debug mode - (ess-send-string proc "c"))))) + (inferior-ess-force) + (cond ((ess--dbg-is-recover-p) + (ess-send-string (ess-get-process) "0")) + ((ess--dbg-is-active-p) + (ess-send-string (ess-get-process) "c")) + (t + (error "Debugger is not active")))) (defun ess-tracebug-set-last-input (&rest ARGS) "Move `ess--tb-last-input' marker to the process mark. @@ -2675,7 +2685,7 @@ (interactive) (ess-force-buffer-current "Process to use: ") (let* ((tbuffer (get-buffer-create " *ess-command-output*")) ;; output buffer name is hard-coded in ess-inf.el - (pkg (car (ess-r-package-get-info))) + (pkg (ess-r-package-name)) (all-functions (ess-get-words-from-vector (if pkg (format ".ess_all_functions(c('%s'))\n" pkg) @@ -2781,7 +2791,7 @@ ;; reported as bug#21368 ;; ;; previous-line gets stuck if next char is intangible -;; reported +;; reported ;; (defadvice previous-line (around ess-fix-cursor-stuck-at-intangible-text activate) ;; "When about to move to previous line when next char is ;; intangible, step char backward first" diff -Nru ess-16.10/lisp/ess-trns.el ess-17.11/lisp/ess-trns.el --- ess-16.10/lisp/ess-trns.el 2014-10-28 18:15:42.000000000 +0000 +++ ess-17.11/lisp/ess-trns.el 2017-11-13 14:13:17.000000000 +0000 @@ -90,7 +90,6 @@ (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\C-t" 'ess-execute-in-tb) (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) @@ -135,25 +134,14 @@ ["Switch S process" ess-switch-process t] )) -(unless (featurep 'xemacs) - (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))))) - -(when (featurep 'xemacs) - (defun ess-transcript-mode-xemacs-menu () - "Hook to install `ess-transcript-mode' menu for XEmacs (w/ easymenu)." - (if 'ess-transcript-mode - (easy-menu-add ess-transcript-mode-menu) - (easy-menu-remove ess-transcript-mode-menu))) - - (add-hook 'ess-transcript-mode-hook 'ess-transcript-mode-xemacs-menu)) - +(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)))) (defun ess-transcript-mode (alist &optional proc) "Major mode for manipulating {ESS} transcript files. @@ -175,7 +163,8 @@ (setq major-mode 'ess-transcript-mode) (setq mode-name "ESS Transcript") (use-local-map ess-transcript-mode-map) - (set-syntax-table ess-mode-syntax-table) + (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) @@ -286,8 +275,7 @@ (save-excursion (if do-toggle (setq buffer-read-only nil)) (save-restriction - (unless (featurep 'xemacs) ;; does not exist in xemacs: - (deactivate-mark)) + (deactivate-mark) (narrow-to-region beg end) (goto-char (point-min)) (delete-non-matching-lines ess-prompt-rx) @@ -335,18 +323,18 @@ ; Local variables section -;;; This file is automatically placed in Outline minor mode. -;;; The file is structured as follows: -;;; Chapters: ^L ; -;;; Sections: ;;*;; -;;; Subsections: ;;;*;;; -;;; Components: defuns, defvars, defconsts -;;; Random code beginning with a ;;;;* comment - -;;; Local variables: -;;; mode: emacs-lisp -;;; mode: outline-minor -;;; outline-regexp: "\^L\\|\\`;\\|;;\\*\\|;;;\\*\\|(def[cvu]\\|(setq\\|;;;;\\*" -;;; End: +;; This file is automatically placed in Outline minor mode. +;; The file is structured as follows: +;; Chapters: ^L ; +;; Sections: ;;*;; +;; Subsections: ;;;*;;; +;; Components: defuns, defvars, defconsts +;; Random code beginning with a ;;;;* comment + +;; Local variables: +;; mode: emacs-lisp +;; mode: outline-minor +;; outline-regexp: "\^L\\|\\`;\\|;;\\*\\|;;;\\*\\|(def[cvu]\\|(setq\\|;;;;\\*" +;; End: ;;; ess-trns.el ends here diff -Nru ess-16.10/lisp/ess-utils.el ess-17.11/lisp/ess-utils.el --- ess-16.10/lisp/ess-utils.el 2016-10-22 16:03:27.000000000 +0000 +++ ess-17.11/lisp/ess-utils.el 2017-11-22 16:28:36.000000000 +0000 @@ -2,7 +2,7 @@ ;; Copyright (C) 1998--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, +;; Copyright (C) 2011--2017 A.J. Rossini, Richard M. Heiberger, Martin Maechler, ;; Kurt Hornik, Rodney Sparapani, Stephen Eglen and Vitalie Spinu. ;; Author: Martin Maechler @@ -28,176 +28,210 @@ (eval-when-compile (require 'tramp) - (require 'cl)) + ;; We can't use cl-lib whilst supporting Emacs <= 24.2 users + (with-no-warnings (require 'cl))) -(defun ess-inside-string-or-comment-p (&optional pos) - "Return non-nil if POSition [defaults to (point)] is inside string or comment - (according to syntax)." - ;;FIXME (defun ess-calculate-indent ..) can do that ... - (interactive) - (setq pos (or pos (point))) - (let ((ppss (syntax-ppss pos))) - (or (car (setq ppss (nthcdr 3 ppss))) - (car (setq ppss (cdr ppss))) - (nth 3 ppss)))) + +;;*;; Internal ESS tools and variables +(defvar ess-lisp-directory + (directory-file-name + (file-name-directory + (if load-file-name + (file-truename load-file-name) + (locate-library "ess-utils") ))) + "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.") + +;; Try to detect the `etc' folder only if not alread set up by distribution +(unless ess-etc-directory + (let ((path-list '("../etc/ess/" "../etc/" "../../etc/ess/" "./etc/"))) + (while (and (listp path-list) (consp path-list)) + (setq ess-etc-directory + (expand-file-name (concat ess-lisp-directory "/" + (car path-list)))) + (if (file-directory-p ess-etc-directory) + (setq path-list nil) + (setq ess-etc-directory nil) + (setq path-list (cdr path-list)) + (when (null path-list) + (beep 0) (beep 0) + (message (concat + "ERROR:ess-etc-directory\n" + "Relative to ess-lisp-directory, one of the following must exist:\n" + "../etc/ess, ../etc, ../../etc/ess or ./etc")) + (sit-for 4)))))) + +(defun ess-message (format-string &rest args) + "Shortcut for \\[message] only if `ess-show-load-messages' is non-nil." + (when (bound-and-true-p ess-show-load-messages) + (message format-string args))) + + +;;*;; elisp tools + +(defun ess-goto-line (line) + (save-restriction + (widen) + (goto-char (point-min)) + (forward-line (1- line)))) -(defun ess-inside-string-p (&optional pos) - "Return non-nil if point is inside string (according to syntax)." +(defun ess-line-end-position (&optional N) + "return the 'point' at the end of N lines. N defaults to 1, i.e., current line." + (save-excursion + (end-of-line N) + (point))) + +(defun ess-search-except (regexp &optional except backward) + "Search for a regexp, store as match 1, optionally ignore +strings that match exceptions." (interactive) - ;; when narrowing the buffer in iESS the ppss cahce is screwed:( But it is - ;; very fast, so don't bother for now. - (let ((pps (syntax-ppss pos))) - (nth 3 pps)) - ;; (nth 3 (parse-partial-sexp (point-min) pos)) - ) -(defun ess-inside-comment-p (&optional pos) - "Return non-nil if point is inside string (according to syntax)." + (let ((continue t) (exit nil)) + + (while continue + (if (or (and backward (search-backward-regexp regexp nil t)) + (and (not backward) (search-forward-regexp regexp nil t))) + (progn + (setq exit (match-string 1)) + (setq continue (and except (string-match except exit))) + (if continue (setq exit nil))) + ;;else + (setq continue nil)) + ) + + exit)) + +(defun ess-save-and-set-local-variables () + "If buffer was modified, save file and set Local Variables if defined. +Return t if buffer was modified, nil otherwise." (interactive) - (setq pos (or pos (point))) - (save-excursion - (or (when font-lock-mode ;; this is a shortcut (works well usually) - (let ((face (get-char-property pos 'face))) - (eq 'font-lock-comment-face face))) - (nth 4 (parse-partial-sexp (progn (goto-char pos) (point-at-bol)) pos))))) -(defun ess-inside-brackets-p (&optional pos curly?) - "Return t if position POS is inside brackets. -POS defaults to point if no value is given. If curly? is non nil -also return t if inside curly brackets." - (save-excursion - (let ((ppss (syntax-ppss pos)) - (r nil)) - (while (and (> (nth 0 ppss) 0) - (not r)) - (goto-char (nth 1 ppss)) - (when (or (char-equal ?\[ (char-after)) - (and curly? - (char-equal ?\{ (char-after)))) - (setq r t)) - (setq ppss (syntax-ppss))) - r))) + (let ((ess-temp-point (point)) + (ess-temp-return-value (buffer-modified-p))) + ;; if buffer has changed, save buffer now (before potential revert) + (if ess-temp-return-value (save-buffer)) -(defun ess--extract-default-fl-keywords (keywords) - "Extract the t-keywords from `ess-font-lock-keywords'." - (delq nil (mapcar (lambda (c) - (when (cdr c) (symbol-value (car c)))) - (if (symbolp keywords) - (symbol-value keywords) - keywords)))) + ;; If Local Variables are defined, update them now + ;; since they may have changed since the last revert + ;; (save-excursion + (beginning-of-line -1) + (save-match-data + (if (search-forward "End:" nil t) (revert-buffer t t))) + ;; save-excursion doesn't save point in the presence of a revert + ;; so you need to do it yourself + (goto-char ess-temp-point) -(defun ess-font-lock-toggle-keyword (keyword) - (interactive - (list (intern (ess-completing-read - "Keyword to toggle" - (mapcar (lambda (el) (symbol-name (car el))) - (symbol-value ess-font-lock-keywords)) - nil t)))) - (let* ((kwds (symbol-value (if (eq major-mode 'ess-mode) - ess-font-lock-keywords - inferior-ess-font-lock-keywords))) - (kwd (assoc keyword kwds))) - (unless kwd (error "Keyword %s was not found in (inferior-)ess-font-lock-keywords list" keyword)) - (if (cdr kwd) - (setcdr kwd nil) - (setcdr kwd t)) - (let ((mode major-mode) - (dialect ess-dialect) - (fld (ess--extract-default-fl-keywords kwds))) - ;; refresh font-lock defaults in all necessary buffers - (mapc (lambda (b) - (with-current-buffer b - (when (and (eq major-mode mode) - (eq ess-dialect dialect)) - (setcar font-lock-defaults fld) - (font-lock-refresh-defaults)))) - (buffer-list))))) + ess-temp-return-value)) +(defun ess-get-file-or-buffer (file-or-buffer) + "Return file-or-buffer if it is a buffer; otherwise return the buffer +associated with the file which must be qualified by it's path; if the +buffer does not exist, return nil." + (interactive) -(defun ess--generate-font-lock-submenu (menu) - "Internal, used to generate ESS font-lock submenu" - (append (mapcar (lambda (el) - `[,(symbol-name (car el)) - (lambda () (interactive) - (ess-font-lock-toggle-keyword ',(car el))) - :style toggle - :enable t - :selected ,(cdr el)]) - (cond ((eq major-mode 'ess-mode) - (symbol-value ess-font-lock-keywords)) - ((eq major-mode 'inferior-ess-mode) - (symbol-value inferior-ess-font-lock-keywords)))) - (list "-----" - ["Save to custom" (lambda () (interactive) - (let ((kwd (if (eq major-mode 'ess-mode) - ess-font-lock-keywords - inferior-ess-font-lock-keywords))) - (customize-save-variable kwd (symbol-value kwd)))) t]))) + (if file-or-buffer + (if (bufferp file-or-buffer) file-or-buffer + (find-buffer-visiting file-or-buffer)))) +(defun ess-set-local-variables (alist &optional file-or-buffer) + "Set local variables from ALIST in current buffer; if file-or-buffer +is specified, perform action in that buffer." + (interactive) + (if file-or-buffer (set-buffer (ess-get-file-or-buffer file-or-buffer))) + (mapcar (lambda (pair) + (make-local-variable (car pair)) + (set (car pair) (eval (cdr pair)))) + alist)) -(defun ess--generate-eval-visibly-submenu (menu) - '(["yes" (lambda () (interactive) (setq ess-eval-visibly t)) - :style radio :enable t :selected (eq ess-eval-visibly t)] - ["nowait" (lambda () (interactive) (setq ess-eval-visibly 'nowait)) - :style radio :enable t :selected (eq ess-eval-visibly 'nowait) ] - ["no" (lambda () (interactive) (setq ess-eval-visibly nil)) - :style radio :enable t :selected (eq ess-eval-visibly nil) ])) +(defun ess-clone-local-variables (from-file-or-buffer + &optional to-file-or-buffer) + "Clone local variables from one buffer to another buffer." + (interactive) + (ess-set-local-variables + (ess-sas-create-local-variables-alist from-file-or-buffer) + to-file-or-buffer)) +(defun ess-return-list (ess-arg) + "Given an item, if it is a list return it, else return item in a list." + (if (listp ess-arg) ess-arg (list ess-arg))) -(defun ess-quote-special-chars (string) - (replace-regexp-in-string - "\"" "\\\\\\&" - (replace-regexp-in-string ;; replace backslashes - "\\\\" "\\\\" string nil t))) +;; Copyright (C) 1994 Simon Marshall. +;; Author: Simon Marshall +;; LCD Archive Entry: +;; unique|Simon Marshall|Simon.Marshall@mail.esrin.esa.it| +;; Functions and commands to uniquify lists or buffer text (cf. sort). +;; 23-Apr-1994|1.00|~/packages/unique.el.Z| +;; +;; MM: renamed from 'unique' to 'ess-unique', then +(defun ess-uniq (list predicate) + "Uniquify LIST, stably, deleting elements using PREDICATE. +Return the list with subsequent duplicate items removed by side effects. +PREDICATE is called with an element of LIST and a list of elements from LIST, +and should return the list of elements with occurrences of the element removed. +This function will work even if LIST is unsorted. See also `ess-uniq-list'." + (let ((list list)) + (while list + (setq list (setcdr list (funcall predicate (car list) (cdr list)))))) + list) -;; simple alternative to ess-read-object-name-default of ./ess-inf.el : -;; is "wrongly" returning "p1" for word "p1.part2" : -(defun ess-extract-word-name () - "Get the word you're on (cheap algorithm). Use `ess-read-object-name-default' -for a better but slower version." - (save-excursion - (re-search-forward "\\<\\w+\\>" nil t) - (buffer-substring (match-beginning 0) (match-end 0)))) +(defun ess-uniq-list (items) + "Delete all duplicate entries in ITEMS list, calling `ess-uniq'." + (ess-uniq items 'delete)) -(defun ess-rep-regexp (regexp to-string &optional fixedcase literal verbose) - "Instead of (replace-regexp..) -- do NOT replace in strings or comments. - If FIXEDCASE is non-nil, do *not* alter case of replacement text. - If LITERAL is non-nil, do *not* treat `\\' as special. - If VERBOSE is non-nil, (message ..) about replacements." - (let ((case-fold-search (and case-fold-search - (not fixedcase))); t <==> ignore case in search - (ppt (point)); previous point - (p)) - (while (and (setq p (re-search-forward regexp nil t)) - (< ppt p)) - (setq ppt p) - (cond ((not (ess-inside-string-or-comment-p (1- p))) - (if verbose - (let ((beg (match-beginning 0))) - (message "buffer in (match-beg.,p)=(%d,%d) is '%s'" - beg p (buffer-substring beg p)))) - (replace-match to-string fixedcase literal) - ;;or (if verbose (setq pl (append pl (list p)))) - ))) - ;;or (if (and verbose pl) - ;;or (message "s/%s/%s/ at %s" regexp to-string pl)) - ) ) +(defun ess-flatten-list (&rest list) + "Take the arguments and flatten them into one long list. +Drops 'nil' entries." + ;; Taken from lpr.el + ;; `lpr-flatten-list' is defined here (copied from "message.el" and + ;; enhanced to handle dotted pairs as well) until we can get some + ;; sensible autoloads, or `flatten-list' gets put somewhere decent. -(defun ess-replace-regexp-dump-to-src - (regexp to-string &optional dont-query verbose ensure-mode) - "Depending on dont-query, call `ess-rep-regexp' or `query-replace-regexp' -from the beginning of the buffer." + ;; (ess-flatten-list '((a . b) c (d . e) (f g h) i . j)) + ;; => (a b c d e f g h i j) + (ess-flatten-list-1 list)) + +(defun ess-flatten-list-1 (list) + (cond + ((null list) (list)) + ((consp list) + (append (ess-flatten-list-1 (car list)) + (ess-flatten-list-1 (cdr list)))) + (t (list list)))) + +(defun ess-delete-blank-lines () + "Convert 2 or more lines of white space into one." + (interactive) (save-excursion - (if (and ensure-mode - (not (equal major-mode 'ess-mode))) - (ess-mode)) (goto-char (point-min)) - (if dont-query - (ess-rep-regexp regexp to-string nil nil verbose) - (query-replace-regexp regexp to-string nil)))) + (save-match-data + (while (search-forward-regexp "^[ \t]*\n[ \t]*\n" nil t) + ;;(goto-char (match-beginning 0)) + (delete-blank-lines))))) +;; Parse a line into its constituent parts (words separated by +;; whitespace). Return a list of the words. +;; Taken from rlogin.el, from the comint package, from XEmacs 20.3. +(defun ess-line-to-list-of-words (line) + (if (listp line) + line + (let ((list nil) + (posn 0)) + ;; (match-data (match-data))) + (while (string-match "[^ \t\n]+" line posn) + (setq list (cons (substring line (match-beginning 0) (match-end 0)) + list)) + (setq posn (match-end 0))) + (store-match-data (match-data)) + (nreverse list)))) + + +;;*;; System (defun ess-revert-wisely () "Revert from disk if file and buffer last modification times are different." @@ -215,82 +249,6 @@ t) nil)) - -(defun ess-space-around (word &optional from verbose) - "Replace-regexp .. ensuring space around all occurences of WORD, - starting from FROM {defaults to (point)}." - (interactive "d\nP"); Defaults: point and prefix (C-u) - (save-excursion - (goto-char from) - (ess-rep-regexp (concat "\\([^ \t\n]\\)\\(\\<" word "\\>\\)") - "\\1 \\2" nil nil verbose) - (goto-char from) - (ess-rep-regexp (concat "\\(\\<" word "\\>\\)\\([^ \t\n]\\)") - "\\1 \\2" nil nil verbose) - ) - ) - -(defun ess-time-string (&optional clock) - "Returns a string for use as a timestamp. + hr:min if CLOCK is non-nil, - like \"13 Mar 1992\". Redefine to taste." - (format-time-string (concat "%e %b %Y" (if clock ", %H:%M")))) - - -;;- From: friedman@gnu.ai.mit.edu (Noah Friedman) -;;- Date: 12 Feb 1995 21:30:56 -0500 -;;- Newsgroups: gnu.emacs.sources -;;- Subject: nuke-trailing-whitespace -;;- -;;- This is too trivial to make into a big todo with comments and copyright -;;- notices whose length exceed the size of the actual code, so consider it -;;- public domain. Its purpose is along similar lines to that of -;;- `require-final-newline', which is built in. I hope the names make it -;;- obvious. - -;; use -;; (add-hook 'write-file-functions 'ess-nuke-trailing-whitespace) - -(defvar ess-nuke-trailing-whitespace-p nil;disabled by default 'ask - "*[Dis]activates (ess-nuke-trailing-whitespace). - Disabled if `nil'; if `t', it works unconditionally, otherwise, - the user is queried. - Note that setting the default to `t' may not be a good idea when you edit - binary files!") - -;;; MM: Newer Emacsen now have delete-trailing-whitespace -;;; -- but no customization like nuke-trailing-whitespace-p .. -(defun ess-nuke-trailing-whitespace () - "Nuke all trailing whitespace in the buffer. -Whitespace in this case is just spaces or tabs. -This is a useful function to put on write-file-hooks. - -If the variable `ess-nuke-trailing-whitespace-p' is `nil', this function is -disabled. If `t', unreservedly strip trailing whitespace. -If not `nil' and not `t', query for each instance." - (interactive) - (let ((bname (buffer-name))) - (cond ((or - (string= major-mode "rmail-mode") - (string= bname "RMAIL") - nil)); do nothing.. - - (t - (and (not buffer-read-only) - ess-nuke-trailing-whitespace-p - (save-match-data - (save-excursion - (save-restriction - (widen) - (goto-char (point-min)) - (cond ((eq ess-nuke-trailing-whitespace-p t) - (while (re-search-forward "[ \t]+$" (point-max) t) - (delete-region (match-beginning 0) - (match-end 0)))) - (t - (query-replace-regexp "[ \t]+$" ""))))))))) - ;; always return nil, in case this is on write-file-hooks. - nil)) - (defun ess-kermit-get (&optional ess-file-arg ess-dir-arg) "Get a file with Kermit. WARNING: Experimental! From your *shell* buffer, start kermit and then log in to the remote machine. Open @@ -332,131 +290,57 @@ ;; (concat "receive ]" ess-sas-temp-file))) ;; (comint-send-input) ;; (insert (read-string "Press Return when transfer is complete: " nil nil "c")) - ;; (comint-send-input) - (insert (read-string "Press Return when shell is ready: ")) - (comint-send-input) - (switch-to-buffer (find-buffer-visiting ess-temp-file)) - (ess-revert-wisely) - )))) - -(defun ess-kermit-send () - "Send a file with Kermit. WARNING: Experimental! From -a file that starts with `ess-kermit-prefix', -execute this command. It will transfer this file to the remote -directory with the same name, but without the `ess-kermit-prefix'." - - (interactive) - - ;; (save-match-data - (let ((ess-temp-file (expand-file-name (buffer-name))) - (ess-temp-file-remote-directory nil)) - - (if (string-equal ess-kermit-prefix (substring (file-name-nondirectory ess-temp-file) 0 1)) - (progn - ;; I think there is a bug in the buffer-local variable handling in GNU Emacs 21.3 - ;; Setting ess-kermit-remote-directory every time is somehow resetting it to the - ;; default on the second pass. Here's a temporary work-around. It will fail - ;; if you change the default, so maybe this variable should not be customizable. - ;; In any case, there is also trouble with local variables in XEmacs 21.4.9 and - ;; 21.4.10. XEmacs 21.4.8 is fine. - (if (string-equal "." ess-kermit-remote-directory) - (setq ess-kermit-remote-directory (read-string "Remote directory to transfer file to: " - ess-kermit-remote-directory))) - - (setq ess-temp-file-remote-directory ess-kermit-remote-directory) - - ;; (setq ess-temp-file (substring ess-temp-file (match-end 0))) - (ess-sas-goto-shell) - (insert "cd " ess-temp-file-remote-directory "; " ess-kermit-command " -a " - (substring (file-name-nondirectory ess-temp-file) 1) " -g " ess-temp-file) - (comint-send-input) - ;; (insert (read-string "Press Return to connect to Kermit: " nil nil "\C-\\c")) - ;; (comint-send-input) - ;; (insert (read-string "Press Return when Kermit is ready to recieve: " nil nil - ;; (concat "receive ]" ess-sas-temp-file))) - ;; (comint-send-input) - ;; (insert (read-string "Press Return when transfer is complete: " nil nil "c")) - ;; (comint-send-input) - (insert (read-string "Press Return when shell is ready: ")) - (comint-send-input) - (switch-to-buffer (find-buffer-visiting ess-temp-file)) - (ess-revert-wisely) - )))) - -(defun ess-search-except (regexp &optional except backward) - "Search for a regexp, store as match 1, optionally ignore -strings that match exceptions." - (interactive) - - (let ((continue t) (exit nil)) - - (while continue - (if (or (and backward (search-backward-regexp regexp nil t)) - (and (not backward) (search-forward-regexp regexp nil t))) - (progn - (setq exit (match-string 1)) - (setq continue (and except (string-match except exit))) - (if continue (setq exit nil))) - ;;else - (setq continue nil)) - ) - - exit)) - -(defun ess-save-and-set-local-variables () - "If buffer was modified, save file and set Local Variables if defined. -Return t if buffer was modified, nil otherwise." - (interactive) - - (let ((ess-temp-point (point)) - (ess-temp-return-value (buffer-modified-p))) - ;; if buffer has changed, save buffer now (before potential revert) - (if ess-temp-return-value (save-buffer)) - - ;; If Local Variables are defined, update them now - ;; since they may have changed since the last revert - ;; (save-excursion - (beginning-of-line -1) - (save-match-data - (if (search-forward "End:" nil t) (revert-buffer t t))) - ;; save-excursion doesn't save point in the presence of a revert - ;; so you need to do it yourself - (goto-char ess-temp-point) + ;; (comint-send-input) + (insert (read-string "Press Return when shell is ready: ")) + (comint-send-input) + (switch-to-buffer (find-buffer-visiting ess-temp-file)) + (ess-revert-wisely) + )))) - ess-temp-return-value)) +(defun ess-kermit-send () + "Send a file with Kermit. WARNING: Experimental! From +a file that starts with `ess-kermit-prefix', +execute this command. It will transfer this file to the remote +directory with the same name, but without the `ess-kermit-prefix'." -(defun ess-get-file-or-buffer (file-or-buffer) - "Return file-or-buffer if it is a buffer; otherwise return the buffer -associated with the file which must be qualified by it's path; if the -buffer does not exist, return nil." (interactive) - (if file-or-buffer - (if (bufferp file-or-buffer) file-or-buffer - (find-buffer-visiting file-or-buffer)))) + ;; (save-match-data + (let ((ess-temp-file (expand-file-name (buffer-name))) + (ess-temp-file-remote-directory nil)) -(defun ess-set-local-variables (alist &optional file-or-buffer) - "Set local variables from ALIST in current buffer; if file-or-buffer -is specified, perform action in that buffer." - (interactive) - (if file-or-buffer (set-buffer (ess-get-file-or-buffer file-or-buffer))) + (if (string-equal ess-kermit-prefix (substring (file-name-nondirectory ess-temp-file) 0 1)) + (progn + ;; I think there is a bug in the buffer-local variable handling in GNU Emacs 21.3 + ;; Setting ess-kermit-remote-directory every time is somehow resetting it to the + ;; default on the second pass. Here's a temporary work-around. It will fail + ;; if you change the default, so maybe this variable should not be customizable. + ;; In any case, there is also trouble with local variables in XEmacs 21.4.9 and + ;; 21.4.10. XEmacs 21.4.8 is fine. + (if (string-equal "." ess-kermit-remote-directory) + (setq ess-kermit-remote-directory (read-string "Remote directory to transfer file to: " + ess-kermit-remote-directory))) - (mapcar (lambda (pair) - (make-local-variable (car pair)) - (set (car pair) (eval (cdr pair)))) - alist)) + (setq ess-temp-file-remote-directory ess-kermit-remote-directory) -(defun ess-clone-local-variables (from-file-or-buffer - &optional to-file-or-buffer) - "Clone local variables from one buffer to another buffer." - (interactive) - (ess-set-local-variables - (ess-sas-create-local-variables-alist from-file-or-buffer) - to-file-or-buffer)) + ;; (setq ess-temp-file (substring ess-temp-file (match-end 0))) + (ess-sas-goto-shell) + (insert "cd " ess-temp-file-remote-directory "; " ess-kermit-command " -a " + (substring (file-name-nondirectory ess-temp-file) 1) " -g " ess-temp-file) + (comint-send-input) + ;; (insert (read-string "Press Return to connect to Kermit: " nil nil "\C-\\c")) + ;; (comint-send-input) + ;; (insert (read-string "Press Return when Kermit is ready to recieve: " nil nil + ;; (concat "receive ]" ess-sas-temp-file))) + ;; (comint-send-input) + ;; (insert (read-string "Press Return when transfer is complete: " nil nil "c")) + ;; (comint-send-input) + (insert (read-string "Press Return when shell is ready: ")) + (comint-send-input) + (switch-to-buffer (find-buffer-visiting ess-temp-file)) + (ess-revert-wisely) + )))) -(defun ess-return-list (ess-arg) - "Given an item, if it is a list return it, else return item in a list." - (if (listp ess-arg) ess-arg (list ess-arg))) (defun ess-find-exec (ess-root-arg ess-root-dir) "Given a root directory and the root of an executable file name, @@ -509,263 +393,105 @@ (nconc ess-tmp-exec (list ess-tmp-file))))))) ess-tmp-exec)) -;; Copyright (C) 1994 Simon Marshall. -;; Author: Simon Marshall -;; LCD Archive Entry: -;; unique|Simon Marshall|Simon.Marshall@mail.esrin.esa.it| -;; Functions and commands to uniquify lists or buffer text (cf. sort). -;; 23-Apr-1994|1.00|~/packages/unique.el.Z| -;; -;; MM: renamed from 'unique' to 'ess-unique', then -(defun ess-uniq (list predicate) - "Uniquify LIST, stably, deleting elements using PREDICATE. -Return the list with subsequent duplicate items removed by side effects. -PREDICATE is called with an element of LIST and a list of elements from LIST, -and should return the list of elements with occurrences of the element removed. -This function will work even if LIST is unsorted. See also `ess-uniq-list'." - (let ((list list)) - (while list - (setq list (setcdr list (funcall predicate (car list) (cdr list)))))) - list) - -(defun ess-uniq-list (items) - "Delete all duplicate entries in ITEMS list, calling `ess-uniq'." - (ess-uniq items 'delete)) - (defun ess-drop-non-directories (file-strings) "Drop all entries that do not \"look like\" directories." (ess-flatten-list (mapcar 'file-name-directory file-strings))) +(defun ess--parent-dir (path n) + "Return Nth parent of PATH." + (let ((opath path)) + (while (and path (> n 0)) + (setq path (file-name-directory (directory-file-name opath))) + (if (equal path opath) + (setq path nil) + (setq opath path + n (1- n)))) + path)) -(defun ess-flatten-list (&rest list) - "Take the arguments and flatten them into one long list. -Drops 'nil' entries." - ;; Taken from lpr.el - ;; `lpr-flatten-list' is defined here (copied from "message.el" and - ;; enhanced to handle dotted pairs as well) until we can get some - ;; sensible autoloads, or `flatten-list' gets put somewhere decent. - - ;; (ess-flatten-list '((a . b) c (d . e) (f g h) i . j)) - ;; => (a b c d e f g h i j) - (ess-flatten-list-1 list)) - -(defun ess-flatten-list-1 (list) - (cond - ((null list) (list)) - ((consp list) - (append (ess-flatten-list-1 (car list)) - (ess-flatten-list-1 (cdr list)))) - (t (list list)))) - -(defun ess-delete-blank-lines () - "Convert 2 or more lines of white space into one." - (interactive) - (save-excursion - (goto-char (point-min)) - (save-match-data - (while (search-forward-regexp "^[ \t]*\n[ \t]*\n" nil t) - ;;(goto-char (match-beginning 0)) - (delete-blank-lines))))) - -(defun ess-do-auto-fill () - "This is the same as \\[do-auto-fill] in GNU emacs 21.3, with one major -difference: if we could not find a suitable place to break the line, -we simply do not break it (instead of breaking after the first word)." - (let (fc justify bol give-up - (fill-prefix fill-prefix)) - (if (or (not (setq justify (current-justification))) - (null (setq fc (current-fill-column))) - (and (eq justify 'left) - (<= (current-column) fc)) - (save-excursion (beginning-of-line) - (setq bol (point)) - (and auto-fill-inhibit-regexp - (looking-at auto-fill-inhibit-regexp)))) - nil ;; Auto-filling not required - (if (memq justify '(full center right)) - (save-excursion (unjustify-current-line))) - - ;; Choose a fill-prefix automatically. - (if (and adaptive-fill-mode - (or (null fill-prefix) (string= fill-prefix ""))) - (let ((prefix - (fill-context-prefix - (save-excursion (backward-paragraph 1) (point)) - (save-excursion (forward-paragraph 1) (point))))) - (and prefix (not (equal prefix "")) - (setq fill-prefix prefix)))) - - (while (and (not give-up) (> (current-column) fc)) - ;; Determine where to split the line. - (let* (after-prefix - (fill-point - (let ((opoint (point)) - bounce - (first t)) - (save-excursion - (beginning-of-line) - (setq after-prefix (point)) - (and fill-prefix - (looking-at (regexp-quote fill-prefix)) - (setq after-prefix (match-end 0))) - (move-to-column (1+ fc)) - ;; Move back to the point where we can break the line. - ;; We break the line between word or - ;; after/before the character which has character - ;; category `|'. We search space, \c| followed by - ;; a character, or \c| following a character. If - ;; not found, place the point at beginning of line. - (while (or first - ;; If this is after period and a single space, - ;; move back once more--we don't want to break - ;; the line there and make it look like a - ;; sentence end. - (and (not (bobp)) - (not bounce) - sentence-end-double-space - (save-excursion (forward-char -1) - (and (looking-at "\\. ") - (not (looking-at "\\. "))))) - (and (not (bobp)) - (not bounce) - fill-nobreak-predicate - (funcall fill-nobreak-predicate))) - (setq first nil) - (re-search-backward "[ \t]\\|\\c|.\\|.\\c|\\|^") - ;; If we find nowhere on the line to break it, - ;; do not break it. Set bounce to t - ;; so we will not keep going in this while loop. - (if (<= (point) after-prefix) - (setq bounce t) - (if (looking-at "[ \t]") - ;; Break the line at word boundary. - (skip-chars-backward " \t") - ;; Break the line after/before \c|. - (forward-char 1)))) - (if enable-multibyte-characters - ;; If we are going to break the line after or - ;; before a non-ascii character, we may have - ;; to run a special function for the charset - ;; of the character to find the correct break - ;; point. - (if (not (and (eq (charset-after (1- (point))) 'ascii) - (eq (charset-after (point)) 'ascii))) - (fill-find-break-point after-prefix))) - - ;; Let fill-point be set to the place where we end up. - ;; But move back before any whitespace here. - (skip-chars-backward " \t") - (point))))) + +;;*;; Interaction with inferiors - ;; See whether the place we found is any good. - (if (save-excursion - (goto-char fill-point) - (and (not (bolp)) - ;; There is no use breaking at end of line. - (not (save-excursion (skip-chars-forward " ") (eolp))) - ;; It is futile to split at the end of the prefix - ;; since we would just insert the prefix again. - (not (and after-prefix (<= (point) after-prefix))) - ;; Don't split right after a comment starter - ;; since we would just make another comment starter. - (not (and comment-start-skip - (let ((limit (point))) - (beginning-of-line) - (and (re-search-forward comment-start-skip - limit t) - (eq (point) limit))))))) - ;; Ok, we have a useful place to break the line. Do it. - (let ((prev-column (current-column))) - ;; If point is at the fill-point, do not `save-excursion'. - ;; Otherwise, if a comment prefix or fill-prefix is inserted, - ;; point will end up before it rather than after it. - (if (save-excursion - (skip-chars-backward " \t") - (= (point) fill-point)) - (funcall comment-line-break-function t) - (save-excursion - (goto-char fill-point) - (funcall comment-line-break-function t))) - ;; Now do justification, if required - (if (not (eq justify 'left)) - (save-excursion - (end-of-line 0) - (justify-current-line justify nil t))) - ;; If making the new line didn't reduce the hpos of - ;; the end of the line, then give up now; - ;; trying again will not help. - (if (>= (current-column) prev-column) - (setq give-up t))) - ;; No good place to break => stop trying. - (setq give-up t)))) - ;; Justify last line. - (justify-current-line justify t t) - t))) +(defmacro ess-when-new-input (time-var &rest body) + "BODY is evaluate only if the value of procss variable TIME-VAR +is bigger than the time of the last user input (stored in +'last-eval' process variable). TIME-VAR is the name of the +process variable which holds the access time. See the code for +`ess-synchronize-dirs' and `ess-cache-search-list'. -(defun ess-select-frame-set-input-focus (frame) - "Select FRAME, raise it, and set input focus, if possible. -Copied almost verbatim from gnus-utils.el (but with test for mac added)." - (cond ((featurep 'xemacs) - (raise-frame frame) - (select-frame frame) - (focus-frame frame)) - ;; The function `select-frame-set-input-focus' won't set - ;; the input focus under Emacs 21.2 and X window system. - ;;((fboundp 'select-frame-set-input-focus) - ;; (defalias 'gnus-select-frame-set-input-focus - ;; 'select-frame-set-input-focus) - ;; (select-frame-set-input-focus frame)) - (t - (raise-frame frame) - (select-frame frame) - (cond ((and - (memq window-system '(x mac)) - (fboundp 'x-focus-frame)) - (x-focus-frame frame)) - ((eq window-system 'w32) - (w32-focus-frame frame))) - (when focus-follows-mouse - (set-mouse-position frame (1- (frame-width frame)) 0))))) +Returns nil when no current process, or process is busy, or +time-var > last-eval. Otherwise, execute BODY and return the last +value. -(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)))))) - -(defun ess-num-or-zero (arg) - "*If a number, then return that number, otherwise return 0." - (or (and (numberp arg) arg) 0)) +If BODY is executed, set process variable TIME-VAR +to (current-time). + +Variable *proc* is bound to the current process during the +evaluation of BODY. + +Should be used in `ess-idle-timer-functions' which call the +process to avoid excessive requests. +" + (declare (indent 1) (debug t)) + `(with-ess-process-buffer 'no-error + (let ((le (process-get *proc* 'last-eval)) + (tv (process-get *proc* ',time-var))) + (when (and (or (null tv) (null le) (time-less-p tv le)) + (not (process-get *proc* 'busy))) + (let ((out (progn ,@body))) + (process-put *proc* ',time-var (current-time)) + out))))) + +(defmacro ess-execute-dialect-specific (command &optional prompt &rest args) + "Execute dialect specific command. + +-- If command is nil issue warning 'Not available for dialect X' +-- If command is a elisp function, execute it with ARGS +-- If a string starting with 'http' or 'www', browse with `browse-url', + otherwise execute the command in inferior process. +-- If a string, interpret as a command to subprocess, and + substitute ARGS with `(format ,command ,@args). + +When PROMPT is non-nil ask the user for a string value and +prepend the response to ARGS. +If prompt is a string just pass it to `read-string'. If a list, pass it +to `ess-completing-read'. +" + `(if (null ,command) + (message "Not implemented for dialect %s" ess-dialect) + (let* ((com (if (symbolp ,command) + (symbol-function ,command) + ,command)) + (prompt ',prompt) + (resp (and prompt + (if (stringp prompt) + (read-string prompt) + (apply 'ess-completing-read prompt)))) + (args (append (list resp) ',args))) + (cond ((functionp com) + (apply com args)) + ((and (stringp com) + (string-match "^\\(http\\|www\\)" com)) + (setq com (apply 'format com args)) + (require 'browse-url) + (browse-url com)) + ((stringp com) + (unless (string-match "\n$" com) + (setq com (concat com "\n"))) + (setq com (apply 'format com args)) + (ess-eval-linewise com)) + (t + (error "Argument COMMAND must be either a function or a string")))))) - ; Timer management +(defun ess--inject-code-from-file (file) + ;; this is different from ess-load-file + (let ((content (with-temp-buffer + (insert-file-contents file) + (buffer-string)))) + (when (string= ess-dialect "R") + ;; don't detect intermediate prompts + (setq content (concat "{" content "}\n"))) + (ess-command content))) (defcustom ess-idle-timer-interval 1 "Number of idle seconds to wait before running function in @@ -785,7 +511,7 @@ Most likely you will need a local hook. Then you should specify the LOCAL argument to `add-hook' and initialise it in `ess-mode-hook' or `ess-post-run-hook', or one of the more -specialised hooks `ess-R-post-run-hook',`ess-stata-post-run-hook' +specialised hooks `ess-r-post-run-hook',`ess-stata-post-run-hook' etc. ") @@ -799,37 +525,166 @@ (run-with-idle-timer ess-idle-timer-interval 'repeat 'ess--idle-timer-function) "Timer used to run `ess-idle-timer-functions'.") -(defmacro ess-when-new-input (time-var &rest body) - "BODY is evaluate only if the value of procss variable TIME-VAR -is bigger than the time of the last user input (stored in -'last-eval' process variable). TIME-VAR is the name of the -process variable which holds the access time. See the code for -`ess-synchronize-dirs' and `ess-cache-search-list'. + +;;*;; Emacs Integration -Returns nil when no current process, or process is busy, or -time-var > last-eval. Otherwise, execute BODY and return the last -value. +;;;*;;; Menus -If BODY is executed, set process variable TIME-VAR -to (current-time). +(defun ess--generate-eval-visibly-submenu (menu) + '(["yes" (lambda () (interactive) (setq ess-eval-visibly t)) + :style radio :enable t :selected (eq ess-eval-visibly t)] + ["nowait" (lambda () (interactive) (setq ess-eval-visibly 'nowait)) + :style radio :enable t :selected (eq ess-eval-visibly 'nowait) ] + ["no" (lambda () (interactive) (setq ess-eval-visibly nil)) + :style radio :enable t :selected (eq ess-eval-visibly nil) ])) -Variable *proc* is bound to the current process during the -evaluation of BODY. +;;;*;;; Font Lock -Should be used in `ess-idle-timer-functions' which call the -process to avoid excessive requests. -" - (declare (indent 1) (debug t)) - `(with-ess-process-buffer 'no-error - (let ((le (process-get *proc* 'last-eval)) - (tv (process-get *proc* ',time-var))) - (when (and (or (null tv) (null le) (time-less-p tv le)) - (not (process-get *proc* 'busy))) - (let ((out (progn ,@body))) - (process-put *proc* ',time-var (current-time)) - out))))) +(defun ess--extract-default-fl-keywords (keywords) + "Extract the t-keywords from `ess-font-lock-keywords'." + (delq nil (mapcar (lambda (c) + (when (cdr c) (symbol-value (car c)))) + (if (symbolp keywords) + (symbol-value keywords) + keywords)))) + +(defun ess-font-lock-toggle-keyword (keyword) + (interactive + (list (intern (ess-completing-read + "Keyword to toggle" + (mapcar (lambda (el) (symbol-name (car el))) + (symbol-value ess-font-lock-keywords)) + nil t)))) + (let* ((kwds (symbol-value (if (eq major-mode 'ess-mode) + ess-font-lock-keywords + inferior-ess-font-lock-keywords))) + (kwd (assoc keyword kwds))) + (unless kwd (error "Keyword %s was not found in (inferior-)ess-font-lock-keywords list" keyword)) + (if (cdr kwd) + (setcdr kwd nil) + (setcdr kwd t)) + (let ((mode major-mode) + (dialect ess-dialect) + (fld (ess--extract-default-fl-keywords kwds))) + ;; refresh font-lock defaults in all necessary buffers + (mapc (lambda (b) + (with-current-buffer b + (when (and (eq major-mode mode) + (eq ess-dialect dialect)) + (setcar font-lock-defaults fld) + (font-lock-refresh-defaults)))) + (buffer-list))))) + +(defun ess--generate-font-lock-submenu (menu) + "Internal, used to generate ESS font-lock submenu" + (append (mapcar (lambda (el) + `[,(symbol-name (car el)) + (lambda () (interactive) + (ess-font-lock-toggle-keyword ',(car el))) + :style toggle + :enable t + :selected ,(cdr el)]) + (cond ((eq major-mode 'ess-mode) + (symbol-value ess-font-lock-keywords)) + ((eq major-mode 'inferior-ess-mode) + (symbol-value inferior-ess-font-lock-keywords)))) + (list "-----" + ["Save to custom" (lambda () (interactive) + (let ((kwd (if (eq major-mode 'ess-mode) + ess-font-lock-keywords + inferior-ess-font-lock-keywords))) + (customize-save-variable kwd (symbol-value kwd)))) t]))) +;;;*;;; External modes + +(defun ess-completing-read (prompt collection &optional predicate + require-match initial-input hist def) + "Read a string in the minibuffer, with completion. +Use `ido-completing-read' if IDO interface is present, or fall +back on classical `completing-read' otherwise. Meaning of +arguments is as in `completing-read' (PROMPT is automatically +suffixed with ': ' and (default %s) when needed). If HIST +is null use `ess--completing-hist' as history. + +See also `ess-use-ido'." + (let ((use-ido (and ess-use-ido (featurep 'ido)))) + (setq hist (or hist 'ess--completing-hist)) + (when (and def (not use-ido)) ;; ido places in front and highlights the default + (setq prompt (format "%s(default %s)" prompt def))) + (setq prompt (concat prompt ": ")) + (if use-ido + (let ((reset-ido (and use-ido (not ido-mode))) ;people not using ido but having it) + (ido-current-directory nil) + (ido-directory-nonreadable nil) + (ido-directory-too-big nil) + (ido-context-switch-command 'ignore) + (ido-enable-flex-matching ess-ido-flex-matching) ;it's fast and useful, may be get into options + (ido-choice-list (copy-sequence collection)) ;ido removes the match (reported) + sel) + (unwind-protect + (progn + (ido-init-completion-maps) + (add-hook 'minibuffer-setup-hook 'ido-minibuffer-setup) + (add-hook 'choose-completion-string-functions 'ido-choose-completion-string) + (setq sel (ido-read-internal 'list prompt hist def require-match initial-input)) + (when hist ;; ido does not push into hist the whole match if C-SPC or RET is used (reported) + (unless (string= sel (car (symbol-value hist))) + (set hist (cons sel (symbol-value hist)))))) + (when reset-ido + (remove-hook 'minibuffer-setup-hook 'ido-minibuffer-setup) + (remove-hook 'choose-completion-string-functions 'ido-choose-completion-string))) + sel) + ;; else usual completion + (when (and (featurep 'xemacs) ;; xemacs workaround + (not (listp (car collection)))) + (setq collection (mapcar 'list collection))) + (completing-read prompt collection predicate require-match initial-input hist def)))) + +(defun ess-load-extras (&optional inferior) + "Load all the extra features depending on custom settings." + + (let ((mode (if inferior 'inferior-ess-mode 'ess-mode)) + (isR (string-match "^R" ess-dialect))) + + ;; auto-complete + (when (and (boundp 'ac-sources) + (if inferior + (eq ess-use-auto-complete t) + ess-use-auto-complete)) + (add-to-list 'ac-modes mode) + ;; files should be in front; ugly, but needed + (when ess-ac-sources + (setq ac-sources + (delq 'ac-source-filename ac-sources)) + (mapc (lambda (el) (add-to-list 'ac-sources el)) + ess-ac-sources) + (add-to-list 'ac-sources 'ac-source-filename))) + + ;; company + (when (and (boundp 'company-backends) + (if inferior + (eq ess-use-company t) + ess-use-company)) + (when ess-company-backends + (set (make-local-variable 'company-backends) + (copy-list (append ess-company-backends company-backends))) + (delq 'company-capf company-backends))) + + ;; eldoc) + (require 'eldoc) + (when (and ess-eldoc-function ;; if mode provide this, it suports eldoc + (or (and (not inferior) ess-use-eldoc) + (and inferior (eq ess-use-eldoc t)))) + (when (> eldoc-idle-delay 0.4) ;; default is too slow for paren help + (set (make-local-variable 'eldoc-idle-delay) 0.1)) + (set (make-local-variable 'eldoc-documentation-function) ess-eldoc-function) + (turn-on-eldoc-mode)) + + ;; tracebug + (when (and ess-use-tracebug inferior isR) + (ess-tracebug 1)))) + (defmacro ess--execute-electric-command (map &optional prompt wait exit-form &rest args) "Execute single-key comands defined in MAP till a key is pressed which is not part of map. @@ -871,49 +726,152 @@ (push ev unread-command-events)) out))) -(defmacro ess-execute-dialect-specific (command &optional prompt &rest args) - "Execute dialect specific command. +(defvar ess-build-tags-command nil + "Command passed to generate tags. --- If command is nil issue warning 'Not available for dialect X' --- If command is a elisp function, execute it with ARGS --- If a string starting with 'http' or 'www', browse with `browse-url', - otherwise execute the command in inferior process. --- If a string, interpret as a command to subprocess, and - substitute ARGS with `(format ,command ,@args). +If nil, `ess-build-tags-for-directory' uses the mode's imenu +regexpresion. Othersiwe, it should be a string with two %s +formats: one for directory and another for the output file.") + +;;;*;;; Emacs itself + +(defun ess-yank-cleaned-commands () + "Yank and strip the code, leaving only (R/S/Lsp/..) commands. +Deletes any lines not beginning with a prompt, and then removes +the prompt from those lines that remain. + +Invoke this command with C-u C-u C-y." + (setq yank-window-start (window-start)) + (let ((beg (point))) + (push-mark beg) + (setq this-command t) + (insert-for-yank (current-kill 0)) + (ess-transcript-clean-region beg (point) nil) + (if (eq (point) beg) + (message "No commands found")) + (if (eq this-command t) + (setq this-command 'yank)) + )) + +(defun ess-yank (&optional ARG) + "With double prefix (C-u C-u) call `ess-yank-cleaned-commands" + (interactive "*P") + (if (equal '(16) ARG) + (ess-yank-cleaned-commands) + (let* ((remapped (command-remapping 'yank (point))) + (command (cond ((eq remapped 'ess-yank) 'yank) + ((null remapped) 'yank) + (t remapped)))) + (funcall command ARG)))) + +(put 'ess-yank 'delete-selection 'yank) + +(defun ess-build-tags-for-directory (dir tagfile) + "Ask for directory and tag file and build tags for current dialect. + +If the current language defines `ess-build-tags-command' use it +and ask the subprocess to build the tags. Otherwise use imenu +regexp and call find .. | etags .. in a shell command. You must +have 'find' and 'etags' programs installed. + +Use M-. to navigate to a tag. M-x `visit-tags-table' to +append/replace the currently used tag table. + +If prefix is given, force tag generation based on imenu. Might be +useful when different language files are also present in the +directory (.cpp, .c etc)." + (interactive "DDirectory to tag: +GTags file (default TAGS): ") + (when (or (eq (length (file-name-nondirectory tagfile)) 0) + (file-directory-p tagfile)) + (setq tagfile (concat (file-name-as-directory tagfile) "TAGS"))) + ;; emacs find-tags doesn't play well with remote TAG files :( + (when (file-remote-p tagfile) + (require 'tramp) + (setq tagfile (with-parsed-tramp-file-name tagfile foo foo-localname))) + (when (file-remote-p dir) + (setq dir (with-parsed-tramp-file-name dir foo foo-localname))) + (if (and ess-build-tags-command (null current-prefix-arg)) + (ess-eval-linewise (format ess-build-tags-command dir tagfile)) + ;; else generate from imenu + (unless (or imenu-generic-expression ess-imenu-generic-expression) ;; need both!! + (error "No ess-tag-command found, and no imenu-generic-expression defined")) + (let* ((find-cmd + (format "find %s -type f -size 1M \\( -regex \".*\\.\\(cpp\\|jl\\|[RsrSch]\\(nw\\)?\\)$\" \\)" dir)) + (regs (delq nil (mapcar (lambda (l) + (if (string-match "'" (cadr l)) + nil ;; remove for time being + (format "/%s/\\%d/" + (replace-regexp-in-string "/" "\\/" (nth 1 l) t) + (nth 2 l)))) + imenu-generic-expression))) + (tags-cmd (format "etags -o %s --regex='%s' -" tagfile + (mapconcat 'identity regs "' --regex='")))) + (message "Building tags: %s" tagfile) + ;; (dbg (format "%s | %s" find-cmd tags-cmd)) + (when (= 0 (shell-command (format "%s | %s" find-cmd tags-cmd))) + (message "Building tags .. ok!"))))) -When PROMPT is non-nil ask the user for a string value and -prepend the response to ARGS. -If prompt is a string just pass it to `read-string'. If a list, pass it -to `ess-completing-read'. +;;;*;;; System + +;; trying different viewers; thanks to an original patch for +;; ess-swv.el from Leo : +(defun ess-get-ps-viewer () + "Get external PostScript viewer to be used from ESS. +Use `ess-ps-viewer-pref' when that is executably found by \\[executable-find]. +Otherwise try a list of fixed known viewers." + (file-name-nondirectory + (or (and ess-ps-viewer-pref ; -> ./ess-custom.el + (executable-find ess-ps-viewer-pref)) + (executable-find "gv") + (executable-find "evince") + (executable-find "kghostview")))) + +(defun ess-get-pdf-viewer () + "Get external PDF viewer to be used from ESS. +Use `ess-pdf-viewer-pref' when that is executably found by \\[executable-find]. +Otherwise try a list of fixed known viewers. " - `(if (null ,command) - (message "Not implemented for dialect %s" ess-dialect) - (let* ((com (if (symbolp ,command) - (symbol-function ,command) - ,command)) - (prompt ',prompt) - (resp (and prompt - (if (stringp prompt) - (read-string prompt) - (apply 'ess-completing-read prompt)))) - (args (append (list resp) ',args))) - (cond ((functionp com) - (apply com args)) - ((and (stringp com) - (string-match "^\\(http\\|www\\)" com)) - (setq com (apply 'format com args)) - (require 'browse-url) - (browse-url com)) - ((stringp com) - (unless (string-match "\n$" com) - (setq com (concat com "\n"))) - (setq com (apply 'format com args)) - (ess-eval-linewise com)) - (t - (error "Argument COMMAND must be either a function or a string")))))) + (let ((viewer (or ess-pdf-viewer-pref + ;; (and (stringp ess-pdf-viewer-pref) ; -> ./ess-custom.el + ;; (executable-find ess-pdf-viewer-pref)) + (executable-find "evince") + (executable-find "kpdf") + (executable-find "okular") + (executable-find "xpdf") + (executable-find "acroread") + (executable-find "xdg-open") + ;; this one is wrong, (ok for time being as it is used only in swv) + (car (ess-get-words-from-vector + "getOption(\"pdfviewer\")\n")) + ))) + (when (stringp viewer) + (setq viewer (file-name-nondirectory viewer))) + viewer)) + + +;;*;; UI + +(defvar ess-current-region-overlay + (let ((overlay (make-overlay (point) (point)))) + (overlay-put overlay 'face 'highlight) + overlay) + "The overlay for highlighting currently evaluated region or line.") +(defun ess-blink-region (start end) + (when ess-blink-region + (move-overlay ess-current-region-overlay start end) + (run-with-timer ess-blink-delay nil + (lambda () + (delete-overlay ess-current-region-overlay))))) +(defun ess-deactivate-mark () + (cond ((and (featurep 'evil) evil-mode) + (when (evil-visual-state-p) + (evil-normal-state))) + ((fboundp 'deactivate-mark) + (deactivate-mark)))) ;; SJE: 2009-01-30 -- this contribution from ;; Erik Iverson @@ -969,71 +927,285 @@ (tooltip-show text)) )) +(defun ess-select-frame-set-input-focus (frame) + "Select FRAME, raise it, and set input focus, if possible. +Copied almost verbatim from gnus-utils.el (but with test for mac added)." + (cond ((featurep 'xemacs) + (raise-frame frame) + (select-frame frame) + (focus-frame frame)) + ;; The function `select-frame-set-input-focus' won't set + ;; the input focus under Emacs 21.2 and X window system. + ;;((fboundp 'select-frame-set-input-focus) + ;; (defalias 'gnus-select-frame-set-input-focus + ;; 'select-frame-set-input-focus) + ;; (select-frame-set-input-focus frame)) + (t + (raise-frame frame) + (select-frame frame) + (cond ((and + (memq window-system '(x mac)) + (fboundp 'x-focus-frame)) + (x-focus-frame frame)) + ((eq window-system 'w32) + (w32-focus-frame frame))) + (when focus-follows-mouse + (set-mouse-position frame (1- (frame-width frame)) 0))))) -;; (defun ess-tooltip-show-at-point (text xo yo) -;; (with-no-warnings -;; (pos-tip-show text -;; 'popup-tip-face -;; (point) -;; nil tooltip-hide-delay -;; popup-tip-max-width -;; nil xo yo))) +(defun ess-do-auto-fill () + "This is the same as \\[do-auto-fill] in GNU emacs 21.3, with one major +difference: if we could not find a suitable place to break the line, +we simply do not break it (instead of breaking after the first word)." + (let (fc justify bol give-up + (fill-prefix fill-prefix)) + (if (or (not (setq justify (current-justification))) + (null (setq fc (current-fill-column))) + (and (eq justify 'left) + (<= (current-column) fc)) + (save-excursion (beginning-of-line) + (setq bol (point)) + (and auto-fill-inhibit-regexp + (looking-at auto-fill-inhibit-regexp)))) + nil ;; Auto-filling not required + (if (memq justify '(full center right)) + (save-excursion (unjustify-current-line))) + ;; Choose a fill-prefix automatically. + (if (and adaptive-fill-mode + (or (null fill-prefix) (string= fill-prefix ""))) + (let ((prefix + (fill-context-prefix + (save-excursion (backward-paragraph 1) (point)) + (save-excursion (forward-paragraph 1) (point))))) + (and prefix (not (equal prefix "")) + (setq fill-prefix prefix)))) -(defvar ess-build-tags-command nil - "Command passed to generate tags. + (while (and (not give-up) (> (current-column) fc)) + ;; Determine where to split the line. + (let* (after-prefix + (fill-point + (let ((opoint (point)) + bounce + (first t)) + (save-excursion + (beginning-of-line) + (setq after-prefix (point)) + (and fill-prefix + (looking-at (regexp-quote fill-prefix)) + (setq after-prefix (match-end 0))) + (move-to-column (1+ fc)) + ;; Move back to the point where we can break the line. + ;; We break the line between word or + ;; after/before the character which has character + ;; category `|'. We search space, \c| followed by + ;; a character, or \c| following a character. If + ;; not found, place the point at beginning of line. + (while (or first + ;; If this is after period and a single space, + ;; move back once more--we don't want to break + ;; the line there and make it look like a + ;; sentence end. + (and (not (bobp)) + (not bounce) + sentence-end-double-space + (save-excursion (forward-char -1) + (and (looking-at "\\. ") + (not (looking-at "\\. "))))) + (and (not (bobp)) + (not bounce) + fill-nobreak-predicate + (funcall fill-nobreak-predicate))) + (setq first nil) + (re-search-backward "[ \t]\\|\\c|.\\|.\\c|\\|^") + ;; If we find nowhere on the line to break it, + ;; do not break it. Set bounce to t + ;; so we will not keep going in this while loop. + (if (<= (point) after-prefix) + (setq bounce t) + (if (looking-at "[ \t]") + ;; Break the line at word boundary. + (skip-chars-backward " \t") + ;; Break the line after/before \c|. + (forward-char 1)))) + (if enable-multibyte-characters + ;; If we are going to break the line after or + ;; before a non-ascii character, we may have + ;; to run a special function for the charset + ;; of the character to find the correct break + ;; point. + (if (not (and (eq (charset-after (1- (point))) 'ascii) + (eq (charset-after (point)) 'ascii))) + (fill-find-break-point after-prefix))) -If nil, `ess-build-tags-for-directory' uses the mode's imenu -regexpresion. Othersiwe, it should be a string with two %s -formats: one for directory and another for the output file.") + ;; Let fill-point be set to the place where we end up. + ;; But move back before any whitespace here. + (skip-chars-backward " \t") + (point))))) + + ;; See whether the place we found is any good. + (if (save-excursion + (goto-char fill-point) + (and (not (bolp)) + ;; There is no use breaking at end of line. + (not (save-excursion (skip-chars-forward " ") (eolp))) + ;; It is futile to split at the end of the prefix + ;; since we would just insert the prefix again. + (not (and after-prefix (<= (point) after-prefix))) + ;; Don't split right after a comment starter + ;; since we would just make another comment starter. + (not (and comment-start-skip + (let ((limit (point))) + (beginning-of-line) + (and (re-search-forward comment-start-skip + limit t) + (eq (point) limit))))))) + ;; Ok, we have a useful place to break the line. Do it. + (let ((prev-column (current-column))) + ;; If point is at the fill-point, do not `save-excursion'. + ;; Otherwise, if a comment prefix or fill-prefix is inserted, + ;; point will end up before it rather than after it. + (if (save-excursion + (skip-chars-backward " \t") + (= (point) fill-point)) + (funcall comment-line-break-function t) + (save-excursion + (goto-char fill-point) + (funcall comment-line-break-function t))) + ;; Now do justification, if required + (if (not (eq justify 'left)) + (save-excursion + (end-of-line 0) + (justify-current-line justify nil t))) + ;; If making the new line didn't reduce the hpos of + ;; the end of the line, then give up now; + ;; trying again will not help. + (if (>= (current-column) prev-column) + (setq give-up t))) + ;; No good place to break => stop trying. + (setq give-up t)))) + ;; Justify last line. + (justify-current-line justify t t) + t))) + +;;*;; Syntax -(defun ess-build-tags-for-directory (dir tagfile) - "Ask for directory and tag file and build tags for current dialect. +(defun ess-containing-sexp-position () + (cadr (syntax-ppss))) -If the current language defines `ess-build-tags-command' use it -and ask the subprocess to build the tags. Otherwise use imenu -regexp and call find .. | etags .. in a shell command. You must -have 'find' and 'etags' programs installed. +(defun ess-code-end-position () + "Like (line-end-position) but stops at comments" + (save-excursion + (goto-char (1+ (line-end-position))) + (forward-comment -1) + (point))) + +;; FIXME: The following function pattern stuff is specific to R but is +;; used throughout ESS +(defvar ess-r-set-function-start + ;; [MGAR].. <=> {setMethod(), set[Group]Generic(), setAs(), setReplaceMethod()} + ;; see also set-S4-exp in ess-r-function-pattern below + "^set[MGAR][GMa-z]+\\s-?(") + +(defvar ess-function-pattern nil ; in R set to ess-r-function-pattern + "Regexp to match the beginning of a function in S buffers.") + +(defvar ess-r-symbol-pattern + "\\(\\sw\\|\\s_\\)" + "The regular expression for matching an R symbol") + +(defvar ess-r-name-pattern + (concat "\\(" ess-r-symbol-pattern "+\\|\\(`\\).+`\\)") + "The regular expression for matching a R name.") + +(let* ((Q "\\s\"") ; quote + (repl "\\(<-\\)?") ; replacement (function) + (Sym-0 "\\(\\sw\\|\\s_\\)") ; symbol + (Symb (concat Sym-0 "+")) + (xSymb "[^ \t\n\"']+") ;; (concat "\\[?\\[?" Sym-0 "*")); symbol / [ / [[ / [symbol / [[symbol + ;; FIXME: allow '%foo%' but only when quoted; don't allow [_0-9] at beg. + (_or_ "\\)\\|\\(") ; OR + (space "\\(\\s-\\|\n\\)*") ; white space + + (part-1 (concat + "\\(" ;;--------outer Either------- + "\\(\\(" ; EITHER + Q xSymb Q ; any function name between quotes + _or_ + "\\(^\\|[ ]\\)" Symb ; (beginning of name) + ess-r-symbol-pattern + "\\)\\)")) ; END EITHER OR + + (set-S4-exp + (concat + "^set\\(As\\|Method\\|Generic\\|GroupGeneric\\|ReplaceMethod\\)(" ; S4 ... + Q xSymb Q "," space + ;; and now often `` signature(......), : '' + ".*" ;; <<< FIXME ??? + )) + + (part-2 (concat + "\\|" ;;--------outer Or --------- + set-S4-exp + "\\)" ;;--------end outer Either/Or------- + + "\\(" space "\\s<.*\\s>\\)*" ; whitespace, comment + ;; FIXME: in principle we should skip 'definition *= *' here + space "function\\s-*(" ; whitespace, function keyword, parenthesis + ))) + + (defvar ess-r-function-pattern + (concat part-1 + "\\s-*\\(<-\\|=\\)" ; whitespace, assign + part-2) + "The regular expression for matching the beginning of an R function.") + + (defvar ess-s-function-pattern + (concat part-1 + "\\s-*\\(<-\\|_\\|=\\)" ; whitespace, assign (incl. "_") + part-2) + "The regular expression for matching the beginning of an S function.")) -Use M-. to navigate to a tag. M-x `visit-tags-table' to -append/replace the currently used tag table. -If prefix is given, force tag generation based on imenu. Might be -useful when different language files are also present in the -directory (.cpp, .c etc)." - (interactive "DDirectory to tag: -GTags file (default TAGS): ") - (when (or (eq (length (file-name-nondirectory tagfile)) 0) - (file-directory-p tagfile)) - (setq tagfile (concat (file-name-as-directory tagfile) "TAGS"))) - ;; emacs find-tags doesn't play well with remote TAG files :( - (when (file-remote-p tagfile) - (require 'tramp) - (setq tagfile (with-parsed-tramp-file-name tagfile foo foo-localname))) - (when (file-remote-p dir) - (setq dir (with-parsed-tramp-file-name dir foo foo-localname))) - (if (and ess-build-tags-command (null current-prefix-arg)) - (ess-eval-linewise (format ess-build-tags-command dir tagfile)) - ;; else generate from imenu - (unless (or imenu-generic-expression ess-imenu-generic-expression) ;; need both!! - (error "No ess-tag-command found, and no imenu-generic-expression defined")) - (let* ((find-cmd - (format "find %s -type f -size 1M \\( -regex \".*\\.\\(cpp\\|jl\\|[RsrSch]\\(nw\\)?\\)$\" \\)" dir)) - (regs (delq nil (mapcar (lambda (l) - (if (string-match "'" (cadr l)) - nil ;; remove for time being - (format "/%s/\\%d/" - (replace-regexp-in-string "/" "\\/" (nth 1 l) t) - (nth 2 l)))) - imenu-generic-expression))) - (tags-cmd (format "etags -o %s --regex='%s' -" tagfile - (mapconcat 'identity regs "' --regex='")))) - (message "Building tags: %s" tagfile) - ;; (dbg (format "%s | %s" find-cmd tags-cmd)) - (when (= 0 (shell-command (format "%s | %s" find-cmd tags-cmd))) - (message "Building tags .. ok!"))))) +(defvar ess--funname.start nil) + +(defun ess--funname.start (&optional look-back) + "If inside a function call, return (FUNNAMME . START) where +FUNNAME is a function name found before ( and START is where +FUNNAME starts. +LOOK-BACK is a number of characters to look back; defaults to +2000. As the search might get quite slow for files with thousands +of lines. + +Also store the cons in 'ess--funname.start for potential use +later." + (save-excursion + (save-restriction + (let* ((proc (get-buffer-process (current-buffer))) + (mark (and proc (process-mark proc)))) + + (if (and mark (>= (point) mark)) + (narrow-to-region mark (point))) + + (and ess-noweb-mode + (ess-noweb-narrow-to-chunk)) + + (unless (ess-inside-string-p) + (setq ess--funname.start + (condition-case nil ;; check if it is inside a functon + (progn + ;; for the sake of big buffers, look only 1000 chars back + (narrow-to-region (max (point-min) (- (point) 1000)) (point)) + (up-list -1) + (while (not (looking-at "(")) + (up-list -1)) + (let ((funname (symbol-name (symbol-at-point)))) + (when (and funname + (not (member funname ess-S-non-functions))) + (cons funname (- (point) (length funname)))) + )) + (error nil)) + )))))) (defun ess-function-arguments (funname &optional proc) "Get FUNARGS from cache or ask the process for it. @@ -1069,7 +1241,7 @@ (setq args nil)) (or args (cadr (assoc funname (process-get proc 'funargs-pre-cache))) - (and + (and (not (process-get proc 'busy)) (with-current-buffer (ess-command (format ess-funargs-command (ess-quote-special-chars funname)) @@ -1108,80 +1280,131 @@ "Get initial position for args completion" (when (not (ess-inside-string-p)) (when (ess--funname.start) - (if (looking-back "[(,]+[ \t\n]*") + (if (looking-back "[(,]+[ \t\n]*" nil) (point) (ess-symbol-start))))) -(defvar ess--funname.start nil) +(defun ess-inside-string-or-comment-p (&optional pos) + "Return non-nil if POSition [defaults to (point)] is inside string or comment + (according to syntax)." + ;;FIXME (defun ess-calculate-indent ..) can do that ... + (interactive) + (setq pos (or pos (point))) + (let ((ppss (syntax-ppss pos))) + (or (car (setq ppss (nthcdr 3 ppss))) + (car (setq ppss (cdr ppss))) + (nth 3 ppss)))) -(defun ess--funname.start (&optional look-back) - "If inside a function call, return (FUNNAMME . START) where -FUNNAME is a function name found before ( and START is where -FUNNAME starts. +(defun ess-inside-string-p (&optional pos) + "Return non-nil if point is inside string (according to syntax)." + (interactive) + ;; when narrowing the buffer in iESS the ppss cahce is screwed:( But it is + ;; very fast, so don't bother for now. + (let ((pps (syntax-ppss pos))) + (nth 3 pps)) + ;; (nth 3 (parse-partial-sexp (point-min) pos)) + ) -LOOK-BACK is a number of characters to look back; defaults to -2000. As the search might get quite slow for files with thousands -of lines. +(defun ess-inside-comment-p (&optional pos) + "Return non-nil if point is inside string (according to syntax)." + (interactive) + (setq pos (or pos (point))) + (save-excursion + (or (when font-lock-mode ;; this is a shortcut (works well usually) + (let ((face (get-char-property pos 'face))) + (eq 'font-lock-comment-face face))) + (nth 4 (parse-partial-sexp (progn (goto-char pos) (point-at-bol)) pos))))) -Also store the cons in 'ess--funname.start for potential use -later." +(defun ess-inside-brackets-p (&optional pos curly?) + "Return t if position POS is inside brackets. +POS defaults to point if no value is given. If curly? is non nil +also return t if inside curly brackets." (save-excursion - (save-restriction - (let* ((proc (get-buffer-process (current-buffer))) - (mark (and proc (process-mark proc)))) + (let ((ppss (syntax-ppss pos)) + (r nil)) + (while (and (> (nth 0 ppss) 0) + (not r)) + (goto-char (nth 1 ppss)) + (when (or (char-equal ?\[ (char-after)) + (and curly? + (char-equal ?\{ (char-after)))) + (setq r t)) + (setq ppss (syntax-ppss))) + r))) - (if (and mark (>= (point) mark)) - (narrow-to-region mark (point))) + +;;*;; String manipulation - (and ess-noweb-mode - (ess-noweb-narrow-to-chunk)) +(defun ess-quote-special-chars (string) + (replace-regexp-in-string + "\"" "\\\\\\&" + (replace-regexp-in-string ;; replace backslashes + "\\\\" "\\\\" string nil t))) - (unless (ess-inside-string-p) - (setq ess--funname.start - (condition-case nil ;; check if it is inside a functon - (progn - ;; for the sake of big buffers, look only 1000 chars back - (narrow-to-region (max (point-min) (- (point) 1000)) (point)) - (up-list -1) - (while (not (looking-at "(")) - (up-list -1)) - (let ((funname (symbol-name (ess-symbol-at-point)))) - (when (and funname - (not (member funname ess-S-non-functions))) - (cons funname (- (point) (length funname)))) - )) - (error nil)) - )))))) +;; simple alternative to ess-read-object-name-default of ./ess-inf.el : +;; is "wrongly" returning "p1" for word "p1.part2" : +(defun ess-extract-word-name () + "Get the word you're on (cheap algorithm). Use `ess-read-object-name-default' +for a better but slower version." + (save-excursion + (re-search-forward "\\<\\w+\\>" nil t) + (buffer-substring (match-beginning 0) (match-end 0)))) -(defun ess--inject-code-from-file (file) - ;; this is different from ess-load-file - (let ((content (with-temp-buffer - (insert-file-contents file) - (buffer-string)))) - (when (string= ess-dialect "R") - ;; don't detect intermediate prompts - (setq content (concat "{" content "}\n"))) - (ess-command content))) +(defun ess-rep-regexp (regexp to-string &optional fixedcase literal verbose) + "Instead of (replace-regexp..) -- do NOT replace in strings or comments. + If FIXEDCASE is non-nil, do *not* alter case of replacement text. + If LITERAL is non-nil, do *not* treat `\\' as special. + If VERBOSE is non-nil, (message ..) about replacements." + (let ((case-fold-search (and case-fold-search + (not fixedcase))); t <==> ignore case in search + (ppt (point)); previous point + (p)) + (while (and (setq p (re-search-forward regexp nil t)) + (< ppt p)) + (setq ppt p) + (cond ((not (ess-inside-string-or-comment-p (1- p))) + (if verbose + (let ((beg (match-beginning 0))) + (message "buffer in (match-beg.,p)=(%d,%d) is '%s'" + beg p (buffer-substring beg p)))) + (replace-match to-string fixedcase literal) + ;;or (if verbose (setq pl (append pl (list p)))) + ))) + ;;or (if (and verbose pl) + ;;or (message "s/%s/%s/ at %s" regexp to-string pl)) + ) ) -(defvar ess-current-region-overlay - (let ((overlay (make-overlay (point) (point)))) - (overlay-put overlay 'face 'highlight) - overlay) - "The overlay for highlighting currently evaluated region or line.") +(defun ess-replace-regexp-dump-to-src + (regexp to-string &optional dont-query verbose ensure-mode) + "Depending on dont-query, call `ess-rep-regexp' or `query-replace-regexp' +from the beginning of the buffer." + (save-excursion + (if (and ensure-mode + (not (equal major-mode 'ess-mode))) + (ess-mode)) + (goto-char (point-min)) + (if dont-query + (ess-rep-regexp regexp to-string nil nil verbose) + (query-replace-regexp regexp to-string nil)))) -(defun ess-blink-region (start end) - (when ess-blink-region - (move-overlay ess-current-region-overlay start end) - (run-with-timer ess-blink-delay nil - (lambda () - (delete-overlay ess-current-region-overlay))))) +(defun ess-space-around (word &optional from verbose) + "Replace-regexp .. ensuring space around all occurences of WORD, + starting from FROM {defaults to (point)}." + (interactive "d\nP"); Defaults: point and prefix (C-u) + (save-excursion + (goto-char from) + (ess-rep-regexp (concat "\\([^ \t\n]\\)\\(\\<" word "\\>\\)") + "\\1 \\2" nil nil verbose) + (goto-char from) + (ess-rep-regexp (concat "\\(\\<" word "\\>\\)\\([^ \t\n]\\)") + "\\1 \\2" nil nil verbose) + ) + ) -(defun ess-deactivate-mark () - (cond ((and (featurep 'evil) evil-mode) - (when (evil-visual-state-p) - (evil-normal-state))) - ((fboundp 'deactivate-mark) - (deactivate-mark)))) +(defun ess-time-string (&optional clock) + "Returns a string for use as a timestamp. + hr:min if CLOCK is non-nil, + like \"13 Mar 1992\". Redefine to taste." + (format-time-string (concat "%e %b %Y" (if clock ", %H:%M")))) (defun ess-replace-in-string (str regexp newtext &optional literal) "Replace all matches in STR for REGEXP with NEWTEXT string. @@ -1234,6 +1457,83 @@ newtext "")))))) (concat rtn-str (substring str start)))) +;;- From: friedman@gnu.ai.mit.edu (Noah Friedman) +;;- Date: 12 Feb 1995 21:30:56 -0500 +;;- Newsgroups: gnu.emacs.sources +;;- Subject: nuke-trailing-whitespace +;;- +;;- This is too trivial to make into a big todo with comments and copyright +;;- notices whose length exceed the size of the actual code, so consider it +;;- public domain. Its purpose is along similar lines to that of +;;- `require-final-newline', which is built in. I hope the names make it +;;- obvious. + +;; (add-hook 'write-file-hooks 'nuke-trailing-whitespace) +;;or at least +;; (add-hook 'ess-mode-hook +;; (lambda () +;; (add-hook 'local-write-file-hooks 'nuke-trailing-whitespace))) + +(defvar ess-nuke-trailing-whitespace-p nil;disabled by default 'ask + "*[Dis]activates (ess-nuke-trailing-whitespace). + Disabled if `nil'; if `t', it works unconditionally, otherwise, + the user is queried. + Note that setting the default to `t' may not be a good idea when you edit + binary files!") + +;;; MM: Newer Emacsen now have delete-trailing-whitespace +;;; -- but no customization like nuke-trailing-whitespace-p .. +(defun ess-nuke-trailing-whitespace () + "Nuke all trailing whitespace in the buffer. +Whitespace in this case is just spaces or tabs. +This is a useful function to put on write-file-hooks. + +If the variable `ess-nuke-trailing-whitespace-p' is `nil', this function is +disabled. If `t', unreservedly strip trailing whitespace. +If not `nil' and not `t', query for each instance." + (interactive) + (let ((bname (buffer-name))) + (cond ((or + (string= major-mode "rmail-mode") + (string= bname "RMAIL") + nil)); do nothing.. + + (t + (and (not buffer-read-only) + ess-nuke-trailing-whitespace-p + (save-match-data + (save-excursion + (save-restriction + (widen) + (goto-char (point-min)) + (cond ((eq ess-nuke-trailing-whitespace-p t) + (while (re-search-forward "[ \t]+$" (point-max) t) + (delete-region (match-beginning 0) + (match-end 0)))) + (t + (query-replace-regexp "[ \t]+$" ""))))))))) + ;; always return nil, in case this is on write-file-hooks. + nil)) + + +;;*;; Debugging tools + +(defun ess-write-to-dribble-buffer (text) + "Write TEXT to dribble ('*ESS*') buffer." + (unless (buffer-live-p ess-dribble-buffer) + ;; ESS dribble buffer must be re-created. + (setq ess-dribble-buffer (get-buffer-create "*ESS*"))) + (let (deactivate-mark) + (with-current-buffer ess-dribble-buffer + (goto-char (point-max)) + (insert-before-markers text)))) + +;; Shortcut to render "dribbling" statements less cluttering: +(defun ess-if-verbose-write (text) + "Write TEXT to dribble buffer ('*ESS*') only *if* `ess-verbose'." + (if ess-verbose (ess-write-to-dribble-buffer text))) + + (defun ess-kill-last-line () (save-excursion (goto-char (point-max)) @@ -1291,4 +1591,20 @@ (provide 'ess-utils) + ; Local variables section + +;;; This file is automatically placed in Outline minor mode. +;;; The file is structured as follows: +;;; Chapters: ^L ; +;;; Sections: ;;*;; +;;; Subsections: ;;;*;;; +;;; Components: defuns, defvars, defconsts +;;; Random code beginning with a ;;;;* comment + +;;; Local variables: +;;; mode: emacs-lisp +;;; mode: outline-minor +;;; outline-regexp: "\^L\\|\\`;\\|;;\\*\\|;;;\\*\\|(def[cvu]\\|(setq\\|;;;;\\*" +;;; End: + ;;; ess-utils.el ends here diff -Nru ess-16.10/lisp/julia-mode.el ess-17.11/lisp/julia-mode.el --- ess-16.10/lisp/julia-mode.el 1970-01-01 00:00:00.000000000 +0000 +++ ess-17.11/lisp/julia-mode.el 2017-03-26 22:00:00.000000000 +0000 @@ -0,0 +1,3247 @@ +;;; julia-mode.el --- Major mode for editing Julia source code + +;; Copyright (C) 2009-2014 Julia contributors +;; URL: https://github.com/JuliaLang/julia +;; Version: 0.3 +;; Keywords: languages + +;;; Usage: +;; Put the following code in your .emacs, site-load.el, or other relevant file +;; (add-to-list 'load-path "path-to-julia-mode") +;; (require 'julia-mode) + +;;; Commentary: +;; This is the official Emacs mode for editing Julia programs. + +;;; License: +;; Permission is hereby granted, free of charge, to any person obtaining +;; a copy of this software and associated documentation files (the +;; "Software"), to deal in the Software without restriction, including +;; without limitation the rights to use, copy, modify, merge, publish, +;; distribute, sublicense, and/or sell copies of the Software, and to +;; permit persons to whom the Software is furnished to do so, subject to +;; the following conditions: +;; +;; The above copyright notice and this permission notice shall be +;; included in all copies or substantial portions of the Software. +;; +;; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +;; EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +;; MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +;; NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +;; LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +;; OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +;; WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +;;; Code: + +;; We can't use cl-lib whilst supporting Emacs <= 24.2 users +(with-no-warnings (require 'cl)) ;; incf, decf, plusp + +(defvar julia-mode-hook nil) + +(defgroup julia () + "Major mode for the julia programming language." + :group 'languages + :prefix "julia-") + +(defcustom julia-indent-offset 4 + "Number of spaces per indentation level." + :type 'integer + :group 'julia) + +(defface julia-macro-face + '((t :inherit font-lock-preprocessor-face)) + "Face for Julia macro invocations." + :group 'julia-mode) + +(defface julia-quoted-symbol-face + '((t :inherit font-lock-preprocessor-face)) + "Face for quoted Julia symbols, e.g. :foo." + :group 'julia-mode) + + +;;;###autoload +(add-to-list 'auto-mode-alist '("\\.jl\\'" . julia-mode)) + +;; define ignore-errors macro if it isn't present +;; (necessary for emacs 22 compatibility) +(when (not (fboundp 'ignore-errors)) + (defmacro ignore-errors (body) `(condition-case nil ,body (error nil)))) + +(defun julia--regexp-opt (strings &optional paren) + "Emacs 23 provides `regexp-opt', but it does not support PAREN taking the value 'symbols. +This function provides equivalent functionality, but makes no efforts to optimise the regexp." + (cond + ((>= emacs-major-version 24) + (regexp-opt strings paren)) + ((not (eq paren 'symbols)) + (regexp-opt strings paren)) + ((null strings) + "") + ('t + (rx-to-string `(seq symbol-start (or ,@strings) symbol-end))))) + +(defvar julia-mode-syntax-table + (let ((table (make-syntax-table))) + (modify-syntax-entry ?_ "_" table) + (modify-syntax-entry ?@ "_" table) + (modify-syntax-entry ?! "_" table) + (modify-syntax-entry ?# "< 14" table) ; # single-line and multiline start + (modify-syntax-entry ?= ". 23bn" table) + (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) + ;; Here, we treat ' as punctuation (when it's used for transpose), + ;; see our use of `julia-char-regex' for handling ' as a character + ;; delimeter + (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 ?> "." table) + (modify-syntax-entry ?% "." table) + table) + "Syntax table for `julia-mode'.") + +(eval-when-compile + (defconst julia-char-regex + (rx (or (any "-" ";" "\\" "^" "!" "|" "?" "*" "<" "%" "," "=" ">" "+" "/" "&" "$" "~" ":") + (syntax open-parenthesis) + (syntax whitespace) + bol) + (group "'") + (group + (or (repeat 0 8 (not (any "'"))) (not (any "\\")) + "\\\\")) + (group "'")))) + +(defconst julia-triple-quoted-string-regex + ;; We deliberately put a group on the first and last delimiter, so + ;; we can mark these as string delimiters for font-lock. + (rx (group "\"") + (group "\"\"" + ;; After the delimiter, we're a sequence of + ;; non-backslashes or blackslashes paired with something. + (*? (or (not (any "\\")) + (seq "\\" anything))) + "\"\"") + (group "\""))) + +(defconst julia-unquote-regex + "\\(\\s(\\|\\s-\\|-\\|[,%=<>\\+*/?&|!\\^~\\\\;:]\\|^\\)\\($[a-zA-Z0-9_]+\\)") + +(defconst julia-forloop-in-regex + "for +.*[^ +].* \\(in\\)\\(\\s-\\|$\\)+") + +(defconst julia-function-regex + (rx line-start (* (or space "@inline" "@noinline")) symbol-start + "function" + (1+ space) + ;; Don't highlight module names in function declarations: + (* (seq (1+ (or word (syntax symbol))) ".")) + ;; The function name itself + (group (1+ (or word (syntax symbol)))))) + +(defconst julia-function-assignment-regex + (rx line-start (* (or space "@inline" "@noinline")) symbol-start + (* (seq (1+ (or word (syntax symbol))) ".")) ; module name + (group (1+ (or word (syntax symbol)))) + (* space) + (? "{" (* (not (any "}"))) "}") + (* space) + "(" (* (or + (seq "(" (* (not (any "(" ")"))) ")") + (not (any "(" ")")))) + ")" + (* space) + "=" + (not (any "=")))) + +(defconst julia-type-regex + (rx symbol-start (or "immutable" "type" "abstract") (1+ space) (group (1+ (or word (syntax symbol)))))) + +(defconst julia-type-annotation-regex + (rx "::" (0+ space) (group (1+ (or word (syntax symbol)))))) + +;;(defconst julia-type-parameter-regex +;; (rx symbol-start (1+ (or (or word (syntax symbol)) ?_)) "{" (group (1+ (or (or word (syntax symbol)) ?_))) "}")) + +(defconst julia-subtype-regex + (rx "<:" (0+ space) (group (1+ (or word (syntax symbol)))) (0+ space) (or "\n" "{" "}" "end"))) + +(defconst julia-macro-regex + (rx symbol-start (group "@" (1+ (or word (syntax symbol)))))) + +(defconst julia-keyword-regex + (julia--regexp-opt + '("if" "else" "elseif" "while" "for" "begin" "end" "quote" + "try" "catch" "return" "local" "abstract" "function" "macro" "ccall" + "finally" "typealias" "break" "continue" "type" "global" + "module" "using" "import" "export" "const" "let" "bitstype" "do" "in" + "baremodule" "importall" "immutable") + 'symbols)) + +(defconst julia-builtin-regex + (julia--regexp-opt + ;;'("error" "throw") + '() + 'symbols)) + +(defconst julia-builtin-types-regex + (julia--regexp-opt + '("Number" "Real" "BigInt" "Integer" + "UInt" "UInt8" "UInt16" "UInt32" "UInt64" "UInt128" + "Int" "Int8" "Int16" "Int32" "Int64" "Int128" + "BigFloat" "AbstractFloat" "Float16" "Float32" "Float64" + "Complex128" "Complex64" + "Bool" + "Cuchar" "Cshort" "Cushort" "Cint" "Cuint" "Clonglong" "Culonglong" "Cintmax_t" "Cuintmax_t" + "Cfloat" "Cdouble" "Cptrdiff_t" "Cssize_t" "Csize_t" + "Cchar" "Clong" "Culong" "Cwchar_t" + "Char" "ASCIIString" "UTF8String" "ByteString" "SubString" + "Array" "DArray" "AbstractArray" "AbstractVector" "AbstractMatrix" "AbstractSparseMatrix" "SubArray" "StridedArray" "StridedVector" "StridedMatrix" "VecOrMat" "StridedVecOrMat" "DenseArray" "SparseMatrixCSC" "BitArray" + "Range" "OrdinalRange" "StepRange" "UnitRange" "FloatRange" + "Tuple" "NTuple" "Vararg" + "DataType" "Symbol" "Function" "Vector" "Matrix" "Union" "Type" "Any" "Complex" "AbstractString" "Ptr" "Void" "Exception" "Task" "Signed" "Unsigned" "Associative" "Dict" "IO" "IOStream" "Rational" "Regex" "RegexMatch" "Set" "IntSet" "Expr" "WeakRef" "ObjectIdDict" + "AbstractRNG" "MersenneTwister" + ) + 'symbols)) + +(defconst julia-quoted-symbol-regex + ;; :foo and :foo2 are valid, but :123 is not. + (rx (or whitespace "(" "[" "," "=") + (group ":" (or letter (syntax symbol)) (0+ (or word (syntax symbol)))))) + +(defconst julia-font-lock-keywords + (list + ;; Ensure :: and <: aren't highlighted, so we don't confuse ::Foo with :foo. + ;; (in Emacs, keywords don't overlap). + (cons (rx (or "::" "<:")) ''default) + ;; Highlight quoted symbols before keywords, so :function is not + ;; highlighted as a keyword. + (list julia-quoted-symbol-regex 1 ''julia-quoted-symbol-face) + (cons julia-builtin-types-regex 'font-lock-type-face) + (cons julia-keyword-regex 'font-lock-keyword-face) + (cons julia-macro-regex ''julia-macro-face) + (cons + (julia--regexp-opt + '("true" "false" "C_NULL" "Inf" "NaN" "Inf32" "NaN32" "nothing") + 'symbols) + 'font-lock-constant-face) + (list julia-unquote-regex 2 'font-lock-constant-face) + (list julia-forloop-in-regex 1 'font-lock-keyword-face) + (list julia-function-regex 1 'font-lock-function-name-face) + (list julia-function-assignment-regex 1 'font-lock-function-name-face) + (list julia-type-regex 1 'font-lock-type-face) + (list julia-type-annotation-regex 1 'font-lock-type-face) + ;;(list julia-type-parameter-regex 1 'font-lock-type-face) + (list julia-subtype-regex 1 'font-lock-type-face) + (list julia-builtin-regex 1 'font-lock-builtin-face) + )) + +(defconst julia-block-start-keywords + (list "if" "while" "for" "begin" "try" "function" "type" "let" "macro" + "quote" "do" "immutable")) + +(defconst julia-block-end-keywords + (list "end" "else" "elseif" "catch" "finally")) + +(defun julia-stringify-triple-quote () + "Put `syntax-table' property on triple-quoted string delimeters. + +Based on `python-syntax-stringify'." + (let* ((string-start-pos (- (point) 3)) + (string-end-pos (point)) + (ppss (prog2 + (backward-char 3) + (syntax-ppss) + (forward-char 3))) + (in-comment (nth 4 ppss)) + (in-string (nth 8 ppss))) + (unless in-comment + (if in-string + ;; We're in a string, so this must be the closing triple-quote. + ;; Put | on the last " character. + (put-text-property (1- string-end-pos) string-end-pos + 'syntax-table (string-to-syntax "|")) + ;; We're not in a string, so this is the opening triple-quote. + ;; Put | on the first " character. + (put-text-property string-start-pos (1+ string-start-pos) + 'syntax-table (string-to-syntax "|")))))) + +(unless (< emacs-major-version 24) + (defconst julia-syntax-propertize-function + (syntax-propertize-rules + ("\"\"\"" + (0 (ignore (julia-stringify-triple-quote)))) + (julia-char-regex + (1 "\"") ; Treat ' as a string delimiter. + (2 ".") ; Don't highlight anything between. + (3 "\""))))) ; Treat the last " in """ as a string delimiter. + +(defun julia-in-comment () + "Return non-nil if point is inside a comment. +Handles both single-line and multi-line comments." + (nth 4 (syntax-ppss))) + +(defun julia-in-string () + "Return non-nil if point is inside a string. +Note this is Emacs' notion of what is highlighted as a string. +As a result, it is true inside \"foo\", `foo` and 'f'." + (nth 3 (syntax-ppss))) + +(defun julia-in-brackets () + "Return non-nil if point is inside square brackets." + (let ((start-pos (point)) + (open-count 0)) + ;; Count all the [ and ] characters on the current line. + (save-excursion + (beginning-of-line) + + (while (< (point) start-pos) + ;; Don't count [ or ] inside strings, characters or comments. + (unless (or (julia-in-string) (julia-in-comment)) + + (when (looking-at (rx "[")) + (incf open-count)) + (when (looking-at (rx "]")) + (decf open-count))) + + (forward-char 1))) + + ;; If we've opened more than we've closed, we're inside brackets. + (plusp open-count))) + +(defun julia-at-keyword (kw-list) + "Return the word at point if it matches any keyword in KW-LIST. +KW-LIST is a list of strings. The word at point is not considered +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)) ?:)))) + (member (current-word t) kw-list) + (not (julia-in-comment)) + ;; 'end' is not a keyword when used for indexing, e.g. foo[end-2] + (or (not (equal (current-word t) "end")) + (not (julia-in-brackets))))) + +;; if backward-sexp gives an error, move back 1 char to move over the '(' +(defun julia-safe-backward-sexp () + (if (condition-case nil (backward-sexp) (error t)) + (ignore-errors (backward-char)))) + +(defun julia-last-open-block-pos (min) + "Return the position of the last open block, if one found. +Do not move back beyond position MIN." + (save-excursion + (let ((count 0)) + (while (not (or (> count 0) (<= (point) min))) + (julia-safe-backward-sexp) + (setq count + (cond ((julia-at-keyword julia-block-start-keywords) + (+ count 1)) + ;; fixme: breaks on strings + ((and (equal (current-word t) "end") + (not (julia-in-comment)) (not (julia-in-brackets))) + (- count 1)) + (t count)))) + (if (> count 0) + (point) + nil)))) + +(defun julia-last-open-block (min) + "Move back and return indentation level for last open block. +Do not move back beyond MIN." + ;; Ensure MIN is not before the start of the buffer. + (setq min (max min (point-min))) + (let ((pos (julia-last-open-block-pos min))) + (and pos + (progn + (goto-char pos) + (+ julia-indent-offset (current-indentation)))))) + +(defsubst julia--safe-backward-char () + "Move back one character, but don't error if we're at the +beginning of the buffer." + (unless (eq (point) (point-min)) + (backward-char))) + +(defvar julia-max-paren-lookback 400 + "When indenting, don't look back more than this +many characters to see if there are unclosed parens. + +This variable has a major effect on indent performance if set too +high.") + +(defvar julia-max-block-lookback 5000 + "When indenting, don't look back more than this +many characters to see if there are unclosed blocks. + +This variable has a moderate effect on indent performance if set too +high.") + +(defun julia-paren-indent () + "Return the column of the text following the innermost +containing paren before point, so we can align succeeding code +with it. Returns nil if we're not within nested parens." + (save-excursion + ;; Back up to previous line (beginning-of-line was already called) + (backward-char) + (let ((min-pos (max (- (point) julia-max-paren-lookback) + (point-min))) + (open-count 0)) + (while (and (> (point) min-pos) + (not (plusp open-count))) + + (when (looking-at (rx (any "[" "]" "(" ")"))) + (unless (or (julia-in-string) (julia-in-comment)) + (cond ((looking-at (rx (any "[" "("))) + (incf open-count)) + ((looking-at (rx (any "]" ")"))) + (decf open-count))))) + + (julia--safe-backward-char)) + + (if (plusp open-count) + (progn (forward-char 2) + (while (looking-at (rx blank)) + (forward-char)) + (current-column)) + nil)))) + +(defun julia-indent-line () + "Indent current line of julia code." + (interactive) + (let* ((point-offset (- (current-column) (current-indentation)))) + (end-of-line) + (indent-line-to + (or + ;; If we're inside an open paren, indent to line up arguments. + (save-excursion + (beginning-of-line) + (ignore-errors (julia-paren-indent))) + ;; If the previous line ends in =, increase the indent. + (ignore-errors ; if previous line is (point-min) + (save-excursion + (if (and (not (equal (point-min) (line-beginning-position))) + (progn + (forward-line -1) + (end-of-line) (backward-char 1) + (and (equal (char-after (point)) ?=) + (not (julia-in-comment))))) + (+ julia-indent-offset (current-indentation)) + nil))) + ;; Indent according to how many nested blocks we are in. + (save-excursion + (beginning-of-line) + (forward-to-indentation 0) + (let ((endtok (julia-at-keyword julia-block-end-keywords)) + (last-open-block (julia-last-open-block (- (point) julia-max-block-lookback)))) + (max 0 (+ (or last-open-block 0) + (if endtok (- julia-indent-offset) 0))))))) + ;; Point is now at the beginning of indentation, restore it + ;; to its original position (relative to indentation). + (when (>= point-offset 0) + (move-to-column (+ (current-indentation) point-offset))))) + +(defmacro julia--should-indent (from to) + "Assert that we indent text FROM producing text TO in `julia-mode'." + `(with-temp-buffer + (let ((julia-indent-offset 4)) + (julia-mode) + (insert ,from) + (indent-region (point-min) (point-max)) + (should (equal (buffer-substring-no-properties (point-min) (point-max)) + ,to))))) + +;; Emacs 23.X doesn't include ert, so we ignore any errors that occur +;; when we define tests. +(ignore-errors + (require 'ert) + + (ert-deftest julia--test-indent-if () + "We should indent inside if bodies." + (julia--should-indent + " +if foo +bar +end" + " +if foo + bar +end")) + + (ert-deftest julia--test-indent-else () + "We should indent inside else bodies." + (julia--should-indent + " +if foo + bar +else +baz +end" + " +if foo + bar +else + baz +end")) + + (ert-deftest julia--test-indent-toplevel () + "We should not indent toplevel expressions. " + (julia--should-indent + " +foo() +bar()" + " +foo() +bar()")) + + (ert-deftest julia--test-indent-nested-if () + "We should indent for each level of indentation." + (julia--should-indent + " +if foo + if bar +bar + end +end" + " +if foo + if bar + bar + end +end")) + + (ert-deftest julia--test-indent-function () + "We should indent function bodies." + (julia--should-indent + " +function foo() +bar +end" + " +function foo() + bar +end")) + + (ert-deftest julia--test-indent-begin () + "We should indent after a begin keyword." + (julia--should-indent + " +@async begin +bar +end" + " +@async begin + bar +end")) + + (ert-deftest julia--test-indent-paren () + "We should indent to line up with the text after an open paren." + (julia--should-indent + " +foobar(bar, +baz)" + " +foobar(bar, + baz)")) + + (ert-deftest julia--test-indent-paren-space () + "We should indent to line up with the text after an open +paren, even if there are additional spaces." + (julia--should-indent + " +foobar( bar, +baz )" + " +foobar( bar, + baz )")) + + (ert-deftest julia--test-indent-equals () + "We should increase indent on a trailing =." + (julia--should-indent + " +foo() = +bar" + " +foo() = + bar")) + + (ert-deftest julia--test-indent-ignores-blank-lines () + "Blank lines should not affect indentation of non-blank lines." + (julia--should-indent + " +if foo + +bar +end" + " +if foo + + bar +end")) + + (ert-deftest julia--test-indent-comment-equal () + "`=` at the end of comment should not increase indent level." + (julia--should-indent + " +# a = +# b = +c" + " +# a = +# b = +c")) + + (ert-deftest julia--test-indent-leading-paren () + "`(` at the beginning of a line should not affect indentation." + (julia--should-indent + " +(1)" + " +(1)")) + + (ert-deftest julia--test-top-level-following-paren-indent () + "`At the top level, a previous line indented due to parens should not affect indentation." + (julia--should-indent + "y1 = f(x, + z) +y2 = g(x)" + "y1 = f(x, + z) +y2 = g(x)")) + + (defun julia--run-tests () + (interactive) + (ert-run-tests-interactively "julia--test"))) + +(defalias 'julia-mode-prog-mode + (if (fboundp 'prog-mode) + 'prog-mode + 'fundamental-mode)) + +;;; IMENU +(defvar 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) + ;; ("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))) + )) + +;;;###autoload +(define-derived-mode julia-mode julia-mode-prog-mode "Julia" + "Major mode for editing julia code." + (set-syntax-table julia-mode-syntax-table) + (set (make-local-variable 'comment-start) "# ") + (set (make-local-variable 'comment-start-skip) "#+\\s-*") + (set (make-local-variable 'font-lock-defaults) '(julia-font-lock-keywords)) + (if (< emacs-major-version 24) + ;; Emacs 23 doesn't have syntax-propertize-function + (set (make-local-variable 'font-lock-syntactic-keywords) + (list + `(,julia-char-regex + (1 "\"") ; Treat ' as a string delimiter. + (2 ".") ; Don't highlight anything between the open and close '. + (3 "\"")); Treat the close ' as a string delimiter. + `(,julia-triple-quoted-string-regex + (1 "\"") ; Treat the first " in """ as a string delimiter. + (2 ".") ; Don't highlight anything between. + (3 "\"")))) ; Treat the last " in """ as a string delimiter. + ;; Emacs 24 and later has syntax-propertize-function, so use that instead. + (set (make-local-variable 'syntax-propertize-function) + julia-syntax-propertize-function)) + (set (make-local-variable 'indent-line-function) 'julia-indent-line) + (setq indent-tabs-mode nil) + (setq imenu-generic-expression julia-imenu-generic-expression) + (imenu-add-to-menubar "Imenu")) + +(defvar julia-latexsubs (make-hash-table :test 'equal)) + +(defun julia-latexsub () + "Perform a LaTeX-like Unicode symbol substitution." + (interactive "*i") + (let ((orig-pt (point))) + (while (not (or (bobp) (= ?\\ (char-before)) + (= ?\s (char-syntax (char-before))))) + (backward-char)) + (if (and (not (bobp)) (= ?\\ (char-before))) + (progn + (backward-char) + (let ((sub (gethash (buffer-substring (point) orig-pt) julia-latexsubs))) + (if sub + (progn + (delete-region (point) orig-pt) + (insert sub)) + (goto-char orig-pt)))) + (goto-char orig-pt)))) + +(defalias 'latexsub 'julia-latexsub) + +(defun julia-latexsub-or-indent (arg) + "Either indent according to mode or perform a LaTeX-like symbol substution" + (interactive "*i") + (if (latexsub) + (indent-for-tab-command arg))) +(define-key julia-mode-map (kbd "TAB") 'julia-latexsub-or-indent) + +(defalias 'latexsub-or-indent 'julia-latexsub-or-indent) + +; LaTeX-like symbol substitutions, equivalent to those in the Julia REPL, +; generated by: +;for (k,v) in sort!(collect(Base.REPLCompletions.latex_symbols), by=x->x[2]) +; ks = escape_string(k) +; vs = escape_string(v) +; if ismatch(r"^\\U[0-9A-Fa-f]+$", vs) +; # codepoints outside the BMP can be problematic in older Emacsen +; cp = vs[3:end] +; println("(let ((c (decode-char 'ucs #x$cp)))\n", +; " (if c (puthash \"$ks\" (char-to-string c) julia-latexsubs)))") +; else +; println("(puthash \"$ks\" \"$vs\" julia-latexsubs)") +; end +;end +; (See Julia issue #8947 for why we don't use the Emacs tex input mode.) +(puthash "\\textexclamdown" "¡" julia-latexsubs) +(puthash "\\sterling" "£" julia-latexsubs) +(puthash "\\yen" "¥" julia-latexsubs) +(puthash "\\textbrokenbar" "¦" julia-latexsubs) +(puthash "\\S" "§" julia-latexsubs) +(puthash "\\textasciidieresis" "¨" julia-latexsubs) +(puthash "\\copyright" "©" julia-latexsubs) +(puthash "\\textordfeminine" "ª" julia-latexsubs) +(puthash "\\neg" "¬" julia-latexsubs) +(puthash "\\circledR" "®" julia-latexsubs) +(puthash "\\textasciimacron" "¯" julia-latexsubs) +(puthash "\\degree" "°" julia-latexsubs) +(puthash "\\pm" "±" julia-latexsubs) +(puthash "\\^2" "²" julia-latexsubs) +(puthash "\\^3" "³" julia-latexsubs) +(puthash "\\textasciiacute" "´" julia-latexsubs) +(puthash "\\P" "¶" julia-latexsubs) +(puthash "\\cdotp" "·" julia-latexsubs) +(puthash "\\^1" "¹" julia-latexsubs) +(puthash "\\textordmasculine" "º" julia-latexsubs) +(puthash "\\textonequarter" "¼" julia-latexsubs) +(puthash "\\textonehalf" "½" julia-latexsubs) +(puthash "\\textthreequarters" "¾" julia-latexsubs) +(puthash "\\textquestiondown" "¿" julia-latexsubs) +(puthash "\\AA" "Å" julia-latexsubs) +(puthash "\\AE" "Æ" julia-latexsubs) +(puthash "\\DH" "Ð" julia-latexsubs) +(puthash "\\times" "×" julia-latexsubs) +(puthash "\\O" "Ø" julia-latexsubs) +(puthash "\\TH" "Þ" julia-latexsubs) +(puthash "\\ss" "ß" julia-latexsubs) +(puthash "\\aa" "å" julia-latexsubs) +(puthash "\\ae" "æ" julia-latexsubs) +(puthash "\\eth" "ð" julia-latexsubs) +(puthash "\\div" "÷" julia-latexsubs) +(puthash "\\o" "ø" julia-latexsubs) +(puthash "\\th" "þ" julia-latexsubs) +(puthash "\\DJ" "Đ" julia-latexsubs) +(puthash "\\dj" "đ" julia-latexsubs) +(puthash "\\Elzxh" "ħ" julia-latexsubs) +(puthash "\\hbar" "ħ" julia-latexsubs) +(puthash "\\L" "Ł" julia-latexsubs) +(puthash "\\l" "ł" julia-latexsubs) +(puthash "\\NG" "Ŋ" julia-latexsubs) +(puthash "\\ng" "ŋ" julia-latexsubs) +(puthash "\\OE" "Œ" julia-latexsubs) +(puthash "\\oe" "œ" julia-latexsubs) +(puthash "\\texthvlig" "ƕ" julia-latexsubs) +(puthash "\\textnrleg" "ƞ" julia-latexsubs) +(puthash "\\Zbar" "Ƶ" julia-latexsubs) +(puthash "\\textdoublepipe" "ǂ" julia-latexsubs) +(puthash "\\Elztrna" "ɐ" julia-latexsubs) +(puthash "\\Elztrnsa" "ɒ" julia-latexsubs) +(puthash "\\Elzopeno" "ɔ" julia-latexsubs) +(puthash "\\Elzrtld" "ɖ" julia-latexsubs) +(puthash "\\Elzschwa" "ə" julia-latexsubs) +(puthash "\\varepsilon" "ɛ" julia-latexsubs) +(puthash "\\Elzpgamma" "ɣ" julia-latexsubs) +(puthash "\\Elzpbgam" "ɤ" julia-latexsubs) +(puthash "\\Elztrnh" "ɥ" julia-latexsubs) +(puthash "\\Elzbtdl" "ɬ" julia-latexsubs) +(puthash "\\Elzrtll" "ɭ" julia-latexsubs) +(puthash "\\Elztrnm" "ɯ" julia-latexsubs) +(puthash "\\Elztrnmlr" "ɰ" julia-latexsubs) +(puthash "\\Elzltlmr" "ɱ" julia-latexsubs) +(puthash "\\Elzltln" "ɲ" julia-latexsubs) +(puthash "\\Elzrtln" "ɳ" julia-latexsubs) +(puthash "\\Elzclomeg" "ɷ" julia-latexsubs) +(puthash "\\textphi" "ɸ" julia-latexsubs) +(puthash "\\Elztrnr" "ɹ" julia-latexsubs) +(puthash "\\Elztrnrl" "ɺ" julia-latexsubs) +(puthash "\\Elzrttrnr" "ɻ" julia-latexsubs) +(puthash "\\Elzrl" "ɼ" julia-latexsubs) +(puthash "\\Elzrtlr" "ɽ" julia-latexsubs) +(puthash "\\Elzfhr" "ɾ" julia-latexsubs) +(puthash "\\Elzrtls" "ʂ" julia-latexsubs) +(puthash "\\Elzesh" "ʃ" julia-latexsubs) +(puthash "\\Elztrnt" "ʇ" julia-latexsubs) +(puthash "\\Elzrtlt" "ʈ" julia-latexsubs) +(puthash "\\Elzpupsil" "ʊ" julia-latexsubs) +(puthash "\\Elzpscrv" "ʋ" julia-latexsubs) +(puthash "\\Elzinvv" "ʌ" julia-latexsubs) +(puthash "\\Elzinvw" "ʍ" julia-latexsubs) +(puthash "\\Elztrny" "ʎ" julia-latexsubs) +(puthash "\\Elzrtlz" "ʐ" julia-latexsubs) +(puthash "\\Elzyogh" "ʒ" julia-latexsubs) +(puthash "\\Elzglst" "ʔ" julia-latexsubs) +(puthash "\\Elzreglst" "ʕ" julia-latexsubs) +(puthash "\\Elzinglst" "ʖ" julia-latexsubs) +(puthash "\\textturnk" "ʞ" julia-latexsubs) +(puthash "\\Elzdyogh" "ʤ" julia-latexsubs) +(puthash "\\Elztesh" "ʧ" julia-latexsubs) +(puthash "\\^h" "ʰ" julia-latexsubs) +(puthash "\\^j" "ʲ" julia-latexsubs) +(puthash "\\^r" "ʳ" julia-latexsubs) +(puthash "\\^w" "ʷ" julia-latexsubs) +(puthash "\\^y" "ʸ" julia-latexsubs) +(puthash "\\rasp" "ʼ" julia-latexsubs) +(puthash "\\textasciicaron" "ˇ" julia-latexsubs) +(puthash "\\Elzverts" "ˈ" julia-latexsubs) +(puthash "\\Elzverti" "ˌ" julia-latexsubs) +(puthash "\\Elzlmrk" "ː" julia-latexsubs) +(puthash "\\Elzhlmrk" "ˑ" julia-latexsubs) +(puthash "\\Elzsbrhr" "˒" julia-latexsubs) +(puthash "\\Elzsblhr" "˓" julia-latexsubs) +(puthash "\\Elzrais" "˔" julia-latexsubs) +(puthash "\\Elzlow" "˕" julia-latexsubs) +(puthash "\\u" "˘" julia-latexsubs) +(puthash "\\texttildelow" "˜" julia-latexsubs) +(puthash "\\^l" "ˡ" julia-latexsubs) +(puthash "\\^s" "ˢ" julia-latexsubs) +(puthash "\\^x" "ˣ" julia-latexsubs) +(puthash "\\grave" "̀" julia-latexsubs) +(puthash "\\acute" "́" julia-latexsubs) +(puthash "\\hat" "̂" julia-latexsubs) +(puthash "\\tilde" "̃" julia-latexsubs) +(puthash "\\bar" "̄" julia-latexsubs) +(puthash "\\overbar" "̅" julia-latexsubs) +(puthash "\\breve" "̆" julia-latexsubs) +(puthash "\\dot" "̇" julia-latexsubs) +(puthash "\\ddot" "̈" julia-latexsubs) +(puthash "\\ovhook" "̉" julia-latexsubs) +(puthash "\\ocirc" "̊" julia-latexsubs) +(puthash "\\H" "̋" julia-latexsubs) +(puthash "\\check" "̌" julia-latexsubs) +(puthash "\\candra" "̐" julia-latexsubs) +(puthash "\\oturnedcomma" "̒" julia-latexsubs) +(puthash "\\ocommatopright" "̕" julia-latexsubs) +(puthash "\\droang" "̚" julia-latexsubs) +(puthash "\\Elzpalh" "̡" julia-latexsubs) +(puthash "\\Elzrh" "̢" julia-latexsubs) +(puthash "\\c" "̧" julia-latexsubs) +(puthash "\\k" "̨" julia-latexsubs) +(puthash "\\Elzsbbrg" "̪" julia-latexsubs) +(puthash "\\wideutilde" "̰" julia-latexsubs) +(puthash "\\underbar" "̱" julia-latexsubs) +(puthash "\\Elzxl" "̵" julia-latexsubs) +(puthash "\\Elzbar" "̶" julia-latexsubs) +(puthash "\\sout" "̶" julia-latexsubs) +(puthash "\\not" "̸" julia-latexsubs) +(puthash "\\Alpha" "Α" julia-latexsubs) +(puthash "\\Beta" "Β" julia-latexsubs) +(puthash "\\Gamma" "Γ" julia-latexsubs) +(puthash "\\Delta" "Δ" julia-latexsubs) +(puthash "\\Epsilon" "Ε" julia-latexsubs) +(puthash "\\Zeta" "Ζ" julia-latexsubs) +(puthash "\\Eta" "Η" julia-latexsubs) +(puthash "\\Theta" "Θ" julia-latexsubs) +(puthash "\\Iota" "Ι" julia-latexsubs) +(puthash "\\Kappa" "Κ" julia-latexsubs) +(puthash "\\Lambda" "Λ" julia-latexsubs) +(puthash "\\upMu" "Μ" julia-latexsubs) +(puthash "\\upNu" "Ν" julia-latexsubs) +(puthash "\\Xi" "Ξ" julia-latexsubs) +(puthash "\\upOmicron" "Ο" julia-latexsubs) +(puthash "\\Pi" "Π" julia-latexsubs) +(puthash "\\Rho" "Ρ" julia-latexsubs) +(puthash "\\Sigma" "Σ" julia-latexsubs) +(puthash "\\Tau" "Τ" julia-latexsubs) +(puthash "\\Upsilon" "Υ" julia-latexsubs) +(puthash "\\Phi" "Φ" julia-latexsubs) +(puthash "\\Chi" "Χ" julia-latexsubs) +(puthash "\\Psi" "Ψ" julia-latexsubs) +(puthash "\\Omega" "Ω" julia-latexsubs) +(puthash "\\alpha" "α" julia-latexsubs) +(puthash "\\beta" "β" julia-latexsubs) +(puthash "\\gamma" "γ" julia-latexsubs) +(puthash "\\delta" "δ" julia-latexsubs) +(puthash "\\upepsilon" "ε" julia-latexsubs) +(puthash "\\zeta" "ζ" julia-latexsubs) +(puthash "\\eta" "η" julia-latexsubs) +(puthash "\\theta" "θ" julia-latexsubs) +(puthash "\\iota" "ι" julia-latexsubs) +(puthash "\\kappa" "κ" julia-latexsubs) +(puthash "\\lambda" "λ" julia-latexsubs) +(puthash "\\mu" "μ" julia-latexsubs) +(puthash "\\nu" "ν" julia-latexsubs) +(puthash "\\xi" "ξ" julia-latexsubs) +(puthash "\\upomicron" "ο" julia-latexsubs) +(puthash "\\pi" "π" julia-latexsubs) +(puthash "\\rho" "ρ" julia-latexsubs) +(puthash "\\varsigma" "ς" julia-latexsubs) +(puthash "\\sigma" "σ" julia-latexsubs) +(puthash "\\tau" "τ" julia-latexsubs) +(puthash "\\upsilon" "υ" julia-latexsubs) +(puthash "\\varphi" "φ" julia-latexsubs) +(puthash "\\chi" "χ" julia-latexsubs) +(puthash "\\psi" "ψ" julia-latexsubs) +(puthash "\\omega" "ω" julia-latexsubs) +(puthash "\\upvarbeta" "ϐ" julia-latexsubs) +(puthash "\\vartheta" "ϑ" julia-latexsubs) +(puthash "\\phi" "ϕ" julia-latexsubs) +(puthash "\\varpi" "ϖ" julia-latexsubs) +(puthash "\\upoldKoppa" "Ϙ" julia-latexsubs) +(puthash "\\upoldkoppa" "ϙ" julia-latexsubs) +(puthash "\\Stigma" "Ϛ" julia-latexsubs) +(puthash "\\upstigma" "ϛ" julia-latexsubs) +(puthash "\\Digamma" "Ϝ" julia-latexsubs) +(puthash "\\digamma" "ϝ" julia-latexsubs) +(puthash "\\Koppa" "Ϟ" julia-latexsubs) +(puthash "\\upkoppa" "ϟ" julia-latexsubs) +(puthash "\\Sampi" "Ϡ" julia-latexsubs) +(puthash "\\upsampi" "ϡ" julia-latexsubs) +(puthash "\\varkappa" "ϰ" julia-latexsubs) +(puthash "\\varrho" "ϱ" julia-latexsubs) +(puthash "\\textTheta" "ϴ" julia-latexsubs) +(puthash "\\epsilon" "ϵ" julia-latexsubs) +(puthash "\\backepsilon" "϶" julia-latexsubs) +(puthash "\\^A" "\u1d2c" julia-latexsubs) +(puthash "\\^B" "\u1d2e" julia-latexsubs) +(puthash "\\^D" "\u1d30" julia-latexsubs) +(puthash "\\^E" "\u1d31" julia-latexsubs) +(puthash "\\^G" "\u1d33" julia-latexsubs) +(puthash "\\^H" "\u1d34" julia-latexsubs) +(puthash "\\^I" "\u1d35" julia-latexsubs) +(puthash "\\^J" "\u1d36" julia-latexsubs) +(puthash "\\^K" "\u1d37" julia-latexsubs) +(puthash "\\^L" "\u1d38" julia-latexsubs) +(puthash "\\^M" "\u1d39" julia-latexsubs) +(puthash "\\^N" "\u1d3a" julia-latexsubs) +(puthash "\\^O" "\u1d3c" julia-latexsubs) +(puthash "\\^P" "\u1d3e" julia-latexsubs) +(puthash "\\^R" "\u1d3f" julia-latexsubs) +(puthash "\\^T" "\u1d40" julia-latexsubs) +(puthash "\\^U" "\u1d41" julia-latexsubs) +(puthash "\\^W" "\u1d42" julia-latexsubs) +(puthash "\\^a" "\u1d43" julia-latexsubs) +(puthash "\\^alpha" "\u1d45" julia-latexsubs) +(puthash "\\^b" "\u1d47" julia-latexsubs) +(puthash "\\^d" "\u1d48" julia-latexsubs) +(puthash "\\^e" "\u1d49" julia-latexsubs) +(puthash "\\^epsilon" "\u1d4b" julia-latexsubs) +(puthash "\\^g" "\u1d4d" julia-latexsubs) +(puthash "\\^k" "\u1d4f" julia-latexsubs) +(puthash "\\^m" "\u1d50" julia-latexsubs) +(puthash "\\^o" "\u1d52" julia-latexsubs) +(puthash "\\^p" "\u1d56" julia-latexsubs) +(puthash "\\^t" "\u1d57" julia-latexsubs) +(puthash "\\^u" "\u1d58" julia-latexsubs) +(puthash "\\^v" "\u1d5b" julia-latexsubs) +(puthash "\\^beta" "\u1d5d" julia-latexsubs) +(puthash "\\^gamma" "\u1d5e" julia-latexsubs) +(puthash "\\^delta" "\u1d5f" julia-latexsubs) +(puthash "\\^phi" "\u1d60" julia-latexsubs) +(puthash "\\^chi" "\u1d61" julia-latexsubs) +(puthash "\\_i" "\u1d62" julia-latexsubs) +(puthash "\\_r" "\u1d63" julia-latexsubs) +(puthash "\\_u" "\u1d64" julia-latexsubs) +(puthash "\\_v" "\u1d65" julia-latexsubs) +(puthash "\\_beta" "\u1d66" julia-latexsubs) +(puthash "\\_gamma" "\u1d67" julia-latexsubs) +(puthash "\\_rho" "\u1d68" julia-latexsubs) +(puthash "\\_phi" "\u1d69" julia-latexsubs) +(puthash "\\_chi" "\u1d6a" julia-latexsubs) +(puthash "\\^c" "\u1d9c" julia-latexsubs) +(puthash "\\^f" "\u1da0" julia-latexsubs) +(puthash "\\^iota" "\u1da5" julia-latexsubs) +(puthash "\\^Phi" "\u1db2" julia-latexsubs) +(puthash "\\^z" "\u1dbb" julia-latexsubs) +(puthash "\\^theta" "\u1dbf" julia-latexsubs) +(puthash "\\enspace" " " julia-latexsubs) +(puthash "\\quad" " " julia-latexsubs) +(puthash "\\thickspace" " " julia-latexsubs) +(puthash "\\thinspace" " " julia-latexsubs) +(puthash "\\hspace" " " julia-latexsubs) +(puthash "\\endash" "–" julia-latexsubs) +(puthash "\\emdash" "—" julia-latexsubs) +(puthash "\\Vert" "‖" julia-latexsubs) +(puthash "\\lq" "‘" julia-latexsubs) +(puthash "\\rq" "’" julia-latexsubs) +(puthash "\\Elzreapos" "‛" julia-latexsubs) +(puthash "\\textquotedblleft" "“" julia-latexsubs) +(puthash "\\textquotedblright" "”" julia-latexsubs) +(puthash "\\dagger" "†" julia-latexsubs) +(puthash "\\ddagger" "‡" julia-latexsubs) +(puthash "\\bullet" "•" julia-latexsubs) +(puthash "\\dots" "…" julia-latexsubs) +(puthash "\\textperthousand" "‰" julia-latexsubs) +(puthash "\\textpertenthousand" "‱" julia-latexsubs) +(puthash "\\prime" "′" julia-latexsubs) +(puthash "\\pprime" "″" julia-latexsubs) +(puthash "\\ppprime" "‴" julia-latexsubs) +(puthash "\\backprime" "‵" julia-latexsubs) +(puthash "\\backpprime" "‶" julia-latexsubs) +(puthash "\\backppprime" "‷" julia-latexsubs) +(puthash "\\guilsinglleft" "‹" julia-latexsubs) +(puthash "\\guilsinglright" "›" julia-latexsubs) +(puthash "\\tieconcat" "⁀" julia-latexsubs) +(puthash "\\pppprime" "⁗" julia-latexsubs) +(puthash "\\nolinebreak" "\u2060" julia-latexsubs) +(puthash "\\^0" "⁰" julia-latexsubs) +(puthash "\\^i" "ⁱ" julia-latexsubs) +(puthash "\\^4" "⁴" julia-latexsubs) +(puthash "\\^5" "⁵" julia-latexsubs) +(puthash "\\^6" "⁶" julia-latexsubs) +(puthash "\\^7" "⁷" julia-latexsubs) +(puthash "\\^8" "⁸" julia-latexsubs) +(puthash "\\^9" "⁹" julia-latexsubs) +(puthash "\\^+" "⁺" julia-latexsubs) +(puthash "\\^-" "⁻" julia-latexsubs) +(puthash "\\^=" "⁼" julia-latexsubs) +(puthash "\\^(" "⁽" julia-latexsubs) +(puthash "\\^)" "⁾" julia-latexsubs) +(puthash "\\^n" "ⁿ" julia-latexsubs) +(puthash "\\_0" "₀" julia-latexsubs) +(puthash "\\_1" "₁" julia-latexsubs) +(puthash "\\_2" "₂" julia-latexsubs) +(puthash "\\_3" "₃" julia-latexsubs) +(puthash "\\_4" "₄" julia-latexsubs) +(puthash "\\_5" "₅" julia-latexsubs) +(puthash "\\_6" "₆" julia-latexsubs) +(puthash "\\_7" "₇" julia-latexsubs) +(puthash "\\_8" "₈" julia-latexsubs) +(puthash "\\_9" "₉" julia-latexsubs) +(puthash "\\_+" "₊" julia-latexsubs) +(puthash "\\_-" "₋" julia-latexsubs) +(puthash "\\_=" "₌" julia-latexsubs) +(puthash "\\_(" "₍" julia-latexsubs) +(puthash "\\_)" "₎" julia-latexsubs) +(puthash "\\_a" "\u2090" julia-latexsubs) +(puthash "\\_e" "\u2091" julia-latexsubs) +(puthash "\\_o" "\u2092" julia-latexsubs) +(puthash "\\_x" "\u2093" julia-latexsubs) +(puthash "\\_schwa" "\u2094" julia-latexsubs) +(puthash "\\_h" "\u2095" julia-latexsubs) +(puthash "\\_k" "\u2096" julia-latexsubs) +(puthash "\\_l" "\u2097" julia-latexsubs) +(puthash "\\_m" "\u2098" julia-latexsubs) +(puthash "\\_n" "\u2099" julia-latexsubs) +(puthash "\\_p" "\u209a" julia-latexsubs) +(puthash "\\_s" "\u209b" julia-latexsubs) +(puthash "\\_t" "\u209c" julia-latexsubs) +(puthash "\\Elzpes" "₧" julia-latexsubs) +(puthash "\\euro" "€" julia-latexsubs) +(puthash "\\leftharpoonaccent" "⃐" julia-latexsubs) +(puthash "\\rightharpoonaccent" "⃑" julia-latexsubs) +(puthash "\\vertoverlay" "⃒" julia-latexsubs) +(puthash "\\overleftarrow" "⃖" julia-latexsubs) +(puthash "\\vec" "⃗" julia-latexsubs) +(puthash "\\dddot" "⃛" julia-latexsubs) +(puthash "\\ddddot" "⃜" julia-latexsubs) +(puthash "\\enclosecircle" "⃝" julia-latexsubs) +(puthash "\\enclosesquare" "⃞" julia-latexsubs) +(puthash "\\enclosediamond" "⃟" julia-latexsubs) +(puthash "\\overleftrightarrow" "⃡" julia-latexsubs) +(puthash "\\enclosetriangle" "⃤" julia-latexsubs) +(puthash "\\annuity" "⃧" julia-latexsubs) +(puthash "\\threeunderdot" "⃨" julia-latexsubs) +(puthash "\\widebridgeabove" "⃩" julia-latexsubs) +(puthash "\\underrightharpoondown" "\u20ec" julia-latexsubs) +(puthash "\\underleftharpoondown" "\u20ed" julia-latexsubs) +(puthash "\\underleftarrow" "\u20ee" julia-latexsubs) +(puthash "\\underrightarrow" "\u20ef" julia-latexsubs) +(puthash "\\asteraccent" "\u20f0" julia-latexsubs) +(puthash "\\BbbC" "ℂ" julia-latexsubs) +(puthash "\\Eulerconst" "ℇ" julia-latexsubs) +(puthash "\\mscrg" "ℊ" julia-latexsubs) +(puthash "\\mscrH" "ℋ" julia-latexsubs) +(puthash "\\mfrakH" "ℌ" julia-latexsubs) +(puthash "\\BbbH" "ℍ" julia-latexsubs) +(puthash "\\Planckconst" "ℎ" julia-latexsubs) +(puthash "\\hslash" "ℏ" julia-latexsubs) +(puthash "\\mscrI" "ℐ" julia-latexsubs) +(puthash "\\Im" "ℑ" julia-latexsubs) +(puthash "\\mscrL" "ℒ" julia-latexsubs) +(puthash "\\ell" "ℓ" julia-latexsubs) +(puthash "\\BbbN" "ℕ" julia-latexsubs) +(puthash "\\textnumero" "№" julia-latexsubs) +(puthash "\\wp" "℘" julia-latexsubs) +(puthash "\\BbbP" "ℙ" julia-latexsubs) +(puthash "\\BbbQ" "ℚ" julia-latexsubs) +(puthash "\\mscrR" "ℛ" julia-latexsubs) +(puthash "\\Re" "ℜ" julia-latexsubs) +(puthash "\\BbbR" "ℝ" julia-latexsubs) +(puthash "\\Elzxrat" "℞" julia-latexsubs) +(puthash "\\texttrademark" "™" julia-latexsubs) +(puthash "\\BbbZ" "ℤ" julia-latexsubs) +(puthash "\\mho" "℧" julia-latexsubs) +(puthash "\\mfrakZ" "ℨ" julia-latexsubs) +(puthash "\\turnediota" "℩" julia-latexsubs) +(puthash "\\Angstrom" "Å" julia-latexsubs) +(puthash "\\mscrB" "ℬ" julia-latexsubs) +(puthash "\\mfrakC" "ℭ" julia-latexsubs) +(puthash "\\mscre" "ℯ" julia-latexsubs) +(puthash "\\mscrE" "ℰ" julia-latexsubs) +(puthash "\\mscrF" "ℱ" julia-latexsubs) +(puthash "\\Finv" "Ⅎ" julia-latexsubs) +(puthash "\\mscrM" "ℳ" julia-latexsubs) +(puthash "\\mscro" "ℴ" julia-latexsubs) +(puthash "\\aleph" "ℵ" julia-latexsubs) +(puthash "\\beth" "ℶ" julia-latexsubs) +(puthash "\\gimel" "ℷ" julia-latexsubs) +(puthash "\\daleth" "ℸ" julia-latexsubs) +(puthash "\\Bbbpi" "\u213c" julia-latexsubs) +(puthash "\\Bbbgamma" "ℽ" julia-latexsubs) +(puthash "\\BbbGamma" "ℾ" julia-latexsubs) +(puthash "\\BbbPi" "ℿ" julia-latexsubs) +(puthash "\\bbsum" "⅀" julia-latexsubs) +(puthash "\\Game" "⅁" julia-latexsubs) +(puthash "\\sansLturned" "⅂" julia-latexsubs) +(puthash "\\sansLmirrored" "⅃" julia-latexsubs) +(puthash "\\Yup" "⅄" julia-latexsubs) +(puthash "\\mitBbbD" "ⅅ" julia-latexsubs) +(puthash "\\mitBbbd" "ⅆ" julia-latexsubs) +(puthash "\\mitBbbe" "ⅇ" julia-latexsubs) +(puthash "\\mitBbbi" "ⅈ" julia-latexsubs) +(puthash "\\mitBbbj" "ⅉ" julia-latexsubs) +(puthash "\\PropertyLine" "⅊" julia-latexsubs) +(puthash "\\upand" "⅋" julia-latexsubs) +(puthash "\\leftarrow" "←" julia-latexsubs) +(puthash "\\uparrow" "↑" julia-latexsubs) +(puthash "\\rightarrow" "→" julia-latexsubs) +(puthash "\\downarrow" "↓" julia-latexsubs) +(puthash "\\leftrightarrow" "↔" julia-latexsubs) +(puthash "\\updownarrow" "↕" julia-latexsubs) +(puthash "\\nwarrow" "↖" julia-latexsubs) +(puthash "\\nearrow" "↗" julia-latexsubs) +(puthash "\\searrow" "↘" julia-latexsubs) +(puthash "\\swarrow" "↙" julia-latexsubs) +(puthash "\\nleftarrow" "↚" julia-latexsubs) +(puthash "\\nrightarrow" "↛" julia-latexsubs) +(puthash "\\twoheadleftarrow" "↞" julia-latexsubs) +(puthash "\\twoheaduparrow" "↟" julia-latexsubs) +(puthash "\\twoheadrightarrow" "↠" julia-latexsubs) +(puthash "\\twoheaddownarrow" "↡" julia-latexsubs) +(puthash "\\leftarrowtail" "↢" julia-latexsubs) +(puthash "\\rightarrowtail" "↣" julia-latexsubs) +(puthash "\\mapsfrom" "↤" julia-latexsubs) +(puthash "\\mapsup" "↥" julia-latexsubs) +(puthash "\\mapsto" "↦" julia-latexsubs) +(puthash "\\mapsdown" "↧" julia-latexsubs) +(puthash "\\updownarrowbar" "↨" julia-latexsubs) +(puthash "\\hookleftarrow" "↩" julia-latexsubs) +(puthash "\\hookrightarrow" "↪" julia-latexsubs) +(puthash "\\looparrowleft" "↫" julia-latexsubs) +(puthash "\\looparrowright" "↬" julia-latexsubs) +(puthash "\\leftrightsquigarrow" "↭" julia-latexsubs) +(puthash "\\nleftrightarrow" "↮" julia-latexsubs) +(puthash "\\downzigzagarrow" "↯" julia-latexsubs) +(puthash "\\Lsh" "↰" julia-latexsubs) +(puthash "\\Rsh" "↱" julia-latexsubs) +(puthash "\\Ldsh" "↲" julia-latexsubs) +(puthash "\\Rdsh" "↳" julia-latexsubs) +(puthash "\\linefeed" "↴" julia-latexsubs) +(puthash "\\carriagereturn" "↵" julia-latexsubs) +(puthash "\\curvearrowleft" "↶" julia-latexsubs) +(puthash "\\curvearrowright" "↷" julia-latexsubs) +(puthash "\\barovernorthwestarrow" "↸" julia-latexsubs) +(puthash "\\barleftarrowrightarrowbar" "↹" julia-latexsubs) +(puthash "\\circlearrowleft" "↺" julia-latexsubs) +(puthash "\\circlearrowright" "↻" julia-latexsubs) +(puthash "\\leftharpoonup" "↼" julia-latexsubs) +(puthash "\\leftharpoondown" "↽" julia-latexsubs) +(puthash "\\upharpoonleft" "↾" julia-latexsubs) +(puthash "\\upharpoonright" "↿" julia-latexsubs) +(puthash "\\rightharpoonup" "⇀" julia-latexsubs) +(puthash "\\rightharpoondown" "⇁" julia-latexsubs) +(puthash "\\downharpoonright" "⇂" julia-latexsubs) +(puthash "\\downharpoonleft" "⇃" julia-latexsubs) +(puthash "\\rightleftarrows" "⇄" julia-latexsubs) +(puthash "\\dblarrowupdown" "⇅" julia-latexsubs) +(puthash "\\leftrightarrows" "⇆" julia-latexsubs) +(puthash "\\leftleftarrows" "⇇" julia-latexsubs) +(puthash "\\upuparrows" "⇈" julia-latexsubs) +(puthash "\\rightrightarrows" "⇉" julia-latexsubs) +(puthash "\\downdownarrows" "⇊" julia-latexsubs) +(puthash "\\leftrightharpoons" "⇋" julia-latexsubs) +(puthash "\\rightleftharpoons" "⇌" julia-latexsubs) +(puthash "\\nLeftarrow" "⇍" julia-latexsubs) +(puthash "\\nLeftrightarrow" "⇎" julia-latexsubs) +(puthash "\\nRightarrow" "⇏" julia-latexsubs) +(puthash "\\Leftarrow" "⇐" julia-latexsubs) +(puthash "\\Uparrow" "⇑" julia-latexsubs) +(puthash "\\Rightarrow" "⇒" julia-latexsubs) +(puthash "\\Downarrow" "⇓" julia-latexsubs) +(puthash "\\Leftrightarrow" "⇔" julia-latexsubs) +(puthash "\\Updownarrow" "⇕" julia-latexsubs) +(puthash "\\Nwarrow" "⇖" julia-latexsubs) +(puthash "\\Nearrow" "⇗" julia-latexsubs) +(puthash "\\Searrow" "⇘" julia-latexsubs) +(puthash "\\Swarrow" "⇙" julia-latexsubs) +(puthash "\\Lleftarrow" "⇚" julia-latexsubs) +(puthash "\\Rrightarrow" "⇛" julia-latexsubs) +(puthash "\\leftsquigarrow" "⇜" julia-latexsubs) +(puthash "\\rightsquigarrow" "⇝" julia-latexsubs) +(puthash "\\nHuparrow" "⇞" julia-latexsubs) +(puthash "\\nHdownarrow" "⇟" julia-latexsubs) +(puthash "\\leftdasharrow" "⇠" julia-latexsubs) +(puthash "\\updasharrow" "⇡" julia-latexsubs) +(puthash "\\rightdasharrow" "⇢" julia-latexsubs) +(puthash "\\downdasharrow" "⇣" julia-latexsubs) +(puthash "\\barleftarrow" "⇤" julia-latexsubs) +(puthash "\\rightarrowbar" "⇥" julia-latexsubs) +(puthash "\\leftwhitearrow" "⇦" julia-latexsubs) +(puthash "\\upwhitearrow" "⇧" julia-latexsubs) +(puthash "\\rightwhitearrow" "⇨" julia-latexsubs) +(puthash "\\downwhitearrow" "⇩" julia-latexsubs) +(puthash "\\whitearrowupfrombar" "⇪" julia-latexsubs) +(puthash "\\circleonrightarrow" "⇴" julia-latexsubs) +(puthash "\\DownArrowUpArrow" "⇵" julia-latexsubs) +(puthash "\\rightthreearrows" "⇶" julia-latexsubs) +(puthash "\\nvleftarrow" "⇷" julia-latexsubs) +(puthash "\\nvrightarrow" "⇸" julia-latexsubs) +(puthash "\\nvleftrightarrow" "⇹" julia-latexsubs) +(puthash "\\nVleftarrow" "⇺" julia-latexsubs) +(puthash "\\nVrightarrow" "⇻" julia-latexsubs) +(puthash "\\nVleftrightarrow" "⇼" julia-latexsubs) +(puthash "\\leftarrowtriangle" "⇽" julia-latexsubs) +(puthash "\\rightarrowtriangle" "⇾" julia-latexsubs) +(puthash "\\leftrightarrowtriangle" "⇿" julia-latexsubs) +(puthash "\\forall" "∀" julia-latexsubs) +(puthash "\\complement" "∁" julia-latexsubs) +(puthash "\\partial" "∂" julia-latexsubs) +(puthash "\\exists" "∃" julia-latexsubs) +(puthash "\\nexists" "∄" julia-latexsubs) +(puthash "\\varnothing" "∅" julia-latexsubs) +(puthash "\\increment" "∆" julia-latexsubs) +(puthash "\\del" "∇" julia-latexsubs) +(puthash "\\nabla" "∇" julia-latexsubs) +(puthash "\\in" "∈" julia-latexsubs) +(puthash "\\notin" "∉" julia-latexsubs) +(puthash "\\smallin" "∊" julia-latexsubs) +(puthash "\\ni" "∋" julia-latexsubs) +(puthash "\\nni" "∌" julia-latexsubs) +(puthash "\\smallni" "∍" julia-latexsubs) +(puthash "\\QED" "∎" julia-latexsubs) +(puthash "\\prod" "∏" julia-latexsubs) +(puthash "\\coprod" "∐" julia-latexsubs) +(puthash "\\sum" "∑" julia-latexsubs) +(puthash "\\minus" "−" julia-latexsubs) +(puthash "\\mp" "∓" julia-latexsubs) +(puthash "\\dotplus" "∔" julia-latexsubs) +(puthash "\\setminus" "∖" julia-latexsubs) +(puthash "\\ast" "∗" julia-latexsubs) +(puthash "\\circ" "∘" julia-latexsubs) +(puthash "\\vysmblkcircle" "∙" julia-latexsubs) +(puthash "\\surd" "√" julia-latexsubs) +(puthash "\\sqrt" "√" julia-latexsubs) +(puthash "\\cbrt" "∛" julia-latexsubs) +(puthash "\\fourthroot" "∜" julia-latexsubs) +(puthash "\\propto" "∝" julia-latexsubs) +(puthash "\\infty" "∞" julia-latexsubs) +(puthash "\\rightangle" "∟" julia-latexsubs) +(puthash "\\angle" "∠" julia-latexsubs) +(puthash "\\measuredangle" "∡" julia-latexsubs) +(puthash "\\sphericalangle" "∢" julia-latexsubs) +(puthash "\\mid" "∣" julia-latexsubs) +(puthash "\\nmid" "∤" julia-latexsubs) +(puthash "\\parallel" "∥" julia-latexsubs) +(puthash "\\nparallel" "∦" julia-latexsubs) +(puthash "\\wedge" "∧" julia-latexsubs) +(puthash "\\vee" "∨" julia-latexsubs) +(puthash "\\cap" "∩" julia-latexsubs) +(puthash "\\cup" "∪" julia-latexsubs) +(puthash "\\int" "∫" julia-latexsubs) +(puthash "\\iint" "∬" julia-latexsubs) +(puthash "\\iiint" "∭" julia-latexsubs) +(puthash "\\oint" "∮" julia-latexsubs) +(puthash "\\oiint" "∯" julia-latexsubs) +(puthash "\\oiiint" "∰" julia-latexsubs) +(puthash "\\clwintegral" "∱" julia-latexsubs) +(puthash "\\varointclockwise" "∲" julia-latexsubs) +(puthash "\\ointctrclockwise" "∳" julia-latexsubs) +(puthash "\\therefore" "∴" julia-latexsubs) +(puthash "\\because" "∵" julia-latexsubs) +(puthash "\\Colon" "∷" julia-latexsubs) +(puthash "\\dotminus" "∸" julia-latexsubs) +(puthash "\\dotsminusdots" "∺" julia-latexsubs) +(puthash "\\kernelcontraction" "∻" julia-latexsubs) +(puthash "\\sim" "∼" julia-latexsubs) +(puthash "\\backsim" "∽" julia-latexsubs) +(puthash "\\lazysinv" "∾" julia-latexsubs) +(puthash "\\sinewave" "∿" julia-latexsubs) +(puthash "\\wr" "≀" julia-latexsubs) +(puthash "\\nsim" "≁" julia-latexsubs) +(puthash "\\eqsim" "≂" julia-latexsubs) +(puthash "\\neqsim" "≂̸" julia-latexsubs) +(puthash "\\simeq" "≃" julia-latexsubs) +(puthash "\\nsime" "≄" julia-latexsubs) +(puthash "\\cong" "≅" julia-latexsubs) +(puthash "\\approxnotequal" "≆" julia-latexsubs) +(puthash "\\ncong" "≇" julia-latexsubs) +(puthash "\\approx" "≈" julia-latexsubs) +(puthash "\\napprox" "≉" julia-latexsubs) +(puthash "\\approxeq" "≊" julia-latexsubs) +(puthash "\\tildetrpl" "≋" julia-latexsubs) +(puthash "\\allequal" "≌" julia-latexsubs) +(puthash "\\asymp" "≍" julia-latexsubs) +(puthash "\\Bumpeq" "≎" julia-latexsubs) +(puthash "\\nBumpeq" "≎̸" julia-latexsubs) +(puthash "\\bumpeq" "≏" julia-latexsubs) +(puthash "\\nbumpeq" "≏̸" julia-latexsubs) +(puthash "\\doteq" "≐" julia-latexsubs) +(puthash "\\Doteq" "≑" julia-latexsubs) +(puthash "\\fallingdotseq" "≒" julia-latexsubs) +(puthash "\\risingdotseq" "≓" julia-latexsubs) +(puthash "\\coloneq" "≔" julia-latexsubs) +(puthash "\\eqcolon" "≕" julia-latexsubs) +(puthash "\\eqcirc" "≖" julia-latexsubs) +(puthash "\\circeq" "≗" julia-latexsubs) +(puthash "\\arceq" "≘" julia-latexsubs) +(puthash "\\wedgeq" "≙" julia-latexsubs) +(puthash "\\veeeq" "≚" julia-latexsubs) +(puthash "\\starequal" "≛" julia-latexsubs) +(puthash "\\triangleq" "≜" julia-latexsubs) +(puthash "\\eqdef" "≝" julia-latexsubs) +(puthash "\\measeq" "≞" julia-latexsubs) +(puthash "\\questeq" "≟" julia-latexsubs) +(puthash "\\ne" "≠" julia-latexsubs) +(puthash "\\equiv" "≡" julia-latexsubs) +(puthash "\\nequiv" "≢" julia-latexsubs) +(puthash "\\Equiv" "≣" julia-latexsubs) +(puthash "\\le" "≤" julia-latexsubs) +(puthash "\\ge" "≥" julia-latexsubs) +(puthash "\\leqq" "≦" julia-latexsubs) +(puthash "\\geqq" "≧" julia-latexsubs) +(puthash "\\lneqq" "≨" julia-latexsubs) +(puthash "\\lvertneqq" "≨︀" julia-latexsubs) +(puthash "\\gneqq" "≩" julia-latexsubs) +(puthash "\\gvertneqq" "≩︀" julia-latexsubs) +(puthash "\\ll" "≪" julia-latexsubs) +(puthash "\\NotLessLess" "≪̸" julia-latexsubs) +(puthash "\\gg" "≫" julia-latexsubs) +(puthash "\\NotGreaterGreater" "≫̸" julia-latexsubs) +(puthash "\\between" "≬" julia-latexsubs) +(puthash "\\nasymp" "≭" julia-latexsubs) +(puthash "\\nless" "≮" julia-latexsubs) +(puthash "\\ngtr" "≯" julia-latexsubs) +(puthash "\\nleq" "≰" julia-latexsubs) +(puthash "\\ngeq" "≱" julia-latexsubs) +(puthash "\\lesssim" "≲" julia-latexsubs) +(puthash "\\gtrsim" "≳" julia-latexsubs) +(puthash "\\nlesssim" "≴" julia-latexsubs) +(puthash "\\ngtrsim" "≵" julia-latexsubs) +(puthash "\\lessgtr" "≶" julia-latexsubs) +(puthash "\\gtrless" "≷" julia-latexsubs) +(puthash "\\notlessgreater" "≸" julia-latexsubs) +(puthash "\\notgreaterless" "≹" julia-latexsubs) +(puthash "\\prec" "≺" julia-latexsubs) +(puthash "\\succ" "≻" julia-latexsubs) +(puthash "\\preccurlyeq" "≼" julia-latexsubs) +(puthash "\\succcurlyeq" "≽" julia-latexsubs) +(puthash "\\precsim" "≾" julia-latexsubs) +(puthash "\\nprecsim" "≾̸" julia-latexsubs) +(puthash "\\succsim" "≿" julia-latexsubs) +(puthash "\\nsuccsim" "≿̸" julia-latexsubs) +(puthash "\\nprec" "⊀" julia-latexsubs) +(puthash "\\nsucc" "⊁" julia-latexsubs) +(puthash "\\subset" "⊂" julia-latexsubs) +(puthash "\\supset" "⊃" julia-latexsubs) +(puthash "\\nsubset" "⊄" julia-latexsubs) +(puthash "\\nsupset" "⊅" julia-latexsubs) +(puthash "\\subseteq" "⊆" julia-latexsubs) +(puthash "\\supseteq" "⊇" julia-latexsubs) +(puthash "\\nsubseteq" "⊈" julia-latexsubs) +(puthash "\\nsupseteq" "⊉" julia-latexsubs) +(puthash "\\subsetneq" "⊊" julia-latexsubs) +(puthash "\\varsubsetneqq" "⊊︀" julia-latexsubs) +(puthash "\\supsetneq" "⊋" julia-latexsubs) +(puthash "\\varsupsetneq" "⊋︀" julia-latexsubs) +(puthash "\\cupdot" "⊍" julia-latexsubs) +(puthash "\\uplus" "⊎" julia-latexsubs) +(puthash "\\sqsubset" "⊏" julia-latexsubs) +(puthash "\\NotSquareSubset" "⊏̸" julia-latexsubs) +(puthash "\\sqsupset" "⊐" julia-latexsubs) +(puthash "\\NotSquareSuperset" "⊐̸" julia-latexsubs) +(puthash "\\sqsubseteq" "⊑" julia-latexsubs) +(puthash "\\sqsupseteq" "⊒" julia-latexsubs) +(puthash "\\sqcap" "⊓" julia-latexsubs) +(puthash "\\sqcup" "⊔" julia-latexsubs) +(puthash "\\oplus" "⊕" julia-latexsubs) +(puthash "\\ominus" "⊖" julia-latexsubs) +(puthash "\\otimes" "⊗" julia-latexsubs) +(puthash "\\oslash" "⊘" julia-latexsubs) +(puthash "\\odot" "⊙" julia-latexsubs) +(puthash "\\circledcirc" "⊚" julia-latexsubs) +(puthash "\\circledast" "⊛" julia-latexsubs) +(puthash "\\circledequal" "⊜" julia-latexsubs) +(puthash "\\circleddash" "⊝" julia-latexsubs) +(puthash "\\boxplus" "⊞" julia-latexsubs) +(puthash "\\boxminus" "⊟" julia-latexsubs) +(puthash "\\boxtimes" "⊠" julia-latexsubs) +(puthash "\\boxdot" "⊡" julia-latexsubs) +(puthash "\\vdash" "⊢" julia-latexsubs) +(puthash "\\dashv" "⊣" julia-latexsubs) +(puthash "\\top" "⊤" julia-latexsubs) +(puthash "\\bot" "⊥" julia-latexsubs) +(puthash "\\models" "⊧" julia-latexsubs) +(puthash "\\vDash" "⊨" julia-latexsubs) +(puthash "\\Vdash" "⊩" julia-latexsubs) +(puthash "\\Vvdash" "⊪" julia-latexsubs) +(puthash "\\VDash" "⊫" julia-latexsubs) +(puthash "\\nvdash" "⊬" julia-latexsubs) +(puthash "\\nvDash" "⊭" julia-latexsubs) +(puthash "\\nVdash" "⊮" julia-latexsubs) +(puthash "\\nVDash" "⊯" julia-latexsubs) +(puthash "\\prurel" "⊰" julia-latexsubs) +(puthash "\\scurel" "⊱" julia-latexsubs) +(puthash "\\vartriangleleft" "⊲" julia-latexsubs) +(puthash "\\vartriangleright" "⊳" julia-latexsubs) +(puthash "\\trianglelefteq" "⊴" julia-latexsubs) +(puthash "\\trianglerighteq" "⊵" julia-latexsubs) +(puthash "\\original" "⊶" julia-latexsubs) +(puthash "\\image" "⊷" julia-latexsubs) +(puthash "\\multimap" "⊸" julia-latexsubs) +(puthash "\\hermitconjmatrix" "⊹" julia-latexsubs) +(puthash "\\intercal" "⊺" julia-latexsubs) +(puthash "\\veebar" "⊻" julia-latexsubs) +(puthash "\\barwedge" "⊼" julia-latexsubs) +(puthash "\\barvee" "⊽" julia-latexsubs) +(puthash "\\rightanglearc" "⊾" julia-latexsubs) +(puthash "\\varlrtriangle" "⊿" julia-latexsubs) +(puthash "\\bigwedge" "⋀" julia-latexsubs) +(puthash "\\bigvee" "⋁" julia-latexsubs) +(puthash "\\bigcap" "⋂" julia-latexsubs) +(puthash "\\bigcup" "⋃" julia-latexsubs) +(puthash "\\diamond" "⋄" julia-latexsubs) +(puthash "\\cdot" "⋅" julia-latexsubs) +(puthash "\\star" "⋆" julia-latexsubs) +(puthash "\\divideontimes" "⋇" julia-latexsubs) +(puthash "\\bowtie" "⋈" julia-latexsubs) +(puthash "\\ltimes" "⋉" julia-latexsubs) +(puthash "\\rtimes" "⋊" julia-latexsubs) +(puthash "\\leftthreetimes" "⋋" julia-latexsubs) +(puthash "\\rightthreetimes" "⋌" julia-latexsubs) +(puthash "\\backsimeq" "⋍" julia-latexsubs) +(puthash "\\curlyvee" "⋎" julia-latexsubs) +(puthash "\\curlywedge" "⋏" julia-latexsubs) +(puthash "\\Subset" "⋐" julia-latexsubs) +(puthash "\\Supset" "⋑" julia-latexsubs) +(puthash "\\Cap" "⋒" julia-latexsubs) +(puthash "\\Cup" "⋓" julia-latexsubs) +(puthash "\\pitchfork" "⋔" julia-latexsubs) +(puthash "\\equalparallel" "⋕" julia-latexsubs) +(puthash "\\lessdot" "⋖" julia-latexsubs) +(puthash "\\gtrdot" "⋗" julia-latexsubs) +(puthash "\\verymuchless" "⋘" julia-latexsubs) +(puthash "\\ggg" "⋙" julia-latexsubs) +(puthash "\\lesseqgtr" "⋚" julia-latexsubs) +(puthash "\\gtreqless" "⋛" julia-latexsubs) +(puthash "\\eqless" "⋜" julia-latexsubs) +(puthash "\\eqgtr" "⋝" julia-latexsubs) +(puthash "\\curlyeqprec" "⋞" julia-latexsubs) +(puthash "\\curlyeqsucc" "⋟" julia-latexsubs) +(puthash "\\npreccurlyeq" "⋠" julia-latexsubs) +(puthash "\\nsucccurlyeq" "⋡" julia-latexsubs) +(puthash "\\nsqsubseteq" "⋢" julia-latexsubs) +(puthash "\\nsqsupseteq" "⋣" julia-latexsubs) +(puthash "\\sqsubsetneq" "⋤" julia-latexsubs) +(puthash "\\Elzsqspne" "⋥" julia-latexsubs) +(puthash "\\lnsim" "⋦" julia-latexsubs) +(puthash "\\gnsim" "⋧" julia-latexsubs) +(puthash "\\precnsim" "⋨" julia-latexsubs) +(puthash "\\succnsim" "⋩" julia-latexsubs) +(puthash "\\ntriangleleft" "⋪" julia-latexsubs) +(puthash "\\ntriangleright" "⋫" julia-latexsubs) +(puthash "\\ntrianglelefteq" "⋬" julia-latexsubs) +(puthash "\\ntrianglerighteq" "⋭" julia-latexsubs) +(puthash "\\vdots" "⋮" julia-latexsubs) +(puthash "\\cdots" "⋯" julia-latexsubs) +(puthash "\\adots" "⋰" julia-latexsubs) +(puthash "\\ddots" "⋱" julia-latexsubs) +(puthash "\\disin" "⋲" julia-latexsubs) +(puthash "\\varisins" "⋳" julia-latexsubs) +(puthash "\\isins" "⋴" julia-latexsubs) +(puthash "\\isindot" "⋵" julia-latexsubs) +(puthash "\\varisinobar" "⋶" julia-latexsubs) +(puthash "\\isinobar" "⋷" julia-latexsubs) +(puthash "\\isinvb" "⋸" julia-latexsubs) +(puthash "\\isinE" "⋹" julia-latexsubs) +(puthash "\\nisd" "⋺" julia-latexsubs) +(puthash "\\varnis" "⋻" julia-latexsubs) +(puthash "\\nis" "⋼" julia-latexsubs) +(puthash "\\varniobar" "⋽" julia-latexsubs) +(puthash "\\niobar" "⋾" julia-latexsubs) +(puthash "\\bagmember" "⋿" julia-latexsubs) +(puthash "\\diameter" "⌀" julia-latexsubs) +(puthash "\\house" "⌂" julia-latexsubs) +(puthash "\\vardoublebarwedge" "⌆" julia-latexsubs) +(puthash "\\lceil" "⌈" julia-latexsubs) +(puthash "\\rceil" "⌉" julia-latexsubs) +(puthash "\\lfloor" "⌊" julia-latexsubs) +(puthash "\\rfloor" "⌋" julia-latexsubs) +(puthash "\\invnot" "⌐" julia-latexsubs) +(puthash "\\sqlozenge" "⌑" julia-latexsubs) +(puthash "\\profline" "⌒" julia-latexsubs) +(puthash "\\profsurf" "⌓" julia-latexsubs) +(puthash "\\recorder" "⌕" julia-latexsubs) +(puthash "\\viewdata" "⌗" julia-latexsubs) +(puthash "\\turnednot" "⌙" julia-latexsubs) +(puthash "\\ulcorner" "⌜" julia-latexsubs) +(puthash "\\urcorner" "⌝" julia-latexsubs) +(puthash "\\llcorner" "⌞" julia-latexsubs) +(puthash "\\lrcorner" "⌟" julia-latexsubs) +(puthash "\\frown" "⌢" julia-latexsubs) +(puthash "\\smile" "⌣" julia-latexsubs) +(puthash "\\varhexagonlrbonds" "⌬" julia-latexsubs) +(puthash "\\conictaper" "⌲" julia-latexsubs) +(puthash "\\topbot" "⌶" julia-latexsubs) +(puthash "\\obar" "⌽" julia-latexsubs) +(puthash "\\APLnotslash" "⌿" julia-latexsubs) +(puthash "\\APLnotbackslash" "⍀" julia-latexsubs) +(puthash "\\APLboxupcaret" "⍓" julia-latexsubs) +(puthash "\\APLboxquestion" "⍰" julia-latexsubs) +(puthash "\\hexagon" "⎔" julia-latexsubs) +(puthash "\\Elzdlcorn" "⎣" julia-latexsubs) +(puthash "\\lmoustache" "⎰" julia-latexsubs) +(puthash "\\rmoustache" "⎱" julia-latexsubs) +(puthash "\\overbracket" "⎴" julia-latexsubs) +(puthash "\\underbracket" "⎵" julia-latexsubs) +(puthash "\\bbrktbrk" "⎶" julia-latexsubs) +(puthash "\\sqrtbottom" "⎷" julia-latexsubs) +(puthash "\\lvboxline" "⎸" julia-latexsubs) +(puthash "\\rvboxline" "⎹" julia-latexsubs) +(puthash "\\varcarriagereturn" "⏎" julia-latexsubs) +(puthash "\\trapezium" "\u23e2" julia-latexsubs) +(puthash "\\benzenr" "\u23e3" julia-latexsubs) +(puthash "\\strns" "\u23e4" julia-latexsubs) +(puthash "\\fltns" "\u23e5" julia-latexsubs) +(puthash "\\accurrent" "\u23e6" julia-latexsubs) +(puthash "\\elinters" "\u23e7" julia-latexsubs) +(puthash "\\blanksymbol" "␢" julia-latexsubs) +(puthash "\\textvisiblespace" "␣" julia-latexsubs) +(puthash "\\circledS" "Ⓢ" julia-latexsubs) +(puthash "\\Elzdshfnc" "┆" julia-latexsubs) +(puthash "\\Elzsqfnw" "┙" julia-latexsubs) +(puthash "\\diagup" "╱" julia-latexsubs) +(puthash "\\diagdown" "╲" julia-latexsubs) +(puthash "\\blockuphalf" "▀" julia-latexsubs) +(puthash "\\blocklowhalf" "▄" julia-latexsubs) +(puthash "\\blockfull" "█" julia-latexsubs) +(puthash "\\blocklefthalf" "▌" julia-latexsubs) +(puthash "\\blockrighthalf" "▐" julia-latexsubs) +(puthash "\\blockqtrshaded" "░" julia-latexsubs) +(puthash "\\blockhalfshaded" "▒" julia-latexsubs) +(puthash "\\blockthreeqtrshaded" "▓" julia-latexsubs) +(puthash "\\blacksquare" "■" julia-latexsubs) +(puthash "\\square" "□" julia-latexsubs) +(puthash "\\squoval" "▢" julia-latexsubs) +(puthash "\\blackinwhitesquare" "▣" julia-latexsubs) +(puthash "\\squarehfill" "▤" julia-latexsubs) +(puthash "\\squarevfill" "▥" julia-latexsubs) +(puthash "\\squarehvfill" "▦" julia-latexsubs) +(puthash "\\squarenwsefill" "▧" julia-latexsubs) +(puthash "\\squareneswfill" "▨" julia-latexsubs) +(puthash "\\squarecrossfill" "▩" julia-latexsubs) +(puthash "\\smblksquare" "▪" julia-latexsubs) +(puthash "\\smwhtsquare" "▫" julia-latexsubs) +(puthash "\\hrectangleblack" "▬" julia-latexsubs) +(puthash "\\hrectangle" "▭" julia-latexsubs) +(puthash "\\vrectangleblack" "▮" julia-latexsubs) +(puthash "\\Elzvrecto" "▯" julia-latexsubs) +(puthash "\\parallelogramblack" "▰" julia-latexsubs) +(puthash "\\parallelogram" "▱" julia-latexsubs) +(puthash "\\bigblacktriangleup" "▲" julia-latexsubs) +(puthash "\\bigtriangleup" "△" julia-latexsubs) +(puthash "\\blacktriangle" "▴" julia-latexsubs) +(puthash "\\vartriangle" "▵" julia-latexsubs) +(puthash "\\blacktriangleright" "▶" julia-latexsubs) +(puthash "\\triangleright" "▹" julia-latexsubs) +(puthash "\\blackpointerright" "►" julia-latexsubs) +(puthash "\\whitepointerright" "▻" julia-latexsubs) +(puthash "\\bigblacktriangledown" "▼" julia-latexsubs) +(puthash "\\bigtriangledown" "▽" julia-latexsubs) +(puthash "\\blacktriangledown" "▾" julia-latexsubs) +(puthash "\\triangledown" "▿" julia-latexsubs) +(puthash "\\blacktriangleleft" "◀" julia-latexsubs) +(puthash "\\triangleleft" "◃" julia-latexsubs) +(puthash "\\blackpointerleft" "◄" julia-latexsubs) +(puthash "\\whitepointerleft" "◅" julia-latexsubs) +(puthash "\\mdlgblkdiamond" "◆" julia-latexsubs) +(puthash "\\mdlgwhtdiamond" "◇" julia-latexsubs) +(puthash "\\blackinwhitediamond" "◈" julia-latexsubs) +(puthash "\\fisheye" "◉" julia-latexsubs) +(puthash "\\lozenge" "◊" julia-latexsubs) +(puthash "\\bigcirc" "○" julia-latexsubs) +(puthash "\\dottedcircle" "◌" julia-latexsubs) +(puthash "\\circlevertfill" "◍" julia-latexsubs) +(puthash "\\bullseye" "◎" julia-latexsubs) +(puthash "\\mdlgblkcircle" "●" julia-latexsubs) +(puthash "\\Elzcirfl" "◐" julia-latexsubs) +(puthash "\\Elzcirfr" "◑" julia-latexsubs) +(puthash "\\Elzcirfb" "◒" julia-latexsubs) +(puthash "\\circletophalfblack" "◓" julia-latexsubs) +(puthash "\\circleurquadblack" "◔" julia-latexsubs) +(puthash "\\blackcircleulquadwhite" "◕" julia-latexsubs) +(puthash "\\blacklefthalfcircle" "◖" julia-latexsubs) +(puthash "\\blackrighthalfcircle" "◗" julia-latexsubs) +(puthash "\\Elzrvbull" "◘" julia-latexsubs) +(puthash "\\inversewhitecircle" "◙" julia-latexsubs) +(puthash "\\invwhiteupperhalfcircle" "◚" julia-latexsubs) +(puthash "\\invwhitelowerhalfcircle" "◛" julia-latexsubs) +(puthash "\\ularc" "◜" julia-latexsubs) +(puthash "\\urarc" "◝" julia-latexsubs) +(puthash "\\lrarc" "◞" julia-latexsubs) +(puthash "\\llarc" "◟" julia-latexsubs) +(puthash "\\topsemicircle" "◠" julia-latexsubs) +(puthash "\\botsemicircle" "◡" julia-latexsubs) +(puthash "\\lrblacktriangle" "◢" julia-latexsubs) +(puthash "\\llblacktriangle" "◣" julia-latexsubs) +(puthash "\\ulblacktriangle" "◤" julia-latexsubs) +(puthash "\\urblacktriangle" "◥" julia-latexsubs) +(puthash "\\smwhtcircle" "◦" julia-latexsubs) +(puthash "\\Elzsqfl" "◧" julia-latexsubs) +(puthash "\\Elzsqfr" "◨" julia-latexsubs) +(puthash "\\squareulblack" "◩" julia-latexsubs) +(puthash "\\Elzsqfse" "◪" julia-latexsubs) +(puthash "\\boxbar" "◫" julia-latexsubs) +(puthash "\\trianglecdot" "◬" julia-latexsubs) +(puthash "\\triangleleftblack" "◭" julia-latexsubs) +(puthash "\\trianglerightblack" "◮" julia-latexsubs) +(puthash "\\lgwhtcircle" "◯" julia-latexsubs) +(puthash "\\squareulquad" "◰" julia-latexsubs) +(puthash "\\squarellquad" "◱" julia-latexsubs) +(puthash "\\squarelrquad" "◲" julia-latexsubs) +(puthash "\\squareurquad" "◳" julia-latexsubs) +(puthash "\\circleulquad" "◴" julia-latexsubs) +(puthash "\\circlellquad" "◵" julia-latexsubs) +(puthash "\\circlelrquad" "◶" julia-latexsubs) +(puthash "\\circleurquad" "◷" julia-latexsubs) +(puthash "\\ultriangle" "◸" julia-latexsubs) +(puthash "\\urtriangle" "◹" julia-latexsubs) +(puthash "\\lltriangle" "◺" julia-latexsubs) +(puthash "\\mdwhtsquare" "◻" julia-latexsubs) +(puthash "\\mdblksquare" "◼" julia-latexsubs) +(puthash "\\mdsmwhtsquare" "◽" julia-latexsubs) +(puthash "\\mdsmblksquare" "◾" julia-latexsubs) +(puthash "\\lrtriangle" "◿" julia-latexsubs) +(puthash "\\bigstar" "★" julia-latexsubs) +(puthash "\\bigwhitestar" "☆" julia-latexsubs) +(puthash "\\astrosun" "☉" julia-latexsubs) +(puthash "\\danger" "☡" julia-latexsubs) +(puthash "\\blacksmiley" "☻" julia-latexsubs) +(puthash "\\sun" "☼" julia-latexsubs) +(puthash "\\rightmoon" "☽" julia-latexsubs) +(puthash "\\mercury" "☿" julia-latexsubs) +(puthash "\\venus" "♀" julia-latexsubs) +(puthash "\\female" "♀" julia-latexsubs) +(puthash "\\male" "♂" julia-latexsubs) +(puthash "\\mars" "♂" julia-latexsubs) +(puthash "\\jupiter" "♃" julia-latexsubs) +(puthash "\\saturn" "♄" julia-latexsubs) +(puthash "\\uranus" "♅" julia-latexsubs) +(puthash "\\neptune" "♆" julia-latexsubs) +(puthash "\\pluto" "♇" julia-latexsubs) +(puthash "\\aries" "♈" julia-latexsubs) +(puthash "\\taurus" "♉" julia-latexsubs) +(puthash "\\gemini" "♊" julia-latexsubs) +(puthash "\\cancer" "♋" julia-latexsubs) +(puthash "\\leo" "♌" julia-latexsubs) +(puthash "\\virgo" "♍" julia-latexsubs) +(puthash "\\libra" "♎" julia-latexsubs) +(puthash "\\scorpio" "♏" julia-latexsubs) +(puthash "\\sagittarius" "♐" julia-latexsubs) +(puthash "\\capricornus" "♑" julia-latexsubs) +(puthash "\\aquarius" "♒" julia-latexsubs) +(puthash "\\pisces" "♓" julia-latexsubs) +(puthash "\\spadesuit" "♠" julia-latexsubs) +(puthash "\\heartsuit" "♡" julia-latexsubs) +(puthash "\\diamondsuit" "♢" julia-latexsubs) +(puthash "\\clubsuit" "♣" julia-latexsubs) +(puthash "\\varspadesuit" "♤" julia-latexsubs) +(puthash "\\varheartsuit" "♥" julia-latexsubs) +(puthash "\\vardiamondsuit" "♦" julia-latexsubs) +(puthash "\\varclubsuit" "♧" julia-latexsubs) +(puthash "\\quarternote" "♩" julia-latexsubs) +(puthash "\\eighthnote" "♪" julia-latexsubs) +(puthash "\\twonotes" "♫" julia-latexsubs) +(puthash "\\flat" "♭" julia-latexsubs) +(puthash "\\natural" "♮" julia-latexsubs) +(puthash "\\sharp" "♯" julia-latexsubs) +(puthash "\\acidfree" "\u267e" julia-latexsubs) +(puthash "\\dicei" "⚀" julia-latexsubs) +(puthash "\\diceii" "⚁" julia-latexsubs) +(puthash "\\diceiii" "⚂" julia-latexsubs) +(puthash "\\diceiv" "⚃" julia-latexsubs) +(puthash "\\dicev" "⚄" julia-latexsubs) +(puthash "\\dicevi" "⚅" julia-latexsubs) +(puthash "\\circledrightdot" "⚆" julia-latexsubs) +(puthash "\\circledtwodots" "⚇" julia-latexsubs) +(puthash "\\blackcircledrightdot" "⚈" julia-latexsubs) +(puthash "\\blackcircledtwodots" "⚉" julia-latexsubs) +(puthash "\\Hermaphrodite" "\u26a5" julia-latexsubs) +(puthash "\\mdwhtcircle" "\u26aa" julia-latexsubs) +(puthash "\\mdblkcircle" "\u26ab" julia-latexsubs) +(puthash "\\mdsmwhtcircle" "\u26ac" julia-latexsubs) +(puthash "\\neuter" "\u26b2" julia-latexsubs) +(puthash "\\checkmark" "✓" julia-latexsubs) +(puthash "\\maltese" "✠" julia-latexsubs) +(puthash "\\circledstar" "✪" julia-latexsubs) +(puthash "\\varstar" "✶" julia-latexsubs) +(puthash "\\dingasterisk" "✽" julia-latexsubs) +(puthash "\\draftingarrow" "➛" julia-latexsubs) +(puthash "\\threedangle" "\u27c0" julia-latexsubs) +(puthash "\\whiteinwhitetriangle" "\u27c1" julia-latexsubs) +(puthash "\\perp" "\u27c2" julia-latexsubs) +(puthash "\\bsolhsub" "\u27c8" julia-latexsubs) +(puthash "\\suphsol" "\u27c9" julia-latexsubs) +(puthash "\\wedgedot" "⟑" julia-latexsubs) +(puthash "\\upin" "⟒" julia-latexsubs) +(puthash "\\bigbot" "⟘" julia-latexsubs) +(puthash "\\bigtop" "⟙" julia-latexsubs) +(puthash "\\langle" "⟨" julia-latexsubs) +(puthash "\\rangle" "⟩" julia-latexsubs) +(puthash "\\UUparrow" "⟰" julia-latexsubs) +(puthash "\\DDownarrow" "⟱" julia-latexsubs) +(puthash "\\longleftarrow" "⟵" julia-latexsubs) +(puthash "\\longrightarrow" "⟶" julia-latexsubs) +(puthash "\\longleftrightarrow" "⟷" julia-latexsubs) +(puthash "\\Longleftarrow" "⟸" julia-latexsubs) +(puthash "\\Longrightarrow" "⟹" julia-latexsubs) +(puthash "\\Longleftrightarrow" "⟺" julia-latexsubs) +(puthash "\\longmapsfrom" "⟻" julia-latexsubs) +(puthash "\\longmapsto" "⟼" julia-latexsubs) +(puthash "\\Longmapsfrom" "⟽" julia-latexsubs) +(puthash "\\Longmapsto" "⟾" julia-latexsubs) +(puthash "\\longrightsquigarrow" "⟿" julia-latexsubs) +(puthash "\\nvtwoheadrightarrow" "⤀" julia-latexsubs) +(puthash "\\nVtwoheadrightarrow" "⤁" julia-latexsubs) +(puthash "\\nvLeftarrow" "⤂" julia-latexsubs) +(puthash "\\nvRightarrow" "⤃" julia-latexsubs) +(puthash "\\nvLeftrightarrow" "⤄" julia-latexsubs) +(puthash "\\twoheadmapsto" "⤅" julia-latexsubs) +(puthash "\\Mapsfrom" "⤆" julia-latexsubs) +(puthash "\\Mapsto" "⤇" julia-latexsubs) +(puthash "\\downarrowbarred" "⤈" julia-latexsubs) +(puthash "\\uparrowbarred" "⤉" julia-latexsubs) +(puthash "\\Uuparrow" "⤊" julia-latexsubs) +(puthash "\\Ddownarrow" "⤋" julia-latexsubs) +(puthash "\\leftbkarrow" "⤌" julia-latexsubs) +(puthash "\\bkarow" "⤍" julia-latexsubs) +(puthash "\\leftdbkarrow" "⤎" julia-latexsubs) +(puthash "\\dbkarow" "⤏" julia-latexsubs) +(puthash "\\drbkarrow" "⤐" julia-latexsubs) +(puthash "\\rightdotarrow" "⤑" julia-latexsubs) +(puthash "\\UpArrowBar" "⤒" julia-latexsubs) +(puthash "\\DownArrowBar" "⤓" julia-latexsubs) +(puthash "\\nvrightarrowtail" "⤔" julia-latexsubs) +(puthash "\\nVrightarrowtail" "⤕" julia-latexsubs) +(puthash "\\twoheadrightarrowtail" "⤖" julia-latexsubs) +(puthash "\\nvtwoheadrightarrowtail" "⤗" julia-latexsubs) +(puthash "\\nVtwoheadrightarrowtail" "⤘" julia-latexsubs) +(puthash "\\diamondleftarrow" "⤝" julia-latexsubs) +(puthash "\\rightarrowdiamond" "⤞" julia-latexsubs) +(puthash "\\diamondleftarrowbar" "⤟" julia-latexsubs) +(puthash "\\barrightarrowdiamond" "⤠" julia-latexsubs) +(puthash "\\hksearow" "⤥" julia-latexsubs) +(puthash "\\hkswarow" "⤦" julia-latexsubs) +(puthash "\\tona" "⤧" julia-latexsubs) +(puthash "\\toea" "⤨" julia-latexsubs) +(puthash "\\tosa" "⤩" julia-latexsubs) +(puthash "\\towa" "⤪" julia-latexsubs) +(puthash "\\rdiagovfdiag" "⤫" julia-latexsubs) +(puthash "\\fdiagovrdiag" "⤬" julia-latexsubs) +(puthash "\\seovnearrow" "⤭" julia-latexsubs) +(puthash "\\neovsearrow" "⤮" julia-latexsubs) +(puthash "\\fdiagovnearrow" "⤯" julia-latexsubs) +(puthash "\\rdiagovsearrow" "⤰" julia-latexsubs) +(puthash "\\neovnwarrow" "⤱" julia-latexsubs) +(puthash "\\nwovnearrow" "⤲" julia-latexsubs) +(puthash "\\ElzRlarr" "⥂" julia-latexsubs) +(puthash "\\ElzrLarr" "⥄" julia-latexsubs) +(puthash "\\rightarrowplus" "⥅" julia-latexsubs) +(puthash "\\leftarrowplus" "⥆" julia-latexsubs) +(puthash "\\Elzrarrx" "⥇" julia-latexsubs) +(puthash "\\leftrightarrowcircle" "⥈" julia-latexsubs) +(puthash "\\twoheaduparrowcircle" "⥉" julia-latexsubs) +(puthash "\\leftrightharpoonupdown" "⥊" julia-latexsubs) +(puthash "\\leftrightharpoondownup" "⥋" julia-latexsubs) +(puthash "\\updownharpoonrightleft" "⥌" julia-latexsubs) +(puthash "\\updownharpoonleftright" "⥍" julia-latexsubs) +(puthash "\\LeftRightVector" "⥎" julia-latexsubs) +(puthash "\\RightUpDownVector" "⥏" julia-latexsubs) +(puthash "\\DownLeftRightVector" "⥐" julia-latexsubs) +(puthash "\\LeftUpDownVector" "⥑" julia-latexsubs) +(puthash "\\LeftVectorBar" "⥒" julia-latexsubs) +(puthash "\\RightVectorBar" "⥓" julia-latexsubs) +(puthash "\\RightUpVectorBar" "⥔" julia-latexsubs) +(puthash "\\RightDownVectorBar" "⥕" julia-latexsubs) +(puthash "\\DownLeftVectorBar" "⥖" julia-latexsubs) +(puthash "\\DownRightVectorBar" "⥗" julia-latexsubs) +(puthash "\\LeftUpVectorBar" "⥘" julia-latexsubs) +(puthash "\\LeftDownVectorBar" "⥙" julia-latexsubs) +(puthash "\\LeftTeeVector" "⥚" julia-latexsubs) +(puthash "\\RightTeeVector" "⥛" julia-latexsubs) +(puthash "\\RightUpTeeVector" "⥜" julia-latexsubs) +(puthash "\\RightDownTeeVector" "⥝" julia-latexsubs) +(puthash "\\DownLeftTeeVector" "⥞" julia-latexsubs) +(puthash "\\DownRightTeeVector" "⥟" julia-latexsubs) +(puthash "\\LeftUpTeeVector" "⥠" julia-latexsubs) +(puthash "\\LeftDownTeeVector" "⥡" julia-latexsubs) +(puthash "\\leftharpoonsupdown" "⥢" julia-latexsubs) +(puthash "\\upharpoonsleftright" "⥣" julia-latexsubs) +(puthash "\\rightharpoonsupdown" "⥤" julia-latexsubs) +(puthash "\\downharpoonsleftright" "⥥" julia-latexsubs) +(puthash "\\leftrightharpoonsup" "⥦" julia-latexsubs) +(puthash "\\leftrightharpoonsdown" "⥧" julia-latexsubs) +(puthash "\\rightleftharpoonsup" "⥨" julia-latexsubs) +(puthash "\\rightleftharpoonsdown" "⥩" julia-latexsubs) +(puthash "\\leftharpoonupdash" "⥪" julia-latexsubs) +(puthash "\\dashleftharpoondown" "⥫" julia-latexsubs) +(puthash "\\rightharpoonupdash" "⥬" julia-latexsubs) +(puthash "\\dashrightharpoondown" "⥭" julia-latexsubs) +(puthash "\\UpEquilibrium" "⥮" julia-latexsubs) +(puthash "\\ReverseUpEquilibrium" "⥯" julia-latexsubs) +(puthash "\\RoundImplies" "⥰" julia-latexsubs) +(puthash "\\Vvert" "⦀" julia-latexsubs) +(puthash "\\Elroang" "⦆" julia-latexsubs) +(puthash "\\Elzddfnc" "⦙" julia-latexsubs) +(puthash "\\measuredangleleft" "⦛" julia-latexsubs) +(puthash "\\Angle" "⦜" julia-latexsubs) +(puthash "\\rightanglemdot" "⦝" julia-latexsubs) +(puthash "\\angles" "⦞" julia-latexsubs) +(puthash "\\angdnr" "⦟" julia-latexsubs) +(puthash "\\Elzlpargt" "⦠" julia-latexsubs) +(puthash "\\sphericalangleup" "⦡" julia-latexsubs) +(puthash "\\turnangle" "⦢" julia-latexsubs) +(puthash "\\revangle" "⦣" julia-latexsubs) +(puthash "\\angleubar" "⦤" julia-latexsubs) +(puthash "\\revangleubar" "⦥" julia-latexsubs) +(puthash "\\wideangledown" "⦦" julia-latexsubs) +(puthash "\\wideangleup" "⦧" julia-latexsubs) +(puthash "\\measanglerutone" "⦨" julia-latexsubs) +(puthash "\\measanglelutonw" "⦩" julia-latexsubs) +(puthash "\\measanglerdtose" "⦪" julia-latexsubs) +(puthash "\\measangleldtosw" "⦫" julia-latexsubs) +(puthash "\\measangleurtone" "⦬" julia-latexsubs) +(puthash "\\measangleultonw" "⦭" julia-latexsubs) +(puthash "\\measangledrtose" "⦮" julia-latexsubs) +(puthash "\\measangledltosw" "⦯" julia-latexsubs) +(puthash "\\revemptyset" "⦰" julia-latexsubs) +(puthash "\\emptysetobar" "⦱" julia-latexsubs) +(puthash "\\emptysetocirc" "⦲" julia-latexsubs) +(puthash "\\emptysetoarr" "⦳" julia-latexsubs) +(puthash "\\emptysetoarrl" "⦴" julia-latexsubs) +(puthash "\\circledparallel" "⦷" julia-latexsubs) +(puthash "\\obslash" "⦸" julia-latexsubs) +(puthash "\\odotslashdot" "⦼" julia-latexsubs) +(puthash "\\circledwhitebullet" "⦾" julia-latexsubs) +(puthash "\\circledbullet" "⦿" julia-latexsubs) +(puthash "\\olessthan" "⧀" julia-latexsubs) +(puthash "\\ogreaterthan" "⧁" julia-latexsubs) +(puthash "\\boxdiag" "⧄" julia-latexsubs) +(puthash "\\boxbslash" "⧅" julia-latexsubs) +(puthash "\\boxast" "⧆" julia-latexsubs) +(puthash "\\boxcircle" "⧇" julia-latexsubs) +(puthash "\\ElzLap" "⧊" julia-latexsubs) +(puthash "\\Elzdefas" "⧋" julia-latexsubs) +(puthash "\\LeftTriangleBar" "⧏" julia-latexsubs) +(puthash "\\NotLeftTriangleBar" "⧏̸" julia-latexsubs) +(puthash "\\RightTriangleBar" "⧐" julia-latexsubs) +(puthash "\\NotRightTriangleBar" "⧐̸" julia-latexsubs) +(puthash "\\dualmap" "⧟" julia-latexsubs) +(puthash "\\lrtriangleeq" "⧡" julia-latexsubs) +(puthash "\\shuffle" "⧢" julia-latexsubs) +(puthash "\\eparsl" "⧣" julia-latexsubs) +(puthash "\\smeparsl" "⧤" julia-latexsubs) +(puthash "\\eqvparsl" "⧥" julia-latexsubs) +(puthash "\\blacklozenge" "⧫" julia-latexsubs) +(puthash "\\RuleDelayed" "⧴" julia-latexsubs) +(puthash "\\dsol" "⧶" julia-latexsubs) +(puthash "\\rsolbar" "⧷" julia-latexsubs) +(puthash "\\doubleplus" "⧺" julia-latexsubs) +(puthash "\\tripleplus" "⧻" julia-latexsubs) +(puthash "\\bigodot" "⨀" julia-latexsubs) +(puthash "\\bigoplus" "⨁" julia-latexsubs) +(puthash "\\bigotimes" "⨂" julia-latexsubs) +(puthash "\\bigcupdot" "⨃" julia-latexsubs) +(puthash "\\biguplus" "⨄" julia-latexsubs) +(puthash "\\bigsqcap" "⨅" julia-latexsubs) +(puthash "\\bigsqcup" "⨆" julia-latexsubs) +(puthash "\\conjquant" "⨇" julia-latexsubs) +(puthash "\\disjquant" "⨈" julia-latexsubs) +(puthash "\\bigtimes" "⨉" julia-latexsubs) +(puthash "\\modtwosum" "⨊" julia-latexsubs) +(puthash "\\sumint" "⨋" julia-latexsubs) +(puthash "\\iiiint" "⨌" julia-latexsubs) +(puthash "\\intbar" "⨍" julia-latexsubs) +(puthash "\\intBar" "⨎" julia-latexsubs) +(puthash "\\clockoint" "⨏" julia-latexsubs) +(puthash "\\cirfnint" "⨐" julia-latexsubs) +(puthash "\\awint" "⨑" julia-latexsubs) +(puthash "\\rppolint" "⨒" julia-latexsubs) +(puthash "\\scpolint" "⨓" julia-latexsubs) +(puthash "\\npolint" "⨔" julia-latexsubs) +(puthash "\\pointint" "⨕" julia-latexsubs) +(puthash "\\sqrint" "⨖" julia-latexsubs) +(puthash "\\intx" "⨘" julia-latexsubs) +(puthash "\\intcap" "⨙" julia-latexsubs) +(puthash "\\intcup" "⨚" julia-latexsubs) +(puthash "\\upint" "⨛" julia-latexsubs) +(puthash "\\lowint" "⨜" julia-latexsubs) +(puthash "\\ringplus" "⨢" julia-latexsubs) +(puthash "\\plushat" "⨣" julia-latexsubs) +(puthash "\\simplus" "⨤" julia-latexsubs) +(puthash "\\plusdot" "⨥" julia-latexsubs) +(puthash "\\plussim" "⨦" julia-latexsubs) +(puthash "\\plussubtwo" "⨧" julia-latexsubs) +(puthash "\\plustrif" "⨨" julia-latexsubs) +(puthash "\\commaminus" "⨩" julia-latexsubs) +(puthash "\\minusdot" "⨪" julia-latexsubs) +(puthash "\\minusfdots" "⨫" julia-latexsubs) +(puthash "\\minusrdots" "⨬" julia-latexsubs) +(puthash "\\opluslhrim" "⨭" julia-latexsubs) +(puthash "\\oplusrhrim" "⨮" julia-latexsubs) +(puthash "\\ElzTimes" "⨯" julia-latexsubs) +(puthash "\\dottimes" "⨰" julia-latexsubs) +(puthash "\\timesbar" "⨱" julia-latexsubs) +(puthash "\\btimes" "⨲" julia-latexsubs) +(puthash "\\smashtimes" "⨳" julia-latexsubs) +(puthash "\\otimeslhrim" "⨴" julia-latexsubs) +(puthash "\\otimesrhrim" "⨵" julia-latexsubs) +(puthash "\\otimeshat" "⨶" julia-latexsubs) +(puthash "\\Otimes" "⨷" julia-latexsubs) +(puthash "\\odiv" "⨸" julia-latexsubs) +(puthash "\\triangleplus" "⨹" julia-latexsubs) +(puthash "\\triangleminus" "⨺" julia-latexsubs) +(puthash "\\triangletimes" "⨻" julia-latexsubs) +(puthash "\\intprod" "⨼" julia-latexsubs) +(puthash "\\intprodr" "⨽" julia-latexsubs) +(puthash "\\amalg" "⨿" julia-latexsubs) +(puthash "\\capdot" "⩀" julia-latexsubs) +(puthash "\\uminus" "⩁" julia-latexsubs) +(puthash "\\barcup" "⩂" julia-latexsubs) +(puthash "\\barcap" "⩃" julia-latexsubs) +(puthash "\\capwedge" "⩄" julia-latexsubs) +(puthash "\\cupvee" "⩅" julia-latexsubs) +(puthash "\\twocups" "⩊" julia-latexsubs) +(puthash "\\twocaps" "⩋" julia-latexsubs) +(puthash "\\closedvarcup" "⩌" julia-latexsubs) +(puthash "\\closedvarcap" "⩍" julia-latexsubs) +(puthash "\\Sqcap" "⩎" julia-latexsubs) +(puthash "\\Sqcup" "⩏" julia-latexsubs) +(puthash "\\closedvarcupsmashprod" "⩐" julia-latexsubs) +(puthash "\\wedgeodot" "⩑" julia-latexsubs) +(puthash "\\veeodot" "⩒" julia-latexsubs) +(puthash "\\ElzAnd" "⩓" julia-latexsubs) +(puthash "\\ElzOr" "⩔" julia-latexsubs) +(puthash "\\wedgeonwedge" "⩕" julia-latexsubs) +(puthash "\\ElOr" "⩖" julia-latexsubs) +(puthash "\\bigslopedvee" "⩗" julia-latexsubs) +(puthash "\\bigslopedwedge" "⩘" julia-latexsubs) +(puthash "\\wedgemidvert" "⩚" julia-latexsubs) +(puthash "\\veemidvert" "⩛" julia-latexsubs) +(puthash "\\midbarwedge" "⩜" julia-latexsubs) +(puthash "\\midbarvee" "⩝" julia-latexsubs) +(puthash "\\perspcorrespond" "⩞" julia-latexsubs) +(puthash "\\Elzminhat" "⩟" julia-latexsubs) +(puthash "\\wedgedoublebar" "⩠" julia-latexsubs) +(puthash "\\varveebar" "⩡" julia-latexsubs) +(puthash "\\doublebarvee" "⩢" julia-latexsubs) +(puthash "\\veedoublebar" "⩣" julia-latexsubs) +(puthash "\\eqdot" "⩦" julia-latexsubs) +(puthash "\\dotequiv" "⩧" julia-latexsubs) +(puthash "\\dotsim" "⩪" julia-latexsubs) +(puthash "\\simrdots" "⩫" julia-latexsubs) +(puthash "\\simminussim" "⩬" julia-latexsubs) +(puthash "\\congdot" "⩭" julia-latexsubs) +(puthash "\\asteq" "⩮" julia-latexsubs) +(puthash "\\hatapprox" "⩯" julia-latexsubs) +(puthash "\\approxeqq" "⩰" julia-latexsubs) +(puthash "\\eqqplus" "⩱" julia-latexsubs) +(puthash "\\pluseqq" "⩲" julia-latexsubs) +(puthash "\\eqqsim" "⩳" julia-latexsubs) +(puthash "\\Coloneq" "⩴" julia-latexsubs) +(puthash "\\Equal" "⩵" julia-latexsubs) +(puthash "\\eqeqeq" "⩶" julia-latexsubs) +(puthash "\\ddotseq" "⩷" julia-latexsubs) +(puthash "\\equivDD" "⩸" julia-latexsubs) +(puthash "\\ltcir" "⩹" julia-latexsubs) +(puthash "\\gtcir" "⩺" julia-latexsubs) +(puthash "\\ltquest" "⩻" julia-latexsubs) +(puthash "\\gtquest" "⩼" julia-latexsubs) +(puthash "\\leqslant" "⩽" julia-latexsubs) +(puthash "\\nleqslant" "⩽̸" julia-latexsubs) +(puthash "\\geqslant" "⩾" julia-latexsubs) +(puthash "\\ngeqslant" "⩾̸" julia-latexsubs) +(puthash "\\lesdot" "⩿" julia-latexsubs) +(puthash "\\gesdot" "⪀" julia-latexsubs) +(puthash "\\lesdoto" "⪁" julia-latexsubs) +(puthash "\\gesdoto" "⪂" julia-latexsubs) +(puthash "\\lesdotor" "⪃" julia-latexsubs) +(puthash "\\gesdotol" "⪄" julia-latexsubs) +(puthash "\\lessapprox" "⪅" julia-latexsubs) +(puthash "\\gtrapprox" "⪆" julia-latexsubs) +(puthash "\\lneq" "⪇" julia-latexsubs) +(puthash "\\gneq" "⪈" julia-latexsubs) +(puthash "\\lnapprox" "⪉" julia-latexsubs) +(puthash "\\gnapprox" "⪊" julia-latexsubs) +(puthash "\\lesseqqgtr" "⪋" julia-latexsubs) +(puthash "\\gtreqqless" "⪌" julia-latexsubs) +(puthash "\\lsime" "⪍" julia-latexsubs) +(puthash "\\gsime" "⪎" julia-latexsubs) +(puthash "\\lsimg" "⪏" julia-latexsubs) +(puthash "\\gsiml" "⪐" julia-latexsubs) +(puthash "\\lgE" "⪑" julia-latexsubs) +(puthash "\\glE" "⪒" julia-latexsubs) +(puthash "\\lesges" "⪓" julia-latexsubs) +(puthash "\\gesles" "⪔" julia-latexsubs) +(puthash "\\eqslantless" "⪕" julia-latexsubs) +(puthash "\\eqslantgtr" "⪖" julia-latexsubs) +(puthash "\\elsdot" "⪗" julia-latexsubs) +(puthash "\\egsdot" "⪘" julia-latexsubs) +(puthash "\\eqqless" "⪙" julia-latexsubs) +(puthash "\\eqqgtr" "⪚" julia-latexsubs) +(puthash "\\eqqslantless" "⪛" julia-latexsubs) +(puthash "\\eqqslantgtr" "⪜" julia-latexsubs) +(puthash "\\simless" "⪝" julia-latexsubs) +(puthash "\\simgtr" "⪞" julia-latexsubs) +(puthash "\\simlE" "⪟" julia-latexsubs) +(puthash "\\simgE" "⪠" julia-latexsubs) +(puthash "\\NestedLessLess" "⪡" julia-latexsubs) +(puthash "\\NotNestedLessLess" "⪡̸" julia-latexsubs) +(puthash "\\NestedGreaterGreater" "⪢" julia-latexsubs) +(puthash "\\NotNestedGreaterGreater" "⪢̸" julia-latexsubs) +(puthash "\\partialmeetcontraction" "⪣" julia-latexsubs) +(puthash "\\glj" "⪤" julia-latexsubs) +(puthash "\\gla" "⪥" julia-latexsubs) +(puthash "\\ltcc" "⪦" julia-latexsubs) +(puthash "\\gtcc" "⪧" julia-latexsubs) +(puthash "\\lescc" "⪨" julia-latexsubs) +(puthash "\\gescc" "⪩" julia-latexsubs) +(puthash "\\smt" "⪪" julia-latexsubs) +(puthash "\\lat" "⪫" julia-latexsubs) +(puthash "\\smte" "⪬" julia-latexsubs) +(puthash "\\late" "⪭" julia-latexsubs) +(puthash "\\bumpeqq" "⪮" julia-latexsubs) +(puthash "\\preceq" "⪯" julia-latexsubs) +(puthash "\\npreceq" "⪯̸" julia-latexsubs) +(puthash "\\succeq" "⪰" julia-latexsubs) +(puthash "\\nsucceq" "⪰̸" julia-latexsubs) +(puthash "\\precneq" "⪱" julia-latexsubs) +(puthash "\\succneq" "⪲" julia-latexsubs) +(puthash "\\preceqq" "⪳" julia-latexsubs) +(puthash "\\succeqq" "⪴" julia-latexsubs) +(puthash "\\precneqq" "⪵" julia-latexsubs) +(puthash "\\succneqq" "⪶" julia-latexsubs) +(puthash "\\precapprox" "⪷" julia-latexsubs) +(puthash "\\succapprox" "⪸" julia-latexsubs) +(puthash "\\precnapprox" "⪹" julia-latexsubs) +(puthash "\\succnapprox" "⪺" julia-latexsubs) +(puthash "\\Prec" "⪻" julia-latexsubs) +(puthash "\\Succ" "⪼" julia-latexsubs) +(puthash "\\subsetdot" "⪽" julia-latexsubs) +(puthash "\\supsetdot" "⪾" julia-latexsubs) +(puthash "\\subsetplus" "⪿" julia-latexsubs) +(puthash "\\supsetplus" "⫀" julia-latexsubs) +(puthash "\\submult" "⫁" julia-latexsubs) +(puthash "\\supmult" "⫂" julia-latexsubs) +(puthash "\\subedot" "⫃" julia-latexsubs) +(puthash "\\supedot" "⫄" julia-latexsubs) +(puthash "\\subseteqq" "⫅" julia-latexsubs) +(puthash "\\nsubseteqq" "⫅̸" julia-latexsubs) +(puthash "\\supseteqq" "⫆" julia-latexsubs) +(puthash "\\nsupseteqq" "⫆̸" julia-latexsubs) +(puthash "\\subsim" "⫇" julia-latexsubs) +(puthash "\\supsim" "⫈" julia-latexsubs) +(puthash "\\subsetapprox" "⫉" julia-latexsubs) +(puthash "\\supsetapprox" "⫊" julia-latexsubs) +(puthash "\\subsetneqq" "⫋" julia-latexsubs) +(puthash "\\supsetneqq" "⫌" julia-latexsubs) +(puthash "\\lsqhook" "⫍" julia-latexsubs) +(puthash "\\rsqhook" "⫎" julia-latexsubs) +(puthash "\\csub" "⫏" julia-latexsubs) +(puthash "\\csup" "⫐" julia-latexsubs) +(puthash "\\csube" "⫑" julia-latexsubs) +(puthash "\\csupe" "⫒" julia-latexsubs) +(puthash "\\subsup" "⫓" julia-latexsubs) +(puthash "\\supsub" "⫔" julia-latexsubs) +(puthash "\\subsub" "⫕" julia-latexsubs) +(puthash "\\supsup" "⫖" julia-latexsubs) +(puthash "\\suphsub" "⫗" julia-latexsubs) +(puthash "\\supdsub" "⫘" julia-latexsubs) +(puthash "\\forkv" "⫙" julia-latexsubs) +(puthash "\\mlcp" "⫛" julia-latexsubs) +(puthash "\\forks" "⫝̸" julia-latexsubs) +(puthash "\\forksnot" "⫝" julia-latexsubs) +(puthash "\\dashV" "⫣" julia-latexsubs) +(puthash "\\Dashv" "⫤" julia-latexsubs) +(puthash "\\interleave" "⫴" julia-latexsubs) +(puthash "\\Elztdcol" "⫶" julia-latexsubs) +(puthash "\\lllnest" "⫷" julia-latexsubs) +(puthash "\\gggnest" "⫸" julia-latexsubs) +(puthash "\\leqqslant" "⫹" julia-latexsubs) +(puthash "\\geqqslant" "⫺" julia-latexsubs) +(puthash "\\squaretopblack" "\u2b12" julia-latexsubs) +(puthash "\\squarebotblack" "\u2b13" julia-latexsubs) +(puthash "\\squareurblack" "\u2b14" julia-latexsubs) +(puthash "\\squarellblack" "\u2b15" julia-latexsubs) +(puthash "\\diamondleftblack" "\u2b16" julia-latexsubs) +(puthash "\\diamondrightblack" "\u2b17" julia-latexsubs) +(puthash "\\diamondtopblack" "\u2b18" julia-latexsubs) +(puthash "\\diamondbotblack" "\u2b19" julia-latexsubs) +(puthash "\\dottedsquare" "\u2b1a" julia-latexsubs) +(puthash "\\lgblksquare" "\u2b1b" julia-latexsubs) +(puthash "\\lgwhtsquare" "\u2b1c" julia-latexsubs) +(puthash "\\vysmblksquare" "\u2b1d" julia-latexsubs) +(puthash "\\vysmwhtsquare" "\u2b1e" julia-latexsubs) +(puthash "\\pentagonblack" "\u2b1f" julia-latexsubs) +(puthash "\\pentagon" "\u2b20" julia-latexsubs) +(puthash "\\varhexagon" "\u2b21" julia-latexsubs) +(puthash "\\varhexagonblack" "\u2b22" julia-latexsubs) +(puthash "\\hexagonblack" "\u2b23" julia-latexsubs) +(puthash "\\lgblkcircle" "\u2b24" julia-latexsubs) +(puthash "\\mdblkdiamond" "\u2b25" julia-latexsubs) +(puthash "\\mdwhtdiamond" "\u2b26" julia-latexsubs) +(puthash "\\mdblklozenge" "\u2b27" julia-latexsubs) +(puthash "\\mdwhtlozenge" "\u2b28" julia-latexsubs) +(puthash "\\smblkdiamond" "\u2b29" julia-latexsubs) +(puthash "\\smblklozenge" "\u2b2a" julia-latexsubs) +(puthash "\\smwhtlozenge" "\u2b2b" julia-latexsubs) +(puthash "\\blkhorzoval" "\u2b2c" julia-latexsubs) +(puthash "\\whthorzoval" "\u2b2d" julia-latexsubs) +(puthash "\\blkvertoval" "\u2b2e" julia-latexsubs) +(puthash "\\whtvertoval" "\u2b2f" julia-latexsubs) +(puthash "\\circleonleftarrow" "\u2b30" julia-latexsubs) +(puthash "\\leftthreearrows" "\u2b31" julia-latexsubs) +(puthash "\\leftarrowonoplus" "\u2b32" julia-latexsubs) +(puthash "\\longleftsquigarrow" "\u2b33" julia-latexsubs) +(puthash "\\nvtwoheadleftarrow" "\u2b34" julia-latexsubs) +(puthash "\\nVtwoheadleftarrow" "\u2b35" julia-latexsubs) +(puthash "\\twoheadmapsfrom" "\u2b36" julia-latexsubs) +(puthash "\\twoheadleftdbkarrow" "\u2b37" julia-latexsubs) +(puthash "\\leftdotarrow" "\u2b38" julia-latexsubs) +(puthash "\\nvleftarrowtail" "\u2b39" julia-latexsubs) +(puthash "\\nVleftarrowtail" "\u2b3a" julia-latexsubs) +(puthash "\\twoheadleftarrowtail" "\u2b3b" julia-latexsubs) +(puthash "\\nvtwoheadleftarrowtail" "\u2b3c" julia-latexsubs) +(puthash "\\nVtwoheadleftarrowtail" "\u2b3d" julia-latexsubs) +(puthash "\\leftarrowx" "\u2b3e" julia-latexsubs) +(puthash "\\leftcurvedarrow" "\u2b3f" julia-latexsubs) +(puthash "\\equalleftarrow" "\u2b40" julia-latexsubs) +(puthash "\\bsimilarleftarrow" "\u2b41" julia-latexsubs) +(puthash "\\leftarrowbackapprox" "\u2b42" julia-latexsubs) +(puthash "\\rightarrowgtr" "\u2b43" julia-latexsubs) +(puthash "\\rightarrowsupset" "\u2b44" julia-latexsubs) +(puthash "\\LLeftarrow" "\u2b45" julia-latexsubs) +(puthash "\\RRightarrow" "\u2b46" julia-latexsubs) +(puthash "\\bsimilarrightarrow" "\u2b47" julia-latexsubs) +(puthash "\\rightarrowbackapprox" "\u2b48" julia-latexsubs) +(puthash "\\similarleftarrow" "\u2b49" julia-latexsubs) +(puthash "\\leftarrowapprox" "\u2b4a" julia-latexsubs) +(puthash "\\leftarrowbsimilar" "\u2b4b" julia-latexsubs) +(puthash "\\rightarrowbsimilar" "\u2b4c" julia-latexsubs) +(puthash "\\medwhitestar" "\u2b50" julia-latexsubs) +(puthash "\\medblackstar" "\u2b51" julia-latexsubs) +(puthash "\\smwhitestar" "\u2b52" julia-latexsubs) +(puthash "\\rightpentagonblack" "\u2b53" julia-latexsubs) +(puthash "\\rightpentagon" "\u2b54" julia-latexsubs) +(puthash "\\_j" "\u2c7c" julia-latexsubs) +(puthash "\\^V" "\u2c7d" julia-latexsubs) +(puthash "\\postalmark" "〒" julia-latexsubs) +(puthash "\\openbracketleft" "〚" julia-latexsubs) +(puthash "\\openbracketright" "〛" julia-latexsubs) +(puthash "\\overbrace" "︷" julia-latexsubs) +(puthash "\\underbrace" "︸" julia-latexsubs) +(puthash "\\mbfA" "𝐀" julia-latexsubs) +(puthash "\\mbfB" "𝐁" julia-latexsubs) +(puthash "\\mbfC" "𝐂" julia-latexsubs) +(puthash "\\mbfD" "𝐃" julia-latexsubs) +(puthash "\\mbfE" "𝐄" julia-latexsubs) +(puthash "\\mbfF" "𝐅" julia-latexsubs) +(puthash "\\mbfG" "𝐆" julia-latexsubs) +(puthash "\\mbfH" "𝐇" julia-latexsubs) +(puthash "\\mbfI" "𝐈" julia-latexsubs) +(puthash "\\mbfJ" "𝐉" julia-latexsubs) +(puthash "\\mbfK" "𝐊" julia-latexsubs) +(puthash "\\mbfL" "𝐋" julia-latexsubs) +(puthash "\\mbfM" "𝐌" julia-latexsubs) +(puthash "\\mbfN" "𝐍" julia-latexsubs) +(puthash "\\mbfO" "𝐎" julia-latexsubs) +(puthash "\\mbfP" "𝐏" julia-latexsubs) +(puthash "\\mbfQ" "𝐐" julia-latexsubs) +(puthash "\\mbfR" "𝐑" julia-latexsubs) +(puthash "\\mbfS" "𝐒" julia-latexsubs) +(puthash "\\mbfT" "𝐓" julia-latexsubs) +(puthash "\\mbfU" "𝐔" julia-latexsubs) +(puthash "\\mbfV" "𝐕" julia-latexsubs) +(puthash "\\mbfW" "𝐖" julia-latexsubs) +(puthash "\\mbfX" "𝐗" julia-latexsubs) +(puthash "\\mbfY" "𝐘" julia-latexsubs) +(puthash "\\mbfZ" "𝐙" julia-latexsubs) +(puthash "\\mbfa" "𝐚" julia-latexsubs) +(puthash "\\mbfb" "𝐛" julia-latexsubs) +(puthash "\\mbfc" "𝐜" julia-latexsubs) +(puthash "\\mbfd" "𝐝" julia-latexsubs) +(puthash "\\mbfe" "𝐞" julia-latexsubs) +(puthash "\\mbff" "𝐟" julia-latexsubs) +(puthash "\\mbfg" "𝐠" julia-latexsubs) +(puthash "\\mbfh" "𝐡" julia-latexsubs) +(puthash "\\mbfi" "𝐢" julia-latexsubs) +(puthash "\\mbfj" "𝐣" julia-latexsubs) +(puthash "\\mbfk" "𝐤" julia-latexsubs) +(puthash "\\mbfl" "𝐥" julia-latexsubs) +(puthash "\\mbfm" "𝐦" julia-latexsubs) +(puthash "\\mbfn" "𝐧" julia-latexsubs) +(puthash "\\mbfo" "𝐨" julia-latexsubs) +(puthash "\\mbfp" "𝐩" julia-latexsubs) +(puthash "\\mbfq" "𝐪" julia-latexsubs) +(puthash "\\mbfr" "𝐫" julia-latexsubs) +(puthash "\\mbfs" "𝐬" julia-latexsubs) +(puthash "\\mbft" "𝐭" julia-latexsubs) +(puthash "\\mbfu" "𝐮" julia-latexsubs) +(puthash "\\mbfv" "𝐯" julia-latexsubs) +(puthash "\\mbfw" "𝐰" julia-latexsubs) +(puthash "\\mbfx" "𝐱" julia-latexsubs) +(puthash "\\mbfy" "𝐲" julia-latexsubs) +(puthash "\\mbfz" "𝐳" julia-latexsubs) +(puthash "\\mitA" "𝐴" julia-latexsubs) +(puthash "\\mitB" "𝐵" julia-latexsubs) +(puthash "\\mitC" "𝐶" julia-latexsubs) +(puthash "\\mitD" "𝐷" julia-latexsubs) +(puthash "\\mitE" "𝐸" julia-latexsubs) +(puthash "\\mitF" "𝐹" julia-latexsubs) +(puthash "\\mitG" "𝐺" julia-latexsubs) +(puthash "\\mitH" "𝐻" julia-latexsubs) +(puthash "\\mitI" "𝐼" julia-latexsubs) +(puthash "\\mitJ" "𝐽" julia-latexsubs) +(puthash "\\mitK" "𝐾" julia-latexsubs) +(puthash "\\mitL" "𝐿" julia-latexsubs) +(puthash "\\mitM" "𝑀" julia-latexsubs) +(puthash "\\mitN" "𝑁" julia-latexsubs) +(puthash "\\mitO" "𝑂" julia-latexsubs) +(puthash "\\mitP" "𝑃" julia-latexsubs) +(puthash "\\mitQ" "𝑄" julia-latexsubs) +(puthash "\\mitR" "𝑅" julia-latexsubs) +(puthash "\\mitS" "𝑆" julia-latexsubs) +(puthash "\\mitT" "𝑇" julia-latexsubs) +(puthash "\\mitU" "𝑈" julia-latexsubs) +(puthash "\\mitV" "𝑉" julia-latexsubs) +(puthash "\\mitW" "𝑊" julia-latexsubs) +(puthash "\\mitX" "𝑋" julia-latexsubs) +(puthash "\\mitY" "𝑌" julia-latexsubs) +(puthash "\\mitZ" "𝑍" julia-latexsubs) +(puthash "\\mita" "𝑎" julia-latexsubs) +(puthash "\\mitb" "𝑏" julia-latexsubs) +(puthash "\\mitc" "𝑐" julia-latexsubs) +(puthash "\\mitd" "𝑑" julia-latexsubs) +(puthash "\\mite" "𝑒" julia-latexsubs) +(puthash "\\mitf" "𝑓" julia-latexsubs) +(puthash "\\mitg" "𝑔" julia-latexsubs) +(puthash "\\miti" "𝑖" julia-latexsubs) +(puthash "\\mitj" "𝑗" julia-latexsubs) +(puthash "\\mitk" "𝑘" julia-latexsubs) +(puthash "\\mitl" "𝑙" julia-latexsubs) +(puthash "\\mitm" "𝑚" julia-latexsubs) +(puthash "\\mitn" "𝑛" julia-latexsubs) +(puthash "\\mito" "𝑜" julia-latexsubs) +(puthash "\\mitp" "𝑝" julia-latexsubs) +(puthash "\\mitq" "𝑞" julia-latexsubs) +(puthash "\\mitr" "𝑟" julia-latexsubs) +(puthash "\\mits" "𝑠" julia-latexsubs) +(puthash "\\mitt" "𝑡" julia-latexsubs) +(puthash "\\mitu" "𝑢" julia-latexsubs) +(puthash "\\mitv" "𝑣" julia-latexsubs) +(puthash "\\mitw" "𝑤" julia-latexsubs) +(puthash "\\mitx" "𝑥" julia-latexsubs) +(puthash "\\mity" "𝑦" julia-latexsubs) +(puthash "\\mitz" "𝑧" julia-latexsubs) +(puthash "\\mbfitA" "𝑨" julia-latexsubs) +(puthash "\\mbfitB" "𝑩" julia-latexsubs) +(puthash "\\mbfitC" "𝑪" julia-latexsubs) +(puthash "\\mbfitD" "𝑫" julia-latexsubs) +(puthash "\\mbfitE" "𝑬" julia-latexsubs) +(puthash "\\mbfitF" "𝑭" julia-latexsubs) +(puthash "\\mbfitG" "𝑮" julia-latexsubs) +(puthash "\\mbfitH" "𝑯" julia-latexsubs) +(puthash "\\mbfitI" "𝑰" julia-latexsubs) +(puthash "\\mbfitJ" "𝑱" julia-latexsubs) +(puthash "\\mbfitK" "𝑲" julia-latexsubs) +(puthash "\\mbfitL" "𝑳" julia-latexsubs) +(puthash "\\mbfitM" "𝑴" julia-latexsubs) +(puthash "\\mbfitN" "𝑵" julia-latexsubs) +(puthash "\\mbfitO" "𝑶" julia-latexsubs) +(puthash "\\mbfitP" "𝑷" julia-latexsubs) +(puthash "\\mbfitQ" "𝑸" julia-latexsubs) +(puthash "\\mbfitR" "𝑹" julia-latexsubs) +(puthash "\\mbfitS" "𝑺" julia-latexsubs) +(puthash "\\mbfitT" "𝑻" julia-latexsubs) +(puthash "\\mbfitU" "𝑼" julia-latexsubs) +(puthash "\\mbfitV" "𝑽" julia-latexsubs) +(puthash "\\mbfitW" "𝑾" julia-latexsubs) +(puthash "\\mbfitX" "𝑿" julia-latexsubs) +(puthash "\\mbfitY" "𝒀" julia-latexsubs) +(puthash "\\mbfitZ" "𝒁" julia-latexsubs) +(puthash "\\mbfita" "𝒂" julia-latexsubs) +(puthash "\\mbfitb" "𝒃" julia-latexsubs) +(puthash "\\mbfitc" "𝒄" julia-latexsubs) +(puthash "\\mbfitd" "𝒅" julia-latexsubs) +(puthash "\\mbfite" "𝒆" julia-latexsubs) +(puthash "\\mbfitf" "𝒇" julia-latexsubs) +(puthash "\\mbfitg" "𝒈" julia-latexsubs) +(puthash "\\mbfith" "𝒉" julia-latexsubs) +(puthash "\\mbfiti" "𝒊" julia-latexsubs) +(puthash "\\mbfitj" "𝒋" julia-latexsubs) +(puthash "\\mbfitk" "𝒌" julia-latexsubs) +(puthash "\\mbfitl" "𝒍" julia-latexsubs) +(puthash "\\mbfitm" "𝒎" julia-latexsubs) +(puthash "\\mbfitn" "𝒏" julia-latexsubs) +(puthash "\\mbfito" "𝒐" julia-latexsubs) +(puthash "\\mbfitp" "𝒑" julia-latexsubs) +(puthash "\\mbfitq" "𝒒" julia-latexsubs) +(puthash "\\mbfitr" "𝒓" julia-latexsubs) +(puthash "\\mbfits" "𝒔" julia-latexsubs) +(puthash "\\mbfitt" "𝒕" julia-latexsubs) +(puthash "\\mbfitu" "𝒖" julia-latexsubs) +(puthash "\\mbfitv" "𝒗" julia-latexsubs) +(puthash "\\mbfitw" "𝒘" julia-latexsubs) +(puthash "\\mbfitx" "𝒙" julia-latexsubs) +(puthash "\\mbfity" "𝒚" julia-latexsubs) +(puthash "\\mbfitz" "𝒛" julia-latexsubs) +(puthash "\\mscrA" "𝒜" julia-latexsubs) +(puthash "\\mscrC" "𝒞" julia-latexsubs) +(puthash "\\mscrD" "𝒟" julia-latexsubs) +(puthash "\\mscrG" "𝒢" julia-latexsubs) +(puthash "\\mscrJ" "𝒥" julia-latexsubs) +(puthash "\\mscrK" "𝒦" julia-latexsubs) +(puthash "\\mscrN" "𝒩" julia-latexsubs) +(puthash "\\mscrO" "𝒪" julia-latexsubs) +(puthash "\\mscrP" "𝒫" julia-latexsubs) +(puthash "\\mscrQ" "𝒬" julia-latexsubs) +(puthash "\\mscrS" "𝒮" julia-latexsubs) +(puthash "\\mscrT" "𝒯" julia-latexsubs) +(puthash "\\mscrU" "𝒰" julia-latexsubs) +(puthash "\\mscrV" "𝒱" julia-latexsubs) +(puthash "\\mscrW" "𝒲" julia-latexsubs) +(puthash "\\mscrX" "𝒳" julia-latexsubs) +(puthash "\\mscrY" "𝒴" julia-latexsubs) +(puthash "\\mscrZ" "𝒵" julia-latexsubs) +(puthash "\\mscra" "𝒶" julia-latexsubs) +(puthash "\\mscrb" "𝒷" julia-latexsubs) +(puthash "\\mscrc" "𝒸" julia-latexsubs) +(puthash "\\mscrd" "𝒹" julia-latexsubs) +(puthash "\\mscrf" "𝒻" julia-latexsubs) +(puthash "\\mscrh" "𝒽" julia-latexsubs) +(puthash "\\mscri" "𝒾" julia-latexsubs) +(puthash "\\mscrj" "𝒿" julia-latexsubs) +(puthash "\\mscrk" "𝓀" julia-latexsubs) +(let ((c (decode-char 'ucs #x1d4c1))) + (if c (puthash "\\mscrl" (char-to-string c) julia-latexsubs))) +(puthash "\\mscrm" "𝓂" julia-latexsubs) +(puthash "\\mscrn" "𝓃" julia-latexsubs) +(puthash "\\mscrp" "𝓅" julia-latexsubs) +(puthash "\\mscrq" "𝓆" julia-latexsubs) +(puthash "\\mscrr" "𝓇" julia-latexsubs) +(puthash "\\mscrs" "𝓈" julia-latexsubs) +(puthash "\\mscrt" "𝓉" julia-latexsubs) +(puthash "\\mscru" "𝓊" julia-latexsubs) +(puthash "\\mscrv" "𝓋" julia-latexsubs) +(puthash "\\mscrw" "𝓌" julia-latexsubs) +(puthash "\\mscrx" "𝓍" julia-latexsubs) +(puthash "\\mscry" "𝓎" julia-latexsubs) +(puthash "\\mscrz" "𝓏" julia-latexsubs) +(puthash "\\mbfscrA" "𝓐" julia-latexsubs) +(puthash "\\mbfscrB" "𝓑" julia-latexsubs) +(puthash "\\mbfscrC" "𝓒" julia-latexsubs) +(puthash "\\mbfscrD" "𝓓" julia-latexsubs) +(puthash "\\mbfscrE" "𝓔" julia-latexsubs) +(puthash "\\mbfscrF" "𝓕" julia-latexsubs) +(puthash "\\mbfscrG" "𝓖" julia-latexsubs) +(puthash "\\mbfscrH" "𝓗" julia-latexsubs) +(puthash "\\mbfscrI" "𝓘" julia-latexsubs) +(puthash "\\mbfscrJ" "𝓙" julia-latexsubs) +(puthash "\\mbfscrK" "𝓚" julia-latexsubs) +(puthash "\\mbfscrL" "𝓛" julia-latexsubs) +(puthash "\\mbfscrM" "𝓜" julia-latexsubs) +(puthash "\\mbfscrN" "𝓝" julia-latexsubs) +(puthash "\\mbfscrO" "𝓞" julia-latexsubs) +(puthash "\\mbfscrP" "𝓟" julia-latexsubs) +(puthash "\\mbfscrQ" "𝓠" julia-latexsubs) +(puthash "\\mbfscrR" "𝓡" julia-latexsubs) +(puthash "\\mbfscrS" "𝓢" julia-latexsubs) +(puthash "\\mbfscrT" "𝓣" julia-latexsubs) +(puthash "\\mbfscrU" "𝓤" julia-latexsubs) +(puthash "\\mbfscrV" "𝓥" julia-latexsubs) +(puthash "\\mbfscrW" "𝓦" julia-latexsubs) +(puthash "\\mbfscrX" "𝓧" julia-latexsubs) +(puthash "\\mbfscrY" "𝓨" julia-latexsubs) +(puthash "\\mbfscrZ" "𝓩" julia-latexsubs) +(puthash "\\mbfscra" "𝓪" julia-latexsubs) +(puthash "\\mbfscrb" "𝓫" julia-latexsubs) +(puthash "\\mbfscrc" "𝓬" julia-latexsubs) +(puthash "\\mbfscrd" "𝓭" julia-latexsubs) +(puthash "\\mbfscre" "𝓮" julia-latexsubs) +(puthash "\\mbfscrf" "𝓯" julia-latexsubs) +(puthash "\\mbfscrg" "𝓰" julia-latexsubs) +(puthash "\\mbfscrh" "𝓱" julia-latexsubs) +(puthash "\\mbfscri" "𝓲" julia-latexsubs) +(puthash "\\mbfscrj" "𝓳" julia-latexsubs) +(puthash "\\mbfscrk" "𝓴" julia-latexsubs) +(puthash "\\mbfscrl" "𝓵" julia-latexsubs) +(puthash "\\mbfscrm" "𝓶" julia-latexsubs) +(puthash "\\mbfscrn" "𝓷" julia-latexsubs) +(puthash "\\mbfscro" "𝓸" julia-latexsubs) +(puthash "\\mbfscrp" "𝓹" julia-latexsubs) +(puthash "\\mbfscrq" "𝓺" julia-latexsubs) +(puthash "\\mbfscrr" "𝓻" julia-latexsubs) +(puthash "\\mbfscrs" "𝓼" julia-latexsubs) +(puthash "\\mbfscrt" "𝓽" julia-latexsubs) +(puthash "\\mbfscru" "𝓾" julia-latexsubs) +(puthash "\\mbfscrv" "𝓿" julia-latexsubs) +(puthash "\\mbfscrw" "𝔀" julia-latexsubs) +(puthash "\\mbfscrx" "𝔁" julia-latexsubs) +(puthash "\\mbfscry" "𝔂" julia-latexsubs) +(puthash "\\mbfscrz" "𝔃" julia-latexsubs) +(puthash "\\mfrakA" "𝔄" julia-latexsubs) +(puthash "\\mfrakB" "𝔅" julia-latexsubs) +(puthash "\\mfrakD" "𝔇" julia-latexsubs) +(puthash "\\mfrakE" "𝔈" julia-latexsubs) +(puthash "\\mfrakF" "𝔉" julia-latexsubs) +(puthash "\\mfrakG" "𝔊" julia-latexsubs) +(puthash "\\mfrakJ" "𝔍" julia-latexsubs) +(puthash "\\mfrakK" "𝔎" julia-latexsubs) +(puthash "\\mfrakL" "𝔏" julia-latexsubs) +(puthash "\\mfrakM" "𝔐" julia-latexsubs) +(puthash "\\mfrakN" "𝔑" julia-latexsubs) +(puthash "\\mfrakO" "𝔒" julia-latexsubs) +(puthash "\\mfrakP" "𝔓" julia-latexsubs) +(puthash "\\mfrakQ" "𝔔" julia-latexsubs) +(puthash "\\mfrakS" "𝔖" julia-latexsubs) +(puthash "\\mfrakT" "𝔗" julia-latexsubs) +(puthash "\\mfrakU" "𝔘" julia-latexsubs) +(puthash "\\mfrakV" "𝔙" julia-latexsubs) +(puthash "\\mfrakW" "𝔚" julia-latexsubs) +(puthash "\\mfrakX" "𝔛" julia-latexsubs) +(puthash "\\mfrakY" "𝔜" julia-latexsubs) +(puthash "\\mfraka" "𝔞" julia-latexsubs) +(puthash "\\mfrakb" "𝔟" julia-latexsubs) +(puthash "\\mfrakc" "𝔠" julia-latexsubs) +(puthash "\\mfrakd" "𝔡" julia-latexsubs) +(puthash "\\mfrake" "𝔢" julia-latexsubs) +(puthash "\\mfrakf" "𝔣" julia-latexsubs) +(puthash "\\mfrakg" "𝔤" julia-latexsubs) +(puthash "\\mfrakh" "𝔥" julia-latexsubs) +(puthash "\\mfraki" "𝔦" julia-latexsubs) +(puthash "\\mfrakj" "𝔧" julia-latexsubs) +(puthash "\\mfrakk" "𝔨" julia-latexsubs) +(puthash "\\mfrakl" "𝔩" julia-latexsubs) +(puthash "\\mfrakm" "𝔪" julia-latexsubs) +(puthash "\\mfrakn" "𝔫" julia-latexsubs) +(puthash "\\mfrako" "𝔬" julia-latexsubs) +(puthash "\\mfrakp" "𝔭" julia-latexsubs) +(puthash "\\mfrakq" "𝔮" julia-latexsubs) +(puthash "\\mfrakr" "𝔯" julia-latexsubs) +(puthash "\\mfraks" "𝔰" julia-latexsubs) +(puthash "\\mfrakt" "𝔱" julia-latexsubs) +(puthash "\\mfraku" "𝔲" julia-latexsubs) +(puthash "\\mfrakv" "𝔳" julia-latexsubs) +(puthash "\\mfrakw" "𝔴" julia-latexsubs) +(puthash "\\mfrakx" "𝔵" julia-latexsubs) +(puthash "\\mfraky" "𝔶" julia-latexsubs) +(puthash "\\mfrakz" "𝔷" julia-latexsubs) +(puthash "\\BbbA" "𝔸" julia-latexsubs) +(puthash "\\BbbB" "𝔹" julia-latexsubs) +(puthash "\\BbbD" "𝔻" julia-latexsubs) +(puthash "\\BbbE" "𝔼" julia-latexsubs) +(puthash "\\BbbF" "𝔽" julia-latexsubs) +(puthash "\\BbbG" "𝔾" julia-latexsubs) +(puthash "\\BbbI" "𝕀" julia-latexsubs) +(puthash "\\BbbJ" "𝕁" julia-latexsubs) +(puthash "\\BbbK" "𝕂" julia-latexsubs) +(puthash "\\BbbL" "𝕃" julia-latexsubs) +(puthash "\\BbbM" "𝕄" julia-latexsubs) +(puthash "\\BbbO" "𝕆" julia-latexsubs) +(puthash "\\BbbS" "𝕊" julia-latexsubs) +(puthash "\\BbbT" "𝕋" julia-latexsubs) +(puthash "\\BbbU" "𝕌" julia-latexsubs) +(puthash "\\BbbV" "𝕍" julia-latexsubs) +(puthash "\\BbbW" "𝕎" julia-latexsubs) +(puthash "\\BbbX" "𝕏" julia-latexsubs) +(puthash "\\BbbY" "𝕐" julia-latexsubs) +(puthash "\\Bbba" "𝕒" julia-latexsubs) +(puthash "\\Bbbb" "𝕓" julia-latexsubs) +(puthash "\\Bbbc" "𝕔" julia-latexsubs) +(puthash "\\Bbbd" "𝕕" julia-latexsubs) +(puthash "\\Bbbe" "𝕖" julia-latexsubs) +(puthash "\\Bbbf" "𝕗" julia-latexsubs) +(puthash "\\Bbbg" "𝕘" julia-latexsubs) +(puthash "\\Bbbh" "𝕙" julia-latexsubs) +(puthash "\\Bbbi" "𝕚" julia-latexsubs) +(puthash "\\Bbbj" "𝕛" julia-latexsubs) +(puthash "\\Bbbk" "𝕜" julia-latexsubs) +(puthash "\\Bbbl" "𝕝" julia-latexsubs) +(puthash "\\Bbbm" "𝕞" julia-latexsubs) +(puthash "\\Bbbn" "𝕟" julia-latexsubs) +(puthash "\\Bbbo" "𝕠" julia-latexsubs) +(puthash "\\Bbbp" "𝕡" julia-latexsubs) +(puthash "\\Bbbq" "𝕢" julia-latexsubs) +(puthash "\\Bbbr" "𝕣" julia-latexsubs) +(puthash "\\Bbbs" "𝕤" julia-latexsubs) +(puthash "\\Bbbt" "𝕥" julia-latexsubs) +(puthash "\\Bbbu" "𝕦" julia-latexsubs) +(puthash "\\Bbbv" "𝕧" julia-latexsubs) +(puthash "\\Bbbw" "𝕨" julia-latexsubs) +(puthash "\\Bbbx" "𝕩" julia-latexsubs) +(puthash "\\Bbby" "𝕪" julia-latexsubs) +(puthash "\\Bbbz" "𝕫" julia-latexsubs) +(puthash "\\mbffrakA" "𝕬" julia-latexsubs) +(puthash "\\mbffrakB" "𝕭" julia-latexsubs) +(puthash "\\mbffrakC" "𝕮" julia-latexsubs) +(puthash "\\mbffrakD" "𝕯" julia-latexsubs) +(puthash "\\mbffrakE" "𝕰" julia-latexsubs) +(puthash "\\mbffrakF" "𝕱" julia-latexsubs) +(puthash "\\mbffrakG" "𝕲" julia-latexsubs) +(puthash "\\mbffrakH" "𝕳" julia-latexsubs) +(puthash "\\mbffrakI" "𝕴" julia-latexsubs) +(puthash "\\mbffrakJ" "𝕵" julia-latexsubs) +(puthash "\\mbffrakK" "𝕶" julia-latexsubs) +(puthash "\\mbffrakL" "𝕷" julia-latexsubs) +(puthash "\\mbffrakM" "𝕸" julia-latexsubs) +(puthash "\\mbffrakN" "𝕹" julia-latexsubs) +(puthash "\\mbffrakO" "𝕺" julia-latexsubs) +(puthash "\\mbffrakP" "𝕻" julia-latexsubs) +(puthash "\\mbffrakQ" "𝕼" julia-latexsubs) +(puthash "\\mbffrakR" "𝕽" julia-latexsubs) +(puthash "\\mbffrakS" "𝕾" julia-latexsubs) +(puthash "\\mbffrakT" "𝕿" julia-latexsubs) +(puthash "\\mbffrakU" "𝖀" julia-latexsubs) +(puthash "\\mbffrakV" "𝖁" julia-latexsubs) +(puthash "\\mbffrakW" "𝖂" julia-latexsubs) +(puthash "\\mbffrakX" "𝖃" julia-latexsubs) +(puthash "\\mbffrakY" "𝖄" julia-latexsubs) +(puthash "\\mbffrakZ" "𝖅" julia-latexsubs) +(puthash "\\mbffraka" "𝖆" julia-latexsubs) +(puthash "\\mbffrakb" "𝖇" julia-latexsubs) +(puthash "\\mbffrakc" "𝖈" julia-latexsubs) +(puthash "\\mbffrakd" "𝖉" julia-latexsubs) +(puthash "\\mbffrake" "𝖊" julia-latexsubs) +(puthash "\\mbffrakf" "𝖋" julia-latexsubs) +(puthash "\\mbffrakg" "𝖌" julia-latexsubs) +(puthash "\\mbffrakh" "𝖍" julia-latexsubs) +(puthash "\\mbffraki" "𝖎" julia-latexsubs) +(puthash "\\mbffrakj" "𝖏" julia-latexsubs) +(puthash "\\mbffrakk" "𝖐" julia-latexsubs) +(puthash "\\mbffrakl" "𝖑" julia-latexsubs) +(puthash "\\mbffrakm" "𝖒" julia-latexsubs) +(puthash "\\mbffrakn" "𝖓" julia-latexsubs) +(puthash "\\mbffrako" "𝖔" julia-latexsubs) +(puthash "\\mbffrakp" "𝖕" julia-latexsubs) +(puthash "\\mbffrakq" "𝖖" julia-latexsubs) +(puthash "\\mbffrakr" "𝖗" julia-latexsubs) +(puthash "\\mbffraks" "𝖘" julia-latexsubs) +(puthash "\\mbffrakt" "𝖙" julia-latexsubs) +(puthash "\\mbffraku" "𝖚" julia-latexsubs) +(puthash "\\mbffrakv" "𝖛" julia-latexsubs) +(puthash "\\mbffrakw" "𝖜" julia-latexsubs) +(puthash "\\mbffrakx" "𝖝" julia-latexsubs) +(puthash "\\mbffraky" "𝖞" julia-latexsubs) +(puthash "\\mbffrakz" "𝖟" julia-latexsubs) +(puthash "\\msansA" "𝖠" julia-latexsubs) +(puthash "\\msansB" "𝖡" julia-latexsubs) +(puthash "\\msansC" "𝖢" julia-latexsubs) +(puthash "\\msansD" "𝖣" julia-latexsubs) +(puthash "\\msansE" "𝖤" julia-latexsubs) +(puthash "\\msansF" "𝖥" julia-latexsubs) +(puthash "\\msansG" "𝖦" julia-latexsubs) +(puthash "\\msansH" "𝖧" julia-latexsubs) +(puthash "\\msansI" "𝖨" julia-latexsubs) +(puthash "\\msansJ" "𝖩" julia-latexsubs) +(puthash "\\msansK" "𝖪" julia-latexsubs) +(puthash "\\msansL" "𝖫" julia-latexsubs) +(puthash "\\msansM" "𝖬" julia-latexsubs) +(puthash "\\msansN" "𝖭" julia-latexsubs) +(puthash "\\msansO" "𝖮" julia-latexsubs) +(puthash "\\msansP" "𝖯" julia-latexsubs) +(puthash "\\msansQ" "𝖰" julia-latexsubs) +(puthash "\\msansR" "𝖱" julia-latexsubs) +(puthash "\\msansS" "𝖲" julia-latexsubs) +(puthash "\\msansT" "𝖳" julia-latexsubs) +(puthash "\\msansU" "𝖴" julia-latexsubs) +(puthash "\\msansV" "𝖵" julia-latexsubs) +(puthash "\\msansW" "𝖶" julia-latexsubs) +(puthash "\\msansX" "𝖷" julia-latexsubs) +(puthash "\\msansY" "𝖸" julia-latexsubs) +(puthash "\\msansZ" "𝖹" julia-latexsubs) +(puthash "\\msansa" "𝖺" julia-latexsubs) +(puthash "\\msansb" "𝖻" julia-latexsubs) +(puthash "\\msansc" "𝖼" julia-latexsubs) +(puthash "\\msansd" "𝖽" julia-latexsubs) +(puthash "\\msanse" "𝖾" julia-latexsubs) +(puthash "\\msansf" "𝖿" julia-latexsubs) +(puthash "\\msansg" "𝗀" julia-latexsubs) +(puthash "\\msansh" "𝗁" julia-latexsubs) +(puthash "\\msansi" "𝗂" julia-latexsubs) +(puthash "\\msansj" "𝗃" julia-latexsubs) +(puthash "\\msansk" "𝗄" julia-latexsubs) +(puthash "\\msansl" "𝗅" julia-latexsubs) +(puthash "\\msansm" "𝗆" julia-latexsubs) +(puthash "\\msansn" "𝗇" julia-latexsubs) +(puthash "\\msanso" "𝗈" julia-latexsubs) +(puthash "\\msansp" "𝗉" julia-latexsubs) +(puthash "\\msansq" "𝗊" julia-latexsubs) +(puthash "\\msansr" "𝗋" julia-latexsubs) +(puthash "\\msanss" "𝗌" julia-latexsubs) +(puthash "\\msanst" "𝗍" julia-latexsubs) +(puthash "\\msansu" "𝗎" julia-latexsubs) +(puthash "\\msansv" "𝗏" julia-latexsubs) +(puthash "\\msansw" "𝗐" julia-latexsubs) +(puthash "\\msansx" "𝗑" julia-latexsubs) +(puthash "\\msansy" "𝗒" julia-latexsubs) +(puthash "\\msansz" "𝗓" julia-latexsubs) +(puthash "\\mbfsansA" "𝗔" julia-latexsubs) +(puthash "\\mbfsansB" "𝗕" julia-latexsubs) +(puthash "\\mbfsansC" "𝗖" julia-latexsubs) +(puthash "\\mbfsansD" "𝗗" julia-latexsubs) +(puthash "\\mbfsansE" "𝗘" julia-latexsubs) +(puthash "\\mbfsansF" "𝗙" julia-latexsubs) +(puthash "\\mbfsansG" "𝗚" julia-latexsubs) +(puthash "\\mbfsansH" "𝗛" julia-latexsubs) +(puthash "\\mbfsansI" "𝗜" julia-latexsubs) +(puthash "\\mbfsansJ" "𝗝" julia-latexsubs) +(puthash "\\mbfsansK" "𝗞" julia-latexsubs) +(puthash "\\mbfsansL" "𝗟" julia-latexsubs) +(puthash "\\mbfsansM" "𝗠" julia-latexsubs) +(puthash "\\mbfsansN" "𝗡" julia-latexsubs) +(puthash "\\mbfsansO" "𝗢" julia-latexsubs) +(puthash "\\mbfsansP" "𝗣" julia-latexsubs) +(puthash "\\mbfsansQ" "𝗤" julia-latexsubs) +(puthash "\\mbfsansR" "𝗥" julia-latexsubs) +(puthash "\\mbfsansS" "𝗦" julia-latexsubs) +(puthash "\\mbfsansT" "𝗧" julia-latexsubs) +(puthash "\\mbfsansU" "𝗨" julia-latexsubs) +(puthash "\\mbfsansV" "𝗩" julia-latexsubs) +(puthash "\\mbfsansW" "𝗪" julia-latexsubs) +(puthash "\\mbfsansX" "𝗫" julia-latexsubs) +(puthash "\\mbfsansY" "𝗬" julia-latexsubs) +(puthash "\\mbfsansZ" "𝗭" julia-latexsubs) +(puthash "\\mbfsansa" "𝗮" julia-latexsubs) +(puthash "\\mbfsansb" "𝗯" julia-latexsubs) +(puthash "\\mbfsansc" "𝗰" julia-latexsubs) +(puthash "\\mbfsansd" "𝗱" julia-latexsubs) +(puthash "\\mbfsanse" "𝗲" julia-latexsubs) +(puthash "\\mbfsansf" "𝗳" julia-latexsubs) +(puthash "\\mbfsansg" "𝗴" julia-latexsubs) +(puthash "\\mbfsansh" "𝗵" julia-latexsubs) +(puthash "\\mbfsansi" "𝗶" julia-latexsubs) +(puthash "\\mbfsansj" "𝗷" julia-latexsubs) +(puthash "\\mbfsansk" "𝗸" julia-latexsubs) +(puthash "\\mbfsansl" "𝗹" julia-latexsubs) +(puthash "\\mbfsansm" "𝗺" julia-latexsubs) +(puthash "\\mbfsansn" "𝗻" julia-latexsubs) +(puthash "\\mbfsanso" "𝗼" julia-latexsubs) +(puthash "\\mbfsansp" "𝗽" julia-latexsubs) +(puthash "\\mbfsansq" "𝗾" julia-latexsubs) +(puthash "\\mbfsansr" "𝗿" julia-latexsubs) +(puthash "\\mbfsanss" "𝘀" julia-latexsubs) +(puthash "\\mbfsanst" "𝘁" julia-latexsubs) +(puthash "\\mbfsansu" "𝘂" julia-latexsubs) +(puthash "\\mbfsansv" "𝘃" julia-latexsubs) +(puthash "\\mbfsansw" "𝘄" julia-latexsubs) +(puthash "\\mbfsansx" "𝘅" julia-latexsubs) +(puthash "\\mbfsansy" "𝘆" julia-latexsubs) +(puthash "\\mbfsansz" "𝘇" julia-latexsubs) +(puthash "\\mitsansA" "𝘈" julia-latexsubs) +(puthash "\\mitsansB" "𝘉" julia-latexsubs) +(puthash "\\mitsansC" "𝘊" julia-latexsubs) +(puthash "\\mitsansD" "𝘋" julia-latexsubs) +(puthash "\\mitsansE" "𝘌" julia-latexsubs) +(puthash "\\mitsansF" "𝘍" julia-latexsubs) +(puthash "\\mitsansG" "𝘎" julia-latexsubs) +(puthash "\\mitsansH" "𝘏" julia-latexsubs) +(puthash "\\mitsansI" "𝘐" julia-latexsubs) +(puthash "\\mitsansJ" "𝘑" julia-latexsubs) +(puthash "\\mitsansK" "𝘒" julia-latexsubs) +(puthash "\\mitsansL" "𝘓" julia-latexsubs) +(puthash "\\mitsansM" "𝘔" julia-latexsubs) +(puthash "\\mitsansN" "𝘕" julia-latexsubs) +(puthash "\\mitsansO" "𝘖" julia-latexsubs) +(puthash "\\mitsansP" "𝘗" julia-latexsubs) +(puthash "\\mitsansQ" "𝘘" julia-latexsubs) +(puthash "\\mitsansR" "𝘙" julia-latexsubs) +(puthash "\\mitsansS" "𝘚" julia-latexsubs) +(puthash "\\mitsansT" "𝘛" julia-latexsubs) +(puthash "\\mitsansU" "𝘜" julia-latexsubs) +(puthash "\\mitsansV" "𝘝" julia-latexsubs) +(puthash "\\mitsansW" "𝘞" julia-latexsubs) +(puthash "\\mitsansX" "𝘟" julia-latexsubs) +(puthash "\\mitsansY" "𝘠" julia-latexsubs) +(puthash "\\mitsansZ" "𝘡" julia-latexsubs) +(puthash "\\mitsansa" "𝘢" julia-latexsubs) +(puthash "\\mitsansb" "𝘣" julia-latexsubs) +(puthash "\\mitsansc" "𝘤" julia-latexsubs) +(puthash "\\mitsansd" "𝘥" julia-latexsubs) +(puthash "\\mitsanse" "𝘦" julia-latexsubs) +(puthash "\\mitsansf" "𝘧" julia-latexsubs) +(puthash "\\mitsansg" "𝘨" julia-latexsubs) +(puthash "\\mitsansh" "𝘩" julia-latexsubs) +(puthash "\\mitsansi" "𝘪" julia-latexsubs) +(puthash "\\mitsansj" "𝘫" julia-latexsubs) +(puthash "\\mitsansk" "𝘬" julia-latexsubs) +(puthash "\\mitsansl" "𝘭" julia-latexsubs) +(puthash "\\mitsansm" "𝘮" julia-latexsubs) +(puthash "\\mitsansn" "𝘯" julia-latexsubs) +(puthash "\\mitsanso" "𝘰" julia-latexsubs) +(puthash "\\mitsansp" "𝘱" julia-latexsubs) +(puthash "\\mitsansq" "𝘲" julia-latexsubs) +(puthash "\\mitsansr" "𝘳" julia-latexsubs) +(puthash "\\mitsanss" "𝘴" julia-latexsubs) +(puthash "\\mitsanst" "𝘵" julia-latexsubs) +(puthash "\\mitsansu" "𝘶" julia-latexsubs) +(puthash "\\mitsansv" "𝘷" julia-latexsubs) +(puthash "\\mitsansw" "𝘸" julia-latexsubs) +(puthash "\\mitsansx" "𝘹" julia-latexsubs) +(puthash "\\mitsansy" "𝘺" julia-latexsubs) +(puthash "\\mitsansz" "𝘻" julia-latexsubs) +(puthash "\\mbfitsansA" "𝘼" julia-latexsubs) +(puthash "\\mbfitsansB" "𝘽" julia-latexsubs) +(puthash "\\mbfitsansC" "𝘾" julia-latexsubs) +(puthash "\\mbfitsansD" "𝘿" julia-latexsubs) +(puthash "\\mbfitsansE" "𝙀" julia-latexsubs) +(puthash "\\mbfitsansF" "𝙁" julia-latexsubs) +(puthash "\\mbfitsansG" "𝙂" julia-latexsubs) +(puthash "\\mbfitsansH" "𝙃" julia-latexsubs) +(puthash "\\mbfitsansI" "𝙄" julia-latexsubs) +(puthash "\\mbfitsansJ" "𝙅" julia-latexsubs) +(puthash "\\mbfitsansK" "𝙆" julia-latexsubs) +(puthash "\\mbfitsansL" "𝙇" julia-latexsubs) +(puthash "\\mbfitsansM" "𝙈" julia-latexsubs) +(puthash "\\mbfitsansN" "𝙉" julia-latexsubs) +(puthash "\\mbfitsansO" "𝙊" julia-latexsubs) +(puthash "\\mbfitsansP" "𝙋" julia-latexsubs) +(puthash "\\mbfitsansQ" "𝙌" julia-latexsubs) +(puthash "\\mbfitsansR" "𝙍" julia-latexsubs) +(puthash "\\mbfitsansS" "𝙎" julia-latexsubs) +(puthash "\\mbfitsansT" "𝙏" julia-latexsubs) +(puthash "\\mbfitsansU" "𝙐" julia-latexsubs) +(puthash "\\mbfitsansV" "𝙑" julia-latexsubs) +(puthash "\\mbfitsansW" "𝙒" julia-latexsubs) +(puthash "\\mbfitsansX" "𝙓" julia-latexsubs) +(puthash "\\mbfitsansY" "𝙔" julia-latexsubs) +(puthash "\\mbfitsansZ" "𝙕" julia-latexsubs) +(puthash "\\mbfitsansa" "𝙖" julia-latexsubs) +(puthash "\\mbfitsansb" "𝙗" julia-latexsubs) +(puthash "\\mbfitsansc" "𝙘" julia-latexsubs) +(puthash "\\mbfitsansd" "𝙙" julia-latexsubs) +(puthash "\\mbfitsanse" "𝙚" julia-latexsubs) +(puthash "\\mbfitsansf" "𝙛" julia-latexsubs) +(puthash "\\mbfitsansg" "𝙜" julia-latexsubs) +(puthash "\\mbfitsansh" "𝙝" julia-latexsubs) +(puthash "\\mbfitsansi" "𝙞" julia-latexsubs) +(puthash "\\mbfitsansj" "𝙟" julia-latexsubs) +(puthash "\\mbfitsansk" "𝙠" julia-latexsubs) +(puthash "\\mbfitsansl" "𝙡" julia-latexsubs) +(puthash "\\mbfitsansm" "𝙢" julia-latexsubs) +(puthash "\\mbfitsansn" "𝙣" julia-latexsubs) +(puthash "\\mbfitsanso" "𝙤" julia-latexsubs) +(puthash "\\mbfitsansp" "𝙥" julia-latexsubs) +(puthash "\\mbfitsansq" "𝙦" julia-latexsubs) +(puthash "\\mbfitsansr" "𝙧" julia-latexsubs) +(puthash "\\mbfitsanss" "𝙨" julia-latexsubs) +(puthash "\\mbfitsanst" "𝙩" julia-latexsubs) +(puthash "\\mbfitsansu" "𝙪" julia-latexsubs) +(puthash "\\mbfitsansv" "𝙫" julia-latexsubs) +(puthash "\\mbfitsansw" "𝙬" julia-latexsubs) +(puthash "\\mbfitsansx" "𝙭" julia-latexsubs) +(puthash "\\mbfitsansy" "𝙮" julia-latexsubs) +(puthash "\\mbfitsansz" "𝙯" julia-latexsubs) +(puthash "\\mttA" "𝙰" julia-latexsubs) +(puthash "\\mttB" "𝙱" julia-latexsubs) +(puthash "\\mttC" "𝙲" julia-latexsubs) +(puthash "\\mttD" "𝙳" julia-latexsubs) +(puthash "\\mttE" "𝙴" julia-latexsubs) +(puthash "\\mttF" "𝙵" julia-latexsubs) +(puthash "\\mttG" "𝙶" julia-latexsubs) +(puthash "\\mttH" "𝙷" julia-latexsubs) +(puthash "\\mttI" "𝙸" julia-latexsubs) +(puthash "\\mttJ" "𝙹" julia-latexsubs) +(puthash "\\mttK" "𝙺" julia-latexsubs) +(puthash "\\mttL" "𝙻" julia-latexsubs) +(puthash "\\mttM" "𝙼" julia-latexsubs) +(puthash "\\mttN" "𝙽" julia-latexsubs) +(puthash "\\mttO" "𝙾" julia-latexsubs) +(puthash "\\mttP" "𝙿" julia-latexsubs) +(puthash "\\mttQ" "𝚀" julia-latexsubs) +(puthash "\\mttR" "𝚁" julia-latexsubs) +(puthash "\\mttS" "𝚂" julia-latexsubs) +(puthash "\\mttT" "𝚃" julia-latexsubs) +(puthash "\\mttU" "𝚄" julia-latexsubs) +(puthash "\\mttV" "𝚅" julia-latexsubs) +(puthash "\\mttW" "𝚆" julia-latexsubs) +(puthash "\\mttX" "𝚇" julia-latexsubs) +(puthash "\\mttY" "𝚈" julia-latexsubs) +(puthash "\\mttZ" "𝚉" julia-latexsubs) +(puthash "\\mtta" "𝚊" julia-latexsubs) +(puthash "\\mttb" "𝚋" julia-latexsubs) +(puthash "\\mttc" "𝚌" julia-latexsubs) +(puthash "\\mttd" "𝚍" julia-latexsubs) +(puthash "\\mtte" "𝚎" julia-latexsubs) +(puthash "\\mttf" "𝚏" julia-latexsubs) +(puthash "\\mttg" "𝚐" julia-latexsubs) +(puthash "\\mtth" "𝚑" julia-latexsubs) +(puthash "\\mtti" "𝚒" julia-latexsubs) +(puthash "\\mttj" "𝚓" julia-latexsubs) +(puthash "\\mttk" "𝚔" julia-latexsubs) +(puthash "\\mttl" "𝚕" julia-latexsubs) +(puthash "\\mttm" "𝚖" julia-latexsubs) +(puthash "\\mttn" "𝚗" julia-latexsubs) +(puthash "\\mtto" "𝚘" julia-latexsubs) +(puthash "\\mttp" "𝚙" julia-latexsubs) +(puthash "\\mttq" "𝚚" julia-latexsubs) +(puthash "\\mttr" "𝚛" julia-latexsubs) +(puthash "\\mtts" "𝚜" julia-latexsubs) +(puthash "\\mttt" "𝚝" julia-latexsubs) +(puthash "\\mttu" "𝚞" julia-latexsubs) +(puthash "\\mttv" "𝚟" julia-latexsubs) +(puthash "\\mttw" "𝚠" julia-latexsubs) +(puthash "\\mttx" "𝚡" julia-latexsubs) +(puthash "\\mtty" "𝚢" julia-latexsubs) +(puthash "\\mttz" "𝚣" julia-latexsubs) +(let ((c (decode-char 'ucs #x1d6a4))) + (if c (puthash "\\imath" (char-to-string c) julia-latexsubs))) +(let ((c (decode-char 'ucs #x1d6a5))) + (if c (puthash "\\jmath" (char-to-string c) julia-latexsubs))) +(puthash "\\mbfAlpha" "𝚨" julia-latexsubs) +(puthash "\\mbfBeta" "𝚩" julia-latexsubs) +(puthash "\\mbfGamma" "𝚪" julia-latexsubs) +(puthash "\\mbfDelta" "𝚫" julia-latexsubs) +(puthash "\\mbfEpsilon" "𝚬" julia-latexsubs) +(puthash "\\mbfZeta" "𝚭" julia-latexsubs) +(puthash "\\mbfEta" "𝚮" julia-latexsubs) +(puthash "\\mbfTheta" "𝚯" julia-latexsubs) +(puthash "\\mbfIota" "𝚰" julia-latexsubs) +(puthash "\\mbfKappa" "𝚱" julia-latexsubs) +(puthash "\\mbfLambda" "𝚲" julia-latexsubs) +(puthash "\\mbfMu" "𝚳" julia-latexsubs) +(puthash "\\mbfNu" "𝚴" julia-latexsubs) +(puthash "\\mbfXi" "𝚵" julia-latexsubs) +(puthash "\\mbfOmicron" "𝚶" julia-latexsubs) +(puthash "\\mbfPi" "𝚷" julia-latexsubs) +(puthash "\\mbfRho" "𝚸" julia-latexsubs) +(puthash "\\mbfvarTheta" "𝚹" julia-latexsubs) +(puthash "\\mbfSigma" "𝚺" julia-latexsubs) +(puthash "\\mbfTau" "𝚻" julia-latexsubs) +(puthash "\\mbfUpsilon" "𝚼" julia-latexsubs) +(puthash "\\mbfPhi" "𝚽" julia-latexsubs) +(puthash "\\mbfChi" "𝚾" julia-latexsubs) +(puthash "\\mbfPsi" "𝚿" julia-latexsubs) +(puthash "\\mbfOmega" "𝛀" julia-latexsubs) +(puthash "\\mbfnabla" "𝛁" julia-latexsubs) +(puthash "\\mbfalpha" "𝛂" julia-latexsubs) +(puthash "\\mbfbeta" "𝛃" julia-latexsubs) +(puthash "\\mbfgamma" "𝛄" julia-latexsubs) +(puthash "\\mbfdelta" "𝛅" julia-latexsubs) +(puthash "\\mbfepsilon" "𝛆" julia-latexsubs) +(puthash "\\mbfzeta" "𝛇" julia-latexsubs) +(puthash "\\mbfeta" "𝛈" julia-latexsubs) +(puthash "\\mbftheta" "𝛉" julia-latexsubs) +(puthash "\\mbfiota" "𝛊" julia-latexsubs) +(puthash "\\mbfkappa" "𝛋" julia-latexsubs) +(puthash "\\mbflambda" "𝛌" julia-latexsubs) +(puthash "\\mbfmu" "𝛍" julia-latexsubs) +(puthash "\\mbfnu" "𝛎" julia-latexsubs) +(puthash "\\mbfxi" "𝛏" julia-latexsubs) +(puthash "\\mbfomicron" "𝛐" julia-latexsubs) +(puthash "\\mbfpi" "𝛑" julia-latexsubs) +(puthash "\\mbfrho" "𝛒" julia-latexsubs) +(puthash "\\mbfvarsigma" "𝛓" julia-latexsubs) +(puthash "\\mbfsigma" "𝛔" julia-latexsubs) +(puthash "\\mbftau" "𝛕" julia-latexsubs) +(puthash "\\mbfupsilon" "𝛖" julia-latexsubs) +(puthash "\\mbfvarphi" "𝛗" julia-latexsubs) +(puthash "\\mbfchi" "𝛘" julia-latexsubs) +(puthash "\\mbfpsi" "𝛙" julia-latexsubs) +(puthash "\\mbfomega" "𝛚" julia-latexsubs) +(puthash "\\mbfpartial" "𝛛" julia-latexsubs) +(puthash "\\mbfvarepsilon" "𝛜" julia-latexsubs) +(puthash "\\mbfvartheta" "𝛝" julia-latexsubs) +(puthash "\\mbfvarkappa" "𝛞" julia-latexsubs) +(puthash "\\mbfphi" "𝛟" julia-latexsubs) +(puthash "\\mbfvarrho" "𝛠" julia-latexsubs) +(puthash "\\mbfvarpi" "𝛡" julia-latexsubs) +(puthash "\\mitAlpha" "𝛢" julia-latexsubs) +(puthash "\\mitBeta" "𝛣" julia-latexsubs) +(puthash "\\mitGamma" "𝛤" julia-latexsubs) +(puthash "\\mitDelta" "𝛥" julia-latexsubs) +(puthash "\\mitEpsilon" "𝛦" julia-latexsubs) +(puthash "\\mitZeta" "𝛧" julia-latexsubs) +(puthash "\\mitEta" "𝛨" julia-latexsubs) +(puthash "\\mitTheta" "𝛩" julia-latexsubs) +(puthash "\\mitIota" "𝛪" julia-latexsubs) +(puthash "\\mitKappa" "𝛫" julia-latexsubs) +(puthash "\\mitLambda" "𝛬" julia-latexsubs) +(puthash "\\mitMu" "𝛭" julia-latexsubs) +(puthash "\\mitNu" "𝛮" julia-latexsubs) +(puthash "\\mitXi" "𝛯" julia-latexsubs) +(puthash "\\mitOmicron" "𝛰" julia-latexsubs) +(puthash "\\mitPi" "𝛱" julia-latexsubs) +(puthash "\\mitRho" "𝛲" julia-latexsubs) +(puthash "\\mitvarTheta" "𝛳" julia-latexsubs) +(puthash "\\mitSigma" "𝛴" julia-latexsubs) +(puthash "\\mitTau" "𝛵" julia-latexsubs) +(puthash "\\mitUpsilon" "𝛶" julia-latexsubs) +(puthash "\\mitPhi" "𝛷" julia-latexsubs) +(puthash "\\mitChi" "𝛸" julia-latexsubs) +(puthash "\\mitPsi" "𝛹" julia-latexsubs) +(puthash "\\mitOmega" "𝛺" julia-latexsubs) +(puthash "\\mitnabla" "𝛻" julia-latexsubs) +(puthash "\\mitalpha" "𝛼" julia-latexsubs) +(puthash "\\mitbeta" "𝛽" julia-latexsubs) +(puthash "\\mitgamma" "𝛾" julia-latexsubs) +(puthash "\\mitdelta" "𝛿" julia-latexsubs) +(puthash "\\mitepsilon" "𝜀" julia-latexsubs) +(puthash "\\mitzeta" "𝜁" julia-latexsubs) +(puthash "\\miteta" "𝜂" julia-latexsubs) +(puthash "\\mittheta" "𝜃" julia-latexsubs) +(puthash "\\mitiota" "𝜄" julia-latexsubs) +(puthash "\\mitkappa" "𝜅" julia-latexsubs) +(puthash "\\mitlambda" "𝜆" julia-latexsubs) +(puthash "\\mitmu" "𝜇" julia-latexsubs) +(puthash "\\mitnu" "𝜈" julia-latexsubs) +(puthash "\\mitxi" "𝜉" julia-latexsubs) +(puthash "\\mitomicron" "𝜊" julia-latexsubs) +(puthash "\\mitpi" "𝜋" julia-latexsubs) +(puthash "\\mitrho" "𝜌" julia-latexsubs) +(puthash "\\mitvarsigma" "𝜍" julia-latexsubs) +(puthash "\\mitsigma" "𝜎" julia-latexsubs) +(puthash "\\mittau" "𝜏" julia-latexsubs) +(puthash "\\mitupsilon" "𝜐" julia-latexsubs) +(puthash "\\mitphi" "𝜑" julia-latexsubs) +(puthash "\\mitchi" "𝜒" julia-latexsubs) +(puthash "\\mitpsi" "𝜓" julia-latexsubs) +(puthash "\\mitomega" "𝜔" julia-latexsubs) +(puthash "\\mitpartial" "𝜕" julia-latexsubs) +(puthash "\\mitvarepsilon" "𝜖" julia-latexsubs) +(puthash "\\mitvartheta" "𝜗" julia-latexsubs) +(puthash "\\mitvarkappa" "𝜘" julia-latexsubs) +(puthash "\\mitvarphi" "𝜙" julia-latexsubs) +(puthash "\\mitvarrho" "𝜚" julia-latexsubs) +(puthash "\\mitvarpi" "𝜛" julia-latexsubs) +(puthash "\\mbfitAlpha" "𝜜" julia-latexsubs) +(puthash "\\mbfitBeta" "𝜝" julia-latexsubs) +(puthash "\\mbfitGamma" "𝜞" julia-latexsubs) +(puthash "\\mbfitDelta" "𝜟" julia-latexsubs) +(puthash "\\mbfitEpsilon" "𝜠" julia-latexsubs) +(puthash "\\mbfitZeta" "𝜡" julia-latexsubs) +(puthash "\\mbfitEta" "𝜢" julia-latexsubs) +(puthash "\\mbfitTheta" "𝜣" julia-latexsubs) +(puthash "\\mbfitIota" "𝜤" julia-latexsubs) +(puthash "\\mbfitKappa" "𝜥" julia-latexsubs) +(puthash "\\mbfitLambda" "𝜦" julia-latexsubs) +(puthash "\\mbfitMu" "𝜧" julia-latexsubs) +(puthash "\\mbfitNu" "𝜨" julia-latexsubs) +(puthash "\\mbfitXi" "𝜩" julia-latexsubs) +(puthash "\\mbfitOmicron" "𝜪" julia-latexsubs) +(puthash "\\mbfitPi" "𝜫" julia-latexsubs) +(puthash "\\mbfitRho" "𝜬" julia-latexsubs) +(puthash "\\mbfitvarTheta" "𝜭" julia-latexsubs) +(puthash "\\mbfitSigma" "𝜮" julia-latexsubs) +(puthash "\\mbfitTau" "𝜯" julia-latexsubs) +(puthash "\\mbfitUpsilon" "𝜰" julia-latexsubs) +(puthash "\\mbfitPhi" "𝜱" julia-latexsubs) +(puthash "\\mbfitChi" "𝜲" julia-latexsubs) +(puthash "\\mbfitPsi" "𝜳" julia-latexsubs) +(puthash "\\mbfitOmega" "𝜴" julia-latexsubs) +(puthash "\\mbfitnabla" "𝜵" julia-latexsubs) +(puthash "\\mbfitalpha" "𝜶" julia-latexsubs) +(puthash "\\mbfitbeta" "𝜷" julia-latexsubs) +(puthash "\\mbfitgamma" "𝜸" julia-latexsubs) +(puthash "\\mbfitdelta" "𝜹" julia-latexsubs) +(puthash "\\mbfitepsilon" "𝜺" julia-latexsubs) +(puthash "\\mbfitzeta" "𝜻" julia-latexsubs) +(puthash "\\mbfiteta" "𝜼" julia-latexsubs) +(puthash "\\mbfittheta" "𝜽" julia-latexsubs) +(puthash "\\mbfitiota" "𝜾" julia-latexsubs) +(puthash "\\mbfitkappa" "𝜿" julia-latexsubs) +(puthash "\\mbfitlambda" "𝝀" julia-latexsubs) +(puthash "\\mbfitmu" "𝝁" julia-latexsubs) +(puthash "\\mbfitnu" "𝝂" julia-latexsubs) +(puthash "\\mbfitxi" "𝝃" julia-latexsubs) +(puthash "\\mbfitomicron" "𝝄" julia-latexsubs) +(puthash "\\mbfitpi" "𝝅" julia-latexsubs) +(puthash "\\mbfitrho" "𝝆" julia-latexsubs) +(puthash "\\mbfitvarsigma" "𝝇" julia-latexsubs) +(puthash "\\mbfitsigma" "𝝈" julia-latexsubs) +(puthash "\\mbfittau" "𝝉" julia-latexsubs) +(puthash "\\mbfitupsilon" "𝝊" julia-latexsubs) +(puthash "\\mbfitphi" "𝝋" julia-latexsubs) +(puthash "\\mbfitchi" "𝝌" julia-latexsubs) +(puthash "\\mbfitpsi" "𝝍" julia-latexsubs) +(puthash "\\mbfitomega" "𝝎" julia-latexsubs) +(puthash "\\mbfitpartial" "𝝏" julia-latexsubs) +(puthash "\\mbfitvarepsilon" "𝝐" julia-latexsubs) +(puthash "\\mbfitvartheta" "𝝑" julia-latexsubs) +(puthash "\\mbfitvarkappa" "𝝒" julia-latexsubs) +(puthash "\\mbfitvarphi" "𝝓" julia-latexsubs) +(puthash "\\mbfitvarrho" "𝝔" julia-latexsubs) +(puthash "\\mbfitvarpi" "𝝕" julia-latexsubs) +(puthash "\\mbfsansAlpha" "𝝖" julia-latexsubs) +(puthash "\\mbfsansBeta" "𝝗" julia-latexsubs) +(puthash "\\mbfsansGamma" "𝝘" julia-latexsubs) +(puthash "\\mbfsansDelta" "𝝙" julia-latexsubs) +(puthash "\\mbfsansEpsilon" "𝝚" julia-latexsubs) +(puthash "\\mbfsansZeta" "𝝛" julia-latexsubs) +(puthash "\\mbfsansEta" "𝝜" julia-latexsubs) +(puthash "\\mbfsansTheta" "𝝝" julia-latexsubs) +(puthash "\\mbfsansIota" "𝝞" julia-latexsubs) +(puthash "\\mbfsansKappa" "𝝟" julia-latexsubs) +(puthash "\\mbfsansLambda" "𝝠" julia-latexsubs) +(puthash "\\mbfsansMu" "𝝡" julia-latexsubs) +(puthash "\\mbfsansNu" "𝝢" julia-latexsubs) +(puthash "\\mbfsansXi" "𝝣" julia-latexsubs) +(puthash "\\mbfsansOmicron" "𝝤" julia-latexsubs) +(puthash "\\mbfsansPi" "𝝥" julia-latexsubs) +(puthash "\\mbfsansRho" "𝝦" julia-latexsubs) +(puthash "\\mbfsansvarTheta" "𝝧" julia-latexsubs) +(puthash "\\mbfsansSigma" "𝝨" julia-latexsubs) +(puthash "\\mbfsansTau" "𝝩" julia-latexsubs) +(puthash "\\mbfsansUpsilon" "𝝪" julia-latexsubs) +(puthash "\\mbfsansPhi" "𝝫" julia-latexsubs) +(puthash "\\mbfsansChi" "𝝬" julia-latexsubs) +(puthash "\\mbfsansPsi" "𝝭" julia-latexsubs) +(puthash "\\mbfsansOmega" "𝝮" julia-latexsubs) +(puthash "\\mbfsansnabla" "𝝯" julia-latexsubs) +(puthash "\\mbfsansalpha" "𝝰" julia-latexsubs) +(puthash "\\mbfsansbeta" "𝝱" julia-latexsubs) +(puthash "\\mbfsansgamma" "𝝲" julia-latexsubs) +(puthash "\\mbfsansdelta" "𝝳" julia-latexsubs) +(puthash "\\mbfsansepsilon" "𝝴" julia-latexsubs) +(puthash "\\mbfsanszeta" "𝝵" julia-latexsubs) +(puthash "\\mbfsanseta" "𝝶" julia-latexsubs) +(puthash "\\mbfsanstheta" "𝝷" julia-latexsubs) +(puthash "\\mbfsansiota" "𝝸" julia-latexsubs) +(puthash "\\mbfsanskappa" "𝝹" julia-latexsubs) +(puthash "\\mbfsanslambda" "𝝺" julia-latexsubs) +(puthash "\\mbfsansmu" "𝝻" julia-latexsubs) +(puthash "\\mbfsansnu" "𝝼" julia-latexsubs) +(puthash "\\mbfsansxi" "𝝽" julia-latexsubs) +(puthash "\\mbfsansomicron" "𝝾" julia-latexsubs) +(puthash "\\mbfsanspi" "𝝿" julia-latexsubs) +(puthash "\\mbfsansrho" "𝞀" julia-latexsubs) +(puthash "\\mbfsansvarsigma" "𝞁" julia-latexsubs) +(puthash "\\mbfsanssigma" "𝞂" julia-latexsubs) +(puthash "\\mbfsanstau" "𝞃" julia-latexsubs) +(puthash "\\mbfsansupsilon" "𝞄" julia-latexsubs) +(puthash "\\mbfsansphi" "𝞅" julia-latexsubs) +(puthash "\\mbfsanschi" "𝞆" julia-latexsubs) +(puthash "\\mbfsanspsi" "𝞇" julia-latexsubs) +(puthash "\\mbfsansomega" "𝞈" julia-latexsubs) +(puthash "\\mbfsanspartial" "𝞉" julia-latexsubs) +(puthash "\\mbfsansvarepsilon" "𝞊" julia-latexsubs) +(puthash "\\mbfsansvartheta" "𝞋" julia-latexsubs) +(puthash "\\mbfsansvarkappa" "𝞌" julia-latexsubs) +(puthash "\\mbfsansvarphi" "𝞍" julia-latexsubs) +(puthash "\\mbfsansvarrho" "𝞎" julia-latexsubs) +(puthash "\\mbfsansvarpi" "𝞏" julia-latexsubs) +(puthash "\\mbfitsansAlpha" "𝞐" julia-latexsubs) +(puthash "\\mbfitsansBeta" "𝞑" julia-latexsubs) +(puthash "\\mbfitsansGamma" "𝞒" julia-latexsubs) +(puthash "\\mbfitsansDelta" "𝞓" julia-latexsubs) +(puthash "\\mbfitsansEpsilon" "𝞔" julia-latexsubs) +(puthash "\\mbfitsansZeta" "𝞕" julia-latexsubs) +(puthash "\\mbfitsansEta" "𝞖" julia-latexsubs) +(puthash "\\mbfitsansTheta" "𝞗" julia-latexsubs) +(puthash "\\mbfitsansIota" "𝞘" julia-latexsubs) +(puthash "\\mbfitsansKappa" "𝞙" julia-latexsubs) +(puthash "\\mbfitsansLambda" "𝞚" julia-latexsubs) +(puthash "\\mbfitsansMu" "𝞛" julia-latexsubs) +(puthash "\\mbfitsansNu" "𝞜" julia-latexsubs) +(puthash "\\mbfitsansXi" "𝞝" julia-latexsubs) +(puthash "\\mbfitsansOmicron" "𝞞" julia-latexsubs) +(puthash "\\mbfitsansPi" "𝞟" julia-latexsubs) +(puthash "\\mbfitsansRho" "𝞠" julia-latexsubs) +(puthash "\\mbfitsansvarTheta" "𝞡" julia-latexsubs) +(puthash "\\mbfitsansSigma" "𝞢" julia-latexsubs) +(puthash "\\mbfitsansTau" "𝞣" julia-latexsubs) +(puthash "\\mbfitsansUpsilon" "𝞤" julia-latexsubs) +(puthash "\\mbfitsansPhi" "𝞥" julia-latexsubs) +(puthash "\\mbfitsansChi" "𝞦" julia-latexsubs) +(puthash "\\mbfitsansPsi" "𝞧" julia-latexsubs) +(puthash "\\mbfitsansOmega" "𝞨" julia-latexsubs) +(puthash "\\mbfitsansnabla" "𝞩" julia-latexsubs) +(puthash "\\mbfitsansalpha" "𝞪" julia-latexsubs) +(puthash "\\mbfitsansbeta" "𝞫" julia-latexsubs) +(puthash "\\mbfitsansgamma" "𝞬" julia-latexsubs) +(puthash "\\mbfitsansdelta" "𝞭" julia-latexsubs) +(puthash "\\mbfitsansepsilon" "𝞮" julia-latexsubs) +(puthash "\\mbfitsanszeta" "𝞯" julia-latexsubs) +(puthash "\\mbfitsanseta" "𝞰" julia-latexsubs) +(puthash "\\mbfitsanstheta" "𝞱" julia-latexsubs) +(puthash "\\mbfitsansiota" "𝞲" julia-latexsubs) +(puthash "\\mbfitsanskappa" "𝞳" julia-latexsubs) +(puthash "\\mbfitsanslambda" "𝞴" julia-latexsubs) +(puthash "\\mbfitsansmu" "𝞵" julia-latexsubs) +(puthash "\\mbfitsansnu" "𝞶" julia-latexsubs) +(puthash "\\mbfitsansxi" "𝞷" julia-latexsubs) +(puthash "\\mbfitsansomicron" "𝞸" julia-latexsubs) +(puthash "\\mbfitsanspi" "𝞹" julia-latexsubs) +(puthash "\\mbfitsansrho" "𝞺" julia-latexsubs) +(puthash "\\mbfitsansvarsigma" "𝞻" julia-latexsubs) +(puthash "\\mbfitsanssigma" "𝞼" julia-latexsubs) +(puthash "\\mbfitsanstau" "𝞽" julia-latexsubs) +(puthash "\\mbfitsansupsilon" "𝞾" julia-latexsubs) +(puthash "\\mbfitsansphi" "𝞿" julia-latexsubs) +(puthash "\\mbfitsanschi" "𝟀" julia-latexsubs) +(puthash "\\mbfitsanspsi" "𝟁" julia-latexsubs) +(puthash "\\mbfitsansomega" "𝟂" julia-latexsubs) +(puthash "\\mbfitsanspartial" "𝟃" julia-latexsubs) +(puthash "\\mbfitsansvarepsilon" "𝟄" julia-latexsubs) +(puthash "\\mbfitsansvartheta" "𝟅" julia-latexsubs) +(puthash "\\mbfitsansvarkappa" "𝟆" julia-latexsubs) +(puthash "\\mbfitsansvarphi" "𝟇" julia-latexsubs) +(puthash "\\mbfitsansvarrho" "𝟈" julia-latexsubs) +(puthash "\\mbfitsansvarpi" "𝟉" julia-latexsubs) +(let ((c (decode-char 'ucs #x1d7ca))) + (if c (puthash "\\mbfDigamma" (char-to-string c) julia-latexsubs))) +(let ((c (decode-char 'ucs #x1d7cb))) + (if c (puthash "\\mbfdigamma" (char-to-string c) julia-latexsubs))) +(puthash "\\mbfzero" "𝟎" julia-latexsubs) +(puthash "\\mbfone" "𝟏" julia-latexsubs) +(puthash "\\mbftwo" "𝟐" julia-latexsubs) +(puthash "\\mbfthree" "𝟑" julia-latexsubs) +(puthash "\\mbffour" "𝟒" julia-latexsubs) +(puthash "\\mbffive" "𝟓" julia-latexsubs) +(puthash "\\mbfsix" "𝟔" julia-latexsubs) +(puthash "\\mbfseven" "𝟕" julia-latexsubs) +(puthash "\\mbfeight" "𝟖" julia-latexsubs) +(puthash "\\mbfnine" "𝟗" julia-latexsubs) +(puthash "\\Bbbzero" "𝟘" julia-latexsubs) +(puthash "\\Bbbone" "𝟙" julia-latexsubs) +(puthash "\\Bbbtwo" "𝟚" julia-latexsubs) +(puthash "\\Bbbthree" "𝟛" julia-latexsubs) +(puthash "\\Bbbfour" "𝟜" julia-latexsubs) +(puthash "\\Bbbfive" "𝟝" julia-latexsubs) +(puthash "\\Bbbsix" "𝟞" julia-latexsubs) +(puthash "\\Bbbseven" "𝟟" julia-latexsubs) +(puthash "\\Bbbeight" "𝟠" julia-latexsubs) +(puthash "\\Bbbnine" "𝟡" julia-latexsubs) +(puthash "\\msanszero" "𝟢" julia-latexsubs) +(puthash "\\msansone" "𝟣" julia-latexsubs) +(puthash "\\msanstwo" "𝟤" julia-latexsubs) +(puthash "\\msansthree" "𝟥" julia-latexsubs) +(puthash "\\msansfour" "𝟦" julia-latexsubs) +(puthash "\\msansfive" "𝟧" julia-latexsubs) +(puthash "\\msanssix" "𝟨" julia-latexsubs) +(puthash "\\msansseven" "𝟩" julia-latexsubs) +(puthash "\\msanseight" "𝟪" julia-latexsubs) +(puthash "\\msansnine" "𝟫" julia-latexsubs) +(puthash "\\mbfsanszero" "𝟬" julia-latexsubs) +(puthash "\\mbfsansone" "𝟭" julia-latexsubs) +(puthash "\\mbfsanstwo" "𝟮" julia-latexsubs) +(puthash "\\mbfsansthree" "𝟯" julia-latexsubs) +(puthash "\\mbfsansfour" "𝟰" julia-latexsubs) +(puthash "\\mbfsansfive" "𝟱" julia-latexsubs) +(puthash "\\mbfsanssix" "𝟲" julia-latexsubs) +(puthash "\\mbfsansseven" "𝟳" julia-latexsubs) +(puthash "\\mbfsanseight" "𝟴" julia-latexsubs) +(puthash "\\mbfsansnine" "𝟵" julia-latexsubs) +(puthash "\\mttzero" "𝟶" julia-latexsubs) +(puthash "\\mttone" "𝟷" julia-latexsubs) +(puthash "\\mtttwo" "𝟸" julia-latexsubs) +(puthash "\\mttthree" "𝟹" julia-latexsubs) +(puthash "\\mttfour" "𝟺" julia-latexsubs) +(puthash "\\mttfive" "𝟻" julia-latexsubs) +(puthash "\\mttsix" "𝟼" julia-latexsubs) +(puthash "\\mttseven" "𝟽" julia-latexsubs) +(puthash "\\mtteight" "𝟾" julia-latexsubs) +(puthash "\\mttnine" "𝟿" julia-latexsubs) + +;; Code for `inferior-julia-mode' +(require 'comint) + +(defcustom julia-program "julia" + "Path to the program used by `inferior-julia'." + :type 'string + :group 'julia) + +(defcustom julia-arguments '() + "Commandline arguments to pass to `julia-program'." + :type 'string + :group 'julia) + +(defvar julia-prompt-regexp "julia>" + "Regexp for matching `inferior-julia' prompt.") + +(defvar inferior-julia-mode-map + (let ((map (nconc (make-sparse-keymap) comint-mode-map))) + ;; example definition + (define-key map (kbd "TAB") 'julia-latexsub-or-indent) + map) + "Basic mode map for `inferior-julia-mode'.") + +;;;###autoload +(defun inferior-julia () + "Run an inferior instance of `julia' inside Emacs." + (interactive) + (let ((julia-program julia-program) + (buffer (get-buffer-create "*Julia*"))) + (when (not (comint-check-proc "*Julia*")) + (apply #'make-comint-in-buffer "Julia" "*Julia*" julia-program julia-arguments)) + (pop-to-buffer-same-window "*Julia*") + (inferior-julia-mode))) + +(defun inferior-julia--initialize () + "Helper function to initialize `inferior-julia'." + (setq comint-use-prompt-regexp t)) + +(define-derived-mode inferior-julia-mode comint-mode "Julia" + "Major mode for `inferior-julia'. + +\\" + nil "Julia" + (setq comint-prompt-regexp julia-prompt-regexp) + (setq comint-prompt-read-only t) + (set (make-local-variable 'font-lock-defaults) '(julia-font-lock-keywords t)) + (set (make-local-variable 'paragraph-start) julia-prompt-regexp) + (set (make-local-variable 'indent-line-function) 'julia-indent-line)) + +(add-hook 'inferior-julia-mode-hook 'inferior-julia--initialize) + +(provide 'julia-mode) + +;; Local Variables: +;; coding: utf-8 +;; byte-compile-warnings: (not obsolete) +;; End: +;;; julia-mode.el ends here diff -Nru ess-16.10/lisp/Makefile ess-17.11/lisp/Makefile --- ess-16.10/lisp/Makefile 2016-05-07 16:45:06.000000000 +0000 +++ ess-17.11/lisp/Makefile 2017-11-13 14:13:16.000000000 +0000 @@ -38,20 +38,20 @@ ELC = $(CORE) ess-comp.elc ess-custom.elc \ ess-dde.elc ess-compat.elc ess-font-lock.elc \ ess-help.elc ess-inf.elc ess-mode.elc \ - ess-menu.elc ess-mouse.elc mouseme.elc \ + ess-mouse.elc mouseme.elc \ ess-swv.elc ess-toolbar.elc \ ess-trns.elc ess-utils.elc \ essd-els.elc ess-gretl.elc \ ess-lsp-l.elc ess-xls-d.elc ess-vst-d.elc ess-arc-d.elc \ ess-sas-l.elc ess-sas-d.elc ess-sas-a.elc \ - ess-sta-l.elc ess-sta-d.elc make-regexp.elc \ + ess-stata-lang.elc ess-stata-mode.elc make-regexp.elc \ ess-omg-l.elc ess-omg-d.elc \ ess-bugs-l.elc ess-bugs-d.elc ess-jags-d.elc \ ess-noweb.elc ess-noweb-mode.elc ess-noweb-font-lock-mode.elc \ ess-eldoc.elc ess-roxy.elc ess-rutils.elc ess-r-completion.elc \ - ess-s-l.elc ess-s3-d.elc ess-s4-d.elc \ + ess-s-lang.elc ess-s3-d.elc ess-s4-d.elc \ ess-sp3-d.elc ess-sp4-d.elc ess-sp5-d.elc ess-sp6-d.elc \ - ess-rdired.elc ess-r-args.elc ess-r-syntax.elc ess-r-d.elc ess-rd.elc \ + ess-rdired.elc ess-r-args.elc ess-r-syntax.elc ess-r-mode.elc ess-rd.elc \ ess-r-package.elc ess-tracebug.elc ess-julia.elc\ julia-mode.elc\ ess-generics.elc ess-r-gui.elc\ @@ -65,10 +65,10 @@ ### Targets -all: $(ELC) ess-custom.el julia-mode.el +all: $(ELC) ess-custom.el .PHONY: dist -dist: all +dist: all julia-mode.el ## @touch dist ## svn committing happens in ../Makefile @@ -101,12 +101,13 @@ ess-custom.el: ../VERSION EV='$(ESSVERSION)'; perl -pi -e "s/\".*\"/\"$$EV\"/ if /ess-version/" $@ -# ess-r-d.el: ../etc/ESSR-VERSION +# ess-r-mode.el: ../etc/ESSR-VERSION # sed -i -e '/let.*ESSR-version/s/"[-.0-9]*"/"$(ESSR_VER)"/' $@ -## This should typically happen before building ESS +## Should happen before building ESS; definitely *NOT* after unpacking tarball : julia-mode.el: - $(DOWNLOAD) https://raw.githubusercontent.com/JuliaLang/julia-emacs/master/julia-mode.el > julia-mode.el + test -f ../etc/.IS.RELEASE || $(DOWNLOAD) \ + https://raw.githubusercontent.com/JuliaLang/julia-emacs/master/julia-mode.el > $@ ### File Dependencies @@ -141,17 +142,17 @@ ## S languages -ess-s-l.elc : ess-s-l.el ess.elc +ess-s-lang.elc : ess-s-lang.el ess.elc ess-sas-d.elc : ess-sas-d.el ess.elc -ess-s3-d.elc : ess-s3-d.el ess-s-l.elc ess.elc +ess-s3-d.elc : ess-s3-d.el ess-s-lang.elc ess.elc -ess-sp3-d.elc : ess-sp3-d.el ess-s-l.elc ess.elc +ess-sp3-d.elc : ess-sp3-d.el ess-s-lang.elc ess.elc -ess-s4-d.elc : ess-s4-d.el ess-s-l.elc ess.elc +ess-s4-d.elc : ess-s4-d.el ess-s-lang.elc ess.elc -ess-r-d.elc : ess-r-d.el ess-s-l.elc ess.elc +ess-r-mode.elc : ess-r-mode.el ess-s-lang.elc ess.elc ess-swv.elc: ess-swv.el ess-noweb.elc @@ -171,9 +172,9 @@ ## Stata -ess-sta-l.elc : ess-sta-l.el ess.elc +ess-stata-lang.elc : ess-stata-lang.el ess.elc -ess-sta-d.elc : ess-sta-d.el ess.elc +ess-stata-mode.elc : ess-stata-mode.el ess.elc ## BUGS diff -Nru ess-16.10/lisp/old/ess-old-contrib.el ess-17.11/lisp/old/ess-old-contrib.el --- ess-16.10/lisp/old/ess-old-contrib.el 1970-01-01 00:00:00.000000000 +0000 +++ ess-17.11/lisp/old/ess-old-contrib.el 2017-11-13 14:13:17.000000000 +0000 @@ -0,0 +1,134 @@ +;;; ess-old-contrib.el --- Various utils contributed over the years + +;; Copyright (C) 1997--2012 A.J. Rossini, Richard M. Heiberger, Martin +;; Maechler, Kurt Hornik, Rodney Sparapani, and Stephen Eglen. + +;; Created: 1 April 2016 +;; Maintainer: ESS-core + +;; 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/ + +;;; Code: + +;; This is thanks to Ed L Cashin , 03 Mar 2004 : +(defun ess-restore-asm-extns () + "Remove the S-Plus mode association for .s and .S files added by ESS. +Putting the following in ~/.emacs restores emacs' default association +between .s or .S files and assembly mode. + + (add-hook 'ess-mode-hook 'ess-restore-asm-extns) + (add-hook 'inferior-ess-mode-hook 'ess-restore-asm-extns)" + (interactive) + (when (assoc "\\.[qsS]\\'" auto-mode-alist) + (setq auto-mode-alist + (remassoc "\\.[qsS]\\'" auto-mode-alist)) + ;; put .q extention back + ;; (add-to-list is in xemacs and GNU emacs) + ;; R-mode when in a R/ subdirectory, otherwise S-mode: + (add-to-list 'auto-mode-alist '("/R/.*\\.q\\'" . R-mode)) + (add-to-list 'auto-mode-alist '("\\.q\\'" . S-mode)) + )) + + +;; From: Sebastian Luque +;; To: ess-help@stat.math.ethz.ch +;; Date: Mon, 01 May 2006 19:17:49 -0500 + +;; Without knowing how to tell R to use w3m from within Emacs, and after +;; switching to Konqueror's window for the millionth time, I wrote the +;; following function: + +;; This emulates some of the functionality of RSiteSearch() and tests ok in +;; my system GNU Emacs 22.0.50.1 (i486-pc-linux-gnu, X toolkit, Xaw3d scroll +;; bars) of 2006-04-27 on pacem, modified by Debian. This has the benefit of +;; displaying results with whatever you've told browse-url to use; in my +;; case, w3m with the emacs-w3m package. + +;; My elisp skills are rather poor, so comments and suggestions for +;; improvement are welcome. +;; -- +;; Seb + +;; MM _FIXME_: This only works correctly for Emacs 22.0.50 (alpha) +;; for 21.x it has problems in the (completing-read-multiple .) +;; at the end +(defun R-site-search (string) + "Search the R archives for STRING, using default criteria. If +called with a prefix, options are available for + 1) matches per page, + 2) sections of the archives to search (separated by value of `crm-default-separator'), + 3) for displaying results in long or short formats, and + 4) for sorting by any given field. +Completion is available for supplying options." + (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" "short") + 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))) + ;; else: without prefix use defaults: + (browse-url (concat site okstring "&max=20&result=normal&sort=score" + "&idxname=Rhelp02a&idxname=functions&idxname=docs"))))) + +(provide 'ess-old-contrib) + + ; Local variables section + +;;; This file is automatically placed in Outline minor mode. +;;; The file is structured as follows: +;;; Chapters: ^L ; +;;; Sections: ;;*;; +;;; Subsections: ;;;*;;; +;;; Components: defuns, defvars, defconsts +;;; Random code beginning with a ;;;;* comment +;;; Local variables: +;;; mode: emacs-lisp +;;; mode: outline-minor +;;; outline-regexp: "\^L\\|\\`;\\|;;\\*\\|;;;\\*\\|(def[cvu]\\|(setq\\|;;;;\\*" +;;; End: + +;;; ess-old-contrib.el ends here diff -Nru ess-16.10/lisp/old/ess-old-s.el ess-17.11/lisp/old/ess-old-s.el --- ess-16.10/lisp/old/ess-old-s.el 1970-01-01 00:00:00.000000000 +0000 +++ ess-17.11/lisp/old/ess-old-s.el 2017-11-13 14:13:17.000000000 +0000 @@ -0,0 +1,25 @@ + +(defvar ess-function-outline-file + (concat ess-etc-directory "/function-outline.S") + "The file name of the ess-function outline that is to be inserted at point, +when \\[ess-insert-function-outline] is used. +Placeholders (substituted `at runtime'): $A$ for `Author', $D$ for `Date'.") + +;; Use the user's own ~/S/emacs-fun.outline if (s)he has one : --- +(let ((outline-file (concat (getenv "HOME") "/S/function-outline.S"))) + (if (file-exists-p outline-file) + (setq ess-function-outline-file outline-file))) + +(defun ess-insert-function-outline () + "Insert an S function definition `outline' at point. +Uses the file given by the variable `ess-function-outline-file'." + (interactive) + (let ((oldpos (point))) + (save-excursion + (insert-file-contents ess-function-outline-file) + (if (search-forward "$A$" nil t) + (replace-match (user-full-name) 'not-upcase 'literal)) + (goto-char oldpos) + (if (search-forward "$D$" nil t) + (replace-match (ess-time-string 'clock) 'not-upcase 'literal))) + (goto-char (1+ oldpos)))) diff -Nru ess-16.10/lisp/old/ess-old-site.el ess-17.11/lisp/old/ess-old-site.el --- ess-16.10/lisp/old/ess-old-site.el 1970-01-01 00:00:00.000000000 +0000 +++ ess-17.11/lisp/old/ess-old-site.el 2017-11-13 14:13:17.000000000 +0000 @@ -0,0 +1,344 @@ +;;; ess-old-setup.el --- Old setup suggestions from ess-site.ely + +;; Copyright (C) 1997--2012 A.J. Rossini, Richard M. Heiberger, Martin +;; Maechler, Kurt Hornik, Rodney Sparapani, and Stephen Eglen. + +;; Created: 1 April 2016 +;; Maintainer: ESS-core + +;; 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: + +;; You may need to require ess-old-contrib.el to apply these +;; suggestions: (require 'ess-old-contrib) + +;;; Code: + + +;;; The following require sets ess-local-custom-available to +;;; true if custom is provided at this point. +;;; If it is not provided, but we think it will be available when necessary, +;;; then we can use the following line (uncommented) to make sure that +;;; it will be used. If you have to ask, then you don't need this. +;; (ess-require 'ess-compat) +;; (setq ess-local-custom-available t) + + +;; NON DEFAULTS: +;;(defvar ess-lisp-directory +;;(directory-file-name "/usr/local/lib/xemacs/site-lisp/ess-/lisp")) +;; >> or replace "ess-" above by "ESS" which would be a symbolic link.. +;; >> This way, your .emacs (or default.el or site-start.el) +;; >> won't have to change with each version of ESS + +;; example of "local" or personal use +;;(defvar ess-lisp-directory +;;(directory-file-name "/stat2/faculty/rossini/ESS/lisp")) + +;;) + + +;; Files ending in .q and .S are considered to be S source files +;; Files ending in .St are considered to be S transcript files +;; +;; NB: in standard Emacs, files ending in .s are assembler files. If you +;; want to use assembler. If a user wants to +;; restore the default modes for assembly file extensions, the +;; following can go into ~/.emacs or ~/.xemacs/init.el +;; +;; (add-hook 'ess-mode-hook 'ess-restore-asm-extns) +;; (add-hook 'inferior-ess-mode-hook 'ess-restore-asm-extns) + + +;; (1.4) Customize the dialects for your setup. + +;;; AS OF ESS 5.1.14, if you are using Emacs 20.x, x>3, or XEmacs +;;; 21.x, x>0, you can now use the "Customize" facility for +;;; customization. + +;;;; Choices for *(), where * is from inferior-*-program.... +;;; Most sites will not need to use these customized program-names. They are +;;; provided for cases where the program is not on the standard default path. +;;; If the program doesn't get located correctly by the default use of +;;; M-x S+3 (for example), then put the path name for your system into the +;;; the variable inferior-S+3-program-name. If for any reason you want the +;;; default use of M-x S to refer to a different program than S+3, then +;;; redefine inferior-S-program-name. + +;;(setq-default inferior-S3-program-name "/disk05/s/S") +;;(setq-default inferior-S+3-program-name "Splus34") +;;(setq-default inferior-S4-program-name "/disk05/s4/S") +;;(setq-default inferior-S+4-program-name "Splus") +;;(setq-default inferior-S+5-program-name "Splus5") +;;(setq-default inferior-S+-program-name "Splus7") ; unix systems ; or +;;(setq-default inferior-S+-program-name "Splus") ; unix systems +;; +;; If you wish to call other versions of R on a Unix system, ESS +;; should auto-detect other versions of R, according to matches to the +;; variable `ess-r-versions' as described in its docstring. Consider +;; changing that variable rather than changing inferior-ess-r-program-name +;; if your version of R is not already auto-detected. +;;(setq-default inferior-R-program-name "R") ; unix systems +;;(setq-default inferior-R-program-name "Rterm") ; MS Windows, see below for path as well +;;(setq-default inferior-R-program-name "C:\\Program Files\\R\\R-2.5.0\\bin\\Rterm.exe") +;;(setq-default inferior-XLS-program-name "xlispstat") +;;(setq-default inferior-ARC-program-name "arc") +;;(setq-default inferior-VST-program-name "vista") +;;(setq-default inferior-SAS-program-name "sas") +;;(setq-default inferior-OMG-program-name "/home/rossini/src/anoncvs/Omegahat/org/omegahat/bin/omegahat") +;;(setq-default inferior-OMG-program-name "omegahat") + + +;;; The line below is the ESS default and sends the commands window +;;; to emacs, giving the user the opportunity to +;;; (1) edit the output into a clean ess-transcript file before printing, or +;;; (2) print a region of the file. +;;(setq-default inferior-S+4-print-command "S_PRINT_COMMAND=emacsclientw.exe") + +;;; The editor and pager output from S+4 and Sqpe+4 are sent by +;;; StatSci default to notepad, effectively using the definition: +;;(setq-default inferior-S+4-editor-pager-command +;; "options(editor='notepad', pager='notepad')") +;;; +;;; ESS sends the output from both commands to an emacs buffer using +;;; the definition: +;;(setq-default inferior-S+4-editor-pager-command +;; "options(editor='emacsclient.exe', pager='emacsclientw.exe')") + +;;; These commands are for running the PC version of Sqpe of S+4 and +;;; S+6 in an emacs buffer, using the same technology as ESS uses for +;;; Unix S-Plus. Interactive graphics with javagraph are available +;;; in this mode beginning with S-Plus 6.1. +;;; See ess-sp4-d.el or ess-sp6w-d.el + +;;; -----> configuration now via custom, see ./ess-custom.el and look for +;;; inferior-Sqpe+... e.g. inferior-Sqpe+6-program-name + + +;;; see essd-els.el + +;;(setq-default inferior-S-elsewhere-program-name "sh") +;;(setq-default inferior-S-elsewhere-program-name "ssh") +;;; You might consider using ssh, if you can! (and if you really do +;;; this, use ssh-agent, etc, for securing your sessions). + + +;;;; Choice for S(). +;;(setq-default inferior-S-program-name inferior-S+3-program-name) + +;; (ess-message "[ess-site:] require 'ess-s4-d ...") +;; (require 'ess-s4-d) ; has become VERY RARE .. + +;;(ess-message "[ess-site:] require 'ess-s3-d ...") +;;(require 'ess-s3-d) ; THIS IS RARE. You probably do not have this. + +;; Old S+ versions: + +;; (if ess-microsoft-p +;; (progn +;; (ess-message "[ess-site:] require 'ess-sp4-d ...") +;; (require 'ess-sp4-d)) +;; ;; else: decent OS +;; (ess-message "[ess-site:] require 'ess-sp5-d ...") +;; (require 'ess-sp5-d)) + + +;;; Rarely used packages: + +;; (ess-message "[ess-site:] require 'ess-xls-d ...") +;; (require 'ess-xls-d) ;; XLispStat +;; (ess-message "[ess-site:] require 'ess-vst-d ...") +;; (require 'ess-vst-d) ;; ViSta +;; (ess-message "[ess-site:] require 'ess-arc-d ...") +;; (require 'ess-arc-d) ;; Arc +;; (ess-message "[ess-site:] require 'ess-omg-d ...") +;; (require 'ess-omg-d) ;; for omegahat + + +;;; Set this to the name of the program you use to run S or S-PLUS. It +;;; can be an absolute pathname, if you wish. +;;(setq inferior-ess-program "Splus") +;;(setq inferior-ess-program (concat (getenv "SHOME") "/Splus")) + + +;;; 2.1 Backwards compatibility (roll your own!) +;;; What you want S and R to call... + + + +;;; (3.01) SOME PEOPLE (who will remain nameless) worry that novices +;;; won't like fancy buffer names for their first (and only :-) +;;; process. To number all processes: +;;(setq ess-plain-first-buffername nil) + +;;; (3.02) Some people have requested using the program name as part +;;; of the buffer. Turned on for R. +;;(setq ess-use-inferior-program-name-in-buffer-name t) + + +;;; (3.2) Framepop. Windows produced by ess-execute-objects etc. are +;;; often unnecessarily large. The framepop package makes such +;;; windows appear in a separate, shrink-wrapped frame. This will +;;; also affect other "temporary" windows such as those produced by +;;; C-h k, etc. To enable: +;;; +;;; Works only with Emacs at this time. +;; (cond (window-system +;; (require 'framepop))) + +;;; (3.3) ess-keep-dump-files. +;;; Documentation: +;;; *Variable controlling whether to delete dump files after a successful load. +;;; If nil: always delete. If `ask', confirm to delete. If `check', confirm +;;; to delete, except for files created with ess-dump-object-into-edit-buffer. +;;; Anything else (for example `always'): always keep and never delete. +;;; This variable only affects the behavior +;;; of ess-load-file. Dump files are never deleted if an error occurs +;;; during the load. +;;; +;;; RH sez: I find the default `always' keep to be imperative. The previous +;;; default was to throw away +;;; files at the wrong time (I think it was something like, if you M-x +;;; ess-load a file twice, while you are working on it, the file is +;;; deleted). I believe source is real and the ESS object is temporary. +;;; The previous default behavior is dangerous for people who believe this way. +;;; It made sense only for people who believe the object is real +;;; and the source file temporary. +;; (setq ess-keep-dump-files "always") + +;;; (3.4) ess-ask-for-ess-directory +;;; If t, will ask for the directory to use. If nil, assumes the +;;; default (usually, the users home directory...). +;;now rather in ./ess-custom.el : (setq ess-ask-for-ess-directory t) + +;;; (3.5) ess-directory default (correlated with above) +;;; The default location for running the subprocess is configurable. +;;; By default, that is the default-directory (a lisp variable which +;;; initially contains the directory from which the inferior ESS +;;; statistical package/process is started). +;;; For example, the following function (added to the pre-run-hook, by +;;; the line following it) will set the default directory to be your +;;; home directory: +;;; +;;(defun ajr:ess-set-directory () +;; "Set ess-directory to home." +;; (setq-default ess-directory (file-name-as-directory (getenv "HOME")))) +;;(add-hook 'ess-pre-run-hook 'ajr:ess-set-directory) +;;; +;;; If you replace the setq-default line with: +;;; +;; (setq-default ess-directory (file-name-as-directory +;; (concat (getenv "HOME") "/ess/"))) +;;; +;;; then it will always start up in the directory "ess" in your home +;;; directory. +;;; +;;; The default is to have ess to start up in the current buffer's +;;; directory (the one in which you started the inferior ESS +;;; statistical package/process). This is obtained +;;; by setting ess-directory to nil, i.e. +;; (setq-default ess-directory nil) ; this is the default. + + + +;;; 3.6 Example of formatting changes + +;;; Formatting and indentation patterns are defined in ess-custom.el, please +;;; see ess-custom.el for exact definitions of these variable settings. +;;; To change them (eg, follow changes suggested by Terry Therneau), +;;; you need one or both of the following lines: +;;; +;;(setq ess-indent-with-fancy-comments nil) +;;(setq ess-default-style 'CLB) + +;;; 4.0 SAS configuration + +;;; Beginning with ESS 5.1.13, we have editing options in SAS-mode. +;;; The default behavior is as it was in prior releases. +;;; +;;; There are two sets of alternatives. +;;; 1. Editing SAS-mode files. +;;; 1a. Default: TAB is bound to sas-indent-line. +;;; Current line is correctly indented as SAS code. Equivalent to +;;;(setq ess-sas-edit-keys-toggle nil) ;; default TAB in sas-mode +;;; 1b. Optional: TAB is bound to tab-to-tab-stop and inserts up to 4 +;;; columns at a time. C-TAB moves backwards and deletes characters +;;; up to 4 columns at a time. +;;; The following line is for the optional behavior. +;;;(setq ess-sas-edit-keys-toggle t) ;; optional TAB and C-TAB in sas-mode +;;; Use the function call (ess-sas-edit-keys-toggle) +;;; to change the setting after the first SAS-mode buffer has been created. +;;; 1c. You can also define C-TAB in all modes by Option 2b (below). +;;; +;;; 2. Managing submitted SAS jobs with function keys. +;;; 2a. Default: To define the function keys in ESS[SAS] mode only, +;;; you will need, at most, one of the following two lines. +;;;(setq ess-sas-local-unix-keys t) ;; F2-F12 bound in ESS[SAS] mode +;;;(setq ess-sas-local-pc-keys t) ;; F2-F12 bound in ESS[SAS] mode +;;; +;;; 2b. Options: To define the function keys in all modes, +;;; you will need, at most, one of the following two lines. +;;;(setq ess-sas-global-unix-keys t) ;; F2-F12 bound in all modes +;;;(setq ess-sas-global-pc-keys t) ;; F2-F12 bound in all modes +;;; +;;; 3. If it is more convenient to have "*Async Shell Command*" +;;; in same-window-buffer-names, then: +;;;(ess-same-window-async) +;;; +;;;(defvar sas-program "sas" "*Name of program which runs sas.") +;;; +;;;(defvar sas-indent-width 4 "*Amount to indent sas statements") + + +;; To remove toolbar support under ESS, add "(setq ess-use-toolbar nil)" +;; to your ~/.emacs or ~/.xemacs/init.el before (require 'ess-site) + + +;;; Customization (and examples) for your site +;;;; =============================================== + +;;; (3.1) Font-lock +;; The following two expressions automatically enable font-lock-mode +;; for ess-mode and inferior-ess-mode buffers. + +;; ;; no longer requiring (window-system) here: +;; (when ess-font-lock-mode +;; (add-hook 'ess-mode-hook 'turn-on-font-lock t) +;; (add-hook 'ess-transcript-mode-hook 'turn-on-font-lock t) +;; (add-hook 'Rd-mode-hook 'turn-on-font-lock t) +;; (add-hook 'inferior-ess-mode-hook 'turn-on-font-lock t)) + + + + ; Local variables section + +;;; This file is automatically placed in Outline minor mode. +;;; The file is structured as follows: +;;; Chapters: ^L ; +;;; Sections: ;;*;; +;;; Subsections: ;;;*;;; +;;; Components: defuns, defvars, defconsts +;;; Random code beginning with a ;;;;* comment +;;; Local variables: +;;; mode: emacs-lisp +;;; mode: outline-minor +;;; outline-regexp: "\^L\\|\\`;\\|;;\\*\\|;;;\\*\\|(def[cvu]\\|(setq\\|;;;;\\*" +;;; End: + +;;; ess-old-setup.el ends here diff -Nru ess-16.10/Makeconf ess-17.11/Makeconf --- ess-16.10/Makeconf 2015-12-11 12:17:11.000000000 +0000 +++ ess-17.11/Makeconf 2017-11-13 14:13:15.000000000 +0000 @@ -86,7 +86,9 @@ DOCDIR=$(PREFIX)/share/doc/ess -DOWNLOAD = wget -O - +# N.B. $(shell) is a GNU-ism: we need a workaround to be UNIX make friendly +DOWNLOAD=$(shell which -s wget && echo 'wget -O -' || which curl) +##DOWNLOAD = wget -O - ##DOWNLOAD = curl ## Section 3 @@ -102,7 +104,7 @@ ## ESS_HOMEPAGE Martin's svn co https://svn.r-project.org/ESS-web/trunk ## -# $(shell) is a GNU-ism which we would like to workaround to be UNIX make friendly +# N.B. $(shell) is a GNU-ism: we need a workaround to be UNIX make friendly ESSVERSION=$(shell cat ./VERSION 2> /dev/null || cat ../VERSION) #F: but the following use of `..` *FAILS* #F: ESSVERSION=`cat ./VERSION 2> /dev/null || cat ../VERSION` diff -Nru ess-16.10/Makefile ess-17.11/Makefile --- ess-16.10/Makefile 2016-10-22 16:03:27.000000000 +0000 +++ ess-17.11/Makefile 2017-11-13 14:13:15.000000000 +0000 @@ -40,8 +40,8 @@ ## --- PRE-release --- # Create .tgz and .zip files only -# GNUTAR=gtar make downloads -downloads: $(ESSDIR) +# GNUTAR=gtar make tarballs +tarballs: $(ESSDIR) @echo "**********************************************************" @echo "** Making distribution of ESS for (pre)release $(ESSVERSION) from $(ESSDIR)/" @echo "** Creating .tgz file **" @@ -67,17 +67,17 @@ CLEANUP="user-* useR-* Why_* README.*"; ED=$(ESSDIR)/doc; \ if [ -d $$ED ] ; then CD=`pwd`; cd $$ED; chmod -R u+w $$CLEANUP; rm -rf $$CLEANUP; \ $(MAKE) all cleanaux ; cd $$CD; fi -# just in case: update from VERSION - cd lisp; $(MAKE) ess-custom.el; cp ess-custom.el ../$(ESSDIR)/lisp/; cd .. -# # cd lisp; $(MAKE) julia-mode.el; cp julia-mode.el ../$(ESSDIR)/lisp/; cd .. - cp -p RPM.spec $(ESSDIR)/ +# just in case: update from VERSION: + cd lisp; $(MAKE) ess-custom.el; $(INSTALL) ess-custom.el ../$(ESSDIR)/lisp/; cd .. + cd lisp; $(MAKE) julia-mode.el; $(INSTALL) julia-mode.el ../$(ESSDIR)/lisp/; cd .. + $(INSTALL) RPM.spec $(ESSDIR)/ chmod a-w $(ESSDIR)/lisp/*.el chmod u+w $(ESSDIR)/lisp/ess-site.el $(ESSDIR)/Make* $(ESSDIR)/*/Makefile touch $(ESSDIR)/etc/.IS.RELEASE # # Get (the first 12 hexdigits of) the git version into the release tarball: cut -c 1-12 $(ESSDIR)-git/.git/refs/heads/master > $(ESSDIR)/etc/git-ref -dist: VERSION downloads +dist: VERSION tarballs grep -E 'defvar ess-(version|revision)' lisp/ess-custom.el \ $(ESSDIR)/lisp/ess-custom.el touch $@ diff -Nru ess-16.10/NEWS ess-17.11/NEWS --- ess-16.10/NEWS 1970-01-01 00:00:00.000000000 +0000 +++ ess-17.11/NEWS 2017-11-13 14:13:22.000000000 +0000 @@ -0,0 +1,903 @@ +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 + + Changes and New Features in 15.09: + + * ESS[R]: The indentation logic has been refactored. It should be + faster, more consistent and more flexible. There are three types + of indentation settings, those starting with 'ess-offset-' give the + actual offsets, those starting with 'ess-indent-' are control + (commonly Boolean) variables, and those starting with 'ess-align-' + are vertical alignment overrides which inhibit default offsets in + specific situations. See 'ess-style-alist' for detailed + description of the new indentation system and provided default + indentation styles. + + * ESS[R]: Deprecation of old indentation settings. As a consequence + of the indentation re-factoring 'ess-brace-imaginary-offset', + 'ess-expression-offset' and all delimiter-specific offsets are + deprecated. The settings for indentation of continued statements + have been replaced by 'ess-offset-continuations'. It can be set to + either 'cascade' or 'straight' (the default). + 'ess-arg-function-offset' has been replaced by + 'ess-indent-from-lhs' and has been generalised to assignments. + This setting now works with both statement blocks and expressions + and only takes effect for offsets set to 'prev-call' and + 'open-delim' in order to produce a consistent indentation. + + * ESS: A test framework has been set up. + + * ESS[R]: A new RStudio style is provided to mimic as closely as + possible R files indented via RStudio. To reproduce the setup of + some of the RStudio users, the RStudio- style with + 'ess-offset-arguments' set to 'prev-line' is also provided. In + addition, the new RRR+ style is equivalent to RRR except it indents + blocks in function calls relatively to the opening delimiter. This + style does not try to save horizontal space and produces more + indentation. + + * ESS[R]: Roxygen fields will now be indented on paragraph refilling + in order to make the documentation more readable. You can also + refill commented lines in the 'examples' field without squashing + the surrounding code in the comments. + + * ESS[R]: ESS can now format your code! This is controlled through + the settings 'ess-fill-calls' and 'ess-fill-continuations'. When + activated, '(fill-paragraph)' formats your calls and your + formulas/continuations while making sure they don't go past + 'fill-column'. Repeated refills cycle through different styles + (see the docstrings for more details). By default, the refilled + region blinks. Set 'ess-blink-filling' to nil to prevent this. + + * ESS[R]: Fix occasional missing error location fontification in + inferior buffers. + + * ESS[R]: ess-developer now correctly assigned the environment of new + functions to the package namespace. + + * ESS[Julia]: ?[topic] now works in the *julia* buffer. Note that + support for editing Julia code now depends on 'julia-mode.el' from + the Julia project. If you install ESS from the official + tarball/zip file, 'julia-mode.el' is already included. Otherwise, + if you install ESS by running 'make', then the latest version of + 'julia-mode.el' is downloaded (and so you need an active internet + connection to install) during the installation process. + Alternatively, if you run ESS without running 'make', then ensure + that you have the 'julia-mode.el', which you can get easily from + MELPA for example. + + * iESS: For naming inferior processes, ESS can use 'projectile''s + project root and it does so when + 'ess-gen-proc-buffer-name-function' is set to + 'ess-gen-proc-buffer-name:projectile-or-simple' as by default, or + to another value beginning with + 'ess-gen-proc-buffer-name:projectile-*'. + + Changes and New Features in 15.03-1: + * ESS[R]: An indentation bug has been fixed (github issue 163) + * ESS[R]: On windows, if 'ess-prefer-higher-bit' is non-nil (the + default), then R-newest will try to run a 64 bit (rather than 32 + bit) version of R. + + Changes and New Features in 15.03: + * ESS[R]: Full native support for 'company-mode'. + * ESS[R]: More efficient caching algorithm for R completion. + * ESS: New offset variable 'ess-close-paren-offset' to control the + indentation of the closing parentheses. + * ESS[R]: Ask for CRAN mirror only once per emacs session. + * ESS[R]: Detect 'library' and 'require' calls for better completion + caching. + * Buffer display is now customizable ('ess-show-buffer-action'). + * Use 'y-or-n-p' instead of 'yes-or-no-p' throughout. + * More support for ODS in ess-sas-graph-view. + * Makefiles are now both UNIX and GNU friendly. + * ESS[R]: Simplify directory lookup in 'ess-developer' (#137). + * Make closed paren indentation consistent + + Bug Fixes in 15.03: + * Fix open brace indentation bug (#27 in ess/R-ESS-bugs.R). + * Fix git version lookup + * Don't check directory modtime in R dialect. + * Declare all ess macros for edebug. + * Add 'ess-smart-comma' to eldoc message functions. + * Inform users when retrieving RDA aliases. + * Line ending in '~' is also a continuation line. + * Filing roxy paragraphs works as expected now. + * In 'ess-developer-add-package', remove incorrect 'wait' argument + from 'ess-get-words-from-vector' call. + * Fix #96, #117, #120, #125, #134, #137. + * Fix ess-quit-r. Call base::q() even if it is masked. + * Fix 'ess-show-buffer' to always display the buffer in another + window. + * Makefile: Fix cd bug for directories with spaces in them + * 'ess-kill-buffer-and-go' modified to not restart R + + Changes / Selected Bug Fixes in 14.09: + * ESS[Julia]: Executable is changed to 'julia'. + * ESS[Julia]: Completion and help system was adjusted to Julia + v.0.3.0. Julia v.0.2.x is no more supported. + * ESS[R]: Running R with 'gdb' debugger now works as expected + * iESS: Inferior ESS buffers are now derived from 'comint-mode' + * ESS[R]: 'ess-execute-screen-options' uses correct screen width in + terminal sessions + * ESS: 'ess-build-tags-for-directory' works when no TAGS file name + was provided + * ESS: 'ess-offset-statement-continued' is now respected everywhere + except inside of the 'if' test condition. + * ESS: New variable 'ess-offset-statement-first-continued' for + indentation of the first line in multiline statements. + * ESSR: Starting ',' in multiline statements indentation is now + ignored to achieve a more pleasant alignment. + * ESSR: Improved behavior of 'RET' in roxygen blocks. + * ESS[R]: command cleaning with 'C-u C-u C-y' was broken with lines + containing " + " + * ESS[R]: fixed "empty watch window bug" + * ESS[R]: don't ask for help location on ac-quick-help (request of + github #81) + * ESS[R]: "importClassesFrom" and "importMethodsFrom" were added to + the list of two-parameter roxygen commands + * ESS[R]: fix vignetes display and hyperlinks (were broken in + 13.09-1) + * ESS[Julia]: recognize function names ending with ! + * ESS[Julia]: fix indentation of "for" comprehension syntax within + brackets. + + Changes / Selected Bug Fixes in 13.09-1: + * ess-remote and TRAMP: R support code is now downloaded in binary + form instead of being injected from local machine. The R code is + stored in '~/.config/ESSR/' directory on the remote machine + * TRAMP: PAGER environment variable is now correctly set to + 'inferior-ess-pager' + * retrieval of help topics on remote machines is fixed + * org-babel: source references of R code executed from org files + correctly point to source references in original org files (version + 8.2.1 or higher of org-mode is required for this feature) + * 'ess-execute' is now bound to 'C-c C-e C-e' in 'ess-extra-map'. + * completion works again in 'ess-execute' + * ESS[R]: 'head' and 'tail' methods were replaced by 'htsummary' in + 'ess-R-describe-object-at-point-commands' + * ESS[roxygen]: evaluation commands now work in roxygen blocks. + Leading comments are automatically removed before the evaluation + * ESS[transcript]: 'Clean Region' now works with multiline + statements; 'ess-transcript-clean-region' etc. correctly treat + multiline statements, i.e., no longer forgets the lines typically + preceded by '+' + * ESS[SAS]: Three features/fixes with special thanks to Matthew + Fidler https://github.com/emacs-ess/ESS/pulls/mlf176f2 + (https://github.com/emacs-ess/ESS/pulls/mlf176f2). Turn on SAS log + mode when appropriate. Indent comments and CARDS statement more + appropriately. + * ESS[SAS]: 'ess-sas-edit-keys-toggle' default returns to 'nil' + * ESS[R]: support for 'prettify-symbols-mode': contribution from + Rudiger Sonderfeld + * ESS[SWV]: knitr now evaluates in the current frame + * ESS[developer]: ess-developer doesn't kill open DESCRIPTION files + anymore + * ESS[roxygen]: 'ess-roxy-preview-HTML' is now on 'C-c C-o C-w' and + 'ess-roxy-preview-text' is now on 'C-c C-o C-t' + * ESS: installation with 'make install' was simplified and should + work out of the box on most *nix systems + * ESS installation instructions simplified + * fixed font-lock bug introduced in 13.09 that was causing very slow + process output + + Changes/New Features in 13.09: + * font-lock in process buffers doesn't "spill" over prompts. Missing + closing string delimiters should not cause wrong fontification of + the following command input. + * ESS[julia]: full features M-TAB completion and auto-complete + support, which now works for modules, structures and data types. + * ESS[julia]: a much better eldoc showing arguments of methods and + data type constructors + * ESS-developer: + - ESS-developer work-flow pattern has been streamlined: + ESS-developer is now automatically activated on per-file basis + if the file is part of a developed package + 'ess-developer-packages'. The old behavior (activation on + per-process basis) is still available on 'M-x ess-developer' + in a process buffer. + - integration with 'devtools' package. New command + 'ess-developer-load-package' calls 'load_all' on the package + containing current file. 'ess-developer-add-package' now + offers IDO menu completions with available loading methods, + currently 'library', and 'load_all'. Loading command can be + customized with 'ess-developer-load-on-add-commands'. + * 'TAB' now indents region if region is active (a contribution of + Matthew Fidler in pull #41) + * 'M-x ess-version' now reports full loading path and recognizes git + and ELPA versions. + * warning and error keyword are now highlighted with + 'font-lock-warning-face' as they should be, (for quite some time + these keywords have been hijacked by compilation mode + fontification). + * eldoc: Eldoc now recognizes multiple processes. If current process + is busy, or current buffer is not associated with a process, eldoc + picks its completions from the first available free process. + * org-babel: evaluation is now org-friendly + * help: new help buffers now try to reuse ess-help buffers. This + behavior is controlled by 'ess-help-reuse-window' custom variable. + * help: ?foo pops IDO menu on multiple help files (so far it worked + only for 'C-c C-v') + * remote evaluation is considerably faster now on slow connections + * ESS[R] tracebug R source references regular expressions are + (mostly) language agnostic. + * 'ess-function-call-face' inherits from + 'font-lock-function-name-face' rather than + 'font-lock-builtin-face'. + * 'ess-inject-source' now accepts 'function-and-buffer' option. + * Documentation: The "New Features" section (and 'NEWS') now + represent recent changes: within the last year or so. All changes + can be found in the new news.html (news.html) (or 'NEWS' and + 'ONEWS'). + * ESS[R] 'ess-rep-regexp' should no longer inf.loop (rarely!), and + hence 'M-x ess-fix-miscellaneous' should neither. + + Changes/New Features in 13.05: + * ESS[gretl]: Support for 'gretl' (both editing and sub-process + interaction). A contribution of Ahmadou Dicko. + * ESS: process output display is 4-10 times faster due to new caching + and only occasional emacs re-display (for the moment this + functionality is available only when 'ess-tracebug' is active). + * ESS: 'C-c `' is now bound to 'ess-show-traceback' and 'C-c ~' is + bound to 'ess-show-call-stack'. + * ESS[R]: ESS stores function in 'ESSR' environment to avoid kludging + users' global environment and accidental deletion. + * ESS[R]: new variable 'ess-swv-processing-command' to control + weaving and tangling. + * ESS[R]: 'ess-default-style' has been changed (from 'DEFAULT') to + 'RRR'. Use something like '(setq ess-default-style 'DEFAULT)' or + '(setq ess-indent-level 2)' in your '~/.emacs' equivalent _before_ + loading ESS, if you do not like this new "incompatible" default + style. + * ESS[julia]: ESS stores its functions in 'ESS' module. + * ESS[julia]: Eldoc is now supported in julia modes + * ESS[julia]: Adjusted error reference detection and interactive help + to julia internal changes + * ESS[R]: 'ess-use-tracebug''s default has been changed to 't'. Set + it to nil if you want to keep the previous behavior. + * ESS[tracebug]: Electric debug keys have been removed [breaking + change] The functionality was replaced with 'ess-debug-minor-mode' + and 'ess-debug-minor-mode-map'. + * ESS[tracebug]: 'ess-tracebug-map' is an alias to 'ess-dev-map' 'C-c + C-t'. + * ESS[tracebug]: 'ess-bp-toggle-state' ('C-c C-t o') can now be used + during the debug session to toggle breakpoints on the fly + (suggestion by Ross Boylan). + * ESS[tracebug]: 'ess-debug-flag-for-debugging' and + 'ess-debug-unflag-for-debugging' work correctly from the debugging + contexts. These commands also recognize non-exported functions for + the packages listed in 'ess-developer-packages' ('C-c C-t C-a'). + + * ESS[R]: Eldoc (activated by 'ess-use-eldoc') has become more + sophisticated, and hence also more intruding in the interface + between the Statistics softare, e.g., R, and the user. + + Note that you can turn off ElDoc, by placing '(setq ess-use-eldoc + nil)' in your '~/.emacs' file, prior to loading ESS, + + * ESS[SAS]: long over-looked 'SAS-mode-hook' appears! + * ESS[SAS]: 'ess-sas-edit-keys-toggle' now defaults to 't' since + 'sas-indent-line' is still broken, i.e. 'TAB' is now bound to + 'ess-sas-tab-to-tab-stop' by default + + Changes/Bug Fixes in 12.09-2: + * ESS: new 'ess-switch-to-end-of-proc-buffer' variable that controls + whether 'C-c C-z' switches to the end of process buffer. The + default is 't'. You can use prefix argument to 'C-c C-z' to toggle + this variable. + * ESS: fix in 'ess-eval-linewise' that was causing emacs to hang + during R debugging with 'ess-eval-visibly' equal to 't'. + * ESS: fix in 'ess-eval-linewise' that was causing emacs to recenter + the prompt in visible window + * ESS[tracebug]: A better handling of "Selection" prompts and debug + related singlekey commands. + * ESS: fix a bug in 'ess-switch-process' that was causing '*new*' + selection to fail. + * ESS[R]: Solve missing 'ess-local-process-name' bug in R-dired. + * ESS[SWV]: 'ess-swv-PDF' doesn't ask for a command to run if there + is only one command in 'ess-swv-pdflatex-commands'. + * ESS[SWV]: 'ess-swv-weave' gained an universal argument to allow for + an interactive choice between available weavers (sweave, knitr). + * ESS: 'ess-eval-*-and-step' functions go to next empty line at eob, + instead of staying at the last line. + + Changes/New Features in 12.09-1: + * ESS _Breaking Changes in Keys_: + + - New keymaps: 'ess-doc-map' bound to 'C-c C-d'; 'ess-extra-map' + bound to 'C-c C-e'; 'ess-dump-object-into-edit-buffer' was + moved on 'C-c C-e C-d' + - roxygen map was moved on 'C-c C-o' and 'ess-roxy-update-entry' + now resides on 'C-c C-o C-o' + - ess-handy-commands is not bound anymore + - 'ess-dev-map' (including 'ess-tracebug' and 'ess-developer') + moved on 'C-c C-t' + - 'C-c C-y' is deprecated in favor of 'C-c C-z C-z' + * ESS[R] new command 'ess-describe-object-at-point' bound to 'C-c C-d + C-e' (repeat 'C-e' or 'e' to cycle). It was inspired by Erik + Iverson's 'ess-R-object-tooltip'. Customize + 'ess-describe-at-point-method' to use tooltip instead of an + electric buffer. + * ESS: New command 'ess-build-tags-for-directory' bound to 'C-c C-e + C-t' for building dialect specific tag tables. After building tags + use 'M-.' to navigate to function and objects definitions. By + default 'C-c C-e C-t' builds tags based on imenu regular + expressions and also include other common languages '.c, .o, .cpp' + etc. But it relies on external 'find' and 'etags' commands. If + 'ess-build-tags-command' is defined (for 'R'), the inferior process + is asked to build tags instead. + * ESS: 'ess-switch-process' offers '*new*' alternative to start a new + process instead of switching to one of the currently running + processes. + * ESS: Switching between processes ('C-c C-s') uses buffer names + instead of the internal process names. Use 'M-x rename-buffer' + command to conveniently rename your process buffers. + * ESS: Process buffers can be automatically named on process creation + according to user specified scheme. Default schemes are *proc*, + *proc:dir* and *proc:abbr-long-dir* where 'proc' stands for the + internal process name and 'dir' stands for the directory where the + process was started in. The default is *proc*. For customization + see 'ess-gen-proc-buffer-name-function'. + * ESS: 'ess-eval-visibly-p' is deprecated in favor of + 'ess-eval-visibly'. + * ESS: New evaluation pattern 'nowait'. In addition to old 'nil' and + 't' values, 'ess-eval-visibly' accepts 'nowait' for a visible + evaluation with no waiting for the process. See 'ess-eval-visibly' + for details on evaluation patterns. + * ESS: New "Process" menu entry with process related commands and + configuration + * iESS: Process buffer is now automatically shown on errors + * ESS: New 'ess-switch-to-inferior-or-script-buffer' command bound to + 'C-c C-z' in both script and process buffers. If invoked form + process buffer it switches to the most recent buffer of the same + dialect. It is a single key command. + * ESSR-help: On multiple help pages with the same name, 'C-c C-v' now + asks for user resolution directly in emacs. + * ESS[R] ess-roxy: new variable 'ess-roxy-re' for fontification of + cases where the number of leading '#' differs from 'ess-roxy-str'. + * ESS[R] Eldoc was considerably enhanced. It now finds hidden + default S3 methods and displays non-default methods' arguments + after trailing ||. + * ESS[R]: New 'ess-display-demos' command bound to 'C-c C-d o' and + 'C-c C-d C-o' + * ESS: New 'ess-help-web-search' command bound to 'C-c C-d w' and + 'C-c C-d C-w' to facilitate interactive search of web resources. + Implemented for 'R', 'Stata' and 'Julia'. See also + 'ess-help-web-search-command'. + * ESS: ess-pdf-viewer-pref accepts now command line arguments + * ESS[Rnw]: Add knitr support. Customize 'ess-swv-processor' for the + default processor. + * ESS[Rnw]: More thorough renaming of remaining 'noweb-*' to + 'ess-noweb-*'. + * ESS[Rnw] new commands 'ess-eval-chunk-and-step' and + 'ess-eval-chunk' bound to 'M-n C-c' and 'M-n C-M-x' to mirror + standard ess commands in C-c map. + * ESS[R] Auto-completion: new variable 'ess-ac-R-argument-suffix' to + customize the insertion of trailing "=". Defaults to " = ". + * ESS[Julia]: Added index, apropos and web-search to julia. + * ESS help: More evaluation commands were added to ess-help mode + ('C-c C-c', 'C-M-x' etc) + + Bug Fixes in 12.09-1: + * iESShelp: Multiple help pages with the same name are properly + handled on 'C-c C-v' + * iESSremote: Evaluation with ESS remote no longer freezes emacs. + * iESS: 'comint-previous-prompt' 'C-c C-p' no longer stops on + secondary prompt "+". + * iESS[R], iESS(Sqpe) [S] on Windows: The 'options("editor")' is now + initialized to 'emacsclient' instead of the previous 'gnuclient'. + The user may need to add the line '(server-start)' to the emacs + initialization file. 'emacsclient' has been included with emacs + since GNU Emacs 22.1. + * ESS[Rnw] Fixed "connection to R" bug (in 12.09 only). + * ESS[Rnw] Explicit 'ess-swv-stangle' and 'ess-swv-sweave' functions. + * ESS[Rnw] Fixed completion and smart underscore problems cause by + unmatched "\"' + * ESS[R] is more careful with the 'R' code injection. It now happens + only once at the start of the session. + * ESS[R]: Fixed auto-scrolling the comint buffer on evaluation. + * ESS[Julia]: Solve several indentation and word navigation problems. + * ESS[Julia]: Help system works again. + + Changes/New Features in 12.09: + + * Due to XEmacs lacking some features that ESS requires, ESS support + of XEmacs ends with ESS 12.04-4. This decision will be re-visited + in the future as XEmacs continues to sync with GNU Emacs. + + * ESS[R]: On Windows, there is now a new customizable variable + (currently called 'ess-directory-containing-R') to tell ESS where + to look for the 'Rterm.exe' executables. The name of the variable + and the values it can take are both in beta and subject to change. + Prior to this variable, ESS searched only in the default + installation directory. Setting this variable now tells ESS how to + find 'Rterm.exe' executables when they are installed somewhere + else. + + * ESS[julia]: _new_ mode for editing julia code ('*.jl'). Start with + 'M-x julia'. + + Full interaction interface, imenu and basic error referencing are + available. + + * ESS[R] noweb: 'noweb-mode' and 'noweb-font-lock-mode' have been + renamed to 'ess-noweb-mode' and 'ess-noweb-font-lock-mode' to avoid + conflicts with the "real" 'noweb-mode'. + + * ESS[R] noweb: The long standing font-lock bug has been solved in + 'ess-noweb' interface. + + * ESS: Basic evaluation keys are now bound to 'ess-eval-region-*-' + functions: + + - 'C-M-x' is bound to 'ess-eval-region-or-function-or-paragraph' + - 'C-c C-c' is bound to + 'ess-eval-region-or-function-or-paragraph-and-step' + - 'C-RET' is bound to 'ess-eval-region-or-line-and-step' + + Each of these functions first evaluates the region whenever the + region is active. + + * ESS: 'C-M-a'/'C-M-e' now step to beginning/end of paragraph if no + function has been detected. + + * ESS: 'ess-eval-*-and-step' family of functions are now smarter, and + don't step to end of buffer or end of chunk code ('@') when at the + end of the code. + + * ESS: 'ess-handy-commands' function is bound to 'C-c h' + + * ESS: ESS is now _blinking_ the evaluated region. Set + 'ess-blink-region' to nil to deactivate; 'ess-blink-delay' gives + the duration of the blink. Evaluated region is "blinked" in + 'highlight' face. + + * ESS[R-help] New key 'a' for "apropos()" in help buffers. Also + available through 'C-c h'. + + * ESS[R-help] All R commands of type foo?bar and foo??bar are + recognized and redirected into appropriate *ESS-help* buffers. + + * ESS[R]: New customization interface for _font-lock_. + + ESS font-lock operates with predefined keywords. Default keywords + are listed in 'ess-R-font-lock-keywords' and + 'inferior-R-font-lock-keywords', which see. The user can easily + customize those by adding new keywords. These variables can also + be interactively accessed and saved through 'ESS/Font-lock' + submenu. + + Several new fontification keywords have been added. Most notably + the keywords for highlighting of function calls, numbers and + operators. + + * ESS[R]: auto-complete is now activated by default whenever + auto-complete package is detected. Set 'ess-use-auto-complete' to + nil to deactivate. + * ESS[R]: R AC sources are no longer auto-starting at 0 characters + but at the default 'ac-auto-start' characters. + * ESS no longer redefines default ac-sources, but only appends + 'ac-source-filename' to it. + * ESS: 'ac-source-R' now concatenates " = " to function arguments. + + * ESS: Menus for ESS and iESS have been reorganized and enriched with + _Tracebug_ and _Developer_ submenus. + + * ESS[R]: 'ess-developer' and 'ess-tracebug' commands are available + by default in 'ess-dev-map' which is bound to 'C-c d' in ESS and + iESS maps. + + * ESS[R]: 'eldoc' truncates long lines whenever + 'eldoc-echo-area-use-multiline-p' is non-nil (the default). Set + this variable to t if you insist on multiline eldoc. See also + 'ess-eldoc-abbreviation-style'. + + * ESS[R]: completion code pre-caches arguments of heavy generics such + as 'plot' and 'print' to eliminated the undesirable delay on first + request. + + * iESS: Prompts in inferior buffers are now highlighted uniformly + with 'comint-highlight-prompt' face. + + * ESS[R]: R process no longer wait for the completion of input in + inferior buffer. Thus, long running commands like 'Sys.sleep(5)' + no longer stall emacs. + + * ESS: [R, S, Stata, Julia] have specialized 'ess-X-post-run-hook's, + which are run at the end of subprocess initialization. + + * ESS[Stata]: All interactive evaluation commands work as expected. + On-line comments are removed before the evaluation and multiline + comments are skipped on 'C-c C-c' and other interactive commands. + + * ESS no longer auto-connects to a subprocess with a different + dialect than the current buffer's one. + + * ESS: 'ess-arg-function-offset-new-line' is now a list for all the + ESS indentation styles, which results in the following indentation + after an open "(": + + a <- some.function(other.function( + arg1, + arg2) + + * ESS[SAS]: Improved MS RTF support for GNU Emacs; try + 'ess-sas-rtf-portrait' and 'ess-sas-rtf-landscape'. + + Changes/Bug Fixes in 12.04-3: + * ESS: basic support for package.el compatibility + * ESS[R]: correct indentation of & and | continuation lines + * 'M-x ess-version' shows the svn revision even after 'make install' + * ESS[SAS]: improved XEmacs support + * iESS[R]: better finding of previous prompt + * ESS[Stata]: adjusted prompt for mata mode + * ESS[R]: resolved name clashes with cl.el + * ESS[R]: removed dependence on obsolete package assoc + * New 'make' target 'lisp', to build the lisp-only part, i.e., not + building the docs. + + Changes/New Features in 12.04-1: + * iESS[Stata]: New interactive help invocation. + * iESS[Stata]: New custom variable 'inferior-STA-start-file'. + * iESS[Stata]: 'inferior-STA-program-name' is now "stata" and can be + customized. + * ESS[Stata] New sections in stata help files Syntax('s-S'), + Remarks('r'), Title('t'). + + Bug Fixes in 12.04-1: + * ESS[R]: Better 'ess-tracebug' error handling. + * ESS[R]: Corrected 'ess-eldoc' help string filtering and improved + argument caching. + * ESS[R]: Indentation of non-block if/else/for/while lines fixed. + * 'M-x ess-version' should work better. + * ESS: Filename completion now again works inside strings. + * iESS[Stata]: Fixed prompt detection issue. + * ESS[Rd]: R is autostarted also from here, when needed. + + Changes/New Features in 12.04: + * ESS: Reverting new behavior of 12.03, 'TAB' in 'ess-mode' no longer + completes by default. If you want smart 'TAB' completion in R and + S scripts, similarly to iESS behavior, set the variable + 'ess-tab-complete-in-script' to 't'. Also see + 'ess-first-tab-never-complete' for how to customize where first + 'TAB' is allowed to complete. + * ESS: completion is consistently bound to 'M-TAB' (aka 'M-C-i') in + both Emacs23 and Emacs24. + * ESS: The variable 'ess-arg-function-offset-new-line' introduced in + ESS(12.03) now accepts a list with the first element a number to + indicate that the offset should be computed from the indent of the + previous line. For example setting it to '(2) results in: + + a <- some.function( + arg1, + arg2) + + Changes/New Features in 12.03: + * ESS indentation: new offset variable + 'ess-arg-function-offset-new-line' controlling for the indentation + of lines immediately following open '('. This is useful to shift + backwards function arguments after a long function call expression: + + a <- some.function( + arg1, + arg2) + + instead of the old + + a <- some.function( + arg1, + arg2) + + If '(' is not followed by new line the behavior is unchanged: + + a <- some.function(arg1, + arg2) + + This variable should be set as part of indentation style lists, or + in ess-mode hook. + * ESS[R]: 'C-c .' sets (indentation) style. + * ESS: In ESS buffers 'yank'('C-y') command accepts double argument + 'C-u C-u' to paste commands only. It deletes any lines not + beginning with a prompt, and then removes the prompt from those + lines that remain. Useful to paste code from emails, + documentation, inferior ESS buffers or transcript files. + * Documentation: ESS user manual has been rearranged and completed + with several new chapters and sections to reflect newly added + features ("Completion", "Developing with ESS", "ESS tracebug", "ESS + developer", "ESS ElDoc", "IDO Completion" and "Evaluating Code") + * RefCard: Reference card was updated to include new features. + * Eldoc: Eldoc was rewritten and is activated by default. See + 'ess-use-eldoc', 'ess-eldoc-show-on-symbol', + 'ess-eldoc-abbreviation-style' variables for how to change the + default behavior. _Note:_ 'skeleton-pair-insert-maybe' prohibits + eldoc display, on '(' insertion. + * ESS[R]: Eldoc shows arguments of a generic function whenever found. + * ESS: 'TAB' in 'ess-mode' now indents and completes, if there is + nothing to indent. Set 'ess-first-tab-never-completes-p' to 't' to + make 'TAB' never complete on first invocation. Completion + mechanism is similar to the completion in the 'inferior-ess-mode' - + a filename expansion is tried, if not found ESS completes the + symbol by querying the process. + * ESS for emacs version 24 or higher: ESS is fully compatible with + the emacs 24 completion scheme, i.e. all the completion is done by + 'completion-at-point'. Also in accordance with emacs conventions, + ESS doesn't bind 'M-TAB' for emacs 24 or higher. 'M-TAB' calls the + default 'complete-symbol'. + + * ESS[R]: Out of the box integration with 'Auto Completion' mode + http://cx4a.org/software/auto-complete + (http://cx4a.org/software/auto-complete) . Three AC sources + 'ac-source-R-args', 'ac-source-R-objects' and 'ac-source-R' are + provided. The last one combines the previous two and makes them + play nicely together. Set 'ess-use-auto-complete' to 't' to start + using it. Refer to documentation string of 'ac-use-auto-complete' + for further information. + * ESS[R]: New unified and fast argument completion system, comprised + of 'ess-funname.start', 'ess-function-arguments', + 'ess-get-object-at-point'. Eldoc and auto-completion integration + are using this system. + * ESS: 'ess-switch-to-end-of-ESS'('C-c C-z'), and + 'ess-switch-to-ESS'('C-c C-y'): Automatically start the process + whenever needed. + * ESS[R]: 'roxy' knows about previewing text version of the + documentation. Bound to 'C-c C-e t'. + * ESS[R]: Solved the "nil filename" bug in roxygen support. + * ESS[R]: 'ess-tracebug' is now part of ESS: + + New Features: + + - Source injection: Tracebug now can inject source references on + the fly during code evaluation, i.e. you don't have to source + your file, but just evaluate your code in normal fashion. + Variable 'ess-tracebug-inject-source-p' controls this behavior + - if t, always inject source reference, if ''function', inject + only for functions (this is the default), if 'nil', never + inject. + + During the source injection the value of 'ess-eval-visibly' is + ignored. + - Org-mode support: Visual debugger is now aware of the + temporary org source editing buffer ('C-c '') and jumps + through this buffers if still alive, or in original org buffer + otherwise. + - New keys in watch mode: '?' and 'd' + - Two new hooks: ess-tracebug-enter-hook and + ess-tracebug-exit-hook + + * ESS[R]: New package 'ess-developer' to evaluate 'R' code directly + in the package environment and namespace. It can be toggled on and + off with 'C-c d t'. When 'ess-developer' is on all ESS evaluation + commands are redefined to evaluate code in appropriate + environments. Add package names to the list of your development + packages with 'C-d a', and remove with 'C-d r'. Source the current + file with 'C-d s'.Evaluation function which depend on + '`ess-eval-region'' ask for the package to source the code into, + 'ess-eval-function' and alternatives search for the function name + in the development packages' environment and namespace and insert + the definition accordingly. See the documentation section + "Developing with ESS/ESS developer" for more details. + + * ESS[R] help system: + + New Features: + + - 'q' quits window instead of calling + 'ess-switch-to-end-of-ESS'. This is consistent with emacs + behavior help and other special buffers (_breaking change_). + - 'k' kills window without asking for the name (pointed by Sam + Steingold) + - Help map inherits from 'special-mode-map' as sugested by Sam + Steingold. + - Package index: new function 'ess-display-index' bound to 'i' + in help mode map. + - Package vignettes: new function 'ess-display-vignettes' bound + to 'v' in help mode map. + - Display help in HTML browser: new function + 'ess-display-help-in-browser' bound to 'w' in help mode map. + It depends on 'R''s 'browser' option. + - New custom variable 'ess-help-pop-to-buffer': if non-nil ESS + help buffers are given focus on display. The default is 't' + (_breaking change_). + - New menu entries for the above functions. + - Bogus help buffers are no longer generated by default, i.e. + buffers of the form "No documentation for 'foo' in specified + packages and libraries: you could try '??foo' ". + 'ess-help-kill-bogus-buffers' now defaults to 't'. Beware, + there may be instances where the default is unsatisfactory + such as debugging and/or during R development. Thanks to Ross + Boylan for making the suggestion, Sam Steingold for reminding + us of this variable and Martin Maechler for the warning. + * ESS now uses 'IDO' completing read functionality for all the + interactive requests. It uses ido completion mechanism whenever + available, and falls back on classical completing-read otherwise. + You can set 'ess-use-ido' to nil if you don't want the IDO + completion. See the documentation string of 'ess-use-ido' for more + information about 'IDO' and ESS configuration. + + * ESS[S]: "','" is bound to ess-smart-comma: If comma is invoked at + the process marker of an ESS inferior buffer, request and execute a + command from '`ess-handy-commands'' list. If + 'ess-R-smart-operators' is t '`ess-smart-comma' also inserts " " + after comma. + * ESS[S], notably 'R': Variable '`ess-handy-commands'' stores an + alist of useful commands which are called by 'ess-smart-comma' in + the inferior buffer. + + Currently containing: + + change-directory + 'ess-change-directory' + help-index + 'ess-display-index' + help-object + 'ess-display-help-on-object' + vignettes + 'ess-display-vignettes' + objects[ls] + 'ess-execute-objects' + search + 'ess-execute-search' + set-width + 'ess-execute-screen-options' + install.packages + 'ess-install.packages' + library + 'ess-library' + setRepos + 'ess-setRepositories' + sos + 'ess-sos' + + Handy commands: 'ess-library', 'ess-install.packages', etc - ask + for item with completion and execute the correspond command. + 'ess-sos' is a interface to 'findFn' function in package 'sos'. If + package 'sos' is not found, ask user for interactive install. + + * ESS: New dynamic mode line indicator: Process status is + automatically reflected in all mode-lines of associated with the + process buffers. Particularly useful for displaying debug status + of 'ess-tracebug' and developer status of 'ess-developer' in all + associated buffers. + + * ESS: New 'ess-completing-read' mechanism: ESS uses 'ido' + completions whenever possible. Variable 'ess-use-ido' controls + whether to use ido completion or not. Active by default. + + * ESS now supports comint fields for output and input detection. + This feature is not used by default, but might be useful in the + future. + + * ESS[S]: New custom variable 'inferior-ess-S-prompt' to customize + prompt detection regular expression in the inferior ESS buffers. + You can customize this variable to enhance comint navigation + ('comint-previous-prompt' and 'comint-next-prompt') the inferior + buffers. + + * ESS[R]: Internal 'R' completion retrieval + ('ess-R-complete-object-name') was rewritten and is faster now. + + * ESS is using process plist to store process specific variables, as + opposed to buffer local variables as it was using before. The use + of buffer local variables to store process variables is + discouraged. + + * ESS: new functions to manipulate process plists: 'ess-process-get' + and 'ess-process-set'. + + * ESS: Internal process waiting mechanism was completely rewritten. + ESS no more relies on prompt regular expressions for the prompt + detection. The only requirement on the primary process prompt is + to end in '> '. This could be overwritten by setting + 'inferor-ess-primary-prompt'. + + * ESS[S], notably 'R': Saved command history: ESS-HISTORY-FILE now + accepts 't' (default), 'nil', or a file name. By setting it to + 'nil' no command line history is saved anymore. + ESS-HISTORY-DIRECTORY now allows to have the history all saved in + one "central" file. + * ESS[R]: more Roxygen improvements. + * ESS[R]: 'C-c .' to set (indentation) style. + + * ESS[R]: Functions with non-standard names (for example + 'aaa-bbb:cc') are properly handled by font-lock and evaluation + routines. + * ESS[R]:Several regexp bugs (described in etc/R-ESS-bugs.el) were + fixed in 'ess-get-words-from-vector' and 'ess-command'. + diff -Nru ess-16.10/ONEWS ess-17.11/ONEWS --- ess-16.10/ONEWS 1970-01-01 00:00:00.000000000 +0000 +++ ess-17.11/ONEWS 2017-11-13 14:13:22.000000000 +0000 @@ -0,0 +1,713 @@ +Changes/New Features in 5.14: + * ESS[BUGS/JAGS]: Batch BUGS is back! For recent OpenBUGS versions, + 3.0.8+, a batch BUGS script is once again available, but for Linux + only. Therefore, since it seems that BUGS and JAGS must co-exist + (rather than a transition from BUGS to JAGS), .bug files are now in + ESS[BUGS] mode and .jag files are in ESS[JAGS] mode. ESS[BUGS] now + works like ESS[JAGS] rather than the original mode ESS[BUGS] mode + which was difficult to maintain. Although, ESS[BUGS] appears to + work, there still may be some features missing as well as bugs. + + * ESS[R]: New customizable variable 'ess-swv-plug-into-AUCTeX-p' + Commands to Sweave current file and LaTeX the result are now + available to AUCTeX users, if this variable is set to 't'. + + * ESS[S]: 'C-c C-c' ('ess-eval-function-or-paragraph-and-step') is + now skipping over comments as the other paragraph functions do. It + (and similar functions) should no longer wrongly find 'function()' + beginnings inside comments or strings. + + * ESS[SAS]: improved by better support for GNU Emacs + + Changes/New Features in 5.13: + * ESS[R]: On Windows, for R 2.12.0 and later, the Rterm executables + (in subdirectories i386 / x64) now are found as well as for earlier + R versions. + * ESS[S+]: on Windows, both 32- and 64-bit versions of S+ ("S-PLUS") + are found now and made available on the menu. + * ESS[R]: When prompting for a starting directory, the R version is + (always?) correct now. + * ESS[R]: on non-Windows platforms, the 'use-dialog-box' variable is + no longer temporarily changed (to 'nil' for R-x.y.z version + functions and to 't' for 'R' itself), but rather the user + customization is obeyed. + * ESS[R]: more Roxygen improvements. + * 'Rd-preview-help' now generates preview buffers with navigation + facilities the same as regular help buffers. + * ESS: New functions and keys C-c [up] / [down] for evaluating the + buffer "from beginning till here". + + Changes/New Features in 5.12: + * ESS[SAS] Font-locking: update of PROCs keywords (up to SAS 9.22); + error/warnings. + * ESS[R]: Roxygen improvements: S4 classes; also optionally keep + spaces when filling arguments + * ESS[Rd]: support new keywords: section-name \subsection plus a + dozen "new" keywords; should match R 2.12.x now. + * 'ess-display-help-on-object' ('C-c C-v') now _caches_ the list of + topics, thus speeding up the improvement feature introduced in 5.9. + + Changes/New Features in 5.11: + * Filename completion within buffers now adds only trailing + characters to complete the filename, rather than expanding to an + absolute file path. This filename completion is bound to the TAB + key. + + * 'M-n P' in Sweave buffers now prompts for the command to run + instead of using 'pdflatex' unconditionally, offering completion + from customizable collection 'ess-swv-pdflatex-commands', the first + of which is taken as default and that defaults to 'texi2pdf'. + * 'M-RET' is now also bound in S language (R and S+) buffers to + 'ess-use-this-dir'. It sends 'setwd(..)' to the S process to set + the working directory to the one of the source file. + + Changes/New Features in 5.10: + * 'M-RET' in *S* buffers is now bound to 'ess-dirs'. This function + will set Emacs's current directory to be the same as the *S* + process. This is useful if you use 'setwd()' within a *S* process. + + Changes/New Features in 5.9: + * Toolbar: The toolbar now has an icon for starting Splus. + * Indentation: New documentation and code has been added to make it + easier to change how ESS indents code. In particular, see + 'ess-default-style', 'ess-own-style-list' and the documention + subsection "Changing indentation styles". + * 'ess-display-help-on-object' ('C-c C-v') now offers completion + candidates for help file aliases, in addition to object names. + * Font locking: is now turned on even without 'window-system' is + 'nil', whenever ESS-FONT-LOCK-MODE is non-nil, i.e., by default. + * ESS script editing: ess-eval-deactivate-mark default is now t, as + suggested by Leo Alekseyev and subsequent "unanimous" ESS-help + discussion. + * ESS[R]: Editing support for "#!" (Rscript / littler) editing, + thanks to Jeffrey Arnold. + * ESS[R]: Now finds all R versions, both 64-bit and 32-bit, on some + 64-bit Windows machines. Please report back to ess-core success or + failure on your 64-bit Windows machine. + * ESS Manual now more visually pleasing; + + * ESS[R]: Roxygen on XEmacs no longer font locks for now (as it + required missing features and hence broke ESS startup, there). + * ESS[R]: Roxygen has a sub-menu on the [ESS] menu. + * ESS[R]: Function 'ess-rutils-htmldocs' in 'ess-rutils.el' offers an + alternative to 'help.start()' for navigating R documentation, using + the 'browse-url' Emacs function. + + Changes/New Features in 5.8: + * ESS[R]: New 'ess-rutils.el' with utilities for listing, loading, + installing, and updating packages, as well as object manipulation + (listing, viewing, and deleting). It also provides an alternative + to 'RSiteSearch()' that uses the 'browse-url' function, so results + can be viewed in an Emacs web browser. + * ESS[R]: much more extensive Roxygen interface, via ess-roxy.el from + Henning Redestig. Ess-roxy supports filling of roxygen fields, + generation and updating roxygen templates, completion of roxygen + tags, basic navigation (marking and moving between entries), + folding using hs-minor-mode and preview of the Rd file. + * Emacs lisp files have got better names (partly, for now). + + Changes/New Features in 5.7: + * ESS[R]: loading a source file ('C-c C-l') now works in Windows, + similarly to other platforms; (further; it had accidentally been + broken in ESS 5.6 on all platforms) + + Changes/New Features in 5.6: + * ESS[R]: help() calls have to differ from old default, with newer + versions of R; currently via .help.ESS <- function(...) hack. + + Changes/New Features in 5.4: + * ESS[SAS]: The long overdue change from 'make-regexp' to + 'regexp-opt' for font-locking is complete. The new 'regexp-opt' is + now the default since it is better than the old code in many ways + (and especially more maintainable). However, there are certainly + some special cases missed (bug reports and patches welcome!). + Setting 'ess-sas-run-regexp-opt' to 'nil' will result in the old + code being used. + * ESS[BUGS] and ESS[JAGS]: typing '=' now results in '<-'. + * ESS[R] function arguments "show" '(ess-r-args-show)' now uses the + new '(tooltip-show-at-point)' contributed by Erik Iverson. + * Toolbar icons now also work in (beta) Emacs 23. + * ESS[S]: New function 'ess-change-directory' for setting both emacs' + current directory and the directory of an *R* or *S* buffer. + * ESS[S] when transient-mark-mode is true, the mark is now kept, + rather than deactivated, thanks to a patch from David Reitter. + + Changes/New Features in 5.3.11: + * ESS[SAS]: work around bug in Emacs 22.2 & 22.3 which fails to set + case-fold fontification automatically. + * Rd mode: support new keyword 'Rdversion' + * ESS[R]: now again works with Emacs 21.x + + Changes/New Features in 5.3.10: + * Fixed noweb-mode bug accidentally introduced into 5.3.9 + * In noweb-mode, e.g., Rnw-mode, electric "<" also inserts closing + "@". Further, the code chunk boundaries are better kept + up-to-date, such that code[R] <-> text[LaTeX] minor mode switching + should happen more reliably. + * In noweb-mode, fix a buglet in rare [Enter] or [Tab] behavior; + further, by default disable the former '[[' .. ']]' + code-protection-when-filling behavior which has been found to be + buggy. + + Changes/New Features in 5.3.9: + * ESS[SAS]: evince PDF viewer now supported as well; search order: + evince, Xpdf, Adobe/Acrobat Reader + * ESS[R]: added support for Roxygen, potentially to be extended. + * ESS[S] (and R): inferior ('*R*') and transcript modes no longer + fontify language keywords (such as 'for', 'in', etc). + * iESS[Stata]: Customize the 'ess-sta-delimiter-friendly' setting to + 't' to convert embedded semi-colons to newlines for Stata + processing. + * Sweave fix for embedded blanks in PDF reader and PDF files + * Several fixes for Major Mode Convention violations in 'ess-mode' + and 'noweb-mode'. + * ESS[JAGS]: 'M-x comment-region' now available! + * ESS[S] The 'ess-swv-*' commands (and keybindings) are now in a + submenu of the "Noweb" menu, when editing Sweave files. + + Changes/New Features in 5.3.8: + * ESS[JAGS]: more separation from ESS[BUGS] (as much as is currently + planned); now 'C-c C-c' on an empty '.jmd' creates a template as it + should; symbolic links are created for CODA output so BOA is happy: + from 'index.txt' to '.ind' and 'chain#.txt' to '#.out' + * ESS[SAS]: buffer-local 'ess-sas-submit-command' and + 'ess-sas-submit-command-options' now recognized by + 'ess-sas-submit-region' + * ESS[S]: When trying to evaluate code in an S language buffer and + there is no associated process, now start R automatically instead + of signalling an error. Also, restart R if there is an associated + process which is not running. However, do not start R just via the + "electric" '(' ('ess-r-args-auto-show'). + * ESS[S]: For (one-line) functions withOUT '{ .. }' bodys, the end + of function is now correctly found more often. This notably + improves 'C-c C-c' ('ess-eval-function-or-paragraph-and-step'). + * ESS[JAGS]: cleanup/re-organization of elisp code; symbolic links + for CODA output are now only created by the new JAGS 'system' + command in version 1.0.3; specify whether this command is available + via 'ess-jags-system'; if not present, then no links are created so + that the '*shell*' buffer does not become unresponsive during the + batch run + + Changes/New Features in 5.3.7: + * ESS: 'ess-default-style' now *is* customizable, i.e., changing its + value in '~/.emacs' now does have the desired effect. + * ESS: 'ess-font-lock-mode' is a new variable (default: t) which + controls whether font-locking is enabled in ESS buffers. + * ESS[R]: for XEmacs on Windows; another tweak to find R versions + * ESS[SAS]: font-locking updated for ODS and SAS Bayesian Procedures; + a more consistent handling of SAS options by + 'ess-sas-submit-command-options' which is buffer-local; portable + snooze for MS Windows via customize-able 'ess-sleep-for' (floats + welcome); Xpdf now supported as a PDF viewer + * ESS[Rnw]: now also works with "emacs -nw" and Emacs 22. + * ESS[JAGS]: now requires JAGS 1.0 (see the new ESS for JAGS help + section for more information): both need work; suggestions welcome + * ESS[R]: [TAB] completion now uses the R-internal completion + mechanism (for R >= 2.5.0). + * ESS[R] ([S]): interpretation of "_" as assignment has been removed + in 'ess-continued-statement-p' for R and S. + * several internal code cleanups. + * ESS[R]: An experimental version of a new command 'Rgui' on MS + Windows to send lines directly from emacs to 'Rgui' is available in + file 'lisp/essd-rgui.el'. Preliminary documentation is in file + 'doc/rgui-doc.txt'. + + Changes/New Features in 5.3.6: + * ESS: for XEmacs, using "gnuclient" (without a "-q") works for + things like fix() after M-x gnuserv-start has been done. + * ESS[R]: M-x R-newest should now work in more situations on MS + Windows, e.g., when R has been installed in a non-default + "ProgramFiles" directory tree. In these cases, there's no need to + specify the name (and full path) of the R program anymore. + * ESS[R]: For XEmacs, startup (with new tooltip code) works again. + + Changes/New Features in 5.3.5: + * ESS[R] a new defun is available, 'M-x R-newest', which will start + the newest version of R that it can find on your system. + * ESS[R] add Sven Hartenstein's "R function arguments tips" + functionality, via new file '../lisp/essd-r-args.el'. Note that + this includes an "electric "("" behavior inside 'R-mode' which is + _active by default_ and can be customized via + 'ess-r-args-electric-paren'; i.e., use '(setq + ess-r-args-electric-paren nil)' to turn it off. Further, + 'ess-r-args-show-as' allows to switch to the "tooltip" mode. + * ESS: functions 'ess-get-pdf-viewer' and *-ps-viewer; built on new + customizable variables 'ess-pdf-viewer-pref' and + 'ess-ps-viewer-pref'; currently used in 'ess-swv-PDF' and '*-PS'. + * ESS[R] Improved 'ess-swv-PDF' to run pdf viewer only if pdflatex + was ok + * ESS[R] Improved 'ess-swv-weave' to start R automatically if none is + running. + * ESS: Do no longer ask _which_ ESS process to use if there is only + one. + + Changes/New Features in 5.3.4: + * ESS[R] now better work with options(error=recover); and the new + default of CHM help files on windows. + * ESS[R] some more cleanup in the "sweave" functions + * miscellaneous fixes + + Changes/New Features in 5.3.3: + * ESS[S] fix buglet (5.3.2 only) which left command prompt in + "execute buffer" and hence help files. + * new customizable variable 'ess-display-buffer-reuse-frames' set to + true (which changes default behavior) such that execution or help + *frames* are reused. + + Changes/New Features in 5.3.2: + * Classic BUGS now supported by '(require 'essd-bugs)' with ESS[BUGS] + and JAGS by '(require 'essd-jags)' with ESS[JAGS]. But, only one + of them can be used at a time since they don't play nice together. + Also, 'C-c C-c' is now bound to the function 'ess-bugs-next-action' + ('F12' has been retired). And finally, note that 'essl-bug.el' is + deprecated and the replacement is 'essl-bugs.el'. + * ESS[R] Improved some of the "Sweave-make" functions (yet scarcely + documented) in 'ess-swv.el'. + * ESS[S] No longer mess with .Last.value (nor in other "languages"). + + Changes/New Features in 5.3.1: + * See the docs for 2 ways to install ESS for XEmacs + 1. by uncommenting the XEmacs part of Section 1 of 'Makeconf' and + performing 'make install' + 2. by unpacking either 'ess-5.3.1.tgz' or 'ess-5.3.1.zip' into + 'PREFIX/lib/xemacs/site-packages' on unix or + 'PREFIX\XEmacs\site-packages' on windows + * ESS[R]: fixed bugs so that Rterm.exe can be found by XEmacs + * ESS[S]: 'ess-toggle-S-assign-key' is slightly changed; in + particular, the default 'ess-assign-key' is now 'C-x ='. + * ESS[R]: 'M-x R-site-search' is a new (slightly experimental) + utility similar to R's 'RSiteSearch(..)' but with the advantage of + using Emacs' preferred browser, see 'browse-url-browser-function' + + Changes/New Features in 5.3.0: + * ESS[BUGS]: sanely re-format statistical output, '.bog', from + scientific notation to numbers rounded with 4 decimal places with + 'M-x ess-bugs-sci-round-to-4-dp'. + * The keys for navigating among section headings in help buffers + worked, but only for one language per session; they should now work + for multiple languages. (They were also broken on Windows + machines.) + * ESS[S] long standing buglets in the internal logic for loading lisp + code on Windows. Particularly fixed behavior in help mode with + S-plus GUI. + * New variable, 'ess-use-inferior-program-name-in-buffer-name', which + enables using the executable name instead of the dialect name for + R. Feature request. + * ESS[S] 'ess-execute-screen-options' now also works correctly when + there is more than one window *side-by-side* in the same frame and + runs in the correct buffer also when there is more than one S + buffer. + * iESS[S] new functions 'ess-eval-paragraph-and-step' and + 'ess-eval-function-or-paragraph-and-step' are bound to keys 'C-c + C-p' and 'C-c C-c' respectively and to the menu in ESS-mode; also + bound in the help mode (for evaluating examples). + * ESS[S] new function 'ess-toggle-S-assign-key' allows to assign the + " <- " insertion to an arbitrary key. + + Changes/New Features in 5.2.12: + * ESS[SAS]: 'M-;' fixed, but the XEmacs function 'comment-dwim' may + be broken, if so, use 'M-x comment-region' and 'M-x + uncomment-region' instead; only valid PROCs are fontified which is + very helpful finding syntax errors (currently supported: BASE, ETS, + FSP, GRAPH, IML, INSIGHT and STAT); the "feature" where 'F'-keys + take you to an empty buffer when the requested destination is a + file that does not exist has been fixed, now the request results in + a no-op. Further, sas-mode now also works in simple terminals. + * Rterm/Cygwin combination works under Microsoft Windows. + * ESS[R]: internal calls use baseenv() instead of NULL and define + 'baseenv' where needed. + * New experimental support for installing ESS. See the file + 'lisp/ess-install.el'. + + Changes/New Features in 5.2.11: + * ESS Info entry and 'dir' handled more effectively for GNU Emacs + users + * ESS[SAS]: temporary files created for batch submission of a region + are now named based on the current file; see 'ess-sas-file-root' + for details; all 'lag' and 'dif' functions now fontified correctly + * iESS[SAS]: fixed a few nagging bugs, however, still does not appear + to work at this time; please let us know if you have any ideas. + * ESS[S]: Support for running other versions of Splus has been added + for unix. Two new variables, 'ess-s-versions' and + 'ess-s-versions-list', are used to tell ESS what other versions of + Splus you would like to run. + + Changes/New Features in 5.2.10: + * ESS[R]: ess-r-versions can no longer be customized (since the + customization was not taking effect unless customizations were + loaded before ESS). Its value has been changed so that it will also + find R executables beginning "R-devel" and "R-patched". If you + wish to change this variable, it must be set in your '.emacs' + before ESS is loaded. + * Installation with GNU Make enhanced: unix and unix-like operating + systems will now be able to install ESS for all users in either a + GNU Emacs site-lisp or an XEmacs package configuration by editing + 'lisp/ess-site.el' and 'Makeconf' accordingly, then issuing 'make + install' + * ESS[S]: Filename completion (inside strings) now also works in + XEmacs for R and S-plus. + + Changes/New Features in 5.2.9: + * ESS[R] for Windows: the \ directory character bug with respect to + ess-load-file has been eradicated. + * iESS[SAS]: 'C-c C-r' and 'C-c C-b' once again work as intended and + documented. + * ESS[S]: M-x ess-fix-EQ-assign is a bit more agressive. + * ESS[S]: Imenu now also shows setAs(), etc. + * ESS[R]: R function pattern enhanced with underlying code such that + 'M-C-a' ('ess-beginning-of-function') etc now work for many more + cases, including S4 method definitions. + * iESS[R]: myOwnhelp(1) no longer wrongly triggers help(1). + * ESS[R]: Improved detection of bogus help buffers: valid help + buffers containing with the string "no documentation"(e.g. + contour) were being treated as bogus. + * ESS[R]: In R help buffers, if 'options("help.try.all.packages" = + TRUE)' then '?rlm' will list which packages rlm is defined in. + This help buffer is not bogus, but instead is now relabelled + "*help[R](rlm in packages)*". + * ESS[STA]: add "//" as comment starting character to syntax-table. + + Changes/New Features in 5.2.8: + * iESS: [Tab] completes *file* names "inside string" as in earlier + (<= 5.2.3) ESS versions. + + Changes/New Features in 5.2.7: + * If you use Custom to change the variable ess-toolbar-items, the new + toolbar is used in all subsequent ESS buffers. + * ESS[SAS]: new feature: if ess-sas-log-max >0 and your .log grows to + more than ess-sas-log-max bytes, just the first ess-sas-log-max + bytes are refreshed; this is helpful when your .sas program + generates lots of error messages and gets too big for emacs to + display + * ESS[R/S]: 'M-;' in R/S editing modes will now indent with either + one or two hashes depending on context. + * ESS[R]: David Whiting's Sweave extensions (to 'noweb') are now + available (from ess-swv.el loaded by default). + + Changes/New Features in 5.2.6: + * Removed non-ASCII characters in a few files. + * ESS[R]: now works better when UTF-8 locale is active; in + particular, you get correct directional quotes in R's startup + message for R-devel (unstable development version of R 2.1.0) when + using environment variables LANGUAGE=en@quot LC_ALL=en_US.UTF-8 + * ESS[SAS]: toggling of .log mode improved ('F10'); toggling of .lst + mode now also available ('C-F10'); killing all buffers associated + with .sas program no longer bound to 'C-F10' since its a bit + overzealous. + * S-Plus 7 for Windows is now recognized. + * ESS[S] (incl. R): in auto-fill mode, strings are not wrapped + anymore. + * ESS[S] (incl. R): font-lock now correctly differs between R and S, + e.g., for "_"; both now fontify warning(.) and S does terminate() + additionally. + * Support for 'bell' aka 'beep' aka 'ding' aka 'alarm' in all + inferior modes: When \a is output "to the the console" at the + beginning of a line, the bell is rung. + + Changes/New Features in 5.2.5: + * ESS[R]: 'C-c C-q' or 'Quit S' from the menu now should work (again + and less klunkily) and do not append '-exited' to the buffer name. + Further, the behavior of '(ess-cleanup)', called from ess-quit, now + depends on the new customizable variable + 'ess-S-quit-kill-buffers-p' which defaults to 'nil'. Consequently, + the question _"Delete all buffers associated with ..?"_ will not + be asked anymore by default. + * ESS[SAS] - ess-ebcdic-to-ascii-search-and-replace will now work + with the 'recode' application as well which is available on many + platforms + * ESS[S] (incl. R): Name completion for slots of S4 objects now + works! + + Changes/New Features in 5.2.4: + * The documentation now includes an overview of how to use the emacs + TAGS facility for S functions. (The distribution also used to + contain a directory 'etc/other/Tags' where a ~1990 version of + 'etags.c' was distributed; this is no longer relevant and so has + been deleted.) + * ESS[SAS] - When you are working with EBCDIC files on an ASCII + platform, .log NOTEs may display as gibberish since the EBCDIC + characters are not converted to ASCII prior to their display. So, + the function ess-ebcdic-to-ascii-search-and-replace is provided for + convenience and is bound to 'C-F11'. This function requires the + 'dd' command (only available on unix or unix-like platforms). + * ESS: Completion of object names is now always done dynamically + rather than allowing the option of using a pre-computed database + (by 'ess-create-object-name-db') since modern computers seem fast + enough for dynamic completion. (We expect few users, if any, have + been using the pre-computed database method.) + * ESS: object completion in iESS buffers running on Windows was very + slow (for GNU Emacs, but not XEmacs) and has now been fixed. + Further, it was more or less broken for all versions of S-plus 6.x, + and has been fixed to work everywhere but with the Windows' GUI of + S-plus. The list of objects now shows unique names also when an + object appears more than once in the search path. + * ESS[R]: Completion of object names now also includes those starting + with ".". + + Changes/New Features in 5.2.3: + * ESS: When new inferior ESS processes are created, by default they + will replace the current buffer (this restores behavior from pre + 5.2.0). If you wish new ESS processes to start in another window + of the current frame, set inferior-ess-same-window to nil. + * New variables inferior-Splus-args and inferior-R-args provide a way + to pass command line arguments to starting S and R processes. + + Changes/New Features in 5.2.2: + * bug-fixes for 5.2.1 (require 'executable), html docs, etc. + * ess-lisp-directory/../doc/info added to Info-directory-list if + ess-info not found by info + * ESS[R]: If you have other versions of R on your exec-path, such as + "R-1.8.1" with Unix or "rw1081" with Windows, ESS will find them + and create appropriate functions, such as 'M-x R-1.8.1' or 'M-x + rw1081', for calling them. By default only Unix programs beginning + "R-1" and "R-2" and Windows programs parallel to the version of R + in your exec-path will be found, but see ess-r-versions and + ess-rterm-versions for ways to find other versions of R. + * ESS[R]: Other versions of R, such as "R-1.8.1" on Unix and "rw1081" + on Windows, are added to the "ESS / Start Process / Other" menu. + * ESS[S]: If you have other versions of S-Plus on your Windows + computer, such as S-Plus 6.1 or S-Plus 4.5, ESS will find them and + create appropriate functions, such as 'M-x splus61', for calling + the console version (Sqpe) inside an emacs buffer. By default only + programs installed in the default location will be found, but see + ess-SHOME-versions for ways to find other versions of S-Plus. + * ESS[S]: Other versions of Sqpe on Windows, such as "splus61", are + added to the "ESS / Start Process / Other" menu. + * ESS[R]: (bug fix) ess-quit (bound to 'C-c C-q') should now quit the + inferior R process, when issued from either the inferior buffer, or + from a .R buffer. + + Changes/New Features in 5.2.1: + * ESS[S] (R and S-plus): now have toolbar support with icons to + evaluate code in the inferior process or to switch there. This + code is experimental and likely to change as XEmacs/Emacs issues + get resolved. The toolbar should be enabled if your Emacs displays + images, but can be disabled with the variable ess-use-toolbar. + Thanks to David Smith from Insightful for the S-plus logo. + * ESS[SAS]: ess-sas-graph-view ('F12') enhanced; you can specify + external file viewers for each graphics file type via the alist + ess-sas-graph-view-viewer-alist; also .jpg/.gif are now handled by + image-mode on XEmacs, if available, otherwise by graphics + primitives as before + + Changes/New Features in 5.2.0: + * ESS[BUGS]: new info documentation! now supports interactive + processing thanks to Aki Vehtari (mailto:Aki.Vehtari@hut.fi); new + architecture-independent unix support as well as support for BUGS + v. 0.5 + * ESS[SAS]: convert .log to .sas with ess-sas-transcript; info + documentation improved; Local Variable bug fixes; SAS/IML + statements/functions now highlighted; files edited remotely by + ange-ftp/EFS/tramp are recognized and pressing SUBMIT opens a + buffer on the remote host via the local variable + ess-sas-shell-buffer-remote-init which defaults to "ssh"; changed + the definition of the variable ess-sas-edit-keys-toggle to boolean + rather than 0/1; added the function ess-electric-run-semicolon + which automatically reverse indents lines containing only "run;"; + 'C-F1' creates MS RTF portrait from the current buffer; 'C-F2' + creates MS RTF landscape from the current buffer; 'C-F9' opens a + SAS DATASET with PROC INSIGHT rather than PROC FSVIEW; "inferior" + aliases for SAS batch: 'C-c C-r' for submit region, 'C-c C-b' for + submit buffer, 'C-c C-x' for goto .log; 'C-c C-y' for goto .lst + * ESS[S]: Pressing underscore ("_") once inserts " <- " (as before); + pressing underscore twice inserts a literal underscore. To stop + this smart behaviour, add "(ess-toggle-underscore nil)" to your + .emacs after ess-site has been loaded; + ess-dump-filename-template-proto (new name!) now can be customized + successfully (for S language dialects); Support for Imenu has been + improved; set ess-imenu-use-S to non-nil to get an "Imenu-S" item + on your menubar; ess-help: Now using nice underlines (instead of + 'nuke-* ^H_') + * ESS[R]: After (require 'essa-r), 'M-x ess-r-var' allows to load + numbers from any Emacs buffer into an existing *R* process; 'M-x + ess-rdired' gives a "directory editor" of R objects; fixed + ess-retr-lastvalue-command, i.e. .Last.value bug (thanks to David + Brahm) + * ESS: Support for creating new window frames has been added to ESS. + Inferior ESS processes can be created in dedicated frames by + setting inferior-ess-own-frame to t. ESS help buffers can also + open in new frames; see the documentation for ess-help-own-frame + for details. (Thanks to Kevin Rodgers for contributing code.) + + Changes/New Features in 5.1.24: + * The version number is now correct even inside ESS/Emacs + + Changes/New Features in 5.1.23: + * Minor more Makefile clean up. + + Changes/New Features in 5.1.22: + * Besides info documentation, PDF and HTML documentation are also + provided (instead of built using "make") and available on the web + as well; see ESS web page (http://ess.r-project.org/) and StatLib + (http://lib.stat.cmu.edu/general/ESS/doc) + * Now that info documentation is available, the README.* files are no + longer supported. However, they are still distributed for what + it's worth. + * ESS is now an XEmacs package! See XEmacs Installation HOWTO + (http://www.xemacs.org/Install/index.html) for details + (specifically, items 10-15). + * ESS[SAS]: more user-friendly enhancements for remote SAS batch jobs + with Kermit file transfers (LOG and OUTPUT function key features + now supported). Multiple shells now supported so you can run SAS + on different computers from different buffers by setting the + buffer-local variable ess-sas-shell-buffer to unique buffer names. + * Major re-vamping of Makefile/Makeconf. + + Changes/New Features in 5.1.21: + * ESS[SAS]: info documentation now available!, see ESS->Help for SAS; + 'F12' opens GSASFILE nearest point for viewing either within emacs, + when available, or via an external viewer; more syntax highlighting + keywords; more enhancements for remote SAS batch jobs with Kermit; + new framework for remote SAS interactive jobs, see ess-remote + * ESS[S]: info documentation now available!, see ESS->Help for the S + family + * Makefile: tag now independent of rel; info files made by + doc/Makefile and installed in new info sub-directory + + Changes/New Features in 5.1.20: + * New 'options()$STERM' in the S dialects (S, S-Plus, R). The S + program can determine the environment in which it is currently + running. ESS sets the option to 'iESS' or 'ddeESS' when it starts + an S language process. We recommend other specific values for S + language processes that ESS does not start. + * New 'ess-mouse-me' function, assigned to S-mouse-3 by default. + User may click on a word or region and then choose from the menu to + display the item, or a summary, or a plot, etc. This feature is + still under development. + * GNU Emacs 21.1 is now supported (fixed for S dialects, SAS & BUGS), + (some from Stephen Eglen). + * XEmacs 21.x is now supported (fixed w32-using-nt bug) + * XEmacs on Win (NT) is better supported. + * Workaround for bug in Sqpe+6 (S-PLUS 6 for Win). + * should now work even when imenu is not available (for old + XEmacsen). + * ESS[SAS]: XEmacs-Imenu fix; 'C-TAB' is globalized along with your + function-key definitions, if specified; you can specify your SAS + library definitions outside of autoexec.sas for ess-sas-data-view + with SAS code placed in the variable ess-sas-data-view-libname, + also the dataset name is defaulted to the nearest permanent dataset + to point; Speedbar support now works for permanent datasets, please + ignore first./last.; new font-locking is now the default with more + improvements for font-locking PROCs, macro statements, * ; and %* ; + comments; you can toggle sas-log-mode with 'F10' which will + font-lock your .log (if it isn't too big); submit remote .sas files + accessed with ange-ftp, EFS or Tramp (Kermit is experimental) by + setting ess-sas-submit-method to 'sh; ess-sas-submit-command and + ess-sas-submit-command-options are buffer-local so you can have + local file variable sections at the end of your .sas files to + request different executables or specify special options and the + local file variables are re-read at submit instead of only at file + open so that if you make a change it is picked up immediately; + * ESS[BUGS]: font-lock with 'in' fixed. + * for STATA: font-lock bug fixed. + * for Rd mode: 'C-c C-v' and 'switch-process' in menu. further, 'C-c + C-f' prefix (Rd-font) for inserting or surrounding a word by things + such as \code{.}, \code{\link{.}}, \emph{.} etc. + * new functions (ess-directory-function) and (ess-narrow-to-defun) + ess-directory <-> default-directory logic (Jeff Mincy). + * Re-organized Makefile and fixed a few bugs. + + Changes/New Features in 5.1.19: + * S+6 now supported (Tony Rossini (Unix) and Rich Heiberger + (Windows)) + * New BUGS support through ESS[BUGS] mode (Rodney Sparapani) + Templates assist you in writing .bug and .cmd code (.cmd and .log + are replaced by .bmd and .bog to avoid emacs extension collisions). + Substitution" parameters facilitate "automagic" generation of + data...in" and "init...in" filenames, "const N=" from your data + file and "monitor()/stats()" commands. Activated by pressing + 'F12'. + * Fixes for 'ess-smart-underscore' SAS breakage (Rich Heiberger) + * You can change between PC and Unix, local and global SAS + function-key definitions interactively (Rich Heiberger) + * 'C-Submit' a highlighted region to SAS batch (Rodney Sparapani) + * New and improved SAS syntax highlighting (Rodney Sparapani) To get + the new functionality, set ess-sas-run-make-regexp to nil. Also + available in .log files via 'F10'. + * Open a permanent SAS dataset for viewing via 'F9' (Rodney + Sparapani) You must have the library defined in autoexec.sas for it + to work. + * User-friendly defaults for 'sas-program', + 'ess-sas-batch-pre-command' and 'ess-sas-batch-post-command' as + well Customize support for these and other ESS[SAS] variables + (Rodney Sparapani) + * 'ess-sas-suffix-2' now defaults to .dat via 'F11' (Rodney + Sparapani) + * Emacs/XEmacs, Unix/Windows issues collectively handled in + ess-emcs.el + * defadvice solves problem of missing *ESS* (thanks to Jeff Mincy) + * Improved manual a bit by including things that were only in + 'README'. + + Changes/New Features in 5.1.18: + * New 'ess-smart-underscore' function, now assigned to "_" by + default. Inserts 'ess-S-assign' (customizable " <- "), unless + inside string and comments where plain "_" is used instead. (MM) + * Fixes for longstanding interactive SAS breakage (RMH) + + Changes/New Features in 5.1.17: + * Documentation for Windows Installation (Rich Heiberger) + * removal of ess-vars, finalization of customize support (in the + sense that there is no more use of ess-vars, but that we need to + fix ess-cust) (AJ Rossini) + * Many small (and large) fixes/contributions (MMaechler) + * addition of the "S-equal" variable and provide 'M-x + ess-add-MM-keys' a way to remap "_" to 'ess-S-assign', typically " + <- ", but customizable. (MMaechler) + + Changes/New Features in 5.1.16: + * BUG FIXES + * Better SAS support + + Changes/New Features in 5.1.15: + * BUG FIXES + + Changes/New Features in 5.1.14: + * Yet more fixes to SAS mode, (Rich Heiberger and Rodney Sparapani) + * Customize support (for most Emacsen which support it) (AJRossini) + * ARC and ViSta support out of the box, and fixes for XLispStat + (AJRossini) + + Changes/New Features in 5.1.13: + * Version numbering finally all depending on the ./VERSION file, + thanks to Martin Maechler. + * Yet more fixes to SAS mode, thanks to Rich Heiberger. + + Changes/New Features in 5.1.12: + * Splus 5.1 stabilized, thanks to Martin Maechler, Bill Venables, + Chuck Taylor, and others. + * More fixes to SAS mode, thanks to Rodney Sparapani and Rich + Heiberger. + + Changes/New Features in 5.1.11: + * More fixes to Stata mode, thanks to Brendan Halpin + (mailto:brendan@essex.ac.uk). + * fixed bugs in ESS-elsewhere, thanks to many testers + * README.SPLUS4WIN has DETAILED instructions for S-PLUS 2000, thanks + to David Brahm (mailto:brahm@alum.mit.edu). + * Fixes to SAS mode, thanks to Rodney Sparapani + + Changes/New Features in 5.1.10: + * More fixes to Stata mode + * primitive generic version of ESS-elsewhere + * Small fixes to SAS/Stata. + + Changes/New Features in 5.1.9: + * Stata mode works + * Literate Data Analysis using Noweb works + + Changes/New Features in 5.1.8: + * Bug fixes + * R documentation mode defaults changed + + Changes/New Features in 5.1.2: + * able to use inferior iESS mode to communicate directly with a + running S-Plus 4.x process using the Microsoft DDE protocol. We + use the familiar (from Unix ESS) 'C-c C-n' and related key + sequences to send lines from the S-mode file to the inferior S + process. We continue to edit S input files in ESS[S] mode and + transcripts of previous S sessions in ESS Transcript mode. All + three modes know the S language, syntax, and indentation patterns + and provide the syntactic highlighting that eases the programming + tasks. + diff -Nru ess-16.10/README ess-17.11/README --- ess-16.10/README 1970-01-01 00:00:00.000000000 +0000 +++ ess-17.11/README 2017-11-13 14:13:21.000000000 +0000 @@ -0,0 +1,1154 @@ +1 General Information: README +***************************** + +This is the README file for the distribution of ESS version 17.11 + + ESS is a GNU Emacs and XEmacs mode for interactive statistical +programming and data analysis. Languages supported: the S family (S, +S-PLUS and R), SAS, BUGS/JAGS and Stata. ESS grew out of the desire for +bug fixes and extensions to S-mode and SAS-mode as well as a consistent +union of their features in one package. + + Installation instructions are provided in sections for both Unix and +Windows; see below. + + The current development team is led by Martin Maechler since August +2004. Former project leader A.J. (Tony) Rossini +() did the initial port to XEmacs and has been +the primary coder. Martin Maechler () and +Kurt Hornik () have assisted with the S +family and XLispStat. Stephen Eglen () has worked +mostly on R support. Richard M. Heiberger () has +assisted with S/S-PLUS development for Windows. Richard and Rodney A. +Sparapani () have done much of the work improving SAS +batch and interactive support. Rodney has also extended ESS to support +BUGS/JAGS and has an interest in improving Stata support. + + We are grateful to the previous developers of S-mode (Doug Bates, Ed +Kademan, Frank Ritter, David M. Smith), SAS-mode (Tom Cook) and +Stata-mode (Thomas Lumley). + + Table of Contents + + * License + * Stability + * Requirements + * Latest Version + * Installation + * Starting an ESS Process + * New Features + * Current Features + * Reporting Bugs + * Mailing Lists + * Authors + +1.1 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. + +1.2 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! + +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). + +1.4 Getting the Latest Version +============================== + +The latest released version of ESS is always available on the web at: +ESS web page (http://ess.r-project.org) or StatLib +(http://lib.stat.cmu.edu/general/ESS/) + +1.4.1 Git for ESS development +----------------------------- + +For development and experimentation on new ESS features, there is now a +GitHub branch for ESS, available at . + +1.5 Installation +================ + + 1. Download the latest zip or tgz archive from ESS downloads area + (http://ess.r-project.org/index.php?Section=download) and unpack it + into a directory where you would like ESS to reside. We will + denote this directory as '/path/to/ESS/' hereafter. + + Alternatively you can use 'git' to fetch the most recent + development version to your local machine with: + + git clone https://github.com/emacs-ess/ESS.git /path/to/ESS + + 2. Optionally, compile elisp files and build the documentation with: + cd /path/to/ESS/ + make + Without this step, info, pdf and html documentation and reference + card will not be available. + + 3. Optionally, install into your local machine with 'make install'. + You might need administrative privileges: + + make install + + The files are installed into '/usr/share/emacs' directory. For + this step to run correctly on macOS, you will need to adjust the + 'PREFIX' path in 'Makeconf'. The necessary code and instructions + are commented in that file. + + 4. If you have performed the 'make install' step from above, just add + + (require 'ess-site) + + to your '~/.emacs' file. Otherwise, you should add + '/path/to/ESS/lisp/' to your emacs load path and then load ESS with + the following lines in your '~/.emacs': + + (add-to-list 'load-path "/path/to/ESS/lisp/") + (load "ess-site") + + 5. Restart your Emacs and check that ESS was loaded from a correct + location with 'M-x ess-version'. + + _Note for Windows and macOS users:_ The most straightforward way to +install Emacs on your machine is by downloading the Emacs binary by +Vincent Goulet; either Emacs Modified for macOS +(https://vigou3.github.io/emacs-modified-macos/) or from Emacs Modified +for Windows (https://vigou3.github.io/emacs-modified-windows/). + + _Note for XEmacs users:_ Due to XEmacs lacking some features that ESS +requires, ESS support of XEmacs ends with ESS 12.04-4. This decision +will be re-visited in the future as XEmacs continues to sync with GNU +Emacs. + +1.6 Starting an ESS process +=========================== + +To start an S session on Unix or on Windows when you use the Cygwin bash +shell, simply type 'M-x S RET'. + + To start an S session on Windows when you use the MSDOS prompt shell, +simply type 'M-x S+6-msdos RET'. + +1.7 Current Features +==================== + + * Languages Supported: + * S family (R and S+ AKA S-PLUS) + * SAS + * OpenBUGS/JAGS + * Stata + * Julia + * Editing source code (S family, SAS, OpenBUGS/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, OpenBUGS/JAGS) + * Use of imenu to provide links to appropriate functions + * Interacting with the process (S family, SAS, Stata, Julia) + * Command-line editing + * Searchable Command history + * Command-line completion of S 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 + +1.8 New Features +================ + +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 + + Changes and New Features in 15.09: + + * ESS[R]: The indentation logic has been refactored. It should be + faster, more consistent and more flexible. There are three types + of indentation settings, those starting with 'ess-offset-' give the + actual offsets, those starting with 'ess-indent-' are control + (commonly Boolean) variables, and those starting with 'ess-align-' + are vertical alignment overrides which inhibit default offsets in + specific situations. See 'ess-style-alist' for detailed + description of the new indentation system and provided default + indentation styles. + + * ESS[R]: Deprecation of old indentation settings. As a consequence + of the indentation re-factoring 'ess-brace-imaginary-offset', + 'ess-expression-offset' and all delimiter-specific offsets are + deprecated. The settings for indentation of continued statements + have been replaced by 'ess-offset-continuations'. It can be set to + either 'cascade' or 'straight' (the default). + 'ess-arg-function-offset' has been replaced by + 'ess-indent-from-lhs' and has been generalised to assignments. + This setting now works with both statement blocks and expressions + and only takes effect for offsets set to 'prev-call' and + 'open-delim' in order to produce a consistent indentation. + + * ESS: A test framework has been set up. + + * ESS[R]: A new RStudio style is provided to mimic as closely as + possible R files indented via RStudio. To reproduce the setup of + some of the RStudio users, the RStudio- style with + 'ess-offset-arguments' set to 'prev-line' is also provided. In + addition, the new RRR+ style is equivalent to RRR except it indents + blocks in function calls relatively to the opening delimiter. This + style does not try to save horizontal space and produces more + indentation. + + * ESS[R]: Roxygen fields will now be indented on paragraph refilling + in order to make the documentation more readable. You can also + refill commented lines in the 'examples' field without squashing + the surrounding code in the comments. + + * ESS[R]: ESS can now format your code! This is controlled through + the settings 'ess-fill-calls' and 'ess-fill-continuations'. When + activated, '(fill-paragraph)' formats your calls and your + formulas/continuations while making sure they don't go past + 'fill-column'. Repeated refills cycle through different styles + (see the docstrings for more details). By default, the refilled + region blinks. Set 'ess-blink-filling' to nil to prevent this. + + * ESS[R]: Fix occasional missing error location fontification in + inferior buffers. + + * ESS[R]: ess-developer now correctly assigned the environment of new + functions to the package namespace. + + * ESS[Julia]: ?[topic] now works in the *julia* buffer. Note that + support for editing Julia code now depends on 'julia-mode.el' from + the Julia project. If you install ESS from the official + tarball/zip file, 'julia-mode.el' is already included. Otherwise, + if you install ESS by running 'make', then the latest version of + 'julia-mode.el' is downloaded (and so you need an active internet + connection to install) during the installation process. + Alternatively, if you run ESS without running 'make', then ensure + that you have the 'julia-mode.el', which you can get easily from + MELPA for example. + + * iESS: For naming inferior processes, ESS can use 'projectile''s + project root and it does so when + 'ess-gen-proc-buffer-name-function' is set to + 'ess-gen-proc-buffer-name:projectile-or-simple' as by default, or + to another value beginning with + 'ess-gen-proc-buffer-name:projectile-*'. + + Changes and New Features in 15.03-1: + * ESS[R]: An indentation bug has been fixed (github issue 163) + * ESS[R]: On windows, if 'ess-prefer-higher-bit' is non-nil (the + default), then R-newest will try to run a 64 bit (rather than 32 + bit) version of R. + + Changes and New Features in 15.03: + * ESS[R]: Full native support for 'company-mode'. + * ESS[R]: More efficient caching algorithm for R completion. + * ESS: New offset variable 'ess-close-paren-offset' to control the + indentation of the closing parentheses. + * ESS[R]: Ask for CRAN mirror only once per emacs session. + * ESS[R]: Detect 'library' and 'require' calls for better completion + caching. + * Buffer display is now customizable ('ess-show-buffer-action'). + * Use 'y-or-n-p' instead of 'yes-or-no-p' throughout. + * More support for ODS in ess-sas-graph-view. + * Makefiles are now both UNIX and GNU friendly. + * ESS[R]: Simplify directory lookup in 'ess-developer' (#137). + * Make closed paren indentation consistent + + Bug Fixes in 15.03: + * Fix open brace indentation bug (#27 in ess/R-ESS-bugs.R). + * Fix git version lookup + * Don't check directory modtime in R dialect. + * Declare all ess macros for edebug. + * Add 'ess-smart-comma' to eldoc message functions. + * Inform users when retrieving RDA aliases. + * Line ending in '~' is also a continuation line. + * Filing roxy paragraphs works as expected now. + * In 'ess-developer-add-package', remove incorrect 'wait' argument + from 'ess-get-words-from-vector' call. + * Fix #96, #117, #120, #125, #134, #137. + * Fix ess-quit-r. Call base::q() even if it is masked. + * Fix 'ess-show-buffer' to always display the buffer in another + window. + * Makefile: Fix cd bug for directories with spaces in them + * 'ess-kill-buffer-and-go' modified to not restart R + + Changes / Selected Bug Fixes in 14.09: + * ESS[Julia]: Executable is changed to 'julia'. + * ESS[Julia]: Completion and help system was adjusted to Julia + v.0.3.0. Julia v.0.2.x is no more supported. + * ESS[R]: Running R with 'gdb' debugger now works as expected + * iESS: Inferior ESS buffers are now derived from 'comint-mode' + * ESS[R]: 'ess-execute-screen-options' uses correct screen width in + terminal sessions + * ESS: 'ess-build-tags-for-directory' works when no TAGS file name + was provided + * ESS: 'ess-offset-statement-continued' is now respected everywhere + except inside of the 'if' test condition. + * ESS: New variable 'ess-offset-statement-first-continued' for + indentation of the first line in multiline statements. + * ESSR: Starting ',' in multiline statements indentation is now + ignored to achieve a more pleasant alignment. + * ESSR: Improved behavior of 'RET' in roxygen blocks. + * ESS[R]: command cleaning with 'C-u C-u C-y' was broken with lines + containing " + " + * ESS[R]: fixed "empty watch window bug" + * ESS[R]: don't ask for help location on ac-quick-help (request of + github #81) + * ESS[R]: "importClassesFrom" and "importMethodsFrom" were added to + the list of two-parameter roxygen commands + * ESS[R]: fix vignetes display and hyperlinks (were broken in + 13.09-1) + * ESS[Julia]: recognize function names ending with ! + * ESS[Julia]: fix indentation of "for" comprehension syntax within + brackets. + + Changes / Selected Bug Fixes in 13.09-1: + * ess-remote and TRAMP: R support code is now downloaded in binary + form instead of being injected from local machine. The R code is + stored in '~/.config/ESSR/' directory on the remote machine + * TRAMP: PAGER environment variable is now correctly set to + 'inferior-ess-pager' + * retrieval of help topics on remote machines is fixed + * org-babel: source references of R code executed from org files + correctly point to source references in original org files (version + 8.2.1 or higher of org-mode is required for this feature) + * 'ess-execute' is now bound to 'C-c C-e C-e' in 'ess-extra-map'. + * completion works again in 'ess-execute' + * ESS[R]: 'head' and 'tail' methods were replaced by 'htsummary' in + 'ess-R-describe-object-at-point-commands' + * ESS[roxygen]: evaluation commands now work in roxygen blocks. + Leading comments are automatically removed before the evaluation + * ESS[transcript]: 'Clean Region' now works with multiline + statements; 'ess-transcript-clean-region' etc. correctly treat + multiline statements, i.e., no longer forgets the lines typically + preceded by '+' + * ESS[SAS]: Three features/fixes with special thanks to Matthew + Fidler https://github.com/emacs-ess/ESS/pulls/mlf176f2 + (https://github.com/emacs-ess/ESS/pulls/mlf176f2). Turn on SAS log + mode when appropriate. Indent comments and CARDS statement more + appropriately. + * ESS[SAS]: 'ess-sas-edit-keys-toggle' default returns to 'nil' + * ESS[R]: support for 'prettify-symbols-mode': contribution from + Rudiger Sonderfeld + * ESS[SWV]: knitr now evaluates in the current frame + * ESS[developer]: ess-developer doesn't kill open DESCRIPTION files + anymore + * ESS[roxygen]: 'ess-roxy-preview-HTML' is now on 'C-c C-o C-w' and + 'ess-roxy-preview-text' is now on 'C-c C-o C-t' + * ESS: installation with 'make install' was simplified and should + work out of the box on most *nix systems + * ESS installation instructions simplified + * fixed font-lock bug introduced in 13.09 that was causing very slow + process output + + Changes/New Features in 13.09: + * font-lock in process buffers doesn't "spill" over prompts. Missing + closing string delimiters should not cause wrong fontification of + the following command input. + * ESS[julia]: full features M-TAB completion and auto-complete + support, which now works for modules, structures and data types. + * ESS[julia]: a much better eldoc showing arguments of methods and + data type constructors + * ESS-developer: + - ESS-developer work-flow pattern has been streamlined: + ESS-developer is now automatically activated on per-file basis + if the file is part of a developed package + 'ess-developer-packages'. The old behavior (activation on + per-process basis) is still available on 'M-x ess-developer' + in a process buffer. + - integration with 'devtools' package. New command + 'ess-developer-load-package' calls 'load_all' on the package + containing current file. 'ess-developer-add-package' now + offers IDO menu completions with available loading methods, + currently 'library', and 'load_all'. Loading command can be + customized with 'ess-developer-load-on-add-commands'. + * 'TAB' now indents region if region is active (a contribution of + Matthew Fidler in pull #41) + * 'M-x ess-version' now reports full loading path and recognizes git + and ELPA versions. + * warning and error keyword are now highlighted with + 'font-lock-warning-face' as they should be, (for quite some time + these keywords have been hijacked by compilation mode + fontification). + * eldoc: Eldoc now recognizes multiple processes. If current process + is busy, or current buffer is not associated with a process, eldoc + picks its completions from the first available free process. + * org-babel: evaluation is now org-friendly + * help: new help buffers now try to reuse ess-help buffers. This + behavior is controlled by 'ess-help-reuse-window' custom variable. + * help: ?foo pops IDO menu on multiple help files (so far it worked + only for 'C-c C-v') + * remote evaluation is considerably faster now on slow connections + * ESS[R] tracebug R source references regular expressions are + (mostly) language agnostic. + * 'ess-function-call-face' inherits from + 'font-lock-function-name-face' rather than + 'font-lock-builtin-face'. + * 'ess-inject-source' now accepts 'function-and-buffer' option. + * Documentation: The "New Features" section (and 'NEWS') now + represent recent changes: within the last year or so. All changes + can be found in the new news.html (news.html) (or 'NEWS' and + 'ONEWS'). + * ESS[R] 'ess-rep-regexp' should no longer inf.loop (rarely!), and + hence 'M-x ess-fix-miscellaneous' should neither. + + Changes/New Features in 13.05: + * ESS[gretl]: Support for 'gretl' (both editing and sub-process + interaction). A contribution of Ahmadou Dicko. + * ESS: process output display is 4-10 times faster due to new caching + and only occasional emacs re-display (for the moment this + functionality is available only when 'ess-tracebug' is active). + * ESS: 'C-c `' is now bound to 'ess-show-traceback' and 'C-c ~' is + bound to 'ess-show-call-stack'. + * ESS[R]: ESS stores function in 'ESSR' environment to avoid kludging + users' global environment and accidental deletion. + * ESS[R]: new variable 'ess-swv-processing-command' to control + weaving and tangling. + * ESS[R]: 'ess-default-style' has been changed (from 'DEFAULT') to + 'RRR'. Use something like '(setq ess-default-style 'DEFAULT)' or + '(setq ess-indent-level 2)' in your '~/.emacs' equivalent _before_ + loading ESS, if you do not like this new "incompatible" default + style. + * ESS[julia]: ESS stores its functions in 'ESS' module. + * ESS[julia]: Eldoc is now supported in julia modes + * ESS[julia]: Adjusted error reference detection and interactive help + to julia internal changes + * ESS[R]: 'ess-use-tracebug''s default has been changed to 't'. Set + it to nil if you want to keep the previous behavior. + * ESS[tracebug]: Electric debug keys have been removed [breaking + change] The functionality was replaced with 'ess-debug-minor-mode' + and 'ess-debug-minor-mode-map'. + * ESS[tracebug]: 'ess-tracebug-map' is an alias to 'ess-dev-map' 'C-c + C-t'. + * ESS[tracebug]: 'ess-bp-toggle-state' ('C-c C-t o') can now be used + during the debug session to toggle breakpoints on the fly + (suggestion by Ross Boylan). + * ESS[tracebug]: 'ess-debug-flag-for-debugging' and + 'ess-debug-unflag-for-debugging' work correctly from the debugging + contexts. These commands also recognize non-exported functions for + the packages listed in 'ess-developer-packages' ('C-c C-t C-a'). + + * ESS[R]: Eldoc (activated by 'ess-use-eldoc') has become more + sophisticated, and hence also more intruding in the interface + between the Statistics softare, e.g., R, and the user. + + Note that you can turn off ElDoc, by placing '(setq ess-use-eldoc + nil)' in your '~/.emacs' file, prior to loading ESS, + + * ESS[SAS]: long over-looked 'SAS-mode-hook' appears! + * ESS[SAS]: 'ess-sas-edit-keys-toggle' now defaults to 't' since + 'sas-indent-line' is still broken, i.e. 'TAB' is now bound to + 'ess-sas-tab-to-tab-stop' by default + + Changes/Bug Fixes in 12.09-2: + * ESS: new 'ess-switch-to-end-of-proc-buffer' variable that controls + whether 'C-c C-z' switches to the end of process buffer. The + default is 't'. You can use prefix argument to 'C-c C-z' to toggle + this variable. + * ESS: fix in 'ess-eval-linewise' that was causing emacs to hang + during R debugging with 'ess-eval-visibly' equal to 't'. + * ESS: fix in 'ess-eval-linewise' that was causing emacs to recenter + the prompt in visible window + * ESS[tracebug]: A better handling of "Selection" prompts and debug + related singlekey commands. + * ESS: fix a bug in 'ess-switch-process' that was causing '*new*' + selection to fail. + * ESS[R]: Solve missing 'ess-local-process-name' bug in R-dired. + * ESS[SWV]: 'ess-swv-PDF' doesn't ask for a command to run if there + is only one command in 'ess-swv-pdflatex-commands'. + * ESS[SWV]: 'ess-swv-weave' gained an universal argument to allow for + an interactive choice between available weavers (sweave, knitr). + * ESS: 'ess-eval-*-and-step' functions go to next empty line at eob, + instead of staying at the last line. + + Changes/New Features in 12.09-1: + * ESS _Breaking Changes in Keys_: + + - New keymaps: 'ess-doc-map' bound to 'C-c C-d'; 'ess-extra-map' + bound to 'C-c C-e'; 'ess-dump-object-into-edit-buffer' was + moved on 'C-c C-e C-d' + - roxygen map was moved on 'C-c C-o' and 'ess-roxy-update-entry' + now resides on 'C-c C-o C-o' + - ess-handy-commands is not bound anymore + - 'ess-dev-map' (including 'ess-tracebug' and 'ess-developer') + moved on 'C-c C-t' + - 'C-c C-y' is deprecated in favor of 'C-c C-z C-z' + * ESS[R] new command 'ess-describe-object-at-point' bound to 'C-c C-d + C-e' (repeat 'C-e' or 'e' to cycle). It was inspired by Erik + Iverson's 'ess-R-object-tooltip'. Customize + 'ess-describe-at-point-method' to use tooltip instead of an + electric buffer. + * ESS: New command 'ess-build-tags-for-directory' bound to 'C-c C-e + C-t' for building dialect specific tag tables. After building tags + use 'M-.' to navigate to function and objects definitions. By + default 'C-c C-e C-t' builds tags based on imenu regular + expressions and also include other common languages '.c, .o, .cpp' + etc. But it relies on external 'find' and 'etags' commands. If + 'ess-build-tags-command' is defined (for 'R'), the inferior process + is asked to build tags instead. + * ESS: 'ess-switch-process' offers '*new*' alternative to start a new + process instead of switching to one of the currently running + processes. + * ESS: Switching between processes ('C-c C-s') uses buffer names + instead of the internal process names. Use 'M-x rename-buffer' + command to conveniently rename your process buffers. + * ESS: Process buffers can be automatically named on process creation + according to user specified scheme. Default schemes are *proc*, + *proc:dir* and *proc:abbr-long-dir* where 'proc' stands for the + internal process name and 'dir' stands for the directory where the + process was started in. The default is *proc*. For customization + see 'ess-gen-proc-buffer-name-function'. + * ESS: 'ess-eval-visibly-p' is deprecated in favor of + 'ess-eval-visibly'. + * ESS: New evaluation pattern 'nowait'. In addition to old 'nil' and + 't' values, 'ess-eval-visibly' accepts 'nowait' for a visible + evaluation with no waiting for the process. See 'ess-eval-visibly' + for details on evaluation patterns. + * ESS: New "Process" menu entry with process related commands and + configuration + * iESS: Process buffer is now automatically shown on errors + * ESS: New 'ess-switch-to-inferior-or-script-buffer' command bound to + 'C-c C-z' in both script and process buffers. If invoked form + process buffer it switches to the most recent buffer of the same + dialect. It is a single key command. + * ESSR-help: On multiple help pages with the same name, 'C-c C-v' now + asks for user resolution directly in emacs. + * ESS[R] ess-roxy: new variable 'ess-roxy-re' for fontification of + cases where the number of leading '#' differs from 'ess-roxy-str'. + * ESS[R] Eldoc was considerably enhanced. It now finds hidden + default S3 methods and displays non-default methods' arguments + after trailing ||. + * ESS[R]: New 'ess-display-demos' command bound to 'C-c C-d o' and + 'C-c C-d C-o' + * ESS: New 'ess-help-web-search' command bound to 'C-c C-d w' and + 'C-c C-d C-w' to facilitate interactive search of web resources. + Implemented for 'R', 'Stata' and 'Julia'. See also + 'ess-help-web-search-command'. + * ESS: ess-pdf-viewer-pref accepts now command line arguments + * ESS[Rnw]: Add knitr support. Customize 'ess-swv-processor' for the + default processor. + * ESS[Rnw]: More thorough renaming of remaining 'noweb-*' to + 'ess-noweb-*'. + * ESS[Rnw] new commands 'ess-eval-chunk-and-step' and + 'ess-eval-chunk' bound to 'M-n C-c' and 'M-n C-M-x' to mirror + standard ess commands in C-c map. + * ESS[R] Auto-completion: new variable 'ess-ac-R-argument-suffix' to + customize the insertion of trailing "=". Defaults to " = ". + * ESS[Julia]: Added index, apropos and web-search to julia. + * ESS help: More evaluation commands were added to ess-help mode + ('C-c C-c', 'C-M-x' etc) + + Bug Fixes in 12.09-1: + * iESShelp: Multiple help pages with the same name are properly + handled on 'C-c C-v' + * iESSremote: Evaluation with ESS remote no longer freezes emacs. + * iESS: 'comint-previous-prompt' 'C-c C-p' no longer stops on + secondary prompt "+". + * iESS[R], iESS(Sqpe) [S] on Windows: The 'options("editor")' is now + initialized to 'emacsclient' instead of the previous 'gnuclient'. + The user may need to add the line '(server-start)' to the emacs + initialization file. 'emacsclient' has been included with emacs + since GNU Emacs 22.1. + * ESS[Rnw] Fixed "connection to R" bug (in 12.09 only). + * ESS[Rnw] Explicit 'ess-swv-stangle' and 'ess-swv-sweave' functions. + * ESS[Rnw] Fixed completion and smart underscore problems cause by + unmatched "\"' + * ESS[R] is more careful with the 'R' code injection. It now happens + only once at the start of the session. + * ESS[R]: Fixed auto-scrolling the comint buffer on evaluation. + * ESS[Julia]: Solve several indentation and word navigation problems. + * ESS[Julia]: Help system works again. + + Changes/New Features in 12.09: + + * Due to XEmacs lacking some features that ESS requires, ESS support + of XEmacs ends with ESS 12.04-4. This decision will be re-visited + in the future as XEmacs continues to sync with GNU Emacs. + + * ESS[R]: On Windows, there is now a new customizable variable + (currently called 'ess-directory-containing-R') to tell ESS where + to look for the 'Rterm.exe' executables. The name of the variable + and the values it can take are both in beta and subject to change. + Prior to this variable, ESS searched only in the default + installation directory. Setting this variable now tells ESS how to + find 'Rterm.exe' executables when they are installed somewhere + else. + + * ESS[julia]: _new_ mode for editing julia code ('*.jl'). Start with + 'M-x julia'. + + Full interaction interface, imenu and basic error referencing are + available. + + * ESS[R] noweb: 'noweb-mode' and 'noweb-font-lock-mode' have been + renamed to 'ess-noweb-mode' and 'ess-noweb-font-lock-mode' to avoid + conflicts with the "real" 'noweb-mode'. + + * ESS[R] noweb: The long standing font-lock bug has been solved in + 'ess-noweb' interface. + + * ESS: Basic evaluation keys are now bound to 'ess-eval-region-*-' + functions: + + - 'C-M-x' is bound to 'ess-eval-region-or-function-or-paragraph' + - 'C-c C-c' is bound to + 'ess-eval-region-or-function-or-paragraph-and-step' + - 'C-RET' is bound to 'ess-eval-region-or-line-and-step' + + Each of these functions first evaluates the region whenever the + region is active. + + * ESS: 'C-M-a'/'C-M-e' now step to beginning/end of paragraph if no + function has been detected. + + * ESS: 'ess-eval-*-and-step' family of functions are now smarter, and + don't step to end of buffer or end of chunk code ('@') when at the + end of the code. + + * ESS: 'ess-handy-commands' function is bound to 'C-c h' + + * ESS: ESS is now _blinking_ the evaluated region. Set + 'ess-blink-region' to nil to deactivate; 'ess-blink-delay' gives + the duration of the blink. Evaluated region is "blinked" in + 'highlight' face. + + * ESS[R-help] New key 'a' for "apropos()" in help buffers. Also + available through 'C-c h'. + + * ESS[R-help] All R commands of type foo?bar and foo??bar are + recognized and redirected into appropriate *ESS-help* buffers. + + * ESS[R]: New customization interface for _font-lock_. + + ESS font-lock operates with predefined keywords. Default keywords + are listed in 'ess-R-font-lock-keywords' and + 'inferior-R-font-lock-keywords', which see. The user can easily + customize those by adding new keywords. These variables can also + be interactively accessed and saved through 'ESS/Font-lock' + submenu. + + Several new fontification keywords have been added. Most notably + the keywords for highlighting of function calls, numbers and + operators. + + * ESS[R]: auto-complete is now activated by default whenever + auto-complete package is detected. Set 'ess-use-auto-complete' to + nil to deactivate. + * ESS[R]: R AC sources are no longer auto-starting at 0 characters + but at the default 'ac-auto-start' characters. + * ESS no longer redefines default ac-sources, but only appends + 'ac-source-filename' to it. + * ESS: 'ac-source-R' now concatenates " = " to function arguments. + + * ESS: Menus for ESS and iESS have been reorganized and enriched with + _Tracebug_ and _Developer_ submenus. + + * ESS[R]: 'ess-developer' and 'ess-tracebug' commands are available + by default in 'ess-dev-map' which is bound to 'C-c d' in ESS and + iESS maps. + + * ESS[R]: 'eldoc' truncates long lines whenever + 'eldoc-echo-area-use-multiline-p' is non-nil (the default). Set + this variable to t if you insist on multiline eldoc. See also + 'ess-eldoc-abbreviation-style'. + + * ESS[R]: completion code pre-caches arguments of heavy generics such + as 'plot' and 'print' to eliminated the undesirable delay on first + request. + + * iESS: Prompts in inferior buffers are now highlighted uniformly + with 'comint-highlight-prompt' face. + + * ESS[R]: R process no longer wait for the completion of input in + inferior buffer. Thus, long running commands like 'Sys.sleep(5)' + no longer stall emacs. + + * ESS: [R, S, Stata, Julia] have specialized 'ess-X-post-run-hook's, + which are run at the end of subprocess initialization. + + * ESS[Stata]: All interactive evaluation commands work as expected. + On-line comments are removed before the evaluation and multiline + comments are skipped on 'C-c C-c' and other interactive commands. + + * ESS no longer auto-connects to a subprocess with a different + dialect than the current buffer's one. + + * ESS: 'ess-arg-function-offset-new-line' is now a list for all the + ESS indentation styles, which results in the following indentation + after an open "(": + + a <- some.function(other.function( + arg1, + arg2) + + * ESS[SAS]: Improved MS RTF support for GNU Emacs; try + 'ess-sas-rtf-portrait' and 'ess-sas-rtf-landscape'. + + Changes/Bug Fixes in 12.04-3: + * ESS: basic support for package.el compatibility + * ESS[R]: correct indentation of & and | continuation lines + * 'M-x ess-version' shows the svn revision even after 'make install' + * ESS[SAS]: improved XEmacs support + * iESS[R]: better finding of previous prompt + * ESS[Stata]: adjusted prompt for mata mode + * ESS[R]: resolved name clashes with cl.el + * ESS[R]: removed dependence on obsolete package assoc + * New 'make' target 'lisp', to build the lisp-only part, i.e., not + building the docs. + + Changes/New Features in 12.04-1: + * iESS[Stata]: New interactive help invocation. + * iESS[Stata]: New custom variable 'inferior-STA-start-file'. + * iESS[Stata]: 'inferior-STA-program-name' is now "stata" and can be + customized. + * ESS[Stata] New sections in stata help files Syntax('s-S'), + Remarks('r'), Title('t'). + + Bug Fixes in 12.04-1: + * ESS[R]: Better 'ess-tracebug' error handling. + * ESS[R]: Corrected 'ess-eldoc' help string filtering and improved + argument caching. + * ESS[R]: Indentation of non-block if/else/for/while lines fixed. + * 'M-x ess-version' should work better. + * ESS: Filename completion now again works inside strings. + * iESS[Stata]: Fixed prompt detection issue. + * ESS[Rd]: R is autostarted also from here, when needed. + + Changes/New Features in 12.04: + * ESS: Reverting new behavior of 12.03, 'TAB' in 'ess-mode' no longer + completes by default. If you want smart 'TAB' completion in R and + S scripts, similarly to iESS behavior, set the variable + 'ess-tab-complete-in-script' to 't'. Also see + 'ess-first-tab-never-complete' for how to customize where first + 'TAB' is allowed to complete. + * ESS: completion is consistently bound to 'M-TAB' (aka 'M-C-i') in + both Emacs23 and Emacs24. + * ESS: The variable 'ess-arg-function-offset-new-line' introduced in + ESS(12.03) now accepts a list with the first element a number to + indicate that the offset should be computed from the indent of the + previous line. For example setting it to '(2) results in: + + a <- some.function( + arg1, + arg2) + + Changes/New Features in 12.03: + * ESS indentation: new offset variable + 'ess-arg-function-offset-new-line' controlling for the indentation + of lines immediately following open '('. This is useful to shift + backwards function arguments after a long function call expression: + + a <- some.function( + arg1, + arg2) + + instead of the old + + a <- some.function( + arg1, + arg2) + + If '(' is not followed by new line the behavior is unchanged: + + a <- some.function(arg1, + arg2) + + This variable should be set as part of indentation style lists, or + in ess-mode hook. + * ESS[R]: 'C-c .' sets (indentation) style. + * ESS: In ESS buffers 'yank'('C-y') command accepts double argument + 'C-u C-u' to paste commands only. It deletes any lines not + beginning with a prompt, and then removes the prompt from those + lines that remain. Useful to paste code from emails, + documentation, inferior ESS buffers or transcript files. + * Documentation: ESS user manual has been rearranged and completed + with several new chapters and sections to reflect newly added + features ("Completion", "Developing with ESS", "ESS tracebug", "ESS + developer", "ESS ElDoc", "IDO Completion" and "Evaluating Code") + * RefCard: Reference card was updated to include new features. + * Eldoc: Eldoc was rewritten and is activated by default. See + 'ess-use-eldoc', 'ess-eldoc-show-on-symbol', + 'ess-eldoc-abbreviation-style' variables for how to change the + default behavior. _Note:_ 'skeleton-pair-insert-maybe' prohibits + eldoc display, on '(' insertion. + * ESS[R]: Eldoc shows arguments of a generic function whenever found. + * ESS: 'TAB' in 'ess-mode' now indents and completes, if there is + nothing to indent. Set 'ess-first-tab-never-completes-p' to 't' to + make 'TAB' never complete on first invocation. Completion + mechanism is similar to the completion in the 'inferior-ess-mode' - + a filename expansion is tried, if not found ESS completes the + symbol by querying the process. + * ESS for emacs version 24 or higher: ESS is fully compatible with + the emacs 24 completion scheme, i.e. all the completion is done by + 'completion-at-point'. Also in accordance with emacs conventions, + ESS doesn't bind 'M-TAB' for emacs 24 or higher. 'M-TAB' calls the + default 'complete-symbol'. + + * ESS[R]: Out of the box integration with 'Auto Completion' mode + http://cx4a.org/software/auto-complete + (http://cx4a.org/software/auto-complete) . Three AC sources + 'ac-source-R-args', 'ac-source-R-objects' and 'ac-source-R' are + provided. The last one combines the previous two and makes them + play nicely together. Set 'ess-use-auto-complete' to 't' to start + using it. Refer to documentation string of 'ac-use-auto-complete' + for further information. + * ESS[R]: New unified and fast argument completion system, comprised + of 'ess-funname.start', 'ess-function-arguments', + 'ess-get-object-at-point'. Eldoc and auto-completion integration + are using this system. + * ESS: 'ess-switch-to-end-of-ESS'('C-c C-z'), and + 'ess-switch-to-ESS'('C-c C-y'): Automatically start the process + whenever needed. + * ESS[R]: 'roxy' knows about previewing text version of the + documentation. Bound to 'C-c C-e t'. + * ESS[R]: Solved the "nil filename" bug in roxygen support. + * ESS[R]: 'ess-tracebug' is now part of ESS: + + New Features: + + - Source injection: Tracebug now can inject source references on + the fly during code evaluation, i.e. you don't have to source + your file, but just evaluate your code in normal fashion. + Variable 'ess-tracebug-inject-source-p' controls this behavior + - if t, always inject source reference, if ''function', inject + only for functions (this is the default), if 'nil', never + inject. + + During the source injection the value of 'ess-eval-visibly' is + ignored. + - Org-mode support: Visual debugger is now aware of the + temporary org source editing buffer ('C-c '') and jumps + through this buffers if still alive, or in original org buffer + otherwise. + - New keys in watch mode: '?' and 'd' + - Two new hooks: ess-tracebug-enter-hook and + ess-tracebug-exit-hook + + * ESS[R]: New package 'ess-developer' to evaluate 'R' code directly + in the package environment and namespace. It can be toggled on and + off with 'C-c d t'. When 'ess-developer' is on all ESS evaluation + commands are redefined to evaluate code in appropriate + environments. Add package names to the list of your development + packages with 'C-d a', and remove with 'C-d r'. Source the current + file with 'C-d s'.Evaluation function which depend on + '`ess-eval-region'' ask for the package to source the code into, + 'ess-eval-function' and alternatives search for the function name + in the development packages' environment and namespace and insert + the definition accordingly. See the documentation section + "Developing with ESS/ESS developer" for more details. + + * ESS[R] help system: + + New Features: + + - 'q' quits window instead of calling + 'ess-switch-to-end-of-ESS'. This is consistent with emacs + behavior help and other special buffers (_breaking change_). + - 'k' kills window without asking for the name (pointed by Sam + Steingold) + - Help map inherits from 'special-mode-map' as sugested by Sam + Steingold. + - Package index: new function 'ess-display-index' bound to 'i' + in help mode map. + - Package vignettes: new function 'ess-display-vignettes' bound + to 'v' in help mode map. + - Display help in HTML browser: new function + 'ess-display-help-in-browser' bound to 'w' in help mode map. + It depends on 'R''s 'browser' option. + - New custom variable 'ess-help-pop-to-buffer': if non-nil ESS + help buffers are given focus on display. The default is 't' + (_breaking change_). + - New menu entries for the above functions. + - Bogus help buffers are no longer generated by default, i.e. + buffers of the form "No documentation for 'foo' in specified + packages and libraries: you could try '??foo' ". + 'ess-help-kill-bogus-buffers' now defaults to 't'. Beware, + there may be instances where the default is unsatisfactory + such as debugging and/or during R development. Thanks to Ross + Boylan for making the suggestion, Sam Steingold for reminding + us of this variable and Martin Maechler for the warning. + * ESS now uses 'IDO' completing read functionality for all the + interactive requests. It uses ido completion mechanism whenever + available, and falls back on classical completing-read otherwise. + You can set 'ess-use-ido' to nil if you don't want the IDO + completion. See the documentation string of 'ess-use-ido' for more + information about 'IDO' and ESS configuration. + + * ESS[S]: "','" is bound to ess-smart-comma: If comma is invoked at + the process marker of an ESS inferior buffer, request and execute a + command from '`ess-handy-commands'' list. If + 'ess-R-smart-operators' is t '`ess-smart-comma' also inserts " " + after comma. + * ESS[S], notably 'R': Variable '`ess-handy-commands'' stores an + alist of useful commands which are called by 'ess-smart-comma' in + the inferior buffer. + + Currently containing: + + change-directory + 'ess-change-directory' + help-index + 'ess-display-index' + help-object + 'ess-display-help-on-object' + vignettes + 'ess-display-vignettes' + objects[ls] + 'ess-execute-objects' + search + 'ess-execute-search' + set-width + 'ess-execute-screen-options' + install.packages + 'ess-install.packages' + library + 'ess-library' + setRepos + 'ess-setRepositories' + sos + 'ess-sos' + + Handy commands: 'ess-library', 'ess-install.packages', etc - ask + for item with completion and execute the correspond command. + 'ess-sos' is a interface to 'findFn' function in package 'sos'. If + package 'sos' is not found, ask user for interactive install. + + * ESS: New dynamic mode line indicator: Process status is + automatically reflected in all mode-lines of associated with the + process buffers. Particularly useful for displaying debug status + of 'ess-tracebug' and developer status of 'ess-developer' in all + associated buffers. + + * ESS: New 'ess-completing-read' mechanism: ESS uses 'ido' + completions whenever possible. Variable 'ess-use-ido' controls + whether to use ido completion or not. Active by default. + + * ESS now supports comint fields for output and input detection. + This feature is not used by default, but might be useful in the + future. + + * ESS[S]: New custom variable 'inferior-ess-S-prompt' to customize + prompt detection regular expression in the inferior ESS buffers. + You can customize this variable to enhance comint navigation + ('comint-previous-prompt' and 'comint-next-prompt') the inferior + buffers. + + * ESS[R]: Internal 'R' completion retrieval + ('ess-R-complete-object-name') was rewritten and is faster now. + + * ESS is using process plist to store process specific variables, as + opposed to buffer local variables as it was using before. The use + of buffer local variables to store process variables is + discouraged. + + * ESS: new functions to manipulate process plists: 'ess-process-get' + and 'ess-process-set'. + + * ESS: Internal process waiting mechanism was completely rewritten. + ESS no more relies on prompt regular expressions for the prompt + detection. The only requirement on the primary process prompt is + to end in '> '. This could be overwritten by setting + 'inferor-ess-primary-prompt'. + + * ESS[S], notably 'R': Saved command history: ESS-HISTORY-FILE now + accepts 't' (default), 'nil', or a file name. By setting it to + 'nil' no command line history is saved anymore. + ESS-HISTORY-DIRECTORY now allows to have the history all saved in + one "central" file. + * ESS[R]: more Roxygen improvements. + * ESS[R]: 'C-c .' to set (indentation) style. + + * ESS[R]: Functions with non-standard names (for example + 'aaa-bbb:cc') are properly handled by font-lock and evaluation + routines. + * ESS[R]:Several regexp bugs (described in etc/R-ESS-bugs.el) were + fixed in 'ess-get-words-from-vector' and 'ess-command'. + +1.9 Reporting Bugs +================== + +Please send bug reports, suggestions etc. to + + 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. + +1.10 Mailing Lists +================== + +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 ; contributions +to the list may be mailed to . 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. + +1.11 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) + diff -Nru ess-16.10/RPM.spec ess-17.11/RPM.spec --- ess-16.10/RPM.spec 1970-01-01 00:00:00.000000000 +0000 +++ ess-17.11/RPM.spec 2017-11-13 08:49:53.000000000 +0000 @@ -0,0 +1,131 @@ +# This is an RPM spec file that specifies how to package +# ESS for Fedora Core Linux and, possibly, similar systems. + +%define name emacs-ess +%define version 17.11 +%define release 1.tgm +Summary: Emacs Speaks Statistics add-on package for Emacs +Name: %{name} +Version: %{version} +Release: %{release} +Copyright: GPL +Group: Applications/Editors +Source: http://ESS.R-project.org/downloads/ess/ess-%{version}.tgz +URL: http://ESS.R-project.org/ +Packager: Detlef Steuer <.........de> +BuildRoot: %{_tmppath}/%{name}-root +Prefix: %{_prefix} +BuildArchitectures: noarch +BuildRequires: emacs +Requires: emacs + +%description +This package provides Emacs Speaks Statistics (ESS), which provides +Emacs-based front ends for popular statistics packages. + +ESS provides an intelligent, consistent interface between the user and +the software. ESS interfaces with S-PLUS, R, SAS, BUGS and other +statistical analysis packages under the Unix, Microsoft Windows, and +Apple Mac OS 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. + +%prep +%setup -n ess-%{version} +( cd doc && chmod u+w html info ) # fix perms to ensure builddir can be deleted + +%build +make + +# create an init file that is loaded when a user starts up emacs to +# tell emacs to autoload our package's Emacs code when needed +cat > %{name}-init.el <<"EOF" +;;; Set up %{name} for Emacs. +;;; +;;; This file is automatically loaded by emacs's site-start.el +;;; when you start a new emacs session. + +(require 'ess-site) + +EOF + +# create a README.RPM file to document any quirks of this package +cat > README.RPM < +EOF + + +%install +%{__rm} -rf ${RPM_BUILD_ROOT} +INITDIR=${RPM_BUILD_ROOT}%{_datadir}/emacs/site-lisp/site-start.d +PKGLISP=${RPM_BUILD_ROOT}%{_datadir}/emacs/site-lisp/%{name}-%{version} +INFODIR=${RPM_BUILD_ROOT}%{_infodir} +%{__install} -D %{name}-init.el $INITDIR/%{name}-init.el +%{__install} -d $PKGLISP +%{__install} -d $INFODIR +%{__make} install \ + PREFIX=${RPM_BUILD_ROOT}%{_prefix} \ + LISPDIR=$PKGLISP \ + INFODIR=$INFODIR +%{__rm} -f $INFODIR/dir # don't package but instead update in pre and post +%{__cp} -a etc $PKGLISP # tuck ess's /etc into lisp dir for easy transport + +# Uncomment to print the README file after install. +# +# %post +# echo +# cat %{_defaultdocdir}/%{name}-%{version}/README.RPM +# echo + +%clean +%{__rm} -rf ${RPM_BUILD_ROOT} + +%files +%defattr(-,root,root) +%doc README README.RPM ANNOUNCE COPYING VERSION ChangeLog doc +%dir %{_datadir}/emacs/site-lisp/%{name}-%{version} +%{_datadir}/emacs/site-lisp/%{name}-%{version}/* +%{_datadir}/emacs/site-lisp/site-start.d/* +%{_infodir}/*.gz + +%post +[ -f /usr/share/info/ess.info.gz ] && \ + /sbin/install-info /usr/share/info/ess.info.gz /usr/share/info/dir || : + +%preun +if [ $1 = 0 ]; then + [ -f /usr/share/info/ess.info.gz ] && \ + /sbin/install-info --delete /usr/share/info/ess.info.gz \ + /usr/share/info/dir || : +fi + + +%changelog +* Fri Oct 15 2004 Tom Moertel 5.2.3-1.tgm +- Updated to ESS 5.2.3. + +* Fri Aug 27 2004 Tom Moertel 5.2.2-3.tgm +- Updated ESS URL. +- Fixed Summary. + +* Fri Aug 27 2004 Tom Moertel 5.2.2-2.tgm +- Fixed bug: Forgot to include ESS's etc/ directory. + +* Thu Aug 26 2004 Tom Moertel 5.2.2-1.tgm +- Initial build. + + diff -Nru ess-16.10/test/styles/C++.R ess-17.11/test/styles/C++.R --- ess-16.10/test/styles/C++.R 2016-03-03 13:51:15.000000000 +0000 +++ ess-17.11/test/styles/C++.R 2017-11-13 14:13:17.000000000 +0000 @@ -1158,6 +1158,14 @@ ) } +## 8 +"#" + # comment + NULL + +## 9 +"* #" +x + ### Logical operators diff -Nru ess-16.10/test/styles/misc1.R ess-17.11/test/styles/misc1.R --- ess-16.10/test/styles/misc1.R 2016-03-03 13:51:30.000000000 +0000 +++ ess-17.11/test/styles/misc1.R 2017-11-13 14:13:17.000000000 +0000 @@ -1158,6 +1158,14 @@ ) } +## 8 +"#" + # comment + NULL + +## 9 +"* #" +x + ### Logical operators diff -Nru ess-16.10/test/styles/RRR.R ess-17.11/test/styles/RRR.R --- ess-16.10/test/styles/RRR.R 2016-03-03 13:51:23.000000000 +0000 +++ ess-17.11/test/styles/RRR.R 2017-11-13 14:13:17.000000000 +0000 @@ -1158,6 +1158,14 @@ ) } +## 8 +"#" + # comment + NULL + +## 9 +"* #" +x + ### Logical operators diff -Nru ess-16.10/test/styles/RRR+.R ess-17.11/test/styles/RRR+.R --- ess-16.10/test/styles/RRR+.R 2016-03-03 13:51:21.000000000 +0000 +++ ess-17.11/test/styles/RRR+.R 2017-11-13 14:13:17.000000000 +0000 @@ -1158,6 +1158,14 @@ ) } +## 8 +"#" + # comment + NULL + +## 9 +"* #" +x + ### Logical operators diff -Nru ess-16.10/test/styles/RStudio-.R ess-17.11/test/styles/RStudio-.R --- ess-16.10/test/styles/RStudio-.R 2016-10-22 16:03:27.000000000 +0000 +++ ess-17.11/test/styles/RStudio-.R 2017-11-13 14:13:17.000000000 +0000 @@ -1158,6 +1158,14 @@ ) } +## 8 +"#" + # comment + NULL + +## 9 +"* #" +x + ### Logical operators diff -Nru ess-16.10/VERSION ess-17.11/VERSION --- ess-16.10/VERSION 2016-10-22 16:03:27.000000000 +0000 +++ ess-17.11/VERSION 2017-11-13 14:13:15.000000000 +0000 @@ -1 +1 @@ -16.10 +17.11