diff -Nru ess-18.10.2/ANNOUNCE ess-18.10.2+git20220915.f45542e/ANNOUNCE --- ess-18.10.2/ANNOUNCE 2018-11-10 09:41:15.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/ANNOUNCE 1970-01-01 00:00:00.000000000 +0000 @@ -1,530 +0,0 @@ -1 ANNOUNCING ESS -**************** - -The ESS Developers proudly announce the release of ESS 18.10.2 - - 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 -============================== - -ESS supports GNU Emacs versions 24.3 and newer. - - ESS is most likely to work with current/recent versions of the -following statistical packages: R/S-PLUS, SAS, Stata, OpenBUGS and JAGS. - - To build the PDF documentation, you will need a version of TeX Live -or texinfo that includes texi2dvi. - - There are two main methods used for installing ESS. You may install -from a third-party repository or from source code. Once you install it, -you must also activate or load ESS in each Emacs session, though -installation from a third-party repository likely takes care of that for -you. See *note Activating and Loading ESS:: for more details. - -1.2 Installing from a third-party repository -============================================ - -ESS is packaged by many third party repositories. Many GNU/Linux -distributions package it, usually with the name "emacs-ess" or similar. - - ESS is also available through Milkypostman’s Emacs Lisp Package -Archive (MELPA), a popular repository for Emacs packages. Instructions -on how to do so are found on MELPA's website (https://melpa.org/). -MELPA also hosts MELPA-stable with stable ESS builds. You may choose -between MELPA with the latest and greatest features (and bugs) or -MELPA-stable, which may lag a bit behind but should be more stable. - - After installing, users should make sure ESS is activated or loaded -in each Emacs session. See *note Activating and Loading ESS::. -Depending on install method, this may be taken care of automatically. - -1.3 Installing from source -========================== - -Stable versions of ESS are available at the ESS web page -(https://ess.r-project.org) as a .tgz file or .zip file. ESS releases -are GPG-signed, you should check the signature by downloading the -accompanying '.sig' file and doing: - - gpg --verify ess-18.10.tgz.sig - - Alternatively, you may download the git repository. ESS is currently -hosted on Github: . 'git clone -https://github.com/emacs-ess/ESS.git' will download it to a new -directory 'ESS' in the current working directory. - - We will refer to the location of the ESS source files as -'/path/to/ESS/' hereafter. - - After installing, users should make sure they activate or load ESS in -each Emacs session, see *note Activating and Loading ESS:: - - Optionally, compile elisp files, build the documentation, and the -autoloads: - cd /path/to/ESS/ - make - Without this step the documentation, reference card, and autoloads -will not be available. Uncompiled ESS will also run slower. - - Optionally, you may make ESS available to all users of a machine by -installing it site-wide. To do so, run '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. - -1.4 Activating and Loading ESS -============================== - -After installing ESS, you must activate or load it each Emacs session. -ESS can be autoloaded, and if you used a third-party repository (such as -your Linux distribution or MELPA) to install, you can likely skip this -section and proceed directly to *note Check Installation:: - - Otherwise, you may need to add the path to ESS to 'load-path' with: - - (add-to-list 'load-path "/path/to/ESS/lisp") - - You then need to decide whether to take advantage of deferred loading -(which will result in a faster Emacs startup time) or require ESS when -Emacs is loaded. To autoload ESS when needed (note that if installed -from source, you must have run 'make'): - - (load "ess-autoloads") - - To require ESS on startup, you can either put - - (require 'ess-site) - - or - - (require 'ess-r-mode) - - In your configuration file, depending on whether you want all ESS -features or only R related features. - -1.5 Check Installation -====================== - -Restart Emacs and check that ESS was loaded from a correct location with -'M-x ess-version'. - -1.6 Current Features -==================== - - * Languages Supported: - * S family (R, S, and S+ AKA S-PLUS) - * SAS - * BUGS/JAGS - * Stata - * Julia - * Editing source code (S family, SAS, BUGS/JAGS, Stata, Julia) - * Syntactic indentation and highlighting of source code - * Partial evaluation of code - * Loading and error-checking of code - * Source code revision maintenance - * Batch execution (SAS, BUGS/JAGS) - * Use of imenu to provide links to appropriate functions - * Interacting with the process (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.7 Requirements -================ - -ESS supports GNU Emacs versions 24.3 and newer. - - ESS is most likely to work with current/recent versions of the -following statistical packages: R/S-PLUS, SAS, Stata, OpenBUGS and JAGS. - - To build the PDF documentation, you will need a version of TeX Live -or texinfo that includes texi2dvi. - -1.8 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.9 Reporting Bugs -================== - -Please send bug reports, suggestions etc. to , -or post them on our github issue tracker -(https://github.com/emacs-ess/ESS/issues) - - The easiest way to do this is within Emacs by typing - - 'M-x ess-submit-bug-report' - - This also gives the maintainers valuable information about your -installation which may help us to identify or even fix the bug. - - If Emacs reports an error, backtraces can help us debug the problem. -Type "M-x set-variable RET debug-on-error RET t RET". Then run the -command that causes the error and you should see a *Backtrace* buffer -containing debug information; send us that buffer. - - Note that comments, suggestions, words of praise and large cash -donations are also more than welcome. - -1.10 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) - * J. Alexander Branham (mailto:alex.branham@gmail.com) - -1.11 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.12 New Features -================= - -Bug Fixes in 18.10.2: - * ESS[R] Fix namespace evaluation in non-installed packages. - Evaluation is directed into GlobalEnv as originally intended. - * 'Makefile' fixes, notably for 'make install' and including full - docs in the tarballs. - - Bug Fixes in 18.10-1: - * New functions 'ess-eval-line-visibly-and-step' ('C-c C-n' and - 'ess-eval-region-or-line-visibly-and-step' ('C-RET') which behave - as the old versions of 'ess-eval-line-and-step' and - 'ess-eval-region-or-line-and-step'. - - Changes and New Features in 18.10: - - * This is the last release to support Emacs older than 25.1. Going - forward, only GNU Emacs 25.1 and newer will be supported. Soon - after this release, support for older Emacs versions will be - dropped from the git master branch. Note that MELPA uses the git - master branch to produce ESS snapshots, so if you are using Emacs < - 25.1 from MELPA and are unable to upgrade, you should switch to - MELPA-stable. - - * ESS now displays the language dialect in the mode-line. So, for - example, R buffers will now show ESS[R] rather than ESS[S]. - - * The ESS manual has been updated and revised. - - * The ESS initialization process has been further streamlined. If - you update the autoloads (which installation from 'package-install' - does), you should not need to '(require 'ess-site)' at all, as - autoloads should automatically load ESS when it is needed (e.g. - the first time an R buffer is opened). In order to defer loading - your ESS config, you may want to do something like - '(with-require-after-load "ess" )' in your Emacs - init file. Users of the popular 'use-package' Emacs package can - now do '(use-package ess :defer t)' to take advantage of this - behavior. *Note (ess)Activating and Loading ESS:: for more - information on this feature. - - * ESS now respects Emacs conventions for keybindings. This means - that The 'C-c [letter]' bindings have been removed. This affects - 'C-c h', which was bound to 'ess-eval-line-and-step-invisibly' in - 'sas-mode-local-map'; 'C-c f', which was bound to - 'ess-insert-function-outline' in 'ess-add-MM-keys'; and 'C-c h', - which was bound to 'ess-handy-commands' in 'Rd-mode-map', - 'ess-noweb-minor-mode-map', and 'ess-help-mode-map' - - * Functions 'ess-eval-line-and-step' and - 'ess-eval-region-or-line-and-step' now behave consistently with - other evaluation function inside a package. - - * ESS[R]: 'ess-r-package-use-dir' now works with any mode. This sets - the working directory to the root of the current package including - for example C or C++ files within '/src'). - - * ESS[R]: Long + + prompts in the inferior no longer offset output. - - * ESS[R]: New option 'strip' for 'inferior-ess-replace-long+'. This - strips the entire + + sequence. - - * ESS modes now inherit from 'prog-mode'. In the next release, ESS - modes will use 'define-derived-mode' so that each mode will have - (for example) its own hooks and keymaps. - - * ESS[R]: Supports flymake in R buffers for Emacs 26 and newer. - Users need to install the 'lintr' package to use it. Customizable - options include 'ess-use-flymake', 'ess-r-flymake-linters', and - 'ess-r-flymake-lintr-cache'. - - * ESS[R]: Gained support for xref in Emacs 25+. *Note (emacs)Xref:: - - * ESS[R]: The startup screen is cleaner. It also displays the - startup directory with an explicit 'setwd()'. - - * ESS[R]: Changing the working directory is now always reflected in - the process buffer. - - * ESS[R]: 'Makevars' files open with 'makefile-mode'. - - * New variable 'ess-write-to-dribble'. This allows users to disable - the dribble ('*ESS*') buffer if they wish. - - * All of the '*-program-name' variables have been renamed to - '*-program'. Users who previously customized e.g. - 'inferior-ess-R-program-name' will need to update their - customization to 'inferior-ess-R-program'. These variables are - treated as risky variables. - - * 'ess-smart-S-assign' was renamed to 'ess-insert-assign'. It - provides similar functionality but for any keybinding, not just - '_'. For instance if you bind it to ';', repeated invokations - cycle through between assignment and inserting ';'. - - * 'C-c C-=' is now bound to 'ess-cycle-assign' by default. See the - documentation for details. New user customization option - 'ess-assign-list' controls which assignment operators are cycled. - - * ESS[R] In remote sessions, the ESSR package is now fetched from - GitHub. - - * Commands that send the region to the inferior process now deal with - rectangular regions. See the documentation of 'ess-eval-region' - for details. This only works on Emacs 25.1 and newer. - - * ESS[R]: Improvements to interacting with iESS in non-R files. - Interaction with inferior process in non-R files within packages - (for instance C or C++ files) has been improved. This is a work in - progress. - - * ESS[R]: Changing the working directory is now always reflected in - the process buffer. - - * ESS[JAGS]: *.jog and *.jmd files no longer automatically open in - JAGS mode. - - Many improvements to fontification: - - * Improved customization for faces. ESS now provides custom faces - for (nearly) all faces used and places face customization options - into their own group. Users can customize these options using 'M-x - customize-group RET ess-faces'. - - * Many new keywords were added to 'ess-R-keywords' and - 'ess-R-modifiers'. See the documentation for details. - - * ESS[R]: 'in' is now only fontified when inside a 'for' construct. - This avoids spurious fontification, especially in the output buffer - where 'in' is a commond English word. - - * ESS: Font-lock keywords are now generated lazily. That means you - can now add or remove keywords from variables like 'ess-R-keywords' - in your Emacs configuration file after loading ESS (i.e. in the - ':config' section for 'use-package' users). - - * ESS[R]: Fontification of roxygen '@param' keywords now supports - comma-separated parameters. - - * ESS[R]: Certain keywords are only fontified if followed by a - parenthesis. Function-like keywords such as 'if ()' or 'stop()' - are no longer fontified as keyword if not followed by an opening - parenthesis. The same holds for search path modifiers like - 'library()' or 'require()'. - - * ESS[R]: Fixed fontification toggling. Especially certain syntactic - elements such as '%op%' operators and backquoted function - definitions. - - * ESS[R]: 'ess-font-lock-toggle-keyword' can be called interactively. - This command asks with completion for a font-lock group to toggle. - This functionality is equivalent to the font-lock menu. - - Notable bug fixes: - - * 'prettify-symbols-mode' no longer breaks indentation. This is - accomplished by having the pretty symbols occupy the same number of - characters as their non-pretty cousins. You may customize the new - variable 'ess-r-prettify-symbols' to control this behavior. - - * ESS: Inferior process buffers are now always displayed on startup. - Additionally, they don't hang Emacs on failures. - - Obsolete libraries, functions, and variables: - - * The 'ess-r-args.el' library has been obsoleted and will be removed - in the next release. Use 'eldoc-mode' instead, which is on by - default. - - * Functions and options dealing with the smart assign key are - obsolete. The following functions have been made obsolete and will - be removed in the next release of ESS: 'ess-smart-S-assign', - 'ess-toggle-S-assign', 'ess-toggle-S-assign-key', - 'ess-disable-smart-S-assign'. - - The variable 'ess-smart-S-assign-key' is now deprecated and will be - removed in the next release. If you would like to continue using - '_' for insterting assign in future releases, please bind - 'ess-insert-assign' in 'ess-mode-map' the normal way. - - * ESS[S]: Variable 'ess-s-versions-list' is obsolete and ignored. - Use 'ess-s-versions' instead. You may pass arguments by starting - the inferior process with the universal argument. - - 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 - diff -Nru ess-18.10.2/ChangeLog ess-18.10.2+git20220915.f45542e/ChangeLog --- ess-18.10.2/ChangeLog 2018-11-10 09:41:10.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/ChangeLog 2022-10-15 08:06:36.000000000 +0000 @@ -1,3 +1,7 @@ +2018-11-10 ESS Maintainers + + * Version 18.10.2 released. + 2018-10-23 ESS Maintainers * Version 18.10-1 released. diff -Nru ess-18.10.2/COPYING ess-18.10.2+git20220915.f45542e/COPYING --- ess-18.10.2/COPYING 2018-11-10 09:41:10.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/COPYING 2022-10-15 08:06:36.000000000 +0000 @@ -1,285 +1,626 @@ - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 - Copyright (C) 1989, 1991 Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Lesser General Public License instead.) You can apply it to + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their -rights. - - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. The precise terms and conditions for copying, distribution and modification follow. - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. - 0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - - 1. You may copy and distribute verbatim copies of the Program's -source code as you receive it, in any medium, provided that you -conspicuously and appropriately publish on each copy an appropriate -copyright notice and disclaimer of warranty; keep intact all the -notices that refer to this License and to the absence of any warranty; -and give any other recipients of the Program a copy of this License -along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - - 2. You may modify your copy or copies of the Program or any portion -of it, thus forming a work based on the Program, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Program, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections - 1 and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source -code means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to -control compilation and installation of the executable. However, as a -special exception, the source code distributed need not include -anything that is normally distributed (in either source or binary -form) with the major components (compiler, kernel, and so on) of the -operating system on which the executable runs, unless that component -itself accompanies the executable. - -If distribution of executable or object code is made by offering -access to copy from a designated place, then offering equivalent -access to copy the source code from the same place counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program is -void, and will automatically terminate your rights under this License. -However, parties who have received copies, or rights, from you under -this License will not have their licenses terminated so long as such -parties remain in full compliance. - - 5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - - 6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of this License. - 7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License -may add an explicit geographical distribution limitation excluding -those countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. - 9. The Free Software Foundation may publish revised and/or new versions -of the General Public License from time to time. Such new versions will + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any -later version", you have the option of following the terms and conditions -either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. - - 10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author -to ask for permission. For software which is copyrighted by the Free -Software Foundation, write to the Free Software Foundation; we sometimes -make exceptions for this. Our decision will be guided by the two goals -of preserving the free status of all derivatives of our free software and -of promoting the sharing and reuse of software generally. - - NO WARRANTY - - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -REPAIR OR CORRECTION. - - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED -TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY -YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. - END OF TERMS AND CONDITIONS + END OF TERMS AND CONDITIONS - How to Apply These Terms to Your New Programs + How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it @@ -287,15 +628,15 @@ To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least +state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) - This program is free software; you can redistribute it and/or modify + This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or + the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, @@ -303,37 +644,31 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + You should have received a copy of the GNU General Public License + along with this program. If not, see . Also add information on how to contact you by electronic and paper mail. -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: - Gnomovision version 69, Copyright (C) year name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, the commands you use may -be called something other than `show w' and `show c'; they could even be -mouse-clicks or menu items--whatever suits your program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - `Gnomovision' (which makes passes at compilers) written by James Hacker. - - , 1 April 1989 - Ty Coon, President of Vice - -This General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may -consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. diff -Nru ess-18.10.2/debian/changelog ess-18.10.2+git20220915.f45542e/debian/changelog --- ess-18.10.2/debian/changelog 2022-06-24 22:23:24.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/debian/changelog 2022-10-27 19:12:06.000000000 +0000 @@ -1,3 +1,43 @@ +ess (18.10.2+git20220915.f45542e-3) unstable; urgency=medium + + * testsuite.patch: disable ess--command-browser-timeout-test. + It fails randomly. + + -- Sébastien Villemot Thu, 27 Oct 2022 21:12:06 +0200 + +ess (18.10.2+git20220915.f45542e-2) unstable; urgency=medium + + * testsuite.patch: disable command-without-trailing-newline-test. + It fails randomly. + + -- Sébastien Villemot Sun, 23 Oct 2022 16:10:25 +0200 + +ess (18.10.2+git20220915.f45542e-1) unstable; urgency=medium + + * New upstream snapshot, compatible with Emacs 28 (Closes: #1017829) + * Move maintenance to the Debian Emacsen team. + Many thanks to Dirk Eddelbuettel for his work on this package over the + years! + * d/watch: bump format to version 4 + * d/control: use secure URL for Homepage + * Drop ess transitional package that depends on elpa-ess + * d/copyright: rewrite using machine-readable format 1.0 + * Move to “editors” archive section, per Debian Emacsen team policy + * Bump to debhelper compat level 13 + * Add Rules-Requires-Root: no + * Bump Standards-Version to 4.6.1 + * Ship PDF manual and ANNOUNCE file + * Overhaul long description + * refcard-clean.patch: new patch, adds missing clean rules for PDF refcard + * Add d/upstream/metadata + * Rewrite d/rules using dh. + * Honour DEB_BUILD_OPTIONS=nodoc. + * Exercise testsuite at build time and in an autopkgtest. + New testsuite.patch for disabling or fixing a few failing tests. + * Register manual into doc-base + + -- Sébastien Villemot Sun, 16 Oct 2022 12:15:20 +0200 + ess (18.10.2-3) unstable; urgency=medium * debian/control: Remove alternate dependency on install-info diff -Nru ess-18.10.2/debian/control ess-18.10.2+git20220915.f45542e/debian/control --- ess-18.10.2/debian/control 2022-06-24 22:21:57.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/debian/control 2022-10-16 08:44:41.000000000 +0000 @@ -1,65 +1,58 @@ Source: ess -Section: gnu-r +Section: editors Priority: optional -Maintainer: Dirk Eddelbuettel -Standards-Version: 4.2.1 -Build-Depends: debhelper-compat (= 11) -Build-Depends-Indep: dh-elpa, texlive-base, texlive-latex-base, texlive-latex-recommended, texlive-latex-extra, texlive-plain-generic, texlive-extra-utils, texlive-fonts-recommended, texinfo -Vcs-Browser: https://salsa.debian.org/edd/ess -Vcs-Git: https://salsa.debian.org/edd/ess.git -Homepage: http://ess.r-project.org +Maintainer: Debian Emacsen team +Uploaders: Sébastien Villemot +Standards-Version: 4.6.1 +Build-Depends: debhelper-compat (= 13), + dh-elpa, + texlive-latex-extra, + texinfo, +# Build-depend on R for the testsuite + r-base-core +Vcs-Browser: https://salsa.debian.org/emacsen-team/ess +Vcs-Git: https://salsa.debian.org/emacsen-team/ess.git +Homepage: https://ess.r-project.org +Rules-Requires-Root: no +Testsuite: autopkgtest-pkg-elpa Package: elpa-ess Architecture: all -Depends: ${misc:Depends}, emacsen-common (>= 2.0.8) -Conflicts: dhelp (<= 0.3.12) -Breaks: ess (<= 17.11-3) +Depends: ${misc:Depends}, + ${elpa:Depends} +Enhances: emacs Recommends: r-base-core -Suggests: xlispstat, pspp, jags, julia +Suggests: pspp, jags Description: Emacs mode for statistical programming and data analysis - "Emacs Speaks Statistics" (ESS) is an add-on package for emacs text - editors such as GNU Emacs and XEmacs. It is designed to support - editing of scripts and interaction with various statistical analysis - programs such as R, S-Plus, SAS, Stata and OpenBUGS/JAGS. Although - all users of these statistical analysis programs are welcome to apply - ESS, advanced users or professionals who regularly work with - text-based statistical analysis scripts, with various statistical - languages/programs, or with different operating systems might benefit - from it the most. + Emacs Speaks Statistics (ESS) is an add-on package for GNU Emacs. It is + designed to support editing of scripts and interaction with various + statistical analysis programs such as R, S, S-Plus, SAS, Stata, BUGS/JAGS and + Julia. . - The rationale for developing ESS is that most statistical analysis - systems provide a more or less sophisticated graphical user interface - (GUI). However, their full power is only available using their - scripting language. Furthermore, complex statistical analysis - projects require a high degree of automation and documentation which - can only be handled by creating statistical analysis - scripts. Unfortunately, many statistics packages provide only weak - text editor functionality and show major differences between - them. Without a unified text editor user interface additional effort - is required from the user to cope with limited functionality and with - text editor differences. - . - Therefore, emacs editors and the ESS package provide the following - major features: - - Support for various operating systems - Examples: Linux, Unix, Mac OS X and MS Windows - - Working environment based on emacs - Examples: File Manager (Dired), File Transfer Client/Telnet Client - (Tramp), Multiple Clipboards (registers), Bookmarks, Abbreviations, - and many others - - Support for various statistical analysis languages - Examples: R, S-Plus, SAS, Stata and OpenBUGS/JAGS - Examples: Keybindings, Abbreviations, Syntax highlighting, Code - formatting, Commenting, Submitting scripts, Displaying results and - Searching documentation - . - ESS is freely available under the GNU General Public License (GPL). - For further technical and legal information please refer to the ESS - Manual. - -Package: ess -Architecture: all -Depends: ${misc:Depends}, elpa-ess -Description: Transition Package, ess to elpa-ess - The ESS addon package for Emacs has been elpafied. This dummy package - helps ease transition from ess to elpa-ess. + It provides the following features: + - Editing source code (R, S, S-plus, SAS, BUGS/JAGS, Stata, Julia) + + Syntactic indentation and highlighting of source code + + Partial evaluation of code + + Loading and error-checking of code + + Source code revision maintenance + + Batch execution (SAS, BUGS/JAGS) + + Use of imenu to provide links to appropriate functions + - Interacting with the process (R, S, S-plus, SAS, Stata, Julia) + + Command-line editing + + Searchable Command history + + Command-line completion of R, S, S-plus object names and file names + + Quick access to object lists and search lists + + Transcript recording + + Interface to the help system + - Transcript manipulation (R, S, S-plus, 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 diff -Nru ess-18.10.2/debian/copyright ess-18.10.2+git20220915.f45542e/debian/copyright --- ess-18.10.2/debian/copyright 2018-08-18 13:42:26.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/debian/copyright 2022-10-15 15:29:15.000000000 +0000 @@ -1,43 +1,80 @@ -This is the Debian GNU/Linux ess package of Emacs Speaks Statistics (ESS) -which provides a common, generic, and useful interface, through emacs, -to many statistical packages. - -Upstream Authors: A.J. Rossini , - Richard M. Heiberger , - Kurt Hornik , - Martin Maechler , - Rodney A. Sparapani , - Stephen Eglen , - Sebastian P. Luque , - Henning Redestig - -ESS has a home page at `http://ESS.R-project.org/'. It is free software -distributed under a GNU-style copyleft. - -This package was initially debianized by Camm Maguire on -Sat, 11 Sep 1999 12:03:46 -0400. - -As of May 2008, the package is maintained by a group of ESS and Debian -developers which can be reached at ess-debian@r-project.org. - -Sources were downloaded from http://ESS.R-project.org/downloads/ess/ and -changes, typically only to files in the Debian/ directory are fully documented -in the file /usr/share/doc/ess/changelog.Debian.gz - -Copyright (C) 1994 - 2010 Martin Maechler -Copyright (C) 1994 - 2010 A.J. Rossini -Copyright (C) 1994 - 2010 Richard M. Heiberger -Copyright (C) 1994 - 2010 Kurt Hornik -Copyright (C) 1999 - 2010 Rodney A. Sparapani -Copyright (C) 2002 - 2010 Stephen Eglen -Copyright (C) 2010 Sebastian P. Luque -Copyright (C) 2010 Henning Redestig - - -License: GPL - -Earlier copyrights apply to some of the emacs lisp sources files in -../lisp/. These authors have all transferred copyright to the ESS core team. - -On a Debian GNU/Linux system, the GNU General Public License (GPL) is -included in the file /usr/share/common-licenses/GPL. +Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: ESS +Upstream-Contact: ess-help@r-project.org +Source: https://ess.r-project.org/ + +Files: * +Copyright: 1989-2022 Free Software Foundation, Inc. +License: GPL-3+ + +Files: lisp/ess-custom.el + lisp/obsolete/ess-font-lock.el + test/ess-test-inf.el + test/ess-test-literate.el + test/ess-test-org.el + test/ess-test-r-eval.el + test/ess-test-r-mode.el + test/ess-test-r-package.el + test/ess-test-r-syntax.el + test/ess-test-r-utils.el + test/ess-test-r.el + test/ess-test-rd.el + test/ess-test.el +Copyright: 1997-2022 Free Software Foundation, Inc. +License: GPL-2+ + +Files: etc/ess-sas-sh-command +Copyright: 1997 Richard M. Heiberger. +License: GPL-2+ + +Files: doc/* +Copyright: 1992-1995 David M. Smith + 1996-2001 A.J. Rossini + 2002-2018 The ESS Developers +License: permissive + Permission is granted to make and distribute verbatim copies of this + manual provided the copyright notice and this permission notice are + preserved on all copies. + Permission is granted to copy and distribute modified versions of this + manual under the conditions for verbatim copying, provided that the + entire resulting derived work is distributed under the terms of a + permission notice identical to this one. + +Files: debian/* +Copyright: 1999-2006 Camm Maguire + 2006-2022 Dirk Eddelbuettel + 2022 Sébastien Villemot +License: GPL-3+ + +License: GPL-3+ + 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 3 of the License, 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 for more details. + . + You should have received a copy of the GNU General Public License + along with ESS. If not, see . + . + On Debian systems, the complete text of the GNU General Public + License, version 3, can be found in the file + `/usr/share/common-licenses/GPL-3'. + +License: GPL-2+ + 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. + . + On Debian systems, the complete text of the GNU General Public + License, version 2, can be found in the file + `/usr/share/common-licenses/GPL-2'. diff -Nru ess-18.10.2/debian/debian-autoloads.el ess-18.10.2+git20220915.f45542e/debian/debian-autoloads.el --- ess-18.10.2/debian/debian-autoloads.el 2018-08-19 20:01:19.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/debian/debian-autoloads.el 1970-01-01 00:00:00.000000000 +0000 @@ -1,17 +0,0 @@ -;;;###autoload -(autoload 'R "ess-site" "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'." t) - -;;;###autoload -(require 'ess-site) -;;;###autoload -(autoload 'R-mode "ess-site.el" "Major mode for editing R source." t) -;;;###autoload -(autoload 'r-mode "ess-site.el" "Major mode for editing R source." t) -;;;###autoload -(add-to-list 'auto-mode-alist '("\\.R$" . R-mode)) -;;;###autoload -(autoload 'S "ess-site" "Call 'S'." t) diff -Nru ess-18.10.2/debian/doc-base ess-18.10.2+git20220915.f45542e/debian/doc-base --- ess-18.10.2/debian/doc-base 1970-01-01 00:00:00.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/debian/doc-base 2022-10-16 10:14:32.000000000 +0000 @@ -0,0 +1,16 @@ +Document: ess-manual +Title: Emacs Speaks Statistics (ESS) manual +Author: The ESS Developers +Abstract: Describes All features and technical details of the ESS package +Section: Editors + +Format: HTML +Index: /usr/share/doc/elpa-ess/html/ess.html +Files: /usr/share/doc/elpa-ess/html/ess.html + +Format: PDF +Files: /usr/share/doc/elpa-ess/ess.pdf.gz + +Format: Info +Index: /usr/share/info/ess.info.gz +Files: /usr/share/info/ess.info*.gz diff -Nru ess-18.10.2/debian/docs ess-18.10.2+git20220915.f45542e/debian/docs --- ess-18.10.2/debian/docs 2018-10-20 21:21:56.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/debian/docs 2022-10-15 16:22:02.000000000 +0000 @@ -1,11 +1,6 @@ -ChangeLog README +ANNOUNCE doc/html -doc/TODO -doc/archive/rmh-talk.tex -doc/archive/slverb.sty -#doc/NEWS -doc/archive/ESS_intro.tex -doc/archive/ajr-talk.tex -doc/archive/ess-intro-graphs.pdf +doc/ess.pdf +doc/readme.pdf doc/refcard/refcard.pdf diff -Nru ess-18.10.2/debian/elpa ess-18.10.2+git20220915.f45542e/debian/elpa --- ess-18.10.2/debian/elpa 2018-08-19 12:40:26.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/debian/elpa 2022-10-15 15:56:36.000000000 +0000 @@ -1,3 +1,2 @@ lisp/*.el -debian/debian-autoloads.el etc diff -Nru ess-18.10.2/debian/elpa-test ess-18.10.2+git20220915.f45542e/debian/elpa-test --- ess-18.10.2/debian/elpa-test 1970-01-01 00:00:00.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/debian/elpa-test 2022-10-27 19:09:01.000000000 +0000 @@ -0,0 +1,13 @@ +ert_load_path = lisp/,test/etest/ + +# Replicate the test environment setup done by test/run-tests. In particular: +# - manually set etest-local-config which is otherwise set through file local +# variables +# - manually load the “literate” tests (except fontification.R which fails) +# Also: +# - set the C locale (assumed by some tests) +# - set a tramp histfile since $HOME is not available +# - move to the test/ subdirectory (needed by some tests) +ert_eval = (progn (require 'ess-test-r-utils) (setq ess-use-flymake nil) (setq ess-inhibit-message-in-tests t) (setq etest-local-config etest-r-config) (require 'ess-test-literate) (elt-deftest test-elt () "elt.R") (elt-deftest test-ess-roxy-literate () "roxy.R") (elt-deftest test-ess-r-misc () "misc.R") (elt-deftest test-ess-r-syntax () "syntax.R") (elt-deftest test-ess-r-tokens () "tokens.R") (elt-deftest test-ess-r-keybindings () "keybindings.R") (setq tramp-histfile-override (make-temp-file "ess-test" 'dir)) (setq tramp-histfile-override (make-temp-file "ess-test" 'dir)) (setenv "LANG" "C") (cd "test")) + +autopkgtest_keep = test/* diff -Nru ess-18.10.2/debian/emacsen-compat ess-18.10.2+git20220915.f45542e/debian/emacsen-compat --- ess-18.10.2/debian/emacsen-compat 2018-08-18 13:44:12.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/debian/emacsen-compat 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -0 diff -Nru ess-18.10.2/debian/ess.maintscript ess-18.10.2+git20220915.f45542e/debian/ess.maintscript --- ess-18.10.2/debian/ess.maintscript 2018-08-18 21:27:02.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/debian/ess.maintscript 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -rm_conffile /etc/emacs/site-start.d/50ess.el diff -Nru ess-18.10.2/debian/ess-pkg.el ess-18.10.2+git20220915.f45542e/debian/ess-pkg.el --- ess-18.10.2/debian/ess-pkg.el 2018-11-10 13:01:43.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/debian/ess-pkg.el 1970-01-01 00:00:00.000000000 +0000 @@ -1,2 +0,0 @@ -(define-package "ess" "18.10.2" "Emacs Speaks Statistics" nil - :url "http://ess.r-project.org" :keywords nil) diff -Nru ess-18.10.2/debian/gbp.conf ess-18.10.2+git20220915.f45542e/debian/gbp.conf --- ess-18.10.2/debian/gbp.conf 1970-01-01 00:00:00.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/debian/gbp.conf 2022-10-15 11:18:16.000000000 +0000 @@ -0,0 +1,7 @@ +[DEFAULT] +debian-branch = debian/latest +upstream-branch = upstream/latest +pristine-tar = True + +[import-orig] +upstream-vcs-tag = v%(version)s diff -Nru ess-18.10.2/debian/info ess-18.10.2+git20220915.f45542e/debian/info --- ess-18.10.2/debian/info 1970-01-01 00:00:00.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/debian/info 2022-10-15 15:03:33.000000000 +0000 @@ -0,0 +1 @@ +doc/info/ess.info* diff -Nru ess-18.10.2/debian/old/dirs ess-18.10.2+git20220915.f45542e/debian/old/dirs --- ess-18.10.2/debian/old/dirs 2018-08-18 13:38:47.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/debian/old/dirs 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -usr/share/emacs/site-lisp/ess diff -Nru ess-18.10.2/debian/old/doc-base ess-18.10.2+git20220915.f45542e/debian/old/doc-base --- ess-18.10.2/debian/old/doc-base 2018-08-18 13:44:16.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/debian/old/doc-base 1970-01-01 00:00:00.000000000 +0000 @@ -1,12 +0,0 @@ -Document: ess -Title: Ess Manual -Author: A.J. Rossini,Richard M. Heiberger,Kurt Hornik,Martin Maechler,Rodney A. Sparapani,Stephen Eglen,Sebastian P. Luque,Henning Redestig -Abstract: ESS is a GNU Emacs and XEmacs mode for interactive statistical programming and data analysis. Languages supported: the S family (S 3/4, S-PLUS 3/4/5/6/7, and R), SAS, XLispStat, Stata and BUGS. -Section: Science/Data Analysis - -Format: Text -Files: /usr/share/doc/ess/README* - -Format: HTML -Index: /usr/share/doc/ess/html/ess.html -Files: /usr/share/doc/ess/html/*.html diff -Nru ess-18.10.2/debian/old/emacsen-install ess-18.10.2+git20220915.f45542e/debian/old/emacsen-install --- ess-18.10.2/debian/old/emacsen-install 2018-08-18 13:59:05.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/debian/old/emacsen-install 1970-01-01 00:00:00.000000000 +0000 @@ -1,64 +0,0 @@ -#! /bin/sh -e -# /usr/lib/emacsen-common/packages/install/ess - -# Written by Jim Van Zandt , borrowing heavily -# from the install scripts for gettext by Santiago Vila -# and octave by Dirk Eddelbuettel . - -FLAVOR=$1 -PACKAGE=ess - -# 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 -# edd 18 Aug 2018 cf #906517 allowing emacs again -case ${FLAVOR} in xemacs*|emacs2[1-3]) - exit 0;; -esac - -echo install/${PACKAGE}: Handling install for emacsen flavor ${FLAVOR} - -FLAVORTEST=$(echo $FLAVOR | cut -c-6) -if [ ${FLAVORTEST} = xemacs ] ; then - SITEFLAG="-no-site-file -no-init-file" -else - SITEFLAG="--no-site-file --no-init-file" -fi -FLAGS="${SITEFLAG} -q -batch -l path.el -l ess-comp.el -f batch-byte-compile" -#FLAGS1="${SITEFLAG} -q -batch -l path.el -l ess-comp.el -l ess-vars.elc -f batch-byte-compile" - -ELDIR=/usr/share/emacs/site-lisp/${PACKAGE} -ELCDIR=/usr/share/${FLAVOR}/site-lisp/${PACKAGE} - -# Install-info-altdir does not actually exist. -# Maybe somebody will write it. -if test -x /usr/sbin/install-info-altdir; then - echo install/${PACKAGE}: install Info links for ${FLAVOR} - install-info-altdir --quiet --section "" "" --dirname=${FLAVOR} /usr/info/${PACKAGE}.info.gz -fi - -install -m 755 -d ${ELCDIR} -cd ${ELDIR} -FILES=$(ls -1 *.el | grep -vx 'ess.el') -## edd 08 Nov 2010 old code -#cp ${FILES} ess.el ${ELCDIR} -#cd ${ELCDIR} -## edd 08 Nov 2010 replaced by this (cf #594750) -cd ${ELCDIR} -#for f in ${ELDIR}/*.el; do -# ln -sf $f . -#done - -cat << EOF > path.el -(setq load-path (cons "." load-path) byte-compile-warnings nil) -EOF -touch Install.log -${FLAVOR} ${FLAGS} ${FILES} >> Install.log 2>&1 -${FLAVOR} ${FLAGS} ess.el >> Install.log 2>&1 -gzip -9fv Install.log -#rm -f *.el path.el - - -exit 0 diff -Nru ess-18.10.2/debian/old/emacsen-remove ess-18.10.2+git20220915.f45542e/debian/old/emacsen-remove --- ess-18.10.2/debian/old/emacsen-remove 2018-08-18 13:38:47.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/debian/old/emacsen-remove 1970-01-01 00:00:00.000000000 +0000 @@ -1,15 +0,0 @@ -#!/bin/sh -e -# /usr/lib/emacsen-common/packages/remove/ess - -FLAVOR=$1 -PACKAGE=ess - -if [ ${FLAVOR} != emacs ]; then - if test -x /usr/sbin/install-info-altdir; then - echo remove/${PACKAGE}: removing Info links for ${FLAVOR} - install-info-altdir --quiet --remove --dirname=${FLAVOR} /usr/info/ess.info.gz - fi - - echo remove/${PACKAGE}: purging byte-compiled files for ${FLAVOR} - rm -rf /usr/share/${FLAVOR}/site-lisp/${PACKAGE} -fi diff -Nru ess-18.10.2/debian/old/emacsen-startup ess-18.10.2+git20220915.f45542e/debian/old/emacsen-startup --- ess-18.10.2/debian/old/emacsen-startup 2018-10-20 21:18:23.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/debian/old/emacsen-startup 1970-01-01 00:00:00.000000000 +0000 @@ -1,39 +0,0 @@ -;; -*-emacs-lisp-*- -;; -;; Emacs startup file for the Debian GNU/Linux ess package -;; -;; Originally contributed by Nils Naumann -;; Modified by Dirk Eddelbuettel -;; Adapted for dh-make by Jim Van Zandt - -;; The following code fixes bug #440194 - thanks to Peter S Galbraith -;; skip loading when -;; not ess is fully installed, as this file still exists when the -;; package is removed but not purged. - -(cond - ((not (file-exists-p "/usr/share/emacs/site-lisp/elpa-src/ess-18.10")) - (message - "Package ess removed but not purged. Skipping setup.")) - ((not (file-exists-p (concat "/usr/share/" - (symbol-name debian-emacs-flavor) - "/site-lisp/elpa/ess-18.10/ess-site.elc"))) - (message "Package ess not fully installed. Skipping setup.")) - (t - ;; The ess package follows the Debian/GNU Linux 'emacsen' policy and - ;; byte-compiles its elisp files for each 'emacs flavor' (emacs19, - ;; xemacs19, emacs20, xemacs20...). The compiled code is then - ;; installed in a subdirectory of the respective site-lisp directory. - ;; We have to add this to the load-path: - (debian-pkg-add-load-path-item - (concat "/usr/share/" (symbol-name debian-emacs-flavor) "/site-lisp/elpa/ess-18.10")) - - ;; As ess_5.12-1 we also link the uncompiled code into that directory so no need to load it - ;; Put the uncompiled code in the path too - ;; (setq load-path (cons (concat "/usr/share/" - ;; (symbol-name debian-emacs-flavor) - ;; "/site-lisp/ess") load-path )) - (require 'ess-site) - ) - ) - diff -Nru ess-18.10.2/debian/patches/add_ess-custom ess-18.10.2+git20220915.f45542e/debian/patches/add_ess-custom --- ess-18.10.2/debian/patches/add_ess-custom 2018-08-19 14:24:41.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/debian/patches/add_ess-custom 1970-01-01 00:00:00.000000000 +0000 @@ -1,40 +0,0 @@ -Description: - TODO: Put a short summary on the line above and replace this paragraph - with a longer explanation of this change. Complete the meta-information - with other relevant fields (see below for details). To make it easier, the - information below has been extracted from the changelog. Adjust it or drop - it. - . - ess (17.11-4) experimental; urgency=medium - . - [David Bremner] - * experimental conversion to dh_elpa - . - [Dirk Eddelbuettel] - * Applied David's patch, adding transition package ess, tweaks - * Still work in progress -Author: Dirk Eddelbuettel - ---- -The information above should follow the Patch Tagging Guidelines, please -checkout http://dep.debian.net/deps/dep3/ to learn about the format. Here -are templates for supplementary fields that you might want to add: - -Origin: , -Bug: -Bug-Debian: https://bugs.debian.org/ -Bug-Ubuntu: https://launchpad.net/bugs/ -Forwarded: -Reviewed-By: -Last-Update: 2018-08-19 - ---- ess-17.11.orig/lisp/ess-bugs-d.el -+++ ess-17.11/lisp/ess-bugs-d.el -@@ -23,6 +23,7 @@ - - ;;; Code: - -+(require 'ess-custom) - (require 'ess-bugs-l) - (require 'ess-utils) - (require 'ess-inf) diff -Nru ess-18.10.2/debian/patches/ess_pkg_version ess-18.10.2+git20220915.f45542e/debian/patches/ess_pkg_version --- ess-18.10.2/debian/patches/ess_pkg_version 2018-08-18 21:12:13.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/debian/patches/ess_pkg_version 1970-01-01 00:00:00.000000000 +0000 @@ -1,35 +0,0 @@ -Description: - TODO: Put a short summary on the line above and replace this paragraph - with a longer explanation of this change. Complete the meta-information - with other relevant fields (see below for details). To make it easier, the - information below has been extracted from the changelog. Adjust it or drop - it. - . - ess (17.11-4) unstable; urgency=medium - . - [David Bremner] - * experimental conversion to dh_elpa - . - [Dirk Eddelbuettel] - * Applied David's patch, further tweaks -Author: Dirk Eddelbuettel - ---- -The information above should follow the Patch Tagging Guidelines, please -checkout http://dep.debian.net/deps/dep3/ to learn about the format. Here -are templates for supplementary fields that you might want to add: - -Origin: , -Bug: -Bug-Debian: https://bugs.debian.org/ -Bug-Ubuntu: https://launchpad.net/bugs/ -Forwarded: -Reviewed-By: -Last-Update: 2018-08-18 - ---- ess-17.11.orig/lisp/ess-pkg.el -+++ ess-17.11/lisp/ess-pkg.el -@@ -1,2 +1,2 @@ --(define-package "ess" "0" "Emacs Speaks Statistics" '((julia-mode "0.3")) -+(define-package "ess" "17.11" "Emacs Speaks Statistics" nil - :url "http://ess.r-project.org" :keywords nil) diff -Nru ess-18.10.2/debian/patches/refcard-clean.patch ess-18.10.2+git20220915.f45542e/debian/patches/refcard-clean.patch --- ess-18.10.2/debian/patches/refcard-clean.patch 1970-01-01 00:00:00.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/debian/patches/refcard-clean.patch 2022-10-22 08:19:14.000000000 +0000 @@ -0,0 +1,17 @@ +Description: Clean auxiliary files generated by pdflatex for refcard.pdf +Author: Sébastien Villemot +Forwarded: https://github.com/emacs-ess/ESS/pull/1230 +Applied-Upstream: https://github.com/emacs-ess/ESS/commit/32e7baf647b4211d1e8d8419af30af3aa9489361 +Last-Update: 2022-10-22 +--- +This patch header follows DEP-3: http://dep.debian.net/deps/dep3/ +--- a/doc/Makefile ++++ b/doc/Makefile +@@ -25,6 +25,7 @@ readme.pdf : $(TEXISRC); $(TEXI2PDF) rea + distclean clean: + @rm -f *.aux *.cp *.cps *.fn *.fns *.ky *.kys *.log *.out \ + *.pg *.pgs *.tmp *.toc *.tp *.vr *.vrs ++ @rm -f refcard/*.aux refcard/*.log + @rm -f $(TXTs) $(PDFs) info/*.info* \ + html/* *.info dir + diff -Nru ess-18.10.2/debian/patches/series ess-18.10.2+git20220915.f45542e/debian/patches/series --- ess-18.10.2/debian/patches/series 2018-10-20 21:02:10.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/debian/patches/series 2022-10-27 19:08:17.000000000 +0000 @@ -1,2 +1,2 @@ -#ess_pkg_version -#add_ess-custom +refcard-clean.patch +testsuite.patch diff -Nru ess-18.10.2/debian/patches/testsuite.patch ess-18.10.2+git20220915.f45542e/debian/patches/testsuite.patch --- ess-18.10.2/debian/patches/testsuite.patch 1970-01-01 00:00:00.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/debian/patches/testsuite.patch 2022-10-27 19:11:01.000000000 +0000 @@ -0,0 +1,71 @@ +Description: Disable or fix some failing tests + In particular: + - in ess-rd-eval-ns-env-test, remove code that uses the company mode (it fails + if the elpa-company package is installed) + - in ess-test-r-startup-directory, disable a test case that fails when in build + chroot for an unknown reason + - in ess-test-r-help-mode, remove (forward-button 2), which curiously triggers + a test failure when *not* in a build chroot +Author: Sébastien Villemot +Forwarded: not-needed +Last-Update: 2022-10-16 +--- +This patch header follows DEP-3: http://dep.debian.net/deps/dep3/ +--- a/test/ess-test-r.el ++++ b/test/ess-test-r.el +@@ -652,7 +652,6 @@ x <- function(x){ + (should (derived-mode-p 'ess-r-help-mode)) + ;; Ensure help buffers after button presses are also in + ;; `ess-r-help-mode', Bug#836 +- (forward-button 2) + (push-button) + (should (or (equal ess-help-object "plot.default") + (equal ess-help-object "plot"))) +@@ -690,10 +689,6 @@ x <- function(x){ + (ert-deftest ess-test-r-startup-directory () + (let ((proj-dir (expand-file-name "..")) + (cur-dir (directory-file-name (expand-file-name default-directory)))) +- (let ((ess-startup-directory nil)) +- (with-r-running nil +- (with-current-buffer (ess-get-process-buffer) +- (should (string= proj-dir (directory-file-name (expand-file-name default-directory))))))) + (let ((ess-startup-directory 'default-directory)) + (with-r-running nil + (with-current-buffer (ess-get-process-buffer) +@@ -886,6 +881,7 @@ https://github.com/emacs-ess/ESS/issues/ + + ;; The assertions in this test DO require an internet connection + (ert-deftest ess-r-load-ESSR-github-fetch-yes () ++ (ert-skip "Disable on Debian because it stalls in a build chroot") + ;; Skip test when performing as part of the CI + (when (equal (getenv "TRAVIS") "true") + (ert-skip "Running on TRAVIS")) +--- a/test/ess-test-r-eval.el ++++ b/test/ess-test-r-eval.el +@@ -245,8 +245,6 @@ TODO: Install company-mode dependency in + :inf-result "" + + :case "si¶" +- (when (require 'company nil 'noerror) +- (company-complete-common)) + :inf-result "" + + :case "¶{ +--- a/test/ess-test-inf.el ++++ b/test/ess-test-inf.el +@@ -145,6 +145,7 @@ + + (etest-deftest ess--command-browser-timeout-test () + "`ess-command' fails with hanging command within browser (#1081)." ++ (ert-skip "Disable on Debian because it fails randomly") + :cleanup (ess-test--browser-cleanup) + (ess-test--browser) + :inf-result "Called from: top level +@@ -302,6 +303,7 @@ new output") + With delimiters it might be possible to figure out the output. + However if they are not available then the output is + indistinguishable from the prompt." ++ (ert-skip "Disable on Debian because it fails randomly") + (should-error (ess-command "cat(1)\n")) + (ess-wait-for-process) + ;; Leaks output after the error but that seems fine since errors in diff -Nru ess-18.10.2/debian/README.Debian ess-18.10.2+git20220915.f45542e/debian/README.Debian --- ess-18.10.2/debian/README.Debian 2018-08-24 12:06:19.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/debian/README.Debian 1970-01-01 00:00:00.000000000 +0000 @@ -1,19 +0,0 @@ -ess (17.11-5) unstable; urgency=medium ---------------------------------------- - -After many years as standard package, 'ess' has (as of August 2018) been -converted to be an ELPA-compatible package 'elpa-ess'. - -You may now need to add a manual - - (require 'ess-site) - -to the top of your '.emacs' file as the package no longer supplies a -common startup file. Alternatively, use - - (package-initialize) - -to initialize this (and other) 'packages' (in the Emacs sense). We -also added it to the autoloads file. - - -- Dirk Eddelbuettel , Fri, 24 Aug 2018 07:06:19 -0500 diff -Nru ess-18.10.2/debian/rules ess-18.10.2+git20220915.f45542e/debian/rules --- ess-18.10.2/debian/rules 2018-11-17 01:55:09.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/debian/rules 2022-10-16 08:30:57.000000000 +0000 @@ -1,107 +1,16 @@ #!/usr/bin/make -f -#-*- makefile -*- -# Made with the aid of dh_make, by Craig Small -# Sample debian/rules that uses debhelper. GNU copyright 1997 by Joey Hess. -# Some lines taken from debmake, by Christoph Lameter. -# Uncomment this to turn on verbose mode. -#export DH_VERBOSE=1 +%: + dh $@ --with elpa -# This is the debhelper compatability version to use. -#export DH_COMPAT=1 - -## edd 16 May 2008 trivial 'orig.tar.gz' creator -## technically, this could be a native Debian package as -## the debian/ is in upstream SVN but it is easier to have -## another degree of freedom for Debian revisions -## if we used just the svn rev: version := $(shell svnversion) -## edd 04 Oct 2008 use changelog entry instead -version := $(shell head -1 debian/changelog | perl -nle 'm/\((\S+)-\d\)/ && print $$1') - -showversion: - @echo Version is ${version} - -tarball: - (cd .. && \ - tar czf tarballs/ess_${version}.orig.tar.gz ess \ - --exclude=.svn \ - --exclude=.git \ - --exclude=debian ) - -build: build-arch build-indep -build-arch: build-stamp -build-indep: build-stamp -build-stamp: - dh_testdir - - chmod -R u+w * - -# $(MAKE) -C doc ess.dvi -# $(MAKE) -C doc readme.dvi -# $(MAKE) -C doc - (cd doc; $(MAKE) all; $(MAKE) info; $(MAKE) pdf; $(MAKE) html; cd -) - - touch build-stamp - -clean: - dh_testdir - dh_testroot - - chmod -R u+w * - - rm -f build-stamp install-stamp doc/*.info* - - [ ! -f Makefile ] || $(MAKE) clean - - rm -f doc/*.dvi #README ANNOUNCE doc/html/readme.html doc/html/ess.html - rm -f doc/refcard/refcard.log doc/refcard/refcard.aux - - rm -f lisp/ess-pkg.el - dh_clean - -install: install-stamp -install-stamp: build-stamp - dh_testdir - dh_testroot - dh_prep - dh_installdirs - -# cd doc ; $(MAKE) install PREFIX=`pwd`/debian/ess -# ! [ -e debian/ess/usr/share/emacs/site-lisp/ess/ess-site.el ] || \ -# chmod u+w debian/ess/usr/share/emacs/site-lisp/ess/ess-site.el -# sed -i -e 's,(defvar ess-etc-directory nil,(defvar ess-etc-directory "/usr/share/ess/etc/",1'\ -# -e 's,(while (and (listp ess-etc,(while (and (not ess-etc-directory) (listp ess-etc,1' \ -# lisp/ess-site.el - cp -vax debian/ess-pkg.el lisp/ - dh_elpa -# mkdir -p debian/elpa-ess/usr/share/ess -# cp -a etc debian/elpa-ess/usr/share/ess/ - (cd debian/elpa-ess/usr/share/emacs/site-lisp/elpa-src/ess-*/etc/ && rm -f BACKBUGS.BAT ess-sas-sh-command backbug*) - - touch install-stamp - -# Build architecture-independent files here. -binary-indep: build install - dh_testdir - dh_testroot - dh_installdocs - dh_installemacsen - dh_installinfo $$(find doc -type f -name "*.info*") - dh_installchangelogs - rm -fv debian/ess/usr/share/doc/elpa-ess/ChangeLog - dh_compress - dh_fixperms - dh_installdeb - dh_shlibdeps - dh_gencontrol - dh_md5sums - dh_builddeb - -# Build architecture-dependent files here. -binary-arch: build install - -source diff: - @echo >&2 'source and diff are obsolete - use dpkg-source -b'; false - -binary: binary-indep binary-arch -.PHONY: build clean binary-indep binary-arch binary install +override_dh_auto_build: +ifeq (,$(filter nodoc,$(DEB_BUILD_OPTIONS))) + make -C doc all html pdf +endif + +# Skip byte compilation by upstream build system +override_dh_auto_install: + +override_dh_auto_clean: + make -C doc clean + rm -f .Rhistory # Generated by the testsuite diff -Nru ess-18.10.2/debian/upstream/metadata ess-18.10.2+git20220915.f45542e/debian/upstream/metadata --- ess-18.10.2/debian/upstream/metadata 1970-01-01 00:00:00.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/debian/upstream/metadata 2022-10-15 16:28:22.000000000 +0000 @@ -0,0 +1,6 @@ +Bug-Database: https://github.com/emacs-ess/ESS/issues +Bug-Submit: https://github.com/emacs-ess/ESS/issues/new +Changelog: https://ess.r-project.org/Manual/news.html +Documentation: https://ess.r-project.org/index.php?Section=documentation&subSection=manuals +Repository: https://github.com/emacs-ess/ESS.git +Repository-Browse: https://github.com/emacs-ess/ESS diff -Nru ess-18.10.2/debian/watch ess-18.10.2+git20220915.f45542e/debian/watch --- ess-18.10.2/debian/watch 2022-06-24 22:23:24.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/debian/watch 2022-10-15 11:18:16.000000000 +0000 @@ -1,7 +1,2 @@ -# format version number, currently 2; this line is compulsory! -version=3 - -# This is one format for an HTTP site, which is the same as the FTP format +version=4 https://ess.r-project.org/downloads/ess/ess-([-0-9\.]*).tgz - - diff -Nru ess-18.10.2/.dir-locals.el ess-18.10.2+git20220915.f45542e/.dir-locals.el --- ess-18.10.2/.dir-locals.el 2018-11-10 09:41:10.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/.dir-locals.el 2022-10-15 08:06:36.000000000 +0000 @@ -6,5 +6,6 @@ (bug-reference-url-format . "https://github.com/emacs-ess/ess/issues/%s") (sentence-end-double-space)) (emacs-lisp-mode - (outline-regexp . "\f\\|\\`;\\|;;\\*\\|;;;\\*\\|(def[cvu]\\|(setq\\|;;;;\\*") - (indent-tabs-mode))) + (outline-regexp . "\f\\|\\`;\\|;;\\*\\|;;;\\*\\|(def[cvum]\\|(setq\\|;;;;\\*") + (indent-tabs-mode)) + (ess-r-mode . ((ess-style . RRR)))) diff -Nru ess-18.10.2/doc/announc.texi ess-18.10.2+git20220915.f45542e/doc/announc.texi --- ess-18.10.2/doc/announc.texi 2018-11-10 09:41:10.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/doc/announc.texi 2022-10-15 08:06:36.000000000 +0000 @@ -6,7 +6,6 @@ @include ess-defs.texi @node Announce -@comment node-name, next, previous, up @chapter ANNOUNCING ESS @cindex ANNOUNCE @@ -18,8 +17,8 @@ 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 +other operating systems. ESS is a package for the GNU Emacs text editor +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 diff -Nru ess-18.10.2/doc/archive/ajr-talk.tex ess-18.10.2+git20220915.f45542e/doc/archive/ajr-talk.tex --- ess-18.10.2/doc/archive/ajr-talk.tex 2018-11-10 09:41:10.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/doc/archive/ajr-talk.tex 1970-01-01 00:00:00.000000000 +0000 @@ -1,469 +0,0 @@ -%% Given in Seattle, at the National Research Center for Statistics -%% and the Environment, and at MathSoft, October 1997. - -\documentclass[semhelv]{seminar} -%% comment out the above and use below, if you have font troubles -%%\documentclass[semlcmss]{seminar} -%%\documentclass{seminar} - -\usepackage{slidesec} -\usepackage[dvips]{graphicx} -%\usepackage{html,heqn,htmllist} % LaTeX2HTML support - -\begin{document} - -\typeout{ } -\typeout{If you have font troubles, comment out line 5 and - uncomment line 7} -\typeout{ } - -\begin{slide} - \slideheading{ESS and Literate Programming: \\ - Tools for Efficient Statistical Programming and Data Analysis} - - \begin{center} - Dr. A.J. Rossini \\ - Statistics Department \\ - University of South Carolina \\ - rossini@stat.sc.edu \\ - % \htmladdnormallink{http://www.stat.sc.edu/\~{}rossini/rsrch/seattle-nrcse/} -% {http://www.stat.sc.edu/\~{}rossini/rsrch/seattle-nrcse/} - \end{center} - - Note: \textbf{ESS} is joint work with: Martin Maechler (ETHZ), Kurt - Hornik (TU-Wien), and Richard M. Heiberger (Temple). -\end{slide} - -\begin{itemize} -\item Thanks also to Bates, Kademan, Ritter (initial versions), and - David Smith (3.x, 4.x). -\end{itemize} - -Recently, I've been giving talks which focus on Computer/Statistician -interfaces, like this one. They tend to get strange responses. This -is not too different from the applied/theoretical Comp Sci situation, -where journals focus both on software practice, as well as on theory. -Practitioners from both groups are also very confused. - -So for today, we will focus on one area of statistical practice, as -opposed to statistical theory (methods/mathematics/data analysis). - -\begin{slide} - \slideheading{Introduction} - - Topics: - \begin{itemize} - \item Computing Environments - \item ESS (=\emph{EMACS Speaks Statistics}), and its capabilities - \item Literate Programming and Literate Data Analysis - \item Links between ESS and Lit Prog - \item Future (planned?) Extensions - \end{itemize} - -\end{slide} - -\begin{itemize} -\item Outline of Talk -\end{itemize} - -\begin{slide} - \slideheading{Computing Environments} - - Computer / Statistician Interface: - \begin{itemize} - \item Command line: keyboard based, minimal mouse usage (SAS (old - style), S-PLUS 3.x, R, XLispStat, Minitab (old style)) - \item Graphical: pointer (mouse)-based, ``point and click'', minimal - keyboard usage (S-PLUS 4, ViSta, Minitab) - \item Mixed Interfaces: S-PLUS 4, SAS, ViSta, Minitab - \end{itemize} - - The \emph{Interface} is dependent on the particular user's practice - (note the repetition of packages). -\end{slide} - - -\begin{itemize} -\item Importance to Statisticians. -\item Issues of efficiency -\end{itemize} - -\begin{slide} - \slideheading{Computing Environments: Design Considerations} - - \begin{itemize} - \item keyboard entry is faster than mouse entry (eventually?) - \item mouse entry is easier than keyboard entry (initially?) - \item At present, keyboard interfaces allow for more - complex/powerful methods, but this is more a function of current - software than a design limitation. - \item Keyboard interfaces generally require memorization of some - commands (at the minimum: those required to find others!). - \end{itemize} -\end{slide} - -\begin{itemize} -\item Not discussing using keyboard as a substitute for a - mouse/pointer-based interface! (i.e. keys to move the pointer, and - to press the pointer buttons). -\end{itemize} - -\begin{slide} - \slideheading{Emacs} - - \begin{itemize} - \item Text Editor (not a word processor) - \item Fully Configurable and Extensible: - \begin{itemize} - \item Communication with system processes - \item Automation of procedures (version control, file comparison) - \item Language-specific customizations - \end{itemize} -\end{itemize} - - Currently, comes in 2 GNU Flavors: - \begin{itemize} - \item Emacs (FSF/RMS developed) - \item XEmacs (derivative of the above, more features, more bloat) - \end{itemize} - -\end{slide} - -Some current modes: -\begin{itemize} -\item \LaTeX -\item C, Fortran, SQL -\item Makefiles -\item version control -\end{itemize} - -XEmacs features: -\begin{itemize} -\item Embeddable images -\item mixed fonts and rich-text (near-WYSIWYG LaTeX document - construction) -\end{itemize} - -\begin{slide} - \slideheading{ESS (=\emph{EMACS Speaks Statistics})} - - A package for Emacs, with the following features: - \begin{itemize} - \item Mode for generating program code for statistical packages - \item Inclusion of statistical processes as inferior processes - controlled through Emacs. - \item Interface for on-line help features for statistical packages - (via calls to the package, standard WWW documentation, etc) - \item Interface for generating, documenting, and reusing transcripts - for data analysis and development sessions. - \end{itemize} - -\end{slide} - -\begin{itemize} -\item Discuss the README -\item What are we trying to do -\end{itemize} - -\begin{slide} - \slideheading{ESS capabilities: programming} - - \begin{itemize} - \item Syntax-based color and font highlighting - \item Access to on-line help facilities when inferior statistical - processes are running; to WWW based facilities when not. - \item Connection to statistical processes, ability to switch - processes (i.e. different instantiations of the same dialect, - different dialects) - \end{itemize} -\end{slide} - -\begin{itemize} -\item to improve code readability. -\item on-line help, split off into a different buffer. -\item connection to different processes: - \begin{itemize} - \item to compare different results - \item to get different help information - \end{itemize} -\end{itemize} - - -\begin{slide} - \slideheading{ESS capabilities: inferior process} - - \begin{itemize} - \item Syntax-based color and font highlighting - \item Searchable Command History - \item Separate buffers for help output - \item Log (Transcript) of commands - \item Debugging assistance (of source) - \end{itemize} -\end{slide} - -\begin{itemize} -\item to improve code readability. -\item ``Splus -e'' improved. -\item split up output by context (help, etc). -\end{itemize} - -\begin{slide} - \slideheading{ESS capabilities: transcript} - - \begin{itemize} - \item Reuse of transcripts in different dialects, for different - sessions. - \item Commenting of transcripts - \item Comparison of output - \end{itemize} -\end{slide} - -\begin{itemize} -\item One use: authors who are targeting a number of dialects of S, - S-PLUS, and R. -\item Readability -\item comparison of output among different statistical packages. -\end{itemize} - -%\begin{slide} -% \slideheading{ESS: examples} - -% %%\includegraphics[height=3\semin,width=3\semin]{ex1.ps} - -% %%\includegraphics[height=3\semin,width=3\semin]{ex2.ps} - -%\end{slide} - -%Discuss example screen shots. - -\begin{slide} - \slideheading{ESS: future plans} - - \begin{itemize} - \item Improved support for current languages - \item Additional support for other languages (Fiasco/SPSS) - \item Inlined statistical graphics (XEmacs) - \item Object browser (partial implementation exists for SAS, - eventually for S and XLispStat languages). - \item Language independent UI/GUI for data analysis. - \item Language independent UI/GUI for statistical instruction. - \end{itemize} -\end{slide} - -\begin{itemize} -\item ESS as a general purpose statistical GUI -\item ESS as a general purpose statistical instruction/assistance tool - \begin{itemize} - \item Statistical help via WWW - \item Download similar Analyses - \item Guidance via Literate Data analysis - \end{itemize} -\end{itemize} - - -\begin{slide} - \slideheading{Why bother?} - - \begin{itemize} - \item No real need to have a unifying mode (both too much and too - little). - \item Different languages have different syntax - \end{itemize} - \textbf{BUT:} - \begin{itemize} - \item Common, generic interface. - \item Improved documentation is important. - \item To this goal, want to encourage documentation and revision - logs: - \begin{itemize} - \item Revision and Source Control Systems (not discussed: SCCS, - RCS, CVS, PRCS) (automated via Emacs, or manually implemented) - \item Literate Programming (discussed) - \end{itemize} - \end{itemize} -\end{slide} - -\begin{itemize} -\item Why 2 topics? -\item Single common mode for Literate Programming, Literate Data - Analysis. -\item Revision/Source control is extremely useful for keeping track of - document and program changes. But will not be discussed today. -\end{itemize} - -\begin{slide} - \slideheading{Literate Programming: Introduction} - - \begin{itemize} - \item Introduced by D.E.Knuth for developing \TeX (1984) - \item Intent: The task of programming should shift from telling a - computer what to do, to explaining to human beings what we are - doing. - \item Remark: Every use of the word \textbf{programming} (used - before and after this) can be exchanged for the words \textbf{data - analysis}. - \end{itemize} -\end{slide} - -\begin{itemize} -\item Origin -\item Goal: a means to document results. -\item \emph{Data Analysis} can be thought of as the implementation of - a particular type/style of \emph{Programming}. -\end{itemize} - -\begin{slide} - \slideheading{Lit Prog: Example} -{\tiny -\begin{verbatim} -\section{Introduction}\label{intro} - -For regression models with interval-censored data, there is generally no simply means of -conditioning out the nuisance parameter. This nuisance parameter is generally a function of the -baseline cumulative distribution function, such as $\Lambda(t)$, the cumulative hazard function, or -$\Phi(t) = F(t)/S(t)$, the odds function. - -However, with right-censored data under the proportional hazards model, we can condition out the -nuisance parameter. This simplifies and speeds up the resulting estimation. - -The main body of code will be the simulation routine, given by - -<>= - bag.sim <- function(beta,N,nobs,numBSsamp) { - <> ; - <> ; - } -@ %def bag.sim N nobs beta numBSsamp - -This can be divided into dataset generation and analysis sections. - -<>= - for (i in 1:N) { - <> ; - <> ; - } -@ %def i -\end{verbatim} -} -\end{slide} - -\begin{itemize} -\item Basic example of literate programming. -\item document chunks start with '@'. -\item program chunks start with '\verb$<<$' -\end{itemize} - -\begin{slide} - \slideheading{Web Processing} - - \begin{itemize} - \item To get documentation: weave a web (forms: tex, html, etc). - \item To get the code: tangle a web - \end{itemize} - idea: don't want to read or change raw code (and discourage this!); - documentation should tell you everything. -\end{slide} - -\begin{itemize} -\item Not WWW... -\item basically text processing. -\end{itemize} - -\begin{slide} - \slideheading{Statistical Programming and Data Analysis} - - Is there a difference? -\end{slide} - -\begin{itemize} -\item Why literate programming is of interest for data analysis - documentation. -\item at the most, differences just in the intended use of the code. - -\end{itemize} - -\begin{slide} - \slideheading{Requirements in a Literate Programming Tool} - (for statisticians) - - Program: - \begin{itemize} - \item Language independence - \item Platform independence - \end{itemize} - - Statistician: - \begin{itemize} - \item discipline - \item interest - \end{itemize} -\end{slide} - -\begin{itemize} -\item Language independence (examples: S-PLUS, C, Fortran code mixed - interchangeably). -\item Flexible and platform independent -\end{itemize} - -\begin{slide} - \slideheading{Relationship between ESS and Lit Prog} - - Good: - \begin{itemize} - \item Documentation (using AUC-TeX), ease of programmability - \item Ability to test out real code (dump straight into a running - process). - \end{itemize} - Bad: - \begin{itemize} - \item Not fully automated (yet!). - \item learn yet another language (or meta-language). - \end{itemize} - -\end{slide} - -lack of automation implies that one needs to access a command line to -actually produce results. - -\begin{itemize} -\item Current Links -\end{itemize} - -\begin{slide} - \slideheading{Future Extensions: ESS/Lit Prog} - -\end{slide} - -\begin{itemize} -\item Templates -\item Software packaging -\end{itemize} - -\begin{slide} - \slideheading{Where to find} - - \begin{itemize} - \item ESS: http://ess.stat.wisc.edu/ - %%\htmladdnormallink{ESS} {http://www.stat.sc.edu/~rossini/projects/}: - \item Literate Programming: - \begin{itemize} - \item General Information: - http://www.desy.de/ftp/pub/userwww/projects/LitProg.html - %%\htmladdnormallink{General Information} {http://www.desy.de/ftp/pub/userwww/projects/LitProg.html} - %%\htmladdnormallink{http://www.desy.de/ftp/pub/userwww/projects/LitProg.html} {http://www.desy.de/ftp/pub/userwww/projects/LitProg.html} - \item %%\htmladdnormallink{Frequently Asked Questions about Lit - %%Prog}{http://shelob.ce.ttu.edu/daves/faq.html}: - Frequently Asked Questions about Lit Prog: http://shelob.ce.ttu.edu/daves/faq.html - %%\htmladdnormallink{http://shelob.ce.ttu.edu/daves/faq.html} {http://shelob.ce.ttu.edu/daves/faq.html} - \item %% \htmladdnormallink{Noweb} {http://www.cs.virginia.edu/~nr/noweb/intro.html}: - %%\htmladdnormallink{http://www.cs.virginia.edu/~nr/noweb/intro.html} {http://www.cs.virginia.edu/~nr/noweb/intro.html} - Noweb: http://www.cs.virginia.edu/~nr/noweb/intro.html - \end{itemize} - \end{itemize} -\end{slide} - -\begin{itemize} -\item Where to get it. -\end{itemize} - -\end{document} diff -Nru ess-18.10.2/doc/archive/bugs-ms.texi ess-18.10.2+git20220915.f45542e/doc/archive/bugs-ms.texi --- ess-18.10.2/doc/archive/bugs-ms.texi 2018-11-10 09:41:10.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/doc/archive/bugs-ms.texi 1970-01-01 00:00:00.000000000 +0000 @@ -1,58 +0,0 @@ - -See the file @file{README.SPLUS4WIN} as well, for more information and -details. - -@itemize @bullet -@item (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 - -@item (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. - - -@item (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. - -@end itemize Binary files /tmp/tmpygwz1x8l/nasy0cgw6A/ess-18.10.2/doc/archive/ediff-sas.gif and /tmp/tmpygwz1x8l/8fYE79yjPk/ess-18.10.2+git20220915.f45542e/doc/archive/ediff-sas.gif differ Binary files /tmp/tmpygwz1x8l/nasy0cgw6A/ess-18.10.2/doc/archive/ediff-sas.pdf and /tmp/tmpygwz1x8l/8fYE79yjPk/ess-18.10.2+git20220915.f45542e/doc/archive/ediff-sas.pdf differ Binary files /tmp/tmpygwz1x8l/nasy0cgw6A/ess-18.10.2/doc/archive/ess-demo.jpg and /tmp/tmpygwz1x8l/8fYE79yjPk/ess-18.10.2+git20220915.f45542e/doc/archive/ess-demo.jpg differ Binary files /tmp/tmpygwz1x8l/nasy0cgw6A/ess-18.10.2/doc/archive/ess-demo.pdf and /tmp/tmpygwz1x8l/8fYE79yjPk/ess-18.10.2+git20220915.f45542e/doc/archive/ess-demo.pdf differ diff -Nru ess-18.10.2/doc/archive/ess-intro-graphs.bib ess-18.10.2+git20220915.f45542e/doc/archive/ess-intro-graphs.bib --- ess-18.10.2/doc/archive/ess-intro-graphs.bib 2018-11-10 09:41:10.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/doc/archive/ess-intro-graphs.bib 1970-01-01 00:00:00.000000000 +0000 @@ -1,467 +0,0 @@ - - -@InCollection{claer:1997, - author = {Matthias Schwab and Martin Karrenbach and Jon Claerbout}, - title = {Making Scientific Computitations Reproducible}, - booktitle = {Stanford Exploration Porject, Report 92}, - OPTcrossref = {}, - OPTkey = {}, - pages = {317--335}, - OPTpublisher = {}, - year = {1997}, - OPTeditor = {}, - volume = {92}, - OPTnumber = {}, - OPTseries = {}, - OPTtype = {}, - OPTchapter = {}, - OPTaddress = {}, - OPTedition = {}, - month = {November 12}, - OPTnote = {}, - OPTannote = {} -} - -@InProceedings{heiberger:dsc:2001, - author = {Richard M. Heiberger}, - title = {Emacs {S}peaks {S}tatistics: One Interface --- Many Programs}, - booktitle = {Proceedings of the 2nd International Workshop on - Distributed Statistical Computing (DSC 2001)}, - OPTcrossref = {}, - OPTkey = {}, - OPTpages = {}, - year = {2001}, - editor = {Kurt Hornik and Friedrich Leisch}, - OPTvolume = {}, - OPTnumber = {}, - OPTseries = {}, - OPTaddress = {}, - OPTmonth = {}, - organization = {Technische Universit{\"a}t Wien, Vienna, Austria}, - OPTpublisher = {}, - note = {\url{http://www.ci.tuwien.ac.at/Conferences/DSC.html}, - ISSN 1609-395X}, - OPTannote = {} -} - -@InProceedings{rossini:dsc:2001, - author = {A.J. Rossini}, - title = {Literate Statistical Practice}, - booktitle = {Proceedings of the 2nd International Workshop on - Distributed Statistical Computing (DSC 2001)}, - OPTcrossref = {}, - OPTkey = {}, - OPTpages = {}, - year = {2001}, - editor = {Kurt Hornik and Friedrich Leisch}, - OPTvolume = {}, - OPTnumber = {}, - OPTseries = {}, - OPTaddress = {}, - OPTmonth = {}, - organization = {Technische Universit{\"a}t Wien, Vienna, Austria}, - OPTpublisher = {}, - note = {\url{http://www.ci.tuwien.ac.at/Conferences/DSC.html}, - ISSN 1609-395X}, - OPTannote = {} -} - -@article{vell:prat:1989, - Author = {Velleman, Paul F. and Pratt, Paul}, - Title = {A Graphical Interface for Data Analysis}, - Year = 1989, - Journal = {Journal of Statistical Computation and Simulation}, - Volume = 32, - Pages = {223--228}, - Keywords = {Exploratory data analysis} -} - -%% --- WinBUGS --- - -@TechReport{SpieThomBest:1999, - author = {D.J. Spiegelhalter and A. Thomas and N.G. Best}, - title = {WinBUGS Version 1.2 User Manual}, - institution = {MRC Biostatistics Unit}, - year = {1999}, - OPTkey = {}, - OPTtype = {}, - OPTnumber = {}, - OPTaddress = {}, - OPTmonth = {}, - OPTnote = {}, - annote = {WinBUGS cite.} -} - -%%--- Emacs books : -------- - -@Book{RMS:2000, - author = {Richard M. Stallman}, - ALTeditor = {}, - title = {GNU Emacs Manual, for Version 20.7}, - publisher = {Free Software Foundation}, - year = {2000}, - OPTkey = {}, - OPTvolume = {}, - OPTnumber = {}, - OPTseries = {}, - OPTaddress = {}, - edition = {13th}, - OPTmonth = {}, - OPTnote = {}, - annote = {ISBN: 1-882114-07-8} -} - - -%%--- Lisp books : -------- - -@Book{RChassell1999, - author = {Robert Chassell}, - ALTeditor = {}, - title = {Programming in Emacs Lisp: An Introduction}, - publisher = {Free Software Foundation, - \url{ftp://alpha.gnu.org/gnu/emacs-lisp-intro-2.00.tar.gz}}, - year = {1999}, - OPTkey = {}, - OPTvolume = {}, - OPTnumber = {}, - OPTseries = {}, - OPTaddress = {}, - edition = {2nd}, - OPTmonth = {}, - OPTnote = {}, - annote = {ISBN: 1-882114-42-6} -} - - -@Book{PGraham:1996, - author = {Paul Graham}, - ALTeditor = {}, - title = {ANSI Common Lisp}, - publisher = {Prentice Hall}, - year = {1996}, - OPTkey = {}, - OPTvolume = {}, - OPTnumber = {}, - OPTseries = {}, - OPTaddress = {}, - OPTedition = {}, - OPTmonth = {}, - OPTnote = {}, - annote = {Great Lisp book for learning} -} - - - -%%--- The 3 S books : -------- - -@Book{BecRCW88, - author = {Richard A. Becker and John M. Chambers and Allan R. Wilks}, - title = {The S Language; A Programming Environment for Data - Analysis and Graphics}, - publisher = {Wadsworth \& Brooks/Cole}, - address = {Pacific Grove}, - year = 1988 -} - -@Book{ChaJH92, - author = {John M. Chambers and Trevor J. Hastie}, - title = {Statistical Models in S}, - publisher = {Wadsworth \& Brooks/Cole}, - year = 1992 -} - -@Book{ChaJ98, - author = {John M. Chambers}, - title = {Programming with Data; A Guide to the S Language}, - publisher = {Springer-Verlag, New York}, - year = 1998 -} - -%%--------- Other books : ---------------- - -@book{Tier90, - author = "Tierney, Luke", - title = "Lisp-Stat: An Object-Oriented Environment for Statistical - Computing and Dynamic Graphics", - publisher = "John Wiley \& Sons", - year = 1990, - address = "New York" -} - - - -@Book{Cook:Weisberg:1999, - author = {R. Dennis Cook and Sanford Weisberg}, - ALTeditor = {}, - title = {Applied Regression Including Computing and Graphics}, - publisher = {John Wiley \& Sons}, - year = {1999}, - OPTkey = {}, - OPTvolume = {}, - OPTnumber = {}, - OPTseries = {}, - OPTaddress = {}, - OPTedition = {1}, - month = {August}, - OPTnote = {}, - OPTannote = {ISBN 0-471-31711-X} -} - -%% Literate Programming and Tools - -@Book{Knuth:1992, - author = {Donald E. Knuth}, - ALTeditor = {}, - title = {Literate Programming}, - publisher = {Center for the Study of Language and Information}, - year = {1992}, - OPTkey = {}, - OPTvolume = {}, - number = {27}, - series = {CSLI Lecture Notes}, - OPTaddress = {}, - OPTedition = {}, - OPTmonth = {}, - OPTnote = {}, - OPTannote = {Primary citation for literate programming} -} - -@Article{NRamsey:1994, - author = {Norman Ramsey}, - title = {Literate programming simplified}, - journal = {IEEE Software}, - year = {1994}, - OPTkey = {}, - volume = {11}, - number = {5}, - pages = {97--105}, - month = {September}, - OPTnote = {}, - OPTannote = {Primary Noweb citation} -} - -%%-------------- Web Citations ------------- - - -%%-------------- Articles, Reports --------------- - -@article{youn:lubi:1995, - Author = {Young, Forrest W. and Lubinsky, David J.}, - Title = {Guiding Data Analysts With Visual Statistical - Strategies (Disc: P251--260)}, - Year = 1995, - Journal = {Journal of Computational and Graphical Statistics}, - Volume = 4, - Pages = {229--250}, - Keywords = {Graphics; Software; [Artificial intelligence]; - [Cognitive science]; [Hypertext]; [Lisp-Stat]; - [Program visualization]; [Statistical system - design]; [ViSta]; [Visual programming]} -} - -@inproceedings{youn:fald:mcfa:1992, - Author = {Young, Forrest W. and Faldowski, Richard A. and - McFarlane, Mary M.}, - Title = {{ViSta}: {A} Visual Statistics Research and - Development Testbed}, - Year = 1992, - Booktitle = {Computing Science and Statistics. Proceedings of the - 24rd Symposium on the Interface}, - Publisher = {Interface Foundation of North America (Fairfax - Station, VA)}, - Pages = {224--233}, - Keywords = {Graphics; Software} -} - -@article{ihak:gent:1996, - Author = {Ihaka, Ross and Gentleman, Robert}, - Title = {R: {A} Language for Data Analysis and Graphics}, - Year = 1996, - Journal = {Journal of Computational and Graphical Statistics}, - Volume = 5, - Pages = {299--314}, - Keywords = {Computer language; Statistical computing} -} - - -@TechReport{ross:lunt:2001, - author = {Rossini, A.J. and Lunt, Mark}, - title = {Literate Statistical Analysis}, - institution = {University of Washington, Biostatistics}, - year = 2001 -} - -%% --- Omegahat - -@Article{DTLang:2000, - author = {Duncan {Temple Lang}}, - title = {The Omegahat Environment: New Possibilities for Statistical Computing}, - journal = {Journal of Computational and Graphical Statistics}, - year = {2000}, - OPTkey = {}, - volume = {9}, - number = {3}, - OPTpages = {}, - month = {September}, - OPTnote = {}, - annote = {primary citation for Omegahat} -} - -%% --- Stata - -%% StataCorp. 1999. Stata Statistical Software: Release 6.0. College -%% Station, TX: Stata Corporation. - -@Misc{Stata:6.0, - OPTkey = {}, - author = {StataCorp}, - title = {Stata Statistical Software: Release 6.0}, - OPThowpublished = {}, - OPTmonth = {}, - year = {1999}, - note = {College Station, TX: Stata Corporation}, - OPTannote = {primary citation for Stata} -} - -@Misc{Stata:7.0, - OPTkey = {}, - author = {StataCorp}, - title = {Stata Statistical Software: Release 7.0}, - OPThowpublished = {}, - OPTmonth = {}, - year = {2000}, - note = {College Station, TX: Stata Corporation}, - OPTannote = {primary citation for Stata} -} - -%% --- SAS - -@Misc{SAS:8, - OPTkey = {}, - author = {{SAS Institute Inc.}}, - title = {\textsc{SAS}$^{\mbox{\scriptsize{\textregistered}}}$ - Software Version 8}, - OPThowpublished = {}, - OPTmonth = {}, - year = {1999}, - note = {Cary, NC, USA: SAS Institute Inc.}, - OPTannote = {primary citation for SAS} -} - -%% --- BUGS --- - -@Book{BUGS, - author = {{MRC Biostatistics Unit}}, - title = {Bayesian Inference Using {G}ibbs Sampling (BUGS)}, - year = {1996--2001}, - publisher = {\url{http://www.mrc-bsu.cam.ac.uk/bugs/welcome.shtml}}, - annote = {primary cite for BUGS} -} - -%% --- XEmacs --- - -@Book{XEmacs, - author = {{The XEmacs Project}}, - title = {XEmacs 21}, - year = {2001}, - publisher = {\url{http://www.xemacs.org}}, - annote = {primary cite for XEmacs} -} - -%% --- GNU Emacs --- - -@Book{GNU-Emacs, - author = {{Free Software Foundation}}, - title = {Emacs 21}, - year = {2001}, - publisher = {\url{http://www.gnu.org/software/emacs/emacs.html}}, - annote = {primary cite for GNU Emacs} -} - -%% --- S-PLUS - -@Misc{Splus, - OPTkey = {}, - author = {{Insightful Corp.}}, - title = {S-{P}LUS Statistical Software: Release 6.0}, - OPThowpublished = {}, - OPTmonth = {}, - year = {2001}, - note = {Seattle, WA: MathSoft}, - OPTannote = {primary citation for S-PLUS} -} - -%% --- R - -@Misc{R, - author = {{R Development Core Team}}, - title = {R 1.6.0}, - month = {October}, - year = 2002, - url = {http://www.R-project.org/}, -} - -%% --- ESS - -@Book{ESS, - author = {A.J. Rossini and Martin M{\"a}chler and Kurt - Hornik and Richard M. Heiberger and Rodney A. Sparapani}, - title = {{ESS (Emacs Speaks Statistics)}}, - year = {2002}, - publisher = {\url{http://www.analytics.washington.edu/downloads/ess/}}, - note = {This is the url for downloading the current release of ESS.} -} - -@Misc{SASMODE, - OPTkey = {}, - author = {Tom Cook}, - title = {{SAS} mode for {Emacs}}, - OPThowpublished = {}, - OPTmonth = {}, - year = {1995}, - note = {\url{ftp://ftp.biostat.wisc.edu/pub/cook/sas-mode/sas.tar.gz}}, - OPTannote = {primary citation for SAS mode} -} - - - -@TechReport{RMHHS:2001, - author = {A.J. Rossini and Martin M{\"a}chler and Kurt - Hornik and Richard M. Heiberger and Rodney A. Sparapani}, - title = {Emacs {S}peaks {S}tatistics: A Universal Interface for - Statistical Analysis}, - institution = {University of Washington Biostatistics}, - year = {2001}, - OPTkey = {}, - OPTtype = {}, - number = {173}, - OPTaddress = {}, - OPTmonth = {}, - note = {\url{http://www.bepress.com/cgi/viewcontent.cgi?article=1002&context=uwbiostat}}, - OPTannote = {Technical report describing ESS} -} - -@Comment @Misc{RMHHS:2001, -@Comment OPTkey = {}, -@Comment author = {A.J. Rossini and Martin M{\"a}chler and Kurt -@Comment Hornik and Richard M. Heiberger and Rodney A. Sparapani}, -@Comment title = {Emacs {S}peaks {S}tatistics: A Universal Interface for -@Comment Statistical Analysis}, -@Comment howpublished = {University of Washington Biostatistics Technical Report \#164}, -@Comment OPTmonth = {}, -@Comment year = {2001}, -@Comment note = {\url{http://software.biostat.washington.edu/statsoft/ess/ess-techrep.pdf}}, -@Comment OPTannote = {Technical report describing ESS} -@Comment } - -@Misc{heiberger:philasugi:2001, - OPTkey = {}, - author = {Richard M. Heiberger}, - title = {{ESS (Emacs Speaks Statistics)} as a User Interface to {SAS}}, - OPThowpublished = {}, - OPTmonth = {}, - year = {2001}, - howpublished = {\url{http://philasug.org/Heiberger/ESS.htm}}, - note = {Presentation to Philadelphia SAS User's Group, - November 12, 2001} -} Binary files /tmp/tmpygwz1x8l/nasy0cgw6A/ess-18.10.2/doc/archive/ess-intro-graphs.pdf and /tmp/tmpygwz1x8l/8fYE79yjPk/ess-18.10.2+git20220915.f45542e/doc/archive/ess-intro-graphs.pdf differ diff -Nru ess-18.10.2/doc/archive/ess-intro-graphs.tex ess-18.10.2+git20220915.f45542e/doc/archive/ess-intro-graphs.tex --- ess-18.10.2/doc/archive/ess-intro-graphs.tex 2018-11-10 09:41:10.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/doc/archive/ess-intro-graphs.tex 1970-01-01 00:00:00.000000000 +0000 @@ -1,1136 +0,0 @@ -\documentclass{article} - -\newif\ifMM\MMtrue -\MMfalse -\newif\ifdraft -% During writing: a draft: -%\drafttrue -% FINAL: -\draftfalse \ifMM\drafttrue\fi - -\ifdraft %% generate tableofcontents down to the \paragraph -\setcounter{tocdepth}{5} -\fi -%1. introduction -% a) a statistician's needs -% b) statistical analysis packages supported by ESS -%2. emacs -% a) buffers -% b) key sequences -% c) modes -% 1) font-lock -% 2) shell/comint -% 3) ange-ftp/EFS/tramp -% 4) vc/pcl-cvs -%3. ESS -% a) interactive -% 1) S family -% 2) SAS -% b) batch -% 1) SAS -% 2) BUGS -% 3) S family -%4. ESS as an open-source project -% a) origins -% 1)S-mode -% 2)SAS-mode -% b) unification -% 1)ESS-mode -% 2)Emacs/XEmacs -% 3)Unix/Windows/Mac -%5. conclusion -% a) summary -% b) what's next for ESS -% ESS internet resources -% a) home page -% b) ess-help -% c) anonymous cvs -% References -% -\ifdraft - \addtolength{\topmargin}{-1cm} - \addtolength{\textheight}{+1cm} -\else%FINAL: - \renewcommand{\baselinestretch}{1.5} -\fi -\addtolength{\oddsidemargin}{-0.5in} -\addtolength{\textheight}{0.2in} -\addtolength{\textwidth}{1in} -\ifMM\addtolength{\textheight}{2cm}\fi - -%%% -\usepackage[authoryear,round]{natbib} -%or (if you have an unshiny latex installation) -%\newcommand{\citep}[1]{{\{\sf#1\}}} -%%% -\usepackage{alltt} - -%% Postscript fonts -\usepackage{times} -\usepackage{graphicx} -%\DeclareGraphicsExtensions{.jpg,.pdf,.png,.mps,.ps} -\DeclareGraphicsRule{.ps}{eps}{.ps.bb}{} -\DeclareGraphicsRule{.ps.Z}{eps}{.ps.bb}{'/bin/zcat -c #1} -%\graphicspath{{jcgs/}} -%\usepackage{psfig} - -\ifx\pdfoutput\undefined - %% Stuff wout hyperref - \def\url#1{\stexttt{#1}} % To help fit in lines ?AJR: stextsf? -\else - %% Stuff with hyperref - \usepackage{hyperref} - %%\hypersetup{backref,colorlinks=true,pagebackref=true,hyperindex=true} - \hypersetup{backref,colorlinks=false,pagebackref=true,hyperindex=true} -\fi -%%---End of package requiring ---------- Own Definitions ------------- - -\newcommand*{\regstrd}{$^{\mbox{\scriptsize{\textregistered}}}$} -\newcommand*{\tm}{$^{\mbox{\scriptsize\sc tm}}$} -\newcommand*{\SAS}{\textsc{SAS}} -\newcommand*{\Splus}{\textsc{S-Plus}} -\newcommand*{\XLispStat}{\textsc{XLispStat}} -\newcommand*{\Stata}{\textsc{Stata}} -\newcommand*{\Rgui}{\textsc{Rgui}} -\newcommand*{\Perl}{\textsc{Perl}} -\newcommand*{\Fortran}{\textsc{Fortran}} -\newcommand*{\Scmt}[1]{\hbox{\qquad {\footnotesize \#\#} \textsl{#1}}} -\newtheorem{defn}{Definition}[section] -\newtheorem{ex}{Example}[section] - -\newcommand{\stexttt}[1]{{\small\texttt{#1}}} -\newcommand{\ssf}[1]{{\small\sf{#1}}} -\newcommand{\elcode}[1]{\\{\stexttt{\hspace*{2em} #1}}\\} -\newcommand{\file}[1]{`\stexttt{#1}'} -\newcommand{\US}{{\char'137}} % \tt _ -\newcommand{\marpar}[1]{\marginpar{\raggedright#1}} -\newenvironment{Salltt}{\small\begin{alltt}}{\end{alltt}} - -\newcommand{\emptyfig}{ -\hspace*{42pt}\rule{324pt}{.25pt}\\ -\hspace*{42pt}\rule{.25pt}{10pc} -\rule{316pt}{.25pt} -\rule{.25pt}{10pc}} - -\newcommand{\ESSfig}[1]{\centering{#1}} - -%% Use \begin{Comment} .. \end{Comment} for internal comments -\ifdraft -\newenvironment{Comment}{\begin{quote}\small\itshape }{\end{quote}} -% -\else %% this requires - \usepackage{verbatim} - \let\Comment=\comment - \let\endComment=\endcomment -\fi - - -%%--------------------------------------------------------------- Start Text - -\title{Emacs Speaks Statistics (ESS): A multi-platform, multi-package -intelligent environment for statistical analysis} - -%%For blinded submission: -%\author{anonymous} - -%%For regular review: -\author{A.J. Rossini \and Richard M. Heiberger \and Rodney A. Sparapani -\and Martin M{\"a}chler \and Kurt Hornik \footnote{% -%% - A.J. Rossini is Research Assistant Professor in the Department of - Biostatistics, University of Washington and Joint Assistant Member at - the Fred Hutchinson Cancer Research Center, Seattle, WA, USA - \url{mailto: rossini@u.washington.edu}; -%% - Richard M. Heiberger is Professor in the Department of Statistics at - Temple University, Philadelphia, PA, USA \url{mailto: rmh@temple.edu}; -%% - Rodney A. Sparapani is Senior Biostatistician in the Center for Patient - Care and Outcomes Research at the Medical College of Wisconsin, - Milwaukee, WI, USA \url{mailto: rsparapa@mcw.edu}; -%% - Martin M{\"a}chler is Senior Scientist and Lecturer in the Seminar for - Statistics, ETH Zurich, Zurich, Switzerland - \url{mailto: maechler@stat.math.ethz.ch}; -%% - Kurt Hornik is Professor in the Institut f{\"u}r Statistik, - Wirtschaftsuniversit{\"a}t Wien and the Institut f{\"u}r - Wahrscheinlichkeitstheorie und Statistik, Technische Universit{\"a}t - Wien, Vienna, Austria \url{mailto: Kurt.Hornik@R-project.org}}} - -%%\date{\today} -\date{$ $Date: 2003/10/22 17:34:04 $ $\tiny Revision: 1.255$ $} - -\begin{document} - -%% To cite everything -%%\nocite{*} - -\ifdraft -\setcounter{page}{0} -%%\newpage -\tableofcontents -\fi - -\maketitle - -\ifdraft{}%% large line skip -- not for draft -\else%FINAL: - \renewcommand{\baselinestretch}{1.5} - %%- \baselineskip=2pc -\fi - -\begin{abstract} - Computer programming is an important component of statistics - research and data analysis. This skill is necessary for using - sophisticated statistical packages as well as for writing custom - software for data analysis. Emacs Speaks Statistics (ESS) provides - an intelligent and consistent interface between the user and - software. ESS interfaces with SAS, S-PLUS, R, and other statistics - packages under the Unix, Microsoft Windows, and Apple Mac operating - systems. ESS extends the Emacs text editor and uses its many - features to streamline the creation and use of statistical software. - ESS understands the syntax for each data analysis language it works - with and provides consistent display and editing features across - packages. ESS assists in the interactive or batch execution by the - statistics packages of statements written in their languages. Some - statistics packages can be run as a subprocess of Emacs, allowing - the user to work directly from the editor and thereby retain a - consistent and constant look-and-feel. We discuss how ESS works and - how it increases statistical programming efficiency. -\end{abstract} - -\noindent Keywords: Data Analysis, Programming, -S, \SAS, \Splus, R, \XLispStat, \Stata, BUGS, Open Source Software, -Cross-platform User Interface. - -\section{Introduction} -\label{sec:introduction} - -Most statistical research activities, particularly data analysis and -communication, involve some form of computing. The computer user -interface is thus placed in the central role of facilitating -statistical tasks. While presentation of character and graphical -information is the most visual component of a user interface, -perhaps a more critical component is how the computer interprets user -input. A familiar, well-understood set of input behaviors can provide -large gains in efficiency. This paper introduces Emacs Speaks -Statistics (ESS) \citep{ESS}, a software package which provides a -common interface to a variety of statistical packages on the most -common computing platforms. - -ESS is an interface to statistical packages that provides tools which -facilitate both statistical software development and data analysis. -ESS provides assistance with both writing and evaluation of analysis -code for both interactive and batch statistical packages. ESS -currently supports the S family of languages (including S -\citep{BecRCW88,ChaJH92,ChaJ98}, \Splus\regstrd\ \citep{Splus}, and R -\citep{ihak:gent:1996,R}; \SAS\regstrd\ \citep{SAS:8}; \Stata\ -\citep{Stata:7.0}; \XLispStat\ \citep{Tier90} and its extensions Arc -\citep{Cook:Weisberg:1999} and ViSta \citep{youn:fald:mcfa:1992}; BUGS -\citep{BUGS}; and Omegahat \citep{DTLang:2000}. ESS can be extended -to accommodate most statistical packages which provide either an -interactive command-line or process batch files for instructions. - -We start by describing the Emacs text editor, the underlying platform -on which ESS is built. Next, we discuss how ESS enhances a -statistician's daily activities by presenting its features and showing -how it facilitates statistical computing. We conclude with a short history -of the development of ESS. -% and conclude with future extensions and related work. - -\section{Emacs} -\label{sec:emacs} - -Emacs is a mature, powerful, and extensible text editing system which -is freely available, under the GNU General Public License (GPL), for a -large number of platforms, including most Unix\regstrd -distributions, Microsoft Windows\regstrd\ and Apple Mac\tm\ OS. There -are two open-source implementations of Emacs: GNU Emacs -\citep{GNU-Emacs} and XEmacs \citep{XEmacs}. Emacs shares many -features with word processors, and some characteristics with operating -systems, including many facilities which go beyond ordinary text -editing. More important to our goals, Emacs can control and interact -with other programs. - -\paragraph{Keyboard and Mouse Input.} -When Emacs was originally written, character-based terminals were the -most advanced method of computer access. Common Emacs commands were -mapped to key sequences, creating keyboard shortcuts for convenience. -Over the last decade, Emacs has been extended to use graphical -windowing systems, such as X11\tm, Microsoft Windows, and Apple Mac -OS, which allow additional forms of input, for example using a mouse, -and which encourage multiple applications to share a single display. -Presently, Emacs is more often used with a GUI, with commands bound to -mouse actions, but having commands also associated with key sequences -is an important ergonomic and time-saving feature. Emacs menus and -toolbars on the display screen allow mouse access to frequently used -actions and provide a graphical alternative when the user does not -know or can not recall a key sequence; these are also subject to -user-customization. - -\paragraph{Buffers give Emacs control.} -Emacs buffers are the interface between the user and computer. They -can be considered to be a collection of scratch pads that both the -user and computer can read, write, and respond to. The user can -simultaneously edit many files and control numerous programs by -opening multiple buffers. With disk files, the working copy of the -opened file is placed in an Emacs buffer where it can be viewed and -edited either by the user or automatically by Emacs or another program -under the control of Emacs. Emacs can save a backup of the contents -to disk at specified intervals. Emacs presents buffer contents in -ways which optimize reading and navigation activities. One example of -program control is the embedding of the interactive operating system -command line interpreter, called a shell, within Emacs. Variations on -this theme are used to control programs such as statistical packages -which take input from and provide output to the command-line. The -resulting buffers provide a copy of the entire transcript of the -interaction, which can be edited and searched while the program -executes. - -\paragraph{Major and Minor Modes.} -Emacs capabilities are extended by loading -%% AJR: If we remove ``or byte-compiled'' we need to remove ``text'', -%% since it is wrong. -%% text -%% or byte-compiled -files containing commands and functions written in Emacs Lisp (elisp) -\citep{RChassell1999}, which is a dialect of Lisp -\citep{PGraham:1996}. Emacs commands can be called interactively by -pressing a key sequence mapped to the command or by name. -%% AJR: this is actually true for M-x long-command-not-bound-to-keys, -%% but I'm not telling anyone this! -% Rodney: I don't understand what the problem is with telling them. -The most important extensions to Emacs take the form of modes, which -provide specific enhancements to the editing behavior. - -Major modes provide a customized environment consisting of mapped key -sequences and associated commands for performing tasks such as file -editing, reading mail, or browsing disk directories. Only one major -mode can be active for a given buffer at any time. Major modes also -can be written to intelligently control other programs such as -statistics packages. Major modes for file editing are often -determined by the file type or extension, i.e. the characters at the -end of the file name that follow a period like \stexttt{txt}, -\stexttt{s}, or \stexttt{sas}. Examples of this kind of major mode are -\stexttt{ESS[S]} and \stexttt{ESS[SAS]}. Major modes understand a -file's syntax and grammar and therefore provide intelligent -actions such as automatic indentation; navigation in units of -characters, words, lines, sentences, paragraphs, function definitions, -and pages; syntax-based fontification and colorization; and -reformatting based on programmed conventions. - -Minor modes provide complementary services that that are applicable -across major modes. Many minor modes can be active at once. For -example, \stexttt{font-lock-mode} allows Emacs to highlight, with -fonts or colors, the syntax of a programming language whose -characteristics are described within a major mode like -\stexttt{ESS[S]}. The \stexttt{overwrite-mode} determines whether -typed characters replace the existing text or are inserted at the -cursor. Minor modes can emulate the key sequences used by another -editor such as \stexttt{vi}. In addition, they can be used to perform -version control operations and many other operations which are nearly -identical across file types. - -\paragraph{Network Support.} -Emacs allows transparent access to remote files over a network. This -means that the user views, edits, and saves files on a remote machine -exactly as if they were on the local machine. Mechanisms for both -open (\stexttt{ange-ftp} and \stexttt{EFS} use ftp) and secure -(\stexttt{tramp} uses scp or ssh) access are available. Emacs can -also monitor and control remote processes running in a shell buffer. - -\paragraph{Editing Extensions.} -Most programming and documentation tasks consist of editing text. -These tasks can be enhanced by contextual highlighting and recognition -of special reserved words appropriate to the programming language in -use. In addition, Emacs also supports folding, outlining, tags, and -bookmarks, all of which assist with maneuvering around a file. Emacs -shares many features with word processing programs and cooperates with -markup-language document preparation systems such as \LaTeX, -\textsc{html}, or \textsc{xml}. - -Tracking changes to a text file made by multiple users, potentially in -different locations, is the job of source-code control programs. -Emacs interacts with standard source-code control programs such as CVS, RCS, -and SCCS through minor modes such as \stexttt{vc-mode}. These -source-code control systems facilitate documenting and tracking edits and -changes to a file. More importantly, they allow for branching and -merging of versions so that material present in an older version of -the file can be recovered and inserted into a newer version in a -fairly easy manner. - -Comparison of files, two or three drafts of a paper for example, is -simplified by \stexttt{ediff}. -An example is shown in Figure \ref{f.ediff}. -The lines that are similar are highlighted in the two -buffers, one for each file, and the specific words that mismatch are -highlighted in a contrasting color. \stexttt{ediff} has many tools -for working with the differences in files and in entire directories. -When combined with the patch utility or a source-code control system, -it provides the user with the ability to insert, delete or modify only -the differing portions of text files. - -\begin{figure}[tbp] - \ESSfig{\includegraphics[angle=270,width=\textwidth]{ediff-sas}} -%\url{http://software.biostat.washington.edu/ess/doc/figures/ediff-sas.gif} - \caption{Ediff of two versions of a file.} - \label{f.ediff} -\end{figure} - -% Rodney: You can't just mention complex functionality like etags and -% speedbar. We would need to introduce these packages. Since they -% aren't critical to ESS at this time, let's ignore them. -Emacs has many other important features. Emacs provides file-manager -capabilities, such as \stexttt{dired} (discussed in Major and Minor -Modes above) and \stexttt{speedbar}, both of which interface to the -computer's directory structure. Emacs stores the complete history of -commands issued in an editing session, allowing a flexible and fairly -complete undo capability. More importantly, for modes which control -processes, the process input history is stored for recall as well as -for later editing for printing or re-use. Emacs also includes web -browsers, mail/newsgroup readers, and spell checking. - -In addition to being an extremely powerful editor, Emacs also -includes capabilities usually found in an operating system. Thus, it -provides a strong foundation for constructing an integrated -development environment focused on the needs of statisticians. Emacs' -power, flexibility, portability, and extensibility make it a solid -platform on which to construct a statistical analysis user interface. - -\section{ESS extends Emacs} -\label{sec:ess-extends-emacs} - -Statistical programming is the writing of computer programs for data -analysis and processing. These programs might be written in a -computer language that requires a compiler, such as \Fortran\ or C. -But, more likely, they are written in a statistical analysis language -that only requires an interpreter such as R, \SAS, \Stata, or \XLispStat. -General purpose languages such as \Fortran, C/C++, Java, and PERL -have integrated development environments which facilitate writing and -debugging code. - -ESS extends Emacs to provide an integrated development environment for -statistical languages. It offers a single -interface for a variety of statistical computing tasks including -interactive data analysis and statistical programming. -ESS is able to provide a functional and extensible interface -which is uniform and consistent across multiple statistical packages. -This is done by adding shortcuts and features for accelerated editing -of files as well as by interacting with the particular statistical -packages to provide, for example, control of input/output, assistance -with evaluation, and specialized parsing of help files. - -ESS supports the S family (S, \Splus, and R) interactively. \SAS\ and -BUGS are also well supported for batch processing. \Stata\ and -\XLispStat\ (including ARC and ViSta) are supported through -highlighting and process-interfacing. - -\subsection{Features and capabilities} -\label{sec:ESS:features} - -\paragraph{Syntactic highlighting and indentation of source code.} -The programmers task is eased when language constructs (such as -reserved words, function calls, strings, and comments) are visually -identifiable and when lines of code are automatically indented to a -depth appropriate to their context (e.g., if--then clauses, loops). -ESS provides both of these to the programmer by including a -description of the syntax of each supported statistical language in -the form used by \stexttt{font-lock-mode}. - -Figure \ref{f.font} shows an example of font-locking a complicated S -statement. The top panel shows an \stexttt{if} statement with a long -expression in the condition and a multi-line consequence. The keyword -\stexttt{if} is shown in purple, the string \stexttt{"deltat"} in -RosyBrown. The comments are in red. Everything else is in the -standard font. The consequence is indented and the continuations of -the consequence are further indented. The matching parentheses are -shown in green. The cursor is indicated by a solid box. In the -bottom panel, we replaced the matching parenthesis with an unbalanced -bracket. Emacs immediately marks that with the paren-mismatch font, -bright purple in this example. On a black and white terminal we would -use bold, underline, italic, and reverse-video, rather than colors, to -distinguish the fonts. - -% Figure \ref{f.font} shows a black-and-white example of font-locking a -% complicated S statement. The top panel shows an \stexttt{if} -% statement with a long expression in the condition and a multi-line -% consequence. The keyword \stexttt{if} is shown in an underlined font, -% the string \stexttt{"deltat"} in an italic underlined font. The -% comments are in an italic font. Everything else is in the standard -% font. The consequence is indented and the continuations of the -% consequence are further indented. The matching parentheses are marked -% by a bold foreground and a shaded background. The cursor is indicated -% by a solid box. In the bottom panel we replaced the matching -% parenthesis with an unbalanced bracket. Emacs immediately marks that -% with the paren-mismatch font, bright purple on -% a color terminal. - -The font selection and the indentation depth are automatically -supplied by Emacs as the lines are typed. The user has several -options for mapping of colors or fonts to each of the syntactic types. -We selected -% black-and-white font-mapping for display here. On a color terminal -% we might use -purple for the keywords, red for comments, green for matching parens, -and inverse-video purple for mismatched parens. Emacs makes default -choices of colors and ESS provides several other optional schemes. - -\begin{figure}[tbp]%h - \ESSfig{% - \includegraphics[angle=270,width=\textwidth]{font-cor-s} - \includegraphics[angle=270,width=\textwidth]{font-incor-s}% - } -%\url{http://software.biostat.washington.edu/ess/doc/figures/font-cor-s.jpg} -%\url{http://software.biostat.washington.edu/ess/doc/figures/font-incor-s.jpg} - \caption{We illustrate here with fonts and colors appropriate for a - color display. On a black and white terminal we would use bold, - underline, italic, and reverse-video. On a color terminal we - would use a selection of colors.} - \label{f.font} -\end{figure} - -Since S syntax is similar to that of C, ESS uses the Emacs tools for -reformatting S code to match particular styles. Common C format styles, -as well as locally customized styles, are defined by specifying the indentation -level for nested statements, location of open-braces (at the end or at the -beginning of a line), indentation offsets for if-then-else constructs, -and similar characteristics. - -Syntax highlighting can be used to help enforce coding -standards. Figure \ref{f.hilock} illustrates a standard for -\SAS\ programming that says all \stexttt{PROC} statements must use the -\stexttt{DATA=datasetname} option. - -\begin{figure}[tbp] - \ESSfig{\includegraphics[angle=270,width=\textwidth]{hilock-sas}} -%\url{http://software.biostat.washington.edu/ess/doc/figures/hilock-sas.gif} - \caption{Enforce coding standards. The standard here is - that all \stexttt{PROC} statements must use the - \stexttt{DATA=datasetname} option. Lines that satisfy the - standard turn green, lines that don't turn red. - Ambiguous ones turn yellow.} - \label{f.hilock} -\end{figure} - -\paragraph{Process interaction.} -Emacs has historically referred to processes under its control as -``inferior'', accounting for the name inferior ESS (\stexttt{iESS}) to -denote the mode for interfacing with the statistical package. Figure -\ref{f.ess-demo} shows the S language program \stexttt{ess-demo.s} in -the top buffer in \stexttt{ESS[S]} mode and the executing R process in -the bottom buffer \stexttt{*R*}. The \stexttt{iESS} major mode of the -\stexttt{*R*} buffer is crafted for command-line editing. This mode -remembers and uses the command history, allowing for the recall and -searching of previously entered commands. Filename completion for -local directories is also available. - -\begin{figure}[tb] - \ESSfig{\includegraphics[angle=270,width=\textwidth]{ess-demo}} -%\url{http://software.biostat.washington.edu/ess/doc/figures/ess-demo.jpg} - \caption{Line-by-line execution of a command file. The cursor is - placed on a line in the \stexttt{ESS[S]} buffer and then with a single - key sequence - the line is sent to the \stexttt{*R*} buffer for - execution. The output of the package goes directly to the - editable \stexttt{*R*} buffer.} - \label{f.ess-demo} -\end{figure} - -\paragraph{Source-level Debugging.} -ESS facilitates the editing of source code files, sets of commands -written for a statistical analysis package, and allows the user to -load and error-check small sections of source code into the package. -This is done through several mechanisms. First, the presence of -unbalanced parentheses or mismatched/unterminated quotes is -immediately evident with syntactic highlighting of the source code. -Second, functions are provided for simple and consistent execution of -user-specified or natural units of the code (function definitions in S -or \XLispStat, \stexttt{PROC \dots\ RUN;} sections in \SAS). An -error-free evaluation lets the user execute the next section of code; -if errors arise, the user edits the current unit and re-evaluates. -Once the code is verified, an entire buffer, or file, of code can be -sent to the package as a unit. This file can also be used as a batch -file for routine analysis at a later time. Finally, output from the -statistics package is normally captured directly by Emacs and placed -into a buffer from where it can be edited and searched. Particular -forms of output such as requests for help pages and log-file output -can be diverted into special buffers with modes crafted to facilitate -reading. These modes include tools for automatically placing the -cursor on the first \stexttt{ERROR}, for example in \SAS\ and S. - -\paragraph{Interactive transcripts.} -A transcript records all commands entered by the analyst and the -corresponding text-based responses such as tables and comments -generated by the statistics package during an interactive statistical -analysis session. Once a transcript file is generated, for example by -saving an \stexttt{iESS} buffer, \stexttt{transcript-mode} assists -with reuse of part or all of the entered commands. ESS understands -the transcript's syntax, especially the potential prompt patterns used -during the interactive analysis. ESS provides tools to facilitate -editing and re-evaluating the commands directly from the saved -transcript. This is useful both for demonstration of techniques and -for reconstruction and auditing of data analyses. Special ESS -functions can ``clean'' S language transcripts by isolating all input -lines and placing them in a new S language source file. Transcript -cleaning facilitates the use of an exploratory interactive analysis -session to construct functions and batch files for routine analysis of -similar data sets. - -\paragraph{Remote access to statistics packages.} -ESS provides transparent facilities for editing files and running -programs which might reside on numerous remote machines during the -same session. The remote machine could be a different platform than -the local machine. - -\paragraph{Manipulating and Editing Objects (S family).} -For languages in the S family, ESS provides object-name completion of -both user- and system-defined functions and data. ESS can dump and -save objects (user- and system-generated) into formatted text files, -and reload them (possibly after editing). - -\paragraph{Help File Editing (R).} -ESS provides an R documentation mode (\stexttt{Rd-mode}) which assists -in writing help files for R functions, objects, and other topics worth -documenting. \stexttt{Rd-mode} provides the ability to view and -execute code embedded in the help file in the same manner as ESS -handles code from any S language source file. It provides syntax -highlighting and the ability to submit code directly to a running ESS -process, either R or \Splus, for evaluation and debugging. This -latter feature is useful for ensuring that code developed using R runs -under \Splus. - -\paragraph{Cooperation across Multiple Tools.} -Statistical packages are intended for either general statistical -analyses or for specialized forms of statistical analyses. The -specialized statistical packages can be far more efficient for their -intended activities, but this is balanced by their inability to -perform a wide range of general statistical functions. Tightly -coupled inter-operability between general and specialized packages -rarely exists, but such a facility is often desired. For example, a -general purpose package such as R does not perform Bayesian analyses -as easily as BUGS does. On the other hand, BUGS lacks breadth in the -range of analyses and results it can generate. For this reason, BUGS -is often distributed with R packages, like the diagnostic packages -CODA and BOA, which assist with importing and analyzing the results in -R. Another point of contention is the difference in the interfaces -between general packages and specialized packages. ESS helps by -providing a single point of contact to both tools, though the typical -interfaces (interactive for R, batch for BUGS) are different. - -%\item[Rodney:] I can't speak for everyone, but the BUGS users I know are -% .. lots deleted by AJR -%will make sense. Besides, the most pressing need for me is to get -%ESS-elsewhere to work with ESS[BUGS] rather than creating inferior-BUGS. - -%\item[Rich:] How does making ``ESS-elsewhere work with ESS[BUGS]'' differ -%from ``creating inferior-BUGS''? My question is predicated on the assumption -%that ESS-elsewhere is a (generalized) minor-mode that makes the location -%of the program irrelevant. -%See my ESS-elsewhere quibble below. - -%\item[Rodney:] It's the whole batch BUGS vs. interactive BUGS thing. Batch -%BUGS with ESS-elsewhere; interactive BUGS with inferior-BUGS which does not -%and will never exist. If you want to call ``inferior-ESS'' ``ESS-elsewhere'' -%why do you need two different names? ``inferior-ESS'' is a terrible name -%so the change would be fine with me, but you can't have it both ways? Is -%this why you keep saying that ESS-elsewhere works for SAS? See -%response to quibble below. - -%\item[Rich:] -%\stexttt{iESS[SAS]} was designed to mimic as well as possible \stexttt{iESS[S]}. -%I need to read doc/README.SAS to make sure all of its options are represented -%here. --- Not yet done. -%\end{description} -%\end{Comment} - -\paragraph{Simplifying Keymap Differences.} -Simple conflicts between interfaces are exemplified by different key -sequences for editing tasks such as cut, copy, paste, beginning of -line, end of line, etc. These may be the most aggravating because our -fingers are typing ``instinctively'', but differences in interfaces -circumvent this learned behavior. ESS solves this problem by -providing a uniform interface to keyboard actions across the variety -of statistical packages that might be used. That is, the same key -sequences are used for cursor movement, evaluation, and basic tasks -such as loading files for editing. - -\paragraph{Concurrent Use of Multiple Machines and Operating Systems.} -It can be useful to have multiple statistical processes running -simultaneously, either on a single machine or a variety of machines. -This capability assists with large-scale numerical simulations as well -as code design and testing across multiple versions of statistical -software packages. - -\subsection{Interactive Processing.} -\label{sec:interactive} - -The increased popularity of exploratory data analysis as well as the -advent of simple GUIs has made interactive data analysis an important -component to statistical practices. -ESS uses three different approaches for communicating with statistical -packages. - -\paragraph{Inter-Process Communication.} -Packages that use the command-line interface are run as an inferior -process in an Emacs buffer, with the standard input and output of the -package redirected to the buffer. Packages that do not use the -command-line interface must be run as an independent process, possibly -with limited cooperation. - -ESS can use the Windows DDE (Dynamic Data Exchange) protocol to -provide one-way communication directly to packages which function as a -DDE server. ESS can control the actions of the package, but it can not capture -the results directly. Transcripts must be physically copied to an -Emacs buffer to get the transcript editing features. - -Statistical packages that use neither the standard input/standard -output protocol nor DDE can not be directly controlled by Emacs. But, ESS -can still provide an editing environment for these statistical languages. The -user must either manually cut and paste the edited code into the -package or save the edited files and run them in a batch environment. -The Microsoft Windows versions of \SAS, \Stata, and \XLispStat\ are -in this category. - -One useful extension in ESS is relaxation of the requirement that the -statistics program be available on the local machine. ESS provides -both transparent editing of files and execution of statistics packages -on a remote machine with \stexttt{iESS[S]} or \stexttt{iESS[SAS]} (see -below). All the editing and interaction features described for the -local machine work equally well on the remote machine. The -interaction, including all the unique features of working with ESS, -appears to the user as if the program were running on the local -%rmh: The interaction ... appears .... -machine. If the X11 Windowing system is running on the local machine, -it is even possible to bring up visual displays and graphics from -remote Unix systems onto a local Microsoft Windows or Apple Mac -display. - -\paragraph{Interactive S family} -ESS for S family statistical languages, \stexttt{iESS[S]}, -replaces the \Splus\ Commands window or the R GUI window. In addition -to running the S family language process, \stexttt{iESS[S]} mode provides the -same editing features, including syntactic highlighting and -string-search, as the editing mode \stexttt{ESS[S]}. It also provides -an interactive history mechanism; transcript recording and editing; -and the ability to re-submit the contents of a multi-line command to -the executing process with a single keystroke. \stexttt{iESS[S]} is -used with S, \Splus, and R on Unix and with Sqpe and R on Windows. - -The \Splus\ GUI on Windows can be a DDE server. There are two -advantages to using even this limited communication with the \Splus\ -GUI through ESS. First, through \stexttt{ESS[S]} mode the user gets -the full editing capabilities of Emacs. Second, S language commands -% rmh: S, not \Splus, in both places. The {\it language} is S. -% The previous session could be R or ATT S. It is not restricted to \Splus. -are sent from the editing mode \stexttt{ESS[S]} buffer and from -transcript buffers from previous S sessions directly to the GUI -Commands window with the same Emacs key sequences as are used with ESS -on Unix. Hence the user can work in a powerful editing environment -and is protected from the delay and ergonomic challenges of using the -mouse for copy and paste operations across windows. - -\paragraph{Interactive \SAS.} -\stexttt{iESS[SAS]} is a mode that allows text-based \stexttt{PROC} by -\stexttt{PROC} interaction with an inferior buffer running an -interactive \SAS\ session on either the local or a remote computer. -\stexttt{iESS[SAS]} mode works by redirecting standard input and -output from \SAS\ to ESS. Currently, the \stexttt{iESS[SAS]} mode can -run on any computer, but the \SAS\ process it is controlling must be -running on a Unix machine. This process is very efficient for dial-up -network connections to a remote computer with \SAS\ installed. The -resulting interface is similar to the SAS character terminal -interface, but with Emacs key sequences. - -%Rodney: What is this paragraph about? I'm going to comment it out -%because I don't recognize what it is supposed to be. Maybe somebody -%can fix it later. -% -% rmh: Round umpteen. Yes, this is redundant with the third paragraph -% of interprocess communication. I still want it here. Try this rephrasing. -% -\stexttt{ESS[SAS]} mode can be used in conjunction with the \SAS\ -Display Manager to allow simultaneous access to Emacs for editing -\SAS\ language code and to the \SAS\ mouse-based interfaces to the -graphical routines and help system. - -%%%%% AJR: WHY IS THIS SUBSTANTIALLY DIFFERENT THAN BATCH? I KNOW ITS -%%%%% SLIGHTLY DIFFERENT, BUT SUBSTANTIALLY? -%%%%% rmh: this is a form of interaction, not batch. I restored the -%%%%% first paragraph with some expansion. -%\paragraph{\SAS---Interactive cooperation with the \SAS\ Display Manager.} -%ESS users who write data analysis code in \stexttt{ESS[SAS]} mode in Emacs -%often need to work with the \SAS\ Display Manager's -%mouse-based interface to the graphical -%routines, the help system, and other non-text-based features. -%%The authors of ESS prefer the Emacs environment for -%%the text-file interaction with \SAS, that is with editing and -%%managing input command files and output listing and log files, -%%even on computer systems which run -%%the \SAS\ Display Manager environment. -%In this situation, the user -%designs the command file in \stexttt{ESS[SAS]} mode and highlights -%regions to be forwarded to \SAS\ for processing. -%% -%% Rodney: I don't see this as a feature of either ESS or emacs. And, -%% what the authors prefer is certainly not germane. -%% -%% -%% rmh: This is my preferred mode for interacting with SAS. I tried another -%% rephrasing. It {\it is} a feature of ESS. ESS is able to provide ESS[SAS] -%% mode for the text processing (.sas .lst. log files) and simultaneously -%% let the user have interactive graphical access. -%%This can be done by either: -%%\begin{enumerate} -%%\item copying and pasting the marked regions to the \SAS\ Editor window -%% and then pressing the \stexttt{RUN} button. Highlighted sections of -%% the \SAS\ Listing window are brought back to Emacs to be read in the -%% \stexttt{ESSlst} mode editing environment. -%%\item submitting the marked region for Batch File Processing (see the -%% next section) but using the mapped key sequences to append to the log -%% and listing files instead of replacing them. -%%\end{enumerate} - -\subsection{Batch File Processing.} -\label{sec:batch-file} - -Batch file processing with statistical analysis packages is a better -choice than interactive processing when the execution times are longer -than the user is willing to wait as well as for regularly updated -statistical reports and figures. ESS provides a means to shorten the -debugging cycle for writing code intended for batch evaluation by -containing the whole process, both writing and evaluation, within -Emacs. - -\paragraph{Batch \SAS.} -\label{sec:sas-batch} - -\SAS\ is a popular choice for processing and analyzing large amounts -of data. However, interactive \SAS\ is rarely used in these situations -due to the length of time involved. Instead, a file containing \SAS\ -commands is created and \SAS\ executes these commands in the background, -or batch, while the user moves on to other activities. - -ESS facilitates \SAS\ batch with \stexttt{ESS[SAS]}, the mode for files -with the \stexttt{sas} extension. ESS defines \SAS\ syntax so that -\stexttt{font-lock-mode} can highlight statements, procedures, -functions, macros, datasets, comments and character string literals in -\SAS\ programs. Optionally, the same language features are -highlighted in the \SAS\ log with the addition of log notes, warnings -and error messages. - -For files with the \stexttt{sas} extension, ESS binds the function -keys in \stexttt{ESS[SAS]} mode to match the definitions used by \SAS\ -Display Manager. These definitions are optionally available in all -modes. They are particularly useful when viewing \SAS\ log and -listing files (with extensions of \stexttt{log} and \stexttt{lst} -respectively). - -Only one function key press is needed to submit a \SAS\ batch process. -Other function keys open the \SAS\ program, the \SAS\ log and the -\SAS\ listing buffers. When accessed in this manner, the \SAS\ log -and \SAS\ listing buffers are automatically updated since they may -have been appended or over-written by the \SAS\ batch process. In -addition, the \SAS\ log is searched for error messages and the error -messages, if any, are sequentially displayed with consecutive key -presses. - -Another function key opens a \SAS\ permanent dataset for editing or -viewing. An option is provided so that the tab and return keys -operate in typewriter fashion like they do in \SAS\ Display Manager. -This option also defines a key to move the cursor to a previous -tab-stop and delete any characters between its present position and -the tab-stop. This is a \SAS\ Display Manager feature that is not -typically available in Emacs. - -The \SAS\ batch process runs on the computer where the \SAS\ program -resides. This is important because any \SAS\ permanent datasets -referenced in a \SAS\ program only exist on the computer running \SAS. -If the \SAS\ program resides on a remote computer, then the -log and listing are also accessed remotely. The net result is that -running \SAS\ batch on remote computers is nearly transparent to the -ESS user. - -%\begin{Comment} -%Rich's version: -%\end{Comment} -%The \SAS\ batch process can run on the same computer on which the -%emacs session is running or it can run on a remote computer. For -%remote jobs, files are transparently saved (with ftp or scp or kermit) -%and the batch process is transparently submitted through a telnet or -%ssh connection. - -%\begin{Comment} -%Rich: I have some terminology quibbles here with how the term -%``ESS-elsewhere'' is used with SAS BATCH. I think of S-elsewhere or -%ESS-elsewhere as a trick to make a \stexttt{telnet-mode} buffer think -%it is \stexttt{iESS-mode} buffer. - -%I don't think of file saving, editing, and retrieval as an example -%of ESS-elsewhere. Neither is submission of the remote job; -%that is just an ordinary shell command in an ordinary shell buffer. -%M-x SAS probably is an example of ESS-elsewhere, but I -%designed it before I thought of the ESS-elsewhere concept. - -%The initial idea behind S-elsewhere was to run an interactive S or S-Plus -%session on a remote computer in telnet (or equivalent) buffer. The trick -%was to make the \stexttt{telnet-mode} buffer accept C-c C-n and -%related commands from the \stexttt{S-mode} buffers. Hence I had to -%make the \stexttt{telnet-mode} buffer think it is \stexttt{iESS-mode} -%buffer. The ``elsewhere'' part of the name is entirely related to a -%different start up procedure. Once the connection is made, there is -%{\em no} difference visible to the user. The buffer shows itself to -%be an ordinary \stexttt{iESS} buffer. Tony generalized S-elsewhere -%to ESS-elsewhere to allow other languages than S to be used -%interactively. - -%I have been using ESS for SAS remote BATCH for years, ever since you -%and I started working on this together. We initially defined -%ess-sas-submit-method to encapsulate the location of the sas process. -%Except for a few lines of elisp to get the connection started, the user -%behavior has been identical whether the SAS process is on the same or -%different machine. Since we are not interactively talking to the SAS -%process in an inferior-ESS buffer I don't see this as ESS-elsewhere. - -%Rodney: Remote submissions of SAS batch jobs never worked. I only got -%it to work a couple of weeks ago. The problem was with the cd command. -%You need to ignore the beginning and end of the expanded buffer name -%that are the ange-ftp/EFS/tramp stubs which tell Emacs what the remote -%username and hostname are. I find the batch usage of ESS-elsewhere -%entirely consistent with the interactive behavior. OTOH, I don't find -%the terminology particularly illuminating. I think ESS-remote or -%ESS-net would be more meaningful. -%\end{Comment} - -\paragraph{Batch BUGS.} -BUGS software performs Markov Chain Monte Carlo integration. There is -an interactive capability, but it is not often used since the analyses -can be very time-consuming. Most BUGS programs are executed as batch -processes. ESS facilitates BUGS batch with \stexttt{ESS[BUGS]}, the -mode for files with the \stexttt{bug} extension. ESS provides 4 -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. Finally, key sequences are defined to create a command -file and submit a BUGS batch process. - -\paragraph{Batch S family.} -ESS provides 2 facilities for batch processing of S family language files. -The first is to execute the contents of a file using buffer-evaluation. This -differs from interactive processing only by the number of commands -being evaluated; errors can be found by examining the resulting -transcript. The second is the load-source mechanism, which provides a -means of jumping to errors in the source file, but doesn't display the -evaluated commands in the transcript. These mechanisms provide -different tools for debugging the source files. - -\section{History of ESS} -\label{sec:ESS:history} - -ESS is built on Emacs, the editing system for which Richard Stallman -won a MacArthur Foundation Fellowship in 1990. Emacs has a long -history of being a programmer's editor. Many statisticians got their -first taste of the power of Emacs with \Fortran\ mode which was -introduced in 1986. As statisticians' preferences changed from -generalist compiled languages such as \Fortran\ to specialist -statistical analysis packages like S and \SAS, Emacs modes soon -followed. - -The ESS environment is built on the open-source projects of -many contributors, dating back over 10 years. -Doug Bates and Ed Kademan wrote S-mode in 1989 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 M{\"a}chler, 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, which -relies on files rather than standard-input/standard-output, on Unix, -Windows and Mac. In 2001, Sparapani added BUGS batch file processing -to ESS for Unix and Windows. - -This history is summarized in Table \ref{tab:timeline}. - -\begin{table}[tbp] - \centering - {\scriptsize - \begin{tabular}{c ll c ll} -\hline - Year \\ -\hline - & \multicolumn{2}{c}{S-mode} && \multicolumn{2}{c}{SAS-mode} \\ -\cline{2-3} \cline{5-6} - 1989 & v.1 & (GNU Emacs, Unix, S/S+) && \\ - 1990 & & && & (GNU Emacs, Unix, SAS editing) \\ - 1991 & v.2 & (GNU Emacs, Unix, S/S+) && \\ - 1993 & v.3 & (GNU Emacs, Unix, S/S+) && \\ - 1994 & v.4 & (GNU Emacs/XEmacs, Unix, S/S+) && v.1 & (GNU Emacs, Unix, SAS batch) \\ - 1995 & v.4.7 & (GNU Emacs/XEmacs, Unix, S/S+/R) && v.2 & (GNU Emacs/XEmacs, Unix, SAS batch) \\ - \cline{2-6}\\[-3.5ex] - \cline{2-6} - & \multicolumn{5}{c}{Emacs Speaks Statistics (ESS)} \\ - \cline{2-6} - &\multicolumn{2}{c}{Emacs, Operating Systems} &&\multicolumn{2}{c}{Additional Functionality}\\ -\cline{2-3} \cline{5-6} - 1997 & v.5.0 & (GNU Emacs/XEmacs, Unix) &&& Stata, XLispStat, SAS interactive \\ - 1998 & v.5.1.1 & (GNU Emacs/XEmacs, Unix/Windows) &&& S+elsewhere; Windows: S+/R\\ - 1999 & v.5.1.10 & (GNU Emacs/XEmacs, Unix/Windows/Mac) &&& SAS batch; Omegahat \\ - 2001 & v.5.1.19 & (GNU Emacs/XEmacs, Unix/Windows/Mac) &&& Unix/DOS: BUGS batch; Mac: R \\ -%% 2002 & v.5.1.20 & (Emacs/XEmacs, Unix/Windows/Mac) &&& Unix/DOS: BUGS batch, Mac: R \\ -%% 2002 & v.5.2 & (Emacs/XEmacs, Unix/Windows/Mac) &&& ? \\ - \hline - \end{tabular} - } - \caption{History and Ancestors of ESS} - \label{tab:timeline} -\end{table} - - -%\section{Future Work} - -%%%There are two active areas of extensions for user environments. One -%%%is to enhance the capabilities of the IDE for statistical practice; -%%%this includes implementing such common IDE features as object -%%%browsers, tool-tips, and interfacing cleaning. The other is to target -%%%appropriate potentially useful programming methodologies for transfer -%%%to statistical practice. -%%% -%%%Literate Programming methodologies \citep{Knuth:1992,NRamsey:1994} are -%%%a natural fit for statistical practice. We refer to the application -%%%to statistical analysis as Literate Statistical Practice -%%%\citep{rossini:dsc:2001}. The tools used are Noweb -%%%\citep{NRamsey:1994} and either \LaTeX, \textsc{html}, or \textsc{xml} -%%%for documenting and explaining the analysis. This approach to -%%%programming encourages the use of a literary documentation style to -%%%explain the programming code for the data analysis. The program can -%%%then be extracted from the documentation text for realizing the -%%%statistical analysis. - -%%future enhancement perhaps -%%ESS provides the same ESS-elsewhere support for BUGS batch -%%that it does for \SAS\ batch (see above). - -%Important extensions which should be implemented in future -%versions include class browsers, analysis templates, tool-tips, and -%similar features. Class browsers can be thought of as a tree or -%outline for presenting datasets, variables and functions in the -%context of what they represent; this allows for rapid and appropriate -%inspection. Analysis templates would allow statistics centers and -%groups to provide standardized templates for initiating an analysis. - -%Additional statistical packages can easily be added to ESS. - -%%While most IDE features have been developed for object-oriented -%%languages, the above also can apply to non-object oriented -%%programming. - -%ESS is one of the first Rapid Application Development (RAD) -%environments intended for statisticians. It provides - - -\section{Conclusion} -\label{sec:concl} - -ESS provides an enhanced, powerful interface for efficient interactive -data analysis and statistical programming. It allows the user -complete control over the communications among the files in which the -analysis is specified, the statistical process doing the computation, -and the output. Because all are within the same programming -environment, and therefore are accessed with the same editing and -searching concepts and the same key sequences, user efficiency is -increased. It is completely customizable to satisfy individual -desires for interface styles and can be extended to support other -statistical languages and data analysis packages. - -%\begin{Comment} -%Rich: see my discussion of ESS-elsewhere terminology. - -%What is the behavior for remote SAS that is new for 2002? - -%Rodney: SAS batch now works and Kermit was added as a method of transfer. -%\end{Comment} -%ESS-elsewhere provides interactive and batch processing -%with \SAS\ running on a remote machine that is accessed over a -%network. This provides a powerful development environment for \SAS. - -%%This -%%includes support for syntax highlighting and template-based source file -%%generation that provides the capability of specifying all the necessary -%%parameters for a BUGS batch run in a single file. - -\bibliographystyle{plainnat} -\pdfbookmark[1]{References}{section.7} -%\addcontentsline {toc}{section}{\numberline {}References} -\bibliography{ess-intro-graphs} - -\clearpage - -\appendix -\section{Appendix: ESS Resources on the Internet} -%\addcontentsline {toc}{section}{\numberline {}ESS Resources on the Internet} -\label{sec:access} - -\paragraph{Latest Version.} - -ESS is constantly in flux. New versions of statistical -packages, Emacs and operating systems require new releases of ESS to -support them. The latest stable version of ESS can be found on the web at -\url{http://software.biostat.washington.edu/statsoft/ess/}. To get help -with problems, send e-mail to \url{mailto: ess-help@stat.math.ethz.ch}. -The latest development, hence unstable, version can be obtained by -anonymous CVS. First type: - -\stexttt{cvs -d - :pserver:anoncvs@software.biostat.washington.edu:/var/anoncvs login} - -You will be prompted for a password which is ``\stexttt{anoncvs}''. -Then type: - -\stexttt{cvs -d - :pserver:anoncvs@software.biostat.washington.edu:/var/anoncvs co - ess} - -\paragraph{Additional documentation.} - -An expanded version of the present paper is in \citep{RMHHS:2001}. A -general introduction and usage instructions can be found in -\citep{heiberger:dsc:2001}; in addition, one which is more focused on -\SAS\ can be found in \citep{heiberger:philasugi:2001}. The -documentation that comes with ESS provides details of its -implementation as well as examples of its use. - -\end{document} - - -%%% Local Variables: -%%% mode: latex -%%% TeX-master: t -%%% End: Binary files /tmp/tmpygwz1x8l/nasy0cgw6A/ess-18.10.2/doc/archive/ess-intro.pdf and /tmp/tmpygwz1x8l/8fYE79yjPk/ess-18.10.2+git20220915.f45542e/doc/archive/ess-intro.pdf differ diff -Nru ess-18.10.2/doc/archive/ess-intro.tex ess-18.10.2+git20220915.f45542e/doc/archive/ess-intro.tex --- ess-18.10.2/doc/archive/ess-intro.tex 2018-11-10 09:41:10.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/doc/archive/ess-intro.tex 1970-01-01 00:00:00.000000000 +0000 @@ -1,1136 +0,0 @@ -\documentclass{article} - -\newif\ifMM\MMtrue -\MMfalse -\newif\ifdraft -% During writing: a draft: -%\drafttrue -% FINAL: -\draftfalse \ifMM\drafttrue\fi - -\ifdraft %% generate tableofcontents down to the \paragraph -\setcounter{tocdepth}{5} -\fi -%1. introduction -% a) a statistician's needs -% b) statistical analysis packages supported by ESS -%2. emacs -% a) buffers -% b) key sequences -% c) modes -% 1) font-lock -% 2) shell/comint -% 3) ange-ftp/EFS/tramp -% 4) vc/pcl-cvs -%3. ESS -% a) interactive -% 1) S family -% 2) SAS -% b) batch -% 1) SAS -% 2) BUGS -% 3) S family -%4. ESS as an open-source project -% a) origins -% 1)S-mode -% 2)SAS-mode -% b) unification -% 1)ESS-mode -% 2)Emacs/XEmacs -% 3)Unix/Windows/Mac -%5. conclusion -% a) summary -% b) what's next for ESS -% ESS internet resources -% a) home page -% b) ess-help -% c) anonymous cvs -% References -% -\ifdraft - \addtolength{\topmargin}{-1cm} - \addtolength{\textheight}{+1cm} -\else%FINAL: - \renewcommand{\baselinestretch}{1.5} -\fi -\addtolength{\oddsidemargin}{-0.5in} -\addtolength{\textheight}{0.2in} -\addtolength{\textwidth}{1in} -\ifMM\addtolength{\textheight}{2cm}\fi - -%%% -\usepackage[authoryear,round]{natbib} -%or (if you have an unshiny latex installation) -%\newcommand{\citep}[1]{{\{\sf#1\}}} -%%% -\usepackage{alltt} - -%% Postscript fonts -\usepackage{times} -\usepackage{graphicx} -%\usepackage{psfig} - -\ifx\pdfoutput\undefined - %% Stuff wout hyperref - \def\url#1{\stexttt{#1}} % To help fit in lines ?AJR: stextsf? -\else - %% Stuff with hyperref - \usepackage{hyperref} - %%\hypersetup{backref,colorlinks=true,pagebackref=true,hyperindex=true} - \hypersetup{backref,colorlinks=false,pagebackref=true,hyperindex=true} -\fi -%%---End of package requiring ---------- Own Definitions ------------- - -\newcommand*{\regstrd}{$^{\mbox{\scriptsize{\textregistered}}}$} -\newcommand*{\tm}{$^{\mbox{\scriptsize\sc tm}}$} -\newcommand*{\SAS}{\textsc{SAS}} -\newcommand*{\Splus}{\textsc{S-Plus}} -\newcommand*{\XLispStat}{\textsc{XLispStat}} -\newcommand*{\Stata}{\textsc{Stata}} -\newcommand*{\Rgui}{\textsc{Rgui}} -\newcommand*{\Perl}{\textsc{Perl}} -\newcommand*{\Fortran}{\textsc{Fortran}} -\newcommand*{\Scmt}[1]{\hbox{\qquad {\footnotesize \#\#} \textsl{#1}}} -\newtheorem{defn}{Definition}[section] -\newtheorem{ex}{Example}[section] - -\newcommand{\stexttt}[1]{{\small\texttt{#1}}} -\newcommand{\ssf}[1]{{\small\sf{#1}}} -\newcommand{\elcode}[1]{\\{\stexttt{\hspace*{2em} #1}}\\} -\newcommand{\file}[1]{`\stexttt{#1}'} -\newcommand{\US}{{\char'137}} % \tt _ -\newcommand{\marpar}[1]{\marginpar{\raggedright#1}} -\newenvironment{Salltt}{\small\begin{alltt}}{\end{alltt}} - -\newcommand{\emptyfig}{ -\hspace*{42pt}\rule{324pt}{.25pt}\\ -\hspace*{42pt}\rule{.25pt}{10pc} -\rule{316pt}{.25pt} -\rule{.25pt}{10pc}} - -\ifMM\newcommand{\ESSfig}[1]{\centering{#1}} -\else\newcommand{\ESSfig}[1]{\centering\ifdraft\emptyfig\else{#1}\fi} -\fi - -%% Use \begin{Comment} .. \end{Comment} for internal comments -\ifdraft -\newenvironment{Comment}{\begin{quote}\small\itshape }{\end{quote}} -% -\else %% this requires - \usepackage{verbatim} - \let\Comment=\comment - \let\endComment=\endcomment -\fi - - -%%--------------------------------------------------------------- Start Text - -\title{Emacs Speaks Statistics (ESS): A multi-platform, multi-package -intelligent environment for statistical analysis} - -%%For blinded submission: -%\author{anonymous} - -%%For regular review: -\author{A.J. Rossini \and Richard M. Heiberger \and Rodney A. Sparapani -\and Martin M{\"a}chler \and Kurt Hornik \footnote{% -%% - A.J. Rossini is Research Assistant Professor in the Department of - Biostatistics, University of Washington and Joint Assistant Member at - the Fred Hutchinson Cancer Research Center, Seattle, WA, USA - \url{mailto: rossini@u.washington.edu}; -%% - Richard M. Heiberger is Professor in the Department of Statistics at - Temple University, Philadelphia, PA, USA \url{mailto: rmh@temple.edu}; -%% - Rodney A. Sparapani is Senior Biostatistician in the Center for Patient - Care and Outcomes Research at the Medical College of Wisconsin, - Milwaukee, WI, USA \url{mailto: rsparapa@mcw.edu}; -%% - Martin M{\"a}chler is Senior Scientist and Lecturer in the Seminar for - Statistics, ETH Zurich, Zurich, Switzerland - \url{mailto: maechler@stat.math.ethz.ch}; -%% - Kurt Hornik is Professor in the Institut f{\"u}r Statistik, - Wirtschaftsuniversit{\"a}t Wien and the Institut f{\"u}r - Wahrscheinlichkeitstheorie und Statistik, Technische Universit{\"a}t - Wien, Vienna, Austria \url{mailto: Kurt.Hornik@R-project.org}}} - -%%\date{\today} -\date{$ $Date: 2003/10/22 17:34:04 $ $\tiny Revision: 1.255$ $} - -\begin{document} - -%%\ifpdf -%% \DeclareGraphicsExtensions{.jpg,.pdf,.png,.mps} -%%\fi -%%%% To cite everything -%%\nocite{*} - -\ifdraft -\setcounter{page}{0} -%%\newpage -\tableofcontents -\fi - -\maketitle - -\ifdraft{}%% large line skip -- not for draft -\else%FINAL: - \renewcommand{\baselinestretch}{1.5} - %%- \baselineskip=2pc -\fi - -\begin{abstract} - Computer programming is an important component of statistics - research and data analysis. This skill is necessary for using - sophisticated statistical packages as well as for writing custom - software for data analysis. Emacs Speaks Statistics (ESS) provides - an intelligent and consistent interface between the user and - software. ESS interfaces with SAS, S-PLUS, R, and other statistics - packages under the Unix, Microsoft Windows, and Apple Mac operating - systems. ESS extends the Emacs text editor and uses its many - features to streamline the creation and use of statistical software. - ESS understands the syntax for each data analysis language it works - with and provides consistent display and editing features across - packages. ESS assists in the interactive or batch execution by the - statistics packages of statements written in their languages. Some - statistics packages can be run as a subprocess of Emacs, allowing - the user to work directly from the editor and thereby retain a - consistent and constant look-and-feel. We discuss how ESS works and - how it increases statistical programming efficiency. -\end{abstract} - -\noindent Keywords: Data Analysis, Programming, -S, \SAS, \Splus, R, \XLispStat, \Stata, BUGS, Open Source Software, -Cross-platform User Interface. - -\section{Introduction} -\label{sec:introduction} - -Most statistical research activities, particularly data analysis and -communication, involve some form of computing. The computer user -interface is thus placed in the central role of facilitating -statistical tasks. While presentation of character and graphical -information is the most visual component of a user interface, -perhaps a more critical component is how the computer interprets user -input. A familiar, well-understood set of input behaviors can provide -large gains in efficiency. This paper introduces Emacs Speaks -Statistics (ESS) \citep{ESS}, a software package which provides a -common interface to a variety of statistical packages on the most -common computing platforms. - -ESS is an interface to statistical packages that provides tools which -facilitate both statistical software development and data analysis. -ESS provides assistance with both writing and evaluation of analysis -code for both interactive and batch statistical packages. ESS -currently supports the S family of languages (including S -\citep{BecRCW88,ChaJH92,ChaJ98}, \Splus\regstrd\ \citep{Splus}, and R -\citep{ihak:gent:1996,R}; \SAS\regstrd\ \citep{SAS:8}; \Stata\ -\citep{Stata:7.0}; \XLispStat\ \citep{Tier90} and its extensions Arc -\citep{Cook:Weisberg:1999} and ViSta \citep{youn:fald:mcfa:1992}; BUGS -\citep{BUGS}; and Omegahat \citep{DTLang:2000}. ESS can be extended -to accommodate most statistical packages which provide either an -interactive command-line or process batch files for instructions. - -We start by describing the Emacs text editor, the underlying platform -on which ESS is built. Next, we discuss how ESS enhances a -statistician's daily activities by presenting its features and showing -how it facilitates statistical computing. We conclude with a short history -of the development of ESS. -% and conclude with future extensions and related work. - -\section{Emacs} -\label{sec:emacs} - -Emacs is a mature, powerful, and extensible text editing system which -is freely available, under the GNU General Public License (GPL), for a -large number of platforms, including most Unix\regstrd -distributions, Microsoft Windows\regstrd\ and Apple Mac\tm\ OS. There -are two open-source implementations of Emacs: GNU Emacs -\citep{GNU-Emacs} and XEmacs \citep{XEmacs}. Emacs shares many -features with word processors, and some characteristics with operating -systems, including many facilities which go beyond ordinary text -editing. More important to our goals, Emacs can control and interact -with other programs. - -\paragraph{Keyboard and Mouse Input.} -When Emacs was originally written, character-based terminals were the -most advanced method of computer access. Common Emacs commands were -mapped to key sequences, creating keyboard shortcuts for convenience. -Over the last decade, Emacs has been extended to use graphical -windowing systems, such as X11\tm, Microsoft Windows, and Apple Mac -OS, which allow additional forms of input, for example using a mouse, -and which encourage multiple applications to share a single display. -Presently, Emacs is more often used with a GUI, with commands bound to -mouse actions, but having commands also associated with key sequences -is an important ergonomic and time-saving feature. Emacs menus and -toolbars on the display screen allow mouse access to frequently used -actions and provide a graphical alternative when the user does not -know or can not recall a key sequence; these are also subject to -user-customization. - -\paragraph{Buffers give Emacs control.} -Emacs buffers are the interface between the user and computer. They -can be considered to be a collection of scratch pads that both the -user and computer can read, write, and respond to. The user can -simultaneously edit many files and control numerous programs by -opening multiple buffers. With disk files, the working copy of the -opened file is placed in an Emacs buffer where it can be viewed and -edited either by the user or automatically by Emacs or another program -under the control of Emacs. Emacs can save a backup of the contents -to disk at specified intervals. Emacs presents buffer contents in -ways which optimize reading and navigation activities. One example of -program control is the embedding of the interactive operating system -command line interpreter, called a shell, within Emacs. Variations on -this theme are used to control programs such as statistical packages -which take input from and provide output to the command-line. The -resulting buffers provide a copy of the entire transcript of the -interaction, which can be edited and searched while the program -executes. - -\paragraph{Major and Minor Modes.} -Emacs capabilities are extended by loading -%% AJR: If we remove ``or byte-compiled'' we need to remove ``text'', -%% since it is wrong. -%% text -%% or byte-compiled -files containing commands and functions written in Emacs Lisp (elisp) -\citep{RChassell1999}, which is a dialect of Lisp -\citep{PGraham:1996}. Emacs commands can be called interactively by -pressing a key sequence mapped to the command or by name. -%% AJR: this is actually true for M-x long-command-not-bound-to-keys, -%% but I'm not telling anyone this! -% Rodney: I don't understand what the problem is with telling them. -The most important extensions to Emacs take the form of modes, which -provide specific enhancements to the editing behavior. - -Major modes provide a customized environment consisting of mapped key -sequences and associated commands for performing tasks such as file -editing, reading mail, or browsing disk directories. Only one major -mode can be active for a given buffer at any time. Major modes also -can be written to intelligently control other programs such as -statistics packages. Major modes for file editing are often -determined by the file type or extension, i.e. the characters at the -end of the file name that follow a period like \stexttt{txt}, -\stexttt{s}, or \stexttt{sas}. Examples of this kind of major mode are -\stexttt{ESS[S]} and \stexttt{ESS[SAS]}. Major modes understand a -file's syntax and grammar and therefore provide intelligent -actions such as automatic indentation; navigation in units of -characters, words, lines, sentences, paragraphs, function definitions, -and pages; syntax-based fontification and colorization; and -reformatting based on programmed conventions. - -Minor modes provide complementary services that that are applicable -across major modes. Many minor modes can be active at once. For -example, \stexttt{font-lock-mode} allows Emacs to highlight, with -fonts or colors, the syntax of a programming language whose -characteristics are described within a major mode like -\stexttt{ESS[S]}. The \stexttt{overwrite-mode} determines whether -typed characters replace the existing text or are inserted at the -cursor. Minor modes can emulate the key sequences used by another -editor such as \stexttt{vi}. In addition, they can be used to perform -version control operations and many other operations which are nearly -identical across file types. - -\paragraph{Network Support.} -Emacs allows transparent access to remote files over a network. This -means that the user views, edits, and saves files on a remote machine -exactly as if they were on the local machine. Mechanisms for both -open (\stexttt{ange-ftp} and \stexttt{EFS} use ftp) and secure -(\stexttt{tramp} uses scp or ssh) access are available. Emacs can -also monitor and control remote processes running in a shell buffer. - -\paragraph{Editing Extensions.} -Most programming and documentation tasks consist of editing text. -These tasks can be enhanced by contextual highlighting and recognition -of special reserved words appropriate to the programming language in -use. In addition, Emacs also supports folding, outlining, tags, and -bookmarks, all of which assist with maneuvering around a file. Emacs -shares many features with word processing programs and cooperates with -markup-language document preparation systems such as \LaTeX, -\textsc{html}, or \textsc{xml}. - -Tracking changes to a text file made by multiple users, potentially in -different locations, is the job of source-code control programs. -Emacs interacts with standard source-code control programs such as CVS, RCS, -and SCCS through minor modes such as \stexttt{vc-mode}. These -source-code control systems facilitate documenting and tracking edits and -changes to a file. More importantly, they allow for branching and -merging of versions so that material present in an older version of -the file can be recovered and inserted into a newer version in a -fairly easy manner. - -\begin{figure}[tbp] -% \ESSfig{\includegraphics[angle=270,width=\textwidth]{ediff-sas}} -\url{http://www.analytics.washington.edu/downloads/ess/doc/figures/ediff-sas.gif} - \caption{Ediff of two versions of a file.} - \label{f.ediff} -\end{figure} - -Comparison of files, two or three drafts of a paper for example, is -simplified by \stexttt{ediff}. An example is shown in Figure -\ref{f.ediff}. The lines that are similar are highlighted in the two -buffers, one for each file, and the specific words that mismatch are -highlighted in a contrasting color. \stexttt{ediff} has many tools -for working with the differences in files and in entire directories. -When combined with the patch utility or a source-code control system, -it provides the user with the ability to insert, delete or modify only -the differing portions of text files. - -% Rodney: You can't just mention complex functionality like etags and -% speedbar. We would need to introduce these packages. Since they -% aren't critical to ESS at this time, let's ignore them. -Emacs has many other important features. Emacs provides file-manager -capabilities, such as \stexttt{dired} (discussed in Major and Minor -Modes above) and \stexttt{speedbar}, both of which interface to the -computer's directory structure. Emacs stores the complete history of -commands issued in an editing session, allowing a flexible and fairly -complete undo capability. More importantly, for modes which control -processes, the process input history is stored for recall as well as -for later editing for printing or re-use. Emacs also includes web -browsers, mail/newsgroup readers, and spell checking. - -In addition to being an extremely powerful editor, Emacs also -includes capabilities usually found in an operating system. Thus, it -provides a strong foundation for constructing an integrated -development environment focused on the needs of statisticians. Emacs' -power, flexibility, portability, and extensibility make it a solid -platform on which to construct a statistical analysis user interface. - -\section{ESS extends Emacs} -\label{sec:ess-extends-emacs} - -Statistical programming is the writing of computer programs for data -analysis and processing. These programs might be written in a -computer language that requires a compiler, such as \Fortran\ or C. -But, more likely, they are written in a statistical analysis language -that only requires an interpreter such as R, \SAS, \Stata, or \XLispStat. -General purpose languages such as \Fortran, C/C++, Java, and PERL -have integrated development environments which facilitate writing and -debugging code. - -ESS extends Emacs to provide an integrated development environment for -statistical languages. It offers a single -interface for a variety of statistical computing tasks including -interactive data analysis and statistical programming. -ESS is able to provide a functional and extensible interface -which is uniform and consistent across multiple statistical packages. -This is done by adding shortcuts and features for accelerated editing -of files as well as by interacting with the particular statistical -packages to provide, for example, control of input/output, assistance -with evaluation, and specialized parsing of help files. - -ESS supports the S family (S, \Splus, and R) interactively. \SAS\ and -BUGS are also well supported for batch processing. \Stata\ and -\XLispStat\ (including ARC and ViSta) are supported through -highlighting and process-interfacing. - -\subsection{Features and capabilities} -\label{sec:ESS:features} - -\paragraph{Syntactic highlighting and indentation of source code.} -The programmers task is eased when language constructs (such as -reserved words, function calls, strings, and comments) are visually -identifiable and when lines of code are automatically indented to a -depth appropriate to their context (e.g., if--then clauses, loops). -ESS provides both of these to the programmer by including a -description of the syntax of each supported statistical language in -the form used by \stexttt{font-lock-mode}. - -Figure \ref{f.font} shows an example of font-locking a complicated S -statement. The top panel shows an \stexttt{if} statement with a long -expression in the condition and a multi-line consequence. The keyword -\stexttt{if} is shown in purple, the string \stexttt{"deltat"} in -RosyBrown. The comments are in red. Everything else is in the -standard font. The consequence is indented and the continuations of -the consequence are further indented. The matching parentheses are -shown in green. The cursor is indicated by a solid box. In the -bottom panel, we replaced the matching parenthesis with an unbalanced -bracket. Emacs immediately marks that with the paren-mismatch font, -bright purple in this example. On a black and white terminal we would -use bold, underline, italic, and reverse-video, rather than colors, to -distinguish the fonts. - -% Figure \ref{f.font} shows a black-and-white example of font-locking a -% complicated S statement. The top panel shows an \stexttt{if} -% statement with a long expression in the condition and a multi-line -% consequence. The keyword \stexttt{if} is shown in an underlined font, -% the string \stexttt{"deltat"} in an italic underlined font. The -% comments are in an italic font. Everything else is in the standard -% font. The consequence is indented and the continuations of the -% consequence are further indented. The matching parentheses are marked -% by a bold foreground and a shaded background. The cursor is indicated -% by a solid box. In the bottom panel we replaced the matching -% parenthesis with an unbalanced bracket. Emacs immediately marks that -% with the paren-mismatch font, bright purple on -% a color terminal. - -The font selection and the indentation depth are automatically -supplied by Emacs as the lines are typed. The user has several -options for mapping of colors or fonts to each of the syntactic types. -We selected -% black-and-white font-mapping for display here. On a color terminal -% we might use -purple for the keywords, red for comments, green for matching parens, -and inverse-video purple for mismatched parens. Emacs makes default -choices of colors and ESS provides several other optional schemes. - -\begin{figure}[tbp]%h -% \ESSfig{% -% \includegraphics[angle=270,width=\textwidth]{font-cor-s} -% \includegraphics[angle=270,width=\textwidth]{font-incor-s}% -% } -\url{http://www.analytics.washington.edu/downloads/ess/doc/figures/font-cor-s.jpg} -\url{http://www.analytics.washington.edu/downloads/ess/doc/figures/font-incor-s.jpg} - \caption{We illustrate here with fonts and colors appropriate for a - color display. On a black and white terminal we would use bold, - underline, italic, and reverse-video. On a color terminal we - would use a selection of colors.} - \label{f.font} -\end{figure} - -Since S syntax is similar to that of C, ESS uses the Emacs tools for -reformatting S code to match particular styles. Common C format styles, -as well as locally customized styles, are defined by specifying the indentation -level for nested statements, location of open-braces (at the end or at the -beginning of a line), indentation offsets for if-then-else constructs, -and similar characteristics. - -Syntax highlighting can be used to help enforce coding -standards. Figure \ref{f.hilock} illustrates a standard for -\SAS\ programming that says all \stexttt{PROC} statements must use the -\stexttt{DATA=datasetname} option. - -\begin{figure}[tbp] -% \ESSfig{\includegraphics[angle=270,width=\textwidth]{hilock-sas}} -\url{http://www.analytics.washington.edu/downloads/ess/doc/figures/hilock-sas.gif} - \caption{Enforce coding standards. The standard here is - that all \stexttt{PROC} statements must use the - \stexttt{DATA=datasetname} option. Lines that satisfy the - standard turn green, lines that don't turn red. - Ambiguous ones turn yellow.} - \label{f.hilock} -\end{figure} - -\paragraph{Process interaction.} -Emacs has historically referred to processes under its control as -``inferior'', accounting for the name inferior ESS (\stexttt{iESS}) to -denote the mode for interfacing with the statistical package. Figure -\ref{f.ess-demo} shows the S language program \stexttt{ess-demo.s} in -the top buffer in \stexttt{ESS[S]} mode and the executing R process in -the bottom buffer \stexttt{*R*}. The \stexttt{iESS} major mode of the -\stexttt{*R*} buffer is crafted for command-line editing. This mode -remembers and uses the command history, allowing for the recall and -searching of previously entered commands. Filename completion for -local directories is also available. - -\begin{figure}[tb] -% \ESSfig{\includegraphics[angle=270,width=\textwidth]{ess-demo}} -\url{http://www.analytics.washington.edu/downloads/ess/doc/figures/ess-demo.jpg} - \caption{Line-by-line execution of a command file. The cursor is - placed on a line in the \stexttt{ESS[S]} buffer and then with a single - key sequence - the line is sent to the \stexttt{*R*} buffer for - execution. The output of the package goes directly to the - editable \stexttt{*R*} buffer.} - \label{f.ess-demo} -\end{figure} - -\paragraph{Source-level Debugging.} -ESS facilitates the editing of source code files, sets of commands -written for a statistical analysis package, and allows the user to -load and error-check small sections of source code into the package. -This is done through several mechanisms. First, the presence of -unbalanced parentheses or mismatched/unterminated quotes is -immediately evident with syntactic highlighting of the source code. -Second, functions are provided for simple and consistent execution of -user-specified or natural units of the code (function definitions in S -or \XLispStat, \stexttt{PROC \dots\ RUN;} sections in \SAS). An -error-free evaluation lets the user execute the next section of code; -if errors arise, the user edits the current unit and re-evaluates. -Once the code is verified, an entire buffer, or file, of code can be -sent to the package as a unit. This file can also be used as a batch -file for routine analysis at a later time. Finally, output from the -statistics package is normally captured directly by Emacs and placed -into a buffer from where it can be edited and searched. Particular -forms of output such as requests for help pages and log-file output -can be diverted into special buffers with modes crafted to facilitate -reading. These modes include tools for automatically placing the -cursor on the first \stexttt{ERROR}, for example in \SAS\ and S. - -\paragraph{Interactive transcripts.} -A transcript records all commands entered by the analyst and the -corresponding text-based responses such as tables and comments -generated by the statistics package during an interactive statistical -analysis session. Once a transcript file is generated, for example by -saving an \stexttt{iESS} buffer, \stexttt{transcript-mode} assists -with reuse of part or all of the entered commands. ESS understands -the transcript's syntax, especially the potential prompt patterns used -during the interactive analysis. ESS provides tools to facilitate -editing and re-evaluating the commands directly from the saved -transcript. This is useful both for demonstration of techniques and -for reconstruction and auditing of data analyses. Special ESS -functions can ``clean'' S language transcripts by isolating all input -lines and placing them in a new S language source file. Transcript -cleaning facilitates the use of an exploratory interactive analysis -session to construct functions and batch files for routine analysis of -similar data sets. - -\paragraph{Remote access to statistics packages.} -ESS provides transparent facilities for editing files and running -programs which might reside on numerous remote machines during the -same session. The remote machine could be a different platform than -the local machine. - -\paragraph{Manipulating and Editing Objects (S family).} -For languages in the S family, ESS provides object-name completion of -both user- and system-defined functions and data. ESS can dump and -save objects (user- and system-generated) into formatted text files, -and reload them (possibly after editing). - -\paragraph{Help File Editing (R).} -ESS provides an R documentation mode (\stexttt{Rd-mode}) which assists -in writing help files for R functions, objects, and other topics worth -documenting. \stexttt{Rd-mode} provides the ability to view and -execute code embedded in the help file in the same manner as ESS -handles code from any S language source file. It provides syntax -highlighting and the ability to submit code directly to a running ESS -process, either R or \Splus, for evaluation and debugging. This -latter feature is useful for ensuring that code developed using R runs -under \Splus. - -\paragraph{Cooperation across Multiple Tools.} -Statistical packages are intended for either general statistical -analyses or for specialized forms of statistical analyses. The -specialized statistical packages can be far more efficient for their -intended activities, but this is balanced by their inability to -perform a wide range of general statistical functions. Tightly -coupled inter-operability between general and specialized packages -rarely exists, but such a facility is often desired. For example, a -general purpose package such as R does not perform Bayesian analyses -as easily as BUGS does. On the other hand, BUGS lacks breadth in the -range of analyses and results it can generate. For this reason, BUGS -is often distributed with R packages, like the diagnostic packages -CODA and BOA, which assist with importing and analyzing the results in -R. Another point of contention is the difference in the interfaces -between general packages and specialized packages. ESS helps by -providing a single point of contact to both tools, though the typical -interfaces (interactive for R, batch for BUGS) are different. - -%\item[Rodney:] I can't speak for everyone, but the BUGS users I know are -% .. lots deleted by AJR -%will make sense. Besides, the most pressing need for me is to get -%ESS-elsewhere to work with ESS[BUGS] rather than creating inferior-BUGS. - -%\item[Rich:] How does making ``ESS-elsewhere work with ESS[BUGS]'' differ -%from ``creating inferior-BUGS''? My question is predicated on the assumption -%that ESS-elsewhere is a (generalized) minor-mode that makes the location -%of the program irrelevant. -%See my ESS-elsewhere quibble below. - -%\item[Rodney:] It's the whole batch BUGS vs. interactive BUGS thing. Batch -%BUGS with ESS-elsewhere; interactive BUGS with inferior-BUGS which does not -%and will never exist. If you want to call ``inferior-ESS'' ``ESS-elsewhere'' -%why do you need two different names? ``inferior-ESS'' is a terrible name -%so the change would be fine with me, but you can't have it both ways? Is -%this why you keep saying that ESS-elsewhere works for SAS? See -%response to quibble below. - -%\item[Rich:] -%\stexttt{iESS[SAS]} was designed to mimic as well as possible \stexttt{iESS[S]}. -%I need to read doc/README.SAS to make sure all of its options are represented -%here. --- Not yet done. -%\end{description} -%\end{Comment} - -\paragraph{Simplifying Keymap Differences.} -Simple conflicts between interfaces are exemplified by different key -sequences for editing tasks such as cut, copy, paste, beginning of -line, end of line, etc. These may be the most aggravating because our -fingers are typing ``instinctively'', but differences in interfaces -circumvent this learned behavior. ESS solves this problem by -providing a uniform interface to keyboard actions across the variety -of statistical packages that might be used. That is, the same key -sequences are used for cursor movement, evaluation, and basic tasks -such as loading files for editing. - -\paragraph{Concurrent Use of Multiple Machines and Operating Systems.} -It can be useful to have multiple statistical processes running -simultaneously, either on a single machine or a variety of machines. -This capability assists with large-scale numerical simulations as well -as code design and testing across multiple versions of statistical -software packages. - -\subsection{Interactive Processing.} -\label{sec:interactive} - -The increased popularity of exploratory data analysis as well as the -advent of simple GUIs has made interactive data analysis an important -component to statistical practices. -ESS uses three different approaches for communicating with statistical -packages. - -\paragraph{Inter-Process Communication.} -Packages that use the command-line interface are run as an inferior -process in an Emacs buffer, with the standard input and output of the -package redirected to the buffer. Packages that do not use the -command-line interface must be run as an independent process, possibly -with limited cooperation. - -ESS can use the Windows DDE (Dynamic Data Exchange) protocol to -provide one-way communication directly to packages which function as a -DDE server. ESS can control the actions of the package, but it can not capture -the results directly. Transcripts must be physically copied to an -Emacs buffer to get the transcript editing features. - -Statistical packages that use neither the standard input/standard -output protocol nor DDE can not be directly controlled by Emacs. But, ESS -can still provide an editing environment for these statistical languages. The -user must either manually cut and paste the edited code into the -package or save the edited files and run them in a batch environment. -The Microsoft Windows versions of \SAS, \Stata, and \XLispStat\ are -in this category. - -One useful extension in ESS is relaxation of the requirement that the -statistics program be available on the local machine. ESS provides -both transparent editing of files and execution of statistics packages -on a remote machine with \stexttt{iESS[S]} or \stexttt{iESS[SAS]} (see -below). All the editing and interaction features described for the -local machine work equally well on the remote machine. The -interaction, including all the unique features of working with ESS, -appears to the user as if the program were running on the local -%rmh: The interaction ... appears .... -machine. If the X11 Windowing system is running on the local machine, -it is even possible to bring up visual displays and graphics from -remote Unix systems onto a local Microsoft Windows or Apple Mac -display. - -\paragraph{Interactive S family} -ESS for S family statistical languages, \stexttt{iESS[S]}, -replaces the \Splus\ Commands window or the R GUI window. In addition -to running the S family language process, \stexttt{iESS[S]} mode provides the -same editing features, including syntactic highlighting and -string-search, as the editing mode \stexttt{ESS[S]}. It also provides -an interactive history mechanism; transcript recording and editing; -and the ability to re-submit the contents of a multi-line command to -the executing process with a single keystroke. \stexttt{iESS[S]} is -used with S, \Splus, and R on Unix and with Sqpe and R on Windows. - -The \Splus\ GUI on Windows can be a DDE server. There are two -advantages to using even this limited communication with the \Splus\ -GUI through ESS. First, through \stexttt{ESS[S]} mode the user gets -the full editing capabilities of Emacs. Second, S language commands -% rmh: S, not \Splus, in both places. The {\it language} is S. -% The previous session could be R or ATT S. It is not restricted to \Splus. -are sent from the editing mode \stexttt{ESS[S]} buffer and from -transcript buffers from previous S sessions directly to the GUI -Commands window with the same Emacs key sequences as are used with ESS -on Unix. Hence the user can work in a powerful editing environment -and is protected from the delay and ergonomic challenges of using the -mouse for copy and paste operations across windows. - -\paragraph{Interactive \SAS.} -\stexttt{iESS[SAS]} is a mode that allows text-based \stexttt{PROC} by -\stexttt{PROC} interaction with an inferior buffer running an -interactive \SAS\ session on either the local or a remote computer. -\stexttt{iESS[SAS]} mode works by redirecting standard input and -output from \SAS\ to ESS. Currently, the \stexttt{iESS[SAS]} mode can -run on any computer, but the \SAS\ process it is controlling must be -running on a Unix machine. This process is very efficient for dial-up -network connections to a remote computer with \SAS\ installed. The -resulting interface is similar to the SAS character terminal -interface, but with Emacs key sequences. - -%Rodney: What is this paragraph about? I'm going to comment it out -%because I don't recognize what it is supposed to be. Maybe somebody -%can fix it later. -% -% rmh: Round umpteen. Yes, this is redundant with the third paragraph -% of interprocess communication. I still want it here. Try this rephrasing. -% -\stexttt{ESS[SAS]} mode can be used in conjunction with the \SAS\ -Display Manager to allow simultaneous access to Emacs for editing -\SAS\ language code and to the \SAS\ mouse-based interfaces to the -graphical routines and help system. - -%%%%% AJR: WHY IS THIS SUBSTANTIALLY DIFFERENT THAN BATCH? I KNOW ITS -%%%%% SLIGHTLY DIFFERENT, BUT SUBSTANTIALLY? -%%%%% rmh: this is a form of interaction, not batch. I restored the -%%%%% first paragraph with some expansion. -%\paragraph{\SAS---Interactive cooperation with the \SAS\ Display Manager.} -%ESS users who write data analysis code in \stexttt{ESS[SAS]} mode in Emacs -%often need to work with the \SAS\ Display Manager's -%mouse-based interface to the graphical -%routines, the help system, and other non-text-based features. -%%The authors of ESS prefer the Emacs environment for -%%the text-file interaction with \SAS, that is with editing and -%%managing input command files and output listing and log files, -%%even on computer systems which run -%%the \SAS\ Display Manager environment. -%In this situation, the user -%designs the command file in \stexttt{ESS[SAS]} mode and highlights -%regions to be forwarded to \SAS\ for processing. -%% -%% Rodney: I don't see this as a feature of either ESS or emacs. And, -%% what the authors prefer is certainly not germane. -%% -%% -%% rmh: This is my preferred mode for interacting with SAS. I tried another -%% rephrasing. It {\it is} a feature of ESS. ESS is able to provide ESS[SAS] -%% mode for the text processing (.sas .lst. log files) and simultaneously -%% let the user have interactive graphical access. -%%This can be done by either: -%%\begin{enumerate} -%%\item copying and pasting the marked regions to the \SAS\ Editor window -%% and then pressing the \stexttt{RUN} button. Highlighted sections of -%% the \SAS\ Listing window are brought back to Emacs to be read in the -%% \stexttt{ESSlst} mode editing environment. -%%\item submitting the marked region for Batch File Processing (see the -%% next section) but using the mapped key sequences to append to the log -%% and listing files instead of replacing them. -%%\end{enumerate} - -\subsection{Batch File Processing.} -\label{sec:batch-file} - -Batch file processing with statistical analysis packages is a better -choice than interactive processing when the execution times are longer -than the user is willing to wait as well as for regularly updated -statistical reports and figures. ESS provides a means to shorten the -debugging cycle for writing code intended for batch evaluation by -containing the whole process, both writing and evaluation, within -Emacs. - -\paragraph{Batch \SAS.} -\label{sec:sas-batch} - -\SAS\ is a popular choice for processing and analyzing large amounts -of data. However, interactive \SAS\ is rarely used in these situations -due to the length of time involved. Instead, a file containing \SAS\ -commands is created and \SAS\ executes these commands in the background, -or batch, while the user moves on to other activities. - -ESS facilitates \SAS\ batch with \stexttt{ESS[SAS]}, the mode for files -with the \stexttt{sas} extension. ESS defines \SAS\ syntax so that -\stexttt{font-lock-mode} can highlight statements, procedures, -functions, macros, datasets, comments and character string literals in -\SAS\ programs. Optionally, the same language features are -highlighted in the \SAS\ log with the addition of log notes, warnings -and error messages. - -For files with the \stexttt{sas} extension, ESS binds the function -keys in \stexttt{ESS[SAS]} mode to match the definitions used by \SAS\ -Display Manager. These definitions are optionally available in all -modes. They are particularly useful when viewing \SAS\ log and -listing files (with extensions of \stexttt{log} and \stexttt{lst} -respectively). - -Only one function key press is needed to submit a \SAS\ batch process. -Other function keys open the \SAS\ program, the \SAS\ log and the -\SAS\ listing buffers. When accessed in this manner, the \SAS\ log -and \SAS\ listing buffers are automatically updated since they may -have been appended or over-written by the \SAS\ batch process. In -addition, the \SAS\ log is searched for error messages and the error -messages, if any, are sequentially displayed with consecutive key -presses. - -Another function key opens a \SAS\ permanent dataset for editing or -viewing. An option is provided so that the tab and return keys -operate in typewriter fashion like they do in \SAS\ Display Manager. -This option also defines a key to move the cursor to a previous -tab-stop and delete any characters between its present position and -the tab-stop. This is a \SAS\ Display Manager feature that is not -typically available in Emacs. - -The \SAS\ batch process runs on the computer where the \SAS\ program -resides. This is important because any \SAS\ permanent datasets -referenced in a \SAS\ program only exist on the computer running \SAS. -If the \SAS\ program resides on a remote computer, then the -log and listing are also accessed remotely. The net result is that -running \SAS\ batch on remote computers is nearly transparent to the -ESS user. - -%\begin{Comment} -%Rich's version: -%\end{Comment} -%The \SAS\ batch process can run on the same computer on which the -%emacs session is running or it can run on a remote computer. For -%remote jobs, files are transparently saved (with ftp or scp or kermit) -%and the batch process is transparently submitted through a telnet or -%ssh connection. - -%\begin{Comment} -%Rich: I have some terminology quibbles here with how the term -%``ESS-elsewhere'' is used with SAS BATCH. I think of S-elsewhere or -%ESS-elsewhere as a trick to make a \stexttt{telnet-mode} buffer think -%it is \stexttt{iESS-mode} buffer. - -%I don't think of file saving, editing, and retrieval as an example -%of ESS-elsewhere. Neither is submission of the remote job; -%that is just an ordinary shell command in an ordinary shell buffer. -%M-x SAS probably is an example of ESS-elsewhere, but I -%designed it before I thought of the ESS-elsewhere concept. - -%The initial idea behind S-elsewhere was to run an interactive S or S-Plus -%session on a remote computer in telnet (or equivalent) buffer. The trick -%was to make the \stexttt{telnet-mode} buffer accept C-c C-n and -%related commands from the \stexttt{S-mode} buffers. Hence I had to -%make the \stexttt{telnet-mode} buffer think it is \stexttt{iESS-mode} -%buffer. The ``elsewhere'' part of the name is entirely related to a -%different start up procedure. Once the connection is made, there is -%{\em no} difference visible to the user. The buffer shows itself to -%be an ordinary \stexttt{iESS} buffer. Tony generalized S-elsewhere -%to ESS-elsewhere to allow other languages than S to be used -%interactively. - -%I have been using ESS for SAS remote BATCH for years, ever since you -%and I started working on this together. We initially defined -%ess-sas-submit-method to encapsulate the location of the sas process. -%Except for a few lines of elisp to get the connection started, the user -%behavior has been identical whether the SAS process is on the same or -%different machine. Since we are not interactively talking to the SAS -%process in an inferior-ESS buffer I don't see this as ESS-elsewhere. - -%Rodney: Remote submissions of SAS batch jobs never worked. I only got -%it to work a couple of weeks ago. The problem was with the cd command. -%You need to ignore the beginning and end of the expanded buffer name -%that are the ange-ftp/EFS/tramp stubs which tell Emacs what the remote -%username and hostname are. I find the batch usage of ESS-elsewhere -%entirely consistent with the interactive behavior. OTOH, I don't find -%the terminology particularly illuminating. I think ESS-remote or -%ESS-net would be more meaningful. -%\end{Comment} - -\paragraph{Batch BUGS.} -BUGS software performs Markov Chain Monte Carlo integration. There is -an interactive capability, but it is not often used since the analyses -can be very time-consuming. Most BUGS programs are executed as batch -processes. ESS facilitates BUGS batch with \stexttt{ESS[BUGS]}, the -mode for files with the \stexttt{bug} extension. ESS provides 4 -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. Finally, key sequences are defined to create a command -file and submit a BUGS batch process. - -\paragraph{Batch S family.} -ESS provides 2 facilities for batch processing of S family language files. -The first is to execute the contents of a file using buffer-evaluation. This -differs from interactive processing only by the number of commands -being evaluated; errors can be found by examining the resulting -transcript. The second is the load-source mechanism, which provides a -means of jumping to errors in the source file, but doesn't display the -evaluated commands in the transcript. These mechanisms provide -different tools for debugging the source files. - -\section{History of ESS} -\label{sec:ESS:history} - -ESS is built on Emacs, the editing system for which Richard Stallman -won a MacArthur Foundation Fellowship in 1990. Emacs has a long -history of being a programmer's editor. Many statisticians got their -first taste of the power of Emacs with \Fortran\ mode which was -introduced in 1986. As statisticians' preferences changed from -generalist compiled languages such as \Fortran\ to specialist -statistical analysis packages like S and \SAS, Emacs modes soon -followed. - -The ESS environment is built on the open-source projects of -many contributors, dating back over 10 years. -Doug Bates and Ed Kademan wrote S-mode in 1989 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 M{\"a}chler, 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, which -relies on files rather than standard-input/standard-output, on Unix, -Windows and Mac. In 2001, Sparapani added BUGS batch file processing -to ESS for Unix and Windows. - -This history is summarized in Table \ref{tab:timeline}. - -\begin{table}[tbp] - \centering - {\scriptsize - \begin{tabular}{c ll c ll} -\hline - Year \\ -\hline - & \multicolumn{2}{c}{S-mode} && \multicolumn{2}{c}{SAS-mode} \\ -\cline{2-3} \cline{5-6} - 1989 & v.1 & (GNU Emacs, Unix, S/S+) && \\ - 1990 & & && & (GNU Emacs, Unix, SAS editing) \\ - 1991 & v.2 & (GNU Emacs, Unix, S/S+) && \\ - 1993 & v.3 & (GNU Emacs, Unix, S/S+) && \\ - 1994 & v.4 & (GNU Emacs/XEmacs, Unix, S/S+) && v.1 & (GNU Emacs, Unix, SAS batch) \\ - 1995 & v.4.7 & (GNU Emacs/XEmacs, Unix, S/S+/R) && v.2 & (GNU Emacs/XEmacs, Unix, SAS batch) \\ - \cline{2-6}\\[-3.5ex] - \cline{2-6} - & \multicolumn{5}{c}{Emacs Speaks Statistics (ESS)} \\ - \cline{2-6} - &\multicolumn{2}{c}{Emacs, Operating Systems} &&\multicolumn{2}{c}{Additional Functionality}\\ -\cline{2-3} \cline{5-6} - 1997 & v.5.0 & (GNU Emacs/XEmacs, Unix) &&& Stata, XLispStat, SAS interactive \\ - 1998 & v.5.1.1 & (GNU Emacs/XEmacs, Unix/Windows) &&& S+elsewhere; Windows: S+/R\\ - 1999 & v.5.1.10 & (GNU Emacs/XEmacs, Unix/Windows/Mac) &&& SAS batch; Omegahat \\ - 2001 & v.5.1.19 & (GNU Emacs/XEmacs, Unix/Windows/Mac) &&& Unix/DOS: BUGS batch; Mac: R \\ -%% 2002 & v.5.1.20 & (Emacs/XEmacs, Unix/Windows/Mac) &&& Unix/DOS: BUGS batch, Mac: R \\ -%% 2002 & v.5.2 & (Emacs/XEmacs, Unix/Windows/Mac) &&& ? \\ - \hline - \end{tabular} - } - \caption{History and Ancestors of ESS} - \label{tab:timeline} -\end{table} - - -%\section{Future Work} - -%%%There are two active areas of extensions for user environments. One -%%%is to enhance the capabilities of the IDE for statistical practice; -%%%this includes implementing such common IDE features as object -%%%browsers, tool-tips, and interfacing cleaning. The other is to target -%%%appropriate potentially useful programming methodologies for transfer -%%%to statistical practice. -%%% -%%%Literate Programming methodologies \citep{Knuth:1992,NRamsey:1994} are -%%%a natural fit for statistical practice. We refer to the application -%%%to statistical analysis as Literate Statistical Practice -%%%\citep{rossini:dsc:2001}. The tools used are Noweb -%%%\citep{NRamsey:1994} and either \LaTeX, \textsc{html}, or \textsc{xml} -%%%for documenting and explaining the analysis. This approach to -%%%programming encourages the use of a literary documentation style to -%%%explain the programming code for the data analysis. The program can -%%%then be extracted from the documentation text for realizing the -%%%statistical analysis. - -%%future enhancement perhaps -%%ESS provides the same ESS-elsewhere support for BUGS batch -%%that it does for \SAS\ batch (see above). - -%Important extensions which should be implemented in future -%versions include class browsers, analysis templates, tool-tips, and -%similar features. Class browsers can be thought of as a tree or -%outline for presenting datasets, variables and functions in the -%context of what they represent; this allows for rapid and appropriate -%inspection. Analysis templates would allow statistics centers and -%groups to provide standardized templates for initiating an analysis. - -%Additional statistical packages can easily be added to ESS. - -%%While most IDE features have been developed for object-oriented -%%languages, the above also can apply to non-object oriented -%%programming. - -%ESS is one of the first Rapid Application Development (RAD) -%environments intended for statisticians. It provides - - -\section{Conclusion} -\label{sec:concl} - -ESS provides an enhanced, powerful interface for efficient interactive -data analysis and statistical programming. It allows the user -complete control over the communications among the files in which the -analysis is specified, the statistical process doing the computation, -and the output. Because all are within the same programming -environment, and therefore are accessed with the same editing and -searching concepts and the same key sequences, user efficiency is -increased. It is completely customizable to satisfy individual -desires for interface styles and can be extended to support other -statistical languages and data analysis packages. - -%\begin{Comment} -%Rich: see my discussion of ESS-elsewhere terminology. - -%What is the behavior for remote SAS that is new for 2002? - -%Rodney: SAS batch now works and Kermit was added as a method of transfer. -%\end{Comment} -%ESS-elsewhere provides interactive and batch processing -%with \SAS\ running on a remote machine that is accessed over a -%network. This provides a powerful development environment for \SAS. - -%%This -%%includes support for syntax highlighting and template-based source file -%%generation that provides the capability of specifying all the necessary -%%parameters for a BUGS batch run in a single file. - -\bibliographystyle{plainnat} -\pdfbookmark[1]{References}{section.7} -%\addcontentsline {toc}{section}{\numberline {}References} -\bibliography{ess-intro-graphs} - -\clearpage - -\appendix -\section{Appendix: ESS Resources on the Internet} -%\addcontentsline {toc}{section}{\numberline {}ESS Resources on the Internet} -\label{sec:access} - -\paragraph{Latest Version.} - -ESS is constantly in flux. New versions of statistical -packages, Emacs and operating systems require new releases of ESS to -support them. The latest stable version of ESS can be found on the web at -\url{http://www.analytics.washington.edu/downloads/ess/}. To get help -with problems, send e-mail to \url{mailto: ess-help@stat.math.ethz.ch}. -The latest development, hence unstable, version can be obtained by -anonymous CVS. First type: - -\stexttt{cvs -d - :pserver:anoncvs@cvs.analytics.washington.edu:/var/anoncvs login} - -You will be prompted for a password which is ``\stexttt{anoncvs}''. -Then type: - -\stexttt{cvs -d - :pserver:anoncvs@cvs.analytics.washington.edu:/var/anoncvs co - ess} - -\paragraph{Additional documentation.} - -An expanded version of the present paper is in \citep{RMHHS:2001}. A -general introduction and usage instructions can be found in -\citep{heiberger:dsc:2001}; in addition, one which is more focused on -\SAS\ can be found in \citep{heiberger:philasugi:2001}. The -documentation that comes with ESS provides details of its -implementation as well as examples of its use. - -\end{document} - - -%%% Local Variables: -%%% mode: latex -%%% TeX-master: t -%%% End: diff -Nru ess-18.10.2/doc/archive/ESS_intro.tex ess-18.10.2+git20220915.f45542e/doc/archive/ESS_intro.tex --- ess-18.10.2/doc/archive/ESS_intro.tex 2018-11-10 09:41:10.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/doc/archive/ESS_intro.tex 1970-01-01 00:00:00.000000000 +0000 @@ -1,356 +0,0 @@ -%% $Id: ESS_intro.tex,v 1.2 1999/11/16 20:58:36 ess Exp $ -%% -%% $Log: ESS_intro.tex,v $ -%% Revision 1.2 1999/11/16 20:58:36 ess -%% Martin suggested a small fix. -%% -%% Revision 1.1 1999/11/16 20:54:33 ess -%% Another bit of documentation -%% -%% Revision 1.11 1998/10/12 21:09:20 rossini -%% added andy's notes. -%% -%% Revision 1.10 1998/10/12 15:53:25 rossini -%% emacs clarification made (thanks Martin!). -%% -%% Revision 1.9 1998/10/12 15:48:16 rossini -%% Released in semi-final form. -%% -%% - -\documentclass{article} - -\addtolength{\textheight}{2in} -\addtolength{\textwidth}{1in} -\addtolength{\topmargin}{-1in} -\addtolength{\oddsidemargin}{-1.0in} - -\usepackage{palatino} -\usepackage{html} - -\title{A Quick Introduction to ESS} -\author{A.J. Rossini} - -\begin{document} - -\maketitle - -This document can be found at -\begin{center} - \htmladdnormallink - {http://www.biostat.washington.edu/\~{}rossini/talk/ESS\_intro/} - {http://www.biostat.washington.edu/\~{}rossini/talk/ESS\_intro/} -\end{center} -The example file for this session is -\htmladdnormallink{rossini.example.R} -{http://www.biostat.washington.edu/\~{}rossini/talk/ESS\_intro/rossini.example.R}, -which can be retrieved (from the Biostat machines) by -\begin{verbatim} - cp ~rossini/public_html/talk/ESS_intro/rossini.example.R . -\end{verbatim} -to your current working directory. (note that the final ``.'' is very -important!). - -For convenience, the \htmladdnormallink{latex} -{http://www.biostat.washington.edu/\~{}rossini/talk/ESS\_intro/ESS\_intro.tex} -and \htmladdnormallink{postscript} -{http://www.biostat.washington.edu/\~{}rossini/talk/ESS\_intro/ESS\_intro.ps} -versions are also available. - -\section{Common Emacs Information} -\label{sec:emacs} - -This is not a tutorial for Emacs. That is a subject for another session. - -Basic notation for key sequences: -\begin{itemize} -\item \verb+[tab]+ is the TAB (indent) key. -\item \verb+C-k+ refers to holding down the control (ctrl) key \textbf{WHILE} - pressing ``k''. -\item \verb+M-k+ refers to pressing the Escape key (ESC), - \textbf{THEN} pressing ``k''. -\end{itemize} -\textbf{Only run one Emacs session}. This is a cardinal rule, that -you should try not to violate. To load in (visit) new files, do: -\begin{itemize} -\item \verb+C-x C-f+ (replaces current file in window with new) -\item \verb+C-x 4 C-f+ (load new file in different window) -\item \verb+C-x 5 C-f+ (load new file in different frame) -\end{itemize} -and to switch to another file, do -\begin{itemize} -\item \verb+C-x b+ (switch to new buffer in window) -\item \verb+C-x 4 b+ (replaces current file in different window) -\item \verb+C-x 5 b+ (replaces current file in different frame) -\end{itemize} - -Buffers are the representations of the files you are editing. You can -treat them as the files themselves. - - -\subsection{Useful (X)Emacs Commands for UW Biostat} -\label{sec:emacs:uwbiostat} - -In the following, \emph{``Emacs''} can be used instead of -\emph{``XEmacs''}. - -This section is thanks to \htmladdnormallink{Andy - Dunning}{mailto:adunning@biostat.washington.edu} and -\htmladdnormallink{Greg Warnes}{mailto:warnes@biostat.washington.edu}. - -It's also available as a \htmladdnormallink{crib sheet text document} -{http://www.biostat.washington.edu/\~{}rossini/talk/ESS\_intro/emacs.txt}. - -\begin{verbatim} - USEFUL XEMACS COMMANDS - ====================== - -STARTING XEMACS (Currently on GIBSON, GORN, SOL, ATLAS, ABACUS) ---------------- - rsh login to machine - - xemacs start xemacs, edit - xemacs -f S start xemacs, run S-plus - xemacs -nw start xemacs in _text_ mode (nw="No Window") - (useful over telnet session from home) - -ANY EMACS BUFFER ----------------- - - MOVING AROUND - ------------- - C-v Move forward one screenful - M-v Move backward one screenful - C-l Clear screen and redisplay everything - M- -> Meta- - moves forward a word - M- <- Meta- - moves back a word - M- |^ Meta- - move up a paragraph - M- V Meta- - move down a paragraph - M- < Meta- - move to end of file - - CUT AND PASTE - ------------- - C-d _D_elete - C-k _K_ill from the cursor position to end of line - C-y Recover/Paste (_Y_ank) killed text (repeat to copy) - M-y recover former killed text (after C-y. Repeat to go - back through stack). - C-x u _U_ndo - - LOADING/SAVING FILES - -------------------- - C-x C-f _F_ind a file - C-x C-s _S_ave the file - - If you find a second file with C-x C-f, the first file remains - inside Emacs. You can switch back to it by finding it again with - C-x C-b. This way you can get quite a number of files inside Emacs. - - MANAGING BUFFERS / WINDOWS - -------------------------- - C-x 0 Move between windows - C-x 1 One window (i.e., kill all other windows). - - C-x b Switch to new _b_uffer - C-x C-b List _b_uffers - - SEARCH and REPLACE - ------------------ - M-x (then) replace-string - Replace string - C-s _S_earch forward - repeat to move to next occurence - C-r Search _r_everse - repeat to move to previous occurence - - MISC - ---- - C-h or C-h ? _H_elp - C-h c (command) _H_elp on this _c_ommand - - C-u 8 (character or command) - Repeat character or command 8 times - - C-g Stop, undo, unhang. - C-x C-c stop editing and exit (_c_lose) Emacs - - STARTING SPLUS / ESS - -------------------- - M-x S Start _S_-plus process buffer - M-x S-mode Change mode of current buffer to S-plus code editing - -S EXECUTION BUFFER (Usually named "*S*" or similar, mode line says "iESS") ------------------- - - C-c C-d _D_ump S-plus object or function into new editing - buffer. - - C-c C-v xxx get S-plus help on "xxx" - - -S CODE EDITING BUFFER (Usually named for the file being edited, mode line ---------------------- says "ESS[S]") - - C-c C-j Send line to S - C-c C-n Send line to S and move down to _n_ext line - C-c C-r Send highlighted _r_egion to S - C-c C-b Send whole _b_uffer to S - C-c C-f Send _f_unction where cursor is to S - - C-c C-v xxx get S-plus help on "xxx" -\end{verbatim} - -\section{Replacing Command-line Usage} -\label{sec:commandline} - -\subsection{Start-up} -\label{sec:commandline:startup} - -\begin{enumerate} -\item To run from the command-line in a non-windowing environment: -\begin{verbatim} - xemacs -f S -\end{verbatim} -\item To run from the command-line in a windowing environment: -\begin{verbatim} - xemacs -f S & -\end{verbatim} -\end{enumerate} -(note that depending on the system, you might be using \verb+emacs+, -not \verb+xemacs+). - -\textbf{Optional: } The first time that one runs this, you should -construct the object list. This is done by: -\begin{verbatim} - M-x ess-create-object-name-db -\end{verbatim} -or -\begin{verbatim} - M-x ess-create-obj[tab] -\end{verbatim} -where \verb+[tab]+ is the TAB key. - -One can replace \verb+S+ with \verb+R+ or \verb+XLS+, to run a -different version. The object database feature currently only works -with Splus and R. - -\subsection{Replacing Command-line Usage} -\label{sec:commandline:usage} - -To enter commands, you generally need to be at a command prompt (i.e. -``\verb+> +''). But there are some nice exceptions. - -The follow applies primarily to \verb+Splus+ and \verb+R+. - -\begin{enumerate} -\item To get help on a function (help(``lm'')) without spoiling your - input line: \verb+C-c C-v+ -\item Completion of objects (functions and data): - \begin{enumerate} - \item \verb+C-c [tab]+ - \item \verb+[tab]+ (sometimes). -\end{enumerate} -\item Search command-line history ``manually'', matching on current input - \begin{enumerate} - \item backwards: \verb+M-p+ - \item forwards: \verb+M-n+ - \end{enumerate} -\item Complete current line based on command-line history: - \begin{enumerate} - \item backwards: \verb+\C-[uparrow]-p+ - \item forwards: \verb+M-n+ - \end{enumerate} -\item If you are reviewing old commands, to re-enter it one (with the - cursor on the line): \verb+[return]+. -\end{enumerate} - -Many other commands, as well... - -\section{Replacing Cut-and-Paste} -\label{sec:cutpaste} - -The next stage of statistics package usage is usually to cut-and-paste -from an editor. Since we are within an editor, this is moot. - -\textbf{Use the following suffices for your files:} -\begin{itemize} -\item \verb+.S+, such as \verb+critical_simulation.S+ -\item \verb+.R+, such as \verb+speedy_simulation.R+ -\end{itemize} - -\subsection{Cut and Paste} -\label{sec:cutpaste:usual} - -You \textbf{can} cut and paste. It's pretty identical, and a bit ugly. - -\subsection{Efficient Methods 1} -\label{sec:cutpaste:eff1} - -\textbf{This works from the process (inferior ESS, or iESS) buffer} - -One improvement is to use a \verb+source()+-like facility. - -\begin{enumerate} -\item To source a file into Splus (within ESS): \verb+C-c C-l+ (load file) -\item To find what the errors are (if any): \verb+C-c `+ (backquote). -\end{enumerate} - -The latter will tell you what the error is. You'll have to go back to -the file and edit it. - -\subsection{Efficient Methods 2} -\label{sec:cutpaste:eff2} - -\textbf{This works from the editing (ESS) buffer} - -Better yet, use a file, and send material from the file straight to -the process. This works if the file ends in the proper suffix (and -hence, the mode at the bottom should say ``ESS''). - -The following is possible: -\begin{itemize} -\item Send current line to S: \verb+C-c C-j+ -\item Send current function to S (assumes the cursor is in the - function body): \verb+C-c C-f+. -\item Send current region (highlighted) to S \verb+C-c C-r+ -\item Send whole buffer/file to S \verb+C-c C-b+ -\end{itemize} - - -\section{Editing} -\label{sec:edit} - -\textbf{This works from the editing (ESS) buffer} - -See Section~\ref{sec:cutpaste:eff2} for communication between the code -buffer and the process buffer. - -The help commands and object completion commands (only \verb+C-c [TAB]+ -version) work. - -Syntax-highlighting and formatting are present. For comment indentation: -\begin{enumerate} -\item \verb+#+ gets moved to the right-side of the line -\item \verb+##+ is placed at the current indentation level -\item \verb+###+ is placed flush-left. -\end{enumerate} - -To dump an object into a buffer (for editing, saving, possible reloading): -\begin{enumerate} -\item \verb+C-c C-d+ dumps the named object into an editing buffer (in - ESS mode). -\end{enumerate} - - -\section{Advanced Usage} -\label{sec:advanced} - -\begin{itemize} -\item preliminary integration with noweb, for literate programming and - data analysis (another talk) -\item Has a transcript mode for recreating work and providing - demonstrations. -\item Except for object-completion, everything mentioned here works - \textbf{identically} for Stata, XLispStat, and SAS. -\item Makes versioning (version control, document revision history) - simple. -\end{itemize} -\end{document} diff -Nru ess-18.10.2/doc/archive/ess-manual.org ess-18.10.2+git20220915.f45542e/doc/archive/ess-manual.org --- ess-18.10.2/doc/archive/ess-manual.org 2018-11-10 09:41:10.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/doc/archive/ess-manual.org 1970-01-01 00:00:00.000000000 +0000 @@ -1,102 +0,0 @@ -** Introduction to ESS -*** Why should I use ESS? -*** Overview of current features -*** New features in ESS -*** Authors of and contributors to ESS -*** Getting the latest version of ESS -*** How to read this manual - -** Overview -*** ESS features for the S family -*** ESS for SAS -*** ESS for BUGS -*** ESS for JAGS - -** Installing ESS on your system -*** Requirements -*** Unix (Linux / MacOS / Solaris / ...) Installation -*** Microsoft Windows installation -*** License -*** Stability - -** Customizing ESS - -** ESS mode: editing source code -*** Creating or modifying objects -*** Loading source code into the ESS process -*** Detecting errors in source files -*** Indenting and formatting code -**** Changing indentation styles -*** Motion and completion -*** Maintaining source files -**** Names and locations of dump files -*** Summary of ESS mode commands - -** Inferior ESS mode: interacting with the ESS process -*** Starting an ESS process -**** Running multiple ESS processes -**** ESS processes on Remote Computers -**** S+elsewhere and ESS-elsewhere -**** Changing the startup actions -**** Is the Statistical Process running under ESS? -**** Using emacsclient -*** Interacting with the ESS process -**** Entering commands and fixing mistakes -**** Manipulating the transcript -***** Manipulating the output from the last command -***** Viewing older commands -***** Re-submitting commands from the transcript -***** Keeping a record of your S session -**** Command History -***** References to historical commands -***** Saving the command history -*** Summary of iESS commands - -** Completion -*** Completion of object names -*** Completion of function arguments -*** Minibuffer completion -*** Integration with auto-complete package -*** Icicles - -** The help system -*** ElDoc - -** Transcript mode: manipulating saved ESS process sessions -*** Resubmitting commands from the transcript file -*** Cleaning transcript files - -** Developing with ESS -*** ESS tracebug -*** Editing documentation -**** Editing R documentation (Rd) files -**** Editing Roxygen documentation -*** ESS developer - -** Other ESS features and tools -*** Handy commands -*** Syntactic highlighting of buffers -*** Parenthesis matching -*** Using graphics with ESS -**** Using ESS with the @code{printer()} driver -**** Using ESS with windowing devices -**** Java Graphics Device -*** Imenu -*** Toolbar -*** TAGS -*** Rdired -*** Rutils -*** Interaction with Org mode -*** Support for Sweave in ESS and AUCTeX - -** Bugs and Bug Reporting, Mailing Lists -*** Bugs -*** Reporting Bugs -*** Mailing Lists -*** Help with emacs - -** Indices -*** Key index -*** Function index -*** Variable and program index -*** Concept Index Binary files /tmp/tmpygwz1x8l/nasy0cgw6A/ess-18.10.2/doc/archive/font-cor-s.gif and /tmp/tmpygwz1x8l/8fYE79yjPk/ess-18.10.2+git20220915.f45542e/doc/archive/font-cor-s.gif differ Binary files /tmp/tmpygwz1x8l/nasy0cgw6A/ess-18.10.2/doc/archive/font-cor-s.jpg and /tmp/tmpygwz1x8l/8fYE79yjPk/ess-18.10.2+git20220915.f45542e/doc/archive/font-cor-s.jpg differ Binary files /tmp/tmpygwz1x8l/nasy0cgw6A/ess-18.10.2/doc/archive/font-cor-s.pdf and /tmp/tmpygwz1x8l/8fYE79yjPk/ess-18.10.2+git20220915.f45542e/doc/archive/font-cor-s.pdf differ Binary files /tmp/tmpygwz1x8l/nasy0cgw6A/ess-18.10.2/doc/archive/font-incor-s.gif and /tmp/tmpygwz1x8l/8fYE79yjPk/ess-18.10.2+git20220915.f45542e/doc/archive/font-incor-s.gif differ Binary files /tmp/tmpygwz1x8l/nasy0cgw6A/ess-18.10.2/doc/archive/font-incor-s.jpg and /tmp/tmpygwz1x8l/8fYE79yjPk/ess-18.10.2+git20220915.f45542e/doc/archive/font-incor-s.jpg differ Binary files /tmp/tmpygwz1x8l/nasy0cgw6A/ess-18.10.2/doc/archive/font-incor-s.pdf and /tmp/tmpygwz1x8l/8fYE79yjPk/ess-18.10.2+git20220915.f45542e/doc/archive/font-incor-s.pdf differ Binary files /tmp/tmpygwz1x8l/nasy0cgw6A/ess-18.10.2/doc/archive/hilock-sas.gif and /tmp/tmpygwz1x8l/8fYE79yjPk/ess-18.10.2+git20220915.f45542e/doc/archive/hilock-sas.gif differ Binary files /tmp/tmpygwz1x8l/nasy0cgw6A/ess-18.10.2/doc/archive/hilock-sas.pdf and /tmp/tmpygwz1x8l/8fYE79yjPk/ess-18.10.2+git20220915.f45542e/doc/archive/hilock-sas.pdf differ diff -Nru ess-18.10.2/doc/archive/include-matrix.org ess-18.10.2+git20220915.f45542e/doc/archive/include-matrix.org --- ess-18.10.2/doc/archive/include-matrix.org 2018-11-10 09:41:10.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/doc/archive/include-matrix.org 1970-01-01 00:00:00.000000000 +0000 @@ -1,45 +0,0 @@ -If you look in [[file:Makefile][Makefile]], you see that we currently (2012-11) have 6 (six!) -master files which '@include' other .texi modules, of course the main one -being our manual, [[file:ess.texi][ESS Manual]] (ess.texi). -The "shocking" observation was that e.g., currfeat.texi has *not* been -included by the manual ess.txi. - -Another surprise, only when compiling this table: -We have much too many "bugs**.texi" (and then bugrept.texi for user bug -reporting). - -|-------------------+------+---------+-----------+---------------+-------+--------| -| File / Master: | ess. | readme. | announce. | README.M..S.. | news. | onews. | -|-------------------+------+---------+-----------+---------------+-------+--------| -| ess-defs.texi | 9 | 7 | 7 | | 2 | 2 | -| ../VERSION | 60 | 14 | 14 | | | | -| license.texi | 392 | 80 | 66 | | | | -| stabilty.texi | 396 | 86 | 50 | | | | -| requires.texi | 400 | 92 | 46 | | | | -| getting.texi | 310 | 98 | 38 | | | | -| installation.texi | 371 | 105 | - | | | | -| currfeat.texi | 202 | 122 | 42 | | | | -|-------------------+------+---------+-----------+---------------+-------+--------| -| newfeat.texi | 297 | 128 | 70 | | 3 | | -| onewfeat.texi | 298 | - | - | | | 3 | -|-------------------+------+---------+-----------+---------------+-------+--------| -| bugrept.texi | 35.. | 134 | 58 | | | | -| mailing.texi | 35.. | 140 | 54 | | | | -| authors.texi | *1) | 146 | 62 | | | | -| credits.texi | 304 | - | - | | | | -| help-s.texi | 413 | - | - | | | | -| help-sas.texi | 35.. | - | - | 25 | | | -| help-bugs.texi | 35.. | - | - | | | | -| help-jags.texi | 35.. | - | - | | | | -| help-sp.texi | - | - | - | 19 | | | -| bugs.texi | 35.. | - | - | | | | -|-------------------+------+---------+-----------+---------------+-------+--------| -| ms-inst.texi | - | - | - | 12 | | | -| bugs-ms.texi | - | - | - | 32 | | | -| bugs-s.texi | - | - | - | 39 | | | -| bugs-sas.texi | - | - | - | 46 | | | -|-------------------+------+---------+-----------+---------------+-------+--------| - -*1): authors.texi is included *via* credits.texi - -(Numbers in table are *line numbers* of "@include .." in respective .texi file.) diff -Nru ess-18.10.2/doc/archive/inst_svn.texi ess-18.10.2+git20220915.f45542e/doc/archive/inst_svn.texi --- ess-18.10.2/doc/archive/inst_svn.texi 2018-11-10 09:41:10.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/doc/archive/inst_svn.texi 1970-01-01 00:00:00.000000000 +0000 @@ -1,49 +0,0 @@ - -The SVN repository has been retired. All ESS development is now carried -out with git and github. - -@c There no longer is an anonymous CVS repository for ESS, due to lack of -@c interest, little demand, and problems with security. - -@c text below modified from R-admin.texi (thanks to Kurt for the tip). - -@c The latest development version of ESS is available via -@c @uref{https://svn.R-project.org/ESS/}, the ESS Subversion repository. If -@c you have a Subversion client (see @uref{http://subversion.tigris.org/}), -@c you can download the sources using: -@c @smallexample -@c % svn checkout https://svn.r-project.org/ESS/trunk @var{path} -@c @end smallexample -@c @noindent -@c which will put the ESS files into directory @var{path}. Later, -@c within that directory, `svn update' will bring that directory up to -@c date. Windows-based tools such as TortoiseSVN are also available for -@c downloading the files. Alternatively, you can browse the sources with a -@c web browser at: @uref{https://svn.r-project.org/ESS/trunk, ESS SVN -@c site}. However, please use a subversion client instead to minimize the -@c load when retrieving. - -@c If you remove other versions of ESS from your emacs load-path, you can -@c then use the development version by adding the following to .emacs: - -@c @example -@c (load "/path/to/ess-svn/lisp/ess-site.el") -@c @end example - -@c Note that https is required, and that the SSL certificate for the -@c Subversion server of the R project is - -@c @smallexample -@c Certificate information: -@c - General name: r-project.org -@c - Serial number: 04:9D:4F:0D:53:03:DB -@c - Valid: from 03/10/2014 to 03/10/2016 -@c - Issuer: Starfield Secure Certificate Authority - G2 -@c http://certs.starfieldtech.com/repository/ -@c - SHA1-Fingerprint: F5:15:96:DB:F1:2F:35:1B:96:06:C3:A4:2A:E2:80:78:76:4C:A4:30 -@c - MD5-Fingerprint: D8:7D:4F:8F:ED:92:65:EE:EE:A5:73:2D:BB:F6:35:E6 -@c @end smallexample - -@c @noindent -@c The above *is* trusted. The R-Project paid for it. - diff -Nru ess-18.10.2/doc/archive/inst_tar.texi ess-18.10.2+git20220915.f45542e/doc/archive/inst_tar.texi --- ess-18.10.2/doc/archive/inst_tar.texi 2018-11-10 09:41:10.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/doc/archive/inst_tar.texi 1970-01-01 00:00:00.000000000 +0000 @@ -1,410 +0,0 @@ - -@node Unix installation, Microsoft Windows installation, , Installation -@comment node-name, next, previous, up -@section Unix installation - -@enumerate - -@item - -@code{cd} to a directory where you keep emacs lisp files, or create a -new directory (for example, @file{$HOME/ess}) to hold the distribution. -This directory will be referred to below as "the ESS distribution -directory". - -@emph{Note for XEmacs packages:} ESS is no longer available as an XEmacs package. -@c But, you can still install ESS into the XEmacs package system by choosing -@c @file{ESSDIR}=@file{PREFIX/lib/xemacs/site-packages}. -@c ESS requires that the XEmacs sumo tarball (all XEmacs packages combined) also -@c be installed. For information on installing XEmacs packages, follow this link: -@c @uref{http://www.xemacs.org/Documentation/packageGuide.html, Quickstart Package Guide}. - -@comment It will contain, -@comment at the end, the tar file @file{ess-VERSION.tar.gz}, and a directory for -@comment the ESS source, which will be termed "the ESS-VERSION source directory". -@comment Note that the .elc files may be installed elsewhere (as specified in the -@comment Makefile) if desired. - -@item -Retrieve the latest version from -@uref{http://ess.r-project.org/downloads/ess, ESS downloads area} -to @file{ESSDIR}. - -@item -Extract the files from the disribution. -@display -If you are using GNU tar, @code{tar zxf ess-VERSION.tgz}. -Otherwise, @code{gunzip < ess-VERSION.tgz | tar xf -}, -@end display - -The @code{tar} command will create the subdirectory @file{ess-VERSION} and install -the files there. - -@comment If you are using GNU Emacs 19.29, decompress/unarchive -@comment @file{ESSDIR/ess-VERSION/lisp/19.29.tar.gz}, -@comment read @file{ESSDIR/ess-VERSION/lisp/19.29/README}, follow the instructions -@comment and you might be able to get ESS to work. -@comment @emph{Please note that GNU Emacs 19.29 is no longer supported}. -@comment For a list of supported versions of emacs, see @xref{Requirements}. - -@item -Edit the file @file{ESSDIR/ess-VERSION/lisp/ess-site.el} as explained in the -comments section of that file. -@comment Installations that are using ESS only for S-Plus -@comment 6.x will probably not need to make any changes. Installations that also -@comment have one or more of (S4, S+3/4/5/6/7/8, R, SAS, BUGS, XLispStat, Stata) -@comment may need to uncomment corresponding lines in @file{ESSDIR/ess-VERSION/lisp/ess-site.el}. - -@item -If you are using GNU Emacs add the line -@example -(load "ESSDIR/ess-VERSION/lisp/ess-site") -@end example -to @file{$HOME/.emacs}. @c For XEmacs, if you followed the XEmacs package system -@c installation advice, add the line -@c @example -@c (require 'ess-site) -@c @end example -@c to @file{$HOME/.xemacs/init.el}. Otherwise, for XEmacs, add the line -@c @example -@c (load "ESSDIR/ess-VERSION/lisp/ess-site") -@c @end example -@c to @file{$HOME/.xemacs/init.el}. - -@comment GNU Emacs uses @file{default.el} or -@comment @file{site-init.el} and XEmacs uses @file{site-start.el} for the system -@comment installation file). -@comment Alternatively, if @file{ess-site.el} is in your current @code{load-path}, then: -@comment @example -@comment (require 'ess-site) -@comment @end example -@comment to configure emacs for ESS. - -@item -That's it! ESS is now ready to use. (The remaining step below is only for a -custom installation.) To edit statistical programs, just open files with the -requisite extensions (@file{.R} for R, @file{.sas} for SAS, @file{.bug} for BUGS, -etc.). To start a statistical process within emacs, such as R, type @code{M-x R}. - -@c @item -@c (OPTIONAL) If you are running S-PLUS or R, you might consider -@c installing the database files. From within emacs, @code{C-x d} to the -@c directory containing ESS. Now: -@c @example -@c M-x S+6 -@c @end example -@c to get S running. Once you see the SPLUS prompt, do: -@c @example -@c M-x ess-create-object-name-db -@c @end example -@c (this will create the file @file{ess-sp6-namedb.el}; if it isn't in the -@c ESS directory, move it there). - -@c Then, completions will be autoloaded and will not be regenerated for -@c every session. - -@c For R, do the same, using -@c @example -@c M-x R -@c @end example -@c and then @code{M-x ess-create-object-name-db} creating -@c @file{ess-r-namedb.el}; if it isn't in the ESS directory, move it there). - -@item -@b{(OPTIONAL) READ THIS ITEM THOROUGHLY BEFORE STARTING}: - -If you want to place the compiled files in other locations edit the -@code{LISPDIR}, @code{INFODIR} and @code{ETCDIR} entries in Section 1 of -@file{Makeconf} in the @file{ESSDIR/ess-VERSION} directory. @c (if you are -@c using XEmacs, then uncomment the XEmacs subsection in Section 1) - -You can compile those files by: -@example -make all -@end example - -When that completes successfully, install the compiled files: -@example -make install -@end example - -@c This will install the compiled info files and lisp files. If you are an -@c XEmacs user, then you should be done. If not, then you may have to -@c edit/create the file @file{dir} that is found in the directory specified -@c by @code{INFODIR}: see the sample @file{dir} in ESSDIR/ess-VERSION/doc/info. -@c If @file{dir} does not exist in @code{INFODIR}, then the sample -@c @file{dir} will be installed. - - -@comment An alternative, if you are running XEmacs and have access to the -@comment XEmacs system directories, would be to place the directory in the -@comment site-lisp directory, and simply type @code{make all} (and copy the -@comment documentation as appropriate). -@comment -@comment For GNU Emacs, you would still have to move the files into the top level -@comment site-lisp directory. - -@end enumerate - -@c >>>> FIXME (see comment in ess.texi): error in ``makeinfo readme.texi'' -@c @node Microsoft Windows installation, , Unix installation, Installation -@node Microsoft Windows installation, Requirements, Unix installation, Installation -@comment node-name, next, previous, up -@section Microsoft Windows installation - -For @b{Microsoft Windows installation}, please follow the next steps. - -@enumerate - -@item -@code{cd} to a directory where you keep emacs lisp files, or create a -new directory (for example, @file{c:\ess\}) to hold the distribution. -This directory will be referred to below as "the ESS distribution -directory". - -@emph{Note for XEmacs packages:} ESS is no longer available as an XEmacs -package. @c But, you can still install ESS into the XEmacs package system -@c by choosing @file{ESSDIR}=@file{PREFIX\XEmacs\site-packages}. ESS -@c requires that the XEmacs sumo tarball (all XEmacs packages combined) -@c also be installed. For information on installing XEmacs packages, -@c follow this link: -@c @uref{http://www.xemacs.org/Documentation/packageGuide.html, Quickstart -@c Package Guide}. - -@item -Retrieve the latest zip file (@file{ess-VERSION.zip}) from -@uref{http://ess.r-project.org/downloads/ess, ESS downloads area} and -store it in the ESS distribution directory. Be aware that http browsers -on Windows frequently change the "." and "-" characters in filenames to -other punctuation. Please change the names back to their original form. - -@item -Extract all the files from @file{ess-VERSION.zip} into the ESS -distribution directory as @file{c:\ess\ess-VERSION\}. (It is possible -to unpack the zip archive in Windows Explorer by double clicking on the -folder; you should then see a new folder called @file{ess-VERSION}. -Drag that folder into your ESS distribution directory.) - -@comment @item -@comment Add the line -@comment @example -@comment (load "C:/emacs/ess-VERSION/lisp/ess-site") -@comment @end example -@comment to your emacs initialization file. (GNU Emacs uses the filename -@comment @file{~/.emacs} and XEmacs uses the filename -@comment @file{~/.xemacs/init.el} for the initialization file. The tilde is -@comment recognised by emacs as your HOME directory, i.e. the value of your HOME -@comment environment variable.) Replace -@comment @code{VERSION} above with the version number of ESS. Remember to use -@comment forwardslashes @code{/}, rather than backslashes @code{\}, in your filename -@comment inside emacs code files. - -@item -If you are using GNU Emacs add the line -@example -(load "ESSDIR/ess-VERSION/lisp/ess-site") -@end example -to @file{%HOME%\.emacs}. @c For XEmacs, if you followed the XEmacs package system -@c installation advice, add the line -@c @example -@c (require 'ess-site) -@c @end example -@c to @file{%HOME%\.xemacs\init.el}. Otherwise, for XEmacs, add the line -@c @example -@c (load "ESSDIR/ess-VERSION/lisp/ess-site") -@c @end example -@c to @file{%HOME%\.xemacs\init.el}. -@c @emph{Note:} Both GNU Emacs and XEmacs require that the HOME environment -@emph{Note:} GNU Emacs requires that the HOME environment -variable be set on your system, otherwise, your initialization file will -not be utilized, and therefore, ESS will not work. - -After saving your initialization file, ESS is now installed. Start a -new emacs and you should be ready to use ESS. For example, to edit -statistical programs, load the files with the requisite extensions -(".sas" for SAS, ".S" or "s" or "q" or "Q" for S-PLUS, ".r" or ".R" for -R, and ".lsp" for XLispStat). One further step is needed if you wish to -run statistical processes, see below. - -@item -To run statistical processes under ESS, Windows users will need to make -sure that the directories for the software they will be using is in the -PATH environment variable. On Windows 9x, add lines similar to the -following to your @file{c:\autoexec.bat} file: -@example -path=%PATH%;c:\progra~1\insightful\splus70\cmd -@end example -On Windows NT/2000/XP, add the directories to the PATH using the -@code{My Computer/Control Panel/System/Advanced/Environment Variables} menu. -Note that the directory containing the program is -added to the PATH, not the program itself. One such line is needed -for each software program. Be sure to use the abbreviation -@code{progra~1} and not the long version with embedded blanks. Use -backslashes "@code{\}". - -An alternative, for R users, is that rather than adjusting the PATH -variable, you can add the following to your emacs initialization file -(and restart emacs): -@example -(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. - -Windows users who place S-PLUS anywhere other than the default -location will also need to add the following three lines (properly -adjusted for their location) to their @file{%HOME%\.emacs} or -@file{%HOME%\.xemacs\init.el} file: -@example -(setq-default inferior-S+6-program-name - "c:/progra~1/Insightful/SPLUS70/cmd/Splus") -(setq-default inferior-Sqpe+6-SHOME-name - "c:/progra~1/Insightful/SPLUS70") -(setq-default inferior-Sqpe+6-program-name - "c:/progra~1/Insightful/SPLUS70/cmd/Sqpe.exe") -@end example -The above example uses the default location of S-PLUS in -@code{c:\progra~1\Insightful}. Please note that ESS -considers S-PLUS 6, 7, and 8 to be variants of S+6. - -These users may also need to modify the emacs variable @code{ess-SHOME-versions} -to match their installation in order to get the full set of S-PLUS versions -on their machine into the @code{ESS} menu. - -To start the S-PLUS [678].x GUI from ESS under emacs: -@enumerate -@item -If you use Cygwin bash as your primary shell, then -@example -M-x S -(or @code{M-x S+6}). -@end example -@item -If you use the MSDOS prompt window as your primary shell, then -@example -M-x S+6-msdos -@end example -@end enumerate -You will then be -asked for a pathname ("S starting data directory?"), from which to -start the process. The prompt will propose your current directory -as the default. ESS will start the S-PLUS GUI. There will be -slight delay during which emacs is temporarily frozen. ESS will arrange for -communication with the S-PLUS GUI using the DDE protocol. -Send lines or regions -from the emacs buffer containing your S program (for example, -@file{myfile.s}) to the S-PLUS Commands Window with the -@code{C-c C-n} or @code{C-c C-r} keys. -(If you are still using S-PLUS 4.x or 2000,\ -then use @code{M-x S+4} or @code{M-x S+4-msdos}.) - -To start an S-PLUS [678].x session inside an emacs buffer---and -without the S-PLUS GUI: -@example -M-x Sqpe -(or @code{M-x Sqpe+6}). -@end example -This works with both the bash and msdos shells. -You will then be asked for a pathname ("S starting data -directory?"), from which to start the process. The prompt will -propose your current directory as the default. -You get Unix-like behavior, in particular the entire -transcript is available for emacs-style search commands. -Send lines or regions from the emacs buffer containing your S -program (for example, @file{myfile.s}) to the *S+6* buffer with the -@code{C-c C-n} or @code{C-c C-r} keys. -Interactive graphics are available with Sqpe by using the java -library supplied with S-PLUS 6.1 and newer releases. -Enter the commands: -@example -library(winjava) -java.graph() -@end example -Graphs can be saved from the @code{java.graph} device -in several formats, but not PostScript. If you -need a PostScript file you will need to open a separate -@code{postscript} device. -(If you are still using S-PLUS 4.x or 2000, then use @code{M-x Sqpe+4}.) - -To connect to an already running S-PLUS GUI (started, for example, -from the S-PLUS icon): -@example -M-x S+6-existing -@end example -or -@example -M-x S+6-msdos-existing -@end example -You will then be -asked for a pathname ("S starting data directory?"), from which to -start the process. The prompt will propose your current directory -as the default. ESS will arrange for -communication with the already running S-PLUS GUI using the DDE protocol. -Send lines or regions -from the emacs buffer containing your S program (for example, -@file{myfile.s}) to the S-PLUS Commands Window with the -@code{C-c C-n} or @code{C-c C-r} keys. -(If you are still using S-PLUS 4.x or 2000, - then use @code{M-x S+4-existing} or @code{M-x S+4-msdos-existing}.) - -If you wish to run R, you can start it with: -@example -M-x R -@end example - -XLispStat can not currently be run with -@example -M-x XLS -@end example -Hopefully, this will change. However, you can still edit with -emacs, and cut and paste the results into the XLispStat -*Listener* Window under Microsoft Windows. - -@comment SAS for Windows uses the batch access with function keys that is -@comment described in -@comment @file{doc/README.SAS}. -@comment @xref{ESS(SAS)--MS Windows}. -@comment The user can also edit SAS files -@comment in an @code{ESS[SAS]} buffer and than manually copy and paste them into -@comment an Editor window in the SAS Display Manager. -@comment -@comment For Windows, inferior SAS in an @code{iESS{[SAS]}} buffer does not work -@comment on the local machine. It does work over a network connection to -@comment SAS running on a remote Unix computer. -@comment -@comment Reason: we use ddeclient to interface with programs and SAS doesn't -@comment provide the corresponding ddeserver capability. - -@c @item -@c (OPTIONAL) If you are running Sqpe or R, you might consider -@c installing the database files. From within emacs, @code{C-x d} to -@c the directory containing ESS. Now: -@c @example -@c M-x Sqpe+6 -@c @end example -@c to get S running. Once you see the SPLUS prompt, do: -@c @example -@c M-x ess-create-object-name-db -@c @end example -@c (this will create the file @file{ess-s+6-namedb.el}; if it isn't in the -@c ESS directory, move it there). - -@c Then, completions will be autoloaded and will not be regenerated -@c for every session. - -@c For R, do the same, using -@c @example -@c M-x R -@c @end example -@c and then @code{M-x ess-create-object-name-db} creating -@c @file{ess-r-namedb.el}; if it isn't in the ESS directory, move it -@c there). - -@item That's it! - -@end enumerate -@comment Requirements duplicated? -@comment @node Requirements, , Microsoft Windows installation, Installation -@comment node-name, next, previous, up -@comment @section Requirements -@comment @include requires.texi diff -Nru ess-18.10.2/doc/archive/lectures.txt ess-18.10.2+git20220915.f45542e/doc/archive/lectures.txt --- ess-18.10.2/doc/archive/lectures.txt 2018-11-10 09:41:10.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/doc/archive/lectures.txt 1970-01-01 00:00:00.000000000 +0000 @@ -1,32 +0,0 @@ -Date: Sat, 11 Oct 2003 09:37:10 -0700 -From: rossini@blindglobe.net (A.J. Rossini) -Subject: More teaching/training materials. -To: ESS HelpRUS -Message-ID: <85d6d3vih5.fsf@blindglobe.net> -Content-Type: text/plain; charset=us-ascii - - - -http://www.analytics.washington.edu/~rossini/courses/cph-statcomp/ - -Lecture/Labs 1 and 2 are on For ESS, ESS-Noweb-Sweave. - -Lecture/Lab 4 is on parallel computing with R - -(each Lecture/Lab was just under 2 hours). - -Comments/corrections welcome, they were used last week here in -Copenhagen, so "most" of the bugs are out. - -best, --tony - -p.s. Lecture/Lab 3 needs to be completely redone for WWW work; it -doesn't translate well (some might say, "at all"). - --- -rossini@u.washington.edu http://www.analytics.washington.edu/ -Biomedical and Health Informatics University of Washington -Biostatistics, SCHARP/HVTN Fred Hutchinson Cancer Research Center -UW (Tu/Th/F): 206-616-7630 FAX=206-543-3461 | Voicemail is unreliable -FHCRC (M/W): 206-667-7025 FAX=206-667-4812 | use Email diff -Nru ess-18.10.2/doc/archive/README.additions ess-18.10.2+git20220915.f45542e/doc/archive/README.additions --- ess-18.10.2/doc/archive/README.additions 2018-11-10 09:41:10.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/doc/archive/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-18.10.2/doc/archive/README.elsewhere ess-18.10.2+git20220915.f45542e/doc/archive/README.elsewhere --- ess-18.10.2/doc/archive/README.elsewhere 2018-11-10 09:41:10.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/doc/archive/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-18.10.2/doc/archive/README.Microsoft ess-18.10.2+git20220915.f45542e/doc/archive/README.Microsoft --- ess-18.10.2/doc/archive/README.Microsoft 2018-11-10 09:41:10.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/doc/archive/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-18.10.2/doc/archive/README.Microsoft.texi ess-18.10.2+git20220915.f45542e/doc/archive/README.Microsoft.texi --- ess-18.10.2/doc/archive/README.Microsoft.texi 2018-11-10 09:41:10.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/doc/archive/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-18.10.2/doc/archive/README.noweb.ESS ess-18.10.2+git20220915.f45542e/doc/archive/README.noweb.ESS --- ess-18.10.2/doc/archive/README.noweb.ESS 2018-11-10 09:41:10.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/doc/archive/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 ? - - diff -Nru ess-18.10.2/doc/archive/README.S ess-18.10.2+git20220915.f45542e/doc/archive/README.S --- ess-18.10.2/doc/archive/README.S 2018-11-10 09:41:10.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/doc/archive/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-18.10.2/doc/archive/README.SAS ess-18.10.2+git20220915.f45542e/doc/archive/README.SAS --- ess-18.10.2/doc/archive/README.SAS 2018-11-10 09:41:10.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/doc/archive/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-18.10.2/doc/archive/README.SPLUS4COMMAND ess-18.10.2+git20220915.f45542e/doc/archive/README.SPLUS4COMMAND --- ess-18.10.2/doc/archive/README.SPLUS4COMMAND 2018-11-10 09:41:10.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/doc/archive/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-18.10.2/doc/archive/README.SPLUS4WIN ess-18.10.2+git20220915.f45542e/doc/archive/README.SPLUS4WIN --- ess-18.10.2/doc/archive/README.SPLUS4WIN 2018-11-10 09:41:10.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/doc/archive/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-18.10.2/doc/archive/README.Windows ess-18.10.2+git20220915.f45542e/doc/archive/README.Windows --- ess-18.10.2/doc/archive/README.Windows 2018-11-10 09:41:10.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/doc/archive/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-18.10.2/doc/archive/README.XLispStat ess-18.10.2+git20220915.f45542e/doc/archive/README.XLispStat --- ess-18.10.2/doc/archive/README.XLispStat 2018-11-10 09:41:10.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/doc/archive/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-18.10.2/doc/archive/rgui-doc.txt ess-18.10.2+git20220915.f45542e/doc/archive/rgui-doc.txt --- ess-18.10.2/doc/archive/rgui-doc.txt 2018-11-10 09:41:10.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/doc/archive/rgui-doc.txt 1970-01-01 00:00:00.000000000 +0000 @@ -1,81 +0,0 @@ -;;; Documentation for ess-r-gui.el --- Support for running Rgui on -;;; Windows as an inferior Emacs process - -;; Copyright (C) 2008 A.J. Rossini, Richard M. Heiberger, Martin -;; Maechler, Kurt Hornik, Rodney Sparapani, and Stephen Eglen. - -;; Original Author: Richard M. Heiberger -;; Created: 10 Mar 2008 -;; Maintainers: ESS-core - -This is preliminary documentation for the preliminary release of M-x -Rgui, a new ESS function that allows access to the Rgui Console on -Windows from an emacs R-mode buffer. - -Here are the steps. - -1. Update your R package 'tcltk2' to 1.0-6 or newer - {E.g. inside R: install.packages("tcltk2") # or - update.packages(check.built=TRUE) } - -2. Start Rgui from an icon and enter these three lines into the R Console - library(tcltk2) ## >= 1.0-6 - .ess.command <- function() source("c:/temp/ess-tempfile.R", echo=TRUE) - tclFun(.ess.command) - -3. Set the environment variable R_HOME in emacs, for example with - (setenv "R_HOME" "c:/progra~1/R/R-2.6.1") - -4. Make sure you have a directory named c:/TEMP - -5. Then, load ess-r-gui.el into emacs and type - M-x Rgui - -This will create a new MSDOS command buffer named "*R*" which will -allow communication with the Rgui Console. Most ESS keys work. - -I have tested these - -C-c C-n works for complete commands. multi-line commands will get - a syntax error. - -C-c C-c works for lines surrounded by a blank line at top and bottom. - -C-c C-r works for a highlighted region. - -C-c C-v works for help - - - -The technology is similar (not identical) to the technology I used in -connecting to the S-Plus Gui on Windows. In Rgui I send the -higlighted lines to a file and then use the execdde.exe from tcltk2 to -source() the lines. - -The source() function suppresses intermediate blank lines and trailing -comments. When the seven lines below are sourced, only lines -1,2,4,5,6 are echoed. Lines 3 and 7 are not echoed. This means that -well-commented user source code will not have complete comments in the -output transcript in the Console. - -## comment 1 -123 - -## comment 4 - -456 -## comment 7 - - -Possible improvements - -1. Duncan suggested I write my own ess.source to echo all lines. That -is another project for another day. - -2. Currently M-x Rgui connects to an existing Rgui that has loaded the -tcltk2 package. It should be easy to detect whether such a process is -running and start one if not. - -3. I would like single line of a multi-line command to be sent over -with a series of C-c C-n, as works for other R and S-Plus interfaces. -It can't be done as long as the R source() command is used. diff -Nru ess-18.10.2/doc/archive/rmh-talk.tex ess-18.10.2+git20220915.f45542e/doc/archive/rmh-talk.tex --- ess-18.10.2/doc/archive/rmh-talk.tex 2018-11-10 09:41:10.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/doc/archive/rmh-talk.tex 1970-01-01 00:00:00.000000000 +0000 @@ -1,388 +0,0 @@ -%% Slides given at S-PLUS Users Conference, October 1997, by RMH. - -\documentclass[12pt]{article} %latex2e -\usepackage{slverb} %latex2e -%\documentstyle[12pt]{article} %latex 2.09 - -% Warning: do not compress blanks into tabs. -% It will destroy the spacing in the S functions in the Example environment. - -%\newfont{\sltt}{cmsltt10 scaled\magstep3} % load slant tt font Large -\newfont{\sltt}{cmsltt10 scaled\magstep5} % load slant tt font Huge %duplicate for Huge -\newfont{\slttH}{cmsltt10 scaled\magstep5} % load slant tt font Huge -\newfont{\ttHuge}{cmtt12 scaled\magstep4} % load tt font Huge -\newfont{\itHuge}{cmti12 scaled\magstep4} % load italic font Huge - -\newcommand{\LB}{{\tt\char'173}} % \tt { -\newcommand{\RB}{{\tt\char'175}} % \tt } -\newcommand{\BS}{{\tt\char'134}} % \tt \ -\newcommand{\HH}{{\tt\char'043}} % \tt # -%\newcommand{\slLB}{{\sltt\char'173}} % \sltt { -%\newcommand{\slRB}{{\sltt\char'175}} % \sltt } -%\newcommand{\slBS}{{\sltt\char'134}} % \sltt \ -%\newcommand{\slHH}{{\sltt\char'043}} % \sltt # -\newcommand{\slLBH}{{\slttH\char'173}} % \slttH { -\newcommand{\slRBH}{{\slttH\char'175}} % \slttH } -\newcommand{\slBSH}{{\slttH\char'134}} % \slttH \ -\newcommand{\slHHH}{{\slttH\char'043}} % \slttH # -% These commands give the stated character in the correct font in LaTeX. -% Beware of spacing in the "Example" environment, where spaces are significant: -% "\LB{}contents\RB" produces "{contents}" -% "\LB contents \RB" produces "{ contents }" - - -\newcommand{\hlinefill}{\mbox{\rule{0pt}{1ex}}\hrulefill} - - -\pagestyle{empty} -\topskip -1in -\topmargin -1in -\textheight 7.5in -\raggedbottom - -\textwidth 10in -\parindent 0in -\oddsidemargin -.5in - -\special{landscape} - -\newcommand{\la}{{\rm\Huge$\leftarrow$}} - -\newcommand{\mc}[1]{\multicolumn{2}{l}{#1}} -\newcommand{\marpar}[1]{\marginpar{\raggedright#1}} -\newcommand{\Twiddle}{$\sim$} - -%10pt -%\newenvironment{exsf}{\begin{list}{}{\setlength{\leftmargin}{\parindent}}\item[]\small\sf}{\end{list}} - -%12pt -%\newenvironment{exsf}{\begin{list}{}{\setlength{\leftmargin}{\parindent}}\item[]\small\sf\boldmath}{\end{list}} - -%12pt Huge -\newenvironment{exsf}{\begin{list}{}{\setlength{\leftmargin}{\parindent}}\item[]\sf\boldmath}{\end{list}} - -\newcommand{\s}[1]{\mbox{\protect\small\sf#1}} -\newcommand{\msf}[1]{\mbox{\tiny\sf #1}} -\newcommand{\msm}[1]{\mbox{\scriptsize$#1$}} - -%\renewcommand{\topfraction}{1.} -%\renewcommand{\bottomfraction}{0.} -%\renewcommand{\textfraction}{0.} -%\renewcommand{\floatpagefraction}{1.} -%\renewcommand{\floatsep}{0pt} -%\renewcommand{\textfloatsep}{0pt} -%\setcounter{topnumber}{25} -%\setcounter{bottomnumber}{0} -%\setcounter{totalnumber}{25} - -%\renewcommand{\dbltopfraction}{1.} -%\renewcommand{\dblfloatpagefraction}{1.} -%\renewcommand{\dblfloatsep}{0pt} -%\renewcommand{\dbltextfloatsep}{0pt} -%\setcounter{dbltopnumber}{25} - -\newcommand{\shortspace}{ - \setlength{\topsep}{0in} - \setlength{\itemsep}{0in} - \setlength{\parsep}{0in} - \setlength{\parskip}{0in} -} - -\begin{document} -\Huge -\parskip=1ex - - -\begin{center} -\Huge -ESS-mode and S-Plus\\ -Richard M. Heiberger\\[1ex] -based on joint work with\\ -A.J. Rossini(U South Carolina),\\ - Kurt Hornik(TU-Wien), and Martin Maechler (ETHZ).\\[2ex] -Thanks also to\\ -Doug Bates, Ed Kademan, Frank Ritter (initial versions),\\ -and David Smith (3.x, 4.x)\\[3ex] - -Richard M. Heiberger\\[.4ex] -Temple University\\[.4ex] -Philadelphia, PA 19122-2585\\[.4ex] -{\sf rmh@astro.ocis.temple.edu}\\[2ex] -S-PLUS Users Conference, Seattle, October 1997 -\end{center} - - -\newpage -\begin{center}Abstract\end{center} -ESS [Emacs Speaks Statistics] (formerly S-mode) is a a GNU Emacs -package for running S(plus), R, X-LispStat, SAS and potentially other -interactive `statistical' languages in an `inferior' buffer, editing -source code in these languages and interacting with the running -program. This talk will discuss the capabilities and advantages of -using ESS as the primary interface to Splus. - - -I am talking about the version which will be released in November 1997 -as ESS-5.0.\\ -\hspace*{2ex}{\sf http://franz.stat.wisc.edu/pub/ESS/ESS-5.0.tar.gz}\\ -\hspace*{2ex}{\sf ftp://franz.stat.wisc.edu/pub/ESS/ESS-5.0.tar.gz}\\ -The previous stable version was 4.8 in -{\sf S-mode-4.8.MM6.XE2.tar.gz} - -\newpage - -What is S-Plus - -What is EMACS - -What is ESS-mode - -Why should I use ESS-mode with S-Plus - -Other features in ESS-mode - -\newpage -\begin{itemize} -\item -What is S-Plus? - -The best, most expressive, most fun, most powerful environment and -program for designing methods for statistical analysis of data and for -displaying and analyzing data. - -\newpage -\item -What is EMACS? - -A text editor that is fully configurable and extensible, can work with -many files simultaneously, interacts with the computer operating -system and other executing processes, has language specific -customizations, and can indeed do anything (the previous edition -iconized to the Kitchen Sink). - -In addition to S, Emacs has modes designed for \TeX, \LaTeX, fortran, -c, lisp, text, directories, telnet, rlogin, terminal emulators, nroff, -pascal, c++, ada, asm, etc. - -Mode customizations include indentation patterns, syntactic -highlighting, comment structure, and interaction with the program that -uses the file as input. - -\newpage -\item -What is ESS-mode? - -A package written in emacs which is designed to work with Statistical -software. The initial development under the name S-mode was designed -for S. It has been extended to dialects of S (S-Plus, S4, R) and now -to other statistical packages (SAS, Xlispstat). With the extension -came the name change to ESS-mode (Emacs Speaks Statistics). - -There are three primary components to ESS -\begin{description} -\item [S-mode] for editing {\tt myfile.s} and submitting individual -lines and paragraphs of S code to the running S process. -\item [inferior-ess-mode] for executing an S process inside an emacs buffer. -\item [S-transcript-mode] for reviewing and possibly re-executing the -transcript of a previous S process. -\end{description} - - -\item -Why should I use ESS-mode with S-Plus? - -It will improve your productivity. - - -\newpage -{\bf S-mode.} Automatic syntactic indentation and highlighting of source -\vspace*{-.5ex} - -{ -\underline{\slttH \slHHH\slHHH as typed -- too long. Line is folded}\\ - {\tt case0701 <- read.table(file={\slttH'case0701.asc'}, header\BS} \\ - {\tt =\underline{T})}\\ -\vspace*{.0ex} - -\underline{\slttH{\slHHH\slHHH insert line break, syntactic indentation lost}}\\ - \tt{case0701 <- read.table(file={\slttH'case0701.asc'},}\\ - \tt{header=\underline{T})}\\ -\vspace*{.0ex} - -\underline{\slttH{\slHHH\slHHH automatic indentation at right parenthesis level}}\\ - \tt{case0701 <- read.table(file={\slttH'case0701.asc'},}\\ - \tt\verb+ header=+\underline{T})\\ -\vspace*{.0ex} - -Here by font, on a terminal by color.\\ -\underline{\slttH{\slHHH\slHHH comments}}~~~~~~~{\rm underlined italic}\\ - {\slttH"quoted strings"}~{\rm italic}\\ -\underline{keywords}~~~~~~~~~{\rm underlined} -} - - -\newpage -{\bf S-mode.} Fill-paragraph understands comments. -\vspace*{2ex} - -Too long and folded.\\ -\underline{\slttH\slHHH\slHHH~Sometimes statements are complicated with many}\BS\\ -\underline{\slttH levels of}\\ -\underline{\slttH\slHHH\slHHH~ parentheses. ESS gets the indentation right.} -\vspace*{3ex} - -Fill-paragraph broke lines evenly and generated the comment symbols.\\ -\underline{\slttH\slHHH\slHHH~Sometimes statements are complicated with}\\ -\underline{\slttH\slHHH\slHHH~many levels of parentheses. ESS gets the}\\ -\underline{\slttH\slHHH\slHHH~indentation right.} - -\newpage -{\bf S-mode.} Detects unbalanced parentheses -\vspace*{2ex} - -\underline{\slttH\slHHH\slHHH~Complicated statement} - -{\ \tt if ((abs(end(x) + tspar(x)["deltat"] - start(y))}\\ -{\ \tt \hspace*{3em}< eps) \&\&}\\ -{\ \tt \hspace*{2.5em}(frequency(x) == frequency(y)) \&\&}\\ -{\ \tt \hspace*{2.5em}\fbox{\slttH(}(length(units(x))==0) ||}\\ -{\ \tt \hspace*{3em}(length(units(y))==0) ||}\\ -{\ \tt \hspace*{3em}(units(x) == units(y))\fbox{\slttH]})} -\vspace*{2ex} - - -On a color display screen the unbalanced parentheses are bright purple. - - -\vspace*{2ex} - -Syntactic highlighting simplifies detection of unbalanced\\ -quotation marks. - -{\tt tmp <- f(x, {\slttH"this is a string, y, z)}} - - - -\newpage - -{\bf inferior-ess-mode.} Evaluating lines of S source - -Program statements and function definitions -can be developed in an editing window that is -NOT the same as the executing S process. - -The lines are sent to S with keyboard -commands. - - -\hlinefill -\begin{verbatim} - -lm( y ~ x, data=mydata) -\end{verbatim} -\begin{slverbatim} ---**-Emacs: test.s (ESS[S] [none])--L1--All------ -\end{slverbatim} -\begin{verbatim} -> lm( y ~ x, data=mydata) -Error: Object "mydata" not found -Dumped - -\end{verbatim} -\begin{slverbatim} ---**-Emacs: *S+3:1* (iESS [S+3:1]: run)--L6--All-- - -\end{slverbatim} -\hlinefill - - -Errors are corrected in the editing window and resent. -\newpage -Errors are corrected in the editing window and resent. - -\hlinefill - -\begin{verbatim} - -lm( y ~ x, data=myrealdata) -\end{verbatim} -\begin{slverbatim} ---**-Emacs: test.s (ESS[S] [none])--L1--All------ -\end{slverbatim} -\begin{verbatim} -> lm( y ~ x, data=mydata) -Error: Object "mydata" not found -Dumped -> lm( y ~ x, data=myrealdata) -\end{verbatim} -\begin{slverbatim} - ---**-Emacs: *S+3:1* (iESS [S+3:1]: run)--L6--All-- -\end{slverbatim} -\hlinefill - -The corrected {\tt test.s} is now a permanent record of the -commands that are needed. - -This form of interaction between the editing process and the S -execution is usually the best way to develop a set of functions. - -\newpage -{\bf inferior-ess-mode.} The session file is always available. - -The entire S session is in a buffer and can be be searched, edited, -reviewed, saved during the current session. Previous results never -run off the top of the screen and are never subject to arbitrary line -restrictions. - -The buffer containing the S session transcript can be saved as a file. -The file can be revisited later for editing into a report or handout. -The file can be brought back into a buffer in S-transcript-mode and used as -the base for further development. - -\newpage -{\bf S-transcript-mode.} The transcript of a previous S session can -be brought back and used as model for further development. When the -cursor is placed on any line of a multi-line command, the entire -command can be sent over -to any relevant active inferior S-process with a single keystroke. - -\begin{verbatim} -> xyplot(data ~ voltage | power, data=time.powers, -+ scales=list(y=list(relation="free")), -+ ylab="powers of time", -+ main="case0802 ladder of powers") -> -\end{verbatim} - -Once the command works correctly, it can be cleaned mechanically with -the {\tt ess-transcript-clean-region} function. - -\begin{verbatim} -xyplot(data ~ voltage | power, data=time.powers, - scales=list(y=list(relation="free")), - ylab="powers of time", - main="case0802 ladder of powers") -\end{verbatim} - -\newpage -\item -Other features in ESS-mode - -\begin{itemize} -\item Help files go to their own buffer. Many can be viewed simultaneously. -\item Several different instantiations of the same or different dialects of S (or other -statistical program) can be controlled simultaneously through the same emacs process. -\item Multiple S source files can be developed simultaneously. -\item ESS-mode recognizes functions, multi-line statements, -highlighted regions, parenthetical expressions. -\item When an error is detected in a source file, ESS switches the display to the file and -places the cursor on the line where the error was detected. -\item Object-name-completion. -\item Menu access. -\end{itemize} - -\end{itemize} -\end{document} - - diff -Nru ess-18.10.2/doc/archive/slverb.sty ess-18.10.2+git20220915.f45542e/doc/archive/slverb.sty --- ess-18.10.2/doc/archive/slverb.sty 2018-11-10 09:41:10.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/doc/archive/slverb.sty 1970-01-01 00:00:00.000000000 +0000 @@ -1,77 +0,0 @@ -\message{slverbatim,} -% **************************************** -% * slverbATIM * -% **************************************** -% -% The slverbatim environment uses the fixed-width \sltt font, turns blanks into -% spaces, starts a new line for each carrige return (or sequence of -% consecutive carriage returns), and interprets EVERY character literally. -% I.e., all special characters \, {, $, etc. are \catcode'd to 'other'. -% -% The command \slverb produces in-line slverbatim text, where the argument -% is delimited by any pair of characters. E.g., \slverb #...# takes -% '...' as its argument, and sets it slverbatim in \sltt font. -% -% The *-variants of these commands is the same, except that spaces -% print as the TeXbook's space character instead of as blank spaces. - -{\catcode`\^^M=13 \gdef\@gobblecr{\@ifnextchar -{\@gobble}{\ignorespaces}}} - -{\catcode`\ =\active\gdef\@vobeyspaces{\catcode`\ \active \let \@xobeysp}} - -% Definition of \@xobeysp chaned on 19 Nov 86 from -% \def\@xobeysp{\leavevmode{} } -% to prevent line breaks at spaces. Change suggested by -% Nelson Beebe -% -\def\@xobeysp{\leavevmode\penalty10000\ } - - - -\begingroup \catcode `|=0 \catcode `[= 1 -\catcode`]=2 \catcode `\{=12 \catcode `\}=12 -\catcode`\\=12 |gdef|@xslverbatim#1\end{slverbatim}[#1|end[slverbatim]] -|gdef|@sxslverbatim#1\end{slverbatim*}[#1|end[slverbatim*]] -|endgroup - -\def\@sslverbatim{\obeyspaces\@slverbatim} - -\def\@gobble#1{} - -\def\@slverbatim{\trivlist \item[]\if@minipage\else\vskip\parskip\fi -\leftskip\@totalleftmargin\rightskip\z@ -\parindent\z@\parfillskip\@flushglue\parskip\z@ -\@tempswafalse \def\par{\if@tempswa\hbox{}\fi\@tempswatrue\@@par} -\obeylines \sltt \catcode``=13 \@noligs \let\do\@makeother \dospecials} - -\def\slverbatim{\@slverbatim \frenchspacing\@vobeyspaces \@xslverbatim} -\let\endslverbatim=\endtrivlist - -\@namedef{slverbatim*}{\@slverbatim\@sxslverbatim} -\expandafter\let\csname endslverbatim*\endcsname =\endtrivlist - - -\def\@makeother#1{\catcode`#112\relax} - -\def\slverb{\begingroup \catcode``=13 \@noligs -\sltt \let\do\@makeother \dospecials -\@ifstar{\@sslverb}{\@slverb}} - -\def\@sslverb#1{\def\@tempa ##1#1{##1\endgroup}\@tempa} - -\def\@slverb{\obeyspaces \frenchspacing \@sslverb} - - -%% \@noligs prevents ?` and !` from being treated as ligatures -%% added 19 April 86 - - -\begingroup -\catcode``=13 -\gdef\@noligs{\let`=\@lquote} -\endgroup - -\def\@lquote{{\kern\z@}`} - - diff -Nru ess-18.10.2/doc/archive/Why_R_mode_not_S_mode.txt ess-18.10.2+git20220915.f45542e/doc/archive/Why_R_mode_not_S_mode.txt --- ess-18.10.2/doc/archive/Why_R_mode_not_S_mode.txt 2018-11-10 09:41:10.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/doc/archive/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-18.10.2/doc/archive/Why_S-mode_Rocks.DMS ess-18.10.2+git20220915.f45542e/doc/archive/Why_S-mode_Rocks.DMS --- ess-18.10.2/doc/archive/Why_S-mode_Rocks.DMS 2018-11-10 09:41:10.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/doc/archive/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-18.10.2/doc/authors.texi ess-18.10.2+git20220915.f45542e/doc/authors.texi --- ess-18.10.2/doc/authors.texi 2018-11-10 09:41:10.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/doc/authors.texi 2022-10-15 08:06:36.000000000 +0000 @@ -35,7 +35,7 @@ @uref{mailto:henning.red@@googlemail.com, Henning Redestig} @c -------- @item -@c @uref{http://vitalie.spinu.info/, Vitalie Spinu} +@c @uref{http://github.com/vspinu, Vitalie Spinu} @uref{mailto:spinuvit@@gmail.com, Vitalie Spinu} @c -------- @item diff -Nru ess-18.10.2/doc/ChangeLog ess-18.10.2+git20220915.f45542e/doc/ChangeLog --- ess-18.10.2/doc/ChangeLog 2018-11-10 09:41:10.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/doc/ChangeLog 1970-01-01 00:00:00.000000000 +0000 @@ -1,67 +0,0 @@ -2013-07-02 Rodney Sparapani - - * readme.texi/announc.texi: cosmetic changes to title - -2013-07-01 Rodney Sparapani - - * ess.texi/allnews.texi: cosmetic changes to title - -2013-06-28 Rodney Sparapani - - * help-sas.texi (ESS): convert ESS(SAS) to ESS[SAS] - in the table of contents as was done for BUGS/JAGS - however, this is not a complete solution since the - nodes themselves are still named ESS(SAS)--... - and there is no way to fix that, right? - -2013-06-12 Rodney Sparapani - - * allnews.texi/Makefile (New features): All "new" - features as discussed in ess-core; see below - -2013-06-12 Rodney Sparapani - - * ess.texi/Makefile (New features): really "new" as - discussed in ess-core; see below - -2013-06-07 Rodney Sparapani - - * onewfeat.texi/newfeat.texi: migrated pre-12.03 - features to onewfeat.texi However, this will have - no practical effect until we stop including - onewfeat.texi from ess.texi; see below - -2013-04-11 Rodney Sparapani - - * onewfeat.texi/newfeat.texi: migrated pre-5.3.10 new - features to old new features in accordance with downloads/OLD; - but, I think we need to go further: is "new" valid - more than 2 years, i.e. 5.14+ (07/11)? However, currently - this migration has no practical effect since ess.texi includes - both newfeat.texi and onewfeat.texi; does that really make sense? - -2013-03-08 Rodney Sparapani - - * newfeat.texi: -@item @ESS{[SAS]}: long over-looked @code{SAS-mode-hook} appears! - -2013-02-25 Rodney Sparapani - - * Makefile: ignore warnings from makeinfo - -2013-01-23 Rodney Sparapani - - * currfeat.texi: cleaning up the language - in Languages Supported... - S family (R and S+ AKA S-PLUS) - -2012-07-06 Rodney Sparapani - - * ess.texi (ESS tracebug): just trying to - see what would make the tracebug key - tables look right - -2012-06-22 Rodney Sparapani - - * credits.texi: fixed a typo - diff -Nru ess-18.10.2/doc/CONTRIBUTING.org ess-18.10.2+git20220915.f45542e/doc/CONTRIBUTING.org --- ess-18.10.2/doc/CONTRIBUTING.org 1970-01-01 00:00:00.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/doc/CONTRIBUTING.org 2022-10-15 08:06:36.000000000 +0000 @@ -0,0 +1,29 @@ +* Contributing code +Please make sure your contribution: + +- Does not introduce any byte compilation warnings or cause existing + tests to fail (=make test=) +- Satisfies M-x checkdoc + +We follow standard Elisp coding conventions with the following +exceptions: + +- =indent-tabs-mode= should be =nil= +- =sentence-end-double-space= should be =nil= + +Both of these are taken care of by the .dir-locals.el file. We do not +require internal functions to be documented if their name is +descriptive enough. + +If you have contributed to ESS in the past but changed your git +username or email, please add the proper alias to .mailmap (see +git-shortlog(1) for the format). + +** FSF copyright assignment + +Unless your change is less than about 15 lines of code, you must +assign copyright to the FSF. This is the same process that Emacs +itself and all packages in GNU ELPA use (the paperwork can cover +both). Instructions for this process can be found [[https://git.savannah.gnu.org/cgit/gnulib.git/tree/doc/Copyright/request-assign.future][here]]. If you have +already signed the paperwork for GNU Emacs, nothing else needs to be +done. diff -Nru ess-18.10.2/doc/dir.txt ess-18.10.2+git20220915.f45542e/doc/dir.txt --- ess-18.10.2/doc/dir.txt 2018-11-10 09:41:10.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/doc/dir.txt 1970-01-01 00:00:00.000000000 +0000 @@ -1,16 +0,0 @@ -This is the file .../info/dir, which contains the -topmost node of the Info hierarchy, called (dir)Top. -The first time you invoke Info you start off looking at this node. - -File: dir, Node: Top, This is the top of the INFO tree - - This (the Directory node) gives a menu of major topics. - Typing "q" exits, "?" lists all Info commands, "d" returns here, - "h" gives a primer for first-timers, - "mEmacs" visits the Emacs manual, etc. - - In Emacs, you can click mouse button 2 on a menu item or cross reference - to select it. - -* Menu: - diff -Nru ess-18.10.2/doc/ess.aux ess-18.10.2+git20220915.f45542e/doc/ess.aux --- ess-18.10.2/doc/ess.aux 2018-11-10 09:41:22.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/doc/ess.aux 1970-01-01 00:00:00.000000000 +0000 @@ -1,309 +0,0 @@ -@xrdef{Introduction-title}{Introduction to ESS} -@xrdef{Introduction-snt}{Chapter@tie 1} -@xrdef{Features-title}{Why should I use ESS?} -@xrdef{Features-snt}{Section@tie 1.1} -@xrdef{Current Features-title}{Features Overview} -@xrdef{Current Features-snt}{Section@tie 1.1.1} -@xrdef{Introduction-pg}{1} -@xrdef{Features-pg}{1} -@xrdef{Current Features-pg}{2} -@xrdef{New features-title}{New features in ESS} -@xrdef{New features-snt}{Section@tie 1.2} -@xrdef{New features-pg}{3} -@xrdef{Credits-title}{Authors of and contributors to ESS} -@xrdef{Credits-snt}{Section@tie 1.3} -@xrdef{Credits-pg}{8} -@xrdef{Manual-title}{How to read this manual} -@xrdef{Manual-snt}{Section@tie 1.4} -@xrdef{Manual-pg}{9} -@xrdef{Installation-title}{Installing ESS on your system} -@xrdef{Installation-snt}{Chapter@tie 2} -@xrdef{Installing from a third-party repository-title}{Installing from a third-party repository} -@xrdef{Installing from a third-party repository-snt}{Section@tie 2.1} -@xrdef{Installing from source-title}{Installing from source} -@xrdef{Installing from source-snt}{Section@tie 2.2} -@xrdef{Installation-pg}{11} -@xrdef{Installing from a third-party repository-pg}{11} -@xrdef{Installing from source-pg}{11} -@xrdef{Activating and Loading ESS-title}{Activating and Loading ESS} -@xrdef{Activating and Loading ESS-snt}{Section@tie 2.3} -@xrdef{Check Installation-title}{Check Installation} -@xrdef{Check Installation-snt}{Section@tie 2.4} -@xrdef{Activating and Loading ESS-pg}{12} -@xrdef{Check Installation-pg}{12} -@xrdef{Interactive ESS-title}{Interacting with statistical programs} -@xrdef{Interactive ESS-snt}{Chapter@tie 3} -@xrdef{Starting up-title}{Starting an ESS process} -@xrdef{Starting up-snt}{Section@tie 3.1} -@xrdef{Multiple ESS processes-title}{Running more than one ESS process} -@xrdef{Multiple ESS processes-snt}{Section@tie 3.2} -@xrdef{ESS processes on Remote Computers-title}{ESS processes on Remote Computers} -@xrdef{ESS processes on Remote Computers-snt}{Section@tie 3.3} -@xrdef{Interactive ESS-pg}{13} -@xrdef{Starting up-pg}{13} -@xrdef{Multiple ESS processes-pg}{13} -@xrdef{ESS processes on Remote Computers-pg}{13} -@xrdef{Customizing startup-title}{Changing the startup actions} -@xrdef{Customizing startup-snt}{Section@tie 3.4} -@xrdef{Customizing startup-pg}{15} -@xrdef{Entering commands-title}{Interacting with the ESS process} -@xrdef{Entering commands-snt}{Chapter@tie 4} -@xrdef{Command-line editing-title}{Entering commands and fixing mistakes} -@xrdef{Command-line editing-snt}{Section@tie 4.1} -@xrdef{Transcript-title}{Manipulating the transcript} -@xrdef{Transcript-snt}{Section@tie 4.2} -@xrdef{Entering commands-pg}{16} -@xrdef{Command-line editing-pg}{16} -@xrdef{Transcript-pg}{16} -@xrdef{Last command-title}{Manipulating the output from the last command} -@xrdef{Last command-snt}{Section@tie 4.2.1} -@xrdef{Process buffer motion-title}{Viewing older commands} -@xrdef{Process buffer motion-snt}{Section@tie 4.2.2} -@xrdef{Transcript resubmit-title}{Re-submitting commands from the transcript} -@xrdef{Transcript resubmit-snt}{Section@tie 4.2.3} -@xrdef{Last command-pg}{17} -@xrdef{Process buffer motion-pg}{17} -@xrdef{Transcript resubmit-pg}{17} -@xrdef{Saving transcripts-title}{Keeping a record of your R session} -@xrdef{Saving transcripts-snt}{Section@tie 4.2.4} -@xrdef{Command History-title}{Command History} -@xrdef{Command History-snt}{Section@tie 4.3} -@xrdef{Saving transcripts-pg}{18} -@xrdef{Command History-pg}{19} -@xrdef{Saving History-title}{Saving the command history} -@xrdef{Saving History-snt}{Section@tie 4.3.1} -@xrdef{History expansion-title}{References to historical commands} -@xrdef{History expansion-snt}{Section@tie 4.4} -@xrdef{Saving History-pg}{20} -@xrdef{History expansion-pg}{20} -@xrdef{Hot keys-title}{Hot keys for common commands} -@xrdef{Hot keys-snt}{Section@tie 4.5} -@xrdef{Hot keys-pg}{21} -@xrdef{Statistical Process running in ESS?-title}{Is the Statistical Process running under ESS?} -@xrdef{Statistical Process running in ESS?-snt}{Section@tie 4.6} -@xrdef{Emacsclient-title}{Using emacsclient} -@xrdef{Emacsclient-snt}{Section@tie 4.7} -@xrdef{Other-title}{Other commands provided by inferior-ESS} -@xrdef{Other-snt}{Section@tie 4.8} -@xrdef{Statistical Process running in ESS?-pg}{23} -@xrdef{Emacsclient-pg}{23} -@xrdef{Other-pg}{23} -@xrdef{Evaluating code-title}{Sending code to the ESS process} -@xrdef{Evaluating code-snt}{Chapter@tie 5} -@xrdef{Evaluating code-pg}{25} -@xrdef{Transcript Mode-title}{Manipulating saved transcript files} -@xrdef{Transcript Mode-snt}{Chapter@tie 6} -@xrdef{Resubmit-title}{Resubmitting commands from the transcript file} -@xrdef{Resubmit-snt}{Section@tie 6.1} -@xrdef{Clean-title}{Cleaning transcript files} -@xrdef{Clean-snt}{Section@tie 6.2} -@xrdef{Transcript Mode-pg}{27} -@xrdef{Resubmit-pg}{27} -@xrdef{Clean-pg}{27} -@xrdef{Editing objects-title}{Editing objects and functions} -@xrdef{Editing objects-snt}{Chapter@tie 7} -@xrdef{Edit buffer-title}{Creating or modifying R objects} -@xrdef{Edit buffer-snt}{Section@tie 7.1} -@xrdef{Loading-title}{Loading source files into the ESS process} -@xrdef{Loading-snt}{Section@tie 7.2} -@xrdef{Editing objects-pg}{28} -@xrdef{Edit buffer-pg}{28} -@xrdef{Loading-pg}{28} -@xrdef{Error Checking-title}{Detecting errors in source files} -@xrdef{Error Checking-snt}{Section@tie 7.3} -@xrdef{Indenting-title}{Indenting and formatting R code} -@xrdef{Indenting-snt}{Section@tie 7.4} -@xrdef{Error Checking-pg}{29} -@xrdef{Indenting-pg}{29} -@xrdef{Styles-title}{Changing styles for code indentation and alignment} -@xrdef{Styles-snt}{Section@tie 7.4.1} -@xrdef{Styles-pg}{30} -@xrdef{Other edit buffer commands-title}{Commands for motion, completion and more} -@xrdef{Other edit buffer commands-snt}{Section@tie 7.5} -@xrdef{Source Files-title}{Maintaining R source files} -@xrdef{Source Files-snt}{Section@tie 7.6} -@xrdef{Other edit buffer commands-pg}{31} -@xrdef{Source Files-pg}{31} -@xrdef{Source Directories-title}{Names and locations of dump files} -@xrdef{Source Directories-snt}{Section@tie 7.7} -@xrdef{Source Directories-pg}{33} -@xrdef{Help-title}{Reading help files} -@xrdef{Help-snt}{Chapter@tie 8} -@xrdef{Help-pg}{35} -@xrdef{Completion-title}{Completion} -@xrdef{Completion-snt}{Chapter@tie 9} -@xrdef{Object names-title}{Completion of object names} -@xrdef{Object names-snt}{Section@tie 9.1} -@xrdef{Function arguments-title}{Completion of function arguments} -@xrdef{Function arguments-snt}{Section@tie 9.2} -@xrdef{Minibuffer completion-title}{Minibuffer completion} -@xrdef{Minibuffer completion-snt}{Section@tie 9.3} -@xrdef{Completion-pg}{37} -@xrdef{Object names-pg}{37} -@xrdef{Function arguments-pg}{37} -@xrdef{Auto-complete-title}{Integration with auto-complete package} -@xrdef{Auto-complete-snt}{Section@tie 9.4} -@xrdef{Company-title}{Company} -@xrdef{Company-snt}{Section@tie 9.5} -@xrdef{Icicles-title}{Icicles} -@xrdef{Icicles-snt}{Section@tie 9.6} -@xrdef{Minibuffer completion-pg}{38} -@xrdef{Auto-complete-pg}{38} -@xrdef{Company-pg}{38} -@xrdef{Icicles-pg}{38} -@xrdef{Developing with ESS-title}{Developing with ESS} -@xrdef{Developing with ESS-snt}{Chapter@tie 10} -@xrdef{ESS tracebug-title}{ESS tracebug} -@xrdef{ESS tracebug-snt}{Section@tie 10.1} -@xrdef{Developing with ESS-pg}{40} -@xrdef{ESS tracebug-pg}{40} -@xrdef{Getting started with tracebug-title}{Getting started with tracebug} -@xrdef{Getting started with tracebug-snt}{Section@tie 10.1.1} -@xrdef{Getting started with tracebug-pg}{41} -@xrdef{Editing documentation-title}{Editing documentation} -@xrdef{Editing documentation-snt}{Section@tie 10.2} -@xrdef{R documentation files-title}{Editing R documentation (Rd) files} -@xrdef{R documentation files-snt}{Section@tie 10.2.1} -@xrdef{Editing documentation-pg}{42} -@xrdef{R documentation files-pg}{42} -@xrdef{Roxygen-title}{Editing Roxygen documentation} -@xrdef{Roxygen-snt}{Section@tie 10.2.2} -@xrdef{Roxygen-pg}{43} -@xrdef{Namespaced Evaluation-title}{Namespaced Evaluation} -@xrdef{Namespaced Evaluation-snt}{Section@tie 10.3} -@xrdef{Namespaced Evaluation-pg}{45} -@xrdef{Extras-title}{Other ESS features and tools} -@xrdef{Extras-snt}{Chapter@tie 11} -@xrdef{ESS ElDoc-title}{ElDoc} -@xrdef{ESS ElDoc-snt}{Section@tie 11.1} -@xrdef{ESS Flymake-title}{Flymake} -@xrdef{ESS Flymake-snt}{Section@tie 11.2} -@xrdef{Handy commands-title}{Handy commands} -@xrdef{Handy commands-snt}{Section@tie 11.3} -@xrdef{Extras-pg}{46} -@xrdef{ESS ElDoc-pg}{46} -@xrdef{ESS Flymake-pg}{46} -@xrdef{Highlighting-title}{Syntactic highlighting of buffers} -@xrdef{Highlighting-snt}{Section@tie 11.4} -@xrdef{Parens-title}{Parenthesis matching} -@xrdef{Parens-snt}{Section@tie 11.5} -@xrdef{Handy commands-pg}{47} -@xrdef{Highlighting-pg}{47} -@xrdef{Graphics-title}{Using graphics with ESS} -@xrdef{Graphics-snt}{Section@tie 11.6} -@xrdef{printer-title}{Using ESS with the @code {printer()} driver} -@xrdef{printer-snt}{Section@tie 11.6.1} -@xrdef{X11-title}{Using ESS with windowing devices} -@xrdef{X11-snt}{Section@tie 11.6.2} -@xrdef{winjava-title}{Java Graphics Device} -@xrdef{winjava-snt}{Section@tie 11.6.3} -@xrdef{Imenu-title}{Imenu} -@xrdef{Imenu-snt}{Section@tie 11.7} -@xrdef{Parens-pg}{48} -@xrdef{Graphics-pg}{48} -@xrdef{printer-pg}{48} -@xrdef{X11-pg}{48} -@xrdef{winjava-pg}{48} -@xrdef{Imenu-pg}{48} -@xrdef{Toolbar-title}{Toolbar} -@xrdef{Toolbar-snt}{Section@tie 11.8} -@xrdef{Xref-title}{Xref} -@xrdef{Xref-snt}{Section@tie 11.9} -@xrdef{Rdired-title}{Rdired} -@xrdef{Rdired-snt}{Section@tie 11.10} -@xrdef{Rutils-title}{Rutils} -@xrdef{Rutils-snt}{Section@tie 11.11} -@xrdef{Toolbar-pg}{49} -@xrdef{Xref-pg}{49} -@xrdef{Rdired-pg}{49} -@xrdef{Rutils-pg}{49} -@xrdef{Org-title}{Interaction with Org mode} -@xrdef{Org-snt}{Section@tie 11.12} -@xrdef{Sweave and AUCTeX-title}{Support for Sweave in ESS and AUCTeX} -@xrdef{Sweave and AUCTeX-snt}{Section@tie 11.13} -@xrdef{Org-pg}{51} -@xrdef{Sweave and AUCTeX-pg}{51} -@xrdef{ESS for R-title}{Overview of ESS features for the S family} -@xrdef{ESS for R-snt}{Chapter@tie 12} -@xrdef{ESS(R)--Editing files-title}{ESS[R]--Editing files} -@xrdef{ESS(R)--Editing files-snt}{Section@tie 12.1} -@xrdef{iESS(R)--Inferior ESS processes-title}{iESS[R]--Inferior ESS processes} -@xrdef{iESS(R)--Inferior ESS processes-snt}{Section@tie 12.2} -@xrdef{ESS for R-pg}{52} -@xrdef{ESS(R)--Editing files-pg}{52} -@xrdef{iESS(R)--Inferior ESS processes-pg}{52} -@xrdef{Philosophies for using ESS(R)-title}{Philosophies for using ESS[R]} -@xrdef{Philosophies for using ESS(R)-snt}{Section@tie 12.3} -@xrdef{Example ESS usage-title}{Example ESS usage} -@xrdef{Example ESS usage-snt}{Section@tie 12.4} -@xrdef{Philosophies for using ESS(R)-pg}{53} -@xrdef{Example ESS usage-pg}{54} -@xrdef{ESS for SAS-title}{ESS for SAS} -@xrdef{ESS for SAS-snt}{Chapter@tie 13} -@xrdef{ESS(SAS)--Design philosophy-title}{ESS[SAS]--Design philosophy} -@xrdef{ESS(SAS)--Design philosophy-snt}{Section@tie 13.1} -@xrdef{ESS(SAS)--Editing files-title}{ESS[SAS]--Editing files} -@xrdef{ESS(SAS)--Editing files-snt}{Section@tie 13.2} -@xrdef{ESS(SAS)--TAB key-title}{ESS[SAS]--@key {TAB} key} -@xrdef{ESS(SAS)--TAB key-snt}{Section@tie 13.3} -@xrdef{ESS for SAS-pg}{56} -@xrdef{ESS(SAS)--Design philosophy-pg}{56} -@xrdef{ESS(SAS)--Editing files-pg}{56} -@xrdef{ESS(SAS)--Batch SAS processes-title}{ESS[SAS]--Batch SAS processes} -@xrdef{ESS(SAS)--Batch SAS processes-snt}{Section@tie 13.4} -@xrdef{ESS(SAS)--TAB key-pg}{57} -@xrdef{ESS(SAS)--Batch SAS processes-pg}{57} -@xrdef{ESS(SAS)--Function keys for batch processing-title}{ESS[SAS]--Function keys for batch processing} -@xrdef{ESS(SAS)--Function keys for batch processing-snt}{Section@tie 13.5} -@xrdef{ESS(SAS)--Function keys for batch processing-pg}{59} -@xrdef{iESS(SAS)--Interactive SAS processes-title}{iESS[SAS]--Interactive SAS processes} -@xrdef{iESS(SAS)--Interactive SAS processes-snt}{Section@tie 13.6} -@xrdef{iESS(SAS)--Interactive SAS processes-pg}{62} -@xrdef{iESS(SAS)--Common problems-title}{iESS[SAS]--Common problems} -@xrdef{iESS(SAS)--Common problems-snt}{Section@tie 13.7} -@xrdef{iESS(SAS)--Common problems-pg}{63} -@xrdef{ESS(SAS)--Graphics-title}{ESS[SAS]--Graphics} -@xrdef{ESS(SAS)--Graphics-snt}{Section@tie 13.8} -@xrdef{ESS(SAS)--Windows-title}{ESS[SAS]--Windows} -@xrdef{ESS(SAS)--Windows-snt}{Section@tie 13.9} -@xrdef{ESS(SAS)--Graphics-pg}{64} -@xrdef{ESS(SAS)--Windows-pg}{64} -@xrdef{ESS for BUGS-title}{ESS for BUGS} -@xrdef{ESS for BUGS-snt}{Chapter@tie 14} -@xrdef{ESS for BUGS-pg}{65} -@xrdef{ESS for JAGS-title}{ESS for JAGS} -@xrdef{ESS for JAGS-snt}{Chapter@tie 15} -@xrdef{ESS for JAGS-pg}{66} -@xrdef{Mailing lists/bug reports-title}{Bugs and Bug Reporting, Mailing Lists} -@xrdef{Mailing lists/bug reports-snt}{Chapter@tie 16} -@xrdef{Bugs-title}{Bugs} -@xrdef{Bugs-snt}{Section@tie 16.1} -@xrdef{Reporting Bugs-title}{Reporting Bugs} -@xrdef{Reporting Bugs-snt}{Section@tie 16.2} -@xrdef{Mailing Lists-title}{Mailing Lists} -@xrdef{Mailing Lists-snt}{Section@tie 16.3} -@xrdef{Mailing lists/bug reports-pg}{67} -@xrdef{Bugs-pg}{67} -@xrdef{Reporting Bugs-pg}{67} -@xrdef{Mailing Lists-pg}{67} -@xrdef{Help with Emacs-title}{Help with Emacs} -@xrdef{Help with Emacs-snt}{Section@tie 16.4} -@xrdef{Help with Emacs-pg}{68} -@xrdef{Customization-title}{Customizing ESS} -@xrdef{Customization-snt}{Appendix@tie @char65{}} -@xrdef{Customization-pg}{69} -@xrdef{Indices-title}{Indices} -@xrdef{Indices-snt}{} -@xrdef{Key index-title}{Key index} -@xrdef{Key index-snt}{} -@xrdef{Function and program index-title}{Function and program index} -@xrdef{Function and program index-snt}{} -@xrdef{Indices-pg}{70} -@xrdef{Key index-pg}{70} -@xrdef{Function and program index-pg}{70} -@xrdef{Variable index-title}{Variable index} -@xrdef{Variable index-snt}{} -@xrdef{Concept index-title}{Concept Index} -@xrdef{Concept index-snt}{} -@xrdef{Variable index-pg}{72} -@xrdef{Concept index-pg}{72} diff -Nru ess-18.10.2/doc/ess.cp ess-18.10.2+git20220915.f45542e/doc/ess.cp --- ess-18.10.2/doc/ess.cp 2018-11-10 09:41:22.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/doc/ess.cp 1970-01-01 00:00:00.000000000 +0000 @@ -1,128 +0,0 @@ -\entry{introduction}{1}{introduction} -\entry{interactive use of R}{1}{interactive use of R} -\entry{using R interactively}{1}{using R interactively} -\entry{interactive use of S}{1}{interactive use of S} -\entry{using S interactively}{1}{using S interactively} -\entry{using ESS interactively}{1}{using ESS interactively} -\entry{transcripts of R sessions}{1}{transcripts of R sessions} -\entry{transcripts of S sessions}{1}{transcripts of S sessions} -\entry{programming in R}{1}{programming in R} -\entry{programming in S}{1}{programming in S} -\entry{comint}{8}{comint} -\entry{authors}{8}{authors} -\entry{credits}{8}{credits} -\entry{installation}{11}{installation} -\entry{starting ESS}{13}{starting ESS} -\entry{running S}{13}{running S} -\entry{running R}{13}{running R} -\entry{ESS process directory}{13}{ESS process directory} -\entry{starting directory}{13}{starting directory} -\entry{working directory}{13}{working directory} -\entry{directories}{13}{directories} -\entry{ESS process buffer}{13}{ESS process buffer} -\entry{process buffer}{13}{process buffer} -\entry{multiple ESS processes}{13}{multiple ESS processes} -\entry{changing ESS processes}{13}{changing ESS processes} -\entry{multiple inferior processes}{13}{multiple inferior processes} -\entry{multiple interactive processes}{13}{multiple interactive processes} -\entry{process names}{13}{process names} -\entry{remote Computers}{13}{remote Computers} -\entry{ESS-elsewhere}{13}{ESS-elsewhere} -\entry{S+elsewhere}{13}{S+elsewhere} -\entry{tramp support}{13}{tramp support} -\entry{transcript file}{15}{transcript file} -\entry{arguments to S program}{15}{arguments to S program} -\entry{arguments to R program}{15}{arguments to R program} -\entry{entering commands}{16}{entering commands} -\entry{commands}{16}{commands} -\entry{sending input}{16}{sending input} -\entry{command-line editing}{16}{command-line editing} -\entry{transcript}{16}{transcript} -\entry{paragraphs in the process buffer}{16}{paragraphs in the process buffer} -\entry{pages in the process buffer}{17}{pages in the process buffer} -\entry{reading long command outputs}{17}{reading long command outputs} -\entry{deleting output}{17}{deleting output} -\entry{multi-line commands, resubmitting}{18}{multi-line commands, resubmitting} -\entry{transcript file names}{18}{transcript file names} -\entry{editing transcripts}{18}{editing transcripts} -\entry{command history}{19}{command history} -\entry{editing commands}{19}{editing commands} -\entry{re-executing commands}{19}{re-executing commands} -\entry{objects}{21}{objects} -\entry{search list}{22}{search list} -\entry{hot keys}{22}{hot keys} -\entry{keyboard short cuts}{22}{keyboard short cuts} -\entry{quitting from ESS}{22}{quitting from ESS} -\entry{killing the ESS process}{22}{killing the ESS process} -\entry{cleaning up}{22}{cleaning up} -\entry{temporary buffers, killing}{22}{temporary buffers, killing} -\entry{killing temporary buffers}{22}{killing temporary buffers} -\entry{STERM}{23}{STERM} -\entry{emacsclient}{23}{emacsclient} -\entry{aborting R commands}{23}{aborting R commands} -\entry{interrupting R commands}{23}{interrupting R commands} -\entry{aborting S commands}{23}{aborting S commands} -\entry{interrupting S commands}{23}{interrupting S commands} -\entry{echoing commands when evaluating}{25}{echoing commands when evaluating} -\entry{evaluating code with echoed commands}{25}{evaluating code with echoed commands} -\entry{ESS commands blocking Emacs}{25}{ESS commands blocking Emacs} -\entry{evaluating R expressions}{25}{evaluating R expressions} -\entry{evaluating S expressions}{25}{evaluating S expressions} -\entry{transcript mode motion}{27}{transcript mode motion} -\entry{motion in transcript mode}{27}{motion in transcript mode} -\entry{editing functions}{28}{editing functions} -\entry{edit buffer}{28}{edit buffer} -\entry{completion, when prompted for object names}{28}{completion, when prompted for object names} -\entry{creating new objects}{28}{creating new objects} -\entry{new objects, creating}{28}{new objects, creating} -\entry{dump files}{28}{dump files} -\entry{reverting function definitions}{28}{reverting function definitions} -\entry{errors}{29}{errors} -\entry{parsing errors}{29}{parsing errors} -\entry{comments in R}{29}{comments in R} -\entry{indenting}{29}{indenting} -\entry{formatting source code}{29}{formatting source code} -\entry{completion in edit buffer}{31}{completion in edit buffer} -\entry{dump files}{31}{dump files} -\entry{comments}{32}{comments} -\entry{project work in R}{32}{project work in R} -\entry{project work in S}{32}{project work in S} -\entry{historic backups}{32}{historic backups} -\entry{autosaving}{32}{autosaving} -\entry{dump file names}{33}{dump file names} -\entry{dump file directories}{33}{dump file directories} -\entry{search list}{33}{search list} -\entry{working directory}{33}{working directory} -\entry{help files}{35}{help files} -\entry{paging commands in help buffers}{35}{paging commands in help buffers} -\entry{temporary buffers}{36}{temporary buffers} -\entry{completion of object names}{37}{completion of object names} -\entry{command-line completion}{37}{command-line completion} -\entry{data frames}{37}{data frames} -\entry{lists, completion on}{37}{lists, completion on} -\entry{completion on lists}{37}{completion on lists} -\entry{completion on file names}{37}{completion on file names} -\entry{IDO completions}{38}{IDO completions} -\entry{auto-complete}{38}{auto-complete} -\entry{company}{38}{company} -\entry{icicles}{38}{icicles} -\entry{ESS tracebug}{40}{ESS tracebug} -\entry{tracebug tutorial}{41}{tracebug tutorial} -\entry{Roxygen}{43}{Roxygen} -\entry{roxy}{43}{roxy} -\entry{ess-roxy}{43}{ess-roxy} -\entry{ess developer}{45}{ess developer} -\entry{ElDoc}{46}{ElDoc} -\entry{flymake}{46}{flymake} -\entry{Handy commands}{47}{Handy commands} -\entry{font-lock mode}{47}{font-lock mode} -\entry{highlighting}{47}{highlighting} -\entry{graphics}{48}{graphics} -\entry{X Windows}{48}{X Windows} -\entry{winjava}{48}{winjava} -\entry{xref}{49}{xref} -\entry{finding function definitions}{49}{finding function definitions} -\entry{command line arguments}{52}{command line arguments} -\entry{bugs}{67}{bugs} -\entry{bug reports}{67}{bug reports} -\entry{customization}{69}{customization} diff -Nru ess-18.10.2/doc/ess.cps ess-18.10.2+git20220915.f45542e/doc/ess.cps --- ess-18.10.2/doc/ess.cps 2018-11-10 09:41:21.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/doc/ess.cps 1970-01-01 00:00:00.000000000 +0000 @@ -1,147 +0,0 @@ -\initial {A} -\entry {aborting R commands}{23} -\entry {aborting S commands}{23} -\entry {arguments to R program}{15} -\entry {arguments to S program}{15} -\entry {authors}{8} -\entry {auto-complete}{38} -\entry {autosaving}{32} -\initial {B} -\entry {bug reports}{67} -\entry {bugs}{67} -\initial {C} -\entry {changing ESS processes}{13} -\entry {cleaning up}{22} -\entry {comint}{8} -\entry {command history}{19} -\entry {command line arguments}{52} -\entry {command-line completion}{37} -\entry {command-line editing}{16} -\entry {commands}{16} -\entry {comments}{32} -\entry {comments in R}{29} -\entry {company}{38} -\entry {completion in edit buffer}{31} -\entry {completion of object names}{37} -\entry {completion on file names}{37} -\entry {completion on lists}{37} -\entry {completion, when prompted for object names}{28} -\entry {creating new objects}{28} -\entry {credits}{8} -\entry {customization}{69} -\initial {D} -\entry {data frames}{37} -\entry {deleting output}{17} -\entry {directories}{13} -\entry {dump file directories}{33} -\entry {dump file names}{33} -\entry {dump files}{28, 31} -\initial {E} -\entry {echoing commands when evaluating}{25} -\entry {edit buffer}{28} -\entry {editing commands}{19} -\entry {editing functions}{28} -\entry {editing transcripts}{18} -\entry {ElDoc}{46} -\entry {emacsclient}{23} -\entry {entering commands}{16} -\entry {errors}{29} -\entry {ess developer}{45} -\entry {ess-roxy}{43} -\entry {ESS commands blocking Emacs}{25} -\entry {ESS process buffer}{13} -\entry {ESS process directory}{13} -\entry {ESS tracebug}{40} -\entry {ESS-elsewhere}{13} -\entry {evaluating code with echoed commands}{25} -\entry {evaluating R expressions}{25} -\entry {evaluating S expressions}{25} -\initial {F} -\entry {finding function definitions}{49} -\entry {flymake}{46} -\entry {font-lock mode}{47} -\entry {formatting source code}{29} -\initial {G} -\entry {graphics}{48} -\initial {H} -\entry {Handy commands}{47} -\entry {help files}{35} -\entry {highlighting}{47} -\entry {historic backups}{32} -\entry {hot keys}{22} -\initial {I} -\entry {icicles}{38} -\entry {IDO completions}{38} -\entry {indenting}{29} -\entry {installation}{11} -\entry {interactive use of R}{1} -\entry {interactive use of S}{1} -\entry {interrupting R commands}{23} -\entry {interrupting S commands}{23} -\entry {introduction}{1} -\initial {K} -\entry {keyboard short cuts}{22} -\entry {killing temporary buffers}{22} -\entry {killing the ESS process}{22} -\initial {L} -\entry {lists, completion on}{37} -\initial {M} -\entry {motion in transcript mode}{27} -\entry {multi-line commands, resubmitting}{18} -\entry {multiple ESS processes}{13} -\entry {multiple inferior processes}{13} -\entry {multiple interactive processes}{13} -\initial {N} -\entry {new objects, creating}{28} -\initial {O} -\entry {objects}{21} -\initial {P} -\entry {pages in the process buffer}{17} -\entry {paging commands in help buffers}{35} -\entry {paragraphs in the process buffer}{16} -\entry {parsing errors}{29} -\entry {process buffer}{13} -\entry {process names}{13} -\entry {programming in R}{1} -\entry {programming in S}{1} -\entry {project work in R}{32} -\entry {project work in S}{32} -\initial {Q} -\entry {quitting from ESS}{22} -\initial {R} -\entry {re-executing commands}{19} -\entry {reading long command outputs}{17} -\entry {remote Computers}{13} -\entry {reverting function definitions}{28} -\entry {roxy}{43} -\entry {Roxygen}{43} -\entry {running R}{13} -\entry {running S}{13} -\initial {S} -\entry {S+elsewhere}{13} -\entry {search list}{22, 33} -\entry {sending input}{16} -\entry {starting directory}{13} -\entry {starting ESS}{13} -\entry {STERM}{23} -\initial {T} -\entry {temporary buffers}{36} -\entry {temporary buffers, killing}{22} -\entry {tracebug tutorial}{41} -\entry {tramp support}{13} -\entry {transcript}{16} -\entry {transcript file}{15} -\entry {transcript file names}{18} -\entry {transcript mode motion}{27} -\entry {transcripts of R sessions}{1} -\entry {transcripts of S sessions}{1} -\initial {U} -\entry {using ESS interactively}{1} -\entry {using R interactively}{1} -\entry {using S interactively}{1} -\initial {W} -\entry {winjava}{48} -\entry {working directory}{13, 33} -\initial {X} -\entry {X Windows}{48} -\entry {xref}{49} diff -Nru ess-18.10.2/doc/ess-defs.texi ess-18.10.2+git20220915.f45542e/doc/ess-defs.texi --- ess-18.10.2/doc/ess-defs.texi 2018-11-10 09:41:10.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/doc/ess-defs.texi 2022-10-15 08:06:36.000000000 +0000 @@ -53,5 +53,5 @@ @end macro @macro initfile{} -@file{~/.emacs} or @file{~/.xemacs/init.el} +@file{~/.emacs} or @file{~/.emacs.d/init.el} @end macro diff -Nru ess-18.10.2/doc/ess.fn ess-18.10.2+git20220915.f45542e/doc/ess.fn --- ess-18.10.2/doc/ess.fn 2018-11-10 09:41:22.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/doc/ess.fn 1970-01-01 00:00:00.000000000 +0000 @@ -1,113 +0,0 @@ -\entry{S}{13}{S} -\entry{R}{13}{R} -\entry{ess-request-a-process}{13}{\code {ess-request-a-process}} -\entry{ess-remote}{13}{\code {ess-remote}} -\entry{inferior-ess-send-input}{16}{\code {inferior-ess-send-input}} -\entry{backward-kill-word}{16}{\code {backward-kill-word}} -\entry{comint-kill-input}{16}{\code {comint-kill-input}} -\entry{comint-bol}{16}{\code {comint-bol}} -\entry{comint-show-output}{17}{\code {comint-show-output}} -\entry{comint-delete-output}{17}{\code {comint-delete-output}} -\entry{comint-previous-prompt}{17}{\code {comint-previous-prompt}} -\entry{comint-next-prompt}{17}{\code {comint-next-prompt}} -\entry{comint-backward-matching-input}{17}{\code {comint-backward-matching-input}} -\entry{comint-forward-matching-input}{17}{\code {comint-forward-matching-input}} -\entry{comint-copy-old-input}{18}{\code {comint-copy-old-input}} -\entry{comint-previous-input}{19}{\code {comint-previous-input}} -\entry{comint-next-input}{19}{\code {comint-next-input}} -\entry{comint-history-isearch-backward-regexp}{19}{\code {comint-history-isearch-backward-regexp}} -\entry{comint-previous-matching-input-from-input}{19}{\code {comint-previous-matching-input-from-input}} -\entry{comint-next-matching-input-from-input}{19}{\code {comint-next-matching-input-from-input}} -\entry{ess-execute-objects}{21}{\code {ess-execute-objects}} -\entry{objects()}{21}{objects()} -\entry{ess-execute-search}{22}{\code {ess-execute-search}} -\entry{search()}{22}{search()} -\entry{ess-load-file}{22}{\code {ess-load-file}} -\entry{ess-parse-errors}{22}{\code {ess-parse-errors}} -\entry{ess-display-help-on-object}{22}{\code {ess-display-help-on-object}} -\entry{ess-quit}{22}{\code {ess-quit}} -\entry{q()}{22}{q()} -\entry{ess-cleanup}{22}{\code {ess-cleanup}} -\entry{STERM}{23}{STERM} -\entry{comint-interrupt-subjob}{23}{\code {comint-interrupt-subjob}} -\entry{ess-switch-to-inferior-or-script-buffer}{23}{\code {ess-switch-to-inferior-or-script-buffer}} -\entry{source()}{25}{source()} -\entry{ess-eval-region-or-line-and-step}{25}{\code {ess-eval-region-or-line-and-step}} -\entry{ess-eval-region-or-function-or-paragraph}{25}{\code {ess-eval-region-or-function-or-paragraph}} -\entry{ess-eval-region-or-function-or-paragraph-and-step}{25}{\code {ess-eval-region-or-function-or-paragraph-and-step}} -\entry{ess-eval-line}{25}{\code {ess-eval-line}} -\entry{ess-eval-line-and-go}{25}{\code {ess-eval-line-and-go}} -\entry{ess-eval-function}{25}{\code {ess-eval-function}} -\entry{ess-eval-function-and-go}{25}{\code {ess-eval-function-and-go}} -\entry{ess-eval-region}{25}{\code {ess-eval-region}} -\entry{ess-eval-region-and-go}{26}{\code {ess-eval-region-and-go}} -\entry{ess-eval-buffer}{26}{\code {ess-eval-buffer}} -\entry{ess-eval-buffer-and-go}{26}{\code {ess-eval-buffer-and-go}} -\entry{ess-transcript-send-command}{27}{\code {ess-transcript-send-command}} -\entry{ess-transcript-copy-command}{27}{\code {ess-transcript-copy-command}} -\entry{ess-transcript-send-command-and-move}{27}{\code {ess-transcript-send-command-and-move}} -\entry{ess-transcript-clean-region}{27}{\code {ess-transcript-clean-region}} -\entry{ess-dump-object-into-edit-buffer}{28}{\code {ess-dump-object-into-edit-buffer}} -\entry{dump()}{28}{dump()} -\entry{ess-load-file}{28}{\code {ess-load-file}} -\entry{source()}{28}{source()} -\entry{ess-parse-errors}{29}{\code {ess-parse-errors}} -\entry{ess-indent-or-complete}{29}{\code {ess-indent-or-complete}} -\entry{ess-indent-exp}{30}{\code {ess-indent-exp}} -\entry{ess-electric-brace}{30}{\code {ess-electric-brace}} -\entry{ess-set-style}{30}{\code {ess-set-style}} -\entry{ess-goto-beginning-of-function-or-para}{31}{\code {ess-goto-beginning-of-function-or-para}} -\entry{ess-goto-end-of-function-or-para}{31}{\code {ess-goto-end-of-function-or-para}} -\entry{ess-mark-function}{31}{\code {ess-mark-function}} -\entry{ess-display-help-on-object}{35}{\code {ess-display-help-on-object}} -\entry{ess-describe-help-mode}{35}{\code {ess-describe-help-mode}} -\entry{ess-display-help-on-object}{35}{\code {ess-display-help-on-object}} -\entry{ess-skip-to-next-section}{35}{\code {ess-skip-to-next-section}} -\entry{ess-skip-to-previous-section}{35}{\code {ess-skip-to-previous-section}} -\entry{ess-skip-to-help-section}{35}{\code {ess-skip-to-help-section}} -\entry{ess-eval-line-and-step}{36}{\code {ess-eval-line-and-step}} -\entry{ess-eval-region}{36}{\code {ess-eval-region}} -\entry{ess-switch-to-end-of-ESS}{36}{\code {ess-switch-to-end-of-ESS}} -\entry{ess-quit}{36}{\code {ess-quit}} -\entry{ess-cleanup}{36}{\code {ess-cleanup}} -\entry{comint-dynamic-complete}{37}{\code {comint-dynamic-complete}} -\entry{search()}{37}{search()} -\entry{ess-list-object-completions}{37}{\code {ess-list-object-completions}} -\entry{ess-resynch}{37}{\code {ess-resynch}} -\entry{ess-use-ido, ess-completing-read}{38}{\code {ess-use-ido, ess-completing-read}} -\entry{ess-tracebug}{40}{\code {ess-tracebug}} -\entry{getting started with tracebug}{41}{\code {getting started with tracebug}} -\entry{ess-roxy-update-entry}{44}{\code {ess-roxy-update-entry}} -\entry{ess-roxy-toggle-roxy-region}{44}{\code {ess-roxy-toggle-roxy-region}} -\entry{ess-roxy-preview-Rd}{44}{\code {ess-roxy-preview-Rd}} -\entry{ess-roxy-preview-HTML}{44}{\code {ess-roxy-preview-HTML}} -\entry{ess-roxy-previous-entry}{44}{\code {ess-roxy-previous-entry}} -\entry{ess-roxy-next-entry}{44}{\code {ess-roxy-next-entry}} -\entry{ess-roxy-hide-all}{44}{\code {ess-roxy-hide-all}} -\entry{ess-R-complete-object-name}{45}{\code {ess-R-complete-object-name}} -\entry{mark-paragraph}{45}{\code {mark-paragraph}} -\entry{ess-indent-command}{45}{\code {ess-indent-command}} -\entry{fill-paragraph}{45}{\code {fill-paragraph}} -\entry{move-beginning-of-line}{45}{\code {move-beginning-of-line}} -\entry{newline-and-indent}{45}{\code {newline-and-indent}} -\entry{ess-r-set-evaluation-env}{45}{\code {ess-r-set-evaluation-env}} -\entry{ess-handy-commands}{47}{\code {ess-handy-commands}} -\entry{ess-smart-comma}{47}{\code {ess-smart-comma}} -\entry{ess-handy-commands}{47}{\code {ess-handy-commands}} -\entry{printer()}{48}{printer()} -\entry{ess-rutils-local-pkgs}{50}{\code {ess-rutils-local-pkgs}} -\entry{ess-rutils-repos-pkgs}{50}{\code {ess-rutils-repos-pkgs}} -\entry{ess-rutils-update-pkgs}{50}{\code {ess-rutils-update-pkgs}} -\entry{ess-rutils-apropos}{50}{\code {ess-rutils-apropos}} -\entry{ess-rutils-rm-all}{50}{\code {ess-rutils-rm-all}} -\entry{ess-rutils-objs}{50}{\code {ess-rutils-objs}} -\entry{ess-rutils-load-wkspc}{50}{\code {ess-rutils-load-wkspc}} -\entry{ess-rutils-save-wkspc}{50}{\code {ess-rutils-save-wkspc}} -\entry{ess-change-directory}{50}{\code {ess-change-directory}} -\entry{ess-rutils-html-docs}{50}{\code {ess-rutils-html-docs}} -\entry{ess-rutils-rsitesearch}{50}{\code {ess-rutils-rsitesearch}} -\entry{ess-swv-weave}{51}{\code {ess-swv-weave}} -\entry{ess-swv-latex}{51}{\code {ess-swv-latex}} -\entry{ess-swv-PS}{51}{\code {ess-swv-PS}} -\entry{ess-swv-PDF}{51}{\code {ess-swv-PDF}} -\entry{ess-submit-bug-report}{67}{\code {ess-submit-bug-report}} diff -Nru ess-18.10.2/doc/ess.fns ess-18.10.2+git20220915.f45542e/doc/ess.fns --- ess-18.10.2/doc/ess.fns 2018-11-10 09:41:21.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/doc/ess.fns 1970-01-01 00:00:00.000000000 +0000 @@ -1,117 +0,0 @@ -\initial {B} -\entry {\code {backward-kill-word}}{16} -\initial {C} -\entry {\code {comint-backward-matching-input}}{17} -\entry {\code {comint-bol}}{16} -\entry {\code {comint-copy-old-input}}{18} -\entry {\code {comint-delete-output}}{17} -\entry {\code {comint-dynamic-complete}}{37} -\entry {\code {comint-forward-matching-input}}{17} -\entry {\code {comint-history-isearch-backward-regexp}}{19} -\entry {\code {comint-interrupt-subjob}}{23} -\entry {\code {comint-kill-input}}{16} -\entry {\code {comint-next-input}}{19} -\entry {\code {comint-next-matching-input-from-input}}{19} -\entry {\code {comint-next-prompt}}{17} -\entry {\code {comint-previous-input}}{19} -\entry {\code {comint-previous-matching-input-from-input}}{19} -\entry {\code {comint-previous-prompt}}{17} -\entry {\code {comint-show-output}}{17} -\initial {D} -\entry {dump()}{28} -\initial {E} -\entry {\code {ess-change-directory}}{50} -\entry {\code {ess-cleanup}}{22, 36} -\entry {\code {ess-describe-help-mode}}{35} -\entry {\code {ess-display-help-on-object}}{22, 35} -\entry {\code {ess-dump-object-into-edit-buffer}}{28} -\entry {\code {ess-electric-brace}}{30} -\entry {\code {ess-eval-buffer}}{26} -\entry {\code {ess-eval-buffer-and-go}}{26} -\entry {\code {ess-eval-function}}{25} -\entry {\code {ess-eval-function-and-go}}{25} -\entry {\code {ess-eval-line}}{25} -\entry {\code {ess-eval-line-and-go}}{25} -\entry {\code {ess-eval-line-and-step}}{36} -\entry {\code {ess-eval-region}}{25, 36} -\entry {\code {ess-eval-region-and-go}}{26} -\entry {\code {ess-eval-region-or-function-or-paragraph}}{25} -\entry {\code {ess-eval-region-or-function-or-paragraph-and-step}}{25} -\entry {\code {ess-eval-region-or-line-and-step}}{25} -\entry {\code {ess-execute-objects}}{21} -\entry {\code {ess-execute-search}}{22} -\entry {\code {ess-goto-beginning-of-function-or-para}}{31} -\entry {\code {ess-goto-end-of-function-or-para}}{31} -\entry {\code {ess-handy-commands}}{47} -\entry {\code {ess-indent-command}}{45} -\entry {\code {ess-indent-exp}}{30} -\entry {\code {ess-indent-or-complete}}{29} -\entry {\code {ess-list-object-completions}}{37} -\entry {\code {ess-load-file}}{22, 28} -\entry {\code {ess-mark-function}}{31} -\entry {\code {ess-parse-errors}}{22, 29} -\entry {\code {ess-quit}}{22, 36} -\entry {\code {ess-r-set-evaluation-env}}{45} -\entry {\code {ess-R-complete-object-name}}{45} -\entry {\code {ess-remote}}{13} -\entry {\code {ess-request-a-process}}{13} -\entry {\code {ess-resynch}}{37} -\entry {\code {ess-roxy-hide-all}}{44} -\entry {\code {ess-roxy-next-entry}}{44} -\entry {\code {ess-roxy-preview-HTML}}{44} -\entry {\code {ess-roxy-preview-Rd}}{44} -\entry {\code {ess-roxy-previous-entry}}{44} -\entry {\code {ess-roxy-toggle-roxy-region}}{44} -\entry {\code {ess-roxy-update-entry}}{44} -\entry {\code {ess-rutils-apropos}}{50} -\entry {\code {ess-rutils-html-docs}}{50} -\entry {\code {ess-rutils-load-wkspc}}{50} -\entry {\code {ess-rutils-local-pkgs}}{50} -\entry {\code {ess-rutils-objs}}{50} -\entry {\code {ess-rutils-repos-pkgs}}{50} -\entry {\code {ess-rutils-rm-all}}{50} -\entry {\code {ess-rutils-rsitesearch}}{50} -\entry {\code {ess-rutils-save-wkspc}}{50} -\entry {\code {ess-rutils-update-pkgs}}{50} -\entry {\code {ess-set-style}}{30} -\entry {\code {ess-skip-to-help-section}}{35} -\entry {\code {ess-skip-to-next-section}}{35} -\entry {\code {ess-skip-to-previous-section}}{35} -\entry {\code {ess-smart-comma}}{47} -\entry {\code {ess-submit-bug-report}}{67} -\entry {\code {ess-switch-to-end-of-ESS}}{36} -\entry {\code {ess-switch-to-inferior-or-script-buffer}}{23} -\entry {\code {ess-swv-latex}}{51} -\entry {\code {ess-swv-PDF}}{51} -\entry {\code {ess-swv-PS}}{51} -\entry {\code {ess-swv-weave}}{51} -\entry {\code {ess-tracebug}}{40} -\entry {\code {ess-transcript-clean-region}}{27} -\entry {\code {ess-transcript-copy-command}}{27} -\entry {\code {ess-transcript-send-command}}{27} -\entry {\code {ess-transcript-send-command-and-move}}{27} -\entry {\code {ess-use-ido, ess-completing-read}}{38} -\initial {F} -\entry {\code {fill-paragraph}}{45} -\initial {G} -\entry {\code {getting started with tracebug}}{41} -\initial {I} -\entry {\code {inferior-ess-send-input}}{16} -\initial {M} -\entry {\code {mark-paragraph}}{45} -\entry {\code {move-beginning-of-line}}{45} -\initial {N} -\entry {\code {newline-and-indent}}{45} -\initial {O} -\entry {objects()}{21} -\initial {P} -\entry {printer()}{48} -\initial {Q} -\entry {q()}{22} -\initial {R} -\entry {R}{13} -\initial {S} -\entry {search()}{22, 37} -\entry {source()}{25, 28} -\entry {S}{13} -\entry {STERM}{23} diff -Nru ess-18.10.2/doc/ess.ky ess-18.10.2+git20220915.f45542e/doc/ess.ky --- ess-18.10.2/doc/ess.ky 2018-11-10 09:41:22.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/doc/ess.ky 1970-01-01 00:00:00.000000000 +0000 @@ -1,64 +0,0 @@ -\entry{RET}{16}{\code {RET}} -\entry{C-c C-x}{21}{\code {C-c C-x}} -\entry{C-c C-s}{22}{\code {C-c C-s}} -\entry{C-c M-l}{22}{\code {C-c M-l}} -\entry{C-c C-v}{22}{\code {C-c C-v}} -\entry{C-c C-q}{22}{\code {C-c C-q}} -\entry{C-c C-c}{23}{\code {C-c C-c}} -\entry{C-c C-z}{23}{\code {C-c C-z}} -\entry{C-RET}{25}{\code {C-RET}} -\entry{C-M-x}{25}{\code {C-M-x}} -\entry{C-c C-c}{25}{\code {C-c C-c}} -\entry{C-c C-j}{25}{\code {C-c C-j}} -\entry{C-c M-j}{25}{\code {C-c M-j}} -\entry{C-c C-f}{25}{\code {C-c C-f}} -\entry{C-c M-f}{25}{\code {C-c M-f}} -\entry{C-C C-r}{25}{\code {C-C C-r}} -\entry{C-c M-r}{26}{\code {C-c M-r}} -\entry{C-c C-b}{26}{\code {C-c C-b}} -\entry{C-c M-b}{26}{\code {C-c M-b}} -\entry{M-RET}{27}{\code {M-RET}} -\entry{C-c RET}{27}{\code {C-c RET}} -\entry{RET}{27}{\code {RET}} -\entry{C-c C-w}{27}{\code {C-c C-w}} -\entry{C-c C-e C-d}{28}{\code {C-c C-e C-d}} -\entry{C-c `}{29}{\code {C-c `}} -\entry{TAB}{29}{\code {TAB}} -\entry{C-M-q}{30}{\code {C-M-q}} -\entry{M-C-q}{30}{\code {M-C-q}} -\entry{ESC C-q}{30}{\code {ESC C-q}} -\entry{{\indexlbrace }}{30}{\code {\lbracechar {}}} -\entry{{\indexrbrace }}{30}{\code {\rbracechar {}}} -\entry{C-j}{30}{\code {C-j}} -\entry{M-;}{30}{\code {M-;}} -\entry{C-c C-e s}{30}{\code {C-c C-e s}} -\entry{C-c C-e C-s}{30}{\code {C-c C-e C-s}} -\entry{ESC C-a}{31}{\code {ESC C-a}} -\entry{C-M-a}{31}{\code {C-M-a}} -\entry{ESC C-e}{31}{\code {ESC C-e}} -\entry{C-M-e}{31}{\code {C-M-e}} -\entry{ESC C-h}{31}{\code {ESC C-h}} -\entry{C-M-h}{31}{\code {C-M-h}} -\entry{M-?}{37}{\code {M-?}} -\entry{C-c C-o C-o}{44}{\code {C-c C-o C-o}} -\entry{C-c C-o C-c}{44}{\code {C-c C-o C-c}} -\entry{C-c C-o C-r}{44}{\code {C-c C-o C-r}} -\entry{C-c C-o C-t}{44}{\code {C-c C-o C-t}} -\entry{C-c C-o p}{44}{\code {C-c C-o p}} -\entry{C-c C-o n}{44}{\code {C-c C-o n}} -\entry{C-c C-o C-h}{44}{\code {C-c C-o C-h}} -\entry{C-c C-t C-s}{45}{\code {C-c C-t C-s}} -\entry{,}{47}{\code {,}} -\entry{C-c C-. l}{50}{\code {C-c C-. l}} -\entry{C-c C-. r}{50}{\code {C-c C-. r}} -\entry{C-c C-. u}{50}{\code {C-c C-. u}} -\entry{C-c C-. a}{50}{\code {C-c C-. a}} -\entry{C-c C-. m}{50}{\code {C-c C-. m}} -\entry{C-c C-. o}{50}{\code {C-c C-. o}} -\entry{C-c C-. w}{50}{\code {C-c C-. w}} -\entry{C-c C-. s}{50}{\code {C-c C-. s}} -\entry{C-c C-. d}{50}{\code {C-c C-. d}} -\entry{C-c C-. H}{50}{\code {C-c C-. H}} -\entry{M-n s}{51}{\code {M-n s}} -\entry{M-n l}{51}{\code {M-n l}} -\entry{M-n P}{51}{\code {M-n P}} diff -Nru ess-18.10.2/doc/ess.kys ess-18.10.2+git20220915.f45542e/doc/ess.kys --- ess-18.10.2/doc/ess.kys 2018-11-10 09:41:21.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/doc/ess.kys 1970-01-01 00:00:00.000000000 +0000 @@ -1,70 +0,0 @@ -\initial {,} -\entry {\code {,}}{47} -\initial {{\indexlbrace }} -\entry {\code {\lbracechar {}}}{30} -\initial {{\indexrbrace }} -\entry {\code {\rbracechar {}}}{30} -\initial {C} -\entry {\code {C-c `}}{29} -\entry {\code {C-c C-. a}}{50} -\entry {\code {C-c C-. d}}{50} -\entry {\code {C-c C-. H}}{50} -\entry {\code {C-c C-. l}}{50} -\entry {\code {C-c C-. m}}{50} -\entry {\code {C-c C-. o}}{50} -\entry {\code {C-c C-. r}}{50} -\entry {\code {C-c C-. s}}{50} -\entry {\code {C-c C-. u}}{50} -\entry {\code {C-c C-. w}}{50} -\entry {\code {C-c C-b}}{26} -\entry {\code {C-c C-c}}{23, 25} -\entry {\code {C-c C-e C-d}}{28} -\entry {\code {C-c C-e C-s}}{30} -\entry {\code {C-c C-e s}}{30} -\entry {\code {C-c C-f}}{25} -\entry {\code {C-c C-j}}{25} -\entry {\code {C-c C-o C-c}}{44} -\entry {\code {C-c C-o C-h}}{44} -\entry {\code {C-c C-o C-o}}{44} -\entry {\code {C-c C-o C-r}}{44} -\entry {\code {C-c C-o C-t}}{44} -\entry {\code {C-c C-o n}}{44} -\entry {\code {C-c C-o p}}{44} -\entry {\code {C-c C-q}}{22} -\entry {\code {C-c C-s}}{22} -\entry {\code {C-c C-t C-s}}{45} -\entry {\code {C-c C-v}}{22} -\entry {\code {C-c C-w}}{27} -\entry {\code {C-c C-x}}{21} -\entry {\code {C-c C-z}}{23} -\entry {\code {C-c M-b}}{26} -\entry {\code {C-c M-f}}{25} -\entry {\code {C-c M-j}}{25} -\entry {\code {C-c M-l}}{22} -\entry {\code {C-c M-r}}{26} -\entry {\code {C-c RET}}{27} -\entry {\code {C-C C-r}}{25} -\entry {\code {C-j}}{30} -\entry {\code {C-M-a}}{31} -\entry {\code {C-M-e}}{31} -\entry {\code {C-M-h}}{31} -\entry {\code {C-M-q}}{30} -\entry {\code {C-M-x}}{25} -\entry {\code {C-RET}}{25} -\initial {E} -\entry {\code {ESC C-a}}{31} -\entry {\code {ESC C-e}}{31} -\entry {\code {ESC C-h}}{31} -\entry {\code {ESC C-q}}{30} -\initial {M} -\entry {\code {M-;}}{30} -\entry {\code {M-?}}{37} -\entry {\code {M-C-q}}{30} -\entry {\code {M-n l}}{51} -\entry {\code {M-n P}}{51} -\entry {\code {M-n s}}{51} -\entry {\code {M-RET}}{27} -\initial {R} -\entry {\code {RET}}{16, 27} -\initial {T} -\entry {\code {TAB}}{29} diff -Nru ess-18.10.2/doc/ess.log ess-18.10.2+git20220915.f45542e/doc/ess.log --- ess-18.10.2/doc/ess.log 2018-11-10 09:41:22.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/doc/ess.log 1970-01-01 00:00:00.000000000 +0000 @@ -1,414 +0,0 @@ -This is pdfTeX, Version 3.14159265-2.6-1.40.18 (TeX Live 2017) (preloaded format=pdfetex 2018.9.16) 10 NOV 2018 10:41 -entering extended mode - restricted \write18 enabled. - file:line:error style messages enabled. - %&-line parsing enabled. -**\input ./ess.texi -(./ess.texi -(/hg/s/linux/rhel3_amd64/app/teTeX/06.17/texmf-dist/tex/texinfo/texinfo.tex -Loading texinfo [version 2016-09-18.18]: -\outerhsize=\dimen16 -\outervsize=\dimen17 -\cornerlong=\dimen18 -\cornerthick=\dimen19 -\topandbottommargin=\dimen20 -\bindingoffset=\dimen21 -\normaloffset=\dimen22 -\txipagewidth=\dimen23 -\txipageheight=\dimen24 -\headlinebox=\box16 -\footlinebox=\box17 -\margin=\insert252 -\EMsimple=\toks13 -\groupbox=\box18 -\groupinvalidhelp=\toks14 -\mil=\dimen25 -\exdentamount=\skip18 -\inmarginspacing=\skip19 -\centerpenalty=\count27 - pdf, -\tempnum=\count28 -\lnkcount=\count29 -\filename=\toks15 -\filenamelength=\count30 -\pgn=\count31 -\toksA=\toks16 -\toksB=\toks17 -\toksC=\toks18 -\toksD=\toks19 -\boxA=\box19 -\boxB=\box20 -\countA=\count32 -\nopdfimagehelp=\toks20 - fonts, -\textleading=\dimen26 -\sffam=\fam8 - markup, -\fontdepth=\count33 - glyphs, -\errorbox=\box21 - -page headings, -\titlepagetopglue=\skip20 -\titlepagebottomglue=\skip21 -\evenheadline=\toks21 -\oddheadline=\toks22 -\evenfootline=\toks23 -\oddfootline=\toks24 - tables, -\tableindent=\dimen27 -\itemindent=\dimen28 -\itemmargin=\dimen29 -\itemmax=\dimen30 -\itemno=\count34 -\multitableparskip=\skip22 -\multitableparindent=\skip23 -\multitablecolspace=\dimen31 -\multitablelinespace=\skip24 -\colcount=\count35 -\everytab=\toks25 - conditionals, -\doignorecount=\count36 - indexing, -\dummybox=\box22 -\whatsitskip=\skip25 -\whatsitpenalty=\count37 -\entryrightmargin=\dimen32 -\thinshrinkable=\skip26 -\entryindexbox=\box23 -\delayedbox=\box24 -\interbox=\box25 -\secondaryindent=\skip27 -\partialpage=\box26 -\doublecolumnhsize=\dimen33 -\savedtopmark=\toks26 -\savedfirstmark=\toks27 -\balancedcolumns=\box27 - sectioning, -\unnumberedno=\count38 -\chapno=\count39 -\secno=\count40 -\subsecno=\count41 -\subsubsecno=\count42 -\appendixno=\count43 -\absseclevel=\count44 -\secbase=\count45 -\chapheadingskip=\skip28 -\secheadingskip=\skip29 -\subsecheadingskip=\skip30 - toc, -\tocfile=\write0 -\contentsrightmargin=\skip31 -\savepageno=\count46 -\lastnegativepageno=\count47 -\tocindent=\dimen34 - environments, -\lispnarrowing=\skip32 -\envskipamount=\skip33 -\circthick=\dimen35 -\cartouter=\dimen36 -\cartinner=\dimen37 -\normbskip=\skip34 -\normpskip=\skip35 -\normlskip=\skip36 -\lskip=\skip37 -\rskip=\skip38 -\nonfillparindent=\dimen38 -\tabw=\dimen39 -\verbbox=\box28 - -defuns, -\defbodyindent=\skip39 -\defargsindent=\skip40 -\deflastargmargin=\skip41 -\defunpenalty=\count48 -\parencount=\count49 -\brackcount=\count50 - macros, -\savedcatcodeone=\count51 -\savedcatcodetwo=\count52 -\paramno=\count53 -\macname=\toks28 - cross references, -\auxfile=\write1 -\savesfregister=\count54 -\toprefbox=\box29 -\printedrefnamebox=\box30 -\infofilenamebox=\box31 -\printedmanualbox=\box32 - insertions, -\footnoteno=\count55 -\SAVEfootins=\box33 -\SAVEmargin=\box34 - -(/usr/local.nfs/app/teTeX/texmflocal/tex/generic/dvips/epsf.tex -\epsffilein=\read1 -\epsfframemargin=\dimen40 -\epsfframethickness=\dimen41 -\epsfrsize=\dimen42 -\epsftmp=\dimen43 -\epsftsize=\dimen44 -\epsfxsize=\dimen45 -\epsfysize=\dimen46 -\pspoints=\dimen47 -\epsfnoopenhelp=\toks29 -) -\noepsfhelp=\toks30 - localization, -\nolanghelp=\toks31 -\countUTFx=\count56 -\countUTFy=\count57 -\countUTFz=\count58 - -formatting, -\defaultparindent=\dimen48 - and turning on texinfo input format.) -@fnindfile=@write2 -\openout2 = `ess.fn'. - - -Writing index file ess.fn -texinfo.tex: doing @include of ess-defs.texi - -(/u/maechler/emacs/ess/ess-18.10.2/doc/ess-defs.texi) -texinfo.tex: doing @include of ../VERSION - - (../VERSION) [1{/hg/s/linux/rhel3_amd64/app/teTeX/06.17/texmf-var/fonts/map/pd -ftex/updmap/pdftex.map}] -(/u/maechler/emacs/ess/ess-18.10.2/doc/ess.toc [-1] [-2]) [-3] -(/u/maechler/emacs/ess/ess-18.10.2/doc/ess.toc) -(/u/maechler/emacs/ess/ess-18.10.2/doc/ess.toc) Chapter 1 -\openout0 = `ess.toc'. - - -(/u/maechler/emacs/ess/ess-18.10.2/doc/ess.aux) -\openout1 = `ess.aux'. - -@cpindfile=@write3 -\openout3 = `ess.cp'. - - -Writing index file ess.cp -texinfo.tex: doing @include of currfeat.texi - -(/u/maechler/emacs/ess/ess-18.10.2/doc/currfeat.texi [1]) [2] -texinfo.tex: doing @include of newfeat.texi - - -(/u/maechler/emacs/ess/ess-18.10.2/doc/newfeat.texi [3] [4] [5] [6] [7]) -texinfo.tex: doing @include of credits.texi - - -(/u/maechler/emacs/ess/ess-18.10.2/doc/credits.texi -texinfo.tex: doing @include of authors.texi - - -(/u/maechler/emacs/ess/ess-18.10.2/doc/authors.texi [8])) Chapter 2 [9] -[10] -texinfo.tex: doing @include of installation.texi - - (/u/maechler/emacs/ess/ess-18.10.2/doc/installation.texi -texinfo.tex: doing @include of requires.texi - - -(/u/maechler/emacs/ess/ess-18.10.2/doc/requires.texi) -Missing character: There is no in font cmr10! -Missing character: There is no in font cmr10! -Missing character: There is no in font cmr10! - -Underfull \hbox (badness 8075) in paragraph at lines 46--50 -[]@textrm Alternatively, you may down-load the git repos-i-tory. ESS is cur-ren -tly - -@hbox(7.60416+2.12917)x433.62, glue set 4.3246 -.@hbox(0.0+0.0)x15.0 -.@textrm A -.@textrm l -.@textrm t -.@textrm e -.etc. - - -Underfull \hbox (badness 7722) in paragraph at lines 46--50 -@texttt https://github.com/emacs-ess/ESS.git[] @textrm will down-load it to a n -ew di-rec-tory - -@hbox(7.60416+2.43333)x433.62, glue set 4.26207 -.@texttt h -.@texttt t -.@texttt t -.@texttt p -.@texttt s -.etc. - -[11]) Chapter 3 [12] -@vrindfile=@write4 -\openout4 = `ess.vr'. - - -Writing index file ess.vr - -Underfull \hbox (badness 10000) in paragraph at lines 418--422 -[]@textrm You can switch to any ac-tive ESS pro-cess with the com-mand `@texttt - M-x - -@hbox(7.60416+2.12917)x433.62, glue set 5.0366 -.@hbox(0.0+0.0)x15.0 -.@textrm Y -.@kern-0.91252 -.@textrm o -.@textrm u -.etc. - -[13] [14] Chapter 4 [15] -@kyindfile=@write5 -\openout5 = `ess.ky'. - - -Writing index file ess.ky -[16] [17] [18] -Overfull \hbox (106.92076pt too wide) in paragraph at lines 933--933 - [] @texttt ;; somewhat extreme, almost disabling writing in *R*, *shell* -buffers above prompt:[] | - -@hbox(6.69167+2.43333)x433.62 -.@glue(@leftskip) 28.90755 -.@hbox(0.0+0.0)x0.0 -.@penalty 10000 -.@glue 5.74869 -.@penalty 10000 -.etc. - -[19] [20] [21] -Underfull \hbox (badness 7832) in paragraph at lines 1101--1104 - []@textttsl C-c C-s[] @textrm Sends the @texttt inferior-ess-search-list-comma -nd[] @textrm com-mand to the - -@hbox(7.60416+0.0)x433.62, glue set 4.28247 -.@glue(@leftskip) 28.90755 -.@hbox(0.0+0.0)x0.0 -.@textttsl C -.@textttsl - -.@discretionary -.etc. - -[22] Chapter 5 [23] [24] [25] Chapter 6 [26] Chapter 7 [27] [28] [29] [30] -[31] [32] Chapter 8 [33] [34] [35] Chapter 9 [36] [37] [38] Chapter 10 [39] -Overfull \hbox (37.7724pt too wide) in paragraph at lines 2419--2419 -[][] | - -@hbox(7.60416+0.91246)x433.62 -.@hbox(0.0+0.0)x0.0 -.@hbox(7.60416+0.91246)x471.3924 -..@penalty 10000 -..@glue 5.74869 -..@texttt ` -..@penalty 10000 -..@glue 5.74869 -..etc. -.@penalty 10000 -.@glue(@parfillskip) 0.0 plus 1.0fil -.@glue(@rightskip) 0.0 -.etc. - - -Overfull \hbox (43.52109pt too wide) in paragraph at lines 2419--2419 -[][] | - -@hbox(7.60416+0.91246)x433.62 -.@hbox(0.0+0.0)x0.0 -.@hbox(7.60416+0.91246)x477.14108 -..@penalty 10000 -..@glue 5.74869 -..@texttt ~ -..@penalty 10000 -..@glue 5.74869 -..etc. -.@penalty 10000 -.@glue(@parfillskip) 0.0 plus 1.0fil -.@glue(@rightskip) 0.0 -.etc. - - -Overfull \hbox (14.77765pt too wide) in paragraph at lines 2419--2419 -[][] | - -@hbox(6.69167+2.43333)x433.62 -.@hbox(0.0+0.0)x0.0 -.@hbox(6.69167+2.43333)x448.39764 -..@penalty 10000 -..@glue 5.74869 -..@texttt u -..@penalty 10000 -..@glue 5.74869 -..etc. -.@penalty 10000 -.@glue(@parfillskip) 0.0 plus 1.0fil -.@glue(@rightskip) 0.0 -.etc. - -[40] [41] [42] [43] [44] Chapter 11 [45] [46] [47] [48] [49] [50] Chapter 12 -[51] -texinfo.tex: doing @include of help-s.texi - - (/u/maechler/emacs/ess/ess-18.10.2/doc/help-s.texi [52] [53] [54]) -Chapter 13 [55] -texinfo.tex: doing @include of help-sas.texi - - (/u/maechler/emacs/ess/ess-18.10.2/doc/help-sas.texi [56] -[57] [58] [59] [60] [61] [62] [63]) Chapter 14 [64] -texinfo.tex: doing @include of help-bugs.texi - - -(/u/maechler/emacs/ess/ess-18.10.2/doc/help-bugs.texi) Chapter 15 [65] -texinfo.tex: doing @include of help-jags.texi - - -(/u/maechler/emacs/ess/ess-18.10.2/doc/help-jags.texi) Chapter 16 [66] -texinfo.tex: doing @include of bugs.texi - - -(/u/maechler/emacs/ess/ess-18.10.2/doc/bugs.texi) -texinfo.tex: doing @include of bugrept.texi - - -(/u/maechler/emacs/ess/ess-18.10.2/doc/bugrept.texi) -texinfo.tex: doing @include of mailing.texi - - -(/u/maechler/emacs/ess/ess-18.10.2/doc/mailing.texi [67]) Appendix A [68] -(Indices) [69] [70] [71] [72] [73] [74] ) -Here is how much of TeX's memory you used: - 3958 strings out of 497102 - 45255 string characters out of 6206773 - 104046 words of memory out of 5000000 - 4840 multiletter control sequences out of 15000+600000 - 32778 words of font info for 114 fonts, out of 8000000 for 9000 - 51 hyphenation exceptions out of 8191 - 18i,6n,16p,287b,718s stack positions out of 5000i,500n,10000p,200000b,80000s -< -/hg/s/linux/rhel3_amd64/app/teTeX/06.17/texmf-dist/fonts/type1/public/amsfonts/ -cm/cmsl10.pfb> -Output written on ess.pdf (78 pages, 441158 bytes). -PDF statistics: - 1467 PDF objects out of 1728 (max. 8388607) - 1355 compressed objects within 14 object streams - 180 named destinations out of 1000 (max. 500000) - 901 words of extra memory for PDF output out of 10000 (max. 10000000) - Binary files /tmp/tmpygwz1x8l/nasy0cgw6A/ess-18.10.2/doc/ess.pdf and /tmp/tmpygwz1x8l/8fYE79yjPk/ess-18.10.2+git20220915.f45542e/doc/ess.pdf differ diff -Nru ess-18.10.2/doc/ess.texi ess-18.10.2+git20220915.f45542e/doc/ess.texi --- ess-18.10.2/doc/ess.texi 2018-11-10 09:41:10.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/doc/ess.texi 2022-10-15 08:06:36.000000000 +0000 @@ -57,7 +57,7 @@ @top ESS: Emacs Speaks Statistics ESS version -@include ../VERSION +@ESSVER @display by A.J. Rossini, @@ -128,7 +128,7 @@ There are two main ways of interacting with ESS: through ``regular'' modes or ``inferior'' modes. Regular modes act like normal Emacs major -modes. ESS major mods are displayed in the mode-line in the format +modes. ESS major modes are displayed in the mode-line in the format @code{ESS[dialect]}, where @code{dialect} can take values such as @code{R}, @code{SAS}, or @code{S}. @@ -183,7 +183,7 @@ @section Why should I use ESS? Statistical packages are powerful software systems for manipulating and -analyzing data, but their user interfaces often leave something something +analyzing data, but their user interfaces often leave 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 @@ -356,6 +356,7 @@ * Multiple ESS processes:: * ESS processes on Remote Computers:: * Customizing startup:: +* Controlling buffer display:: @end menu @node Starting up @@ -536,12 +537,24 @@ @end enumerate +@vindex ess-ask-for-ess-directory +@vindex ess-pre-run-hook If @code{ess-ask-for-ess-directory} has a non-@code{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, @code{ess-directory} is an ideal variable to set in @code{ess-pre-run-hook}. +@vindex ess-post-run-hook +You may also customize @code{ess-post-run-hook} and the +dialect-specific @code{ess-*-post-run-hook} variables. For example, +you may want to use @code{ess-load-file} to load a file when ESS +starts R: + +@example +(add-hook 'ess-r-post-run-hook (lambda () (ess-load-file "foo.R"))) +@end example + If you like to keep a record of your R actions, set the variable @code{ess-ask-about-transfile} to @code{t}, and you will be asked for a filename for the transcript before the ESS process starts. @@ -573,11 +586,85 @@ particular do not pass the @samp{-e} option to @code{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 iESS process to appear in a separate -frame, customize the variable @code{inferior-ess-own-frame}. -Alternatively, change @code{inferior-ess-same-window} if you wish the -process to appear within another window of the current frame. +@vindex ess-auto-width +@vindex ess-auto-width-visible + +ESS can set the width option of inferior processes automatically when +the window configuration changes. To do so, set @code{ess-auto-width} +to a non-nil value. By default, the change will not be shown in the +inferior buffer. If you want it to be shown, set +@code{ess-auto-width-visible} to a non-nil value. + + +@node Controlling buffer display +@section Controlling buffer display + +Users can control how buffers are displayed by customizing +@code{display-buffer-alist}, @xref{Window Choice,,, emacs}. This +section provides examples of how to achieve certain setups. + +Users coming from RStudio may want the R process to appear at the +bottom left of the frame, help buffers to appear at the bottom right, +and ess-rdired buffers at the top right. To achieve that, you could +this. Note that the order matters; @code{*R Dired*} would match +@code{*R} if it came before in the alist. + +@example +(setq display-buffer-alist + `(("^\\*R Dired" + (display-buffer-reuse-window display-buffer-in-side-window) + (side . right) + (slot . -1) + (window-width . 0.33) + (reusable-frames . nil)) + ("^\\*R" + (display-buffer-reuse-window display-buffer-at-bottom) + (window-width . 0.5) + (reusable-frames . nil)) + ("^\\*Help" + (display-buffer-reuse-window display-buffer-in-side-window) + (side . right) + (slot . 1) + (window-width . 0.33) + (reusable-frames . nil)))) +@end example + +Some users prefer working with multiple frames where one frame has the +source code and the other frame has the inferior process. To achieve +this, use this example. For a detailed description of +@code{reusable-frames}, see @xref{Buffer Display Action Alists,,, elisp}. + +@example +(setq display-buffer-alist + '(("^\\*R" + (display-buffer-reuse-window display-buffer-pop-up-frame) + (reusable-frames . 0)))) +@end example + +Some users may want the process window to be dedicated to the process +so that other buffers are not shown on top of that window. +@xref{Dedicated Windows,,, elisp}. For example, this prevents help +buffers from being displayed in the window showing the inferior R +process. + +@example +(setq display-buffer-alist + '(("^\\*R" + nil + (dedicated . t)))) +@end example + +By default, ESS usually prefers splitting the frame into multiple +windows so that you can work with both the R script and the R REPL +visible at once. If you want to override this behavior so that the +script buffer and the process buffer share the same window, you can do +so like this: + +@example +(setq display-buffer-alist + '(("^\\*R" . ((display-buffer-same-window) (inhibit-same-window . nil))) + ("\\.R$" . ((display-buffer-same-window) (inhibit-same-window . nil))))) +@end example @node Entering commands @chapter Interacting with the ESS process @@ -919,7 +1006,7 @@ and do experiment with the @code{In/Out} menu to explore the possibilities. Many ESS users like to have even easier access to these, and recommend -to add something like +adding something like @example (eval-after-load "comint" '(progn @@ -1269,7 +1356,9 @@ @defvr {User Option} ess-eval-visibly Non-@code{nil} means @code{ess-eval-*} commands display commands and -output in the process buffer. Default is @code{t}. +output in the process buffer. A value of @code{t} blocks Emacs while R +is busy. A value of @code{nowait} does not block Emacs but printing +may be slightly off. @end defvr @pindex source() @@ -1601,8 +1690,8 @@ @code{(setq ess-indent-with-fancy-comments nil)} to your @file{.emacs} file. @vindex ess-indent-with-fancy-comments -ESS also supports Roxygen entries which is R documentation maintained in -the source code as comments @xref{Roxygen}. +ESS also supports roxygen2 entries which is R documentation maintained in +the source code as comments @xref{roxygen2}. The indentation commands provided by ESS are: @cindex indenting @@ -1614,15 +1703,10 @@ Try to indent first, and if code is already properly indented, complete instead. In ess-mode, only tries completion if -@code{ess-tab-complete-in-script} is non-nil. See also +@code{tab-always-indent} is @code{'complete}. See also @code{ess-first-tab-never-complete}. @end deffn -@defvr {User Option} ess-tab-complete-in-script -If non-@code{nil}, @kbd{TAB} in script buffers tries to complete if -there is nothing to indent. -@end defvr - @defvr {User Option} ess-first-tab-never-complete If non-@code{nil}, @kbd{TAB} never tries to complete in ess-mode. The default @code{'symbol} does not try to complete if the next char is a valid @@ -1685,14 +1769,14 @@ variable, see below. @end deffn -@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, RRR, -@dots{}) map onto different settings for variables. You can set this in -your Emacs configuration file: +@defvr {User Option} ess-style +The style to use. See the variable @code{ess-style-alist} for how +these groups (DEFAULT, OWN, GNU, RRR, @dots{}) map onto different +settings for variables. You can set this in your Emacs configuration +file: @example -(setq ess-default-style 'C++) +(setq ess-style 'C++) @end example @end defvr @@ -1700,12 +1784,12 @@ 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 @code{ess-own-style-list}. The default -style in use is controlled by @code{ess-default-style}. +style in use is controlled by @code{ess-style}. @end defvr The styles @code{DEFAULT} and @code{OWN} are initially identical. If you wish to edit some of the default values, set -@code{ess-default-style} to @code{'OWN} and change +@code{ess-style} to @code{'OWN} and change @code{ess-own-style-list}. @xref{Customization}, for convenient ways to set both these variables. @@ -1722,7 +1806,7 @@ of your own, copy the definition of @code{ess-own-style-list} to a new variable and ensure that the last line of the @code{:set} declaration calls @code{ess-add-style} with a unique name for your style -(e.g. @code{'MINE}). Finally, add @code{(setq ess-default-style 'MINE)} +(e.g. @code{'MINE}). Finally, add @code{(setq ess-style 'MINE)} to use your new style. @node Other edit buffer commands @@ -2133,6 +2217,13 @@ one per help buffer, or one for all help buffers), you can customize the variable @code{ess-help-own-frame}. +Help buffers are displayed by calling the function +@code{ess-display-help}. You can customize where these buffers are +displayed by adding an entry in @code{display-buffer-alist}; for +examples, see @xref{Controlling buffer display,,, ess}. Or by +customizing the options @code{ess-help-own-frame}, +@code{ess-help-frame-alist}, and @code{ess-display-buffer-reuse-frame}. + @findex ess-quit @findex ess-cleanup @cindex temporary buffers @@ -2143,7 +2234,6 @@ * Object names:: * Function arguments:: * Minibuffer completion:: -* Auto-complete:: * Company:: * Icicles:: @end menu @@ -2155,10 +2245,9 @@ @vindex ess-first-tab-never-complete The @key{TAB} key is for completion. The value of the variable -@code{ess-first-tab-never-complete} controls when completion is allowed -controls when completion is allowed to occur. In @code{ess-mode} -@key{TAB} first tries to indent, and if there is nothing to indent, -complete the object name instead. +@code{ess-first-tab-never-complete} controls when completion is allowed to +occur. In @code{ess-mode} @key{TAB} first tries to indent, and if there is +nothing to indent, complete the object name instead. @table @kbd @item TAB @@ -2187,7 +2276,7 @@ uniqueness, etc. If you just wish to see what completions exist without adding any extra characters, type @kbd{M-?}. -@deffn Command ess-list-object-completions +@deffn Command ess-complete-object-name @kindex M-? @kbd{M-?} List all possible completions of the object name at point. @end deffn @@ -2226,6 +2315,18 @@ completion will provide all the arguments of @code{S3} methods known to @code{R}. +@cindex Space in function argument completion +In R versions newer than 2.14.1, ESS uses R's built-in completion +engine and will honor its settings. You may read about them by issuing +@code{?rc.options} at the prompt. For example, to have the equals sign +for function arguments contain spaces on both sides (e.g. +@code{lm(for)} suggests @code{formula = } rather than +@code{formula=}), you can adjust @code{funarg.suffix}: + +@example +utils::rc.options(funarg.suffix = " = ") +@end example + A related functionality is @xref{ESS ElDoc}, which displays function arguments in the echo area whenever the point is inside a function call. @@ -2241,56 +2342,6 @@ @code{completion-read} interface if this feature is not available for whatever reason. -@node Auto-complete -@section Integration with auto-complete package -@cindex auto-complete -@vindex ac-source-R -@vindex ac-source-R-args -@vindex ac-source-R-objects -ESS provides three sources for @code{Auto Completion} mode: -@comment (@uref{http://cx4a.org/software/auto-complete/}) -@code{ac-source-R-args}, @code{ac-source-R-objects} and -@code{ac-source-R}. The last one combines the previous two and makes them -play nicely together. See auto-complete package documentation -(@uref{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 @code{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: - -@example -(setq ess-use-auto-complete nil) -@end example - -Or, to activate auto-completion only in the @code{ess-mode} buffers: - -@example -(setq ess-use-auto-complete 'script-only) -@end example - -ESS provides AC help both for arguments and objects (default keys -@kbd{C-?} or @kbd{}). You can bind @kbd{M-h} to display quick help -pop-ups: - -@example -(define-key ac-completing-map (kbd "M-h") 'ac-quick-help) -@end example - -@code{AC} binds @kbd{M-n}, and @kbd{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: - -@example -(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) -@end example - @node Company @section Company @cindex company @@ -2496,11 +2547,11 @@ 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. +roxygen2 package. @menu * R documentation files:: Edit objects in a specialized buffer -* Roxygen:: Loading source files into the ESS process +* roxygen2:: Loading source files into the ESS process @end menu @node R documentation files @@ -2520,16 +2571,6 @@ and by showing Rd keywords, strings, etc.@: in different faces (with Font Lock Mode). -Note that R also accepts Rd files with extension @file{rd}; to activate -@ESS{[Rd]} support for this extension, you may need to add - -@example -(add-to-list 'auto-mode-alist '("\\.rd\\'" . Rd-mode)) -@end example - -@noindent -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. @@ -2611,19 +2652,19 @@ (font-lock-mode 1))) @end example -@node Roxygen -@subsection Editing Roxygen documentation -@cindex Roxygen +@node roxygen2 +@subsection Editing roxygen2 documentation +@cindex roxygen2 @cindex roxy @cindex ess-roxy -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 +The roxygen2 R package makes it possible to keep the intended contents +for Rd files as structured comments in the R source files. roxygen2 can then parse R files and generate appropriate Rd files from these comments, fill the usage fields as well as updating @file{NAMESPACE} -files. See the Roxygen documentation found via @uref{http://roxygen.org} -for more information on its usage. An example of an Roxygen entry for a -simple R function can look like this: +files. See the roxygen2 documentation found via +@uref{https://roxygen2.r-lib.org} for more information on its usage. An +example of an roxygen2 entry for a simple R function can look like this: @example @verbatim @@ -2639,22 +2680,22 @@ @end verbatim @end example The entry is immediately preceding the object to document and all lines -start with the Roxygen prefix string, in this case @code{##'}. ESS +start with the roxygen2 prefix string, in this case @code{##'}. 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. +provided. -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. +roxygen2 is customized by the variables in the customization group ``Ess +Roxy''. Customizables include the roxygen2 prefix, use of folding +to toggle visibility of roxygen2 entries and the roxygen2 template. -All ESS Roxygen support is defined in @file{ess-roxy.el} which is loaded +All ESS roxygen2 support is defined in @file{ess-roxy.el} which is loaded by default in ESS. The following special Emacs commands are provided. @deffn Command ess-roxy-update-entry @kindex C-c C-o C-o -@kbd{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 +@kbd{C-c C-o C-o} Generate a roxygen2 template or update the parameter +list in roxygen2 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 @@ -2663,9 +2704,9 @@ @deffn Command ess-roxy-toggle-roxy-region @var{beg} @var{end} @kindex C-c C-o C-c -@kbd{C-c C-o C-c} Toggle the presence of the leading Roxygen string on +@kbd{C-c C-o C-c} Toggle the presence of the leading roxygen2 string on all lines in the marked region (between @var{beg} and -@var{end}. Convenient for transferring text to Roxygen entries and to +@var{end}. Convenient for transferring text to roxygen2 entries and to evaluate example fields. @end deffn @@ -2676,7 +2717,7 @@ syntax. When used with the prefix argument @var{name-file}, i.e. @kbd{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. +roxygen2 package to be installed. @end deffn @deffn Command ess-roxy-preview-HTML @var{visit-instead-of-open} @@ -2684,35 +2725,35 @@ @kbd{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 @var{visit-instead-of-open}, i.e. @kbd{C-u C-c C-e C-t}, -visit the generated HTML file instead. Requires the Roxygen and tools +visit the generated HTML file instead. Requires the roxygen2 and tools packages to be installed. @end deffn @deffn Command ess-roxy-previous-entry @kindex C-c C-o p -@kbd{C-c C-o p} Go to start of the Roxygen entry above point. +@kbd{C-c C-o p} Go to start of the roxygen2 entry above point. @end deffn @deffn Command ess-roxy-next-entry @kindex C-c C-o n -@kbd{C-c C-o n} Go to end of the Roxygen entry above point. +@kbd{C-c C-o n} Go to end of the roxygen2 entry above point. @end deffn @deffn Command ess-roxy-hide-all @kindex C-c C-o C-h @kbd{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 +all roxygen2 entries. Hide-show support must be enabled for this binding to get defined. @end deffn ESS also advises the following standard editing functions in order to -make Roxygen editing more intuitive: +make roxygen2 editing more intuitive: @c not very precise, TAB calls it indirectly @table @kbd @item TAB @findex ess-R-complete-object-name -@code{ess-R-complete-object-name} Complete Roxygen tag at +@code{ess-R-complete-object-name} Complete roxygen2 tag at point. E.g. doing @kbd{TAB} when the point is at the end of @code{@@par} completes to @code{@@param}. @@ -2724,20 +2765,20 @@ @item TAB @findex ess-indent-command @code{ess-indent-command} If hide-show support is enabled, fold away the -visibility of the Roxygen entry at point. +visibility of the roxygen2 entry at point. @item M-q @findex fill-paragraph -@code{fill-paragraph} Fill the Roxygen field at point. +@code{fill-paragraph} Fill the roxygen2 field at point. @item C-a -@findex move-beginning-of-line -@code{move-beginning-of-line} Move to the point directly to the right of -the Roxygen start string. +@findex ess-roxy-move-beginning-of-line +@code{ess-roxy-move-beginning-of-line} Move to the point directly to the right of +the roxygen2 start string. If already there, move to the beginning of the line. @item RET @findex newline-and-indent -@code{newline-and-indent} Insert a new line and the Roxygen prefix +@code{newline-and-indent} Insert a new line and the roxygen2 prefix string. @end table @@ -2795,7 +2836,7 @@ * Toolbar:: Support for toolbar in ESS * Xref:: Xref * Rdired:: Directory editor for R objects -* Rutils:: R object/package management and help utilities +* Package listing:: R object/package management and help utilities * Org:: Interaction with Org mode * Sweave and AUCTeX:: Support for Sweave in ESS and AUCTeX @end menu @@ -3055,9 +3096,9 @@ @cindex xref @cindex finding function definitions Xref is an Emacs interface that supports finding ``identifiers,'' -usually function definitions in ESS's view. ESS ships with support for -Xref in Emacs versions 25.1 and higher. @xref{Xref,,, emacs, The Gnu -Emacs Reference Manual} for how to use this feature. +usually function definitions in ESS's view. ESS ships with support for +Xref in Emacs versions 25.1 and higher. For how to use this feature, see +@xref{Xref,,, emacs, The Gnu Emacs Reference Manual}. @node Rdired @section Rdired @@ -3093,63 +3134,40 @@ deletion (`x' will actually perform the deletion). -@node Rutils -@section Rutils +@node Package listing +@section Package listing -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 @code{help.start()} and -@code{RSiteSearch()} that use the @command{browse-url} Emacs function. -The library can be loaded using @kbd{M-x load-file}, but the easiest is -to include: - -@lisp -(require 'ess-rutils) -@end lisp - -in your Emacs configuration file. Once R is started with @kbd{M-x R}, and if the value of -the customizable variable @code{ess-rutils-keys} is true, several key -bindings become available in iESS process buffers: +ESS[R] provides several commands to list and manage packages and +objects under the @code{C-c C-.} keymap: -@deffn Command ess-rutils-local-pkgs +@deffn Command ess-r-package-list-local-packages @kindex C-c C-. l @kbd{C-c C-. l} List all packages in all available libraries. @end deffn -@deffn Command ess-rutils-repos-pkgs +@deffn Command ess-r-package-list-available-packages @kindex C-c C-. r @kbd{C-c C-. r} List available packages from repositories listed by @command{getOptions(``repos'')} in the current R session. @end deffn -@deffn Command ess-rutils-update-pkgs @var{lib} @var{repos} +@deffn Command ess-r-package-update-packages @var{lib} @var{repos} @kindex C-c C-. u @kbd{C-c C-. u} Update packages in a particular library @var{lib} and repository @var{repos}. @end deffn -@deffn Command ess-rutils-apropos -@kindex C-c C-. a -@kbd{C-c C-. a} Search for a string using apropos. -@end deffn - @deffn Command ess-rutils-rm-all @kindex C-c C-. m @kbd{C-c C-. m} Remove all R objects. @end deffn -@deffn Command ess-rutils-objs -@kindex C-c C-. o -@kbd{C-c C-. o} Manipulate R objects; wrapper for @command{ess-rdired}. -@end deffn - -@deffn Command ess-rutils-load-wkspc +@deffn Command ess-rutils-load-workspace @kindex C-c C-. w @kbd{C-c C-. w} Load a workspace file into R. @end deffn -@deffn Command ess-rutils-save-wkspc +@deffn Command ess-rutils-save-workspace @kindex C-c C-. s @kbd{C-c C-. s} Save a workspace file. @end deffn @@ -3165,17 +3183,6 @@ documentation. @end deffn -See the submenu @samp{Rutils} under the iESS menu for alternative access -to these functions. The function @command{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: - -@lisp -(eval-after-load "ess-rutils" - '(global-set-key [(control c) (f6)] 'ess-rutils-rsitesearch)) -@end lisp -@findex ess-rutils-rsitesearch - Functions for listing objects and packages (@command{ess-rutils-local-pkgs}, @command{ess-rutils-repos-pkgs}, and @command{ess-rutils-objs}) show results in a separate buffer and window, @@ -3188,8 +3195,8 @@ Org-mode (@uref{https://orgmode.org}) now supports reproducible research and literate programming in many languages (including R) -- see chapter -14 of the Org manual -(@uref{https://orgmode.org/org.html#Working-With-Source-Code}). For ESS +15 of the Org manual +(@uref{https://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 @@ -3203,8 +3210,16 @@ @node Sweave and AUCTeX @section Support for Sweave in ESS and AUCTeX +Libraries for literate data analysis are obsolete and not loaded by +default. This includes @code{ess-noweb}, @code{ess-swv}, and related +functionality like @code{Rnw-mode}. Users are encouraged to switch to +one of several other packages that deal with these modes. For example, +polymode @url{https://github.com/polymode/poly-R/}, +@url{https://polymode.github.io/}, or markdown-mode with edit-indirect +@url{https://jblevins.org/projects/markdown-mode}. + ESS provides support for writing and processing Sweave -(@uref{https://www.statistik.lmu.de/~leisch/Sweave}), building up on +(@uref{https://leisch.userweb.mwn.de/Sweave/}), building up on Emacs' ess-noweb-mode for literate programming. When working on an Sweave document, the following key bindings are available: diff -Nru ess-18.10.2/doc/ess.toc ess-18.10.2+git20220915.f45542e/doc/ess.toc --- ess-18.10.2/doc/ess.toc 2018-11-10 09:41:22.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/doc/ess.toc 1970-01-01 00:00:00.000000000 +0000 @@ -1,111 +0,0 @@ -@numchapentry{Introduction to ESS}{1}{Introduction}{1} -@numsecentry{Why should I use ESS?}{1.1}{Features}{1} -@numsubsecentry{Features Overview}{1.1.1}{Current Features}{2} -@numsecentry{New features in ESS}{1.2}{New features}{3} -@numsecentry{Authors of and contributors to ESS}{1.3}{Credits}{8} -@numsecentry{How to read this manual}{1.4}{Manual}{9} -@numchapentry{Installing ESS on your system}{2}{Installation}{11} -@numsecentry{Installing from a third-party repository}{2.1}{Installing from a third-party repository}{11} -@numsecentry{Installing from source}{2.2}{Installing from source}{11} -@numsecentry{Activating and Loading ESS}{2.3}{Activating and Loading ESS}{12} -@numsecentry{Check Installation}{2.4}{Check Installation}{12} -@numchapentry{Interacting with statistical programs}{3}{Interactive ESS}{13} -@numsecentry{Starting an ESS process}{3.1}{Starting up}{13} -@numsecentry{Running more than one ESS process}{3.2}{Multiple ESS processes}{13} -@numsecentry{ESS processes on Remote Computers}{3.3}{ESS processes on Remote Computers}{13} -@numsubsecentry{ESS and TRAMP}{3.3.1}{}{13} -@numsubsecentry{ESS-remote}{3.3.2}{}{14} -@numsecentry{Changing the startup actions}{3.4}{Customizing startup}{15} -@numchapentry{Interacting with the ESS process}{4}{Entering commands}{16} -@numsecentry{Entering commands and fixing mistakes}{4.1}{Command-line editing}{16} -@numsecentry{Manipulating the transcript}{4.2}{Transcript}{16} -@numsubsecentry{Manipulating the output from the last command}{4.2.1}{Last command}{17} -@numsubsecentry{Viewing older commands}{4.2.2}{Process buffer motion}{17} -@numsubsecentry{Re-submitting commands from the transcript}{4.2.3}{Transcript resubmit}{17} -@numsubsecentry{Keeping a record of your R session}{4.2.4}{Saving transcripts}{18} -@numsecentry{Command History}{4.3}{Command History}{19} -@numsubsecentry{Saving the command history}{4.3.1}{Saving History}{20} -@numsecentry{References to historical commands}{4.4}{History expansion}{20} -@numsecentry{Hot keys for common commands}{4.5}{Hot keys}{21} -@numsecentry{Is the Statistical Process running under ESS?}{4.6}{Statistical Process running in ESS?}{23} -@numsecentry{Using emacsclient}{4.7}{Emacsclient}{23} -@numsecentry{Other commands provided by inferior-ESS}{4.8}{Other}{23} -@numchapentry{Sending code to the ESS process}{5}{Evaluating code}{25} -@numchapentry{Manipulating saved transcript files}{6}{Transcript Mode}{27} -@numsecentry{Resubmitting commands from the transcript file}{6.1}{Resubmit}{27} -@numsecentry{Cleaning transcript files}{6.2}{Clean}{27} -@numchapentry{Editing objects and functions}{7}{Editing objects}{28} -@numsecentry{Creating or modifying R objects}{7.1}{Edit buffer}{28} -@numsecentry{Loading source files into the ESS process}{7.2}{Loading}{28} -@numsecentry{Detecting errors in source files}{7.3}{Error Checking}{29} -@numsecentry{Indenting and formatting R code}{7.4}{Indenting}{29} -@numsubsecentry{Changing styles for code indentation and alignment}{7.4.1}{Styles}{30} -@numsecentry{Commands for motion, completion and more}{7.5}{Other edit buffer commands}{31} -@numsecentry{Maintaining R source files}{7.6}{Source Files}{31} -@numsecentry{Names and locations of dump files}{7.7}{Source Directories}{33} -@numchapentry{Reading help files}{8}{Help}{35} -@numchapentry{Completion}{9}{Completion}{37} -@numsecentry{Completion of object names}{9.1}{Object names}{37} -@numsecentry{Completion of function arguments}{9.2}{Function arguments}{37} -@numsecentry{Minibuffer completion}{9.3}{Minibuffer completion}{38} -@numsecentry{Integration with auto-complete package}{9.4}{Auto-complete}{38} -@numsecentry{Company}{9.5}{Company}{38} -@numsecentry{Icicles}{9.6}{Icicles}{38} -@numchapentry{Developing with ESS}{10}{Developing with ESS}{40} -@numsecentry{ESS tracebug}{10.1}{ESS tracebug}{40} -@numsubsecentry{Getting started with tracebug}{10.1.1}{Getting started with tracebug}{41} -@numsecentry{Editing documentation}{10.2}{Editing documentation}{42} -@numsubsecentry{Editing R documentation (Rd) files}{10.2.1}{R documentation files}{42} -@numsubsecentry{Editing Roxygen documentation}{10.2.2}{Roxygen}{43} -@numsecentry{Namespaced Evaluation}{10.3}{Namespaced Evaluation}{45} -@numchapentry{Other ESS features and tools}{11}{Extras}{46} -@numsecentry{ElDoc}{11.1}{ESS ElDoc}{46} -@numsecentry{Flymake}{11.2}{ESS Flymake}{46} -@numsecentry{Handy commands}{11.3}{Handy commands}{47} -@numsecentry{Syntactic highlighting of buffers}{11.4}{Highlighting}{47} -@numsecentry{Parenthesis matching}{11.5}{Parens}{48} -@numsecentry{Using graphics with ESS}{11.6}{Graphics}{48} -@numsubsecentry{Using ESS with the @code {printer()} driver}{11.6.1}{printer}{48} -@numsubsecentry{Using ESS with windowing devices}{11.6.2}{X11}{48} -@numsubsecentry{Java Graphics Device}{11.6.3}{winjava}{48} -@numsecentry{Imenu}{11.7}{Imenu}{48} -@numsecentry{Toolbar}{11.8}{Toolbar}{49} -@numsecentry{Xref}{11.9}{Xref}{49} -@numsecentry{Rdired}{11.10}{Rdired}{49} -@numsecentry{Rutils}{11.11}{Rutils}{49} -@numsecentry{Interaction with Org mode}{11.12}{Org}{51} -@numsecentry{Support for Sweave in ESS and AUCTeX}{11.13}{Sweave and AUCTeX}{51} -@numchapentry{Overview of ESS features for the S family}{12}{ESS for R}{52} -@numsecentry{ESS[R]--Editing files}{12.1}{ESS(R)--Editing files}{52} -@numsecentry{iESS[R]--Inferior ESS processes}{12.2}{iESS(R)--Inferior ESS processes}{52} -@numsecentry{Philosophies for using ESS[R]}{12.3}{Philosophies for using ESS(R)}{53} -@numsecentry{Example ESS usage}{12.4}{Example ESS usage}{54} -@numchapentry{ESS for SAS}{13}{ESS for SAS}{56} -@numsecentry{ESS[SAS]--Design philosophy}{13.1}{ESS(SAS)--Design philosophy}{56} -@numsecentry{ESS[SAS]--Editing files}{13.2}{ESS(SAS)--Editing files}{56} -@numsecentry{ESS[SAS]--@key {TAB} key}{13.3}{ESS(SAS)--TAB key}{57} -@numsecentry{ESS[SAS]--Batch SAS processes}{13.4}{ESS(SAS)--Batch SAS processes}{57} -@numsecentry{ESS[SAS]--Function keys for batch processing}{13.5}{ESS(SAS)--Function keys for batch processing}{59} -@numsecentry{iESS[SAS]--Interactive SAS processes}{13.6}{iESS(SAS)--Interactive SAS processes}{62} -@numsecentry{iESS[SAS]--Common problems}{13.7}{iESS(SAS)--Common problems}{63} -@numsecentry{ESS[SAS]--Graphics}{13.8}{ESS(SAS)--Graphics}{64} -@numsecentry{ESS[SAS]--Windows}{13.9}{ESS(SAS)--Windows}{64} -@numchapentry{ESS for BUGS}{14}{ESS for BUGS}{65} -@numsecentry{ESS[BUGS]--Model files}{14.1}{}{65} -@numsecentry{ESS[BUGS]--Command files}{14.2}{}{65} -@numsecentry{ESS[BUGS]--Log files}{14.3}{}{65} -@numchapentry{ESS for JAGS}{15}{ESS for JAGS}{66} -@numsecentry{ESS[JAGS]--Model files}{15.1}{}{66} -@numsecentry{ESS[JAGS]--Command files}{15.2}{}{66} -@numsecentry{ESS[JAGS]--Log files}{15.3}{}{66} -@numchapentry{Bugs and Bug Reporting, Mailing Lists}{16}{Mailing lists/bug reports}{67} -@numsecentry{Bugs}{16.1}{Bugs}{67} -@numsecentry{Reporting Bugs}{16.2}{Reporting Bugs}{67} -@numsecentry{Mailing Lists}{16.3}{Mailing Lists}{67} -@numsecentry{Help with Emacs}{16.4}{Help with Emacs}{68} -@appentry{Customizing ESS}{A}{Customization}{69} -@unnchapentry{Indices}{10001}{Indices}{70} -@unnsecentry{Key index}{10001.1}{Key index}{70} -@unnsecentry{Function and program index}{10001.2}{Function and program index}{70} -@unnsecentry{Variable index}{10001.3}{Variable index}{72} -@unnsecentry{Concept Index}{10001.4}{Concept index}{72} diff -Nru ess-18.10.2/doc/ess.vr ess-18.10.2+git20220915.f45542e/doc/ess.vr --- ess-18.10.2/doc/ess.vr 2018-11-10 09:41:22.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/doc/ess.vr 1970-01-01 00:00:00.000000000 +0000 @@ -1,42 +0,0 @@ -\entry{ess-plain-first-buffername}{13}{\code {ess-plain-first-buffername}} -\entry{ess-ask-for-ess-directory}{15}{\code {ess-ask-for-ess-directory}} -\entry{ess-ask-about-transfile}{15}{\code {ess-ask-about-transfile}} -\entry{inferior-ess-program}{15}{\code {inferior-ess-program}} -\entry{iESS program arguments}{15}{\code {iESS program arguments}} -\entry{ess-ask-about-transfile}{18}{\code {ess-ask-about-transfile}} -\entry{comint-input-ring-size}{19}{\code {comint-input-ring-size}} -\entry{comint-delimiter-argument-list}{20}{\code {comint-delimiter-argument-list}} -\entry{ess-execute-in-process-buffer}{21}{\code {ess-execute-in-process-buffer}} -\entry{ess-switch-to-end-of-proc-buffer}{23}{\code {ess-switch-to-end-of-proc-buffer}} -\entry{ess-eval-visibly}{25}{\code {ess-eval-visibly}} -\entry{ess-function-template}{28}{\code {ess-function-template}} -\entry{comment-column}{29}{\code {comment-column}} -\entry{ess-indent-with-fancy-comments}{29}{\code {ess-indent-with-fancy-comments}} -\entry{ess-tab-complete-in-script}{29}{\code {ess-tab-complete-in-script}} -\entry{ess-first-tab-never-complete}{30}{\code {ess-first-tab-never-complete}} -\entry{ess-default-style}{30}{\code {ess-default-style}} -\entry{ess-style-alist}{30}{\code {ess-style-alist}} -\entry{ess-delete-dump-files}{31}{\code {ess-delete-dump-files}} -\entry{ess-keep-dump-files}{32}{\code {ess-keep-dump-files}} -\entry{ess-dump-filename-template}{33}{\code {ess-dump-filename-template}} -\entry{ess-source-directory}{33}{\code {ess-source-directory}} -\entry{ess-directory}{33}{\code {ess-directory}} -\entry{ess-search-list}{33}{\code {ess-search-list}} -\entry{ess-first-tab-never-complete}{37}{\code {ess-first-tab-never-complete}} -\entry{ac-source-R}{38}{\code {ac-source-R}} -\entry{ac-source-R-args}{38}{\code {ac-source-R-args}} -\entry{ac-source-R-objects}{38}{\code {ac-source-R-objects}} -\entry{Rd-mode-hook}{43}{\code {Rd-mode-hook}} -\entry{Rd-indent-level}{43}{\code {Rd-indent-level}} -\entry{Rd-to-help-command}{43}{\code {Rd-to-help-command}} -\entry{ess-use-eldoc}{46}{\code {ess-use-eldoc}} -\entry{ess-eldoc-show-on-symbol}{46}{\code {ess-eldoc-show-on-symbol}} -\entry{ess-eldoc-abbreviation-style}{46}{\code {ess-eldoc-abbreviation-style}} -\entry{ess-use-flymake}{46}{\code {ess-use-flymake}} -\entry{ess-r-flymake-linters}{46}{\code {ess-r-flymake-linters}} -\entry{ess-r-flymake-lintr-cache}{46}{\code {ess-r-flymake-lintr-cache}} -\entry{ess-handy-commands}{47}{\code {ess-handy-commands}} -\entry{ess-handy-commands}{47}{\code {ess-handy-commands}} -\entry{inferior-R-font-lock-keywords}{47}{\code {inferior-R-font-lock-keywords}} -\entry{ess-R-font-lock-keywords}{47}{\code {ess-R-font-lock-keywords}} -\entry{ess-swv-pdflatex-commands}{51}{\code {ess-swv-pdflatex-commands}} diff -Nru ess-18.10.2/doc/ess.vrs ess-18.10.2+git20220915.f45542e/doc/ess.vrs --- ess-18.10.2/doc/ess.vrs 2018-11-10 09:41:21.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/doc/ess.vrs 1970-01-01 00:00:00.000000000 +0000 @@ -1,44 +0,0 @@ -\initial {A} -\entry {\code {ac-source-R}}{38} -\entry {\code {ac-source-R-args}}{38} -\entry {\code {ac-source-R-objects}}{38} -\initial {C} -\entry {\code {comint-delimiter-argument-list}}{20} -\entry {\code {comint-input-ring-size}}{19} -\entry {\code {comment-column}}{29} -\initial {E} -\entry {\code {ess-ask-about-transfile}}{15, 18} -\entry {\code {ess-ask-for-ess-directory}}{15} -\entry {\code {ess-default-style}}{30} -\entry {\code {ess-delete-dump-files}}{31} -\entry {\code {ess-directory}}{33} -\entry {\code {ess-dump-filename-template}}{33} -\entry {\code {ess-eldoc-abbreviation-style}}{46} -\entry {\code {ess-eldoc-show-on-symbol}}{46} -\entry {\code {ess-eval-visibly}}{25} -\entry {\code {ess-execute-in-process-buffer}}{21} -\entry {\code {ess-first-tab-never-complete}}{30, 37} -\entry {\code {ess-function-template}}{28} -\entry {\code {ess-handy-commands}}{47} -\entry {\code {ess-indent-with-fancy-comments}}{29} -\entry {\code {ess-keep-dump-files}}{32} -\entry {\code {ess-plain-first-buffername}}{13} -\entry {\code {ess-r-flymake-linters}}{46} -\entry {\code {ess-r-flymake-lintr-cache}}{46} -\entry {\code {ess-R-font-lock-keywords}}{47} -\entry {\code {ess-search-list}}{33} -\entry {\code {ess-source-directory}}{33} -\entry {\code {ess-style-alist}}{30} -\entry {\code {ess-switch-to-end-of-proc-buffer}}{23} -\entry {\code {ess-swv-pdflatex-commands}}{51} -\entry {\code {ess-tab-complete-in-script}}{29} -\entry {\code {ess-use-eldoc}}{46} -\entry {\code {ess-use-flymake}}{46} -\initial {I} -\entry {\code {iESS program arguments}}{15} -\entry {\code {inferior-ess-program}}{15} -\entry {\code {inferior-R-font-lock-keywords}}{47} -\initial {R} -\entry {\code {Rd-indent-level}}{43} -\entry {\code {Rd-mode-hook}}{43} -\entry {\code {Rd-to-help-command}}{43} diff -Nru ess-18.10.2/doc/help-sas.texi ess-18.10.2+git20220915.f45542e/doc/help-sas.texi --- ess-18.10.2/doc/help-sas.texi 2018-11-10 09:41:10.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/doc/help-sas.texi 2022-10-15 08:06:36.000000000 +0000 @@ -4,8 +4,7 @@ @ESS{[SAS]}. The user interface of @ESS{[SAS]} has similarities with @ESS{[S]} and the @SAS{} Display Manager. -@comment node-name, next, previous, up -@node ESS(SAS)--Design philosophy, ESS(SAS)--Editing files, ESS for SAS, ESS for SAS +@node ESS(SAS)--Design philosophy @section ESS[SAS]--Design philosophy @ESS{[SAS]} was designed to aid the user in writing and maintaining @SAS{} @@ -26,8 +25,7 @@ advanced @ESS{[SAS]} users. @end enumerate -@comment node-name, next, previous, up -@node ESS(SAS)--Editing files, ESS(SAS)--TAB key, ESS(SAS)--Design philosophy, ESS for SAS +@node ESS(SAS)--Editing files @section ESS[SAS]--Editing files @ESS{[SAS]} is the mode for editing @SAS{} language files. This mode handles: @@ -69,8 +67,7 @@ single/double quotes in @code{CARDS} data lines are @strong{NOT} ignored; in an iterative @code{DO} statement, @code{TO} and @code{BY} are not highlighted. -@comment node-name, next, previous, up -@node ESS(SAS)--TAB key, ESS(SAS)--Batch SAS processes, ESS(SAS)--Editing files, ESS for SAS +@node ESS(SAS)--TAB key @section ESS[SAS]--@key{TAB} key Two options. The @key{TAB} key is bound by default to @@ -99,8 +96,7 @@ Under the alternate behavior, @key{TAB} is bound to @wkbd{M-x tab-to-tab-stop} and the stops are defined by @code{ess-sas-tab-stop-list}. -@comment node-name, next, previous, up -@node ESS(SAS)--Batch SAS processes, ESS(SAS)--Function keys for batch processing, ESS(SAS)--TAB key, ESS for SAS +@node ESS(SAS)--Batch SAS processes @section ESS[SAS]--Batch SAS processes Submission of a @SAS{} batch job is dependent on your environment. @@ -222,8 +218,7 @@ @key{F3} (@key{F8}) @end example -@comment node-name, next, previous, up -@node ESS(SAS)--Function keys for batch processing, iESS(SAS)--Interactive SAS processes, ESS(SAS)--Batch SAS processes, ESS for SAS +@node ESS(SAS)--Function keys for batch processing @section ESS[SAS]--Function keys for batch processing The setup of function keys for @SAS{} batch processing @@ -482,9 +477,7 @@ (define-key sas-mode-local-map [(control f2)] 'ess-sas-rtf-a4-landscape) @end example - -@comment node-name, next, previous, up -@node iESS(SAS)--Interactive SAS processes, iESS(SAS)--Common problems, ESS(SAS)--Function keys for batch processing, ESS for SAS +@node iESS(SAS)--Interactive SAS processes @section iESS[SAS]--Interactive SAS processes Inferior @ESS{} (@iESS{}) is the method for interfacing with interactive @@ -581,8 +574,7 @@ Troubleshooting: @xref{iESS(SAS)--Common problems}. -@comment node-name, next, previous, up -@node iESS(SAS)--Common problems, ESS(SAS)--Graphics, iESS(SAS)--Interactive SAS processes, ESS for SAS +@node iESS(SAS)--Common problems @section iESS[SAS]--Common problems @enumerate @@ -636,8 +628,7 @@ @comment @end example @comment @end enumerate -@comment node-name, next, previous, up -@node ESS(SAS)--Graphics, ESS(SAS)--Windows, iESS(SAS)--Common problems, ESS for SAS +@node ESS(SAS)--Graphics @section ESS[SAS]--Graphics Output from a @SAS{/GRAPH} @code{PROC} can be displayed in a @SAS{/GRAPH} @@ -658,8 +649,7 @@ run; @end example -@comment node-name, next, previous, up -@node ESS(SAS)--Windows, , ESS(SAS)--Graphics, ESS for SAS +@node ESS(SAS)--Windows @section ESS[SAS]--Windows @itemize @bullet diff -Nru ess-18.10.2/doc/help-s.texi ess-18.10.2+git20220915.f45542e/doc/help-s.texi --- ess-18.10.2/doc/help-s.texi 2018-11-10 09:41:10.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/doc/help-s.texi 2022-10-15 08:06:36.000000000 +0000 @@ -1,5 +1,4 @@ -@node ESS(R)--Editing files, iESS(R)--Inferior ESS processes, ESS for R, ESS for R -@comment node-name, next, previous, up -- don't use @ESS .. +@node ESS(R)--Editing files @section ESS[R]--Editing files @ESS{[R]} mode should be automatically turned on when visiting a file @@ -8,8 +7,7 @@ put the current buffer into R mode. However, one will have to start up an inferior process to take advantage of the interactive features. -@node iESS(R)--Inferior ESS processes, Philosophies for using ESS(R), ESS(R)--Editing files, ESS for R -@comment node-name, next, previous, up +@node iESS(R)--Inferior ESS processes @section iESS[R]--Inferior ESS processes To start up iESS mode for R, use: @@ -22,7 +20,7 @@ @end example @noindent -(for R, S-PLUS 3.x, S4, S+5, S+6 or or S+7, respectively. This assumes that +(for R, S-PLUS 3.x, S4, S+5, S+6 or S+7, respectively. This assumes that you have access to each). @cindex command line arguments @@ -40,15 +38,15 @@ which OS you are using (details below). The general principle, regardless of OS, is that ESS searches the paths listed in the variable @code{exec-path} for R binaries. If ESS cannot -find your R binaries, on Unix you can change the unix environment +find your R binaries, on Unix you can change the Unix environment variable @code{PATH}, as this variable is used to set @code{exec-path}. R on GNU/Linux systems and other Unix-like systems (macOS): If you have -"R-1.8.1" on your @code{exec-path}, it can be started using @kbd{M-x -R-1.8.1}. By default, ESS will find versions of R beginning ``R-1'', -``R-2'', ``R-3'', ``R-devel'', or ``R-patched''. If your versions of R +"R-3.6.3" on your @code{exec-path}, it can be started using @kbd{M-x +R-3.6.3}. By default, ESS will find versions of R beginning ``R-1'', +``R-2'', @dots{}, ``R-7'', ``R-devel'', or ``R-patched''. If your versions of R are called other names, consider renaming them with a symbolic link or -change the variable @code{ess-r-versions}. To see which functions have +change the variable @code{ess-r-runners-prefixes}. To see which functions have been created for starting different versions of R, type @kbd{M-x R-} and then hit [Tab]. These other versions of R can also be started from the "ESS->Start Process->Other" menu. @@ -63,53 +61,11 @@ 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 @kbd{M-x R-newest}, which will call the newest version +function, called @kbd{M-x run-ess-r-newest}, which will call the newest version of R that it found. (ESS examines the date in the first line of information from @code{R --version} to determine which is newest.) -S on Unix systems: If you have "Splus7" on your @code{exec-path}, it can -be started using @kbd{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 @code{ess-s-versions}. To see which functions have -been created for starting different versions of Splus, type @kbd{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 @code{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: -@example -(setq ess-s-versions-list - '( ("Splus64" "/usr/local/bin/Splus64") - ("Splus64-j" "/usr/local/bin/Splus64" "-j"))) -@end example -which will then allow you to do @kbd{M-x Splus64-j} to start Splus64 -with the corresponding command line arguments. - -If you change the value of either @code{ess-r-versions} or -@code{ess-s-versions-list}, you should put them in your Emacs -configuration file 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 @kbd{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 -@code{ess-SHOME-versions}. To see which functions have been created for -starting different versions of S-Plus, type @kbd{M-x spl} and then hit -[Tab]. These other versions of S-Plus can also be started from the -"ESS->Start Process->Other" menu. - - -@node Philosophies for using ESS(R), Example ESS usage, iESS(R)--Inferior ESS processes, ESS for R -@comment node-name, next, previous, up +@node Philosophies for using ESS(R) @section Philosophies for using ESS[R] There are two philosophies for using ESS. Most modern best practices @@ -130,66 +86,55 @@ (setq ess-mode-silently-save nil) @end example -@node Example ESS usage, , Philosophies for using ESS(R), ESS for R +@node Example ESS usage @section Example ESS usage -We present some basic examples for using ESS to interact with R -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 "##". +Comments as to what should be happening are prefixed by "##". + @display -1: ## Data Analysis Example - ## Load the file you want to work with + ### Data Analysis Example + + ## Open the file you want with C-x C-f myfile.R - ## Edit as appropriate, then start and switch to an R buffer + ## Edit as appropriate, then start and switch to an *R* + process buffer with C-c C-z ## A new buffer *R* will appear. R will have been started - ## in this buffer. The buffer is in iESS [R] mode. + ## in this buffer. The buffer is in iESS [R] mode. - ## Return to the script (prefix with C-c if you have pressed other keys) - C-z + ## Return to the script + C-z (or C-c C-z if you have pressed other keys in between) - ## Send regions, lines, or the entire file contents to R. For regions, - ## highlight a region with keystrokes or mouse and then send with: - C-c C-r + ## Send current region (if active), or function, or paragraph at + point with + C-M-x - ## Re-edit myfile.R as necessary to correct any difficulties. Add - ## new commands here. Send them to R by region with C-c C-r, or - ## one line at a time with C-c C-n. + ## Send current region or function or paragraph and step with + C-c C-c - ## Save the revised myfile.R with C-x C-s. + ## Send current line with + C-RET - ## Save the entire *R* interaction buffer with C-c C-s. You - ## will be prompted for a file name. The recommended name is - ## myfile.Rout. With this 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 R in a process buffer (this will be *R*) - M-x R - - ## Load the file you want to work with - C-x C-f myfile.R - - ## edit program, functions, and code in myfile.R, and send revised - ## functions to R 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 M-l + C-c C-l + + ## Save the revised myfile.R with + C-x C-s. - ## save the revised myfile.R when you have finished - C-c C-s + ## Save the entire *R* interaction buffer with + C-x C-s. + + ## Search for documentation with + C-c C-d + + ## Investigate available ESS commands with + C-c C-h + + ## You will be prompted for a file name. The recommended name is + ## myfile.Rout. With this suffix, the file will be opened in + ## ess-transcript. @end display diff -Nru ess-18.10.2/doc/html/ess.html ess-18.10.2+git20220915.f45542e/doc/html/ess.html --- ess-18.10.2/doc/html/ess.html 2018-11-10 09:41:26.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/doc/html/ess.html 1970-01-01 00:00:00.000000000 +0000 @@ -1,6780 +0,0 @@ - - - - - -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 -18.10.2 -

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

Emacs Speaks Statistics (ESS) provides an intelligent, consistent -interface between the user and the software. ESS interfaces with R, -SAS, S-PLUS, BUGS/JAGS and other statistical analysis packages on -GNU/Linux, other Unix-like systems such as macOS, 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. -

- -

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: Top   [Contents][Index]

-
- -

1 Introduction to ESS

- - -

ESS provides a generic interface, through Emacs, to statistical -packages. It currently supports R (and the rest of the S family), SAS, -BUGS/JAGS, Stata, and Julia with the level of support roughly in that -order. -

-

Throughout this manual, Emacs refers to GNU Emacs by the -Free Software Foundation. Although previous versions of ESS supported -other Emacsen, current versions only support GNU Emacs. -

-

There are two main ways of interacting with ESS: through “regular” -modes or “inferior” modes. Regular modes act like normal Emacs major -modes. ESS major mods are displayed in the mode-line in the format -ESS[dialect], where dialect can take values such as -R, SAS, or S. -

-

ESS also provides easy access to an “inferior process,” which is an Emacs buffer associated with a running process. This can be an R session, for example. These inferior processes are referred -to as inferior ESS (iESS), and are shown in the modeline by -iESS [dialect]. -

-

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

- - - - - -

For exclusively interactive users of R, 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 R objects and “hot keys” -are provided for common R 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 R interactively -under ESS. -

- - -

For those that use R in the typical edit–test–revise cycle when -writing R functions, ESS provides for editing of R functions -in Emacs buffers. Unlike the typical use of R 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 R, and a mechanism to jump directly to the -error is provided. ESS also provides for maintaining text versions of -your R 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. -

-

Additionally, both Emacs and ESS (and R) are free software designed to -give users full control over their computer. For more on what this -means, visit https://www.gnu.org/philosophy/free-sw.html. -

- - - - - -
- -
-

-Up: Features   [Contents][Index]

-
- -

1.1.1 Features Overview

-
    -
  • Languages Supported: -
      -
    • S family (R, S, and S+ AKA S-PLUS) -
    • SAS -
    • BUGS/JAGS -
    • Stata -
    • Julia -
    -
  • Editing source code (S family, SAS, BUGS/JAGS, Stata, Julia) -
      -
    • Syntactic indentation and highlighting of source code -
    • Partial evaluation of code -
    • Loading and error-checking of code -
    • Source code revision maintenance -
    • Batch execution (SAS, BUGS/JAGS) -
    • Use of imenu to provide links to appropriate functions -
    -
  • Interacting with the process (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 -
    -
- - -

For source code buffers, ESS offers several features: -

-
    -
  • Support for multiple indentation styles R code 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 R source files. -See Source Files. - -
  • Facilities for evaluating R code such as portions of source -files, or line-by-line evaluation of files (useful for debugging). -See Evaluating code. -
- -

ESS also provides features that make it easier to interact with inferior -ESS (iESS) 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. See Command-line editing. - -
  • Searchable command history for recalling previously-submitted -commands. See Command History. - -
  • Command-line completion of both object and file names for quick -entry. See Completion. - -
  • Hot-keys for quick entry of commonly-used commands in ‘R’ such as -objects(), and search(). See Hot keys. - -
  • Transcript recording for a complete record of all the actions in an -R session. See Transcript. - -
  • Interface to the help system, with a specialized mode for viewing R -help files. See Help. - -
  • 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. -
- -

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

- - -

Bug Fixes in 18.10.2: -

    -
  • ESS[R] Fix namespace evaluation in non-installed packages. -Evaluation is directed into GlobalEnv as originally intended. -
  • Makefile fixes, notably for make install and including -full docs in the tarballs. -
- -

Bug Fixes in 18.10-1: -

    -
  • New functions ess-eval-line-visibly-and-step (C-c C-n and ess-eval-region-or-line-visibly-and-step (C-RET) -which behave as the old versions of ess-eval-line-and-step and ess-eval-region-or-line-and-step. -
- -

Changes and New Features in 18.10: -

    -
  • This is the last release to support Emacs older than 25.1. -Going forward, only GNU Emacs 25.1 and newer will be supported. Soon -after this release, support for older Emacs versions will be dropped -from the git master branch. Note that MELPA uses the git master branch -to produce ESS snapshots, so if you are using Emacs < 25.1 from MELPA -and are unable to upgrade, you should switch to MELPA-stable. - -
  • ESS now displays the language dialect in the mode-line. -So, for example, R buffers will now show ESS[R] rather than ESS[S]. - -
  • The ESS manual has been updated and revised. - -
  • The ESS initialization process has been further streamlined. -If you update the autoloads (which installation from -package-install does), you should not need to (require -'ess-site) at all, as autoloads should automatically load ESS when it -is needed (e.g. the first time an R buffer is opened). In order to -defer loading your ESS config, you may want to do something like -(with-require-after-load "ess" <ess-config-here>) in your Emacs -init file. Users of the popular use-package Emacs package can -now do (use-package ess :defer t) to take advantage of this -behavior. See (ess)Activating and Loading ESS for more -information on this feature. - -
  • ESS now respects Emacs conventions for keybindings. -This means that The C-c [letter] bindings have been -removed. This affects C-c h, which was bound to -ess-eval-line-and-step-invisibly in sas-mode-local-map; -C-c f, which was bound to ess-insert-function-outline in -ess-add-MM-keys; and C-c h, which was bound to -ess-handy-commands in Rd-mode-map, -ess-noweb-minor-mode-map, and ess-help-mode-map - -
  • Functions ess-eval-line-and-step and ess-eval-region-or-line-and-step -now behave consistently with other evaluation function inside a package. - -
  • ESS[R]: ess-r-package-use-dir now works with any mode. -This sets the working directory to the root of the current package -including for example C or C++ files within /src). - -
  • ESS[R]: Long + + prompts in the inferior no longer offset output. - -
  • ESS[R]: New option strip for inferior-ess-replace-long+. -This strips the entire + + sequence. - -
  • ESS modes now inherit from prog-mode. -In the next release, ESS modes will use define-derived-mode so -that each mode will have (for example) its own hooks and keymaps. - -
  • ESS[R]: Supports flymake in R buffers for Emacs 26 and newer. -Users need to install the lintr package to use it. Customizable -options include ess-use-flymake, ess-r-flymake-linters, -and ess-r-flymake-lintr-cache. - -
  • ESS[R]: Gained support for xref in Emacs 25+. -See Xref in The Gnu Emacs Reference Manual - -
  • ESS[R]: The startup screen is cleaner. -It also displays the startup directory with an explicit setwd(). - -
  • ESS[R]: Changing the working directory is now always reflected in the process buffer. - -
  • ESS[R]: Makevars files open with makefile-mode. - -
  • New variable ess-write-to-dribble. -This allows users to disable the dribble (*ESS*) buffer if they wish. - -
  • All of the *-program-name variables have been renamed to *-program. -Users who previously customized e.g. inferior-ess-R-program-name -will need to update their customization to -inferior-ess-R-program. These variables are treated as risky -variables. - -
  • ess-smart-S-assign was renamed to ess-insert-assign. -It provides similar functionality but for any keybinding, not just ‘_‘. -For instance if you bind it to ‘;‘, repeated invokations cycle through -between assignment and inserting ‘;‘. - -
  • C-c C-= is now bound to ess-cycle-assign by default. -See the documentation for details. New user customization option -ess-assign-list controls which assignment operators are cycled. - -
  • ESS[R] In remote sessions, the ESSR package is now fetched from GitHub. - -
  • Commands that send the region to the inferior process now deal with rectangular regions. -See the documentation of ess-eval-region for details. This only -works on Emacs 25.1 and newer. - -
  • ESS[R]: Improvements to interacting with iESS in non-R files. -Interaction with inferior process in non-R files within packages (for -instance C or C++ files) has been improved. This is a work in -progress. - -
  • ESS[R]: Changing the working directory is now always reflected in the process buffer. - -
  • ESS[JAGS]: *.jog and *.jmd files no longer automatically open in JAGS mode. - -
-

Many improvements to fontification: -

-
    -
  • Improved customization for faces. -ESS now provides custom faces for (nearly) all faces used and places -face customization options into their own group. Users can customize -these options using M-x customize-group RET ess-faces. - -
  • Many new keywords were added to ess-R-keywords and ess-R-modifiers. -See the documentation for details. - -
  • ESS[R]: in is now only fontified when inside a for construct. -This avoids spurious fontification, especially in the output buffer -where ‘in‘ is a commond English word. - -
  • ESS: Font-lock keywords are now generated lazily. -That means you can now add or remove keywords from variables like -ess-R-keywords in your Emacs configuration file after loading -ESS (i.e. in the :config section for use-package users). - -
  • ESS[R]: Fontification of roxygen @param keywords now supports comma-separated parameters. - -
  • ESS[R]: Certain keywords are only fontified if followed by a parenthesis. -Function-like keywords such as if () or -stop() are no longer fontified as keyword if not followed by an -opening parenthesis. The same holds for search path modifiers like -library() or require(). - -
  • ESS[R]: Fixed fontification toggling. -Especially certain syntactic elements such as %op% operators -and backquoted function definitions. - -
  • ESS[R]: ess-font-lock-toggle-keyword can be called interactively. -This command asks with completion for a font-lock group to toggle. -This functionality is equivalent to the font-lock menu. - -
- -

Notable bug fixes: -

-
    -
  • prettify-symbols-mode no longer breaks indentation. -This is accomplished by having the pretty symbols occupy the same -number of characters as their non-pretty cousins. You may customize -the new variable ess-r-prettify-symbols to control this -behavior. - -
  • ESS: Inferior process buffers are now always displayed on startup. -Additionally, they don’t hang Emacs on failures. -
- -

Obsolete libraries, functions, and variables: -

-
    -
  • The ess-r-args.el library has been obsoleted and will be removed in the next release. -Use eldoc-mode instead, which is on by default. - -
  • Functions and options dealing with the smart assign key are obsolete. -The following functions have been made obsolete and will be removed in -the next release of ESS: ess-smart-S-assign, -ess-toggle-S-assign, ess-toggle-S-assign-key, -ess-disable-smart-S-assign. - -

    The variable ess-smart-S-assign-key is now deprecated and will -be removed in the next release. If you would like to continue using -‘_‘ for insterting assign in future releases, please bind -ess-insert-assign in ess-mode-map the normal way. -

    -
  • ESS[S]: Variable ess-s-versions-list is obsolete and ignored. -Use ess-s-versions instead. You may pass arguments by starting -the inferior process with the universal argument. - -
- -

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

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

- - -
- -
-

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

-
- -

1.4 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. This section -describes some of the basics of using Emacs. If you are already -familiar with basic Emacs functionality, skip this section. You may -also want to use the Emacs tutorial, accessible via C-h t. -

-

In this manual we use the standard notation used by Emacs 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 key (usually ALT) 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 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. For example, 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 a ‘self-documenting’ text editor. This applies to ESS in two -ways. First, some 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, C-h m pops up a complete list of -keybindings available in each ESS mode and brief description of that -mode. -

-

Emacs is a versatile editor written in both C and a dialect of lisp -known as elisp. ESS is written in elisp and 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

- -

ESS supports GNU Emacs versions 24.3 and newer. -

-

ESS is most likely to work with current/recent versions of the following -statistical packages: R/S-PLUS, SAS, Stata, OpenBUGS and JAGS. -

-

To build the PDF documentation, you will need a version of TeX Live or -texinfo that includes texi2dvi. -

-

There are two main methods used for installing ESS. You may install from -a third-party repository or from source code. Once you install it, you -must also activate or load ESS in each Emacs session, though -installation from a third-party repository likely takes care of that for -you. See Activating and Loading ESS for more details. -

- - - - - - - -
- - - -

2.1 Installing from a third-party repository

- -

ESS is packaged by many third party repositories. Many GNU/Linux -distributions package it, usually with the name “emacs-ess” or -similar. -

-

ESS is also available through Milkypostman’s Emacs Lisp Package Archive -(MELPA), a popular repository for Emacs packages. Instructions on how to -do so are found on MELPA’s website. MELPA -also hosts MELPA-stable with stable ESS builds. You may choose between -MELPA with the latest and greatest features (and bugs) or MELPA-stable, -which may lag a bit behind but should be more stable. -

-

After installing, users should make sure ESS is activated or loaded in -each Emacs session. See Activating and Loading ESS. Depending on -install method, this may be taken care of automatically. -

-
- - - -

2.2 Installing from source

- -

Stable versions of ESS are available at the -ESS web page as a .tgz file or .zip -file. ESS releases are GPG-signed, you should check the signature by -downloading the accompanying .sig file and doing: -

-
-
gpg --verify ess-18.10.tgz.sig
-
- -

Alternatively, you may download the git repository. ESS is currently -hosted on Github: https://github.com/emacs-ess/ESS. git -clone https://github.com/emacs-ess/ESS.git will download it to a new -directory ESS in the current working directory. -

-

We will refer to the location of the ESS source files as -/path/to/ESS/ hereafter. -

-

After installing, users should make sure they activate or load ESS in -each Emacs session, see Activating and Loading ESS -

-

Optionally, compile elisp files, build the documentation, and the -autoloads: -

-
cd /path/to/ESS/
-make
-
-

Without this step the documentation, reference card, and autoloads -will not be available. Uncompiled ESS will also run slower. -

-

Optionally, you may make ESS available to all users of a machine by -installing it site-wide. To do so, run 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. -

-
- - - -

2.3 Activating and Loading ESS

- -

After installing ESS, you must activate or load it each Emacs session. -ESS can be autoloaded, and if you used a third-party repository (such as -your Linux distribution or MELPA) to install, you can likely skip this -section and proceed directly to Check Installation -

-

Otherwise, you may need to add the path to ESS to load-path with: -

-
-
(add-to-list 'load-path "/path/to/ESS/lisp")
-
- -

You then need to decide whether to take advantage of deferred loading -(which will result in a faster Emacs startup time) or require ESS when -Emacs is loaded. To autoload ESS when needed (note that if installed -from source, you must have run make): -

-
-
(load "ess-autoloads")
-
- -

To require ESS on startup, you can either put -

-
-
(require 'ess-site)
-
- -

or -

-
-
(require 'ess-r-mode)
-
- -

In your configuration file, depending on whether you want all ESS -features or only R related features. -

-
- - - -

2.4 Check Installation

-

Restart Emacs and check that ESS was loaded from a correct -location with M-x ess-version. -

- -
- -
-

-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 R from within Emacs. The Emacs -convention is to name such processes running under its control as -‘inferior processes’. Some users find this terminology confusing; you -may prefer to think of these as ‘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 inferior R session on GNU/Linux, macOS, or Windows using the -Cygwin bash shell, simply type M-x R RET. To start an R session on -Windows when you use the MSDOS/powershell shell, simply type M-x -S+6-msdos RET. R will then (by default) ask the question -

- - - - - - - - -
-
R starting data directory?
-
- -

Enter the name of the directory you wish to have as the working -directory (that is, the directory you wish to have getwd() return -if using R). -

-

You will then be popped into a buffer - - -named ‘*R*’ 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 iESS process simultaneously in the -same session. Each process has a name and a number; the initial process - -(process 1) is simply named ‘R’. If you call M-x R again -without killing the first R process, ESS will start a second R process -with the name ‘R:2’. To have the first buffer named ‘R:1’, -customize the option ess-plain-first-buffername. With a prefix -argument, C-u M-x R allows for the specification of command line -options. -

-
-
User Option: ess-plain-first-buffername
-

If non-nil, name the first iESS process [R]. Otherwise, name it [R:1]. -

- - -

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 -processes. This is a good command to consider binding to a global key. -

-
- - - -

3.3 ESS processes on Remote Computers

- -

3.3.1 ESS and TRAMP

- - - - - - -

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 See TRAMP -User Manual. -

-

Start an ssh session using TRAMP 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). When -asked for starting directory, simply type ‘/ssh:user@host: RET’. -The 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 the R graphic device -showing on the current machine -

- -

3.3.2 ESS-remote

-

TRAMP is the recommended way of starting a remote session. The other -way to start a remote ESS connection is 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 -https://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 ‘R’, ‘Splus’, 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 R 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. -

-
- - - -

3.4 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 R actions, 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, ask 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 (for R, you likely want it -to end in ‘.Rout’). 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 inferior -process itself is started. - - -If you need to pass any arguments to this program, they may be specified -in the variable inferior-S_program_name-args. For example, if -inferior-ess-program is "R" then the variable to set is -inferior-R-args. - - -It is not normally necessary to pass arguments to the iESS 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 iESS process to appear in a separate -frame, 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 R interpreter. This is achieved by running the R -process from within an Emacs buffer, called hereafter inferior -buffer, which has an active inferior-ess-mode. The features of -inferior R 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 R objects and a number of ‘hot keys’ for -commonly-used R 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-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 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 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-prompt Moves point to the preceding prompt in the -process buffer. -

-
-
C-c C-n
-
-

comint-next-prompt Moves point to the next prompt 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 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 signaled). Note all 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 (re)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 R session

- -

To keep a record of your R 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 -R 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 R by setting the -variable - -ess-ask-about-transfile to t; See Customizing startup. - -For R files, naming transcript files ‘*.Rout’ puts them in a -special mode (ESS transcript mode — see Transcript Mode) for -editing transcript files which is automatically selected for files with -this suffix. -

- -

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

-

You can use ess-transcript-clean-region to strip output from a -transcript, leaving only source code suitable for inclusion in files -source()-able from R. 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-move-point-for-output 'others)
-      ;; somewhat extreme, almost disabling writing in *R*, *shell* buffers above prompt:
-      (setq comint-scroll-to-bottom-on-input 'this)
-      ))
-
-

to your Emacs configuration file, where the last two settings are -typically desirable for the situation where you work with a script (for -example, 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 a file) in the same directory as the iESS process. -

-

ESS users may work exclusively with script files rather than in a iESS -session, and may not want to save any history files. To do so: -

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

or if you prefer only one global command history file: -

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

in your Emacs configuration 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 R, 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 R 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. In other words, 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). This is 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 R. 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 M-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
-

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 R 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 R -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 R languages (R, S, S-Plus) 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 R 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 R 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 principal -applies. Within your R session, 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 R 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 iESS 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. -Consecutive presses of C-z switch between the script and process buffers. -

-

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 iESS modes 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 -R 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) (in elisp terms, the argument 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 evaluates the current -line without showing the input in the iESS buffer. The default value of -ess-eval-visibly (t) means that ESS calls block Emacs -until they finish. This may be undesirable, especially if commands take -long to finish. Users who want input to be displayed and Emacs not to be -blocked can set ess-eval-visibly to 'nowait. This sends -the input to the iESS buffer but does not wait for the process to -finish, ensuring Emacs is not blocked. -

-

Primary commands for evaluating code are: - - -

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

C-<RET> Sends 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 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 R 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-move-point-for-output to 'others or -t. -

- -
- -
-

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

-
- -

6 Manipulating saved transcript files

- -

Inferior R 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 -.Rout. The most obvious use for a transcript file is as a static -record of the actions you have performed in a particular R 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 .Rout into Emacs, it is placed -in R Transcript Mode. Transcript Mode is similar to inferior R 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 R 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 R 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 R mode, also available in R Transcript Mode. -

- -
- -
-

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

-
- -

7 Editing objects and functions

- - -

ESS provides facilities for editing R objects within your Emacs -session. Most editing is performed on R 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 -R functions. Error-checking is performed when R code is loaded -into the ESS process. -

- - - - - - - - - - -
- -
-

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

-
- -

7.1 Creating or modifying R objects

- - -

To edit an object, type -

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

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

- -

from within the iESS process buffer (*R*). 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 -R source code. Commands are provided to intelligently indent R -code, evaluate portions of R code and to move around R 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 R -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 -R’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 R is to load them in as source file, using R’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 M-l). - - -see Hot keys. -

-

After typing C-c M-l you will prompt for the name of the file to -load into R; 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 R 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 R code

- -

ESS provides a sophisticated mechanism for indenting R source -code. 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 R 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 R (compound) expression which -follows point. Very useful for beautifying your R 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-dwim Call the comment command you want (Do What I Mean). -

-
- - - - - -
- -
-

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

- -
-
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. You can set this in -your Emacs configuration file: -

-
-
(setq ess-default-style 'C++)
-
-
- -
-
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 customization 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 R -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 many 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 R. -

- -
- - - -

7.6 Maintaining R 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 R 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 R dumps an object’s definition to a disk -file the source code on disk corresponds exactly to R’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 R -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 -R’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 (without error) loaded -back into R with C-c C-l, the disk file again corresponds -exactly (well, almost — see below) to R’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 git 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 R object itself. Another useful feature is that you may format the -code in any fashion you please without R 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 ‘.R’. Thus if user joe dumps the -object myfun the dump file will have name joe.myfun.R. -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 R 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 ~/R-source. This could be achieved by including -the following line in your Emacs configuration file: -

-
(setq ess-source-directory (expand-file-name "~/R-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 R working directory during an R 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 R -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 R 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 ESS 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 R help mode. -

-
-
h
-
-

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

-
- -

Paging commands: - -

-
-
DEL
-

scroll-down-command Move one screen backwards through the help file. -

-
-
SPC
-

scroll-up-command Move one screen forwards through the help file. -

-
-
>
-
<
-

end/beginning-of-buffer Move to the end or beginning 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 the exact headings available and capitalization scheme may vary across languages. -

-

You may 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: -

-
-
?
-

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 R 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 R 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 the rest of Emacs. ESS maintains a list of all objects known to R -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 - -

-

For example, consider three functions binomplot(), -binom.test() and binomial(). Typing bin TAB 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 R functions such as get() or scan() -which require fully expanded file names. -

-

In the iESS 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 R; 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

- - - -

ESS uses IDO mechanism (part of default -Emacs) for minibuffer completion if the ido 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)
-
- -
- -
-

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

-
- -

9.5 Company

- -

Another popular package for completion is company, short for complete -anything. ESS provides support for company out-of-the-box. To disable -company support, set ess-use-company to nil. You can set -it to 'script-only to only activate company in R scripts. -

-
- -
-

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

-
- -

9.6 Icicles

- -

Another option for comprehensively handling completion in Emacs is via -Icicles (https://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): -

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

Icicles can be toggled 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. -

-

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

-

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")
-
-
- -
-

-Up: ESS tracebug   [Contents][Index]

-
- -

10.1.1 Getting started with tracebug

- - - -

Consider a buffer with the following function: -

-
test <- function(x){
-  mean(x),
-}
-
-

Evaluating the function (e.g. C-c C-c) results in an error -about an unexpected comma. You can use next-error (bound by -default to C-x `, M-g n, and M-g M-n) to jump to -the place where the error occurred. Alternatively, use the mouse to -click on the error to jump to where it occurred. -

-

Correct the error by deleting the comma. Now put point on mean -and set the breakpoint using C-c C-t b (ess-bp-set) and -reevaluate the function. Jump to the inferior buffer (possibly using -C-c C-z) and evaluate test(1:10). An interactive debug -process starts, stopping at the breakpoint we just specified. Here you -can debug your function (what is x at this point?). Use -M-N to continue. -

-

Let’s replace our test function with one slightly more complicated: -

-
test <- function(x){
-  x <- x + 1
-  y <- mean(x)
-  x <- ifelse(x > 5, x, x - 100)
-  list(x, y)
-}
-
-

Try setting multiple breakpoints. You can unset a breakpoint by killing -it with C-c C-t k. You can set conditional breakpoints too. Try -setting one by placing point on the line x <- x + 1 and doing -C-c C-t B. ESS will ask for the condition. Let’s set it to -!is.numeric(x). After re-evaluating test, try calling -test(1:100) and test('foo'). -

-

You can remove all breakpoints with C-c C-t K. -

-

You can flag a function for debugging (similar to calling -debug(test) at R’s prompt) by doing C-c C-t d. Try this -yourself by putting point over test and doing C-c C-t d. -

-

If an error occurs, you can get the complete call stack by doing -C-c ` or C-c C-t ` (ess-show-traceback). -

-

Tracebug also offers a watch window where you can watch values of -objects. Open it with C-c C-t w (ess-watch). Initially you -aren’t watching anything. Add something with a (e.g. a -test). The watch window displays what the object is at any given time -and automatically updates. Quit the watch window with q. -

-
- - - -

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. For example, -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 -https://cran.r-project.org/doc/manuals/R-ints.html#Namespaces. -

-

Occasionally 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. 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 Flymake

- -

The minor mode flymake-mode provides on-the-fly syntax -checking. ESS provides support for flymake in R-mode in Emacs versions -26 and newer. It is enabled by default, to disable it you may set -ess-use-flymake to nil. In order to use it, you may need -to install the lintr R package, available from CRAN. -

-
-
User Option: ess-use-flymake
-

When non-nil, use flymake. If 'process, only use flymake when the -buffer has an inferior process running. -

- -
-
User Option: ess-r-flymake-linters
-

This variable describes the linters to use. It can either be a string -with an R expression to be used as-is or a list of strings where each -element is passed to lintr::with_defaults. See the help page -for lintr::default_linters for information on available linters -and their defaults. -

- -
-
User Option: ess-r-flymake-lintr-cache
-

When t (the default), lintr uses a cache. Change to nil -to disable lintr’s caching mechanism. -

- -
- -
-

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

-
- -

11.3 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.4 Syntactic highlighting of buffers

- -

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

-

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.5 Parenthesis matching

- -

Emacs has 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. You may activate it putting -this in your Emacs configuration file: -

-
-
(show-paren-mode)
-
- - -
- -
-

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

-
- -

11.6 Using graphics with ESS

- - -

One of the main features of R is its ability to generate high-resolution -graphics plots. When using R in a windowing environment, no additional -configuration is necessary; plots will be shown in a new (non-Emacs) -window. -

-

If not using a windowing environment or S, ESS provides a number of -features for dealing with such plots. -

- - - - - - -
- -
-

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

-
- -

11.6.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.6.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.6.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.7 Imenu

- -

Imenu is an Emacs tool for providing mode-specific buffer indexes. In -some of the ESS editing modes (currently SAS and R), support for Imenu -is provided. For example, in R mode buffers, the menubar should display -an item called "Imenu-R". 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, for example 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.8 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.9 Xref

- - -

Xref is an Emacs interface that supports finding “identifiers,” -usually function definitions in ESS’s view. ESS ships with support for -Xref in Emacs versions 25.1 and higher. See Xref in The Gnu -Emacs Reference Manual for how to use this feature. -

-
- -
-

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

-
- -

11.10 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.11 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 configuration file. 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.12 Interaction with Org mode

- -

Org-mode (https://orgmode.org) now supports reproducible research -and literate programming in many languages (including R) – see chapter -14 of the Org manual -(https://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.13 Support for Sweave in ESS and AUCTeX

- -

ESS provides support for writing and processing Sweave -(https://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 (https://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[R]–Editing files

- -

ESS[R] mode should be automatically turned on when visiting a file -ending with an R or S suffix (*.R, *.S, *.s, etc), which enables the -features discussed previously. 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[R]–Inferior ESS processes

- -

To start up iESS mode for R, use: -

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

(for R, S-PLUS 3.x, S4, S+5, S+6 or or S+7, respectively. This assumes that -you have access to each). -

- -

In the case that you wish to pass command line arguments to the starting -R process, call it with the universal prefix. To set command line -arguments that apply to all future iESS sessions, set the variable -inferior-R-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. -

-

If you have other versions of R or S available on the system, ESS -is also able to start those versions. How this exactly works depend on -which OS you are using (details below). 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 GNU/Linux systems and other Unix-like systems (macOS): 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”, -“R-2”, “R-3”, “R-devel”, or “R-patched”. 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-r-versions or -ess-s-versions-list, you should put them in your Emacs -configuration file 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 Philosophies for using ESS[R]

- -

There are two philosophies for using ESS. Most modern best practices -prefer the first. ESS is configured for the first, and this is what the -manual focuses on. -

-

1: The source code is real. 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: R 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 configuration file: -

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

12.4 Example ESS usage

- -

We present some basic examples for using ESS to interact with R -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
-    ## Load the file you want to work with
-    C-x C-f myfile.R
-
-    ## Edit as appropriate, then start and switch to an R buffer
-    C-c C-z
-
-    ## A new buffer *R* will appear. R will have been started
-    ## in this buffer.  The buffer is in iESS [R] mode.
-
-    ## Return to the script (prefix with C-c if you have pressed other keys)
-    C-z
-
-    ## Send regions, lines, or the entire file contents to R.  For regions,
-    ## highlight a region with keystrokes or mouse and then send with:
-    C-c C-r
-
-    ## Re-edit myfile.R as necessary to correct any difficulties.  Add
-    ## new commands here.  Send them to R by region with C-c C-r, or
-    ## one line at a time with C-c C-n.
-
-    ## Save the revised myfile.R with C-x C-s.
-
-    ## Save the entire *R* interaction buffer with C-c C-s.  You
-    ## will be prompted for a file name.  The recommended name is
-    ## myfile.Rout.  With this 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 R in a process buffer (this will be *R*)
-    M-x R
-
-    ## Load the file you want to work with
-    C-x C-f myfile.R
-
-    ## edit program, functions, and code in myfile.R, and send revised
-    ## functions to R 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 M-l
-
-    ## save the revised myfile.R when you have finished
-    C-c C-s
-
-
- - -
- -
-

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

- -

Files ending in .bmd are used for BUGS 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

- -

The .bog extension is used for BUGS log files. The command line -generated by ESS creates the .bog transcript file. -

- -
- -
-

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

-
- -

15 ESS for JAGS

- -

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

- -

Files with the .jag extension are edited in ESS[JAGS] mode. -Three keys are bound for your use in ESS[JAGS], 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, <-. -

-

The first press of C-c C-c will set up a template, including some -necessary file-local variables in an empty buffer. These variables are -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

- -

Files ending in .jmd are 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, or post them on our -github issue tracker -

-

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 view-emacs-faq) -and EmacsWiki (https://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 configuration 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-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-l: Hot keys
C-c M-r: Evaluating code
C-c RET: Resubmit
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-RET: Evaluating code

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 -   -G -   -I -   -M -   -N -   -O -   -P -   -Q -   -R -   -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: Command History
comint-next-matching-input-from-input: Command History
comint-next-prompt: Process buffer motion
comint-previous-input: Command History
comint-previous-matching-input-from-input: Command History
comint-previous-prompt: Process buffer motion
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

G
getting started with tracebug: Getting started with tracebug

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

R
R: Starting up

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 -   -G -   -I -   -M -   -N -   -O -   -P -   -Q -   -R -   -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-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-plain-first-buffername: Multiple ESS processes
ess-r-flymake-linters: ESS Flymake
ess-r-flymake-lintr-cache: ESS Flymake
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
ess-use-flymake: ESS Flymake

I
iESS program arguments: Customizing startup
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

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

B
bug reports: Reporting Bugs
bugs: Bugs

C
changing ESS processes: Multiple ESS processes
cleaning up: Hot keys
comint: Credits
command history: Command History
command line arguments: iESS(R)--Inferior ESS processes
command-line completion: Object names
command-line editing: Command-line editing
commands: Entering commands
comments: Source Files
comments in R: Indenting
company: Company
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 commands blocking Emacs: Evaluating code
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 R expressions: Evaluating code
evaluating S expressions: Evaluating code

F
finding function definitions: Xref
flymake: ESS Flymake
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 R: Introduction
interactive use of S: Introduction
interrupting R commands: Other
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
multiple inferior processes: Multiple ESS processes
multiple interactive 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 R: Introduction
programming in S: Introduction
project work in R: Source Files
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 R: Starting up
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
temporary buffers: Help
temporary buffers, killing: Hot keys
tracebug tutorial: Getting started with tracebug
tramp support: ESS processes on Remote Computers
transcript: Transcript
transcript file: Customizing startup
transcript file names: Saving transcripts
transcript mode motion: Transcript Mode
transcripts of R sessions: Introduction
transcripts of S sessions: Introduction

U
using ESS interactively: Introduction
using R interactively: Introduction
using S interactively: Introduction

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

X
X Windows: X11
xref: Xref

-
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-18.10.2/doc/html/news.html ess-18.10.2+git20220915.f45542e/doc/html/news.html --- ess-18.10.2/doc/html/news.html 2018-11-10 09:41:27.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/doc/html/news.html 1970-01-01 00:00:00.000000000 +0000 @@ -1,2260 +0,0 @@ - - - - - -ESS – Emacs Speaks Statistics - - - - - - - - - - - - -

ESS – Emacs Speaks Statistics

- - - - - - - - - - - - - - - -

Bug Fixes in 18.10.2: -

    -
  • ESS[R] Fix namespace evaluation in non-installed packages. -Evaluation is directed into GlobalEnv as originally intended. -
  • Makefile fixes, notably for make install and including -full docs in the tarballs. -
- -

Bug Fixes in 18.10-1: -

    -
  • New functions ess-eval-line-visibly-and-step (C-c C-n and ess-eval-region-or-line-visibly-and-step (C-RET) -which behave as the old versions of ess-eval-line-and-step and ess-eval-region-or-line-and-step. -
- -

Changes and New Features in 18.10: -

    -
  • This is the last release to support Emacs older than 25.1. -Going forward, only GNU Emacs 25.1 and newer will be supported. Soon -after this release, support for older Emacs versions will be dropped -from the git master branch. Note that MELPA uses the git master branch -to produce ESS snapshots, so if you are using Emacs < 25.1 from MELPA -and are unable to upgrade, you should switch to MELPA-stable. - -
  • ESS now displays the language dialect in the mode-line. -So, for example, R buffers will now show ESS[R] rather than ESS[S]. - -
  • The ESS manual has been updated and revised. - -
  • The ESS initialization process has been further streamlined. -If you update the autoloads (which installation from -package-install does), you should not need to (require -'ess-site) at all, as autoloads should automatically load ESS when it -is needed (e.g. the first time an R buffer is opened). In order to -defer loading your ESS config, you may want to do something like -(with-require-after-load "ess" <ess-config-here>) in your Emacs -init file. Users of the popular use-package Emacs package can -now do (use-package ess :defer t) to take advantage of this -behavior. See (ess)Activating and Loading ESS for more -information on this feature. - -
  • ESS now respects Emacs conventions for keybindings. -This means that The C-c [letter] bindings have been -removed. This affects C-c h, which was bound to -ess-eval-line-and-step-invisibly in sas-mode-local-map; -C-c f, which was bound to ess-insert-function-outline in -ess-add-MM-keys; and C-c h, which was bound to -ess-handy-commands in Rd-mode-map, -ess-noweb-minor-mode-map, and ess-help-mode-map - -
  • Functions ess-eval-line-and-step and ess-eval-region-or-line-and-step -now behave consistently with other evaluation function inside a package. - -
  • ESS[R]: ess-r-package-use-dir now works with any mode. -This sets the working directory to the root of the current package -including for example C or C++ files within /src). - -
  • ESS[R]: Long + + prompts in the inferior no longer offset output. - -
  • ESS[R]: New option strip for inferior-ess-replace-long+. -This strips the entire + + sequence. - -
  • ESS modes now inherit from prog-mode. -In the next release, ESS modes will use define-derived-mode so -that each mode will have (for example) its own hooks and keymaps. - -
  • ESS[R]: Supports flymake in R buffers for Emacs 26 and newer. -Users need to install the lintr package to use it. Customizable -options include ess-use-flymake, ess-r-flymake-linters, -and ess-r-flymake-lintr-cache. - -
  • ESS[R]: Gained support for xref in Emacs 25+. -See Xref in The Gnu Emacs Reference Manual - -
  • ESS[R]: The startup screen is cleaner. -It also displays the startup directory with an explicit setwd(). - -
  • ESS[R]: Changing the working directory is now always reflected in the process buffer. - -
  • ESS[R]: Makevars files open with makefile-mode. - -
  • New variable ess-write-to-dribble. -This allows users to disable the dribble (*ESS*) buffer if they wish. - -
  • All of the *-program-name variables have been renamed to *-program. -Users who previously customized e.g. inferior-ess-R-program-name -will need to update their customization to -inferior-ess-R-program. These variables are treated as risky -variables. - -
  • ess-smart-S-assign was renamed to ess-insert-assign. -It provides similar functionality but for any keybinding, not just ‘_‘. -For instance if you bind it to ‘;‘, repeated invokations cycle through -between assignment and inserting ‘;‘. - -
  • C-c C-= is now bound to ess-cycle-assign by default. -See the documentation for details. New user customization option -ess-assign-list controls which assignment operators are cycled. - -
  • ESS[R] In remote sessions, the ESSR package is now fetched from GitHub. - -
  • Commands that send the region to the inferior process now deal with rectangular regions. -See the documentation of ess-eval-region for details. This only -works on Emacs 25.1 and newer. - -
  • ESS[R]: Improvements to interacting with iESS in non-R files. -Interaction with inferior process in non-R files within packages (for -instance C or C++ files) has been improved. This is a work in -progress. - -
  • ESS[R]: Changing the working directory is now always reflected in the process buffer. - -
  • ESS[JAGS]: *.jog and *.jmd files no longer automatically open in JAGS mode. - -
-

Many improvements to fontification: -

-
    -
  • Improved customization for faces. -ESS now provides custom faces for (nearly) all faces used and places -face customization options into their own group. Users can customize -these options using M-x customize-group RET ess-faces. - -
  • Many new keywords were added to ess-R-keywords and ess-R-modifiers. -See the documentation for details. - -
  • ESS[R]: in is now only fontified when inside a for construct. -This avoids spurious fontification, especially in the output buffer -where ‘in‘ is a commond English word. - -
  • ESS: Font-lock keywords are now generated lazily. -That means you can now add or remove keywords from variables like -ess-R-keywords in your Emacs configuration file after loading -ESS (i.e. in the :config section for use-package users). - -
  • ESS[R]: Fontification of roxygen @param keywords now supports comma-separated parameters. - -
  • ESS[R]: Certain keywords are only fontified if followed by a parenthesis. -Function-like keywords such as if () or -stop() are no longer fontified as keyword if not followed by an -opening parenthesis. The same holds for search path modifiers like -library() or require(). - -
  • ESS[R]: Fixed fontification toggling. -Especially certain syntactic elements such as %op% operators -and backquoted function definitions. - -
  • ESS[R]: ess-font-lock-toggle-keyword can be called interactively. -This command asks with completion for a font-lock group to toggle. -This functionality is equivalent to the font-lock menu. - -
- -

Notable bug fixes: -

-
    -
  • prettify-symbols-mode no longer breaks indentation. -This is accomplished by having the pretty symbols occupy the same -number of characters as their non-pretty cousins. You may customize -the new variable ess-r-prettify-symbols to control this -behavior. - -
  • ESS: Inferior process buffers are now always displayed on startup. -Additionally, they don’t hang Emacs on failures. -
- -

Obsolete libraries, functions, and variables: -

-
    -
  • The ess-r-args.el library has been obsoleted and will be removed in the next release. -Use eldoc-mode instead, which is on by default. - -
  • Functions and options dealing with the smart assign key are obsolete. -The following functions have been made obsolete and will be removed in -the next release of ESS: ess-smart-S-assign, -ess-toggle-S-assign, ess-toggle-S-assign-key, -ess-disable-smart-S-assign. - -

    The variable ess-smart-S-assign-key is now deprecated and will -be removed in the next release. If you would like to continue using -‘_‘ for insterting assign in future releases, please bind -ess-insert-assign in ess-mode-map the normal way. -

    -
  • ESS[S]: Variable ess-s-versions-list is obsolete and ignored. -Use ess-s-versions instead. You may pass arguments by starting -the inferior process with the universal argument. - -
- -

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; https://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-18.10.2/doc/html/readme.html ess-18.10.2+git20220915.f45542e/doc/html/readme.html --- ess-18.10.2/doc/html/readme.html 2018-11-10 09:41:26.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/doc/html/readme.html 1970-01-01 00:00:00.000000000 +0000 @@ -1,1010 +0,0 @@ - - - - - -ESS - Emacs Speaks Statistics - - - - - - - - - - - - - -

ESS - Emacs Speaks Statistics

- - - - - - - - - - - - - - - - -
-

-  

-
- -

1 General Information: README

- - -

This is the README file for the distribution of ESS version -18.10.2 -

-

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

- - - - - - - - - - - - -
- - - -

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 Installation

-

ESS supports GNU Emacs versions 24.3 and newer. -

-

ESS is most likely to work with current/recent versions of the following -statistical packages: R/S-PLUS, SAS, Stata, OpenBUGS and JAGS. -

-

To build the PDF documentation, you will need a version of TeX Live or -texinfo that includes texi2dvi. -

-

There are two main methods used for installing ESS. You may install from -a third-party repository or from source code. Once you install it, you -must also activate or load ESS in each Emacs session, though -installation from a third-party repository likely takes care of that for -you. See Activating and Loading ESS for more details. -

- - - - - - - -
- -
-

-Next:  

-
- -

1.3 Installing from a third-party repository

- -

ESS is packaged by many third party repositories. Many GNU/Linux -distributions package it, usually with the name “emacs-ess” or -similar. -

-

ESS is also available through Milkypostman’s Emacs Lisp Package Archive -(MELPA), a popular repository for Emacs packages. Instructions on how to -do so are found on MELPA’s website. MELPA -also hosts MELPA-stable with stable ESS builds. You may choose between -MELPA with the latest and greatest features (and bugs) or MELPA-stable, -which may lag a bit behind but should be more stable. -

-

After installing, users should make sure ESS is activated or loaded in -each Emacs session. See Activating and Loading ESS. Depending on -install method, this may be taken care of automatically. -

-
- - - -

1.4 Installing from source

- -

Stable versions of ESS are available at the -ESS web page as a .tgz file or .zip -file. ESS releases are GPG-signed, you should check the signature by -downloading the accompanying .sig file and doing: -

-
-
gpg --verify ess-18.10.tgz.sig
-
- -

Alternatively, you may download the git repository. ESS is currently -hosted on Github: https://github.com/emacs-ess/ESS. git -clone https://github.com/emacs-ess/ESS.git will download it to a new -directory ESS in the current working directory. -

-

We will refer to the location of the ESS source files as -/path/to/ESS/ hereafter. -

-

After installing, users should make sure they activate or load ESS in -each Emacs session, see Activating and Loading ESS -

-

Optionally, compile elisp files, build the documentation, and the -autoloads: -

-
cd /path/to/ESS/
-make
-
-

Without this step the documentation, reference card, and autoloads -will not be available. Uncompiled ESS will also run slower. -

-

Optionally, you may make ESS available to all users of a machine by -installing it site-wide. To do so, run 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. -

-
- -
-

-Next: , Previous:  

-
- -

1.5 Activating and Loading ESS

- -

After installing ESS, you must activate or load it each Emacs session. -ESS can be autoloaded, and if you used a third-party repository (such as -your Linux distribution or MELPA) to install, you can likely skip this -section and proceed directly to Check Installation -

-

Otherwise, you may need to add the path to ESS to load-path with: -

-
-
(add-to-list 'load-path "/path/to/ESS/lisp")
-
- -

You then need to decide whether to take advantage of deferred loading -(which will result in a faster Emacs startup time) or require ESS when -Emacs is loaded. To autoload ESS when needed (note that if installed -from source, you must have run make): -

-
-
(load "ess-autoloads")
-
- -

To require ESS on startup, you can either put -

-
-
(require 'ess-site)
-
- -

or -

-
-
(require 'ess-r-mode)
-
- -

In your configuration file, depending on whether you want all ESS -features or only R related features. -

-
- -
-

-Previous:  

-
- -

1.6 Check Installation

-

Restart Emacs and check that ESS was loaded from a correct -location with M-x ess-version. -

- -
- -
-

-Next: , Previous: , Up: General Information  

-
- -

1.7 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.8 Current Features

- -
    -
  • Languages Supported: -
      -
    • S family (R, S, and S+ AKA S-PLUS) -
    • SAS -
    • BUGS/JAGS -
    • Stata -
    • Julia -
    -
  • Editing source code (S family, SAS, BUGS/JAGS, Stata, Julia) -
      -
    • Syntactic indentation and highlighting of source code -
    • Partial evaluation of code -
    • Loading and error-checking of code -
    • Source code revision maintenance -
    • Batch execution (SAS, BUGS/JAGS) -
    • Use of imenu to provide links to appropriate functions -
    -
  • Interacting with the process (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.9 New Features

- - -

Bug Fixes in 18.10.2: -

    -
  • ESS[R] Fix namespace evaluation in non-installed packages. -Evaluation is directed into GlobalEnv as originally intended. -
  • Makefile fixes, notably for make install and including -full docs in the tarballs. -
- -

Bug Fixes in 18.10-1: -

    -
  • New functions ess-eval-line-visibly-and-step (C-c C-n and ess-eval-region-or-line-visibly-and-step (C-RET) -which behave as the old versions of ess-eval-line-and-step and ess-eval-region-or-line-and-step. -
- -

Changes and New Features in 18.10: -

    -
  • This is the last release to support Emacs older than 25.1. -Going forward, only GNU Emacs 25.1 and newer will be supported. Soon -after this release, support for older Emacs versions will be dropped -from the git master branch. Note that MELPA uses the git master branch -to produce ESS snapshots, so if you are using Emacs < 25.1 from MELPA -and are unable to upgrade, you should switch to MELPA-stable. - -
  • ESS now displays the language dialect in the mode-line. -So, for example, R buffers will now show ESS[R] rather than ESS[S]. - -
  • The ESS manual has been updated and revised. - -
  • The ESS initialization process has been further streamlined. -If you update the autoloads (which installation from -package-install does), you should not need to (require -'ess-site) at all, as autoloads should automatically load ESS when it -is needed (e.g. the first time an R buffer is opened). In order to -defer loading your ESS config, you may want to do something like -(with-require-after-load "ess" <ess-config-here>) in your Emacs -init file. Users of the popular use-package Emacs package can -now do (use-package ess :defer t) to take advantage of this -behavior. See (ess)Activating and Loading ESS for more -information on this feature. - -
  • ESS now respects Emacs conventions for keybindings. -This means that The C-c [letter] bindings have been -removed. This affects C-c h, which was bound to -ess-eval-line-and-step-invisibly in sas-mode-local-map; -C-c f, which was bound to ess-insert-function-outline in -ess-add-MM-keys; and C-c h, which was bound to -ess-handy-commands in Rd-mode-map, -ess-noweb-minor-mode-map, and ess-help-mode-map - -
  • Functions ess-eval-line-and-step and ess-eval-region-or-line-and-step -now behave consistently with other evaluation function inside a package. - -
  • ESS[R]: ess-r-package-use-dir now works with any mode. -This sets the working directory to the root of the current package -including for example C or C++ files within /src). - -
  • ESS[R]: Long + + prompts in the inferior no longer offset output. - -
  • ESS[R]: New option strip for inferior-ess-replace-long+. -This strips the entire + + sequence. - -
  • ESS modes now inherit from prog-mode. -In the next release, ESS modes will use define-derived-mode so -that each mode will have (for example) its own hooks and keymaps. - -
  • ESS[R]: Supports flymake in R buffers for Emacs 26 and newer. -Users need to install the lintr package to use it. Customizable -options include ess-use-flymake, ess-r-flymake-linters, -and ess-r-flymake-lintr-cache. - -
  • ESS[R]: Gained support for xref in Emacs 25+. -See Xref in The Gnu Emacs Reference Manual - -
  • ESS[R]: The startup screen is cleaner. -It also displays the startup directory with an explicit setwd(). - -
  • ESS[R]: Changing the working directory is now always reflected in the process buffer. - -
  • ESS[R]: Makevars files open with makefile-mode. - -
  • New variable ess-write-to-dribble. -This allows users to disable the dribble (*ESS*) buffer if they wish. - -
  • All of the *-program-name variables have been renamed to *-program. -Users who previously customized e.g. inferior-ess-R-program-name -will need to update their customization to -inferior-ess-R-program. These variables are treated as risky -variables. - -
  • ess-smart-S-assign was renamed to ess-insert-assign. -It provides similar functionality but for any keybinding, not just ‘_‘. -For instance if you bind it to ‘;‘, repeated invokations cycle through -between assignment and inserting ‘;‘. - -
  • C-c C-= is now bound to ess-cycle-assign by default. -See the documentation for details. New user customization option -ess-assign-list controls which assignment operators are cycled. - -
  • ESS[R] In remote sessions, the ESSR package is now fetched from GitHub. - -
  • Commands that send the region to the inferior process now deal with rectangular regions. -See the documentation of ess-eval-region for details. This only -works on Emacs 25.1 and newer. - -
  • ESS[R]: Improvements to interacting with iESS in non-R files. -Interaction with inferior process in non-R files within packages (for -instance C or C++ files) has been improved. This is a work in -progress. - -
  • ESS[R]: Changing the working directory is now always reflected in the process buffer. - -
  • ESS[JAGS]: *.jog and *.jmd files no longer automatically open in JAGS mode. - -
-

Many improvements to fontification: -

-
    -
  • Improved customization for faces. -ESS now provides custom faces for (nearly) all faces used and places -face customization options into their own group. Users can customize -these options using M-x customize-group RET ess-faces. - -
  • Many new keywords were added to ess-R-keywords and ess-R-modifiers. -See the documentation for details. - -
  • ESS[R]: in is now only fontified when inside a for construct. -This avoids spurious fontification, especially in the output buffer -where ‘in‘ is a commond English word. - -
  • ESS: Font-lock keywords are now generated lazily. -That means you can now add or remove keywords from variables like -ess-R-keywords in your Emacs configuration file after loading -ESS (i.e. in the :config section for use-package users). - -
  • ESS[R]: Fontification of roxygen @param keywords now supports comma-separated parameters. - -
  • ESS[R]: Certain keywords are only fontified if followed by a parenthesis. -Function-like keywords such as if () or -stop() are no longer fontified as keyword if not followed by an -opening parenthesis. The same holds for search path modifiers like -library() or require(). - -
  • ESS[R]: Fixed fontification toggling. -Especially certain syntactic elements such as %op% operators -and backquoted function definitions. - -
  • ESS[R]: ess-font-lock-toggle-keyword can be called interactively. -This command asks with completion for a font-lock group to toggle. -This functionality is equivalent to the font-lock menu. - -
- -

Notable bug fixes: -

-
    -
  • prettify-symbols-mode no longer breaks indentation. -This is accomplished by having the pretty symbols occupy the same -number of characters as their non-pretty cousins. You may customize -the new variable ess-r-prettify-symbols to control this -behavior. - -
  • ESS: Inferior process buffers are now always displayed on startup. -Additionally, they don’t hang Emacs on failures. -
- -

Obsolete libraries, functions, and variables: -

-
    -
  • The ess-r-args.el library has been obsoleted and will be removed in the next release. -Use eldoc-mode instead, which is on by default. - -
  • Functions and options dealing with the smart assign key are obsolete. -The following functions have been made obsolete and will be removed in -the next release of ESS: ess-smart-S-assign, -ess-toggle-S-assign, ess-toggle-S-assign-key, -ess-disable-smart-S-assign. - -

    The variable ess-smart-S-assign-key is now deprecated and will -be removed in the next release. If you would like to continue using -‘_‘ for insterting assign in future releases, please bind -ess-insert-assign in ess-mode-map the normal way. -

    -
  • ESS[S]: Variable ess-s-versions-list is obsolete and ignored. -Use ess-s-versions instead. You may pass arguments by starting -the inferior process with the universal argument. - -
- -

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

-Next: , Previous: , Up: General Information  

-
- -

1.10 Reporting Bugs

- -

Please send bug reports, suggestions etc. to -ESS-bugs@r-project.org, or post them on our -github issue tracker -

-

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.11 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.12 Authors

- - - -
- - - - - diff -Nru ess-18.10.2/doc/info/ess.info ess-18.10.2+git20220915.f45542e/doc/info/ess.info --- ess-18.10.2/doc/info/ess.info 2018-11-10 09:41:14.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/doc/info/ess.info 1970-01-01 00:00:00.000000000 +0000 @@ -1,4904 +0,0 @@ -This is ess.info, produced by makeinfo version 6.5 from ess.texi. - -INFO-DIR-SECTION Emacs -START-INFO-DIR-ENTRY -* ESS: (ess). Emacs Speaks Statistics (R/S/S+, 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 18.10.2 - - by A.J. Rossini, - R.M. Heiberger, - K. Hornik, - M. Maechler, - R.A. Sparapani, - S.J. Eglen, - S.P. Luque, - H. Redestig, - V. Spinu, - L. Henry, - and J.A. Branham. - - Emacs Speaks Statistics (ESS) provides an intelligent, consistent - interface between the user and the software. ESS interfaces with - R, SAS, S-PLUS, BUGS/JAGS and other statistical analysis packages - on GNU/Linux, other Unix-like systems such as macOS, 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. - - 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. - -* 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 R:: 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 -********************* - -ESS provides a generic interface, through Emacs, to statistical -packages. It currently supports R (and the rest of the S family), SAS, -BUGS/JAGS, Stata, and Julia with the level of support roughly in that -order. - - Throughout this manual, _Emacs_ refers to _GNU Emacs_ by the Free -Software Foundation. Although previous versions of ESS supported other -Emacsen, current versions only support GNU Emacs. - - There are two main ways of interacting with ESS: through "regular" -modes or "inferior" modes. Regular modes act like normal Emacs major -modes. ESS major mods are displayed in the mode-line in the format -'ESS[dialect]', where 'dialect' can take values such as 'R', 'SAS', or -'S'. - - ESS also provides easy access to an "inferior process," which is an -Emacs buffer associated with a running process. This can be an R -session, for example. These inferior processes are referred to as -inferior ESS ('iESS'), and are shown in the modeline by 'iESS -[dialect]'. - - Currently, the documentation contains many references to ''R'' where -actually any supported (statistics) language is meant, i.e., 'R' could -also mean 'S' or 'SAS.' - - For exclusively interactive users of R, 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 R objects and "hot keys" are -provided for common R 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 R interactively -under ESS. - - For those that use R in the typical edit-test-revise cycle when -writing R functions, ESS provides for editing of R functions in Emacs -buffers. Unlike the typical use of R 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 R, and a mechanism to jump directly to the error is provided. ESS -also provides for maintaining text versions of your R functions in -specified source directories. - -* Menu: - -* Features:: Why should I use ESS? -* New features:: -* Credits:: Authors of and contributors to 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. - - Additionally, both Emacs and ESS (and R) are free software designed -to give users full control over their computer. For more on what this -means, visit . - -* Menu: - -* Current Features:: - - -File: ess.info, Node: Current Features, Up: Features - -1.1.1 Features Overview ------------------------ - - * Languages Supported: - * S family (R, S, and S+ AKA S-PLUS) - * SAS - * BUGS/JAGS - * Stata - * Julia - * Editing source code (S family, SAS, BUGS/JAGS, Stata, Julia) - * Syntactic indentation and highlighting of source code - * Partial evaluation of code - * Loading and error-checking of code - * Source code revision maintenance - * Batch execution (SAS, BUGS/JAGS) - * Use of imenu to provide links to appropriate functions - * Interacting with the process (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 - - For source code buffers, ESS offers several features: - - * Support for multiple indentation styles R code *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 R source files. *Note Source Files::. - - * Facilities for evaluating R code such as portions of source files, - or line-by-line evaluation of files (useful for debugging). *Note - Evaluating code::. - - ESS also provides features that make it easier to interact with -inferior ESS (iESS) 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. *Note Command-line editing::. - - * Searchable command history for recalling previously-submitted - commands. *Note Command History::. - - * Command-line completion of both object and file names for quick - entry. *Note Completion::. - - * Hot-keys for quick entry of commonly-used commands in 'R' such as - 'objects()', and 'search()'. *Note Hot keys::. - - * Transcript recording for a complete record of all the actions in an - R session. *Note Transcript::. - - * Interface to the help system, with a specialized mode for viewing R - help files. *Note Help::. - - * 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::. - - 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 -======================= - -Bug Fixes in 18.10.2: - * ESS[R] Fix namespace evaluation in non-installed packages. - Evaluation is directed into GlobalEnv as originally intended. - * 'Makefile' fixes, notably for 'make install' and including full - docs in the tarballs. - - Bug Fixes in 18.10-1: - * New functions 'ess-eval-line-visibly-and-step' ('C-c C-n' and - 'ess-eval-region-or-line-visibly-and-step' ('C-RET') which behave - as the old versions of 'ess-eval-line-and-step' and - 'ess-eval-region-or-line-and-step'. - - Changes and New Features in 18.10: - - * This is the last release to support Emacs older than 25.1. Going - forward, only GNU Emacs 25.1 and newer will be supported. Soon - after this release, support for older Emacs versions will be - dropped from the git master branch. Note that MELPA uses the git - master branch to produce ESS snapshots, so if you are using Emacs < - 25.1 from MELPA and are unable to upgrade, you should switch to - MELPA-stable. - - * ESS now displays the language dialect in the mode-line. So, for - example, R buffers will now show ESS[R] rather than ESS[S]. - - * The ESS manual has been updated and revised. - - * The ESS initialization process has been further streamlined. If - you update the autoloads (which installation from 'package-install' - does), you should not need to '(require 'ess-site)' at all, as - autoloads should automatically load ESS when it is needed (e.g. - the first time an R buffer is opened). In order to defer loading - your ESS config, you may want to do something like - '(with-require-after-load "ess" )' in your Emacs - init file. Users of the popular 'use-package' Emacs package can - now do '(use-package ess :defer t)' to take advantage of this - behavior. *Note (ess)Activating and Loading ESS:: for more - information on this feature. - - * ESS now respects Emacs conventions for keybindings. This means - that The 'C-c [letter]' bindings have been removed. This affects - 'C-c h', which was bound to 'ess-eval-line-and-step-invisibly' in - 'sas-mode-local-map'; 'C-c f', which was bound to - 'ess-insert-function-outline' in 'ess-add-MM-keys'; and 'C-c h', - which was bound to 'ess-handy-commands' in 'Rd-mode-map', - 'ess-noweb-minor-mode-map', and 'ess-help-mode-map' - - * Functions 'ess-eval-line-and-step' and - 'ess-eval-region-or-line-and-step' now behave consistently with - other evaluation function inside a package. - - * ESS[R]: 'ess-r-package-use-dir' now works with any mode. This sets - the working directory to the root of the current package including - for example C or C++ files within '/src'). - - * ESS[R]: Long + + prompts in the inferior no longer offset output. - - * ESS[R]: New option 'strip' for 'inferior-ess-replace-long+'. This - strips the entire + + sequence. - - * ESS modes now inherit from 'prog-mode'. In the next release, ESS - modes will use 'define-derived-mode' so that each mode will have - (for example) its own hooks and keymaps. - - * ESS[R]: Supports flymake in R buffers for Emacs 26 and newer. - Users need to install the 'lintr' package to use it. Customizable - options include 'ess-use-flymake', 'ess-r-flymake-linters', and - 'ess-r-flymake-lintr-cache'. - - * ESS[R]: Gained support for xref in Emacs 25+. *Note (emacs)Xref:: - - * ESS[R]: The startup screen is cleaner. It also displays the - startup directory with an explicit 'setwd()'. - - * ESS[R]: Changing the working directory is now always reflected in - the process buffer. - - * ESS[R]: 'Makevars' files open with 'makefile-mode'. - - * New variable 'ess-write-to-dribble'. This allows users to disable - the dribble ('*ESS*') buffer if they wish. - - * All of the '*-program-name' variables have been renamed to - '*-program'. Users who previously customized e.g. - 'inferior-ess-R-program-name' will need to update their - customization to 'inferior-ess-R-program'. These variables are - treated as risky variables. - - * 'ess-smart-S-assign' was renamed to 'ess-insert-assign'. It - provides similar functionality but for any keybinding, not just - '_'. For instance if you bind it to ';', repeated invokations - cycle through between assignment and inserting ';'. - - * 'C-c C-=' is now bound to 'ess-cycle-assign' by default. See the - documentation for details. New user customization option - 'ess-assign-list' controls which assignment operators are cycled. - - * ESS[R] In remote sessions, the ESSR package is now fetched from - GitHub. - - * Commands that send the region to the inferior process now deal with - rectangular regions. See the documentation of 'ess-eval-region' - for details. This only works on Emacs 25.1 and newer. - - * ESS[R]: Improvements to interacting with iESS in non-R files. - Interaction with inferior process in non-R files within packages - (for instance C or C++ files) has been improved. This is a work in - progress. - - * ESS[R]: Changing the working directory is now always reflected in - the process buffer. - - * ESS[JAGS]: *.jog and *.jmd files no longer automatically open in - JAGS mode. - - Many improvements to fontification: - - * Improved customization for faces. ESS now provides custom faces - for (nearly) all faces used and places face customization options - into their own group. Users can customize these options using 'M-x - customize-group RET ess-faces'. - - * Many new keywords were added to 'ess-R-keywords' and - 'ess-R-modifiers'. See the documentation for details. - - * ESS[R]: 'in' is now only fontified when inside a 'for' construct. - This avoids spurious fontification, especially in the output buffer - where 'in' is a commond English word. - - * ESS: Font-lock keywords are now generated lazily. That means you - can now add or remove keywords from variables like 'ess-R-keywords' - in your Emacs configuration file after loading ESS (i.e. in the - ':config' section for 'use-package' users). - - * ESS[R]: Fontification of roxygen '@param' keywords now supports - comma-separated parameters. - - * ESS[R]: Certain keywords are only fontified if followed by a - parenthesis. Function-like keywords such as 'if ()' or 'stop()' - are no longer fontified as keyword if not followed by an opening - parenthesis. The same holds for search path modifiers like - 'library()' or 'require()'. - - * ESS[R]: Fixed fontification toggling. Especially certain syntactic - elements such as '%op%' operators and backquoted function - definitions. - - * ESS[R]: 'ess-font-lock-toggle-keyword' can be called interactively. - This command asks with completion for a font-lock group to toggle. - This functionality is equivalent to the font-lock menu. - - Notable bug fixes: - - * 'prettify-symbols-mode' no longer breaks indentation. This is - accomplished by having the pretty symbols occupy the same number of - characters as their non-pretty cousins. You may customize the new - variable 'ess-r-prettify-symbols' to control this behavior. - - * ESS: Inferior process buffers are now always displayed on startup. - Additionally, they don't hang Emacs on failures. - - Obsolete libraries, functions, and variables: - - * The 'ess-r-args.el' library has been obsoleted and will be removed - in the next release. Use 'eldoc-mode' instead, which is on by - default. - - * Functions and options dealing with the smart assign key are - obsolete. The following functions have been made obsolete and will - be removed in the next release of ESS: 'ess-smart-S-assign', - 'ess-toggle-S-assign', 'ess-toggle-S-assign-key', - 'ess-disable-smart-S-assign'. - - The variable 'ess-smart-S-assign-key' is now deprecated and will be - removed in the next release. If you would like to continue using - '_' for insterting assign in future releases, please bind - 'ess-insert-assign' in 'ess-mode-map' the normal way. - - * ESS[S]: Variable 'ess-s-versions-list' is obsolete and ignored. - Use 'ess-s-versions' instead. You may pass arguments by starting - the inferior process with the universal argument. - - 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 - - -File: ess.info, Node: Credits, Next: Manual, 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) - * J. Alexander Branham (mailto:alex.branham@gmail.com) - - -File: ess.info, Node: Manual, Prev: Credits, Up: Introduction - -1.4 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. This -section describes some of the basics of using Emacs. If you are already -familiar with basic Emacs functionality, skip this section. You may -also want to use the Emacs tutorial, accessible via 'C-h t'. - - In this manual we use the standard notation used by Emacs for -describing the keystrokes used to invoke certain commands. 'C-' -means hold the CONTROL key while typing the character . 'M-' -means hold the META key (usually ALT) 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 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. For example, 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 a 'self-documenting' text editor. This applies to ESS in -two ways. First, some 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, 'C-h m' pops up a complete list of -keybindings available in each ESS mode and brief description of that -mode. - - Emacs is a versatile editor written in both C and a dialect of lisp -known as elisp. ESS is written in elisp and 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 -******************************* - -ESS supports GNU Emacs versions 24.3 and newer. - - ESS is most likely to work with current/recent versions of the -following statistical packages: R/S-PLUS, SAS, Stata, OpenBUGS and JAGS. - - To build the PDF documentation, you will need a version of TeX Live -or texinfo that includes texi2dvi. - - There are two main methods used for installing ESS. You may install -from a third-party repository or from source code. Once you install it, -you must also activate or load ESS in each Emacs session, though -installation from a third-party repository likely takes care of that for -you. See *note Activating and Loading ESS:: for more details. - -* Menu: - -* Installing from a third-party repository:: -* Installing from source:: -* Activating and Loading ESS:: -* Check Installation:: - - -File: ess.info, Node: Installing from a third-party repository, Next: Installing from source - -2.1 Installing from a third-party repository -============================================ - -ESS is packaged by many third party repositories. Many GNU/Linux -distributions package it, usually with the name "emacs-ess" or similar. - - ESS is also available through Milkypostman’s Emacs Lisp Package -Archive (MELPA), a popular repository for Emacs packages. Instructions -on how to do so are found on MELPA's website (https://melpa.org/). -MELPA also hosts MELPA-stable with stable ESS builds. You may choose -between MELPA with the latest and greatest features (and bugs) or -MELPA-stable, which may lag a bit behind but should be more stable. - - After installing, users should make sure ESS is activated or loaded -in each Emacs session. See *note Activating and Loading ESS::. -Depending on install method, this may be taken care of automatically. - - -File: ess.info, Node: Installing from source, Next: Activating and Loading ESS, Prev: Installing from a third-party repository - -2.2 Installing from source -========================== - -Stable versions of ESS are available at the ESS web page -(https://ess.r-project.org) as a .tgz file or .zip file. ESS releases -are GPG-signed, you should check the signature by downloading the -accompanying '.sig' file and doing: - - gpg --verify ess-18.10.tgz.sig - - Alternatively, you may download the git repository. ESS is currently -hosted on Github: . 'git clone -https://github.com/emacs-ess/ESS.git' will download it to a new -directory 'ESS' in the current working directory. - - We will refer to the location of the ESS source files as -'/path/to/ESS/' hereafter. - - After installing, users should make sure they activate or load ESS in -each Emacs session, see *note Activating and Loading ESS:: - - Optionally, compile elisp files, build the documentation, and the -autoloads: - cd /path/to/ESS/ - make - Without this step the documentation, reference card, and autoloads -will not be available. Uncompiled ESS will also run slower. - - Optionally, you may make ESS available to all users of a machine by -installing it site-wide. To do so, run '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. - - -File: ess.info, Node: Activating and Loading ESS, Next: Check Installation, Prev: Installing from source - -2.3 Activating and Loading ESS -============================== - -After installing ESS, you must activate or load it each Emacs session. -ESS can be autoloaded, and if you used a third-party repository (such as -your Linux distribution or MELPA) to install, you can likely skip this -section and proceed directly to *note Check Installation:: - - Otherwise, you may need to add the path to ESS to 'load-path' with: - - (add-to-list 'load-path "/path/to/ESS/lisp") - - You then need to decide whether to take advantage of deferred loading -(which will result in a faster Emacs startup time) or require ESS when -Emacs is loaded. To autoload ESS when needed (note that if installed -from source, you must have run 'make'): - - (load "ess-autoloads") - - To require ESS on startup, you can either put - - (require 'ess-site) - - or - - (require 'ess-r-mode) - - In your configuration file, depending on whether you want all ESS -features or only R related features. - - -File: ess.info, Node: Check Installation, Prev: Activating and Loading ESS - -2.4 Check Installation -====================== - -Restart Emacs and check that ESS was loaded from a correct location with -'M-x ess-version'. - - -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 R from within Emacs. The Emacs -convention is to name such processes running under its control as -'inferior processes'. Some users find this terminology confusing; you -may prefer to think of these as '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:: -* Customizing startup:: - - -File: ess.info, Node: Starting up, Next: Multiple ESS processes, Up: Interactive ESS - -3.1 Starting an ESS process -=========================== - -To start an inferior R session on GNU/Linux, macOS, or Windows using the -Cygwin bash shell, simply type 'M-x R RET'. To start an R session on -Windows when you use the MSDOS/powershell shell, simply type 'M-x -S+6-msdos RET'. R will then (by default) ask the question - - R starting data directory? - -Enter the name of the directory you wish to have as the working -directory (that is, the directory you wish to have 'getwd()' return if -using R). - - You will then be popped into a buffer named '*R*' 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 iESS process simultaneously in the -same session. Each process has a name and a number; the initial process -(process 1) is simply named 'R'. If you call 'M-x R' again without -killing the first R process, ESS will start a second R process with the -name 'R:2'. To have the first buffer named 'R:1', customize the option -'ess-plain-first-buffername'. With a prefix argument, 'C-u M-x R' -allows for the specification of command line options. - - -- User Option: ess-plain-first-buffername - If non-'nil', name the first iESS process [R]. Otherwise, name it - [R:1]. - - 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 processes. This is -a good command to consider binding to a global key. - - -File: ess.info, Node: ESS processes on Remote Computers, Next: Customizing startup, Prev: Multiple ESS processes, Up: Interactive ESS - -3.3 ESS processes on Remote Computers -===================================== - -3.3.1 ESS and TRAMP -------------------- - -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 *Note (tramp)Top::. - - Start an ssh session using TRAMP 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'). When -asked for starting directory, simply type '/ssh:user@host: RET'. The 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 the R graphic -device showing on the current machine - -3.3.2 ESS-remote ----------------- - -TRAMP is the recommended way of starting a remote session. The other -way to start a remote ESS connection is 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 'R', 'Splus', 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 R 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. - - -File: ess.info, Node: Customizing startup, Prev: ESS processes on Remote Computers, Up: Interactive ESS - -3.4 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 R actions, 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', ask 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 (for R, you likely -want it to end in '.Rout'). 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 -inferior process itself is started. If you need to pass any arguments -to this program, they may be specified in the variable -'inferior-S_PROGRAM_NAME-args'. For example, if 'inferior-ess-program' -is '"R"' then the variable to set is 'inferior-R-args'. It is not -normally necessary to pass arguments to the iESS 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 iESS process to appear in a -separate frame, 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 R interpreter. This is achieved by running the R -process from within an Emacs buffer, called hereafter _inferior_ buffer, -which has an active 'inferior-ess-mode'. The features of inferior R -mode are similar to those provided by the standard Emacs shell mode -(*note (emacs)Shell Mode::). Command-line completion of R objects and a -number of 'hot keys' for commonly-used R 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-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 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 R 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 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-prompt' Moves point to the preceding prompt in the - process buffer. - -'C-c C-n' - 'comint-next-prompt' Moves point to the next prompt 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 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 -signaled). Note all 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 (re)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 R session ----------------------------------------- - -To keep a record of your R 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 R 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 R by setting the variable 'ess-ask-about-transfile' to -'t'; *Note Customizing startup::. For R files, naming transcript files -'*.Rout' puts them in a special mode (ESS transcript mode -- *note -Transcript Mode::) for editing transcript files which is automatically -selected for files with this suffix. - - R 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. - - You can use 'ess-transcript-clean-region' to strip output from a -transcript, leaving only source code suitable for inclusion in files -'source()'-able from R. *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-move-point-for-output 'others) - ;; somewhat extreme, almost disabling writing in *R*, *shell* buffers above prompt: - (setq comint-scroll-to-bottom-on-input 'this) - )) - to your Emacs configuration file, where the last two settings are -typically desirable for the situation where you work with a script (for -example, '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 a file) in the same directory as the iESS process. - - ESS users may work exclusively with script files rather than in a -iESS session, and may not want to save any history files. To do so: - - (setq ess-history-file nil) - -or if you prefer only one global command history file: - - (setq ess-history-directory "~/.R/") - -in your Emacs configuration 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 R, 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 R 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. In other words, 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). This is 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 R. 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 M-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 - 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 R 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 R - 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 R languages (R, S, S-Plus) 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 R 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 R 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 principal applies. -Within your R session, 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 R 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 iESS 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. Consecutive presses of 'C-z' switch between the script and - process buffers. - - 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 iESS modes 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 -R 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') (in elisp terms, the argument 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' -evaluates the current line without showing the input in the iESS buffer. -The default value of 'ess-eval-visibly' ('t') means that ESS calls block -Emacs until they finish. This may be undesirable, especially if -commands take long to finish. Users who want input to be displayed and -Emacs not to be blocked can set 'ess-eval-visibly' to ''nowait'. This -sends the input to the iESS buffer but does not wait for the process to -finish, ensuring Emacs is not blocked. - - Primary commands for evaluating code are: - - -- Command: ess-eval-region-or-line-and-step VIS - 'C-' Sends 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 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 R 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-move-point-for-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 R 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 '.Rout'. The -most obvious use for a transcript file is as a static record of the -actions you have performed in a particular R 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 '.Rout' into Emacs, it is placed -in R Transcript Mode. Transcript Mode is similar to inferior R 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 R 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 R 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 R mode, also available in R 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 R objects within your Emacs session. -Most editing is performed on R 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 R functions. -Error-checking is performed when R 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 R 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 R objects -=================================== - -To edit an object, type - - -- Command: ess-dump-object-into-edit-buffer OBJECT - 'C-c C-e C-d' Edit an object in its own edit buffer. - - from within the iESS process buffer ('*R*'). 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 R -source code. Commands are provided to intelligently indent R code, -evaluate portions of R code and to move around R 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 R 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 R'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 R is to load them in as source file, using R'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 M-l'). *note Hot keys::. - -After typing 'C-c M-l' you will prompt for the name of the file to load -into R; 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 R 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 R code -=================================== - -ESS provides a sophisticated mechanism for indenting R source code. -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 R 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 R (compound) expression which - follows point. Very useful for beautifying your R 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-dwim' Call the comment command you want (Do What I Mean). - -* 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 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. - - -- 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. You can set this - in your Emacs configuration file: - - (setq ess-default-style 'C++) - - -- 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 customization 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 R - 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 many 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 R. - - -File: ess.info, Node: Source Files, Next: Source Directories, Prev: Other edit buffer commands, Up: Editing objects - -7.6 Maintaining R 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 R 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 R dumps an object's definition to a disk file -the source code on disk corresponds exactly to R'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 R 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 R'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 (without error) loaded back -into R with 'C-c C-l', the disk file again corresponds exactly (well, -almost -- see below) to R'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 git *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 R object itself. Another useful feature is -that you may format the code in any fashion you please without R -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 '.R'. Thus if user 'joe' dumps the object -'myfun' the dump file will have name 'joe.myfun.R'. 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 R 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 '~/R-source'. This could be achieved by including the -following line in your Emacs configuration file: - (setq ess-source-directory (expand-file-name "~/R-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 R -working directory during an R 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 R 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 R 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 ESS 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 R help mode. - -'h' - 'ess-display-help-on-object' Pop up a help buffer for a different - object. - - Paging commands: - -'DEL' - 'scroll-down-command' Move one screen backwards through the help - file. - -'SPC' - 'scroll-up-command' Move one screen forwards through the help file. - -'>' -'<' - 'end/beginning-of-buffer' Move to the end or beginning 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 the exact -headings available and capitalization scheme may vary across languages. - - You may 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: - -'?' - 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 R 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:: -* Company:: -* 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 R 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 the rest of -Emacs. ESS maintains a list of all objects known to R 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 - - For example, consider three functions 'binomplot()', 'binom.test()' -and 'binomial()'. Typing 'bin TAB' 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 R functions such as 'get()' or 'scan()' which require -fully expanded file names. - - In the iESS 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 R; 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 -========================= - -ESS uses 'IDO' mechanism (part of default Emacs) for minibuffer -completion if the 'ido' 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: Company, 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: Company, Next: Icicles, Prev: Auto-complete, Up: Completion - -9.5 Company -=========== - -Another popular package for completion is company, short for complete -anything. ESS provides support for company out-of-the-box. To disable -company support, set 'ess-use-company' to 'nil'. You can set it to -''script-only' to only activate company in R scripts. - - -File: ess.info, Node: Icicles, Prev: Company, Up: Completion - -9.6 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): - - (require 'icicles) - (icy-mode 1) - - Icicles can be toggled 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 -================= - -* Menu: - -* Getting started with tracebug:: Quick tutorial - -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. - - '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. - - _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: Getting started with tracebug, Up: ESS tracebug - -10.1.1 Getting started with tracebug ------------------------------------- - -Consider a buffer with the following function: - -test <- function(x){ - mean(x), -} - - Evaluating the function (e.g. 'C-c C-c') results in an error about -an unexpected comma. You can use 'next-error' (bound by default to 'C-x -`', 'M-g n', and 'M-g M-n') to jump to the place where the error -occurred. Alternatively, use the mouse to click on the error to jump to -where it occurred. - - Correct the error by deleting the comma. Now put point on 'mean' and -set the breakpoint using 'C-c C-t b' ('ess-bp-set') and reevaluate the -function. Jump to the inferior buffer (possibly using 'C-c C-z') and -evaluate 'test(1:10)'. An interactive debug process starts, stopping at -the breakpoint we just specified. Here you can debug your function -(what is 'x' at this point?). Use 'M-N' to continue. - - Let's replace our test function with one slightly more complicated: - -test <- function(x){ - x <- x + 1 - y <- mean(x) - x <- ifelse(x > 5, x, x - 100) - list(x, y) -} - - Try setting multiple breakpoints. You can unset a breakpoint by -killing it with 'C-c C-t k'. You can set conditional breakpoints too. -Try setting one by placing point on the line 'x <- x + 1' and doing 'C-c -C-t B'. ESS will ask for the condition. Let's set it to -'!is.numeric(x)'. After re-evaluating 'test', try calling 'test(1:100)' -and 'test('foo')'. - - You can remove all breakpoints with 'C-c C-t K'. - - You can flag a function for debugging (similar to calling -'debug(test)' at R's prompt) by doing 'C-c C-t d'. Try this yourself by -putting point over 'test' and doing 'C-c C-t d'. - - If an error occurs, you can get the complete call stack by doing 'C-c -`' or 'C-c C-t `' ('ess-show-traceback'). - - Tracebug also offers a watch window where you can watch values of -objects. Open it with 'C-c C-t w' ('ess-watch'). Initially you aren't -watching anything. Add something with 'a' (e.g. 'a test'). The watch -window displays what the object is at any given time and automatically -updates. Quit the watch window with 'q'. - - -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. For example, -'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 -. - - Occasionally 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 R, 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 -* ESS Flymake:: On-the-fly syntax checking -* 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 -* Xref:: Xref -* 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: ESS Flymake, Up: Extras - -11.1 ElDoc -========== - -In 'ElDoc' mode, the echo area displays function's arguments at point. -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: ESS Flymake, Next: Handy commands, Prev: ESS ElDoc, Up: Extras - -11.2 Flymake -============ - -The minor mode 'flymake-mode' provides on-the-fly syntax checking. ESS -provides support for flymake in R-mode in Emacs versions 26 and newer. -It is enabled by default, to disable it you may set 'ess-use-flymake' to -'nil'. In order to use it, you may need to install the 'lintr' R -package, available from CRAN. - - -- User Option: ess-use-flymake - When non-nil, use flymake. If ''process', only use flymake when - the buffer has an inferior process running. - - -- User Option: ess-r-flymake-linters - This variable describes the linters to use. It can either be a - string with an R expression to be used as-is or a list of strings - where each element is passed to 'lintr::with_defaults'. See the - help page for 'lintr::default_linters' for information on available - linters and their defaults. - - -- User Option: ess-r-flymake-lintr-cache - When 't' (the default), lintr uses a cache. Change to 'nil' to - disable lintr's caching mechanism. - - -File: ess.info, Node: Handy commands, Next: Highlighting, Prev: ESS Flymake, Up: Extras - -11.3 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.4 Syntactic highlighting of buffers -====================================== - -ESS provides Font-Lock (*note Using Multiple Typefaces: (emacs)Faces.) -patterns for inferior R Mode, S Mode, and R Transcript Mode buffers. - - 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.5 Parenthesis matching -========================= - -Emacs has 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. You may activate it -putting this in your Emacs configuration file: - - (show-paren-mode) - - -File: ess.info, Node: Graphics, Next: Imenu, Prev: Parens, Up: Extras - -11.6 Using graphics with ESS -============================ - -One of the main features of R is its ability to generate high-resolution -graphics plots. When using R in a windowing environment, no additional -configuration is necessary; plots will be shown in a new (non-Emacs) -window. - - If not using a windowing environment or S, 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.6.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.6.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.6.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.7 Imenu -========== - -Imenu is an Emacs tool for providing mode-specific buffer indexes. In -some of the ESS editing modes (currently SAS and R), support for Imenu -is provided. For example, in R mode buffers, the menubar should display -an item called "Imenu-R". 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, for example 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: Xref, Prev: Imenu, Up: Extras - -11.8 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: Xref, Next: Rdired, Prev: Toolbar, Up: Extras - -11.9 Xref -========= - -Xref is an Emacs interface that supports finding "identifiers," usually -function definitions in ESS's view. ESS ships with support for Xref in -Emacs versions 25.1 and higher. *Note (emacs)Xref:: for how to use this -feature. - - -File: ess.info, Node: Rdired, Next: Rutils, Prev: Xref, Up: Extras - -11.10 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.11 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 configuration file. 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.12 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.13 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 R, Next: ESS for SAS, Prev: Extras, Up: Top - -12 Overview of ESS features for the S family -******************************************** - -* Menu: - -* ESS(R)--Editing files:: -* iESS(R)--Inferior ESS processes:: -* Philosophies for using ESS(R):: -* Example ESS usage:: - - -File: ess.info, Node: ESS(R)--Editing files, Next: iESS(R)--Inferior ESS processes, Prev: ESS for R, Up: ESS for R - -12.1 ESS[R]-Editing files -========================= - -ESS[R] mode should be automatically turned on when visiting a file -ending with an R or S suffix (*.R, *.S, *.s, etc), which enables the -features discussed previously. 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(R)--Inferior ESS processes, Next: Philosophies for using ESS(R), Prev: ESS(R)--Editing files, Up: ESS for R - -12.2 iESS[R]-Inferior ESS processes -=================================== - -To start up iESS mode for R, use: - M-x R - M-x S+3 - M-x S4 - M-x S+5 - M-x S+6 - -(for R, S-PLUS 3.x, S4, S+5, S+6 or or S+7, respectively. This assumes -that you have access to each). - - In the case that you wish to pass command line arguments to the -starting R process, call it with the universal prefix. To set command -line arguments that apply to all future iESS sessions, set the variable -'inferior-R-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. - - If you have other versions of R or S available on the system, ESS is -also able to start those versions. How this exactly works depend on -which OS you are using (details below). 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 GNU/Linux systems and other Unix-like systems (macOS): 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", -"R-2", "R-3", "R-devel", or "R-patched". 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-r-versions' or -'ess-s-versions-list', you should put them in your Emacs configuration -file 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: Philosophies for using ESS(R), Next: Example ESS usage, Prev: iESS(R)--Inferior ESS processes, Up: ESS for R - -12.3 Philosophies for using ESS[R] -================================== - -There are two philosophies for using ESS. Most modern best practices -prefer the first. ESS is configured for the first, and this is what the -manual focuses on. - - 1: The source code is real. 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: R 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 configuration file: - (setq ess-keep-dump-files nil) - (setq ess-delete-dump-files t) - (setq ess-mode-silently-save nil) - - -File: ess.info, Node: Example ESS usage, Prev: Philosophies for using ESS(R), Up: ESS for R - -12.4 Example ESS usage -====================== - -We present some basic examples for using ESS to interact with R 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 - ## Load the file you want to work with - C-x C-f myfile.R - - ## Edit as appropriate, then start and switch to an R buffer - C-c C-z - - ## A new buffer *R* will appear. R will have been started - ## in this buffer. The buffer is in iESS [R] mode. - - ## Return to the script (prefix with C-c if you have pressed other keys) - C-z - - ## Send regions, lines, or the entire file contents to R. For regions, - ## highlight a region with keystrokes or mouse and then send with: - C-c C-r - - ## Re-edit myfile.R as necessary to correct any difficulties. Add - ## new commands here. Send them to R by region with C-c C-r, or - ## one line at a time with C-c C-n. - - ## Save the revised myfile.R with C-x C-s. - - ## Save the entire *R* interaction buffer with C-c C-s. You - ## will be prompted for a file name. The recommended name is - ## myfile.Rout. With this 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 R in a process buffer (this will be *R*) - M-x R - - ## Load the file you want to work with - C-x C-f myfile.R - - ## edit program, functions, and code in myfile.R, and send revised - ## functions to R 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 M-l - - ## save the revised myfile.R when you have finished - C-c C-s - - - -File: ess.info, Node: ESS for SAS, Next: ESS for BUGS, Prev: ESS for R, 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 -*************** - -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. -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, '<-'. - -14.2 ESS[BUGS]-Command files -============================ - -Files ending in '.bmd' are used for BUGS 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 -======================== - -The '.bog' extension is used for BUGS log files. The command line -generated by ESS creates the '.bog' transcript file. - - -File: ess.info, Node: ESS for JAGS, Next: Mailing lists/bug reports, Prev: ESS for BUGS, Up: Top - -15 ESS for JAGS -*************** - -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 -========================== - -Files with the '.jag' extension are edited in ESS[JAGS] mode. Three -keys are bound for your use in ESS[JAGS], '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, '<-'. - - The first press of 'C-c C-c' will set up a template, including some -necessary file-local variables in an empty buffer. These variables are -'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 -============================ - -Files ending in '.jmd' are 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. - - -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 , -or post them on our github issue tracker -(https://github.com/emacs-ess/ESS/issues) - - The easiest way to do this is within Emacs by typing - - 'M-x ess-submit-bug-report' - - This also gives the maintainers valuable information about your -installation which may help us to identify or even fix the bug. - - If Emacs reports an error, backtraces can help us debug the problem. -Type "M-x set-variable RET debug-on-error RET t RET". Then run the -command that causes the error and you should see a *Backtrace* buffer -containing debug information; send us that buffer. - - Note that comments, suggestions, words of praise and large cash -donations are also more than welcome. - - -File: 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 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 configuration 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 57) -* }: Indenting. (line 57) -* 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 66) -* C-c C-c: Other. (line 9) -* C-c C-c <1>: Evaluating code. (line 39) -* 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 52) -* C-c C-j: Evaluating code. (line 45) -* 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 71) -* C-C C-r: Evaluating code. (line 59) -* 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 66) -* 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 69) -* C-c M-f: Evaluating code. (line 55) -* C-c M-j: Evaluating code. (line 48) -* C-c M-l: Hot keys. (line 50) -* C-c M-r: Evaluating code. (line 62) -* C-c RET: Resubmit. (line 14) -* C-c `: Error Checking. (line 9) -* C-j: Indenting. (line 64) -* 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 53) -* C-M-x: Evaluating code. (line 36) -* C-RET: Evaluating code. (line 32) -* 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 53) -* M-;: Indenting. (line 69) -* M-?: Object names. (line 34) -* M-C-q: Indenting. (line 53) -* 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 35) - - -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: Command History. (line 18) -* comint-next-matching-input-from-input: Command History. (line 45) -* comint-next-prompt: Process buffer motion. - (line 15) -* comint-previous-input: Command History. (line 14) -* comint-previous-matching-input-from-input: Command History. (line 41) -* comint-previous-prompt: Process buffer motion. - (line 11) -* comint-show-output: Last command. (line 20) -* dump(): Edit buffer. (line 35) -* ess-change-directory: Rutils. (line 45) -* ess-cleanup: Hot keys. (line 71) -* ess-cleanup <1>: Help. (line 163) -* ess-describe-help-mode: Help. (line 21) -* ess-display-help-on-object: Hot keys. (line 65) -* 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 56) -* ess-eval-buffer: Evaluating code. (line 65) -* ess-eval-buffer-and-go: Evaluating code. (line 68) -* ess-eval-function: Evaluating code. (line 51) -* ess-eval-function-and-go: Evaluating code. (line 54) -* ess-eval-line: Evaluating code. (line 44) -* ess-eval-line-and-go: Evaluating code. (line 47) -* ess-eval-line-and-step: Help. (line 106) -* ess-eval-region: Evaluating code. (line 58) -* ess-eval-region <1>: Help. (line 111) -* ess-eval-region-and-go: Evaluating code. (line 61) -* ess-eval-region-or-function-or-paragraph: Evaluating code. (line 35) -* ess-eval-region-or-function-or-paragraph-and-step: Evaluating code. - (line 38) -* ess-eval-region-or-line-and-step: Evaluating code. (line 31) -* 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 52) -* ess-indent-or-complete: Indenting. (line 34) -* ess-list-object-completions: Object names. (line 33) -* 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 70) -* ess-quit <1>: Help. (line 163) -* 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 9) -* ess-request-a-process: Multiple ESS processes. - (line 18) -* ess-resynch: Object names. (line 53) -* 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 55) -* 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 117) -* 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) -* getting started with tracebug: Getting started with tracebug. - (line 6) -* 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 71) -* R: Starting up. (line 11) -* S: Starting up. (line 11) -* search(): Hot keys. (line 34) -* search() <1>: Object names. (line 20) -* source(): Evaluating code. (line 18) -* 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 24) -* 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 21) -* 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 46) -* ess-first-tab-never-complete <1>: Object names. (line 6) -* 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 27) -* ess-keep-dump-files: Source Files. (line 26) -* ess-plain-first-buffername: Multiple ESS processes. - (line 14) -* ess-r-flymake-linters: ESS Flymake. (line 16) -* ess-r-flymake-lintr-cache: ESS Flymake. (line 23) -* ess-R-font-lock-keywords: Highlighting. (line 19) -* ess-search-list: Source Directories. (line 62) -* ess-source-directory: Source Directories. (line 22) -* ess-style-alist: Styles. (line 29) -* 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 42) -* ess-use-eldoc: ESS ElDoc. (line 13) -* ess-use-flymake: ESS Flymake. (line 12) -* iESS program arguments: Customizing startup. (line 42) -* inferior-ess-program: Customizing startup. (line 42) -* inferior-R-font-lock-keywords: Highlighting. (line 12) -* 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: - -* aborting R commands: Other. (line 9) -* aborting S commands: Other. (line 9) -* arguments to R program: Customizing startup. (line 45) -* arguments to S program: Customizing startup. (line 45) -* 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) -* changing ESS processes: Multiple ESS processes. - (line 6) -* cleaning up: Hot keys. (line 71) -* comint: Credits. (line 6) -* command history: Command History. (line 6) -* command line arguments: iESS(R)--Inferior ESS processes. - (line 16) -* 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 R: Indenting. (line 18) -* company: Company. (line 6) -* 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 40) -* completion on lists: Object names. (line 38) -* 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 21) -* deleting output: Last command. (line 24) -* directories: Starting up. (line 11) -* 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 18) -* 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 commands blocking Emacs: Evaluating code. (line 18) -* ess developer: Namespaced Evaluation. - (line 6) -* ESS process buffer: Starting up. (line 17) -* ESS process directory: Starting up. (line 11) -* ESS tracebug: ESS tracebug. (line 6) -* ESS-elsewhere: ESS processes on Remote Computers. - (line 9) -* ess-roxy: Roxygen. (line 6) -* evaluating code with echoed commands: Evaluating code. (line 18) -* evaluating R expressions: Evaluating code. (line 29) -* evaluating S expressions: Evaluating code. (line 29) -* finding function definitions: Xref. (line 6) -* flymake: ESS Flymake. (line 6) -* font-lock mode: Highlighting. (line 7) -* formatting source code: Indenting. (line 32) -* 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 32) -* installation: Installation. (line 6) -* interactive use of R: Introduction. (line 31) -* interactive use of S: Introduction. (line 31) -* interrupting R commands: Other. (line 9) -* interrupting S commands: Other. (line 9) -* introduction: Introduction. (line 6) -* keyboard short cuts: Hot keys. (line 43) -* killing temporary buffers: Hot keys. (line 71) -* killing the ESS process: Hot keys. (line 71) -* lists, completion on: Object names. (line 38) -* motion in transcript mode: Transcript Mode. (line 17) -* multi-line commands, resubmitting: Transcript resubmit. (line 33) -* multiple ESS processes: Multiple ESS processes. - (line 6) -* multiple inferior processes: Multiple ESS processes. - (line 6) -* multiple interactive 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 17) -* process names: Multiple ESS processes. - (line 8) -* programming in R: Introduction. (line 43) -* programming in S: Introduction. (line 43) -* project work in R: Source Files. (line 41) -* project work in S: Source Files. (line 41) -* quitting from ESS: Hot keys. (line 71) -* re-executing commands: Command History. (line 6) -* reading long command outputs: Last command. (line 19) -* remote Computers: ESS processes on Remote Computers. - (line 9) -* reverting function definitions: Edit buffer. (line 27) -* roxy: Roxygen. (line 6) -* Roxygen: Roxygen. (line 6) -* running R: Starting up. (line 6) -* running S: Starting up. (line 6) -* S+elsewhere: ESS processes on Remote Computers. - (line 9) -* search list: Hot keys. (line 34) -* search list <1>: Source Directories. (line 55) -* sending input: Entering commands. (line 6) -* starting directory: Starting up. (line 11) -* starting ESS: Starting up. (line 6) -* STERM: Statistical Process running in ESS?. - (line 6) -* temporary buffers: Help. (line 162) -* temporary buffers, killing: Hot keys. (line 71) -* tracebug tutorial: Getting started with tracebug. - (line 6) -* tramp support: ESS processes on Remote Computers. - (line 9) -* 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 R sessions: Introduction. (line 38) -* transcripts of S sessions: Introduction. (line 38) -* using ESS interactively: Introduction. (line 31) -* using R interactively: Introduction. (line 31) -* using S interactively: Introduction. (line 31) -* winjava: winjava. (line 6) -* working directory: Starting up. (line 11) -* working directory <1>: Source Directories. (line 55) -* X Windows: X11. (line 6) -* xref: Xref. (line 6) - - - -Tag Table: -Node: Top268 -Node: Introduction2906 -Node: Features5659 -Node: Current Features6495 -Node: New features9946 -Node: Credits23693 -Node: Manual27310 -Node: Installation29976 -Node: Installing from a third-party repository30913 -Node: Installing from source31860 -Node: Activating and Loading ESS33452 -Node: Check Installation34526 -Node: Interactive ESS34746 -Node: Starting up35560 -Node: Multiple ESS processes36304 -Node: ESS processes on Remote Computers37385 -Node: Customizing startup41488 -Node: Entering commands44105 -Node: Command-line editing45263 -Node: Transcript46496 -Node: Last command48265 -Node: Process buffer motion49691 -Node: Transcript resubmit51194 -Node: Saving transcripts53159 -Node: Command History54949 -Node: Saving History58358 -Node: History expansion59119 -Node: Hot keys62330 -Node: Statistical Process running in ESS?66400 -Node: Emacsclient67679 -Node: Other68471 -Node: Evaluating code69490 -Node: Transcript Mode73171 -Node: Resubmit74324 -Node: Clean75387 -Node: Editing objects76383 -Node: Edit buffer77501 -Node: Loading79547 -Node: Error Checking80574 -Node: Indenting81623 -Node: Styles84812 -Node: Other edit buffer commands87247 -Node: Source Files88903 -Node: Source Directories93507 -Node: Help96660 -Node: Completion100758 -Node: Object names100991 -Node: Function arguments103664 -Node: Minibuffer completion104203 -Node: Auto-complete104683 -Node: Company106230 -Node: Icicles106609 -Node: Developing with ESS107929 -Node: ESS tracebug108375 -Node: Getting started with tracebug111382 -Node: Editing documentation113540 -Node: R documentation files114090 -Node: Roxygen118017 -Node: Namespaced Evaluation122352 -Node: Extras124350 -Node: ESS ElDoc125374 -Node: ESS Flymake126870 -Node: Handy commands127964 -Node: Highlighting129161 -Node: Parens130196 -Node: Graphics130672 -Node: printer131343 -Node: X11132099 -Node: winjava132438 -Node: Imenu132850 -Node: Toolbar133697 -Node: Xref134105 -Node: Rdired134428 -Node: Rutils135482 -Node: Org137876 -Node: Sweave and AUCTeX138821 -Node: ESS for R140947 -Node: ESS(R)--Editing files141247 -Node: iESS(R)--Inferior ESS processes141766 -Node: Philosophies for using ESS(R)146515 -Node: Example ESS usage147442 -Node: ESS for SAS149663 -Node: ESS(SAS)--Design philosophy150386 -Node: ESS(SAS)--Editing files151339 -Node: ESS(SAS)--TAB key153193 -Node: ESS(SAS)--Batch SAS processes154559 -Node: ESS(SAS)--Function keys for batch processing159585 -Node: iESS(SAS)--Interactive SAS processes169071 -Node: iESS(SAS)--Common problems172825 -Node: ESS(SAS)--Graphics174349 -Node: ESS(SAS)--Windows175132 -Node: ESS for BUGS175710 -Node: ESS for JAGS177466 -Node: Mailing lists/bug reports180818 -Node: Bugs181082 -Node: Reporting Bugs182707 -Node: Mailing Lists183600 -Node: Help with Emacs184347 -Node: Customization184879 -Node: Indices185653 -Node: Key index185828 -Node: Function and program index191106 -Node: Variable index200745 -Node: Concept index204233 - -End Tag Table diff -Nru ess-18.10.2/doc/installation.texi ess-18.10.2+git20220915.f45542e/doc/installation.texi --- ess-18.10.2/doc/installation.texi 2018-11-10 09:41:10.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/doc/installation.texi 2022-10-15 08:06:36.000000000 +0000 @@ -44,7 +44,7 @@ @end example Alternatively, you may download the git repository. ESS is currently -hosted on Github: @uref{https://github.com/emacs-ess/ESS}. @code{git +hosted on GitHub: @uref{https://github.com/emacs-ess/ESS}. @code{git clone https://github.com/emacs-ess/ESS.git} will download it to a new directory @code{ESS} in the current working directory. diff -Nru ess-18.10.2/doc/mailing.texi ess-18.10.2+git20220915.f45542e/doc/mailing.texi --- ess-18.10.2/doc/mailing.texi 2018-11-10 09:41:10.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/doc/mailing.texi 2022-10-15 08:06:36.000000000 +0000 @@ -12,7 +12,7 @@ @item helping users of ESS to get along with it. @item - discussing aspects of using ESS on Emacs and XEmacs. + discussing aspects of using ESS. @item suggestions for improvements. @item diff -Nru ess-18.10.2/doc/Makefile ess-18.10.2+git20220915.f45542e/doc/Makefile --- ess-18.10.2/doc/Makefile 2018-11-10 09:41:10.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/doc/Makefile 2022-10-15 08:06:36.000000000 +0000 @@ -1,23 +1,5 @@ -### Makefile - for DOCUMENTATION (./doc) of ESS distribution. -### - -## Before making changes here, please take a look at Makeconf include ../Makeconf -# program to convert .texi{nfo} to .html -#MM: use makeinfo (i.e. MAKEHTML from above) which is more -#-- standardized than texi2html which exists in -#MM at least two widely differing versions (TeX vs GNU): -#MM TEXI2HTML = LANG=C texi2html -verbose -iso -#MM SPLITCHAP = -split_chapter -menu -glossary -## - -TEXI2PDF = LANG=C texi2dvi --pdf - -# To obtain sorted indices run: "texindex ess.??". - -#### no user servicable parts beyond this point #### - TEXISRC = announc.texi authors.texi bugrept.texi bugs.texi \ credits.texi currfeat.texi ess.texi ess-defs.texi \ help-s.texi help-sas.texi installation.texi \ @@ -25,11 +7,6 @@ newfeat.texi requires.texi help-bugs.texi \ help-jags.texi allnews.texi Makefile ../Makeconf ../VERSION -ESSINFONODE1='* ESS: (ess).' -ESSINFONODE2=' Emacs Speaks Statistics' -ESSINFONODE3=' (S/S+/R, SAS, BUGS, Stata, XLisp-Stat).' - -### Targets -- PDFs = ess.pdf readme.pdf refcard/refcard.pdf TXTs = ../README ../ANNOUNCE ../NEWS ../ONEWS @@ -45,30 +22,20 @@ readme.pdf : $(TEXISRC); $(TEXI2PDF) readme.texi -cleanaux: - -@rm -f *.aux *.cp *.cps *.fn *.fns *.ky *.kys *.log *.out \ +distclean clean: + @rm -f *.aux *.cp *.cps *.fn *.fns *.ky *.kys *.log *.out \ *.pg *.pgs *.tmp *.toc *.tp *.vr *.vrs -## this shall remove *exactly* those things that are *not* in version control: -clean: cleanaux - -@rm -f $(TXTs) $(PDFs) info/*.info* html/* - -## this removes also things in VC (svn, when they are remade by "make"): -distclean : clean -# -@rm -f $(PDFs) + @rm -f $(TXTs) $(PDFs) info/*.info* \ + html/* *.info dir ../README: $(TEXISRC) -$(MAKETXT) readme.texi \ | perl -pe 'last if /^Concept Index/;' > $@ -# | perl -pe 'last if /^Concept Index/; print "For INSTALLATION, see way below.\n\n" if /^\s*ESS grew out of/' \ ../ANNOUNCE: $(TEXISRC) -$(MAKETXT) announc.texi \ | perl -pe 'last if /^Concept Index/;' > $@ -README.Microsoft : README.Microsoft.texi - $(MAKETXT) README.Microsoft.texi \ - | perl -pe 'last if /^Concept Index/;' > $@ - ../NEWS: Makefile ess-defs.texi newfeat.texi news.texi -$(MAKETXT) news.texi > $@ @@ -87,7 +54,7 @@ install-info : info/ess.info -$(INSTALLDIR) $(INFODIR) $(INSTALL) info/ess.info $(INFODIR) - test -f $(INFODIR)/dir || $(INSTALL) dir.txt $(INFODIR)/dir + $(INSTALL) info/dir $(INFODIR) grep $(ESSINFONODE1) $(INFODIR)/dir || \ (echo >> $(INFODIR)/dir; echo 'Emacs' >> $(INFODIR)/dir; \ echo $(ESSINFONODE1) $(ESSINFONODE2) >> $(INFODIR)/dir; \ @@ -109,15 +76,9 @@ @echo "making HTML documentation..." mkdir -p html -$(MAKEHTML) html/ess.html ess.texi -#MM $(TEXI2HTML) $(SPLITCHAP) ess.texi -#MM test -d ess && cp -p ess/ess_toc.html html/index.html || cp -p ess_toc.html html/index.html -#MM test -d ess && mv -f ess/*.html html || mv -f *.html html html/readme.html: $(TEXISRC) -$(MAKEHTML) html/readme.html --no-validate readme.texi - ## ^^^^^^^^^^^^^ (design bug: "FIXME" in ess.texi) -#MM $(TEXI2HTML) readme.texi -# mv -f readme.html html html/news.html: $(TEXISRC) mkdir -p html diff -Nru ess-18.10.2/doc/name-completion.txt ess-18.10.2+git20220915.f45542e/doc/name-completion.txt --- ess-18.10.2/doc/name-completion.txt 2018-11-10 09:41:10.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/doc/name-completion.txt 1970-01-01 00:00:00.000000000 +0000 @@ -1,60 +0,0 @@ -Name completion (for R and S-plus): ----------------- - -Want to keep an up-to-date list of S object names, on which we can -complete. - Additionally, list-component completion "x$a" also work, - as does slot completion on S4 objects "ob@". - -Historically, for S and S-plus, we had made an effort to only reread -the objects of database entries in search() ``when needed''. -In particular, for "non-compressed" directories, one had looked at their -"modification time" and kept as timestamp. And they were only re-read (by -listing the *files* inside !) when the time changed. -For R, this is not available and for newer versions of S-plus, with -"compiled" (or "compressed") directories this isn't relevant either. -........... - -I (MM) think R does never re-read things as long as search() is not -changed by library(), attach(), detach(), source(),.. -These calls are, BTW, given by ess-change-sp-regexp in ../lisp/ess-cust.el -(initialized by dialect specific ess--sp-regexp "defcustom"s). - -How are things working in ../lisp/ess-inf.el currently : - -o) ess-search-path-tracker is added to `comint-input-filter-functions' hook; - it just sets `ess-sp-change' to true when the above regexp triggers. - -o) Main user functions - - ess-complete-object-name and - + - ess-resynch {also sets ess-object-list to nil ..} - | call the "main work horse" - | - |-> ess-get-object-list either uses - | - |--> [V] ess-object-list or all the following - | - |-> ess-get-modtime-list {when one of the following var.s "says so"}: - | - |--> [V] ess-sp-change - |--> [V] ess-sl-modtime-alist - | - \-> ess-extract-onames-from-alist - | - |-> ess-dir-modtime - | - \-> ess-object-names - | - |-> - |-> [V] ess-object-name-db - | - |-> [V] inferior-ess-object-command - \-> ess-get-words-from-vector - | - \-> ess-command - | - |-> [V] ess-cmd-delay - | - \-> ess-prompt-wait diff -Nru ess-18.10.2/doc/newfeat.texi ess-18.10.2+git20220915.f45542e/doc/newfeat.texi --- ess-18.10.2/doc/newfeat.texi 2018-11-10 09:41:10.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/doc/newfeat.texi 2022-10-15 08:06:36.000000000 +0000 @@ -1,6 +1,246 @@ @comment @itemize @w{} @comment @item +Changes and New Features in 19.04 (unreleased): +@itemize @bullet + +@item ESS[R]: Add support for R projects and start R by default in the project folder. + +@item ESS[R]: Backticked symbols in the process buffer are no +longer fontified as strings. + +@item ESS[R]: @code{ess-command} now runs R code in a sandboxed environment. +Use @code{.ess.environment()} to inspect the current environment. + +@item ESS[R]: Added support for new syntax in R 4.0 and R 4.1. +This concerns raw strings, lambda functions, and the pipe operator. + +@item ESS[R]: Highlight error locations in rlang style backtraces + +@item ESS[R]: Fixed issue that caused ESS-help to hang when usage blocks +include R comments (#1025). Fix contributed by Bill Evans. + +@item ESS: New @code{ess-elisp-trace-mode} minor mode. +Toggle it to start or stop tracing all @code{ess}-prefixed functions +with @code{trace-function}. Tracing is useful for debugging background +ESS behaviour. + +@item ESS[R]: @code{ess-get-help-aliases-list} now caches the aliases +on the R side. This should speed up help lookup when the search path has +changed and the aliases are read again. + +@item ESS: @code{ess-command} now uses a default timeout of 30 seconds. +It should normally be avoided with long-running tasks because it causes +Emacs to block while the command is running. If the timeout is reached, +an error is thrown. An interrupt is also sent to the process in case of early +exit. + +This is a behaviour change: you will now have to explicitly opt in +blocking the whole Emacs UI for more than 30 seconds by supplying a +larger timeout (use @code{most-positive-fixnum} for infinity). + +@item ESS: @code{ess-wait-for-process} now returns nil if a timeout is +reached. + +@item ESS: @code{ess-get-words-from-vector} gains a @code{timeout} argument. + +@item ESS[R]: Fixed performance issue with argument completions. +The help summary for the argument is no longer displayed in the +echo area. This fixes delays and hangs (#1062). + +@item ESS[R]: @code{ess-command} is now more robust and resilient to hangs +and custom prompts (#1043). It also strips continuation prompts (@code{+} +prompts) automatically and reliably (#1116). + +@item ESS[R]: @code{ess-command} now handles sinked consoles correctly. + +@item ESS[R]: @code{ess-command} no longer changes @code{.Last.value}. +As a result, background tasks like completions no longer affect +the last value binding (#1058). + +@item ESS[R]: Namespaced evaluation is disable in roxygen examples (#1026). +Part of this change is that namespaced evaluation has become a +buffer-local rather than process-local setting (#1046). This makes it +possible to disable namespaced evaluation in specific buffers or +contexts. + +@item iESS: Inferior processes can now properly reuse frames (#987). +Fixed issue that caused the current buffer to be incorrectly displayed +in the new frame when @code{display-buffer} is set to pop up frames. + +@item ESS[R]: Better support for tramp. +Fixed package evaluation on remote servers with Tramp (#950); +process reloading (#1001); and an evaluation issue (#1024). +These fixes were contributed by David Pritchard. + +@item ESS[R]: Automatic offsetting of R process output is now disabled by default +because it produces undesirable output in some situations. To re-enable, +set @code{inferior-ess-fix-misaligned-output} to t. + +@item ESS[R]: Improved @code{xref} lookup (@kbd{M-.}). +Function locations are now always detected for package libraries listed +in @code{ess-r-package-library-paths}. + +@item ESS[R]: Evaluated lines starting with the Roxygen prefix +are now always stripped from the prefix, so they can be sent to the +process easily. Previously, this was only the case inside the +@code{examples} field. Since roxygen is switching to R markdown, it +becomes useful to evaluate chunks of R outside examples. + +@item stata support is now obsolete since we were unable to elicit +FSF paperwork from some of the original authors: see the lisp/obsolete +sub-directory on the ESS github repo + +@item @code{ess-set-working-directory} no longer changes the active +directory (as defined by the buffer-local variable +@code{default-directory}) of the buffer where the command is called. +Instead, the active directory of the inferior buffer is updated to the +new working directory. + +@item The default of ess-eval-visibly is now @code{'nowait}. +With this change you should no longer experience freezes while +evaluating code. + +@item ESS[R]: There is a new menu entry for reloading the R process. +It is otherwise bound to @code{C-c C-e C-r}. Reloading now reuses the +same process name and start arguments that were used to start the +process. + +@item iESS: Process runners now return the inferior buffer. +Note that callers of inferior runners should not assume that the current +buffer has been set to the inferior buffer. Instead, use +@code{with-current-buffer} with the return value of the inferior. + +@item iESS[SAS]: The SAS keymap was only set in iESS buffers +called `*SAS*`. This is now fixed. + +@item ESS[R]: Fixed longstanding indentation issues involving +@code{::} and @code{:::} operators. + +@item Implement a more reliable check for the process busy state. +Background actions such as completion and directory synchronization +should not block the process and should not cause printing of the +extraneous output to the interpreter. + +@item Activate @code{goto-address-mode} for url and email highlighting in inferior buffers. + +@item @code{smart-underscore} and @code{ess-smart-S-assign-key} have been removed. +Users who liked the previous behavior (i.e. underscore inserting ``<-'') +should bind @code{ess-insert-assign} to the underscore in their Emacs +initialization file. For example, @code{(define-key ess-r-mode-map "_" +#'ess-insert-assign)} and @code{(define-key inferior-ess-r-mode-map "_" +#'ess-insert-assign)} will activate it in all ESS R buffers. + +@item ESS major modes are now defined using 'define-derived-mode'. +This makes ESS major modes respect modern conventions such as having +-mode-hook and -mode-map. Users are encouraged to +place customizations under the appropriate mode. + +@item New option ess-auto-width controls setting the width option on window changes. +Users can change it to 'frame, 'window, or an integer. See the +documentation for details. @code{ess-auto-width-visible} controls +visibility. + +@item ESS now respects @code{display-buffer-alist}. +Users can now use @code{display-buffer-alist} to manage how and where +windows appear. For more information and examples, see @xref{Controlling +buffer display,,, ess}. + +@item @code{ess-roxy-mode} can now be enabled in non-R buffers. +This is primarily intended to support roxygen documentation for cpp +buffers. Preview functionality is not supported outside R buffers. + +@item ESS[R]: DESCRIPTION files now open in @code{conf-colon-mode}. + +@item @code{ess-style} now has effects when set as a file or directory local variable. + +@item @code{ess-default-style} is now obsolete, use @code{ess-style} instead. + +@item Options for 'ess-gen-proc-buffer-name-function' have been renamed. +ess-gen-proc-buffer-name:projectile-or-simple was renamed to +ess-gen-proc-buffer-name:project-or-simple and +ess-gen-proc-buffer-name:projectile-or-directory was renamed to +ess-gen-proc-buffer-name:project-or-directory. As the name suggests, +these now rely on project.el (included with Emacs) rather than +projectile.el, which is a third-party package. + +@item Eldoc fully honors @code{eldoc-echo-area-use-multiline-p} + +@item ESS[R]: @code{ess-r-rhub-check-package} gained new @code{RECOMMENDED}. + +@item ESS[R]: devtools commands ask about saving modified buffers before running. +Users can disable the questioning with @code{ess-save-silently}. + +@item ESS[R] help pages now provide links to other help topics. +This is similar with what you would see with, for example +@code{options(help_type = ``html'')} but works with the plain-text +version as well. This only works with @code{options(useFancyQuotes = +TRUE)} (the default). + +@item @code{ess-rdired} buffers now derive from tabulated-list-mode. +They should look better and be a bit faster overall. The size column +now displays object sizes in bytes. + +@item @code{ess-rdired} buffers now auto-update. +The frequency is governed by the new option +@code{ess-rdired-auto-update-interval}. + +@item ESS[R]: @code{electric-layout-mode} is now supported. +This automatically inserts a newline after an opening curly brace in R +buffers. To enable it, customize @code{ess-r-mode-hook}. + +@item ESS[R]: imenu now supports assignment with the equals sign. + +@item ESS[Rd]: Rd no longer writes abbrevs to user's abbrev file. + +@item ESS removed support for many unused languages. +This includes old versions of S+, ARC, OMG, VST, and XLS. + +@item ess-r-runner-prefixes was modified to find R-4 and later. + +@item ESS no longer activates eldoc if the user has disabled global-eldoc-mode. + +@end itemize + +The following have been made obsolete or removed, see their +documentation for more detail: + +@itemize @bullet + +@item Libraries for literate data analysis are obsolete and not loaded by default. +This includes @code{ess-noweb}, @code{ess-swv}, and related +functionality like @code{Rnw-mode}. Users are encouraged to switch to +one of several other packages that deal with these modes. For example, +polymode @url{https://github.com/polymode/poly-R/}, +@url{https://polymode.github.io/}, or markdown-mode with edit-indirect +@url{https://jblevins.org/projects/markdown-mode}. + +@item Support for @code{auto-complete} is obsolete. +The @code{auto-complete} package is unmaintained and so ESS support is +now obsolete. Users are encouraged to switch to @code{company-mode} +instead. + +@item User options for controlling display of buffers. +This includes @code{ess-show-buffer-action}, +@code{inferior-ess-same-window}, @code{inferior-ess-own-frame}, and +@code{inferior-ess-frame-alist}. See above about ESS respecting +@code{display-buffer-alist}. + +@item Variables @code{ess-tab-always-indent} and @code{ess-tab-complete-in-script}. +Use the Emacs-wide setting of @code{tab-always-indent} instead. + +@item @code{inferior-ess-*-start-file} variables. +All modes except Stata did not respect customization of this variable. +In order to load a file on startup, you should put a function on +@code{ess-*-post-run-hook}. + +@end itemize + +Bug Fixes in 18.10.3: +@itemize @bullet +@item More @file{Makefile} fixes, notably installing @file{*.el}s. +@end itemize + Bug Fixes in 18.10.2: @itemize @bullet @item @ESS{[R]} Fix namespace evaluation in non-installed packages. @@ -13,6 +253,7 @@ @itemize @bullet @item New functions @code{ess-eval-line-visibly-and-step} (@kbd{C-c C-n} and @code{ess-eval-region-or-line-visibly-and-step} (@kbd{C-RET}) which behave as the old versions of @code{ess-eval-line-and-step} and @code{ess-eval-region-or-line-and-step}. + @end itemize Changes and New Features in 18.10: @@ -34,13 +275,13 @@ If you update the autoloads (which installation from @code{package-install} does), you should not need to @code{(require 'ess-site)} at all, as autoloads should automatically load ESS when it -is needed (e.g. the first time an R buffer is opened). In order to -defer loading your ESS config, you may want to do something like +is needed (e.g. the first time an R buffer is opened). In order to defer +loading your ESS config, you may want to do something like @code{(with-require-after-load "ess" )} in your Emacs -init file. Users of the popular @code{use-package} Emacs package can -now do @code{(use-package ess :defer t)} to take advantage of this -behavior. @xref{Activating and Loading ESS,,, ess,} for more -information on this feature. +init file. Users of the popular @code{use-package} Emacs package can now +do @code{(use-package ess :defer t)} to take advantage of this behavior. +For more information on this feature, see @xref{Activating and Loading +ESS,,, ess,}. @item ESS now respects Emacs conventions for keybindings. This means that The @code{C-c [letter]} bindings have been @@ -72,8 +313,8 @@ options include @code{ess-use-flymake}, @code{ess-r-flymake-linters}, and @code{ess-r-flymake-lintr-cache}. -@item @ESS{[R]}: Gained support for xref in Emacs 25+. -@xref{Xref,,, emacs, The Gnu Emacs Reference Manual} +@item @ESS{[R]}: Gained support for xref in Emacs 25+ +@xref{Xref,,, emacs, The Gnu Emacs Reference Manual}. @item @ESS{[R]}: The startup screen is cleaner. It also displays the startup directory with an explicit @code{setwd()}. @@ -93,7 +334,7 @@ @item @code{ess-smart-S-assign} was renamed to @code{ess-insert-assign}. It provides similar functionality but for any keybinding, not just `_`. -For instance if you bind it to `;`, repeated invokations cycle through +For instance if you bind it to `;`, repeated invocations cycle through between assignment and inserting `;`. @item @code{C-c C-=} is now bound to @code{ess-cycle-assign} by default. @@ -130,7 +371,7 @@ @item @ESS{[R]}: @code{in} is now only fontified when inside a @code{for} construct. This avoids spurious fontification, especially in the output buffer -where `in` is a commond English word. +where `in` is a common English word. @item @ESS: Font-lock keywords are now generated lazily. That means you can now add or remove keywords from variables like @@ -184,7 +425,7 @@ The variable @code{ess-smart-S-assign-key} is now deprecated and will be removed in the next release. If you would like to continue using -`_` for insterting assign in future releases, please bind +`_` for inserting assign in future releases, please bind @code{ess-insert-assign} in @code{ess-mode-map} the normal way. @item @ESS{[S]}: Variable @code{ess-s-versions-list} is obsolete and ignored. @@ -196,7 +437,7 @@ Changes and New Features in 17.11: @itemize @bullet -@item The ESS initialisation process has been streamlined. You can now +@item The ESS initialization 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 @@ -233,10 +474,10 @@ @item @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 +Furthermore they are now correctly recognized when they are function definitions or function calls. @item @ESS{[R]}: Backquoted names and @code{%op%} operators are -recognised as sexp. This is useful for code navigation, e.g. with +recognized as sexp. This is useful for code navigation, e.g. with @kbd{C-M-f} and @kbd{C-M-b}. @item @ESS{[R]}: Integration of outline mode with roxygen examples fields. You can use outline mode's code folding commands to fold the examples diff -Nru ess-18.10.2/doc/onewfeat.texi ess-18.10.2+git20220915.f45542e/doc/onewfeat.texi --- ess-18.10.2/doc/onewfeat.texi 2018-11-10 09:41:10.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/doc/onewfeat.texi 2022-10-15 08:06:36.000000000 +0000 @@ -162,7 +162,7 @@ org-mode is required for this feature) @item @code{ess-execute} is now bound to @kbd{C-c C-e C-e} in @code{ess-extra-map}. @item completion works again in @code{ess-execute} -@item @ESS{[R]}: @code{head} and @code{tail} methods were replaced by @code{htsummary} in +@item @ESS{[R]}: @code{head} and @code{tail} methods were replaced by @code{.ess_htsummary} in @code{ess-R-describe-object-at-point-commands} @item @ESS{[roxygen]}: evaluation commands now work in roxygen blocks. Leading comments are automatically removed before the evaluation diff -Nru ess-18.10.2/doc/readme.aux ess-18.10.2+git20220915.f45542e/doc/readme.aux --- ess-18.10.2/doc/readme.aux 2018-11-10 09:41:24.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/doc/readme.aux 1970-01-01 00:00:00.000000000 +0000 @@ -1,39 +0,0 @@ -@xrdef{General Information-title}{General Information: README} -@xrdef{General Information-snt}{Chapter@tie 1} -@xrdef{License-title}{License} -@xrdef{License-snt}{Section@tie 1.1} -@xrdef{Installation-title}{Installation} -@xrdef{Installation-snt}{Section@tie 1.2} -@xrdef{Installing from a third-party repository-title}{Installing from a third-party repository} -@xrdef{Installing from a third-party repository-snt}{Section@tie 1.3} -@xrdef{General Information-pg}{1} -@xrdef{License-pg}{1} -@xrdef{Installation-pg}{1} -@xrdef{Installing from source-title}{Installing from source} -@xrdef{Installing from source-snt}{Section@tie 1.4} -@xrdef{Activating and Loading ESS-title}{Activating and Loading ESS} -@xrdef{Activating and Loading ESS-snt}{Section@tie 1.5} -@xrdef{Installing from a third-party repository-pg}{2} -@xrdef{Installing from source-pg}{2} -@xrdef{Activating and Loading ESS-pg}{2} -@xrdef{Check Installation-title}{Check Installation} -@xrdef{Check Installation-snt}{Section@tie 1.6} -@xrdef{Starting up-title}{Starting an ESS process} -@xrdef{Starting up-snt}{Section@tie 1.7} -@xrdef{Current Features-title}{Current Features} -@xrdef{Current Features-snt}{Section@tie 1.8} -@xrdef{Check Installation-pg}{3} -@xrdef{Starting up-pg}{3} -@xrdef{Current Features-pg}{3} -@xrdef{New Features-title}{New Features} -@xrdef{New Features-snt}{Section@tie 1.9} -@xrdef{New Features-pg}{4} -@xrdef{Reporting Bugs-title}{Reporting Bugs} -@xrdef{Reporting Bugs-snt}{Section@tie 1.10} -@xrdef{Reporting Bugs-pg}{8} -@xrdef{Mailing Lists-title}{Mailing Lists} -@xrdef{Mailing Lists-snt}{Section@tie 1.11} -@xrdef{Authors-title}{Authors} -@xrdef{Authors-snt}{Section@tie 1.12} -@xrdef{Mailing Lists-pg}{9} -@xrdef{Authors-pg}{9} diff -Nru ess-18.10.2/doc/readme.cp ess-18.10.2+git20220915.f45542e/doc/readme.cp --- ess-18.10.2/doc/readme.cp 2018-11-10 09:41:24.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/doc/readme.cp 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -\entry{README}{1}{README} diff -Nru ess-18.10.2/doc/readme.cps ess-18.10.2+git20220915.f45542e/doc/readme.cps --- ess-18.10.2/doc/readme.cps 2018-11-10 09:41:23.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/doc/readme.cps 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -\entry {README}{1} diff -Nru ess-18.10.2/doc/readme.log ess-18.10.2+git20220915.f45542e/doc/readme.log --- ess-18.10.2/doc/readme.log 2018-11-10 09:41:24.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/doc/readme.log 1970-01-01 00:00:00.000000000 +0000 @@ -1,280 +0,0 @@ -This is pdfTeX, Version 3.14159265-2.6-1.40.18 (TeX Live 2017) (preloaded format=pdfetex 2018.9.16) 10 NOV 2018 10:41 -entering extended mode - restricted \write18 enabled. - file:line:error style messages enabled. - %&-line parsing enabled. -**\input ./readme.texi -(./readme.texi -(/hg/s/linux/rhel3_amd64/app/teTeX/06.17/texmf-dist/tex/texinfo/texinfo.tex -Loading texinfo [version 2016-09-18.18]: -\outerhsize=\dimen16 -\outervsize=\dimen17 -\cornerlong=\dimen18 -\cornerthick=\dimen19 -\topandbottommargin=\dimen20 -\bindingoffset=\dimen21 -\normaloffset=\dimen22 -\txipagewidth=\dimen23 -\txipageheight=\dimen24 -\headlinebox=\box16 -\footlinebox=\box17 -\margin=\insert252 -\EMsimple=\toks13 -\groupbox=\box18 -\groupinvalidhelp=\toks14 -\mil=\dimen25 -\exdentamount=\skip18 -\inmarginspacing=\skip19 -\centerpenalty=\count27 - pdf, -\tempnum=\count28 -\lnkcount=\count29 -\filename=\toks15 -\filenamelength=\count30 -\pgn=\count31 -\toksA=\toks16 -\toksB=\toks17 -\toksC=\toks18 -\toksD=\toks19 -\boxA=\box19 -\boxB=\box20 -\countA=\count32 -\nopdfimagehelp=\toks20 - fonts, -\textleading=\dimen26 -\sffam=\fam8 - markup, -\fontdepth=\count33 - glyphs, -\errorbox=\box21 - -page headings, -\titlepagetopglue=\skip20 -\titlepagebottomglue=\skip21 -\evenheadline=\toks21 -\oddheadline=\toks22 -\evenfootline=\toks23 -\oddfootline=\toks24 - tables, -\tableindent=\dimen27 -\itemindent=\dimen28 -\itemmargin=\dimen29 -\itemmax=\dimen30 -\itemno=\count34 -\multitableparskip=\skip22 -\multitableparindent=\skip23 -\multitablecolspace=\dimen31 -\multitablelinespace=\skip24 -\colcount=\count35 -\everytab=\toks25 - conditionals, -\doignorecount=\count36 - indexing, -\dummybox=\box22 -\whatsitskip=\skip25 -\whatsitpenalty=\count37 -\entryrightmargin=\dimen32 -\thinshrinkable=\skip26 -\entryindexbox=\box23 -\delayedbox=\box24 -\interbox=\box25 -\secondaryindent=\skip27 -\partialpage=\box26 -\doublecolumnhsize=\dimen33 -\savedtopmark=\toks26 -\savedfirstmark=\toks27 -\balancedcolumns=\box27 - sectioning, -\unnumberedno=\count38 -\chapno=\count39 -\secno=\count40 -\subsecno=\count41 -\subsubsecno=\count42 -\appendixno=\count43 -\absseclevel=\count44 -\secbase=\count45 -\chapheadingskip=\skip28 -\secheadingskip=\skip29 -\subsecheadingskip=\skip30 - toc, -\tocfile=\write0 -\contentsrightmargin=\skip31 -\savepageno=\count46 -\lastnegativepageno=\count47 -\tocindent=\dimen34 - environments, -\lispnarrowing=\skip32 -\envskipamount=\skip33 -\circthick=\dimen35 -\cartouter=\dimen36 -\cartinner=\dimen37 -\normbskip=\skip34 -\normpskip=\skip35 -\normlskip=\skip36 -\lskip=\skip37 -\rskip=\skip38 -\nonfillparindent=\dimen38 -\tabw=\dimen39 -\verbbox=\box28 - -defuns, -\defbodyindent=\skip39 -\defargsindent=\skip40 -\deflastargmargin=\skip41 -\defunpenalty=\count48 -\parencount=\count49 -\brackcount=\count50 - macros, -\savedcatcodeone=\count51 -\savedcatcodetwo=\count52 -\paramno=\count53 -\macname=\toks28 - cross references, -\auxfile=\write1 -\savesfregister=\count54 -\toprefbox=\box29 -\printedrefnamebox=\box30 -\infofilenamebox=\box31 -\printedmanualbox=\box32 - insertions, -\footnoteno=\count55 -\SAVEfootins=\box33 -\SAVEmargin=\box34 - -(/usr/local.nfs/app/teTeX/texmflocal/tex/generic/dvips/epsf.tex -\epsffilein=\read1 -\epsfframemargin=\dimen40 -\epsfframethickness=\dimen41 -\epsfrsize=\dimen42 -\epsftmp=\dimen43 -\epsftsize=\dimen44 -\epsfxsize=\dimen45 -\epsfysize=\dimen46 -\pspoints=\dimen47 -\epsfnoopenhelp=\toks29 -) -\noepsfhelp=\toks30 - localization, -\nolanghelp=\toks31 -\countUTFx=\count56 -\countUTFy=\count57 -\countUTFz=\count58 - -formatting, -\defaultparindent=\dimen48 - and turning on texinfo input format.) -texinfo.tex: doing @include of ess-defs.texi - - -(/u/maechler/emacs/ess/ess-18.10.2/doc/ess-defs.texi) Chapter 1 -\openout0 = `readme.toc'. - - -(/u/maechler/emacs/ess/ess-18.10.2/doc/readme.aux) -\openout1 = `readme.aux'. - -@cpindfile=@write2 -\openout2 = `readme.cp'. - - -Writing index file readme.cp -texinfo.tex: doing @include of ../VERSION - -(../VERSION) -Underfull \hbox (badness 10000) in paragraph at lines 25--38 -@textrm ([][]@texttt maechler@stat.math.ethz.ch[][][]@textrm ) and Kurt Hornik -([][]@texttt Kurt.Hornik@R-project.org[][][]@textrm ) - -@hbox(8.2125+2.73749)x433.62, glue set 4.81291 -.@textrm ( -.@pdfliteral{0 0 0 rg 0 0 0 RG} -.@pdfstartlink(*+*)x* attr{/Border [0 0 0]} action user{/Subtype /Link /A << /S - /URI /URI (mailto:maechler@stat.math.ethz.ch)@ETC.} -.@texttt m -.@texttt a -.etc. - -texinfo.tex: doing @include of license.texi - -(/u/maechler/emacs/ess/ess-18.10.2/doc/license.texi) -texinfo.tex: doing @include of installation.texi - - -(/u/maechler/emacs/ess/ess-18.10.2/doc/installation.texi -texinfo.tex: doing @include of requires.texi - - -(/u/maechler/emacs/ess/ess-18.10.2/doc/requires.texi) -Missing character: There is no in font cmr10! -Missing character: There is no in font cmr10! -Missing character: There is no in font cmr10! - [1{/hg/s/linux/rhel3_amd64/app/teTeX/06.17/texmf-var/fonts/map/pdftex/updmap/p -dftex.map}] -Underfull \hbox (badness 8075) in paragraph at lines 46--50 -[]@textrm Alternatively, you may down-load the git repos-i-tory. ESS is cur-ren -tly - -@hbox(7.60416+2.12917)x433.62, glue set 4.3246 -.@hbox(0.0+0.0)x15.0 -.@textrm A -.@textrm l -.@textrm t -.@textrm e -.etc. - - -Underfull \hbox (badness 7722) in paragraph at lines 46--50 -@texttt https://github.com/emacs-ess/ESS.git[] @textrm will down-load it to a n -ew di-rec-tory - -@hbox(7.60416+2.43333)x433.62, glue set 4.26207 -.@texttt h -.@texttt t -.@texttt t -.@texttt p -.@texttt s -.etc. - -[2]) -texinfo.tex: doing @include of currfeat.texi - - (/u/maechler/emacs/ess/ess-18.10.2/doc/currfeat.texi [3]) -texinfo.tex: doing @include of newfeat.texi - - -(/u/maechler/emacs/ess/ess-18.10.2/doc/newfeat.texi [4] [5] [6] [7]) -texinfo.tex: doing @include of bugrept.texi - - -(/u/maechler/emacs/ess/ess-18.10.2/doc/bugrept.texi [8]) -texinfo.tex: doing @include of mailing.texi - - -(/u/maechler/emacs/ess/ess-18.10.2/doc/mailing.texi) -texinfo.tex: doing @include of authors.texi - - -(/u/maechler/emacs/ess/ess-18.10.2/doc/authors.texi) [9] ) -Here is how much of TeX's memory you used: - 3359 strings out of 497102 - 35690 string characters out of 6206773 - 76956 words of memory out of 5000000 - 4427 multiletter control sequences out of 15000+600000 - 32778 words of font info for 114 fonts, out of 8000000 for 9000 - 51 hyphenation exceptions out of 8191 - 16i,5n,16p,290b,631s stack positions out of 5000i,500n,10000p,200000b,80000s - -Output written on readme.pdf (9 pages, 116791 bytes). -PDF statistics: - 121 PDF objects out of 1000 (max. 8388607) - 100 compressed objects within 1 object stream - 22 named destinations out of 1000 (max. 500000) - 13 words of extra memory for PDF output out of 10000 (max. 10000000) - Binary files /tmp/tmpygwz1x8l/nasy0cgw6A/ess-18.10.2/doc/readme.pdf and /tmp/tmpygwz1x8l/8fYE79yjPk/ess-18.10.2+git20220915.f45542e/doc/readme.pdf differ diff -Nru ess-18.10.2/doc/readme.texi ess-18.10.2+git20220915.f45542e/doc/readme.texi --- ess-18.10.2/doc/readme.texi 2018-11-10 09:41:10.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/doc/readme.texi 2022-10-15 08:06:36.000000000 +0000 @@ -6,14 +6,13 @@ @include ess-defs.texi @node General Information -@comment node-name, next, previous, up @chapter General Information: README @cindex README This is the README file for the distribution of ESS version @include ../VERSION -ESS is a GNU Emacs and XEmacs mode for interactive statistical +ESS is a GNU Emacs package 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 @@ -71,19 +70,14 @@ @end menu @node License, Installation, General Information, General Information -@comment node-name, next, previous, up @section License - @include license.texi -@c vvvvvvvvvvvv node name *must* match the one in ./ess.texi ! @node Installation, Starting up, License, General Information -@comment node-name, next, previous, up @section Installation @include installation.texi @node Starting up, Current Features, Installation, General Information -@comment node-name, next, previous, up @section Starting an ESS process To start an @Sl{} session on Unix or on Windows when you use the Cygwin bash shell, simply type @kbd{M-x S RET}. @@ -92,31 +86,26 @@ use the MSDOS prompt shell, simply type @kbd{M-x S+6-msdos RET}. @node Current Features, New Features, Starting up, General Information -@comment node-name, next, previous, up @section Current Features @include currfeat.texi @node New Features, Reporting Bugs, Current Features, General Information -@comment node-name, next, previous, up @section New Features @include newfeat.texi @node Reporting Bugs, Mailing Lists, New Features, General Information -@comment node-name, next, previous, up @section Reporting Bugs @include bugrept.texi @node Mailing Lists, Authors, Reporting Bugs, General Information -@comment node-name, next, previous, up @section Mailing Lists @include mailing.texi @node Authors, , Mailing Lists, General Information -@comment node-name, next, previous, up @section Authors @include authors.texi diff -Nru ess-18.10.2/doc/readme.toc ess-18.10.2+git20220915.f45542e/doc/readme.toc --- ess-18.10.2/doc/readme.toc 2018-11-10 09:41:24.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/doc/readme.toc 1970-01-01 00:00:00.000000000 +0000 @@ -1,13 +0,0 @@ -@numchapentry{General Information: README}{1}{General Information}{1} -@numsecentry{License}{1.1}{License}{1} -@numsecentry{Installation}{1.2}{Installation}{1} -@numsecentry{Installing from a third-party repository}{1.3}{Installing from a third-party repository}{2} -@numsecentry{Installing from source}{1.4}{Installing from source}{2} -@numsecentry{Activating and Loading ESS}{1.5}{Activating and Loading ESS}{2} -@numsecentry{Check Installation}{1.6}{Check Installation}{3} -@numsecentry{Starting an ESS process}{1.7}{Starting up}{3} -@numsecentry{Current Features}{1.8}{Current Features}{3} -@numsecentry{New Features}{1.9}{New Features}{4} -@numsecentry{Reporting Bugs}{1.10}{Reporting Bugs}{8} -@numsecentry{Mailing Lists}{1.11}{Mailing Lists}{9} -@numsecentry{Authors}{1.12}{Authors}{9} diff -Nru ess-18.10.2/doc/refcard/refcard.aux ess-18.10.2+git20220915.f45542e/doc/refcard/refcard.aux --- ess-18.10.2/doc/refcard/refcard.aux 2018-11-10 09:41:25.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/doc/refcard/refcard.aux 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -\relax diff -Nru ess-18.10.2/doc/refcard/refcard.log ess-18.10.2+git20220915.f45542e/doc/refcard/refcard.log --- ess-18.10.2/doc/refcard/refcard.log 2018-11-10 09:41:25.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/doc/refcard/refcard.log 1970-01-01 00:00:00.000000000 +0000 @@ -1,223 +0,0 @@ -This is pdfTeX, Version 3.14159265-2.6-1.40.18 (TeX Live 2017) (preloaded format=pdflatex 2018.9.17) 10 NOV 2018 10:41 -entering extended mode - restricted \write18 enabled. - %&-line parsing enabled. -**refcard -(./refcard.tex -LaTeX2e <2017-04-15> -Babel <3.9r> and hyphenation patterns for 3 language(s) loaded. -(/hg/s/linux/rhel3_amd64/app/teTeX/06.17/texmf-dist/tex/latex/base/article.cls -Document Class: article 2014/09/29 v1.4h Standard LaTeX document class -(/hg/s/linux/rhel3_amd64/app/teTeX/06.17/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/rhel3_amd64/app/teTeX/06.17/texmf-dist/tex/latex/tools/multicol.st -y -Package: multicol 2017/04/11 v1.8q 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/rhel3_amd64/app/teTeX/06.17/texmf-dist/tex/latex/tools/verbatim.st -y -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/rhel3_amd64/app/teTeX/06.17/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/rhel3_amd64/app/teTeX/06.17/texmf-var/fonts/map/pdftex/updmap/pdft -ex.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: - 428 strings out of 494941 - 5850 string characters out of 6180918 - 92918 words of memory out of 5000000 - 3784 multiletter control sequences out of 15000+600000 - 6660 words of font info for 25 fonts, out of 8000000 for 9000 - 14 hyphenation exceptions out of 8191 - 23i,12n,17p,144b,290s 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/tmpygwz1x8l/nasy0cgw6A/ess-18.10.2/doc/refcard/refcard.pdf and /tmp/tmpygwz1x8l/8fYE79yjPk/ess-18.10.2+git20220915.f45542e/doc/refcard/refcard.pdf differ diff -Nru ess-18.10.2/doc/refcard/refcard.tex ess-18.10.2+git20220915.f45542e/doc/refcard/refcard.tex --- ess-18.10.2/doc/refcard/refcard.tex 2018-11-10 09:41:10.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/doc/refcard/refcard.tex 2022-10-15 08:06:36.000000000 +0000 @@ -3,6 +3,7 @@ \usepackage{parskip} \usepackage{verbatim} \usepackage{fullpage}% +- ok for paper 'A4' as well +\usepackage{textcomp}% added from \textasciigrave %\usepackage{svn}% and {fullpage} are both in debian/ubuntu pkg 'texlive-latex-extra' \addtolength{\textheight}{20mm} @@ -33,8 +34,8 @@ \smallskip - {\small updated for ESS 12.09-1}% {\footnotesize --- needs \em{more} updating!}} - \\[1ex] {\tiny September 2012} + {\small updated for ESS 18.10-3}% {\footnotesize --- needs \em{more} updating!}} + \\[1ex] {\tiny June 2019} % \footnotesize --- as of \today \end{center} % takes a lot of space @@ -54,13 +55,13 @@ \Sect{Interacting with the process} %% ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -For use in a process buffers ({\small inferior-ess-mode}): +For use in a process buffer ({\texttt{inferior-ess-mode}}): \begin{tabI} \texttt{\RET } & Send a command\\ \texttt{C-c \RET} & Copy old input\\ - \texttt{\TAB}& Complete object or file name.\\ - & Also bound to \texttt{M-\TAB}, \texttt{M-C-i}.\\ + \texttt{\TAB}& Complete object or file name\\ + %& Also bound to \texttt{M-\TAB}, \texttt{M-C-i}.\\ % seems to be obsolete \texttt{C-c C-c }& Break \\ \texttt{C-g} & interrupt Emacs' waiting for S\\ %% SfS-only (others need C-u C-a for comint-bol ! @@ -69,7 +70,9 @@ \texttt{C-c C-w }& Delete last word \\ % \texttt{M-C-r }& String search \texttt{C-c C-r }& Top of last output \\ - \texttt{C-c C-o }& Delete last output + \texttt{C-c C-o }& Delete last output \\ + \texttt{C-c C-n}& Next \hspace{1.4em} prompt \\ % moved from Transcript section + \texttt{C-c C-p}& Previous prompt \\ % moved from Transcript section \end{tabI} \begin{tabTit}{Command history (part of Menu `\texttt{In/Out}')} @@ -113,12 +116,12 @@ \Sect{Inside ESS Transcripts (I + O)} %% ~~~~~~~~~~~~~~~~ -Inside (\texttt{*.Rout} files): +Inside \texttt{*.Rout} files: \begin{tabI} - \texttt{\RET} & Send and Move \\ - \texttt{C-c C-n}& Next \hspace{1.4em} prompt \\ - \texttt{C-c C-p}& Previous prompt \\ + \texttt{M-\RET} & Send current line \\ + \texttt{\RET} & Send and move to next line \\ + \texttt{C-\RET} & Copy current line into ESS buffer \\ \texttt{C-c C-w}& Clean Region ($\mapsto$ input only) \end{tabI}\\[0.5cm] @@ -187,7 +190,7 @@ \Sect{General Commands} -\textbf{ess-doc-map} (\textbf{C-c C-d}): +\texttt{ess-doc-map} (prefix \texttt{C-c C-d}): \begin{tabI} \texttt{C-a, a} & \textbf{A}propos \\ @@ -199,7 +202,7 @@ \texttt{C-w, w} & \textbf{W}eb search (dialect dependent) \\ \end{tabI} -\textbf{\underline{ess-extra-map}} (\textbf{C-c C-e}): +\texttt{ess-extra-map} (prefix \texttt{C-c C-e}): \begin{tabI} \texttt{C-d, d} & Dump object into edit buffer \\ @@ -228,7 +231,7 @@ \begin{tabI} \texttt{SPC} & Next page \\ - \texttt{b, DEL} & Previous page (`\textbf{b}ack')\\ + \texttt{DEL} & Previous page\\ \texttt{n} & \textbf{N}ext section \\ \texttt{p} & \textbf{P}revious section \\ \texttt{s} & \textbf{S}kip (`jump') to a named section \\ @@ -237,35 +240,38 @@ \texttt{r} & Evaluate current \textbf{r}egion \\ \texttt{q} & \textbf{Q}uit window \\ \texttt{k} & \textbf{K}ill this buffer\\ - \texttt{x} & Kill this buffer and return (`e\textbf{x}it)\\ + \texttt{x} & Kill this buffer and return to ESS\\ \texttt{h} &\textbf{H}elp on another object \rule{0pt}{3ex}\\ \texttt{?} & Help for this mode \\ \texttt{a} & Display \textbf{a}propos\\ \texttt{i} & Display \textbf{i}ndex\\ \texttt{v} & Display \textbf{v}ignettes\\ \texttt{w} & Display this help in \textbf{w}eb bro\textbf{w}ser\\ + \texttt{/} & Search (also on \texttt{C-s})\\ \end{tabI}\\[0.5cm] \Sect{ESS tracebug} %% ~~~~~~~~~~~~~~~~ - Commands in \textbf{\underline{ess-dev-map}} (\textbf{C-c C-t}): + Commands in \texttt{ess-dev-map} (prefix \texttt{C-c C-t}): \begin{tabular}{p{20mm}l} \texttt{?} & Show key help \\ - \texttt{C-b, b}& Set BP (repeat to cycle)\\ + \texttt{b}& Set BP (repeat to cycle)\\ + \texttt{C-b, B}& Set conditional BP\\ \texttt{C-k, k}& Kill BP\\ + \texttt{C-K, K}& Kill all BPs\\ \texttt{C-n, n}& Goto next BP\\ \texttt{C-p, p}& Goto previous BP\\ - \texttt{`} &Show R Traceback (also on \texttt{C-c `}\\ - \texttt{\~} &Show R call stack (also on \texttt{C-c ~}\\ + \texttt{\textasciigrave} & Show R traceback (also on \texttt{C-c \textasciigrave})\\ + \texttt{\textasciitilde} & Show R call stack (also on \texttt{C-c \textasciitilde})\\ \texttt{C-e, e}& Toggle error action (cycle)\\ \texttt{C-d, d}& Flag for debugging\\ \texttt{C-u, u}& Un-flag debugged objects\\ \texttt{C-w, w} & Watch window\\ - \texttt{0..9, q}& Recover commands\\ + %\texttt{0..9, q}& Recover commands\\ % seems to be obsolete \end{tabular} - Commands in \textbf{\underline{ess-debug-mode-map}}\\ + Commands in \texttt{ess-debug-mode-map}\\ (active during debugging): \begin{tabular}{p{20mm}l} @@ -273,8 +279,8 @@ \texttt{M-N}& Next line\\ \texttt{M-Q}& Quit\\ \texttt{M-U}& Up frame\\ - \texttt{C-M-S-c }& Continue Multiple\\ - \texttt{C-M-S-n }& Next Multiple\\ + \texttt{C-M-S-c}& Continue Multiple\\ + \texttt{C-M-S-n}& Next Multiple\\ \end{tabular} \underline{\textbf{Others}} @@ -288,18 +294,62 @@ \columnbreak %% ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - \Sect{ESS developer} + \Sect{Package development} %% ~~~~~~~~~~~~~~~~ - Evaluate your code into the package (in \textbf{\underline{ess-dev-map}}: - \textbf{C-c C-t}): - + Evaluate your code into a given package (in \texttt{ess-dev-map}, prefix + \texttt{C-c C-t}): + + \begin{tabI} + \texttt{C-s, s} & Select package for namespaced evaluation\\ + \end{tabI} + + Keybindings in \texttt{ess-r-package-mode} (\texttt{C-c C-w})\\ + (call to \texttt{devtools} functions): + \begin{tabI} - \texttt{C-t, t} & Toggle developer on/off\\ - \texttt{C-a, a} & Add package to the dev list\\ - \texttt{C-r, r} & Remove package from dev list\\ + \texttt{C-b, b} & Build package (\texttt{devtools::build()})\\ + \texttt{C-c c} & Check package (\texttt{devtools::check()})\\ + \texttt{C-c w} & Check and build package with winbuilder \\ + & (\texttt{devtools::check\_win\_devel()})\\ + \texttt{C-c h} & Check and build package with R-hub \\ + & (\texttt{devtools::check\_rhub()})\\ + \texttt{C-d, d} & Document package (\texttt{devtools::document()})\\ + \texttt{C-i, i} & Install package (\texttt{devtools::install()})\\ + \texttt{C-t, t} & Run all tests (\texttt{devtools::test()})\\ \end{tabI} +%% All these commands seems to be obsolete: +%% \begin{tabI} +%% \texttt{C-t, t} & Toggle developer on/off\\ +%% \texttt{C-a, a} & Add package to the dev list\\ +%% \texttt{C-r, r} & Remove package from dev list\\ +%% \end{tabI} + + \Sect{Editing documentation} + + Inside \texttt{*.Rd} files: + + \begin{tabular}{p{25mm}l} + \texttt{C-c C-e} & Insert a template of help file\\ + \texttt{\TAB} & Indent current line\\ + \texttt{C-c C-f} & Prefix for font specifiers\\ + \texttt{C-c C-f \TAB} & Display list of font specifiers\\ + \texttt{C-c C-j} & Insert an `\texttt{\textbackslash item}' on next line\\ + \texttt{C-c C-n} & (in example section) \\ + & send current line to ESS process \\ + \texttt{C-c C-p} & Preview help file in plain text \\ + \end{tabular} + + For \texttt{Roxygen} users, inside \texttt{*.R} files \\ (prefix \texttt{C-c C-o}): + + \begin{tabI} + \texttt{C-o} & Insert an Roxygen template\\ + \texttt{C-c} & Add \texttt{\#\#\rq} prefix at the beginning \\ + & of all selected lines\\ + \texttt{C-r} & Parse R file and get Rd code\\ + \texttt{C-t} & Parse R file and preview help file \\ + \end{tabI} \end{multicols} diff -Nru ess-18.10.2/doc/requires.texi ess-18.10.2+git20220915.f45542e/doc/requires.texi --- ess-18.10.2/doc/requires.texi 2018-11-10 09:41:10.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/doc/requires.texi 2022-10-15 08:06:36.000000000 +0000 @@ -1,4 +1,4 @@ -ESS supports GNU Emacs versions 24.3 and newer. +ESS supports GNU Emacs versions 25.1 and newer. ESS is most likely to work with current/recent versions of the following statistical packages: R/S-PLUS, SAS, Stata, OpenBUGS and JAGS. diff -Nru ess-18.10.2/doc/TODO ess-18.10.2+git20220915.f45542e/doc/TODO --- ess-18.10.2/doc/TODO 2018-11-10 09:41:10.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/doc/TODO 1970-01-01 00:00:00.000000000 +0000 @@ -1,1320 +0,0 @@ - -*- indented-text -*- - -$Revision: 4.13 $ - - - The original TODO list (nothing fixed there yet): -=========================================================== - -The following things need to be fixed. In a very rough order of priority. - -* (DS) M-RET in *S* doesn't work properly with multi-line inputs. - -* (DS) Typing C-c C-d in an S-mode buffer can read the wrong file - (apparently the wrong value of S-directory is used.) - -* (DS) Maybe S-eval-region should do S-view-at-bottom, too - -* (DS) It would be nice to interpret a nil value of S-directory as the - default directory. - -* (DS) Add a predicate to control when S-object-list is dumped. It would - be nice to dump this only if an assignment has taken place or the - search list has changed. - -* (DS) C-u -1 C-c C-x C-c C-o produces odd results - -* (DS) Automate inferior-S-send-input to delay sending to the S process - until a complete command has been typed. (I.e. when presented with - an incomplete command, RET behaves like LFD). If this is done, - multi-line commands will always get into the history as one entry. - -* (DS) The menus need finetuning, and a binding to a keyboard key. - -* (DS) Need to decide on a sensible policy on csh-like history references. - At the moment, expanding such references is only possible from the - menu. - -* (DS) Need a keystroke to kill an edit buffer *and* the associated file. - -* (DS) Need a function to copy an object to a new object *and* copy - it's source file to a new source file, modifying the target of - the assignment. - -* (DS) Debugging support, through trace() and tprint() - -* (DS) Modify S-beginning-of-function so that, with arg n, will move out - n layers of nested functions. Wiht C-u arg, move to outermost - function definition - -* (DS) Rewrite the S-command and S-eval-visibly functions to use - transaction queues (so that we can really have S running in the - background) This is a big job. - -============================================================= -Here is the new set (a start for S-mode 5.0). -NOTE: Not all of these are clean OR are even consistent. --------------------------------------------- - -* (KH) Fix indentation for "{" in the GNU style... - - Kurt> * What I also find frustrating is that the GNU style does - Kurt> not get the indentation of `{' in: - Kurt> fun <- function(x, y, z) { - Kurt> right (in fact, the results of hitting TAB on the second - Kurt> line seem to vary). But it is not important. - -* (KH) It may be worth while replacing - ("^[>+]" . font-lock-keyword-face) - in R-inf-font-lock-keywords by - ("^[RS]?[>+]" . font-lock-keyword-face) - (or perhaps something even better assuming the coexistence of processes - called R, S, S on a system with the corresponding prompts. - - (MM) Yes, add "S4" to this list to get something like - - ("^[RS]?[1-9.]?[>+]" . font-lock-keyword-face) - - is not quite correct, since it includes ".3>" buth should rather - "R0.50>". - -* (KH) In R at least, asking for deletion of a file after loading it with C-c - C-l does not make sense. - - (MM) Yes! -- this has been a real pain, especially when the file was - version-controlled, it sometimes has just been deleted w/o asking ! - -* (KH) Also, there is no support for an Emacs-specific startup file. This is - not really important right now, I think, but anything based on comint - and term should support that. - - (Tony, if you look at my R-inf.el, you'll notice that some effort goes - into doing the right thing with output from startup args and files.) - -* (KH) The function S-complete-object-name() in S-inf.el currently - returns - - (or (comint-dynamic-simple-complete pattern components) 'none) - - with the comment `always return a non-nil value to prevent history - expansions'. Do you have an idea what that means? - - Is there any good reason to break the Emacs/Comint convention that a - completer should return a non-nil value only if it did successfully - complete? - - The specific reason why I ask is the following: - - S-inf does - - (setq comint-dynamic-complete-functions - '(S-complete-filename - S-complete-object-name - comint-replace-by-expanded-history)) - - I don't care about the last and prefer - - (setq comint-dynamic-complete-functions - '(S-complete-object-name - comint-dynamic-complete-filename)) - - Note the reversed order of filename and object name completions. I - think it makes more sense that way, because if I have the file - `anthony.dat' in my current dir and do - - anthony <- read.table("anthony.dat") - - then typing `ant TAB' at the R prompt should complete to `anthony' - as an object name, as I can always force the filename in the current - dir by `./ant TAB'. - - However, as S-complete-object-name() always returns a non-nil value, - the comint file name completion simply does not happen (well - ... that's at least what I think is the case ... but then also, what - is the point to have comint-replace-by-expanded-history() in the - list of completers, when it definitely will never be called - ... hmmm.) - - Please let me know what you think. My suggestion would be to simply - change the last 2 lines of the code for S-complete-object-name() to - - (comint-dynamic-simple-complete pattern components)))) - - and set comint-dynamic-complete-functions as I do :-) - - Well ... what I said was not quite right, as S-complete-object-name - also tries to do something about `./ant RET'. In any case, please - let me know what you think. - -* (AJR) Need an AUTOCONF for configuring Makefile, etc... - -* (AJR) Move S-extras into the mainstream distribution files and as an - S-site example. - -* (KH) So, need a "create-debian" entry in the Makefile. - -* (KH) MINOR REMARK: Currently, we have American and English spelling - together. If we want to change this, please add it to the TODO list. - -* (KH) MINOR REMARK: Some of the doc strings are not o.k. (first - sentence longer than one line ). We eventually need to fix this, - but perhaps not for 4.9. - -* (KH) Btw, why not have `M-x vista' too? - -* (KH) MAJOR REMARK I: - - The code for getting the `right' history file does not work. E.g., - when I start R and XLS in the same directory, they both use - .Rhistory. - - For a possible solution, see the novel below. - -* (KH) MAJOR REMARK II: - - The code - -(condition-case () - (load S-object-name-db-file) - (error - (message "%s does not exist. Consider running S-create-object-name-db." - S-object-name-db-file) - (ding) - (sit-for 1))) - - in S.el causes several problems. - - First, it produces an error in the byte-compilation process. I - noticed that you put an empty S-namedb.el in the distribution, but - that does not help if `nil' is not in the default load path - (because then the current directory is not searched), which I think - is the default. - - Second, there should obviously be different namedb for R and S. - (What I really mean is that the setting of S-object-name-db must be - a function of the implementation [have we officially decided on - using `dialect'?] used. Hence, the right thing most likely is to - execute the code not when loading S.el, but when it is clear which - process is started (assuming we have different namedb's for each - dialect). - - This could probably be as late as before inferior-S-mode-hook, but I am - not sure. - - (Note: currently this is not a problem for me, because I only have R, - but what does Martin do?) - -* (KH) NOVEL: - - So I spent several hours yesterday trying to figure out the right way of - solving our problems with local variables, in particular because Martin - explicitly asked me to do (only to find that the next morning Tony had - already done something about it ...). - - I think it is important to distinguish two kinds of variables that need - to be taken care of. - - ** One group is those variables which need to be known when the inferior - process is started (i.e., before the process and hence also its buffer - exist). - - Such variables are - *) dialect (currently transmitted through S-proc-prefix) - *) program name (`R' might be on the load path) - *) program args (such as for `-v 10' for R) - *) program startup file (currently unused) - *) program history file (???) - - ** The other group consists of those which are not needed for startup, - but need to have the right buffer-local values in the interaction - buffer, such as - - inferior-S-help-command - inferior-S-objects-command - - etc. - - The problem we have is that there is NO WAY of passing non-global - values to buffer-local variables in Emacs. Something like - - (defun R () - (let ((inferior-S-var value)) - (inferior-S))) - - does not set inferior-S-var to value in the interaction buffer if it is - local there. (Sort of static scoping.) - - There are several possible solutions: - - ** Keep manipulating the global name space using setq-default, as b4 - did. Of course, this is terrible, because it overrides defaults. - - ** Have one function which does something like - - (cond - ((eq S-dialect "R") - (setq ...)) - ((eq S-dialect "S4") - (setq ...)) - (t - (ERROR))) - - after calling make-local-variable() on the relevant variables, and wrap - the code into a function. - - To add a dialect, users would need to to this in there inferior-S-mode - hook, or to advise/change this function. - - ** Have a list similar to S-style-alist with settings for the variables, - and a function which sets them. This is similar to the above, but keeps - the code for the function and the variables separate. - - ** Have a dialect specific hook, e.g. - - inferior-S--mode-hook - - ** Keep manupulating a non-dialect-specific hook in the global name - space. This is what we currently do, and not `optimal' for the same - reason that using setq-default was not: If we think of inferior-S as - user function and S and R as simple wrappers, then calling these should - not modify the behavior of the generic function. - - I think the KEY to a clean solution lies in the observation that there - is really only ONE variable needed in both steps (i.e., cranking up the - process and setting local variables in the interaction buffer), and that - is the information about the CURRENT DIALECT (which I think is currently - kept in `S-proc-prefix'. We need to ensure that this variable has the - right local value to be able to run a specific hook (or a simpler hook - as explained above), and that it starts the right process in the right - buffer etc. - - To get that, we could either create a global variable, KEEP IT GLOBAL, - use let() in the wrappers, and assign to a local variable afterwards, or - (and I think this is the right thing to do) PASS THE DIALECT INFORMATION - AS AN ARGUMENT. I.e., we would have - - (defun inferior-S (&optional dialect n) - ... - - [NOTE: I am not sure about the optional `n', and whether this is used. - I think that users might want to have - - (defun R (&optional n) ...) - (defun S (&optional n) ...) - - and we are safe to give inferior-S the interface we want because it is a - NEW function anyway. We could also have it prompt for all relevant - variables if given a prefix ...] - - and have - - (defun R (&optional n) - (interactive) - (inferior-S "R" n)) - - Now the function inferior-S has the information it needs. It can figure - out the `right' startup settings (history file, program name and args) - based on the dialect information in the generic pre-run hook and perhaps - a dialect-specific pre-run-hook, and PASS THE DIALECT INFORMATION ON to - the function S-multi() [or whatever it will be called]. I.e., it could - be - - (defun S-multi (name &optional buffer dialect) ...) - - S-multi can now do - - (make-local-variable 'S-dialect) - (setq S-dialect (or dialect S-default-dialect)) - - and go on with the buffer-specific settings, again using the dialect - information as described above. - - [Yes, there should be a default dialect which is used when inferior-S is - used directly. Perhaps naming would be better with global S-dialect and - inferior-S-dialect as the local one ...] - -* (MM) My WISH: - I'm using ess-eval-region and friends very often. - - If the region has leading TAB, I think the readline feature of R, - does a huge 'completion ...' - which can completely destray the whole evaluation. - - ((Try C-c C-f from within a function that has a bit of indentation, - and therefore leading TABS (unless you 'untabified' it). - )) - - Yes, I'll have to 'untabify' things before I send it to *R*, but it's a - pain, anyway. - One could do 'untabify' in ess-eval-region & ess-eval-visibly - in ess-inf.el. - But actually this is not quite correct, - since I may have real TABs in a string - - nchar(" ") #-> 1 because it has one TAB - - which should not be converted to spaces. - - Hence my wish: - Write a function 'untabify-leading-white-space' - and apply it to the regions in ess-eval-region and ..-visibly. - -* (RMH) - - - 5. ess-s3-d.el - 63 ;;(if (string= ess-version-running "S3") - This comment seems inconsistent with ess-version-running. I think it should be - ;;(if (string= ess-version-running "S+3") - - - 7. ess-object-name-db-file - ess.el line 775. Why is this EVIL? A nuisance I understand, but EVIL? - Does the database get built automatically when ess-mode is installed? - That would be the right thing to do. Then individual users wouldn't need - to know about it all. - - - 10 ess.el lines 254-270 - This is one of the things I put in my site-start.el. I think this is - too complicated. I think that when item 2 of this note is corrected (that is - run the ess-pre-run-hook before the things that depend on it) then the nil - value will work as advertised and the comment beginning with the word - " Alternatively," will become completely unnecessary. - - (defvar ess-directory (file-name-as-directory (getenv "HOME")) - "*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. - Buffer-local: in process buffers, this contains the directory ess was - run from.") - ;; You can put something like: - ;; (setq ess-directory (file-name-as-directory (concat (getenv "HOME") "/ess/"))) - ;; in your ~/.emacs file and ess will always start up in your ~/ess directory. - - ;; Or you can say: - ;; (setq ess-directory nil) - ;; in your ~/.emacs file and ess will always start up in your current buffer's - ;; default directory. - - - [[[[ delete - ;; Alternatively, you can get ess to start up in the current buffer's directory - ;; by putting this in your .emacs - ;; (setq ess-pre-run-hook '((lambda () (setq ess-directory default-directory)))) - ;; Better (more correct) version: - ;; (defun ajr:ess-set-directory () - ;; "Set ess-directory to current directory." - ;; (setq ess-directory default-directory)) - ;; (add-hook 'ess-pre-run-hook 'ajr:ess-set-directory) - ]]]] - -* (RMH) From smode.cmt (from the S4 package): - - <-- AJR: some of these HAVE been done. --> - - - e. Problem - Working data will be in /usr/people/rmh/.Data - > !pwd - /disk5/rmh/smode - > - - Reason: - .Data has not yet been created in /disk5/rmh/smode - - Solution: - quit S, mkdir .Data, start again - Recommendation 1. Tell users in README to create .Data first. - Recommendation 2. Tell users in README about Info item - - User Option: S-directory - I for one always want the current buffer's working directory. - - - g. Question: - S-help does the following: - (S-command (format inferior-S-help-command object) tbuffer) - which seems to going through more work than is often necessary. When the - .Cat.Help subdirectory exists, why not just M-x find-file the help file? - - - - - 2. S3, Splus 3.3, S4 - - e. S-inf-font-lock-keywords - In inferior-S-mode the expressions below are in the indicated faces: - > tmp <- 1:3 # > is in font-lock-keyword-face - # rest is font-lock-variable-name-face - - tmp <- 1:3 # <- is in font-lock-reference-face - # rest is in default - - I don't understand why. - >From the definitions in S-inf.el, I expected that there would be - no dependence on the presence or absence of the leading prompt ">". - In particular, I anticipated that <- would be in font-lock-reference-face - with or without the prompt. - - - f. S-inf-font-lock-keywords - I recommend adding several keywords to S-inf-font-lock-keywords - for S3 and Splus 3.3 as noted in the attached s3.el and splus.el. - - - g. Interesting glitch - While fixing C-c C-l for S4, I found the following: - >From the *scratch* buffer, both the commands - (S-command "source(\"junk.s\")\n" (get-buffer "*S-errors*")) - (S-command "source(\"junk.s\")\n") - work correctly when junk.s is ok. - - The first one puts an error message in "*S-errors*" when junk.s has a - problem. But the second one loses the error message. I chose not to - investigate this further, since S-load-file uses the first form, and I - doubt any person would consider using the second. - - - 3. S4 changes - - a. S-mode.el [C-c C-l S-load-file] - - ;;; The S4 requires the fixes to - ; S-dump-error-re - ; S-parse-errors - ; S-prompt-wait - ;;; in my s4.el in order to respond correctly to syntax errors - ;;; during S-load-file. - ;;; Without these changes the system will freeze. - ;;; (^G will clear the freeze, and ^XB *S-errors* will - ;;; display the error message). - - - b. S.el and S-site.el - The variable S-version-running, defined in S.el, with the option to - revise in S-site.el, needs to be redefined to identify version 4. - Some of the items coded by S-version-running differ in Version 4. - - b1. S-inf.el - (setq inferior-S-search-list-command "searchPaths()\n") - ;;; This variable needs to depend on S-version-running. - ;;; the function inferior-S-search-list-command should probably use - ;;; inferior-S-search-list-command, but it actually has "search()\n" - ;;; hard-wired in. - - ;;; inferior-S-objects-command is the same for version 4 as for version 3 - - - b2. S.el - ;;; inferior-S-help-command - ;;; inferior-S-search-list-command - ;;; S-dump-error-re - Add a new line - ;;; inferior-S-objects-command - - - b3. S-help.el - ;;; S-submit-bug-report needs to know about version 4 for a bug report - ;;; to be useful. - - - c. Other changes in s4.el respond to changes in S4: - .Help is now __Help - Errors are now Problems - "Dumped" messages now become offers to Debug - Additional keywords should be fontified - - - d. I have placed S-namedb.el in $SHOME in my s4.el file. On further - reflection it should probably be in the $SHOME/library/emacs/ - directory. Question, does it make sense for S-namedb.el to be - distributed in $SHOME/library/emacs as part of binary.*.tar.gz ? - -* (RMH) - - Rather than have the site installer change the name of the directory, - it should be possible to find it out automatically. Here is the - relevant code from my spread.frame package. It assumes the user - started up spread.frames by typing - M-x load-file "/path/name" - It then finds the directory associated with that path and goes from - there. Some similar trick should be doable when the user does a - M-x load-library "name" - - - (defun find-spread-frame-directory nil - "Locate directory in which spread.frame functions are stored." - (list-command-history) - (set-buffer "*Command History*") - (goto-char (point-min)) - (search-forward "(load-file ") ) - (goto-char (1+ (match-end 0))) - (setq beg (point)) - (end-of-line) - (search-backward "/") - (goto-char (match-end 0)) - (setq spread-frame-directory - (expand-file-name (buffer-substring beg (point)))) - (kill-buffer "*Command History*")) - -* (daven@stille.llnl.gov (David Nelson)) - - Transcript mode is delightful, with one possible improvement. Quite - often, when I'm in the middle of a session, I'd like to insert a - comment in the transcript, preferably with a distinctive type face - like those provided by "font lock". Is there an easy way to do this - that I'm just missing? - - (RMH's thought): - - I'm writing to you rather than directly to daven@stille.llnl.gov - (David Nelson) because I'm not sure how to tell him to do the - following fix in .emacs or S-site.el because of the local variable - issue or if it even is the right fix. - - I think the permanent answer should be for you to add the lines - - (make-local-variable 'comment-start) - (setq comment-start "#") - (make-local-variable 'comment-start-skip) - (setq comment-start-skip "#+ *") - - copied from S-mode.el to the files S-trans.el and S-inf.el (4.8 - notation). But when I tried it out with M-x eval-expression in the - *S* buffer it didn't have the effect I anticipated. - - I can't figure out the intent or meaning of the line - ("^\\*\\*\\\*.*\\*\\*\\*\\s *$" . font-lock-comment-face) ; S-mode msg - from S-inf.el and S-trans.el - -* (KH, 010897) Can we combine the inferior-ess font-lock-patterns for prompt - and input into one regexp? I.e., use - - ("^\\([a-zA-Z0-9 ]*[>+]\\)\\(.*$\\)" - (1 font-lock-keyword-face) ; prompt - (2 font-lock-variable-name-face keep t)) ; input - - -* (KH, 010897) Perhaps one could have an option to install the Info - files gzipped (as is default for e.g. Debian GNU/Linux). - -* (RMH bad behavior) - I loaded ess-site from *shell* in directory ~/ - Then I M-x S from that buffer. It asked me about starting S in ~/ - The with in *shell* I cd /disk05/rmh and M-x S from *shell* again. - I think it should have attempted to start S from /disk05/rmh, but instead it - again asked me about starting S in ~/ - -* (AJR/RMH) make sure that font-lock stuff is properly set. (look into - file order, for example). - -* (AJR) Kurt> * When first starting R and then XLS, we have - - Kurt> ess-history-file's value is ".Rhistory" Local in - Kurt> buffer *R*; global value is ".XLShistory" - - Kurt> Why is there a non-nil global value? - - > Because of the nature of buffer-local variables. It doesn't really - > matter, since I'm ALWAYS ignoring the global value (at least that is - > my intent). - -* (MM) Date: Fri, 22 Aug 1997 09:11:25 +0200 - - >>>>> "Kurt" == Kurt Hornik writes: - - >> * Questions: 1. I don't understand why ess-customize-alist is not - >> buffer-local (This definition is from ess-vars.el.): (defvar - >> ess-customize-alist nil "Variable settings to use for proper - >> behavior. Not buffer local!") ;;(make-variable-buffer-local - >> 'ess-customize-alist) ;;(setq-default ess-customize-alist nil) - - Kurt> Personally, I think that most of the (make-variable-buffer-local - Kurt> ...) and (setq-default ...) will have to be replaced eventually - Kurt> by making the variables local when needed and passing them not in - Kurt> the global environment but rather as explicit arguments to the - Kurt> caller functions. - - Kurt> E.g., - - Kurt> (ess-start-process NAME BUF FILE ARGS ALIST) - - This is cleaner from a programming point of view, - however is n't this much less CPU efficient ?? - - >> 3. Should ess-proc-prefix be renamed to ess-language? I glanced at - >> the result of 'grep ess-proc-prefix *.el' and don't immediately see - >> a problem. - - Kurt> Yes, good idea. Could we then have - - Kurt> ess-language ess-dialect - - Yes, this looks like the thing to aim at !! - Together with what Kurt wrote in the last e-mail's PS: - - Kurt>>> PS. We should decide on a scheme for languages (S, XLS, ...) - Kurt>>> and what we call ``dialects'' (for S: S3, S4, S+, ..., R). - Kurt>>> This would allow us to have a general mechanism for dealing - Kurt>>> with the above, such as - Kurt>>> - Kurt>>> * In the caller function (M-x S, M-x R, ...) set language and - Kurt>>> dialect. - Kurt>>> - Kurt>>> * Then, we don't explicitly have to assign all variables which - Kurt>>> should be local (such as font-lock-keywords) anyway, but could - Kurt>>> figure them out by - Kurt>>> - Kurt>>> looking for -font-lock-keywords looking for - Kurt>>> --font-lock-keywords - Kurt>>> - Kurt>>> Hooks could be organized similarly - Kurt>>> ... (ess-inf-S-S4-mode-hook?) - - -* (RMH 31 Jul 1997 07:22:10 -0400 or earlier) - - * what it doesn't do 1. The effect of the second line is to prevent - * font-lock information from happening on input lines. The prompt - * is highlighted, the rest of the line is not. The effect is to - * cancel the usefulness of syntax highlighting on user-typed - * commands. Syntax marking is only in effect when the system types - * a function back to us. - - 2. I can't figure out what the ess-mode msg line is doing. - ("^\\*\\*\\\*.*\\*\\*\\*\\s *$" . font-lock-comment-face) ; ess-mode msg - - 3. comments (beginning with #) are syntactically ignored by - highlighting. In ess-mode, comments are not picked up with this - table (actually ess-mode-font-lock-keywords). They are picked up by - ess-mode-syntax-table on line 733 of ess-vars.el. - - 4. what are the < > characters doing in this line: - ("\\<\\(TRUE\\|FALSE\\|T\\|F\\|NA\\|NULL\\|Inf\\|NaN\\)\\>" - . font-lock-type-face) ; keywords - - - * open questions - - 1. I think I want ess-mode-font-lock-keywords to be effective in - inferior-ess and in ess-transcript. That means to the user, the <- - and function and T and F will be highlighted as commands are typed - in. - - 2. That means to the ess-mode designer that the line - ("^[a-zA-Z0-9 ]*[>+]\\(.*$\\)" - (1 font-lock-variable-name-face keep t)) ; input - is deleted from inferior-ess-font-lock-keywords. - - 3. Further it means that inferior-ess-font-lock-keywords should be - defined by adding additional definitions to - ess-mode-font-lock-keywords. - - - * harder questions - - 1. these keywords are hardwired. They should probably be put into - the *-customize-alist. In particular, S4 uses different keywords - for errors (problems) and so forth. It also uses different keywords - for the Help file (__Help instead of .Help). These are functional - differences, not just cosmetic differences where the font would be - wrong. See the comments in ess-s4-d.el (based on my original s4.el). - (just noticed, the current ess-s4-d.el has two ending pages.) It is - easy to make ess-mode work for S4 by overriding all the differences - (which is how s4.el works). It is harder to do it cleanly so the - same emacs session can be used for S4 and S3. Lots of currently - hardwired variables need to be moved to the *-customize-alist first. - xlispstat is quite differently structured, so I am sure that the - keywords and highlighting here will be either irrelevant or harmful - if applied directly. customization is needed for that generality as - well. - - * comments - - I'm confused? I've always gotten comment highlighting in - inferior-ess/S-mode. Or do you mean that it's not done in the right - place? - - correct, it is not done where you think it is done (right place or - not). It is done by ess-mode-syntax-table for inferior and - transcript mode. It is not done at all for ess-mode. The font-lock - settings seems to be irrelevant. - - * logic - Richard> 4. what are the < > characters doing in this line: - Richard> ("\\<\\(TRUE\\|FALSE\\|T\\|F\\|NA\\|NULL\\|Inf\\|NaN\\)\\>" - Richard> . font-lock-type-face) ; keywords - - using the typeface for the inequalities, for boolean statements/tests. - - Not so. The < > do not appear in font-lock-type-face. - - * Hmm... I think that was the font that was to be used for the prompt. - - Not so. The previous line is used for the prompt. This line seems - to be used to suppress font-lock control for all characters - following the prompt. Note that the (1 ...) is in the position - normally taken by the "." . I assume the keep makes it stay that - way for the rest of the line. I haven't bothered to read font.el to - figure this out. - - - * *Buffer List* - . text.st 0 ESS Transcript /disk05/rmh/text.st - test.r 0 ESS[R] /disk05/rmh/test.r - test.s 0 ESS[S] /disk05/rmh/test.s - * *S4* 236 Inf-ESS - - Note that the *.r and *.s files include the [R] and [S]. The - inferior processes do not include the ess-version-running, I wish - they would. The corresponding modelines are - - (ESS Transcript [] Font) - (ESS[R] [none] Font) - (ESS[S] [none] Font) - (Inf-ESS [S4]: run Font) - - I don't know the original intent of the [] and [none], but I would - love to see the name of the buffer to which ^C^N is sending stuff. - - - * ^C^N goes to the wrong inferior process. - - I opened test.r in the same directory as *R* and sent a line. It - went to the *S* buffer in a different directory and running the - wrong program. There needs to be a way for the system to ask me - which process to use. Also, it's default guessing system should - have guessed *R* based on the file name test.r. - - - - * hooks - - in ess-vars.el, line 317 and following, some of the hooks are - initialized to '() and others to nil. Is there a difference? - - - * ess-source-modes in ess-vars.el line 382 - Is this obsolete now that auto-mode-alist has the suffix information? - - -* (AJR, via MM, RMH, DB): distinguish between files of dumped objects - and files of loading objects. - -* (RMH/AJR) - Richard> essl-sas.el - Richard> SAS-log-mode - - Richard> As present, SAS-log-mode doesn't do anything but be - Richard> human-readable. My intent in basing it on - Richard> ess-transcript-mode rather than on fundamental-mode is - Richard> that when sas-clean-region and related functions are - Richard> figured out, then the log file can be used to re-enter - Richard> commands back to *SAS:1*. We will look for all numbered - Richard> lines between a - Richard> 34 PROC abcd; - Richard> ... - Richard> 38 run; - Richard> pair, sas-clean-region them and send them over to - Richard> *SAS:1*. This is NOT an exercise for 5.0. But because - Richard> it is intended, I feel (weakly, not strongly) that it - Richard> would be better to base SAS-log-mode on - Richard> ess-transcript-mode. This plan should be formally - Richard> entered into the TODO list. - - I would agree with this. I'd also like to make sure that we have a - means of easily going between linked buffers. Added into the TODO - list. - - Richard> While we are entering things in the TODO list, I would - Richard> like to consider setting up *SAS:n* as a unix pipe, - Richard> rather than as a unix buffer/file. I don't know how to - Richard> tell emacs to do that. The idea is to mimic the behavior - Richard> of the SAS edit window where, once the Submit menu item - Richard> has been clicked, the window is emptied. - - No, I think that using as a buffer would be better (especially for - debugging any weird problems). Hiding it, though, will be desirable. - - Richard> I can also see a case for leaving the *SAS:n* buffer as a - Richard> buffer. We should consider making it read-only to force - Richard> the user to do all thinking in the ex123.sas buffer. The - Richard> only reason I can currently think of for letting the user - Richard> write directly in the *SAS:n* buffer is to enter the - Richard> commands - Richard> stop; - Richard> or - Richard> endsas; - Richard> I can't think of any reason to save the *SAS:n* buffer - Richard> and would like to know if there is any way to prevent the - Richard> user from saving it. - - and not even that, since that should be the result of C-c C-q, so - that we get a nice, uniform means of exiting. - - (RS1) I don't believe the sas-log-mode suggestions were ever implemented. - In fact, sas-log-mode is not a default option anymore since there - are so many different applications that create .log files. - Instead, a few changes were made to sas-mode based on requests for syntax - highlighting of the .log. This feature can be toggled on and off - by F10. This temporarily turns on sas-mode for .log files so you will - not experience permanent extension collisions with other .log file - generating applications. Also, performance may be an issue. - Extremely long .log files (particularly those generated by macros - that involve alot of code-generation) can be extremely time-consuming - to fontify and lazy-locking is usually not an option due to the - complexity of the SAS regular expressions. Fast-locking may help a - bit, but font-locking of several minutes is not unheard of. - Also, the font-lock code was re-written to properly highlight either - a .sas or a .log file. See ess-sas-run-make-regexp below. - - (RS2) Rich re-did sas-log-mode to use the font-locking from ESS[SAS] and - it seems to be working. The only caveat is that I found that - fast-lock is very slow for big .logs and I switched to lazy-lock - and it is much faster, however, I have problems toggling; usually, - after I turn it on, I can't turn it off; but, that's not so bad - with lazy-lock. Also, a new function creates transcript from - your .log, ess-sas-transcript - -* (KH) Font-lock needs to be more intelligent about recognizing - reserved words in non-reserved contexts (such as in "strings"). - (RS1) If this was a SAS problem, then problem has been fixed. - To turn on the new functionality, - (setq ess-sas-run-make-regexp nil) - - (RS2) This is now the default and most known issues have been addressed; - even hanging then statements! - -* (AJR) SAS indenting needs to be fixed. - - (RS) I don't know if this was fixed, but I haven't had any problems - with indenting recently. - -* (KH) explicit statement: - - I have only one remark (one of my usual ones). I'd like to be able to - pass command line arguments to the inferior process when it is started. - This is currently not supported, and poses some difficulties with an - interactive prompt mechanism. (Also rules out my suggestion of using - C-u to force prompting for command line args.) - - Hmm ... Perhaps we should have a variable (ess-inf-always-prompt-...) - to get around this problem? - -* (RMH - SAS) - graphics are possible in two ways: - a. proc gplot; plot a*b / vpos=25; - b. goptions device=psfile; - filename gsasfile 'temp.ps'; - and then use ghostview from another *shell* buffer. - - autoexec.sas defines the departmental printers and turns off - overprinting. My autoexec.sas file is: - - libname gdevice0 '/home/public/stat/gdevice0' ; - options noovp; - -* (RMH - SAS) I have another proposal for font-lock in SAS-mode. I - think it will be easy, but I would like discussion first. My new - proposal is that - - proc whatever - data myfile - %macro macname - - and maybe a few others (including both the keyword and name of the - dataset or proc) be in font-lock-function-name-face - - %include will be in font-lock-reference-face - - Any other FIRST word in a statement will be in - font-lock-keyword-face - - My reasoning is that the current laundry list is too long, and still - misses many keywords. The structure of the SAS language is - essentially keyword and arguments, so let's follow that. - (RS) Essentially done. The following statements are in - font-lock-reference-face: macro statements, PROC ..., - DATA, RUN, ENDSAS, and QUIT. - See ess-sas-run-make-regexp above. - -* (Tobias Laatsch - SAS) - There seem to be some problems fontifying SAS Comments in ESS 5.0 - Pre1. (I'm running xemacs 20.2 on AIX .) - Currently I recognized following problems: - 1) Multi-line-comments are not fontified. (open comment "/*", some - lines of code, close comment "*/") - 2) When typing / , " or ' in a comment-area, ESS fontifies the - whole line as normal code instead of comment. - 3) Typing a '* in a comment-area fontifies the rest of the line as - string. - (RS) Fixed for /* */ style comments which are now handled by grammar - only. * ; and %* ; are still broken since they can't be - specified by grammar. - -* (AJR) - Richard> I think of S-transcript-mode as identical to - Richard> inferior-S-mode except that the transmission is to the - Richard> same buffer in inferior-S-mode and to a different buffer - Richard> in transcript-mdoe. So I expect ^M (enter) to behave - Richard> normally for lines that begin with "> command" and "+ - Richard> continuation". - - Which is what my proposal does (send command, move to next prompt). - - What needs to be modified is that currently, it moves to any next - prompt, including "+ ", rather than just to the next primary prompt -- - it is smart enough to strip the "+ " as well from the whole command, - and collect the rest of the command line. - - Richard> I haven't tried eval-region commands from either *S* or - Richard> from a filename.st. I think both ^C^N and ^C^R should - Richard> make sense and work if the region is valid input. Both - Richard> modes should strip leading ">" and "+" characters. I - Richard> think that a region which is a subset of a line, or which - Richard> doesn't begin with the standard prompt sequences, should - Richard> send it over literally. - - So, C-c C-r would only send lines beginning with - inferior-ess-primary-prompt (up to the last consecutive - inferior-ess-secondary-prompt), strip off the prompt, and ignore lines - which do not begin with prompts. Does this sound correct - (for C-c C-r)? - - C-c C-n should be correct (comint-next-prompt). - -* (KH/AJR) - I see. This is what the "help(\"%s\")\n" does. - - Well, we have the following problem. The `new' interface to help() - I created is - - help(topic, package = .package(), library = .lib.loc) - - This allows you to get help on a topic (R object, ie fun or var or - whatever else is documented) in a package without loading it, via - - help(topic, p = PKG) - - I've eliminated the help(data = ) part, but there may soon be - another argument to search for keys ... - - If we want people to be able to use the extended forms, we can - - * use "help(%s)\n" for the format, which means they have to quote - special things as they would need to from the command line - - * or do something smarter, such as - quote only if object does not contain "," - which appears to be the right thing. - - What do you think? - - > How about this 3rd alternative? - - > C-c C-v works as usual - > C-u C-c C-v prompts for the extra arguments (a "wizards - > help", of sorts) - - > Completion will only work with the prompt for the command, and will be - > turned off for the others? - - > If not, we'll go with the "right thing" (option 2). - - The alternative sounds good. We might still want to quote the help - string in case it does not contain a `,', so that C-c C-v + - continues to work ... - -* (RMH) His (Tom Cook's) sas-get-dataset is a very good idea and was - not in my proposal. I would do it using the same mechanism that - S-help uses to put the results of ?function into *help(function)* - buffer. It is a relative of ess-dump-object-into-edit-buffer. The - major difference is that there is no sense of editing the object and - sending it back to S. It is also a relative of the display of a - spred.frame, with the difference again that there is no sense of - editing the object. - - I like the switch-to-sas* functions. I would like to generalize - them back to S. I think switch-to-S-source when entered from the - *S* buffer should go to the filename.s that was the most recent - sender of ^C^N or ^C^R. - - Here is cook's sas-mode-map and how it fits with my ess-sas-d.el - - "\C-c\C-i" 'indent-sas-statement) \t use recommended conventions - "\C-c\C-a" 'beginning-of-sas-statement) use - "\e\C-a" 'beginning-of-sas-proc) \M-\C-a - "\e\C-e" 'next-sas-proc) \M-\C-e - "\C-cs" 'switch-to-sas-source) use - "\C-cS" 'switch-to-sas-source-other-window) use - "\C-cg" 'switch-to-sas-log) use - "\C-cG" 'switch-to-sas-log-other-window) use - "\C-cl" 'switch-to-sas-lst) use - "\C-cL" 'switch-to-sas-lst-other-window) use - "\C-cr" 'run-sas-on-region) ^C^R - "\C-c\C-l" 'submit-sas) ^C^B or ^C^L - "\C-cd" 'sas-get-dataset) use - "\C-c\C-c" 'switch-to-sas-process-buffer) ^C^Z or ^C^Y - - (RS) Can't comment on the S aspects, but you can now browse/edit a permanent - SAS dataset (provided the library definition appears in autoexec.sas) - with F9. - -* (AJR) REWRITE INFERIOR-ESS (AJR, for 5.1 series). - -* (RMH) Add explicit directions on installing or using dir for info. - Makefile ; for 5.0 - line 96 of pre5/Makefile included dir. - dir does not appear in lastpre/Makefile. - dir does not appear at all in the directory. - You did include instructions on line 194 on editing dir. - dir is needed for the info system to get ess into its menu. - Please include the sample dir (below) and instructions on - editing site-start.el. - I have the following in my site-start.el - ;; - (defun add-info-path (newpath) - (setq Info-default-directory-list - (cons (expand-file-name newpath) - Info-default-directory-list))) - - (add-info-path "/disk05/local/teTeX/info/") ; stat dept - (add-info-path "/disk05/local/emacs/S-mode/") ; stat dept - (add-info-path "/disk05/local/info/") ; stat dept - ;; - - Here is my 5 line dir file from S-mode 4.8. It needs to be - updated to 5.0. The first line is blank. I think the blank - line is required, although it might be there only for - appearance when the info menu comes up. - -  - File: dir Node: Top This is the top of the INFO tree - * Menu: The list of major topics begins on the next line. - * S-mode: (S-mode). S-mode Version 4.8 - - - This works correctly in Emacs 19.29. My memory says that when - I was playing with XEmacs a few months ago, the add-info-path - didn't work correctly in XEmacs. Only the first and last - items on the Info-default-directory-list actually got - displayed. - -* (RMH) >From here on is NOT for 5.0 - - ess-create-object-name-db and ess-load-object-name-db-file - 1. e-load-* doesn't ding if not there. good - 2. I entered e-create-* manually and it did its job, creating - ess-s+3-namedb.el - in my home directory. Then I did a name completion and ESS - redid the entire set of searching the directories. - 3. mv ess-s+3-namedb.el to ESS-5.0/ - 4. Quit emacs and start over - 5. Then I did a name completion and ESS redid the - entire set of searching the directories. - 6. Quit emacs and start over - 7. Manually M-: (ess-load-object-name-db-file) - 8. Then I did a name completion and ESS redid the - entire set of searching the directories. - -* (RMH) buffer choice (questions for 5.1) - I opened lots of simultaneous processes. - The q() from *R*. - Then M-x XLS - XLS came up in the *R* buffer - - Tried it again. This time I C-c q() from *S4*. - Then M-x S - S+3:3 came up in *S4* buffer. - - This is obscure stuff. What really should happen? - - Problem in inferior-ess: logic states that if the current buffer is - iESS or ESS-trans, and doesn't have an active process, use it, - instead of creating a new buffer. (AJR). - -* (RMH) - * iESS [S+3] 5.0? 5.1? - 'single quotes' are in regular font - "double quotes" are in quote font - This differs from ESS[S] mode in which both kinds of - quotes are in quote font. - - Should be fixed in 5.0 if easy. Not obvious to me where - the problem is. The identical S-syntax-table is in use - in both iESS [S+3] and ESS[S]. The font-lock-keywords - don't seem to me to be the problem. - - -* (RMH) - Dumped problem in S+3 - Here is an example of the Dumped font problem in S+3: - - > "trellis.settings" + "x + z + abcdefghij + klmnopqrstuv" - Error in "trellis.settings" + "x + z + abcdefghij ..: Non-numeric first operand - Dumped - > - - Note that the Error description from S+3 truncates the command and - adds the ".." to indicate the truncation. Part of what gets - truncated is the closing quotation mark. Hence everything from that - point on is still inside the opening quotation mark. Everything - includes the rest of the error description, the word "Dumped", the - prompt on the next line, and all succeeding commands. I normally go - back and edit the line by adding the closing quote in front of the - prompt - - Dumped - "> - - I would love for iESS [S+3] to monitor the word "^Dumped" and make sure the - font is back to regular. - - - * On the Dumped ".. font problem - I have an answer that I am uncomfortable with. - The problem: - Error in "trellis.settings" + "x + z + abcdefghij ..: Non-numeric - first operand - Dumped - - Potential Solution: - a. Look for the pair "Error in" and "Dumped" - b. Verify the number of uses of '"'. - c. Insert an extra '"' if needed after the ".." and before the ":", thus - Error in "trellis.settings" + "x + z + abcdefghij ..": Non-numeric - first operand - - My discomfort is that we are then modifying the output, not just - highlighting it. - -* (BR) Scripts in S-PLUS 4.x provide quite similar functionality to - the ESS front-end, and are worth investigating. - -* (Duncan Murdoch, on IDEs): - - I don't understand the details of what you're saying, but for an - example of a very good IDE, you should look at Borland Delphi, - version 3. It has some very nice features: - - - at any point, you can ask to see a list of legal identifiers to - insert. These are presented in order from most to least local, so - usually the one you want is near the top. The IDE knows enough - about the syntax of the current line to only suggest things that - would be legal there. - - when you type a dot (more or less equivalent to $ in S), you're - presented with a list of fields and methods for the object or record - you're working with. - - you can point at any identifier and hit a key for the help for that - identifier. Because it's an object oriented system, there are often - multiple different methods with the same name; the IDE picks the - appropriate one by the context. - - Other unrelated things that Delphi does nicely which Splus would do - well to emulate: - - - you can ask for a new object of a specific type, and it will insert - appropriate skeleton code for it. - - the object browser is quick and convenient to use! Of course, the - objects in Delphi tend to be quite different from the objects in - S... - - it has lots of nice visual design tools for writing user interface - code. - -* Bob_Dorazio@usgs.gov (Bob Dorazio) on IDEs: - - I have no experience with emacs, but in response to your question - take a look at Watcom's IDE for C++. This IDE is the best I have - ever seen! The source code editor is fantastic and the level of - integration between the source code editor, the compiler, the - debugger, and the utility for "building" executables or libraries - surpasses that of any other IDE I have used. - -* From: Sandy Weisberg -Subject: Re: ESS 5.1.14 supports ARC -To: rossini@biostat.washington.edu -Date: Thu, 6 Jul 2000 09:42:19 -0500 (CDT) - -The name of the program is Arc, capitalized because it is a proper name, but -otherwise a normal English language word. - -Thanks for asking! -> -> Thanks to Doug Bates' prodding, ESS 5.1.14 (Emacs Stat interface) -> released an hour ago, works with ARC). -> -> Should it be referred to by "ARC" or "Arc" (or?) in the ESS -> documentation (which still needs to be written)? -> - -* From: Sven Garbade[SMTP:garbade@psy.uni-muenchen.de] - Subject: Delete forward key - - I dont like it that the delete-forward key deletes backwards in - ESS-mode. My default option is, delete-forward deletes forward, but - ess-mode ignore this. Is there a simple way to change this? - (RS) Put this line in your .emacs file after you have loaded ESS: - (define-key ess-mode-map [delete] 'delete-char) - -* (RMH) Stata question: delimiter - - I noted that the command lines are duplicated. You might need - (setq comint-process-echoes t) - in the defun stata - - - -Date: Tue, 15 Jun 2004 01:11:33 -0400 -From: "Richard M. Heiberger" Add To Address Book | This is Spam -Subject: Re: change in ESS with edit() in R -To: rossini@u.washington.edu -Cc: Stephen Eglen , ess-core@stat.math.ethz.ch - - - -I think Tony spotted the source of the problem. I think I did it. - -The goal in ess-iw32.el was to change the behavior of -ess-eval-linewise and ess-eval-region to call the Windows S-Plus GUI -through the DDE protocol. This was successful. I and others have used it daily -for the past 6 years. - -I intended to restrict the change to the S-Plus -GUI. My thinking at the moment is that I didn't do that restriction well enough. - -I get an emacs freeze in both R and Sqpe on Windows. An initial look at emacs -variables makes me think that the "if" tests in ess-iw32.el for the substitute -definitions of - -ess-eval-region -ess-eval-linewise -ess-load-file -ess-dump-object-into-edit-buffer -ess-display-help-on-object -ess-dump-object - -aren't precise enough to detect that R and Sqpe should not be sent to ddeclient. - -This note goes on the master "To DO" list. Do we have one? -Taking it off the list is not a high priority for me because the work around of -C-g is so easy. - - -Rich - - -03-17-08: Add advanced features to ESS[JAGS] like thinning and -multiple chains (initialization and creation): Done! - -Rodney - - -01-24-12: ESS[R] and Tramp bug - -The help doesn't work nicely. -?chol doesn't pop up a new buffer like it does locally; instead it -puts you into a pager of some sort. Also, help.start() doesn't work -unless you launch firefox remotely (which defeats the purpose of -working remotely for the most part). - -Rodney diff -Nru ess-18.10.2/etc/completion_ideas.R ess-18.10.2+git20220915.f45542e/etc/completion_ideas.R --- ess-18.10.2/etc/completion_ideas.R 2018-11-10 09:41:11.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/etc/completion_ideas.R 1970-01-01 00:00:00.000000000 +0000 @@ -1,30 +0,0 @@ - -## inspired by: -## https://github.com/rstudio/rstudio/pull/191 - -## nested calls should work -df[a][, |] - -## matrix, list, environments -l <- list(aaaa = 1111, bbbb = 2222) -l[a|] ## -> "aaaa" (quoted!) - -## data table -dt <- data.table(aaaa = 1111, bbbb = 22222) -dt[, a|] # -> aaaa (unquoted!) - -## attributes -x <- "" -attr(x, "foo") <- function(alpha, beta) {} -attr(x, "foo")(al| # -> "alpha" - -## chains -mtcars %>% dplyr::select(mp| #-> mpg (unquoted)) - -## models -lm(mpg ~ cy| , data = mtcars) #-> cyl - -## "by" keyword in data.table, inner_join, etc -inner_join(foo, bar, by = c(| # provides completions for variables in foo when - # on the left side of an =, and bar when on the - # right side of an =. diff -Nru ess-18.10.2/etc/ess-julia.jl ess-18.10.2+git20220915.f45542e/etc/ess-julia.jl --- ess-18.10.2/etc/ess-julia.jl 2018-11-10 09:41:11.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/etc/ess-julia.jl 2022-10-15 08:06:36.000000000 +0000 @@ -15,7 +15,13 @@ end function help(topic::AbstractString) - VERSION >= v"0.4-" ? Core.eval(@current_module(), parse("@doc $topic")) : Base.Help.help(topic) + if (VERSION >= v"1.0-") + Core.eval(parentmodule(ESS), parse("@doc $topic")) + elseif (VERSION >= v"0.4-") + Core.eval(@current_module(), parse("@doc $topic")) + else + Base.Help.help(topic) + end end ## modified version of function show(io::IO, m::Method) @@ -50,7 +56,8 @@ function fun_args(s::AbstractString) try - m = Core.eval(@current_module(), parse(s)) + mod = VERSION >= v"1.0-" ? parentmodule(ESS) : @current_module() + m = Core.eval(mod, parse(s)) if ! isa(m, String) fun_args(m) end @@ -76,9 +83,9 @@ # add Function # free Function function components(m::Module) - for v in sort(names(m)) + for v in sort(names(m, all=true, imported=true)) s = string(v) - if isdefined(m,v) + if !startswith(s, "#") && isdefined(m,v) println(rpad(s, 30), summary(Core.eval(m,v))) end end diff -Nru ess-18.10.2/etc/ESSR/BUILDESSR ess-18.10.2+git20220915.f45542e/etc/ESSR/BUILDESSR --- ess-18.10.2/etc/ESSR/BUILDESSR 2018-11-10 09:41:10.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/etc/ESSR/BUILDESSR 2022-10-15 08:06:36.000000000 +0000 @@ -1,4 +1,4 @@ -#!/usr/bin/Rscript +#!/usr/bin/env Rscript ## -*- mode: R -*- ## code to build ESSR environemnt. ## Assume that current directory is etc/ESSR @@ -6,5 +6,5 @@ ## exactly as in inferior-ess-r-load-ESSR in ess-r-d.el source('./R/.load.R', local=TRUE) -ESSR <- load.ESSR('./R/') +ESSR <- .ess.ESSR.load('./R/') saveRDS(ESSR, file = "../ESSR.rds") diff -Nru ess-18.10.2/etc/ESSR/LOADREMOTE ess-18.10.2+git20220915.f45542e/etc/ESSR/LOADREMOTE --- ess-18.10.2/etc/ESSR/LOADREMOTE 2018-11-10 09:41:10.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/etc/ESSR/LOADREMOTE 2022-10-15 08:06:36.000000000 +0000 @@ -1,7 +1,7 @@ ## -*- mode: R -*- ## loading code which is first sent to R on remote sessions local({ - ver <- '1.3' + ver <- '%s' ## <- passed from elisp root <- '~/.config/ESSR' if(!file.exists(root)) dir.create(root, recursive = TRUE) @@ -13,6 +13,7 @@ utils::download.file(url, essr_file) } ESSR <- readRDS(essr_file) + ESSR[[".ess.Rversion"]] <- ESSR[[".ess.getRversion"]]() attach(ESSR) print(TRUE) }, diff -Nru ess-18.10.2/etc/ESSR/R/.basic.R ess-18.10.2+git20220915.f45542e/etc/ESSR/R/.basic.R --- ess-18.10.2/etc/ESSR/R/.basic.R 2018-11-10 09:41:10.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/etc/ESSR/R/.basic.R 2022-10-15 08:06:36.000000000 +0000 @@ -4,14 +4,13 @@ ## Do not use _ in names, nor :: , nor 1L etc, as they ## cannot be parsed in old R versions +.ess.getRversion <- function() { + if(exists("getRversion", mode="function")) getRversion() + else paste(R.version$major, R.version$minor, sep=".") +} ## loading ESSR.rda might fail, so re-assign here: -.ess.Rversion <- - if( exists("getRversion", mode="function") ){ - getRversion() - } else { - paste(R.version$major, R.version$minor, sep=".") - } +.ess.Rversion <- .ess.getRversion() .ess.R.has.utils <- (.ess.Rversion >= "1.9.0") .ess.utils.name <- paste("package", @@ -45,17 +44,90 @@ } } -.ess.getHelpAliases <- function(){ - readrds <- - if(.ess.Rversion >= '2.13.0') readRDS - else .readRDS - rds.files <- paste(searchpaths(), "/help/aliases.rds", sep = "") - unlist(lapply(rds.files, - function(f){ - if( file.exists(f) ) - try(names(readrds(f))) - }), - use.names = FALSE) +.ess.getHelpAliases <- local({ + readrds <- if (.ess.Rversion >= '2.13.0') readRDS else .readRDS + aliasesCache <- new.env() + + getAliases <- function(file) { + cached <- aliasesCache[[file]] + if (!is.null(cached)) + return(cached) + + aliases <- tryCatch( + error = function(...) NULL, + if (file.exists(file)) + names(readrds(file)) + else + NULL + ) + + aliasesCache[[file]] <- aliases + aliases + } + + function(reset = FALSE) { + if (reset) + aliasesCache <<- new.env() + + rdsFiles <- paste(searchpaths(), "/help/aliases.rds", sep = "") + unlist(lapply(rdsFiles, getAliases), use.names = FALSE) + } +}) + +.ess.helpLinks <- function(topic, package) { + tryCatch( + warning = function(...) NULL, + error = function(...) NULL, + { + ast <- .ess.fetchParsedRd(topic, package) + .ess.findLinks(ast) + } + ) +} + +.ess.fetchParsedRd <- function(topic, package) { + path <- utils:::index.search(topic, find.package(package)) + utils:::.getHelpFile(path) +} + +.ess.findLinks <- function(x) { + links <- NULL + findLinksRec <- function(x) { + if (.ess.isRdLink(x)) { + ## Ignore `pkg` for now + links <<- c(links, .ess.getRdLink(x)[[2]]) + } else if (is.list(x)) { + for (elt in x) + findLinksRec(elt) + } + } + + findLinksRec(x) + links +} + +.ess.isRdLink <- function(x) { + identical(attr(x, "Rd_tag"), "\\link") +} + +## From `tools:::get_link()` +.ess.getRdLink <- function(x) { + pkg <- "" + dest <- paste(unlist(x), collapse = "") + + opt <- attr(x, "Rd_option") + if (!is.null(opt)) { + if (grepl("^=", opt, perl = TRUE, useBytes = TRUE)) { + dest <- sub("^=", "", opt) + } else if (grepl(":", opt, perl = TRUE, useBytes = TRUE)) { + dest <- sub("^[^:]*:", "", opt) + pkg <- sub(":.*", "", opt) + } else { + pkg <- as.character(opt) + } + } + + c(pkg, dest) } ### SOURCING @@ -134,7 +206,48 @@ unquote(substitute(expr)) } +.ess.command <- function(expr, sentinel) { + ## It is possible that the REPL is marked as non-busy when the + ## output is sinked because prompts are not sinked. In that case, + ## redirect the sinked output temporarily to ESS. + sinked <- !identical(stdout(), getConnection(1)) + if (sinked) + sink(getConnection(1)) + + on.exit({ + writeLines(paste0(sentinel, "-END")) + if (sinked) + sink(NULL) + }) + + writeLines(paste0(sentinel, "-START")) + + .ess.environment.state$env <- parent.frame() + on.exit(.ess.environment.state$env <- NULL, add = TRUE) -## Local Variables: -## eval: (ess-set-style 'RRR t) -## End: + + ## Don't interrupt `browser()` sessions (#1081) + restart <- function(...) { + if (!is.null(findRestart("browser"))) + invokeRestart("browser") + } + + out <- withCallingHandlers( + interrupt = restart, + withVisible(expr) + ) + + ## Print result manually because we can't rely on auto-print + ## without changing the last value + if (out$visible) + print(out$value) + + ## Keep `.Last.value` stable + invisible(.Last.value) +} + +.ess.environment.state <- new.env(parent = emptyenv()) + +.ess.environment <- function() { + .ess.environment.state$env +} diff -Nru ess-18.10.2/etc/ESSR/R/completion.R ess-18.10.2+git20220915.f45542e/etc/ESSR/R/completion.R --- ess-18.10.2/etc/ESSR/R/completion.R 2018-11-10 09:41:10.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/etc/ESSR/R/completion.R 2022-10-15 08:06:36.000000000 +0000 @@ -18,10 +18,10 @@ } }) - + .ess_eval <- function(str, env = globalenv()) { ## don't remove; really need eval(parse( here!! - tryCatch(base::eval(base::parse(text=str), envir = env), + tryCatch(eval(parse(text=str), envir = env), error=function(e) NULL) ## also works for special objects containing @:$ etc } @@ -37,6 +37,15 @@ env <- globalenv() } fn <- .ess_eval(name, env) + if (is.null(fn)) { + objs <- utils::getAnywhere(name)$objs + for (o in objs) { + if (is.function(o)) { + fn <- o + break; + } + } + } out <- "()\n" if (is.function(fn) && !is.null(utils::getSrcref(fn))) { file <- utils::getSrcFilename(fn, full.names = TRUE) @@ -49,17 +58,10 @@ cat(out) } + .ess_fn_pkg <- function(fn_name) { - fn <- .ess_eval(fn_name) - env_name <- base::environmentName(base::environment(fn)) - out <- if (base::is.primitive(fn)) { # environment() does not work on primitives. - "base" - } else if (base::is.function(fn) && env_name != "R_GlobalEnv") { - env_name - } else { - "" - } - base::cat(base::sprintf("%s\n", out)) + objs <- utils::getAnywhere(fn_name) + print(sub("(package|namespace):", "", objs$where)) } .ess_funargs <- function(funname) { @@ -85,30 +87,35 @@ fmls <- formals(args) fmls_names <- names(fmls) fmls <- gsub('\"', '\\\"', - gsub("\\", "\\\\", as.character(fmls),fixed = TRUE), + gsub("\\", "\\\\", as.character(fmls), fixed = TRUE), fixed=TRUE) args_alist <- sprintf("'(%s)", paste("(\"", fmls_names, "\" . \"", fmls, "\")", sep = '', collapse = ' ')) allargs <- - if(special) fmls_names - else tryCatch(gsub('=', '', utils:::functionArgs(funname, ''), fixed = TRUE), + if (special) fmls_names + else tryCatch(gsub(' ?= ?', '', utils:::functionArgs(funname, ''), fixed = FALSE), error=function(e) NULL) allargs <- sprintf("'(\"%s\")", paste(allargs, collapse = '\" "')) - envname <- environmentName(environment(fun)) - if(envname == "R_GlobalEnv") envname <- "" + envname <- + if (is.primitive(fun)) "base" + else environmentName(environment(fun)) + if (envname == "R_GlobalEnv") envname <- "" cat(sprintf('(list \"%s\" %s %s)\n', envname, args_alist, allargs)) } } -.ess_get_completions <- function(string, end){ + +.ess_get_completions <- function(string, end, suffix = " = ") { + oldopts <- utils::rc.options(funarg.suffix = suffix) + on.exit(utils::rc.options(oldopts)) if(.ess.Rversion > '2.14.1'){ comp <- compiler::enableJIT(0) op <- options(error=NULL) - on.exit({ options(op); compiler::enableJIT(comp) }) + on.exit({ options(op); compiler::enableJIT(comp)}, add = TRUE) } utils:::.assignLinebuffer(string) utils:::.assignEnd(end) @@ -158,9 +165,4 @@ )) i <- i + 1 cat('\n\n', as.character(out), '\n') -}; - - -## Local Variables: -## eval: (ess-set-style 'RRR t) -## End: +} diff -Nru ess-18.10.2/etc/ESSR/R/debug.R ess-18.10.2+git20220915.f45542e/etc/ESSR/R/debug.R --- ess-18.10.2/etc/ESSR/R/debug.R 2018-11-10 09:41:10.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/etc/ESSR/R/debug.R 2022-10-15 08:06:36.000000000 +0000 @@ -34,6 +34,7 @@ invert = TRUE, value = TRUE) } + .ess_dbg_flag_for_debuging <- function(fname){ all <- utils::getAnywhere(fname) if(length(all$obj) == 0){ @@ -93,8 +94,8 @@ unique(c(debugged_pkg, debugged, all_traced)) } -.ess_dbg_UntraceOrUndebug <- function(name, env = parent.frame()) -{ + +.ess_dbg_UntraceOrUndebug <- function(name, env = parent.frame()) { tr_state <- tracingState(FALSE) on.exit(tracingState(tr_state)) if( grepl('::', name) ){ @@ -134,6 +135,7 @@ })) } + ### WATCH .ess_watch_expressions <- list() @@ -158,10 +160,13 @@ .essWEnames <- allNames(exps) len0p <- !nzchar(.essWEnames) .essWEnames[len0p] <- seq_along(len0p)[len0p] + oo <- options(width = 10000) + on.exit(options(oo)) for(i in seq_along(exps)) { cat('\n@---- ', .essWEnames[[i]], ' ', rep.int('-', max(0, 35 - nchar(.essWEnames[[i]]))), '-@\n', sep = '') - cat(paste('@---:', deparse(exps[[i]][[1]])), ' \n', sep = '') + expr <- gsub(" +", " ", paste(deparse(exps[[i]][[1]]), collapse = " ")) + cat(paste('@---:', expr), ' \n', sep = '') tryCatch(print(eval(exps[[i]], envir = .parent_frame)), error = function(e) cat('Error:', e$message, '\n' ), @@ -170,12 +175,12 @@ } } -.ess_watch_assign_expressions <- function(elist){ + +.ess_watch_assign_expressions <- function(elist) { assign(".ess_watch_expressions", elist, envir = as.environment("ESSR")) } -.ess_log_eval <- function(log_name) -{ +.ess_log_eval <- function(log_name) { env <- as.environment("ESSR") if(!exists(log_name, envir = env, inherits = FALSE)) assign(log_name, list(), envir = env) @@ -199,6 +204,7 @@ invisible(NULL) } + .ess_package_attached <- function(pack_name){ as.logical(match(paste0("package:", pack_name), search())) } @@ -222,7 +228,3 @@ x } } - -## Local Variables: -## eval: (ess-set-style 'RRR t) -## End: diff -Nru ess-18.10.2/etc/ESSR/R/.load.R ess-18.10.2+git20220915.f45542e/etc/ESSR/R/.load.R --- ess-18.10.2/etc/ESSR/R/.load.R 2018-11-10 09:41:10.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/etc/ESSR/R/.load.R 2022-10-15 08:06:36.000000000 +0000 @@ -1,58 +1,93 @@ +## This file is sourced when R starts and `load.ESSR` is called. See +## inferior-ess-r-load-ESSR--local. ## Do not use _ in names, nor :: as they cannot be parsed in old R versions +## obtain the R version number as a string +.ess.ESSR.get.rver <- function() { + if(exists("getRversion", mode="function")) getRversion() + else paste(R.version$major, R.version$minor, sep=".") +} + ## load .base.R and all other files into ESSR environment; then attach ESSR -load.ESSR <- function(dir){ - .source <- - if(any("keep.source" == names(formals(sys.source)))) - sys.source - else - function(..., keep.source) sys.source(...) +.ess.ESSR.load <- function(dir) { - Rver <- - if(exists("getRversion", mode="function")) getRversion() - else paste(R.version$major, R.version$minor, sep=".") + Rver <- .ess.ESSR.get.rver() + ESSR <- .ess.ESSR.create.env(Rver) + .ess.ESSR.source.files(ESSR, dir, Rver) + .ess.ESSR.attach.env(ESSR, Rver) - oldR <- Rver <= "1.3.0" + ## BUILDESSR needs this: + invisible(ESSR) +} + +.ess.ESSR.create.env <- function(Rver) { ESSR <- - if(oldR) ## really old library() revert order a bit + if (Rver <= "1.3.0") ## really old library() revert order a bit attach(NULL, name = "ESSR") else if(length(nn <- names(formals(new.env))) && any(nn == "parent")) new.env(parent = - if(Rver >= "1.9.0") getNamespace("utils") + if (Rver >= "1.9.0") getNamespace("utils") else .BaseNamespaceEnv) else new.env() assign(".ess.Rversion", Rver, envir = ESSR) - ESSRver <- scan(paste(dirname(dir), "/VERSION", sep = ""), - what = "character", quiet = TRUE) - assign(".ess.ESSRversion", ESSRver, envir = ESSR) + ## updated by make !! + VERSION <- "1.7" + assign(".ess.ESSRversion", VERSION, envir = ESSR) + + ESSR +} + +## attempt to source the files in the ESSR directory and place the resulting R +## objects into ESSR environment; the updated version of the environment is +## returned +.ess.ESSR.source.files <- function(ESSR, dir, Rver) { + .source <- + if(any("keep.source" == names(formals(sys.source)))) + sys.source + else + function(..., keep.source) sys.source(...) ## .basic.R: try(.source(paste(dir,'/.basic.R', sep = ""), envir = ESSR, keep.source = FALSE)) ## all others try(*) as it will fail in old R - if(!oldR) # no sense if(oldR) - for( f in dir(dir, pattern='\\.R$', full.names=TRUE) ) + if (Rver > "1.3.0") { # no sense if very old R + for (f in dir(dir, pattern='\\.R$', full.names=TRUE)) try(.source(f, envir = ESSR, keep.source = FALSE)) + } + + ESSR +} + - if(Rver >= "2.4.0") +## attach the ESSR environment to the search path +.ess.ESSR.attach.env <- function(ESSR, Rver) { + if (Rver >= "2.4.0") attach(ESSR) - else if(!oldR) { ## borrow from older library() + else if (Rver > "1.3.0") { # borrow from older library() e <- attach(NULL, name = "ESSR") .Internal(lib.fixup(ESSR, e)) - } else { ## if(oldR), use as in that old library(): + } else { # if old R, use as in that old library(): .Internal(lib.fixup(ESSR, .GlobalEnv)) } - - ## BUILDESSR needs this: - invisible(ESSR) } -## Local Variables: -## eval: (ess-set-style 'RRR t) -## End: +## copy any ESSR R objects in the global environment into a newly created ESSR +## environment; then remove the original objects and attach ESSR +.ess.collect.ESSR.objects <- function() { + + Rver <- .ess.ESSR.get.rver() + ESSR <- .ess.ESSR.create.env(Rver) + essr.nms <- grep('\\.(ess|ESS)', ls(.GlobalEnv, all.names = TRUE), value = TRUE) + for (nm in essr.nms) { + assign(nm, get(nm, pos = .GlobalEnv), envir = ESSR) + } + .ess.ESSR.attach.env(ESSR, Rver) + rm(list = essr.nms, pos = .GlobalEnv) +} diff -Nru ess-18.10.2/etc/ESSR/R/misc.R ess-18.10.2+git20220915.f45542e/etc/ESSR/R/misc.R --- ess-18.10.2/etc/ESSR/R/misc.R 2018-11-10 09:41:10.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/etc/ESSR/R/misc.R 2022-10-15 08:06:36.000000000 +0000 @@ -21,6 +21,7 @@ eval(bquote(knit(.(file), output = .(output))), envir = frame) } + .ess_sweave <- function(file, output = NULL){ od <- getwd() frame <- parent.frame() @@ -30,7 +31,7 @@ } ## Users might find it useful. So don't prefix with .ess. -htsummary <- function(x, hlength = 4, tlength = 4, digits = 3) { +.ess_htsummary <- function(x, hlength = 4, tlength = 4, digits = 3) { ## fixme: simplify and generalize snames <- c("mean", "sd", "min", "max", "nlev", "NAs") d <- " " @@ -95,6 +96,7 @@ invisible(NULL) } + .ess_vignettes <- function(all=FALSE) { vs <- unclass(browseVignettes(all = all)) vs <- vs[sapply(vs, length) > 0] @@ -140,6 +142,33 @@ paste0(home, "/doc/html/index.html") } -## Local Variables: -## eval: (ess-set-style 'RRR t) -## End: + +.ess.rdired <- function() { + cat('\n') + + objs <- ls(envir = .GlobalEnv) + if (length(objs)==0) { + cat("No objects to view!\n") + return(invisible(NULL)) + } + + names(objs) <- objs + objs <- lapply(objs, get, envir = .GlobalEnv) + + mode <- sapply(objs, data.class) + length <- sapply(objs, length) + size <- sapply(objs, function(obj) format(object.size(obj))) + d <- data.frame(mode, length, size) + + var.names <- row.names(d) + + ## If any names contain spaces, we need to quote around them. + quotes <- rep('', length(var.names)) + spaces <- grep(' ', var.names) + if (any(spaces)) + quotes[spaces] <- '\"' + var.names <- paste(quotes, var.names, quotes, sep = '') + row.names(d) <- paste(' ', var.names, sep = '') + + print(d) +} diff -Nru ess-18.10.2/etc/ESSR/R/mpi.R ess-18.10.2+git20220915.f45542e/etc/ESSR/R/mpi.R --- ess-18.10.2/etc/ESSR/R/mpi.R 2018-11-10 09:41:10.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/etc/ESSR/R/mpi.R 2022-10-15 08:06:36.000000000 +0000 @@ -1,19 +1,24 @@ ## simple Message Parsing Inerface .ess_mpi_send <- function(head, ...){ - payload <- paste(..., sep = "") - cat(sprintf("%s%s", head, payload)) + dots <- lapply(list(...), function(el) { + if (is.null(el)) "nil" + else if (is.logical(el)) {if (el) "t" else "nil"} + else as.character(el) + }) + payload <- paste(dots, collapse = "") + cat(sprintf("_%s%s\\", head, payload)) } .ess_mpi_message <- function(msg){ .ess_mpi_send("message", msg) } -.ess_mpi_y_or_n <- function(prompt, callback){ +.ess_mpi_y_or_n <- function(prompt, callback = NULL){ .ess_mpi_send("y-or-n", prompt, callback) } -.ess_mpi_eval <- function(expr, callback){ +.ess_mpi_eval <- function(expr, callback = NULL){ .ess_mpi_send("eval", expr, callback) } diff -Nru ess-18.10.2/etc/ESSR/R/ns-eval.R ess-18.10.2+git20220915.f45542e/etc/ESSR/R/ns-eval.R --- ess-18.10.2/etc/ESSR/R/ns-eval.R 2018-11-10 09:41:11.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/etc/ESSR/R/ns-eval.R 2022-10-15 08:06:36.000000000 +0000 @@ -18,6 +18,7 @@ fallback_env = fallback_env, local_env = local_env) } + ##' Source FILE into an environment. After having a look at each new object in ##' the environment, decide what to do with it. Handles plain objects, ##' functions, existing S3 methods, S4 classes and methods. @@ -28,12 +29,11 @@ fake.source = FALSE, fallback_env = NULL, local_env = NULL) { - oldopts <- options(warn = 2) - on.exit(options(oldopts)) pname <- paste("package:", package, sep = "") envpkg <- tryCatch(as.environment(pname), error = function(cond) NULL) - if (is.null(envpkg)) - if (require(package, quietly = TRUE, character.only = TRUE)) { + + if (is.null(envpkg)) { + if (suppressWarnings(require(package, quietly = TRUE, character.only = TRUE))) { envpkg <- tryCatch(as.environment(pname), error = function(cond) NULL) } else { ## no such package; source in current (local) user environment @@ -41,6 +41,7 @@ output = output, local = local_env, fake.source = fake.source)) } + } envns <- tryCatch(asNamespace(package), error = function(cond) NULL) if (is.null(envns)) @@ -140,27 +141,31 @@ } ## deal with new plain objects and functions - for(this in intersect(newPkg, newNs)){ + for (this in intersect(newPkg, newNs)) { thisEnv <- get(this, envir = env, inherits = FALSE) - if(exists(this, envir = fallback_env, inherits = FALSE)){ + if (exists(this, envir = fallback_env, inherits = FALSE)){ thisGl <- get(this, envir = fallback_env) - if(.ess.differs(thisEnv, thisGl)){ - if(is.function(thisEnv)){ + if (.ess.differs(thisEnv, thisGl)) { + if (is.function(thisEnv)) { environment(thisEnv) <- envns newFunc <- c(newFunc, this) - }else{ + } else { newObjects <- c(newObjects, this) } .ess.assign(this, thisEnv, fallback_env) + if (.is.essenv(fallback_env)) + .ess.assign(this, thisEnv, .GlobalEnv) } - }else{ - if(is.function(thisEnv)){ + } else { + if (is.function(thisEnv)) { environment(thisEnv) <- envns newFunc <- c(newFunc, this) - }else{ + } else { newObjects <- c(newObjects, this) } .ess.assign(this, thisEnv, fallback_env) + if (.is.essenv(fallback_env)) + .ess.assign(this, thisEnv, .GlobalEnv) } } @@ -265,6 +270,7 @@ invisible(env) } + .ess.ns_insertMethods <- function(tableEnv, tablePkg, envns) { inserted <- character() for(m in ls(envir = tableEnv, all.names = T)){ @@ -307,6 +313,7 @@ env } + .ess.assign <- function(x, value, envir) { ## Cannot add bindings to locked environments exists <- exists(x, envir = envir, inherits = FALSE) @@ -345,6 +352,7 @@ !identical(f1, f2) } + .ess.is_package <- function(envName) { isPkg <- identical(substring(envName, 0, 8), "package:") isPkg && (envName != "package:base") @@ -361,6 +369,7 @@ containsObj } + .ess.ns_format_deps <- function(dependentPkgs) { pkgs <- unique(unlist(dependentPkgs, use.names = FALSE)) @@ -380,9 +389,10 @@ name } + .ess.ns_insert_essenv <- function(nsenv) { if (is.character(nsenv)) - nsenv <- base::asNamespace(nsenv) + nsenv <- asNamespace(nsenv) stopifnot(isNamespace(nsenv)) if (identical(nsenv, .BaseNamespaceEnv)) return(.GlobalEnv) @@ -392,6 +402,7 @@ return(nsenv_parent) } essenv <- new.env(parent = nsenv_parent) + essenv[[".__ESSENV__."]] <- TRUE attr(essenv, "name") <- essenv_name nssym <- ".__NAMESPACE__." nssym_val <- get(nssym, envir = nsenv, inherits = FALSE) @@ -405,7 +416,6 @@ essenv } - -## Local Variables: -## eval: (ess-set-style 'RRR t) -## End: +.is.essenv <- function(env) { + exists(".__ESSENV__.", envir = env, inherits = FALSE) +} diff -Nru ess-18.10.2/etc/ESSR/VERSION ess-18.10.2+git20220915.f45542e/etc/ESSR/VERSION --- ess-18.10.2/etc/ESSR/VERSION 2018-11-10 09:41:11.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/etc/ESSR/VERSION 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -1.4 \ No newline at end of file Binary files /tmp/tmpygwz1x8l/nasy0cgw6A/ess-18.10.2/etc/ESSR.rds and /tmp/tmpygwz1x8l/8fYE79yjPk/ess-18.10.2+git20220915.f45542e/etc/ESSR.rds differ diff -Nru ess-18.10.2/etc/git-ref ess-18.10.2+git20220915.f45542e/etc/git-ref --- ess-18.10.2/etc/git-ref 2018-11-10 09:41:16.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/etc/git-ref 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -d4cd65da6dbf diff -Nru ess-18.10.2/etc/gpl-check ess-18.10.2+git20220915.f45542e/etc/gpl-check --- ess-18.10.2/etc/gpl-check 2018-11-10 09:41:11.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/etc/gpl-check 1970-01-01 00:00:00.000000000 +0000 @@ -1,56 +0,0 @@ -#!/bin/sh - -if [ $# -eq 0 -o "$1" = "-h" -o "$1" = "-help" -o "$1" = "--help" ] -then - echo "usage: gpl-check [-h|-help|--help|-2|-3|-u|-n] file1 [file2 ...]" - echo " -h|-help|--help print this help" - echo " -2 print file names found with GPLv2+" - echo " -3 print file names found with GPLv3+" - echo " -u print file names found with a GPL of unknown version" - echo " -n print file names with no GPL found" - echo " file1 [file2 ...] list of files to check" -else - GPLV2=0 - GPLV3=0 - GPLVUNK=0 - NOGPL=0 - - for i - do - case $i in - -2) GPLV2=1;; - -3) GPLV3=1;; - -23) GPLV2=1;GPLV3=1;; - -u) GPLVUNK=1;; - -n) NOGPL=1;; - -nu|-un) GPLVUNK=1;NOGPL=1;; - *) if [ $GPLV2 -eq 0 -a $GPLV3 -eq 0 -a $GPLVUNK -eq 0 -a $NOGPL -eq 0 ] - then - GPLV2=1 - GPLV3=1 - GPLVUNK=1 - NOGPL=1 - fi - if grep -l 'either version 2, or' $i > /dev/null - then - if [ $GPLV2 -eq 1 ] - then echo "$i GPLv2+" - fi - elif grep -l 'either version 3' $i > /dev/null - then - if [ $GPLV3 -eq 1 ] - then echo "$i GPLv3+" - fi - elif grep -l 'GNU General Public License' $i > /dev/null - then - if [ $GPLVUNK -eq 1 ] - then echo "$i GPLv unknown" - fi - else - if [ $NOGPL -eq 1 ] - then echo "$i no GPL" - fi - fi;; - esac - done -fi diff -Nru ess-18.10.2/etc/Makefile ess-18.10.2+git20220915.f45542e/etc/Makefile --- ess-18.10.2/etc/Makefile 2018-11-10 09:41:11.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/etc/Makefile 2022-10-15 08:06:36.000000000 +0000 @@ -4,9 +4,6 @@ ## Before making changes here, please take a look at Makeconf include ../Makeconf -# In ../Makefile we already construct the ESSR-VERSION file : -# ESSR_VERSION = $(shell cat ESSR-VERSION) - #ETCFILES = $(wildcard BACKBUG[S5].BAT backbug[s5] *.S sas-keys.*) #ETCFILES = ESSR.R ess-developer.R SVN-REVISION *.S sas-keys.* ess-sas-sh-command # ETCFILES_1 = *.S sas-keys.* ess-sas-sh-command *.jl @@ -21,30 +18,15 @@ #ICONS = $(wildcard icons/*.xpm) ICONS = icons/*.xpm -ESSR_UTIL_FILES = ESSR/LOADREMOTE ESSR/VERSION +ESSR_UTIL_FILES = ESSR/LOADREMOTE ESSR_CODE_FILES = ESSR/R/*.R ESSR/R/.*.R -# ESSR_tarball = ESSR_$(ESSR_VERSION).tar.gz -all: #ESSR-VERSION $(ESSR_tarball) library/ESSR +all: show-etc: @echo $(ETCFILES) ls -l $(ETCFILES) - -## happens "above" as it is need also in ../lisp/ : -# ESSR-VERSION: $(ESSR_FILES) -# (cd .. ; make etc/ESSR-VERSION) - -# $(ESSR_tarball): $(ESSR_FILES) -# R CMD build ESSR -# library/ESSR: $(ESSR_tarball) -# R CMD INSTALL -l library ESSR - -# rel: $(ESSR_tarball) -# [ x$$USER = xmaechler ] || (echo 'must be maechler'; exit 1 ) -# $(INSTALL) $(ESSR_tarball) $(UPLOAD_DIR)/pkgs/src/contrib - install : $(INSTALLDIR) $(ETCDIR)/icons $(INSTALLDIR) $(ETCDIR)/ESSR/R diff -Nru ess-18.10.2/etc/other/config.guess ess-18.10.2+git20220915.f45542e/etc/other/config.guess --- ess-18.10.2/etc/other/config.guess 2018-11-10 09:41:11.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/etc/other/config.guess 1970-01-01 00:00:00.000000000 +0000 @@ -1,1560 +0,0 @@ -#! /bin/sh -# Attempt to guess a canonical system name. -# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, -# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 -# Free Software Foundation, Inc. - -timestamp='2013-12-09' - -# 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 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# A copy of the GNU General Public License is available at -# https://www.r-project.org/Licenses/ -# -# -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - - -# Originally written by Per Bothner . -# Please send patches to . Submit a context -# diff and a properly formatted ChangeLog entry. -# -# This script attempts to guess a canonical system name similar to -# config.sub. If it succeeds, it prints the system name on stdout, and -# exits with 0. Otherwise, it exits with 1. -# -# The plan is that this can be called by configure scripts if you -# don't specify an explicit build system type. - -me=`echo "$0" | sed -e 's,.*/,,'` - -usage="\ -Usage: $0 [OPTION] - -Output the configuration name of the system \`$me' is run on. - -Operation modes: - -h, --help print this help, then exit - -t, --time-stamp print date of last modification, then exit - -v, --version print version number, then exit - -Report bugs and patches to ." - -version="\ -GNU config.guess ($timestamp) - -Originally written by Per Bothner. -Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, -2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. - -This is free software; see the source for copying conditions. There is NO -warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." - -help=" -Try \`$me --help' for more information." - -# Parse command line -while test $# -gt 0 ; do - case $1 in - --time-stamp | --time* | -t ) - echo "$timestamp" ; exit ;; - --version | -v ) - echo "$version" ; exit ;; - --help | --h* | -h ) - echo "$usage"; exit ;; - -- ) # Stop option processing - shift; break ;; - - ) # Use stdin as input. - break ;; - -* ) - echo "$me: invalid option $1$help" >&2 - exit 1 ;; - * ) - break ;; - esac -done - -if test $# != 0; then - echo "$me: too many arguments$help" >&2 - exit 1 -fi - -trap 'exit 1' 1 2 15 - -# CC_FOR_BUILD -- compiler used by this script. Note that the use of a -# compiler to aid in system detection is discouraged as it requires -# temporary files to be created and, as you can see below, it is a -# headache to deal with in a portable fashion. - -# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still -# use `HOST_CC' if defined, but it is deprecated. - -# Portable tmp directory creation inspired by the Autoconf team. - -set_cc_for_build=' -trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; -trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; -: ${TMPDIR=/tmp} ; - { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || - { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || - { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || - { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; -dummy=$tmp/dummy ; -tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; -case $CC_FOR_BUILD,$HOST_CC,$CC in - ,,) echo "int x;" > $dummy.c ; - for c in cc gcc c89 c99 ; do - if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then - CC_FOR_BUILD="$c"; break ; - fi ; - done ; - if test x"$CC_FOR_BUILD" = x ; then - CC_FOR_BUILD=no_compiler_found ; - fi - ;; - ,,*) CC_FOR_BUILD=$CC ;; - ,*,*) CC_FOR_BUILD=$HOST_CC ;; -esac ; set_cc_for_build= ;' - -# This is needed to find uname on a Pyramid OSx when run in the BSD universe. -# (ghazi@noc.rutgers.edu 1994-08-24) -if (test -f /.attbin/uname) >/dev/null 2>&1 ; then - PATH=$PATH:/.attbin ; export PATH -fi - -UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown -UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown -UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown -UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown - -# Note: order is significant - the case branches are not exclusive. - -case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in - *:NetBSD:*:*) - # NetBSD (nbsd) targets should (where applicable) match one or - # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, - # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently - # switched to ELF, *-*-netbsd* would select the old - # object file format. This provides both forward - # compatibility and a consistent mechanism for selecting the - # object file format. - # - # Note: NetBSD doesn't particularly care about the vendor - # portion of the name. We always set it to "unknown". - sysctl="sysctl -n hw.machine_arch" - UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ - /usr/sbin/$sysctl 2>/dev/null || echo unknown)` - case "${UNAME_MACHINE_ARCH}" in - armeb) machine=armeb-unknown ;; - arm*) machine=arm-unknown ;; - sh3el) machine=shl-unknown ;; - sh3eb) machine=sh-unknown ;; - sh5el) machine=sh5le-unknown ;; - *) machine=${UNAME_MACHINE_ARCH}-unknown ;; - esac - # The Operating System including object format, if it has switched - # to ELF recently, or will in the future. - case "${UNAME_MACHINE_ARCH}" in - arm*|i386|m68k|ns32k|sh3*|sparc|vax) - eval $set_cc_for_build - if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ - | grep __ELF__ >/dev/null - then - # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). - # Return netbsd for either. FIX? - os=netbsd - else - os=netbsdelf - fi - ;; - *) - os=netbsd - ;; - esac - # The OS release - # Debian GNU/NetBSD machines have a different userland, and - # thus, need a distinct triplet. However, they do not need - # kernel version information, so it can be replaced with a - # suitable tag, in the style of linux-gnu. - case "${UNAME_VERSION}" in - Debian*) - release='-gnu' - ;; - *) - release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` - ;; - esac - # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: - # contains redundant information, the shorter form: - # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. - echo "${machine}-${os}${release}" - exit ;; - *:OpenBSD:*:*) - UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` - echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} - exit ;; - *:ekkoBSD:*:*) - echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} - exit ;; - *:SolidBSD:*:*) - echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} - exit ;; - macppc:MirBSD:*:*) - echo powerpc-unknown-mirbsd${UNAME_RELEASE} - exit ;; - *:MirBSD:*:*) - echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} - exit ;; - alpha:OSF1:*:*) - case $UNAME_RELEASE in - *4.0) - UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` - ;; - *5.*) - UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` - ;; - esac - # According to Compaq, /usr/sbin/psrinfo has been available on - # OSF/1 and Tru64 systems produced since 1995. I hope that - # covers most systems running today. This code pipes the CPU - # types through head -n 1, so we only detect the type of CPU 0. - ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` - case "$ALPHA_CPU_TYPE" in - "EV4 (21064)") - UNAME_MACHINE="alpha" ;; - "EV4.5 (21064)") - UNAME_MACHINE="alpha" ;; - "LCA4 (21066/21068)") - UNAME_MACHINE="alpha" ;; - "EV5 (21164)") - UNAME_MACHINE="alphaev5" ;; - "EV5.6 (21164A)") - UNAME_MACHINE="alphaev56" ;; - "EV5.6 (21164PC)") - UNAME_MACHINE="alphapca56" ;; - "EV5.7 (21164PC)") - UNAME_MACHINE="alphapca57" ;; - "EV6 (21264)") - UNAME_MACHINE="alphaev6" ;; - "EV6.7 (21264A)") - UNAME_MACHINE="alphaev67" ;; - "EV6.8CB (21264C)") - UNAME_MACHINE="alphaev68" ;; - "EV6.8AL (21264B)") - UNAME_MACHINE="alphaev68" ;; - "EV6.8CX (21264D)") - UNAME_MACHINE="alphaev68" ;; - "EV6.9A (21264/EV69A)") - UNAME_MACHINE="alphaev69" ;; - "EV7 (21364)") - UNAME_MACHINE="alphaev7" ;; - "EV7.9 (21364A)") - UNAME_MACHINE="alphaev79" ;; - esac - # A Pn.n version is a patched version. - # A Vn.n version is a released version. - # A Tn.n version is a released field test version. - # A Xn.n version is an unreleased experimental baselevel. - # 1.2 uses "1.2" for uname -r. - echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - exit ;; - Alpha\ *:Windows_NT*:*) - # How do we know it's Interix rather than the generic POSIX subsystem? - # Should we change UNAME_MACHINE based on the output of uname instead - # of the specific Alpha model? - echo alpha-pc-interix - exit ;; - 21064:Windows_NT:50:3) - echo alpha-dec-winnt3.5 - exit ;; - Amiga*:UNIX_System_V:4.0:*) - echo m68k-unknown-sysv4 - exit ;; - *:[Aa]miga[Oo][Ss]:*:*) - echo ${UNAME_MACHINE}-unknown-amigaos - exit ;; - *:[Mm]orph[Oo][Ss]:*:*) - echo ${UNAME_MACHINE}-unknown-morphos - exit ;; - *:OS/390:*:*) - echo i370-ibm-openedition - exit ;; - *:z/VM:*:*) - echo s390-ibm-zvmoe - exit ;; - *:OS400:*:*) - echo powerpc-ibm-os400 - exit ;; - arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) - echo arm-acorn-riscix${UNAME_RELEASE} - exit ;; - arm:riscos:*:*|arm:RISCOS:*:*) - echo arm-unknown-riscos - exit ;; - SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) - echo hppa1.1-hitachi-hiuxmpp - exit ;; - Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) - # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. - if test "`(/bin/universe) 2>/dev/null`" = att ; then - echo pyramid-pyramid-sysv3 - else - echo pyramid-pyramid-bsd - fi - exit ;; - NILE*:*:*:dcosx) - echo pyramid-pyramid-svr4 - exit ;; - DRS?6000:unix:4.0:6*) - echo sparc-icl-nx6 - exit ;; - DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) - case `/usr/bin/uname -p` in - sparc) echo sparc-icl-nx7; exit ;; - esac ;; - s390x:SunOS:*:*) - echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit ;; - sun4H:SunOS:5.*:*) - echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit ;; - sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) - echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit ;; - i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) - eval $set_cc_for_build - SUN_ARCH="i386" - # If there is a compiler, see if it is configured for 64-bit objects. - # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. - # This test works for both compilers. - if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then - if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ - (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ - grep IS_64BIT_ARCH >/dev/null - then - SUN_ARCH="x86_64" - fi - fi - echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit ;; - sun4*:SunOS:6*:*) - # According to config.sub, this is the proper way to canonicalize - # SunOS6. Hard to guess exactly what SunOS6 will be like, but - # it's likely to be more like Solaris than SunOS4. - echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit ;; - sun4*:SunOS:*:*) - case "`/usr/bin/arch -k`" in - Series*|S4*) - UNAME_RELEASE=`uname -v` - ;; - esac - # Japanese Language versions have a version number like `4.1.3-JL'. - echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` - exit ;; - sun3*:SunOS:*:*) - echo m68k-sun-sunos${UNAME_RELEASE} - exit ;; - sun*:*:4.2BSD:*) - UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` - test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 - case "`/bin/arch`" in - sun3) - echo m68k-sun-sunos${UNAME_RELEASE} - ;; - sun4) - echo sparc-sun-sunos${UNAME_RELEASE} - ;; - esac - exit ;; - aushp:SunOS:*:*) - echo sparc-auspex-sunos${UNAME_RELEASE} - exit ;; - # The situation for MiNT is a little confusing. The machine name - # can be virtually everything (everything which is not - # "atarist" or "atariste" at least should have a processor - # > m68000). The system name ranges from "MiNT" over "FreeMiNT" - # to the lowercase version "mint" (or "freemint"). Finally - # the system name "TOS" denotes a system which is actually not - # MiNT. But MiNT is downward compatible to TOS, so this should - # be no problem. - atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) - echo m68k-atari-mint${UNAME_RELEASE} - exit ;; - atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) - echo m68k-atari-mint${UNAME_RELEASE} - exit ;; - *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) - echo m68k-atari-mint${UNAME_RELEASE} - exit ;; - milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) - echo m68k-milan-mint${UNAME_RELEASE} - exit ;; - hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) - echo m68k-hades-mint${UNAME_RELEASE} - exit ;; - *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) - echo m68k-unknown-mint${UNAME_RELEASE} - exit ;; - m68k:machten:*:*) - echo m68k-apple-machten${UNAME_RELEASE} - exit ;; - powerpc:machten:*:*) - echo powerpc-apple-machten${UNAME_RELEASE} - exit ;; - RISC*:Mach:*:*) - echo mips-dec-mach_bsd4.3 - exit ;; - RISC*:ULTRIX:*:*) - echo mips-dec-ultrix${UNAME_RELEASE} - exit ;; - VAX*:ULTRIX*:*:*) - echo vax-dec-ultrix${UNAME_RELEASE} - exit ;; - 2020:CLIX:*:* | 2430:CLIX:*:*) - echo clipper-intergraph-clix${UNAME_RELEASE} - exit ;; - mips:*:*:UMIPS | mips:*:*:RISCos) - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c -#ifdef __cplusplus -#include /* for printf() prototype */ - int main (int argc, char *argv[]) { -#else - int main (argc, argv) int argc; char *argv[]; { -#endif - #if defined (host_mips) && defined (MIPSEB) - #if defined (SYSTYPE_SYSV) - printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); - #endif - #if defined (SYSTYPE_SVR4) - printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); - #endif - #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) - printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); - #endif - #endif - exit (-1); - } -EOF - $CC_FOR_BUILD -o $dummy $dummy.c && - dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` && - SYSTEM_NAME=`$dummy $dummyarg` && - { echo "$SYSTEM_NAME"; exit; } - echo mips-mips-riscos${UNAME_RELEASE} - exit ;; - Motorola:PowerMAX_OS:*:*) - echo powerpc-motorola-powermax - exit ;; - Motorola:*:4.3:PL8-*) - echo powerpc-harris-powermax - exit ;; - Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) - echo powerpc-harris-powermax - exit ;; - Night_Hawk:Power_UNIX:*:*) - echo powerpc-harris-powerunix - exit ;; - m88k:CX/UX:7*:*) - echo m88k-harris-cxux7 - exit ;; - m88k:*:4*:R4*) - echo m88k-motorola-sysv4 - exit ;; - m88k:*:3*:R3*) - echo m88k-motorola-sysv3 - exit ;; - AViiON:dgux:*:*) - # DG/UX returns AViiON for all architectures - UNAME_PROCESSOR=`/usr/bin/uname -p` - if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] - then - if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ - [ ${TARGET_BINARY_INTERFACE}x = x ] - then - echo m88k-dg-dgux${UNAME_RELEASE} - else - echo m88k-dg-dguxbcs${UNAME_RELEASE} - fi - else - echo i586-dg-dgux${UNAME_RELEASE} - fi - exit ;; - M88*:DolphinOS:*:*) # DolphinOS (SVR3) - echo m88k-dolphin-sysv3 - exit ;; - M88*:*:R3*:*) - # Delta 88k system running SVR3 - echo m88k-motorola-sysv3 - exit ;; - XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) - echo m88k-tektronix-sysv3 - exit ;; - Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) - echo m68k-tektronix-bsd - exit ;; - *:IRIX*:*:*) - echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` - exit ;; - ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. - echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id - exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' - i*86:AIX:*:*) - echo i386-ibm-aix - exit ;; - ia64:AIX:*:*) - if [ -x /usr/bin/oslevel ] ; then - IBM_REV=`/usr/bin/oslevel` - else - IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} - fi - echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} - exit ;; - *:AIX:2:3) - if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #include - - main() - { - if (!__power_pc()) - exit(1); - puts("powerpc-ibm-aix3.2.5"); - exit(0); - } -EOF - if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` - then - echo "$SYSTEM_NAME" - else - echo rs6000-ibm-aix3.2.5 - fi - elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then - echo rs6000-ibm-aix3.2.4 - else - echo rs6000-ibm-aix3.2 - fi - exit ;; - *:AIX:*:[456]) - IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` - if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then - IBM_ARCH=rs6000 - else - IBM_ARCH=powerpc - fi - if [ -x /usr/bin/oslevel ] ; then - IBM_REV=`/usr/bin/oslevel` - else - IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} - fi - echo ${IBM_ARCH}-ibm-aix${IBM_REV} - exit ;; - *:AIX:*:*) - echo rs6000-ibm-aix - exit ;; - ibmrt:4.4BSD:*|romp-ibm:BSD:*) - echo romp-ibm-bsd4.4 - exit ;; - ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and - echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to - exit ;; # report: romp-ibm BSD 4.3 - *:BOSX:*:*) - echo rs6000-bull-bosx - exit ;; - DPX/2?00:B.O.S.:*:*) - echo m68k-bull-sysv3 - exit ;; - 9000/[34]??:4.3bsd:1.*:*) - echo m68k-hp-bsd - exit ;; - hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) - echo m68k-hp-bsd4.4 - exit ;; - 9000/[34678]??:HP-UX:*:*) - HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` - case "${UNAME_MACHINE}" in - 9000/31? ) HP_ARCH=m68000 ;; - 9000/[34]?? ) HP_ARCH=m68k ;; - 9000/[678][0-9][0-9]) - if [ -x /usr/bin/getconf ]; then - sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` - sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` - case "${sc_cpu_version}" in - 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 - 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 - 532) # CPU_PA_RISC2_0 - case "${sc_kernel_bits}" in - 32) HP_ARCH="hppa2.0n" ;; - 64) HP_ARCH="hppa2.0w" ;; - '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 - esac ;; - esac - fi - if [ "${HP_ARCH}" = "" ]; then - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - - #define _HPUX_SOURCE - #include - #include - - int main () - { - #if defined(_SC_KERNEL_BITS) - long bits = sysconf(_SC_KERNEL_BITS); - #endif - long cpu = sysconf (_SC_CPU_VERSION); - - switch (cpu) - { - case CPU_PA_RISC1_0: puts ("hppa1.0"); break; - case CPU_PA_RISC1_1: puts ("hppa1.1"); break; - case CPU_PA_RISC2_0: - #if defined(_SC_KERNEL_BITS) - switch (bits) - { - case 64: puts ("hppa2.0w"); break; - case 32: puts ("hppa2.0n"); break; - default: puts ("hppa2.0"); break; - } break; - #else /* !defined(_SC_KERNEL_BITS) */ - puts ("hppa2.0"); break; - #endif - default: puts ("hppa1.0"); break; - } - exit (0); - } -EOF - (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` - test -z "$HP_ARCH" && HP_ARCH=hppa - fi ;; - esac - if [ ${HP_ARCH} = "hppa2.0w" ] - then - eval $set_cc_for_build - - # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating - # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler - # generating 64-bit code. GNU and HP use different nomenclature: - # - # $ CC_FOR_BUILD=cc ./config.guess - # => hppa2.0w-hp-hpux11.23 - # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess - # => hppa64-hp-hpux11.23 - - if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | - grep __LP64__ >/dev/null - then - HP_ARCH="hppa2.0w" - else - HP_ARCH="hppa64" - fi - fi - echo ${HP_ARCH}-hp-hpux${HPUX_REV} - exit ;; - ia64:HP-UX:*:*) - HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` - echo ia64-hp-hpux${HPUX_REV} - exit ;; - 3050*:HI-UX:*:*) - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #include - int - main () - { - long cpu = sysconf (_SC_CPU_VERSION); - /* The order matters, because CPU_IS_HP_MC68K erroneously returns - true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct - results, however. */ - if (CPU_IS_PA_RISC (cpu)) - { - switch (cpu) - { - case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; - case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; - case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; - default: puts ("hppa-hitachi-hiuxwe2"); break; - } - } - else if (CPU_IS_HP_MC68K (cpu)) - puts ("m68k-hitachi-hiuxwe2"); - else puts ("unknown-hitachi-hiuxwe2"); - exit (0); - } -EOF - $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && - { echo "$SYSTEM_NAME"; exit; } - echo unknown-hitachi-hiuxwe2 - exit ;; - 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) - echo hppa1.1-hp-bsd - exit ;; - 9000/8??:4.3bsd:*:*) - echo hppa1.0-hp-bsd - exit ;; - *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) - echo hppa1.0-hp-mpeix - exit ;; - hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) - echo hppa1.1-hp-osf - exit ;; - hp8??:OSF1:*:*) - echo hppa1.0-hp-osf - exit ;; - i*86:OSF1:*:*) - if [ -x /usr/sbin/sysversion ] ; then - echo ${UNAME_MACHINE}-unknown-osf1mk - else - echo ${UNAME_MACHINE}-unknown-osf1 - fi - exit ;; - parisc*:Lites*:*:*) - echo hppa1.1-hp-lites - exit ;; - C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) - echo c1-convex-bsd - exit ;; - C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) - if getsysinfo -f scalar_acc - then echo c32-convex-bsd - else echo c2-convex-bsd - fi - exit ;; - C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) - echo c34-convex-bsd - exit ;; - C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) - echo c38-convex-bsd - exit ;; - C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) - echo c4-convex-bsd - exit ;; - CRAY*Y-MP:*:*:*) - echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit ;; - CRAY*[A-Z]90:*:*:*) - echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ - | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ - -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ - -e 's/\.[^.]*$/.X/' - exit ;; - CRAY*TS:*:*:*) - echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit ;; - CRAY*T3E:*:*:*) - echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit ;; - CRAY*SV1:*:*:*) - echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit ;; - *:UNICOS/mp:*:*) - echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit ;; - F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) - FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` - FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` - echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" - exit ;; - 5000:UNIX_System_V:4.*:*) - FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` - FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` - echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" - exit ;; - i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) - echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} - exit ;; - sparc*:BSD/OS:*:*) - echo sparc-unknown-bsdi${UNAME_RELEASE} - exit ;; - *:BSD/OS:*:*) - echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} - exit ;; - *:FreeBSD:*:*) - case ${UNAME_MACHINE} in - pc98) - echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; - amd64) - echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; - *) - echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; - esac - exit ;; - i*:CYGWIN*:*) - echo ${UNAME_MACHINE}-pc-cygwin - exit ;; - *:MINGW*:*) - echo ${UNAME_MACHINE}-pc-mingw32 - exit ;; - i*:windows32*:*) - # uname -m includes "-pc" on this system. - echo ${UNAME_MACHINE}-mingw32 - exit ;; - i*:PW*:*) - echo ${UNAME_MACHINE}-pc-pw32 - exit ;; - *:Interix*:[3456]*) - case ${UNAME_MACHINE} in - x86) - echo i586-pc-interix${UNAME_RELEASE} - exit ;; - EM64T | authenticamd | genuineintel) - echo x86_64-unknown-interix${UNAME_RELEASE} - exit ;; - IA64) - echo ia64-unknown-interix${UNAME_RELEASE} - exit ;; - esac ;; - [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) - echo i${UNAME_MACHINE}-pc-mks - exit ;; - i*:Windows_NT*:* | Pentium*:Windows_NT*:*) - # How do we know it's Interix rather than the generic POSIX subsystem? - # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we - # UNAME_MACHINE based on the output of uname instead of i386? - echo i586-pc-interix - exit ;; - i*:UWIN*:*) - echo ${UNAME_MACHINE}-pc-uwin - exit ;; - amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) - echo x86_64-unknown-cygwin - exit ;; - p*:CYGWIN*:*) - echo powerpcle-unknown-cygwin - exit ;; - prep*:SunOS:5.*:*) - echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit ;; - *:GNU:*:*) - # the GNU system - echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` - exit ;; - *:GNU/*:*:*) - # other systems with GNU libc and userland - echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu - exit ;; - i*86:Minix:*:*) - echo ${UNAME_MACHINE}-pc-minix - exit ;; - arm*:Linux:*:*) - eval $set_cc_for_build - if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ - | grep -q __ARM_EABI__ - then - echo ${UNAME_MACHINE}-unknown-linux-gnu - else - echo ${UNAME_MACHINE}-unknown-linux-gnueabi - fi - exit ;; - avr32*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit ;; - cris:Linux:*:*) - echo cris-axis-linux-gnu - exit ;; - crisv32:Linux:*:*) - echo crisv32-axis-linux-gnu - exit ;; - frv:Linux:*:*) - echo frv-unknown-linux-gnu - exit ;; - ia64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit ;; - m32r*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit ;; - m68*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit ;; - mips:Linux:*:*) - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #undef CPU - #undef mips - #undef mipsel - #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) - CPU=mipsel - #else - #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) - CPU=mips - #else - CPU= - #endif - #endif -EOF - eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' - /^CPU/{ - s: ::g - p - }'`" - test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } - ;; - mips64:Linux:*:*) - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #undef CPU - #undef mips64 - #undef mips64el - #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) - CPU=mips64el - #else - #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) - CPU=mips64 - #else - CPU= - #endif - #endif -EOF - eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' - /^CPU/{ - s: ::g - p - }'`" - test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } - ;; - or32:Linux:*:*) - echo or32-unknown-linux-gnu - exit ;; - ppc:Linux:*:*) - echo powerpc-unknown-linux-gnu - exit ;; - ppc64:Linux:*:*) - echo powerpc64-unknown-linux-gnu - exit ;; - alpha:Linux:*:*) - case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in - EV5) UNAME_MACHINE=alphaev5 ;; - EV56) UNAME_MACHINE=alphaev56 ;; - PCA56) UNAME_MACHINE=alphapca56 ;; - PCA57) UNAME_MACHINE=alphapca56 ;; - EV6) UNAME_MACHINE=alphaev6 ;; - EV67) UNAME_MACHINE=alphaev67 ;; - EV68*) UNAME_MACHINE=alphaev68 ;; - esac - objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null - if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi - echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} - exit ;; - padre:Linux:*:*) - echo sparc-unknown-linux-gnu - exit ;; - parisc:Linux:*:* | hppa:Linux:*:*) - # Look for CPU level - case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in - PA7*) echo hppa1.1-unknown-linux-gnu ;; - PA8*) echo hppa2.0-unknown-linux-gnu ;; - *) echo hppa-unknown-linux-gnu ;; - esac - exit ;; - parisc64:Linux:*:* | hppa64:Linux:*:*) - echo hppa64-unknown-linux-gnu - exit ;; - s390:Linux:*:* | s390x:Linux:*:*) - echo ${UNAME_MACHINE}-ibm-linux - exit ;; - sh64*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit ;; - sh*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit ;; - sparc:Linux:*:* | sparc64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit ;; - vax:Linux:*:*) - echo ${UNAME_MACHINE}-dec-linux-gnu - exit ;; - x86_64:Linux:*:*) - echo x86_64-unknown-linux-gnu - exit ;; - xtensa*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit ;; - i*86:Linux:*:*) - # The BFD linker knows what the default object file format is, so - # first see if it will tell us. cd to the root directory to prevent - # problems with other programs or directories called `ld' in the path. - # Set LC_ALL=C to ensure ld outputs messages in English. - ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \ - | sed -ne '/supported targets:/!d - s/[ ][ ]*/ /g - s/.*supported targets: *// - s/ .*// - p'` - case "$ld_supported_targets" in - elf32-i386) - TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu" - ;; - a.out-i386-linux) - echo "${UNAME_MACHINE}-pc-linux-gnuaout" - exit ;; - "") - # Either a pre-BFD a.out linker (linux-gnuoldld) or - # one that does not give us useful --help. - echo "${UNAME_MACHINE}-pc-linux-gnuoldld" - exit ;; - esac - # Determine whether the default compiler is a.out or elf - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #include - #ifdef __ELF__ - # ifdef __GLIBC__ - # if __GLIBC__ >= 2 - LIBC=gnu - # else - LIBC=gnulibc1 - # endif - # else - LIBC=gnulibc1 - # endif - #else - #if defined(__INTEL_COMPILER) || defined(__PGI) || defined(__SUNPRO_C) || defined(__SUNPRO_CC) - LIBC=gnu - #else - LIBC=gnuaout - #endif - #endif - #ifdef __dietlibc__ - LIBC=dietlibc - #endif -EOF - eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' - /^LIBC/{ - s: ::g - p - }'`" - test x"${LIBC}" != x && { - echo "${UNAME_MACHINE}-pc-linux-${LIBC}" - exit - } - test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; } - ;; - i*86:DYNIX/ptx:4*:*) - # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. - # earlier versions are messed up and put the nodename in both - # sysname and nodename. - echo i386-sequent-sysv4 - exit ;; - i*86:UNIX_SV:4.2MP:2.*) - # Unixware is an offshoot of SVR4, but it has its own version - # number series starting with 2... - # I am not positive that other SVR4 systems won't match this, - # I just have to hope. -- rms. - # Use sysv4.2uw... so that sysv4* matches it. - echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} - exit ;; - i*86:OS/2:*:*) - # If we were able to find `uname', then EMX Unix compatibility - # is probably installed. - echo ${UNAME_MACHINE}-pc-os2-emx - exit ;; - i*86:XTS-300:*:STOP) - echo ${UNAME_MACHINE}-unknown-stop - exit ;; - i*86:atheos:*:*) - echo ${UNAME_MACHINE}-unknown-atheos - exit ;; - i*86:syllable:*:*) - echo ${UNAME_MACHINE}-pc-syllable - exit ;; - i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) - echo i386-unknown-lynxos${UNAME_RELEASE} - exit ;; - i*86:*DOS:*:*) - echo ${UNAME_MACHINE}-pc-msdosdjgpp - exit ;; - i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) - UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` - if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then - echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} - else - echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} - fi - exit ;; - i*86:*:5:[678]*) - # UnixWare 7.x, OpenUNIX and OpenServer 6. - case `/bin/uname -X | grep "^Machine"` in - *486*) UNAME_MACHINE=i486 ;; - *Pentium) UNAME_MACHINE=i586 ;; - *Pent*|*Celeron) UNAME_MACHINE=i686 ;; - esac - echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} - exit ;; - i*86:*:3.2:*) - if test -f /usr/options/cb.name; then - UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then - UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` - (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 - (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ - && UNAME_MACHINE=i586 - (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ - && UNAME_MACHINE=i686 - (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ - && UNAME_MACHINE=i686 - echo ${UNAME_MACHINE}-pc-sco$UNAME_REL - else - echo ${UNAME_MACHINE}-pc-sysv32 - fi - exit ;; - pc:*:*:*) - # Left here for compatibility: - # uname -m prints for DJGPP always 'pc', but it prints nothing about - # the processor, so we play safe by assuming i586. - # Note: whatever this is, it MUST be the same as what config.sub - # prints for the "djgpp" host, or else GDB configury will decide that - # this is a cross-build. - echo i586-pc-msdosdjgpp - exit ;; - Intel:Mach:3*:*) - echo i386-pc-mach3 - exit ;; - paragon:*:*:*) - echo i860-intel-osf1 - exit ;; - i860:*:4.*:*) # i860-SVR4 - if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then - echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 - else # Add other i860-SVR4 vendors below as they are discovered. - echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 - fi - exit ;; - mini*:CTIX:SYS*5:*) - # "miniframe" - echo m68010-convergent-sysv - exit ;; - mc68k:UNIX:SYSTEM5:3.51m) - echo m68k-convergent-sysv - exit ;; - M680?0:D-NIX:5.3:*) - echo m68k-diab-dnix - exit ;; - M68*:*:R3V[5678]*:*) - test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; - 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) - OS_REL='' - test -r /etc/.relid \ - && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` - /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ - && { echo i486-ncr-sysv4.3${OS_REL}; exit; } - /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ - && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; - 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) - /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ - && { echo i486-ncr-sysv4; exit; } ;; - NCR*:*:4.2:* | MPRAS*:*:4.2:*) - OS_REL='.3' - test -r /etc/.relid \ - && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` - /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ - && { echo i486-ncr-sysv4.3${OS_REL}; exit; } - /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ - && { echo i586-ncr-sysv4.3${OS_REL}; exit; } - /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \ - && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; - m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) - echo m68k-unknown-lynxos${UNAME_RELEASE} - exit ;; - mc68030:UNIX_System_V:4.*:*) - echo m68k-atari-sysv4 - exit ;; - TSUNAMI:LynxOS:2.*:*) - echo sparc-unknown-lynxos${UNAME_RELEASE} - exit ;; - rs6000:LynxOS:2.*:*) - echo rs6000-unknown-lynxos${UNAME_RELEASE} - exit ;; - PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*) - echo powerpc-unknown-lynxos${UNAME_RELEASE} - exit ;; - SM[BE]S:UNIX_SV:*:*) - echo mips-dde-sysv${UNAME_RELEASE} - exit ;; - RM*:ReliantUNIX-*:*:*) - echo mips-sni-sysv4 - exit ;; - RM*:SINIX-*:*:*) - echo mips-sni-sysv4 - exit ;; - *:SINIX-*:*:*) - if uname -p 2>/dev/null >/dev/null ; then - UNAME_MACHINE=`(uname -p) 2>/dev/null` - echo ${UNAME_MACHINE}-sni-sysv4 - else - echo ns32k-sni-sysv - fi - exit ;; - PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort - # says - echo i586-unisys-sysv4 - exit ;; - *:UNIX_System_V:4*:FTX*) - # From Gerald Hewes . - # How about differentiating between stratus architectures? -djm - echo hppa1.1-stratus-sysv4 - exit ;; - *:*:*:FTX*) - # From seanf@swdc.stratus.com. - echo i860-stratus-sysv4 - exit ;; - i*86:VOS:*:*) - # From Paul.Green@stratus.com. - echo ${UNAME_MACHINE}-stratus-vos - exit ;; - *:VOS:*:*) - # From Paul.Green@stratus.com. - echo hppa1.1-stratus-vos - exit ;; - mc68*:A/UX:*:*) - echo m68k-apple-aux${UNAME_RELEASE} - exit ;; - news*:NEWS-OS:6*:*) - echo mips-sony-newsos6 - exit ;; - R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) - if [ -d /usr/nec ]; then - echo mips-nec-sysv${UNAME_RELEASE} - else - echo mips-unknown-sysv${UNAME_RELEASE} - fi - exit ;; - BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. - echo powerpc-be-beos - exit ;; - BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. - echo powerpc-apple-beos - exit ;; - BePC:BeOS:*:*) # BeOS running on Intel PC compatible. - echo i586-pc-beos - exit ;; - BePC:Haiku:*:*) # Haiku running on Intel PC compatible. - echo i586-pc-haiku - exit ;; - SX-4:SUPER-UX:*:*) - echo sx4-nec-superux${UNAME_RELEASE} - exit ;; - SX-5:SUPER-UX:*:*) - echo sx5-nec-superux${UNAME_RELEASE} - exit ;; - SX-6:SUPER-UX:*:*) - echo sx6-nec-superux${UNAME_RELEASE} - exit ;; - SX-7:SUPER-UX:*:*) - echo sx7-nec-superux${UNAME_RELEASE} - exit ;; - SX-8:SUPER-UX:*:*) - echo sx8-nec-superux${UNAME_RELEASE} - exit ;; - SX-8R:SUPER-UX:*:*) - echo sx8r-nec-superux${UNAME_RELEASE} - exit ;; - Power*:Rhapsody:*:*) - echo powerpc-apple-rhapsody${UNAME_RELEASE} - exit ;; - *:Rhapsody:*:*) - echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} - exit ;; - *:Darwin:*:*) - UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown - case $UNAME_PROCESSOR in - unknown) UNAME_PROCESSOR=powerpc ;; - esac - echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} - exit ;; - *:procnto*:*:* | *:QNX:[0123456789]*:*) - UNAME_PROCESSOR=`uname -p` - if test "$UNAME_PROCESSOR" = "x86"; then - UNAME_PROCESSOR=i386 - UNAME_MACHINE=pc - fi - echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} - exit ;; - *:QNX:*:4*) - echo i386-pc-qnx - exit ;; - NSE-?:NONSTOP_KERNEL:*:*) - echo nse-tandem-nsk${UNAME_RELEASE} - exit ;; - NSR-?:NONSTOP_KERNEL:*:*) - echo nsr-tandem-nsk${UNAME_RELEASE} - exit ;; - *:NonStop-UX:*:*) - echo mips-compaq-nonstopux - exit ;; - BS2000:POSIX*:*:*) - echo bs2000-siemens-sysv - exit ;; - DS/*:UNIX_System_V:*:*) - echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} - exit ;; - *:Plan9:*:*) - # "uname -m" is not consistent, so use $cputype instead. 386 - # is converted to i386 for consistency with other x86 - # operating systems. - if test "$cputype" = "386"; then - UNAME_MACHINE=i386 - else - UNAME_MACHINE="$cputype" - fi - echo ${UNAME_MACHINE}-unknown-plan9 - exit ;; - *:TOPS-10:*:*) - echo pdp10-unknown-tops10 - exit ;; - *:TENEX:*:*) - echo pdp10-unknown-tenex - exit ;; - KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) - echo pdp10-dec-tops20 - exit ;; - XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) - echo pdp10-xkl-tops20 - exit ;; - *:TOPS-20:*:*) - echo pdp10-unknown-tops20 - exit ;; - *:ITS:*:*) - echo pdp10-unknown-its - exit ;; - SEI:*:*:SEIUX) - echo mips-sei-seiux${UNAME_RELEASE} - exit ;; - *:DragonFly:*:*) - echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` - exit ;; - *:*VMS:*:*) - UNAME_MACHINE=`(uname -p) 2>/dev/null` - case "${UNAME_MACHINE}" in - A*) echo alpha-dec-vms ; exit ;; - I*) echo ia64-dec-vms ; exit ;; - V*) echo vax-dec-vms ; exit ;; - esac ;; - *:XENIX:*:SysV) - echo i386-pc-xenix - exit ;; - i*86:skyos:*:*) - echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' - exit ;; - i*86:rdos:*:*) - echo ${UNAME_MACHINE}-pc-rdos - exit ;; - i*86:AROS:*:*) - echo ${UNAME_MACHINE}-pc-aros - exit ;; -esac - -#echo '(No uname command or uname output not recognized.)' 1>&2 -#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 - -eval $set_cc_for_build -cat >$dummy.c < -# include -#endif -main () -{ -#if defined (sony) -#if defined (MIPSEB) - /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, - I don't know.... */ - printf ("mips-sony-bsd\n"); exit (0); -#else -#include - printf ("m68k-sony-newsos%s\n", -#ifdef NEWSOS4 - "4" -#else - "" -#endif - ); exit (0); -#endif -#endif - -#if defined (__arm) && defined (__acorn) && defined (__unix) - printf ("arm-acorn-riscix\n"); exit (0); -#endif - -#if defined (hp300) && !defined (hpux) - printf ("m68k-hp-bsd\n"); exit (0); -#endif - -#if defined (NeXT) -#if !defined (__ARCHITECTURE__) -#define __ARCHITECTURE__ "m68k" -#endif - int version; - version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; - if (version < 4) - printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); - else - printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); - exit (0); -#endif - -#if defined (MULTIMAX) || defined (n16) -#if defined (UMAXV) - printf ("ns32k-encore-sysv\n"); exit (0); -#else -#if defined (CMU) - printf ("ns32k-encore-mach\n"); exit (0); -#else - printf ("ns32k-encore-bsd\n"); exit (0); -#endif -#endif -#endif - -#if defined (__386BSD__) - printf ("i386-pc-bsd\n"); exit (0); -#endif - -#if defined (sequent) -#if defined (i386) - printf ("i386-sequent-dynix\n"); exit (0); -#endif -#if defined (ns32000) - printf ("ns32k-sequent-dynix\n"); exit (0); -#endif -#endif - -#if defined (_SEQUENT_) - struct utsname un; - - uname(&un); - - if (strncmp(un.version, "V2", 2) == 0) { - printf ("i386-sequent-ptx2\n"); exit (0); - } - if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ - printf ("i386-sequent-ptx1\n"); exit (0); - } - printf ("i386-sequent-ptx\n"); exit (0); - -#endif - -#if defined (vax) -# if !defined (ultrix) -# include -# if defined (BSD) -# if BSD == 43 - printf ("vax-dec-bsd4.3\n"); exit (0); -# else -# if BSD == 199006 - printf ("vax-dec-bsd4.3reno\n"); exit (0); -# else - printf ("vax-dec-bsd\n"); exit (0); -# endif -# endif -# else - printf ("vax-dec-bsd\n"); exit (0); -# endif -# else - printf ("vax-dec-ultrix\n"); exit (0); -# endif -#endif - -#if defined (alliant) && defined (i860) - printf ("i860-alliant-bsd\n"); exit (0); -#endif - - exit (1); -} -EOF - -$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` && - { echo "$SYSTEM_NAME"; exit; } - -# Apollos put the system type in the environment. - -test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; } - -# Convex versions that predate uname can use getsysinfo(1) - -if [ -x /usr/convex/getsysinfo ] -then - case `getsysinfo -f cpu_type` in - c1*) - echo c1-convex-bsd - exit ;; - c2*) - if getsysinfo -f scalar_acc - then echo c32-convex-bsd - else echo c2-convex-bsd - fi - exit ;; - c34*) - echo c34-convex-bsd - exit ;; - c38*) - echo c38-convex-bsd - exit ;; - c4*) - echo c4-convex-bsd - exit ;; - esac -fi - -cat >&2 < in order to provide the needed -information to handle your system. - -config.guess timestamp = $timestamp - -uname -m = `(uname -m) 2>/dev/null || echo unknown` -uname -r = `(uname -r) 2>/dev/null || echo unknown` -uname -s = `(uname -s) 2>/dev/null || echo unknown` -uname -v = `(uname -v) 2>/dev/null || echo unknown` - -/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` -/bin/uname -X = `(/bin/uname -X) 2>/dev/null` - -hostinfo = `(hostinfo) 2>/dev/null` -/bin/universe = `(/bin/universe) 2>/dev/null` -/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` -/bin/arch = `(/bin/arch) 2>/dev/null` -/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` -/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` - -UNAME_MACHINE = ${UNAME_MACHINE} -UNAME_RELEASE = ${UNAME_RELEASE} -UNAME_SYSTEM = ${UNAME_SYSTEM} -UNAME_VERSION = ${UNAME_VERSION} -EOF - -exit 1 - -# Local variables: -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "timestamp='" -# time-stamp-format: "%:y-%02m-%02d" -# time-stamp-end: "'" -# End: diff -Nru ess-18.10.2/etc/other/pkg1/DESCRIPTION ess-18.10.2+git20220915.f45542e/etc/other/pkg1/DESCRIPTION --- ess-18.10.2/etc/other/pkg1/DESCRIPTION 2018-11-10 09:41:11.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/etc/other/pkg1/DESCRIPTION 1970-01-01 00:00:00.000000000 +0000 @@ -1,9 +0,0 @@ -Package: pkg1 -Type: Package -Title: A sample package for testing ESS -Version: 1.0 -Date: 2014-01-20 -Author: ESS Core -Maintainer: -Description: A sample package for testing ESS -License: GPL-2 diff -Nru ess-18.10.2/etc/other/pkg1/man/D1tr.Rd ess-18.10.2+git20220915.f45542e/etc/other/pkg1/man/D1tr.Rd --- ess-18.10.2/etc/other/pkg1/man/D1tr.Rd 2018-11-10 09:41:11.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/etc/other/pkg1/man/D1tr.Rd 1970-01-01 00:00:00.000000000 +0000 @@ -1,36 +0,0 @@ -\name{D1tr} -\alias{D1tr} -\title{Numerical Derivatives of (x,y) Data} -\description{ - Compute the numerical derivatives of \eqn{f()} given - observations \code{(x[i], y ~= f(x[i]))}. - - \code{D1tr} is the \emph{\bold{tr}ivial} discrete first derivative - using simple difference ratios. - - This is \bold{far} from optimal and only kept here for reference. -} -\usage{ -D1tr(y, x = 1) -} -\arguments{ - \item{x,y}{numeric vectors of same length, supposedly from a model - \code{y ~ f(x)}. For \code{D1tr()}, \code{x} can have length one - and then gets the meaning of \eqn{h = \Delta x}.} -} -\value{ - \code{D1tr()} returns a numeric vector of the length of \code{y}. -} -\author{Martin Maechler, in 1992 (for S).} -\seealso{\code{\link[sfsmisc]{D1D2}} which directly uses the 2nd - derivative of the smoothing spline; \code{\link{smooth.spline}}. -} -\examples{ -set.seed(330) -x <- sort(runif(500, 0,10)) -y <- sin(x) + rnorm(500)/100 -f1 <- D1tr(x=x,y=y) -plot(x,f1, ylim = range(c(-1,1, f1))) -curve(cos(x), col=3, add= TRUE) -} -\keyword{smooth} diff -Nru ess-18.10.2/etc/other/pkg1/NAMESPACE ess-18.10.2+git20220915.f45542e/etc/other/pkg1/NAMESPACE --- ess-18.10.2/etc/other/pkg1/NAMESPACE 2018-11-10 09:41:11.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/etc/other/pkg1/NAMESPACE 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -export(D1tr) diff -Nru ess-18.10.2/etc/other/pkg1/R/D1tr.R ess-18.10.2+git20220915.f45542e/etc/other/pkg1/R/D1tr.R --- ess-18.10.2/etc/other/pkg1/R/D1tr.R 2018-11-10 09:41:11.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/etc/other/pkg1/R/D1tr.R 1970-01-01 00:00:00.000000000 +0000 @@ -1,20 +0,0 @@ -D1tr <- function(y, x = 1) -{ - ## Purpose: discrete trivial estimate of 1st derivative. - ## ---------------------------------------------------------------------- - ## Arguments: x is optional; let's say we don't like "'" - ## ---------------------------------------------------------------------- - ## Author: Martin Maechler, ~ 1990 - n <- length(y) - - if(length(x) == 1) - c(y[2] - y[1], 0.5 * (y[-(1:2)] - y[-((n-1):n)]), y[n] - y[n-1])/x - else { - ## Here, already using non-matching apostrophes, but developer mode - ## still seems to work .. - if(n != length(x)) stop("lengths' of x & 'y' must equal") - if(is.unsorted(x)) stop("'x' must be sorted !") - c(y[2] - y[1], 0.5 * (y[-(1:2)] - y[-((n-1):n)]), y[n] - y[n-1]) / - c(x[2] - x[1], 0.5 * (x[-(1:2)] - x[-((n-1):n)]), x[n] - x[n-1]) - } -} diff -Nru ess-18.10.2/etc/other/sje-ess-notes.txt ess-18.10.2+git20220915.f45542e/etc/other/sje-ess-notes.txt --- ess-18.10.2/etc/other/sje-ess-notes.txt 2018-11-10 09:41:11.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/etc/other/sje-ess-notes.txt 1970-01-01 00:00:00.000000000 +0000 @@ -1,283 +0,0 @@ -Stephen Eglen's notes on future changes to ESS -*- org -*- - -* Problem with ESS infrastructure and Martin away? Email isg@math.ethz.ch -* ess-history-file - -needs documenting and possibly updating: - -From: Stephen Eglen -To: Erik Iverson -Comments: In-reply-to Erik Iverson - message dated "Wed, 20 Apr 2011 09:36:26 -0500." -Date: Tue, 26 Apr 2011 09:01:29 +0100 -Cc: Feng Li , ess-help@stat.math.ethz.ch -Subject: Re: [ESS] ESS and .Rhistory -Sender: ess-help-bounces@r-project.org - -Dear Erik, Feng, - -Thanks for this -- I was blissfully unaware about this persistence of -history across R sessions. Howabout if we change the semantics of -ess-history-file to be: - -nil -- do not attempt to read/write a history file -t -- use the default naming scheme for loading the history -"some.string" -- use this value as the filename. - - -Stephen -> Feng, -> -> On 04/20/2011 09:00 AM, Feng Li wrote: -> > Dear list, -> > -> > I tried to change the ESS default R history to a permanent file so -> > that ESS does not generate .Rhistory everywhere. I tried both -> > -> > (setq ess-history-directory "~/.R/history") -> > -> > and -> > -> > (setq ess-history-file "~/.R/history/.Rhistory") -> -> If I recall correctly, it's because of the way the ess-history-file -> variable is set in the ESS code. The following works for me: -> -> (defun ei-no-rhistory () -> (setq ess-history-file "/dev/null")) -> -> (add-hook 'inferior-ess-mode-hook 'ei-no-rhistory) - -* completion of functions within buffers - -From: Stephen Eglen -To: ESS-help@stat.math.ethz.ch -Date: Tue, 22 Jun 2010 14:00:25 +0100 -Cc: Stephen Eglen -Subject: [ESS] request for comments: completion within .R buffers -Sender: ess-help-bounces@stat.math.ethz.ch - -Rodney recently kindly polled ess-help, and a summary of the results can -be seen in the SVN sources at: - -https://svn.r-project.org/ESS/trunk/rsn.txt - -One thing that came up was (thanks Ista Zhan): - - Function/variable completion in script files (maybe this already is - supposed to work, but for me completion only works in interactive - sessions). - -Below is some suggested code to implement this, based on a hint from -Deepayan. If you press TAB at the start of the line, you still get -standard indentation, but if you are already typing something, e.g. - write.t - -then hitting TAB will complete to write.table - -Hitting TAB again, will then bring up a *Completions* window showing -(for me): - -Possible completions are: -write.table -write.table0 - -I don't like the *Completions* window hanging around, but apart from -that, is that the sort of completion people would like? Erik Iverson -mentioned something related: - - I think ESS is very feature complete at this point. The only thing - I've looked at that seems interesting is some sort of 'intellisense' - feature that uses R's built-in completion mechanism to temporarily - display available completions using something like company-mode, - autocomplete, or completion-ui. I had at one point something that - almost worked, but I believe the library it was built in, - company-mode, has now changed significantly. - -but I've not explored those options. - -Code/ideas welcome! - -Stephen - ----------------------------------------------------------------------- - -(defun ess-indent-or-complete (&optional whole-exp) - (interactive "P") - "Function bound to TAB key in R mode buffers. -If at the start of the line, or numeric prefix provided, call -`ess-indent-command', otherwise try to complete object at point." - (if (or whole-exp - (save-excursion - (skip-chars-backward " \t") - (bolp))) - (ess-indent-command whole-exp) - (ess-complete-object-name))) - -(add-hook 'ess-mode-hook - '(lambda () (local-set-key "\t" 'ess-indent-or-complete))) - - -* ess-eldoc.el - -** Switch to use R-mode-hook, rather than ess-mode-hook - -** Document in the info node. - -* Debugger - -Would like to implement a debugger akin to Norm Matloff's work: - -https://cran.r-project.org/web/packages/edtdbg/index.html - -http://www.stats.uwo.ca/faculty/murdoch/software/debuggingR/ - -Norm posted that he had started work on ESS, but had to abandon it. - - -* Comint so slow? ess-eval-visibly-p should be t again. - -Why is comint so slow when passing code line by line? Markus Triska -recently looked at this: - -To: ess-help@stat.math.ethz.ch -connect(): No such file or directory -From: Markus Triska -Date: Sun, 16 May 2010 13:59:57 +0200 -Subject: Re: [ESS] ESS on Mac slower than R.app? -Sender: ess-help-bounces@stat.math.ethz.ch - -Hi Rodney, - -Rodney Sparapani writes: - -> I think if you update to the latest version of ESS this problem will -> go away. See the previous discussion of a very similar GNU Emacs bug -> fix at https://stat.ethz.ch/pipermail/ess-bugs/2009q4/000584.html - -I think ess-eval-visibly-p should remain true by default, as it is quite -useful. If you change the accept-process-output call in -ess-eval-linewise to: - - (accept-process-output sprocess 0 timeout-ms) - -(the difference being that you explicitly state to wait for input from -"sprocess"), the test case works instantly also with ess-eval-visibly-p. - -All the best, -Markus - -* Funny indentation if semicolon follows brace: - -From: Stephen Eglen -To: Paul Burkander -Comments: In-reply-to Paul Burkander - message dated "Sat, 04 Jun 2011 10:17:03 -0400." -Date: Mon, 06 Jun 2011 10:35:27 +0100 -Cc: ess-help@r-project.org -Subject: Re: [ESS] ess-indent-exp follow OWN style? -Sender: ess-help-bounces@r-project.org - -> I think it must be ess-electric-brace, and I think it warrants a bug report. -> -> The behavior is the same in R and Stata (though I don't know if it -> would ever come up in R) -> -> Typing any line (excluding comments) that ends in { sets the -> indentation of the next line to ess-indent-level -> Typing any line (excluding comments) that ends in {; sets the -> indentation of the next line to so that the first character is below -> the preceding semicolon. -> -> I know basically nothing about Lisp, otherwise I'd like to try to -> debug this thing.  It seems like an important replicable issue that -> warrants a bug report. - -Thanks; I can see this behaviour in R mode. As I don't think its a -common idiom in R to write something like - - for (i in seq) {; - ... - -I'm afraid its not high enough on my priority list to fix right now -(sorry, too many other things already need fixing in ESS), but -I will make a note of it. Is this biting other users? - -Stephen - -** is ess-electric-brace working okay? should reindent line? - -* Handing the *ESS* buffer - -Is the *ESS* buffer necessary for end users? If not, have a toggle to -switch it off. - - From: Stephen Eglen - Date: Mon, 6 Jun 2011 22:12:08 +0100 - - > Re: the *ESS* buffer, how much of a pain is it? I recall also - > finding it a bit offputting seeing this many years ago, and in all - > my years of developing ESS, I for one have yet to find reason of - > inspecting it! I imagine other developers may differ -- but one - > thing I could suggest to other core members is having a variable - > to inhibit this buffer? - - This could be as simple as having a variable ess-dribble-buffer - which if nil, means that the buffer is not created, otherwise, the - variable contains (as a string) the name of the buffer to use, which - defaults to "*ESS*". It could even be " *ESS*" so that it doesn't - appear in buffer lists, but is there and will be included into - reports generated by ess-submit-bug-report. - - -* Add ess-r-versions-list - -Subject: Re: [ESS] Customisation of ess-r-versions or ess-r-versions-list -From: John Maindonald -Date: Thu, 18 Aug 2011 10:19:44 +1000 -Cc: ess-help@stat.math.ethz.ch -To: Stephen Eglen - -On 18/08/2011, at 5:38 AM, Stephen Eglen wrote: - ->> Yes, ->> (setq ess-s-versions-list ->> '( ("R64" "/usr/bin/R64") ->> ("R32" "/usr/bin/R32"))) ->> works. The buffer for R64 is however called *S+6*. No doubt there is ->> some variable that one can set that will fix this; I have not ->> investigated. -> I don't recall ever doing this for R, but this was quite a few years -> ago. Did it ever work for you in earlier versions of ESS? - -The lines that I had commented out had 'ess-r-versions-list'. If this variable -has never been available, this would be something that I tried by analogy -with 'ess-s-versions-list' and never did work. - -If 'ess-s-versions-list' is to stay, it would seem to be cleanest to have a -matching 'ess-r-versions-list' also, following the precedent of -'ess-s-versions' and 'ess-r-versions'. An advantage of this way of doing -things (an 'ess-r-versions-list'), for some users at least, is that it is explicit -about the command line statement that is invoked. - -> One can have defvar in place of setq. Does it matter which one uses? -> Better to use setq -- as it will always update the value. By contrast: -> -> (defvar apple 1) -> (defvar apple 2) -> -> Evaluate both lines above, in order, and check "apple" -- it has the -> value 1. -> -> Stephen - - -John Maindonald email: john.maindonald@anu.edu.au -phone : +61 2 (6125)3473 fax : +61 2(6125)5549 -Centre for Mathematics & Its Applications, Room 1194, -John Dedman Mathematical Sciences Building (Building 27) -Australian National University, Canberra ACT 0200. -http://www.maths.anu.edu.au/~johnm - -* Toolbar is missing from file.Rt transcript buffers -Add toolbar? diff -Nru ess-18.10.2/etc/pkg-Maintainers ess-18.10.2+git20220915.f45542e/etc/pkg-Maintainers --- ess-18.10.2/etc/pkg-Maintainers 2018-11-10 09:41:11.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/etc/pkg-Maintainers 1970-01-01 00:00:00.000000000 +0000 @@ -1,3 +0,0 @@ -Debian: Dirk Eddelbuettel -RPM: Tom Moertel -SuSe: Detlef Steuer diff -Nru ess-18.10.2/etc/R-error-patterns.R ess-18.10.2+git20220915.f45542e/etc/R-error-patterns.R --- ess-18.10.2/etc/R-error-patterns.R 2018-11-10 09:41:11.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/etc/R-error-patterns.R 1970-01-01 00:00:00.000000000 +0000 @@ -1,71 +0,0 @@ - -## 1 -Error: chunk 7 (label = OP4) -Error in disp.Rnw:656:31: unexpected symbol -655: par(mgp = c(2.5, 1, 1), mar = c(0, 0, 0, 0), - 656: plt= c(0.08, 0.9, 0.25, 0.p9 -)) - -## 2 -Browse[2]> Error in x %*% y (from models.R#46) : - Cholmod error 'X and/or Y have wrong dimensions' at file ../MatrixOps/cholmod_sdmult.c, line 90 - -## 3 -Error in source("~/works/protoClasses/R/funcs.R") (from hierarchy.R#6) : - ~/works/protoClasses/R/funcs.R:1797:5: unexpected '[[' -1796: b[[2]] <- quote(browser()) -1797: [[ - ^ -## 4 -source("basicModel.R") -Error in source("basicModel.R") : basicModel.R:95:1: unexpected symbol -94: -95: ixQ - ^ - -## 5.a -> + Error in source(file = "/home/vitoshka/works/pbm/R/S4.R") (from #1) : - /home/vitoshka/works/pbm/R/S4.R:36:62: unexpected ')' -35: }, list(vname = as.name(".pix_v")), -36: pname = as.name(".pix_p")))) - ^ - -## 5.b -> + Error in source(file = "/home/vitoshka/works/pbm/R/S4.R") (from #1) : - c:/home/vitoshka/works/pbm/R/S4.R:36:62: unexpected ')' -35: }, list(vname = as.name(".pix_v")), -36: pname = as.name(".pix_p")))) - ^ - -## 6 first line is not a pattern! -+ . + Error in base::source(file = file, echo = echo, local = local, print.eval = print.eval, (from #95) : - /tmp/model_mixture.R@4:5:13: unexpected symbol -4: Mq$DATA$ixs$clust <- data$ixQ -5: Mq - -## 7 don't highlight dates - id lat lon obs_date - Min. : 1.00 Min. :21.57 Min. :-179.88 01/02/1997 04:16:53: 1 - 1st Qu.: 99.25 1st Qu.:24.36 1st Qu.:-147.38 01/02/1997 05:56:25: 1 - Median :197.50 Median :25.64 Median :-119.64 01/04/1997 17:41:54: 1 - Mean :197.50 Mean :27.21 Mean : -21.52 01/05/1997 17:20:07: 1 - 3rd Qu.:295.75 3rd Qu.:27.41 3rd Qu.: 153.66 01/06/1997 04:31:13: 1 - Max. :394.00 Max. :39.84 Max. : 179.93 01/06/1997 06:12:56: 1 - (Other) :388 -## 8 valgrind errors -==25269== Invalid read of size 8 -==25269== at 0x9EC363C: inner_product (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) - -## 9 testhat new patterns -test_embeddings.R:20: failure: average embedding works -embed_vocab(vocab, embs) not equal to embs[, 1:N]. -Attributes: < Length mismatch: comparison on first 1 components > - -test_embeddings.R:59: error: average embedding works with missing values -no 'dimnames' attribute for array -1: expect_equal(e[, "dd"], e[, "ee"]) at /store/Dropbox/dev/mlvocab/tests/testthat/test_embeddings.R:59 -2: quasi_label(enquo(object), label) at /tmp/Rtmp6McxD6/R.INSTALL70c948e315c6/testthat/R/expect-equality.R:51 -3: eval_bare(get_expr(quo), get_env(quo)) at /tmp/Rtmp6McxD6/R.INSTALL70c948e315c6/testthat/R/expectation.R:90 - diff -Nru ess-18.10.2/etc/R-ESS-bugs.el ess-18.10.2+git20220915.f45542e/etc/R-ESS-bugs.el --- ess-18.10.2/etc/R-ESS-bugs.el 2018-11-10 09:41:11.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/etc/R-ESS-bugs.el 1970-01-01 00:00:00.000000000 +0000 @@ -1,91 +0,0 @@ -;;;; Things that go wrong or *went* wrong in the past -;;;; (from list side) see R-ESS-bugs.R for the R's side. - - - ;;;; 1 ess-get-words-from-vector stumbles over \" -(ess-get-words-from-vector "c('aaa','bbb\"ccc', 'dddd')\n") -;;-> (" " "ccc" "dddd"): SOLVED - - -;;;; 2 ess-get-words-from-vector disregards max.print -;; options(max.print=1000) (warning added to the docs) -(length (ess-get-words-from-vector "as.character(1:10000)\n")) -;;-> 1001 with "max.print" at the end; added a comment in the function doc - -;;;; 3 Inferior-ess-primary-prompt does not capture "+ + > " -;; this hangs emacs; SOLVED -(ess-command "tf<-function(N){ -N}\n") - -;;;; 4 ess-command detects the prompt prematurely -;; this outputs str(iris) in the inferior buffer; SOLVED -(ess-command " -lm_test <- function (formula, data, subset, weights, na.action, method = 'qr', - model = TRUE, x = FALSE, y = FALSE, qr = TRUE, singular.ok = TRUE, - contrasts = NULL, offset, ...) -{ - cl <- match.call() - mf <- match.call(expand.dots = FALSE) - m <- match(c('formula', 'data', 'subset', 'weights', 'na.action', - 'offset'), names(mf), 0L) - mf <- mf[c(1L, m)] - mf$drop.unused.levels <- TRUE - mf[[1L]] <- as.name('model.frame') - mf <- eval(mf, parent.frame()) - if (method == 'model.frame') - return(mf) - else if (method != 'qr') - warning(gettextf('method is not supported. Using', - method), domain = NA) - mt <- attr(mf, 'terms') - y <- model.response(mf, 'numeric') - w <- as.vector(model.weights(mf)) - if (!is.null(w) && !is.numeric(w)) - stop('weights must be a numeric vector') - offset <- as.vector(model.offset(mf)) - if (!is.null(offset)) { - if (length(offset) != NROW(y)) - stop(gettextf('number of offsets is %d, should equal %d (number of observations)', - length(offset), NROW(y)), domain = NA) - } - if (is.empty.model(mt)) { - x <- NULL - z <- list(coefficients = if (is.matrix(y)) matrix(, 0, - 3) else numeric(0L), residuals = y, fitted.values = 0 * - y, weights = w, rank = 0L, df.residual = if (!is.null(w)) sum(w != - 0) else if (is.matrix(y)) nrow(y) else length(y)) - if (!is.null(offset)) { - z$fitted.values <- offset - z$residuals <- y - offset - } - } - else { - x <- model.matrix(mt, mf, contrasts) - z <- if (is.null(w)) - lm.fit(x, y, offset = offset, singular.ok = singular.ok, - ...) - else lm.wfit(x, y, w, offset = offset, singular.ok = singular.ok, - ...) - } - class(z) <- c(if (is.matrix(y)) 'mlm', 'lm') - z$na.action <- attr(mf, 'na.action') - z$offset <- offset - z$contrasts <- attr(x, 'contrasts') - z$xlevels <- .getXlevels(mt, mf) - z$call <- cl - z$terms <- mt - if (model) - z$model <- mf - if (ret.x) - z$x <- x - if (ret.y) - z$y <- y - if (!qr) - z$qr <- NULL - z -} -str(iris) -") - -;;;; 5 double prompt > > used to stall emacs; SOLVED -(ess-command "\n\n\n") diff -Nru ess-18.10.2/etc/R-ESS-bugs.R ess-18.10.2+git20220915.f45542e/etc/R-ESS-bugs.R --- ess-18.10.2/etc/R-ESS-bugs.R 2018-11-10 09:41:11.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/etc/R-ESS-bugs.R 1970-01-01 00:00:00.000000000 +0000 @@ -1,951 +0,0 @@ -#### File showing off things that go wrong or *went* wrong in the past #### -- with R-mode (mostly coded in ../lisp/ess-mode.el ) - -### NOTE: this file is indented with RRR style !!!!! -### but do not change indentations anymore of anything in here: -### expressions are written as we *want* them, not as ESS currently puts them - -options(keep.source = FALSE) # so we see R's deparse() + print() indentation - - -### --- 1 --------- extraneous comment chars : This seems fixed - -## From: Robert Gentleman -## To: Martin Maechler -## Subject: ESS buglet -## Date: Sun, 01 Jul 2007 21:41:24 -0700 - -## Hi Martin, -## It seems that the following buglet exists (at least in what ever -## version I am using) - -##a silly comment -##and a second one -foo <- function(x=a, abc = list("def", a=1,3,3), more.args, and, bla, - blu, bl, - another, plus, yet.another, and_mbasd, - lots = NULL, - more = NULL, - args = NULL) { - x -} - -##- when the line before a function def is a comment, and adding args, -##- then new lines, when generated have a comment char at the beginning of -##- the line. It is slightly annoying as I have to remove the comment char. -##- -##- If I add a blank line after the comment line, then the problem does not -##- occur. -## and another ''anonymous'' function: -function(x=a, abc = list("def", a=c(1,3,3)), more.args, and, bla, blu, - blo, Abc, - def, - another, and_another, and_this) { - ...; ... -} - -## This is a "TRUE" example (from Matrix/tests/ ): -NA.or.True <- function(x) is.na(x) | x - -abc <- function(x, y, ...) this.is.just.a.one.liner(x,y, z=TRUE, ...) - -## A more-liner function with no "{...}" -- this one even works (but not all!) -mindiff <- function(df) df[which.min(df$diff), - which.max(df$daff)] - -## Two functions in one line - can I "send" just one of them? {no, not "simply"} -f1 <- function(x) be.friendly(x, force=TRUE); f2 <- function(x,y) x*sin(pi*x) - -### --- 2 ---------------------------------------------------------------- -### --- Suggestion (Jenny Brian): --> Create a (defun ess-eval-multiline .) -## Here is useful valid R "test code": - -## From 'example(plot.default)' : - -Speed <- cars$speed -Distance <- cars$dist -plot(Speed, Distance, panel.first = grid(8,8), - pch = 0, cex = 1.2, col = "blue") -pp <- plot(Speed, Distance, panel.first = grid(8,8), - pch = 0, cex = 1.2, col = "blue") -plot(Speed, Distance, - panel.first = lines(lowess(Speed, Distance), lty = "dashed"), - pch = 0, cex = 1.2, col = "blue") - -## Note: We now at least C-c C-c {ess-eval-function-or-paragraph-and-step} - -### --- 3 ---------------------------------------------------------------- -###--- This one (from the Matrix package) is for testing ess-roxy..., -## i.e., C-c C-o - -## not exported but used more than once for "dimnames<-" method : -## -- or do only once for all "Matrix" classes ?? -dimnamesGets <- function (x, value) { - d <- dim(x) - if (!is.list(value) || length(value) != 2 || - !(is.null(v1 <- value[[1]]) || length(v1) == d[1]) || - !(is.null(v2 <- value[[2]]) || length(v2) == d[2])) - stop(gettextf("invalid dimnames given for '%s' object", class(x))) - x@Dimnames <- list(if(!is.null(v1)) as.character(v1), - if(!is.null(v2)) as.character(v2)) - x -} - -### --- 4 ---------------------------------------------------------------- -### continued statements -a <- function(ch) { - if(ch == Inf) { - E.cond <- numeric(nb) - } - else { - indic <- ifelse(jinf+1 <= 1 & jsup >= 1,1,0) - E.cond <- ch*(-pbinom(jinf,ni,prb) + 1-pbinom(js.n,ni,prb)) + - ifelse(ni == 1, prb*indic, - mu*(pbinom(js.n-1,pmax(ni-1,1),prb) - - pbinom(jinf-1,pmax(ni-1,1),prb))) / sV - -### ^-- now here (better) - mu/sV*(pbinom(js.n,ni,prb) - pbinom(jinf,ni,prb)) -### ^-- now here (ok; more indentation would also be ok) - indic2 <- ifelse(jinf+1 <= 1 & jsup >= 1 & ni == 2,1,0) - } -} - - -### --- 5 ---------------------------------------------------------------- -### The beginning of function is not found correctly, and hence -### all "ess-*-function" (C-M-a, C-M-e, ...) fail: - -setMeneric <- - ## It is clearly allowed to have comments here. - ## S version 4, and John Chambers in particular like it. - ## - ## BUG: M-C-e or M-C-a fails from ``here'' -- - ## --- effectively because of ess-beginning-of-function fails - ## and that really relies on finding ess-function-pattern; - ## i.e., ess-R-function-pattern in ~/emacs/ess/lisp/ess-cust.el - ## - function(name, def = NULL, group = list(), valueClass = character(), - where = topenv(parent.frame()), genericFunction = NULL) -{ - ## comments in here are at least kept via "source" attribute - if(exists(name, "package:base") && - typeof(get(name, "package:base")) != "closure") { - FALSE - } - "ABC" -} - -### --- 6 ---------------------------------------------------------------- -## In one-liners without "{ ... }" body, the end-of-function is also -## not correctly found: -## Use C-M-e to see: In these two, the "end-of-function" is after -## 'class' : -## ---- these all work now (ESS version 5.3.8) : -## no it doesn't VS[10-03-2012|ESS 12.03]: -onelinerFails <- function(x, ...) class(x) - -onelinerFailsToo <- - function(x, ...) - class(x) - -onelinerWorks <- function(x, ...) { class(x) } - -onelinerWorksToo <- - function(x, ...) { - class(x) - } - -### --- 7 ---------------------------------------------------------------- -## idem: -## this has one line more before 'function' than "typically:" -setMethod("[", signature(x = "dgTMatrix", i = "numeric", j = "missing", - drop = "logical"), - function (x, i, j, ..., drop) { ## select rows - storage.mode(i) <- "integer" - xi <- x@i + 1:1 # 1-indexing - ## ................... - if (drop && any(nd == 1)) drop(as(x,"matrix")) else x - }) - -### --- 8 ---------------------------------------------------------------- -## idem: -## all bellow are ok VS[10-03-2012|ESS 12.03]: -"dimnames<-.data.frame" <- function(x, value) { - d <- dim(x) - if(!is.list(value) || length(value) != 2 - || d[[1]] != length(value[[1]]) - || d[[2]] != length(value[[2]])) - stop("invalid 'dimnames' given for data frame") - row.names(x) <- as.character(value[[1]]) # checks validity - names(x) <- as.character(value[[2]]) - x -} - -'[.foo' <- function(x, i, value) -{ -### - y <- x - y[i] <- value - y -} - -'[[.bar' <- function(x, i, value) -{ - ## bla bla bla - y <- as.foo(x) ; y[[i]] <- value - y -} - -"[<-.foobar" <- function(x,i,j,value) { - ## just something - x -} - -"names<-.foobar" <- function(x, value) { - ## just something else - x -} - -`[<-.data.frame` <- function(x, i, j, value) -{ - nA <- nargs() # value is never missing, so 3 or 4. - -###.......... - - class(x) <- cl - x -} - -"[[<-.data.frame"<- function(x, i, j, value) -{ - cl <- oldClass(x) - ## delete class: Version 3 idiom - ## to avoid any special methods for [[<- - class(x) <- NULL - -###........... - - class(x) <- cl - x -} - - -"$<-.data.frame" <- function(x, i, value) -{ - cl <- oldClass(x) - ## delete class: Version 3 idiom - ## to avoid any special methods for [[<- - -###........... - - class(x) <- cl - return(x) -} - -## swanky functions: -`swank:quit-inspector` <- function(slimeConnection, sldbState) { - resetInspector(slimeConnection) - FALSE -} - -'swank:quit-inspector' <- function(slimeConnection, sldbState) { - resetInspector(slimeConnection) - FALSE -} - - -### --- 9 ---------------------------------------------------------------- -## VS[03-2012|12.03]:FIXED: - -## From: "Sebastian P. Luque" -## To: ess-bugs@stat.math.ethz.ch -## Subject: [ESS-bugs] ess-mode 5.12; `ess-indent-line' error -## Date: Tue, 17 Aug 2010 13:08:25 -0500 - -## With the following input, and point on the line with "Table 8.3": -## it was the parenthetical expression at the beg of line - -if (require(lme4)) { - ## Model in p. 213 - (fm1 <- lmer(logFEV1 ~ age + log(height) + age0 + log(height0) + (age | id), - data=fev1, subset=logFEV1 > -0.5)) - ## Table 8.3 - VarCorr(fm1)$id * 100 - - ## Model in p. 216 - (fm2 <- update(fm1, . ~ . - (age | id) + (log(height) | id))) -} - -### ----- -## hitting TAB (`ess-indent-command'), which calls `ess-indent-line' I get -## the following trace: - -## ....: (scan-error "Containing expression ends prematurely" 20 20) -## scan-sexps(177 -2) -## forward-sexp(-2) -## ... -## ess-continued-statement-p() -## ...... - -## Interestingly, if the lines 2-4 are absent, then the problem is gone. -## The problem is also there in ESS 5.11. - -## I'll try to find out what is going on in `ess-continued-statement-p' but -## given that I'm not very familiar with the stuff in ess-mode.el, I'm -## submitting the report in case somebody can detect the issue sooner. - -## another example: hitting Tab at }else line -.essDev_differs <- function(f1, f2){ - if (is.function(f1) && is.function(f2)){ - !(identical(body(f1), body(f2)) && identical(args(f1), args(f2))) - }else - !identical(f1, f2) -} - - - -### --- 10 --------------------------------------------------------------- -## indent at 0 after }else: -## VS:[03-2012|12.03]:FIXED: -if (is.function(f1) && is.function(f2)){ - !(identical(body(f1), body(f2)) && identical(args(f1), args(f2))) -}else - !identical(f1, f2) - - -### --- 11 --------------------------------------------------------------- -## --------------- C-c C-c was finding the wrong "beginning of function" -## [:FIXED:, 2011-05-28] -foobar <- function(...) {} -rm(list=ls()) - -##--------> consequence of the above experiments: -## the 2nd form is numerically "uniformly better" than the first -##--------> 2011-05-27: Change Frank's psiInv() to -## psiInv = function(t,theta) -## -log1p(exp(-theta)*expm1((1-t)*theta)/expm1(-theta)) - -### --- 12 --------------------------------------------------------------- -##--- In the following block, in the first line, C-c C-c does *NOT* behave -## VS[10-03-2012|ESS 12.03]: works fine for me: -th <- 48 # now do ls() and see what happened ... the horror !!! -d <- 3 -cpF <- list("Frank", list(th, 1:d)) -cop <- acF <- cpF$copula - -### --- 13 --------------------------------------------------------------- -## VS[05-05-2012|ESS 12.04]: looks like :FIXED: - -## From: Aleksandar Blagotic -## To: -## Subject: [ESS] R-mode: forward-sexp: Scan error: "Unbalanced parentheses" -## Date: Tue, 6 Dec 2011 01:24:11 +0100 - # -## Let's presuppose that I have a function like this: - # -fn <- function(x, ...){ - re <- "^#{1,6} [[:print:]]+$" - grepl(re, x, ...) -} -## As soon as I put my cursor at the end of the line with regexp, and -## press RET, I get this error: - -## forward-sexp: Scan error: "Unbalanced parentheses" -## -##------- -## Rodney S: I can reproduce it ... -## Martin M: I can NOT reproduce it, neither with 'emacs -Q'; -## tried both ESS 5.14 and ESS from svn -## VS[03-2012|12.03]: Cannot reproduce it either, solved? - - -### --- 14 --------------------------------------------------------------- -## check the behavior of ess-arg-function-offset-new-line - -a <- some.function( - arg1, - arg2) -## ^--- RRR has ess-arg-function-offset-new-line (4) ==> should indent here - -a <- some.function(arg1, - arg2) -## ^--- here - - -### --- 15 -------------------------------------------------------------- -## VS[05-05-2012|ESS 12.04]:FIXED: -## indentation of the 3rd line is wrong -for(s in seq(10, 50, len = 5)) - for(a in seq(.5, 1, len = 5)) - pt_dif_plot(s, a) -## ^-- here - -### --- 16 ---- -## VS[05-05-2012|ESS 12.04]:FIXED: -## MM[2014-04-28]: added '}' before else (=> "{" after if(.)) -## so parse() works at all! -## Gives error unbalanced para at else lines and indentation is wrong -## error: Point is not in a function according to 'ess-function-pattern'. -getOrCreateForm <- function(bindName, whereEnv) - if(exists(bindName, envir = get(".forms", envir = whereEnv))) { - get(bindName, envir = whereEnv) -### ^-- here - } else - new("protoForm") -### ^-- here - - - -parentContainer <- - if(is.null(.getPrototype(.Object@host))) { emptyenv() - } else sdf -### ^-- here - -parentContainer <- - if(is.null(.getPrototype(.Object@host))) emptyenv() - else sdf -### ^-- here - -### --- 17 --- -## Indentation ----- "expression" is special -expremmion <- c(1, 3, - 9876)# was always ok -## Had wrong indentation here: -expression <- c(2343, - 23874, 239487) - -## or here: -foo <- function(x) { - expression <- c(2343, - 23874, 239487) - 10 + expression -} - -## Where as here, we *do* want the indentation to -## *NOT* go all the way to the right: - -{ - my.long.Expression <- expression( - x[a[j]] == exp(theta[1] + theta[2]^2), - x[b[i]] == sin(theta[3] ~~ theta[4]) - ) - ausdruck <- expression - my.long.Expr...... <- ausdruck( - x[a[j]] == exp(theta[1] + theta[2]^2), - ) -} - -## VS[18-08-2012]: redundant feature. This is a feature for long subexpressions -## imidiately folowing new line. Documented in ess-arg-function-offset-new-line - -### --- 18 --- -## M-C-a (beginning of function) -## ----- anywhere inside the following function, M-C-a must go to beginning -Ops.x.x <- function(e1, e2) -{ - d <- dimCheck(e1,e2) - if((dens1 <- extends(c1 <- class(e1), "denseMatrix"))) - gen1 <- extends(c1, "generalMatrix") - if((dens2 <- extends(c2 <- class(e2), "denseMatrix"))) - gen2 <- extends(c2, "generalMatrix") - if(dens1 && dens2) { ## both inherit from ddense* - geM <- TRUE - if(!gen1) { - if(!gen2) { ## consider preserving "triangular" / "symmetric" - geM <- FALSE - le <- prod(d) - isPacked <- function(x) length(x@x) < le - } - } - ## now, in all cases @x should be matching & correct {only "uplo" part is used} - r <- callGeneric(e1@x, e2@x) - if(geM) - new(paste0(.M.kind(r), "geMatrix"), x = r, Dim = d, Dimnames = dimnames(e1)) - else - new(paste0(.M.kind(r), Mclass), x = r, Dim = d, .....) - } - else { - r <- .... - - ## criterion "2 * nnz(.) < ." as in sparseDefault() in Matrix() [./Matrix.R] : - if(2 * nnzero(r, na.counted = TRUE) < prod(d)) - as(r, "sparseMatrix") else r - } -} - - -### --- 19 --- -## indentation with regexp (bug in ess-backward-to-noncomment) -parse_roc <- function(lines, match = "^\\s*+\' ?") { - lines <- lines[str_detect(lines, match)] - if (length(lines) == 0) return(NULL) -### ^-- here (2014-11: fixed) -} - - -### --- 20 --- -## continuation indentation must be consistent in/out {}: - -{ - a <- ggplot(data = overtime.by.month, - aes(x="", y=Percent, fill = Overtime)) + - geom_bar(width = 1) + - xlab('') + - ylab(sub.txt) + - labs(title = title.txt) + - facet_wrap(~Year.Month) -} - -a <- ggplot(data = overtime.by.month, - aes(x="", y=Percent, fill = Overtime)) + - geom_bar(width = 1) + - xlab('') + - ylab(sub.txt) + - labs(title = title.txt) + - facet_wrap(~Year.Month) -### ^-- face_wrap must be here - - -### --- 20b --- -## From https://github.com/emacs-ess/ESS/issues/120 - -mean(rnorm(100, mean = runif(1, 1, 10)), na.rm =TRUE) + - 2 -## ^--- 2 is here - -mean(rnorm(100, mean = runif(1, 1, 10)), - na.rm =TRUE) + - 2 -## ^--- 2 is here - -mean(rnorm(100, - mean = runif(1, 1, 10)), na.rm=TRUE) + - 2 -## ^--- 2 is here - -### --- 21 --- - -## From: Marius Hofert -## Date: Fri, 15 Mar 2013 21:00:45 +0100 -## Hi, -## The following bug happens in ESS 12.09-2 [rev. 5395 (2013-01-10)]. Put the -## cursor in the line before the function head and hit C-c C-c. - -foo <- function(x) - x # bar -x <- 1:10 - -## I'll see -## > + > [1] 1 2 3 4 5 6 7 8 9 10 -## ESS 15.03: Error in eval(expr, .... : object 'x' not found - -foo <- function(x) x*x -bar <- function(y) y -## via C-c C-c leads to "Error: object 'bar' not found". -- fixed - - -### --- 22 ---- -## now correct indentation (inspite of # {was same reason as 19}) -if (!grepl("#", x)) - return(res) - -### --- 23 ---- -### three ways to indent closing parent depending on context: -foo <- - function_call( - a, - b, - c - ) -### ^-- ) is here now - -foo <- function_call( - a, - b, - c -) -### ")" is at column 0 - -foo <- function_call(a, - b, - c - ) -### ^-- ) is here - -### --- 24 --- -### shift comma in function calls - -foo <- function_call(a - , b - , c -### ^-- c is here - ) -### ^-- ) is here - -### --- 25 --- -## if/else in function calls and nested - -function_call(abc = - if (test) - do_something - else - do_something_else) - -function_call( - abc = - if (test) - do_something - else - do_something_else) - - -function_call(abc = if (test) - do_something - else - do_something_else) - -## real example is smooth.spline() source code [still (2015-04-08) wrong / bug!] -ss <- function (x, all.knots, nknots, ...) -{ - if (all.knots) { - if (!missing(nknots) && !is.null(nknots)) - warning("'all.knots' is TRUE; 'nknots' specification is disregarded") - nknots <- nx - } else if (is.null(nknots)) # <- for back compatibility - nknots <- .nknots.smspl(nx) - else { -### ^ want 'else' there - if (is.function(nknots)) - nknots <- nknots(nx) - else if (!is.numeric(nknots)) - stop("'nknots' must be numeric (in {1,..,n})") - if (nknots < 1) - stop("'nknots' must be at least 1") - else if (nknots > nx) - stop("cannot use more inner knots than unique 'x' values") - } -### ^-- want '}' there -} - -## "if" conditional is an exception of the continuation rules: -## Here, we do not want subsequently further indentation of the c1 || c2 || c3 -## part: -t2 <- function(x) { - if(long.expression.of.some.size(x, pi) || - another.longish.expression(sin(x)*exp(x)) || - a.third.condition.under.which.A.is.chosen) -### ^-- here - A - else - B -} - - -r <- - (some.function (x, 2342) + - another.f (x^3) + sdfsdf - sdfsdf + - and(x) + the(x) - last(x)*part(3)) - - -### --- 26 ---- -## This is formally correct R, though help(parse) mentions the line-length limit of -## 4095 __when reading from the console__ -## ESS gives syntax errors ("Error: unexpected ','" ...) when evaluating this -## because line length >= 4096 : -## -x <- c(1, 3.075819, 1.515999, 2.156169, 1.480742, 1.765485, 1.460206, 1.603707, 1.427429, 1.504712, 1.334528, 1.48297, 1.355308, 1.383867, 1.319241, 1.36065, 1.307467, 1.365596, 1.255259, 1.352741, 1.239381, 3.15342, 1.799889, 2.258497, 1.688312, 1.906779, 1.548203, 1.724785, 1.500873, 1.573442, 1.417137, 1.540805, 1.395945, 1.472596, 1.394247, 1.377487, 1.337394, 1.369354, 1.333378, 1.3181, 1.313813, 1.315528, 2.12777, 2.718898, 1.993509, 2.220433, 1.820585, 1.97782, 1.672455, 1.770151, 1.587478, 1.685352, 1.539295, 1.584536, 1.499487, 1.50702, 1.41952, 1.449058, 1.393042, 1.432999, 1.369964, 1.400997, 1.333824, 2.950549, 2.145387, 2.382224, 1.927077, 2.032489, 1.8371, 1.877833, 1.710891, 1.756053, 1.620778, 1.657761, 1.558978, 1.56257, 1.508633, 1.534406, 1.46709, 1.468734, 1.432529, 1.455283, 1.386975, 1.417532, 2.229573, 2.494447, 2.016117, 2.190061, 1.877996, 1.978964, 1.767284, 1.836948, 1.677372, 1.743316, 1.616383, 1.655964, 1.55484, 1.594831, 1.502185, 1.543723, 1.467005, 1.491123, 1.44402, 1.446915, 1.401578, 2.580264, 2.109121, 2.240741, 1.944719, 2.043397, 1.821808, 1.89725, 1.748788, 1.786988, 1.659333, 1.697012, 1.610622, 1.616503, 1.538529, 1.562024, 1.499964, 1.529344, 1.474519, 1.483264, 1.441552, 1.434448, 2.165233, 2.320281, 2.007836, 2.086471, 1.884052, 1.950563, 1.76926, 1.843328, 1.708941, 1.741039, 1.627206, 1.644755, 1.580563, 1.593402, 1.527312, 1.568418, 1.501462, 1.502542, 1.464583, 1.467921, 1.431141, 2.340443, 2.048262, 2.161097, 1.926082, 1.995422, 1.81446, 1.853165, 1.738533, 1.784456, 1.679444, 1.696463, 1.612931, 1.629483, 1.548186, 1.580026, 1.52198, 1.531111, 1.482914, 1.484824, 1.442726, 1.447838, 2.093386, 2.185793, 1.948989, 2.02804, 1.867137, 1.907732, 1.771923, 1.800413, 1.691612, 1.720603, 1.642705, 1.649769, 1.589028, 1.598955, 1.539759, 1.55096, 1.503965, 1.50703, 1.471349, 1.469791, 1.436959, 2.218315, 1.997369, 2.041128, 1.887059, 1.928524, 1.79626, 1.827538, 1.716748, 1.735696, 1.658329, 1.664211, 1.599286, 1.611511, 1.553925, 1.562637, 1.516805, 1.529894, 1.476064, 1.482474, 1.453253, 1.458467, 2.0247, 2.07899, 1.921976, 1.949376, 1.824629, 1.851671, 1.744713, 1.765647, 1.683525, 1.685592, 1.625113, 1.624961, 1.571921, 1.581223, 1.535257, 1.537464, 1.497165, 1.504879, 1.468682, 1.469319, 1.448344, 2.092315, 1.941412, 1.969843, 1.844093, 1.866133, 1.766145, 1.783829, 1.703613, 1.709714, 1.646078, 1.654264, 1.594523, 1.598488, 1.545105, 1.555356, 1.514627, 1.521353, 1.483958, 1.487677, 1.449191, 1.459721, 1.958987, 1.985144, 1.87739, 1.879643, 1.786823, 1.799642, 1.720015, 1.724688, 1.663539, 1.662997, 1.609267, 1.615124, 1.56746, 1.562026, 1.520586, 1.52503, 1.493008, 1.502496, 1.471983, 1.468546, 1.435064, 1.994706, 1.880348, 1.894254, 1.805827, 1.815965, 1.744296, 1.743389, 1.665481, 1.681644, 1.624466, 1.626109, 1.584028, 1.5818, 1.54376, 1.547237, 1.504878, 1.515087, 1.479032, 1.47936, 1.450758, 1.45073, 1.892685, 1.91087, 1.825301, 1.827176, 1.745363, 1.746115, 1.693373, 1.701692, 1.648247, 1.637112, 1.594648, 1.592013, 1.554849, 1.55013, 1.522186, 1.520901, 1.492606, 1.493072, 1.460868, 1.46733, 1.440956, 1.92771, 1.835696, 1.841979, 1.775991, 1.766092, 1.703807, 1.708791, 1.654985, 1.655917, 1.602388, 1.611867, 1.570765, 1.573368, 1.53419, 1.529033, 1.506767, 1.503596, 1.481126, 1.471806, 1.444917, 1.451682, 1.850262, 1.855034, 1.778997, 1.789995, 1.718871, 1.717326, 1.667357, 1.666291, 1.619743, 1.631475, 1.582624, 1.58766, 1.546302, 1.545063, 1.512222, 1.517888, 1.489127, 1.487271, 1.466722, 1.463618, 1.444137, 1.8709, 1.794033, 1.80121, 1.736376, 1.740201, 1.673776, 1.682541, 1.638153, 1.642294, 1.604417, 1.597721, 1.559534, 1.559108, 1.533942, 1.529348, 1.499517, 1.501586, 1.473147, 1.473031, 1.457615, 1.452348, 1.805753, 1.812952, 1.746549, 1.747222, 1.696924, 1.694957, 1.652157, 1.650568, 1.607807, 1.613666, 1.577295, 1.570712, 1.543704, 1.538272, 1.515369, 1.517113, 1.487451, 1.491593, 1.464514, 1.464658, 1.439359, 1.823222, 1.758781, 1.767358, 1.70872, 1.712926, 1.666956, 1.667838, 1.62077, 1.621445, 1.592891, 1.58549, 1.55603, 1.559042, 1.521501, 1.523342, 2, 3, 4) - -### --- 27 ---- -## Indentation after open brace -.a.lst <- - list(ex1 = function(p) { - cMah <- qchisq(0.975, p) - function(d) as.numeric(d < cMah) -### ^--- now here (less indented than prev.) - }, - ex2 = function(p) { - cM <- qchisq(0.95, p) - function(d) as.numeric(d < cM) -### ^--- here - }) -### ^--- '}' here - - -.a.lst <- list(ex1 = function(p) { - cMah <- qchisq(0.975, p) - function(d) as.numeric(d < cMah) -}, ## <- now at column 0 {also the next line} -ex2 = function(p) { - cM <- qchisq(0.95, p) - function(d) as.numeric(d < cM) -}) - - -.a.lst <- list(list(aa = { - bbb -### ^--- here -}, -aaa = function(p) { - qchisq(0.95, p) -### ^--- here -}, -aaaa = { - cccc -### ^--- here -})) - -list(function(p){ - abc -### ^-- here - ## <-- Press [Tab] before/at the first '#': should *NOT* insert '...=' -}) -### at column 0 - -(ab) { - sfdsf -### ^-- here -} - -### --- 27b --- [new, 2015-04-09] -print.MethodsFunction <- function(x, byclass = attr(x, "byclass"), ...) -{ - info <- attr(x, "info") - values <- if (byclass) { - unique(info$generic) - } else { - visible <- ifelse(info$visible, "", "*") - paste0(rownames(info), visible) -### ^-- both lines above should start here - } -### ^-- "}" here - - ## 2nd version: - val <- - if (byclass) { - unique(info$generic) - } else { - visible <- ifelse(info$visible, "", "*") - paste0(rownames(info), visible) -### ^-- both lines above should start here - } -### ^-- "}" here - invisible(x) -} - - - -### --- 28 --- [2015-02-17; still unfixed, 2015-11-21] -## Indentation of end-line comments (to column 40 = 'indent-column') -## {this is part of "real" code in Rmpfr/R/hjk.R}: -hjk <- function(x,n) { # <--- C-M-q "on {" -- does *no longer* indent the "# .." - ##-- Setting steps and stepsize ----- - nsteps <- floor(log2(1/tol)) # number of steps - steps <- 2^c(-(0:(nsteps-1))) # decreasing step size - dir <- diag(1, n, n) # orthogonal directions - - x <- par # start point - fx <- f(x) # smallest value so far - fcount <- 1 # counts number of function calls - - if (info) cat(sprintf("step nofc %-12s | %20s\n", - "fmin", "xpar")) - - ##-- Start the main loop ------------ - ns <- 0 - while (ns < nsteps && fcount < maxfeval && abs(fx) < target) { - ns <- ns + 1 - hjs <- .hjsearch(x, f, steps[ns], dir, fcount, maxfeval, target) - } - hjs -} - -### --- 29 --- -foreach(a = 1:3) %do% { - a^2 -### ^--- here -} - -foreach(a = 1:3) %:% - foreach(b = 10:13) %dopar% { -### ^--- here - a + b -### ^---- here - } -### ^--- here - -read.csv('file.csv') %>% - mutate(X = X+2, Y = Y/2) %>% -### ^--- here - filter(X < 5) -### ^-- here (*was* indented earlier) - - -### --- 30 --- -## a) ok: -{ - r <- array(if (d[3L] == 3L) - rgb(t(x[,,1L]), t(x[,,2L]), t(x[,,3L]), maxColorValue = max) - else if (d[3L] == 4L) - rgb(t(x[,,1L]), t(x[,,2L]), t(x[,,3L]), t(x[,,4L]), maxColorValue = max) - else stop("foo"), - dim = d[1:2]) -} - -## b) ok : -{ - obj <- obj && (condition1 || class2 %in% .BasicClasses || - condition3) -} - -## c) ok: -{ - if (any(abs(d) < .001*abs(dd) | - (is.na(d) & x == y))) - TRUE -} - - -### --- 31 -------- -## C-s "recog"; M-C-a -- should go to beginning of function, does not - -glmmTMB <- function (formula, data = NULL) -{ - ## glFormula <- function(formula, data=NULL, family = gaussian, - ## subset, weights, na.action, offset, - ## contrasts = NULL, mustart, etastart, - ## control = glmerControl(), ...) { - - ## FIXME: check for offsets in ziformula/dispformula, throw an error - - call <- mf <- mc <- match.call() - - if (is.null(family$family)) { - print(family) - stop("'family' not recognized") - } -} - - -### --- 32 --- 2015-11-07 --- indentation again! -------- -{ - yl <- if(strictlim) { - ylim - } - else { - range(y, ylim) - } - ## room below for weights - dy <- 4*dy -} -## -- 32 b) -{ - yl <- if(strictlim) { - ylim - } - else - range(y, ylim) - ## continue -} -## -- 32 c) -{ - U <- if(is.matrix(x)) - apply(x, 2, foo) / (nrow(x) + 1) - else - foo(x) / (length(x) + 1) -} -## 'else' now aligns with 'if' (and their code too) - -### --- 33 -- Treat `<<-` as `<-` -{ - f(X <- - callme(arg)) - f(X <<- - callme(arg)) -} -## the 2nd callme() now indents like the first - - -### --- 34 --- "eval-function" (e.g. C-c C-c) fails with this - -##' checking pretty(): -chkPretty <- function(x, n = 5, min.n = NULL, ..., max.D = 1) { - if(is.null(min.n)) { - ## work with both pretty.default() and greDevices::prettyDate() - ## *AND* these have a different default for 'min.n' we must be "extra smart": - min.n <- - if(inherits(x, "Date") || inherits(x, "POSIXt")) - n %/% 2 # grDevices:::prettyDate - else - n %/% 3 # pretty.default - } - pr <- pretty(x, n=n, min.n=min.n, ...) - ## if debugging: pr <- grDevices:::prettyDate(x, n=n, min.n=min.n, ...) - stopifnot(length(pr) >= (min.n+1), - abs(length(pr) - (n+1)) <= max.D, - ## must be equidistant [may need fuzz, i.e., signif(.) ?]: - length(pr) == 1 || length(unique(diff(pr))) == 1, - ## pretty(x, *) must cover range of x: - min(pr) <= min(x), max(x) <= max(pr)) - invisible(pr) -} - - -### --- 35 --- indentation of conditional function definitions: -## from a robustbase vignette: -{ - ## calculate robustness weights - lwgts <- Mwgt(lresid, lctrl$tuning.psi, lctrl$psi) - ## function to calculate robustified leverages - tfun <- - if (is.function(attr(estlist$design, 'gen'))) - function(i) { - if (all(is.na(wi <- lwgts[i,]))) wi - else .lmrob.hat(lXs[,,i,lcdn[2]],wi) - } - else -### \-<-- 'else' (and all below) should indent 4 more, 'else' matching the above 'if' - function(i) { - if (all(is.na(wi <- lwgts[i,]))) wi else .lmrob.hat(lX, wi) - } -} - -### --- 36 --- indentation of '#' inside string plus a '#' after that, issue #446 -A <- f("abc") + - f("abc") + f("abc") + - f("abc # abc") + - ## The above is now ok, - f("abc # abc") + # <- comment w/o quotes or hashtag -- fixed now: next line was indented to beginning of line - f("ABCDEF") + - f(g(h("abc # def"), "foo ## bar")) + - f("another") - - -### --- 37 ----------Github issue #432 ---- now fixed -## Indentation after string with "*" -fo4 <- function(x, ...) { - if(length(x) > 0) - warning("Result gave strings of *different* #{characters}") - x - ## 'x' was wrongly indented --here: ^ -} - -### --- 38 ----------Mario Bouguin to ESS-bugs, Nov 21, 2017 ---- -scored <- read.csv(scored_path, comment.char="#") -## writes -## When I'm on the line and execute ess-eval-region-or-function-or-paragraph-and-step (i.e. C-c C-c), R only receives this: -## -## > scored <- read.csv(scored_path, comment.char=" -## + -## MM: but I don't see this, so told him to upgrade ESS (he had 16.10, Windows) - - -## This is a problem only inside package code [ess-tracebug related] -rm(old,new) -old <- 10 # line 1, use ess-eval-line, i.e., C-c C-j -new <- old+1 # line 2, use ess-eval-line-and-step, i.e., C-c C-n - - - - -### Local Variables: -### page-delimiter: "^### --- [1-9]" -### End: diff -Nru ess-18.10.2/fontlock-test/baseball.sas ess-18.10.2+git20220915.f45542e/fontlock-test/baseball.sas --- ess-18.10.2/fontlock-test/baseball.sas 2018-11-10 09:41:11.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/fontlock-test/baseball.sas 1970-01-01 00:00:00.000000000 +0000 @@ -1,453 +0,0 @@ -/* The BASEBALL Data Set: Baseball Data */ - -/* The BASEBALL data set contains variables that measure batting - and fielding performance for 322 regular and substitute hitters - in the 1986 year, their career performance statistics, and - their salary at the start of the 1987 season. - - NAME: hitter's name - ATBAT: times at bat - HITS: hits - HOMER: home runs - RUNS: runs - RBI: runs batted in - WALKS: walks - YEARS: years in the major leagues - ATBATC: career times at bat - HITSC: career hits - HOMERC: career home runs - RUNSC: career runs scored - RBIC: career runs batted in - POSITION: player's position - PUTOUTS: put outs - ASSISTS: assists - ERRORS: errors - SALARY: annual salary, expressed in units of $1,000 - BATAVG: batting average, calculated as 1,000*(HITS/ATBAT) - BATAVGC: career batting average, calculated as 1,000*(HITSC/ATBATC) -*/ - -Title 'Baseball Hitters Data'; - - /* Formats to specify the coding of some of the variables */ -proc format; - value $league - 'N' ='National' - 'A' ='American'; - value $team - 'ATL'='Atlanta ' - 'BAL'='Baltimore ' - 'BOS'='Boston ' - 'CAL'='California ' - 'CHA'='Chicago A ' - 'CHN'='Chicago N ' - 'CIN'='Cincinnati ' - 'CLE'='Cleveland ' - 'DET'='Detroit ' - 'HOU'='Houston ' - 'KC '='Kansas City ' - 'LA '='Los Angeles ' - 'MIL'='Milwaukee ' - 'MIN'='Minnesota ' - 'MON'='Montreal ' - 'NYA'='New York A ' - 'NYN'='New York N ' - 'OAK'='Oakland ' - 'PHI'='Philadelphia ' - 'PIT'='Pittsburgh ' - 'SD '='San Diego ' - 'SEA'='Seattle ' - 'SF '='San Francisco' - 'STL'='St. Louis ' - 'TEX'='Texas ' - 'TOR'='Toronto '; - value $posfmt - '1B' = 'First Base' - '2B' = 'Second Base' - 'SS' = 'Short Stop' - '3B' = 'Third Base' - 'RF' = 'Right Field' - 'CF' = 'Center Field' - 'LF' = 'Left Field' - 'C ' = 'Catcher' - 'DH' = 'Designated Hitter' - 'OF' = 'Outfield' - 'UT' = 'Utility' - 'OS' = 'Outfield & Short Stop' - '3S' = 'Third Base & Short Stop' - '13' = 'First & Third Base' - '3O' = 'Third Base & Outfield' - 'O1' = 'Outfield & First Base' - 'S3' = 'Short Stop & Third Base' - '32' = 'Third & Second Base' - 'DO' = 'Designated Hitter & Outfield' - 'OD' = 'Outfield & Designated Hitter' - 'CD' = 'Catcher & Designated Hitter' - 'CS' = 'Catcher & Short Stop' - '23' = 'Second & Third Base' - '1O' = 'First Base and Outfield' - '2S' = 'Second Base and Short Stop'; - /* Recode position to short list */ - value $pos - 'CS','CD' ='C ' - 'OS','O1','OD' ='OF' - 'CF','RF','LF' ='OF' - '1O','13' ='1B' - '2S','23' ='2B' - 'DO' ='DH' - 'S3' ='SS' - '32','3S','3O' ='3B' ; - -data baseball; - input name $1-14 - league $15 team $16-18 position $19-20 - atbat 3. hits 3. homer 3. runs 3. rbi 3. walks 3. years 3. - atbatc 5. hitsc 4. homerc 4. runsc 4. rbic 4. walksc 4. - putouts 4. assists 3. errors 3. salary 4.; - batavg = round(1000 * (hits / atbat)); - batavgc= round(1000 * (hitsc/ atbatc)); - label - name = "Hitter's name" - atbat = 'Times at Bat' - hits = 'Hits' - homer = 'Home Runs' - runs = 'Runs' - rbi = 'Runs Batted In' - walks = 'Walks' - years = 'Years in the Major Leagues' - atbatc = 'Career Times at Bat' - hitsc = 'Career Hits' - homerc = 'Career Home Runs' - runsc = 'Career Runs Scored' - rbic = 'Career Runs Batted In' - position= 'Position(s)' - putouts = 'Put Outs' - assists = 'Assists' - errors = 'Errors' - salary = 'Salary (in 1000$)' - batavg = 'Batting Average' - batavgc = 'Career Batting Average'; - cards; -Andy Allanson ACLEC 293 66 1 30 29 14 1 293 66 1 30 29 14 446 33 20 . -Alan Ashby NHOUC 315 81 7 24 38 39 14 3449 835 69 321 414 375 632 43 10 475 -Alvin Davis ASEA1B479130 18 66 72 76 3 1624 457 63 224 266 263 880 82 14 480 -Andre Dawson NMONRF496141 20 65 78 37 11 56281575 225 828 838 354 200 11 3 500 -A Galarraga NMON1B321 87 10 39 42 30 2 396 101 12 48 46 33 805 40 4 92 -A Griffin AOAKSS594169 4 74 51 35 11 44081133 19 501 336 194 282421 25 750 -Al Newman NMON2B185 37 1 23 8 21 2 214 42 1 30 9 24 76127 7 70 -A Salazar AKC SS298 73 0 24 24 7 3 509 108 0 41 37 12 121283 9 100 -Andres Thomas NATLSS323 81 6 26 32 8 2 341 86 6 32 34 8 143290 19 75 -A Thornton ACLEDH401 92 17 49 66 65 13 52061332 253 784 890 866 0 0 01100 -Alan Trammell ADETSS574159 21107 75 59 10 46311300 90 702 504 488 238445 22 517 -Alex Trevino NLA C 202 53 4 31 26 27 9 1876 467 15 192 186 161 304 45 11 513 -A Van.Slyke NSTLRF418113 13 48 61 47 4 1512 392 41 205 204 203 211 11 7 550 -Alan Wiggins ABAL2B239 60 0 30 11 22 6 1941 510 4 309 103 207 121151 6 700 -Bill Almon NPITUT196 43 7 29 27 30 13 3231 825 36 376 290 238 80 45 8 240 -Billy Beane AMINOF183 39 3 20 15 11 3 201 42 3 20 16 11 118 0 0 . -Buddy Bell NCIN3B568158 20 89 75 73 15 80682273 1771045 993 732 105290 10 775 -B Biancalana AKC SS190 46 2 24 8 15 5 479 102 5 65 23 39 102177 16 175 -Bruce Bochte AOAK1B407104 6 57 43 65 12 52331478 100 643 658 653 912 88 9 . -Bruce Bochy NSD C 127 32 8 16 22 14 8 727 180 24 67 82 56 202 22 2 135 -Barry Bonds NPITCF413 92 16 72 48 65 1 413 92 16 72 48 65 280 9 5 100 -Bobby Bonilla ACHAO1426109 3 55 43 62 1 426 109 3 55 43 62 361 22 2 115 -Bob Boone ACALC 22 10 1 4 2 1 6 84 26 2 9 9 3 812 84 11 . -Bob Brenly NSF C 472116 16 60 62 74 6 1924 489 67 242 251 240 518 55 3 600 -Bill Buckner ABOS1B629168 18 73102 40 18 84242464 16410081072 4021067157 14 777 -Brett Butler ACLECF587163 4 92 51 70 6 2695 747 17 442 198 317 434 9 3 765 -Bob Dernier NCHNCF324 73 4 32 18 22 7 1931 491 13 291 108 180 222 3 3 708 -Bo Diaz NCINC 474129 10 50 56 40 10 2331 604 61 246 327 166 732 83 13 750 -Bill Doran NHOU2B550152 6 92 37 81 5 2308 633 32 349 182 308 262329 16 625 -Brian Downing ACALLF513137 20 90 95 90 14 52011382 166 763 734 784 267 5 3 900 -Bobby Grich ACAL2B313 84 9 42 30 39 17 68901833 2241033 8641087 127221 7 . -Billy Hatcher NHOUCF419108 6 55 36 22 3 591 149 8 80 46 31 226 7 4 110 -Bob Horner NATL1B517141 27 70 87 52 9 3571 994 215 545 652 3371378102 8 . -Brook Jacoby ACLE3B583168 17 83 80 56 5 1646 452 44 219 208 136 109292 25 613 -Bob Kearney ASEAC 204 49 6 23 25 12 7 1309 308 27 126 132 66 419 46 5 300 -Bill Madlock NLA 3B379106 10 38 60 30 14 62071906 146 859 803 571 72170 24 850 -Bobby Meacham ANYASS161 36 0 19 10 17 4 1053 244 3 156 86 107 70149 12 . -Bob Melvin NSF C 268 60 5 24 25 15 2 350 78 5 34 29 18 442 59 6 90 -Ben Oglivie AMILDH346 98 5 31 53 30 16 59131615 235 784 901 560 0 0 0 . -Bip Roberts NSD 2B241 61 1 34 12 14 1 241 61 1 34 12 14 166172 10 . -B Robidoux AMIL1B181 41 1 15 21 33 2 232 50 4 20 29 45 326 29 5 68 -Bill Russell NLA UT216 54 0 21 18 15 18 73181926 46 796 627 483 103 84 5 . -Billy Sample NATLOF200 57 6 23 14 14 9 2516 684 46 371 230 195 69 1 1 . -B Schroeder AMILUT217 46 7 32 19 9 4 694 160 32 86 76 32 307 25 1 180 -Butch Wynegar ANYAC 194 40 7 19 29 30 11 41831069 64 486 493 608 325 22 2 . -Chris Bando ACLEC 254 68 2 28 26 22 6 999 236 21 108 117 118 359 30 4 305 -Chris Brown NSF 3B416132 7 57 49 33 3 932 273 24 113 121 80 73177 18 215 -C Castillo ACLEOD205 57 8 34 32 9 5 756 192 32 117 107 51 58 4 4 248 -Cecil Cooper AMIL1B542140 12 46 75 41 16 70992130 235 9871089 431 697 61 9 . -Chili Davis NSF RF526146 13 71 70 84 6 2648 715 77 352 342 289 303 9 9 815 -Carlton Fisk ACHAC 457101 14 42 63 22 17 65211767 2811003 977 619 389 39 4 875 -Curt Ford NSTLOF214 53 2 30 29 23 2 226 59 2 32 32 27 109 7 3 70 -Cliff Johnson ATORDH 19 7 0 1 2 1 4 41 13 1 3 4 4 0 0 0 . -C Lansford AOAK3B591168 19 80 72 39 9 44781307 113 634 563 319 67147 41200 -Chet Lemon ADETCF403101 12 45 53 39 12 51501429 166 747 666 526 316 6 5 675 -C Maldonado NSF OF405102 18 49 85 20 6 950 231 29 99 138 64 161 10 3 415 -C Martinez NSD O1244 58 9 28 25 35 4 1335 333 49 164 179 194 142 14 2 340 -Charlie Moore AMILC 235 61 3 24 39 21 14 39261029 35 441 401 333 425 43 4 . -C Reynolds NHOUSS313 78 6 32 41 12 12 3742 968 35 409 321 170 106206 7 417 -Cal Ripken ABALSS627177 25 98 81 70 6 3210 927 133 529 472 313 240482 131350 -Cory Snyder ACLEOS416113 24 58 69 16 1 416 113 24 58 69 16 203 70 10 90 -Chris Speier NCHN3S155 44 6 21 23 15 16 66311634 98 698 661 777 53 88 3 275 -C Wilkerson ATEX2S236 56 0 27 15 11 4 1115 270 1 116 64 57 125199 13 230 -Dave Anderson NLA 3S216 53 1 31 15 22 4 926 210 9 118 69 114 73152 11 225 -Doug Baker AOAKOF 24 3 0 1 0 2 3 159 28 0 20 12 9 80 4 0 . -Don Baylor ABOSDH585139 31 93 94 62 17 75461982 31511411179 727 0 0 0 950 -D Bilardello NMONC 191 37 4 12 17 14 4 773 163 16 61 74 52 391 38 8 . -Daryl Boston ACHACF199 53 5 29 22 21 3 514 120 8 57 40 39 152 3 5 75 -Darnell Coles ADET3B521142 20 67 86 45 4 815 205 22 99 103 78 107242 23 105 -Dave Collins ADETLF419113 1 44 27 44 12 44841231 32 612 344 422 211 2 1 . -D Concepcion NCINUT311 81 3 42 30 26 17 82472198 100 950 909 690 153223 10 320 -D Daulton NPHIC 138 31 8 18 21 38 3 244 53 12 33 32 55 244 21 4 . -Doug DeCinces ACAL3B512131 26 69 96 52 14 53471397 221 712 815 548 119216 12 850 -Darrell Evans ADET1B507122 29 78 85 91 18 77611947 347117511521380 808108 2 535 -Dwight Evans ABOSRF529137 26 86 97 97 15 66611785 2911082 949 989 280 10 5 933 -Damaso Garcia ATOR2B424119 6 57 46 13 9 36511046 32 461 301 112 224286 8 850 -Dan Gladden NSF CF351 97 4 55 29 39 4 1258 353 16 196 110 117 226 7 3 210 -Danny Heep NNYNOF195 55 5 24 33 30 8 1313 338 25 144 149 153 83 2 1 . -D Henderson ASEAOF388103 15 59 47 39 6 2174 555 80 285 274 186 182 9 4 325 -Donnie Hill AOAK23339 96 4 37 29 23 4 1064 290 11 123 108 55 104213 9 275 -Dave Kingman AOAKDH561118 35 70 94 33 16 66771575 442 9011210 608 463 32 8 . -Davey Lopes NCHN3O255 70 7 49 35 43 15 63111661 1541019 608 820 51 54 8 450 -Don Mattingly ANYA1B677238 31117113 53 5 2223 737 93 349 401 1711377100 61975 -Darryl Motley AKC RF227 46 7 23 20 12 5 1325 324 44 156 158 67 92 2 2 . -Dale Murphy NATLCF614163 29 89 83 75 11 50171388 266 813 822 617 303 6 61900 -Dwayne Murphy AOAKCF329 83 9 50 39 56 9 3828 948 145 575 528 635 276 6 2 600 -Dave Parker NCINRF637174 31 89116 56 14 67272024 247 9781093 495 278 9 91042 -Dan Pasqua ANYALF280 82 16 44 45 47 2 428 113 25 61 70 63 148 4 2 110 -D Porter ATEXCD155 41 12 21 29 22 16 54091338 181 746 805 875 165 9 1 260 -D Schofield ACALSS458114 13 67 57 48 4 1350 298 28 160 123 122 246389 18 475 -Don Slaught ATEXC 314 83 13 39 46 16 5 1457 405 28 156 159 76 533 40 4 432 -D Strawberry NNYNRF475123 27 76 93 72 4 1810 471 108 292 343 267 226 10 61220 -Dale Sveum AMIL3B317 78 7 35 35 32 1 317 78 7 35 35 32 45122 26 70 -D Tartabull ASEARF511138 25 76 96 61 3 592 164 28 87 110 71 157 7 8 145 -Dickie Thon NHOUSS278 69 3 24 21 29 8 2079 565 32 258 192 162 142210 10 . -Denny Walling NHOU3B382119 13 54 58 36 12 2133 594 41 287 294 227 59156 9 595 -Dave Winfield ANYARF565148 24 90104 77 14 72872083 30511351234 791 292 9 51861 -Enos Cabell NLA 1B277 71 2 27 29 14 15 59521647 60 753 596 259 360 32 5 . -Eric Davis NCINLF415115 27 97 71 68 3 711 184 45 156 119 99 274 2 7 300 -Eddie Milner NCINCF424110 15 70 47 36 7 2130 544 38 335 174 258 292 6 3 490 -Eddie Murray ABAL1B495151 17 61 84 78 10 56241679 275 8841015 7091045 88 132460 -Ernest Riles AMILSS524132 9 69 47 54 2 972 260 14 123 92 90 212327 20 . -Ed Romero ABOSSS233 49 2 41 23 18 8 1350 336 7 166 122 106 102132 10 375 -Ernie Whitt ATORC 395106 16 48 56 35 10 2303 571 86 266 323 248 709 41 7 . -Fred Lynn ABALCF397114 23 67 67 53 13 55891632 241 906 926 716 244 2 4 . -Floyd Rayford ABAL3B210 37 8 15 19 15 6 994 244 36 107 114 53 40115 15 . -F Stubbs NLA LF420 95 23 55 58 37 3 646 139 31 77 77 61 206 10 7 . -Frank White AKC 2B566154 22 76 84 43 14 61001583 131 743 693 300 316439 10 750 -George Bell ATORLF641198 31101108 41 5 2129 610 92 297 319 117 269 17 101175 -Glenn Braggs AMILLF215 51 4 19 18 11 1 215 51 4 19 18 11 116 5 12 70 -George Brett AKC 3B441128 16 70 73 80 14 66752095 20910721050 695 97218 161500 -Greg Brock NLA 1B325 76 16 33 52 37 5 1506 351 71 195 219 214 726 87 3 385 -Gary Carter NNYNC 490125 24 81105 62 13 60631646 271 847 999 680 869 62 81926 -Glenn Davis NHOU1B574152 31 91101 64 3 985 260 53 148 173 951253111 11 215 -George Foster NNYNLF284 64 14 30 42 24 18 70231925 348 9861239 666 96 4 4 . -Gary Gaetti AMIN3B596171 34 91108 52 6 2862 728 107 361 401 224 118334 21 900 -Greg Gagne AMINSS472118 12 63 54 30 4 793 187 14 102 80 50 228377 26 155 -G Hendrick ACALOF283 77 14 45 47 26 16 68401910 259 9151067 546 144 6 5 700 -Glenn Hubbard NATL2B408 94 4 42 36 66 9 3573 866 59 429 365 410 282487 19 535 -Garth Iorg ATOR32327 85 3 30 44 20 8 2140 568 16 216 208 93 91185 12 363 -Gary Matthews NCHNLF370 96 21 49 46 60 15 69861972 2311070 955 921 137 5 9 733 -Graig Nettles NSD 3B354 77 16 36 55 41 20 87162172 384117212671057 83174 16 200 -Gary Pettis ACALCF539139 5 93 58 69 5 1469 369 12 247 126 198 462 9 7 400 -Gary Redus NPHILF340 84 11 62 33 47 5 1516 376 42 284 141 219 185 8 4 400 -G Templeton NSD SS510126 2 42 44 35 11 55621578 44 703 519 256 207358 20 738 -Gorman Thomas ASEADH315 59 16 45 36 58 13 46771051 268 681 782 697 0 0 0 . -Greg Walker ACHA1B282 78 13 37 51 29 5 1649 453 73 211 280 138 670 57 5 500 -Gary Ward ATEXLF380120 5 54 51 31 8 3118 900 92 444 419 240 237 8 1 600 -Glenn Wilson NPHIRF584158 15 70 84 42 5 2358 636 58 265 316 134 331 20 4 663 -Harold Baines ACHARF570169 21 72 88 38 7 37541077 140 492 589 263 295 15 5 950 -Hubie Brooks NMONSS306104 14 50 58 25 7 2954 822 55 313 377 187 116222 15 750 -H Johnson NNYN3S220 54 10 30 39 31 5 1185 299 40 145 154 128 50136 20 298 -Hal McRae AKC DH278 70 7 22 37 18 18 71862081 190 9351088 643 0 0 0 325 -H Reynolds ASEA2B445 99 1 46 24 29 4 618 129 1 72 31 48 278415 16 88 -Harry Spilman NSF 1B143 39 5 18 30 15 9 639 151 16 80 97 61 138 15 1 175 -H Winningham NMONOF185 40 4 23 11 18 3 524 125 7 58 37 47 97 2 2 90 -J Barfield ATORRF589170 40107108 69 6 2325 634 128 371 376 238 368 20 31238 -Juan Beniquez ABALUT343103 6 48 36 40 15 43381193 70 581 421 325 211 56 13 430 -Juan Bonilla ABAL2B284 69 1 33 18 25 5 1407 361 6 139 98 111 122140 5 . -J Cangelosi ACHALF438103 2 65 32 71 2 440 103 2 67 32 71 276 7 9 100 -Jose Canseco AOAKLF600144 33 85117 65 2 696 173 38 101 130 69 319 4 14 165 -Joe Carter ACLERF663200 29108121 32 4 1447 404 57 210 222 68 241 8 6 250 -Jack Clark NSTL1B232 55 9 34 23 45 12 44051213 194 702 705 625 623 35 31300 -Jose Cruz NHOULF479133 10 48 72 55 17 74722147 153 9801032 854 237 5 4 773 -Julio Cruz ACHA2B209 45 0 38 19 42 10 3859 916 23 557 279 478 132205 5 . -Jody Davis NCHNC 528132 21 61 74 41 6 2641 671 97 273 383 226 885105 81008 -Jim Dwyer ABALDO160 39 8 18 31 22 14 2128 543 56 304 268 298 33 3 0 275 -Julio Franco ACLESS599183 10 80 74 32 5 2482 715 27 330 326 158 231374 18 775 -Jim Gantner AMIL2B497136 7 58 38 26 11 38711066 40 450 367 241 304347 10 850 -Johnny Grubb ADETDH210 70 13 32 51 28 15 40401130 97 544 462 551 0 0 0 365 -J Hairston ACHAUT225 61 5 32 26 26 11 1568 408 25 202 185 257 132 9 0 . -Jack Howell ACAL3B151 41 4 26 21 19 2 288 68 9 45 39 35 28 56 2 95 -John Kruk NSD LF278 86 4 33 38 45 1 278 86 4 33 38 45 102 4 2 110 -J Leonard NSF LF341 95 6 48 42 20 10 2964 808 81 379 428 221 158 4 5 100 -Jim Morrison NPIT3B537147 23 58 88 47 10 2744 730 97 302 351 174 92257 20 278 -John Moses ASEACF399102 3 56 34 34 5 670 167 4 89 48 54 211 9 3 80 -J Mumphrey NCHNOF309 94 5 37 32 26 13 46181330 57 616 522 436 161 3 3 600 -Joe Orsulak NPITRF401100 2 60 19 28 4 876 238 2 126 44 55 193 11 4 . -Jorge Orta AKC DH336 93 9 35 46 23 15 57791610 128 730 741 497 0 0 0 . -Jim Presley ASEA3B616163 27 83107 32 3 1437 377 65 181 227 82 110308 15 200 -Jamie Quirk AKC CS219 47 8 24 26 17 12 1188 286 23 100 125 63 260 58 4 . -Johnny Ray NPIT2B579174 7 67 78 58 6 3053 880 32 366 337 218 280479 5 657 -Jeff Reed AMINC 165 39 2 13 9 16 3 196 44 2 18 10 18 332 19 2 75 -Jim Rice ABOSLF618200 20 98110 62 13 71272163 35111041289 564 330 16 82413 -Jerry Royster NSD UT257 66 5 31 26 32 14 3910 979 33 518 324 382 87166 14 250 -John Russell NPHIC 315 76 13 35 60 25 3 630 151 24 68 94 55 498 39 13 155 -Juan Samuel NPHI2B591157 16 90 78 26 4 2020 541 52 310 226 91 290440 25 640 -John Shelby ABALOF404 92 11 54 49 18 6 1354 325 30 188 135 63 222 5 5 300 -Joel Skinner ACHAC 315 73 5 23 37 16 4 450 108 6 38 46 28 227 15 3 110 -Jeff Stone NPHIOF249 69 6 32 19 20 4 702 209 10 97 48 44 103 8 2 . -Jim Sundberg AKC C 429 91 12 41 42 57 13 55901397 83 578 579 644 686 46 4 825 -Jim Traber ABALUT212 54 13 28 44 18 2 233 59 13 31 46 20 243 23 5 . -Jose Uribe NSF SS453101 3 46 43 61 3 948 218 6 96 72 91 249444 16 195 -Jerry Willard AOAKC 161 43 4 17 26 22 3 707 179 21 77 99 76 300 12 2 . -J Youngblood NSF OF184 47 5 20 28 18 11 3327 890 74 419 382 304 49 2 0 450 -Kevin Bass NHOURF591184 20 83 79 38 5 1689 462 40 219 195 82 303 12 5 630 -Kal Daniels NCINOF181 58 6 34 23 22 1 181 58 6 34 23 22 88 0 3 87 -Kirk Gibson ADETRF441118 28 84 86 68 8 2723 750 126 433 420 309 190 2 21300 -Ken Griffey ANYAOF490150 21 69 58 35 14 61261839 121 983 707 600 96 5 31000 -K Hernandez NNYN1B551171 13 94 83 94 13 60901840 128 969 900 9171199149 51800 -Kent Hrbek AMIN1B550147 29 85 91 71 6 2816 815 117 405 474 3191218104 101310 -Ken Landreaux NLA OF283 74 4 34 29 22 10 39191062 85 505 456 283 145 5 7 738 -K McReynolds NSD CF560161 26 89 96 66 4 1789 470 65 233 260 155 332 9 8 625 -K Mitchell NNYNOS328 91 12 51 43 33 2 342 94 12 51 44 33 145 59 8 125 -K Moreland NCHNRF586159 12 72 79 53 9 3082 880 83 363 477 295 181 13 41043 -Ken Oberkfell NATL3B503136 5 62 48 83 10 3423 970 20 408 303 414 65258 8 725 -Ken Phelps ASEADH344 85 24 69 64 88 7 911 214 64 150 156 187 0 0 0 300 -Kirby Puckett AMINCF680223 31119 96 34 3 1928 587 35 262 201 91 429 8 6 365 -K Stillwell NCINSS279 64 0 31 26 30 1 279 64 0 31 26 30 107205 16 75 -Leon Durham NCHN1B484127 20 66 65 67 7 3006 844 116 436 458 3771231 80 71183 -Len Dykstra NNYNCF431127 8 77 45 58 2 667 187 9 117 64 88 283 8 3 203 -Larry Herndon ADETOF283 70 8 33 37 27 12 44791222 94 557 483 307 156 2 2 225 -Lee Lacy ABALRF491141 11 77 47 37 15 42911240 84 615 430 340 239 8 2 525 -Len Matuszek NLA O1199 52 9 26 28 21 6 805 191 30 113 119 87 235 22 5 265 -Lloyd Moseby ATORCF589149 21 89 86 64 7 3558 928 102 513 471 351 371 6 6 788 -Lance Parrish ADETC 327 84 22 53 62 38 10 42731123 212 577 700 334 483 48 6 800 -Larry Parrish ATEXDH464128 28 67 94 52 13 58291552 210 740 840 452 0 0 0 588 -Luis Rivera NMONSS166 34 0 20 13 17 1 166 34 0 20 13 17 64119 9 . -Larry Sheets ABALDH338 92 18 42 60 21 3 682 185 36 88 112 50 0 0 0 145 -Lonnie Smith AKC LF508146 8 80 44 46 9 3148 915 41 571 289 326 245 5 9 . -Lou Whitaker ADET2B584157 20 95 73 63 10 47041320 93 724 522 576 276421 11 420 -Mike Aldrete NSF 1O216 54 2 27 25 33 1 216 54 2 27 25 33 317 36 1 75 -Marty Barrett ABOS2B625179 4 94 60 65 5 1696 476 12 216 163 166 303450 14 575 -Mike Brown NPITOF243 53 4 18 26 27 4 853 228 23 101 110 76 107 3 3 . -Mike Davis AOAKRF489131 19 77 55 34 7 2051 549 62 300 263 153 310 9 9 780 -Mike Diaz NPITO1209 56 12 22 36 19 2 216 58 12 24 37 19 201 6 3 90 -M Duncan NLA SS407 93 8 47 30 30 2 969 230 14 121 69 68 172317 25 150 -Mike Easler ANYADH490148 14 64 78 49 13 34001000 113 445 491 301 0 0 0 700 -M Fitzgerald NMONC 209 59 6 20 37 27 4 884 209 14 66 106 92 415 35 3 . -Mel Hall ACLELF442131 18 68 77 33 6 1416 398 47 210 203 136 233 7 7 550 -M Hatcher AMINUT317 88 3 40 32 19 8 2543 715 28 269 270 118 220 16 4 . -Mike Heath NSTLC 288 65 8 30 36 27 9 2815 698 55 315 325 189 259 30 10 650 -Mike Kingery AKC OF209 54 3 25 14 12 1 209 54 3 25 14 12 102 6 3 68 -M LaValliere NSTLC 303 71 3 18 30 36 3 344 76 3 20 36 45 468 47 6 100 -Mike Marshall NLA RF330 77 19 47 53 27 6 1928 516 90 247 288 161 149 8 6 670 -M Pagliarulo ANYA3B504120 28 71 71 54 3 1085 259 54 150 167 114 103283 19 175 -Mark Salas AMINC 258 60 8 28 33 18 3 638 170 17 80 75 36 358 32 8 137 -Mike Schmidt NPHI3B 20 1 0 0 0 0 2 41 9 2 6 7 4 78220 62127 -Mike Scioscia NLA C 374 94 5 36 26 62 7 1968 519 26 181 199 288 756 64 15 875 -M Tettleton AOAKC 211 43 10 26 35 39 3 498 116 14 59 55 78 463 32 8 120 -Milt Thompson NPHICF299 75 6 38 23 26 3 580 160 8 71 33 44 212 1 2 140 -Mitch Webster NMONCF576167 8 89 49 57 4 822 232 19 132 83 79 325 12 8 210 -Mookie Wilson NNYNOF381110 9 61 45 32 7 3015 834 40 451 249 168 228 7 5 800 -Marvell Wynne NSD OF288 76 7 34 37 15 4 1644 408 16 198 120 113 203 3 3 240 -Mike Young ABALLF369 93 9 43 42 49 5 1258 323 54 181 177 157 149 1 6 350 -Nick Esasky NCIN1B330 76 12 35 41 47 4 1367 326 55 167 198 167 512 30 5 . -Ozzie Guillen ACHASS547137 2 58 47 12 2 1038 271 3 129 80 24 261459 22 175 -O McDowell ATEXCF572152 18105 49 65 2 978 249 36 168 91 101 325 13 3 200 -Omar Moreno NATLRF359 84 4 46 27 21 12 49921257 37 699 386 387 151 8 5 . -Ozzie Smith NSTLSS514144 0 67 54 79 9 47391169 13 583 374 528 229453 151940 -Ozzie Virgil NATLC 359 80 15 45 48 63 7 1493 359 61 176 202 175 682 93 13 700 -Phil Bradley ASEALF526163 12 88 50 77 4 1556 470 38 245 167 174 250 11 1 750 -Phil Garner NHOU3B313 83 9 43 41 30 14 58851543 104 751 714 535 58141 23 450 -P Incaviglia ATEXRF540135 30 82 88 55 1 540 135 30 82 88 55 157 6 14 172 -Paul Molitor AMIL3B437123 9 62 55 40 9 41391203 79 676 390 364 82170 151260 -Pete O'Brien ATEX1B551160 23 86 90 87 5 2235 602 75 278 328 2731224115 11 . -Pete Rose NCIN1B237 52 0 15 25 30 24140534256 160216513141566 523 43 6 750 -Pat Sheridan ADETOF236 56 6 41 19 21 5 1257 329 24 166 125 105 172 1 4 190 -Pat Tabler ACLE1B473154 6 61 48 29 6 1966 566 29 250 252 178 846 84 9 580 -R Belliard NPITSS309 72 0 33 31 26 5 354 82 0 41 32 26 117269 12 130 -Rick Burleson ACALUT271 77 5 35 29 33 12 49331358 48 630 435 403 62 90 3 450 -Randy Bush AMINLF357 96 7 50 45 39 5 1394 344 43 178 192 136 167 2 4 300 -Rick Cerone AMILC 216 56 4 22 18 15 12 2796 665 43 266 304 198 391 44 4 250 -Ron Cey NCHN3B256 70 13 42 36 44 16 70581845 312 9651128 990 41118 81050 -Rob Deer AMILRF466108 33 75 86 72 3 652 142 44 102 109 102 286 8 8 215 -Rick Dempsey ABALC 327 68 13 42 29 45 18 3949 939 78 438 380 466 659 53 7 400 -Rich Gedman ABOSC 462119 16 49 65 37 7 2131 583 69 244 288 150 866 65 6 . -Ron Hassey ANYAC 341110 9 45 49 46 9 2331 658 50 249 322 274 251 9 4 560 -R Henderson ANYACF608160 28130 74 89 8 40711182 103 862 417 708 426 4 61670 -R Jackson ACALDH419101 18 65 58 92 20 95282510 548150916591342 0 0 0 488 -Ricky Jones ACALRF 33 6 0 2 4 7 1 33 6 0 2 4 7 205 5 4 . -Ron Kittle ACHADH376 82 21 42 60 35 5 1770 408 115 238 299 157 0 0 0 425 -Ray Knight NNYN3B486145 11 51 76 40 11 39671102 67 410 497 284 88204 16 500 -Randy Kutcher NSF OF186 44 7 28 16 11 1 186 44 7 28 16 11 99 3 1 . -Rudy Law AKC OF307 80 1 42 36 29 7 2421 656 18 379 198 184 145 2 2 . -Rick Leach ATORDO246 76 5 35 39 13 6 912 234 12 102 96 80 44 0 1 250 -Rick Manning AMILOF205 52 8 31 27 17 12 51341323 56 643 445 459 155 3 2 400 -R Mulliniks ATOR3B348 90 11 50 45 43 10 2288 614 43 295 273 269 60176 6 450 -Ron Oester NCIN2B523135 8 52 44 52 9 3368 895 39 377 284 296 367475 19 750 -Rey Quinones ABOSSS312 68 2 32 22 24 1 312 68 2 32 22 24 86150 15 70 -R Ramirez NATLS3496119 8 57 33 21 7 3358 882 36 365 280 165 155371 29 875 -Ronn Reynolds NPITLF126 27 3 8 10 5 4 239 49 3 16 13 14 190 2 9 190 -Ron Roenicke NPHIOF275 68 5 42 42 61 6 961 238 16 128 104 172 181 3 2 191 -Ryne Sandberg NCHN2B627178 14 68 76 46 6 3146 902 74 494 345 242 309492 5 740 -R Santana NNYNSS394 86 1 38 28 36 4 1089 267 3 94 71 76 203369 16 250 -Rick Schu NPHI3B208 57 8 32 25 18 3 653 170 17 98 54 62 42 94 13 140 -Ruben Sierra ATEXOF382101 16 50 55 22 1 382 101 16 50 55 22 200 7 6 98 -Roy Smalley AMINDH459113 20 59 57 68 12 53481369 155 713 660 735 0 0 0 740 -R Thompson NSF 2B549149 7 73 47 42 1 549 149 7 73 47 42 255450 17 140 -Rob Wilfong ACAL2B288 63 3 25 33 16 10 2682 667 38 315 259 204 135257 7 342 -R Williams NLA CF303 84 4 35 32 23 2 312 87 4 39 32 23 179 5 3 . -Robin Yount AMILCF522163 9 82 46 62 13 70372019 1531043 827 535 352 9 11000 -Steve Balboni AKC 1B512117 29 54 88 43 6 1750 412 100 204 276 1551236 98 18 100 -Scott Bradley ASEAC 220 66 5 20 28 13 3 290 80 5 27 31 15 281 21 3 90 -Sid Bream NPIT1B522140 16 73 77 60 4 730 185 22 93 106 861320166 17 200 -S Buechele ATEX3B461112 18 54 54 35 2 680 160 24 76 75 49 111226 11 135 -S Dunston NCHNSS581145 17 66 68 21 2 831 210 21 106 86 40 320465 32 155 -S Fletcher ATEXSS530159 3 82 50 47 6 1619 426 11 218 149 163 196354 15 475 -Steve Garvey NSD 1B557142 21 58 81 23 18 87592583 27111381299 4781160 53 71450 -Steve Jeltz NPHISS439 96 0 44 36 65 4 711 148 1 68 56 99 229406 22 150 -S Lombardozzi AMIN2B453103 8 53 33 52 2 507 123 8 63 39 58 289407 6 105 -Spike Owen ASEASS528122 1 67 45 51 4 1716 403 12 211 146 155 209372 17 350 -Steve Sax NLA 2B633210 6 91 56 59 6 3070 872 19 420 230 274 367432 16 90 -Tony Armas ABOSCF 16 2 0 1 0 0 2 28 4 0 1 0 0 247 4 8 . -T Bernazard ACLE2B562169 17 88 73 53 8 3181 841 61 450 342 373 351442 17 530 -Tom Brookens ADETUT281 76 3 42 25 20 8 2658 657 48 324 300 179 106144 7 342 -Tom Brunansky AMINRF593152 23 69 75 53 6 2765 686 133 369 384 321 315 10 6 940 -T Fernandez ATORSS687213 10 91 65 27 4 1518 448 15 196 137 89 294445 13 350 -Tim Flannery NSD 2B368103 3 48 28 54 8 1897 493 9 207 162 198 209246 3 327 -Tom Foley NMONUT263 70 1 26 23 30 4 888 220 9 83 82 86 81147 4 250 -Tony Gwynn NSD RF642211 14107 59 52 5 2364 770 27 352 230 193 337 19 4 740 -Terry Harper NATLOF265 68 8 26 30 29 7 1337 339 32 135 163 128 92 5 3 425 -Toby Harrah ATEX2B289 63 7 36 41 44 17 74021954 1951115 9191153 166211 7 . -Tommy Herr NSTL2B559141 2 48 61 73 8 3162 874 16 421 349 359 352414 9 925 -Tim Hulett ACHA3B520120 17 53 44 21 4 927 227 22 106 80 52 70144 11 185 -Terry Kennedy NSD C 19 4 1 2 3 1 1 19 4 1 2 3 1 692 70 8 920 -Tito Landrum NSTLOF205 43 2 24 17 20 7 854 219 12 105 99 71 131 6 1 287 -Tim Laudner AMINC 193 47 10 21 29 24 6 1136 256 42 129 139 106 299 13 5 245 -Tom O'Malley ABAL3B181 46 1 19 18 17 5 937 238 9 88 95 104 37 98 9 . -Tom Paciorek ATEXUT213 61 4 17 22 3 17 40611145 83 488 491 244 178 45 4 235 -Tony Pena NPITC 510147 10 56 52 53 7 2872 821 63 307 340 174 810 99 181150 -T Pendleton NSTL3B578138 1 56 59 34 3 1399 357 7 149 161 87 133371 20 160 -Tony Perez NCIN1B200 51 2 14 29 25 23 97782732 37912721652 925 398 29 7 . -Tony Phillips AOAK2B441113 5 76 52 76 5 1546 397 17 226 149 191 160290 11 425 -Terry Puhl NHOUOF172 42 3 17 14 15 10 40861150 57 579 363 406 65 0 0 900 -Tim Raines NMONLF580194 9 91 62 78 8 33721028 48 604 314 469 270 13 6 . -Ted Simmons NATLUT127 32 4 14 25 12 19 83962402 24210481348 819 167 18 6 500 -Tim Teufel NNYN2B279 69 4 35 31 32 4 1359 355 31 180 148 158 133173 9 278 -Tim Wallach NMON3B480112 18 50 71 44 7 3031 771 110 338 406 239 94270 16 750 -Vince Coleman NSTLLF600139 0 94 29 60 2 1236 309 1 201 69 110 300 12 9 160 -Von Hayes NPHI1B610186 19107 98 74 6 2728 753 69 399 366 2861182 96 131300 -Vance Law NMON2B360 81 5 37 44 37 7 2268 566 41 279 257 246 170284 3 525 -Wally Backman NNYN2B387124 1 67 27 36 7 1775 506 6 272 125 194 186290 17 550 -Wade Boggs ABOS3B580207 8107 71105 5 2778 978 32 474 322 417 121267 191600 -Will Clark NSF 1B408117 11 66 41 34 1 408 117 11 66 41 34 942 72 11 120 -Wally Joyner ACAL1B593172 22 82100 57 1 593 172 22 82 100 571222139 15 165 -W Krenchicki NMON13221 53 2 21 23 22 8 1063 283 15 107 124 106 325 58 6 . -Willie McGee NSTLCF497127 7 65 48 37 5 2703 806 32 379 311 138 325 9 3 700 -W Randolph ANYA2B492136 5 76 50 94 12 55111511 39 897 451 875 313381 20 875 -W Tolleson ACHA3B475126 3 61 43 52 6 1700 433 7 217 93 146 37113 7 385 -Willie Upshaw ATOR1B573144 9 85 60 78 8 3198 857 97 470 420 3321314131 12 960 -Willie Wilson AKC CF631170 9 77 44 31 11 49081457 30 775 357 249 408 4 31000 -; diff -Nru ess-18.10.2/fontlock-test/elem.sas ess-18.10.2+git20220915.f45542e/fontlock-test/elem.sas --- ess-18.10.2/fontlock-test/elem.sas 2018-11-10 09:41:11.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/fontlock-test/elem.sas 1970-01-01 00:00:00.000000000 +0000 @@ -1,10 +0,0 @@ -/* comment */; -data test; - a=1; -run; -Title 'Baseball Hitters Data'; - -/* Formats to specify the coding of some of the variables */; - - -/* Recode position to short list */ diff -Nru ess-18.10.2/fontlock-test/runif.Rcxx ess-18.10.2+git20220915.f45542e/fontlock-test/runif.Rcxx --- ess-18.10.2/fontlock-test/runif.Rcxx 2018-11-10 09:41:11.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/fontlock-test/runif.Rcxx 1970-01-01 00:00:00.000000000 +0000 @@ -1,22 +0,0 @@ -## -*- mode: poly-r+c++; -*- -require(RcppEigen) - -# cxxfunction not supported -# require(inline) -## runifXd <- cxxfunction(signature(arg1="integer"), plugin='RcppEigen', -## includes=' -## RNGScope scope; -## using namespace Eigen; - -## inline VectorXd runifXd(int size, double a=0., double b=1.) { -## return as(runif(size, a, b)); -## }', -## body='return wrap(runifXd(as(arg1)));') - -cppFunction(' -NumericVector runifXd(int size, double a=0., double b=1.) { - return runif(size, a, b);}', depends='RcppEigen', includes=' -RNGScope scope; -using namespace Eigen;') - -runifXd(3) diff -Nru ess-18.10.2/fontlock-test/testing.sas ess-18.10.2+git20220915.f45542e/fontlock-test/testing.sas --- ess-18.10.2/fontlock-test/testing.sas 2018-11-10 09:41:11.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/fontlock-test/testing.sas 1970-01-01 00:00:00.000000000 +0000 @@ -1,103 +0,0 @@ -/* */ - -/* -* ; -*/ - -* bad(news) ; - -/* -abort; -array; -*/ - -data onelevel; -data two.level; -data onelevel(keep=pt rename=(pt=patient)); -data two.level(keep=pt rename=(pt=patient)); - -attrib; -by; -cards; -cards4; -delete; -dm; -else do; -else if something then something; -do; -do over; -drop; -drop=; -end; -endsas; -error; -file; -filename; -footnote; -footnote1; -footnote10; -format; -go to; -goto; -else if; -if; -if something then something; -if something then something do; -else; -else do; -informat; -input; -keep; -keep=; -label; -length; -libname; -link; -lostcard; -options; -goptions; -output; -put; -rename; -rename=(; -retain; -return; -skip; -stop; -title; -title1; -title10; -where shhh; -where=(; -id; -tables; -window; -x; -class; -model; -var; -%include; -%Include; -select; -Select; -SELECT; -select(; -data; -Data; -data=; -set; -merge; -modify; -update; -run; -out=; - -proc any data=onelevel out=two.level; -proc any data=onelevel(where=(something)) out=two.level(where=(something)); - -when(; -else do; -then do; -do until(; -do while(; -%_episode(; diff -Nru ess-18.10.2/.gitignore ess-18.10.2+git20220915.f45542e/.gitignore --- ess-18.10.2/.gitignore 2018-11-10 09:41:10.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/.gitignore 2022-10-15 08:06:36.000000000 +0000 @@ -7,7 +7,6 @@ doc/readme.* doc/refcard/refcard.* *history -*NEWS *VERSION *REVISION *BACKUP* @@ -26,8 +25,15 @@ ess-[1-9]*.[0-9][0-9][-.]??? ess-[1-9]*.[0-9][0-9]-[0-9] ess-[1-9]*.[0-9][0-9]-[0-9][-.]??? -lisp/julia-mode.el +lisp/julia* lisp/ess-autoloads.el tmp* .DS_Store ._.DS_Store +.dependencies +NEWS +ONEWS + +# ELPA-generated files +/ess-autoloads.el +/ess-pkg.el diff -Nru ess-18.10.2/install-sh ess-18.10.2+git20220915.f45542e/install-sh --- ess-18.10.2/install-sh 2018-11-10 09:41:11.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/install-sh 1970-01-01 00:00:00.000000000 +0000 @@ -1,238 +0,0 @@ -#!/bin/sh -# -# install - install a program, script, or datafile -# This comes from X11R5. -# -# Calling this script install-sh is preferred over install.sh, to prevent -# `make' implicit rules from creating a file called install from it -# when there is no Makefile. -# -# This script is compatible with the BSD install script, but was written -# from scratch. -# - - -# set DOITPROG to echo to test this script - -# Don't use :- since 4.3BSD and earlier shells don't like it. -doit="${DOITPROG-}" - - -# put in absolute paths if you don't have them in your path; or use env. vars. - -mvprog="${MVPROG-mv}" -cpprog="${CPPROG-cp}" -chmodprog="${CHMODPROG-chmod}" -chownprog="${CHOWNPROG-chown}" -chgrpprog="${CHGRPPROG-chgrp}" -stripprog="${STRIPPROG-strip}" -rmprog="${RMPROG-rm}" -mkdirprog="${MKDIRPROG-mkdir}" - -tranformbasename="" -transform_arg="" -instcmd="$mvprog" -chmodcmd="$chmodprog 0755" -chowncmd="" -chgrpcmd="" -stripcmd="" -rmcmd="$rmprog -f" -mvcmd="$mvprog" -src="" -dst="" -dir_arg="" - -while [ x"$1" != x ]; do - case $1 in - -c) instcmd="$cpprog" - shift - continue;; - - -d) dir_arg=true - shift - continue;; - - -m) chmodcmd="$chmodprog $2" - shift - shift - continue;; - - -o) chowncmd="$chownprog $2" - shift - shift - continue;; - - -g) chgrpcmd="$chgrpprog $2" - shift - shift - continue;; - - -s) stripcmd="$stripprog" - shift - continue;; - - -t=*) transformarg=`echo $1 | sed 's/-t=//'` - shift - continue;; - - -b=*) transformbasename=`echo $1 | sed 's/-b=//'` - shift - continue;; - - *) if [ x"$src" = x ] - then - src=$1 - else - # this colon is to work around a 386BSD /bin/sh bug - : - dst=$1 - fi - shift - continue;; - esac -done - -if [ x"$src" = x ] -then - echo "install: no input file specified" - exit 1 -else - true -fi - -if [ x"$dir_arg" != x ]; then - dst=$src - src="" - - if [ -d $dst ]; then - instcmd=: - else - instcmd=mkdir - fi -else - -# Waiting for this to be detected by the "$instcmd $src $dsttmp" command -# might cause directories to be created, which would be especially bad -# if $src (and thus $dsttmp) contains '*'. - - if [ -f $src -o -d $src ] - then - true - else - echo "install: $src does not exist" - exit 1 - fi - - if [ x"$dst" = x ] - then - echo "install: no destination specified" - exit 1 - else - true - fi - -# If destination is a directory, append the input filename; if your system -# does not like double slashes in filenames, you may need to add some logic - - if [ -d $dst ] - then - dst="$dst"/`basename $src` - else - true - fi -fi - -## this sed command emulates the dirname command -dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` - -# Make sure that the destination directory exists. -# this part is taken from Noah Friedman's mkinstalldirs script - -# Skip lots of stat calls in the usual case. -if [ ! -d "$dstdir" ]; then -defaultIFS=' -' -IFS="${IFS-${defaultIFS}}" - -oIFS="${IFS}" -# Some sh's can't handle IFS=/ for some reason. -IFS='%' -set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'` -IFS="${oIFS}" - -pathcomp='' - -while [ $# -ne 0 ] ; do - pathcomp="${pathcomp}${1}" - shift - - if [ ! -d "${pathcomp}" ] ; - then - $mkdirprog "${pathcomp}" - else - true - fi - - pathcomp="${pathcomp}/" -done -fi - -if [ x"$dir_arg" != x ] -then - $doit $instcmd $dst && - - if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi && - if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi && - if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi && - if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi -else - -# If we're going to rename the final executable, determine the name now. - - if [ x"$transformarg" = x ] - then - dstfile=`basename $dst` - else - dstfile=`basename $dst $transformbasename | - sed $transformarg`$transformbasename - fi - -# don't allow the sed command to completely eliminate the filename - - if [ x"$dstfile" = x ] - then - dstfile=`basename $dst` - else - true - fi - -# Make a temp file name in the proper directory. - - dsttmp=$dstdir/#inst.$$# - -# Move or copy the file name to the temp name - - $doit $instcmd $src $dsttmp && - - trap "rm -f ${dsttmp}" 0 && - -# and set any options; do chmod last to preserve setuid bits - -# If any of these fail, we abort the whole thing. If we want to -# ignore errors from any of these, just make sure not to ignore -# errors from the above "$doit $instcmd $src $dsttmp" command. - - if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi && - if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi && - if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi && - if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi && - -# Now rename the file to the real destination. - - $doit $rmcmd -f $dstdir/$dstfile && - $doit $mvcmd $dsttmp $dstdir/$dstfile - -fi && - - -exit 0 diff -Nru ess-18.10.2/LDA/ex1.nw ess-18.10.2+git20220915.f45542e/LDA/ex1.nw --- ess-18.10.2/LDA/ex1.nw 2018-11-10 09:41:10.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/LDA/ex1.nw 1970-01-01 00:00:00.000000000 +0000 @@ -1,34 +0,0 @@ -\documentclass{article} -\usepackage{noweb} - -\begin{document} - -For example, plotting 20 pairs of $N(0,1)$ random variates can be -looked at via the two following chunks. - -<>= -;; -*- mode: xlispstat -*- -(def test (normal-rand 20)) -(def test2 (normal-rand 20)) -(plot test test2) -@ - -The below code demonstrates that there isn't much difference between -Lisp and the S language (as implemented through the dialect, R). - -<>= -## -*- mode: R -*- -test <- rnorm(20) -test2 <- rnorm(20) -plot(test,test2) -@ - -Finally, we could show how to do this in Stata or SAS, as follows: - -<>= -gen test = normal(20) -gen test2 = normal(20) -plot test,test2 -@ - -\end{document} diff -Nru ess-18.10.2/LDA/README ess-18.10.2+git20220915.f45542e/LDA/README --- ess-18.10.2/LDA/README 2018-11-10 09:41:10.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/LDA/README 1970-01-01 00:00:00.000000000 +0000 @@ -1,18 +0,0 @@ -Test - - - -Literate Data Analysis is a concept that takes Literate Programming -and implements it for data analysis. We envision it as a means to -record for future use, the trials and tribulations of data analysis -which are helpful for future statisticians, and to provide examples of -expert analyses (including mistakes and the roads less and not taken). - -This directory contains work on a tech report for ESS and literate -data analysis, as well as examples of literary styles and -applications. - -Files: -- ex1.nw : trivial example of the use of multiple code modes -- ex2.nw : -- lda-ess.tex (.pdf, .ps) : Tech Report diff -Nru ess-18.10.2/lisp/ess-arc-d.el ess-18.10.2+git20220915.f45542e/lisp/ess-arc-d.el --- ess-18.10.2/lisp/ess-arc-d.el 2018-11-10 09:41:11.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/lisp/ess-arc-d.el 1970-01-01 00:00:00.000000000 +0000 @@ -1,84 +0,0 @@ -;;; ess-arc-d.el --- ARC customization - -;; Copyright (C) 2000 A. J. Rossini -;; Copyright (C) 2001--2004 A.J. Rossini, Richard M. Heiberger, Martin -;; Maechler, Kurt Hornik, Rodney Sparapani, and Stephen Eglen. - -;; Author: A.J. Rossini -;; Created: 30 Jun 2000 -;; 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 -;; https://www.r-project.org/Licenses/ - - -;;; Commentary: - -;; This file extends the XLispStat configuration for ARC, the extension of the -;; R-Code. - -;;; Code: - -(require 'ess-lsp-l) -(require 'ess-inf) -(declare-function ess-write-to-dribble-buffer "ess-utils") -(defvar ess-customize-alist) -(defvar ess-dialect) - -(defvar ARC-customize-alist - '((ess-customize-alist . ARC-customize-alist ) - (ess-language . "XLS" ) - (ess-dialect . "ARC" ) - (ess-object-name-db-file . "ess-xls-namedb.el" ) - (ess-help-sec-regex . " ") - (ess-help-sec-keys-alist . " ") - (inferior-ess-primary-prompt . "> ?" ) - (comint-use-prompt-regexp . t) - (inferior-ess-program . inferior-ARC-program) - (inferior-ess-help-command . "(help '%s)\n" ) - (inferior-ess-objects-command . "(variables)\n" ) - (inferior-ess-exit-command . "(exit)\n" ) - ;;(inferior-ess-start-args . nil) - (inferior-ess-start-file . nil)) ; "~/.ess-ARC") - - "Variables to customize for ARC, a dialect of XLS.") - - -(defun ARC-mode (&optional proc-name) - "Major mode for editing ARC source. NOT EVEN STARTED." - (interactive) - (setq ess-customize-alist ARC-customize-alist) - (lisp-mode)) - - -(defun ARC () - "Call 'ARC', the extend XLispStat statistical system, from Forrest Young." - - (interactive) - (setq ess-customize-alist ARC-customize-alist) - (ess-write-to-dribble-buffer - (format "(ARC): ess-dialect=%s , buf=%s\n" - ess-dialect (current-buffer))) - (inferior-ess)) - -(fset 'arc 'ARC) - - ; Provide package - -(provide 'ess-arc-d) - -;;; ess-arc-d.el ends here diff -Nru ess-18.10.2/lisp/ess-bugs-d.el ess-18.10.2+git20220915.f45542e/lisp/ess-bugs-d.el --- ess-18.10.2/lisp/ess-bugs-d.el 2018-11-10 09:41:11.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/lisp/ess-bugs-d.el 2022-10-15 08:06:36.000000000 +0000 @@ -1,37 +1,35 @@ -;;; ess-bugs-d.el --- ESS[BUGS] dialect +;;; ess-bugs-d.el --- ESS[BUGS] dialect -*- lexical-binding: t; -*- -;; Copyright (C) 2008-2011 Rodney Sparapani +;; Copyright (C) 2008-2020 Free Software Foundation, Inc. ;; Author: Rodney Sparapani -;; Created: 13 March 2008 ;; Maintainer: ESS-help -;; This file is part of ESS +;; This file is part of GNU Emacs. -;; This file is free software; you can redistribute it and/or modify +;;; License: +;; +;; This program is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 2, or (at your option) -;; any later version. +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. ;; -;; This file is distributed in the hope that it will be useful, +;; This program is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. ;; -;; A copy of the GNU General Public License is available at -;; https://www.r-project.org/Licenses/ +;; You should have received a copy of the GNU General Public License +;; along with this program. If not, see +;; ;;; Code: (require 'ess-bugs-l) (require 'ess-utils) (require 'ess-inf) -(require 'ess-custom) (require 'ess-mode) -(setq auto-mode-alist - (append '(("\\.[bB][uU][gG]\\'" . ess-bugs-mode)) auto-mode-alist)) - (defvar ess-bugs-command "OpenBUGS" "Default BUGS program in PATH.") (make-local-variable 'ess-bugs-command) @@ -122,7 +120,7 @@ )) (if (equal ".bmd" suffix) (let - ((ess-bugs-temp-chains "") (ess-bugs-temp-monitor "") (ess-bugs-temp-chain "")) + ((ess-bugs-temp-chains "") (ess-bugs-temp-monitor "")) (if bugs-chains (setq ess-bugs-chains bugs-chains)) (if bugs-monitor (setq ess-bugs-monitor bugs-monitor)) @@ -193,7 +191,7 @@ )) ) -(defun ess-bugs-na-bmd (bugs-command bugs-chains) +(defun ess-bugs-na-bmd (bugs-command) "ESS[BUGS]: Perform the Next-Action for .bmd." ;(ess-save-and-set-local-variables) (if (equal 0 (buffer-size)) (ess-bugs-switch-to-suffix ".bmd") @@ -246,23 +244,14 @@ ) ;;;###autoload -(defun ess-bugs-mode () - "ESS[BUGS]: Major mode for BUGS." - (interactive) - (kill-all-local-variables) - (ess-setq-vars-local '((comment-start . "#"))) - (setq major-mode 'ess-bugs-mode) - (setq mode-name "ESS[BUGS]") - (use-local-map ess-bugs-mode-map) - (make-local-variable 'font-lock-defaults) +(define-derived-mode ess-bugs-mode ess-mode "ESS[BUGS]" + "Major mode for BUGS." + (setq-local comment-start "#") (setq font-lock-defaults '(ess-bugs-font-lock-keywords nil t)) (setq ess-language "S") ; mimic S for ess-smart-underscore - (run-mode-hooks 'ess-bugs-mode-hook) - (unless (when (fboundp 'w32-shell-dos-semantics) (w32-shell-dos-semantics)) - (add-hook 'comint-output-filter-functions 'ess-bugs-exit-notify-sh)) - ) + (add-hook 'comint-output-filter-functions 'ess-bugs-exit-notify-sh))) ;;;###autoload (add-to-list 'auto-mode-alist '("\\.[Bb][Uu][Gg]\\'" . ess-bugs-mode)) @@ -304,7 +293,6 @@ (replace-match ess-temp-replacement-string)))))) -(setq features (delete 'ess-bugs-d features)) (provide 'ess-bugs-d) ;;; ess-bugs-d.el ends here diff -Nru ess-18.10.2/lisp/ess-bugs-l.el ess-18.10.2+git20220915.f45542e/lisp/ess-bugs-l.el --- ess-18.10.2/lisp/ess-bugs-l.el 2018-11-10 09:41:11.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/lisp/ess-bugs-l.el 2022-10-15 08:06:36.000000000 +0000 @@ -1,34 +1,32 @@ -;;; ess-bugs-l.el --- ESS[BUGS] languages +;;; ess-bugs-l.el --- ESS[BUGS] languages -*- lexical-binding: t; -*- -;; Copyright (C) 2006-2011 Rodney Sparapani +;; Copyright (C) 2006-2020 Free Software Foundation, Inc. ;; Author: Rodney Sparapani -;; Created: 16 August 2006 ;; Maintainer: ESS-help -;; This file is part of ESS +;; This file is part of GNU Emacs -;; This file is free software; you can redistribute it and/or modify +;;; License: +;; +;; This program is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 2, or (at your option) -;; any later version. +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. ;; -;; This file is distributed in the hope that it will be useful, +;; This program is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. ;; -;; A copy of the GNU General Public License is available at -;; https://www.r-project.org/Licenses/ - +;; You should have received a copy of the GNU General Public License +;; along with this program. If not, see +;; ;;; Code: -(require 'font-lock) (require 'shell) -(require 'comint) (require 'ess-utils) -(require 'ess-custom) (defvar ess-bugs-command) (defvar ess-bugs-chains) (defvar ess-jags-command) @@ -46,28 +44,32 @@ :prefix "ess-") (defcustom ess-bugs-batch-method - (if ess-microsoft-p (if (w32-shell-dos-semantics) 'dos 'sh) 'sh) + (if (and ess-microsoft-p + (fboundp 'w32-shell-dos-semantics) + (w32-shell-dos-semantics)) + 'dos + 'sh) "Method used by `ess-bugs-batch'. The default is based on the value of the Emacs variable `system-type' and, on Windows machines, the function `w32-shell-dos-semantics'. -'sh if *shell* runs a Bourne-like or a C-like Unix shell -'dos if *shell* runs a DOS-like Windows shell +\\='sh if *shell* runs a Bourne-like or a C-like Unix shell +\\='dos if *shell* runs a DOS-like Windows shell -Unix users will get 'sh by default. +Unix users will get \\='sh by default. -Windows users running a DOS-like *shell* will get 'dos by default, -while those running a Unix-like *shell* will get 'sh by default. +Windows users running a DOS-like *shell* will get \\='dos by default, +while those running a Unix-like *shell* will get \\='sh by default. -Users whose default is not 'sh, but are accessing a remote machine with +Users whose default is not \\='sh, but are accessing a remote machine with `telnet' or `ssh', should have the following in their init file: - (setq-default ess-bugs-batch-method 'sh)" + (setq-default ess-bugs-batch-method \\='sh)" :group 'ess-bugs - :type '(choice (const 'sh :tag "Bourne/C-like Unix Shell") - (const 'dos :tag "DOS-like Windows shell"))) + :type '(choice (const sh :tag "Bourne/C-like Unix Shell") + (const dos :tag "DOS-like Windows shell"))) (defcustom ess-bugs-batch-post-command (if (equal ess-bugs-batch-method 'sh) "&" " ") - "*ESS[BUGS]: Modifiers at the end of the batch BUGS command line." + "ESS[BUGS]: Modifiers at the end of the batch BUGS command line." :group 'ess-bugs :type 'string ) @@ -75,7 +77,7 @@ (defcustom ess-bugs-batch-pre-command (if (equal ess-bugs-batch-method 'sh) "nohup nice time" (if ess-microsoft-p "start")) - "*ESS[BUGS]: Modifiers at the beginning of the batch BUGS command line." + "ESS[BUGS]: Modifiers at the beginning of the batch BUGS command line." :group 'ess-bugs :type 'string ) @@ -94,7 +96,7 @@ ) (defvar ess-bugs-batch-command ";" - "*ESS[BUGS]: The name of the command to run BUGS in batch mode." + "ESS[BUGS]: The name of the command to run BUGS in batch mode." ) (defvar ess-bugs-file "." @@ -125,7 +127,7 @@ ) (defcustom ess-bugs-mode-hook nil - "*ESS[BUGS]: List of functions to call upon entering mode." + "ESS[BUGS]: List of functions to call upon entering mode." :group 'ess-bugs :type 'hook) @@ -135,27 +137,26 @@ (defvar ess-bugs-stats-vars " " "ESS[BUGS]: List of BUGS variables to be summarized with statistics.") -(defvar ess-bugs-mode-map nil +(defvar ess-bugs-mode-map + (let ((map (make-sparse-keymap))) + (define-key map (quote [f2]) #'ess-revert-wisely) + (define-key map "\C-c\C-c" #'ess-bugs-next-action) + (define-key map "=" #'ess-bugs-hot-arrow) +;; (define-key map "_" #'ess-bugs-hot-arrow) + map) "ESS[BUGS]: Keymap for mode.") -(if ess-bugs-mode-map nil (setq ess-bugs-mode-map (make-keymap))) -(define-key ess-bugs-mode-map (quote [f2]) 'ess-revert-wisely) - ;(define-key ess-bugs-mode-map (quote [f12]) 'ess-bugs-next-action) -(define-key ess-bugs-mode-map "\C-c\C-c" 'ess-bugs-next-action) -(define-key ess-bugs-mode-map "=" 'ess-bugs-hot-arrow) -(define-key ess-bugs-mode-map "_" 'ess-bugs-hot-arrow) - -(defvar ess-bugs-syntax-table nil +(defvar ess-bugs-syntax-table + (let ((table (make-syntax-table))) + (modify-syntax-entry ?\\ "." table) + (modify-syntax-entry ?# "<" table) + (modify-syntax-entry ?\n ">" table) + (modify-syntax-entry ?\( "()" table) + (modify-syntax-entry ?\) ")(" table) + (modify-syntax-entry ?. "w" table) + table) "ESS[BUGS]: Syntax table for mode.") -(if ess-bugs-syntax-table nil (setq ess-bugs-syntax-table (make-syntax-table))) -(modify-syntax-entry ?\\ "." ess-bugs-syntax-table) -(modify-syntax-entry ?# "<" ess-bugs-syntax-table) -(modify-syntax-entry ?\n ">" ess-bugs-syntax-table) -(modify-syntax-entry ?\( "()" ess-bugs-syntax-table) - (modify-syntax-entry ?\) ")(" ess-bugs-syntax-table) -(modify-syntax-entry ?. "w" ess-bugs-syntax-table) - (defun ess-bugs-file () "ESS[BUGS]: Set internal variables dealing with BUGS files. Set `ess-bugs-file', `ess-bugs-file-root', `ess-bugs-file-suffix' @@ -181,12 +182,12 @@ (defun ess-bugs-exit-notify-sh (string) "ESS[BUGS]: Detect completion or failure of submitted job and notify the user." - (let* ((exit-done "\\[[0-9]+\\]\\ *\\+*\\ *\\(Exit\\|Done\\)[^\r\n]*") + (let* ((exit-done "\\[[0-9]+\\] *\\+* *\\(Exit\\|Done\\)[^\r\n]*") (beg (string-match exit-done string))) - (if beg (message (substring string beg (match-end 0)))))) + (if beg (message "%s" (substring string beg (match-end 0)))))) (defun ess-bugs-hot-arrow () - "*ESS[BUGS]: Substitute <- for = key press" + "ESS[BUGS]: Substitute <- for = key press" (interactive) (insert " <- ")) @@ -245,12 +246,12 @@ :prefix "ess-") (defcustom ess-bugs-shell-buffer-name "BUGS" - "*ESS[BUGS-Shell]: The name of the BUGS-Shell buffer." + "ESS[BUGS-Shell]: The name of the BUGS-Shell buffer." :group 'ess-bugs-shell :type 'string) (defcustom ess-bugs-shell-command "OpenBUGS" - "*ESS[BUGS-Shell]: The name of the command to run BUGS interactively. + "ESS[BUGS-Shell]: The name of the command to run BUGS interactively. Set to the name of the batch BUGS script that comes with ESS or to the name of BUGS command. Make sure it is in your PATH or @@ -259,19 +260,19 @@ :type 'string) (defcustom ess-bugs-shell-default-output-file-root "bugs" - "*ESS[BUGS-Shell]: Default value for the root of output files." + "ESS[BUGS-Shell]: Default value for the root of output files." :group 'ess-bugs-shell :type 'string) (defcustom ess-bugs-shell-mode-hook nil - "*ESS[BUGS-Shell]: List of functions to call upon entering mode." + "ESS[BUGS-Shell]: List of functions to call upon entering mode." :group 'ess-bugs-shell :type 'hook) (defun ess-bugs-shell () "Create a buffer with BUGS running as a subprocess." (interactive) - (switch-to-buffer (concat "*" ess-bugs-shell-buffer-name "*")) + (pop-to-buffer-same-window (concat "*" ess-bugs-shell-buffer-name "*")) (make-comint ess-bugs-shell-buffer-name ess-bugs-shell-command nil ess-bugs-default-bins ess-bugs-shell-default-output-file-root) (comint-mode) diff -Nru ess-18.10.2/lisp/ess-custom.el ess-18.10.2+git20220915.f45542e/lisp/ess-custom.el --- ess-18.10.2/lisp/ess-custom.el 2018-11-02 21:15:01.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/lisp/ess-custom.el 2022-10-15 08:06:36.000000000 +0000 @@ -1,16 +1,28 @@ -;;; ess-custom.el --- Customize variables for ESS +;;; ess-custom.el --- Customize variables for ESS -*- lexical-binding: t; -*- -;; 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: 05 June 2000 -;; Maintainer: ESS-core +;; Copyright (C) 1997-2020 Free Software Foundation, Inc. +;; Author: Rodney Sparapani +;; Maintainer: ESS-help ;; Keywords: languages +;; This file is part of GNU Emacs + +;; 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 +;; https://www.r-project.org/Licenses/ + + + ;; This file is part of ESS ;; This file is free software; you can redistribute it and/or modify @@ -26,18 +38,19 @@ ;; A copy of the GNU General Public License is available at ;; https://www.r-project.org/Licenses/ + +;;; Commentary: +;; This file holds defcustoms for ESS. It is required by ess-utils.el, +;; which in turn is required by almost every other ESS file. + ;;; Code: (require 'comint) -(require 'custom) -(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 @@ -47,7 +60,7 @@ :link '(url-link "https://ess.r-project.org/")) (defgroup ess-edit nil - "ESS: editing behavior, including coments/indentation." + "ESS: editing behavior, including comments/indentation." :group 'ess :prefix "ess-") @@ -76,11 +89,6 @@ :group 'ess :prefix "ess-") -(defgroup ess-origS nil - "ESS: Original S Dialect from Bell Labs/AT&T." - :group 'ess-S - :prefix "ess-") - (defgroup ess-SPLUS nil "ESS: S-PLUS Dialect of S." :group 'ess-S @@ -101,62 +109,68 @@ :group 'ess :prefix "ess-") -(defgroup ess-Stata nil - "ESS: Stata." - :group 'ess - :prefix "ess-") - -(defgroup ess-XLS nil - "ESS: XLispStat." - :group 'ess - :prefix "ess-") - -(defgroup ess-OMG nil - "ESS: Omegahat." - :group 'ess - :prefix "ess-") - -(defgroup ess-mouse nil ;; FIXME: this is not used yet <--> ./ess-mous.el - "ESS: Mouse." - :group 'ess - :prefix "ess-") - (defgroup ess-roxy nil "Mode for editing in-code Roxygen documentation." :group 'ess :group 'convenience :group 'ess-extras - :prefix "ess-" ;; << -- added for ESS integration FIXME?? + :prefix "ess-" :group 'tools) -(defgroup ess-sweave nil - "Mode for editing Sweave (*.[SR]nw) files." - :group 'ess-S - :prefix "ess-") - (defgroup ess-extras nil - "Extra utilities for ESS" + "Extra utilities for ESS." :group 'ess :prefix "ess-") (defgroup ess-faces nil "Faces and face options for ESS modes." :group 'ess + :group 'faces :prefix "ess-") -;; Variables (not user-changeable) -(defvar ess-version "18.10.2" ;; updated by 'make' - "Version of ESS currently loaded.") + ; User changeable variables -(defvar ess-revision nil ;; set - "The subversion revision and date of ESS. -Is set by \\[ess-version-string].") +;;*;; Options and Initialization +;;;###autoload +(defcustom ess-lisp-directory + (file-name-directory + (or load-file-name + buffer-file-name)) + "Directory containing ess-site.el(c) and other ESS Lisp files." + :group 'ess + :type 'directory + :package-version '(ess . "19.04")) - ; User changeable variables +(defcustom ess-etc-directory + ;; Try to detect the `etc' folder only if not already set up by distribution + (let (dir) + (dolist (d '("./etc/" "../../etc/ess/" "../etc/" "../etc/ess/")) + (setq d (expand-file-name d ess-lisp-directory)) + (when (file-directory-p d) + (setq dir d))) + dir) + "Location of the ESS etc/ directory. +The ESS etc directory stores various auxiliary files that are useful +for ESS, such as icons." + :group 'ess + :type 'directory + :package-version '(ess . "19.04")) -;;*;; Options and Initialization +;; 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 +;;;###autoload +(add-to-list 'load-path (directory-file-name ess-lisp-directory)) +;; Add ess-lisp-directory/obsolete to load-path; files here will +;; automatically warn that they are obsolete when loaded. +;;;###autoload +(add-to-list 'load-path (directory-file-name (expand-file-name "obsolete" ess-lisp-directory))) + +(unless (file-directory-p ess-etc-directory) + (display-warning 'ess (format "Could not find directory `ess-etc-directory': %s" + ess-etc-directory) :error)) ;; Menus and pulldowns. @@ -168,12 +182,31 @@ :type 'boolean) (defcustom ess-imenu-use-S ess-imenu-use-p - "*Non-nil means include an Imenu menu item in S buffers." + "Non-nil means include an Imenu menu item in S buffers." :group 'ess :type 'boolean) -(defvar ess-imenu-generic-expression nil - "Placeholder for imenu-generic-expression. Dialect specific.") +(defcustom ess-auto-width-visible nil + "When non-nil, echo width setting in the inferior buffer. +See `ess-auto-width'. Be warned that ESS can set the width a +lot." + :group 'ess + :type 'boolean + :package-version '(ess . "19.04")) + +(defcustom ess-auto-width nil + "When non-nil, set the width option when the window configuration changes. +When \\='frame, set the width to the frame width. When \\='window, set +the width to the window width. If an integer, set the width to +that integer. If it's a negative integer, set the width to the +window's width minus that number. Anything else is treated as +\\='window." + :group 'ess + :type '(choice (const :tag "Do nothing" :value nil) + (const :tag "Frame width" :value frame) + (const :tag "Window width" :value window) + (integer :tag "Integer value")) + :package-version '(ess . "19.04")) (defcustom ess-handy-commands '(("change-directory" . ess-change-directory) ("install.packages" . ess-install-library) @@ -188,37 +221,30 @@ ("sos" . ess-sos) ("vignettes" . ess-display-vignettes) ) - "An alist of custom ESS commands available for call by -`ess-handy-commands' and `ess-smart-comma' function." + "An alist of custom ESS commands. +These are available for call by function `ess-handy-commands' and +`ess-smart-comma' function." :group 'ess :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) - +(defvar-local ess--local-handy-commands nil + "Store handy commands locally.") (defcustom ess-describe-at-point-method nil "Whether `ess-describe-object-at-point' should use a tooltip. -If nil display in an electric buffer. If 'tooltip display in +If nil display in an electric buffer. If \\='tooltip display in a tooltip. -See also `tooltip-hide-delay' and `tooltip-delay'. - " +See also `tooltip-hide-delay' and variable `tooltip-delay'." :group 'ess-utils - :type '(choice (const :tag "buffer" :value nil ) (const tooltip)) - ) + :type '(choice (const :tag "buffer" :value nil ) (const tooltip))) (defvaralias 'ess-R-describe-object-at-point-commands 'ess-r-describe-object-at-point-commands) (defcustom ess-r-describe-object-at-point-commands '(("str(%s)") - ("htsummary(%s, hlength = 20, tlength = 20)") + (".ess_htsummary(%s, hlength = 20, tlength = 20)") ("summary(%s, maxsum = 20)")) "A list of commands cycled by `ess-describe-object-at-point'. %s is substituted with the name at point. @@ -238,8 +264,8 @@ (defcustom ess-can-eval-in-background t - "If non-nil ESS can perform caching and other background - activities by calling the subprocess on idle time." + "If non-nil ESS can perform caching and other background activities. +This allows ESS to call the subprocess on idle time." :group 'ess :type 'boolean) @@ -270,48 +296,48 @@ :type 'boolean) (defcustom ess-display-buffer-reuse-frames t - "Non-nil means \\[display-buffer] reuses existing frames; see -`display-buffer-reuse-frames'." + "Non-nil means \\[display-buffer] reuses existing frames. +See `display-buffer-reuse-frames'." :group 'ess :type 'boolean) -(defvar ess-language nil +(defvar-local ess-language nil "Determines the language to use for the current buffer. See also `ess-dialect'.") -(make-variable-buffer-local 'ess-language) -(defvar ess-dialect nil +(defvar-local ess-dialect nil "String version of the dialect being run for the inferior process. This, plus `ess-language', should be able to determine the exact version of the statistical package being executed in the particular buffer.") -(make-variable-buffer-local 'ess-dialect) -(defcustom ess-directory-function nil +(defvaralias 'ess-directory-function 'ess-startup-directory-function) +(defcustom ess-startup-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-startup-directory'." - :group 'ess - :type '(choice (const nil) function)) - -(defcustom ess-setup-directory-function nil - "Function to setup the directory that ESS is run from. -This function can be called to set environment variables or to create -a workspace." +Value of `ess-startup-directory' has precedence over this function." :group 'ess :type '(choice (const nil) function)) (defvaralias 'ess-directory 'ess-startup-directory) (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." + "The directory ESS is run from (string or a symbol). +Provided a default (especially useful if +`ess-ask-for-ess-directory' is non-nil). A nil value means use +the value returned by `ess-startup-directory-function'. If nil, +use current project directory, otherwise use to the +`default-directory'. + +When this variable is a symbol, use its value. Set this variable +to `'default-directory' in order to always start in the current +directory." :group 'ess - :type '(choice (const nil) directory)) + :type '(choice (const nil) directory symbol)) (defcustom ess-history-directory nil "Directory to pick up `ess-history-file' from. -If this is nil, the history file is relative to `ess-directory'." +If this is nil, the history file is relative to the startup +directory of the inferior process (see `ess-startup-directory')." :group 'ess :type '(choice (const nil) directory)) @@ -327,7 +353,9 @@ file)) (defcustom ess-plain-first-buffername t - "No fancy process buffname for the first process of each type (novice mode)." + "When non-nil, the first process buffer created does not have a number. +In other words, it is R:foo rather than R:1:foo. Subsequent +processes buffers are always numbered (e.g. R:2:foo." :group 'ess :type 'boolean) @@ -349,40 +377,37 @@ `ess-ido-flex-matching' on how to disable it for ESS, if you don't want it. -Some useful keys for IDO completion: - - - C-s (next) or C-r (previous) to move through the list. - - C-SPC to restrict the list to currently matched items. - - TAB to display possible completion in a buffer - - C-t `ido-toggle-regexp' -" +See info node `(ido) Top' for more information about how ido +works." :group 'ess + :require 'ido :type 'boolean) (defcustom ess-tab-complete-in-script nil - "If non-nil, TAB in script buffers tries to complete if there is nothing to indent. + "If non-nil, TAB tries to complete if it does not indent in script buffers. See also `ess-first-tab-never-complete'." :group 'ess :type 'boolean) +(make-obsolete-variable 'ess-tab-complete-in-script 'tab-always-indent "ESS 19.04" 'set) -(defvaralias 'ess-first-tab-never-completes-p 'ess-first-tab-never-complete) +(define-obsolete-variable-alias 'ess-first-tab-never-completes-p + 'ess-first-tab-never-complete "ESS 19.04") (defcustom ess-first-tab-never-complete 'symbol - "If t, first TAB never tries to complete in ess-mode. -If 'symbol first TAB doesn't try to complete if next char is a + "If t, first TAB never tries to complete in `ess-mode'. +If \\='symbol first TAB doesn't try to complete if next char is a valid symbol constituent. -If 'symbol-or-paren don't complete if next char is closed paren +If \\='symbol-or-paren don't complete if next char is closed paren )}] or symbol character. -If 'symbol-or-paren-or-punct don't complete if next char is +If \\='symbol-or-paren-or-punct don't complete if next char is punctuation +-=% etc, or closed paren or symbol. -If 'unless-eol - first TAB completes only at end of line. +If \\='unless-eol - first TAB completes only at end of line. If nil first TAB always tries to complete (this might be too -aggressive and dangerous). -" +aggressive and dangerous)." :group 'ess :type '(choice (const nil) (const symbol) @@ -392,8 +417,8 @@ (const t))) (defcustom ess-use-eldoc t - "If t, activate eldoc in ess-mode and inferior-ess-mode buffers. -If 'script-only activate in ess-mode buffers only. + "If t, activate eldoc in `ess-mode' and `inferior-ess-mode' buffers. +If \\='script-only activate in `ess-mode' buffers only. See also `ess-eldoc-show-on-symbol'." :group 'ess-extras @@ -407,15 +432,20 @@ :type 'boolean) (defcustom ess-eldoc-abbreviation-style 'normal - "How ess-eldoc string should be abbreviated when it doesn't fit into one line + "Controls how `eldoc' displays information that does not fit on a line. + A symbol which can be -nil: do nothing -mild: Replace TRUE, FALSE with T,F -normal: Try mild + shorten the default values longer than 10 characters. -strong: Try normal + completely remove default values except =F,=T,=d where d is a digit. -aggressive (or t): Try strong + truncate the doc string to fit into minibuffer. -The default style is 'normal. +- nil: do nothing +- mild: Replace TRUE, FALSE with T,F +- normal: Try mild + shorten the default values longer than 10 + characters. +- strong: Try normal + completely remove default values except + =F,=T,=d where d is a digit. +- aggressive (or t): Try strong + truncate the doc string to fit + into minibuffer. + +The default style is \\='normal. Ess-eldoc also honors the value of `eldoc-echo-area-use-multiline-p'. If this variable is not t (the @@ -427,7 +457,7 @@ (defcustom ess-use-flymake t "If non-nil activate flymake in `ess-mode' buffers. -If 'process, only check if the buffer has an inferior process." +If \\='process, only check if the buffer has an inferior process." :group 'ess :type '(choice (const :tag "Always" t) (const :tag "With running inferior process" process) @@ -435,8 +465,10 @@ :package-version '(ess . "18.10")) (defcustom ess-use-auto-complete t - "If t, activate auto-complete support in ess-mode and inferior-ess-mode buffers. -If 'script-only activate in ess-mode buffers only. + "If non-nil, activate auto-complete support. +If t, activate auto-complete support in `ess-mode' and +`inferior-ess-mode' buffers. If \\='script-only activate in `ess-mode' +buffers only. If non-nil add `ac-source-R' and `ac-source-filename' to the `ac-sources' buffer local variable. @@ -447,11 +479,13 @@ to install your custom sources." :group 'ess-extras :type '(choice (const t) (const script-only) (const nil))) +(make-obsolete-variable 'ess-use-auto-complete "Auto-complete is unmaintained; use company-mode instead" + "ESS 19.04" 'set) (defcustom ess-use-company t - "If t, activate company support in ess-mode and inferior-ess-mode buffers. + "If t, activate company support in `ess-mode' and `inferior-ess-mode' buffers. If non-nil add `company-R-args' and `company-R-objects' to the -`company-backends'. If 'script-only activate in ess-mode buffers +`company-backends'. If \\='script-only activate in `ess-mode' buffers only." :group 'ess-extras :type '(choice (const t) (const script-only) (const nil))) @@ -463,7 +497,7 @@ integer)) (defcustom ess-use-tracebug t - "If t, load ess-tracebug when R process starts." + "If t, load `ess-tracebug' when R process starts." :group 'ess-extras :type 'boolean) @@ -471,36 +505,27 @@ "If t, ido for ESS completion uses flex matching. See `ido-enable-flex-matching' for details. If you have an old computer, or you load lot of packages, you -might want to set this to nil. -" +might want to set this to nil." :group 'ess :type 'boolean) - -(defvar ess-ac-sources nil - "Dialect specific, ESS specific list of ac-sources") - -(defvar ess-company-backends nil - "Dialect specific, ESS specific list of `company-backends'") - (defvar ess--completing-hist nil "Variable to store completion history. Used by `ess-completion-read' command.") -(defvar ess-smart-operators () +(defvar-local 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'.") -(make-variable-buffer-local 'ess-smart-operators) (defvaralias 'ess-R-smart-operators 'ess-r-smart-operators) (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 +If t, use all. If an explicit 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.") +In current version of ESS, it controls the behavior of +`ess-smart-comma' only, but will be enriched in the near future.") (defvar ess-no-skip-regexp "[ \t\n]*\\'" @@ -509,19 +534,9 @@ Used to avoid annoying jumping by ess-eval.*-and-step to end of buffer or end chunks etc.") -(defcustom ess-smart-S-assign-key "_" - "Key used by `ess-smart-S-assign'. -Should be nil or a \"simple\" key, in other words no key -modifiers. - -This variable is deprecated and will be removed in the future. -Please bind `ess-insert-assign' in `ess-mode-map' to your key of -choice with `define-key' or similar." - :group 'ess-S - :type '(choice (const :tag "Nothing" :value nil) string)) (make-obsolete-variable 'ess-smart-S-assign-key nil "ESS 18.10") -(defcustom ess-assign-list (cons (if (boundp 'ess-S-assign) ess-S-assign " <- ") +(defcustom ess-assign-list (cons (or (bound-and-true-p ess-S-assign) " <- ") '(" <<- " " = " " -> " " ->> ")) "List of assignment operators. `ess-cycle-assign' uses this list. These strings must @@ -555,29 +570,28 @@ :type '(alist :key-type string :value-type symbol) :package-version '(ess . "18.10")) -;;*;; Variables concerning editing behaviour +;;*;; Variables concerning editing behavior (defcustom ess-filenames-map t - "Declares if the filenames in an attached directory are the same -as objects in that directory (when t). This is not true for DOS and -other OS's with limited filename lengths. Even if this is set -incorrectly, the right things will probably still happen, however." + "If non-nil, filenames and objects are the same in an attached directory. +This is not true for DOS and other OS's with limited filename +lengths. Even if this is set incorrectly, the right things will +probably still happen, however." :group 'ess-edit :type 'boolean) (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. -Anything else, never delete. This variable only affects the behaviour +to delete, except for files created with `ess-dump-object-into-edit-buffer'. +Anything else, never delete. This variable only affects the behavior of `ess-load-file'. Dump files are never deleted if an error occurs -during the load. " +during the load." :group 'ess-edit - :type '(choice (const :tag "Check" :value 'check) - (const :tag "Ask" :value 'ask) - (const :tag "Always keep" :value t) - (const :tag "Always delete" :value nil) - )) + :type '(choice (const :tag "Check" :value check) + (const :tag "Ask" :value ask) + (const :tag "Always keep" :value t) + (const :tag "Always delete" :value nil))) (defcustom ess-delete-dump-files nil "Non-nil means delete dump files after they are created. @@ -608,7 +622,8 @@ :type 'boolean) (defcustom ess-fill-calls t - "If non-nil, refilling a paragraph inside a function or + "If non-nil, refilling inside a call arranges arguments. +In other words, refilling a paragraph inside a function or indexing call will arrange the arguments according to `fill-column' as in: @@ -639,8 +654,9 @@ Setting `ess-offset-arguments' to `prev-line' or `prev-call' activates a third style. It keeps one argument per line except for the first N arguments. N is controlled with a prefix. For -example, calling M-q three times sets N to 1 while calling M-q -twice then C-U 2 M-q sets N to 2. Here what the default produces: +example, calling \\[fill-paragraph] three times sets N to 1 while +calling \\[fill-paragraph] twice then \\[universal-argument] 2 +\\[fill-paragraph] sets N to 2. Here what the default produces: fun_call(argument1, argument2, @@ -659,7 +675,8 @@ :type 'boolean) (defcustom ess-fill-continuations t - "If non-nil, refilling a paragraph inside a continuation of + "Controls filling of continuations. +If non-nil, refilling a paragraph inside a continuation of statements (expressions separated by operators) will arrange all its elements, never going past `fill-column'. @@ -684,7 +701,8 @@ :type 'boolean) (defcustom ess-fill-calls-newlines nil - "When non-nil, the second refilling style produces newlines + "When non-nil, refilling may place newlines before and after delimiters. +When non-nil, the second refilling style produces newlines after and before the opening and closing delimiters. This is intended for example for dplyr-style code: @@ -696,21 +714,28 @@ ) Note that this setting is temporary and likely to be replaced in -the next ESS version by a more comprehensive and flexible way to +a future ESS version by a more comprehensive and flexible way to set refill styles." :group 'ess-edit :type 'boolean) (defcustom ess-blink-refilling t - "When non-nil, refilling a call or a continuation will first -blink the filling region." + "When non-nil, refilling blinks the filling region." :group 'ess-edit :type 'boolean) -(defcustom ess-mode-silently-save t - "Non-nil means automatically save ESS source buffers before loading." +(define-obsolete-variable-alias 'ess-mode-silently-save 'ess-save-silently "ESS 19.04") +(defcustom ess-save-silently 'auto + "If non-nil, possibly save buffers without asking. +If t, save without asking. If \\='auto, save without asking if +either `compilation-ask-about-save' or variable `auto-save-visited-mode' +is non-nil. Affects `ess-save-file'." :group 'ess-edit - :type 'boolean) + :type '(choice (const :tag "Do not save without asking." :value nil) + (const :tag "Use compilation-ask-about-save and auto-save-visited-mode." + :value auto) + (const :tag "Save without asking." :value t)) + :package-version '(ess . "19.04")) ;;*;; Variables controlling editing @@ -726,27 +751,15 @@ ;;;*;;; Indentation parameters -(defcustom ess-auto-newline nil - "Non-nil means automatically newline before and after braces -inserted in S code." - :type 'boolean - :group 'ess-edit) - -(defcustom ess-tab-always-indent t - "Non-nil means TAB in S mode should always reindent the current line, -regardless of where in the line point is when the TAB command is used." - :type 'boolean - :group 'ess-edit) - -(defvar ess-indent-line-function nil - "Function to be used for the current dialect -nil means to use R/S indentation.") -(make-variable-buffer-local 'ess-indent-line-function) +(define-obsolete-variable-alias 'ess-tab-always-indent 'tab-always-indent "ESS 19.04") (define-obsolete-variable-alias 'ess-indent-level 'ess-indent-offset "15.09") (defvar ess-indent-offset 2 "Main indentation offset that is commonly inherited by other offsets. See `ess-style-alist' for all available offsets.") +;;;###autoload +(put 'ess-indent-offset 'safe-local-variable #'numberp) + (defvar ess-offset-arguments 'open-delim "Indent for arguments of function calls or indexing brackets. @@ -793,7 +806,7 @@ )) -Wnen set to `prev-call', arguments on a new line are indented relative to +When set to `prev-call', arguments on a new line are indented relative to the closest function call: object <- call(argument, other_call( @@ -819,10 +832,10 @@ for other offsets controlling indentation.") (defvar ess-offset-block 'prev-line - "Indentation for blocks. A block is usually declared with -braces but a statement wrapped in anonymous parentheses is also -considered a block. This offset can be either `prev-call', -`prev-line' or `open-delim'. + "Controls indentation for blocks. +A block is usually declared with braces but a statement wrapped +in anonymous parentheses is also considered a block. This offset +can be either `prev-call', `prev-line' or `open-delim'. When set to `open-delim', blocks are indented relative to the opening parenthesis of the closest function call: @@ -876,33 +889,33 @@ (define-obsolete-variable-alias 'ess-first-continued-statement-offset 'ess-offset-continued "15.09") (define-obsolete-variable-alias 'ess-continued-statement-offset 'ess-offset-continued "15.09") (defvar ess-offset-continued 'straight - "This setting controls indentation of continued statements, that is, -consecutive statements separated by operators. + "This setting controls indentation of continued statements. +That is, consecutive statements separated by operators. -When set to 'straight, continued statements are indented as follows: +When set to \\='straight, continued statements are indented as follows: object %>% some_function() %>% other_function() -When set to 'cascade: +When set to \\='cascade: object %>% some_function() %>% other_function() -The 'straight and 'cascade settings are actually equivalent to -'(straight . t) and '(cascade . t), where `t' represents the -base indent size. More generally, you can supply '(straight . N) +The \\='straight and \\='cascade settings are actually equivalent to +\\='(straight . t) and \\='(cascade . t), where t represents the +base indent size. More generally, you can supply \\='(straight . N) to control the size of indentation. See `ess-style-alist' for for an overview of ESS indentation.") (defvar ess-align-nested-calls '("ifelse") - "List of strings declaring function calls for which -`ess-offset-arguments-newline' should be ignored. These calls -will be vertically aligned instead. The default is `ifelse', -resulting in the following indentation for nested ifelse calls: + "List of strings for which `ess-offset-arguments-newline' is ignored. +These calls will be vertically aligned instead. For example, if +`ifelse' is a member of the list, nested ifelse calls are +indented like this: object <- ifelse(condition1, out1, ifelse(condition2, out2, out3)) @@ -910,10 +923,10 @@ See `ess-style-alist' for for an overview of ESS indentation.") (defvar ess-align-arguments-in-calls '("function[ \t]*(") - "List of regexes specifying the calls where -`ess-offset-arguments' should have no effect on function -declarations. The arguments of those calls will be aligned from -the opening parenthesis. + "A list of refexes where `ess-offset-arguments' is ignored. +List of regexes specifying the calls where `ess-offset-arguments' +should have no effect on function declarations. The arguments of +those calls will be aligned from the opening parenthesis. By default, function declarations are overridden. If for example `ess-offset-arguments' is set to `prev-line', then function calls @@ -935,8 +948,8 @@ See `ess-style-alist' for further details.") (defvar ess-align-continuations-in-calls t - "Whether continuations inside calls should be indented from the -opening delimiter. This produces the following indentation: + "Whether continuations inside calls are indented from the opening delimiter. +This produces the following indentation: 10 + (1 + 2 + 3 + 4) @@ -975,9 +988,9 @@ See `ess-style-alist' for for an overview of ESS indentation.") (defvar ess-align-blocks '(control-flow) - "List of block types for which `ess-offset-blocks' should be -ignored. The overridden blocks are vertically aligned. The list -can contain either or both of the symbols `control-flow' and + "List of block types for which `ess-offset-blocks' is ignored. +The overridden blocks are vertically aligned. The list can +contain either or both of the symbols `control-flow' and `fun-decl'. With `control-flow', if, else for and while blocks will always be @@ -987,9 +1000,8 @@ (define-obsolete-variable-alias 'ess-arg-function-offset 'ess-indent-from-lhs "15.09") (defvar ess-indent-from-lhs '(arguments fun-decl-opening) - "List of syntactic elements that should be indented from the -left-hand side of an assignment. The list accepts the symbol -`arguments' and `fun-decl-opening'. + "List of elements that are indented from the left side of an assignment. +The list accepts the symbol `arguments' and `fun-decl-opening'. For arguments, this setting only has an effect for offsets set to `prev-call'. When set, this indentation is produced: @@ -1040,18 +1052,18 @@ See `ess-style-alist' for for an overview of ESS indentation.") (defvar ess-indent-from-chain-start t - "When non-nil, chained calls will be treated as if they were -one call and indentation will start from the first one. This -setting only has an effect for offsets set to `prev-call' or -block offsets set to `opening-delim'. + "When non-nil, chained calls are treated as if they were one call. +Indentation will start from the first one. This setting only has +an effect for offsets set to `prev-call' or block offsets set to +`opening-delim'. -If `nil': +If nil: some_function(other_function( argument )) -If `t': +If t: some_function(other_function( argument @@ -1062,7 +1074,7 @@ ;;added rmh 2Nov97 at request of Terry Therneau (define-obsolete-variable-alias 'ess-fancy-comments 'ess-indent-with-fancy-comments "15.09") (defcustom ess-indent-with-fancy-comments t - "Non-nil means distiguish between #, ##, and ### for indentation. + "Non-nil means distinguish between #, ##, and ### for indentation. See `ess-style-alist' for for an overview of ESS indentation." :type 'boolean :group 'ess-edit) @@ -1212,14 +1224,14 @@ (ess-indent-from-chain-start . ,(default-value 'ess-indent-from-chain-start)) (ess-indent-with-fancy-comments . ,(default-value 'ess-indent-with-fancy-comments)))) - "Predefined formatting styles for ESS code. Use -`ess-default-style' to apply a style in all R buffers. The values -of all styles except OWN are fixed. To change the value of -variables in the OWN group, customize the variable -`ess-own-style-list'. DEFAULT style picks default (aka global) -values from ESS indentation variables. In addition, ESS provides -many indentation styles, the most important being the RRR and the -RStudio variants. + "Predefined formatting styles for ESS code. +Use `ess-set-style' to apply a style in all R buffers. The values of +all styles except OWN are fixed. To change the value of variables +in the OWN group, customize the variable `ess-own-style-list'. +DEFAULT style picks default (aka global) values from ESS +indentation variables. In addition, ESS provides many indentation +styles, the most important being the RRR and the RStudio +variants. RRR is the common R style that adheres closely to R internal standards. RRR+ is the same except it also aligns blocks in @@ -1281,16 +1293,17 @@ ### comments distinctly.") (defun ess-add-style (key entries) - "Add a new style to `ess-style-list', with the key KEY. -Remove any existing entry with the same KEY before adding the new one." + "Add a new style to `ess-style-list'. +The new style has KEY and ENTRIES. Remove any existing entry with +the same KEY before adding the new one." (setq ess-style-alist (assq-delete-all key ess-style-alist)) (add-to-list 'ess-style-alist (cons key entries))) (defcustom ess-own-style-list (cdr (assoc 'RRR ess-style-alist)) "Indentation variables for your own style. -Set `ess-default-style' to 'OWN to use these values. To change +Set `ess-style' to 'OWN to use these values. To change these values, use the customize interface. See the documentation -of each variable for its meaning. " +of each variable for its meaning." :group 'ess-edit :type 'alist :initialize 'custom-initialize-set @@ -1298,13 +1311,22 @@ (set symbol value) (ess-add-style 'OWN value))) -(defcustom ess-default-style 'RRR - "The default value of `ess-indent-style'. +;;;###autoload +(put 'ess-style 'safe-local-variable #'symbolp) + +(define-obsolete-variable-alias 'ess-default-style 'ess-style "ESS 19.04") +(defcustom ess-style 'RRR + "Current ESS indentation style, see `ess-style-alist' for more. See the variable `ess-style-alist' for how these groups (RRR, DEFAULT, GNU, BSD, ...) map onto different settings for variables. OWN style is defined in `ess-own-style-list' and you can customize it to your needs. DEFAULT style picks default (aka -global) values from ESS indentation variables." +global) values from ESS indentation variables. + +Prefer `ess-set-style' to set the current style. This variable +has an effect if set before a buffer is visited (e.g. in your +Emacs initialization file) or as a file or directory local +variable (see Info node `(Emacs) File Variables'." :type '(choice (const OWN) (const GNU) (const BSD) @@ -1316,13 +1338,10 @@ (const RStudio) (const RStudio-) (const DEFAULT)) - :group 'ess-edit) - -;; the real setting of this happens via -editing-alist: -(defvar ess-style ess-default-style - "Current ESS indentation style, see `ess-style-alist' for more.") + :group 'ess-edit + :safe #'symbolp) -;;*;; Variables controlling behaviour of dump files +;;*;; Variables controlling behavior of dump files (defcustom ess-source-directory (or (getenv "TMPDIR") (getenv "TMP") (getenv "TEMP") temporary-file-directory) @@ -1339,7 +1358,7 @@ :package-version '(ess . "18.10")) (defvar ess-dump-filename-template nil - "Internal. Initialized by dialects") + "Internal. Initialized by dialects.") (defcustom ess-dump-filename-template-proto (concat (user-login-name) ".%s.S") "Prototype template for filenames of dumped objects. @@ -1357,14 +1376,6 @@ :group 'ess-edit :type 'string) - -;;*;; Hooks - -(defcustom ess-mode-hook nil - "Hook for customizing ESS each time it is entered." - :group 'ess-hooks - :type 'hook) - (defcustom ess-pre-run-hook nil "Hook to call before starting up ESS. Good for setting up your directory." @@ -1377,63 +1388,11 @@ :group 'ess-hooks :type 'hook) -(defcustom inferior-ess-mode-hook nil - "Hook for customizing inferior ESS mode. Called after -`inferior-ess-mode' is entered and variables have been initialised." - :group 'ess-hooks - :type 'hook) - -;;; make it possible to save an inferior-ess-mode buffer without losing -;;; the connection to the running ESS process. -(put 'inferior-ess-mode 'mode-class 'special) -;; FIXME AJR: Should the above be there? I don't think so! -;; MM : the functionality should be, right? Move statement to ./ess.el ? -;; AJR: No, we should move the statement to ./ess-inf.el - -(defcustom ess-help-mode-hook nil - "Functions to call when entering `ess-help-mode'." - :group 'ess-hooks - :type 'hook) - (defcustom ess-send-input-hook nil "Hook called just before line input is sent to the process." :group 'ess-hooks :type 'hook) -(defcustom ess-transcript-mode-hook nil - "Hook for customizing ESS transcript mode." - :group 'ess-hooks - :type 'hook) - -(defcustom R-mode-hook nil - "Hook run when entering R mode." - :type 'hook - :group 'ess-R) - -(defcustom Rnw-mode-hook nil - "Hook run when entering Rnw mode." - :type 'hook - :group 'ess-R) - -(defcustom SAS-mode-hook nil - "Hook to run when entering SAS mode." - :type 'hook - :group 'ess-sas) - -(defcustom ess-pdf-viewer-pref nil - "External pdf viewer you like to use from ESS. -Can be a string giving a name of the program or a list with car -giving heprogram and the tail giving the arguments. For example -'(\"okular\" \"--unique\")." - :type '(choice (const nil) (repeat :tag "Command with arguments" string) (string :tag "Command")) - :group 'ess) - -(defcustom ess-ps-viewer-pref nil - "External PostScript viewer you like to use from ESS. -If nil, ESS will try finding one from a list." - :type '(choice (const nil) string) - :group 'ess) - ;; ---- ./ess-roxy.el : ------------ (defcustom ess-roxy-package "roxygen2" @@ -1442,8 +1401,8 @@ :type 'string) (defcustom ess-roxy-tags-noparam '("export" "noRd") - "The tags used in roxygen fields that can be used alone. Used -to decide highlighting and tag completion." + "The tags used in roxygen fields that can be used alone. +Used to decide highlighting and tag completion." :group 'ess-roxy :type '(repeat string)) @@ -1455,11 +1414,12 @@ "seealso" "source" "docType" "title" "TODO" "usage" "import" "exportClass" "exportPattern" "S3method" - "inheritParams" + "inherit" "inheritParams" "inheritSection" "importFrom" "importClassesFrom" "importMethodsFrom" "useDynLib" + "rawNamespace" "rdname" "section" "slot" "description" - "md") + "md" "eval" "family") "The tags used in roxygen fields that require a parameter. Used to decide highlighting and tag completion." :group 'ess-roxy @@ -1482,13 +1442,13 @@ :type '(alist :key-type string :value-type string)) (defcustom ess-roxy-fill-param-p nil - "Non-nil causes parameter descriptions to be filled (word-wrapped) upon `ess-roxy-update-entry'." + "When non-nil `ess-roxy-update-entry' fills (wraps) parameters." :group 'ess-roxy :type '(choice (const :tag "Off" nil) (const :tag "On" t))) (defcustom ess-roxy-hide-show-p nil - "Non-nil means ess-roxy uses hs-minor-mode for block hiding with TAB." + "Non-nil means ess-roxy uses function `hs-minor-mode' for block hiding with TAB." :group 'ess-roxy :type '(choice (const :tag "Off" nil) (const :tag "On" t))) @@ -1500,74 +1460,58 @@ (const :tag "On" t))) (defcustom ess-roxy-str "##'" - "Prefix string to insert before each line in new roxygen -blocks. In existing roxygen blocks, the prefix is taken from -the line at point" + "Prefix string to insert before each line in new roxygen blocks. +In existing roxygen blocks, the prefix is taken from the line at +point" :group 'ess-roxy :type 'string) -(defcustom ess-roxy-re "^#+'" - "Regular expression to recognize roxygen blocks." - :group 'ess-roxy - :type 'string) - -(defcustom ess-swv-pdflatex-commands '("texi2pdf" "pdflatex" "make") - "Commands to run a version of pdflatex in \\[ess-swv-PDF]; -the first entry is the default command." - :group 'ess-sweave - :type '(repeat string)) - -(defcustom ess-swv-plug-into-AUCTeX-p nil - "Non-nil means add commands to AUCTeX's \\[TeX-command-list] -to sweave the current noweb file and latex the result." - :group 'ess-sweave - :type '(choice (const :tag "Off" nil) - (const :tag "On" t))) - (defvar ess-roxy-insert-prefix-on-newline t - "When non-nil, `ess-newline-and-indent' will make sure the new -line starts with the roxy prefix.") + "When non-nil, `ess-roxy-newline' inserts the roxy prefix on newlines.") ; System variables ;; SJE -- this should not be defcustom - user does not set it. (defvaralias 'ess-current-process-name 'ess-local-process-name) -(defvar ess-local-process-name nil +(defvar-local ess-local-process-name nil "The name of the ESS process associated with the current buffer.") (put 'ess-local-process-name 'risky-local-variable t) (put 'ess-local-process-name 'permanent-local t) -(make-variable-buffer-local 'ess-local-process-name) (defcustom ess-switch-to-end-of-proc-buffer t - "If t, `ess-switch-to-inferior-or-script-buffer goes to end of -process buffer." + "If non-nil, \\\\[ess-switch-to-inferior-or-script-buffer] goes to the end of the process buffer." :group 'ess :type 'boolean) -(defcustom ess-gen-proc-buffer-name-function 'ess-gen-proc-buffer-name:projectile-or-simple - "Function used for generation of the buffer name of the newly created ESS process. +(defcustom ess-gen-proc-buffer-name-function 'ess-gen-proc-buffer-name:project-or-simple + "Function used for generation of the buffer name of the new ESS processes. It should accept one argument PROC-NAME, a string specifying internal process name (R, R:2, etc). Provided default options are: - `ess-gen-proc-buffer-name:simple' -- *proc* - `ess-gen-proc-buffer-name:directory' -- *proc:dir* - `ess-gen-proc-buffer-name:abbr-long-directory' -- *proc:abbr-long-dir* - `ess-gen-proc-buffer-name:projectile-or-simple' -- *proc:projectile-root* or *proc*. - `ess-gen-proc-buffer-name:projectile-or-directory' -- *proc:projectile-root* or *proc:dir*. - -Strategies based on projectile default to built-in strategies if -projectile.el is not loaded or there is no project root in the -current directory. -" +`ess-gen-proc-buffer-name:simple' + *proc* + +`ess-gen-proc-buffer-name:directory' + *proc:dir* +`ess-gen-proc-buffer-name:abbr-long-directory' + *proc:abbr-long-dir* +`ess-gen-proc-buffer-name:project-or-simple' + *proc:project-root* or *proc* +`ess-gen-proc-buffer-name:project-or-directory' + *proc:project-root* or *proc:dir* + +Strategies based on projects default to built-in strategies if +there is no project root in the current directory." :group 'ess :type '(choice (const :tag "*proc*" ess-gen-proc-buffer-name:simple) (const :tag "*proc:dir*" ess-gen-proc-buffer-name:directory) (const :tag "*proc:abbr-long-dir*" ess-gen-proc-buffer-name:abbr-long-directory) - (const :tag "*proc:projectile-root* or *proc*" ess-gen-proc-buffer-name:projectile-or-simple) - (const :tag "*proc:projectile-root* or *proc:dir*" ess-gen-proc-buffer-name:projectile-or-directory) - function)) + (const :tag "*proc:project-root* or *proc*" ess-gen-proc-buffer-name:project-or-simple) + (const :tag "*proc:project-root* or *proc:dir*" ess-gen-proc-buffer-name:project-or-directory) + function) + :package-version '(ess . "19.04")) (defcustom ess-kermit-command "gkermit -T" @@ -1588,13 +1532,11 @@ ;;*;; Regular expressions -;; -- Note: Some variables not-to-customize moved to ./ess-mode.el : -;; ess-r-set-function-start - -;; Fixme: the following is just for S dialects : (defcustom ess-dumped-missing-re "\\(<-\nDumped\n\\'\\)\\|\\(<-\\(\\s \\|\n\\)*\\'\\)" - "If a dumped object's buffer matches this re, then it is replaced + "Regex determines if dumped objects are replaced by `ess-function-template'. + +If a dumped object's buffer matches this re, then it is replaced by `ess-function-template'." :group 'ess :type 'regexp) @@ -1609,26 +1551,18 @@ ; ess-inf: variables for inferior-ess. -(defcustom inferior-ess-own-frame nil +(defvar inferior-ess-own-frame nil "Non-nil means that inferior ESS buffers should start in their own frame. -The parameters of this frame are stored in `inferior-ess-frame-alist'." - :group 'ess-proc - :type 'boolean) - -(defcustom inferior-ess-frame-alist default-frame-alist - "Alist of frame parameters used to create new frames for iESS buffers. -This defaults to `default-frame-alist' and is used only when -the variable `inferior-ess-own-frame' is non-nil." - :group 'ess-proc - :type 'alist) - -(defcustom inferior-ess-same-window t - "Non-nil indicates new inferior ESS process appears in current window. -Otherwise, the new inferior ESS buffer is shown in another window in the -current frame. This variable is ignored if `inferior-ess-own-frame' is -non-nil." - :group 'ess-proc - :type 'boolean) +This variable is deprecated. +please add an entry to `display-buffer-alist' instead. See Info +node `(ess)Customizing startup'. For example: + +\(add-to-list \\='display-buffer-alist + \\='(\"*R\" + (display-buffer-reuse-window display-buffer-pop-up-frame)))") +(make-obsolete-variable 'inferior-ess-own-frame 'display-buffer-alist "ESS 19.04") +(make-obsolete-variable 'inferior-ess-frame-alist "It is ignored. Use `display-buffer-alist' and `pop-up-frame-alist' instead." "ESS 19.04") +(make-obsolete-variable 'inferior-ess-same-window 'display-buffer-alist "ESS 19.04") (defcustom inferior-ess-jit-lock-chunk-size 10000 "Default for (buffer local) `jit-lock-chunk-size' in inferior ESS buffers." @@ -1649,33 +1583,22 @@ :type '(choice (string) file)) (defcustom inferior-R-args "" - "String of arguments (see 'R --help') used when starting R, -including the versions of R created via variable `ess-r-versions'." + "String of arguments used when starting R. +See also `ess-R-readline'." :group 'ess-R :type 'string) (defcustom ess-R-readline nil - "nil indicates that \"--no-readline \" should be used as argument when starting R. -This has been the default since 1998 and may very slightly speedup interaction. -On the other hand, readline is necessary for expansion of \"~username/\" in paths. -Note that readline interprets tabs (tabular characters) in R source files as asking -for file name completion. This can mess up ess evaluation completely." + "When non-nil, use readline in R. +nil indicates that \"--no-readline \" should be used as argument +when starting R. This may very slightly speedup interaction. On +the other hand, readline is necessary for expansion of +\"~username/\" in paths. Note that readline interprets +tabs (tabular characters) in R source files as asking for file +name completion. This can mess up evaluation completely." :group 'ess-R :type 'boolean) -(defcustom inferior-STA-start-file nil - "Initialization file for Stata." - :group 'ess-Stata - :type '(choice (const nil) string)) - -(defcustom inferior-STA-start-args "" - "String of switches used when starting stata. -Don't use this to send initialization command to stata, use -`inferior-STA-start-file' instead. Also see -`inferior-STA-program'." - :group 'ess-Stata - :type 'string) - (defvaralias 'inferior-R-objects-command 'inferior-ess-r-objects-command) (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. @@ -1684,118 +1607,65 @@ :type 'string) (defvar ess-getwd-command nil - "Command string retriving the working directory from the process.") + "Command string retrieving the working directory from the process.") (defvar ess-setwd-command nil "Command string to set working directory. -Should contain a formating %s to be replaced by a -path (as in 'setwd(%s)\\n'.") +Should contain a formatting %s to be replaced by a +path (as in `setwd(%s)\\n'.") (defcustom ess-program-files ;; 32 bit version - (if ess-microsoft-p + (if (and ess-microsoft-p + (fboundp 'w32-short-file-name)) (if (getenv "ProgramW6432") (w32-short-file-name (getenv "ProgramFiles(x86)"));; always 32 on 64 bit OS (w32-short-file-name (getenv "ProgramFiles"))) ;; always 32 on 32 bit OS nil) - "Safe (no embedded blanks) 8.3 name for 32-bit programs that works across internationalization." + "Name for 32-bit programs. + +Safe (no embedded blanks) 8.3 name for 32-bit programs that works +across internationalization." :group 'ess :type '(choice (string) (const nil))) (defcustom ess-program-files-64 ;; 64 bit version - (if (and ess-microsoft-p (getenv "ProgramW6432")) - (w32-short-file-name (getenv "ProgramW6432")) - nil) - "Safe (no embedded blanks) 8.3 name for 64-bit programs that works across internationalization." + (when (and ess-microsoft-p (fboundp 'w32-short-file-name) (getenv "ProgramW6432")) + (w32-short-file-name (getenv "ProgramW6432"))) + "Name for 64-bit programs. + +Safe (no embedded blanks) 8.3 name for 64-bit programs that works +across internationalization." :group 'ess :type '(choice (string) (const nil))) (defcustom ess-directory-containing-R nil - "nil (the default) means the search for all occurences of R -on the machine will use the default location of the R directory + "When non-nil, a directory containing R. +nil means the search for all occurrences of R on the machine will +use the default location of the R directory (inside \"c:/Program Files\" in English locale Windows systems). Non-nil values mean use the specified location as the directory in which \"R/\" is located. For example, setting `ess-directory-containing-R' to \"c:\" will tell ESS to search -for R versions with pathnames of the form \"c:/R/R-x.y.z\". +for R versions with path names of the form \"c:/R/R-x.y.z\". Currently only used when `ess-microsoft-p'. If you change the value of this variable, you need to restart Emacs for it to take effect. It also needs to be set before you load ess-site as its value is used once only when ESS is loaded." - :group 'ess :type '(choice (directory) (const nil))) (defcustom ess-rterm-version-paths nil - "Stores the full path file names of Rterm versions, computed via -\\[ess-find-rterm]. If you have versions of R in locations other than -in ../../R-*/bin/Rterm.exe or ../../rw*/bin/Rterm.exe, relative to the -directory in the `exec-path' variable containing your default location -of Rterm, you will need to redefine this variable with a + "Stores the full path file names of Rterm versions computed via \\[ess-find-rterm]. +If you have versions of R in locations other than in +../../R-*/bin/Rterm.exe or ../../rw*/bin/Rterm.exe, relative to +the directory in the variable `exec-path' containing your default +location of Rterm, you will need to redefine this variable with a `custom-set-variables' statement in your site-start.el or .emacs file." :group 'ess-R :type '(repeat string)) -(defcustom ess-SHOME-versions - ;; ess-program-files ~= "c:/progra~1" for typical locales/languages - (mapcar - (lambda (ch) (concat ess-program-files ch)) - '("/Insightful/splus62" - "/Insightful/splus61" - "/MathSoft/splus6" - "/spls45se" - "/Insightful/splus62netclient" - "/Insightful/splus62net/server" - "/Insightful/splus61netclient" - "/Insightful/splus61net/server" - "/Insightful/splus6se" - "/Insightful/splus61se" - "/Insightful/splus62se" - "/Insightful/splus70" - "/Insightful/splus71" - "/Insightful/splus8.0.1" - "/Insightful/splus8.0.4" - "/Insightful/splus80" - "/TIBCO/splus81" - "/TIBCO/splus82" - )) - "List of possible values of the environment variable SHOME for recent -releases of S-Plus. These are the default locations for several -current and recent releases of S-Plus. If any of these pathnames -correspond to a directory on your machine, running the function -`ess-sqpe-versions-create' will create a function, for example, -\\[splus70], that will start the corresponding version Sqpe inside an -emacs buffer in iESS[S] mode. If you have versions of S-Plus in -locations other than these default values, redefine this variable with -a `custom-set-variables' statement in your site-start.el or .emacs -file. The list of functions actually created appears in the *ESS* -buffer and should appear in the \"ESS / Start Process / Other\" -menu." - :group 'ess-SPLUS - :type '(repeat string)) - -(defcustom ess-SHOME-versions-64 - ;; ess-program-files-64 ~= "c:/progra~1" for typical locales/languages - (mapcar - (lambda (ch) (concat ess-program-files-64 ch)) - '("/TIBCO/splus82" - )) - "List of possible values of the environment variable SHOME for recent -releases of 64-bit S-Plus. These are the default locations for several -current and recent releases of S-Plus. If any of these pathnames -correspond to a directory on your machine, running the function -`ess-sqpe-versions-create' will create a function, for example, -\\[splus70], that will start the corresponding version Sqpe inside an -emacs buffer in iESS[S] mode. If you have versions of 64-bit S-Plus in -locations other than these default values, redefine this variable with -a `custom-set-variables' statement in your site-start.el or .emacs -file. The list of functions actually created appears in the *ESS* -buffer and should appear in the \"ESS / Start Process / Other\" -menu." - :group 'ess-SPLUS - :type '(repeat string)) - (define-obsolete-variable-alias 'inferior-S3-program-name 'inferior-S3-program "ESS 18.10") (defcustom inferior-S3-program "/disk05/s/S" @@ -1803,58 +1673,6 @@ :group 'ess-S :type 'string) -(define-obsolete-variable-alias 'inferior-S+3-program-name - 'inferior-S+3-program "ESS 18.10") -(define-obsolete-variable-alias 'inferior-S-program-name - 'inferior-S+3-program "ESS 18.10") -(defcustom inferior-S+3-program "Splus" - "Program name for invoking an inferior ESS with S+3()." - :group 'ess-SPLUS - :type '(choice (string) file)) - -(define-obsolete-variable-alias 'inferior-S+4-program-name - 'inferior-S+4-program "ESS 18.10") -(defcustom inferior-S+4-program - (concat ess-program-files "/spls45se/cmd/Splus.exe") - "Program name for invoking an external GUI S+4. -The default value is correct for a default installation of -S-Plus 4.5 Student Edition and with bash as the shell. -For any other version or location, change this value in ess-site.el or -site-start.el. Use the 8.3 version of the pathname. -Use double backslashes if you use the msdos shell." - :group 'ess-SPLUS - :type 'string) - -(defcustom inferior-S+4-print-command "S_PRINT_COMMAND=emacsclientw.exe" - "Destination of print icon in S+4 Commands window." - :group 'ess-SPLUS - :type 'string) - -(defcustom inferior-S+4-editor-pager-command - "options(editor='emacsclient.exe', pager='emacsclientw.exe')" - "Programs called by the editor() and pager() functions -in S+4 Commands window and in Sqpe+4 buffer." - :group 'ess-S - :type 'string) - -(define-obsolete-variable-alias 'inferior-Sqpe+4-program-name - 'inferior-Sqpe+4-program "ESS 18.10") -(defcustom inferior-Sqpe+4-program - (concat ess-program-files "/spls45se/cmd/Sqpe.exe") - "Program name for invoking an inferior ESS with Sqpe+4()." - :group 'ess-SPLUS - :type '(choice (const nil) (string))) - -(defcustom inferior-Sqpe+4-SHOME-name - (if ess-microsoft-p (concat ess-program-files "/spls45se" "")) - "SHOME name for invoking an inferior ESS with Sqpe+4(). -The default value is correct for a default installation of -S-Plus 4.5 Student Edition. For any other version or location, -change this value in ess-site.el or site-start.el. Use the 8.3 -version of the pathname." - :group 'ess-SPLUS - :type '(choice (const nil) (string))) - (define-obsolete-variable-alias 'inferior-S-elsewhere-program-name 'inferior-S-elsewhere-program "ESS 18.10") @@ -1863,40 +1681,13 @@ :group 'ess-proc :type 'string) -(define-obsolete-variable-alias - 'inferior-ESS-elsewhere-program-name - 'inferior-ESS-elsewhere-program "ESS 18.10") -(defcustom inferior-ESS-elsewhere-program "sh" - "Program name to invoke an inferior ESS with program on a -different computer." - :group 'ess-proc - :type 'string) - -(define-obsolete-variable-alias 'inferior-S4-program-name - 'inferior-S4-program "ESS 18.10") -(defcustom inferior-S4-program "S4" - "Program name to invoke an inferior ESS with S4()." - :group 'ess-S - :type '(choice (string) (file))) - -(define-obsolete-variable-alias 'inferior-S+5-program-name - 'inferior-S+5-program "ESS 18.10") -(defcustom inferior-S+5-program "Splus5" - "Program name to invoke an inferior ESS with S+5()." - :group 'ess-SPLUS - :type '(choice (string) (file))) - (defvaralias 'S+6-dialect-name 'S+-dialect-name) (defcustom S+-dialect-name "S+" - "Name of 'dialect' for S-PLUS 6.x and later. + "Name of `dialect' for S-PLUS 6.x and later. Easily changeable in a user's `.emacs'." :group 'ess-SPLUS :type 'string) -(defvaralias 'inferior-S+6-program 'inferior-S+-program) -(define-obsolete-variable-alias 'inferior-S+6-program-name - 'inferior-S+-program "ESS 18.10") - (define-obsolete-variable-alias 'inferior-S+-program-name 'inferior-S+-program "ESS 18.10") (defcustom inferior-S+-program @@ -1908,7 +1699,7 @@ value is correct for a default installation of S-Plus 8.1 and with bash as the shell. For any other version or location, change this value in ess-site.el or site-start.el. Use the 8.3 -version of the pathname. Use double backslashes if you use the +version of the path name. Use double backslashes if you use the msdos shell." :group 'ess-SPLUS :type '(choice (string) (file))) @@ -1921,61 +1712,15 @@ :group 'ess-SPLUS :type 'string) - -(defvaralias 'inferior-Sqpe-start-args 'inferior-Sqpe+-start-args) -(defcustom inferior-Sqpe+-start-args " " - "Default is empty. Can be used for license manager information, for example -`(setq inferior-Sqpe+-start-args \" S_ELMHOST=@123.456.789.012 ELMTIMEOUT=60 \")'." - ;; (setq inferior-Sqpe+-start-args " S_ELMHOST=@123.456.789.012 ELMTIMEOUT=60 ") ;; use this line as the model for your site-start.el - :group 'ess-SPLUS - :type 'string - ) - - (defcustom inferior-Splus-objects-command "objects(where=%d)\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-S+6-print-command 'inferior-S+-print-command) - -(defcustom inferior-S+-print-command "S_PRINT_COMMAND=emacsclientw.exe" - "Destination of print icon in S+ for Windows Commands window." - :group 'ess-SPLUS - :type 'string) - -(defvaralias 'inferior-S+6-editor-pager-command 'inferior-S+-editor-pager-command) -(defcustom inferior-S+-editor-pager-command - "options(editor='emacsclient.exe', pager='emacsclientw.exe')" - "Programs called by the editor() and pager() functions in S+ -for Windows Commands window and in Sqpe+6 for Windows buffer." - :group 'ess-SPLUS - :type 'string) - -(defvaralias 'inferior-Sqpe+6-program 'inferior-Sqpe+-program) -(define-obsolete-variable-alias 'inferior-Sqpe+-program-name - 'inferior-Sqpe+-program "ESS 18.10") -(defcustom inferior-Sqpe+-program - (concat ess-program-files "/TIBCO/splus82/cmd/Sqpe.exe") - "Program name for invoking an inferior ESS with Sqpe+6() for Windows." - :group 'ess-S - :type '(choice (const nil) (string))) - -(defvaralias 'inferior-Sqpe+6-SHOME-name 'inferior-Sqpe+-SHOME-name) -(defcustom inferior-Sqpe+-SHOME-name - (if ess-microsoft-p (concat ess-program-files "/TIBCO/splus82" "")) - "SHOME name for invoking an inferior ESS with Sqpe+6 and higher for Windows. -The default value is correct for a default installation of -S-Plus 8.1. For any other version or location, -change this value in ess-site.el or site-start.el. Use the 8.3 -version of the pathname." - :group 'ess-SPLUS - :type '(choice (const nil) (string))) - (defcustom ess-S-quit-kill-buffers-p nil "Controls whether S buffers should also be killed once a process is killed. -This is used only when an iESS process is killed using C-c C-q. +This is used only when an iESS process is killed using \\[ess-quit]. Possible values: nil - do not kill any S buffers associated with the process. t - kill S buffers associated with the process. @@ -1983,27 +1728,6 @@ :group 'ess-S :type '(choice (const nil) (const t) (const ask))) -(define-obsolete-variable-alias 'inferior-XLS-program-name - 'inferior-XLS-program "ESS 18.10") -(defcustom inferior-XLS-program "xlispstat" - "Program name for invoking an inferior ESS with \\[XLS]." - :group 'ess-XLS - :type '(choice (string) (file))) - -(define-obsolete-variable-alias 'inferior-VST-program-name - 'inferior-VST-program "ESS 18.10") -(defcustom inferior-VST-program "vista" - "Program name for invoking an inferior ESS with \\[ViSta]." - :group 'ess-XLS - :type '(choice (string) (file))) - -(define-obsolete-variable-alias 'inferior-ARC-program-name - 'inferior-ARC-program "ESS 18.10") -(defcustom inferior-ARC-program "arc" - "Program name for invoking an inferior ESS with \\[ARC]." - :group 'ess-XLS - :type '(choice (string) (file))) - (define-obsolete-variable-alias 'inferior-SAS-program-name 'inferior-SAS-program "ESS 18.10") (defcustom inferior-SAS-program "sas" @@ -2011,142 +1735,76 @@ :group 'ess-sas :type '(choice (string) (file))) -(define-obsolete-variable-alias 'inferior-STA-program-name - 'inferior-STA-program "ESS 18.10") -(defcustom inferior-STA-program "stata" - "Program name for invoking an inferior ESS with stata(). -This is NOT Stata, because we need to call stata with TERM=emacs in -order for it to work right. And Emacs is too smart for it." - :group 'ess-Stata - :type '(choice (string) (file))) - -(defcustom ess-sta-delimiter-friendly nil - "Non-nil means convert embedded semi-colons to newlines for Stata processing." - :group 'ess-Stata - :type 'boolean) - -(define-obsolete-variable-alias 'inferior-OMG-program-name - 'inferior-OMG-program "ESS 18.10") -(defcustom inferior-OMG-program "omegahat" - "Program name for invoking an inferior ESS with omegahat()." - :group 'ess-OMG - :type '(choice (string) (file))) - (defvaralias 'R-editor 'ess-r-editor) (defcustom ess-r-editor "emacsclient" - "Editor called by R process with 'edit()' command." + "Editor called by R process with `edit()' command." :group 'ess :type 'string) (defvaralias 'R-pager 'ess-r-pager) (defcustom ess-r-pager 'nil ; Usually nil is correct as ESS and page() cooperate. - "Pager called by R process with 'page()' command." + "Pager called by R process with `page()' command." :group 'ess :type '(choice (const nil) string)) (defcustom S-editor "emacsclient" - "Editor called by S process with 'edit()' command." + "Editor called by S process with `edit()' command." :group 'ess :type 'string) (defcustom S-pager (if ess-microsoft-p "emacsclientw.exe" "emacsclient") - "Pager called by S process with 'page()' command." + "Pager called by S process with `page()' command." :group 'ess :type 'string) -(defvar ess-editor nil - "*Editor by which the process sends information to an emacs buffer -for editing and then to be returned to the process.") - -(defvar ess-pager nil - "*Pager by which the process sends information to an emacs buffer.") - -(defvar inferior-ess-language-start nil - "*Initialization commands sent to the ESS process.") - -(make-variable-buffer-local 'ess-editor) -(make-variable-buffer-local 'ess-pager) -(make-variable-buffer-local 'inferior-ess-language-start) - - - -;;;;; names for S-Plus help files on MS-Windows +(defvar-local ess-editor nil + "Editor command. -(defcustom inferior-ess-help-filetype nil - "S-Plus and Sqpe for Windows use the \"chm\" (compiled html) filetype -for help files. The default value is nil for other systems." - :group 'ess-proc - :type '(choice (const nil) (string))) -(make-variable-buffer-local 'inferior-ess-help-filetype) - -;;;;; names for communication using MS-Windows 9x/NT ddeclient mechanism - -(defcustom inferior-ess-ddeclient nil - "ddeclient is the intermediary between emacs and the stat program." - :group 'ess-proc - :type '(choice (const nil) (string))) - -(defcustom inferior-ess-client-name nil - "Name of ESS program ddeclient talks to." - :group 'ess-proc - :type '(choice (const nil) (string))) - -(defcustom inferior-ess-client-command nil - "ddeclient command sent to the ESS program." - :group 'ess-proc - :type '(choice (const nil) string)) +Editor by which the process sends information to an Emacs buffer +for editing and then to be returned to the process.") -(make-variable-buffer-local 'inferior-ess-client-name) -(make-variable-buffer-local 'inferior-ess-ddeclient) -(make-variable-buffer-local 'inferior-ess-client-command) +(defvar-local ess-pager nil + "Pager by which the process sends information to an Emacs buffer.") -(defvar inferior-S-program inferior-S+3-program - "Program name for invoking an inferior ESS with S.") +(defvar-local inferior-ess-language-start nil + "Initialization commands sent to the ESS process.") (define-obsolete-variable-alias 'inferior-ess-program-name 'inferior-ess-program "ESS 18.10") -(defvar inferior-ess-program nil ;inferior-S-program +(defvar-local inferior-ess-program nil "Default program name for invoking `inferior-ess'. The other variables ...-program should be changed, for the corresponding program.") -(make-variable-buffer-local 'inferior-ess-program) +(make-obsolete-variable 'inferior-ess-start-args + "Use the language specific variables like `inferior-R-args'" + "ESS 19.04") (defvar inferior-ess-start-args "" "String of arguments passed to the ESS process. If you wish to pass arguments to a process, see e.g. `inferior-R-args'.") -(defcustom inferior-ess-start-file nil - "File dumped into process, if non-nil." - :group 'ess-proc - :type '(choice (const nil) file)) - (defcustom inferior-ess-pager (if ess-microsoft-p "console" "cat") "Pager to use for reporting help files and similar things." :group 'ess-proc :type 'string) -(defvar inferior-ess-primary-prompt "> " +(defvar-local inferior-ess-primary-prompt "> " "Regular expression used by `ess-mode' to detect the primary prompt.") -(make-variable-buffer-local 'inferior-ess-primary-prompt) -(defvar inferior-ess-secondary-prompt nil - "Regular expression used by ess-mode to detect the secondary prompt. +(defvar-local inferior-ess-secondary-prompt nil + "Regular expression used by `ess-mode' to detect the secondary prompt. This is issued by S to continue an incomplete expression. Set to nil if language doesn't support secondary prompt.") -(make-variable-buffer-local 'inferior-ess-secondary-prompt) (defvar ess-traceback-command nil "Command to generate error traceback.") -;; need this to recognise + + + > > > -;; and "+ . + " in tracebug prompt -;; VS[17-08-2012]: all of the occurrences in the code should should eventually -;; go away, (once we are sure this doesn't break anything) -(defvaralias 'inferior-ess-S-prompt 'inferior-S-prompt) -(defvar inferior-S-prompt "[]a-zA-Z0-9.[]*\\(?:[>+.] \\)+" +;; Need this to recognize prompts of the form + + + > > > +;; and "+ . + ", but not "Abcd. " +(defvar inferior-S-prompt "[]a-zA-Z0-9.[]*[+ ]*> \\(?:[>+.] \\)*" "Regexp used in S and R inferior and transcript buffers for prompt navigation. -Must be anchored to BOL.") +Must not be anchored to BOL.") ;;*;; Variables controlling interaction with the ESS process @@ -2163,28 +1821,28 @@ (defvaralias 'ess-eval-visibly-p 'ess-eval-visibly) -(defcustom ess-eval-visibly t +(defcustom ess-eval-visibly 'nowait "Non-nil means ess-eval- commands display commands in the process buffer. +If \\='nowait, ESS shows input commands in the process buffer, but +doesn't wait for the process. Thus all the output is printed +after the input lines. + If t, ESS waits after each line of the command for the process output. This results in a nice sequence of input and output but -stalls emacs on long output (like Sys.sleep(5) in R). - -If 'nowait, ESS still shows the input commands, but don't wait -for the process. Thus all the output is printed after the input -lines. +stalls Emacs on long output (like Sys.sleep(5) in R). -If nil, ESS doesn't print input commands and doesn't wait for the process. +If nil, ESS doesn't print input commands and doesn't wait for the +process. This variable also affect the evaluation of input code in iESS. The effect is similar to the above. If t then ess waits for -the process output, otherwise not. -" +the process output, otherwise not." :group 'ess-proc + :package-version '(ess . "19.04") :type '(choice (const t) (const nowait) (const nil))) (defcustom ess-eval-deactivate-mark (fboundp 'deactivate-mark); was nil till 2010-03-22 - "Non-nil means that after ess-eval- commands the mark is deactivated, - (see \\[deactivate-mark])." + "Non-nil means that after ess-eval- commands the mark is deactivated." :group 'ess-proc :type 'boolean) @@ -2193,15 +1851,8 @@ :group 'ess-proc :type 'boolean) -(defcustom ess-eval-ddeclient-sleep 0.06 - "If non-nil, a number specifying *seconds* to wait after certain -\\[ess-eval-linewise-ddeclient] calls, such as those at startup." - ;; i.e this currently only applies to (if microsoft-p ...) ! - :group 'ess-proc - :type '(choice (const nil) number)) - (defcustom ess-sleep-for-shell (if ess-microsoft-p 5 1) - "*Pause before sending output to the shell." + "Pause before sending output to the shell." :group 'ess-proc :type 'number) @@ -2210,48 +1861,42 @@ ;;*;; Variables relating to multiple processes -(defvar ess--mode-line-process-indicator '("" ess-local-process-name) +(defvar-local ess--mode-line-process-indicator '("" ess-local-process-name) "List of ESS mode-line indicators. Local in process buffers and must start with a string. Changes of this variable are automatically reflected in mode-lines of the process and all associated with it buffers. -Each symbol must evaluate ot one of the standard mode line -objecst. See info node `(elisp)Mode Line Data'). Add a symbol +Each symbol must evaluate to one of the standard mode line +objects. See info node `(elisp)Mode Line Data'). Add a symbol with `add-to-list' and remove with `delq'. Note that the symbols which are part of this list should better have -'risky-local-variable property set to t, otherwise the text +\\='risky-local-variable property set to t, otherwise the text properties are not displayed. External utilities such as `ess-tracebug' and `ess-developer' customize this variable to indicate changes in the process -status. -") +status.") (put 'ess--mode-line-process-indicator 'risky-local-variable t) -(make-variable-buffer-local 'ess--mode-line-process-indicator) -(defvar ess--local-mode-line-process-indicator '("") +(defvar-local ess--local-mode-line-process-indicator '("") "List of local process indicators. See `ess--mode-line-process-indicator' for how to set it. -This is an internal varialbe used by tools like `ess-developer' +This is an internal variable used by tools like `ess-developer' and `ess-tracebug'.") (put 'ess--local-mode-line-process-indicator 'risky-local-variable t) -(make-variable-buffer-local 'ess--local-mode-line-process-indicator) - -(defvar ess-process-name-list nil - "Alist of active ESS processes.") ;;*;; Inferior ESS commands -(defvar ess-load-command "source('%s')\n" +(defvar-local ess-load-command "source('%s')\n" "Dialect specific format-string for building the ess command to load a file. This format string should use %s to substitute a file name and should result in an ESS expression that will command the inferior ESS to load that file.") -(defvar ess-eval-command nil +(defvar-local ess-eval-command nil "Dialect specific format-string for building the command to evaluate a string. It is usually faster to send a string to remote processes than a @@ -2267,103 +1912,65 @@ transitory output. See also `ess-eval-visibly-command' and `ess-eval-visibly-noecho-command'.") -(defvar ess-build-eval-message-function nil +(defvar-local ess-build-eval-message-function nil "Dialect-specific function for formatting an evaluation message.") -(make-variable-buffer-local 'ess-eval-command) -(make-variable-buffer-local 'ess-load-command) -(make-variable-buffer-local 'ess-build-eval-message-function) - (defcustom inferior-ess-dump-command "dump(\"%s\",file=\"%s\")\n" "Format-string for building the ess command to dump an object into a file. - -Use first %s to substitute an object name +Use first %s to substitute an object name. Use second %s to substitute the dump file name." :group 'ess-command :type 'string) -(defvar inferior-ess-help-command "help(\"%s\")\n" +(defvar-local inferior-ess-help-command "help(\"%s\")\n" "Format-string for building the ESS command to ask for help on an object. - This format string should use %s to substitute an object name.") -(make-variable-buffer-local 'inferior-ess-help-command) (defcustom inferior-ess-r-help-command ".ess.help('%s')\n" "Format-string for building the R command to ask for help on an object. - This format string should use %s to substitute an object name. If set, changes will take effect when next R session is started." :group 'ess-command :type 'string) -(defvar ess-get-help-topics-function nil - "Dialect specific help topics retrieval") - -(defvar ess-display-help-on-object-function nil - "Dialect specific function for displaying help on object.") - -(defvar ess-find-help-file-function nil - "Dialect specific function for displaying help on object.") - -(defvar ess-build-help-command-function nil - "Dialect specific function for building an help command.") - -(make-variable-buffer-local 'ess-get-help-topics-function) -(make-variable-buffer-local 'ess-display-help-on-object-function) -(make-variable-buffer-local 'ess-find-help-file-function) -(make-variable-buffer-local 'ess-build-help-command-function) - (defvar-local inferior-ess-exit-command "q()\n" "Format-string for building the ess command to exit. - This format string should use %s to substitute an object name.") -(defvar inferior-ess-search-list-command nil +(defvar-local inferior-ess-search-list-command nil "`ess-language' command that prints out the search list; i.e. the list of directories and (recursive) objects that `ess-language' uses when it searches for objects. Really set in -customize-alist in ess[dl]-*.el") -(make-variable-buffer-local 'inferior-ess-search-list-command) (defcustom inferior-ess-safe-names-command "tryCatch(base::print(base::names(%s), max=1e6), error=function(e){})\n" "Format string for ESS command to extract names from an object *safely*. -%s is replaced by an \"object name\" -- usually a list or data frame, but in R also - e.g., 'package:stats'." - :group 'ess-command - :type 'string) - -(defcustom inferior-ess-get-prompt-command "options()$prompt\n" - "Command to find the value of the current S prompt." +%s is replaced by an \"object name\" -- usually a list or data +frame, but in R also e.g., `package:stats'." :group 'ess-command :type 'string) ;;*;; Regular expressions -(defvar inferior-ess-prompt nil +(defvar-local inferior-ess-prompt nil "The regular expression used for recognizing prompts. It is always used in transcript mode. In inferior ess mode it is used only if `comint-use-prompt-regexp' is t. -If not set in language's customise-alist it is constructed at run time +If not set in language's customize-alist it is constructed at run time from `inferior-ess-primary-prompt' and `inferior-ess-secondary-prompt'.") -(make-variable-buffer-local 'inferior-ess-prompt) -(defvar ess-change-sp-regexp "" +(defvar-local ess-change-sp-regexp "" "The regexp for matching the S/R/.. commands that change the search path.") -(make-variable-buffer-local 'ess-change-sp-regexp) (defvar ess-S+-change-sp-regexp "\\(attach(\\([^)]\\|$\\)\\|detach(\\|collection(\\|library(\\|module(\\|source(\\)" "The regexp for matching the S-plus commands that change the search path.") -(defvar ess-S-change-sp-regexp - "\\(attach(\\([^)]\\|$\\)\\|detach(\\|library(\\|source(\\)" - "The regexp for matching the S commands that change the search path.") - (defvaralias 'ess-R-change-sp-regexp 'ess-r-change-sp-regexp) (defvar ess-r-change-sp-regexp "\\(attach(\\([^)]\\|$\\)\\|detach(\\|library(\\|require(\\|source(\\)" @@ -2371,47 +1978,28 @@ ;;*;; Process-dependent variables -(defvar ess-search-list nil - "Deprecated. Use (ess-search-list) or (ess-process-get 'search-list) instead.") -(make-obsolete-variable 'ess-search-list nil "ESS[12.09]") - -(defvar ess-sl-modtime-alist nil +(defvar-local ess-sl-modtime-alist nil "Alist of modification times for all ess directories accessed this session.") -(make-variable-buffer-local 'ess-sl-modtime-alist) -(defvar ess-sp-change nil - "Variable not used. Use (ess-process-get 'sp-for-help-changed?) instead.") -(make-obsolete-variable 'ess-sp-change nil "ESS[12.09]") -;; (make-variable-buffer-local 'ess-sp-change) +(defvar-local ess-prev-load-dir/file nil + "Cached value for `ess-load-file'. -(defvar ess-prev-load-dir/file nil - "This symbol saves the (directory . file) pair used in the last +This symbol saves the (directory . file) pair used in the last `ess-load-file' command. Used for determining the default in the next one.") -(make-variable-buffer-local 'ess-prev-load-dir/file) - -(defvar ess-object-list nil +(defvar-local ess-object-list nil ;; This is a list of the currently known object names. It is ;; current only for one command entry; it exists under the ;; assumption that the list of objects doesn't change while entering ;; a command. - "Cache of object names") - -(make-variable-buffer-local 'ess-object-list) + "Cache of object names.") -(defvar ess-help-topics-list nil +(defvar-local ess-help-topics-list nil ;; List of currently known help topics. - "Cache of help topics") - -(make-variable-buffer-local 'ess-help-topics-list) - + "Cache of help topics.") ;;*;; Miscellaneous system variables -(defvar ess-temp-point nil - "Variable used to retain a buffer position past let or let*.") - - ;; SJE: Wed 29 Dec 2004 - following 3 ess-object* variables can be removed ;; soon if no-one needs the completion code. (defvar ess-object-name-db-file "ess-namedb" @@ -2420,13 +2008,11 @@ (defvar ess-object-name-db-file-loaded '() "List of programs whose name-db file has been loaded.") -(defvar ess-object-name-db nil +(defvar-local ess-object-name-db nil "Alist of lists of object names, with directory names as keys. The file ess-namedb.el is loaded (if it exists) to define this variable. See also function `ess-create-object-name-db'.") -(make-variable-buffer-local 'ess-object-name-db) - ;;;*;;; Font-lock support ;; "Reserved Words" -- part 1 -- @@ -2488,10 +2074,9 @@ ess-R-function-name-regexp) (defvar ess-font-lock-keywords nil - "Internal. Holds a name of the dialect sepcific font-lock -keywords in the current buffer. See `ess-R-font-lock-keywords' -for an example.") -(make-variable-buffer-local 'ess-font-lock-keywords) + "A name of the dialect specific font-lock keywords in the current buffer. +See `ess-R-font-lock-keywords' for an example. This is an +internal variable.") (defvar ess-fl-keyword:fun-calls (cons "\\(\\sw+\\)[\t ]*(" '(1 ess-function-call-face keep)) @@ -2510,7 +2095,7 @@ "Font lock for equal sign (=).") (defvar ess-fl-keyword:operators - (cons "[-=+> -;; Copyright (C) 2000--2006 A.J. Rossini, Richard M. Heiberger, Martin -;; Maechler, Kurt Hornik, Rodney Sparapani, and Stephen Eglen. - -;; Author: Richard M. Heiberger -;; Created: 9 Dec 1998 -;; Maintainer: ESS-core - -;; 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 -;; https://www.r-project.org/Licenses/ - - -;;; Commentary: - -;; Code for dealing with running external processes on Windows 9x/NT -;; through ddeclient. - -;;; Code: - -(require 'ess-custom) -(require 'ess-mode) -(require 'ess-utils) - -(defun ess-ddeclient-p () - "Returns t iff `ess-local-process-name' is associated with an -inferior-ess-ddeclient, and nil if the ess-process is running as an -ordinary inferior process. Alway nil on Unix machines." - (interactive) - (when ess-microsoft-p - ;; Debug: C-c C-l fails (to start R or give good message) in Windows - (ess-write-to-dribble-buffer - (format "*ddeclient-p: ess-loc-proc-name is '%s'" ess-local-process-name)) - (ess-force-buffer-current "Process to load into: ") - (not (equal (ess-get-process-variable 'inferior-ess-ddeclient) - (default-value 'inferior-ess-ddeclient))))) - -;; C-c C-r -(defun ess-dde-send-region (proc start end &optional visibly message) - "Loop through lines in region and send them to ESS via ddeclient. - -PROC, VISIBLY and MESSAGE are ignored." - (setq ;; set the following variables for the current ddeESS process. - inferior-ess-ddeclient (ess-get-process-variable 'inferior-ess-ddeclient) - inferior-ess-client-name (ess-get-process-variable 'inferior-ess-client-name) - inferior-ess-client-command (ess-get-process-variable 'inferior-ess-client-command)) - (narrow-to-region start end) - (goto-char (point-min)) - (let ((beg)) - (while (or (< (point) (point-max)) - (and (= 1 (point-max)) - (bound-and-true-p ess-dde-even-empty))) - (setq beg (point)) - (end-of-line) - ;; call-process-region won't send over a 0-character line. - ;; We go outside the loop to create a 1-character line " " in the - ;; *ESS-temporary* buffer - (if (= beg (point)) ;; do empty line outside loop - (ess-dde-eval-linewise " " nil 'eob t) - ;;(call-process-region start end - ;; "ddeclient" nil nil nil "S-PLUS" "SCommand") - (call-process-region - beg (point) - inferior-ess-ddeclient nil nil nil - inferior-ess-client-name inferior-ess-client-command)) - (forward-line 1)) - (widen))) - -;; C-c C-n -(defun ess-dde-eval-linewise (text-withtabs &optional invisibly eob - even-empty wait-last-prompt &rest args) - (with-current-buffer (get-buffer-create "*ESS-temporary*") - (ess-setq-vars-local ess-customize-alist (current-buffer)) - (erase-buffer) - (insert text-withtabs) - (let ((ess-dde-even-empty even-empty)) - (ess-dde-send-region nil (point-min) (point-max)))) - (when wait-last-prompt - ess-eval-ddeclient-sleep)) ; in addition to timeout-ms - -;; C-c C-v -(defun ess-dde-display-help-on-object (object &rest args) - "Display the ESS documentation for OBJECT in another window. -If prefix arg is given, forces a query of the ESS process for the help -file. Otherwise just pops to an existing buffer if it exists." - (ess-force-buffer-current "Process to load into: ") - (ess-dde-eval-linewise (concat "help(" object ")"))) - -(defun ess-dde-find-help-file (p-string) - (read-string "Help on: ")) - -;; C-c C-l -(defun ess-dde-load-file (filename) - "Load an S source file into an inferior ESS process; alternate behavior for -`ess-load-file', required with S-Plus GUI for Windows: Sends the S-Plus command -source(\"filename\") to S. This version does not guarantee to save .Last.value, -nor offer alternate buffers or editing capability." - (let ((source-buffer (get-file-buffer filename))) - (if (ess-check-source filename) - (error "Buffer %s has not been saved" (buffer-name source-buffer)) - ;; Find the process to load into - (if source-buffer - (with-current-buffer source-buffer - (ess-force-buffer-current "Process to load into: ") - ;; (ess-check-modifications) ;;; not possible with ddeclient - ;; it calls ess-command which requires two-way communication - ;; with the S-Plus process - ))) - (ess-dde-eval-linewise (format ess-load-command filename))) - (widen)) - - -;; C-c C-d -(defun ess-dde-dump-object (object filename) - "Dump the ESS object OBJECT into file FILENAME." - (ess-force-buffer-current "Process to load into: ") - (ess-dde-eval-linewise (concat "dump('" object "','" filename "')")) - (sleep-for 5) - (find-file filename) - (widen)) - -(defun ess-dde-read-object-name (p-string) - (read-string "Object to edit: ")) - -(defun ess-dput-expression-ddeclient (object filename) - "Dump the ESS object found by evaluating OBJECT into file FILENAME." - (ess-force-buffer-current "Process to load into: ") - (ess-dde-eval-linewise (concat "dput(" object ",'" filename "')")) - (sleep-for 2) - (find-file filename)) - -(defun ess-command-ddeclient-proposed (com &optional buf sleep) - "ddeclient version of real `ess-command'. -Send the ESS process command COM and redirect its output to the -temporary file named BUF. The temporary filename is constructed -in emacs, not in the ESS process. The default name for the -temporary buffer is \"ess-temp.st\". The function waits -SLEEP (which defaults to 1) seconds and then brings the temporary -file into an emacs buffer and displays it." - (let (filename bufname) - (if (not buf) (setq buf "ess-temp.st")) - (if (not sleep) (setq sleep 1)) - (setq filename (concat (file-name-as-directory (getenv "TEMP")) buf)) - (ess-dde-eval-linewise - (concat ".old.Last.value <- .Last.value; sink('" - filename - "'); print(" - com - "); sink(); .Last.value <- .old.Last.value")) - (setq bufname (ess-get-file-or-buffer filename)) ;; must follow the eval - (sleep-for sleep) - (if (not bufname) - (find-file filename) - (switch-to-buffer bufname)) - (revert-buffer t t) ;; this allows the user to reuse the BUF name - )) - -;; previous version (ESS-5.2.12 and earlier) -(defun ess-dde-command (com &optional buf sleep) - "ddeclient bypass of real ess-command" - (ess-eval-linewise com)) - -(provide 'ess-dde) - -;;; ess-dde.el ends here diff -Nru ess-18.10.2/lisp/essd-els.el ess-18.10.2+git20220915.f45542e/lisp/essd-els.el --- ess-18.10.2/lisp/essd-els.el 2018-11-10 09:41:11.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/lisp/essd-els.el 2022-10-15 08:06:36.000000000 +0000 @@ -1,30 +1,26 @@ -;;; essd-els.el --- S-PLUS 3.x at another location customization +;;; essd-els.el --- S-PLUS 3.x at another location customization -*- lexical-binding: t; -*- -;; Copyright (C) 1998 Richard M. Heiberger -;; Copyright (C) 1999--2005 A.J. Rossini, Richard M. Heiberger, Martin -;; Maechler, Kurt Hornik, Rodney Sparapani, and Stephen Eglen. +;; Copyright (C) 1998-2020 Free Software Foundation, Inc. ;; Author: Richard M. Heiberger ;; Created: December 1998 - ;; Maintainer: ESS-core -;; Keywords: languages - -;; This file is part of ESS. - -;; This file is free software; you can redistribute it and/or modify +;;; License: +;; +;; This program is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 2, or (at your option) -;; any later version. - -;; This file is distributed in the hope that it will be useful, +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. +;; +;; This program is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. - -;; A copy of the GNU General Public License is available at -;; https://www.r-project.org/Licenses/ +;; +;; You should have received a copy of the GNU General Public License +;; along with this program. If not, see +;; ;;; Commentary: @@ -32,27 +28,19 @@ ;;; Code: -(require 'ess-arc-d) -(require 'ess-julia) -(require 'ess-omg-d) -(require 'ess-s-lang) -(require 'ess-s3-d) -(require 'ess-s4-d) -(require 'ess-sas-d) -(require 'ess-sp3-d) -(require 'ess-sp4-d) -(require 'ess-sp5-d) +(require 'ess-r-mode) (require 'ess-sp6-d) -(require 'ess-sp6w-d) -(require 'ess-stata-mode) +(require 'ess-sas-d) (require 'ess-trns) (require 'ess-utils) -(require 'ess-vst-d) -(require 'ess-xls-d) +(defvar ess-julia-customize-alist) +;; Easily changeable in a user's .emacs (defvar S+elsewhere-dialect-name "S+6" - "Name of 'dialect' for S-PLUS at another location.") - ;easily changeable in a user's .emacs + "Name of `dialect' for S-PLUS at another location.") + +(defvar S+elsewhere-start-args "-i" + "Arguments for `S+elsewhere-dialect-name'.") (defcustom inferior-ess-remote-pager nil "Remote pager to use for reporting help files and similar things. @@ -63,72 +51,52 @@ (defvar S+elsewhere-customize-alist (append - '((ess-local-customize-alist . 'S+elsewhere-customize-alist) + '((ess-local-customize-alist . S+elsewhere-customize-alist) (ess-dialect . S+elsewhere-dialect-name) (ess-object-name-db-file . "ess-spelsewhere-namedb.el" ) (inferior-ess-program . inferior-S-elsewhere-program) (inferior-ess-help-command . "help(\"%s\", pager=\"cat\", window=F)\n") - - (inferior-ess-start-file . nil) ;"~/.ess-S+3") - (inferior-ess-start-args . "-i") (ess-STERM . "iESS") ) S+common-cust-alist) - "Variables to customize for S+elsewhere") + "Variables to customize for S+elsewhere.") -(defun S+elsewhere (&optional proc-name) +(defun S+elsewhere (&optional _proc-name) "Call 'S-PLUS 3.x', the 'Real Thing' from StatSci." - (interactive) - (setq ess-customize-alist S+elsewhere-customize-alist) + ;; git commit 104c4d7c56bc239ea245562763caa317bc3a1a84 + (declare (obsolete ess-remote "2000")) (ess-write-to-dribble-buffer (format "\n(S+elsewhere): ess-dialect=%s, buf=%s\n" ess-dialect (current-buffer))) - (inferior-ess) - (if inferior-ess-language-start - (ess-eval-linewise inferior-ess-language-start))) -;; git commit 104c4d7c56bc239ea245562763caa317bc3a1a84 -(make-obsolete 'S+elsewhere #'ess-remote "2000") + (let ((inf-buf (inferior-ess nil S+elsewhere-customize-alist))) + (when inferior-ess-language-start + (ess-eval-linewise inferior-ess-language-start)) + inf-buf)) -(defun S+elsewhere-mode (&optional proc-name) +(defun S+elsewhere-mode (&optional _proc-name) "Major mode for editing S+3 source. See `ess-mode' for more help." - (interactive) - (setq ess-customize-alist S+elsewhere-customize-alist) - (ess-mode S+elsewhere-customize-alist proc-name)) + (declare (obsolete ess-remote "2000")) + (setq-local ess-local-customize-alist S+elsewhere-customize-alist) + (ess-mode)) -(defun S+elsewhere-transcript-mode () - "S-PLUS 3.x transcript mode." - (interactive) - (ess-transcript-mode S+elsewhere-customize-alist)) +(define-obsolete-function-alias 'S+elsewhere-transcript-mode #'S-transcript-mode "2000") ;; This REALLY shouldn't need an editing mode. Just a transcript and ;; an inferior process handler. (defun ess-select-alist-dialect (&optional dialect) - "Query user for an ESS dialect and return the matching customize-alist." + "Query user for an ESS DIALECT and return the matching customize-alist." (interactive) - (let* ((dialects '("R" "S+" "julia" "arc" "vst" "omg" "s3" "s4" "stata" "sp3" "sp4" - "sqpe4" "sp5" "sqpe" "XLS" "SAS")) + (let* ((dialects '("R" "S+" "julia" "s3" "s4" + "sp3" "sp4" "sqpe4" "sp5" "sqpe" "SAS")) (dialect (or dialect (ess-completing-read "Dialect" dialects nil t)))) (cond - ((string= dialect "julia") ess-julia-customize-alist) - ((string= dialect "arc") ARC-customize-alist) - ((string= dialect "vst") VST-customize-alist) - ((string= dialect "omg") OMG-customize-alist) - ((string= dialect "s3") S3-customize-alist) - ((string= dialect "s4") S4-customize-alist) - ((string= dialect "stata") STA-customize-alist) + ((string= dialect "julia") (progn (require 'julia-mode) + ess-julia-customize-alist)) ((string= dialect "R") ess-r-customize-alist) - ((string= dialect "sp3") S+3-customize-alist) - ((string= dialect "sp4") S+4-customize-alist) - ((string= dialect "sqpe4") Sqpe+4-customize-alist) - ((string= dialect "sp5") S+5-customize-alist) - ((string= dialect "S+") S+-customize-alist) - ((string= dialect "sqpe") Sqpe+-customize-alist) - ((string= dialect "XLS") XLS-customize-alist) - ((string= dialect "SAS") SAS-customize-alist);was S+elsewhere-customize-alist? - (t S+elsewhere-customize-alist) - ))) + ((string= dialect "SAS") SAS-customize-alist) + (t S+elsewhere-customize-alist)))) (defun ess-add-ess-process () "Execute this command from within a buffer running a process to add @@ -139,27 +107,27 @@ (interactive) (let ((proc (get-buffer-process (buffer-name)))) (if (not proc) - (error "No process is associated with this buffer.") + (error "No process is associated with this buffer") (set-process-filter proc 'inferior-ess-output-filter) (setq ess-current-process-name (process-name proc)) (add-to-list 'ess-process-name-list (list ess-current-process-name))))) (defvar ess-remote nil - "Indicator, t in ess-remote buffers.") + "Indicator, t in remote buffers.") ;;;###autoload (defun ess-remote (&optional proc-name dialect) - "Execute this command from within a buffer running a process. It -runs `ess-add-ess-process' to add the process to + "Execute this command from within a buffer running a process. +It runs `ess-add-ess-process' to add the PROC-NAME to `ess-process-name-alist' and to make it the -`ess-current-process-name'. It then prompts the user for an ESS +`ess-current-process-name'. It then prompts the user for an ESS language and sets the editing characteristics appropriately. To use this command, first start a process on a remote computer by manual use of telnet, rlogin, ssh, or some other protocol. Start the relevant program (\"S\" or \"R\" or \"sas -stdio\") in that buffer. Once -you are talking to S or R or SAS, then execute `ess-remote' to make +you are talking to S or R or SAS, then do \\[ess-remote] to make the current buffer an inferior-ess buffer with the right behavior for the language you are currently working with. With S and R, use C-c C-n to send lines over. With SAS, use C-c i @@ -170,13 +138,13 @@ (interactive) (ess-add-ess-process) ;; Need to select a remote-customize-alist - (let ((ess-customize-alist (ess-select-alist-dialect dialect))) + (let ((customize-alist (ess-select-alist-dialect dialect))) (ess-write-to-dribble-buffer (format "\n(ESS-remote): ess-dialect=%s, buf=%s\n" ess-dialect (current-buffer))) - (ess-setq-vars-local ess-customize-alist) - (inferior-ess-mode) - (set (make-local-variable 'ess-remote) t) + (ess-setq-vars-local customize-alist) + (inferior-ess--set-major-mode ess-dialect) + (setq-local ess-remote t) (setq ess-local-process-name (or proc-name ess-current-process-name)) (goto-char (point-max)) @@ -186,7 +154,7 @@ (ess-eval-linewise (format "options(pager='%s')\n" (or inferior-ess-remote-pager inferior-ess-pager)) nil nil nil 'wait) - (inferior-ess-r-load-ESSR)) + (ess-r-load-ESSR)) (when (equal ess-dialect "S+") (ess-command ess-S+--injected-code)) @@ -198,7 +166,12 @@ (setq buffer-read-only nil) (font-lock-mode 1)) - (ess-load-extras) + (ess-process-put 'funargs-cache (make-hash-table :test 'equal)) + (ess-process-put 'funargs-pre-cache nil) + ;; auto-complete + (ess--setup-auto-complete ess-r-ac-sources t) + ;; company + (ess--setup-company ess-r-company-backends t) (when inferior-ess-language-start (ess-eval-linewise inferior-ess-language-start diff -Nru ess-18.10.2/lisp/ess.el ess-18.10.2+git20220915.f45542e/lisp/ess.el --- ess-18.10.2/lisp/ess.el 2018-11-10 09:41:11.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/lisp/ess.el 2022-10-15 08:06:36.000000000 +0000 @@ -1,5 +1,7 @@ -;;; ess.el --- Emacs Speaks Statistics -;; +;;; ess.el --- Emacs Speaks Statistics -*- lexical-binding: t; -*- + +;; Copyright (C) 1997-2020 Free Software Foundation, Inc. + ;; Author: David Smith ;; A.J. Rossini ;; Richard M. Heiberger @@ -14,733 +16,66 @@ ;; J. Alexander Branham ;; ;; Maintainer: ESS Core Team -;; Copyright (C) 1997-2018 ESS Core Team ;; Created: 7 Jan 1994 -;; Version: 18.10.2 -;; Package-Requires: ((julia-mode "0.3")) +;; Version: 18.10.3snapshot +;; URL: https://ess.r-project.org/ +;; Package-Requires: ((emacs "25.1")) +;; ESSR-Version: 1.7 + +;; This file is part of GNU Emacs. + +;;; License: ;; -;; This file is free software; you can redistribute it and/or modify +;; This program is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 2, or (at your option) -;; any later version. +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. ;; -;; This file is distributed in the hope that it will be useful, +;; This program is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. ;; -;; A copy of the GNU General Public License is available at -;; https://www.r-project.org/Licenses/ -;; +;; You should have received a copy of the GNU General Public License +;; along with this program. If not, see +;; + ;;; Commentary: ;; ;; Emacs Speaks Statistics (ESS) is a package designed to support editing of ;; scripts and interaction with various statistical analysis programs such as R, ;; S-Plus, SAS, Stata and OpenBUGS/JAGS. For more details please visit ESS home ;; page at https://ess.r-project.org/ -;; + ;;; Code: -(eval-when-compile - (require 'cl) - (require 'cl-lib)) -(require 'ess-custom) (require 'ess-utils) -(require 'ess-generics) -(require 'ess-inf) - -;; FIXME: should this be optional? -(require 'ess-noweb-mode) - -;; Silence the byte compiler -(declare-function run-ess-r "ess-r-mode") -(declare-function S+ "ess-sp6w-d") -(declare-function SAS "ess-sas-d") - - ; ESS mode - -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;;;; In this section: -;;;; -;;;; * The major mode ess-mode -;;;; * Commands for ess-mode -;;;; * Code evaluation commands -;;;; * Indenting code and commands -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - -;;*;; Major mode definition - -(defvar ess-mode-map - (let ((map (make-sparse-keymap))) - - ;; By popular demand: - (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) - (define-key map "\C-c\M-r" 'ess-eval-region-and-go) - (define-key map "\C-c\C-b" 'ess-eval-buffer) - (define-key map "\C-c\M-b" 'ess-eval-buffer-and-go) - (define-key map (kbd "C-c C-") 'ess-eval-buffer-from-beg-to-here) - (define-key map (kbd "C-c C-") 'ess-eval-buffer-from-here-to-end) - (define-key map "\C-c\C-f" 'ess-eval-function) - (define-key map "\C-c\M-f" 'ess-eval-function-and-go) - (define-key map "\C-c\C-c" 'ess-eval-region-or-function-or-paragraph-and-step) - (define-key map "\C-c\C-p" 'ess-eval-paragraph-and-step) - (define-key map "\C-c\M-p" 'ess-eval-paragraph-and-go) - (define-key map "\C-\M-x" 'ess-eval-region-or-function-or-paragraph) - (define-key map "\C-c\C-n" 'ess-eval-line-visibly-and-step) - (define-key map "\C-c\C-j" 'ess-eval-line) - (define-key map [(control return)] 'ess-eval-region-or-line-visibly-and-step) - (define-key map "\C-c\M-j" 'ess-eval-line-and-go) - ;; 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) - (define-key map "\C-xnf" 'ess-narrow-to-defun-or-para) - (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) - ;;; 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-c\C-s" 'ess-switch-process) - (define-key map "\C-c\t" 'ess-complete-object-name-deprecated) - (define-key map "\M-?" 'ess-list-object-completions) - (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-\M-q" 'ess-indent-exp) - (define-key map "{" 'skeleton-pair-insert-maybe) - (define-key map "}" 'skeleton-pair-insert-maybe) - (define-key map "\C-\M-h" 'ess-mark-function-or-para) - (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) - (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) - (with-no-warnings ; Obsolete key variable - (when ess-smart-S-assign-key - (define-key map ess-smart-S-assign-key 'ess-smart-S-assign))) - (define-key map (kbd "C-c C-=") 'ess-cycle-assign) - map) - "Keymap for `ess-mode'.") - -;; Redefine substituted commands -(substitute-key-definition 'indent-new-comment-line - 'ess-indent-new-comment-line - ess-mode-map global-map) - -(defvar ess-extra-map - (let (ess-extra-map) - (define-prefix-command 'ess-extra-map) - (define-key ess-extra-map "\C-d" 'ess-dump-object-into-edit-buffer) - (define-key ess-extra-map "d" 'ess-dump-object-into-edit-buffer) - (define-key ess-extra-map "\C-e" 'ess-execute) - (define-key ess-extra-map "e" 'ess-execute) - (define-key ess-extra-map "\C-i" 'ess-install-library) - (define-key ess-extra-map "i" 'ess-install-library) - (define-key ess-extra-map "\C-l" 'ess-load-library) - (define-key ess-extra-map "l" 'ess-load-library) - (define-key ess-extra-map "\C-r" 'inferior-ess-reload) - (define-key ess-extra-map "r" 'inferior-ess-reload) - (define-key ess-extra-map "\C-s" 'ess-set-style) - (define-key ess-extra-map "s" 'ess-set-style) - (define-key ess-extra-map "\C-t" 'ess-build-tags-for-directory) - (define-key ess-extra-map "t" 'ess-build-tags-for-directory) - (define-key ess-extra-map "\C-w" 'ess-execute-screen-options) - (define-key ess-extra-map "w" 'ess-execute-screen-options) - (define-key ess-extra-map "/" 'ess-set-working-directory) - ess-extra-map) - "ESS extra map.") - -(easy-menu-define - ess-mode-menu ess-mode-map - "Menu for use in `ess-mode'." - '("ESS" ; ESS-mode - ["What is this? (beta)" ess-mouse-me t] - ["Load file" ess-load-file t] - ["Eval region | func | para" ess-eval-region-or-function-or-paragraph t] - ["Eval region | func | para & step" ess-eval-region-or-function-or-paragraph-and-step t] - ["Eval region | line" ess-eval-region-or-line-visibly-and-step t] - ["Enter expression" ess-execute t] - ;; sub menus - "------" - ("Process" - ["Goto end of process buffer" ess-switch-to-end-of-ESS t] - ["Switch to process buffer" ess-switch-to-inferior-or-script-buffer t] - ["Switch Process" ess-switch-process t] - ;; ["Recreate R and S versions known to ESS" (ess-r-s-versions-creation+menu) t] - ("Start Process" - ["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 - ;; The following menu item "Other" is a place-holder that will - ;; be replaced with the other versions of R and Sqpe that can be run. - ;; See `ess-r-versions-create' and ess-site.el - ("Other" - ["No other R or Sqpe versions" nil nil]) - ["About" - (ess-goto-info "Starting up") t] - ;; :help "Read about starting a new ESS process" :active t] - ) - ("Eval visibly " - :filter ess--generate-eval-visibly-submenu)) - "------" - ("ESS Eval" - ["Eval region | func | para" ess-eval-region-or-function-or-paragraph t] - ["Eval region | func | para & step" ess-eval-region-or-function-or-paragraph-and-step t] - ["Eval region | line & step" ess-eval-region-or-line-visibly-and-step t] - "-----" - ["Eval buffer" ess-eval-buffer t] - ["Eval buffer till here" ess-eval-buffer-from-beg-to-here t] - ["Eval buffer from here" ess-eval-buffer-from-here-to-end t] - ["Eval region" ess-eval-region t] - ["Eval function" ess-eval-function t] - ["Eval line" ess-eval-line t] - ["Eval line & step" ess-eval-line-and-step t] - ["Eval paragraph" ess-eval-paragraph t] - ["Eval paragraph & step" ess-eval-paragraph-and-step t] - ["Eval chunk" ess-eval-chunk ess-noweb-mode] - ["Eval chunk and step" ess-eval-chunk-and-step ess-noweb-mode] - ["Eval thread" ess-eval-thread ess-noweb-mode] - ["About" (ess-goto-info "Evaluating code") t] - ) - ("Eval and Go" - ["Eval buffer" ess-eval-buffer-and-go t] - ["Eval region" ess-eval-region-and-go t] - ["Eval function" ess-eval-function-and-go t] - ["Eval line" ess-eval-line-and-go t] - ["Eval paragraph" ess-eval-paragraph-and-go t] - ["Eval chunk" ess-eval-chunk-and-go ess-noweb-mode] - ["Eval thread" ess-eval-thread-and-go ess-noweb-mode] - ["About" (ess-goto-info "Evaluating code") t] - ) - ("Motion" - ["Beginning of function or para" ess-goto-beginning-of-function-or-para t] - ["End of function or para" ess-goto-end-of-function-or-para t] - "-----" - ["Backward list" backward-list t] - ["Forward list" forward-list t] - ["Next parenthesis" down-list t] - ["Enclosing parenthesis" backward-up-list t] - ["Backward sexp" backward-sexp t] - ["Forward sexp" forward-sexp t] - ["About" (Info-goto-node "(Emacs)Lists") t] - ) - ("ESS Edit" - ["Edit new object" ess-dump-object-into-edit-buffer t] - ["Complete Filename" comint-replace-by-expanded-filename t] - ["Complete File or Object" ess-indent-or-complete t] - ["Kill sexp" kill-sexp t] - ["Mark function" ess-mark-function-or-para t] - ["Indent expression" ess-indent-exp t] - ["Indent line" ess-indent-command t] - ["Toggle Auto-Fill Mode" auto-fill-mode t] - ["Undo" undo t] - ["About" (ess-goto-info "Edit buffer") t] - ) - "------" - ("start-dev" :visible nil) - ("end-dev" :visible nil) - "------" - ("Font Lock" - :active ess-font-lock-keywords - :filter ess--generate-font-lock-submenu) - "------" - ["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])) - -;;;###autoload -(defun ess-mode (&optional alist proc-name is-derived) - "Major mode for editing ESS source. -Optional arg ALIST describes how to customize the editing mode. -Optional arg PROC-NAME is name of associated inferior process. - -\\{ess-mode-map} - -Extra binding to note: 'ESC C-\\' indent-region. - -Entry to this mode runs the hooks in ess-mode-hook. - -You can send text to the inferior ESS process from other buffers containing -ESS source. - `ess-eval-region' sends the current region to the ESS process. - `ess-eval-buffer' sends the current buffer to the ESS process. - `ess-eval-function' sends the current function to the ESS process. - `ess-eval-line' sends the current line to the ESS process. - `ess-beginning-of-function' and `ess-end-of-function' move the point to - the beginning and end of the current ESS function. - `ess-switch-to-ESS' switches the current buffer to the ESS process buffer. - `ess-switch-to-end-of-ESS' switches the current buffer to the ESS process - buffer and puts point at the end of it. - - `ess-eval-region-and-go', `ess-eval-buffer-and-go', - `ess-eval-function-and-go', and `ess-eval-line-and-go' switch to the S - process buffer after sending their text. - - `ess-load-file' sources a file of commands to the ESS process. - -\\[ess-indent-command] indents for ESS code. -\\[backward-delete-char-untabify] converts tabs to spaces as it moves back. -Comments are indented in a similar way to Emacs-lisp mode: - `###' beginning of line - `##' the same level of indentation as the code - `#' the same column on the right, or to the right of such a - column if that is not possible.(default value 40). - \\[indent-for-comment] command automatically inserts such a - `#' in the right place, or aligns such a comment if it is - already inserted. -\\[ess-indent-exp] command indents each line of the syntactic unit following point. - -Variables controlling indentation style: - `ess-tab-always-indent' - Non-nil means TAB in ESS mode should always reindent the current line, - regardless of where in the line point is when the TAB command is used. - `ess-auto-newline' - Non-nil means automatically newline before and after braces inserted in S - code. - `ess-indent-offset' - Indentation of ESS statements within surrounding block. - The surrounding block's indentation is the indentation of the line on - which the open-brace appears. - `ess-offset-block' - Indentation of blocks opened with curly braces or anonymous parentheses. - `ess-offset-arguments' - Indentation of function arguments or bracket indices. - `ess-offset-arguments-newline' - Indentation of function arguments or bracket indices when the opening - delimiter is immediately followed by a newline. - `ess-offset-continued' - Indentation style for continued statements. - `ess-align-nested-calls' - Functions whose nested calls should be aligned. - `ess-align-arguments-in-calls' - Calls in which arguments should be aligned. - `ess-align-continuations-in-calls' - Whether ignore indentation after an operator in calls - `ess-align-blocks' - Blocks that should always be aligned vertically. - `ess-indent-from-lhs' - Whether function calls given as argument should be indented from the - parameter name. - `ess-indent-from-chain-start' - Whether to indent arguments from the first of several consecutive calls. - `ess-indent-with-fancy-comments' - Non-nil means distinguish between #, ##, and ### for indentation. - -Furthermore, \\[ess-set-style] command enables you to set up predefined ess-mode -indentation style. At present, predefined style are `BSD', `GNU', `K&R', `C++', -`CLB' (quoted from C language style)." - (setq alist (or alist - (buffer-local-value 'ess-local-customize-alist (current-buffer)) - (error "Customise alist is not specified, nor ess-local-customize-alist is set"))) - (unless is-derived - (kill-all-local-variables)) ;; NOTICE THIS! *** NOTICE THIS! *** NOTICE THIS! *** - (ess-setq-vars-local alist) - (ess-write-to-dribble-buffer - (format "(ess-mode-1): ess-language=%s, ess-dialect=%s buf=%s \n" - ess-language - ess-dialect - (current-buffer))) - ;; (ess-write-to-dribble-buffer - ;; (format "(ess-mode-1.2): ess-process=%s \n" - ;; (ess-local-process-name ess-local-process-name "none"))) - (ess-write-to-dribble-buffer - (format "(ess-mode-1.5): alist=%s \n" alist)) - (unless is-derived - (setq major-mode 'ess-mode) - (setq mode-name (concat "ESS[" (or ess-dialect ess-language) "]"))) - ;; The following line does the next 20 or so :-). - (ess-write-to-dribble-buffer - (format "(ess-mode-1.6): editing-alist=%s \n" - ess-mode-editing-alist)) - (ess-setq-vars-local ess-mode-editing-alist) - - (ess-set-style ess-style t) - (use-local-map ess-mode-map) - (when ess-mode-syntax-table - (set-syntax-table ess-mode-syntax-table)) - - ;; Keep out of the code. - (make-local-variable 'indent-tabs-mode) - (setq indent-tabs-mode nil) - - (put 'ess-local-process-name 'permanent-local t) ; protect from RCS - (setq mode-line-process - '(" [" - (:eval (ess--get-mode-line-indicator)) - ess--local-mode-line-process-indicator - "]")) - ;; completion - (add-hook 'comint-dynamic-complete-functions 'ess-complete-filename nil 'local) - (delq t comint-dynamic-complete-functions) - (set (make-local-variable 'comint-completion-addsuffix) - (cons "/" "")) - - (add-hook 'ess-idle-timer-functions 'ess-synchronize-dirs nil 'local) - (ess-load-extras) - (run-mode-hooks 'prog-mode-hook) - (run-mode-hooks 'ess-mode-hook) - (ess-write-to-dribble-buffer "\nFinished setting up ESS-mode.\n")) - -;; Set parent to `prog-mode' -(put 'ess-mode 'derived-mode-parent 'prog-mode) -(set-keymap-parent ess-mode-map prog-mode-map) - -(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 -`ess-mode'." - (if ess-local-process-name - (let* ((proc (get-process ess-local-process-name)) - (buff (when proc (process-buffer proc)))) - (if (and proc (buffer-live-p buff)) - (with-current-buffer buff (mapcar 'eval ess--mode-line-process-indicator)) - "none")) - "none")) +(require 'cl-generic) +(require 'lisp-mnt) +(defvar reporter-prompt-for-summary-p) -;;*;; User commands in ess-mode - -;;;*;;; Miscellaneous - -(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)))) - - -;;;*;;; Motion / manipulation commands - -(defun ess-goto-beginning-of-function-or-para () - "If inside a function go to the beginning of it. -Otherwise go to the beginning of paragraph." - (interactive) - (or (ess-beginning-of-function 'no-error) - (backward-paragraph)) - (point)) - -(defun ess-goto-end-of-function-or-para () - "If inside a function go to end of it. -Otherwise go to the end of paragraph." - (interactive) - (or (ess-end-of-function nil 'no-error) - (forward-paragraph)) - (point)) - -(defun ess-mark-function-or-para () - "Put mark at end of ESS function, point at beginning." - (interactive) - (ess-goto-beginning-of-function-or-para) - (push-mark (point)) - (ess-goto-end-of-function-or-para) - (exchange-point-and-mark)) - -(define-obsolete-function-alias 'ess-mark-function 'ess-mark-function-or-para "15.09") - -(defun ess-narrow-to-defun-or-para () - "Make text outside current function invisible. -If text is already narrowed, this is removed before narrowing to the -current function." - (interactive) - ;; if point is not in a function, ess-end-of-function catches the error. - (save-excursion - (widen) - (let* ((beg (ess-goto-beginning-of-function-or-para)) - (end (ess-goto-end-of-function-or-para))) - (narrow-to-region beg end)))) - -(define-obsolete-function-alias 'ess-narrow-to-defun 'ess-narrow-to-defun-or-para "15.09") +;; Versions -(defun ess-newline-and-indent () - "Like `newline-and-indent' but accounts for roxygen comments." - (interactive) - (cond ((and (fboundp 'ess-roxy-newline-and-indent) - (string= ess-dialect "R")) - (ess-roxy-newline-and-indent)) - (t - (newline-and-indent)))) - -(defun ess-indent-new-comment-line () - "Like `indent-new-comment-line' but accounts for roxygen comments." - (interactive) - (cond ((and (fboundp 'ess-roxy-indent-new-comment-line) - (string= ess-dialect "R")) - (ess-roxy-indent-new-comment-line)) - (t - (indent-new-comment-line)))) - - -;;;*;;; Formatting / indentation - -(defun ess-set-style (&optional style quiet) - "Set up the `ess-mode' style variables from the `ess-style' variable. -If STYLE argument is given, use that instead. It makes the ESS -indentation style variables buffer local. When non-nil, QUIET -suppresses messaging." - (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)) - -;; 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. -If `ess-tab-always-indent' is non-nil (the default), always indent -current line. Otherwise, indent the current line only if point is at -the left margin or in the line's indentation; otherwise insert a tab. -A numeric argument, regardless of its value, means indent rigidly all -the lines of the expression starting after point so that this line -becomes properly indented. The relative indentation among the lines -of the expression are preserved." - (interactive "P") - (if whole-exp - ;; If arg, always indent this line as S - ;; and shift remaining lines of expression the same amount. - (let ((shift-amt (ess-indent-line)) - beg end) - (save-excursion - (if ess-tab-always-indent - (beginning-of-line)) - (setq beg (point)) - (backward-up-list 1) - (forward-list 1) - (setq end (point)) - (goto-char beg) - (forward-line 1) - (setq beg (point))) - (if (> end beg) - (indent-code-rigidly beg end shift-amt))) - (if (and (not ess-tab-always-indent) - (save-excursion - (skip-chars-backward " \t") - (not (bolp)))) - (insert-tab) - ;; call ess-indent-line - (funcall indent-line-function)))) - -(defun ess-indent-or-complete () - "When region is selected indent the region. -Otherwise, if `ess-tab-complete-in-script' is non-nil, try to -indent, if code is already indented, complete instead. +(defconst ess-version (eval-when-compile + (lm-version (or (and (boundp 'load-true-file-name) + load-true-file-name) + load-file-name + buffer-file-name))) + "Version of ESS currently loaded.") + +(defconst essr-version (eval-when-compile + (lm-with-file (or (and (boundp 'load-true-file-name) + load-true-file-name) + load-file-name + buffer-file-name) + (lm-header "ESSR-Version"))) + "Version of ESSR package.") + +(defvar ess-revision nil + "The revision and date of ESS. +Is set by \\[ess-version-string].") -The default of `ess-tab-complete-in-script' is nil. Also see -`ess-first-tab-never-complete'." - (interactive) - (if (use-region-p) - (indent-region (region-beginning) (region-end)) - (let ((shift (ess-indent-command))) - (when (and ess-tab-complete-in-script - (numberp shift) ;; can be nil if ess-tab-always-indent is nil - (equal shift 0) - (or (eq last-command 'ess-indent-or-complete) - (null ess-first-tab-never-complete) - (and (eq ess-first-tab-never-complete 'unless-eol) - (looking-at "\\s-*$")) - (and (eq ess-first-tab-never-complete 'symbol) - (not (looking-at "\\w\\|\\s_"))) - (and (eq ess-first-tab-never-complete 'symbol-or-paren) - (not (looking-at "\\w\\|\\s_\\|\\s)"))) - (and (eq ess-first-tab-never-complete 'symbol-or-paren-or-punct) - (not (looking-at "\\w\\|\\s_\\|\\s)\\|\\s."))))) - (completion-at-point))))) - -(defun ess-indent-exp () - "Indent each line of the ESS grouping following point." - (interactive) - (cond ((and (fboundp 'ess-r-indent-exp) - (string= ess-dialect "R")) - (ess-r-indent-exp)) - (t - (save-excursion - (let ((start (point)) - (end (ignore-errors (forward-sexp 1) (point)))) - (when end - (indent-region start end))))))) - -(defun ess-indent-line () - "Indent current line as ESS code. -Return the amount the indentation changed by." - ;; fixme: make this work with standard indent-line-function - (cond ((fboundp ess-indent-line-function) - (funcall ess-indent-line-function)) - ;; else S and R default behavior - ((fboundp 'ess-r-indent-line) - (ess-r-indent-line)) - ;; fallback on Emacs - (t (funcall indent-line-function)))) - - -;;*;; Creating and manipulating dump buffers -;;;###autoload -(defun ess-dump-object-into-edit-buffer (object) - "Edit an ESS OBJECT in its own buffer. -Without a prefix argument, this simply finds the file pointed to by -`ess-source-directory'. If this file does not exist, or if a -prefix argument is given, a dump() command is sent to the ESS process to -generate the source buffer." - (interactive - (progn - (ess-force-buffer-current "Process to dump from: ") - (ess-read-object-name "Object to edit"))) - - (let* ((dirname (file-name-as-directory - (if (stringp ess-source-directory) - ess-source-directory - (with-current-buffer (process-buffer (ess-get-process - ess-local-process-name)) - (ess-setq-vars-local ess-customize-alist) - (apply ess-source-directory nil))))) - (filename (concat dirname (format ess-dump-filename-template object))) - (old-buff (get-file-buffer filename))) - - ;; If the directory doesn't exist, offer to create it - (if (file-exists-p (directory-file-name dirname)) nil - (if (y-or-n-p ; Approved - (format "Directory %s does not exist. Create it? " dirname)) - (make-directory (directory-file-name dirname)) - (error "Directory %s does not exist" dirname))) - - ;; Three options: - ;; (1) Pop to an existing buffer containing the file in question - ;; (2) Find an existing file - ;; (3) Create a new file by issuing a dump() command to S - ;; Force option (3) if there is a prefix arg - - (if current-prefix-arg - (ess-dump-object object filename) - (if old-buff - (progn - (pop-to-buffer old-buff) - (message "Popped to edit buffer.")) - ;; No current buffer containing desired file - (if (file-exists-p filename) - (progn - (ess-find-dump-file-other-window filename) - (message "Read %s" filename)) - ;; No buffer and no file - (ess-dump-object object filename)))))) - -(ess-defgeneric ess-dump-object (object filename) - "Dump the ESS object OBJECT into file FILENAME." - (let ((complete-dump-command (format inferior-ess-dump-command - object filename))) - (if (file-writable-p filename) nil - (error "Can't dump %s as %f is not writeable" object filename)) - - (:override - ;; Make sure we start fresh - (when (get-file-buffer filename) - (kill-buffer (get-file-buffer filename))) - - (ess-command complete-dump-command) - (message "Dumped in %s" filename) - - (ess-find-dump-file-other-window filename) - - ;; PD, 1Apr97 - ;;This ensures that the object gets indented according to ess-mode, - ;;not as the R/S deparser does it. At the same time, it gets rid - ;;of the mess generated by sending TAB characters to the readline - ;;functions in R when you eval-buffer-*. - (indent-region (point-min-marker) (point-max-marker) nil) - (set-buffer-modified-p nil) ; no need to safe just because of indenting - - ;; Don't make backups for temporary files; it only causes clutter. - ;; The ESS object itself is a kind of backup, anyway. - (unless ess-keep-dump-files - (make-local-variable 'make-backup-files) - (setq make-backup-files nil)) - - ;; Don't get confirmation to delete dumped files when loading - (when (eq ess-keep-dump-files 'check) - (setq ess-keep-dump-files nil)) - - ;; Delete the file if necessary - (when ess-delete-dump-files - (delete-file (buffer-file-name)))))) - -(defun ess-find-dump-file-other-window (filename) - "Find ESS source file FILENAME in another window." - - (if (file-exists-p filename) nil - (ess-write-to-dribble-buffer - (format "%s does not exist. Bad dump, starting fresh." filename))) - - ;; Generate a buffer with the dumped data - (find-file-other-window filename) - (ess-mode ess-customize-alist) - - (auto-save-mode 1) ; Auto save in this buffer - (setq ess-local-process-name ess-current-process-name) - - (if ess-function-template - (progn - (goto-char (point-max)) - (if (re-search-backward ess-dumped-missing-re nil t) - (progn - (replace-match ess-function-template t t) - (set-buffer-modified-p nil) ; Don't offer to save if killed now - (goto-char (point-min)) - (condition-case nil - ;; This may fail if there are no opens - (down-list 1) - (error nil))))))) - -(defun ess-define-runner (name dialect &optional path) - "Create a function NAME. -This function starts the inferior process with the specified -version. DIALECT can be \"R,\" \"S,\", \"SAS.\" If given, PATH -should be the absolute path to the program. It defaults to NAME." - (lexical-let ((name name) - (dialect dialect) - (path path)) - (fset (intern name) - (lambda (&optional start-args) - "Start this process version in an inferior ESS buffer. -Function defined using `ess-define-runner'." - (interactive "P") - (cond ((string= dialect "R") - (let ((inferior-ess-r-program (or path name))) - (require 'ess-r-mode) - (run-ess-r start-args))) - ((string= dialect "S") - (let ((inferior-S+-program (or path name))) - (require 'ess-sp6-d) - (S+))) - ((string= dialect "SAS") - (let ((inferior-SAS-program (or path name))) - (require 'ess-sas-d) - (SAS)))))))) ;;;###autoload (defun ess-version () "Return a string with ESS version information." @@ -783,6 +118,114 @@ (setq ess-revision "")) (concat ess-version " [" ess-revision "]"))) + +;;; Bug Reporting + +;;;###autoload +(defun ess-submit-bug-report () + "Submit a bug report to the ESS maintainers." + (interactive) + (let ((reporter-prompt-for-summary-p 't)) + (reporter-submit-bug-report + "ess-bugs@r-project.org" + (concat "ess-mode " (ess-version-string)) + (list 'ess-language + 'ess-dialect + 'ess-ask-for-ess-directory + 'ess-ask-about-transfile + 'default-directory + 'ess-keep-dump-files + 'ess-source-directory + 'ess-use-ido + 'ess-use-eldoc + 'ess-use-tracebug + 'ess-use-auto-complete + 'ess-use-company + 'ess-eval-visibly-p + 'ess-can-eval-in-background + 'ess-local-process-name) + nil + (lambda () + ;;(goto-char (point-max)) + (rfc822-goto-eoh) + (forward-line 1) + (insert "\n\n-------------------------------------------------------\n") + (insert "This bug report will be sent to the ESS bugs email list\n") + (insert "Press C-c C-c when you are ready to send your message.\n") + (insert "-------------------------------------------------------\n\n") + (insert (with-current-buffer ess-dribble-buffer + (goto-char (point-max)) + (forward-line -100) + (buffer-substring-no-properties (point) (point-max)))))))) + + + +;;; Timer + +(defcustom ess-idle-timer-interval 1 + "Number of seconds to wait before running function in `ess-idle-timer-functions'." + :type '(integer) + :group 'ess) + +(defvar ess-idle-timer-functions nil + "A list of functions to run each `ess-idle-timer-interval' idle seconds. +If your function calls the process, you better use +`ess-when-new-input' to wrap your call. If you call the +subprocess please respect `ess-can-eval-in-background' variable. + +These functions are run with `run-hooks'. Use `add-hook' to add +symbols to this variable. + +Most likely you will need a local hook. Then you should specify +the LOCAL argument to `add-hook' and initialize it in +`ess-mode-hook' or `ess-post-run-hook', or one of the more +specialized hooks `ess-r-post-run-hook',`ess-stata-post-run-hook' +etc.") + +(defun ess--idle-timer-function nil + "Internal function executed by `ess--idle-timer'." + (run-hooks 'ess-idle-timer-functions)) + +(require 'timer) +(defvar ess--idle-timer + (run-with-idle-timer ess-idle-timer-interval 'repeat 'ess--idle-timer-function) + "Timer used to run `ess-idle-timer-functions'.") + + +;;; Dispatch on ess-dialect +;; Inspired by major-mode specializer in cl-generic.el + +;; FIXME: Implement a notion of derived dialects. major-mode specializer cannot +;; be used here as we need same dialect in different major-modes. + +;; Two parts: +;; 1) first define a specializer (ess-dialect= DIALECT) to match symbols +;; representing ess dialects. +;; 2) then define a context-rewriter so you can write +;; `&context (ess-dialect "R")` rather than +;; `&context (ess-dialect (ess-dialect= "R"))`. + +(cl-generic-define-generalizer ess--generic-dialect-generalizer + 95 + (lambda (name &rest _) `(if (stringp ,name) (intern ,name) + (if (symbolp ,name) ,name))) + (lambda (tag &rest _) `((ess-dialect= ,tag)))) + +(cl-defmethod cl-generic-generalizers ((_specializer (head ess-dialect=))) + "Support for (ess-dialect DIALECT) context specializer." + (list ess--generic-dialect-generalizer)) + +(cl-generic-define-context-rewriter ess-dialect (dialect) + `(ess-dialect (ess-dialect= ,(if (stringp dialect) + (intern dialect) + dialect)))) + +;; (cl-defgeneric ess-print-dialect () +;; (error "unknown dialect %s" ess-dialect)) +;; (cl-defmethod ess-print-dialect (&context (ess-dialect "R")) +;; (message "dialect: R")) +;; (cl-defmethod ess-print-dialect (&context (ess-dialect "julia")) +;; (message "dialect: julia")) (provide 'ess) diff -Nru ess-18.10.2/lisp/ess-font-lock.el ess-18.10.2+git20220915.f45542e/lisp/ess-font-lock.el --- ess-18.10.2/lisp/ess-font-lock.el 2018-11-10 09:41:11.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/lisp/ess-font-lock.el 1970-01-01 00:00:00.000000000 +0000 @@ -1,151 +0,0 @@ -;;; ess-font-lock.el --- font-lock color options - -;; Copyright (C) 2000--2006 A.J. Rossini, Richard M. Heiberger, Martin -;; Maechler, Kurt Hornik, Rodney Sparapani, and Stephen Eglen. - -;; Author: Richard M. Heiberger -;; Created: 06 Feb 2000 - -;; Keywords: languages, faces - -;; This file is part of ESS - -;; This file is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 2, or (at your option) -;; any later version. -;; -;; This file is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. -;; -;; A copy of the GNU General Public License is available at -;; https://www.r-project.org/Licenses/ - -;;; Commentary: - -;; provides syntax highlighting support. - -;;; Code: - - ; Requires and autoloads - -(require 'font-lock) -(require 'paren) - -;; FIXME: What is this doing here!? -(if (fboundp 'show-paren-mode) (show-paren-mode 1)) - -;;; Emacs 20.x notes: - -;; font-lock faces are defined in /emacs/emacs-20.5/lisp/font-lock.el -;; The font-lock faces are applied to ESS buffers by -;; ess-mode.el ess-inf.el ess-trns.el ess-custom.el -;; The keywords for faces are defined in the ess[dl]*.el files. -;; All faces can be looked at, under Emacs 20.x, with -;; [menu-bar] [Edit] [Text Properties] [Display Faces} - -(defun ess-font-lock-rmh () - "Set font-lock colors to Richard Heiberger's usual choice." - ;; FIXME: Turn it into a Custom theme! - (interactive) - - (set-foreground-color "Black") - (set-background-color "lightcyan") - - (set-face-background 'mode-line "lightskyblue") - (set-face-foreground 'mode-line "midnightblue") - - (set-face-foreground 'font-lock-comment-face "Firebrick") - (set-face-foreground 'font-lock-function-name-face "Blue") - (set-face-foreground 'font-lock-keyword-face "Purple") - (set-face-foreground 'font-lock-constant-face "Brown") - (set-face-foreground 'font-lock-string-face "VioletRed") - (set-face-foreground 'font-lock-type-face "Sienna") - (set-face-foreground 'font-lock-variable-name-face "Black")) - -(defun ess-font-lock-blue () - "Set font-lock colors to Richard Heiberger's blue color scheme." - ;; FIXME: Turn it into a Custom theme! - (interactive) - - (set-foreground-color "Black") - (set-background-color "LightBlue") - - (set-face-foreground 'mode-line "LightBlue") - (set-face-background 'mode-line "DarkSlateBlue") - - (set-face-foreground 'font-lock-comment-face "Firebrick") - (set-face-foreground 'font-lock-function-name-face "Blue") - (set-face-foreground 'font-lock-keyword-face "Purple") - (set-face-foreground 'font-lock-constant-face "Brown") - (set-face-foreground 'font-lock-string-face "VioletRed") - (set-face-foreground 'font-lock-type-face "Sienna") - (set-face-foreground 'font-lock-variable-name-face "Black")) - -(defun ess-font-lock-wheat () - "Set font-lock colors to Richard Heiberger's wheat color scheme." - ;; FIXME: Turn it into a Custom theme! - (interactive) - - (set-foreground-color "Black") - (set-background-color "Wheat") - - (set-face-foreground 'mode-line "Wheat") - (set-face-background 'mode-line "Sienna") - - (set-face-foreground 'font-lock-comment-face "Firebrick") - (set-face-foreground 'font-lock-function-name-face "Blue") - (set-face-foreground 'font-lock-keyword-face "Purple") - (set-face-foreground 'font-lock-constant-face "Brown") - (set-face-foreground 'font-lock-string-face "VioletRed") - (set-face-foreground 'font-lock-type-face "Sienna") - (set-face-foreground 'font-lock-variable-name-face "Black")) - - -(defun ess-font-lock-bw () - "Set font-lock colors to Richard Heiberger's black and white color scheme." - ;; FIXME: Turn it into a Custom theme! - (interactive) - - (set-foreground-color "Black") - (set-background-color "white") - - (set-face-foreground 'mode-line "gray10") - (set-face-background 'mode-line "gray90") - - ;; modify-face is an interactive compiled Lisp function in `faces'. - ;; Sample usage: - - ;;(modify-face FACE FOREGROUND BACKGROUND STIPPLE BOLD-P ITALIC-P UNDERLINE-P &optional INVERSE-P FRAME) - - (modify-face 'mode-line "gray10" "gray90" nil nil t nil ) - (modify-face 'font-lock-comment-face "black" "white" nil nil t nil ) - (modify-face 'font-lock-function-name-face "black" "white" nil t nil nil ) - (modify-face 'font-lock-keyword-face "black" "white" nil nil nil t ) - (modify-face 'font-lock-constant-face "black" "white" nil t nil nil ) - (modify-face 'font-lock-string-face "black" "white" nil nil t t ) - (modify-face 'font-lock-type-face "black" "white" nil t t nil ) - (modify-face 'font-lock-variable-name-face "black" "white" nil nil nil nil ) - (modify-face 'font-lock-builtin-face "black" "white" nil t nil nil ) - (modify-face 'font-lock-warning-face "black" "white" nil t nil nil ) - (modify-face 'show-paren-match-face "gray20" "gray80" nil t nil nil ) - (modify-face 'show-paren-mismatch-face "white" "gray40" nil t t nil )) - -(defun ess-font-lock-db () - "Set font-lock colors (leave fore-/back-ground alone) courtesy David Brahm " - ;; FIXME: Turn it into a Custom theme! - (interactive) - (set-face-foreground 'font-lock-comment-face "Firebrick") ; #... %... - (set-face-foreground 'font-lock-string-face "SeaGreen") ; "..." "..." - (set-face-foreground 'font-lock-keyword-face "MediumBlue") ; if \end - (set-face-foreground 'font-lock-function-name-face "VioletRed") ; talk<- {center} - (set-face-foreground 'font-lock-variable-name-face "Blue") ; xv - (set-face-foreground 'font-lock-type-face "Goldenrod") ; T,F ? - (set-face-foreground 'font-lock-constant-face "Magenta") ; <- {eq1} - ) - -(provide 'ess-font-lock) - -;;; ess-font-lock.el ends here diff -Nru ess-18.10.2/lisp/ess-generics.el ess-18.10.2+git20220915.f45542e/lisp/ess-generics.el --- ess-18.10.2/lisp/ess-generics.el 2018-11-10 09:41:11.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/lisp/ess-generics.el 1970-01-01 00:00:00.000000000 +0000 @@ -1,109 +0,0 @@ -;;; ess-generics.el --- Mode-generic functions -;; -;; Copyright (C) ESS-core -;; Maintainer: ESS-core -;; -;; 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 -;; https://www.r-project.org/Licenses/ -;; -;;; Comment -;; -;; Define generic method with `ess-defgeneric' and dialect specific override with -;; `ess-defmethod`. Current implementation is using `{name}-function' and -;; `ess-customize-alist' as the backbone mechanism. This might change in the -;; future. -;; -;;; Code - -(defun ess-generics--override (name args body) - (let ((funname (intern (format "%s-function" name))) - (arg-list (delq '&rest (delq '&optional (copy-alist args))))) - `(if (fboundp ,funname) - ,(if (memq '&rest args) - `(apply ,funname ,@arg-list) - `(funcall ,funname ,@arg-list)) - ,@(or body - `((error (format "`%s' is not implemented for dialect `%s'" - ',name ess-dialect))))))) - -(defun ess-generics--expand-overrides (name args body) - ;; ripped off from `mode-local--expand-overrides' - (let ((forms body) - (ditto t) - form xbody) - (while forms - (setq form (car forms)) - (cond - ((atom form)) - ((eq (car form) :override) - (setq form (ess-generics--override name args (cdr form)))) - ((eq (car form) :override-with-args) - (setq form (ess-generics--override name (cadr form) (cddr form)))) - ((setq form (ess-generics--expand-overrides name args form)))) - (setq ditto (and ditto (eq (car forms) form)) - xbody (cons form xbody) - forms (cdr forms))) - (if ditto body (nreverse xbody)))) - -;;;###autoload -(defmacro ess-defgeneric (name args docstring &rest body) - "Define a new function, as with `defun', which can be overloaded. -NAME is the name of the function to create. ARGS are the -arguments to the function. DOCSTRING is a documentation string to -describe the function. The docstring will automatically have -details about its overload symbol appended to the end. BODY is -code that would be run when there is no override defined. The -default is to signal error if {name}-function is not defined." - (declare (doc-string 3) (indent defun) (debug defun)) - (let ((funname (intern (format "%s-function" name)))) - `(eval-and-compile - (defvar-local ,funname nil ,(format "When defined this function is called by `%s'." name)) - (defun ,name ,args ,(format "%s\n\nUse `ess-defmethod' to define dialect specific overrides." docstring) - ,@(ess-generics--expand-overrides name args body))))) - -(defmacro ess-defmethod (dialect name args &rest body) - "Define a dialect specific override of the method NAME. -If NAME wasn't created with `ess-defgeneric' signal an -error. DIALECT is the dialect name this override is being defined -for. ARGS are the function arguments, which should match those of -the same named function created with `ess-defgeneric'. BODY is the -implementation of this function." - (declare (indent defun) (debug (&define sexp sexp lambda-list def-body))) - (let ((new-name (intern (format "%s:%s" name dialect))) - (fun-name (intern (format "%s-function" name))) - (alist-name (intern (downcase (format "ess-%s-customize-alist" dialect))))) - `(eval-and-compile - (unless (boundp ',alist-name) - (defvar ,alist-name nil - ,(format "Variables to customize dialect '%s'." dialect))) - (add-to-list ',alist-name - '(,fun-name . ',new-name)) - (defun ,new-name ,args - ,(format "%s\nThis is an override for `%s' for `%s' dialect." - ;; fixme: NAME might be undefined as yet. Look at help-fns-describe-function-functions - (or (and (fboundp name) - (documentation name) - ;; hackish - (replace-regexp-in-string "\nUse.*ess-defmethod.*\\." "" (documentation name))) - "") - name dialect) - ;; The body for this implementation - ,@body) - ;; For find-func to locate the definition of NEW-NAME. - (put ',new-name 'definition-name ',name)))) - - - -(provide 'ess-generics) diff -Nru ess-18.10.2/lisp/ess-gretl.el ess-18.10.2+git20220915.f45542e/lisp/ess-gretl.el --- ess-18.10.2/lisp/ess-gretl.el 2018-11-10 09:41:11.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/lisp/ess-gretl.el 2022-10-15 08:06:36.000000000 +0000 @@ -1,48 +1,38 @@ -;; ess-gretl.el --- ESS gretl mode and inferior interaction -;; -;; Copyright (C) 2012 Allin Cottrell -;; Copyright (C) 2012 Ahmadou DICKO -;; Copyright (C) 2013 ESS core team -;; -;; Filename: ess-gretl.el -;; Author: Ahmadou DICKO, Spinu Vitalie and Allin Cottrell (based on ess-julia.el and gretl.el) -;; Maintainer: Ahmadou DICKO +;; ess-gretl.el --- ESS gretl mode and inferior interaction -*- lexical-binding: t; -*- + +;; Copyright (C) 2012-2020 Free Software Foundation, Inc. +;; Author: Ahmadou Dicko, Spinu Vitalie and Allin Cottrell +;; Maintainer: ESS Core Team ;; Created: 01-10-2012 (ESS 12.09) -;; Keywords: ESS, gretl, econometrics -;; -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; -;; This file is *NOT* part of GNU Emacs. -;; This file is *NOT YET* part of ESS -;; -;; This program is free software; you can redistribute it and/or -;; modify it under the terms of the GNU General Public License as -;; published by the Free Software Foundation; either version 3, any later version. -;; -;; This program is distributed in the hope that it will be useful, but WITHOUT -;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -;; FOR A PARTICULAR PURPOSE. See the GNU General Public License for more -;; details. -;; -;; A copy of the GNU General Public License is available at -;; https://www.r-project.org/Licenses/ -;; -;; -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; This file is part of GNU Emacs. + +;;; License: ;; +;; This program is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. +;; +;; This program is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. +;; +;; You should have received a copy of the GNU General Public License +;; along with this program. If not, see +;; + ;;; Commentary: ;; start the inferior with M-x gretl. -;; -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; + +;;; Code: + (require 'compile); for compilation-* below (require 'ess-r-mode) -;;; Code: -(defvar gretl-mode-hook nil) -(add-to-list 'auto-mode-alist '("\\.inp$" . gretl-mode)) +(add-to-list 'auto-mode-alist '("\\.inp\\'" . ess-gretl-mode)) (defvar gretl-syntax-table @@ -78,16 +68,16 @@ (modify-syntax-entry ?\# "<" table) (modify-syntax-entry ?\n ">" table) table) - "Syntax table for `gretl-mode'.") + "Syntax table for `ess-gretl-mode'.") ;; syntax table that holds within strings -(defvar gretl-mode-string-syntax-table +(defvar ess-gretl-mode-string-syntax-table (let ((table (make-syntax-table))) table) - "Syntax table for `gretl-mode' that holds within strings.") + "Syntax table for `ess-gretl-mode' that holds within strings.") (defcustom gretl-continuation-offset 4 - "*Extra indentation applied to Gretl continuation lines." + "Extra indentation applied to Gretl continuation lines." :type 'integer :group 'ess-gretl) @@ -95,7 +85,7 @@ "[^#%\n]*\\(\\\\\\|\\.\\.\\.\\)\\s-*\\(\\s<.*\\)?$") (defcustom gretl-continuation-string "\\" - "*Character string used for Gretl continuation lines. Normally \\." + "Character string used for Gretl continuation lines. Normally \\." :type 'string :group 'ess-gretl) @@ -114,25 +104,25 @@ ;; "Regexp for function names") (defvar gretl-command-words - '("add" "adf" "anova" "append" "ar" "ar1" "arbond" "arch" - "arima" "biprobit" "break" "boxplot" "chow" "clear" "coeffsum" "coint" - "coint2" "corr" "corrgm" "cusum" "data" "dataset" "delete" "diff" - "difftest" "discrete" "dpanel" "dummify" "duration" "elif" "else" "end" - "endif" "endloop" "eqnprint" "equation" "estimate" "fcast" "foreign" "fractint" - "freq" "function" "funcerr" "garch" "genr" "gmm" "gnuplot" "graphpg" - "hausman" "heckit" "help" "hsk" "hurst" "if" "include" "info" - "intreg" "kalman" "kpss" "labels" "lad" "lags" "ldiff" "leverage" - "levinlin" "logistic" "logit" "logs" "loop" "mahal" "makepkg" "meantest" - "mle" "modeltab" "modprint" "modtest" "mpols" "negbin" "nls" "normtest" - "nulldata" "ols" "omit" "open" "orthdev" "outfile" "panel" "pca" - "pergm" "textplot" "poisson" "print" "printf" "probit" "pvalue" "quantreg" - "qlrtest" "qqplot" "quit" "rename" "reset" "restrict" "rmplot" "run" - "runs" "scatters" "sdiff" "set" "setinfo" "setobs" "setmiss" "shell" - "smpl" "spearman" "sprintf" "square" "sscanf" "store" "summary" "system" - "tabprint" "tobit" "tsls" "var" "varlist" "vartest" "vecm" "vif" - "wls" "xcorrgm" "xtab" "debug" "return" "catch" "for" "foreach" - "funcerr" "return" "while" "elif" "const" "3sls" "liml" "fiml" - "sur" "params" "deriv" "orthog" "weights" "series" "scalar" "genr") + '("add" "adf" "anova" "append" "ar" "ar1" "arbond" "arch" + "arima" "biprobit" "break" "boxplot" "chow" "clear" "coeffsum" "coint" + "coint2" "corr" "corrgm" "cusum" "data" "dataset" "delete" "diff" + "difftest" "discrete" "dpanel" "dummify" "duration" "elif" "else" "end" + "endif" "endloop" "eqnprint" "equation" "estimate" "fcast" "foreign" "fractint" + "freq" "function" "funcerr" "garch" "genr" "gmm" "gnuplot" "graphpg" + "hausman" "heckit" "help" "hsk" "hurst" "if" "include" "info" + "intreg" "kalman" "kpss" "labels" "lad" "lags" "ldiff" "leverage" + "levinlin" "logistic" "logit" "logs" "loop" "mahal" "makepkg" "meantest" + "mle" "modeltab" "modprint" "modtest" "mpols" "negbin" "nls" "normtest" + "nulldata" "ols" "omit" "open" "orthdev" "outfile" "panel" "pca" + "pergm" "textplot" "poisson" "print" "printf" "probit" "pvalue" "quantreg" + "qlrtest" "qqplot" "quit" "rename" "reset" "restrict" "rmplot" "run" + "runs" "scatters" "sdiff" "set" "setinfo" "setobs" "setmiss" "shell" + "smpl" "spearman" "sprintf" "square" "sscanf" "store" "summary" "system" + "tabprint" "tobit" "tsls" "var" "varlist" "vartest" "vecm" "vif" + "wls" "xcorrgm" "xtab" "debug" "return" "catch" "for" "foreach" + "while" "const" "3sls" "liml" "fiml" + "sur" "params" "deriv" "orthog" "weights" "series" "scalar") "Commands in Gretl (these names are also reserved).") (defvar gretl-genr-functions @@ -167,58 +157,58 @@ (defvar gretl-option-flags - '("addstats" "all" "anova" "append" - "arch" "arma-init" "asymptotic" "autocorr" "auto" - "autocorr" "auxiliary" "balanced" "bartlett" - "between" "bootstrap" "both" "breusch-pagan" - "byobs" "by" "c" "close" - "coded" "cols" "column" "comfac" - "complete" "conditional" "contiguous" "continue" - "continuous" "control" "covariance" "cross" - "cross-section" "crt" "csv" "ct" - "ctt" "cubes-only" "dat" "database" - "dataset" "db" "degrees" "dhansen" - "difference" "diffuse" "discrete" "dpdstyle" - "drop-empty" "drop-first" "drop-last" "dummy" - "dynamic" "equal" "exit" "exponential" - "fcp" "fixed-effects" "from-file" "full" - "func" "gamma" "geomean" "gls" - "gmm" "gnu-R" "gnu-octave" "gph" - "gzipped" "hausman-reg" "hessian" "hilu" - "impulse-responses" "input" "inst" "integrate" - "intervals" "inverse-fit" "iterate" "jackknife" - "jbera" "jitter" "jmulti" "kendall" - "lags" "lagselect" "lbfgs" "lillie" - "liml" "linear-fit" "list" "loess-fit" - "log" "loglogistic" "lognormal" "logs" - "matrix" "matrix-diff" "medians" "ml" - "model1" "multi" "multinomial" "nc" - "next" "no-corc" "no-dates" "no-df-corr" - "no-gradient-check" "no-header" "no-missing" "no-scaling" - "no-stats" "normal" "normality" "notches" - "numerical" "odbc" "omit-obs" "one-scale" - "opg" "orthdev" "other" "out-of-sample" - "output" "overwrite" "p-values" "panel" - "panel-vars" "plot" "pooled" "preserve" - "print-final" "progress-bar" "progressive" "pwe" - "quadratic-fit" "quiet" "quit" "radians" - "random" "random-effects" "rank-sum" "raw" - "rc" "replace" "restrict" "restructure" - "reverse" "robust" "rolling" "row" - "rtf" "save" "save-all" "save-ehat" - "save-xbeta" "scalars" "seasonals" "send-data" - "sign" "signed-rank" "silent" "simple" - "simple-print" "single-yaxis" "skip-df" "spearman" - "special-time-series" "squares" "squares-only" "stacked-cross-section" - "stacked-time-series" "static" "stdresid" "suppress-fitted" - "swilk" "system" "t-ratios" "tall" - "test-down" "tex" "time-dummies" "time-series" - "to-file" "to_file" "traditional" "trend" - "two-step" "unequal-vars" "uniform" "unit-weights" - "variance-decomp" "vcv" "verbose" "wald" - "weibull" "weights" "white" "white-nocross" - "with-impulses" "with-lines" "write" "www" - "x-12-arima" "y-diff-only" "z-scores" "zeros") + '("addstats" "all" "anova" "append" + "arch" "arma-init" "asymptotic" "auto" + "autocorr" "auxiliary" "balanced" "bartlett" + "between" "bootstrap" "both" "breusch-pagan" + "byobs" "by" "c" "close" + "coded" "cols" "column" "comfac" + "complete" "conditional" "contiguous" "continue" + "continuous" "control" "covariance" "cross" + "cross-section" "crt" "csv" "ct" + "ctt" "cubes-only" "dat" "database" + "dataset" "db" "degrees" "dhansen" + "difference" "diffuse" "discrete" "dpdstyle" + "drop-empty" "drop-first" "drop-last" "dummy" + "dynamic" "equal" "exit" "exponential" + "fcp" "fixed-effects" "from-file" "full" + "func" "gamma" "geomean" "gls" + "gmm" "gnu-R" "gnu-octave" "gph" + "gzipped" "hausman-reg" "hessian" "hilu" + "impulse-responses" "input" "inst" "integrate" + "intervals" "inverse-fit" "iterate" "jackknife" + "jbera" "jitter" "jmulti" "kendall" + "lags" "lagselect" "lbfgs" "lillie" + "liml" "linear-fit" "list" "loess-fit" + "log" "loglogistic" "lognormal" "logs" + "matrix" "matrix-diff" "medians" "ml" + "model1" "multi" "multinomial" "nc" + "next" "no-corc" "no-dates" "no-df-corr" + "no-gradient-check" "no-header" "no-missing" "no-scaling" + "no-stats" "normal" "normality" "notches" + "numerical" "odbc" "omit-obs" "one-scale" + "opg" "orthdev" "other" "out-of-sample" + "output" "overwrite" "p-values" "panel" + "panel-vars" "plot" "pooled" "preserve" + "print-final" "progress-bar" "progressive" "pwe" + "quadratic-fit" "quiet" "quit" "radians" + "random" "random-effects" "rank-sum" "raw" + "rc" "replace" "restrict" "restructure" + "reverse" "robust" "rolling" "row" + "rtf" "save" "save-all" "save-ehat" + "save-xbeta" "scalars" "seasonals" "send-data" + "sign" "signed-rank" "silent" "simple" + "simple-print" "single-yaxis" "skip-df" "spearman" + "special-time-series" "squares" "squares-only" "stacked-cross-section" + "stacked-time-series" "static" "stdresid" "suppress-fitted" + "swilk" "system" "t-ratios" "tall" + "test-down" "tex" "time-dummies" "time-series" + "to-file" "to_file" "traditional" "trend" + "two-step" "unequal-vars" "uniform" "unit-weights" + "variance-decomp" "vcv" "verbose" "wald" + "weibull" "weights" "white" "white-nocross" + "with-impulses" "with-lines" "write" "www" + "x-12-arima" "y-diff-only" "z-scores" "zeros") "Gretl option flags.") (defvar gretl-internal-vars @@ -384,60 +374,34 @@ (defun gretl-indent-line () - "Indent current line of gretl code" + "Indent current line of gretl code." (interactive) - ; (save-excursion - (end-of-line) - (indent-line-to - (or (and (ess-inside-string-p (point-at-bol)) 0) - (save-excursion (ignore-errors (gretl-form-indent))) - (save-excursion - (let ((endtok (progn - (beginning-of-line) - (forward-to-indentation 0) - (gretl-at-keyword gretl-block-end-keywords)))) - (ignore-errors (+ (gretl-last-open-block (point-min)) - (if endtok (- gretl-basic-offset) 0))))) - ;; previous line ends in = - (save-excursion - (if (and (not (equal (point-min) (line-beginning-position))) - (progn - (forward-line -1) - (end-of-line) (backward-char 1) - (equal (char-after (point)) ?=))) - (+ gretl-basic-offset (current-indentation)) - nil)) - ;; take same indentation as previous line - (save-excursion (forward-line -1) - (current-indentation)) - 0)) - (when (gretl-at-keyword gretl-block-end-keywords) - (forward-word 1))) - - -(defvar gretl-editing-alist - '((paragraph-start . (concat "\\s-*$\\|" page-delimiter)) - (paragraph-separate . (concat "\\s-*$\\|" page-delimiter)) - (paragraph-ignore-fill-prefix . t) - (require-final-newline . mode-require-final-newline) - (comment-start . "# ") - (comment-add . 1) - (comment-start-skip . "\\s<+\\s-*") - (comment-column . 40) - ;;(comment-indent-function . 'S-comment-indent) - ;;(ess-comment-indent . 'S-comment-indent) - ;;(ess-indent-line . 'S-indent-line) - (ess-calculate-indent . 'ess-calculate-indent) - (ess-indent-line-function . 'gretl-indent-line) - (parse-sexp-ignore-comments . t) - (ess-style . ess-default-style) ;; ignored - (ess-local-process-name . nil) - ;;(ess-keep-dump-files . 'ask) - (ess-mode-syntax-table . gretl-syntax-table) - ;; (add-log-current-defun-header-regexp . "^.*function[ \t]*\\([^ \t(]*\\)[ \t]*(") - ) - "General options for gretl source files.") - + (end-of-line) + (indent-line-to + (or (and (ess-inside-string-p (point-at-bol)) 0) + (save-excursion (ignore-errors (gretl-form-indent))) + (save-excursion + (let ((endtok (progn + (beginning-of-line) + (forward-to-indentation 0) + (gretl-at-keyword gretl-block-end-keywords)))) + (ignore-errors (+ (gretl-last-open-block (point-min)) + (if endtok (- gretl-basic-offset) 0))))) + ;; previous line ends in = + (save-excursion + (if (and (not (equal (point-min) (line-beginning-position))) + (progn + (forward-line -1) + (end-of-line) (backward-char 1) + (equal (char-after (point)) ?=))) + (+ gretl-basic-offset (current-indentation)) + nil)) + ;; take same indentation as previous line + (save-excursion (forward-line -1) + (current-indentation)) + 0)) + (when (gretl-at-keyword gretl-block-end-keywords) + (forward-word 1))) ;; (defun gretl-send-string-function (process string visibly) ;; (let ((gretl-process (get-process "gretlcli"))) @@ -450,8 +414,8 @@ ;; (insert string)) ;; (process-send-string process (format ess-load-command file)))) -(defun gretl--get-words-from-command (command start-reg end-reg) - (with-current-buffer (ess-command command) +(defun gretl--get-words-from-command (command start-reg end-reg proc) + (with-current-buffer (ess-command command nil nil nil nil proc) (goto-char (point-min)) (let ((beg (or (re-search-forward start-reg nil t) (point-min))) @@ -465,14 +429,14 @@ (push (match-string-no-properties 0) acum)) acum))) -(defun gretl-get-help-topics-function (name) +(cl-defmethod ess-help-get-topics (proc &context (ess-dialect "gretl")) (delete-dups (append gretl-command-words gretl-genr-functions gretl-block-end-keywords gretl-block-other-keywords gretl-block-start-keywords - (gretl--get-words-from-command "help\n" "are:" "^For") - (gretl--get-words-from-command "help functions\n" "Accessors:" "^Functions") - (gretl--get-words-from-command "help functions\n" "^Functions" "^For") + (gretl--get-words-from-command "help\n" "are:" "^For" proc) + (gretl--get-words-from-command "help functions\n" "Accessors:" "^Functions" proc) + (gretl--get-words-from-command "help functions\n" "^Functions" "^For" proc) ))) ;; (defvar ess-gretl-error-regexp-alist '(gretl-in gretl-at) @@ -489,10 +453,8 @@ (inferior-ess-primary-prompt . "\\? ") (inferior-ess-secondary-prompt . "\\ ") (inferior-ess-prompt . "\\? ") - (ess-local-customize-alist . 'gretl-customize-alist) + (ess-local-customize-alist . gretl-customize-alist) (inferior-ess-program . "gretlcli") - (ess-get-help-topics-function . 'gretl-get-help-topics-function) - (font-lock-defaults . '(gretl-font-lock-keywords)) (ess-load-command . "open \"%s\"\n") ;; (ess-dump-error-re . "in \\w* at \\(.*\\):[0-9]+") ;; (ess-error-regexp . "\\(^\\s-*at\\s-*\\(?3:.*\\):\\(?2:[0-9]+\\)\\)") @@ -505,10 +467,8 @@ (ess-dialect . "gretl") (ess-suffix . "inp") (ess-dump-filename-template . (replace-regexp-in-string - "S$" ess-suffix ; in the one from custom: - ess-dump-filename-template-proto)) - (ess-mode-syntax-table . gretl-syntax-table) - (ess-mode-editing-alist . gretl-editing-alist) + "S$" ess-suffix ; in the one from custom: + ess-dump-filename-template-proto)) (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) @@ -516,15 +476,12 @@ (ess-object-name-db-file . "ess-r-namedb.el" ) ;; (ess-imenu-mode-function . nil) (ess-smart-operators . ess-r-smart-operators) - (inferior-ess-help-filetype . nil) (inferior-ess-exit-command . "exit\n") ;;harmful for shell-mode's C-a: -- but "necessary" for ESS-help? - (inferior-ess-start-file . nil) ;; "~/.ess-R" - (inferior-ess-start-args . "") (inferior-ess-language-start . nil) (ess-STERM . "iESS") ) - "Variables to customize for Gretl -- set up later than emacs initialization.") + "Variables to customize for Gretl -- set up later than Emacs initialization.") ;; (defcustom inferior-gretl-program "gretlcli" ;; "*The program to use for running gretl scripts." @@ -538,42 +495,34 @@ ;; command for that version of Julia is made available. ") (defcustom inferior-gretl-args "" - "String of arguments used when starting gretl. -These arguments are currently not passed to other versions of gretl that have -been created using the variable `ess-r-versions'." + "String of arguments used when starting gretl." :group 'ess-gretl :type 'string) ;;;###autoload -(defun gretl-mode (&optional proc-name) +(define-derived-mode ess-gretl-mode ess-mode "ESS[gretl]" "Major mode for editing gretl source. See `ess-mode' for more help." - (interactive "P") - ;; (setq ess-customize-alist gretl-customize-alist) ;;(setq imenu-generic-expression R-imenu-generic-expression) - (ess-mode gretl-customize-alist proc-name) - ;; for emacs < 24 - ;; (add-hook 'comint-dynamic-complete-functions 'ess-complete-object-name nil 'local) - ;; for emacs >= 24 - ;; (remove-hook 'completion-at-point-functions 'ess-filename-completion 'local) ;; should be first - ;; (add-hook 'completion-at-point-functions 'ess-object-completion nil 'local) - ;; (add-hook 'completion-at-point-functions 'ess-filename-completion nil 'local) - (if (fboundp 'ess-add-toolbar) (ess-add-toolbar)) - (set (make-local-variable 'end-of-defun-function) 'ess-end-of-function) - ;; (local-set-key "\t" 'gretl-indent-line) ;; temp workaround - ;; (set (make-local-variable 'indent-line-function) 'gretl-indent-line) - ;; (ess-imenu-gretl) - (run-mode-hooks 'gretl-mode-hook)) + (ess-setq-vars-local gretl-customize-alist) + (setq font-lock-defaults `(,gretl-font-lock-keywords)) + (setq-local paragraph-start (concat "\\s-*$\\|" page-delimiter)) + (setq-local paragraph-separate (concat "\\s-*$\\|" page-delimiter)) + (setq-local paragraph-ignore-fill-prefix t) + (setq-local comment-start "# ") + (setq-local comment-add 1) + (setq-local comment-start-skip "\\s<+\\s-*") + (setq-local comment-column 40) + (setq-local indent-line-function #'gretl-indent-line) + (setq-local ess-local-customize-alist gretl-customize-alist) + (when (fboundp 'ess-add-toolbar) (ess-add-toolbar))) (defvar ess-gretl-post-run-hook nil - "Functions run in process buffer after the initialization of - Gretl process.") - - + "Functions run in process buffer after Gretl starts.") ;;;###autoload (defun gretl (&optional start-args) - "Call 'gretl', + "Call `gretl', Optional prefix (C-u) allows to set command line arguments, such as --vsize. This should be OS agnostic. If you have certain command line arguments that should always be passed @@ -582,30 +531,29 @@ ;; get settings, notably inferior-ess-r-program : ;; (if (null inferior-gretl-program) ;; (error "'inferior-gretl-program' does not point to 'gretl-release-basic' executable") - (setq ess-customize-alist gretl-customize-alist) (ess-write-to-dribble-buffer ;; for debugging only (format "\n(Gretl): ess-dialect=%s, buf=%s" ess-dialect (current-buffer))) (let* ((r-start-args - (concat inferior-gretl-args " " ; add space just in case - (if start-args - (read-string - (concat "Starting Args [other than `" - inferior-gretl-args - "'] ? ")) - nil)))) - (inferior-ess r-start-args) - (set (make-local-variable 'indent-line-function) 'gretl-indent-line) - (set (make-local-variable 'gretl-basic-offset) 4) + (concat inferior-gretl-args " " ; add space just in case + (if start-args + (read-string + (concat "Starting Args [other than `" + inferior-gretl-args + "'] ? ")) + nil))) + (inf-buf (inferior-ess r-start-args gretl-customize-alist))) + (setq-local indent-line-function 'gretl-indent-line) + (setq-local gretl-basic-offset 4) (setq indent-tabs-mode nil) (goto-char (point-max)) ;; (if inferior-ess-language-start ;; (ess-eval-linewise inferior-ess-language-start ;; nil nil nil 'wait-prompt))) - (with-ess-process-buffer nil + (with-current-buffer inf-buf (run-mode-hooks 'ess-gretl-post-run-hook)) - )) + inf-buf)) ;;;; IMENU @@ -643,8 +591,5 @@ (provide 'ess-gretl) -;; (provide 'ess-gretl) - -(provide 'ess-gretl) ;;; ess-gretl.el ends here diff -Nru ess-18.10.2/lisp/ess-help.el ess-18.10.2+git20220915.f45542e/lisp/ess-help.el --- ess-18.10.2/lisp/ess-help.el 2018-11-10 09:41:11.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/lisp/ess-help.el 2022-10-15 08:06:36.000000000 +0000 @@ -1,53 +1,61 @@ -;;; ess-help.el --- Support for viewing ESS help files +;;; ess-help.el --- Support for viewing ESS help files -*- lexical-binding: t; -*- -;; 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 . -;; Copyright (C) 2001--2010 A.J. Rossini, Richard M. Heiberger, Martin -;; Maechler, Kurt Hornik, Rodney Sparapani, and Stephen Eglen. -;; Copyright (C) 2011--2012 A.J. Rossini, Richard M. Heiberger, Martin Maechler, -;; Kurt Hornik, Rodney Sparapani, Stephen Eglen and Vitalie Spinu. +;; Copyright (C) 1989-2020 Free Software Foundation, Inc. ;; Author: David Smith ;; Created: 7 Jan 1994 ;; Maintainer: ESS-core -;; This file is part of ESS +;; This file is part of GNU Emacs. -;; This file is free software; you can redistribute it and/or modify +;;; License: +;; +;; This program is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 2, or (at your option) -;; any later version. - -;; This file is distributed in the hope that it will be useful, +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. +;; +;; This program is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. - -;; A copy of the GNU General Public License is available at -;; https://www.r-project.org/Licenses/ +;; +;; You should have received a copy of the GNU General Public License +;; along with this program. If not, see +;; ;;; Commentary: ;; Code for dealing with ESS help files. See README. where -;; is one of `S', `SAS', `Stata'or `XLispStat'. +;; is one of `S', `SAS', `Stata' or `XLispStat'. ;;; Code: ; Requires and autoloads (require 'cl-lib) (eval-when-compile - (require 'tramp) - (require 'reporter)) + (require 'tramp)) (require 'info) (require 'ess-mode) (require 'ess-inf) (require 'ess-utils) +(require 'ansi-color) + +(declare-function ess-r-help-mode "ess-r-mode") +(declare-function ess-stata-help-mode "ess-stata-lang") + + +(defcustom ess-help-mode-hook nil + "Functions to call when entering `ess-help-mode'." + :group 'ess-hooks + :type 'hook) (defvar ess--help-frame nil "Stores the frame used for displaying R help buffers.") +(defvar ess-help--aliases-timeout 10 + "The large timeout is necessary for some users (#1025, #1081).") + ; ess-help-mode ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;; In this section: @@ -56,6 +64,11 @@ ;;;; * The major mode ess-help-mode ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +(cl-defgeneric ess--help-major-mode () + "Determine which help major mode to call, and call it. +Uses `ess-dialect' to determine the appropriate help mode." + (ess-help-mode)) + (defun ess--help-get-bogus-buffer-substring (buffer &optional nr-first) "Return non-nil if BUFFER looks like a bogus ESS help buffer. Return the pair (match-beg. match-end) which can be used in error @@ -99,75 +112,82 @@ buffer))) (buffer-list))) -(defvar ess-help-type nil - "Type of help file, help, index, vingettes etc. +(defvar-local ess-help-type nil + "Type of help file, help, index, vignettes etc. Local in `ess-help' buffers.") -(make-variable-buffer-local 'ess-help-type) -(defvar ess-help-object nil +(defvar-local ess-help-object nil "Name of the object the help is displayed for. Is name of the package for package index. Local in `ess-help' buffers.") -(make-variable-buffer-local 'ess-help-object) +(put 'ess-help-object 'permanent-local t) -;;;###autoload (defun ess-display-help-on-object (object &optional command) - "Display documentation for OBJECT in another window. -If prefix arg is given, force an update of the cached help topics + "Display documentation for OBJECT. +If prefix ARG is given, force an update of the cached help topics and query the ESS process for the help file instead of reusing an existing buffer if it exists. Uses the variable `inferior-ess-help-command' for the actual help command. Prompts for the object name based on the cursor location for all cases except the S-Plus GUI. With S-Plus on Windows (both GUI and in an inferior Emacs buffer) the GUI help window is used. If COMMAND is -suplied, it is used instead of `inferior-ess-help-command'." +supplied, it is used instead of `inferior-ess-help-command'." (interactive (progn (ess-force-buffer-current) - (when current-prefix-arg ;update cache if prefix - (ess-process-put 'sp-for-help-changed? t)) + (when current-prefix-arg + (ess-help--reset-cache)) (list (ess-find-help-file "Help on")))) - (if (fboundp ess-display-help-on-object-function) - (funcall ess-display-help-on-object-function object command) - (let* ((hb-name (concat "*help[" ess-current-process-name "](" - (replace-regexp-in-string "^\\?\\|`" "" object) ")*")) - (old-hb-p (get-buffer hb-name)) - (tbuffer (get-buffer-create hb-name))) - (when (or (not old-hb-p) - current-prefix-arg - (ess--help-get-bogus-buffer-substring old-hb-p)) - (ess-with-current-buffer tbuffer - (setq ess-help-object object - ess-help-type 'help) - (setq buffer-read-only t) - (ess--flush-help-into-current-buffer object command))) - (unless (ess--help-kill-bogus-buffer-maybe tbuffer) - (ess--switch-to-help-buffer tbuffer))))) + (let* ((hb-name (concat "*help[" ess-current-process-name "](" + (replace-regexp-in-string "^\\?\\|`" "" object) ")*")) + (old-hb-p (get-buffer hb-name)) + (tbuffer (get-buffer-create hb-name))) + (when (or (not old-hb-p) + (ess-process-get 'sp-for-help-changed?) + (ess--help-get-bogus-buffer-substring old-hb-p)) + (ess-with-current-buffer tbuffer + (ess--flush-help-into-current-buffer object command) + (setq ess-help-object object) + (ess--help-major-mode) + (setq truncate-lines nil + ess-help-type 'help))) + (unless (ess--help-kill-bogus-buffer-maybe tbuffer) + (ess-display-help tbuffer)))) + +(defun ess-help--reset-cache () + "Reset all cached help files." + (ess-process-put 'sp-for-help-changed? t) + (ess-help--reset-cache-override)) + +(cl-defgeneric ess-help--reset-cache-override ()) + +(defun ess-help-revert-buffer (_ignore-auto _noconfirm) + "Revert the current help buffer. +This reloads the documentation. IGNORE-AUTO and NOCONFIRM are +ignored." + (ess-process-put 'sp-for-help-changed? t) + (ess-display-help-on-object ess-help-object)) -;;;###autoload (defalias 'ess-help 'ess-display-help-on-object) -(defun ess-build-help-command (object) - (if (fboundp ess-build-help-command-function) - (funcall ess-build-help-command-function object) - ;; TODO-CLEANUP: Remove the inferior- prefix for consistency - (format inferior-ess-help-command object))) +(cl-defgeneric ess-build-help-command (object) + "Build a string command for retrieving help on OBJECT." + (format inferior-ess-help-command object)) -(defun ess--flush-help-into-current-buffer (object &optional command dont-ask) +(defun ess--flush-help-into-current-buffer (object &optional command) (let ((inhibit-modification-hooks t) (inhibit-read-only t)) (delete-region (point-min) (point-max)) - (ess-help-mode) (let ((command (if (and command (string-match-p "%s" command)) (format command object) command))) - (ess-command (or command (ess-build-help-command object)) (current-buffer))) + (ess-command (or command (ess-build-help-command object)) + (current-buffer))) (ess-help-underline) (unless (string= ess-language "STA") (ess-nuke-help-bs)) (goto-char (point-min)) - (set-buffer-modified-p 'nil) - (setq truncate-lines nil))) + (set-buffer-modified-p 'nil))) (defun ess--help-kill-bogus-buffer-maybe (buffer) "Internal, try to kill bogus BUFFER with message. Return t if killed." @@ -184,127 +204,92 @@ (kill-buffer buffer))))) (defun ess-display-help-in-browser () - "Displaying html help where available, using \\[browse-url]." + "Displaying HTML help where available, using \\[browse-url]." (interactive) - ;; Three ways to find html help, 1) ask sub-process 2) get url/file from subproces - ;; 3) call elisp function to get the file path - ;; For 2 and 3 call browse-url on the output - (let (com-html-help ;1) command for sub-process to trigger - ;help, must contain %s for help obj - com-get-file-path ;2) command for sub-process to return a - ; location for the help page, must - ; contain %s for help obj - fun-get-file-path ;3) elisp function to return the - ;location, gets one argument, help topic - not-implemented - ) - (cond - ((string-match "^R" ess-dialect) - (setq com-html-help "help('%s', help_type='html')\n")) - (t (setq not-implemented t)) - ) - (if not-implemented - (message "Sorry, not implemented for %s " ess-dialect) - (if (or (not ess-help-object) - (not (eq ess-help-type 'help))) - (message "No help topic found") - (if com-html-help - (ess-command (format com-html-help ess-help-object)) - (require 'browse-url) - (if com-get-file-path - (browse-url (car (ess-get-words-from-vector - (format com-get-file-path ess-help-object)))) - (when (functionp fun-get-file-path) - (browse-url (funcall fun-get-file-path ess-help-object))))))))) + (unless (string-match "^R" ess-dialect) + (user-error "Sorry, not implemented for %s " ess-dialect)) + (if (or (not ess-help-object) + (not (eq ess-help-type 'help))) + (message "No help topic found") + (ess-command (format "help('%s', help_type='html')\n" ess-help-object)))) (defun ess--button-action (&optional button) "Provide help on object at the beginning of line. It's intended to be used in R-index help pages. Load the package if necessary. It is bound to RET and C-m in R-index pages." - (interactive) (let* ((string (button-label button)) - (command (when (fboundp ess-build-help-command-function) - (funcall ess-build-help-command-function string)))) + (command (ess-build-help-command string))) (ess-display-help-on-object string command))) -(defun ess-display-package-index () +(cl-defgeneric ess-help-commands () + "Return an alist of dialect specific retriever commands. +Currently understood commands: +- package-for-object - command to get the package of current + help object +- packages - command to get a list of available + packages (REQUIRED) +- package-index - command to get the package index (REQUIRED) +- index-keyword-reg - regexp used to find keywords for linking in + index listing only (1st subexpression is used) +- index-start-reg - regexp from where to start searching for + keywords in index listing" + (user-error "Not implemented for %s " ess-dialect)) + +(cl-defmethod ess-help-commands (&context (ess-dialect "R")) + '((package-for-object . "sub('package:', '', .ess.findFUN('%s'))\n") + (packages . ".packages(all.available=TRUE)\n") + (package-index . ".ess.help(package='%s', help.type='text')\n") + (index-keyword-reg . "^\\([^ \t\n:]+\\)") + (index-start-reg . "^Index:"))) + +(defun ess-display-package-index (&optional package) "Prompt for package name and display its index." - (interactive) - (let ((object (buffer-name)) - (alist ess-local-customize-alist) - (pname ess-local-process-name) - pack buff all-packs not-implemented - ;; Available customization for ess languages/dialects: - com-package-for-object ;command to get the package of current help object - com-packages ;command to get a list of available packages (REQUIRED) - com-package-index ;command to get the package index (REQUIRED) - reg-keyword ;regexp used to find keywords for linking in index listing - ; only (1st subexpression is used) - reg-start ;regexp from where to start searching for keywords in index listing - ) - (cond - ((string-match "^R" ess-dialect) - ;; carefully using syntax to be parsed in old R versions (no '::', '_'): - (setq com-package-for-object "sub('package:', '', .ess.findFUN('%s'))\n" - com-packages ".packages(all.available=TRUE)\n" - com-package-index ".ess.help(package='%s', help.type='text')\n" - reg-keyword "^\\([^ \t\n:]+\\)" - reg-start "^Index:")) - ((string-match "julia" ess-dialect) - (setq com-packages "_ess_list_categories()\n" - com-package-index "_ess_print_index(\"%s\")\n" - reg-keyword "^\\(.*+\\):$*" - reg-start ":" - )) - (t (error "Not implemented for %s " ess-dialect))) - (when (and com-package-for-object - ess-help-object - (eq ess-help-type 'help)) - (setq pack (car (ess-get-words-from-vector - (format com-package-for-object ess-help-object))))) - (setq all-packs (ess-get-words-from-vector com-packages)) - (unless pack ;try symbol at point - (setq pack (car (member (ess-read-object-name-default) all-packs)))) - (setq pack (ess-completing-read "Index of" - all-packs nil nil nil nil pack)) + (interactive + (list (let* ((coms (ess-help-commands)) + (all-packs (ess-get-words-from-vector (cdr (assoc 'packages coms)))) + (pack (or (when (and ess-help-object + (cdr (assoc 'package-for-object coms)) + (eq ess-help-type 'help)) + (car (ess-get-words-from-vector + (format (cdr (assoc 'package-for-object coms)) + ess-help-object)))) + (car (member (ess-read-object-name-default) all-packs))))) + (ess-completing-read "Index of" all-packs nil nil nil nil pack)))) + (let ((coms (ess-help-commands))) (ess--display-indexed-help-page - (format com-package-index pack) - reg-keyword - (format "*help[%s](index:%s)*" ess-dialect pack) - 'index nil nil reg-start pack))) - -(defalias 'ess-display-index 'ess-display-package-index) -(make-obsolete 'ess-display-index 'ess-display-package-index "ESS[12.09]") + (format (cdr (assoc 'package-index coms)) package) + (cdr (assoc 'index-keyword-reg coms)) + (format "*help[%s](index:%s)*" ess-dialect package) + 'index nil nil (cdr (assoc 'index-start-reg coms)) package))) (defun ess--display-indexed-help-page (command item-regexp title help-type &optional action help-echo reg-start help-object) - "Internal function to display help pages with linked actions - ;; COMMAND to produce the indexed help page - ;; ITEM-REGEXP -- first subexpression is highlighted - ;; TITLE of the help page - ;; HELP-TYPE to be stored in `ess-help-type' local variable - ;; ACTION is a function with no argument (default is `ess--button-action') - ;; HELP-ECHO - ;; REG-START gives the start location from where to search linkifying" - (interactive) + "Internal function to display help pages with linked actions. +COMMAND to produce the indexed help page, +ITEM-REGEXP -- first subexpression is highlighted, +TITLE of the help page, +HELP-TYPE to be stored in `ess-help-type' local variable, +ACTION is a function with no argument (default is `ess--button-action'), +HELP-ECHO if given becomes the help-echo property of the button, +REG-START gives the start location from where to search linkifying, + and HELP-OBJECT becomes `ess-help-object'." (let ((inhibit-modification-hooks t) - (object (buffer-name)) (alist ess-local-customize-alist) (pname ess-local-process-name) (buff (get-buffer-create title))) - (with-current-buffer buff - (setq ess-help-object help-object) - (ess-setq-vars-local (eval alist)) - (setq ess-help-sec-regex "\\(^\\s-.*\n\\)\\|\\(^\n\\)" - ess-local-process-name pname) + (ess-with-current-buffer buff (setq buffer-read-only nil) (delete-region (point-min) (point-max)) - (ess-help-mode) - (ess-command command buff) + (setq ess-local-process-name pname) + (ess--help-major-mode) + (ess-setq-vars-local (eval alist)) + (setq ess-help-object help-object + ess-help-sec-regex "\\(^\\s-.*\n\\)\\|\\(^\n\\)") + (ess--foreground-command command buff) (ess-help-underline) (set-buffer-modified-p 'nil) (goto-char (point-min)) - (when reg-start ;; go to the beginning of listing + (when reg-start ;; go to the beginning of listing (re-search-forward reg-start nil t)) (when item-regexp ;;linkify the buffer @@ -316,15 +301,17 @@ 'help-object (buffer-substring-no-properties (match-beginning 1) (match-end 1)) 'follow-link t 'help-echo (or help-echo "help on object"))))) - ;; (save-excursion ;; why R places all these spaces? - ;; (goto-char (point-min)) - ;; (while (re-search-forward " \\{10,\\} *" nil t) - ;; (replace-match "\t\t\t"))) + (save-excursion ;; why R help adds all these spaces? + (goto-char (point-min)) + (when (re-search-forward "Index:\n\n" nil t) + (let ((beg (point))) + (forward-paragraph 1) + (align-regexp beg (point) "\\(\\s-+\\)")))) (setq buffer-read-only t) (setq ess-help-type help-type) (setq truncate-lines nil)) (unless (ess--help-kill-bogus-buffer-maybe buff) - (ess--switch-to-help-buffer buff)))) + (ess-display-help buff)))) (defun ess-display-help-apropos (&optional pattern) "Create an ess-apropos buffer with a *linked* list of apropos topics." @@ -362,7 +349,6 @@ "Provide help on object at the beginning of line. It's intended to be used in R-index help pages. Load the package if necessary. It is bound to RET and C-m in R-index pages." - (interactive) (let* ((string (button-label button)) (command (cond ((equal ess-dialect "R") @@ -376,238 +362,140 @@ With (prefix) ALL non-nil, use `vignette(*, all=TRUE)`, i.e., from all installed packages, which can be *very* slow." (interactive "P") - (cond - ((equal ess-dialect "R") (ess-R-display-vignettes all)) - (t (message "Sorry, not implemented for %s" ess-dialect)))) + (ess--display-vignettes-override all)) -(defun ess-R-display-vignettes (&optional all) - "Display R vignettes in ess-help-like buffer.. -With (prefix) ALL non-nil, use `vignette(*, all=TRUE)`, i.e., from all installed - packages, which can be *very* slow." - (interactive "P") - (let* ((vslist (with-current-buffer - (ess-command - (format ".ess_vignettes(%s)\n" (if all "TRUE" ""))) - (goto-char (point-min)) - (when (re-search-forward "(list" nil t) - (goto-char (match-beginning 0)) - (ignore-errors (eval (read (current-buffer))))))) - (proc-name ess-current-process-name) - (alist ess-local-customize-alist) - (remote (file-remote-p default-directory)) - (buff (get-buffer-create (format "*[%s]vignettes*" ess-dialect))) - (inhibit-modification-hooks t)) - (with-current-buffer buff - (setq buffer-read-only nil) - (delete-region (point-min) (point-max)) - (ess-setq-vars-local (eval alist)) - (setq ess-help-sec-regex "^\\w+:$" - ess-help-type 'vignettes - ess-local-process-name proc-name) - (ess-help-mode) - (set-buffer-modified-p 'nil) - (goto-char (point-min)) - (dolist (el vslist) - (let ((pack (car el))) - (insert (format "\n\n%s:\n\n" (propertize pack 'face 'underline))) - (dolist (el2 (cdr el)) - (let ((path (if remote - (with-no-warnings - ;; Have to wrap this in with-no-warnings because - ;; otherwise the byte compiler complains about - ;; calling tramp-make-tramp-file-name with an - ;; incorrect number of arguments on Both 26+ and 25 emacses. - (if (>= emacs-major-version 26) - (with-parsed-tramp-file-name default-directory nil - (tramp-make-tramp-file-name method user domain host port (nth 1 el2))) - (with-parsed-tramp-file-name default-directory nil - (tramp-make-tramp-file-name method user host (nth 1 el2))))) - (nth 1 el2)))) - (insert-text-button "Pdf" - 'mouse-face 'highlight - 'action (if remote - #'ess--action-open-in-emacs - #'ess--action-R-open-vignette) - 'follow-link t - 'vignette (file-name-sans-extension (nth 2 el2)) - 'package pack - 'help-echo (concat path "/doc/" (nth 2 el2))) - (insert " ") - (insert-text-button "Rnw" - 'mouse-face 'highlight - 'action #'ess--action-open-in-emacs - 'follow-link t - 'help-echo (concat path "/doc/" (nth 3 el2))) - (insert " ") - (insert-text-button "R" - 'mouse-face 'highlight - 'action #'ess--action-open-in-emacs - 'follow-link t - 'help-echo (concat path "/doc/" (nth 4 el2))) - (insert (format "\t%s\n" (nth 0 el2))))))) - (goto-char (point-min)) - (insert (propertize "\t\t**** Vignettes ****\n" 'face 'bold-italic)) - (unless (eobp) (delete-char 1)) - (setq buffer-read-only t)) - (ess--switch-to-help-buffer buff))) +(cl-defgeneric ess--display-vignettes-override (_all) + "Display vignettes for the current dialect. +See `ess-display-vignettes' for ALL." + (user-error "Sorry, not implemented for %s" ess-dialect)) (defun ess--action-open-in-emacs (pos) (display-buffer (find-file-noselect (get-text-property pos 'help-echo)))) (defun ess--action-R-open-vignette (pos) - (ess-command (format "vignette('%s', package='%s')\n" - (get-text-property pos 'vignette) - (get-text-property pos 'package)))) + (ess-eval-linewise (format "vignette('%s', package='%s')\n" + (get-text-property pos 'vignette) + (get-text-property pos 'package)))) (defalias 'ess-help-quit 'quit-window) (make-obsolete 'ess-help-quit 'quit-window "16.04") -(defun ess--find-displayed-help-window () - (catch 'win - (dolist (f (frame-list)) - (when (frame-visible-p f) - (dolist (w (window-list f)) - (when (eq (buffer-local-value 'major-mode (window-buffer w)) - 'ess-help-mode) - (throw 'win w))))))) - -(defun ess--switch-to-help-buffer (buff) - "Switch to an ESS help BUFF. -For internal use. Take into account variable `ess-help-own-frame'." - (if (eq ess-help-own-frame t) - ;; 0) always pop new frame - (let* ((frame (make-frame ess-help-frame-alist)) - (action `(display-buffer-same-window (reusable-frames . ,frame)))) - (ess--display-help buff frame action)) - (let ((help-win (or - ;; if this doc is already displayed, reuse - (get-buffer-window buff 'all-frames) - ;; if help window visible, reuse - (and ess-help-reuse-window - (ess--find-displayed-help-window))))) - (cond - ;; 1) existent help window lying somewhere; reuse - (help-win - (set-window-buffer help-win buff) - (let ((action '(display-buffer-reuse-window (reusable-frames . t)))) - (ess--display-help buff nil action))) - ;; 2) - ((eq ess-help-own-frame 'one) - (let* ((frame (if (frame-live-p ess--help-frame) - ess--help-frame - (make-frame ess-help-frame-alist))) - (action `(display-buffer-same-window (reusable-frames . ,frame)))) - (setq ess--help-frame frame) - (ess--display-help buff frame action))) - ;; 3) display help in other window - (t - (ess--display-help buff)))))) - -(defun ess--display-help (buff &optional frame action) - (let ((action (or action `(nil (reusable-frames . ,(or frame ess-display-buffer-reuse-frames)))))) - (when (and (framep frame) - (not (eq (selected-frame) frame))) - ;; VS[04-05-2018]: `display-buffer` framework has no satisfactory - ;; functionality to display buffers in selected windows. So, do some extra - ;; frame selection here. - (raise-frame frame) - (if ess-help-pop-to-buffer - (select-frame-set-input-focus frame) - (select-frame frame))) +(defun ess-display-help (buff) + "Display buffer BUFF. +If `ess-help-pop-to-buffer' is non-nil, call `pop-to-buffer', +otherwise call `display-buffer' to display the buffer. + +You may control how help buffers are displayed by EITHER setting +an entry in `display-buffer-alist' (see examples in info +node `(ess) Controlling buffer display') OR setting the +ESS-specific variables `ess-help-own-frame', +`ess-help-reuse-window', `ess-help-frame-alist', and +`ess-display-buffer-reuse-frames'." + (let* ((action (cond (ess-help-own-frame + '(display-buffer-reuse-window + display-buffer-use-some-frame + display-buffer-pop-up-frame)) + (ess-help-reuse-window + '(display-buffer-reuse-window + ess-display-buffer-reuse-mode-window + display-buffer-pop-up-window + display-buffer-use-some-window)) + (t '(display-buffer-pop-up-window + display-buffer-use-some-window)))) + (alist `((mode . (ess-help-mode ess-r-help-mode ess-stata-help-mode ess-julia-help-mode)) + (reusable-frames . ,ess-display-buffer-reuse-frames) + ;; `display-buffer-use-some-frame' uses this to + ;; determine whether to use the frame or not. + (frame-predicate . (lambda (f) + (when (equal ess-help-own-frame 'one) + ;; Note we're always returning + ;; nil for `ess-help-own-frame' t. + (frame-parameter f 'ess-help-frame)))) + ;; If `display-buffer' makes a new frame, these are + ;; given as frame parameters. + (pop-up-frame-parameters . ,(append ess-help-frame-alist + `((auto-hide-function . delete-frame) + (ess-help-frame . ,(equal ess-help-own-frame 'one))))))) + (display-alist `(,action . ,alist))) (if ess-help-pop-to-buffer - (pop-to-buffer buff action) - (display-buffer buff action)))) + (pop-to-buffer buff display-alist) + (display-buffer buff display-alist)))) -(defun ess-help-web-search () - "Search the web for documentation." - (interactive) - (ess-execute-dialect-specific ess-help-web-search-command "Search for: ")) +(defun ess-help-web-search (cmd) + "Search the web for documentation on CMD." + (interactive "sSearch for: ") + (ess--help-web-search-override cmd)) + +(cl-defgeneric ess--help-web-search-override (_cmd) + "Dialect-specific override for `ess-help-web-search', which see for CMD." + (error "Not implemented for %s" ess-dialect)) (defun ess-manual-lookup () - "Search manual for topic." + "Search manual for documentation." (interactive) - (ess-execute-dialect-specific ess-manual-lookup-command )) + (ess--manual-lookup-override)) -(defun ess-reference-lookup () - "Search manual for topic." - (interactive) - (ess-execute-dialect-specific ess-reference-lookup-command)) - -(defvar ess-help-sec-map nil "Sub-keymap for ESS help mode.") -;; this breaks "s ?" rather than to fix any (unbroken !) thing: -;; (make-variable-buffer-local 'ess-help-sec-map) +(cl-defgeneric ess--manual-lookup-override () + "Dialect-specific override for `ess-manual-lookup'." + (error "Not implemented for %s" ess-dialect)) (defvar ess-doc-map (let (ess-doc-map) (define-prefix-command 'ess-doc-map) - (define-key ess-doc-map "\C-e" 'ess-describe-object-at-point) - (define-key ess-doc-map "e" 'ess-describe-object-at-point) - (define-key ess-doc-map "\C-d" 'ess-display-help-on-object) - (define-key ess-doc-map "d" 'ess-display-help-on-object) - (define-key ess-doc-map "\C-i" 'ess-display-package-index) - (define-key ess-doc-map "i" 'ess-display-package-index) - (define-key ess-doc-map "\C-a" 'ess-display-help-apropos) - (define-key ess-doc-map "a" 'ess-display-help-apropos) - (define-key ess-doc-map "\C-v" 'ess-display-vignettes) - (define-key ess-doc-map "v" 'ess-display-vignettes) - (define-key ess-doc-map "\C-o" 'ess-display-demos) - (define-key ess-doc-map "o" 'ess-display-demos) - (define-key ess-doc-map "\C-w" 'ess-help-web-search) - (define-key ess-doc-map "w" 'ess-help-web-search) - (define-key ess-doc-map "\C-m" 'ess-manual-lookup) - (define-key ess-doc-map "m" 'ess-manual-lookup) - (define-key ess-doc-map "\C-r" 'ess-reference-lookup) - (define-key ess-doc-map "r" 'ess-reference-lookup) - ess-doc-map - ) + (define-key ess-doc-map "\C-e" #'ess-describe-object-at-point) + (define-key ess-doc-map "e" #'ess-describe-object-at-point) + (define-key ess-doc-map "\C-d" #'ess-display-help-on-object) + (define-key ess-doc-map "d" #'ess-display-help-on-object) + (define-key ess-doc-map "\C-i" #'ess-display-package-index) + (define-key ess-doc-map "i" #'ess-display-package-index) + (define-key ess-doc-map "\C-a" #'ess-display-help-apropos) + (define-key ess-doc-map "a" #'ess-display-help-apropos) + (define-key ess-doc-map "\C-v" #'ess-display-vignettes) + (define-key ess-doc-map "v" #'ess-display-vignettes) + (define-key ess-doc-map "\C-o" #'ess-display-demos) + (define-key ess-doc-map "o" #'ess-display-demos) + (define-key ess-doc-map "\C-w" #'ess-help-web-search) + (define-key ess-doc-map "w" #'ess-help-web-search) + (define-key ess-doc-map "\C-m" #'ess-manual-lookup) + (define-key ess-doc-map "m" #'ess-manual-lookup) + ess-doc-map) "ESS documentation map.") (defvar ess-help-mode-map - (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 (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) - (define-key map "h" 'ess-display-help-on-object) - (define-key map "w" 'ess-display-help-in-browser) - (define-key map "i" 'ess-display-package-index) - (define-key map "a" 'ess-display-help-apropos) - (define-key map "v" 'ess-display-vignettes) - ;; TODO: `electric mouse-2' - ;; (define-key map [mouse-2] 'ess-display-help-on-object) - (define-key map "l" 'ess-eval-line-visibly-and-step) - (define-key map "r" 'ess-eval-region-and-go) - (define-key map "f" 'ess-eval-function-or-paragraph-and-step) - (define-key map "n" 'ess-skip-to-next-section) - (define-key map "p" 'ess-skip-to-previous-section) - (define-key map "/" 'isearch-forward) - (define-key map "x" 'ess-kill-buffer-and-go) - (define-key map "k" 'kill-this-buffer) - (define-key map "?" 'ess-describe-help-mode) - ;;-- those should be "inherited" from ess-mode-map ( ./ess-mode.el ) - (define-key map "\C-c\C-s" 'ess-switch-process) - (define-key map "\C-c\C-r" 'ess-eval-region) - (define-key map "\C-c\M-r" 'ess-eval-region-and-go) - (define-key map "\C-c\C-f" 'ess-eval-function) - (define-key map "\M-\C-x" 'ess-eval-function) - (define-key map "\C-c\M-f" 'ess-eval-function-and-go) - (define-key map "\C-c\C-j" 'ess-eval-line) - (define-key map "\C-c\C-n" 'ess-eval-line-visibly-and-step) - (define-key map "\C-c\C-c" 'ess-eval-region-or-function-or-paragraph-and-step) - (define-key map [(control return)] 'ess-eval-region-or-line-visibly-and-step) - (define-key map "\C-c\M-j" 'ess-eval-line-and-go) - (define-key map "\M-\C-a" 'ess-goto-beginning-of-function-or-para) - (define-key map "\M-\C-e" 'ess-goto-end-of-function-or-para) - (define-key map "\C-c\C-y" 'ess-switch-to-ESS) - (define-key map "\C-c\C-z" 'ess-switch-to-end-of-ESS) - (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-* - (define-key map "\C-c\C-v" 'ess-display-help-on-object) - (define-key map "\C-c\C-k" 'ess-request-a-process) + (let ((map (make-keymap))) + (define-key map "\C-m" #'next-line) + (define-key map "h" #'ess-display-help-on-object) + (define-key map "w" #'ess-display-help-in-browser) + (define-key map "i" #'ess-display-package-index) + (define-key map "a" #'ess-display-help-apropos) + (define-key map "v" #'ess-display-vignettes) + (define-key map "l" #'ess-eval-line-visibly-and-step) + (define-key map "r" #'ess-eval-region-and-go) + (define-key map "f" #'ess-eval-function-or-paragraph-and-step) + (define-key map "n" #'ess-skip-to-next-section) + (define-key map "p" #'ess-skip-to-previous-section) + (define-key map "/" #'isearch-forward) + (define-key map "x" #'ess-kill-buffer-and-go) + (define-key map "k" #'kill-this-buffer) + (define-key map "\C-c\C-s" #'ess-switch-process) + (define-key map "\C-c\C-r" #'ess-eval-region) + (define-key map "\C-c\M-r" #'ess-eval-region-and-go) + (define-key map "\C-c\C-f" #'ess-eval-function) + (define-key map "\M-\C-x" #'ess-eval-function) + (define-key map "\C-c\M-f" #'ess-eval-function-and-go) + (define-key map "\C-c\C-j" #'ess-eval-line) + (define-key map "\C-c\C-n" #'ess-eval-line-visibly-and-step) + (define-key map "\C-c\C-c" #'ess-eval-region-or-function-or-paragraph-and-step) + (define-key map [(control return)] #'ess-eval-region-or-line-visibly-and-step) + (define-key map "\C-c\M-j" #'ess-eval-line-and-go) + (define-key map "\M-\C-a" #'ess-goto-beginning-of-function-or-para) + (define-key map "\M-\C-e" #'ess-goto-end-of-function-or-para) + (define-key map "\C-c\C-y" #'ess-switch-to-ESS) + (define-key map "\C-c\C-z" #'ess-switch-to-end-of-ESS) + (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-* + (define-key map "\C-c\C-v" #'ess-display-help-on-object) + (define-key map "\C-c\C-k" #'ess-request-a-process) (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) @@ -617,75 +505,48 @@ ;; One reason for the following menu is to the user about key strokes (defvar ess-help-mode-menu '("ESS-help" - ["Search Forward" isearch-forward t] - ["Next Section" ess-skip-to-next-section t] - ["Previous Section" ess-skip-to-previous-section t] - ["Help on Section Skipping" ess-describe-sec-map t] - ["Beginning of Buffer" beginning-of-buffer t] - ["End of Buffer" end-of-buffer t] + ["Search forward" isearch-forward t] + ["Next section" ess-skip-to-next-section t] + ["Previous section" ess-skip-to-previous-section t] + ["Help on section skipping" ess-describe-sec-map t] + ["Beginning of buffer" beginning-of-buffer t] + ["End of buffer" end-of-buffer t] "-" - ["Help on ..." ess-display-help-on-object t] + ["Help on ..." ess-display-help-on-object t] ["Apropos of ..." ess-display-help-apropos t] - ["Index of ..." ess-display-package-index t] - ["Vignettes" ess-display-vignettes t] - ["Open in Browser" ess-display-help-in-browser t] + ["Index of ..." ess-display-package-index t] + ["Vignettes" ess-display-vignettes t] + ["Open in browser" ess-display-help-in-browser t] "-" - ["Eval Line" ess-eval-line-and-step t] - ["Eval Paragraph & step" ess-eval-paragraph-and-step t] - ["Eval Region & Go" ess-eval-region-and-go t] - ["Switch to ESS Process" ess-switch-to-ESS t] - ["Switch to End of ESS Proc." ess-switch-to-end-of-ESS t] - ["Switch _the_ Process" ess-switch-process t] + ["Eval line" ess-eval-line-and-step t] + ["Eval paragraph & step" ess-eval-paragraph-and-step t] + ["Eval region & go" ess-eval-region-and-go t] + ["Switch to ESS process" ess-switch-to-ESS t] + ["Switch to end of ESS proc." ess-switch-to-end-of-ESS t] + ["Switch _the_ process" ess-switch-process t] "-" - ["Kill Buffer" kill-this-buffer t] - ["Kill Buffer & Go" ess-kill-buffer-and-go t] + ["Kill buffer" kill-this-buffer t] + ["Kill buffer & go" ess-kill-buffer-and-go t] "-" - ["Handy commands" ess-handy-commands t] - ["Describe ESS-help Mode" ess-describe-help-mode t]) - "Menu used in `ess-help-mode'.") - -(defun ess-help-mode () -;;; Largely ripped from more-mode.el, -;;; originally by Wolfgang Rupprecht wolfgang@mgm.mit.edu - "Mode for viewing ESS help files. -Use SPC and DEL to page back and forth through the file. -Use `n' and `p' to move to next and previous section, - `s' to jump to a particular section; `s ?' for help. -Use `q' to return to your ESS session; `x' to kill this buffer first. -The usual commands for evaluating ESS source are available. -Other keybindings are as follows: -\\{ess-help-mode-map}" - (interactive) - (setq major-mode 'ess-help-mode) - (setq mode-name "ESS Help") - (setq font-lock-mode nil) - (use-local-map ess-help-mode-map) - ;;; Keep out of the code. - (make-local-variable 'indent-tabs-mode) - (setq indent-tabs-mode nil) - (if ess-mode-syntax-table ;;set in advance by ess-setq-local - (set-syntax-table ess-mode-syntax-table)) - (require 'easymenu) - (easy-menu-define ess-help-mode-menu-map ess-help-mode-map - "Menu keymap for ess-help mode." ess-help-mode-menu) - ;; Add the keys for navigating among sections; this is done - ;; dynamically since different languages (e.g. S vs R) have different - ;; section headings. - (setq ess-help-sec-map (make-sparse-keymap)) - (setq-local show-trailing-whitespace nil) - (dolist (pair ess-help-sec-keys-alist) - (define-key ess-help-sec-map (char-to-string (car pair)) - 'ess-skip-to-help-section)) - (define-key ess-help-sec-map "?" 'ess-describe-sec-map) - (define-key ess-help-sec-map ">" 'end-of-buffer) - (define-key ess-help-sec-map "<" 'beginning-of-buffer) - (define-key ess-help-mode-map "s" ess-help-sec-map) - (run-mode-hooks 'ess-help-mode-hook)) + ["Handy commands" ess-handy-commands t]) + "Menu used in ess-help mode.") + +(easy-menu-define ess-help-mode-menu-map ess-help-mode-map + "Menu keymap for ess-help mode." ess-help-mode-menu) + +(define-derived-mode ess-help-mode special-mode "ESS Help" + "Mode for viewing ESS help files." + :group 'ess-help + ;; FIXME + ;; (if ess-mode-syntax-table ;;set in advance by ess-setq-local + ;; (set-syntax-table ess-mode-syntax-table)) + (setq-local revert-buffer-function #'ess-help-revert-buffer) + (setq show-trailing-whitespace nil)) ;;*;; User commands defined in ESS help mode -(defun ess-skip-to-help-section nil +(defun ess-skip-to-help-section () "Jump to a section heading of a help buffer. The section selected is determined by the command letter used to invoke the command, as indicated by `ess-help-sec-keys-alist'. @@ -693,35 +554,34 @@ sections." (interactive) (let ((old-point (point)) - (case-fold-search nil)) + (case-fold-search nil) + (the-sec (cdr (assoc last-command-event ess-help-sec-keys-alist)))) + (cl-assert the-sec nil (format "Invalid section key: %c" last-command-event)) (goto-char (point-min)) - (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) - (recenter) - (message "No %s section in this help. Sorry." the-sec) - (goto-char old-point)))))) + (if (re-search-forward (concat "^" the-sec) nil t) + (progn (recenter) + (beginning-of-line)) + (message "No %s section in this help. Sorry." the-sec) + (goto-char old-point)))) -(defun ess-skip-to-next-section nil +(defun ess-skip-to-next-section () "Jump to next section in ESS help buffer." (interactive) (let ((case-fold-search nil)) - (if (re-search-forward ess-help-sec-regex nil 'no-error) nil + (when (looking-at-p ess-help-sec-regex) + (forward-line)) + (if (re-search-forward ess-help-sec-regex nil 'no-error) + (beginning-of-line) (message "No more sections.")))) -(defun ess-skip-to-previous-section nil +(defun ess-skip-to-previous-section () "Jump to previous section in ESS help buffer." (interactive) (let ((case-fold-search nil)) - (if (re-search-backward ess-help-sec-regex nil 'no-error) nil + (if (re-search-backward ess-help-sec-regex nil 'no-error) + (beginning-of-line) (message "No previous section.")))) -(defun ess-describe-help-mode nil - "Display help for `ess-mode'." - (interactive) - (describe-function 'ess-help-mode)) - (defun ess-kill-buffer-and-go nil "Kill the current buffer and switch back to the ESS process." (interactive) @@ -746,10 +606,7 @@ (insert " " (car cs) " " - (cdr cs) "\n")) - (insert "\nFull list of key definitions:\n" - (substitute-command-keys - "\\{ess-help-sec-map}"))))) + (cdr cs) "\n"))))) (defun ess-helpobjs-at-point--read-obj () (let* ((obj (ess-read-object-name-default))) @@ -762,12 +619,11 @@ (substring object (match-end 0)) object)) -;;;###autoload (defun ess-helpobjs-at-point (slist) "Return a list (def obj fun). Obj is a name at point, fun is the name of the function call point is in, and def is either obj or fun (in that order) which -has a a help file, i.e. it is a member of slist (string-list). +has a a help file, i.e. it is a member of SLIST (string-list). nil otherwise." (let* ((obj (ess-helpobjs-at-point--read-obj)) (unqualified-obj (and obj (ess-unqualify-symbol obj))) @@ -786,22 +642,17 @@ (car (member fun slist))) obj fun))) +(cl-defgeneric ess-help-get-topics (proc) + "Return a list of help topics from PROC." + (user-error "Not supported for %s (process: %s)" ess-dialect proc)) + (defun ess-find-help-file (p-string) - "Find help, prompting for P-STRING. -Note that we can't search SAS, Stata or XLispStat for additional information." + "Find help, prompting for P-STRING." (ess-make-buffer-current) - (cond - ((fboundp ess-find-help-file-function) - (funcall ess-find-help-file-function p-string)) - ;; Fixme: Are `ess-find-help-file-function' and - ;; `ess-get-help-topics-function' redundant? - ((fboundp ess-get-help-topics-function) - (let* ((help-files-list (funcall ess-get-help-topics-function ess-current-process-name)) - (hlpobjs (ess-helpobjs-at-point help-files-list))) - (ess-completing-read p-string (append (delq nil hlpobjs) help-files-list) - nil nil nil nil (car hlpobjs)))) - (t - (read-string (format "%s: " p-string))))) + (let* ((help-files-list (ess-help-get-topics ess-current-process-name)) + (hlpobjs (delq nil (ess-helpobjs-at-point help-files-list)))) + (ess-completing-read p-string (append hlpobjs help-files-list) + nil nil nil nil (car hlpobjs)))) ;;*;; Utility functions @@ -821,13 +672,15 @@ ;; ess-command locks display, make sure the above message is visible (redisplay t) (ess-write-to-dribble-buffer "Processing RDS files ...\n") - (prog1 (ess-get-words-from-vector ".ess.getHelpAliases()\n") + ;; FIXME: This should be run asynchronously + (prog1 (ess-get-words-from-vector ".ess.getHelpAliases()\n" + nil nil nil ess-help--aliases-timeout) (message "Retrieving RDS aliases...done"))) (defun ess-nuke-help-bs () "Remove ASCII underlining and overstriking performed by ^H codes." ;; This function is a modification of nuke-nroff-bs in man.el from the - ;; standard emacs 18 lisp library. + ;; standard Emacs 18 lisp library. ;; Nuke underlining and overstriking (only by the same letter) (goto-char (point-min)) (while (search-forward "\b" nil t) @@ -865,21 +718,18 @@ (put-text-property (point) (1+ (point)) 'face 'underline)))) ;;*;; Link to Info -;;;###autoload (defun ess-goto-info (node) "Display node NODE from `ess-mode' info." (require 'info) (split-window) - ;;(other-window 1) (Info-goto-node (concat "(ess)" node))) ;; describe object at point -(defvar ess-describe-object-at-point-commands nil +(defvar-local ess-describe-object-at-point-commands nil "Commands cycled by `ess-describe-object-at-point'. Dialect specific.") -(make-variable-buffer-local 'ess-describe-at-point-commands) (defvar ess--descr-o-a-p-commands nil) @@ -890,11 +740,11 @@ This is an electric command (`ess--execute-electric-command'), which means that you can use the last key to cycle through the action set (in this case `C-e'). After invocation of this command -all standard Emacs commands, except those containing 'window' in +all standard Emacs commands, except those containing `window' in their names, remove the electric *ess-describe* buffer. Use `other-window' to switch to *ess-describe* window. -Customize `ess-describe-at-point-method' if you wan to display +Customize `ess-describe-at-point-method' if you want to display the description in a tooltip. See also `ess-r-describe-object-at-point-commands' (and similar option for other dialects)." @@ -906,7 +756,7 @@ (objname (or (and (use-region-p) (buffer-substring-no-properties (point) (mark))) (ess-symbol-at-point))) - bs ess--descr-o-a-p-commands) ;; used in ess--describe-object-at-point + ess--descr-o-a-p-commands) ;; used in ess--describe-object-at-point (unless objname (error "No object at point ")) (define-key map (vector last-command-event) 'ess--describe-object-at-point) ;; todo: put digits into the map @@ -922,11 +772,11 @@ (bufferp buf) (or (not (symbolp command)) ;; kill on lambdas (not (string-match "window" (symbol-name command))))) - (kill-buffer buf)) ;; bury does not work here :( (emacs bug?) + (kill-buffer buf)) ;; bury does not work here :( (Emacs bug?) (setq unread-command-events (append keys unread-command-events)))))) -(defun ess--describe-object-at-point (ev objname) +(defun ess--describe-object-at-point (_ev objname) (setq ess--descr-o-a-p-commands (or ess--descr-o-a-p-commands (symbol-value ess-describe-object-at-point-commands))) (let* ((com (format (car (pop ess--descr-o-a-p-commands)) objname)) @@ -944,7 +794,8 @@ (setq pos (point)) ;; set the keys that we are used to in help mode (special-mode) - (local-set-key "k" 'kill-this-buffer)) + (let ((inhibit-read-only t)) + (ansi-color-apply-on-region (point-min) (point-max)))) (if (eq ess-describe-at-point-method 'tooltip) (ess-tooltip-show-at-point (with-current-buffer buf (buffer-string)) 0 30) @@ -952,48 +803,61 @@ (set-window-point (get-buffer-window buf) pos) ;; don't move window point buf))) - -;;; Bug Reporting - -;;;###autoload -(defun ess-submit-bug-report () - "Submit a bug report to the ESS maintainers." - (interactive) - (require 'ess-mode) - (require 'reporter) - (let ((reporter-prompt-for-summary-p 't)) - (reporter-submit-bug-report - "ess-bugs@r-project.org" - (concat "ess-mode " (ess-version-string)) - (list 'ess-language - 'ess-dialect - 'ess-ask-for-ess-directory - 'ess-ask-about-transfile - 'default-directory - 'ess-keep-dump-files - 'ess-source-directory - 'ess-use-ido - 'ess-use-eldoc - 'ess-use-tracebug - 'ess-use-auto-complete - 'ess-use-company - 'ess-eval-visibly-p - 'ess-can-eval-in-background - 'ess-local-process-name) - nil - (lambda () - ;;(goto-char (point-max)) - (rfc822-goto-eoh) - (forward-line 1) - (insert "\n\n-------------------------------------------------------\n") - (insert "This bug report will be sent to the ESS bugs email list\n") - (insert "Press C-c C-c when you are ready to send your message.\n") - (insert "-------------------------------------------------------\n\n") - (insert (with-current-buffer ess-dribble-buffer - (goto-char (point-max)) - (forward-line -100) - (buffer-substring-no-properties (point) (point-max)))))))) - +(with-no-warnings + ;; We're just backporting here, don't care about compiler warnings + (defalias 'ess-display-buffer-reuse-mode-window + ;; TODO: Remove once we drop support for Emacs 25 + (if (fboundp 'display-buffer-reuse-mode-window) + 'display-buffer-reuse-mode-window + (lambda (buffer alist) + (let* ((alist-entry (assq 'reusable-frames alist)) + (alist-mode-entry (assq 'mode alist)) + (frames (cond (alist-entry (cdr alist-entry)) + ((if (eq pop-up-frames 'graphic-only) + (display-graphic-p) + pop-up-frames) + 0) + (display-buffer-reuse-frames 0) + (t (last-nonminibuffer-frame)))) + (inhibit-same-window-p (cdr (assq 'inhibit-same-window alist))) + (windows (window-list-1 nil 'nomini frames)) + (buffer-mode (with-current-buffer buffer major-mode)) + (allowed-modes (if alist-mode-entry + (cdr alist-mode-entry) + buffer-mode)) + (curwin (selected-window)) + (curframe (selected-frame))) + (unless (listp allowed-modes) + (setq allowed-modes (list allowed-modes))) + (let (same-mode-same-frame + same-mode-other-frame + derived-mode-same-frame + derived-mode-other-frame) + (dolist (window windows) + (let ((mode? + (with-current-buffer (window-buffer window) + (cond ((memq major-mode allowed-modes) + 'same) + ((derived-mode-p allowed-modes) + 'derived))))) + (when (and mode? + (not (and inhibit-same-window-p + (eq window curwin)))) + (push window (if (eq curframe (window-frame window)) + (if (eq mode? 'same) + same-mode-same-frame + derived-mode-same-frame) + (if (eq mode? 'same) + same-mode-other-frame + derived-mode-other-frame)))))) + (let ((window (car (nconc same-mode-same-frame + same-mode-other-frame + derived-mode-same-frame + derived-mode-other-frame)))) + (when (window-live-p window) + (prog1 (window--display-buffer buffer window 'reuse alist) + (unless (cdr (assq 'inhibit-switch-frame alist)) + (window--maybe-raise-frame (window-frame window)))))))))))) (provide 'ess-help) ;;; ess-help.el ends here diff -Nru ess-18.10.2/lisp/ess-inf.el ess-18.10.2+git20220915.f45542e/lisp/ess-inf.el --- ess-18.10.2/lisp/ess-inf.el 2018-11-10 09:41:11.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/lisp/ess-inf.el 2022-10-15 08:06:36.000000000 +0000 @@ -1,31 +1,28 @@ -;;; ess-inf.el --- Support for running S as an inferior Emacs process +;;; ess-inf.el --- Support for running S as an inferior Emacs process -*- lexical-binding: t; -*- -;; Copyright (C) 1989-1994 Bates, Kademan, Ritter and Smith -;; Copyright (C) 1997-1999 A.J. Rossini , -;; Martin Maechler . -;; Copyright (C) 2000--2010 A.J. Rossini, Richard M. Heiberger, Martin -;; Maechler, Kurt Hornik, Rodney Sparapani, and Stephen Eglen. -;; Copyright (C) 2011--2012 A.J. Rossini, Richard M. Heiberger, Martin Maechler, -;; Kurt Hornik, Rodney Sparapani, Stephen Eglen and Vitalie Spinu. +;; Copyright (C) 1989-2022 Free Software Foundation, Inc. ;; Author: David Smith ;; Created: 7 Jan 1994 ;; Maintainer: ESS-core -;; This file is part of ESS +;; This file is part of GNU Emacs. -;; This file is free software; you can redistribute it and/or modify +;;; License: +;; +;; This program is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 2, or (at your option) -;; any later version. - -;; This file is distributed in the hope that it will be useful, +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. +;; +;; This program is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. - -;; A copy of the GNU General Public License is available at -;; https://www.r-project.org/Licenses/ +;; +;; You should have received a copy of the GNU General Public License +;; along with this program. If not, see +;; ;;; Commentary: @@ -33,30 +30,81 @@ ;;; Code: - ; Requires and autoloads (eval-when-compile - (require 'tramp)) -(require 'ess-generics) + (require 'cl-lib) + (require 'tramp) + (require 'subr-x)) (require 'ess-utils) -(require 'newcomment) +(require 'ess) +(require 'ess-tracebug) + +(require 'ansi-color) (require 'comint) -(require 'overlay) (require 'compile) (require 'format-spec) -(require 'ess-tracebug) +(require 'overlay) +(require 'project) ;; Don't require tramp at run time. It's an expensive library to load. ;; Instead, guard calls with (require 'tramp) and silence the byte ;; compiler. -(declare-function tramp-sh-handle-expand-file-name "tramp-sh") -(declare-function tramp-dissect-file-name "tramp") -(declare-function tramp-tramp-file-p "tramp") - -;; TODO: refactor and remove file-local variable -;; byte-compile-warnings. See ess-r-mode.el also -(defvar proc) -(defvar start) -(defvar end) +(declare-function tramp-sh-handle-expand-file-name "tramp-sh" (name &optional dir)) +(declare-function tramp-dissect-file-name "tramp" (name &optional nodefault)) +(declare-function tramp-tramp-file-p "tramp" (name)) +(declare-function inferior-ess-r-mode "ess-r-mode" ()) +(declare-function inferior-ess-julia-mode "ess-julia" ()) +(declare-function inferior-ess-stata-mode "ess-stata-mode" ()) +(declare-function extract-rectangle-bounds "rect" (start end)) + +(declare-function ess-mode "ess-mode" ()) +(declare-function ess-complete-object-name "ess-r-completion" ()) +;; FIXME:This one should not be necessary +(declare-function ess-display-help-on-object "ess-help" (object &optional command)) +(declare-function ess-dump-object-into-edit-buffer "ess-mode" (object)) + +(defvar add-log-current-defun-header-regexp) + +;; The following declares can be removed once we drop Emacs 25 +(declare-function tramp-file-name-method "tramp") +(declare-function tramp-file-name-user "tramp") +(declare-function tramp-file-name-host "tramp") +(declare-function tramp-file-name-localname "tramp") +(declare-function tramp-file-name-hop "tramp") + +(defcustom inferior-ess-mode-hook nil + "Hook for customizing inferior ESS mode. +Called after `inferior-ess-mode' is entered and variables have +been initialized." + :group 'ess-hooks + :type 'hook) + +(defvar inferior-ess-mode-syntax-table + (let ((tab (copy-syntax-table comint-mode-syntax-table))) + tab) + "Syntax table for `inferior-ess-mode'.") + +(defun inferior-ess--set-major-mode (dialect) + "Set major mode according to DIALECT." + (cond ((string= "R" dialect) + (progn (require 'ess-r-mode) + (inferior-ess-r-mode))) + ((string= "julia" dialect) + (progn (require 'ess-julia) + (inferior-ess-julia-mode))) + ((string= "stata" dialect) + (progn (require 'ess-stata-mode) + (inferior-ess-stata-mode))) + ;; FIXME: we need this horrible hack so that + ;; inferior-ess-mode-syntax-table gets set for + ;; languages that still rely on the old way of doing + ;; things (before we used define-derived-mode for + ;; inferior modes). + (t + (progn + (setq-local inferior-ess-mode-syntax-table + (eval (or (alist-get 'inferior-ess-mode-syntax-table ess-local-customize-alist) + (alist-get 'ess-mode-syntax-table ess-local-customize-alist)))) + (inferior-ess-mode))))) ;;*;; Process handling @@ -70,7 +118,6 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;*;; Starting a process -;;;###autoload (defun ess-proc-name (n name) "Return name of process N, as a string, with NAME prepended. If `ess-plain-first-buffername', then initial process is number-free." @@ -79,15 +126,16 @@ (= n 1))) ; if not both first and plain-first add number (concat ":" (number-to-string n))))) -;;;###autoload -(defun inferior-ess (&optional ess-start-args customize-alist no-wait) - "Start inferior ESS process. +(defvar-local inferior-ess--local-data nil + "Program name and arguments used to start the inferior process.") +(defun inferior-ess (start-args customize-alist &optional no-wait) + "Start inferior ESS process. Without a prefix argument, starts a new ESS process, or switches -to the ESS process associated with the current buffer. With -ESS-START-ARGS (perhaps specified via \\[universal-argument]), -starts the process with those args. The current buffer is used -if it is an `inferior-ess-mode' or `ess-transcript-mode' buffer. +to the ESS process associated with the current buffer. With +START-ARGS (perhaps specified via \\[universal-argument]), starts +the process with those args. The current buffer is used if it is +an `inferior-ess-mode' or `ess-transcript-mode' buffer. If `ess-ask-about-transfile' is non-nil, you will be asked for a transcript file to use. If there is no transcript file, the @@ -95,14 +143,10 @@ `ess-gen-proc-buffer-name-function'. Takes the program name from the variable `inferior-ess-program'. -An initialization file (dumped into the process) is specified by -`inferior-ess-start-file', and `inferior-ess-start-args' is used -to accompany the call for `inferior-ess-program'. - -When creating a new process, the process buffer replaces the -current window if `inferior-ess-same-window' is non-nil. -Alternatively, it can appear in its own frame if -`inferior-ess-own-frame' is non-nil. + +See Info node `(ess)Customizing startup' and +`display-buffer-alist' to control where and how the buffer is +displayed. \(Type \\[describe-mode] in the process buffer for a list of commands.) @@ -110,193 +154,112 @@ CUSTOMIZE-ALIST is the list of dialect-specific variables. When non-nil, NO-WAIT tells ESS not to wait for the process to finish. This may be useful for debugging." - ;; Use the current buffer if it is in inferior-ess-mode or ess-trans-mode ;; If not, maybe ask about starting directory and/or transcript file. ;; If no transfile, use buffer *S* - ;; ;; This function is primarily used to figure out the Process and ;; buffer names to use for inferior-ess. - - ;; Once, long ago, it was used for switching buffers, but we don't - ;; do that any more (at least not from here). - - (interactive) - - (let* ((ess-customize-alist (or customize-alist - ess-customize-alist)) - (temp-ess-dialect (eval (cdr (assoc 'ess-dialect - ess-customize-alist)))) - (temp-ess-lang (eval (cdr (assoc 'ess-language - ess-customize-alist))))) - - (run-hooks 'ess-pre-run-hook) - (ess-write-to-dribble-buffer - (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) - ;; Use temp-ess-dialect if not R, R program name otherwise - (temp-dialect (if ess-use-inferior-program-in-buffer-name ;VS[23-02-2013]: fixme: this should not be here - (if (string-equal temp-ess-dialect "R") - (file-name-nondirectory inferior-ess-r-program) - temp-ess-dialect) - temp-ess-dialect)) - (temp-lang temp-ess-lang) - ;; 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)) - (cur-dir (inferior-ess--maybe-prompt-startup-directory procname temp-dialect)) - (default-directory cur-dir) - buf method) - (ess-write-to-dribble-buffer - (format "(inf-ess 1.1): procname=%s temp-dialect=%s, buf-name=%s \n" - procname temp-dialect buf-name-str)) - - (cond - ;; 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 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)) - (setq method 2)) - - ;; 3) Pick up a transcript file or create a new buffer - (t - (setq buf (if ess-ask-about-transfile - (let ((transfilename (read-file-name "Use transcript file (default none):" - cur-dir - ""))) - (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 cur-dir buf)) - - (set-buffer buf) - (set 'default-directory cur-dir) - (ess-setq-vars-local ess-customize-alist) - - (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))) - - (let* ((infargs (or ess-start-args - inferior-ess-start-args)) - (proc (get-process procname))) - ;; If ESS process NAME is running, switch to it - (if (and proc (comint-check-proc (process-buffer proc))) - (progn ;; fixme: when does this happen? -> log: - (ess-write-to-dribble-buffer (format "(inf-ess ..): popping to proc\n")) - (pop-to-buffer (process-buffer proc))) - - ;; Otherwise, crank up a new process - (let* ((symbol-string - (concat "inferior-" inferior-ess-program "-args")) - (switches-symbol (intern-soft symbol-string)) - (switches - (when (and switches-symbol (boundp switches-symbol)) - (symbol-value switches-symbol)))) - - (inferior-ess-mode) - (ess-write-to-dribble-buffer - (format "(inf-ess 3.0): prog=%s, start-args=%s, echoes=%s\n" - inferior-ess-program infargs comint-process-echoes)) - (setq ess-local-process-name procname) - (goto-char (point-max)) - - (when ess-history-file - ;; Load past history - (when (eq t ess-history-file) - (setq-local ess-history-file (concat "." ess-dialect "history"))) - (let ((histfile (expand-file-name ess-history-file - (or ess-history-directory cur-dir)))) - (when (file-readable-p histfile) - (setq comint-input-ring-file-name histfile) - (comint-read-input-ring)))) - - (with-current-buffer buf - (rename-buffer buf-name-str t)) - - ;; before the start, display the buffer depending on user settings: - (cond (inferior-ess-own-frame - (progn - (make-frame inferior-ess-frame-alist) - (switch-to-buffer buf))) - (inferior-ess-same-window - (switch-to-buffer buf)) - (t (pop-to-buffer buf))) - - ;; create the process - (setq buf - (if switches - (inferior-ess-make-comint buf-name-str - procname - infargs - switches) - (inferior-ess-make-comint buf-name-str - procname - infargs))) - - (set-buffer buf) - (set 'default-directory cur-dir) - - (setq proc (get-buffer-process buf)) - - ;; set the process sentinel to save the history - (set-process-sentinel proc 'ess-process-sentinel) - ;; add this process to ess-process-name-list, if needed - (let ((conselt (assoc procname ess-process-name-list))) - (unless conselt - (setq ess-process-name-list - (cons (cons procname nil) ess-process-name-list)))) - (ess-make-buffer-current) - (goto-char (point-max)) - (setq ess-sl-modtime-alist nil) - - ;; add the process filter to catch certain output - (set-process-filter proc 'inferior-ess-output-filter) - (inferior-ess-mark-as-busy proc) - - (unless no-wait - (ess-write-to-dribble-buffer "(inferior-ess: waiting for process to start (before hook)\n") - (ess-wait-for-process proc nil 0.01 t)) - - (unless (and proc (eq (process-status proc) 'run)) - (error "Process %s failed to start" procname)) - - ;; don't font-lock strings over process prompt - (set (make-local-variable 'syntax-begin-function) ;; fixme: obsolete in emacs 25.1 - #'inferior-ess-last-prompt-end) - (set (make-local-variable 'font-lock-fontify-region-function) - #'inferior-ess-fontify-region) - - (when ess-setwd-command - (ess-set-working-directory cur-dir)) - - (run-hooks 'ess-post-run-hook) - (ess-load-extras t) - - ;; user initialization can take some time ... - (unless no-wait - (ess-write-to-dribble-buffer "(inferior-ess 3): waiting for process after hook") - (ess-wait-for-process proc)))))))) + (run-hooks 'ess-pre-run-hook) + (let* ((dialect (eval (cdr (assoc 'ess-dialect customize-alist)))) + (process-environment process-environment) + ;; Use dialect if not R, R program name otherwise + (temp-dialect (if ess-use-inferior-program-in-buffer-name ;VS[23-02-2013]: FIXME: this should not be here + (if (string-equal dialect "R") + (file-name-nondirectory inferior-ess-r-program) + dialect) + dialect)) + (inf-buf (inferior-ess--get-proc-buffer-create temp-dialect)) + (proc-name (buffer-local-value 'ess-local-process-name inf-buf))) + (with-current-buffer inf-buf + ;; TODO: Get rid of this, we should rely on modes to set the + ;; variables they need. + (ess-setq-vars-local customize-alist) + (inferior-ess--set-major-mode ess-dialect) + ;; Set local variables after changing mode because they might + ;; not be permanent + (setq default-directory + (inferior-ess--maybe-prompt-startup-directory proc-name temp-dialect)) + (setq inferior-ess--local-data (cons inferior-ess-program start-args)) + ;; Read the history file + (when ess-history-file + (setq comint-input-ring-file-name + (expand-file-name (if (eql t ess-history-file) + (concat "." ess-dialect "history") + ess-history-file) + ess-history-directory)) + (comint-read-input-ring)) + ;; Show the buffer + ;; TODO: Remove inferior-ess-own-frame after ESS 19.04, then just have: + ;; (pop-to-buffer inf-buf) + (pop-to-buffer inf-buf (with-no-warnings + (when inferior-ess-own-frame + '(display-buffer-pop-up-frame)))) + (let ((proc (inferior-ess--start-process inf-buf proc-name start-args))) + (ess-make-buffer-current) + (goto-char (point-max)) + (unless no-wait + (ess-write-to-dribble-buffer "(inferior-ess: waiting for process to start (before hook)\n") + (ess-wait-for-process proc nil 0.01 t)) + (unless (and proc (eq (process-status proc) 'run)) + (error "Process %s failed to start" proc-name)) + (when ess-setwd-command + (ess-set-working-directory default-directory)) + (setq-local font-lock-fontify-region-function #'inferior-ess-fontify-region) + (setq-local ess-sl-modtime-alist nil) + (run-hooks 'ess-post-run-hook) + ;; User initialization can take some time ... + (unless no-wait + (ess-write-to-dribble-buffer "(inferior-ess 3): waiting for process after hook") + (ess-wait-for-process proc))) + inf-buf))) + +(defun inferior-ess--get-proc-buffer-create (name) + "Get a process buffer, creating a new one if needed. +This always returns a process-less buffer. The variable +`ess-local-process-name' is set in the buffer with the name of +the next process to spawn. This name may be different from the +buffer name, depending on how `ess-gen-proc-buffer-name-function' +generated the latter from NAME." + (let* ((proc-name (let ((ntry 1)) + ;; Find the next non-existent process N (*R:N*) + (while (get-process (ess-proc-name ntry name)) + (setq ntry (1+ ntry))) + (ess-proc-name ntry name))) + (inf-name (funcall ess-gen-proc-buffer-name-function proc-name))) + (let ((buf (cond + ;; Try to use current buffer, if inferior-ess-mode but + ;; no process + ((and (not (comint-check-proc (current-buffer))) + (derived-mode-p 'inferior-ess-mode)) + ;; Don't change existing buffer name in this case. It + ;; is very common to restart the process in the same + ;; buffer. + (setq proc-name ess-local-process-name) + (current-buffer)) + ;; Pick up a transcript file + (ess-ask-about-transfile + (let ((transfilename (read-file-name + "Use transcript file (default none):" nil ""))) + (if (string= transfilename "") + (get-buffer-create inf-name) + (find-file-noselect (expand-file-name transfilename))))) + ;; Create a new buffer or take the *R:N* buffer if + ;; already exists (it should contain a dead process) + (t + (get-buffer-create inf-name))))) + ;; We generated a new process name but there might still be a + ;; live process in the buffer in corner cases because of + ;; `ess-gen-proc-buffer-name-function` or if the user renames + ;; inferior buffers + (when (comint-check-proc buf) + (error "Can't start a new session in buffer `%s` because one already exists" + inf-name)) + (with-current-buffer buf + (setq-local ess-local-process-name proc-name)) + buf))) (defun ess--accumulation-buffer (proc) + "Return, creating if needed, the accumulation buffer for PROC." (let ((abuf (process-get proc :accum-buffer))) (if (buffer-live-p abuf) abuf @@ -307,40 +270,27 @@ (setq-local inhibit-modification-hooks t)) abuf)))) -(defvar inferior-ess-objects-command nil +(defvar-local inferior-ess-objects-command nil "The language/dialect specific command for listing objects. It is initialized from the corresponding inferior--objects-command and then made buffer local."); and the *--* ones are customized! -(make-variable-buffer-local 'inferior-ess-objects-command) -(defvar ess-save-lastvalue-command nil +(defvar-local ess-save-lastvalue-command nil "The command to save the last value. See S section for more details. Default depends on the ESS language/dialect and hence made buffer local") -(make-variable-buffer-local 'ess-save-lastvalue-command) -(defvar ess-retr-lastvalue-command nil +(defvar-local ess-retr-lastvalue-command nil "The command to retrieve the last value. See S section for more details. Default depends on the ESS language/dialect and hence made buffer local") -(make-variable-buffer-local 'ess-retr-lastvalue-command) -(defun inferior-ess-last-prompt-end (&optional pos limit) - "Move to the end of last prompt from POS, but not further than LIMIT." - (let ((pos (or pos (point)))) - (goto-char pos) - (end-of-line) - (when (re-search-backward inferior-ess-prompt limit t) - (goto-char (match-end 0))))) - -(defvar compilation--parsed) -(defvar ess--tb-last-input) -(defvar compilation--parsed) (defun inferior-ess-fontify-region (beg end &optional verbose) - "Fontify output by output to avoid fontification spilling over prompts." + "Fontify output by output to avoid fontification spilling over prompts. +BEG and END signify the bounds, VERBOSE gets passed to +`font-lock-default-fontify-region'." (let* ((buffer-undo-list t) (inhibit-point-motion-hooks t) (font-lock-dont-widen t) (font-lock-extend-region-functions nil) - (buff (current-buffer)) (pos1 beg) (pos2)) (when (< beg end) @@ -364,75 +314,183 @@ (format "*%s*" proc-name)) (defun ess-gen-proc-buffer-name:directory (proc-name) - "Function to generate buffer name by wrapping PROC-NAME in *PROC-NAME:DIR-NAME*. + "Return a buffer name by wrapping PROC-NAME in *PROC-NAME:DIR-NAME*. DIR-NAME is a short directory name. See `ess-gen-proc-buffer-name-function'." (format "*%s:%s*" proc-name (file-name-nondirectory (directory-file-name default-directory)))) (defun ess-gen-proc-buffer-name:abbr-long-directory (proc-name) - "Function to generate buffer name in the form *PROC-NAME:ABBREVIATED-LONG-DIR-NAME*. + "Return a buffer name in the form *PROC-NAME:ABBREVIATED-LONG-DIR-NAME*. PROC-NAME is a string representing an internal process name. ABBREVIATED-LONG-DIR-NAME is an abbreviated full directory name. Abbreviation is performed by `abbreviate-file-name'. See `ess-gen-proc-buffer-name-function'." (format "*%s:%s*" proc-name (abbreviate-file-name default-directory))) -(defun ess-gen-proc-buffer-name:projectile-or-simple (proc-name) - "Function to generate buffer name in the form *PROC-NAME:PROJECTILE-ROOT*. -PROC-NAME is a string representing an internal process -name. PROJECTILE-ROOT is directory name returned by -`projectile-project-p' if defined. If -`projectile-project-p' is undefined or no project directory -has been found use `ess-gen-proc-buffer-name:simple'. See +(defun ess-gen-proc-buffer-name:project-or-simple (proc-name) + "Function to generate buffer name in the form *PROC-NAME:PROJECT-ROOT*. +PROC-NAME is a string representing an internal process name. If +no project directory has been found use +`ess-gen-proc-buffer-name:simple'. See `ess-gen-proc-buffer-name-function'." - (let ((proj (and (fboundp 'projectile-project-p) - (projectile-project-p)))) - (if proj - (format "*%s:%s*" proc-name (file-name-nondirectory - (directory-file-name proj))) - (ess-gen-proc-buffer-name:simple proc-name)))) - -(defun ess-gen-proc-buffer-name:projectile-or-directory (proc-name) - "Function to generate buffer name in the form *PROC-NAME:PROJECTILE-ROOT*. -PROC-NAME is a string representing an internal process -name. PROJECTILE-ROOT is directory name returned by -`projectile-project-p' if defined. If -`projectile-project-p' is undefined, or no project directory -has been found, use `ess-gen-proc-buffer-name:directory'. See + (if-let ((p (project-current)) + (proj (ess--project-root p))) + (format "*%s:%s*" proc-name (file-name-nondirectory + (directory-file-name proj))) + (ess-gen-proc-buffer-name:simple proc-name))) + +(defun ess-gen-proc-buffer-name:project-or-directory (proc-name) + "Function to generate buffer name in the form *PROC-NAME:PROJECT-ROOT*. +PROC-NAME is a string representing an internal process name. +PROJECT-ROOT is directory name returned by `ess--project-root' if +defined. If no project directory has been found, use +`ess-gen-proc-buffer-name:directory'. See `ess-gen-proc-buffer-name-function'." - (let ((proj (and (fboundp 'projectile-project-p) - (projectile-project-p)))) - (if proj - (format "*%s:%s*" proc-name (file-name-nondirectory - (directory-file-name proj))) - (ess-gen-proc-buffer-name:directory proc-name)))) - -(defun inferior-ess-set-status (proc string &optional no-timestamp) - "Internal function to set the satus of the PROC. -If no-timestamp, don't set the last-eval timestamp. -Return the 'busy state." - ;; todo: do it in one search, use starting position, use prog1 - (let ((busy (not (string-match (concat "\\(" inferior-ess-primary-prompt "\\)\\'") string)))) - (process-put proc 'busy-end? (and (not busy) - (process-get proc 'busy))) - (when (not busy) + (if-let ((p (project-current)) + (proj (ess--project-root p))) + (format "*%s:%s*" proc-name (file-name-nondirectory + (directory-file-name proj))) + (ess-gen-proc-buffer-name:directory proc-name))) + +;; This ensures that people who have this set in their init file don't +;; get errors about undefined functions after upgrading ESS: +(define-obsolete-function-alias 'ess-gen-proc-buffer-name:projectile-or-simple + 'ess-gen-proc-buffer-name:project-or-simple "ESS 19.04") +(define-obsolete-function-alias 'ess-gen-proc-buffer-name:projectile-or-directory + 'ess-gen-proc-buffer-name:project-or-directory "ESS 19.04") + +(defun inferior-ess-available-p (&optional proc) + "Return non-nil if PROC is not busy." + (when-let ((proc (or proc (and ess-local-process-name + (get-process ess-local-process-name))))) + (unless (process-get proc 'busy) + (or (ess-debug-active-p proc) ; don't send empty lines in debugger + (when-let ((last-check (process-get proc 'last-availability-check))) + (time-less-p (process-get proc 'last-eval) last-check)) + (progn + ;; Send an empty string and waiting a bit to make sure we are not busy. + (process-send-string proc "\n") + (inferior-ess-mark-as-busy proc) + (process-put proc 'availability-check t) + ;; Start with a very conservative waiting time and quickly average + ;; down to the actual response. + (let ((avresp (or (process-get proc 'average-response-time) 0.1)) + (ts (current-time))) + (when (accept-process-output proc (max 0.005 (* 2.0 avresp))) + (let ((avresp (/ (+ (* 2.0 avresp) + (float-time (time-subtract (current-time) ts))) + 3.0))) + (process-put proc 'average-response-time avresp))) + (process-put proc 'last-availability-check ts)) + (not (process-get proc 'busy))))))) + +(defun inferior-ess--set-status (proc string) + "Internal function to set the status of process PROC. +Return non-nil if the process is in a ready (not busy) state." + ;; TODO: do it in one search, use starting position, use prog1 + (let ((ready (string-match-p (concat "\\(" inferior-ess-primary-prompt "\\)\\'") string))) + (process-put proc 'busy-end? (and ready (process-get proc 'busy))) + ;; When "\n" inserted from inferior-ess-available-p, delete the prompt. + (when (and ready + (process-get proc 'availability-check) + (string-match-p (concat "^" inferior-ess-primary-prompt "\\'") string)) + (process-put proc 'suppress-next-output? t)) + (process-put proc 'availability-check nil) + (when ready (process-put proc 'running-async? nil)) - (process-put proc 'busy busy) + (process-put proc 'busy (not ready)) (process-put proc 'sec-prompt (when inferior-ess-secondary-prompt (string-match (concat "\\(" inferior-ess-secondary-prompt "\\)\\'") string))) - (unless no-timestamp - (process-put proc 'last-eval (current-time))) - busy)) + ready)) + +(defun ess--command-delimited-output-info (buf delim) + "Detect positions of accumulated output. +Return positions after START, before END, after prompt. If any is +not found, returns nil. The last position marks the start of new +output, if any." + (with-current-buffer buf + (save-excursion + (save-match-data + (goto-char (point-min)) + (when (re-search-forward (ess--delimiter-start-re delim) nil t) + (let ((start (1+ (match-end 0)))) + (when (re-search-forward (ess--delimiter-end-re delim) nil t) + (when (not (equal (line-beginning-position) + (match-beginning 0))) + (error "Missing newline in command output")) + (let ((end (max (1- (match-beginning 0)) + start))) + (goto-char (1+ (match-end 0))) + (when (re-search-forward inferior-ess-primary-prompt nil t) + (let* ((prompt-end (match-end 0)) + (new (when (> (point-max) prompt-end) + prompt-end))) + (list start end new))))))))))) + +(defun ess--command-output-info (buf) + "Detect positions of accumulated output. +Like `ess--command-delimited-output-info' but detects prompts +without the benefit of output delimiters. This is much less +robust. This might leave parasite output at the start of BUF +(e.g. `+' prompts with multiline commands). The result might be +incomplete if the command output includes a line that ends with +`> ' and which happens to be the last characters in a partial +output (process output passed to filters is split in batches at +arbitrary locations). In that case the rest of the output will be +inserted in the process buffer instead of the command buffer." + (with-current-buffer buf + (save-excursion + (save-match-data + (goto-char (point-min)) + (when (re-search-forward (concat inferior-ess-primary-prompt + "\\(\n\\|\\'\\)") + nil t) + (goto-char (match-beginning 0)) + (let ((end (max (1- (line-beginning-position)) + (point-min))) + (new (when (> (point-max) (line-end-position)) + (1+ (line-end-position))))) + (list (point-min) end new))))))) + +;; Be careful that new output might come in after the closing +;; delimiter or prompt. This could happen when a background command is +;; interrupted asynchronously and the user has sent new inputs before +;; the process has finished interrupting. +(defun ess--command-set-status (proc buf info) + (with-current-buffer buf + (unwind-protect + (progn + (let* ((beg (nth 0 info)) + (end (nth 1 info)) + (new (nth 2 info)) + (output (buffer-substring beg end)) + (new-output (when new + (buffer-substring new (point-max))))) + ;; Delete the start delimiter and anything before it. + ;; This takes care of `+` continuation lines that occur + ;; with multi-line commands. Delete anything after the + ;; end delimiter, including the prompt and new output + (delete-region (point-min) (point-max)) + (insert output) + new-output)) + (process-put proc 'busy nil)))) + +(defun ess--delimiter-start-re (delim) + (concat "\\(" delim "-START$\\)")) + +(defun ess--delimiter-end-re (delim) + (concat "\\(" delim "-END\\)")) (defun inferior-ess-mark-as-busy (proc) + "Put PROC's busy value to t." (process-put proc 'busy t) (process-put proc 'sec-prompt nil)) (defun inferior-ess-run-callback (proc string) ;; callback is stored in 'callbacks proc property. Callbacks is a list that - ;; can contain either functions to be called with two artuments PROC and + ;; can contain either functions to be called with two arguments PROC and ;; STRING, or cons cells of the form (func . suppress). If SUPPRESS is non-nil ;; next process output will be suppressed. (unless (process-get proc 'busy) @@ -449,11 +507,12 @@ (when suppress (process-put proc 'suppress-next-output? t)) (process-put proc 'callbacks nil) - (condition-case err + (condition-case-unless-debug err (funcall cb proc string) (error (message "%s" (error-message-string err)))))))) (defun ess--if-verbose-write-process-state (proc string &optional filter) + "Write informaiton about PROC, STRING, and FILTER to the dribble buffer." (ess-if-verbose-write (format "\n%s: --> busy:%s busy-end:%s sec-prompt:%s interruptable:%s <-- @@ -479,11 +538,11 @@ Ring Emacs bell if process output starts with an ASCII bell, and pass the rest to `comint-output-filter'. Taken from octave-mod.el." - (inferior-ess-set-status proc string) + (inferior-ess--set-status proc string) (ess--if-verbose-write-process-state proc string) (inferior-ess-run-callback proc string) (if (process-get proc 'suppress-next-output?) - ;; works only for surpressing short output, for time being is enough (for callbacks) + ;; works only for suppressing short output, for time being is enough (for callbacks) (process-put proc 'suppress-next-output? nil) (comint-output-filter proc (inferior-ess-strip-ctrl-g string)))) @@ -499,84 +558,87 @@ string) (defun ess-process-sentinel (proc message) - "Sentinel for use with ESS processes. -This marks the process with a message, at a particular time point." - (save-excursion - (let ((abuf (process-get proc :accum-buffer))) - (when (buffer-live-p abuf) - (kill-buffer abuf))) - (setq message (substring message 0 -1)) ; strip newline - (set-buffer (process-buffer proc)) - (comint-write-input-ring) - (goto-char (point-max)) - (insert-before-markers - (format "\nProcess %s %s at %s\n" - (process-name proc) message (current-time-string))))) - -(defun inferior-ess-make-comint (bufname procname infargs &rest switches) - "Make an S comint process in buffer BUFNAME with process PROCNAME." -;;; This function is a modification of make-comint from the comint.el -;;; code of Olin Shivers. - (let* ((buffer (get-buffer-create bufname)) - (proc (get-process procname))) - ;; If no process, or nuked process, crank up a new one and put buffer in - ;; comint mode. Otherwise, leave buffer and existing process alone. - (cond ((or (not proc) (not (memq (process-status proc) '(run stop)))) - (with-current-buffer buffer - (if (eq (buffer-size) 0) nil - (goto-char (point-max)) - (insert "\^L\n"))) ; page boundaries = Interactive sessions - (let ((process-environment - (nconc - (list "STATATERM=emacs" - (format "PAGER=%s" inferior-ess-pager)) - process-environment)) - (tramp-remote-process-environment - (nconc ;; it contains a pager already, so append - (when (boundp 'tramp-remote-process-environment) - (copy-sequence tramp-remote-process-environment)) - (list "STATATERM=emacs" - (format "PAGER=%s" inferior-ess-pager))))) - (ess-write-to-dribble-buffer "Making Process...") - (ess-write-to-dribble-buffer - (format "Buf %s, :Proc %s, :Prog %s\n :Args= %s\nStart File=%s\n" - buffer - procname - inferior-ess-program - infargs - inferior-ess-start-file)) - (comint-exec buffer - procname - inferior-ess-program - inferior-ess-start-file - (ess-line-to-list-of-words - infargs))))) - buffer)) + "Sentinel for use with ESS processes PROC. +This marks the process with a MESSAGE, at a particular time point." + (let ((abuf (process-get proc :accum-buffer))) + (when (buffer-live-p abuf) + (kill-buffer abuf))) + (let ((pbuf (process-buffer proc))) + (when (buffer-live-p pbuf) + (with-current-buffer pbuf + (save-excursion + (setq message (substring message 0 -1)) ; strip newline + (set-buffer (process-buffer proc)) + (comint-write-input-ring) + (goto-char (point-max)) + (insert-before-markers + (format "\nProcess %s %s at %s\n" + (process-name proc) message (current-time-string)))))))) + +;; FIXME: This list is structured as '(("R:2") ("R")). It doesn't +;; appear the CDR are used. Can probably just be '("R:2" "R"). +(defvar ess-process-name-list nil + "Alist of active ESS processes.") + +(defun inferior-ess--start-process (buf proc-name switches) + "Make a comint process in buffer BUF with process PROC-NAME. +SWITCHES is passed to `comint-exec'. BUF is guaranteed to be a +process-less buffer because it was created with +`inferior-ess--get-proc-buffer-create'." + (with-current-buffer buf + (if (eq (buffer-size) 0) nil + (goto-char (point-max)) + (insert "\^L\n"))) + (let ((process-environment + (nconc + (list "STATATERM=emacs" + (format "PAGER=%s" inferior-ess-pager)) + process-environment)) + (tramp-remote-process-environment + (nconc ;; it contains a pager already, so append + (when (boundp 'tramp-remote-process-environment) + (copy-sequence tramp-remote-process-environment)) + (list "STATATERM=emacs" + (format "PAGER=%s" inferior-ess-pager))))) + (comint-exec buf + proc-name + inferior-ess-program + nil + (when switches + (split-string switches)))) + (let ((proc (get-buffer-process buf))) + ;; Set the process hooks + (set-process-sentinel proc 'ess-process-sentinel) + (set-process-filter proc 'inferior-ess-output-filter) + (inferior-ess-mark-as-busy proc) + ;; Add this process to ess-process-name-list, if needed + (let ((conselt (assoc proc-name ess-process-name-list))) + (unless conselt + (setq ess-process-name-list + (cons (cons proc-name nil) ess-process-name-list)))) + proc)) ;;*;; Requester functions called at startup - -;; 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 + "Return a startup directory." + (let ((dir (or (when (boundp 'ess-startup-directory) + (if (symbolp ess-startup-directory) + (symbol-value ess-startup-directory) + ess-startup-directory)) + (and ess-startup-directory-function + (funcall ess-startup-directory-function)) + (when-let ((proj (project-current))) + (ess--project-root proj)) default-directory))) (directory-file-name dir))) -(defun inferior-ess--maybe-prompt-startup-directory (procname dialect) +(defun inferior-ess--maybe-prompt-startup-directory (procname _dialect) "Possibly prompt for a startup directory. When `ess-ask-for-ess-directory' is non-nil, prompt. PROCNAME is the name of the inferior process (e.g. \"R:1\"), and DIALECT is the language dialect (e.g. \"R\")." - (let ((default-dir (if (fboundp 'inferior-ess-r--adjust-startup-directory) - (inferior-ess-r--adjust-startup-directory - (inferior-ess--get-startup-directory) dialect) - (inferior-ess--get-startup-directory)))) + (let ((default-dir (inferior-ess--get-startup-directory))) (if ess-ask-for-ess-directory (let ((prompt (format "%s starting project directory? " procname))) (ess-prompt-for-directory default-dir prompt)) @@ -594,31 +656,21 @@ ;;*;; General process handling code -(defmacro with-ess-process-buffer (no-error &rest body) - "Execute BODY in the process buffer of `ess-current-process-name'. -If NO-ERROR is t don't trigger error when there is not current -process. - -Symbol *proc* is bound to the current process during the evaluation of BODY." - (declare (indent 1) (debug t)) - `(let ((*proc* (and ess-local-process-name (get-process ess-local-process-name)))) - (if *proc* - (with-current-buffer (process-buffer *proc*) - ,@body) - (unless ,no-error - (error "No current ESS process"))))) (defmacro ess-with-current-buffer (buffer &rest body) "Like `with-current-buffer' but with transfer of some essential local ESS vars like `ess-local-process-name'." (declare (indent 1) (debug t)) (let ((lpn (make-symbol "lpn")) + (dialect (make-symbol "dialect")) (alist (make-symbol "alist"))) `(let ((,lpn ess-local-process-name) + (,dialect ess-dialect) (,alist ess-local-customize-alist)) (with-current-buffer ,buffer (ess-setq-vars-local (eval ,alist)) (setq ess-local-process-name ,lpn) + (setq ess-dialect ,dialect) ,@body)))) (dolist (mode '(emacs-lisp-mode lisp-interaction-mode)) @@ -635,43 +687,32 @@ default (USE-ANOTHER is nil), the connection to another process happens interactively (when possible)." (setq name (or name ess-local-process-name)) - (if (null name) ; should almost never happen at this point - (error "No ESS process is associated with this buffer now")) + (cl-assert name nil "No ESS process is associated with this buffer now") (update-ess-process-name-list) - (if (assoc name ess-process-name-list) - (get-process name) - ;; else : - ;; was (error "Process %s is not running" name) - (ess-write-to-dribble-buffer - (format "ess-get-process: process '%s' not running" name)) - (if (= 0 (length ess-process-name-list)) - (save-current-buffer - (ess-write-to-dribble-buffer - (format " .. restart proc %s for language %s (buf %s)\n" - name ess-language (current-buffer))) - (message "trying to (re)start process %s for language %s ..." - name ess-language) - (ess-start-process-specific ess-language ess-dialect) - ;; and return the process: "call me again" - (ess-get-process name)) - - ;; else: there are other running processes - (if use-another ; connect to another running process : the first one - (let ((other-name (car (elt ess-process-name-list 0)))) - ;; "FIXME": try to find the process name that matches *closest* - (message "associating with *other* process '%s'" other-name) - (ess-get-process other-name)) - ;; else - (ding) - (if (y-or-n-p - (format "Process %s is not running, but others are. Switch? " name)) - (progn - (ess-force-buffer-current - (concat ess-dialect " process to use: ") 'force) - (ess-get-process ess-current-process-name)) - (error "Process %s is not running" name)))))) + (cond ((assoc name ess-process-name-list) + (get-process name)) + ((= 0 (length ess-process-name-list)) + (save-current-buffer + (message "trying to (re)start process %s for language %s ..." + name ess-language) + (ess-start-process-specific ess-language ess-dialect) + ;; and return the process: "call me again" + (ess-get-process name))) + ;; else: there are other running processes + (use-another ; connect to another running process : the first one + (let ((other-name (car (elt ess-process-name-list 0)))) + ;; "FIXME": try to find the process name that matches *closest* + (message "associating with *other* process '%s'" other-name) + (ess-get-process other-name))) + ((and (not noninteractive) + (y-or-n-p + (format "Process %s is not running, but others are. Switch? " name))) + (ess-force-buffer-current (concat ess-dialect " process to use: ") 'force) + (ess-get-process ess-current-process-name)) + (t (error "Process %s is not running" name)))) (defun inferior-ess-default-directory () + "Return the `default-directory' of the process." (ess-get-process-variable 'default-directory)) ;;--- Unfinished idea (ESS-help / R-help ) -- probably not worth it... @@ -690,6 +731,8 @@ ;;*;; Multiple process handling code +;; FIXME: It seems the only effect of this function is to remove dead +;; processes from `ess-process-name-list'. Am I missing something? (defun ess-make-buffer-current nil "Make the process associated with the current buffer the current ESS process. Returns the name of the process, or nil if the current buffer has none." @@ -707,71 +750,65 @@ (with-current-buffer (process-buffer (ess-get-process ess-local-process-name)) (set var val))) -(defun ess-process-live-p () +(defun ess-process-live-p (&optional proc) "Check if the local ess process is alive. Return nil if current buffer has no associated process, or -process was killed." - (and ess-local-process-name - (let ((proc (get-process ess-local-process-name))) +process was killed. PROC defaults to `ess-local-process-name'" + (and (or proc ess-local-process-name) + (let ((proc (or proc (get-process ess-local-process-name)))) (and (processp proc) (process-live-p proc))))) -(defun ess-process-get (propname) - "Return the variable PROPNAME (symbol) from the plist of the current ESS process." - (process-get (get-process ess-local-process-name) propname)) - -(defun ess-process-put (propname value) - "Set the variable PROPNAME (symbol) to VALUE in the plist of the current ESS process." - (process-put (get-process ess-local-process-name) propname value)) +(defun ess-process-get (propname &optional proc) + "Return the variable PROPNAME (symbol) of the current ESS process. +PROC defaults to process with name `ess-local-process-name'." + (process-get (or proc (get-process ess-local-process-name)) propname)) + +(defun ess-process-put (propname value &optional proc) + "Set the variable PROPNAME (symbol) to VALUE in the current ESS process. +PROC defaults to the process given by `ess-local-process-name'" + (process-put (or proc (get-process ess-local-process-name)) propname value)) (defun ess-start-process-specific (language dialect) "Start an ESS process. -Typically from a language-specific buffer, using LANGUAGE (and DIALECT)." - (unless dialect - (error "The value of `dialect' is nil")) +Typically from a language-specific buffer, using DIALECT. +LANGUAGE is ignored." (save-current-buffer (let ((dsymb (intern dialect))) - (ess-write-to-dribble-buffer - (format " ..start-process-specific: lang:dialect= %s:%s, current-buf=%s\n" - language dialect (current-buffer))) - (cond ;; ((string= dialect "R") (R)) - ;; ((string= language "S") ; - ;; (message "ESS process not running, trying to start R, since language = 'S") - ;; (R)) - ;; ((string= dialect STA-dialect-name) (stata)) - ;;general case - ((fboundp dsymb) - (funcall dsymb)) - (t ;; else: ess-dialect is not a function - - ;; Typically triggered from - ;; ess-force-buffer-current("Process to load into: ") - ;; \--> ess-request-a-process("Process to load into: " no-switch) + (if (fboundp dsymb) + (funcall dsymb) (error "No ESS processes running; not yet implemented to start (%s,%s)" - language dialect))) - ;; save excursion is not working here !!! bad bad bad !! - ))) + language dialect))))) + +(defmacro ess--with-no-pop-to-buffer (&rest body) + "Disable some effects of `pop-to-buffer'. +Prevent `display-buffer' from performing an action and save the +current buffer to prevent `pop-to-buffer' from setting a new +current buffer." + ;; `pop-to-buffer' might still raise windows and frames so it may be + ;; better to have our own configurable `ess--pop-to-buffer' wrapper. + (declare (indent 0) + (debug (&rest form))) + `(let ((display-buffer-overriding-action '(display-buffer-no-window (allow-no-window . t)))) + (save-current-buffer + ,@body))) (defun ess-request-a-process (message &optional noswitch ask-if-1) "Ask for a process, and make it the current ESS process. If there is exactly one process, only ask if ASK-IF-1 is non-nil. -Also switches to the process buffer unless NOSWITCH is non-nil. Interactively, -NOSWITCH can be set by giving a prefix argument. -Returns the name of the selected process." - (interactive - (list "Switch to which ESS process? " current-prefix-arg)) - ; prefix sets 'noswitch - (ess-write-to-dribble-buffer "ess-request-a-process: {beginning}\n") +Also switches to the process buffer unless NOSWITCH is non-nil. +Interactively, NOSWITCH can be set by giving a prefix argument. +Returns the name of the selected process. MESSAGE may get passed +to `ess-completing-read'." + (interactive (list "Switch to which ESS process? " current-prefix-arg)) (update-ess-process-name-list) - - (setq ess-dialect (or ess-dialect - (ess-completing-read - "Set `ess-dialect'" - (delete-dups (list "R" "S+" (if (boundp 'S+-dialect-name) S+-dialect-name "S+") - "stata" (if (boundp 'STA-dialect-name) STA-dialect-name "stata") - "julia" "SAS" "XLS" "ViSta"))))) - - (let* ((pname-list (delq nil ;; keep only those mathing dialect + (let* ((ess-dialect (or ess-dialect + (ess-completing-read + "Set `ess-dialect'" + (delete-dups (list "R" "S+" (or (bound-and-true-p S+-dialect-name) "S+") + "stata" (or (bound-and-true-p STA-dialect-name) "stata") + "julia" "SAS"))))) + (pname-list (delq nil ;; keep only those matching dialect (append (mapcar (lambda (lproc) (and (equal ess-dialect @@ -785,57 +822,52 @@ (when (assoc ess-local-process-name ess-process-name-list) (list ess-local-process-name))))) (num-processes (length pname-list)) - (inferior-ess-same-window nil) ;; this should produce the inferior process in other window - (auto-started?)) - (if (or (= 0 num-processes) - (and (= 1 num-processes) - (not (equal ess-dialect ;; don't auto connect if from different dialect - (buffer-local-value - 'ess-dialect - (process-buffer (get-process - (car pname-list)))))))) - ;; try to start "the appropriate" process - (progn - (ess-write-to-dribble-buffer - (concat " ... request-a-process:\n " - (format - "major mode %s; current buff: %s; ess-language: %s, ess-dialect: %s\n" - major-mode (current-buffer) ess-language ess-dialect))) - (ess-start-process-specific ess-language ess-dialect) - (ess-write-to-dribble-buffer - (format " ... request-a-process: buf=%s\n" (current-buffer))) - (setq num-processes 1 - pname-list (car ess-process-name-list) - auto-started? t))) + proc auto-started?) + (when (or (= 0 num-processes) + (and (= 1 num-processes) + (not (equal ess-dialect ;; don't auto connect if from different dialect + (buffer-local-value + 'ess-dialect + (process-buffer (get-process + (car pname-list)))))))) + ;; try to start "the appropriate" process, don't show the buffer + ;; since we handle that explicitly with no-switch + (ess--with-no-pop-to-buffer + (ess-start-process-specific ess-language ess-dialect)) + (setq num-processes 1 + pname-list (car ess-process-name-list) + auto-started? t)) ;; now num-processes >= 1 : (let* ((proc-buffers (mapcar (lambda (lproc) (buffer-name (process-buffer (get-process lproc)))) - pname-list)) - (proc + pname-list))) + (setq proc (if (or auto-started? - (and (not ask-if-1) (= 1 num-processes))) - (progn - (message "using process '%s'" (car proc-buffers)) - (car pname-list)) - ;; else + (and (not ask-if-1) + (= 1 num-processes) + (message "Using process `%s'" (car proc-buffers)))) + (car pname-list) (unless (and ess-current-process-name (get-process ess-current-process-name)) (setq ess-current-process-name nil)) - (when message - (setq message (replace-regexp-in-string ": +\\'" "" message))) ;; <- why is this here?? ;; ask for buffer name not the *real* process name: (let ((buf (ess-completing-read message (append proc-buffers (list "*new*")) nil t nil nil))) - (if (equal buf "*new*") - (progn - (ess-start-process-specific ess-language ess-dialect) ;; switches to proc-buff - (caar ess-process-name-list)) - (process-name (get-buffer-process buf)) - )) - ))) - (if noswitch - (pop-to-buffer (current-buffer)) ;; VS: this is weired, but is necessary - (pop-to-buffer (buffer-name (process-buffer (get-process proc))) t)) - proc))) + (if (not (equal buf "*new*")) + (process-name (get-buffer-process buf)) + ;; Prevent new process buffer from being popped + ;; because we handle display depending on the value + ;; of `no-switch` + (ess--with-no-pop-to-buffer + (ess-start-process-specific ess-language ess-dialect)) + (caar ess-process-name-list)))))) + ;; Always display buffer if auto-started but do not select it if + ;; NOSWITCH is set + (when (or auto-started? (not noswitch)) + (let ((proc-buf (ess-get-process-buffer proc))) + (if noswitch + (display-buffer proc-buf) + (pop-to-buffer proc-buf)))) + proc)) (defun ess-force-buffer-current (&optional prompt force no-autostart ask-if-1) "Make sure the current buffer is attached to an ESS process. @@ -845,24 +877,21 @@ died. `ess-local-process-name' is set to the name of the process selected. `ess-dialect' is set to the dialect associated with the process selected. ASK-IF-1 asks user for the process, even if -there is only one process running." +there is only one process running. Returns the inferior buffer if +it was successfully forced, throws an error otherwise." (interactive (list (concat ess-dialect " process to use: ") current-prefix-arg nil)) - ;; fixme: why the above interactive is not working in emacs 24? - (setq prompt (or prompt "Process to use: ")) (let ((proc-name (ess-make-buffer-current))) - (if (and (not force) proc-name (get-process proc-name)) - nil ; do nothing - ;; Make sure the source buffer is attached to a process - (if (and ess-local-process-name (not force) no-autostart) - (error "Process %s has died" ess-local-process-name) - ;; ess-local-process-name is nil -- which process to attach to - (let ((proc (ess-request-a-process prompt 'no-switch ask-if-1)) - temp-ess-help-filetype dialect) - (with-current-buffer (process-buffer (get-process proc)) - (setq temp-ess-help-filetype inferior-ess-help-filetype)) - (setq ess-local-process-name proc) - (setq inferior-ess-help-filetype temp-ess-help-filetype)))))) + (cond ((and (not force) proc-name (get-process proc-name))) + ;; Make sure the source buffer is attached to a process + ((and ess-local-process-name (not force) no-autostart) + (error "Process %s has died" ess-local-process-name)) + ;; Request a process if `ess-local-process-name' is nil + (t + (let* ((prompt (or prompt "Process to use: ")) + (proc (ess-request-a-process prompt 'no-switch ask-if-1))) + (setq ess-local-process-name proc))))) + (process-buffer (get-process ess-local-process-name))) (defalias 'inferior-ess-force #'ess-force-buffer-current) @@ -888,7 +917,7 @@ (equal dialect (buffer-local-value 'ess-dialect (process-buffer proc))) (or ignore-busy - (not (process-get proc 'busy)))) + (inferior-ess-available-p proc))) (throw 'found proc)))))))) @@ -896,25 +925,12 @@ (defun ess-switch-to-ESS (eob-p) "Switch to the current inferior ESS process buffer. -With (prefix) EOB-P non-nil, positions cursor at end of buffer. -This function should follow the description in `ess-show-buffer' -for showing the iESS buffer, except that the iESS buffer is also -made current." +With (prefix) EOB-P non-nil, positions cursor at end of buffer." (interactive "P") (ess-force-buffer-current) - (if (and ess-current-process-name (get-process ess-current-process-name)) - (progn - (ess-show-buffer - (buffer-name (process-buffer (get-process ess-current-process-name))) - t) - (if eob-p (goto-char (point-max)))) - (message "No inferior ESS process") - (ding))) - -(defun ess-switch-to-ESS-deprecated (eob-p) - (interactive "P") - (ess-switch-to-ESS eob-p) - (message "C-c C-y is deprecated, use C-c C-z instead (ess-switch-to-inferior-or-script-buffer)")) + (pop-to-buffer (buffer-name (process-buffer (get-process ess-current-process-name))) + '(nil . ((inhibit-same-window . t)))) + (when eob-p (goto-char (point-max)))) (defun ess-switch-to-end-of-ESS () "Switch to the end of the inferior ESS process buffer." @@ -922,7 +938,7 @@ (ess-switch-to-ESS t)) (defun ess-switch-to-inferior-or-script-buffer (toggle-eob) - "If in script, switch to the iESS. If in iESS switch to most recent script buffer. + "Switch between script and process buffer. This is a single-key command. Assuming that it is bound to C-c C-z, you can navigate back and forth between iESS and script buffer with C-c C-z C-z C-z ... If variable @@ -931,33 +947,29 @@ given, the value of `ess-switch-to-end-of-proc-buffer' is toggled." (interactive "P") - (let ((map (make-sparse-keymap)) - (EOB (if toggle-eob + (let ((eob (if toggle-eob (not ess-switch-to-end-of-proc-buffer) ess-switch-to-end-of-proc-buffer))) - (define-key map (vector last-command-event) - (lambda (ev eob) (interactive) - (if (not (eq major-mode 'inferior-ess-mode)) - (ess-switch-to-ESS eob) - (let ((dialect ess-dialect) - (loc-proc-name ess-local-process-name) - (blist (cdr (buffer-list)))) - (while (and blist - (with-current-buffer (car blist) - (not (or (and - (memq major-mode '(ess-mode ess-julia-mode)) - (equal dialect ess-dialect) - (null ess-local-process-name)) - (and - (memq major-mode '(ess-mode ess-julia-mode)) - (equal loc-proc-name ess-local-process-name)) - )))) - (pop blist)) - (if blist - (ess-show-buffer (car blist) t) - (message "Found no buffers for ess-dialect %s associated with process %s" - dialect loc-proc-name)))))) - (ess--execute-electric-command map nil nil nil EOB))) + (if (derived-mode-p 'inferior-ess-mode) + (let ((dialect ess-dialect) + (proc-name ess-local-process-name) + (blist (buffer-list))) + (while (and (pop blist) + (with-current-buffer (car blist) + (not (or (and (ess-derived-mode-p) + (equal dialect ess-dialect) + (null ess-local-process-name)) + (and (ess-derived-mode-p) + (equal proc-name ess-local-process-name))))))) + (if blist + (pop-to-buffer (car blist)) + (message "Found no buffers for `ess-dialect' %s associated with process %s" + dialect proc-name))) + (ess-switch-to-ESS eob)) + (when (called-interactively-p 'any) + (set-transient-map (let ((map (make-sparse-keymap)) + (key (vector last-command-event))) + (define-key map key #'ess-switch-to-inferior-or-script-buffer) map))))) (defun ess-get-process-buffer (&optional name) @@ -976,118 +988,44 @@ (if (eq (length ess-process-name-list) 0) (setq ess-current-process-name nil))) -(defcustom ess-show-buffer-action - '((display-buffer-pop-up-window display-buffer-use-some-window)) - "Actions for `ess-show-buffer', passed to `display-buffer'." - :group 'ess - :type '(list (repeat function))) - -(defun ess-show-buffer (buf &optional visit) - "Ensure the ESS buffer BUF is visible. -The buffer, specified as a string, is typically an iESS (e.g. -*R*) buffer. This handles several cases: - -1. If BUF is visible in the current frame, nothing is done. -2. If BUF is visible in another frame, then we ensure that frame is -visible (it may have been iconified). -3. If buffer is not visible in any frame, simply show it in another window -in the current frame. - -If VISIT is non-nil, as well as making BUF visible, we also select it -as the current buffer." - (let ((frame)) - (if (ess-buffer-visible-this-frame buf) - ;;1. Nothing to do, BUF visible in this frame; just return window - ;; where this buffer is. - t - ;; 2. Maybe BUF visible in another frame. - (setq frame (ess-buffer-visible-other-frame buf)) - (if frame - ;; BUF is visible in frame, so just check frame is raised. - (if (not (eq (frame-visible-p frame) t)) - ;; frame is not yet visible, so raise it. - (raise-frame frame)) - ;; 3. else BUF not visible in any frame, so show it (but do - ;; not select it) in another window in current frame. - (display-buffer buf ess-show-buffer-action))) - ;; At this stage, the buffer should now be visible on screen, - ;; although it won't have been made current. - (when visit - ;; Need to select the buffer. - ;; - ;; First of all, check case 2 if buffer is in another frame - ;; but that frame may not be selected. - (if frame - (ess-select-frame-set-input-focus frame)) - (select-window (get-buffer-window buf 0))))) - -(defvar ess-bufs-in-frame nil) ;silence the compiler. -;; The next few functions are copied from my (SJE) iswitchb library. -(defun ess-get-bufname (win) - "Used by `ess-get-buffers-in-frames' to walk through all windows." - (let ((buf (buffer-name (window-buffer win)))) - (if (not (member buf ess-bufs-in-frame)) - ;; Only add buf if it is not already in list. - ;; This prevents same buf in two different windows being - ;; put into the list twice. - (setq ess-bufs-in-frame - (cons buf ess-bufs-in-frame))))) - -(defun ess-get-buffers-in-frames (&optional current) - "Return the list of buffers that are visible in the current frame. -If optional argument CURRENT is given, restrict searching to the -current frame, rather than all frames." - (let ((ess-bufs-in-frame nil)) - (walk-windows 'ess-get-bufname nil (if current nil 0)) - ess-bufs-in-frame)) - -(defun ess-buffer-visible-this-frame (buf) - "Return t if BUF is visible in current frame." - (member buf (ess-get-buffers-in-frames t))) - -(defun ess-buffer-visible-other-frame (buf) - "Return t if BUF is visible in another frame. -Assumes that buffer has not already been in found in current frame." - (if (member (buffer-name (get-buffer buf)) (ess-get-buffers-in-frames)) - (window-frame (get-buffer-window buf 0)) - nil)) - - ;;; Functions for evaluating code ;;*;; Utils for evaluation -(ess-defgeneric ess-build-eval-command (string &optional visibly output file &rest args) +(defun ess-build-eval-command (string &optional visibly output file &rest args) "Format an evaluation command. -Wrap STRING with `ess-quote-special-chars' and dispatch on the -dialect-specific `ess-build-eval-command' function and -`ess-eval-command', in that order. If none of the above is -defined, return nil." +Wrap STRING with `ess-quote-special-chars' and dispatch on +`ess-build-eval-command--override'." (setq string (ess-quote-special-chars string)) - (:override - (and ess-eval-command - (format-spec ess-eval-command - `((?s . ,string) - (?f . ,file)))))) + (ess-build-eval-command--override string visibly output file args)) -(ess-defgeneric ess-build-load-command (file &optional visibly output &rest args) +(cl-defgeneric ess-build-eval-command--override + (string &optional _visibly _output file &rest _args) + "Default method to build eval command." + (and ess-eval-command + (format-spec ess-eval-command + `((?s . ,string) + (?f . ,file))))) + +(cl-defgeneric ess-build-load-command (file &optional _visibly _output &rest _args) "Format a loading command. Dispatches on the dialect-specific `ess-build-load-command' and `ess-load-command', in that order." - (:override - (and ess-load-command - (format ess-load-command file)))) + (and ess-load-command + (format ess-load-command file))) (defun ess-wait-for-process (&optional proc sec-prompt wait force-redisplay timeout) - "Wait for 'busy property of the process to become nil. + "Wait for \\='busy property of the process to become nil. 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.002s. When FORCE-REDISPLAY is non-nil force redisplay. You better use WAIT >= 0.1 if you need -FORCE-REDISPLAY to avoid excesive redisplay. If TIMEOUT is -non-nil stop waiting for output after TIMEOUT seconds." +FORCE-REDISPLAY to avoid excessive redisplay. If TIMEOUT is +non-nil stop waiting for output after TIMEOUT seconds. + +Returns nil if TIMEOUT was reached, non-nil otherwise." (setq proc (or proc (get-process ess-local-process-name))) (setq wait (or wait 0.005)) (setq timeout (or timeout most-positive-fixnum)) @@ -1108,15 +1046,41 @@ (redisplay 'force)) (setq elapsed (- (float-time) start-time)) (when (> elapsed .3) - (setq wait .3)))))) + (setq wait .3)))) + (< elapsed timeout))) (defun inferior-ess-ordinary-filter (proc string) - (inferior-ess-set-status proc string t) (ess--if-verbose-write-process-state proc string "ordinary-filter") - (inferior-ess-run-callback proc string) - (with-current-buffer (process-buffer proc) - ;; (princ (format "%s:" string)) - (insert string))) + (let* ((cmd-buf (process-get proc 'cmd-buffer)) + (cmd-delim (process-get proc 'cmd-output-delimiter)) + (early-exit t)) + (when (buffer-live-p cmd-buf) + (unwind-protect + (progn + (with-current-buffer cmd-buf + (goto-char (point-max)) + (insert string)) + (when-let ((info (if cmd-delim + (ess--command-delimited-output-info cmd-buf cmd-delim) + (ess--command-output-info cmd-buf)))) + (let ((new-output (ess--command-set-status proc cmd-buf info))) + (when (not (process-get proc 'busy)) + ;; Store new output until restoration + (when new-output + (process-put proc 'pending-output new-output)) + ;; Restore the user's process filter as soon as process is + ;; available + (funcall (process-get proc 'cmd-restore-function)) + ;; Run callback with command output + (when (process-get proc 'callbacks) + (inferior-ess-run-callback proc (with-current-buffer cmd-buf + (buffer-string))))))) + (setq early-exit nil)) + ;; Be defensive when something goes wrong. Restore process to a + ;; usable state. + (when early-exit + (process-put proc 'busy nil) + (funcall (process-get proc 'cmd-restore-function))))))) (defvar ess-presend-filter-functions nil "List of functions to call before sending the input string to the process. @@ -1205,16 +1169,17 @@ ;;*;; Evaluation primitives -(ess-defgeneric ess-send-string (process string &optional visibly message type) +(defun ess-send-string (process string &optional visibly message _type) "ESS wrapper for `process-send-string'. Run `comint-input-filter-functions' and current buffer's and PROCESS' `ess-presend-filter-functions' hooks on the input -STRING. VISIBLY can be nil, t, 'nowait or a string. If string -the behavior is as with 'nowait with the differences that +STRING. VISIBLY can be nil, t, \\='nowait or a string. If string +the behavior is as with \\='nowait with the differences that inserted string is VISIBLY instead of STRING (evaluated command is still STRING). In all other cases the behavior is as described in `ess-eval-visibly'. STRING need not end with -\\n. TYPE is a symbol indicating type of the string." +\\n. TYPE is a symbol indicating type of the string. +MESSAGE is a message to display." ;; No support of `visibly' when there's no secondary prompt (let ((visibly (if (and (eq visibly t) (null inferior-ess-secondary-prompt)) @@ -1223,31 +1188,31 @@ (string (ess--run-presend-hooks process string))) (inferior-ess--interrupt-subjob-maybe process) (inferior-ess-mark-as-busy process) - (:override - (cond - ;; Wait after each line - ((eq visibly t) - (let ((ess--inhibit-presend-hooks t)) - (ess-eval-linewise string))) - ;; Insert command and eval invisibly - ((or (stringp visibly) - (eq visibly 'nowait)) - (with-current-buffer (process-buffer process) - (save-excursion - (goto-char (process-mark process)) - (insert-before-markers - (propertize (format "%s\n" - (replace-regexp-in-string - "\n" "\n+ " - (if (stringp visibly) visibly string))) - 'font-lock-face 'comint-highlight-input))) - (process-send-string process (ess--concat-new-line-maybe string)))) - (t - (process-send-string process (ess--concat-new-line-maybe string)))) - (when message - (message "%s" message))))) + (process-put process 'last-eval (current-time)) + (cond + ;; Wait after each line + ((eq visibly t) + (let ((ess--inhibit-presend-hooks t)) + (ess-eval-linewise string))) + ;; Insert command and eval invisibly + ((or (stringp visibly) + (eq visibly 'nowait)) + (with-current-buffer (process-buffer process) + (save-excursion + (goto-char (process-mark process)) + (insert-before-markers + (propertize (format "%s\n" + (replace-regexp-in-string + "\n" "\n+ " + (if (stringp visibly) visibly string))) + 'font-lock-face 'comint-highlight-input))) + (process-send-string process (ess--concat-new-line-maybe string)))) + (t + (process-send-string process (ess--concat-new-line-maybe string)))) + (when message + (message "%s" message)))) -(ess-defgeneric ess-send-region (process start end &optional visibly message type) +(defun ess-send-region (process start end &optional visibly message type) "Low level ESS version of `process-send-region'. If VISIBLY call `ess-eval-linewise', else call `ess-send-string'. If MESSAGE is supplied, display it at the @@ -1256,9 +1221,11 @@ type of the region." (cond ((ess-tracebug-p) - (ess-tracebug-send-region proc start end visibly message type)) - (t (:override - (ess-send-string process (buffer-substring start end) visibly message type))))) + (ess-tracebug-send-region process start end visibly message type)) + (t (ess-send-region--override process start end visibly message type)))) + +(cl-defgeneric ess-send-region--override (process start end visibly message type) + (ess-send-string process (buffer-substring start end) visibly message type)) ;;*;; Evaluation commands @@ -1275,39 +1242,31 @@ (abbreviate-file-name file))) (defun ess-load-file--normalise-buffer (file) - (when (ess-check-source file) + (when (ess-save-file file) (error "Buffer %s has not been saved" (buffer-name file))) (let ((source-buffer (get-file-buffer file))) (if source-buffer (with-current-buffer source-buffer (when (buffer-modified-p) (save-buffer)) - (ess-force-buffer-current "Process to load into: ") - (ess-check-modifications)) + (ess-force-buffer-current "Process to load into: ")) (ess-force-buffer-current "Process to load into: ")))) ;;;###autoload -(ess-defgeneric ess-load-file (&optional filename) - "Load a source file into an inferior ESS process. +(defun ess-load-file (&optional filename) + "Load FILENAME into an inferior ESS process. This handles Tramp when working on a remote." - (interactive (list (or (and (memq major-mode '(ess-mode ess-julia-mode)) + (interactive (list (or (and (ess-derived-mode-p) (buffer-file-name)) (expand-file-name (read-file-name "Load source file: " nil nil t))))) (ess-load-file--normalise-buffer filename) - ;; Pop up an inferior window - (save-selected-window - (ess-switch-to-ESS t)) - (:override - (let ((file (ess-load-file--normalise-file filename))) - (let ((command (ess-build-load-command file nil t))) - (ess-send-string (ess-get-process) command t))))) - -;; C-c C-l *used to* eval code: -(defun ess-msg-and-comint-dynamic-list-input-ring () - "Display a list of recent inputs entered into the current buffer." - (interactive) - (message "C-c C-l no longer loads a source file in [iESS], rather use C-c M-l instead") - (comint-dynamic-list-input-ring)) + (setq filename (ess-load-file--normalise-file filename)) + (ess-load-file--override filename) + (message "Loaded %s" filename)) + +(cl-defgeneric ess-load-file--override (filename) + (let ((command (ess-build-load-command filename nil t))) + (ess-send-string (ess-get-process) command t))) ;; ;;; VS[03-09-2012]: Test Cases: ;; (ess-command "a<-0\n" nil nil nil nil (get-process "R")) @@ -1317,33 +1276,60 @@ ;; (lambda (proc) (message "done"))) ;; (process-get (get-process "R") 'running-async?) -(defun ess-command--normalise-proc (proc no-prompt-check) - (let ((proc (cond - (proc - ;; This lets external functions call this command - (unless ess-local-process-name - (setq ess-local-process-name (process-name proc))) - proc) - (t - (ess-get-process ess-local-process-name))))) - (unless no-prompt-check - (when (process-get proc 'busy) - (user-error "ESS process not ready. Finish your command before trying again"))) - proc)) - -(ess-defgeneric ess-command (cmd &optional out-buffer sleep no-prompt-check wait proc force-redisplay) - "Send the ESS process command CMD and delete the output from -the ESS process buffer. If an optional second argument -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. - -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'. +(defun ess-command--get-proc (proc no-prompt-check) + (if proc + (unless ess-local-process-name + (setq ess-local-process-name (process-name proc))) + (setq proc (ess-get-process ess-local-process-name))) + (unless no-prompt-check + (when (process-get proc 'busy) + (user-error "ESS process not ready. Finish your command before trying again"))) + proc) + +(defvar-local ess-format-command-alist nil + "Alist of mode-specific parameters for formatting a command. +All elements are optional. + +- `fun': A formatting function for running a command. First + argument is the background command to run. Must include a + catch-all `&rest` parameter for extensibility. + +- `use-delimiter' : Whether to wait for an output sentinel. If + non-nil, `fun' should get the `cmd-output-delimiter' element of the + alist of parameters and ensure the sentinel is written to the + process output at the end of the command.") + +(defvar inferior-ess--output-delimiter-count 0) +(defun inferior-ess--output-delimiter () + (setq inferior-ess--output-delimiter-count (1+ inferior-ess--output-delimiter-count)) + (format "ess-output-delimiter%s" inferior-ess--output-delimiter-count)) + +(defvar ess--command-default-timeout most-positive-fixnum) + +;; NOTE: We might want to switch to somethig like `cl-defun' with +;; keyword arguments given the length of the signature. Would also +;; make it easier to deprecate arguments. +(defun ess-command (cmd &optional out-buffer _sleep no-prompt-check wait proc + force-redisplay timeout) + "Send the ESS process CMD and delete the output from the ESS process buffer. +If an optional second argument 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. + +`ess-command' is executes CMD in the background synchronously, +meaning that the Emacs UI blocks while CMD is running. Make sure +that CMD returns immediately. Blocking the UI for more than 0.1 +seconds should generally be considered a bug. + +SLEEP is deprecated and no longer has any effect. WAIT, +FORCE-REDISPLAY, and TIMEOUT are as in `ess-wait-for-process' and +are passed to `ess-wait-for-process'. The default timeout is 30 +seconds. The process is interrupted with `interrupt-process' when +the timeout is reached or when an error occurs. PROC should be a process, if nil the process name is taken from -`ess-local-process-name'. This command doesn't set 'last-eval +`ess-local-process-name'. This command doesn't set \\='last-eval process variable. Note: for critical, or error prone code you should consider @@ -1354,44 +1340,94 @@ on.exit(options(olderr)) ... })" - (:override - (let ((out-buffer (or out-buffer (get-buffer-create " *ess-command-output*"))) - (proc (ess-command--normalise-proc proc no-prompt-check))) - (with-current-buffer (process-buffer proc) - (let ((primary-prompt inferior-ess-primary-prompt) - (oldpb (process-buffer proc)) - (oldpf (process-filter proc)) - (oldpm (marker-position (process-mark proc)))) - (ess-if-verbose-write (format "(ess-command %s ..)" cmd)) - ;; Swap the process buffer with the output buffer before - ;; sending the command - (unwind-protect - (progn - (set-process-buffer proc out-buffer) - (set-process-filter proc 'inferior-ess-ordinary-filter) - (with-current-buffer out-buffer - (setq inferior-ess-primary-prompt primary-prompt) - (setq buffer-read-only nil) - (erase-buffer) - (set-marker (process-mark proc) (point-min)) - (inferior-ess-mark-as-busy proc) - (process-send-string proc cmd) - ;; Need time for ess-create-object-name-db on PC - (if no-prompt-check - (sleep-for 0.02) ; 0.1 is noticeable! - (ess-wait-for-process proc nil wait force-redisplay) - (ess-mpi-handle-messages (current-buffer)) - ;; Remove prompt - ;; If output is cat(..)ed this deletes the output - (goto-char (point-max)) - (delete-region (point-at-bol) (point-max))) - (ess-if-verbose-write " .. ok{ess-command}"))) - (ess-if-verbose-write " .. exiting{ess-command}\n") - ;; Restore the process buffer in its previous state - (set-process-buffer proc oldpb) - (set-process-filter proc oldpf) - (set-marker (process-mark proc) oldpm)))) - out-buffer))) + (let ((out-buffer (or out-buffer (get-buffer-create " *ess-command-output*"))) + (proc (ess-command--get-proc proc no-prompt-check)) + (delim (inferior-ess--output-delimiter)) + (timeout (or timeout ess--command-default-timeout))) + (with-current-buffer (process-buffer proc) + (let ((proc-forward-alist (ess--alist (ess-local-process-name + inferior-ess-primary-prompt))) + (use-delimiter (alist-get 'use-delimiter ess-format-command-alist)) + (rich-cmd (if-let ((cmd-fun (alist-get 'fun ess-format-command-alist))) + (funcall cmd-fun + (ess--strip-final-newlines cmd) + (cons 'output-delimiter delim)) + cmd)) + (early-exit t)) + (ess-if-verbose-write (format "(ess-command %s ..)" cmd)) + ;; Swap the process buffer with the output buffer before + ;; sending the command + (unwind-protect + (progn + ;; The process is restored from the filter once it's + ;; available again (i.e. a prompt or delimeter is + ;; detected). This handles the synchronous case when the + ;; command runs to completion, as well as the + ;; asynchronous case when an early exit occurs. The most + ;; common cause of early exits are interrupts sent by + ;; Emacs when the user types (see `when-no-input'). In + ;; these cases we forward the interrupt to the process + ;; and return to the caller right away. We can't restore + ;; synchronously after an interrupt because the output + ;; of the background command would spill into the + ;; process buffer of the user when the process doesn't + ;; interrupt in time. + (process-put proc 'cmd-restore-function + (ess--command-make-restore-function proc)) + (when use-delimiter + (process-put proc 'cmd-output-delimiter delim)) + (process-put proc 'cmd-buffer out-buffer) + (set-process-filter proc 'inferior-ess-ordinary-filter) + (with-current-buffer out-buffer + (ess-setq-vars-local proc-forward-alist) + (setq buffer-read-only nil) + (erase-buffer) + (inferior-ess-mark-as-busy proc) + (process-send-string proc rich-cmd) + ;; Need time for ess-create-object-name-db on PC + (if no-prompt-check + (sleep-for 0.02) ; 0.1 is noticeable! + (unless (ess-wait-for-process proc nil wait force-redisplay timeout) + (error "Timeout during background ESS command `%s'" + (ess--strip-final-newlines cmd))))) + (setq early-exit nil)) + (when early-exit + ;; Protect process interruption from further quits + (let ((inhibit-quit t)) + ;; In case of early exit send an interrupt to the + ;; process to abort the command + (with-current-buffer out-buffer + (goto-char (point-min)) + (when (and use-delimiter + (not (re-search-forward (ess--delimiter-start-re delim) nil t))) + ;; CMD probably failed to parse if the start delimiter + ;; can't be found in the output. Disable the delimiter + ;; before interrupt to avoid a freeze. + (ess-write-to-dribble-buffer + "Disabling output delimiter because CMD failed to parse") + (process-put proc 'cmd-output-delimiter nil)) + (goto-char (point-max)) + (ess--interrupt proc))))))) + out-buffer)) + +(defun ess--command-make-restore-function (proc) + (let ((old-pf (process-filter proc))) + (lambda () + (set-process-filter proc old-pf) + (process-put proc 'cmd-output-delimiter nil) + (process-put proc 'cmd-buffer nil) + (when-let ((pending (process-get proc 'pending-output))) + (process-put proc 'pending-output nil) + (funcall old-pf proc pending))))) + +;; TODO: Needs some Julia tests as well +(defun ess--foreground-command (cmd &optional out-buffer _sleep no-prompt-check wait proc) + "Same as `ess-command' but does not timeout. +Currently blocks the Emacs UI. Eventually it would make sense to +lock the inferior to prevent interactions and use +`ess-async-command' with a callback." + (let ((timeout most-positive-fixnum)) + (ess-command cmd out-buffer nil no-prompt-check wait proc nil timeout))) (defun ess-boolean-command (com &optional buf wait) "Like `ess-command' but expects COM to print TRUE or FALSE. @@ -1405,19 +1441,9 @@ (defun ess-string-command (com &optional buf wait) "Returns the output of COM as a string." (with-current-buffer (ess-command com buf nil nil wait) - (ess-kill-last-line) (buffer-substring (point-min) (point-max)))) -;; (ess-async-command "{cat(1:5);Sys.sleep(5);cat(2:6)}\n" nil (get-process "R") -;; (lambda (proc) (message "done"))) -;; (ess-async-command "{cat(1:5);Sys.sleep(5);cat(2:6)}\n" nil (get-process "R") -;; (lambda (proc) (message "done")) -;; t) -;; (ess-async-command "{cat(1:5);Sys.sleep(5);cat(2:6)}\n" nil (get-process "R") -;; (lambda (proc) (message "done")) -;; (lambda (proc2) (message "name: %s" (process-name proc2)))) - -(defun ess-async-command (com &optional buf proc callback interrupt-callback ) +(defun ess-async-command (com &optional buf proc callback interrupt-callback) "Asynchronous version of `ess-command'. COM, BUF, WAIT and PROC are as in `ess-command'. @@ -1431,22 +1457,22 @@ jobs like caching. ESS tries to suppress any output from the asynchronous command, but long output of COM will most likely end up in user's main buffer." - (let ((proc (or proc (get-process ess-local-process-name)))) - (if (not (and proc - (eq (process-status proc) 'run))) - (error "Process %s is dead" ess-local-process-name) - (if (or (process-get proc 'busy) - (process-get proc 'running-async?)) - (error "Process %s is busy or already running an async command" ess-local-process-name) - (when (eq interrupt-callback t) - (setq interrupt-callback (lambda (proc)))) - (process-put proc 'callbacks (list (cons callback 'suppress-output) - interrupt-callback)) - (process-put proc 'interruptable? (and interrupt-callback t)) - (process-put proc 'running-async? t) - (ess-command com buf nil 'no-prompt-check .01 proc))))) + (setq proc (or proc (get-process ess-local-process-name))) + (cond ((not (and proc (eq (process-status proc) 'run))) + (error "Process %s is dead" proc)) + ((process-get proc 'busy) + (error "Process %s is busy" proc)) + ((process-get proc 'running-async?) + (error "Process %s is already running an async command" proc))) + (when (eq interrupt-callback t) + (setq interrupt-callback (lambda (_proc)))) + (process-put proc 'callbacks (list (cons callback 'suppress-output) + interrupt-callback)) + (process-put proc 'interruptable? (and interrupt-callback t)) + (process-put proc 'running-async? t) + (ess-command com buf nil 'no-prompt-check .01 proc)) -(defun ess-async-command-delayed (com &optional buf proc callback delay) +(defun ess-async-command-delayed (com buf proc &optional callback delay) "Delayed asynchronous ess-command. COM and BUF are as in `ess-command'. DELAY is a number of idle seconds to wait before starting the execution of the COM. On @@ -1457,10 +1483,7 @@ PROC for delayed evaluation, as the current process might change, leading to unpredictable consequences. This function is a wrapper of `ess-async-command' with an explicit interrupt-callback." - (unless proc - (error "You must provide PROC argument to ess-async-command-delayed")) - (let* ((timer (make-symbol "timer")) - (delay (or delay + (let* ((delay (or delay (+ ess-idle-timer-interval 3))) (int-cb `(lambda (proc) (ess-async-command-delayed ,com ,buf proc ,callback ,delay))) @@ -1474,98 +1497,117 @@ (ess-async-command ,com ,buf ,proc ,callback ',int-cb))))) (run-with-idle-timer delay nil com-fun))) +(defun ess-load-library () + "Prompt and load dialect specific library/package/module. +Note that in R these 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) + (let ((ess-eval-visibly-p t) + (packs (ess-installed-packages)) + pack) + (setq pack (ess-completing-read "Load" packs)) + (ess-load-library--override pack) + (ess--mark-search-list-as-changed))) + +(cl-defgeneric ess-installed-packages () + "Return a list of installed packages.") + +(cl-defgeneric ess-load-library--override (pack) + "Load library/package PACK.") + ;;*;; Evaluating lines, paragraphs, regions, and buffers. -(ess-defgeneric ess-eval-linewise - (text &optional invisibly eob even-empty wait-last-prompt sleep-sec wait-sec) +(defun ess-eval-linewise (text &optional invisibly eob even-empty + wait-last-prompt sleep-sec wait-sec) "Evaluate TEXT in the ESS process buffer as if typed in w/o tabs. Waits for prompt after each line of input, so won't break on large texts. If optional second arg INVISIBLY is non-nil, don't echo commands. If it is a string, just include that string. If optional third -arg EOB is non-nil go to end of ESS process buffer after -evaluation. If optional 4th arg EVEN-EMPTY is non-nil, also send -empty text (e.g. an empty line). If 5th arg WAIT-LAST-PROMPT is +arg EOB is non-nil, display ESS process buffer after evaluation. +If optional 4th arg EVEN-EMPTY is non-nil, also send empty +text (e.g. an empty line). If 5th arg WAIT-LAST-PROMPT is non-nil, also wait for the prompt after the last line; if 6th arg -SLEEP-SEC is a number, ESS will call '(\\[sleep-for] SLEEP-SEC) -at the end of this function. If the 7th arg WAIT-SEC is set, it +SLEEP-SEC is a number, ESS will call `(\\[sleep-for] SLEEP-SEC)' +at the end of this function. If the 7th arg WAIT-SEC is set, it will be used instead of the default .001s and be passed to \\[ess-wait-for-process]. Run `comint-input-filter-functions' and `ess-presend-filter-functions' of the associated PROCESS on the TEXT." - (unless (numberp wait-sec) - (setq wait-sec 0.001)) (ess-force-buffer-current "Process to use: ") - (:override - ;; Use this to evaluate some code, but don't wait for output. - (let* ((deactivate-mark) ; keep local {do *not* deactivate wrongly} - (cbuffer (current-buffer)) - (sprocess (ess-get-process ess-current-process-name)) - (sbuffer (process-buffer sprocess)) - (win (get-buffer-window sbuffer t))) - (setq text (ess--concat-new-line-maybe - (ess--run-presend-hooks sprocess text))) - (with-current-buffer sbuffer - (setq text (propertize text 'field 'input 'front-sticky t)) - (goto-char (marker-position (process-mark sprocess))) - (if (stringp invisibly) - (insert-before-markers (concat "*** " invisibly " ***\n"))) - ;; dbg: - ;; dbg (ess-write-to-dribble-buffer - ;; dbg (format "(eval-visibly 2): text[%d]= '%s'\n" (length text) text)) - (while (or (> (length text) 0) even-empty) - (setq even-empty nil) - (let* ((pos (string-match "\n\\|$" text)) - (input (if (= (length text) 0) - "\n" - (concat (substring text 0 pos) "\n")))) - (setq text (substring text (min (length text) (1+ pos)))) - (goto-char (marker-position (process-mark sprocess))) - (if win (set-window-point win (process-mark sprocess))) - (unless invisibly - ;; for consistency with comint :( - (insert (propertize input 'font-lock-face 'comint-highlight-input)) - (set-marker (process-mark sprocess) (point))) - (inferior-ess-mark-as-busy sprocess) - (process-send-string sprocess input)) - (when (or (> (length text) 0) - wait-last-prompt) - (ess-wait-for-process sprocess t wait-sec))) - (if eob (ess-show-buffer (buffer-name sbuffer) nil)) - (goto-char (marker-position (process-mark sprocess))) - (when win - (with-selected-window win - (goto-char (point)) - ;; this is crucial to avoid reseting window-point - (recenter (- -1 scroll-margin))))))) - (if (numberp sleep-sec) - (sleep-for sleep-sec))) + ;; Use this to evaluate some code, but don't wait for output. + (let* ((deactivate-mark) ; keep local {do *not* deactivate wrongly} + (inf-proc (ess-get-process ess-current-process-name)) + (inf-buf (process-buffer inf-proc)) + (win (get-buffer-window inf-buf t))) + (setq text (ess--concat-new-line-maybe + (ess--run-presend-hooks inf-proc text))) + (with-current-buffer inf-buf + (setq text (propertize text 'field 'input 'front-sticky t)) + (goto-char (marker-position (process-mark inf-proc))) + (when (stringp invisibly) + (insert-before-markers (concat "*** " invisibly " ***\n"))) + ;; dbg: + ;; dbg (ess-write-to-dribble-buffer + ;; dbg (format "(eval-visibly 2): text[%d]= '%s'\n" (length text) text)) + (while (or (> (length text) 0) even-empty) + (setq even-empty nil) + (let* ((pos (string-match "\n\\|$" text)) + (input (if (= (length text) 0) + "\n" + (concat (substring text 0 pos) "\n")))) + (setq text (substring text (min (length text) (1+ pos)))) + (goto-char (marker-position (process-mark inf-proc))) + (when win + (set-window-point win (process-mark inf-proc))) + (unless invisibly + ;; for consistency with comint :( + (insert (propertize input 'font-lock-face 'comint-highlight-input)) + (set-marker (process-mark inf-proc) (point))) + (inferior-ess-mark-as-busy inf-proc) + (process-send-string inf-proc input)) + (when (or (> (length text) 0) + wait-last-prompt) + (ess-wait-for-process inf-proc t (or wait-sec 0.001)))) + (when eob + (display-buffer inf-buf)) + ;; This used to be conditioned on EOB but this is no longer the + ;; case since commit fd90550d in 2012 (probably an accident) + (goto-char (marker-position (process-mark inf-proc))) + (when win + (with-selected-window win + (goto-char (point)) + ;; this is crucial to avoid resetting window-point + (recenter (- -1 scroll-margin)))))) + (when (numberp sleep-sec) + (sleep-for sleep-sec))) ;;;*;;; Evaluate only -(defun ess-eval-region--normalise-region () - "Clean the region for evaluation. +(defun ess-eval-region--normalise-region (start end) + "Clean the region from START to END for evaluation. This trims newlines at beginning and end of the region because they might throw off the debugger." (save-excursion (goto-char start) (skip-chars-forward "\n\t ") (setq start (point)) - (unless mark-active (ess-blink-region start end)) - (goto-char end) (skip-chars-backward "\n\t ") - (setq end (point)))) + (setq end (point)) + (cons start end))) -(defun ess-eval-region (start end toggle &optional message type) +(defun ess-eval-region (start end vis &optional message type) "Send the region from START to END to the inferior ESS process. -TOGGLE switches the meaning of `ess-eval-visibly'. If given, +VIS switches the meaning of `ess-eval-visibly'. If given, MESSAGE is `message'ed. TYPE is a symbol indicating what type of region this is. If command `rectangle-mark-mode' is active, send the lines of the rectangle separately to the inferior process." @@ -1576,138 +1618,120 @@ ;; External applications might call ess-eval-* functions; make it ;; easier for them (ess-setq-vars-local (symbol-value (ess-get-process-variable 'ess-local-customize-alist)))) - (if (and (bound-and-true-p rectangle-mark-mode) - ;; TODO: Remove this check after dropping support for Emacs - ;; 24, replace by putting this at the top of this file: - ;; (declare-function extract-rectangle-bounds "rect") - (fboundp 'extract-rectangle-bounds)) + (if (bound-and-true-p rectangle-mark-mode) ;; If we're in rectangle-mark-mode, loop over each line of the ;; rectangle. Send them separately. (let ((reclines (extract-rectangle-bounds (min (mark) (point)) (max (mark) (point))))) (mapc (lambda (l) - (ess--eval-region (car l) (cdr l) toggle message type)) + (ess--eval-region (car l) (cdr l) vis message type)) reclines)) - (ess--eval-region start end toggle message type))) + (ess--eval-region start end vis message type))) -(defun ess--eval-region (start end toggle &optional message type) +(defun ess--eval-region (start end vis &optional message type) "Helper function for `ess-eval-region', which see. -START, END, TOGGLE, MESSAGE, and TYPE described there." - (ess-eval-region--normalise-region) - (let ((visibly (if toggle (not ess-eval-visibly) ess-eval-visibly)) - (message (or message "Eval region")) - (proc (ess-get-process))) - (save-excursion - (ess-send-region proc start end visibly message type))) - (when ess-eval-deactivate-mark - (ess-deactivate-mark)) - (list start end)) +START, END, VIS, MESSAGE, and TYPE described there." + (let* ((se (ess-eval-region--normalise-region start end)) + (start (car se)) + (end (cdr se))) + (let ((visibly (if vis (not ess-eval-visibly) ess-eval-visibly)) + (message (or message "Eval region")) + (proc (ess-get-process))) + (save-excursion + (ess-send-region proc start end visibly message type))) + (when ess-eval-deactivate-mark + (ess-deactivate-mark)) + (list start end))) -(defun ess-eval-buffer (vis) +(defun ess-eval-buffer (&optional vis) "Send the current buffer to the inferior ESS process. VIS has same meaning as for `ess-eval-region'." (interactive "P") (ess-eval-region (point-min) (point-max) vis "Eval buffer" 'buffer)) -(defun ess-eval-buffer-from-beg-to-here (vis) +(defun ess-eval-buffer-from-beg-to-here (&optional vis) "Send region from beginning to point to the inferior ESS process. VIS has same meaning as for `ess-eval-region'." (interactive "P") (ess-eval-region (point-min) (point) vis "Eval buffer till point")) -(defun ess-eval-buffer-from-here-to-end (vis) +(defun ess-eval-buffer-from-here-to-end (&optional vis) "Send region from point to end of buffer to the inferior ESS process. VIS has same meaning as for `ess-eval-region'." (interactive "P") (ess-eval-region (point) (point-max) vis "Eval buffer till end")) -(defun ess-eval-function (vis &optional no-error) +(defun ess-eval-function (&optional vis) "Send the current function to the inferior ESS process. -Prefix argument VIS toggles the meaning of `ess-eval-visibly'. If -NO-ERROR is non-nil and the function was successfully evaluated, -return '(beg end) representing the beginning and end of the -current function, otherwise (in case of an error) return nil." +Prefix arg VIS toggles visibility of ess-code as for +`ess-eval-region'. Returns nil if not inside a function." (interactive "P") - (ess-force-buffer-current "Process to use: ") + (ess-force-buffer-current) (save-excursion (ignore-errors ;; Evaluation is forward oriented (forward-line -1) (ess-next-code-line 1)) - (let ((beg-end (ess-end-of-function nil no-error))) - (when beg-end - (let* ((beg (nth 0 beg-end)) - (end (nth 1 beg-end)) - (proc (get-process ess-local-process-name)) - ;; FIXME: func names starting with . are not recognized?? - (name (progn (goto-char beg) - (forward-word) - (ess-read-object-name-default))) - (msg (format "Eval function %s" - (propertize (or name "???") - 'face 'font-lock-function-name-face))) - (visibly (if vis (not ess-eval-visibly) ess-eval-visibly))) - (ess-blink-region beg end) - (cond - ((ess-tracebug-p) - (ess-tracebug-send-function proc beg end visibly msg)) - (t - (ess-send-region proc beg end visibly msg))) - beg-end))))) - -;; This is from Mary Lindstrom -;; 31 Aug 1995 14:11:43 To: S-mode@stat.math.ethz.ch -(defun ess-eval-paragraph (vis) + (let ((pos (point)) + beg end msg) + (end-of-defun) + (beginning-of-defun) + ;; While we are the beginning of the function, get the function + ;; name. FIXME: should use our ess-function-pattern. + (setq msg (format "Eval function: %s" + (if (looking-at add-log-current-defun-header-regexp) + (match-string 1) + (buffer-substring (point) (point-at-eol))))) + (setq beg (point)) + (end-of-defun) + (setq end (point)) + (when (or (< pos beg) + (< end pos)) + (error "Not in a function")) + (if (ess-tracebug-p) + (ess-tracebug-send-function (get-process ess-local-process-name) beg end vis msg) + (ess-eval-region beg end vis msg))))) + +(defun ess-eval-paragraph (&optional vis) "Send the current paragraph to the inferior ESS process. Prefix arg VIS toggles visibility of ess-code as for `ess-eval-region'." (interactive "P") - (save-excursion - (forward-paragraph) - ;; Skip blank code to avoid sending surrounding comments - (ess-skip-blanks-backward 'multiline) - (let ((end (point))) - (backward-paragraph) - (ess-skip-blanks-forward 'multiline) - (ess-eval-region (point) end vis "Eval paragraph")))) - -;; ;; Experimental - after suggestion from Jenny Brian for an 'eval-multiline' -;; ;; 'sentence' is too much : almost like 'paragraph' -;; ;; 'sexp' is close, but too little [when point is inside function call; -;; ;; it moves all the way to the end - which is fine] -;; (defun ess-eval-sexp (vis) -;; "Send the current sexp to the inferior ESS process. -;; Prefix arg VIS toggles visibility of ess-code as for `ess-eval-region'." -;; (interactive "P") -;; (save-excursion -;; (forward-sexp) -;; (let ((end (point))) -;; (backward-sexp) -;; (ess-eval-region (point) end vis "Eval sexp")))) + (let ((start-pos (point))) + (if (= (point-at-bol) (point-min)) + (ess-next-code-line 0) + ;; Evaluation is forward oriented + (forward-line -1) + (ess-next-code-line 1)) + (when (< (point) start-pos) + (goto-char start-pos)) + (save-excursion + (let ((beg (progn (backward-paragraph) (point))) + (end (progn (forward-paragraph) (point)))) + (ess-eval-region beg end vis))))) -(defun ess-eval-function-or-paragraph (vis) +(defun ess-eval-function-or-paragraph (&optional vis) "Send the current function if \\[point] is inside one. Otherwise send the current paragraph to the inferior ESS process. Prefix arg VIS toggles visibility of ess-code as for -`ess-eval-region'." +`ess-eval-region'. Returns \\='function if a function was evaluated +or \\='paragraph if a paragraph." (interactive "P") - (let ((beg-end (ess-eval-function vis 'no-error))) - (if (null beg-end) ; not a function - (ess-eval-paragraph vis)))) + (condition-case nil + (progn (ess-eval-function vis) + 'function) + ;; TODO: Maybe be smarter than just catching all errors? + (error (ess-eval-paragraph vis) + 'paragraph))) -(defun ess-eval-function-or-paragraph-and-step (vis) +(defun ess-eval-function-or-paragraph-and-step (&optional vis) "Send the current function if \\[point] is inside one. Otherwise send the current paragraph to the inferior ESS process. Prefix arg VIS toggles visibility of ess-code as for `ess-eval-region'." (interactive "P") - (let ((beg-end (ignore-errors (ess-eval-function vis 'no-error)))) ;; ignore-errors is a hack, ess-eval-function gives stupid errors sometimes - (if (null beg-end) ; not a function - (ess-eval-paragraph-and-step vis) - (goto-char (cadr beg-end)) - (if ess-eval-empty - (forward-line 1) - (ess-next-code-line 1))))) + (ess-skip-thing (ess-eval-function-or-paragraph vis)) + (ess-next-code-line)) -(defun ess-eval-region-or-function-or-paragraph (vis) +(defun ess-eval-region-or-function-or-paragraph (&optional vis) "Send the region, function, or paragraph depending on context. Send the region if it is active. If not, send function if `point' is inside one, otherwise the current paragraph. Treats @@ -1718,7 +1742,7 @@ (ess-eval-region (region-beginning) (region-end) vis) (ess-eval-function-or-paragraph vis))) -(defun ess-eval-region-or-function-or-paragraph-and-step (vis) +(defun ess-eval-region-or-function-or-paragraph-and-step (&optional vis) "Send the region, function, or paragraph depending on context. Send the region if it is active. If not, send function if `point' is inside one, otherwise the current paragraph. Treats @@ -1727,18 +1751,13 @@ active. Prefix arg VIS toggles visibility of ess-code as for `ess-eval-region'." (interactive "P") - (if (use-region-p) - (let ((end (region-end))) - (ess-eval-region (region-beginning) end vis) - (goto-char end)) - (ess-eval-function-or-paragraph-and-step vis))) + (ess-skip-thing (ess-eval-region-or-function-or-paragraph vis)) + (ess-next-code-line)) (defun ess-eval-region-or-line-and-step (&optional vis) - "Evaluate region if active, otherwise the current line and step. -Prefix arg VIS toggles visibility of ess-code when evaluating the -region (as for `ess-eval-region') and has no effect for -evaluation of the line. Treats rectangular regions as -`ess-eval-region' does." + "Evaluate region if active, otherwise `ess-eval-line-and-step'. +See `ess-eval-region' for the meaning of VIS. Treats rectangular +regions as `ess-eval-region' does." (interactive "P") (if (use-region-p) (ess-eval-region (region-beginning) (region-end) vis) @@ -1753,7 +1772,14 @@ input will fail." (interactive) (ess-force-buffer-current) - (ess-show-buffer (ess-get-process-buffer)) + (display-buffer (ess-get-process-buffer) + ;; Use a different window for the process buffer: + '(nil (inhibit-same-window . t)) + ;; Pass t to reusable-frames if users have help in + ;; own frames, otherwise help frames get split to + ;; display the inferior. + (or (equal ess-help-own-frame 'one) + ess-help-own-frame)) (let ((ess-eval-visibly t)) (ess-eval-region-or-line-and-step))) @@ -1767,30 +1793,38 @@ (ess-eval-region beg end vis msg))) (defun ess-eval-line-and-step (&optional vis) - "Evaluate the current line and step to the \"next\" line." + "Evaluate the current line and step to the \"next\" line. +See `ess-eval-region' for VIS." (interactive "P") (ess-eval-line vis) - (ess-next-code-line 1)) + (ess-skip-thing 'line) + (ess-next-code-line)) -(defun ess-eval-line-visibly-and-step (&optional simple-next even-empty) +(defun ess-eval-line-visibly-and-step (&optional simple-next) "Evaluate the current line visibly and step to the \"next\" line. If SIMPLE-NEXT is non-nil, possibly via prefix arg, first skip -empty and commented lines. If 2nd arg EVEN-EMPTY [prefix as -well], also send empty lines. When the variable `ess-eval-empty' +empty and commented lines. When the variable `ess-eval-empty' is non-nil both SIMPLE-NEXT and EVEN-EMPTY are interpreted as true. Note that when inside a package and namespaced evaluation is in -place (see `ess-r-set-evaluation-env') evaluation of multiline -input will fail." - (interactive "P\nP"); prefix sets BOTH! +place (see `ess-r-set-evaluation-env'), the evaluation of +multiline input will fail." + (interactive "P") (ess-force-buffer-current) - (ess-show-buffer (ess-get-process-buffer)) - (let ((ess-eval-visibly t)) - (ess-eval-line)) - (if (or simple-next ess-eval-empty even-empty) - (forward-line 1) - (ess-next-code-line 1))) + (display-buffer (ess-get-process-buffer) + ;; Use a different window for the process buffer: + '(nil (inhibit-same-window . t)) + ;; Pass t to reusable-frames if users have help in + ;; own frames, otherwise help frames get split to + ;; display the inferior. + (or (equal ess-help-own-frame 'one) + ess-help-own-frame)) + (let ((ess-eval-visibly t) + (ess-eval-empty (or ess-eval-empty simple-next))) + (ess-eval-line) + (ess-skip-thing 'line) + (ess-next-code-line))) (defun ess-eval-line-invisibly-and-step () "Evaluate the current line invisibly and step to the next line. @@ -1800,42 +1834,10 @@ (ess-eval-line-and-step))) (define-obsolete-function-alias 'ess-eval-line-and-step-invisibly 'ess-eval-line-invisibly-and-step "18.10") -(defun ess-next-code-line (&optional arg skip-to-eob) - "Move ARG lines of code forward (backward if ARG is negative). -Skips past all empty and comment lines. Default for ARG is 1. -Don't skip the last empty and comment lines in the buffer unless -SKIP-TO-EOB is non-nil. On success, return 0. Otherwise, go as -far as possible and return -1." - (interactive "p") - (or arg (setq arg 1)) - (beginning-of-line) - (let ((pos (point)) - (n 0) - (inc (if (> arg 0) 1 -1))) - (while (and (/= arg 0) (= n 0)) - (setq n (forward-line inc)); n=0 is success - (if (not (fboundp 'comment-beginning)) - (while (and (= n 0) - (looking-at "\\s-*\\($\\|\\s<\\)")) - (setq n (forward-line inc))) - (comment-beginning) - (beginning-of-line) - (forward-comment (* inc (buffer-size))) ;; as suggested in info file - ) - (if (or skip-to-eob - (not (looking-at ess-no-skip-regexp))) ;; don't go to eob or whatever - (setq arg (- arg inc)) - (goto-char pos) - (setq arg 0) - (forward-line 1));; stop at next empty line - (setq pos (point))) - (goto-char pos) - n)) - ;;;*;;; Evaluate and switch to S -(defun ess-eval-region-and-go (start end vis) +(defun ess-eval-region-and-go (start end &optional vis) "Send region from START to END to the inferior process buffer. START and END default to the current region, and rectangular regions are treated as `ess-eval-region'. VIS has same meaning as @@ -1844,46 +1846,44 @@ (ess-eval-region start end vis) (ess-switch-to-ESS t)) -(defun ess-eval-buffer-and-go (vis) +(defun ess-eval-buffer-and-go (&optional vis) "Send the current buffer to the inferior S and switch to the process buffer. VIS has same meaning as for `ess-eval-region'." (interactive "P") (ess-eval-buffer vis) (ess-switch-to-ESS t)) -(defun ess-eval-function-and-go (vis) +(defun ess-eval-function-and-go (&optional vis) "Send the current function, then switch to the inferior process buffer. VIS has same meaning as for `ess-eval-region'." (interactive "P") (ess-eval-function vis) (ess-switch-to-ESS t)) -(defun ess-eval-line-and-go (vis) +(defun ess-eval-line-and-go (&optional vis) "Send the current line, then switch to the inferior process buffer. VIS has same meaning as for `ess-eval-region'." (interactive "P") (ess-eval-line vis) (ess-switch-to-ESS t)) -(defun ess-eval-paragraph-and-go (vis) +(defun ess-eval-paragraph-and-go (&optional vis) "Send the current paragraph, then switch to the inferior process buffer. VIS has same meaning as for `ess-eval-region'." (interactive "P") (ess-eval-paragraph vis) (ess-switch-to-ESS t)) -(defun ess-eval-paragraph-and-step (vis) +(defun ess-eval-paragraph-and-step (&optional vis) "Evaluate the current paragraph and move point to the next line. If not inside a paragraph, evaluate the next one. VIS has same meaning as for `ess-eval-region'." (interactive "P") - (let ((beg-end (ess-eval-paragraph vis))) - (goto-char (cadr beg-end)) - (if ess-eval-empty - (forward-line 1) - (ess-next-code-line 1)))) + (ess-eval-paragraph vis) + (ess-skip-thing 'paragraph) + (ess-next-code-line)) - ; Inferior S mode + ; Inferior ESS mode ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;; In this section: ;;;; @@ -1896,39 +1896,31 @@ (defvar inferior-ess-mode-map (let ((map (make-sparse-keymap))) - (set-keymap-parent map comint-mode-map) - (define-key map "\C-y" 'ess-yank) - (define-key map "\r" 'inferior-ess-send-input) - (define-key map "\C-a" 'comint-bol) + (define-key map "\C-y" #'ess-yank) + (define-key map "\r" #'inferior-ess-send-input) + (define-key map "\C-a" #'comint-bol) ;; 2010-06-03 SJE - ;; disabled this in favour of ess-dirs. Martin was not sure why this + ;; disabled this in favor of ess-dirs. Martin was not sure why this ;; key was defined anyway in this mode. - ;;(define-key map "\M-\r" 'ess-transcript-send-command-and-move) - (define-key map "\C-c\M-l" 'ess-load-file);; no longer overwrites C-c C-l; - ;; but for now the user deserves a message: - (define-key map "\C-c\C-l" 'ess-msg-and-comint-dynamic-list-input-ring) - (define-key map "\C-c`" 'ess-show-traceback) - (define-key map [(control ?c) ?~] 'ess-show-call-stack) - (define-key map "\C-c\C-d" 'ess-dump-object-into-edit-buffer) - (define-key map "\C-c\C-v" 'ess-display-help-on-object) - (define-key map "\C-c\C-q" 'ess-quit) - (define-key map "\C-c\C-s" 'ess-execute-search) - (define-key map "\C-c\C-x" 'ess-execute-objects) - (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 - (define-key map "\t" 'completion-at-point) - (define-key map "\C-c\t" 'ess-complete-object-name-deprecated) - (define-key map "\M-?" 'ess-list-object-completions) - (define-key map "\C-c\C-k" 'ess-request-a-process) - (define-key map "," 'ess-smart-comma) - (define-key map (kbd "C-c C-=") 'ess-cycle-assign) - (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) - (with-no-warnings ; Obsolete key variable - (when ess-smart-S-assign-key - (define-key map ess-smart-S-assign-key 'ess-smart-S-assign))) + ;;(define-key map "\M-\r" #'ess-transcript-send-command-and-move) + (define-key map "\C-c\M-l" #'ess-load-file) + (define-key map "\C-c`" #'ess-show-traceback) + (define-key map [(control ?c) ?~] #'ess-show-call-stack) + (define-key map "\C-c\C-d" #'ess-dump-object-into-edit-buffer) + (define-key map "\C-c\C-v" #'ess-display-help-on-object) + (define-key map "\C-c\C-q" #'ess-quit) + (define-key map "\C-c\C-s" #'ess-execute-search) + (define-key map "\C-c\C-x" #'ess-execute-objects) + (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 + (define-key map "\t" #'completion-at-point) + (define-key map "\M-?" #'ess-complete-object-name) + (define-key map "\C-c\C-k" #'ess-request-a-process) + (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) map) "Keymap for `inferior-ess' mode.") @@ -1936,13 +1928,13 @@ inferior-ess-mode-menu inferior-ess-mode-map "Menu for use in Inferior S mode" '("iESS" - ["What is this? (beta)" ess-mouse-me t] - ["Quit" ess-quit t] + ["Quit" ess-quit t] + ["Reload process" inferior-ess-reload t] ;; ["Send and move" ess-transcript-send-command-and-move t] - ["Copy command" comint-copy-old-input t] - ["Send command" inferior-ess-send-input t] - ["Switch to Script Buffer" ess-switch-to-inferior-or-script-buffer t] - ["Get help on S object" ess-display-help-on-object t] + ["Copy command" comint-copy-old-input t] + ["Send command" inferior-ess-send-input t] + ["Switch to script buffer" ess-switch-to-inferior-or-script-buffer t] + ["Get help on S object" ess-display-help-on-object t] "------" ("Process" ["Process Echoes" (lambda () (interactive) @@ -1954,23 +1946,23 @@ :filter ess--generate-eval-visibly-submenu )) "------" ("Utils" - ;; need a toggle switch for above, AJR. - ["Attach directory" ess-execute-attach t] - ["Display object list" ess-execute-objects t] - ["Display search list" ess-execute-search t] - ["Edit S Object" ess-dump-object-into-edit-buffer t] - ["Enter S command" ess-execute t] - ["Jump to Error" ess-parse-errors t] - ["Load source file" ess-load-file t] + ["Attach directory" ess-execute-attach t] + ["Display object list" ess-execute-objects t] + ["Display search list" ess-execute-search t] + ["Edit S object" ess-dump-object-into-edit-buffer t] + ["Enter S command" ess-execute t] + ["Jump to error" ess-parse-errors t] + ["Load source file" ess-load-file t] ["Resynch S completions" ess-resynch t] - ;; ["Recreate R and S versions known to ESS" (ess-r-s-versions-creation+menu) t] + ["Recreate R versions known to ESS" + (lambda () (interactive) (ess-r-redefine-runners 'verbose)) t] ) "------" ("start-dev" :visible nil); <-- ?? ("end-dev" :visible nil) "------" ("Font Lock" - :active inferior-ess-font-lock-keywords + :active ess-font-lock-keywords :filter ess--generate-font-lock-submenu) "------" ["Describe" describe-mode t] @@ -1982,88 +1974,28 @@ (defvar ess-mode-minibuffer-map (let ((map (make-sparse-keymap))) (set-keymap-parent map minibuffer-local-map) - (define-key map "\t" 'ess-complete-object-name) - (define-key map "\C-\M-i" 'ess-complete-object-name) ;; doesn't work:( - (define-key map "\C-c\C-s" 'ess-execute-search) - (define-key map "\C-c\C-x" 'ess-execute-objects) + (define-key map "\t" #'ess-complete-object-name) + (define-key map "\C-\M-i" #'ess-complete-object-name) ;; doesn't work:( + (define-key map "\C-c\C-s" #'ess-execute-search) + (define-key map "\C-c\C-x" #'ess-execute-objects) map) "Keymap used in `ess-execute'.") -;;;###autoload -(defun inferior-ess-mode () +(define-derived-mode inferior-ess-mode comint-mode "iESS" "Major mode for interacting with an inferior ESS process. -Runs an S interactive job as a subprocess of Emacs, with I/O through an -Emacs buffer. Variable `inferior-ess-program' controls which S -is run. - -Commands are sent to the ESS process by typing them, and pressing -\\[inferior-ess-send-input]. Pressing \\[complete-dynamic-complete] -completes known object names or filenames, as appropriate. Other -keybindings for this mode are: - -\\{inferior-ess-mode-map} - -When editing S objects, the use of \\[ess-load-file] is advocated. -`ess-load-file' keeps source files (if `ess-keep-dump-files' is non-nil) in -the directory specified by `ess-source-directory', with the -filename chosen according to `ess-dump-filename-template'. When a file is -loaded, `ess-mode' parses error messages and jumps to the appropriate file -if errors occur. The ess-eval- commands do not do this. - -Customization: Entry to this mode runs the hooks on `comint-mode-hook' and -`inferior-ess-mode-hook' (in that order). - -You can send text to the inferior ESS process from other buffers -containing source code. The key bindings of these commands can be -found by typing \\[describe-mode]. - - `ess-eval-region' sends the current region to the ESS process. - `ess-eval-buffer' sends the current buffer to the ESS process. - `ess-eval-function' sends the current function to the ESS process. - `ess-eval-line' sends the current line to the ESS process. - `ess-beginning-of-function' and `ess-end-of-function' move the point to - the beginning and end of the current S function. - `ess-switch-to-ESS' switches the current buffer to the ESS process buffer. - `ess-switch-to-end-of-ESS' switches the current buffer to the ESS process - buffer and puts point at the end of it. - - `ess-eval-region-and-go', `ess-eval-buffer-and-go', - `ess-eval-function-and-go', and `ess-eval-line-and-go' switch to the S - process buffer after sending their text. - `ess-dump-object-into-edit-buffer' moves an S object into a temporary file - and buffer for editing - `ess-load-file' sources a file of commands to the ESS process. - -Commands: -Return after the end of the process' output sends the text from the - end of process to point. -Return before the end of the process' output copies the sexp ending at point - to the end of the process' output, and sends it. -Delete converts tabs to spaces as it moves back. -C-M-q does Tab on each line starting within following expression. -Paragraphs are separated only by blank lines. Crosshatches start comments. -If you accidentally suspend your process, use \\[comint-continue-subjob] -to continue it." - (interactive) - (delay-mode-hooks - (comint-mode)) - (set (make-local-variable 'comint-input-sender) 'inferior-ess-input-sender) - (set (make-local-variable 'process-connection-type) t) - ;; initialize all custom vars: - (ess-setq-vars-local ess-customize-alist) ; (current-buffer)) - +To learn more about how to use inferior ess modes, see Info +node `(ess)Top'. If you accidentally suspend your process, use +\\[comint-continue-subjob] to continue it." + :group 'ess-proc + (setq-local comint-input-sender 'inferior-ess-input-sender) + (setq-local font-lock-fontify-region-function + #'inferior-ess-fontify-region) ;; If comint-process-echoes is t inferior-ess-input-sender - ;; recopies the input, otherwise not. VS[03-09-2012]: should be in customize-alist - (set (make-local-variable 'comint-process-echoes) - (not (member ess-language '("SAS" "XLS" "OMG" "julia")))) ;; these don't echo - - (when (and (member ess-dialect '("R")) ;; S+ echoes!! - (not (eq ess-eval-visibly t))) - ;; when 'nowait or nil, don't wait for process - (setq comint-process-echoes nil)) + ;; recopies the input, otherwise not + (setq-local comint-process-echoes (not (member ess-language '("SAS" "XLS" "OMG" "julia")))) (when comint-use-prompt-regexp ;; why comint is not setting this? bug? - (set (make-local-variable 'inhibit-field-text-motion) t)) + (setq-local inhibit-field-text-motion t)) (unless inferior-ess-prompt ;; build when unset (setq inferior-ess-prompt @@ -2073,70 +2005,33 @@ inferior-ess-secondary-prompt "\\)"))) (setq comint-prompt-regexp (concat "^" inferior-ess-prompt)) - (setq comint-get-old-input 'inferior-ess-get-old-input) ;; todo: this is R specific - (add-hook 'comint-input-filter-functions 'ess-search-path-tracker nil 'local) ;; R and S specific - (setq major-mode 'inferior-ess-mode) - (setq mode-name "iESS") ;(concat "iESS:" ess-dialect)) (setq mode-line-process '(" [" ess--mode-line-process-indicator ess--local-mode-line-process-indicator "]: %s")) - (use-local-map inferior-ess-mode-map) - (let ((inf-syntax-table (or inferior-ess-mode-syntax-table - ess-mode-syntax-table))) - (when inf-syntax-table - (set-syntax-table inf-syntax-table))) - - (ess-write-to-dribble-buffer - (format "(i-ess 1): buf=%s, lang=%s, comint..echo=%s, comint..sender=%s,\n" - (current-buffer) ess-language - comint-process-echoes comint-input-sender)) - - (when (string= ess-language "S") ;; todo: what is this doing here? - (local-set-key "\M-\r" 'ess-dirs)) - - ;; SJE 2007-06-28: Emacs 22.1 has a bug in that comint-mode will set - ;; this variable to t, when we need it to be nil. The Emacs 22 - ;; solution to this bug is to use define-derived-mode to derive - ;; inferior-ess-mode from comint-mode. Not sure if we can go down - ;; that route yet. I've used the when condition so that if the var - ;; is nil, don't bother setting it -- as setting it will make a new - ;; local var. - (when font-lock-keywords-only - (setq font-lock-keywords-only nil)) ;;; Completion support ---------------- (remove-hook 'completion-at-point-functions 'comint-completion-at-point t) ;; reset the hook (add-hook 'completion-at-point-functions 'comint-c-a-p-replace-by-expanded-history nil 'local) (add-hook 'completion-at-point-functions 'ess-filename-completion nil 'local) - ;; (setq comint-completion-addsuffix nil) ; To avoid spaces after filenames - ;; KH: next 2 lines solve. - (set (make-local-variable 'comint-completion-addsuffix) - (cons "/" "")) + + ;; hyperlinks support + (goto-address-mode t) + + ;; Avoid spaces after filenames + (setq-local comint-completion-addsuffix (cons "/" "")) + (setq comint-input-autoexpand t) ; Only for completion, not on input. - ;; timers - ;; (add-hook 'ess-idle-timer-functions 'ess-cache-search-list nil 'local) - ;; (add-hook 'ess-idle-timer-functions 'ess-synchronize-dirs nil 'local) - ;;; Keep out of the code. - (set (make-local-variable 'indent-tabs-mode) nil) - (set (make-local-variable 'paragraph-start) - (concat inferior-ess-primary-prompt "\\|\^L")) - (set (make-local-variable 'paragraph-separate) "\^L") - (if (featurep 'jit-lock) - (setq-local jit-lock-chunk-size inferior-ess-jit-lock-chunk-size)) - (make-local-variable 'kill-buffer-hook) - (add-hook 'kill-buffer-hook 'ess-kill-buffer-function) - (run-mode-hooks 'inferior-ess-mode-hook) - (ess-write-to-dribble-buffer - (format "(i-ess end): buf=%s, lang=%s, comint..echo=%s, comint..sender=%s,\n" - (current-buffer) ess-language - comint-process-echoes comint-input-sender)) - (message - (concat (substitute-command-keys - "Type \\[describe-mode] for help on ESS version ") - ess-version))) + + (add-hook 'window-configuration-change-hook #'ess-set-width nil t) + (setq-local indent-tabs-mode nil) + + (setq-local paragraph-start (concat inferior-ess-primary-prompt "\\|\^L")) + (setq-local paragraph-separate "\^L") + (setq-local jit-lock-chunk-size inferior-ess-jit-lock-chunk-size)) + ;;*;; Commands used exclusively in inferior-ess-mode @@ -2145,7 +2040,7 @@ (defun inferior-ess-input-sender (proc string) (inferior-ess--interrupt-subjob-maybe proc) - (let ((comint-input-filter-functions nil)) ; comint runs them, don't run twise. + (let ((comint-input-filter-functions nil)) ; comint runs them, don't run twice. (if comint-process-echoes (ess-eval-linewise string nil nil ess-eval-empty) (ess-send-string proc string)))) @@ -2164,13 +2059,13 @@ (setq ess-object-list nil)) (defun inferior-ess--goto-input-start:field () - "Move point to the begining of input skiping all continuation lines. -If in the output field, goes to the begining of previous input + "Move point to the beginning of input skipping all continuation lines. +If in the output field, goes to the beginning of previous input field. Note: `inferior-ess-secondary-prompt' should match exactly." (goto-char (field-beginning)) - ;; move to the begining of non-output field - (while (and (not (= (point) (point-min))) + ;; move to the beginning of non-output field + (while (and (not (bobp)) (eq (field-at-pos (point)) 'output)) (goto-char (field-beginning nil t))) ;; skip all secondary prompts @@ -2184,8 +2079,8 @@ (setq pos (previous-single-property-change pos 'field))))) (defun inferior-ess--goto-input-end:field () - "Move point to the end of input skiping all continuation lines. -If in the output field, goes to the begining of previous input + "Move point to the end of input skipping all continuation lines. +If in the output field, goes to the beginning of previous input field. NOTE: to be used only with fields, see `comint-use-prompt-regexp'." ;; this func is not used but might be useful some day @@ -2221,13 +2116,13 @@ (setq pos (next-single-property-change pos 'field))) command)))) -;; todo: error when entering a multiline function +;; TODO: error when entering a multiline function ;; check.integer <- function(N){ ;; is.integer(N) | !length(grep("[^[:digit:]]", as.character(N))) ;; } (defun inferior-ess--goto-input-start:regexp () - "Move point to the begining of input skiping all continuation lines. -If in the output field, goes to the begining of previous input." + "Move point to the beginning of input skipping all continuation lines. +If in the output field, goes to the beginning of previous input." (beginning-of-line) (unless (looking-at inferior-ess-prompt) (re-search-backward (concat "^" inferior-ess-prompt) nil t)) @@ -2237,7 +2132,7 @@ (while (and (> (forward-line -1) -1) (looking-at inferior-ess-secondary-prompt)))) (unless (looking-at inferior-ess-prompt) - (error "Beggining of input not found")) + (error "Beginning of input not found")) (comint-skip-prompt)) (defun inferior-ess--get-old-input:regexp () @@ -2262,7 +2157,6 @@ (setq command (concat command "\n" (buffer-substring-no-properties (point) (point-at-eol)))))) (forward-line -1) - (setq ess-temp-point (point)) ;; this is ugly, used by transcript command) (message "No command at this point") "")))) @@ -2299,8 +2193,8 @@ (ess-execute the-command invert "S objects" the-message))) (defun ess-execute-search (invert) - "Send the `inferior-ess-search-list-command' command to the `ess-language' process. -[search(..) in S]" + "Send the `inferior-ess-search-list-command' command. +INVERT is as in `ess-execute'. E.g. search(..) in S." (interactive "P") (ess-execute inferior-ess-search-list-command invert "S search list")) @@ -2328,32 +2222,66 @@ (interactive) (if (null ess-execute-screen-options-command) (message "Not implemented for '%s'" ess-dialect) - ;; We cannot use (window-width) here because it returns sizes in default - ;; (frame) characters which leads to incorrect sizes with scaled fonts.To - ;; solve this we approximate font width in pixels and use window-pixel-width - ;; to compute the approximate number of characters that fit into line. - (let* ((wedges (window-inside-pixel-edges)) - (wwidth (- (nth 2 wedges) (nth 0 wedges))) - (nchars (if (fboundp 'default-font-width) - (floor (/ wwidth (default-font-width))) - ;; emacs 24 - (if (display-graphic-p) - (let* ((r (/ (float (frame-char-height)) (frame-char-width))) - (charh (aref (font-info (face-font 'default)) 3)) - (charw (/ charh r))) - (- (floor (/ wwidth charw)) 1)) - ;; e.g., no X11 as in 'emacs -nw' - (- (window-width) 2)))) - (command (format ess-execute-screen-options-command nchars))) + (let ((command (ess-calculate-width 'window))) (if invisibly (ess-command command) (ess-eval-linewise command nil nil nil 'wait-prompt))))) +(defun ess-calculate-width (opt) + "Calculate width command given OPT. +OPT can be \\='window, \\='frame, or an integer. Return a command +suitable to send to the inferior process (e.g. +\"options(width=80, length=999999)\")." + (when (null ess-execute-screen-options-command) + (error "Not implemented for %s" ess-dialect)) + (let (command) + (cond ((and (integerp opt) + (>= opt 0)) + (setq command (format ess-execute-screen-options-command opt))) + ((or (eql 'window opt) + (and (integerp opt) + (> 0 opt))) + ;; We cannot use (window-width) here because it returns sizes + ;; in default (frame) characters which leads to incorrect + ;; sizes with scaled fonts.To solve this we approximate font + ;; width in pixels and use window-pixel-width to compute the + ;; approximate number of characters that fit into line. + (let* ((wedges (window-inside-pixel-edges)) + (wwidth (- (nth 2 wedges) (nth 0 wedges))) + (nchars (floor (/ wwidth (default-font-width))))) + (when (and (integerp opt) + (> 0 opt)) + (setq nchars (- nchars (- opt)))) + (setq command (format ess-execute-screen-options-command + nchars)))) + ((eql 'frame opt) + (setq command + (format ess-execute-screen-options-command (frame-width)))) + (t (error "OPT (%s) not 'window, 'frame or an integer" opt))) + command)) + +(defun ess-set-width () + "Set the width option. +A part of `window-configuration-change-hook' in inferior ESS +buffers." + (when (and ess-auto-width + ess-execute-screen-options-command) + ;; `window-configuration-change-hook' runs with the window selected. + (let ((proc (get-buffer-process (window-buffer))) + command) + ;; TODO: Set the width once the process is no longer busy. + (when (and (process-live-p proc) + (not (process-get proc 'busy))) + (setq command (ess-calculate-width ess-auto-width)) + (if ess-auto-width-visible + (ess-eval-linewise command nil nil nil 'wait-prompt) + (ess-command command)))))) + (defun ess-execute (command &optional invert buff message) "Send a command to the ESS process. A newline is automatically added to COMMAND. Prefix arg (or second arg INVERT) means invert the meaning of -`ess-execute-in-process-buffer'. If INVERT is 'buffer, output is +`ess-execute-in-process-buffer'. If INVERT is \\='buffer, output is forced to go to the process buffer. If the output is going to a buffer, name it *BUFF*. This buffer is erased before use. Optional fourth arg MESSAGE is text to print at the top of the buffer (defaults @@ -2363,7 +2291,7 @@ (let ((enable-recursive-minibuffers t) (proc-name (progn (ess-force-buffer-current) ess-local-process-name))) - (with-current-buffer (get-buffer " *Minibuf-1*") ;; fixme: hardcoded name + (with-current-buffer (get-buffer " *Minibuf-1*") ;; FIXME: hardcoded name (setq ess-local-process-name proc-name)) (read-from-minibuffer "Execute> " nil ess-mode-minibuffer-map)) @@ -2376,34 +2304,40 @@ ess-execute-in-process-buffer))) (if in-pbuff (ess-eval-linewise the-command) - (let ((buff (ess-create-temp-buffer buff-name))) - (ess-command the-command buff);; sleep? - (with-current-buffer buff - (goto-char (point-min)) - (if message (insert message) - (if buff nil - ;; Print the command in the buffer if it has not been - ;; given a special name - (insert "> " the-command))) - (setq ess-local-process-name ess-current-process-name)) - (ess-display-temp-buffer buff))))) + (ess-with-current-buffer (get-buffer-create buff-name) + (ess-command the-command (current-buffer) nil nil nil + (get-process ess-local-process-name)) + (ansi-color-apply-on-region (point-min) (point-max)) + (goto-char (point-min)) + (if message (insert message) + (insert "> " the-command)) + (display-buffer (current-buffer)))))) ;;;*;;; Quitting -(ess-defgeneric ess-quit (&rest args) - "Issue an exiting command to the inferior process, additionally -also running \\[ess-cleanup]." - (interactive) - (ess-force-buffer-current "Process to quit: " nil 'no-autostart) +(cl-defgeneric ess-quit--override (_arg) + "Stop the inferior process." + (let ((proc (ess-get-process))) + (ess-cleanup) + (when ess-eval-visibly + (goto-char (marker-position (process-mark proc))) + (insert inferior-ess-exit-command)) + (process-send-string proc inferior-ess-exit-command))) + +(defun ess-quit (&optional arg) + "Issue an exiting command to the inferior process. +Runs `ess-cleanup'. ARG gets passed to a language specific +method, see `ess-quit--override'." + (interactive "P") + (unless (ess-process-live-p) + (user-error "No live ESS process associated with this buffer")) + (ess-force-buffer-current "Process to quit: ") (ess-interrupt) (ess-make-buffer-current) - (:override - (let ((proc (ess-get-process))) - (ess-cleanup) - (goto-char (marker-position (process-mark proc))) - (insert inferior-ess-exit-command) - (process-send-string proc inferior-ess-exit-command)))) + (ess-quit--override arg)) + +(defvar ess--interrupt-timeout 5) (defun ess-interrupt () "Interrupt the inferior process. @@ -2411,17 +2345,19 @@ (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)))) + (ess--interrupt proc) + (unless (ess-wait-for-process proc nil nil nil + ess--interrupt-timeout) + (error "Timeout while interrupting process")) + (with-current-buffer (process-buffer proc) + (goto-char (process-mark proc))))) + +(defun ess--interrupt (proc) + (interrupt-process proc comint-ptyp) + ;; Workaround for Windows terminals. NOTE: Is this really needed + ;; for background commands? Or just for interactive interrupts? + (unless (memq system-type '(gnu/linux darwin)) + (process-send-string nil "\n"))) (defun ess-abort () "Kill the ESS process, without executing .Last or terminating devices. @@ -2437,12 +2373,14 @@ (message "Good move."))) (defun ess-cleanup () - "Possibly kill or offer to kill, depending on the value of -`ess-S-quit-kill-buffers-p', all buffers associated with this ESS process. -Leaves you in the ESS process buffer. It's a good idea to run this -before you quit. It is run automatically by \\[ess-quit]." + "Cleanup buffers associated with the process. +Possibly kill or offer to kill, depending on the value of +`ess-S-quit-kill-buffers-p', all buffers associated with this ESS +process. Uses `display-buffer' to display the process buffer. It +is run automatically by \\[ess-quit]." (interactive) - (let ((the-procname (or (ess-make-buffer-current) ess-local-process-name))) + (let* ((the-procname (or (ess-make-buffer-current) ess-local-process-name)) + (buf (buffer-name (process-buffer (get-process the-procname))))) (unless the-procname (error "I don't know which ESS process to clean up after!")) (when @@ -2460,43 +2398,50 @@ ess-local-process-name (equal ess-local-process-name the-procname)) (kill-buffer buf))))) - (ess-switch-to-ESS nil))) + (display-buffer buf) + buf)) -(ess-defgeneric inferior-ess-reload (&optional start-args) - "Reload the inferior process." +(defun inferior-ess-reload (&optional start-args) + "Reload the inferior process. +START-ARGS gets passed to the dialect-specific +`inferior-ess-reload-override'." (interactive) - (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"))))) + (let* ((inf-buf (inferior-ess-force)) + (inf-proc (get-buffer-process inf-buf)) + (inf-start-data (buffer-local-value 'inferior-ess--local-data inf-buf)) + (start-name (car inf-start-data)) + (start-args (or start-args (cdr inf-start-data)))) + ;; Interrupt early so we can get working directory + (ess-interrupt) + ;; Quit debugging session before reloading + (when (ess-debug-active-p) + (ess-debug-command-quit) + (ess-wait-for-process inf-proc nil nil nil 1)) + (save-window-excursion + ;; Make sure we don't ask for directory again + ;; Use current working directory as default + (let ((project-find-functions nil) + (ess-startup-directory-function nil) + (ess-startup-directory (ess-get-process-variable 'default-directory)) + (ess-ask-for-ess-directory nil)) + (ess-quit 'no-save) + (inferior-ess--wait-for-exit inf-proc) + (with-current-buffer inf-buf + (inferior-ess-reload--override start-name start-args)))))) + +(cl-defgeneric inferior-ess-reload--override (_start-name _start-args) + (user-error "Reloading not implemented for %s" ess-dialect)) (defun inferior-ess--wait-for-exit (proc) - "Wait for process exit. + "Wait for process PROC to 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) + (when (> (- (float-time) start-time) 30) (error "Timeout while quitting process"))))) -(defun ess-kill-buffer-function () - "Function run just before an ESS process buffer is killed." - ;; This simply deletes the buffers process to avoid an Emacs bug - ;; where the sentinel is run *after* the buffer is deleted - (let ((proc (get-buffer-process (current-buffer)))) - (if (processp proc) (delete-process proc)))) - ;;;*;;; Support functions @@ -2543,9 +2488,9 @@ (> (car (cdr mod1)) (car (cdr mod2))))))) (defun ess-get-object-list (name &optional exclude-first) - "Return a list of current S object names associated with process NAME, -using `ess-object-list' if that is non-nil. -If exclude-first is non-nil, don't return objects in first positon (.GlobalEnv)." + "Return a list of current S object names associated with process NAME. +Uses `ess-object-list' if that is non-nil. If EXCLUDE-FIRST is +non-nil, don't return objects in first positon (.GlobalEnv)." (or ess-object-list ;; <<- MM: this is now always(?) nil; we cache the *-modtime-alist (with-current-buffer (process-buffer (ess-get-process name)) (ess-make-buffer-current) @@ -2572,14 +2517,16 @@ (append result (ess-extract-onames-from-alist alist i))) (setq i (1+ i))) - (setq ess-object-list (ess-uniq-list result)))))) + (setq ess-object-list (delete-dups result)))))) -(defun ess-get-words-from-vector (command &optional no-prompt-check wait proc) +(defun ess-get-words-from-vector (command &optional no-prompt-check wait proc + timeout) "Evaluate the S command COMMAND, which returns a character vector. Return the elements of the result of COMMAND as an alist of strings. COMMAND should have a terminating newline. -NO-PROMPT-CHECK, WAIT, and PROC are passed to `ess-command'. -FILTER may be the keyword 'non-... or nil. To avoid truncation of +NO-PROMPT-CHECK, WAIT, PROC, and TIMEOUT are passed to `ess-command'. + +FILTER may be the keyword \\='non-... or nil. To avoid truncation of long vectors, wrap your command (%s) like this, or a version with explicit options(max.print=1e6): \"local({ out <- try({%s}); print(out, max=1e6) })\n\"." @@ -2589,7 +2536,7 @@ " *ess-get-words*")); initial space: disable-undo (word-RE (concat "\\(" - "\\\\\\\"" "\\|" "[^\"]" ; \" or non-"-char + "\\\\\"" "\\|" "[^\"]" ; \" or non-"-char "\\)*")) (full-word-regexp (concat "\"" "\\(" word-RE "\\)" @@ -2597,11 +2544,7 @@ "\\( \\|$\\)"; space or end )) words) - (ess-if-verbose-write - (format "(ess-get-words-* command=%s full-word-regexp=%S)\n" - command full-word-regexp)) - (ess-command command tbuffer 'sleep no-prompt-check wait proc) - (ess-if-verbose-write " [ok] ..") + (ess-command command tbuffer 'sleep no-prompt-check wait proc nil timeout) (with-current-buffer tbuffer (goto-char (point-min)) (while (re-search-forward full-word-regexp nil t) @@ -2613,6 +2556,10 @@ (format " |-> words= '%s'\n" words))) (reverse words))) +(defun ess-get-words-from-vector--foreground (command &optional no-prompt-check wait proc) + (let ((timeout most-positive-fixnum)) + (ess-get-words-from-vector command no-prompt-check wait proc timeout))) + (defun ess-compiled-dir (dir) "Return non-nil if DIR is an S object directory with special files. I.e. if the filenames in DIR are not representative of the objects in DIR." @@ -2704,8 +2651,8 @@ (when (re-search-forward "(list" nil t) (goto-char (match-beginning 0)) (setq args (ignore-errors (eval (read (current-buffer))))) - (if args - (setcar args (cons (car args) (current-time))))) + (when args + (setcar args (cons (car args) (current-time))))) ;; push even if nil (puthash (substring-no-properties funname) args cache))))))) @@ -2728,8 +2675,7 @@ (pos 2) name (buffer (get-buffer-create " *ess-db*")) - (temp-object-name-db nil) - (temp-object-name-db-file ess-object-name-db-file)) + (temp-object-name-db nil)) (ess-write-to-dribble-buffer (format "(object db): search-list=%s \n " search-list)) @@ -2755,33 +2701,37 @@ (setq ess-object-name-db temp-object-name-db))) (defun ess-resynch nil - "Reread all directories/objects in variable `ess-search-list' to form completions." + "Reread all directories and objects in `ess-search-list' for completions." (interactive) (if (ess-make-buffer-current) nil (error "Not an ESS process buffer")) - (setq ess-sl-modtime-alist nil) - (setq ess-object-list nil) - (setq ess-object-name-db nil) ; perhaps it would be better to reload? + (setq + ess-sl-modtime-alist nil + ess-object-list nil + ess-object-name-db nil ; perhaps it would be better to reload? + ) (ess-process-put 'sp-for-help-changed? t) + ;; Action! : (ess-get-modtime-list)) (defun ess-filename-completion () - ;; > emacs 24 "Return completion only within string or comment." - (save-restriction ;; explicitely handle inferior-ess + (save-restriction ;; explicitly handle inferior-ess (ignore-errors - (when (and (eq major-mode 'inferior-ess-mode) + (when (and (derived-mode-p 'inferior-ess-mode) (> (point) (process-mark (get-buffer-process (current-buffer))))) (narrow-to-region (process-mark (get-buffer-process (current-buffer))) (point-max)))) - (when (ess-inside-string-or-comment-p (point)) + (when (and (not (equal ?` (nth 3 (syntax-ppss (point))))) + (ess-inside-string-or-comment-p (point))) (append (comint-filename-completion) '(:exclusive no))))) (defun ess-complete-filename () "Do file completion only within strings." - (save-restriction ;; explicitely handle inferior-ess + (declare (obsolete comint-filename-completion "ESS 19.04")) + (save-restriction ;; explicitly handle inferior-ess (ignore-errors - (when (and (eq major-mode 'inferior-ess-mode) + (when (and (derived-mode-p 'inferior-ess-mode) (> (point) (process-mark (get-buffer-process (current-buffer))))) (narrow-to-region (process-mark (get-buffer-process (current-buffer))) (point-max)))) @@ -2792,6 +2742,7 @@ ;; Heuristic: after partial pathname if it looks like we're in a ;; string, and that string looks like a pathname. Not the best for ;; use with unix() (or it's alias, !). Oh well. + (declare (obsolete comint-filename-completion "ESS 19.04")) (save-excursion (save-match-data (let ((opoint (point))) @@ -2859,7 +2810,7 @@ (defun ess-get-modtime-list (&optional cache-var-name exclude-first) "Record directories in the search list, and the objects in those directories. The result is stored in CACHE-VAR-NAME. If nil, CACHE-VAR-NAME -defaultst to `ess-sl-modtime-alist'. If EXCLUDE-FIRST is non-nil +defaults to `ess-sl-modtime-alist'. If EXCLUDE-FIRST is non-nil don't recompile first object in the search list." ;; Operation applies to process of current buffer (let* ((searchlist (if exclude-first @@ -2869,19 +2820,18 @@ (cache-name (or cache-var-name 'ess-sl-modtime-alist)) pack newalist) (while searchlist - (setq pack (car searchlist)) - (setq newalist - (append - newalist - (list (or (assoc pack (symbol-value cache-name)) - (append - (list pack (ess-dir-modtime pack)) - (prog2 - (message "Forming completions for %s..." pack) - (ess-object-names pack index) - (message "Forming completions for %s...done" pack))))))) - (setq index (1+ index)) - (setq searchlist (cdr searchlist))) + (setq + pack (car searchlist) + newalist (append newalist + (list (or (assoc pack (symbol-value cache-name)) + (append + (list pack (ess-dir-modtime pack)) + (prog2 + (message "Forming completions for %s..." pack) + (ess-object-names pack index) + (message "Forming completions for %s...done" pack)))))) + index (1+ index) + searchlist (cdr searchlist))) ;;DBG: (ess-write-to-dribble-buffer (format "(%s): created new alist of length %d\n" @@ -2892,7 +2842,7 @@ (defun ess-search-path-tracker (str) "Check if input STR changed the search path. This function monitors user input to the inferior ESS process so -that Emacs can keep the process variable 'search-list' up to +that Emacs can keep the process variable `search-list' up to date. `ess-completing-read' in \\[ess-read-object-name] uses this list indirectly when it prompts for help or for an object to dump. From ESS 12.09 this is not necessary anymore, as the search @@ -2906,16 +2856,15 @@ ;;; Miscellaneous routines ;;;*;;; Routines for reading object names -(ess-defgeneric ess-read-object-name (p-string) +(defun ess-read-object-name (p-string) "Read an object name from the minibuffer with completion, and return it. P-STRING is the prompt string." - (:override - (let* ((default (ess-read-object-name-dump)) - (object-list (ess-get-object-list ess-local-process-name)) - (spec (ess-completing-read p-string object-list nil nil nil nil default))) - (list (cond - ((string= spec "") default) - (t spec)))))) + (let* ((default (ess-read-object-name-dump)) + (object-list (ess-get-object-list ess-local-process-name)) + (spec (ess-completing-read p-string object-list nil nil nil nil default))) + (list (cond + ((string= spec "") default) + (t spec))))) (defun ess-read-object-name-default () "Return the object name at point, or nil if none." @@ -2953,7 +2902,7 @@ (defvar ess--handy-history nil) (defun ess-handy-commands () - "Request and execute a command from `ess-handy-commands' list." + "Request and execute a command from variable `ess-handy-commands'." (interactive) (let* ((commands (or ess--local-handy-commands ess-handy-commands)) @@ -2980,7 +2929,7 @@ (progn (delete-horizontal-space) (insert ", ") - (unless (eq major-mode 'inferior-ess-mode) + (unless (derived-mode-p 'inferior-ess-mode) (indent-according-to-mode))) (insert ","))))) @@ -3001,8 +2950,8 @@ (with-parsed-tramp-file-name path v v-localname) path))) (ess-eval-linewise (format ess-setwd-command lpath)) - ;; use set instead of setq to take effect even when let bound - (set 'default-directory (file-name-as-directory path))) + (ess-set-process-variable 'default-directory + (file-name-as-directory path))) (unless no-error (error "Not implemented for dialect %s" ess-dialect)))) @@ -3010,19 +2959,17 @@ (define-obsolete-function-alias 'ess-use-dir 'ess-set-working-directory "ESS 18.10") -(defun ess-use-this-dir (&optional no-force-current) +(defun ess-use-this-dir (&rest _ignore) "Set the current process directory to the directory of this file. -`default-directory' is used as a fallback. If that buffer has no -associated *R* process, use \\[ess-force-buffer-current], unless -prefix argument NO-FORCE-CURRENT is non-nil." - (interactive "P") +`default-directory' is used as a fallback." + (interactive) (let ((dir (if buffer-file-name (file-name-directory buffer-file-name) default-directory))) (ess-set-working-directory (abbreviate-file-name dir)))) (defun ess-get-working-directory (&optional no-error) - "Retrive the current working directory from the current ess process." + "Retrieve the current working directory from the current ess process." (if ess-getwd-command (abbreviate-file-name (car (ess-get-words-from-vector ess-getwd-command))) (unless no-error @@ -3032,11 +2979,14 @@ "Set Emacs' current directory to be the same as the subprocess directory. To be used in `ess-idle-timer-functions'." (when (and ess-can-eval-in-background - ess-getwd-command) + ess-getwd-command + (inferior-ess-available-p)) (ess-when-new-input last-sync-dirs (ess-if-verbose-write "\n(ess-synchronize-dirs)\n") - (setq default-directory - (car (ess-get-words-from-vector ess-getwd-command))) + (let ((lpath (car (ess-get-words-from-vector ess-getwd-command)))) + (setq default-directory + (file-name-as-directory + (ess--derive-connection-path default-directory lpath)))) default-directory))) (defun ess-dirs () @@ -3045,9 +2995,19 @@ ;; default-directory and subprocess working directory are ;; synchronized automatically. (interactive) - (let ((dir (car (ess-get-words-from-vector "getwd()\n")))) + (let* ((dir (car (ess-get-words-from-vector "getwd()\n"))) + (new-default-dir (ess--derive-connection-path default-directory dir))) (message "(ESS / default) directory: %s" dir) - (setq default-directory (file-name-as-directory dir)))) + (setq default-directory (file-name-as-directory new-default-dir)))) + +(defun ess--derive-connection-path (old new) + "Derive a (possibly remote) path with an updated local filename. +A new connection path is derived from OLD (a path) and NEW (a +path), in such a way that the host and connection information (if +any) in OLD is retained in the NEW path. NEW must be an absolute +path, and can be a remote path" + (concat (file-remote-p old) + (or (file-remote-p new 'localname) new))) ;; search path (defun ess--mark-search-list-as-changed () @@ -3070,56 +3030,6 @@ ;;*;; Temporary buffer handling - -;; (defun ess-create-temp-buffer (name) -;; "Create an empty buffer called NAME, but doesn't display it." -;; (let ((buff (get-buffer-create name))) -;; (save-excursion -;; (set-buffer buff) -;; (erase-buffer)) -;; buff)) - - -;; Ed Kademan's version: -;; From: Ed Kademan -;; Subject: Re: ess-mode 5.1.16; search list -;; To: rossini@biostat.washington.edu (A.J. Rossini) -;; Cc: Martin Maechler , ess-bugs@stat.math.ethz.ch -;; Date: 26 Jul 2000 16:12:12 -0400 - -;; Dear Tony Rossini, - -;; I was having trouble looking at the search list under ess. When I -;; started up multiple inferior processes---each for a different -;; dialect---ess-mode would issue the wrong variant of the "search" -;; command when I typed C-c C-s. In case it is useful let me tell you -;; what I did to get it to work for me. - -;; I added the component: -;; (inferior-ess-search-list-command . "search()\n") -;; to S+3-customize-alist and ess-r-customize-alist, and then I redefined the -;; ess-create-temp-buffer function as follows: -(defun ess-create-temp-buffer (name) - "Create an empty buffer called NAME." - (let ((buff (get-buffer-create name)) - (elca (eval ess-local-customize-alist))) - (with-current-buffer buff - (erase-buffer) - (ess-setq-vars-local elca buff)) - buff)) -;;These two steps seem to insure that the temporary buffer in which the -;;search results appear has the correct version of the local variables. -;;I am not that well acquainted with the ess code and don't know whether -;;this is a good fundamental way of fixing the problem, or even whether -;;or not this breaks some other feature of ess-mode that I never use. -;;Thanks for listening. -;;Ed K. -;;-- -;;Ed Kademan 508.651.3700 -;;PHZ Capital Partners 508.653.1745 (fax) -;;321 Commonwealth Road -;;Wayland, MA 01778 - (defun ess-display-temp-buffer (buff) "Display the buffer BUFF. Uses `temp-buffer-show-function' and respects @@ -3128,23 +3038,37 @@ (funcall temp-buffer-show-function buff)) (display-buffer buff '(display-buffer-reuse-window) ess-display-buffer-reuse-frames)) -(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--inject-code-from-file (file &optional chunked) + "Load code from FILE into process. +If CHUNKED is non-nil, split the file by separator (must be at +bol) and load each chunk separately." + ;; This is different from ess-load-file as it works by directly loading the + ;; string into the process and thus works on remotes. + (let ((proc-name ess-local-process-name) + (dialect ess-dialect) + (send-1 (lambda (str) + (if (string= ess-dialect "R") + ;; avoid detection of intermediate prompts + (ess-command (concat "{" str "}\n")) + (ess-command str))))) + (with-temp-buffer + (setq ess-local-process-name proc-name + ess-dialect dialect) + (insert-file-contents-literally file) + (if chunked + (let ((beg (point-min))) + (goto-char beg) + (while (re-search-forward "^ " nil t) + (funcall send-1 (buffer-substring beg (point))) + (setq beg (point))) + (funcall send-1 (buffer-substring (point) (point-max)))) + (funcall send-1 (buffer-string)))))) (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 + (declare (obsolete "Do not use" "21.04")) (when (> (length ess-change-sp-regexp) 0) (and (buffer-file-name) ess-filenames-map (let ((sourcemod (nth 5 (file-attributes (buffer-file-name)))) @@ -3171,40 +3095,33 @@ 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))))) +(define-obsolete-function-alias 'ess-check-source #'ess-save-file "ESS 19.04") +(defun ess-save-file (file) + "If FILE (a string) has an unsaved buffer, offer to save it. +Return t if the buffer existed and was modified, but was not +saved. If `ess-save-silently' is non-nil, the buffer is +saved without offering." + (when-let ((buff (find-buffer-visiting file))) + (when (and (buffer-modified-p buff) + (or (eql ess-save-silently t) + (and (eql ess-save-silently 'auto) + (or (not compilation-ask-about-save) + (bound-and-true-p + ;; Only added in Emacs 26.1 + auto-save-visited-mode))) + (y-or-n-p + (format "Buffer %s is modified. Save? " + (buffer-name buff))))) + (with-current-buffer buff + (save-buffer))) + (buffer-modified-p buff))) ;;*;; Error messages -(defun ess-parse-errors (&optional showerr reset) +(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 +With prefix argument SHOWERR, only show the errors ESS reported. RESET is for compatibility with `next-error' and is ignored." (interactive "P") (ess-make-buffer-current) @@ -3228,7 +3145,10 @@ (if fbuffer nil (setq fbuffer (find-file-noselect filename)) (with-current-buffer fbuffer - (ess-mode))) + ;; TODO: ess-mode is surely wrong here, but I don't + ;; think we need this whole function anymore? + (when (fboundp 'ess-mode) + (ess-mode)))) (pop-to-buffer fbuffer) (ess-goto-line linenum)) (princ errmess t))) @@ -3239,14 +3159,9 @@ (defun ess-error (msg) "Something bad has happened. Display the S buffer, and cause an error displaying MSG." + (declare (obsolete error "ESS 18.10")) (display-buffer (process-buffer (get-process ess-local-process-name))) (error msg)) -(make-obsolete 'ess-error nil "18.10") - (provide 'ess-inf) ;;; ess-inf.el ends here - -;; Local Variables: -;; byte-compile-warnings: (not lexical) -;; End: diff -Nru ess-18.10.2/lisp/ess-jags-d.el ess-18.10.2+git20220915.f45542e/lisp/ess-jags-d.el --- ess-18.10.2/lisp/ess-jags-d.el 2018-11-10 09:41:11.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/lisp/ess-jags-d.el 2022-10-15 08:06:36.000000000 +0000 @@ -1,36 +1,36 @@ -;;; ess-jags-d.el --- ESS[JAGS] dialect +;;; ess-jags-d.el --- ESS[JAGS] dialect -*- lexical-binding: t; -*- -;; Copyright (C) 2008-2011 Rodney Sparapani +;; Copyright (C) 2009-2020 Free Software Foundation, Inc. ;; Author: Rodney Sparapani ;; Created: 13 March 2008 -;; Maintainer: ESS-help +;; Maintainer: ESS Core Team -;; This file is part of ESS +;; This file is part of GNU Emacs. -;; This file is free software; you can redistribute it and/or modify +;;; License: +;; +;; This program is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 2, or (at your option) -;; any later version. +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. ;; -;; This file is distributed in the hope that it will be useful, +;; This program is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. ;; -;; A copy of the GNU General Public License is available at -;; https://www.r-project.org/Licenses/ +;; You should have received a copy of the GNU General Public License +;; along with this program. If not, see +;; ;;; Code: -(require 'ess-bugs-l) +(require 'ess-bugs-d) (require 'ess-utils) (require 'ess-inf) (require 'ess-mode) -(setq auto-mode-alist - (append '(("\\.[jJ][aA][gG]\\'" . ess-jags-mode)) auto-mode-alist)) - (defvar ess-jags-command "jags" "Default JAGS program in PATH.") (make-local-variable 'ess-jags-command) @@ -177,7 +177,7 @@ )) ) -(defun ess-jags-na-jmd (jags-command jags-chains) +(defun ess-jags-na-jmd (jags-command) "ESS[JAGS]: Perform the Next-Action for .jmd." ;(ess-save-and-set-local-variables) (if (equal 0 (buffer-size)) (ess-jags-switch-to-suffix ".jmd") @@ -239,19 +239,11 @@ ) ;;;###autoload -(defun ess-jags-mode () - "ESS[JAGS]: Major mode for JAGS." - (interactive) - (kill-all-local-variables) - (ess-setq-vars-local '((comment-start . "#"))) - (setq major-mode 'ess-jags-mode) - (setq mode-name "ESS[JAGS]") - (use-local-map ess-bugs-mode-map) - (make-local-variable 'font-lock-defaults) +(define-derived-mode ess-jags-mode ess-bugs-mode "ESS[JAGS]" + "Major mode for JAGS." + (setq-local comment-start "#") (setq font-lock-defaults '(ess-jags-font-lock-keywords nil t)) (setq ess-language "S") ; mimic S for ess-smart-underscore - (run-mode-hooks 'ess-bugs-mode-hook) - (unless (and (fboundp 'w32-shell-dos-semantics) (w32-shell-dos-semantics)) (add-hook 'comint-output-filter-functions 'ess-bugs-exit-notify-sh)) @@ -260,10 +252,6 @@ ;;;###autoload (add-to-list 'auto-mode-alist '("\\.[Jj][Aa][Gg]\\'" . ess-jags-mode)) -(defvaralias 'ess-jags-mode-hook 'ess-bugs-mode-hook) -(defvaralias 'ess-jags-mode-map 'ess-bugs-mode-map) - -(setq features (delete 'ess-bugs-d features)) (provide 'ess-jags-d) ;;; ess-jags-d.el ends here diff -Nru ess-18.10.2/lisp/ess-julia.el ess-18.10.2+git20220915.f45542e/lisp/ess-julia.el --- ess-18.10.2/lisp/ess-julia.el 2018-11-10 09:41:11.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/lisp/ess-julia.el 2022-10-15 08:06:36.000000000 +0000 @@ -1,64 +1,63 @@ -;; ess-julia.el --- ESS julia mode and inferior interaction -;; -;; Copyright (C) 2012-2015 Vitalie Spinu and the ESS Core team. -;; +;; ess-julia.el --- ESS julia mode and inferior interaction -*- lexical-binding: t; -*- + +;; Copyright (C) 2012-2020 Free Software Foundation, Inc. ;; Author: Vitalie Spinu ;; Maintainer: Vitalie Spinu ;; Created: 02-04-2012 (ESS 12.03) ;; Keywords: ESS, julia + +;; This file is part of GNU Emacs. + +;;; License: ;; -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; -;; This file is *NOT* part of GNU Emacs. -;; This file is part of ESS -;; -;; This program is free software; you can redistribute it and/or -;; modify it under the terms of the GNU General Public License as -;; published by the Free Software Foundation; either version 3, or +;; This program is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or ;; (at your option) any later version. ;; -;; This file is distributed in the hope that it will be useful, +;; This program is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. ;; -;; A copy of the GNU General Public License is available at -;; https://www.r-project.org/Licenses/ -;; -;; -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; +;; You should have received a copy of the GNU General Public License +;; along with this program. If not, see +;; + ;;; Commentary: -;; -;; Customise inferior-julia-program to point to your julia binary + +;; Customize inferior-julia-program to point to your julia binary ;; and start the inferior with M-x julia. -;; + ;; As of Sept 2015, this file depends heavily on julia-mode.el from the Julia ;; sources. If you install ESS using `make', this will work fine, otherwise ;; ensure that julia-mode.el is on your path before loading this file. -;; -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; + ;;; Code: -(require 'compile) -(require 'ess-utils) +(require 'ess-help) +(require 'ess-inf) (require 'ess-r-mode) -(require 'julia-mode) +(require 'ess-utils) +;; Don't require `julia-mode' to compile this file. +(when t (require 'julia-mode)) +(declare-function julia-mode "julia-mode" ()) +(declare-function julia-latexsub "julia-mode" ()) +(defvar julia-mode-syntax-table) (defvar ac-prefix) (declare-function company-in-string-or-comment "company") (declare-function company-doc-buffer "company") (defcustom inferior-julia-args "" - "String of arguments (see 'julia --help') used when starting julia." + "String of arguments (see `julia --help') used when starting julia." :group 'ess-julia :type 'string) (eval-when-compile (require 'cl-lib)) -(defun ess-julia-send-string-function (process string visibly) +(defun ess-julia-send-string-function (process string _visibly) "Send the Julia STRING to the PROCESS. VISIBLY is not currently used." (let ((file (concat temporary-file-directory "julia_eval_region.jl"))) @@ -68,8 +67,8 @@ ;;; HELP -(defun ess-julia-get-help-topics (&optional proc) - (append (with-current-buffer (ess-command "ESS.all_help_topics()\n") +(cl-defmethod ess-help-get-topics (proc &context (ess-dialect "julia")) + (append (with-current-buffer (ess--foreground-command "ESS.all_help_topics()\n") (split-string (buffer-string) "\n")) (ess-julia--get-objects proc))) @@ -78,7 +77,8 @@ (require 'url) (goto-char (point-min)) (let (out) - (while (re-search-forward "toctree.*href=\"\\(.+\\)\">\\(.+\\)]+\\)\">\\([^<]+\\)Introduction +(cl-defmethod ess--manual-lookup-override (&context (ess-dialect "julia")) + "Look up topics at https://docs.julialang.org/en/latest/manual/." (let* ((pages (or ess-julia--manual-topics (setq ess-julia--manual-topics - (ess-julia--retrive-topics "https://docs.julialang.org/en/latest/manual/")))) + (ess-julia--retrive-topics + "https://docs.julialang.org/en/latest/")))) (page (ess-completing-read "Lookup:" pages nil t))) (browse-url (get-text-property 1 :manual page)))) (defun ess-julia-input-sender (proc string) + "Function to send PROC STRING submitted by user. +See `comint-input-sender'." (save-current-buffer (let* ((help-?-regexp "^ *\\(?:\\(?1: *?\\? *\\)\\(?2:.+\\)\\)") (help-?-match (string-match help-?-regexp string))) @@ -106,27 +107,25 @@ (t ;; normal command (inferior-ess-input-sender proc string)))))) -;; julia 0.3.0 doesn't provide categories. Thus we don't support this anymore. -;; (defun ess-julia-reference-lookup-function (&rest args) ; args are not used -;; (interactive) -;; "Look up reference topics" -;; ;;
  • Introduction
  • -;; (let* ((pages (ess-get-words-from-vector "ESS.help_categories()\n"))) -;; (ess-display-help-on-object -;; (ess-completing-read "Category" pages nil t)))) +(cl-defmethod ess-installed-packages (&context (ess-dialect "julia")) + "Return list of installed julia packages." + ;; FIXME: This doesn't work if the user hasn't done "using Pkg" yet + (ess-get-words-from-vector "keys(Pkg.installed())\n")) +(cl-defmethod ess-load-library--override (pack &context (ess-dialect "julia")) + (ess-eval-linewise (format "using %s\n" pack))) ;;; COMPLETION (defun ess-julia-latexsub-completion () - "Complete latex input, and returns in a format required by `completion-at-point-functions'." + "Complete latex input in 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'. " + "Return completions in format required by `completion-at-point-functions'." (let ((proc (ess-get-next-available-process ess-dialect t)) (beg (ess-symbol-start))) (if proc @@ -192,8 +191,8 @@ (process-put proc 'last-objects-cache (current-time))))))))) (defun ess-julia--get-components (proc obj &optional cache?) - (with-current-buffer (ess-command (format "ESS.components(%s)\n" obj) - nil nil nil nil proc) + (with-current-buffer (ess--foreground-command (format "ESS.components(%s)\n" obj) + nil nil nil nil proc) (goto-char (point-min)) (let (list) (while (re-search-forward @@ -213,7 +212,7 @@ (let ((buf (get-buffer-create " *ess-command-output*"))) (with-current-buffer (process-buffer proc) (ess-with-current-buffer buf - (ess--flush-help-into-current-buffer sym nil t))) + (ess--flush-help-into-current-buffer sym nil))) (with-current-buffer buf (ess-help-underline) (goto-char (point-min)) @@ -224,7 +223,7 @@ (requires . 2) (candidates . ess-ac-julia-objects) (document . ess-julia-get-object-help-string)) - "Auto-completion source for julia objects") + "Auto-completion source for julia objects.") (defun ess-ac-julia-objects () (require 'auto-complete) @@ -259,17 +258,17 @@ ;;; ELDOC -(defun ess-julia-eldoc-function () +(defun ess-julia-eldoc-function (&rest _ignored) "Return the doc string, or nil. If an ESS process is not associated with the buffer, do not try -to look up any doc strings." - (interactive) +to look up any doc strings. Honors `eldoc-echo-area-use-multiline-p'." (when (and ess-can-eval-in-background (ess-process-live-p) (not (ess-process-get 'busy))) (let ((funname (or (and ess-eldoc-show-on-symbol ;; aggressive completion (symbol-name (ess-symbol-at-point))) - (car (ess--fn-name-start))))) + (car (ess--fn-name-start)))) + (multiline (eq t eldoc-echo-area-use-multiline-p))) (when funname (let* ((args (copy-sequence (nth 2 (ess-function-arguments funname)))) (W (- (window-width (minibuffer-window)) (+ 4 (length funname)))) @@ -278,46 +277,25 @@ (setq args (sort args (lambda (s1 s2) (< (length s1) (length s2))))) (setq doc (concat doc (pop args))) - (while (and args (< (+ (length doc) (length (car args))) W)) - (setq doc (concat doc " " - (pop args)))) + (while (and args (or multiline (< (+ (length doc) (length (car args))) W))) + (setq doc (concat doc " " (pop args)))) (when (and args (< (length doc) W)) (setq doc (concat doc " {--}"))) doc)))))) -;;; IMENU -(defvar ess-julia-imenu-generic-expression - ;; don't use syntax classes, screws egrep - '(("Function (_)" "[ \t]*function[ \t]+\\(_[^ \t\n]*\\)" 1) - ("Function" "^[ \t]*function[ \t]+\\([^_][^\t\n]*\\)" 1) - ("Const" "[ \t]*const \\([^ \t\n]*\\)" 1) - ("Type" "^[ \t]*[a-zA-Z0-9_]*type[a-zA-Z0-9_]* \\([^ \t\n]*\\)" 1) - ("Require" " *\\(\\brequire\\)(\\([^ \t\n)]*\\)" 2) - ("Include" " *\\(\\binclude\\)(\\([^ \t\n)]*\\)" 2) - )) - - ;;; CORE (defvar ess-julia-customize-alist - '((comint-use-prompt-regexp . t) - (ess-eldoc-function . 'ess-julia-eldoc-function) - (inferior-ess-primary-prompt . "a> ") ;; from julia> + '((inferior-ess-primary-prompt . "\\w*> ") (inferior-ess-secondary-prompt . nil) (inferior-ess-prompt . "\\w*> ") - (ess-local-customize-alist . 'ess-julia-customize-alist) + (ess-local-customize-alist . ess-julia-customize-alist) (inferior-ess-program . inferior-julia-program) - (ess-get-help-topics-function . 'ess-julia-get-help-topics) - (ess-help-web-search-command . "https://docs.julialang.org/en/latest/search/?q=%s") - (ess-manual-lookup-command . 'ess-julia-manual-lookup-function) - ;; (ess-reference-lookup-command . 'ess-julia-reference-lookup-function) (ess-load-command . "include(expanduser(\"%s\"))\n") (ess-funargs-command . "ESS.fun_args(\"%s\")\n") (ess-dump-error-re . "in \\w* at \\(.*\\):[0-9]+") (ess-error-regexp . "\\(^\\s-*at\\s-*\\(?3:.*\\):\\(?2:[0-9]+\\)\\)") (ess-error-regexp-alist . ess-julia-error-regexp-alist) - (ess-imenu-generic-expression . ess-julia-imenu-generic-expression) - (ess-mode-syntax-table . julia-mode-syntax-table) (ess-mode-completion-syntax-table . ess-julia-completion-syntax-table) ;; (inferior-ess-objects-command . inferior-ess-r-objects-command) ;; (inferior-ess-search-list-command . "search()\n") @@ -326,8 +304,6 @@ (ess-language . "julia") (ess-dialect . "julia") (ess-suffix . "jl") - (ess-ac-sources . '(ac-source-ess-julia-objects)) - (ess-company-backends . '(company-ess-julia-objects)) (ess-dump-filename-template . (replace-regexp-in-string "S$" ess-suffix ; in the one from custom: ess-dump-filename-template-proto)) @@ -338,22 +314,22 @@ (ess-function-pattern . ess-r-function-pattern) (ess-object-name-db-file . "ess-jl-namedb.el" ) (ess-smart-operators . ess-r-smart-operators) - (inferior-ess-help-filetype . nil) (inferior-ess-exit-command . "exit()\n") ;;harmful for shell-mode's C-a: -- but "necessary" for ESS-help? - (inferior-ess-start-file . nil) ;; "~/.ess-R" - (inferior-ess-start-args . "") (inferior-ess-language-start . nil) (ess-STERM . "iESS") (ess-editor . ess-r-editor) (ess-pager . ess-r-pager) (ess-getwd-command . "pwd()\n") - (ess-setwd-command . "cd(expanduser(\"%s\"))\n") - ) - "Variables to customize for Julia -- set up later than emacs initialization.") + (ess-setwd-command . "cd(expanduser(\"%s\"))\n")) + "Variables to customize for Julia.") + +(cl-defmethod ess--help-web-search-override (cmd &context (ess-dialect "julia")) + "Offer to search the web for a Julia command." + (browse-url (format "https://docs.julialang.org/en/latest/search/?q=%s" cmd))) (defvar ess-julia-completion-syntax-table - (let ((table (make-syntax-table ess-r-syntax-table))) + (let ((table (copy-syntax-table ess-r-mode-syntax-table))) (modify-syntax-entry ?. "_" table) ;; (modify-syntax-entry ?: "_" table) ;; (modify-syntax-entry ?$ "_" table) @@ -362,36 +338,80 @@ "Syntax table used for completion and help symbol lookup. It makes underscores and dots word constituent chars.") +(cl-defmethod ess-help-commands (&context (ess-dialect "julia")) + '((packages . "_ess_list_categories()\n") + (package-index . "_ess_print_index(\"%s\")\n") + (index-keyword-reg . "^\\(.*+\\):$*") + (index-start-reg . ":"))) + +(defvar ess-julia-mode-syntax-table (copy-syntax-table julia-mode-syntax-table)) + +(defvar ess-julia-mode-map + (let ((map (make-sparse-keymap))) + (set-keymap-parent map ess-mode-map) + map) + "Keymap for `ess-julia-mode'.") + ;;;###autoload (define-derived-mode ess-julia-mode julia-mode "ESS[julia]" - "Major mode for editing julia source. See `ess-mode' for more help." - (ess-mode ess-julia-customize-alist nil t) + "Major mode for julia files." + :group 'ess-Julia + (setq-local ess-local-customize-alist ess-julia-customize-alist) + (setq ess-dialect "julia") + (ess-setq-vars-local ess-julia-customize-alist) + ;; eldoc + (ess--setup-eldoc #'ess-julia-eldoc-function) + ;; auto-complete + (ess--setup-auto-complete '(ac-source-ess-julia-objects)) + ;; company + (ess--setup-company '(company-ess-julia-objects)) ;; for emacs >= 24 (remove-hook 'completion-at-point-functions 'ess-filename-completion 'local) ;; should be first (add-hook 'completion-at-point-functions 'ess-julia-object-completion nil 'local) (add-hook 'completion-at-point-functions 'ess-filename-completion nil 'local) - (if (fboundp 'ess-add-toolbar) (ess-add-toolbar)) - (set (make-local-variable 'end-of-defun-function) 'ess-end-of-function) - (setq imenu-generic-expression ess-julia-imenu-generic-expression) - (imenu-add-to-menubar "Imenu-jl") - (run-mode-hooks 'ess-julia-mode-hook)) + (add-hook 'completion-at-point-functions 'ess-julia-latexsub-completion nil 'local) + (if (fboundp 'ess-add-toolbar) (ess-add-toolbar))) + +;; Inferior mode +(defvar inferior-ess-julia-mode-syntax-table + (copy-syntax-table ess-julia-mode-syntax-table) + "Syntax table for `inferior-ess-julia-mode'.") + +(define-derived-mode inferior-ess-julia-mode inferior-ess-mode "iESS[julia]" + "Major mode for inferior julia processes." + :group 'ess-Julia + (ess-setq-vars-local ess-julia-customize-alist) + (setq-local comint-use-prompt-regexp t) + (setq comint-prompt-regexp (concat "^" inferior-ess-prompt)) + (setq ess-dialect "julia") + ;; eldoc + (ess--setup-eldoc #'ess-julia-eldoc-function) + ;; auto-complete + (ess--setup-auto-complete '(ac-source-ess-julia-objects) t) + ;; company + (ess--setup-company '(company-ess-julia-objects) t) + (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)) (defvar ess-julia-mode-hook nil) (defvar ess-julia-post-run-hook nil "Functions run in process buffer after starting julia process.") ;;;###autoload -(defun julia (&optional start-args) - "Call 'julia'. -Optional prefix (C-u) allows to set command line arguments, such as ---load=. This should be OS agnostic. -If you have certain command line arguments that should always be passed -to julia, put them in the variable `inferior-julia-args'." +(defun run-ess-julia (&optional start-args) + "Start an inferior julia process. +Optional prefix START-ARGS (\\[universal-argument]) allows to set +command line arguments, such as --load=. This should be OS +agnostic. If you have certain command line arguments that should +always be passed to julia, put them in the variable +`inferior-julia-args'." (interactive "P") ;; get settings, notably inferior-julia-program : (if (null inferior-julia-program) (error "'inferior-julia-program' does not point to 'julia' or 'julia-basic' executable") - (setq ess-customize-alist ess-julia-customize-alist) (ess-write-to-dribble-buffer ;; for debugging only (format "\n(julia): ess-dialect=%s, buf=%s, start-arg=%s\n current-prefix-arg=%s\n" @@ -405,29 +425,37 @@ (concat " [other than '" inferior-julia-args "']")) " ? ")) nil)))) - (inferior-ess jl-start-args) + (let ((inf-buf (inferior-ess jl-start-args ess-julia-customize-alist))) + (with-current-buffer inf-buf + (ess--tb-start) + ;; Remove ` from julia's logo + (goto-char (point-min)) + (while (re-search-forward "`" nil t) + (replace-match "'")) + ;; Remove an offending unmatched parenthesis + (goto-char (point-min)) + (forward-line 4) + (when (re-search-forward "(" nil t) + (replace-match "|")) + (goto-char (point-max)) + ;; --> julia helpers from ../etc/ess-julia.jl : + (ess--inject-code-from-file (format "%sess-julia.jl" ess-etc-directory)) + (run-mode-hooks 'ess-julia-post-run-hook)) + inf-buf)))) + +;;;###autoload +(defalias 'julia #'run-ess-julia) + +(cl-defmethod ess--help-major-mode (&context (ess-dialect "julia")) + (ess-julia-help-mode)) - (remove-hook 'completion-at-point-functions 'ess-filename-completion 'local) ;; should be first - (add-hook 'completion-at-point-functions 'ess-julia-object-completion nil 'local) - (add-hook 'completion-at-point-functions 'ess-filename-completion nil 'local) - (add-hook 'completion-at-point-functions 'ess-julia-latexsub-completion nil 'local) - (setq comint-input-sender 'ess-julia-input-sender) - - (ess--tb-start) - ;; remove ` from julia's logo - (goto-char (point-min)) - (while (re-search-forward "`" nil t) - (replace-match "'")) - ;; remove an offending unmatched parenthesis - (goto-char (point-min)) - (forward-line 4) - (when (re-search-forward "(" nil t) - (replace-match "|")) - (goto-char (point-max)) - ;; --> julia helpers from ../etc/ess-julia.jl : - (ess--inject-code-from-file (format "%sess-julia.jl" ess-etc-directory)) - (with-ess-process-buffer nil - (run-mode-hooks 'ess-julia-post-run-hook))))) +(define-derived-mode ess-julia-help-mode ess-help-mode "ESS[Julia] Help" + "Major mode for Julia documentation." + :group 'ess-help + (let ((inhibit-read-only t)) + ;; Julia help buffers can contain color if julia starts with + ;; --color=yes + (ansi-color-apply-on-region (point-min) (point-max)))) (add-to-list 'auto-mode-alist '("\\.jl\\'" . ess-julia-mode)) diff -Nru ess-18.10.2/lisp/ess-lsp-l.el ess-18.10.2+git20220915.f45542e/lisp/ess-lsp-l.el --- ess-18.10.2/lisp/ess-lsp-l.el 2018-11-10 09:41:11.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/lisp/ess-lsp-l.el 1970-01-01 00:00:00.000000000 +0000 @@ -1,65 +0,0 @@ -;;; ess-lsp-l.el --- Support for editing Lisp source code - -;; Copyright (C) 1997 A.J. Rossini. -;; Copyright (C) 1998--2004 A.J. Rossini, Richard M. Heiberger, Martin -;; Maechler, Kurt Hornik, Rodney Sparapani, and Stephen Eglen. - -;; Author: A.J. Rossini -;; Created: 1 Sept 1997 -;; Maintainer: ESS-core - -;; 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 -;; https://www.r-project.org/Licenses/ - -;;; Commentary: - -;; Configurations for editing XLispStat source code. Contains any underlying -;; changes that need to be made. - -;;; Code: - - ; Requires and autoloads - -;; Contents "translated" from lisp-mode.el -(require 'lisp-mode) - - ; Configuration variables - - - -(defvar Lisp-editing-alist - '((paragraph-start . (concat "^$\\|" page-delimiter)) - (paragraph-separate . (concat "^$\\|" page-delimiter)) - (paragraph-ignore-fill-prefix . t) - (fill-paragraph-function . 'lisp-fill-paragraph) - (adaptive-fill-mode . nil) - (indent-line-function . 'lisp-indent-line) - (indent-region-function . 'lisp-indent-region) - (require-final-newline . mode-require-final-newline) - (comment-start . ";") - (comment-start-skip . "\\(\\(^\\|[^\\\\\n]\\)\\(\\\\\\\\\\)*\\);+ *") - (comment-column . 40) - (comment-indent-function . 'lisp-comment-indent) - (parse-sexp-ignore-comments . t) - (ess-style . ess-default-style) - (ess-local-process-name . nil) - ;;(ess-keep-dump-files . 'ask) - (ess-mode-syntax-table . lisp-mode-syntax-table) - (font-lock-defaults . '(lisp-font-lock-keywords))) - "General options for editing LispStat, XLispStat, and ViSta source files.") - -(provide 'ess-lsp-l) - -;;; ess-lsp-l.el ends here diff -Nru ess-18.10.2/lisp/ess-mode.el ess-18.10.2+git20220915.f45542e/lisp/ess-mode.el --- ess-18.10.2/lisp/ess-mode.el 2018-11-10 09:41:11.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/lisp/ess-mode.el 2022-10-15 08:06:36.000000000 +0000 @@ -1,31 +1,682 @@ -;;; ess-mode.el -- Emacs Speaks Statistics (ESS). -;; -;; Copyright (C) 1994-2018 ESS Core Team +;;; ess-mode.el -- Emacs Speaks Statistics root mode. -*- lexical-binding: t; -*- + +;; Copyright (C) 1994-2020 Free Software Foundation, Inc. ;; Maintainer: ESS-core + +;; This file is part of GNU Emacs. + +;;; License: ;; -;; Keywords: languages -;; -;; This file is part of ESS -;; -;; This file is free software; you can redistribute it and/or modify +;; This program is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 2, or (at your option) -;; any later version. +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. ;; -;; This file is distributed in the hope that it will be useful, +;; This program is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. ;; -;; A copy of the GNU General Public License is available at -;; https://www.r-project.org/Licenses/ -;; +;; You should have received a copy of the GNU General Public License +;; along with this program. If not, see +;; + ;;; Commentary: -;; -;; A placeholder required by all other mode files. -;; +;; This file defines ess-mode from which other modes (like ess-r-mode) +;; derive. + ;;; Code: (require 'ess) +(eval-when-compile + (require 'cl-lib) + (require 'subr-x)) +(require 'ess-inf) + +;; Silence the byte compiler +(declare-function R "ess-r-mode" (&optional start-args)) +(declare-function S+ "ess-sp6-d" (&optional proc-name)) +(declare-function SAS "ess-sas-d" ()) + +;; FIXME:This one should not be necessary +(declare-function ess-display-help-on-object "ess-help" (object &optional command)) + +;; ESS mode +;; Major mode definition + +;;*;; Hooks + +(defcustom ess-mode-hook nil + "Hook for customizing ESS each time it is entered." + :group 'ess-hooks + :type 'hook) + +(defvar ess-mode-map + (let ((map (make-sparse-keymap))) + (define-key map [remap yank] #'ess-yank) + (define-key map "\C-c\C-r" #'ess-eval-region) + (define-key map "\C-c\M-r" #'ess-eval-region-and-go) + (define-key map "\C-c\C-b" #'ess-eval-buffer) + (define-key map "\C-c\M-b" #'ess-eval-buffer-and-go) + (define-key map (kbd "C-c C-") #'ess-eval-buffer-from-beg-to-here) + (define-key map (kbd "C-c C-") #'ess-eval-buffer-from-here-to-end) + (define-key map "\C-c\C-f" #'ess-eval-function) + (define-key map "\C-c\M-f" #'ess-eval-function-and-go) + (define-key map "\C-c\C-c" #'ess-eval-region-or-function-or-paragraph-and-step) + (define-key map "\C-c\C-p" #'ess-eval-paragraph-and-step) + (define-key map "\C-c\M-p" #'ess-eval-paragraph-and-go) + (define-key map "\C-\M-x" #'ess-eval-region-or-function-or-paragraph) + (define-key map "\C-c\C-n" #'ess-eval-line-visibly-and-step) + (define-key map "\C-c\C-j" #'ess-eval-line) + (define-key map [(control return)] #'ess-eval-region-or-line-visibly-and-step) + (define-key map "\C-c\M-j" #'ess-eval-line-and-go) + ;; 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) + (define-key map "\C-xnf" #'ess-narrow-to-defun-or-para) + (define-key map "\C-c\C-z" #'ess-switch-to-inferior-or-script-buffer) + (define-key map "\C-c\C-l" #'ess-load-file) + ;;; 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-c\C-s" #'ess-switch-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-\M-q" #'ess-indent-exp) + (define-key map "{" #'skeleton-pair-insert-maybe) + (define-key map "}" #'skeleton-pair-insert-maybe) + (define-key map "\C-\M-h" #'ess-mark-function-or-para) + (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) + (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) + map) + "Keymap for `ess-mode'.") + +;; Redefine `indent-new-comment-line' commands for Emacs < 26. Emacs +;; 27 binds M-j to `default-indent-new-line' which calls +;; `comment-line-break-function' if point is in a comment. We set this +;; function in the mode init. +(substitute-key-definition 'indent-new-comment-line + 'ess-indent-new-comment-line + ess-mode-map global-map) + +(defvar ess-extra-map + (let (ess-extra-map) + (define-prefix-command 'ess-extra-map) + (define-key ess-extra-map "\C-d" #'ess-dump-object-into-edit-buffer) + (define-key ess-extra-map "d" #'ess-dump-object-into-edit-buffer) + (define-key ess-extra-map "\C-e" #'ess-execute) + (define-key ess-extra-map "e" #'ess-execute) + (define-key ess-extra-map "\C-i" #'ess-install-library) + (define-key ess-extra-map "i" #'ess-install-library) + (define-key ess-extra-map "\C-l" #'ess-load-library) + (define-key ess-extra-map "l" #'ess-load-library) + (define-key ess-extra-map "\C-r" #'inferior-ess-reload) + (define-key ess-extra-map "r" #'inferior-ess-reload) + (define-key ess-extra-map "\C-s" #'ess-set-style) + (define-key ess-extra-map "s" #'ess-set-style) + (define-key ess-extra-map "\C-t" #'ess-build-tags-for-directory) + (define-key ess-extra-map "t" #'ess-build-tags-for-directory) + (define-key ess-extra-map "\C-w" #'ess-execute-screen-options) + (define-key ess-extra-map "w" #'ess-execute-screen-options) + (define-key ess-extra-map "/" #'ess-set-working-directory) + ess-extra-map) + "ESS extra map.") + +(easy-menu-define + ess-mode-menu ess-mode-map + "Menu for use in `ess-mode'." + '("ESS" ; ESS-mode + ["Load file" ess-load-file t] + ["Eval region | func | para" ess-eval-region-or-function-or-paragraph t] + ["Eval region | func | para & step" ess-eval-region-or-function-or-paragraph-and-step t] + ["Eval region | line" ess-eval-region-or-line-visibly-and-step t] + ["Enter expression" ess-execute t] + ;; sub menus + "------" + ("Process" + ["Goto end of process buffer" ess-switch-to-end-of-ESS t] + ["Switch to process buffer" ess-switch-to-inferior-or-script-buffer t] + ["Switch process" ess-switch-process t] + ;; ["Recreate R and S versions known to ESS" (ess-r-s-versions-creation+menu) t] + ("Start Process" + ["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 + ;; The following menu item "Other" is a place-holder that will + ;; be replaced with the other versions of R and Sqpe that can be run. + ;; See `ess-r-define-runners' and ess-site.el + ("Other" + ["No other R or Sqpe versions" nil nil]) + ["About" + (ess-goto-info "Starting up") t] + ;; :help "Read about starting a new ESS process" :active t] + ) + ("Eval visibly " + :filter ess--generate-eval-visibly-submenu) + ["Quit process" ess-quit t] + ["Reload process" inferior-ess-reload t]) + "------" + ("ESS Eval" + ["Eval region | func | para" ess-eval-region-or-function-or-paragraph t] + ["Eval region | func | para & step" ess-eval-region-or-function-or-paragraph-and-step t] + ["Eval region | line & step" ess-eval-region-or-line-visibly-and-step t] + "-----" + ["Eval buffer" ess-eval-buffer t] + ["Eval buffer till here" ess-eval-buffer-from-beg-to-here t] + ["Eval buffer from here" ess-eval-buffer-from-here-to-end t] + ["Eval region" ess-eval-region t] + ["Eval function" ess-eval-function t] + ["Eval line" ess-eval-line t] + ["Eval line & step" ess-eval-line-and-step t] + ["Eval paragraph" ess-eval-paragraph t] + ["Eval paragraph & step" ess-eval-paragraph-and-step t] + ["About" (ess-goto-info "Evaluating code") t] + ) + ("Eval and Go" + ["Eval buffer" ess-eval-buffer-and-go t] + ["Eval region" ess-eval-region-and-go t] + ["Eval function" ess-eval-function-and-go t] + ["Eval line" ess-eval-line-and-go t] + ["Eval paragraph" ess-eval-paragraph-and-go t] + ["About" (ess-goto-info "Evaluating code") t] + ) + ("Motion" + ["Beginning of function or para" ess-goto-beginning-of-function-or-para t] + ["End of function or para" ess-goto-end-of-function-or-para t] + "-----" + ["Backward list" backward-list t] + ["Forward list" forward-list t] + ["Next parenthesis" down-list t] + ["Enclosing parenthesis" backward-up-list t] + ["Backward sexp" backward-sexp t] + ["Forward sexp" forward-sexp t] + ["About" (Info-goto-node "(Emacs)Lists") t] + ) + ("ESS Edit" + ["Edit new object" ess-dump-object-into-edit-buffer t] + ["Complete Filename" comint-replace-by-expanded-filename t] + ["Complete File or Object" ess-indent-or-complete t] + ["Kill sexp" kill-sexp t] + ["Mark function" ess-mark-function-or-para t] + ["Indent expression" ess-indent-exp t] + ["Indent line" ess-indent-command t] + ["Toggle Auto-Fill Mode" auto-fill-mode t] + ["Undo" undo t] + ["About" (ess-goto-info "Edit buffer") t] + ) + "------" + ("start-dev" :visible nil) + ("end-dev" :visible nil) + "------" + ("Font Lock" + :active ess-font-lock-keywords + :filter ess--generate-font-lock-submenu) + "------" + ["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])) + +;;;###autoload +(define-derived-mode ess-mode prog-mode "ESS" + "Major mode for editing ESS source. +Optional arg ALIST describes how to customize the editing mode. +Optional arg PROC-NAME is name of associated inferior process. + +\\{ess-mode-map} + +You can send text to the inferior ESS process from other buffers containing +ESS source. + `ess-eval-region' sends the current region to the ESS process. + `ess-eval-buffer' sends the current buffer to the ESS process. + `ess-eval-function' sends the current function to the ESS process. + `ess-eval-line' sends the current line to the ESS process. + `ess-switch-to-ESS' switches the current buffer to the ESS process buffer. + `ess-switch-to-end-of-ESS' switches the current buffer to the ESS process + buffer and puts point at the end of it. + + `ess-eval-region-and-go', `ess-eval-buffer-and-go', + `ess-eval-function-and-go', and `ess-eval-line-and-go' switch to the S + process buffer after sending their text. + + `ess-load-file' sources a file of commands to the ESS process. + +\\[ess-indent-command] indents for ESS code. +\\[backward-delete-char-untabify] converts tabs to spaces as it moves back. +Comments are indented in a similar way to Emacs-lisp mode: + `###' beginning of line + `##' the same level of indentation as the code + `#' the same column on the right, or to the right of such a + column if that is not possible.(default value 40). + \\[indent-for-comment] command automatically inserts such a + `#' in the right place, or aligns such a comment if it is + already inserted. +\\[ess-indent-exp] command indents each line of the syntactic unit following point. + +Variables controlling indentation style: + `ess-indent-offset' + Indentation of ESS statements within surrounding block. + The surrounding block's indentation is the indentation of the line on + which the open-brace appears. + `ess-offset-block' + Indentation of blocks opened with curly braces or anonymous parentheses. + `ess-offset-arguments' + Indentation of function arguments or bracket indices. + `ess-offset-arguments-newline' + Indentation of function arguments or bracket indices when the opening + delimiter is immediately followed by a newline. + `ess-offset-continued' + Indentation style for continued statements. + `ess-align-nested-calls' + Functions whose nested calls should be aligned. + `ess-align-arguments-in-calls' + Calls in which arguments should be aligned. + `ess-align-continuations-in-calls' + Whether ignore indentation after an operator in calls + `ess-align-blocks' + Blocks that should always be aligned vertically. + `ess-indent-from-lhs' + Whether function calls given as argument should be indented from the + parameter name. + `ess-indent-from-chain-start' + Whether to indent arguments from the first of several consecutive calls. + `ess-indent-with-fancy-comments' + Non-nil means distinguish between #, ##, and ### for indentation. + +Furthermore, \\[ess-set-style] command enables you to set up predefined ess-mode +indentation style. See `ess-style-alist' for predefined styles." + :group 'ess + ;; TODO: get rid of these and rely on modes to set variables properly + (when-let ((alist (buffer-local-value 'ess-local-customize-alist (current-buffer)))) + (ess-setq-vars-local alist)) + (when-let ((alist ess-mode-editing-alist)) + (ess-setq-vars-local alist)) + ;; Keep out of the code. + (setq-local indent-tabs-mode nil) + (setq-local comment-line-break-function #'ess-newline-and-indent) + (setq mode-line-process + '(" [" + (:eval (ess--get-mode-line-indicator)) + ess--local-mode-line-process-indicator + "]")) + (add-hook 'ess-idle-timer-functions 'ess-synchronize-dirs nil 'local)) + +(defun ess--get-mode-line-indicator () + "Get `ess--mode-line-process-indicator' from process buffer. +Internal function to be used for dynamic mode-line display in +`ess-mode'." + (if ess-local-process-name + (let* ((proc (get-process ess-local-process-name)) + (buff (when proc (process-buffer proc)))) + (if (and proc (buffer-live-p buff)) + (with-current-buffer buff (mapcar 'eval ess--mode-line-process-indicator)) + "none")) + "none")) + + +;;; User commands in ess-mode + +(defun ess-install-library (&optional update package) + "Install PACKAGE for current dialect. +With UPDATE, update cached package list." + (interactive "P") + (ess-install-library--override update package)) + +(cl-defgeneric ess-install-library--override (update package) + "See `ess-install-library' for UPDATE, PACKAGE." + (when update (message "Don't know how to update for %s" ess-dialect)) + (error "Cannot install %s, not available for %s" package ess-dialect)) + + +;; Motion / manipulation commands + +(defun ess-goto-beginning-of-function-or-para () + "If inside a function go to the beginning of it. +Otherwise go to the beginning of paragraph." + (interactive) + (let ((start-pos (point)) + beg end) + (beginning-of-defun) + (setq beg (point)) + (end-of-defun) + (setq end (point)) + (goto-char beg) + (unless (and (< beg start-pos) + (> end start-pos)) + (let ((par-pos (save-excursion + (goto-char start-pos) + (forward-comment most-negative-fixnum) + (backward-paragraph) + (forward-comment most-positive-fixnum) + (point)))) + (if (< end par-pos) + (goto-char par-pos) + (goto-char beg)))))) + +(defun ess-goto-end-of-function-or-para () + "If inside a function go to end of it. +Otherwise go to the end of paragraph." + (interactive) + (let ((pos (point)) + beg end) + (end-of-defun) + (setq end (point)) + (beginning-of-defun) + (setq beg (point)) + (goto-char end) + (when (or (< beg pos) + (> end pos)) + (let ((par-pos (save-excursion + (goto-char pos) + (forward-comment most-positive-fixnum) + (forward-paragraph) + (point)))) + (when (<= par-pos beg) + (goto-char par-pos)))))) + +(defun ess-mark-function-or-para () + "Put mark at end of ESS function, point at beginning." + (interactive) + (ess-goto-beginning-of-function-or-para) + (push-mark (point)) + (ess-goto-end-of-function-or-para) + (exchange-point-and-mark)) + +(define-obsolete-function-alias 'ess-mark-function 'ess-mark-function-or-para "15.09") + +(defun ess-narrow-to-defun-or-para () + "Make text outside current function invisible. +If text is already narrowed, this is removed before narrowing to the +current function." + (interactive) + (save-excursion + (widen) + (let* ((beg (progn (ess-goto-beginning-of-function-or-para) + (point))) + (end (progn (ess-goto-end-of-function-or-para) + (point)))) + (narrow-to-region beg end)))) + +(define-obsolete-function-alias 'ess-narrow-to-defun 'ess-narrow-to-defun-or-para "15.09") + +;; FIXME: Support soft breaks with `insert-and-inherit'. See +;; https://www.gnu.org/software/emacs/manual/html_node/emacs/Hard-and-Soft-Newlines.html +(defun ess-newline-and-indent (&optional _soft) + (ess-indent-new-comment-line)) + +(defun ess-indent-new-comment-line () + "Like `indent-new-comment-line' but accounts for roxygen comments." + (interactive) + (cond ((and (fboundp 'ess-roxy-indent-new-comment-line) + (string= ess-dialect "R")) + (ess-roxy-indent-new-comment-line)) + (t + (indent-new-comment-line)))) + + +;;; Formatting / indentation +(defvar-local ess--installed-style-vars nil + "A cons of the form (STYLE . VARS). +VARS is a list of all style vars which were not set explicitly to +buffer local values by the user in mode hooks.") + +(defun ess-set-style (&optional style _quiet) + "Set up the `ess-mode' style variables from the `ess-style' variable. +If STYLE argument is given, use that instead. It makes the ESS +indentation style variables buffer local. QUIET is for backward +compatibility and is ignored. + +In programs, when STYLE is nil, the `ess-style' is installed. In +this case, if `ess-style' is buffer local, all settings are +overwritten, otherwise only those settings which are not already +buffer local. For example, `ess-style' is buffer local when it is +set in .dir-locals and thus must have priority over the user +settings in the mode hook." + (interactive + (list (let ((styles (mapcar (lambda (x) (symbol-name (car x))) + ess-style-alist))) + (intern (ess-completing-read + "Set ESS mode indentation style" + styles nil t nil nil ess-style))))) + (let* ((keep-local (and (null style) + (not (local-variable-p 'ess-style)))) + (style (or style ess-style)) + (style-alist (or (cdr (assq style ess-style-alist)) + (error "Bad ESS style: %s" style))) + (vars (if keep-local + ;; Install, but Keep user's buffer-local settings. + (cl-loop for (var . _) in (cdr (assq 'DEFAULT ess-style-alist)) + unless (local-variable-p var) + collect var) + (mapcar #'car style-alist)))) + (when (called-interactively-p 'any) + (message "Set indentation style to %s" style)) + (mapc (lambda (var) + (make-local-variable var) + (set var (cdr (assq var style-alist)))) + vars) + style)) + +(defun ess-indent-command (&optional whole-exp) + "Indent current line as ESS code, or in some cases insert a tab character. +If `tab-always-indent' is non-nil, always indent current line. +Otherwise, indent the current line only if point is at the left +margin or in the line's indentation; otherwise insert a tab. If +given, WHOLE-EXP means indent rigidly all the lines of the +expression starting after point so that this line becomes +properly indented. The relative indentation among the lines of +the expression are preserved. + +If in a roxygen block at the beginning of the line with +`ess-roxy-hide-show-p' non-nil, call `ess-roxy-toggle-hiding' +instead of indenting." + (interactive "P") + (cond ((and (fboundp 'ess-roxy-entry-p) + (fboundp 'ess-roxy-toggle-hiding) + (bolp) + (ess-roxy-entry-p) + ess-roxy-hide-show-p) + (ess-roxy-toggle-hiding)) + (whole-exp + ;; If arg, always indent this line as S + ;; and shift remaining lines of expression the same amount. + (let ((shift-amt (funcall indent-line-function)) + beg end) + (save-excursion + (if tab-always-indent + (beginning-of-line)) + (setq beg (point)) + (backward-up-list 1) + (forward-list 1) + (setq end (point)) + (goto-char beg) + (forward-line 1) + (setq beg (point))) + (if (> end beg) + (indent-code-rigidly beg end shift-amt)))) + ((and (not tab-always-indent) + (save-excursion + (skip-chars-backward " \t") + (not (bolp)))) + (insert-tab)) + (t (funcall indent-line-function)))) + +(defun ess-indent-or-complete () + "When region is selected indent the region. +Otherwise, if `tab-always-indent' is \\='complete, try to indent, if +code is already indented, complete instead. Also see +`ess-first-tab-never-complete'." + (interactive) + (if (use-region-p) + (indent-region (region-beginning) (region-end)) + (let ((shift (let ((indent (current-indentation))) + (ess-indent-command) + (- (current-indentation) indent)))) + (when (and (or (equal tab-always-indent 'complete) + ess-tab-complete-in-script) + (numberp shift) ;; can be nil if tab-always-indent is nil + (equal shift 0) + (or (eq last-command 'ess-indent-or-complete) + (null ess-first-tab-never-complete) + (and (eq ess-first-tab-never-complete 'unless-eol) + (looking-at "\\s-*$")) + (and (eq ess-first-tab-never-complete 'symbol) + (not (looking-at "\\w\\|\\s_"))) + (and (eq ess-first-tab-never-complete 'symbol-or-paren) + (not (looking-at "\\w\\|\\s_\\|\\s)"))) + (and (eq ess-first-tab-never-complete 'symbol-or-paren-or-punct) + (not (looking-at "\\w\\|\\s_\\|\\s)\\|\\s."))))) + (completion-at-point))))) + +(defun ess-indent-exp () + "Indent each line of the ESS grouping following point." + (interactive) + (cond ((and (fboundp 'ess-r-indent-exp) + (string= ess-dialect "R")) + (ess-r-indent-exp)) + (t + (save-excursion + (let ((start (point)) + (end (ignore-errors (forward-sexp 1) (point)))) + (when end + (indent-region start end))))))) + +(defun ess-indent-line () + "Indent current line as ESS code. +Return the amount the indentation changed by." + (declare (obsolete 'indent-line-function "ESS 19.04")) + (funcall indent-line-function)) + + +;;; Dump Objects + +(defun ess-dump-object-into-edit-buffer (object) + "Edit an ESS OBJECT in its own buffer. +Without a prefix argument, this simply finds the file pointed to by +`ess-source-directory'. If this file does not exist, or if a +prefix argument is given, a dump() command is sent to the ESS process to +generate the source buffer." + (interactive + (progn + (ess-force-buffer-current "Process to dump from: ") + (ess-read-object-name "Object to edit"))) + (let* ((dirname (file-name-as-directory + (if (stringp ess-source-directory) + ess-source-directory + (with-current-buffer (process-buffer (ess-get-process + ess-local-process-name)) + (ess-setq-vars-local ess-local-customize-alist) + (apply ess-source-directory nil))))) + (filename (concat dirname (convert-standard-filename (format ess-dump-filename-template object)))) + (old-buff (get-file-buffer filename))) + ;; If the directory doesn't exist, offer to create it + (unless (file-exists-p (directory-file-name dirname)) + (if (y-or-n-p (format "Directory %s does not exist. Create it? " dirname)) + (make-directory (directory-file-name dirname)) + (error "Directory %s does not exist" dirname))) + ;; Three options: + ;; (1) Pop to an existing buffer containing the file in question + ;; (2) Find an existing file + ;; (3) Create a new file by issuing a dump() command to S + ;; Force option (3) if there is a prefix arg + (cond (current-prefix-arg + (ess-dump-object object filename)) + (old-buff + (pop-to-buffer old-buff)) + ((file-exists-p filename) + (ess-find-dump-file-other-window filename) + (message "Read %s" filename)) + (t (ess-dump-object object filename))))) + +(defun ess-dump-object (object filename) + "Dump the ESS object OBJECT into file FILENAME." + (unless (file-writable-p filename) + (error "Can't dump %s as %f is not writeable" object filename)) + (let ((dump-cmd (format inferior-ess-dump-command object filename))) + ;; Make sure we start fresh + (when (get-file-buffer filename) + (kill-buffer (get-file-buffer filename))) + (ess-command dump-cmd) + (message "Dumped in %s" filename) + (ess-find-dump-file-other-window filename) + ;; PD, 1Apr97 + ;;This ensures that the object gets indented according to ess-mode, + ;;not as the R/S deparser does it. At the same time, it gets rid + ;;of the mess generated by sending TAB characters to the readline + ;;functions in R when you eval-buffer-*. + (indent-region (point-min-marker) (point-max-marker) nil) + (set-buffer-modified-p nil) ; no need to safe just because of indenting + ;; Don't make backups for temporary files; it only causes clutter. + ;; The ESS object itself is a kind of backup, anyway. + (unless ess-keep-dump-files + (make-local-variable 'make-backup-files) + (setq make-backup-files nil)) + ;; Don't get confirmation to delete dumped files when loading + (when (eq ess-keep-dump-files 'check) + (setq ess-keep-dump-files nil)) + ;; Delete the file if necessary + (when ess-delete-dump-files + (delete-file (buffer-file-name))))) + +(defun ess-find-dump-file-other-window (filename) + "Find ESS source file FILENAME in another window." + (unless (file-readable-p filename) + (ess-write-to-dribble-buffer + (format "%s does not exist. Bad dump, starting fresh." filename))) + ;; Generate a buffer with the dumped data + (find-file-other-window filename) + (auto-save-mode 1) ; Auto save in this buffer + (when (and ess-function-template + (goto-char (point-max)) + (re-search-backward ess-dumped-missing-re nil t)) + (replace-match ess-function-template t t) + (set-buffer-modified-p nil) ; Don't offer to save if killed now + (goto-char (point-min)) + (ignore-errors + ;; This may fail if there are no opens + (down-list 1)))) + + +;;; Runners + +(defun ess-define-runner (name dialect &optional path) + "Create a function NAME. +This function starts the inferior process with the specified +version. DIALECT can be \"R,\" \"S,\", \"SAS.\" If given, PATH +should be the absolute path to the program. It defaults to NAME." + (let ((name name) + (dialect dialect) + (path path)) + (fset (intern name) + (lambda (&optional start-args) + "Start this process version in an inferior ESS buffer. +Function defined using `ess-define-runner'." + (interactive "P") + (cond ((string= dialect "R") + (let ((inferior-ess-r-program (or path name))) + (require 'ess-r-mode) + (R start-args))) + ((string= dialect "S") + (let ((inferior-S+-program (or path name))) + (require 'ess-sp6-d) + (S+))) + ((string= dialect "SAS") + (let ((inferior-SAS-program (or path name))) + (require 'ess-sas-d) + (SAS)))))))) + + + (provide 'ess-mode) + +;;; ess-mode.el ends here diff -Nru ess-18.10.2/lisp/ess-mouse.el ess-18.10.2+git20220915.f45542e/lisp/ess-mouse.el --- ess-18.10.2/lisp/ess-mouse.el 2018-11-10 09:41:11.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/lisp/ess-mouse.el 1970-01-01 00:00:00.000000000 +0000 @@ -1,234 +0,0 @@ -;;; ess-mouse.el --- Support for mouse- or cursor-sensitive actions - -;; Copyright (C) 2001 Richard M. Heiberger -;; Copyright (C) 2002--2004 A.J. Rossini, Richard M. Heiberger, Martin -;; Maechler, Kurt Hornik, Rodney Sparapani, and Stephen Eglen. - -;; Author: Richard M. Heiberger -;; Created: 25 Mar 2001 -;; Maintainer: ESS-core - -;; 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 -;; https://www.r-project.org/Licenses/ - -;;; Commentary: - -;; Support for mouse- or cursor-sensitive actions. This is based on -;; and uses mouseme.el. mouseme.el only does mouse sensititivity. -;; The new functions ess-mouse-me and ess-mouse-me-helper do similar -;; things based on the cursor, not the mouse, and can be bound to a -;; keystroke. - -;;; Code: - - ; Requires and autoloads - -;;*;; Requires -(require 'mouseme) -(require 'ess-dde) -(require 'ess-trns) -;;(if (or (equal window-system 'w32) -;; (equal window-system 'win32) -;; (equal window-system 'mswindows)) -;; (require 'essiw32b)) - -(defun ess-mouse-me () - "Popup a menu of functions to run on selected string or region." - (interactive) - (ess-mouse-me-helper - (lambda (name) - (or (x-popup-menu (list '(0 0) - (get-buffer-window (get-buffer (buffer-name)))) - (funcall mouse-me-build-menu-function name)) - (error "No command to run"))))) - - - -(defun ess-mouse-me-helper (func) - "Determine the string to use to process EVENT and call FUNC to get cmd." - (let (name sp sm mouse beg end cmd mmtype) - ;; temporarily goto where the event occurred, get the name clicked - ;; on and enough info to figure out what to do with it - (save-match-data - (save-excursion - (setq sp (point)) ; saved point - (setq sm (mark t)) ; saved mark -;;; (set-buffer (window-buffer (posn-window (event-start event)))) -;;; (setq mouse (goto-char (posn-point (event-start event)))) - (setq mouse (point)) ;; ess-mouse-me-helper - ;; if there is a region and point is inside it - ;; check for sm first incase (null (mark t)) - ;; set name to either the thing they clicked on or region - (if (and sm - (or (and transient-mark-mode mark-active) - (eq last-command 'mouse-drag-region)) - (>= mouse (setq beg (min sp sm))) - (<= mouse (setq end (max sp sm)))) - (setq name (buffer-substring beg end)) - (setq name (funcall mouse-me-get-string-function)) - (if (listp name) - (setq beg (nth 1 name) - end (nth 2 name) - name (car name)) - (goto-char mouse) - (while (not (looking-at (regexp-quote name))) - (backward-char 1)) - (setq beg (point)) - (setq end (search-forward name)))))) - ;; check if name is null, meaning they clicked on no word - (if (or (null name) - (and (stringp name) (string= name "" ))) - (error "No string to pass to function")) - ;; popup a menu to get a command to run - (setq cmd (funcall func name)) - ;; run the command, eval'ing if it was a list - (if (listp cmd) - (setq cmd (eval cmd))) - (setq mmtype (get cmd 'mouse-me-type)) - (cond ((eq mmtype 'region) - (funcall cmd beg end)) - ((eq mmtype 'string) - (funcall cmd name)) - (t - (funcall cmd name))))) - -(defcustom ess-S-mouse-me-menu-commands-alist - '("S-Plus 4 and 6 GUI under Windows" - ("Edit.data" . ess-mouse-me-Edit.data) - "----" - ("print" . ess-mouse-me-print) - ("summary" . ess-mouse-me-summary) - ("plot" . ess-mouse-me-plot) - ("show" . ess-mouse-me-show) - ("help" . ess-display-help-on-object) - ("args" . ess-mouse-me-args) - "----" - ("Browser on" . ess-mouse-me-browser-on) - ("Browser off" . ess-mouse-me-browser-off)) - "*Command menu used by `mouse-me-build-menu'. -A alist of elements where each element is either a cons cell or a string. -If a cons cell the car is a string to be displayed in the menu and the -cdr is either a function to call passing a string to, or a list which evals -to a function to call passing a string to. If the element is a string -it makes a non-selectable element in the menu. To make a separator line -use a string consisting solely of hyphens. - -The function returned from this menu will be called with one string -argument. Or if the function has the symbol property `mouse-me-type' -and if its value is the symbol `region' it will be called with the -beginning and ending points of the selected string. If the value is -the symbol `string' it will be called with one string argument." - :type '(repeat sexp) - :group 'mouseme) - - -(defun ess-mouse-me-Edit.data (string) - (ess-mouse-me-eval-expanded string "Edit.data(" ")" nil nil nil)) - -(defun ess-mouse-me-print (string) - (ess-mouse-me-eval-expanded string "" "" nil (ess-ddeclient-p) t)) -(defun ess-mouse-me-summary (string) - (ess-mouse-me-eval-expanded string "summary(" ")" nil (ess-ddeclient-p) t)) -(defun ess-mouse-me-plot (string) - (ess-mouse-me-eval-expanded string "plot(" ")") nil nil nil) -(defun ess-mouse-me-show (string) - (ess-mouse-me-eval-expanded string "show(" ")") nil nil nil) -(defun ess-mouse-me-args (string) - (ess-mouse-me-eval-expanded string "args(" ")" nil (ess-ddeclient-p) t)) - -(defun ess-mouse-me-browser-on (string) - (if (equal (substring ess-dialect 0 1) "R") - (ess-eval-linewise (concat "debug(" string ")")) - (ess-mouse-me-eval-expanded string "trace(" ", exit=browser)") nil nil nil)) - -(defun ess-mouse-me-browser-off (string) - (if (equal (substring ess-dialect 0 1) "R") - (ess-eval-linewise (concat "undebug(" string ")")) - (ess-mouse-me-eval-expanded string "untrace(" ")") nil nil nil)) - - - -(defun ess-mouse-me-eval-expanded (string &optional head tail commands-buffer - page value-returned) - "Send the expanded STRING to the inferior-ess process using `ess-command' -after first concating the HEAD and TAIL. Put answer in COMMANDS-BUFFER if -specified and not using ddeclient, otherwise in \"tmp-buffer\". In either -case the buffer containing the answer is renamed to the value of the -constructed command. If PAGE is non-nil and using ddeclient, expand -the string one more time by embedding it in a \"page()\" command." - (interactive) - (let* (scommand - page-scommand - (lproc-name ess-local-process-name) - (ess-mouse-customize-alist ess-local-customize-alist)) - (if (not head) (setq head "summary(")) - (if (not tail) (setq tail ")")) - (if (not commands-buffer) (setq commands-buffer - (get-buffer-create "tmp-buffer"))) - (setq scommand (concat head string tail)) - - (if (ess-ddeclient-p) - (progn - (setq page-scommand (if page - (concat "page(" scommand ")") - scommand)) - (set-buffer-file-coding-system 'undecided-dos) - (ess-command page-scommand commands-buffer) - (if (not value-returned) - nil - (sleep-for 2) - (switch-to-buffer (car (buffer-list))))) - (ess-make-buffer-current) - (switch-to-buffer commands-buffer) - (ess-setq-vars-local (eval ess-mouse-customize-alist) (current-buffer)) - (setq ess-local-process-name lproc-name) - (ess-command (concat scommand "\n") commands-buffer) - (if (not value-returned) (switch-to-buffer (nth 1 (buffer-list))))) - (if (not value-returned) - nil - (if ess-microsoft-p ;; there ought to be a filter - (while (search-forward "\r" nil t) ;; function to keep the ^M - (replace-match "" nil t))) ;; from showing up at all - (ess-transcript-mode (eval ess-mouse-customize-alist)) - (setq ess-local-process-name lproc-name) - (rename-buffer scommand)))) - - - ; Provide package - -(provide 'ess-mouse) - - - -;;;;;;;; STARTUP STUFF ;;;;;;;;;;;; - -(make-variable-buffer-local 'mouse-me-menu-commands) - -(defun ess-S-mouse-me-menu-commands () - (if (equal ess-language "S") - (setq mouse-me-menu-commands ess-S-mouse-me-menu-commands-alist))) - -;; (define-key ess-mode-map [S-mouse-3] 'ess-mouse-me) -;; (define-key inferior-ess-mode-map [S-mouse-3] 'ess-mouse-me) -;; (defun ess-S-mouse-me-ess-transcript-mode () -;; (define-key ess-transcript-mode-map [S-mouse-3] 'ess-mouse-me)) -;; -(add-hook 'ess-mode-hook 'ess-S-mouse-me-menu-commands) -(add-hook 'inferior-ess-mode-hook 'ess-S-mouse-me-menu-commands) -(add-hook 'ess-transcript-mode-hook 'ess-S-mouse-me-menu-commands) -;; (add-hook 'ess-transcript-mode-hook 'ess-S-mouse-me-ess-transcript-mode) - - -;;; ess-mouse.el ends here diff -Nru ess-18.10.2/lisp/ess-noweb.el ess-18.10.2+git20220915.f45542e/lisp/ess-noweb.el --- ess-18.10.2/lisp/ess-noweb.el 2018-11-10 09:41:11.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/lisp/ess-noweb.el 1970-01-01 00:00:00.000000000 +0000 @@ -1,130 +0,0 @@ -;;; ess-noweb.el --- support for Literate Data Analysis - -;; Copyright (C) 1999 Mark Lunt -;; Copyright (C) 1999--2004 A.J. Rossini, Richard M. Heiberger, Martin -;; Maechler, Kurt Hornik, Rodney Sparapani, and Stephen Eglen. - -;; Author: Mark Lunt -;; A.J. Rossini -;; Created: April 18, 1999 -;; Maintainer: ESS-core - -;; Keywords: statistics, languages -;; Summary: Noweb support for ESS - -;; This file is part of ESS - -;; This file is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 2, or (at your option) -;; any later version. - -;; This file is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; A copy of the GNU General Public License is available at -;; https://www.r-project.org/Licenses/ - -;;; Commentary: - -;; Code for ESS and Literate Data Analysis. - -;;; Code: - - ; Requires and autoloads - -(require 'ess-custom) -(require 'ess-inf) -(require 'ess-noweb-mode) - - ; Variables - -(defvar ess-noweb-use-font-lock font-lock-mode - "Set to t if you want to use font-locking in ESS noweb buffers.") - -(if ess-noweb-use-font-lock - (require 'ess-noweb-font-lock-mode)) - - ; Functions - -;;*;; Code Chunk evaluation. - -(defun ess-eval-chunk (vis) - "Tangle the current chunk and send it to the inferior ESS process. -Arg has same meaning as for `ess-eval-region'." - (interactive "P") - (let ((process-name ess-local-process-name) - new-process-name - (cbuf (current-buffer)) - (temp-buffer (ess-create-temp-buffer "Tangle Buffer"))) - (save-excursion - (ess-noweb-tangle-chunk temp-buffer) - (set-buffer temp-buffer) - ;; When the temp buffer is created, it does not inherit any value - ;; of ess-local-process-name from the .Rnw buffer, so we have to set it - ;; here. If ess-local-process-name is not set in the .Rnw buffer, - ;; it will inherit the value that is chosen here. - (set (make-local-variable 'ess-local-process-name) process-name) - (ess-eval-region (point-min) (point-max) vis "Eval Chunk") - (if process-name - (kill-buffer temp-buffer) - ;; if process-name was nil, source buffer did not have a local process - ;; so keep value from temp buffer before killing it. - (setq new-process-name ess-local-process-name) - (kill-buffer temp-buffer) - (set-buffer cbuf) - (set (make-local-variable 'ess-local-process-name) new-process-name))))) - - -(defun ess-eval-chunk-and-step (&optional vis) - "Tangle the current chunk and send it to the inferior ESS process and -step to the next chunk" - (interactive) - (ess-eval-chunk vis) - (ess-noweb-next-code-chunk 1)) - -(defun ess-eval-chunk-and-go (vis) - "Tangle the current chunk, send to the ESS process, and go there. -Arg has same meaning as for `ess-eval-region'." - (interactive "P") - (ess-eval-chunk vis) - (ess-switch-to-ESS t)) - -;;*;; Thread code chunk evaluation - -;; -;; Threads are code chunks which fit into the same "buffer" (I'm (AJR) -;; abusing terminology, but what I mean is things like: -;; <>= -;; 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. -Arg has same meaning as for `ess-eval-region'." - (interactive "P") - (let ((temp-buffer (ess-create-temp-buffer "Tangle Buffer"))) - (ess-noweb-tangle-current-thread temp-buffer) - (set-buffer temp-buffer) - (ess-eval-region (point-min) (point-max) vis "Eval buffer") - (kill-buffer temp-buffer))) - -(defun ess-eval-thread-and-go (vis) - "Tangle all chunks in the current chunk-thread, send to ESS process, -and go there. Arg has same meaning as for `ess-eval-region'." - (interactive "P") - (ess-eval-thread vis) - (ess-switch-to-ESS t)) - - ; Provide package - -(provide 'ess-noweb) - -;;; ess-noweb.el ends here diff -Nru ess-18.10.2/lisp/ess-noweb-font-lock-mode.el ess-18.10.2+git20220915.f45542e/lisp/ess-noweb-font-lock-mode.el --- ess-18.10.2/lisp/ess-noweb-font-lock-mode.el 2018-11-10 09:41:11.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/lisp/ess-noweb-font-lock-mode.el 1970-01-01 00:00:00.000000000 +0000 @@ -1,393 +0,0 @@ -;;; ess-noweb-font-lock-mode.el --- edit noweb files with GNU Emacs - -;; Copyright (C) 1999 by Adnan Yaqub (AYaqub@orga.com) -;; and Mark Lunt (mark.lunt@mrc-bsu.cam.ac.uk -;; Copyright (C) 2002 by A.J. Rossini -;; Copyright (C) 2003--2004 A.J. Rossini, Richard M. Heiberger, Martin -;; Maechler, Kurt Hornik, Rodney Sparapani, and Stephen Eglen. - -;; Maintainer: ESS-core - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 2, or (at your option) -;; any later version. -;; -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. -;; -;; A copy of the GNU General Public License is available at -;; https://www.r-project.org/Licenses/ -;; - -;;; Commentary: - -;; Code-dependent highlighting -;; ***** -;; -;; Adding highlighting to ess-noweb-mode.el -;; -;; Here is a description of how one can add highlighting via the -;; font-lock package to noweb buffers. It uses the hooks provided by -;; ess-noweb-mode.el. The solution provides the following features: -;; 1) The documentation chunks are highlighted in the ess-noweb-doc-mode -;; (e.g., LaTeX). -;; 2) The code chunks without mode comments (-*- mode -*-) are -;; highlighted in the ess-noweb-code-mode. -;; 3) The code chunks with mode comments (-*- mode -*-) on the first -;; line of the first chunk with this name are highlighted in the mode -;; in the comment. -;; -;; For example, given the file: -;; -;; % -*- mode: Noweb; ess-noweb-code-mode: c-mode -*- -;; -;; \begin{itemize} -;; \item a main routine written in C, -;; \item a log configuration file parser written in YACC, and -;; \item a lexical analyzer written in Lex. -;; \end{itemize} -;; -;; <>= -;; /* DO NOT EDIT ME! */ -;; /* This file was automatically generated from %W% (%G%). */ -;; @ -;; -;; <>= -;; .\" -*- nroff -*- -;; .\" DO NOT EDIT ME! -;; .\" This file was automatically generated from %W% (%G%). -;; @ -;; -;; The LaTeX list is highlighted in latex-mode (the default noweb doc -;; mode), the chunk <> is highlighted in c-mode (the -;; default noweb code mode), and the chunk <> is -;; highlighted in nroff-mode due to the "-*- nroff -*-" comment. -;; -;; Chunks are highlighted each time point moves into them from a -;; different mode. They are also fontified 'on the fly', but this is -;; less reliable, since the syntax can depend on the context. It's as -;; good as you would get outside ess-noweb-mode, though. -;; -;; To use it, you must add -;; (require 'ess-noweb-font-lock-mode) to your .emacs file. -;; Then, if you use either global-font-lock or turn-on-font-lock -;; statements, any ess-noweb-mode buffers will be fontified -;; appropriately. (We have to redefine turn-on-font-lock, but it -;; saves breaking other packages (in particular ESS, which I use a -;; lot), that assume that turn-on-font-lock is the way to turn on -;; font locking. - -;; Alternatively, you can turn ess-noweb-font-lock-mode on and off by -;; using M-x ess-noweb-font-lock-mode. However, turning -;; ess-noweb-font-lock-mode off when global-font-lock-mode is t makes it -;; impossible to use font-locking in that buffer subsequently, other -;; than by turning ess-noweb-font-lock-mode back on. - -;; 2) The highlighting sometimes get confused, but this is no longer -;; a noweb problem. Highlighting should work as well within a chunk -;; as it does without ess-noweb-mode. -;; There are some problems with, for example latex-mode: a `$' in a -;; verbatim environment with throw the font-locking out. -;; One slight blemish is that code-quotes are highlighted as comments -;; as they are being entered. They are only highlighted correctly -;; after `ess-noweb-font-lock-fontify-chunk' has been run, either as a -;; command or through changing to a different chunk and back again -;; (unless they lie on a single line, in which case they are -;; fontified correctly once they are completed). - -;;; Code: - -(require 'ess-noweb-mode) -(require 'font-lock) - -(defvar ess-noweb-font-lock-mode nil - "Buffer local variable, t iff this buffer is using `ess-noweb-font-lock-mode'.") - -(defvar ess-noweb-use-font-lock-mode t - "DO NOT CHANGE THIS VARIABLE -If you use `nw-turn-on-font-lock' to turn on font-locking, then turn it -off again, it would come back on again of its own accord when you -changed major-mode. This variable is used internally to stop it.") - -(defvar ess-noweb-font-lock-mode-hook nil - "Hook that is run after entering ess-noweb-font-lock mode.") - -(defvar ess-noweb-font-lock-max-initial-chunks 30 - "Maximum number of chunks to fontify initially. -If nil, will fontify the entire buffer when -ess-noweb-font-lock-initial-fontify-buffer is called" ) - -;; (defvar old-beginning-of-syntax nil -;; "Stores the function used to find the beginning of syntax in the -;; current major mode. ess-noweb-font-lock-mode needs a different one." ) - -(defvar ess-noweb-font-lock-doc-start-face font-lock-reference-face - "Face to use to highlight the `@' at the start of each doc chunk") - -(defvar ess-noweb-font-lock-brackets-face font-lock-reference-face - "Face to use to highlight `<<', `>>' `[[' and `]]' ") - -(defvar ess-noweb-font-lock-chunk-name-face font-lock-keyword-face - "Face to use to highlight the between `<<' and `>>'") - -(defvar ess-noweb-font-lock-code-quote-face font-lock-keyword-face - "Face to use to highlight the between `[[' and `]]'") - -;; Now we add [[ess-noweb-font-lock-mode]] to the list of existing minor -;; modes. The string ``NWFL'' will be added to the mode-line: ugly, but -;; brief. - -(if (not (assq 'ess-noweb-font-lock-mode minor-mode-alist)) - (setq minor-mode-alist (append minor-mode-alist - (list '(ess-noweb-font-lock-mode " NWFL"))))) - -;; An ugly kludge to get around problems with global-font-lock, which -;; fontifies the entire buffer in the new major mode every time you -;; change mode, which is time-consuming and makes a pigs trotters of -;; it. Trying to stop it looks tricky, but using this function as your -;; `font-lock-fontify-buffer' function stops it wasting your time - -(defalias 'nwfl-donowt #'ignore) - -;; The following function is just a wrapper for ess-noweb-font-lock-mode, -;; enabling it to be called as ess-noweb-font-lock-minor-mode instead. - -(define-obsolete-function-alias 'ess-noweb-font-lock-minor-mode - #'ess-noweb-font-lock-mode "ESS-16.11") - -;; Here we get to the meat of the problem -;;;###autoload -(defun ess-noweb-font-lock-mode ( &optional arg) - ;; FIXME: Don't define a new minor mode. Instead, arrange for normal - ;; font-lock to call our functions such as - ;; ess-noweb-font-lock-fontify-chunk-by-number. - "Minor mode for syntax highlighting when using `ess-noweb-mode' to edit noweb files. -Each chunk is fontified in accordance with its own mode." - (interactive "P") - (if (or ess-noweb-mode ess-noweb-font-lock-mode) - (progn - ;; This bit is tricky: copied almost verbatim from bib-cite-mode.el - ;; It seems to ensure that the variable ess-noweb-font-lock-mode is made - ;; local to this buffer. It then sets ess-noweb-font-lock-mode to `t' if - ;; 1) It was called with a prefix argument greater than 0 - ;; or 2) It was called with no argument, and ess-noweb-font-lock-mode is - ;; currently nil - ;; ess-noweb-font-lock-mode is nil if the prefix argument was <= 0 or there - ;; was no prefix argument and ess-noweb-font-lock-mode is currently `t' - (set (make-local-variable 'ess-noweb-font-lock-mode) - (if arg - (> (prefix-numeric-value arg) 0) - (not ess-noweb-font-lock-mode))) - ;; Now, if ess-noweb-font-lock-mode is true, we want to turn - ;; ess-noweb-font-lock-mode on - (cond - (ess-noweb-font-lock-mode ;Setup the minor-mode - (when (and (boundp 'global-font-lock-mode) global-font-lock-mode) - (mapc #'ess-noweb-make-variable-permanent-local - '(font-lock-fontify-buffer-function - font-lock-unfontify-buffer-function)) - (setq font-lock-fontify-buffer-function #'nwfl-donowt) - (setq font-lock-unfontify-buffer-function #'nwfl-donowt)) - (mapc #'ess-noweb-make-variable-permanent-local - '(ess-noweb-font-lock-mode - font-lock-dont-widen - ;; font-lock-beginning-of-syntax-function - syntax-begin-function - ess-noweb-use-font-lock-mode - after-change-functions)) - (setq ess-noweb-font-lock-mode t - font-lock-dont-widen t) - (add-hook 'after-change-functions - #'font-lock-after-change-function nil t) - ;; FIXME: Why add ess-noweb-font-lock-mode-fn to our own hook, - ;; instead of just calling ess-noweb-font-lock-mode-fn directly? - (add-hook 'ess-noweb-font-lock-mode-hook #'ess-noweb-font-lock-mode-fn) - (add-hook 'ess-noweb-changed-chunk-hook - #'ess-noweb-font-lock-fontify-this-chunk) - (run-hooks 'ess-noweb-font-lock-mode-hook) - (message "ess-noweb-font-lock mode: use `M-x ess-noweb-font-lock-describe-mode' for more info")) - ;; If we didn't do the above, then we want to turn ess-noweb-font-lock-mode - ;; off, no matter what (hence the condition `t') - (t - (when (and (boundp 'global-font-lock-mode) global-font-lock-mode) - ;; (setq font-lock-fontify-buffer-function - ;; 'font-lock-default-fontify-buffer) - ;; Get back our unfontify buffer function - (setq font-lock-unfontify-buffer-function - #'font-lock-default-unfontify-buffer)) - (remove-hook 'ess-noweb-font-lock-mode-hook #'ess-noweb-font-lock-mode-fn) - (remove-hook 'ess-noweb-changed-chunk-hook - #'ess-noweb-font-lock-fontify-this-chunk) - (remove-hook 'after-change-functions - #'font-lock-after-change-function ) - (font-lock-default-unfontify-buffer) - (setq ess-noweb-use-font-lock-mode nil) - (message "ess-noweb-font-lock-mode removed")))) - (message "ess-noweb-font-lock-mode can only be used with ess-noweb-mode"))) - -(defun ess-noweb-start-of-syntax () - "Go to the place to start fontifying from" - (interactive) - (goto-char (car (ess-noweb-chunk-region)))) - -(defvar font-latex-extend-region-functions) -(defvar syntax-begin-function) - -(defun ess-noweb-font-lock-fontify-chunk-by-number ( chunk-num ) - "Fontify chunk CHUNK-NUM based on the current major mode." - (save-excursion - (font-lock-set-defaults) - ;; (setq old-beginning-of-syntax font-lock-beginning-of-syntax-function) - (setq syntax-begin-function #'ess-noweb-start-of-syntax) - (setq font-lock-keywords - ;; (append font-lock-keywords - ;; '(("\\(\\[\\[\\)\\([^]]*\\]*\\)\\(\\]\\]\\|\\$\\)" - ;; (1 ess-noweb-font-lock-brackets-face prepend ) - ;; (2 ess-noweb-font-lock-code-quote-face prepend) - ;; (3 ess-noweb-font-lock-brackets-face prepend)) - ;; ("^[ \t\n]*\\(<<\\)\\([^>]*\\)\\(>>=?\\)" - ;; (1 ess-noweb-font-lock-brackets-face prepend ) - ;; (2 ess-noweb-font-lock-chunk-name-face prepend) - ;; (3 ess-noweb-font-lock-brackets-face prepend)) - ;; ("^@[ \t\n]+" - ;; (0 ess-noweb-font-lock-doc-start-face prepend ))))) - (append font-lock-keywords - '(("^[ \t\n]*\\(<<\\)\\([^>]*\\)\\(>>=?\\)" - ;; FIXME: Why not use ess-noweb-font-lock-brackets-face? - (1 font-lock-reference-face prepend ) - ;; FIXME: Why not use ess-noweb-font-lock-chunk-name-face? - (2 font-lock-keyword-face prepend) - (3 font-lock-reference-face prepend)) - ("^@[ \t\n]+" - (0 font-lock-reference-face prepend ))))) - - - (let ((r (cons (marker-position (cdr (aref ess-noweb-chunk-vector - chunk-num))) - (marker-position (cdr (aref ess-noweb-chunk-vector - (1+ chunk-num)))))) - (font-latex-extend-region-functions nil);; don't extend anything - (font-lock-extend-region-functions nil)) ;; this infloops :( - (save-restriction - (narrow-to-region (car r) (cdr r)) - ;; (sit-for 3) - (font-lock-fontify-region (car r) (cdr r))) - t))) - - -(defun ess-noweb-font-lock-fontify-this-chunk () - "Fontify this chunk according to its own major mode. -Since we are in the chunk, the major mode will already have been set -by ess-noweb-mode.el" - (interactive) - (ess-noweb-font-lock-fontify-chunk-by-number (ess-noweb-find-chunk-index-buffer))) - -(defun ess-noweb-font-lock-initial-fontify-buffer () - "Applies syntax highlighting to some or all chunks in a noweb buffer. -The number of chunks is set by `ess-noweb-font-lock-max-initial-chunks': if -this is nil, the entire buffer is fontified. -It is intended to be called when first entering `ess-noweb-font-lock-mode'. -For other purposes, use `ess-noweb-font-lock-fontify-chunks'." - (interactive) - ;; This will be tricky. It will be very slow to go throught the chunks - ;; in order, switching major modes all the time. - ;; So, we will do the documentation in one pass, the code in a second - ;; pass. This could still be a little slow if we have to swap between - ;; different code modes regularly, but it should be bearable. It should - ;; only happen when the file is first read in, anyway - (save-excursion - (let (start-chunk end-chunk this-chunk) - (setq this-chunk (ess-noweb-find-chunk-index-buffer)) - (if ess-noweb-font-lock-max-initial-chunks - (progn - (setq start-chunk - (max 0 - (- this-chunk - (/ ess-noweb-font-lock-max-initial-chunks 2)))) - ;; Don't you just love hairy lisp syntax ? The above means set the - ;; starting chunk to the current chunk minus half of - ;; ess-noweb-font-lock-max-initial-chunks, unless that is negative in - ;; which case set it to 0 - (setq end-chunk (+ start-chunk ess-noweb-font-lock-max-initial-chunks)) - (if (> end-chunk (- (length ess-noweb-chunk-vector) 2)) - (setq end-chunk (- (length ess-noweb-chunk-vector) 2)))) - ;; If ess-noweb-font-lock-max-initial-chunks is nil, do the whole buffer - (progn - (setq start-chunk 0) - (setq end-chunk (- (length ess-noweb-chunk-vector) 2)))) - (ess-noweb-font-lock-fontify-chunks start-chunk end-chunk)))) - -(defun ess-noweb-font-lock-fontify-buffer () - "This function will fontify each chunk in the buffer appropriately." - (interactive) - (let ((start-chunk 0) - (end-chunk (- (length ess-noweb-chunk-vector) 2))) - (ess-noweb-font-lock-fontify-chunks start-chunk end-chunk))) - -(defun ess-noweb-font-lock-fontify-chunks (start-chunk end-chunk) - "Fontify a noweb file from START-CHUNK to END-CHUNK." - (interactive) - (let ((chunk-counter start-chunk)) - (save-excursion - (message "Fontifying from %d to %d" start-chunk end-chunk) - ;; Want to set DOC mode for the first Doc chunk, not for the others - (while (stringp (car (aref ess-noweb-chunk-vector chunk-counter))) - (setq chunk-counter (+ chunk-counter 1))) - (goto-char (cdr (aref ess-noweb-chunk-vector chunk-counter))) - (ess-noweb-select-mode) - ;; Now go through the chunks, fontifying the documentation ones. - (while (<= chunk-counter end-chunk) - (if (not (stringp (car (aref ess-noweb-chunk-vector chunk-counter)))) - (ess-noweb-font-lock-fontify-chunk-by-number chunk-counter)) - (message "Fontifying documentation chunks: chunk %d" chunk-counter) - (setq chunk-counter (+ 1 chunk-counter))) - ;; Go back to the start and go through the chunks, fontifying the code ones. - (setq chunk-counter start-chunk) - (message "About to do code chunks") - (while (<= chunk-counter end-chunk) - (when (stringp (car (aref ess-noweb-chunk-vector chunk-counter))) - ;; It's a code chunk: goto it to set the correct code mode, then - ;; fontify it. - (message "Fontifying code chunks: chunk %d" chunk-counter) - (goto-char (cdr (aref ess-noweb-chunk-vector chunk-counter))) - (ess-noweb-select-mode) - (ess-noweb-font-lock-fontify-this-chunk)) - (setq chunk-counter (1+ chunk-counter)))) - (ess-noweb-select-mode))) - -(defun ess-noweb-font-lock-mode-fn() - "Function that is intended to be attached to ess-noweb-font-lock-mode-hook." - (ess-noweb-font-lock-initial-fontify-buffer)) - -;; This is a wee bit of a hack. If people attach `turn-on-font-lock' -;; to their major mode hook, it will play hell with -;; ess-noweb-font-lock-mode. I had hoped that providing a replacement -;; `nw-turn-on-font-lock' would solve the problem, but it didn't -;; (sometimes turn-on-font-lock appears in places other than -;; `.emacs', such as in ESS). So rather than have it fall over if -;; turn-on-lock was around, I redefined turn-on-font-lock to do the -;; right thing. - -(define-obsolete-function-alias 'nw-turn-on-font-lock - #'turn-on-font-lock "ESS-16.11") - -(defadvice turn-on-font-lock (around ess-noweb-font-lock activate) - ;; FIXME: An advice on turn-on-font-lock is definitely not sufficient, - ;; since font-lock can be enabled without going through turn-on-font-lock! - (if (not ess-noweb-mode) - ad-do-it - (if (and (not ess-noweb-font-lock-mode) ess-noweb-use-font-lock-mode) - (ess-noweb-font-lock-mode)))) - -(provide 'ess-noweb-font-lock-mode) -;; ***** -;; -;; Adnan Yaqub (AYaqub@orga.com) -;; ORGA Kartensysteme GmbH // An der Kapelle 2 // D-33104 Paderborn // Germany -;; Tel. +49 5254 991-823 //Fax. +49 5254 991-749 - - -;;; ess-noweb-font-lock-mode.el ends here diff -Nru ess-18.10.2/lisp/ess-noweb-mode.el ess-18.10.2+git20220915.f45542e/lisp/ess-noweb-mode.el --- ess-18.10.2/lisp/ess-noweb-mode.el 2018-11-10 09:41:11.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/lisp/ess-noweb-mode.el 1970-01-01 00:00:00.000000000 +0000 @@ -1,1896 +0,0 @@ -;;; ess-noweb-mode.el --- edit noweb files with GNU Emacs - -;; Copyright (C) 1995 by Thorsten.Ohl @ Physik.TH-Darmstadt.de -;; with a little help from Norman Ramsey -;; and Mark Lunt -;; and A.J. Rossini -;; Copyright (C) 1999--2010 A.J. Rossini, Richard M. Heiberger, Martin -;; Maechler, Kurt Hornik, Rodney Sparapani, and Stephen Eglen. -;; Copyright (C) 2011--2012 A.J. Rossini, Richard M. Heiberger, Martin Maechler, -;; Kurt Hornik, Rodney Sparapani, Stephen Eglen and Vitalie Spinu. - -;; ESS-related Changes first added by Mark Lunt and A.J. Rossini, March, 1999. - -;; Maintainer: ESS-core - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 2, or (at your option) -;; any later version. -;; -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. -;; -;; A copy of the GNU General Public License is available at -;; https://www.r-project.org/Licenses/ - -;; See bottom of this file for information on language-dependent -;; highlighting, and recent changes. -;; - -;; BASED ON: (from Mark Lunt). -;; -- Id: ess-noweb-mode.el,v 1.11 1999/03/21 20:14:41 root Exp -- - - -;;; NEWS: - -;; * [tho] M-n q, aka: M-x ess-noweb-fill-chunk -;; -;; * [tho] `M-n TAB', aka: `M-x ess-noweb-complete-chunk' -;; -;; * [tho] ess-noweb-occur -;; -;; * [nr] use `M-n' instead of `C-c n' as default command prefix -;; -;; * [nr] don't be fooled by -;; -;; @ -;; <>= -;; int foo; -;; @ %def foo -;; Here starts a new documentation chunk! -;; <>= -;; int bar; -;; -;; * [nr] switch mode changing commands off during isearch-mode -;; -;; * [tho] ess-noweb-goto-chunk proposes a default -;; -;; * commands for tangling, weaving,.. for Sweave: --> ./ess-swv.el -;; - - -;;; TODO: - -;; * _maybe_ replace our `ess-noweb-chunk-vector' by text properties. We -;; could then use highlighting to jazz up the visual appearance. -;; (Highlighting is sorted: `ess-noweb-chunk-vector' can be -;; ditched. It is simple to determine if we are in a doc or code -;; chunk.) -;; -;; * wrapped `ess-noweb-goto-next' and `ess-noweb-goto-previous' -;; -;; * more range checks and error exits -;; -;; * `ess-noweb-hide-code-quotes' should be superfluous now, and could -;; be removed. For ESS 5.3.10, we disable these, using the new variable -;; ess-noweb-code-quote-handling. If nobody misses that code-protecting -;; behavior, all that should be removed entirely. - -;;; Code: - -(require 'ess-custom) -(require 'ess-utils) - -(defvar weave-process) - - -;;; Variables - -;; (defconst ess-noweb-mode-RCS-Id -;; "Imported to ESS Subversion repository and RCS ids not maintained.") - -;; (defconst ess-noweb-mode-RCS-Name -;; " ") - -(defvar ess-noweb-mode-prefix "\M-n" - "*Prefix key to use for noweb mode commands. -The value of this variable is checked as part of loading noweb mode. -After that, changing the prefix key requires manipulating keymaps.") - -(defvar ess-noweb-mode-load-hook nil - "Hook that is run after noweb mode is loaded.") - -(defvar ess-noweb-mode-hook nil - "Hook that is run after entering noweb mode.") - -(defvar ess-noweb-select-code-mode-hook nil - "Hook that is run after the code mode is selected. -This is the place to overwrite keybindings of the ess-noweb-CODE-MODE.") - -(defvar ess-noweb-select-doc-mode-hook nil - "Hook that is run after the documentation mode is selected. -This is the place to overwrite keybindings of the ess-noweb-DOC-MODE.") - -(defvar ess-noweb-select-mode-hook nil - "Hook that is run after the documentation or the code mode is selected. -This is the place to overwrite keybindings of the other modes.") - -(defvar ess-noweb-changed-chunk-hook nil - "Hook that is run every time point moves from one chunk to another. -It will be run whether or not the major-mode changes.") - -(defvar ess-noweb-default-code-mode 'fundamental-mode - "Default major mode for editing code chunks. -This is set to FUNDAMENTAL-MODE by default, but you might want to -change this in the Local Variables section of your file to something -more appropriate, like C-MODE, FORTRAN-MODE, or even -INDENTED-TEXT-MODE.") - -(defvar ess-noweb-code-mode 'c-mode - "Major mode for editing this particular code chunk. -It defaults to ess-noweb-default-code-mode, but can be reset by a comment -on the first line of the chunk containing the string -\"-*- NEWMODE -*-\" or -\"-*- NEWMODE-mode -*-\" or -\"-*- mode: NEWMODE -*- \" or -\"-*- mode: NEWMODE-mode -*- \" -Option three is recommended, as it is the closest to standard emacs usage.") - -(defvar ess-noweb-default-doc-mode 'latex-mode - "Major mode for editing documentation chunks. -Sensible choices would be tex-mode, latex-mode, sgml-mode, or -html-mode. Maybe others will exist someday.") - -(defvar ess-noweb-doc-mode-syntax-table nil - "A syntax-table syntax table that makes quoted code in doc chunks to -behave.") - -(defvar ess-noweb-last-chunk-index 0 - "This keeps track of the chunk we have just been in. If this is not -the same as the current chunk, we have to check if we need to change -major mode.") - -(defvar ess-noweb-chunk-vector nil - "Vector of the chunks in this buffer.") - -(defvar ess-noweb-narrowing nil - "If not NIL, the display will always be narrowed to the -current chunk pair.") - -(defvar ess-noweb-electric-@-and-< t - "If not nil, the keys `@' and `<' will be bound to ess-noweb-ELECTRIC-@ -and ess-noweb-ELECTRIC-<, respectively.") - -(defvar ess-noweb-use-mouse-navigation t - "If not nil, enables moving between chunks using mouse-1. -Clicking on the '<<' at the beginning of a chunk name takes you to the -previous occurence of that chunk name, clicking on the '>>' takes you -to the next. -Assumes mouse-1 is bound to mouse-set-point, so if you have rebound -mouse-1, this will override your binding.") - -(defvar ess-noweb-code-quotes-handling nil - "If not nil, the function pair \\[ess-noweb-hide-code-quotes] and -\\[ess-noweb-restore-code-quotes] are used to \"protect\" code inside -\"[[\" .. \"]]\" pairs. Note that rarely this has been found to be buggy -with the \"catastrophic\" consequence of whole parts of your document being -replaced by sequences of '*'.") - -(defvar ess-noweb-doc-mode ess-noweb-default-doc-mode - "Default major mode for editing noweb documentation chunks. -It is not possible to have more than one doc-mode in a file. -However, this variable is used to determine whether the doc-mode needs -to by added to the mode-line") - -;; The following is apparently broken -- dangling code that was -;; commented out. Need to see if we can get it working? - -(defvar ess-noweb-weave-options "-delay") -(defvar ess-noweb-latex-viewer "xdvi") -(defvar ess-noweb-html-viewer "netscape") - -(defun ess-noweb-weave (&optional name) - (interactive) - (let ((buffer (get-buffer-create "Weave Buffer"))) - (if (not name) - (progn - ;; Assume latex documentation, but set to html if appropriate - (if (eq ess-noweb-doc-mode 'html-mode) - (setq name (concat (substring (buffer-file-name) 0 - (string-match ".nw" name)) - ".html")) - (setq name (concat (substring (buffer-file-name) 0 - (string-match ".nw" name)) - ".tex"))))) - (setq name (concat "> " name)) - (setq ess-noweb-weave-options (concat ess-noweb-weave-options name)) - (start-process weave-process buffer "noweave" ess-noweb-weave-options))) -;;(defun ess-noweb-view ()) - - -;;; Setup -(defvar ess-noweb-mode nil - "Buffer local variable, T iff this buffer is edited in noweb mode.") - -;; For some reason that I do not understand, `newline' does not do the -;; right thing in quoted code. If point is not preceded by whitespace, -;; it moves to the beginning of the current line, not the beginning of -;; the new line. `newline 1' works fine, hence the kludge. I'd love to -;; understand what's going on, though. Try running M-x newline in the -;; middle of a code quote in a doc chunk to see -;; what I mean: its odd. - -(defun ess-noweb-newline (&optional arg) - "A kludge to get round very odd behaviour of newline in quoted code." - (interactive "p") - (if arg (newline arg) (newline 1)) - (ess-noweb-indent-line)) - -(defvar ess-noweb-mode-prefix-map - (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) - (define-key map "\C-p" 'ess-noweb-previous-chunk) - (define-key map "\M-n" 'ess-noweb-goto-next) - (define-key map "\M-m" 'ess-noweb-insert-default-mode-line) - (define-key map "\M-p" 'ess-noweb-goto-previous) - (define-key map "c" 'ess-noweb-next-code-chunk) - (define-key map "C" 'ess-noweb-previous-code-chunk) - (define-key map "d" 'ess-noweb-next-doc-chunk) - (define-key map "D" 'ess-noweb-previous-doc-chunk) - (define-key map "g" 'ess-noweb-goto-chunk) - (define-key map "\C-l" 'ess-noweb-update-chunk-vector) - (define-key map "\M-l" 'ess-noweb-update-chunk-vector) - (define-key map "w" 'ess-noweb-copy-chunk-as-kill) - (define-key map "W" 'ess-noweb-copy-chunk-pair-as-kill) - (define-key map "k" 'ess-noweb-kill-chunk) - (define-key map "K" 'ess-noweb-kill-chunk-pair) - (define-key map "m" 'ess-noweb-mark-chunk) - (define-key map "M" 'ess-noweb-mark-chunk-pair) - (define-key map "n" 'ess-noweb-narrow-to-chunk) - (define-key map "N" 'ess-noweb-narrow-to-chunk-pair) - (define-key map "t" 'ess-noweb-toggle-narrowing) - (define-key map "\t" 'ess-noweb-complete-chunk) - (define-key map "q" 'ess-noweb-fill-chunk) - (define-key map "i" 'ess-noweb-new-chunk) - (define-key map "o" 'ess-noweb-occur) - ;;(define-key map "v" 'ess-noweb-mode-version) - (define-key map "h" 'ess-noweb-describe-mode) - ;; do *NOT* override C-h (give all keybindings startings with M-n! - map) - "noweb minor-mode prefix keymap") - -(defvar ess-noweb-minor-mode-map - (let ((map (make-sparse-keymap))) - (if ess-noweb-electric-@-and-< - (progn - (define-key map "@" 'ess-noweb-electric-@) - (define-key map "<" 'ess-noweb-electric-<))) - (define-key map "\M-q" 'ess-noweb-fill-paragraph-chunk) - (define-key map [(control meta ?\\)] 'ess-noweb-indent-region) - ;;(define-key map "\C-c\C-n" 'ess-noweb-indent-line) ; Override TeX-normal! - (define-key map "\t" 'ess-noweb-indent-line) - ;; (define-key map [tab] 'ess-noweb-indent-line) ;; interferes with ac - (define-key map "\r" 'ess-noweb-newline) - ;; (define-key map [return] 'ess-noweb-newline) ;; interferes with ac - (define-key map [mouse-1] 'ess-noweb-mouse-first-button) - (define-key map ess-noweb-mode-prefix ess-noweb-mode-prefix-map) - map) - "ESS Noweb minor mode keymap") - -(easy-menu-define - ess-noweb-minor-mode-menu ess-noweb-minor-mode-map - "Menu keymap for noweb." - '("Noweb" - ("Movement" - ["Previous chunk" ess-noweb-previous-chunk t] - ["Next chunk" ess-noweb-next-chunk t] - ["Previous chunk of same name" ess-noweb-goto-previous t] - ["Next chunk of same name" ess-noweb-goto-next t] - ["Goto chunk" ess-noweb-goto-chunk t] - ["Previous code chunk" ess-noweb-previous-code-chunk t] - ["Next code chunk" ess-noweb-next-code-chunk t] - ["Previous documentation chunk" ess-noweb-previous-doc-chunk t] - ["Next documentation chunk" ess-noweb-next-doc-chunk t]) - ("Editing" - ["Copy chunk" ess-noweb-copy-chunk-as-kill t] - ["Copy chunk pair" ess-noweb-copy-chunk-pair-as-kill t] - ["Kill chunk" ess-noweb-kill-chunk t] - ["Kill chunk pair" ess-noweb-kill-chunk-pair t] - ["Mark chunk" ess-noweb-mark-chunk t] - ["Mark chunk pair" ess-noweb-mark-chunk-pair t]) - ("Narrowing" - ["Narrow to chunk" ess-noweb-narrow-to-chunk t] - ["Narrow to chunk pair" ess-noweb-narrow-to-chunk-pair t] - ["Toggle auto narrowing" ess-noweb-toggle-narrowing t] - ["Widen" widen t]) - ("Modes" - ["Set documentation mode" ess-noweb-set-doc-mode t] - ["Set default code mode" ess-noweb-set-code-mode t] - ["Set code mode for this chunk" ess-noweb-set-this-code-mode t] - ["Insert default mode line" ess-noweb-insert-default-mode-line t]) - ("Tangling" - ["Tangle current chunk" ess-noweb-tangle-chunk t] - ["Tangle current thread" ess-noweb-tangle-current-thread t] - ["Tangle named thread" ess-noweb-tangle-thread t]) - ("Miscellaneous" - ["Complete chunk name" ess-noweb-complete-chunk t] - ["Fill current chunk" ess-noweb-fill-chunk t] - ["Insert new chunk" ess-noweb-new-chunk t] - ["Update the chunk vector" ess-noweb-update-chunk-vector t] - ["Chunk occurrences" ess-noweb-occur t]) - "--" - ["Help" ess-noweb-describe-mode t] - ;;["Version" ess-noweb-mode-version t] - )) - -;; Add ess-noweb-mode to the list of minor modes -(if (not (assq 'ess-noweb-mode minor-mode-alist)) - (setq minor-mode-alist (append minor-mode-alist - (list '(ess-noweb-mode " Noweb"))))) -;; Add ess-noweb-minor-mode-map to the list of minor-mode keymaps -;; available. Then, whenever ess-noweb-mode is activated, the keymap is -;; automatically activated -(if (not (assq 'ess-noweb-mode minor-mode-map-alist)) - (setq minor-mode-map-alist - (cons (cons 'ess-noweb-mode ess-noweb-minor-mode-map) - minor-mode-map-alist))) - -(defun ess-noweb-minor-mode (&optional arg) - "Minor meta mode for editing noweb files. See ess-noweb-mode." - (interactive) - (ess-noweb-mode arg)) ; this was ess-noweb-minor-mode??? (truly recursive) - -(declare-function ess-noweb-font-lock-mode "ess-noweb-font-lock-mode") - -;;;###autoload -(defun ess-noweb-mode ( &optional arg ) - "Minor meta mode for editing noweb files. -`Meta' refers to the fact that this minor mode is switching major -modes depending on the location of point. - -The following special keystrokes are available in noweb mode: - -Movement: -\\[ess-noweb-next-chunk] \tgoto the next chunk -\\[ess-noweb-previous-chunk] \tgoto the previous chunk -\\[ess-noweb-goto-previous] \tgoto the previous chunk of the same name -\\[ess-noweb-goto-next] \tgoto the next chunk of the same name -\\[ess-noweb-goto-chunk] \t\tgoto a chunk -\\[ess-noweb-next-code-chunk] \t\tgoto the next code chunk -\\[ess-noweb-previous-code-chunk] \t\tgoto the previous code chunk -\\[ess-noweb-next-doc-chunk] \t\tgoto the next documentation chunk -\\[ess-noweb-previous-doc-chunk] \t\tgoto the previous documentation chunk - -Copying/Killing/Marking/Narrowing: -\\[ess-noweb-copy-chunk-as-kill] \t\tcopy the chunk the point is in into the kill ring -\\[ess-noweb-copy-chunk-pair-as-kill] \t\tcopy the pair of doc/code chunks the point is in -\\[ess-noweb-kill-chunk] \t\tkill the chunk the point is in -\\[ess-noweb-kill-chunk-pair] \t\tkill the pair of doc/code chunks the point is in -\\[ess-noweb-mark-chunk] \t\tmark the chunk the point is in -\\[ess-noweb-mark-chunk-pair] \t\tmark the pair of doc/code chunks the point is in -\\[ess-noweb-narrow-to-chunk] \t\tnarrow to the chunk the point is in -\\[ess-noweb-narrow-to-chunk-pair] \t\tnarrow to the pair of doc/code chunks the point is in -\\[widen] \twiden -\\[ess-noweb-toggle-narrowing] \t\ttoggle auto narrowing - -Filling and Indenting: -\\[ess-noweb-fill-chunk] \tfill (or indent) the chunk at point according to mode -\\[ess-noweb-fill-paragraph-chunk] \tfill the paragraph at point, restricted to chunk -\\[ess-noweb-indent-line] \tindent the line at point according to mode - -Insertion: -\\[ess-noweb-insert-default-mode-line] \tinsert a line to set this file's code mode -\\[ess-noweb-new-chunk] \t\tinsert a new chunk at point -\\[ess-noweb-complete-chunk] \tcomplete the chunk name before point -\\[ess-noweb-electric-@] \t\tinsert a `@' or start a new doc chunk -\\[ess-noweb-electric-<] \t\tinsert a `<' or start a new code chunk - -Modes: -\\[ess-noweb-set-doc-mode] \t\tset the major mode for editing doc chunks -\\[ess-noweb-set-code-mode] \tset the major mode for editing code chunks -\\[ess-noweb-set-this-code-mode] \tset the major mode for editing this code chunk - -Misc: -\\[ess-noweb-occur] \t\tfind all occurrences of the current chunk -\\[ess-noweb-update-chunk-vector] \tupdate the markers for chunks -\\[ess-noweb-describe-mode] \tdescribe ess-noweb-mode -" (interactive "P") - ;; This bit is tricky: copied almost verbatim from bib-cite-mode.el - ;; It seems to ensure that the variable ess-noweb-mode is made - ;; local to this buffer. It then sets ess-noweb-mode to `t' if - ;; 1) It was called with an argument greater than 0 - ;; or 2) It was called with no argument, and ess-noweb-mode is - ;; currently nil - ;; ess-noweb-mode is nil if the argument was <= 0 or there - ;; was no argument and ess-noweb-mode is currently `t' - (kill-all-local-variables) - (set (make-local-variable 'ess-noweb-mode) - (if arg - (> (prefix-numeric-value arg) 0) - (not ess-noweb-mode))) - ;; Now, if ess-noweb-mode is true, we want to turn - ;; ess-noweb-mode on - (cond - (ess-noweb-mode ;Setup the minor-mode - (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 - ess-language - ess-use-flymake - after-change-functions - before-change-functions - ess-noweb-narrowing - ess-noweb-chunk-vector - post-command-hook - isearch-mode-hook - isearch-mode-end-hook - ess-noweb-doc-mode - ess-noweb-code-mode - ess-noweb-default-code-mode - ess-noweb-last-chunk-index)) - (setq-local ess-use-flymake nil) - (ess-noweb-update-chunk-vector) - (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) - (ess-noweb-font-lock-mode 1))) - (add-hook 'post-command-hook 'ess-noweb-post-command-function) - - (add-hook 'after-change-functions 'ess-noweb-after-change-function nil t) - (add-hook 'before-change-functions 'ess-noweb-before-change-function nil t) - - (add-hook 'ess-noweb-select-doc-mode-hook 'ess-noweb-auto-fill-doc-mode) - (add-hook 'ess-noweb-select-code-mode-hook 'ess-noweb-auto-fill-code-mode) - (add-hook 'isearch-mode-hook 'ess-noweb-note-isearch-mode) - (add-hook 'isearch-mode-end-hook 'ess-noweb-note-isearch-mode-end) - (setq ess-noweb-doc-mode-syntax-table nil) - (run-hooks 'ess-noweb-mode-hook) - (message - "noweb mode: use `M-x ess-noweb-describe-mode' for further information")) - ;; If we didn't do the above, then we want to turn ess-noweb-mode - ;; off, no matter what (hence the condition `t') - (t - (remove-hook 'post-command-hook 'ess-noweb-post-command-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 '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) - (remove-hook 'isearch-mode-hook 'ess-noweb-note-isearch-mode) - (remove-hook 'isearch-mode-end-hook 'ess-noweb-note-isearch-mode-end) - (if (and (boundp 'ess-noweb-font-lock-mode) - ess-noweb-font-lock-mode) - (progn - (ess-noweb-font-lock-mode -1) - (message "ESS-Noweb and ESS-Noweb-Font-Lock Modes Removed")) - (message "ESS-Noweb mode removed"))))) - -(defun ess-noweb-make-variable-permanent-local (var) - "Declare VAR buffer local, but protect it from beeing killed -by major mode changes." - (make-variable-buffer-local var) - (put var 'permanent-local 't)) - -(defun ess-noweb-note-isearch-mode () - "Take note of an incremental search in progress" - (remove-hook 'post-command-hook 'ess-noweb-post-command-function)) - -(defun ess-noweb-note-isearch-mode-end () - "Take note of an incremental search having ended" - (add-hook 'post-command-hook 'ess-noweb-post-command-function)) - -(defun ess-noweb-post-command-function () - "The hook being run after each command in noweb mode." - (ess-noweb-select-mode)) - -(defvar ess-noweb-chunk-boundary-changed nil - "Whether the current change affects a chunk boundary.") - -(defvar ess-noweb-chunk-boundary-regexp "^\\(@[^@]\\)\\|\\(<<\\)") - -(defun ess-noweb-before-change-function (begin end) - "Record changes to chunk boundaries." - (save-excursion - (goto-char begin) - (setq ess-noweb-chunk-boundary-changed - (re-search-forward ess-noweb-chunk-boundary-regexp end t)))) - -(defun ess-noweb-after-change-function (begin end length) - "Function to run after every change in a noweb buffer. -If the changed region contains a chunk boundary, it will update -the chunk vector" - (save-excursion - (goto-char begin) - (when (or ess-noweb-chunk-boundary-changed - (re-search-forward ess-noweb-chunk-boundary-regexp end t)) - (ess-noweb-update-chunk-vector) - (setq ess-noweb-chunk-boundary-changed nil)))) - - -;;; Chunks - -(defun ess-noweb-update-chunk-vector () - "Scan the whole buffer and place a marker at each \"^@\" and \"^<<\". -Record them in ess-noweb-CHUNK-VECTOR." - (interactive) - (save-excursion - (goto-char (point-min)) - (let ((chunk-list (list (cons 'doc (point-marker))))) - (while (re-search-forward "^\\(@\\( \\|$\\|\\( %def\\)\\)\\|<<\\(.*\\)>>=\\)" nil t) - (goto-char (match-beginning 0)) - ;; If the 3rd subexpression matched @ %def, we're still in a code - ;; chunk (sort of), so don't place a marker here. - (if (not (match-beginning 3)) - (setq chunk-list - ;; If the 4th subexpression matched inside <<...>>, - ;; we're seeing a new code chunk. - (cons (cons (if (match-beginning 4) - ;;buffer-substring-no-properties better - ;;than buffer-substring if highlighting - ;;may be used - (buffer-substring-no-properties - (match-beginning 4) (match-end 4)) - 'doc) - (point-marker)) - chunk-list)) - ;; Scan forward either to !/^@ %def/, which will start a docs chunk, - ;; or to /^<<.*>>=$/, which will start a code chunk. - (progn - (forward-line 1) - (while (looking-at "@ %def") - (forward-line 1)) - (setq chunk-list - ;; Now we can tell code vs docs - (cons (cons (if (looking-at "<<\\(.*\\)>>=") - (buffer-substring-no-properties - (match-beginning 1) (match-end 1)) - 'doc) - (point-marker)) - chunk-list)))) - (forward-line 1)) - (setq chunk-list (cons (cons 'doc (point-max-marker)) chunk-list)) - (setq ess-noweb-chunk-vector (vconcat (reverse chunk-list)))))) - -(defun ess-noweb-find-chunk () - "Return a pair consisting of the name (or 'DOC) and the -marker of the current chunk." - (if (not ess-noweb-chunk-vector) - (ess-noweb-update-chunk-vector)) - (aref ess-noweb-chunk-vector (ess-noweb-find-chunk-index-buffer))) - -(defun ess-noweb-chunk-is-code (index) - "Return t if the chunk 'index' is a code chunk, nil otherwise" - (interactive) - (stringp (car (ess-noweb-chunk-vector-aref index)))) - -(defun ess-noweb-in-code-chunk () - "Return t if we are in a code chunk, nil otherwise." - (interactive) - (ess-noweb-chunk-is-code (ess-noweb-find-chunk-index-buffer))) - -(defun ess-noweb-in-mode-line () - "Return the name of the mode to use if we are in a mode line, nil -otherwise." - (interactive) - (let (beg end mode) - (save-excursion - (beginning-of-line 1) - (and (progn - (ess-write-to-dribble-buffer - (format "(n-i-m-l: 1)")) - (search-forward "-*-" - (save-excursion (end-of-line) (point)) - t)) - (progn - (ess-write-to-dribble-buffer - (format "(n-i-m-l: 2)")) - (skip-chars-forward " \t") - (setq beg (point)) - (search-forward "-*-" - (save-excursion (end-of-line) (point)) - t)) - (progn - (ess-write-to-dribble-buffer - (format "(n-i-m-l: 3)")) - (forward-char -3) - (skip-chars-backward " \t") - (setq end (point)) - (goto-char beg) - (setq mode (concat - (downcase (buffer-substring beg end)) - "-mode")) - (if (and (>= (length mode) 11)) - (progn - (if - (equal (substring mode -10 -5) "-mode") - (setq mode (substring mode 0 -5))) - (if - (equal (substring mode 0 5) "mode:") - (setq mode (substring mode 6)))))) - (progn - (ess-write-to-dribble-buffer - (format "(n-i-m-l: 3) mode=%s" mode)) - (intern mode)))))) - -(defun ess-noweb-find-chunk-index-buffer () - "Return the index of the current chunk in ess-noweb-CHUNK-VECTOR." - (ess-noweb-find-chunk-index 0 (1- (length ess-noweb-chunk-vector)))) - -(defun ess-noweb-find-chunk-index (low hi) - (if (= hi (1+ low)) - low - (let ((med (/ (+ low hi) 2))) - (if (< (point) (cdr (aref ess-noweb-chunk-vector med))) - (ess-noweb-find-chunk-index low med) - (ess-noweb-find-chunk-index med hi))))) - -(defun ess-noweb-chunk-region () - "Return a pair consisting of the beginning and end of the current chunk." - (interactive) - (let ((start (ess-noweb-find-chunk-index-buffer))) - (cons (marker-position (cdr (aref ess-noweb-chunk-vector start))) - (marker-position (cdr (aref ess-noweb-chunk-vector (1+ start))))))) - -(defun ess-noweb-copy-code-chunk () - "Copy the current code chunk to the kill ring, excluding the chunk name. -This will be particularly useful when interfacing with ESS." - (interactive) - (let ((r (ess-noweb-chunk-region))) - (save-excursion - (goto-char (car r)) - (if (ess-noweb-in-code-chunk) - (progn - (beginning-of-line 2) - (copy-region-as-kill (point) (cdr r))))))) - -(defun ess-noweb-extract-code-chunk () - "Create a new buffer with the same name as the current code chunk, -and copy all code from chunks of the same name to it." - (interactive) - (save-excursion - (if (ess-noweb-in-code-chunk) - (progn - (let ((chunk-name (car (ess-noweb-find-chunk))) - (chunk-counter 0) - (copy-counter 0) - (this-chunk) (oldbuf (current-buffer))) - (if (get-buffer chunk-name) - (progn - (set-buffer-modified-p nil) - (kill-buffer chunk-name))) - (get-buffer-create chunk-name) - (message "Created buffer %s" chunk-name) - (while (< chunk-counter (- (length ess-noweb-chunk-vector) 2)) - (setq this-chunk (ess-noweb-chunk-vector-aref - chunk-counter)) - (message "Current buffer is %s" (car this-chunk)) - (if (equal chunk-name (car this-chunk)) - (progn - (setq copy-counter (+ copy-counter 1)) - (goto-char (cdr this-chunk)) - (ess-noweb-copy-code-chunk) - (set-buffer chunk-name) - (goto-char (point-max)) - (yank) - (set-buffer oldbuf))) - (setq chunk-counter (+ chunk-counter 1))) - (message "Copied %d bits" copy-counter) - (set-buffer chunk-name) - (copy-region-as-kill (point-min)(point-max))))))) - -(defun ess-noweb-chunk-pair-region () - "Return a pair consisting of the beginning and end of the current pair of -documentation and code chunks." - (interactive) - (let* ((start (ess-noweb-find-chunk-index-buffer)) - (end (1+ start))) - (if (ess-noweb-chunk-is-code start) - (cons (marker-position (cdr (aref ess-noweb-chunk-vector (1- start)))) - (marker-position (cdr (aref ess-noweb-chunk-vector end)))) - (while (not (ess-noweb-chunk-is-code end)) - (setq end (1+ end))) - (cons (marker-position (cdr (aref ess-noweb-chunk-vector start))) - (marker-position (cdr (aref ess-noweb-chunk-vector (1+ end)))))))) - -(defun ess-noweb-chunk-vector-aref (i) - (if (< i 0) - (error "Before first chunk.")) - (if (not ess-noweb-chunk-vector) - (ess-noweb-update-chunk-vector)) - (if (>= i (length ess-noweb-chunk-vector)) - (error "Beyond last chunk.")) - (aref ess-noweb-chunk-vector i)) - -(defun ess-noweb-complete-chunk () - "Complete the chunk name before point, if any." - (interactive) - (if (ess-noweb-in-code-chunk) - (let ((end (point)) - (beg (save-excursion - (if (re-search-backward "<<" - (save-excursion - (beginning-of-line) - (point)) - t) - (match-end 0) - nil)))) - (if beg - (let* ((pattern (buffer-substring beg end)) - (alist (ess-noweb-build-chunk-alist)) - (completion (try-completion pattern alist))) - (cond ((eq completion t)) - ((null completion) - (message "Can't find completion for \"%s\"" pattern) - (ding)) - ((not (string= pattern completion)) - (delete-region beg end) - (insert completion) - (if (not (looking-at ">>")) - (insert ">>"))) - (t - (message "Making completion list...") - (with-output-to-temp-buffer "*Completions*" - (display-completion-list (all-completions pattern alist))) - (message "Making completion list...%s" "done")))) - (message "Not at chunk name..."))) - (message "Not in code chunk..."))) - - -;;; Filling, etc - -(defun ess-noweb-hide-code-quotes () - "Replace all non blank characters in [[...]] code quotes -in the current buffer (you might want to narrow to the interesting -region first) by `*'. Return a list of pairs with the position and -value of the original strings." - (save-excursion - (let ((quote-list nil)) - (goto-char (point-min)) - (while (re-search-forward "\\[\\[" nil 'move) - (let ((beg (match-end 0)) - (end (if (re-search-forward "\\]\\]" nil t) - (match-beginning 0) - (point-max)))) - (goto-char beg) - (while (< (point) end) - ;; Move on to the next word: - (let ((b (progn - (skip-chars-forward " \t\n" end) - (point))) - (e (progn - (skip-chars-forward "^ \t\n" end) - (point)))) - (if (> e b) - ;; Save the string and a marker to the end of the - ;; replacement text. A marker to the beginning is - ;; useless. See ess-noweb-RESTORE-CODE-QUOTES. - (save-excursion - (setq quote-list (cons (cons (copy-marker e) - (buffer-substring b e)) - quote-list)) - (goto-char b) - (insert-char ?* (- e b) t) - (delete-char (- e b)))))))) - (reverse quote-list)))) - -(defun ess-noweb-restore-code-quotes (quote-list) - "Reinsert the strings modified by `ess-noweb-hide-code-quotes'." - (save-excursion - (mapcar (lambda (q) - (let* ((e (marker-position (car q))) - ;; Slightly inefficient, but correct way to find - ;; the beginning of the word to be replaced. - ;; Using the marker at the beginning will loose - ;; if whitespace has been rearranged - (b (save-excursion - (goto-char e) - (skip-chars-backward "*") - (point)))) - (delete-region b e) - (goto-char b) - (insert (cdr q)))) - quote-list))) - -(defun ess-noweb-fill-chunk () - "Fill the current chunk according to mode. -Run `fill-region' on documentation chunks and `indent-region' on code -chunks." - (interactive) - (save-excursion - (save-restriction - (ess-noweb-narrow-to-chunk) - (if (ess-noweb-in-code-chunk) - (progn - ;; Narrow to the code section proper; w/o the first and any - ;; index declaration lines. - (narrow-to-region (progn - (goto-char (point-min)) - (forward-line 1) - (point)) - (progn - (goto-char (point-max)) - (forward-line -1) - (while (looking-at "@") - (forward-line -1)) - (forward-line 1) - (point))) - (if (or indent-region-function indent-line-function) - (indent-region (point-min) (point-max) nil) - (error "No indentation functions defined in %s!" major-mode))) - (if ess-noweb-code-quotes-handling - (let ((quote-list (ess-noweb-hide-code-quotes))) - (fill-region (point-min) (point-max)) - (ess-noweb-restore-code-quotes quote-list)) - (fill-region (point-min) (point-max))))))) - -(defun ess-noweb-indent-region (beg end) - "If region fits inside current chunk, narrow to chunk and then -indent according to mode." - (interactive "r") - (let* ((inx (ess-noweb-find-chunk-index-buffer)) - (ch-beg (marker-position (cdr (aref ess-noweb-chunk-vector inx)))) - (ch-end (marker-position (cdr (aref ess-noweb-chunk-vector (1+ inx)))))) - - (if (and (< ch-beg beg) (> ch-end end)) - (save-excursion - (save-restriction - (setq beg (max beg (progn (goto-char ch-beg) - (forward-line 1) - (point)))) - (setq end (min end (progn (goto-char ch-end) - (forward-line -1) - (point)))) - (narrow-to-region beg end) - (indent-region beg end))) - (indent-region beg end)))) - - -(defun ess-noweb-indent-line () - "Indent the current line according to mode, after narrowing to this chunk." - (interactive) - (ess-noweb-update-chunk-vector) - (save-restriction - (ess-noweb-narrow-to-chunk) - (if (ess-noweb-in-code-chunk) - (progn - ;; Narrow to the code section proper; w/o the first and any - ;; index declaration lines. - (save-excursion - (narrow-to-region (progn - (goto-char (point-min)) - (forward-line 1) - (point)) - (progn - (goto-char (point-max)) - (forward-line -1) - (while (looking-at "@") - (forward-line -1)) - (forward-line 1) - (point)))))) - (indent-according-to-mode))) - -(defun ess-noweb-fill-paragraph-chunk (&optional justify) - "Fill a paragraph in the current chunk." - (interactive "P") - (ess-noweb-update-chunk-vector) - (save-excursion - (save-restriction - (ess-noweb-narrow-to-chunk) - (if (ess-noweb-in-code-chunk) - (progn - ;; Narrow to the code section proper; w/o the first and any - ;; index declaration lines. - (narrow-to-region (progn - (goto-char (point-min)) - (forward-line 1) - (point)) - (progn - (goto-char (point-max)) - (forward-line -1) - (while (looking-at "@") - (forward-line -1)) - (forward-line 1) - (point))) - (fill-paragraph justify)) - (if ess-noweb-code-quotes-handling - (let ((quote-list (ess-noweb-hide-code-quotes))) - (fill-paragraph justify) - (ess-noweb-restore-code-quotes quote-list)) - (fill-paragraph justify)))))) - -(defun ess-noweb-auto-fill-doc-chunk () - "Replacement for `do-auto-fill'." - (save-restriction - (narrow-to-region (car (ess-noweb-chunk-region)) - (save-excursion - (end-of-line) - (point))) - (if ess-noweb-code-quotes-handling - (let ((quote-list (ess-noweb-hide-code-quotes))) - (do-auto-fill) - (ess-noweb-restore-code-quotes quote-list)) - (do-auto-fill)))) - -(defun ess-noweb-auto-fill-doc-mode () - "Install the improved auto fill function, iff necessary." - (if auto-fill-function - (setq auto-fill-function 'ess-noweb-auto-fill-doc-chunk))) - -(defun ess-noweb-auto-fill-code-chunk () - "Replacement for do-auto-fill. Cancel filling in chunk headers" - (unless (save-excursion - (beginning-of-line) - (looking-at "<<")) - (do-auto-fill))) - -(defun ess-noweb-auto-fill-code-mode () - "Install the default auto fill function, iff necessary." - (if auto-fill-function - (setq auto-fill-function 'ess-noweb-auto-fill-code-chunk))) - -;;; Marking - -(defun ess-noweb-mark-chunk () - "Mark the current chunk." - (interactive) - (let ((r (ess-noweb-chunk-region))) - (goto-char (car r)) - (push-mark (cdr r) nil t))) - -(defun ess-noweb-mark-chunk-pair () - "Mark the current pair of documentation and code chunks." - (interactive) - (let ((r (ess-noweb-chunk-pair-region))) - (goto-char (car r)) - (push-mark (cdr r) nil t))) - - -;;; Narrowing - -(defun ess-noweb-toggle-narrowing (&optional arg) - "Toggle if we should narrow the display to the current pair of -documentation and code chunks after each movement. With argument: -switch narrowing on." - (interactive "P") - (if (or arg (not ess-noweb-narrowing)) - (progn - (setq ess-noweb-narrowing t) - (ess-noweb-narrow-to-chunk-pair)) - (setq ess-noweb-narrowing nil) - (widen))) - -(defun ess-noweb-narrow-to-chunk () - "Narrow the display to the current chunk." - (interactive) - (let ((r (ess-noweb-chunk-region))) - (narrow-to-region (car r) (cdr r)))) - -(defun ess-noweb-narrow-to-chunk-pair () - "Narrow the display to the current pair of documentation and code chunks." - (interactive) - (let ((r (ess-noweb-chunk-pair-region))) - (narrow-to-region (car r) (cdr r)))) - - -;;; Killing - -(defun ess-noweb-kill-chunk () - "Kill the current chunk." - (interactive) - (let ((r (ess-noweb-chunk-region))) - (kill-region (car r) (cdr r)))) - -(defun ess-noweb-kill-chunk-pair () - "Kill the current pair of chunks." - (interactive) - (let ((r (ess-noweb-chunk-pair-region))) - (kill-region (car r) (cdr r)))) - -(defun ess-noweb-copy-chunk-as-kill () - "Place the current chunk on the kill ring." - (interactive) - (let ((r (ess-noweb-chunk-region))) - (copy-region-as-kill (car r) (cdr r)))) - -(defun ess-noweb-copy-chunk-pair-as-kill () - "Place the current pair of chunks on the kill ring." - (interactive) - (let ((r (ess-noweb-chunk-pair-region))) - (copy-region-as-kill (car r) (cdr r)))) - - -;;; Movement - -(defun ess-noweb-sign (n) - "Return the sign of N." - (if (< n 0) -1 1)) - -(defun ess-noweb-next-doc-chunk (&optional cnt) - "Goto to the Nth documentation chunk from point." - (interactive "p") - (widen) - (let ((start (ess-noweb-find-chunk-index-buffer)) - (i 1)) - (while (<= i (abs cnt)) - (setq start (+ (ess-noweb-sign cnt) start)) - (while (ess-noweb-chunk-is-code start) - (setq start (+ (ess-noweb-sign cnt) start))) - (setq i (1+ i))) - (goto-char (marker-position (cdr (ess-noweb-chunk-vector-aref start)))) - (forward-char 1)) - (if ess-noweb-narrowing - (ess-noweb-narrow-to-chunk-pair))) - -(defun ess-noweb-previous-doc-chunk (&optional n) - "Goto to the -Nth documentation chunk from point." - (interactive "p") - (ess-noweb-next-doc-chunk (- n))) - -(defun ess-noweb-next-code-chunk (&optional cnt) - "Goto to the Nth code chunk from point." - (interactive "p") - (widen) - (let ((start (ess-noweb-find-chunk-index-buffer)) - (i 1)) - (while (<= i (abs cnt)) - (setq start (+ (ess-noweb-sign cnt) start)) - (while (not (ess-noweb-chunk-is-code start)) - (setq start (+ (ess-noweb-sign cnt) start))) - (setq i (1+ i))) - (goto-char (marker-position (cdr (ess-noweb-chunk-vector-aref start)))) - (forward-line 1)) - (if ess-noweb-narrowing - (ess-noweb-narrow-to-chunk-pair))) - -(defun ess-noweb-previous-code-chunk (&optional n) - "Goto to the -Nth code chunk from point." - (interactive "p") - (ess-noweb-next-code-chunk (- n))) - -(defun ess-noweb-next-chunk (&optional n) - "If in a documentation chunk, goto to the Nth documentation -chunk from point, else goto to the Nth code chunk from point." - (interactive "p") - (if (ess-noweb-in-code-chunk) - (ess-noweb-next-code-chunk n) - (ess-noweb-next-doc-chunk n))) - -(defun ess-noweb-previous-chunk (&optional n) - "If in a documentation chunk, goto to the -Nth documentation -chunk from point, else goto to the -Nth code chunk from point." - (interactive "p") - (ess-noweb-next-chunk (- n))) - -(defvar ess-noweb-chunk-history nil - "") - -(defun ess-noweb-goto-chunk () - "Goto the named chunk." - (interactive) - (widen) - (let* ((completion-ignore-case t) - (alist (ess-noweb-build-chunk-alist)) - (chunk (ess-completing-read - "Chunk" (delete "" (mapcar 'car alist)) nil t nil - ess-noweb-chunk-history (ess-noweb-goto-chunk-default)))) - (goto-char (cdr (assoc chunk alist)))) - (if ess-noweb-narrowing - (ess-noweb-narrow-to-chunk-pair))) - -(defun ess-noweb-goto-chunk-default () - (save-excursion - (if (re-search-backward "<<" - (save-excursion - (beginning-of-line) - (point)) - 'move) - (goto-char (match-beginning 0))) - (if (re-search-forward "<<\\(.*\\)>>" - (save-excursion - (end-of-line) - (point)) - t) - (buffer-substring (match-beginning 1) (match-end 1)) - nil))) - -(defun ess-noweb-build-chunk-alist () - (if (not ess-noweb-chunk-vector) - (ess-noweb-update-chunk-vector)) - ;; The naive recursive solution will exceed MAX-LISP-EVAL-DEPTH in - ;; buffers w/ many chunks. Maybe there is a tail recursivce solution, - ;; but iterative solutions should be acceptable for dealing with vectors. - (let ((alist nil) - (i (1- (length ess-noweb-chunk-vector)))) - (while (>= i 0) - (let* ((chunk (aref ess-noweb-chunk-vector i)) - (name (car chunk)) - (marker (cdr chunk))) - (if (and (stringp name) - (not (assoc name alist))) - (setq alist (cons (cons name marker) alist)))) - (setq i (1- i))) - alist)) - -(defun ess-noweb-goto-next (&optional cnt) - "Goto the continuation of the current chunk." - (interactive "p") - (widen) - (if (not ess-noweb-chunk-vector) - (ess-noweb-update-chunk-vector)) - (let ((start (ess-noweb-find-chunk-index-buffer))) - (if (not (ess-noweb-chunk-is-code start)) - (setq start (1+ start))) - (if (ess-noweb-chunk-is-code start) - (let ((name (car (ess-noweb-chunk-vector-aref start))) - (i 1)) - (while (<= i (abs cnt)) - (setq start (+ (ess-noweb-sign cnt) start)) - (while (not (equal (car (ess-noweb-chunk-vector-aref start)) - name)) - (setq start (+ (ess-noweb-sign cnt) start))) - (setq i (1+ i))) - (goto-char (marker-position - (cdr (ess-noweb-chunk-vector-aref start)))) - (forward-line 1)))) - (if ess-noweb-narrowing - (ess-noweb-narrow-to-chunk-pair))) - -(defun ess-noweb-goto-previous (&optional cnt) - "Goto the previous chunk." - (interactive "p") - (ess-noweb-goto-next (- cnt))) - -(defun ess-noweb-occur (arg) - "Find all occurences of the current chunk. -This function simply runs OCCUR on \"<>\"." - (interactive "P") - (let ((n (if (and arg - (numberp arg)) - arg - 0)) - (idx (ess-noweb-find-chunk-index-buffer))) - (if (ess-noweb-chunk-is-code idx) - (occur (regexp-quote (concat "<<" - (car (aref ess-noweb-chunk-vector idx)) - ">>")) - n) - (setq idx (1+ idx)) - (while (not (ess-noweb-chunk-is-code idx)) - (setq idx (1+ idx))) - (occur (regexp-quote (concat "<<" - (car (aref ess-noweb-chunk-vector idx)) - ">>")) - n)))) - - -;;; Insertion - -(defun ess-noweb-new-chunk (name) - "Insert a new chunk." - (interactive "sChunk name: ") - (insert "@ \n<<" name ">>=\n") - (save-excursion - (insert "@ %def \n")) - (ess-noweb-update-chunk-vector)) - -(defun ess-noweb-at-beginning-of-line () - (equal (save-excursion - (beginning-of-line) - (point)) - (point))) - -(defun ess-noweb-electric-@ (arg) - "Smart incarnation of `@', starting a new documentation chunk, maybe. -If given an numerical argument, it will act just like the dumb `@'. -Otherwise and if at the beginning of a line in a code chunk: -insert \"@ \" and update the chunk vector." - (interactive "P") - (if arg - (self-insert-command (if (numberp arg) arg 1)) - (if (and (ess-noweb-at-beginning-of-line) - (ess-noweb-in-code-chunk)) - (progn - (insert "@ ") - (ess-noweb-update-chunk-vector)) - (self-insert-command 1)))) - -(defun ess-noweb-electric-< (arg) - "Smart incarnation of `<', starting a new code chunk, maybe. -If given an numerical argument, it will act just like the dumb `<'. -Otherwise and if at the beginning of a line in a documentation chunk: -insert \"<<>>=\", a closing \"@\" and a newline if necessary. Leave point -in the middle and and update the chunk vector." - (interactive "P") - (if arg - (self-insert-command (if (numberp arg) arg 1)) - (if (and (ess-noweb-at-beginning-of-line) - (not (ess-noweb-in-code-chunk))) - (progn - (insert "<<") - (save-excursion - (insert ">>=\n@ ") - (if (not (looking-at "\\s *$")) - (newline))) - (ess-noweb-update-chunk-vector)) - (self-insert-command 1)))) - - -;;; Modes - -(defun ess-noweb-set-chunk-code-mode () - "Set the ess-noweb-code-mode for the current chunk" - (interactive) - (if (ess-noweb-in-code-chunk) - (progn - ;; Reset code-mode to default and then check for a mode comment. - (setq ess-noweb-code-mode ess-noweb-default-code-mode) - (let (mode chunk-name) - (save-excursion - (save-restriction - (end-of-line) - (re-search-backward "^[ \t]*<<\\(.*\\)>>=" nil t) - (setq chunk-name (match-string 1)) - (widen) - (goto-char (point-min)) - (re-search-forward (concat "^<<" (regexp-quote chunk-name) ">>=") nil t) - (beginning-of-line 2) - (setq mode (ess-noweb-in-mode-line)) - (if (functionp mode) - (setq ess-noweb-code-mode mode)))))) - (error "This only makes sense in a code chunk"))) - -(defun ess-noweb-set-doc-syntax-table () - "Sets the doc-mode syntax-table to treat code quotes as comments." - (interactive) - (let ((square-bracket-string (char-to-string (char-syntax ?\[)))) - (if (string= square-bracket-string "(") - (progn - (modify-syntax-entry ?\[ "(]12b" ess-noweb-doc-mode-syntax-table) - (modify-syntax-entry ?\] ")[34b" ess-noweb-doc-mode-syntax-table)) - (progn - (modify-syntax-entry ?\[ - (concat square-bracket-string " 12b") - ess-noweb-doc-mode-syntax-table) - (modify-syntax-entry ?\] - (concat square-bracket-string " 34b") - ess-noweb-doc-mode-syntax-table))))) - -(defun ess-noweb-select-mode () - "Select ess-noweb-DOC-MODE or ess-noweb-CODE-MODE, as appropriate." - (interactive) - (let ((this-chunk-index (ess-noweb-find-chunk-index-buffer))) - ;; Has the last change to the buffer taken us into a different - ;; chunk ? - (if (not (equal this-chunk-index ess-noweb-last-chunk-index)) - (progn - (setq ess-noweb-last-chunk-index this-chunk-index) - (if (ess-noweb-in-code-chunk) - ;; Inside a code chunk - (progn - ;; Find out which code mode to use - (ess-noweb-set-chunk-code-mode) - ;; If we aren't already using it, use it. - (if (not (equal major-mode ess-noweb-code-mode)) - (progn - (funcall ess-noweb-code-mode) - (run-hooks 'ess-noweb-select-mode-hook) - (run-hooks 'ess-noweb-select-code-mode-hook)))) - ;; Inside a documentation chunk - (progn - (if (not (equal major-mode ess-noweb-doc-mode)) - (progn - (funcall ess-noweb-doc-mode))) - (if (not ess-noweb-doc-mode-syntax-table) - (progn - (message "Setting up syntax table") - (setq ess-noweb-doc-mode-syntax-table - (make-syntax-table (syntax-table))) - (ess-noweb-set-doc-syntax-table))) - (set-syntax-table ess-noweb-doc-mode-syntax-table) - (run-hooks 'ess-noweb-select-mode-hook) - (run-hooks 'ess-noweb-select-doc-mode-hook))) - (run-hooks 'ess-noweb-changed-chunk-hook))))) - -(defun ess-noweb-set-doc-mode (mode) - "Change the major mode for editing documentation chunks." - (interactive "CNew major mode for documentation chunks: ") - (setq ess-noweb-doc-mode mode) - (setq ess-noweb-doc-mode-syntax-table nil) - ;;Pretend we've changed chunk, so the mode will be reset if necessary - (setq ess-noweb-last-chunk-index (1- ess-noweb-last-chunk-index)) - (ess-noweb-select-mode)) - -(defun ess-noweb-set-code-mode (mode) - "Change the major mode for editing all code chunks." - (interactive "CNew major mode for all code chunks: ") - (setq ess-noweb-default-code-mode mode) - ;;Pretend we've changed chunk, so the mode will be reset if necessary - (setq ess-noweb-last-chunk-index (1- ess-noweb-last-chunk-index)) - (ess-noweb-select-mode)) - -(defun ess-noweb-set-this-code-mode (mode) - "Change the major mode for editing this code chunk. -The only sensible way to do this is to add a mode line to the chunk" - (interactive "CNew major mode for this code chunk: ") - (if (ess-noweb-in-code-chunk) - (progn - (setq ess-noweb-code-mode mode) - (save-excursion - (save-restriction - (let (chunk-name) - (widen) - (end-of-line) - (re-search-backward "^[ \t]*<<\\(.*\\)>>=" nil t) - (setq chunk-name (match-string 1)) - (goto-char (point-min)) - (re-search-forward (concat "^<<" (regexp-quote chunk-name) ">>=") nil t) - (beginning-of-line 2)) - ;; remove mode-line, if there is one - (if (ess-noweb-in-mode-line) - (progn - (kill-line) - (kill-line))) - (if (not (equal ess-noweb-code-mode ess-noweb-default-code-mode)) - (progn - (setq mode (substring (symbol-name mode) 0 -5)) - ;; Need to set major mode so that we can comment out - ;; the mode line - (funcall ess-noweb-code-mode) - (if (not (boundp 'comment-start)) - (setq comment-start "#")) - (insert comment-start - " -*- " mode - " -*- " comment-end "\n"))) - (setq ess-noweb-last-chunk-index (1- ess-noweb-last-chunk-index))))) - (message "This only makes sense in a code chunk."))) - -;;; Misc - -(defun ess-noweb-mode-version () - "Echo the RCS identification of noweb mode." - (interactive) - (message "Thorsten's ess-noweb-mode, now part of ESS version %s" ess-version)) - -(defun ess-noweb-describe-mode () - "Describe noweb mode." - (interactive) - (describe-function 'ess-noweb-mode)) - -(defun ess-noweb-insert-default-mode-line () - "Insert line that will set the noweb mode of this file in emacs. -The file is set to use the current doc and default-code modes, so -ensure they are set correctly (with ess-noweb-set-code-mode and -ess-noweb-set-doc-mode) before calling this function" - (interactive) - (save-excursion - (goto-char 1) - (if (ess-noweb-in-mode-line) - (progn - (kill-line) - (kill-line))) - (if (not (eq major-mode ess-noweb-doc-mode)) - (ess-noweb-select-mode)) - (insert comment-start " -*- mode: noweb; ess-noweb-default-code-mode: " - (symbol-name ess-noweb-default-code-mode) - (if (not (eq ess-noweb-doc-mode ess-noweb-default-doc-mode)) - (concat "; ess-noweb-doc-mode: " (symbol-name - ess-noweb-doc-mode) ";") - ";") - " -*-" comment-end "\n")) - (ess-noweb-select-mode)) - -(defun ess-noweb-mouse-first-button (event) - (interactive "e") - (mouse-set-point event) - (if (and ess-noweb-use-mouse-navigation - (eq (save-excursion - (end-of-line) - (re-search-backward "^[\t ]*\\(<<\\)\\(.*\\)\\(>>\\)" nil t)) - (save-excursion - (beginning-of-line) (point)))) - (progn - (if (< (point) (match-beginning 2)) - (let ((chunk-name (buffer-substring-no-properties - (match-beginning 2) - (match-end 2)))) - (re-search-backward (concat "<<" (regexp-quote chunk-name) ">>") nil t)) - (if (and (<= (match-end 2) (point)) - (> (+ 2 (match-end 2)) (point))) - (let ((chunk-name (buffer-substring-no-properties - (match-beginning 2) - (match-end 2)))) - (re-search-forward (concat "<<" (regexp-quote chunk-name) ">>") nil t))))))) - - -;;; Debugging - -(defun ess-noweb-log (s) - (let ((b (current-buffer))) - (switch-to-buffer (get-buffer-create "*noweb-log*")) - (goto-char (point-max)) - (setq buffer-read-only nil) - (insert s) - (setq buffer-read-only t) - (switch-to-buffer b))) - - - - - -(defvar ess-noweb-thread-alist nil - "A list of threads in the current buffer. -Each entry in the list contains 5 elements: -1) The name of the threads -2) The name of the immdiate parent thread in which it is used (nil if - it is a \"top-level\" thread which is not used anywhere). -3) The name of the top-level parent thread in which it is used (i.e. a - thread in which it is used but which is not itself used anywhere: - nil if this thread is not used anywhere. -4) The format string to use to define line numbers in the output - file of this thread. Should only be set if this thread is not used - anywhere: if a thread is used as part of another thread, the parent - thread's format string should be used. -5) If this is nil, tabs are converted to spaces in the tangled - file. If it is a number, tabs are copied to the tangled file - unchanged, and tabs are also used for indentation, with the number - of spaces per tab defined by this number. This MUST be set in order - to tangle makefiles, which depend on tabs.Should only be set if - this thread is not used anywhere. otherwise set to nil. " - ) - -(defun ess-noweb-update-thread-alist () - "Updates the list of threads in the current buffer. -Each entry in the list contains 5 elements: -1) The name of the thread -2) The name of the immdiate parent thread in which it is used (nil if - it is a \"top-level\" thread which is not used anywhere). -3) The name of the top-level parent thread in which it is used (i.e. a - thread in which it is used but which is not itself used anywhere: - nil if this thread is not used anywhere. -4) The format string to use to define line numbers in the output - file of this thread. Should only be set if this thread is not used - anywhere: if a thread is used as part of another thread, the parent - thread's format string should be used. -5) If this is nil, tabs are converted to spaces in the tangled - file. If it is a number, tabs are copied to the tangled file - unchanged, and tabs are also used for indentation, with the number - of spaces per tab defined by this number. This MUST be set in order - to tangle makefiles, which depend on tabs.Should only be set if - this thread is not used anywhere. otherwise set to nil. " - (interactive) - (save-excursion - (goto-char (point-min)) - (let ((thread-alist) (thread-list-entry) (chunk-use-name) - (current-thread) (new-thread-alist)) - (while (re-search-forward - "^[ \t]*<<\\(.*\\)>>\\(=\\)?" nil t) - (goto-char (match-beginning 0)) - ;; Is this the definition of a chunk ? - (if (match-beginning 2) - ;;We have a chunk definition - (progn - ;; Get the thread name - (setq current-thread - (buffer-substring-no-properties (match-beginning 1) - (match-end 1))) - ;; Is this thread already in our list ? - (if (assoc current-thread thread-alist) - nil - (progn - ;; If not, create an entry with 4 nils at the end - (setq thread-list-entry - (list (cons current-thread - (make-list 4 nil)))) - ;; And add it to the list - (setq thread-alist - (append thread-alist thread-list-entry))))) - - ;; Not a definition but a use - (progn - ;; Get the thread name - (setq chunk-use-name - (buffer-substring-no-properties (match-beginning 1) - (match-end 1))) - ;; Has the thread already been defined before being used ? - (if (setq thread-list-entry (assoc chunk-use-name - thread-alist)) - ;; If it has, set its parent to be the thread we are in at the moment - (setcar (cdr thread-list-entry) current-thread) - ;; If not, add it to the list, with its parent name and 3 nils - (progn - (setq thread-list-entry - (list (cons chunk-use-name - (cons current-thread - (make-list 3 nil))))) - (setq thread-alist (append thread-alist thread-list-entry))))) - ) - ;;Go to the next line - (beginning-of-line 2)) - ;; Now, the second element of each entry points to that thread's - ;; immediate parent. Need to set it to the thread's ultimate - ;; parent. - (let ((thread-counter 0) - (this-thread) - (this-thread-parent)) - (while (<= thread-counter (1- (length thread-alist))) - (setq this-thread (nth thread-counter thread-alist)) - (setq this-thread-parent (assoc - (car (cdr this-thread)) - thread-alist)) - (while (not (equal nil (car (cdr this-thread-parent)))) - (setq this-thread-parent (assoc - (car (cdr this-thread-parent)) - thread-alist))) - (setq this-thread (cons (car this-thread) - (cons (car (cdr this-thread)) - (cons (car this-thread-parent) - (nthcdr 2 this-thread))))) - (setq new-thread-alist (append new-thread-alist (list this-thread))) - (setq thread-counter (1+ thread-counter)))) - - (setq ess-noweb-thread-alist new-thread-alist)))) - - - ; Option setting functions to go here - -(defun ess-noweb-set-thread-line-format ()) - -(defun ess-noweb-set-thread-tabs ()) - - -(defvar ess-noweb-default-line-number-format nil - "The format string to use to define line numbers in this thread. -If nil, do not use line numbers.") - -(defvar ess-noweb-default-line-number-skip-lines 0 - "The number of initial lines to output before the line number. -This may be useful in shell scripts, where the first line (or two) must have a - specific form.") - -(defvar ess-noweb-default-tab-width 8 - "If a number, convert tabs to that number of spaces in the output. If nil, let tabs through to the output unaltered.") - -(defvar ess-noweb-line-number-format ess-noweb-default-line-number-format - "The format string to use to define line numbers in this thread. -If nil, do not use line numbers.") - -(defvar ess-noweb-line-number-skip-lines ess-noweb-default-line-number-skip-lines - "The number of initial lines to output before the line number. -This may be useful in shell scripts, where the first line (or two) must have a - specific form.") - -(defvar ess-noweb-tab-width ess-noweb-default-tab-width - "If a number, convert tabs to that number of spaces in the output. If nil, let tabs through to the output unaltered.") - -(defun ess-noweb-get-thread-local-variables () - "Get the values of the variables that are local to a thread." - (interactive) - (save-excursion - (save-restriction - (end-of-line) - (re-search-backward "^[ \t]*<<\\(.*\\)>>=" nil t) - (let ((chunk-name (match-string 1))) - (widen) - (goto-char (point-min)) - (re-search-forward (concat "^<<" (regexp-quote chunk-name) ">>=") nil t) - (beginning-of-line 2) - (while (looking-at ".*-\*-.*-\*-") - (let ((this-line (buffer-substring-no-properties - (point) - (progn (end-of-line) (point))))) - (if (string-match - "mode:[ \t]*\\([^\t ]*\\)" this-line) - (setq ess-noweb-code-mode - (match-string-no-properties 1 this-line))) - (if (string-match - "ess-noweb-line-number-format:[ \t]*\"\\([^\"]*\\)\"" this-line) - (setq ess-noweb-line-number-format - (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 - (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 - (match-string-no-properties 1 this-line)))) - (beginning-of-line 2))))))) - -(defun ess-noweb-reset-thread-local-variables () - "Resets the thread-local variables to their default values" - (setq ess-noweb-tab-width ess-noweb-default-tab-width) - (setq ess-noweb-line-number-format ess-noweb-default-line-number-format) - (setq ess-noweb-line-number-skip-lines ess-noweb-default-line-number-skip-lines)) - -(defun ess-noweb-write-line-number (line-number-format buffer) - (if line-number-format - (progn - (let ((this-line (count-lines (point-min)(point)))) - (while (string-match ".*\\(%L\\).*" line-number-format) - (setq line-number-format - (replace-match - (format "%d" this-line) t t line-number-format 1))) - (while (string-match ".*\\(%F\\).*" line-number-format) - (setq line-number-format - (replace-match - (format "%s" (buffer-file-name)) t t line-number-format 1))) - (while (string-match ".*\\(%N\\).*" line-number-format) - (setq line-number-format - (replace-match "\n" t t line-number-format 1))) - (with-current-buffer buffer - (insert line-number-format)))))) - - -(defun ess-noweb-tangle-chunk ( &optional buffer prefix-string) - "Generate the code produced by this chunk, & any threads used in this chunk." - (interactive) - (save-excursion - (ess-noweb-reset-thread-local-variables) - (ess-noweb-get-thread-local-variables) - (ess-noweb-update-chunk-vector) - (let* - ((chunk-end (progn - (end-of-line) - (re-search-forward "^@" nil t) - (beginning-of-line) - (point))) - ;;get name and start point of this chunk - (chunk-start (progn - (re-search-backward "^<<\\([^>]*\\)>>=$" nil t) - (beginning-of-line 2) - (point))) - (chunk-name (buffer-substring-no-properties - (match-end 1) - (match-beginning 1))) - ;; get end of this chunk - ;; Get information we need about this thread - (thread-info (assoc chunk-name ess-noweb-thread-alist)) - (thread-tabs (nth 4 thread-info)) - (line-number-format (nth 3 thread-info)) - (thread-name-re) (post-chunk) (pre-chunk) - (first-line t) - (tangle-buffer (generate-new-buffer "Tangle Buffer"))) - - (progn - (goto-char chunk-start) - ;; If this is a mode-line, ignore it - (while (looking-at ".*-\\*-.*-\\*-") - (beginning-of-line 2)) - ;; If we want to include line numbers, write one - (if line-number-format - (while (> ess-noweb-line-number-skip-lines 0) - (append-to-buffer tangle-buffer - (point) - (save-excursion - (progn - (end-of-line) - (point)))) - (beginning-of-line 2) - (1- ess-noweb-line-number-skip-lines)) - (ess-noweb-write-line-number line-number-format buffer)) - (message "Now at %d" (point)) - - (while (< (point) chunk-end) - (untabify (point) (save-excursion (beginning-of-line 2)(point))) - ;; This RE gave me trouble. Without the `\"', it - ;; recognised itself and so could not copy itself - ;; correctly. - (if (looking-at - "\\([^\n\"@]*\\)<<\\(.*\\)\\(>>\\)\\([^\n\"]*\\)$") - (progn - (save-excursion - (save-restriction - (setq thread-name-re - (concat "<<" - (regexp-quote (match-string 2)) - ">>=")) - (setq pre-chunk (match-string 1)) - (if prefix-string - (setq pre-chunk (concat prefix-string - pre-chunk))) - (setq post-chunk (match-string 4)) - (widen) - (goto-char (point-min)) - (while (re-search-forward thread-name-re nil t) - (ess-noweb-tangle-chunk tangle-buffer pre-chunk) - (forward-line 1))) - (if post-chunk - (with-current-buffer tangle-buffer - (backward-char) - (insert post-chunk) - (beginning-of-line 2))))) - - ;; Otherwise, just copy this line - (setq pre-chunk - (buffer-substring - (point) - (save-excursion - (beginning-of-line 2) - (point)))) - ;; Add a prefix if necessary - (if (and prefix-string - (> (length pre-chunk) 1)) - (setq pre-chunk (concat prefix-string - pre-chunk))) - ;; And copy it to the buffer - (with-current-buffer tangle-buffer - (insert pre-chunk))) - ;; If this is the first line of the chunk, we need to change - ;; prefix-string to consist solely of spaces - (if (and first-line - prefix-string) - (progn - (setq prefix-string - (make-string (length prefix-string) ?\ )) - (setq first-line nil))) - ;; Either way, go to the next line - (beginning-of-line 2)) - - (with-current-buffer tangle-buffer - (goto-char (point-min)) - (while (re-search-forward "\@\<<" nil t) - (replace-match "<<" nil nil) - (forward-char 3)) - (if thread-tabs - (progn - (setq tab-width thread-tabs) - (tabify (point-min)(point-max))) - (untabify (point-min)(point-max)))) - - (if buffer - (with-current-buffer buffer - (insert-buffer-substring tangle-buffer) - (kill-buffer tangle-buffer))) - )))) - -(defun ess-noweb-tangle-thread ( name &optional buffer) - "Given the name of a thread, tangles the thread to buffer. -If no buffer is given, create a new one with the same name as the -thread." - (interactive "sWhich thread ? ") - (if (not buffer) - (progn - (setq buffer (get-buffer-create name)) - (with-current-buffer buffer - (erase-buffer)))) - (save-excursion - (goto-char (point-min)) - (let ((chunk-counter 0)) - (while (re-search-forward - "^<<\\(.*\\)>>=[\t ]*" nil t) - (if (string= (match-string 1) - name) - (progn - (setq chunk-counter (1+ chunk-counter)) - (message "Found %d chunks" chunk-counter) - (ess-noweb-tangle-chunk buffer))))))) - -(defun ess-noweb-tangle-current-thread ( &optional buffer) - (interactive) - (save-excursion - (let* ((chunk-start - (progn - (re-search-backward "^<<\\([^>]*\\)>>=[\t ]*$" - nil t) - (beginning-of-line 2) - (point))) - (chunk-name (buffer-substring-no-properties - (match-end 1) - (match-beginning 1)))) - (ess-noweb-tangle-thread chunk-name buffer)))) - ;menu functions - - -;;; Finale - -(run-hooks 'ess-noweb-mode-load-hook) -(provide 'ess-noweb-mode) - -;; Changes made by Mark Lunt (mark.lunt@mrc-bsu.cam.ac.uk) 22/03/1999 - -;; The possibility of having code chunks using more than one language -;; was added. This was first developed by Adnan Yaqub -;; (AYaqub@orga.com) for syntax highlighting, but even people who hate -;; highlighting may like to maintain their Makefile with their code, -;; or test-scripts with their programs, or even user documentation as -;; latex-mode code chunks. -;; This required quite a few changes to ess-noweb-mode: -;; 1) A new variable `ess-noweb-default-code-mode' was create to do the job -;; `ess-noweb-code-mode' used to. -;; 2) ess-noweb-code-mode now contains the code-mode of the current chunk -;; 3) Each chunk can now have its own mode-line to tell emacs what -;; mode to use to edit it. The function `ess-noweb-in-mode-line' -;; recognises such mode-lines, and the function -;; `ess-noweb-set-this-code-mode' sets the code mode for the current -;; chunk and adds a mode-line if necessary. If several chunks have -;; the same name, the mode-line must appear in the first chunk with -;; that name. -;; 4) The mechanism for deciding whether to change mode was altered, -;; since the old method assumed a single code mode. Now, -;; `ess-noweb-last-chunk-index' keeps track of which chunk we were in -;; last. If we have moved to a different chunk, we have to check -;; which mode we should be in, and change if necessary. - -;; The keymap and menu-map handling was changed. Easymenu was used to -;; define the menu, and it the keymap was attached to the 'official' -;; minor-modes-keymaps list. This means that -;; 1) It was automatically loaded when ess-noweb-mode was active and -;; unloaded when it was inactive. -;; 2) There was no need to worry about the major mode map clobbering -;; it , since it takes precedence over the major mode -;; map. `ess-noweb-setup-keymap' is therefore now superfluous -;; The menu was also reorganised to make it less cluttered, so there -;; would be room for adding tangling and weaving commands (one day). - -;; Mouse navigation (at least under Emacs (AJR)) is supported, in so -;; far as clicking mouse-1 on the '<<' of a chunk name moves to the -;; previous instance of that chunk name, and clicking in the '>>' -;; moves to the next instance. They are not mouse-hightlighted, -;; though: too much hassle for zero added functionality. - -;; ess-noweb-doc-mode has been given its own syntax-table. It is the same -;; as the current doc-mode syntax-table, except that [[ is a comment -;; start and ]] a comment end. Fixes some ugliness in LaTeX-mode if -;; `$' or `%' appear in quoted code (or even `<<', which happens often -;; in C++). -;; (This should make ess-noweb-hide-code-quotes and -;; ess-noweb-restore-code-quotes unnecessary, but I have not yet removed -;; them, nor the calls to them). - -;; A new function `ess-noweb-indent-line' was defined and bound by default -;; to the tab key. This should indent the current line correctly in -;; whichever mode we are currently in. Previously, c-mode in -;; particular did not behave well with indentation (although -;; `ess-noweb-fill-chunk' worked fine). Indentation is only accurate -;; within the chunk: it does not know the syntax at the end of the -;; previous chunk, so it does not know where to start indenting in -;; this chunk. However, provided the indentation within each chunk is correct, -;; notangle will correctly indented code. - -;; (I think it would be good to separate filling and indenting, -;; though, since `indent-region' and `fill-region' have completely -;; different meanings in LaTeX-mode (and both are useful)) - -;; ess-noweb-mode and ess-noweb-minor-mode were given an optional argument, so -;; that (ess-noweb-mode -1) turns it off, (ess-noweb-mode 1) turns it on, and -;; (ess-noweb-mode) toggles it. This is considered normal for minor modes. - -;; buffer-substring changed to buffer-substring-no-properties: -;; comparisons with buffer-substring can be unreliable if highlighting -;; is used. - -;; New functions `ess-noweb-in-code-chunk' & `ess-noweb-chunk-is-code' created -;; to replace (if (stringp (car (ess-noweb-find-chunk)))) and -;; (if (stringp (car (ess-noweb-chunk-vector-aref index)))). - -;; `ess-noweb-insert-mode-line' was renamed -;; `ess-noweb-insert-default-mode-line' and modified to put the mode-line -;; at the start of the file and remove any existing mode-line. - -;; a '<=' in `ess-noweb-find-chunk-index' changed to '<', so we get the -;; right answer if point is on the first character in a chunk - -;; The name of `ess-noweb-post-command-hook' changed to -;; `ess-noweb-post-command-function', since it is a function. - -;; All the highlighting code moved to a separate file: -;; (ess-noweb-font-lock-mode.el) - -;; Menu driven tangling is in the process of being added. It can -;; currently tangle a single chunk or a series of chunks with the -;; same name (which I refer to as a thread) into a separate -;; buffer. This buffer can then be saved to a file, sent to an -;; interpreter, whatever. I haven't tested using line-numbers as yet. - -;;; ess-noweb-mode.el ends here diff -Nru ess-18.10.2/lisp/ess-omg-d.el ess-18.10.2+git20220915.f45542e/lisp/ess-omg-d.el --- ess-18.10.2/lisp/ess-omg-d.el 2018-11-10 09:41:11.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/lisp/ess-omg-d.el 1970-01-01 00:00:00.000000000 +0000 @@ -1,113 +0,0 @@ -;;; ess-omg-d.el --- Omega customization - -;; Copyright (C) 1999 A. J. Rossini -;; Copyright (C) 2000--2004 A.J. Rossini, Richard M. Heiberger, Martin -;; Maechler, Kurt Hornik, Rodney Sparapani, and Stephen Eglen. - -;; Author: A.J. Rossini -;; Created: 15 August 1999 -;; 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 -;; https://www.r-project.org/Licenses/ - -;;; Commentary: - -;; This file defines all the S-PLUS 3.x customizations for ess-mode. - -;;; Code: - -;;; Requires and Autoloads: - -(require 'ess-omg-l) -(require 'ess-trns) - -(defvar OMG-dialect-name "OMG" - "Name of 'dialect' for Omega.") ;easily changeable in a user's .emacs - -(defvar OMG-customize-alist - '((ess-local-customize-alist . 'OMG-customize-alist) - (ess-language . "OMG") - (ess-dialect . "omegahat") - (ess-suffix . "omg") - (ess-loop-timeout . 5000) - (ess-dump-filename-template . (replace-regexp-in-string - "S$" ess-suffix ; in the one from custom: - ess-dump-filename-template-proto)) - (ess-mode-editing-alist . OMG-editing-alist) - (ess-mode-syntax-table . OMG-syntax-table) - (ess-change-sp-regexp . "");fixme (if omegahat ever ..) - (ess-help-sec-regex . ess-help-S+-sec-regex) - (ess-help-sec-keys-alist . ess-help-S+sec-keys-alist) - (ess-object-name-db-file . "ess-omg-namedb.el" ) - (inferior-ess-program . inferior-OMG-program) - (inferior-ess-objects-command . "objects(%d)\n") - (inferior-ess-help-command . "help(\"%s\",pager=\"cat\",window=F)\n") - (inferior-ess-exit-command . "q()\n") - (inferior-ess-primary-prompt . "\\[[0-9]*\\]") - (inferior-ess-secondary-prompt . ".. ?") - (comint-use-prompt-regexp . t) - (inferior-ess-start-file . nil) ;"~/.ess-omg") - (inferior-ess-start-args . "")) - "Variables to customize for OMG (Omegahat)") - - -(defun OMG (&optional start-args) ; proc-name) - "Call Omegahat, from the Omega Group for Statistical Computing." - (interactive "P") - (setq ess-customize-alist OMG-customize-alist) - (ess-write-to-dribble-buffer - (format "\n(OMG): ess-dialect=%s, buf=%s\n" - ess-dialect - (current-buffer))) - (let ((omg-start-args - (concat inferior-ess-start-args - (if start-args (read-string - "Starting Args [possibly -CORBA] ? ") - nil)))) - (inferior-ess omg-start-args))) - - - -(fset 'omegahat 'OMG) - -;;;###autoload -(defun OMG-mode (&optional proc-name) - "Major mode for editing Omegahat source. NOT EVEN STARTED." - (interactive) - (setq ess-customize-alist OMG-customize-alist) - (ess-mode OMG-customize-alist proc-name) - ;;(java-mode) - (setq major-mode 'OMG-mode)) - -;;;###autoload -(add-to-list 'auto-mode-alist '("\\.omg\\'" . omegahat-mode)) -;;;###autoload -(add-to-list 'auto-mode-alist '("\\.hat\\'" . omegahat-mode)) - -(fset 'omegahat-mode 'OMG-mode) - -(defun OMG-transcript-mode () - "Omegahat transcript mode." - (interactive) - (ess-transcript-mode OMG-customize-alist)) - - ; Provide package - -(provide 'ess-omg-d) - -;;; ess-omg-d.el ends here diff -Nru ess-18.10.2/lisp/ess-omg-l.el ess-18.10.2+git20220915.f45542e/lisp/ess-omg-l.el --- ess-18.10.2/lisp/ess-omg-l.el 2018-11-10 09:41:11.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/lisp/ess-omg-l.el 1970-01-01 00:00:00.000000000 +0000 @@ -1,326 +0,0 @@ -;;; ess-omg-l.el --- Support for editing Omega source code - -;; Copyright (C) 1999--2001 A.J. Rossini. -;; Copyright (C) 2002--2004 A.J. Rossini, Richard M. Heiberger, Martin -;; Maechler, Kurt Hornik, Rodney Sparapani, and Stephen Eglen. - -;; Author: A.J. Rossini -;; Created: 15 Aug 1999 -;; 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 -;; https://www.r-project.org/Licenses/ - -;;; Commentary: - -;; Code for general editing Omega source code. This is initially -;; based upon the similarities between Omega and S, but will need to -;; diverge to incorporate the use of Java-style coding. - -;;; Code: - -(require 'ess-s-lang) - - ; Specialized functions - -(defun OMG-comment-indent () - "Indentation for Omega comments." - - (if (looking-at "////") - (current-column) - (if (looking-at "///") - (let ((tem (ess-calculate-indent))) - (if (listp tem) (car tem) tem)) - (skip-chars-backward " \t") - (max (if (bolp) 0 (1+ (current-column))) - comment-column)))) - -;; (defun OMG-indent-line () -;; "Indent current line as Omega code. -;; Return the amount the indentation changed by." -;; (let ((indent (ess-calculate-indent nil)) -;; beg shift-amt -;; (case-fold-search nil) -;; (pos (- (point-max) (point)))) -;; (beginning-of-line) -;; (setq beg (point)) -;; (cond ((eq indent nil) -;; (setq indent (current-indentation))) -;; (t -;; (skip-chars-forward " \t") -;; (if (and ess-indent-with-fancy-comments (looking-at "////")) -;; (setq indent 0)) -;; (if (and ess-indent-with-fancy-comments -;; (looking-at "//") -;; (not (looking-at "///"))) -;; (setq indent comment-column) -;; (if (eq indent t) (setq indent 0)) -;; (if (listp indent) (setq indent (car indent))) -;; (cond ((and (looking-at "else\\b") -;; (not (looking-at "else\\s_"))) -;; (setq indent (save-excursion -;; (ess-backward-to-start-of-if) -;; (+ ess-else-offset -;; (current-indentation))))) -;; ((= (following-char) ?}) -;; (setq indent -;; (+ indent -;; (- ess-close-brace-offset ess-indent-offset)))) -;; ((= (following-char) ?{) -;; (setq indent (+ indent ess-brace-offset))))))) -;; (skip-chars-forward " \t") -;; (setq shift-amt (- indent (current-column))) -;; (if (zerop shift-amt) -;; (if (> (- (point-max) pos) (point)) -;; (goto-char (- (point-max) pos))) -;; (delete-region beg (point)) -;; (indent-to indent) -;; ;; If initial point was within line's indentation, -;; ;; position after the indentation. -;; ;; Else stay at same point in text. -;; (if (> (- (point-max) pos) (point)) -;; (goto-char (- (point-max) pos)))) -;; shift-amt)) - - -;; (defun OMG-calculate-indent (&optional parse-start) -;; "Return appropriate indentation for current line as Omega code. -;; In usual case returns an integer: the column to indent to. -;; Returns nil if line starts inside a string, t if in a comment." -;; (save-excursion -;; (beginning-of-line) -;; (let ((indent-point (point)) -;; (case-fold-search nil) -;; state -;; containing-sexp) -;; (if parse-start -;; (goto-char parse-start) -;; (beginning-of-defun)) -;; (while (< (point) indent-point) -;; (setq parse-start (point)) -;; (setq state (parse-partial-sexp (point) indent-point 0)) -;; (setq containing-sexp (car (cdr state)))) -;; (cond ((or (nth 3 state) (nth 4 state)) -;; ;; return nil or t if should not change this line -;; (nth 4 state)) -;; ((null containing-sexp) -;; ;; Line is at top level. May be data or function definition, -;; (beginning-of-line) -;; (if (and (/= (following-char) ?\{) -;; (save-excursion -;; (ess-backward-to-noncomment (point-min)) -;; (ess-continued-statement-p))) -;; ess-continued-statement-offset -;; 0)) ; Unless it starts a function body -;; ((/= (char-after containing-sexp) ?{) -;; ;; line is expression, not statement: -;; ;; indent to just after the surrounding open. -;; (goto-char containing-sexp) -;; (let ((bol (save-excursion (beginning-of-line) (point)))) - -;; ;; modified by shiba@isac 7.3.1992 -;; (cond ((and (numberp ess-expression-offset) -;; (re-search-backward "[ \t]*expression[ \t]*" bol t)) -;; ;; This regexp match every "expression". -;; ;; modified by shiba -;; ;;(forward-sexp -1) -;; (beginning-of-line) -;; (skip-chars-forward " \t") -;; ;; End -;; (+ (current-column) ess-expression-offset)) -;; ((and (numberp ess-arg-function-offset) -;; (re-search-backward -;; "=[ \t]*\\s\"*\\(\\w\\|\\s_\\)+\\s\"*[ \t]*" -;; bol -;; t)) -;; (forward-sexp -1) -;; (+ (current-column) ess-arg-function-offset)) -;; ;; "expression" is searched before "=". -;; ;; End - -;; (t -;; (progn (goto-char (1+ containing-sexp)) -;; (current-column)))))) -;; (t -;; ;; Statement level. Is it a continuation or a new statement? -;; ;; Find previous non-comment character. -;; (goto-char indent-point) -;; (ess-backward-to-noncomment containing-sexp) -;; ;; Back up over label lines, since they don't -;; ;; affect whether our line is a continuation. -;; (while (eq (preceding-char) ?\,) -;; (ess-backward-to-start-of-continued-exp containing-sexp) -;; (beginning-of-line) -;; (ess-backward-to-noncomment containing-sexp)) -;; ;; Now we get the answer. -;; (if (ess-continued-statement-p) -;; ;; This line is continuation of preceding line's statement; -;; ;; indent ess-continued-statement-offset more than the -;; ;; previous line of the statement. -;; (progn -;; (ess-backward-to-start-of-continued-exp containing-sexp) -;; (+ ess-continued-statement-offset (current-column) -;; (if (save-excursion (goto-char indent-point) -;; (skip-chars-forward " \t") -;; (eq (following-char) ?{)) -;; ess-continued-brace-offset 0))) -;; ;; This line starts a new statement. -;; ;; Position following last unclosed open. -;; (goto-char containing-sexp) -;; ;; Is line first statement after an open-brace? -;; (or -;; ;; If no, find that first statement and indent like it. -;; (save-excursion -;; (forward-char 1) -;; (while (progn (skip-chars-forward " \t\n") -;; (looking-at "//")) -;; ;; Skip over comments following openbrace. -;; (forward-line 1)) -;; ;; The first following code counts -;; ;; if it is before the line we want to indent. -;; (and (< (point) indent-point) -;; (current-column))) -;; ;; If no previous statement, -;; ;; indent it relative to line brace is on. -;; ;; For open brace in column zero, don't let statement -;; ;; start there too. If ess-indent-offset is zero, -;; ;; use ess-brace-offset + ess-continued-statement-offset instead. -;; ;; For open-braces not the first thing in a line, -;; ;; add in ess-brace-imaginary-offset. -;; (+ (if (and (bolp) (zerop ess-indent-offset)) -;; (+ ess-brace-offset ess-continued-statement-offset) -;; ess-indent-offset) -;; ;; Move back over whitespace before the openbrace. -;; ;; If openbrace is not first nonwhite thing on the line, -;; ;; add the ess-brace-imaginary-offset. -;; (progn (skip-chars-backward " \t") -;; (if (bolp) 0 ess-brace-imaginary-offset)) -;; ;; If the openbrace is preceded by a parenthesized exp, -;; ;; move to the beginning of that; -;; ;; possibly a different line -;; (progn -;; (if (eq (preceding-char) ?\)) -;; (forward-sexp -1)) -;; ;; Get initial indentation of the line we are on. -;; (current-indentation)))))))))) - - - - -(defvar OMG-syntax-table nil "Syntax table for Omegahat code.") -(if S-syntax-table - nil - (setq S-syntax-table (make-syntax-table)) - (modify-syntax-entry ?\\ "\\" S-syntax-table) - (modify-syntax-entry ?+ "." S-syntax-table) - (modify-syntax-entry ?- "." S-syntax-table) - (modify-syntax-entry ?= "." S-syntax-table) - (modify-syntax-entry ?% "." S-syntax-table) - (modify-syntax-entry ?< "." S-syntax-table) - (modify-syntax-entry ?> "." S-syntax-table) - (modify-syntax-entry ?& "." S-syntax-table) - (modify-syntax-entry ?| "." S-syntax-table) - (modify-syntax-entry ?\' "\"" S-syntax-table) - ;;FIXME: This fails (warning in compilation): - ;;F "//" are 2 characters; ?// is invalid - ;;F NEXT LINE IS BOGUS IN XEMACS, AJR - ;;F (modify-syntax-entry ?// "<" S-syntax-table) ; open comment - ;;F (modify-syntax-entry ?\n ">" S-syntax-table) ; close comment - ;;(modify-syntax-entry ?. "w" S-syntax-table) ; "." used in S obj names - (modify-syntax-entry ?. "_" S-syntax-table) ; see above/below, - ; plus consider separation. - (modify-syntax-entry ?$ "_" S-syntax-table) ; foo.bar$hack is 1 symbol - (modify-syntax-entry ?_ "." S-syntax-table) - (modify-syntax-entry ?* "." S-syntax-table) - (modify-syntax-entry ?< "." S-syntax-table) - (modify-syntax-entry ?> "." S-syntax-table) - (modify-syntax-entry ?/ "." S-syntax-table)) - - -(defvar OMG-editing-alist - '((paragraph-start . (concat "^$\\|" page-delimiter)) - (paragraph-separate . (concat "^$\\|" page-delimiter)) - (paragraph-ignore-fill-prefix . t) - (require-final-newline . mode-require-final-newline) - (comment-start . "//") - (comment-start-skip . "//+ *") - (comment-column . 40) - ;;(comment-indent-function . 'S-comment-indent) - ;;(ess-comment-indent . 'S-comment-indent) - ;;(ess-indent-line . 'S-indent-line) - ;;(ess-calculate-indent . 'ess-calculate-indent) - (indent-line-function . 'ess-indent-line) - (parse-sexp-ignore-comments . t) - (ess-style . ess-default-style) - (ess-local-process-name . nil) - ;;(ess-keep-dump-files . 'ask) - (ess-mode-syntax-table . S-syntax-table) - (font-lock-defaults . '(ess-OMG-font-lock-defaults - nil nil ((?\. . "w"))))) - "General options for Omegahat source files.") - -(defvar ess-OMG-font-lock-defaults - (append (list - (cons "\\b[0-9]+\\b" 'font-lock-type-face) ; numbers - (cons (regexp-opt ess-S-keywords 'words) 'font-lock-keyword-face)) - (list - (cons (regexp-opt ess-S-assign-ops) - 'font-lock-constant-face) ; assign - (cons (regexp-opt ess-S-constants 'words) - 'font-lock-type-face) ; constants - (cons (regexp-opt ess-S-modifiers 'words) - 'font-lock-constant-face) ; modify search list or source - - (cons ess-S-function-name-regexp - '(1 font-lock-function-name-face keep)) - ; function name - (cons "\\s.\\|\\s(\\|\\s)" 'font-lock-function-name-face) - ;punctuation and parents (same as function not to cause vidual disturbance) - )) ; keywords - "Font-lock patterns used in `OMG' buffers.") - - -;;; Changes from S to S-PLUS 3.x. (standard S3 should be in ess-s-lang.el !). - -(defconst OMG-help-sec-keys-alist - '((?a . "ARGUMENTS:") - (?b . "BACKGROUND:") - (?B . "BUGS:") - (?d . "DESCRIPTION:") - (?D . "DETAILS:") - (?e . "EXAMPLES:") - (?n . "NOTE:") - (?O . "OPTIONAL ARGUMENTS:") - (?R . "REQUIRED ARGUMENTS:") - (?r . "REFERENCES:") - (?s . "SEE ALSO:") - (?S . "SIDE EFFECTS:") - (?u . "USAGE:") - (?v . "VALUE:")) - "Alist of (key . string) pairs for use in section searching.") -;;; `key' indicates the keystroke to use to search for the section heading -;;; `string' in an S help file. `string' is used as part of a -;;; regexp-search, and so specials should be quoted. - -(defconst ess-help-OMG-sec-regex "^[A-Z. ---]+:$" - "Reg(ular) Ex(pression) of section headers in help file") - -;;; S-mode extras of Martin Maechler, Statistik, ETH Zurich. - -;;>> Moved things into --> ./ess-utils.el - -(provide 'ess-omg-l) - -;;; ess-omg-l.el ends here diff -Nru ess-18.10.2/lisp/ess-r-a.el ess-18.10.2+git20220915.f45542e/lisp/ess-r-a.el --- ess-18.10.2/lisp/ess-r-a.el 2018-11-10 09:41:11.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/lisp/ess-r-a.el 1970-01-01 00:00:00.000000000 +0000 @@ -1,153 +0,0 @@ -;;; ess-r-a.el -- Possible local customizations for R with ESS. - -;; Copyright (C) 1997--2005 A.J. Rossini, Richard M. Heiberger, Martin -;; Maechler, Kurt Hornik, Rodney Sparapani, and Stephen Eglen. - -;; Author: A.J. Rossini -;; Created: 17 November 1999 -;; 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 -;; https://www.r-project.org/Licenses/ - -;;; Commentary: - -;; The purpose of this file is to demonstrate some of the extras that -;; have been constructed for the ESS R mode; if they prove -;; interesting, then they might be migrated to ess-r-mode, the primary -;; ESS R mode tools. - -;;; Code: -(require 'ess-inf) -(require 'ess-r-mode) - -;; you can invoke ESS/R from emacs by typing -;; C-u M-x essr -;; with vsize set to (for example) 40M, and nsize set to 600000. - -;; Undefined on non-apple devices -(declare-function ns-do-applescript "nsfns.m" (script)) -(declare-function do-applescript "ess-r-a" (script)) -(unless (fboundp 'do-applescript) - (defalias 'do-applescript 'ns-do-applescript)) - -(defalias 'essr - (read-kbd-macro - "C-u M-x R RET - - vsize = 40M SPC - - nsize = 600000 2*RET")) - -(defun ess-r-do-region (start end &optional message) - "Send the current region to R via AppleScript." - (interactive "r\nP") - (message "Starting evaluation...") - (do-applescript (concat - "try\n" - "tell application \"R\"\n" - "activate\n" - "with timeout of 0 seconds\n" - "cmd \"" (buffer-substring start end) - "\"\n" - "end timeout\n" - "end tell\n" - "end try\n")) - (message "Finished evaluation")) - -(defun ess-r-do-line () - "Send the current line to R via AppleScript." - (interactive) ;; "r\nP") - (message "Starting evaluation...") - (save-excursion - (let ((end (point))) - (move-to-column 0) - (do-applescript (concat - "try\n" - "tell application \"R\"\n" - "activate\n" - "with timeout of 0 seconds\n" - "cmd \"" (buffer-substring (point) end) - "\"\n" - "end timeout\n" - "end tell\n" - "end try\n")))) - (message "Finished evaluation")) - -(defun ess-r-var (beg end) - "Load the current region of numbers into an R variable. Prompts for -a variable name. If none is given, it uses a default variable name, -e. BEG and END denote the region in the current buffer to be sent." - (interactive "r") - (save-window-excursion - (let ((tmp-file (make-temp-file "ess-r-var")) - cmd - var) - (write-region beg end tmp-file) - - ;; Decide on the variable name to use in R; could use completion. - (setq var (read-string "R Variable name (default e): ")) - (if (equal var "") - (setq var "e")) - - ;; Command to send to the R process. Get R to delete the file - ;; rather than Emacs in case it takes R a long time to run the - ;; scan command. - (setq cmd (concat var " <- scan(\"" tmp-file "\"); " - "unlink(\"" tmp-file "\")" )) - - ;; Put the output from the scan command into the process buffer so - ;; the user has a record of it. - (ess-execute cmd 'buffer)))) - - -;;; Peter Dalgaard's code. -;;; This needs to be cleaned and validated! - -(defun pd::set-up-demo () - (run-ess-r) - (split-window-vertically 6) - (find-file "demos.R") - - ;; Don't need to run this as a function -- ought to be fine if set - ;; just once. - - (defun ajr::scroll-to-end::peterD (emacs) - "Goal: map prompt to bottom of the screen after every command. -Alternatively, use the scroll-in-place package, not sure where that -is)." - (interactive) - (other-buffer 1) - (if (= emacs "emacs") - (setq scroll-up-aggressively t) - (setq scroll-conservatively -4)) ;; <- change this - (other-buffer -1)) - - (defun show-max-other-window () - (interactive) - (other-window 1) - (comint-show-maximum-output) - (other-window -1)) - - ;; call this once - ;; (ajr::scroll-to-end::peterD "emacs") - - (global-set-key [f11] 'show-max-other-window) - (global-set-key [f12] 'ess-eval-line-visibly-and-step)) - - - ; Provide package - -(provide 'ess-r-a) - -;;; ess-r-a.el ends here diff -Nru ess-18.10.2/lisp/ess-r-completion.el ess-18.10.2+git20220915.f45542e/lisp/ess-r-completion.el --- ess-18.10.2/lisp/ess-r-completion.el 2018-11-10 09:41:11.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/lisp/ess-r-completion.el 2022-10-15 08:06:36.000000000 +0000 @@ -1,40 +1,39 @@ -;;; ess-r-completion.el --- R completion -;; -;; Copyright (C) 2015 A.J. Rossini, Richard M. Heiberger, Martin Maechler, Kurt -;; Hornik, Rodney Sparapani, Stephen Eglen and Vitalie Spinu. -;; +;;; ess-r-completion.el --- R completion -*- lexical-binding: t; -*- + +;; Copyright (C) 2015-2020 Free Software Foundation, Inc. ;; Author: Vitalie Spinu ;; Maintainer: ESS-core + +;; This file is part of GNU Emacs. + +;;; License: ;; -;; Keywords: languages, statistics -;; -;; This file is part of ESS. -;; -;; This file is free software; you can redistribute it and/or modify +;; This program is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 2, or (at your option) -;; any later version. +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. ;; -;; This file is distributed in the hope that it will be useful, +;; This program is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. ;; -;; A copy of the GNU General Public License is available at -;; https://www.r-project.org/Licenses/ -;; +;; You should have received a copy of the GNU General Public License +;; along with this program. If not, see +;; + ;;; Commentary: -;; -;;; Code: +;; Provide completion support in R buffers. - -;;; ElDoc +;;; Code: (require 'cl-lib) -(require 'ess-utils) (require 'ess-inf) (require 'ess-help) +(eval-when-compile + (require 'subr-x)) + (defvar ac-auto-start) (defvar ac-prefix) (defvar ac-point) @@ -42,11 +41,18 @@ (declare-function company-begin-backend "company") (declare-function company-doc-buffer "company") -(defun ess-r-eldoc-function () +(defcustom ess-R-argument-suffix " = " + "Suffix appended by `ac-source-R' and `ac-source-R-args' to candidates." + :group 'ess-R + :type 'string) + + +;;;*;;; ElDoc + +(defun ess-r-eldoc-function (&rest _ignored) "Return the doc string, or nil. If an ESS process is not associated with the buffer, do not try to look up any doc strings." - (interactive) (when (and eldoc-mode ess-can-eval-in-background) (let* ((proc (ess-get-next-available-process)) (funname (and proc (or (and ess-eldoc-show-on-symbol ;; Aggressive completion @@ -62,10 +68,11 @@ bargs ", ")) (margs (nth 2 args)) (W (- (window-width (minibuffer-window)) (+ 4 (length funname)))) + (multiline (eq t eldoc-echo-area-use-multiline-p)) doc1) (when doc - (setq doc (ess-eldoc-docstring-format funname doc)) - (when (and margs (< (length doc1) W)) + (setq doc (ess-eldoc-docstring-format funname doc (not multiline))) + (when (or multiline (and margs (< (length doc1) W))) (setq doc1 (concat doc (propertize " || " 'face font-lock-function-name-face))) (while (and margs (< (length doc1) W)) (let ((head (pop margs))) @@ -78,16 +85,12 @@ (setq doc (concat doc " {--}")))) doc)))))) -(defun ess-eldoc-docstring-format (funname doc) +(defun ess-eldoc-docstring-format (funname doc &optional truncate) (save-match-data - (let* (;; (name (symbol-name sym)) - (truncate (or (not (eq t eldoc-echo-area-use-multiline-p)) - (eq ess-eldoc-abbreviation-style 'aggressive))) - ;; Subtract 1 from window width since will cause a wraparound and + (let* (;; Subtract 1 from window width since will cause a wraparound and ;; resize of the echo area. (W (1- (- (window-width (minibuffer-window)) - (+ 2 (length funname))))) - newdoc) + (+ 2 (length funname)))))) (setq doc (if (or (<= (length doc) W) (null ess-eldoc-abbreviation-style) @@ -134,16 +137,15 @@ doc ;;AGGRESSIVE filter (truncate what is left) (concat (substring doc 0 (- W 4)) "{--}"))))))))) - (when (and truncate - (> (length doc) W)) + (when (and truncate (> (length doc) W)) (setq doc (concat (substring doc 0 (- W 4)) "{--}"))) (format "%s: %s" (propertize funname 'face 'font-lock-function-name-face) doc)))) -;;; OBJECTS +;;;*;;; OBJECTS (defun ess-r-object-completion () - "Return completions at point in a format required by `completion-at-point-functions'." + "Return completions at point as required in `completion-at-point-functions'." (if (ess-make-buffer-current) (let* ((funstart (cdr (ess--fn-name-start))) (completions (ess-r-get-rcompletions funstart)) @@ -156,9 +158,9 @@ nil))) (defun ess-complete-object-name () - "Perform completion on `ess-language' object preceding point. -Uses \\[ess-r-complete-object-name] when `ess-use-R-completion' is non-nil, -or \\[ess-internal-complete-object-name] otherwise." + "Perform completion on object preceding point. +Uses `ess-r-complete-object-name' when `ess-use-R-completion' is non-nil, +and `ess-internal-complete-object-name' otherwise." (interactive) (if (ess-make-buffer-current) (if ess-use-R-completion @@ -169,17 +171,7 @@ (message "No ESS process associated with current buffer") nil))) -(defun ess-list-object-completions nil - "List all possible completions of the object name at point." - (interactive) - (ess-complete-object-name)) - -(defun ess-complete-object-name-deprecated () - "Gives a deprecated message." - (interactive) - (ess-complete-object-name) - (message "C-c TAB is deprecated, completions has been moved to [M-TAB] (aka C-M-i)") - (sit-for 2 t)) +(define-obsolete-function-alias 'ess-list-object-completions #'ess-complete-object-name "ESS 19.04") ;; This one is needed for R <= 2.6.x -- hence *not* obsoleting it (defun ess-internal-complete-object-name () @@ -196,7 +188,6 @@ modified (S only!), so the most up-to-date list of object names is always available. However attached dataframes are *not* updated, so this command may be necessary if you modify an attached dataframe." - (interactive) (ess-make-buffer-current) (if (memq (char-syntax (preceding-char)) '(?w ?_)) (let* ((comint-completion-addsuffix nil) @@ -254,18 +245,18 @@ (prefix (or prefix (buffer-substring start end))) ;; (opts1 (if no-args "op<-rc.options(args=FALSE)" "")) ;; (opts2 (if no-args "rc.options(op)" "")) - (call1 (format ".ess_get_completions(\"%s\", %d)" + (call1 (format ".ess_get_completions(\"%s\", %d, \"%s\")" (ess-quote-special-chars prefix) - (- end start))) + (- end start) + ess-R-argument-suffix)) (cmd (if allow-3-dots (concat call1 "\n") (concat "local({ r <- " call1 "; r[r != '...='] })\n")))) (ess-get-words-from-vector cmd))) (defun ess-r-complete-object-name () - "Completion in R via R's completion utilities (formerly 'rcompgen'). + "Completion in R via R's completion utilities (formerly `rcompgen'). To be used instead of ESS' completion engine for R versions >= 2.7.0." - (interactive) (let ((possible-completions (ess-r-get-rcompletions)) token-string) (when possible-completions @@ -277,7 +268,7 @@ (defvar ess--cached-sp-objects nil) -(defun ess--get-cached-completions (prefix &optional point) +(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)) @@ -302,17 +293,11 @@ ;; reread new package, but not rda, much faster and not needed anyways (process-put *proc* 'sp-for-ac-changed? nil))) (apply 'append - (cddar ess-sl-modtime-alist) ; .GlobalEnv + (cl-cddar ess-sl-modtime-alist) ; .GlobalEnv (mapcar 'cddr ess--cached-sp-objects))))) -;;; ARGUMENTS - -(define-obsolete-variable-alias 'ess-ac-R-argument-suffix 'ess-R-argument-suffix "15.3") -(defcustom ess-R-argument-suffix " = " - "Suffix appended by `ac-source-R' and `ac-source-R-args' to candidates." - :group 'R - :type 'string) +;;;*;;; ARGUMENTS (defvar ess-r--funargs-pre-cache '(("plot" @@ -336,7 +321,7 @@ "Alist of cached arguments for time consuming functions.") -;;; HELP +;;;*;;; HELP (defun ess-r-get-object-help-string (sym) "Help string for ac." @@ -348,7 +333,7 @@ (setq sym (match-string 1 sym))) (with-current-buffer (process-buffer proc) (ess-with-current-buffer buf - (ess--flush-help-into-current-buffer sym nil t))) + (ess--flush-help-into-current-buffer sym nil))) (with-current-buffer buf (ess-help-underline) (goto-char (point-min)) @@ -368,8 +353,8 @@ (buffer-substring-no-properties (point) (point-max))))))) -;;; COMPANY -;;; https://company-mode.github.io/ +;;;*;;; COMPANY +;; https://company-mode.github.io (defun company-R-objects (command &optional arg &rest ignored) (interactive (list 'interactive)) @@ -403,78 +388,90 @@ (args (mapcar (lambda (a) (concat a ess-R-argument-suffix)) args))) (all-completions arg args))) - (meta (let ((proc (ess-get-next-available-process))) - (when (and proc - (with-current-buffer (process-buffer proc) - (not (file-remote-p default-directory)))) - ;; fixme: ideally meta should be fetched with args - (let ((doc (ess-r-get-arg-help-string arg proc))) - (replace-regexp-in-string "^ +\\| +$" "" - (replace-regexp-in-string "[ \t\n]+" " " doc)))))) + ;; Displaying help for the argument in the echo area is disabled + ;; by default for performance reasons. It causes delays or hangs (#1062). + (meta (when (bound-and-true-p ess-r--company-meta) + (let ((proc (ess-get-next-available-process))) + (when (and proc + (with-current-buffer (process-buffer proc) + (not (file-remote-p default-directory)))) + ;; fixme: ideally meta should be fetched with args + (let ((doc (ess-r-get-arg-help-string arg proc))) + (replace-regexp-in-string "^ +\\| +$" "" + (replace-regexp-in-string "[ \t\n]+" " " doc))))))) (sorted t) (require-match 'never) (doc-buffer (company-doc-buffer (ess-r-get-arg-help-string arg))))) -(defvar-local ess-r--installed-packages-cache nil) - -(defun ess-r-installed-packages () - "Return a list of currently installed R packages. -The value is cached once per session and is not updated if new -packages are installed." - (let ((proc (ess-get-next-available-process))) - (when proc - (with-current-buffer (process-buffer proc) - (or ess-r--installed-packages-cache - (setq ess-r--installed-packages-cache - (ess-get-words-from-vector - "print(unlist(lapply(.libPaths(), dir)), max=1e6)\n"))))))) - -;; completion for library names -- only active within 'library(...)' (defun company-R-library (command &optional arg &rest ignored) (interactive (list 'interactive)) (cl-case command (interactive (company-begin-backend 'company-R-library)) - (prefix (and (member (car (ess--fn-name-start 'symbol)) + (prefix (and (member (car (ess--fn-name-start)) '("library" "require")) (let ((start (ess-symbol-start))) (and start (buffer-substring start (point)))))) - (candidates (all-completions arg (ess-r-installed-packages))) + (candidates (all-completions arg (ess-installed-packages))) (annotation "") (duplicates nil) (sorted t))) +;; FIXME: There's a lot of overlap between `ess-r-package-completion' +;; and `company-R-library'. Can we merge them somehow? +(defun ess-r-package-completion () + "Return installed packages if in a call to library or require. +Return format suitable for `completion-at-point-functions'." + (when (member (car (ess--fn-name-start)) + '("library" "require")) + (list (ess-symbol-start) + (point) + (ess-installed-packages) + :annotation-function + (lambda (_) " ")))) + -;;; AC SOURCES -;;; http://cx4a.org/software/auto-complete/index.html +;;;*;;; AC SOURCES +;; http://cx4a.org/software/auto-complete/index.html +;; auto-complete is de-facto unmaintained, users should switch to `company-mode'. (defvar ac-source-R '((prefix . ess-ac-start) ;; (requires . 0) ::) (candidates . ess-ac-candidates) - ;; (action . ess-ac-action-args) ;; interfere with ac-fallback mechanism on RET (which is extremely annoing in inferior buffers) + ;; (action . ess-ac-action-args) ;; interfere with ac-fallback mechanism on RET (which is extremely annoying in inferior buffers) (document . ess-ac-help)) "Combined ad-completion source for R function arguments and R objects.") +(make-obsolete-variable 'ac-source-R "Use company-mode instead" "ESS 19.04") (defun ess-ac-start () (when (ess-process-live-p) (or (ess-arg-start) (ess-symbol-start)))) +(make-obsolete-variable 'ess-ac-start "Use company-mode instead" "ESS 19.04") (defun ess-ac-candidates () "OBJECTS + ARGS." - (let ((args (ess-ac-args))) + (let ((args (with-no-warnings + ;; suppress obsolete warnings + (ess-ac-args)))) ;; sort of intrusive but right (if (and ac-auto-start (< (length ac-prefix) ac-auto-start)) args (if args - (append args (ess-ac-objects t)) - (ess-ac-objects))))) + (append args (with-no-warnings + ;; suppress obsolete warnings + (ess-ac-objects t))) + (with-no-warnings + ;; suppress obsolete warnings + (ess-ac-objects)))))) +(make-obsolete-variable 'ess-ac-candidates "Use company-mode instead" "ESS 19.04") (defun ess-ac-help (sym) (if (string-match-p "= *\\'" sym) (ess-r-get-arg-help-string sym) (ess-r-get-object-help-string sym))) +(make-obsolete-variable 'ess-ac-help "Use company-mode instead" "ESS 19.04") ;; OBJECTS (defvar ac-source-R-objects @@ -483,14 +480,16 @@ (candidates . ess-ac-objects) (document . ess-r-get-object-help-string)) "Auto-completion source for R objects.") +(make-obsolete-variable 'ac-source-R-objects "Use company-mode instead" "ESS 19.04") (defun ess-ac-objects (&optional no-kill) "Get all cached objects." - (let ((aprf ac-prefix)) - (when (and aprf (ess-process-live-p)) - (unless no-kill ;; workaround - (kill-local-variable 'ac-use-comphist)) - (ess--get-cached-completions aprf ac-point)))) + (declare (obsolete "Use company-mode instead" "ESS 19.04")) + (let ((aprf ac-prefix)) + (when (and aprf (ess-process-live-p)) + (unless no-kill ;; workaround + (kill-local-variable 'ac-use-comphist)) + (ess--get-cached-completions aprf ac-point)))) ;; ARGS (defvar ac-source-R-args @@ -500,22 +499,21 @@ ;; (action . ess-ac-action-args) (document . ess-r-get-arg-help-string)) "Auto-completion source for R function arguments.") +(make-obsolete-variable 'ac-source-R-args "Use company-mode instead" "ESS 19.04") (defun ess-ac-args () "Get the args of the function when inside parentheses." + (declare (obsolete "Use company-mode-instead" "ESS 19.04")) (when (and ess--fn-name-start-cache ;; set in a call to ess-arg-start (ess-process-live-p)) (let ((args (nth 2 (ess-function-arguments (car ess--fn-name-start-cache))))) (if args - (set (make-local-variable 'ac-use-comphist) nil) + (setq-local ac-use-comphist nil) (kill-local-variable 'ac-use-comphist)) (delete "..." args) (mapcar (lambda (a) (concat a ess-R-argument-suffix)) args)))) -(defvar ess--ac-help-arg-command - "getArgHelp('%s','%s')") - (provide 'ess-r-completion) ;;; ess-r-completion.el ends here diff -Nru ess-18.10.2/lisp/ess-rd.el ess-18.10.2+git20220915.f45542e/lisp/ess-rd.el --- ess-18.10.2/lisp/ess-rd.el 2018-11-10 09:41:11.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/lisp/ess-rd.el 2022-10-15 08:06:36.000000000 +0000 @@ -1,122 +1,118 @@ -;; ess-rd.el --- Support for editing R documentation (Rd) source - -;; Copyright (C) 1997--2005 A.J. Rossini, Richard M. Heiberger, Martin -;; Maechler, Kurt Hornik, Rodney Sparapani, and Stephen Eglen. +;; ess-rd.el --- Support for editing R documentation (Rd) source -*- lexical-binding: t; -*- +;; Copyright (C) 1997-2020 Free Software Foundation, Inc. ;; Author: KH ;; Created: 25 July 1997 ;; Maintainer: ESS-core -;; This file is part of ESS (Emacs Speaks Statistics). +;; This file is part of GNU Emacs. -;; This file is free software; you may redistribute it and/or modify it -;; under the terms of the GNU General Public License as published by the -;; Free Software Foundation; either version 2, or (at your option) any -;; later version. +;;; License: ;; -;; This is distributed in the hope that it will be useful, but WITHOUT -;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -;; FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -;; for more details. +;; This program is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. ;; -;; A copy of the GNU General Public License is available on the World -;; Wide Web at https://www.gnu.org/copyleft/gpl.html. You can also -;; obtain it by writing to the Free Software Foundation, Inc., 675 Mass -;; Ave, Cambridge, MA 02139, USA. - +;; This program is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. +;; +;; You should have received a copy of the GNU General Public License +;; along with this program. If not, see +;; ;;; Commentary: ;; ;;; Code: -(require 'ess-custom) -(require 'ess-utils) +(eval-when-compile + (require 'subr-x)) + (require 'ess-help) (require 'ess-inf) ;; Silence the byte compiler, see TODO below; can we remove these? (defvar ess-help-r-sec-regex) (defvar ess-help-r-sec-keys-alist) - (defvar ess-r-customize-alist) -(defvar essddr-version "0.9-1" - "Current version of ess-rd.el.") - -(defvar essddr-maintainer-address - "ESS Core Team " - "Current maintainer of ess-rd.el.") - -(defvar Rd-mode-abbrev-table nil +(defcustom Rd-mode-hook nil + "Hook to be run when Rd mode is entered." + :type 'hook + :group 'ess-R + :group 'ess-hooks) + +(define-abbrev-table 'Rd-mode-skeleton-abbrev-table + '(("`ag" "\\arguments" nil :system t) + ("`al" "\\alias" nil :system t) + ("`au" "\\author" nil :system t) + ("`bf" "\\bold" nil :system t) + ("`co" "\\code" nil :system t) + ("`de" "\\describe" nil :system t) + ("`dn" "\\description" nil :system t) + ("`dt" "\\details" nil :system t) + ("`em" "\\emph" nil :system t) + ("`en" "\\enumerate" nil :system t) + ("`ex" "\\examples" nil :system t) + ("`fi" "\\file" nil :system t) + ("`fo" "\\format" nil :system t) + ("`it" "\\item" nil :system t) + ("`iz" "\\itemize" nil :system t) + ("`kw" "\\keyword" nil :system t) + ("`li" "\\link" nil :system t) + ("`me" "\\method" nil :system t) + ("`na" "\\name" nil :system t) + ("`no" "\\note" nil :system t) + ("`re" "\\references" nil :system t) + ("`sa" "\\seealso" nil :system t) + ("`se" "\\section" nil :system t) + ("`so" "\\source" nil :system t) + ("`ss" "\\subsection" nil :system t) + ("`sy" "\\synopsis" nil :system t) + ("`ta" "\\tabular" nil :system t) + ("`ti" "\\title" nil :system t) + ("`us" "\\usage" nil :system t) + ("`va" "\\value" nil :system t)) "Abbrev table for R documentation keywords. -All Rd mode abbrevs start with a grave accent (`).") -(if Rd-mode-abbrev-table - () - (define-abbrev-table 'Rd-mode-abbrev-table ()) - (define-abbrev Rd-mode-abbrev-table "`ag" "\\arguments") - (define-abbrev Rd-mode-abbrev-table "`al" "\\alias") - (define-abbrev Rd-mode-abbrev-table "`au" "\\author") - (define-abbrev Rd-mode-abbrev-table "`bf" "\\bold") - (define-abbrev Rd-mode-abbrev-table "`co" "\\code") - (define-abbrev Rd-mode-abbrev-table "`de" "\\describe") - (define-abbrev Rd-mode-abbrev-table "`dn" "\\description") - (define-abbrev Rd-mode-abbrev-table "`dt" "\\details") - (define-abbrev Rd-mode-abbrev-table "`em" "\\emph") - (define-abbrev Rd-mode-abbrev-table "`en" "\\enumerate") - (define-abbrev Rd-mode-abbrev-table "`ex" "\\examples") - (define-abbrev Rd-mode-abbrev-table "`fi" "\\file") - (define-abbrev Rd-mode-abbrev-table "`fo" "\\format") - (define-abbrev Rd-mode-abbrev-table "`it" "\\item") - (define-abbrev Rd-mode-abbrev-table "`iz" "\\itemize") - (define-abbrev Rd-mode-abbrev-table "`kw" "\\keyword") - (define-abbrev Rd-mode-abbrev-table "`li" "\\link") - (define-abbrev Rd-mode-abbrev-table "`me" "\\method") - (define-abbrev Rd-mode-abbrev-table "`na" "\\name") - (define-abbrev Rd-mode-abbrev-table "`no" "\\note") - (define-abbrev Rd-mode-abbrev-table "`re" "\\references") - (define-abbrev Rd-mode-abbrev-table "`sa" "\\seealso") - (define-abbrev Rd-mode-abbrev-table "`se" "\\section") - (define-abbrev Rd-mode-abbrev-table "`so" "\\source") - (define-abbrev Rd-mode-abbrev-table "`ss" "\\subsection") - (define-abbrev Rd-mode-abbrev-table "`sy" "\\synopsis") - (define-abbrev Rd-mode-abbrev-table "`ta" "\\tabular") - (define-abbrev Rd-mode-abbrev-table "`ti" "\\title") - (define-abbrev Rd-mode-abbrev-table "`us" "\\usage") - (define-abbrev Rd-mode-abbrev-table "`va" "\\value")) - -(defvar Rd-mode-syntax-table nil - "Syntax table for Rd mode.") -(if Rd-mode-syntax-table - () - (setq Rd-mode-syntax-table (copy-syntax-table text-mode-syntax-table)) - (modify-syntax-entry ?\\ "\\" Rd-mode-syntax-table) - (modify-syntax-entry ?\{ "(}" Rd-mode-syntax-table) - (modify-syntax-entry ?\} "){" Rd-mode-syntax-table) - ;; Nice for editing, not for parsing ... - (modify-syntax-entry ?\( "()" Rd-mode-syntax-table) - (modify-syntax-entry ?\) ")(" Rd-mode-syntax-table) - (modify-syntax-entry ?\[ "(]" Rd-mode-syntax-table) - (modify-syntax-entry ?\] ")[" Rd-mode-syntax-table) - ;; To get strings right - ;; (modify-syntax-entry ?\' "\"" Rd-mode-syntax-table) - (modify-syntax-entry ?\" "\"" Rd-mode-syntax-table) - ;; To make abbrevs starting with a grave accent work ... - (modify-syntax-entry ?\` "w" Rd-mode-syntax-table) - ;; Comments - (modify-syntax-entry ?\% "<" Rd-mode-syntax-table) - (modify-syntax-entry ?\n ">" Rd-mode-syntax-table)) +All Rd mode abbrevs start with a grave accent (`)." + :case-fixed t) -(defvar Rd-mode-parse-syntax-table nil +(define-abbrev-table 'Rd-mode-abbrev-table () + "Abbrev table for Rd mode." + :parents (list Rd-mode-skeleton-abbrev-table)) + +(defvar Rd-mode-syntax-table + (let ((tab (copy-syntax-table text-mode-syntax-table))) + (modify-syntax-entry ?\\ "\\" tab) + (modify-syntax-entry ?\{ "(}" tab) + (modify-syntax-entry ?\} "){" tab) + ;; Nice for editing, not for parsing ... + (modify-syntax-entry ?\( "()" tab) + (modify-syntax-entry ?\) ")(" tab) + (modify-syntax-entry ?\[ "(]" tab) + (modify-syntax-entry ?\] ")[" tab) + ;; To get strings right + ;; (modify-syntax-entry ?\' "\"" Rd-mode-syntax-table) + (modify-syntax-entry ?\" "\"" tab) + ;; To make abbrevs starting with a grave accent work ... + (modify-syntax-entry ?\` "w" tab) + ;; Comments + (modify-syntax-entry ?\% "<" tab) + (modify-syntax-entry ?\n ">" tab) + tab) + "Syntax table for `Rd-mode'.") + +(defvar Rd-mode-parse-syntax-table + (let ((tab (copy-syntax-table Rd-mode-syntax-table))) + ;; To make parse-partial-sexps do the thing we want for computing + ;; indentations + (modify-syntax-entry ?\( "_" tab) + (modify-syntax-entry ?\) "_" tab) + (modify-syntax-entry ?\[ "_" tab) + (modify-syntax-entry ?\] "_" tab) + tab) "Syntax table for parsing Rd mode.") -(if Rd-mode-parse-syntax-table - () - (setq Rd-mode-parse-syntax-table - (copy-syntax-table Rd-mode-syntax-table)) - ;; To make parse-partial-sexps do the thing we want for computing - ;; indentations - (modify-syntax-entry ?\( "_" Rd-mode-parse-syntax-table) - (modify-syntax-entry ?\) "_" Rd-mode-parse-syntax-table) - (modify-syntax-entry ?\[ "_" Rd-mode-parse-syntax-table) - (modify-syntax-entry ?\] "_" Rd-mode-parse-syntax-table)) (defvar Rd-section-names '("Rdversion" "arguments" "alias" "author" "concept" "describe" "description" @@ -133,27 +129,23 @@ ;; "Alpha" "Gamma" "alpha" "beta" "epsilon" "lambda" "mu" "pi" "sigma" ;; "ge" "le" "left" "right" ;; - "R" "RdOpts" "S3method" "S4method" "Sexpr" "acronym" + "RdOpts" "R" "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" + "href" + "ifelse" "if" "item" "kbd" "ldots" "linkS4class" "link" "method" "newcommand" "option" "out" "pkg" "sQuote" "renewcommand" "samp" "strong" "tab" "url" "var" "verb" ;; System macros (from /share/Rd/macros/system.Rd ): "CRANpkg" "PR" "sspace" "doi" + "LaTeX" + "proglang" "packageTitle" "packageDescription" "packageAuthor" "packageMaintainer" "packageDESCRIPTION" "packageIndices" )) -;; Need to fix Rd-bold-face problem. -;; -;; (defvar Rd-bold-face 'bold) - ;(defvar Rd-bold-face nil) - ;(make-face Rd-bold-face "R documentation bold face") - ;(make-face-bold Rd-bold-face - (defvar Rd-font-lock-keywords (list (cons @@ -173,30 +165,27 @@ "Additional Rd expressions to highlight.") (defvar Rd-indent-level 2 - "*Indentation of Rd code with respect to containing blocks.") + "Indentation of Rd code with respect to containing blocks.") (defvar Rd-mode-map (let ((map (make-sparse-keymap))) - (define-key map "\t" 'indent-according-to-mode) - (define-key map "\C-j" 'reindent-then-newline-and-indent) - (define-key map "\C-m" 'reindent-then-newline-and-indent) - (define-key map "\C-c\C-p" 'Rd-preview-help) - (define-key map "\C-c\C-j" 'Rd-mode-insert-item) - (define-key map "\C-c\C-e" 'Rd-mode-insert-skeleton) - (define-key map "\C-c\C-f" 'Rd-font) - ;; ^C^F ^E : \emph{ . } - ;; ^C^F ^C : \code{ . } - ;; ^C^F ^L : \link{ . } - ;; ^C^F L : \code{\link{ . }} etc - (define-key map "\C-c\C-s" 'Rd-mode-insert-section) - (define-key map "\C-c\C-n" 'ess-eval-line-visibly-and-step) - (define-key map "\C-c\C-r" 'ess-eval-region) - (define-key map "\C-c\C-c" 'ess-eval-region-or-function-or-paragraph-and-step) - (define-key map "\C-\M-x" 'ess-eval-region-or-function-or-paragraph) - (define-key map "\C-c\C-v" 'ess-display-help-on-object) - (define-key map "\C-c\C-w" 'ess-switch-process); is on C-c C-s in ess-mode.. - (define-key map "\C-c\C-y" 'ess-switch-to-ESS) - (define-key map "\C-c\C-z" 'ess-switch-to-end-of-ESS) + (define-key map "\t" #'indent-according-to-mode) + (define-key map "\C-j" #'reindent-then-newline-and-indent) + (define-key map "\C-m" #'reindent-then-newline-and-indent) + (define-key map "\C-c\C-p" #'Rd-preview-help) + (define-key map "\C-c\C-j" #'Rd-mode-insert-item) + (define-key map "\C-c\C-e" #'Rd-mode-insert-skeleton) + (define-key map "\C-c\C-d" #'Rd-mode-insert-data-skeleton) + (define-key map "\C-c\C-f" #'Rd-font) + (define-key map "\C-c\C-s" #'Rd-mode-insert-section) + (define-key map "\C-c\C-n" #'ess-eval-line-visibly-and-step) + (define-key map "\C-c\C-r" #'ess-eval-region) + (define-key map "\C-c\C-c" #'ess-eval-region-or-function-or-paragraph-and-step) + (define-key map "\C-\M-x" #'ess-eval-region-or-function-or-paragraph) + (define-key map "\C-c\C-v" #'ess-display-help-on-object) + (define-key map "\C-c\C-w" #'ess-switch-process) + (define-key map "\C-c\C-y" #'ess-switch-to-ESS) + (define-key map "\C-c\C-z" #'ess-switch-to-end-of-ESS) map) "Keymap used in Rd mode.") @@ -206,6 +195,7 @@ ["Insert Item" Rd-mode-insert-item t] ["Insert Section" Rd-mode-insert-section t] ["Insert Skeleton" Rd-mode-insert-skeleton t] + ["Insert Data Skeleton" Rd-mode-insert-data-skeleton t] "-" ["Preview" Rd-preview-help t] "-" @@ -218,18 +208,14 @@ ["Toggle Abbrev Mode" abbrev-mode t] ["Toggle Auto-Fill Mode" auto-fill-mode t] "-" - ["Submit Bug Report" Rd-submit-bug-report t] + ["Submit Bug Report" ess-submit-bug-report t] "-" - ["Describe Rd Mode" Rd-describe-major-mode t]) + ["Describe Rd Mode" describe-mode t]) "Menu used in Rd mode.") -(defvar Rd-mode-hook nil - "Hook to be run when Rd mode is entered.") - (defvar Rd-to-help-command "R CMD Rd2txt" "Shell command for converting R documentation source to help text.") - (defvar Rd-font-list '((?\C-b "\\bold{" "}") (?\C-c "\\code{" "}") @@ -248,94 +234,47 @@ ;;;###autoload -(defun Rd-mode () +(define-derived-mode Rd-mode text-mode "Rd" "Major mode for editing R documentation source files. -This mode makes it easier to write R documentation by helping with -indentation, doing some of the typing for you (with Abbrev mode) and by -showing keywords, strings, etc. in different faces (with Font Lock mode -on terminals that support it). - -Type \\[list-abbrevs] to display the built-in abbrevs for Rd keywords. - -Keybindings -=========== - -\\{Rd-mode-map} - -Variables you can use to customize Rd mode -========================================== - -`Rd-indent-level' - Indentation of Rd code with respect to containing blocks. - Default is 2. - -Turning on Rd mode runs the hook `Rd-mode-hook'. - -To automatically turn on the abbrev(iate) features, add the -following lines to your `.emacs' file: - - (add-hook 'Rd-mode-hook - (lambda () - (abbrev-mode 1)))" - - (interactive) - (text-mode) - (kill-all-local-variables) - (ess-setq-vars-local ess-r-customize-alist) ;same functionality is available as in R buffers - (use-local-map Rd-mode-map) - (setq mode-name "Rd") - (setq major-mode 'Rd-mode) - (setq local-abbrev-table Rd-mode-abbrev-table) - (set-syntax-table Rd-mode-syntax-table) - - (set (make-local-variable 'indent-line-function) 'Rd-mode-indent-line) - (set (make-local-variable 'fill-column) 72) - (set (make-local-variable 'comment-start-skip) "\\s<+\\s-*") - (set (make-local-variable 'comment-start) "% ") - (set (make-local-variable 'comment-end) "") - (set (make-local-variable 'font-lock-defaults) - '(Rd-font-lock-keywords nil nil)) - ;; (set (make-local-variable 'parse-sexp-ignore-comments) t) +Type \\[list-abbrevs] to display the built-in abbrevs for Rd +keywords.To automatically turn on the abbrev(iate) features, add +the following to your Emacs configuration file: + + (add-hook 'Rd-mode-hook #'abbrev-mode)" + (setq ess-language "S" ess-dialect "R") + (require 'ess-r-mode) + (ess-setq-vars-local ess-r-customize-alist) + + (setq-local indent-line-function 'Rd-mode-indent-line) + (setq fill-column 72) + (setq-local comment-start-skip "\\s<+\\s-*") + (setq-local comment-start "% ") + (setq-local comment-end "") + (setq font-lock-defaults + '(Rd-font-lock-keywords nil nil)) ;; Here is a workaround for an Emacs bug related to indirect buffers and ;; spurious lockfiles that rears its ugly head with .Rd files ;; https://lists.gnu.org/archive/html/bug-gnu-emacs/2013-02/msg01368.html ;; https://debbugs.gnu.org/cgi/bugreport.cgi?bug=14328 - (make-local-variable 'create-lockfiles) - (setq create-lockfiles nil) + (setq-local create-lockfiles nil) - (require 'easymenu) (easy-menu-define Rd-mode-menu-map Rd-mode-map "Menu keymap for Rd mode." Rd-mode-menu) - (turn-on-auto-fill) - (message "Rd mode version %s" essddr-version) - (setq ess-language "S" ess-dialect "R"); (buffer local) - (run-mode-hooks 'Rd-mode-hook)) + (turn-on-auto-fill)) ;;;###autoload (add-to-list 'auto-mode-alist '("\\.Rd\\'" . Rd-mode)) -;; FIXME: The following should be moved to ess-utils.el, no? (MM thinks) -(defun ess-point (position) - "Return the value of point at a certain POSITION." - (save-excursion - (cond - ((eq position 'bol) (beginning-of-line)) - ((eq position 'eol) (end-of-line)) - ((eq position 'boi) (back-to-indentation)) - ((eq position 'bonl) (forward-line 1)) - ((eq position 'bopl) (forward-line -1)) - (t (error "Unknown buffer position requested: %s" position))) - (point))) - (defun Rd-describe-major-mode () "Describe the current major mode." - (interactive) + (declare (obsolete describe-mode "ESS 19.04")) (describe-function major-mode)) (defun Rd-mode-in-verbatim-p () + "Return non-nil if in a usage, examples, or synopsis." (let ((pos (point))) (save-excursion (if (and (re-search-backward @@ -349,13 +288,13 @@ nil)))) (defun Rd-mode-in-preprocessor-line-p () + "Return non-nil if in a preprocessor line." (save-excursion (beginning-of-line) (looking-at "[ \t]*#\\(ifdef\\|endif\\)"))) (defun Rd-mode-calculate-indent () "Return appropriate indentation for current line in Rd mode." - (interactive) (save-excursion (beginning-of-line) (cond @@ -367,7 +306,7 @@ 0) (t (let ((p (progn - (re-search-forward "[ \t]*\\s)*" (ess-point 'eol) t) + (re-search-forward "[ \t]*\\s)*" (point-at-eol) t) (point)))) (if (or (< (forward-line -1) 0) (Rd-mode-in-verbatim-p)) @@ -377,7 +316,7 @@ (Rd-mode-in-preprocessor-line-p)) (not (bobp))) (forward-line -1)) - (re-search-forward "[ \t]*\\s)*" (ess-point 'eol) t) + (re-search-forward "[ \t]*\\s)*" (point-at-eol) t) (prog1 (+ (current-indentation) (* (car (parse-partial-sexp (point) p)) @@ -386,23 +325,23 @@ (defun Rd-mode-indent-line () "Indent current line as Rd source." - (interactive) - (let ((ic (Rd-mode-calculate-indent)) - (rp (- (current-column) (current-indentation)))) - (if ic ; Not inside a verbatim - (if (< ic 0) - (error "Unmatched parenthesis") - (indent-line-to ic) - (if (> rp 0) - (move-to-column (+ ic rp))))))) + (when-let ((ic (Rd-mode-calculate-indent)) + (rp (- (current-column) (current-indentation)))) + (when (< ic 0) + (error "Unmatched parenthesis")) + (indent-line-to ic) + (when (> rp 0) + (move-to-column (+ ic rp))))) (defun Rd-mode-insert-item () + "Insert \\item{ on a newline." (interactive) (reindent-then-newline-and-indent) (insert "\\item{") ) (defun Rd-mode-insert-section () + "Insert a section from `Rd-section-names'." (interactive) (let ((s (ess-completing-read "Insert section: " @@ -413,6 +352,7 @@ (insert (format "\\%s{" s))))) (defun Rd-mode-insert-skeleton () + "Insert several empty Rd fields." (interactive) ;; Hmm: in theory this should be kept in sync with prompt() ;; --- maybe using prompt() [or promptClass()...] would be better anyway?! @@ -430,6 +370,25 @@ (insert "\\author{}\n") (insert "\\keyword{}\n")) +(defun Rd-mode-insert-data-skeleton () + "Insert several empty Rd fields." + (interactive) + ;; Hmm: in theory this should be kept in sync with prompt() + ;; --- maybe using prompt() [or promptClass()...] would be better anyway?! + (insert "\\name{}\n") + (insert "\\docType{}\n") + (insert "\\alias{}\n") + (insert "\\title{}\n") + (insert "\\description{\n}\n") + (insert "\\usage{\n}\n") + (insert "\\format{\n}\n") + (insert "\\details{\n}\n") + (insert "\\source{}\n") + (insert "\\references{\n}\n") + (insert "\\examples{\n}\n") + (insert "\\keyword{datasets}\n")) + + ;; This is an `easy' version of (defun TeX-font ..) in AUCtex's tex.el ; ;; see TeX-font-list and also LaTeX-font-list in latex.el @@ -473,14 +432,13 @@ (insert before) (save-excursion (insert after)))))) -;;;###autoload + (defun Rd-preview-help (&optional via-shell) "Preview the current Rd buffer contents as help. -If optional VIA-SHELL is set, using `Rd-to-help-command'. If the current buffer is not associated with a file, create a -temporary one in `temporary-file-directory'." - (interactive "P") - (require 'ess-help) +temporary one in variable `temporary-file-directory'." + (declare (advertised-calling-convention () "ESS 19.04")) + (interactive "P") ; If optional VIA-SHELL is set, using `Rd-to-help-command'. (let ((file buffer-file-name) (pbuf (get-buffer-create "R Help Preview")) del-p) @@ -499,19 +457,19 @@ (shell-command shcmd t)) ;; else directly: (ess-force-buffer-current "R process to use: ") - (ess-command (format ".ess_Rd2txt(\"%s\")\n" file) pbuf) + (ess--foreground-command (format ".ess_Rd2txt(\"%s\")\n" file) pbuf) (set-buffer pbuf)) ;; FIXME(2): once got rid of via-shell, consider ;; (ess--flush-help-into-current-buffer file "tools::Rd2txt(\"%s\")\n") ;; instead of all this : (ess-setq-vars-local ess-r-customize-alist) + ;; mostly cut'n'paste from ess--flush-help* (see FIXME(2)): + (ess-help-underline) + (ess--help-major-mode) ;; FIXME: Is this really needed? (setq ess-help-sec-regex ess-help-r-sec-regex ess-help-sec-keys-alist ess-help-r-sec-keys-alist) - ;; mostly cut'n'paste from ess--flush-help* (see FIXME(2)): - (ess-help-underline) - (ess-help-mode) (goto-char (point-min)) (set-buffer-modified-p 'nil) (setq buffer-read-only t) @@ -520,23 +478,8 @@ (unless (get-buffer-window pbuf 'visible) (display-buffer pbuf t)))) -;; Bug reporting -(defun Rd-submit-bug-report () - "Submit a bug report on Rd mode via mail." - (interactive) - (require 'reporter) - (and - (y-or-n-p "Do you want to submit a bug report? ") - (reporter-submit-bug-report - essddr-maintainer-address - (concat "Emacs version " emacs-version) - (list - 'essddr-version - 'Rd-indent-level)))) - +(define-obsolete-function-alias 'Rd-submit-bug-report 'ess-submit-bug-report "2018-08-16") -;; Legacy feature -(provide 'essddr) (provide 'ess-rd) ;;; ess-rd.el ends here diff -Nru ess-18.10.2/lisp/ess-rdired.el ess-18.10.2+git20220915.f45542e/lisp/ess-rdired.el --- ess-18.10.2/lisp/ess-rdired.el 2018-11-10 09:41:11.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/lisp/ess-rdired.el 2022-10-15 08:06:36.000000000 +0000 @@ -1,40 +1,36 @@ -;;; ess-rdired.el --- prototype object browser for R, looks like dired mode. - -;; Copyright (C) 2002--2004 A.J. Rossini, Richard M. Heiberger, Martin -;; Maechler, Kurt Hornik, Rodney Sparapani, and Stephen Eglen. +;;; ess-rdired.el --- prototype object browser for R, looks like dired mode. -*- lexical-binding: t; -*- +;; Copyright (C) 2002-2020 Free Software Foundation, Inc. ;; Author: Stephen Eglen ;; Created: Thu 24 Oct 2002 ;; Maintainer: ESS-core -;; This file is part of ESS - -;; This file is not part of GNU Emacs. +;; This file is part of GNU Emacs. -;; ess-rdired.el is free software; you can redistribute it and/or modify +;;; License: +;; +;; This program is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 2, or (at your option) -;; any later version. - -;; ess-rdired.el is distributed in the hope that it will be useful, +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. +;; +;; This program is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. +;; +;; You should have received a copy of the GNU General Public License +;; along with this program. If not, see +;; -;; A copy of the GNU General Public License is available at -;; https://www.r-project.org/Licenses/ +;;; Commentary: ;; This provides a dired-like buffer for R objects. Instead of ;; operating on files, we operate on R objects in the current ;; environment. Objects can be viewed, edited, deleted, plotted and ;; so on. - -;;; Commentary: - -;; Installation and usage. +;; Do "M-x R" to start an R session, then create a few variables: ;; -;; After loading this file, do "M-x R" to start an R session, then -;; create a few variables: ;; s <- sin(seq(from=0, to=8*pi, length=100)) ;; x <- c(1, 4, 9) ;; y <- rnorm(20) @@ -42,25 +38,21 @@ ;; Then in Emacs, do "M-x ess-rdired" and you should see the following in ;; the buffer *R dired*: -;; mode length -;; s numeric 100 -;; x numeric 3 -;; y numeric 20 -;; z logical 1 +;; Name Class Length Size +;; s numeric 100 848 bytes +;; x numeric 3 80 bytes +;; y numeric 20 208 bytes +;; z logical 1 56 bytes ;; Type "?" in the buffer to see the documentation. e.g. when the ;; cursor is on the line for `s', type 'p' to plot it, or `v' to view -;; its contents in a buffer. Then type 'd' to mark it for deletion. +;; its contents in a buffer. Then type 'd' to delete it. ;; How it works. -;; Most of the hardwork is done by the R routine .rdired.objects(), +;; Most of the hard work is done by the R routine .rdired.objects(), ;; which, when called, produces the list of objects in a tidy format. -;; This function is stored within the Lisp variable `ess-rdired-objects', -;; and can be altered to provide other information if you so need it. -;; (Martin Maechler suggested providing output from str() here.) - -;; Todo - compare functionality with ess-mouse-me (ess-mous.el). +;; This function is stored within the Lisp variable `ess-rdired-objects'. ;; Todo - How to select alternative environments? Currently only ;; shows objects in the .GlobalEnv? See BrowseEnv() in 1.6.x for way @@ -79,166 +71,139 @@ ;;; Code: -(require 'ess-custom) (require 'ess-inf) -(defvar ess-rdired-objects "{.rdired.objects <- function(objs) { - if (length(objs)==0) { - \"No objects to view!\" - } else { - mode <- sapply(objs, function(my.x) { - eval( parse( text=sprintf('data.class(get(\"%s\"))', my.x))) }) - length <- sapply(objs, function(my.x) { - eval( parse( text=sprintf('length(get(\"%s\"))', my.x))) }) - size <- sapply(objs, function(my.x) { - eval( parse( text=sprintf('format(object.size(get(\"%s\")), units=\"auto\")', my.x))) }) - d <- data.frame(mode, length, size) - - var.names <- row.names(d) - - ## If any names contain spaces, we need to quote around them. - quotes = rep('', length(var.names)) - spaces = grep(' ', var.names) - if (any(spaces)) - quotes[spaces] <- '\"' - var.names = paste(quotes, var.names, quotes, sep='') - row.names(d) <- paste(' ', var.names, sep='') - d - } -}; cat('\n'); print(.rdired.objects(ls()))}\n" - "Function to call within R to print information on objects. -The last line of this string should be the instruction to call -the function which prints the output for rdired.") +(eval-when-compile + (require 'subr-x)) + +(defvar ess-rdired-objects ".ess.rdired()\n" + "Function to call within R to print information on objects.") (defvar ess-rdired-buffer "*R dired*" "Name of buffer for displaying R objects.") +(defvar ess-rdired-auto-update-timer nil + "The timer object for auto updates.") + +(defcustom ess-rdired-auto-update-interval 5 + "Seconds between refreshes of the `ess-rdired' buffer." + :type '(choice (const nil :tag "No auto updates") (integer :tag "Seconds")) + :group 'ess-R + :package-version '(ess . "19.04")) + (defvar ess-rdired-mode-map - (let ((ess-rdired-mode-map (make-sparse-keymap))) - (if (require 'hide-lines nil t) - (define-key ess-rdired-mode-map "/" 'hide-lines)) - (define-key ess-rdired-mode-map "?" 'ess-rdired-help) - (define-key ess-rdired-mode-map "d" 'ess-rdired-delete) - (define-key ess-rdired-mode-map "u" 'ess-rdired-undelete) - (define-key ess-rdired-mode-map "x" 'ess-rdired-expunge) - ;; editing requires a little more work. - ;;(define-key ess-rdired-mode-map "e" 'ess-rdired-edit) - (define-key ess-rdired-mode-map "v" 'ess-rdired-view) - (define-key ess-rdired-mode-map "V" 'ess-rdired-View) - (define-key ess-rdired-mode-map "p" 'ess-rdired-plot) - (define-key ess-rdired-mode-map "s" 'ess-rdired-sort) - (define-key ess-rdired-mode-map "r" 'ess-rdired-reverse) - (define-key ess-rdired-mode-map "q" 'ess-rdired-quit) - (define-key ess-rdired-mode-map "y" 'ess-rdired-type) ;what type? - (define-key ess-rdired-mode-map " " 'ess-rdired-next-line) - (define-key ess-rdired-mode-map [backspace] 'ess-rdired-previous-line) - (define-key ess-rdired-mode-map "\C-n" 'ess-rdired-next-line) - (define-key ess-rdired-mode-map "\C-p" 'ess-rdired-previous-line) - ;; (define-key ess-rdired-mode-map "n" 'ess-rdired-next-line) - ;; (define-key ess-rdired-mode-map "p" 'ess-rdired-previous-line) - - ;; R mode keybindings. - (define-key ess-rdired-mode-map "\C-c\C-s" 'ess-rdired-switch-process) - (define-key ess-rdired-mode-map "\C-c\C-y" 'ess-switch-to-ESS) - (define-key ess-rdired-mode-map "\C-c\C-z" 'ess-switch-to-end-of-ESS) - - (define-key ess-rdired-mode-map [down] 'ess-rdired-next-line) - (define-key ess-rdired-mode-map [up] 'ess-rdired-previous-line) - (define-key ess-rdired-mode-map "g" 'revert-buffer) - (define-key ess-rdired-mode-map [mouse-2] 'ess-rdired-mouse-view) - ess-rdired-mode-map)) + (let ((map (make-sparse-keymap))) + (define-key map "d" #'ess-rdired-delete) + (define-key map "x" #'ess-rdired-delete) + (define-key map "v" #'ess-rdired-view) + (define-key map "V" #'ess-rdired-View) + (define-key map "p" #'ess-rdired-plot) + (define-key map "y" #'ess-rdired-type) + (define-key map "\C-c\C-s" #'ess-rdired-switch-process) + (define-key map "\C-c\C-y" #'ess-switch-to-ESS) + (define-key map "\C-c\C-z" #'ess-switch-to-end-of-ESS) + map)) -(defun ess-rdired-mode () +(define-derived-mode ess-rdired-mode tabulated-list-mode "Rdired" "Major mode for output from `ess-rdired'. `ess-rdired' provides a dired-like mode for R objects. It shows the list of current objects in the current environment, one-per-line. You -can then examine these objects, plot them, and so on. -\\{ess-rdired-mode-map}" - ;; (kill-all-local-variables) - (make-local-variable 'revert-buffer-function) - (setq revert-buffer-function 'ess-rdired-revert-buffer) - (use-local-map ess-rdired-mode-map) - (setq major-mode 'ess-rdired-mode) +can then examine these objects, plot them, and so on." + :group 'ess-R (setq mode-name (concat "RDired " ess-local-process-name)) - (run-mode-hooks 'ess-rdired-mode-hook)) - -(defun ess-rdired-mode-hook nil - "Run upon entering `ess-rdired-mode'.") - -(defvar ess-rdired-sort-num nil) ;silence the compiler. -;; but see following defun -- maybe it should be buffer local. + (setq tabulated-list-format + `[("Name" 18 t) + ("Class" 10 t) + ("Length" 10 ess-rdired--length-predicate) + ("Size" 10 ess-rdired--size-predicate)]) + (add-hook 'tabulated-list-revert-hook #'ess-rdired-refresh nil t) + (when (and (not ess-rdired-auto-update-timer) + ess-rdired-auto-update-interval) + (setq ess-rdired-auto-update-timer + (run-at-time t ess-rdired-auto-update-interval #'ess-rdired-refresh))) + (add-hook 'kill-buffer-hook #'ess-rdired-cancel-auto-update-timer nil t) + (tabulated-list-init-header)) ;;;###autoload (defun ess-rdired () - "Run dired-like mode on R objects. -This is the main function. See documentation for `ess-rdired-mode' though -for more information!" - (interactive) - (let ((proc ess-local-process-name) - (buff (get-buffer-create ess-rdired-buffer))) - - (ess-command ess-rdired-objects buff) - (ess-setq-vars-local (symbol-value ess-local-customize-alist) buff) - - (with-current-buffer buff - (setq ess-local-process-name proc) - (ess-rdired-mode) - - ;; When definiting the function .rdired.objects(), a "+ " is printed - ;; for every line of the function definition; these are deleted - ;; here. - (goto-char (point-min)) - (delete-region (point-min) (1+ (point-at-eol))) - - ;; todo: not sure how to make ess-rdired-sort-num buffer local? - ;;(set (make-local-variable 'ess-rdired-sort-num) 2) - ;;(make-variable-buffer-local 'ess-rdired-sort-num) - (setq ess-rdired-sort-num 1) - (ess-rdired-insert-set-properties (save-excursion - (goto-char (point-min)) - (forward-line 1) - (point)) - (point-max)) - (setq buffer-read-only t) - ) - - (pop-to-buffer buff) - )) - - -(defun ess-rdired-object () - "Return name of object on current line. -Handle special case when object contains spaces." - (save-excursion - (beginning-of-line) - (forward-char 2) - - (cond ((looking-at " ") ; First line? - nil) - ((looking-at "\"") ; Object name contains spaces? - (let (beg) - (setq beg (point)) - (forward-char 1) - (search-forward "\"") - (buffer-substring-no-properties beg (point)))) - (t ;should be a regular object. - (let (beg) - (setq beg (point)) - (search-forward " ") ;assume space follows object name. - (buffer-substring-no-properties beg (1- (point)))))))) + "Show R objects from the global environment in a separate buffer. +You may interact with these objects, see `ess-rdired-mode' for +details." + (interactive) + (unless (and (string= "R" ess-dialect) + ess-local-process-name) + (error "Not in an R buffer with attached process")) + (let ((proc ess-local-process-name)) + (pop-to-buffer (get-buffer-create ess-rdired-buffer)) + (setq ess-local-process-name proc) + (ess-rdired-mode) + (ess-rdired-refresh))) + +(defun ess-rdired-refresh () + "Refresh the `ess-rdired' buffer." + (let* ((buff (get-buffer-create ess-rdired-buffer)) + (proc-name (buffer-local-value 'ess-local-process-name buff)) + (proc (get-process proc-name)) + (out-buff (get-buffer-create " *ess-rdired-output*")) + text) + (when (and proc-name proc + (not (process-get proc 'busy))) + (ess--foreground-command ess-rdired-objects out-buff nil nil nil proc) + (with-current-buffer out-buff + (goto-char (point-min)) + ;; Delete two lines. One filled with +'s from R's prompt + ;; printing, the other with the header info from the data.frame + (delete-region (point-min) (1+ (point-at-eol 2))) + (setq text (split-string (buffer-string) "\n" t "\n")) + (erase-buffer)) + (with-current-buffer buff + (setq tabulated-list-entries + (mapcar #'ess-rdired--tabulated-list-entries text)) + (let ((entry (tabulated-list-get-id)) + (col (current-column))) + (tabulated-list-print) + (while (not (equal entry (tabulated-list-get-id))) + (forward-line)) + (move-to-column col)))))) + +(defun ess-rdired-cancel-auto-update-timer () + "Cancel the timer `ess-rdired-auto-update-timer'." + (setq ess-rdired-auto-update-timer + (cancel-timer ess-rdired-auto-update-timer))) + +(defun ess-rdired--tabulated-list-entries (text) + "Return a value suitable for `tabulated-list-entries' from TEXT." + (let (name class length size) + (if (not (string-match-p " +\"" text)) + ;; Normal-world + (setq text (split-string text " " t) + name (nth 0 text) + text (cdr text)) + ;; Else, someone has spaces in their variable names + (string-match "\"\\([^\"]+\\)" text) + (setq name (substring (match-string 0 text) 1) + text (split-string (substring text (1+ (match-end 0))) " " t))) + (setq class (nth 0 text) + length (nth 1 text) + size (nth 2 text)) + (list name + `[(,name + help-echo "mouse-2, RET: View this object" + action ess-rdired-view) + ,class + ,length + ,size]))) (defun ess-rdired-edit () - "Edit (fix) the object at point." + "Edit the object at point." (interactive) - (let ((objname (ess-rdired-object))) - (ess-command (concat "edit(" objname ")\n")))) + (ess-command (concat "edit(" (tabulated-list-get-id) ")\n"))) -(defun ess-rdired-view () +(defun ess-rdired-view (&optional _button) "View the object at point." (interactive) - (let ((objname (ess-rdired-object))) - (ess-execute (ess-rdired-get objname) - nil "R view" ))) + (ess-execute (ess-rdired-get (tabulated-list-get-id)) + nil "R view" )) (defun ess-rdired-get (name) "Generate R code to get the value of the variable NAME. @@ -253,27 +218,24 @@ name (concat "\"" name "\""))) - (defun ess-rdired-View () "View the object at point in its own buffer. Like `ess-rdired-view', but the object gets its own buffer name." (interactive) - (let ((objname (ess-rdired-object))) + (let ((objname (tabulated-list-get-id))) (ess-execute (ess-rdired-get objname) - nil (concat "R view " objname )))) + nil (concat "R view " objname )))) (defun ess-rdired-plot () "Plot the object on current line." (interactive) - (let ((objname (ess-rdired-object))) + (let ((objname (tabulated-list-get-id))) (ess-eval-linewise (format "plot(%s)" (ess-rdired-get objname))))) (defun ess-rdired-type () - "Run the mode() on command at point. -Named type because of similarity with the dired command bound to -y key." + "Run the mode() on command at point." (interactive) - (let ((objname (ess-rdired-object)) + (let ((objname (tabulated-list-get-id)) ;; create a temp buffer, and then show output in echo area (tmpbuf (get-buffer-create "**ess-rdired-mode**"))) (if objname @@ -281,211 +243,20 @@ (ess-command (concat "mode(" (ess-rdired-get objname) ")\n") tmpbuf ) (set-buffer tmpbuf) - (message (concat - objname ": " - (buffer-substring (+ 4 (point-min)) (1- (point-max))))) + (message "%s" (concat + objname ": " + (buffer-substring (+ 4 (point-min)) (1- (point-max))))) (kill-buffer tmpbuf))))) -(defun ess-rdired-delete (arg) - "Mark the current (or next ARG) objects for deletion. -If point is on first line, all objects are marked for deletion." - (interactive "p") - (ess-rdired-mark "D" arg)) - -(defun ess-rdired-undelete (arg) - "Unmark the current (or next ARG) objects. -If point is on first line, all objects will be unmarked." - (interactive "p") - (ess-rdired-mark " " arg)) - -(defun ess-rdired-mark (mark-char arg) - "Mark the object, using MARK-CHAR, on current line (or next ARG lines)." - ;; If we are on first line, mark all lines. - (let ((buffer-read-only nil) - move) - (if (eq (point-min) - (save-excursion (beginning-of-line) (point))) - (progn - ;; we are on first line, so make a note of point, and count - ;; how many objects we want to delete. Then at end of defun, - ;; restore point. - (setq move (point)) - (forward-line 1) - (setq arg (count-lines (point) (point-max))))) - (while (and (> arg 0) (not (eobp))) - (setq arg (1- arg)) - (beginning-of-line) - (progn - (insert mark-char) - (delete-char 1) - (forward-line 1))) - (if move - (goto-char move)))) - - -(defun ess-rdired-expunge () - "Delete the marked objects. -User is queried first to check that objects should really be deleted." - (interactive) - (let ((objs "rm(") - (count 0)) - (save-excursion - (goto-char (point-min)) (forward-line 1) - (while (< (count-lines (point-min) (point)) - (count-lines (point-min) (point-max))) - (beginning-of-line) - (if (looking-at "^D ") - (setq count (1+ count) - objs (concat objs (ess-rdired-object) ", " ))) - (forward-line 1) - )) - (if (> count 0) - ;; found objects to delete - (progn - (setq objs (concat - (substring objs 0 (- (length objs) 2)) - ")\n")) - (if (yes-or-no-p (format "Delete %d %s " count - (if (> count 1) "objects" "object"))) - (progn - (ess-eval-linewise objs nil nil nil 'wait) - (ess-rdired) - ))) - ;; else nothing to delete - (message "no objects set to delete") - ))) - -;; Fancy delete method, based on dired. Bit too much for our needs? -;; (defun ess-rdired-expunge () -;; "Delete the marked objects. -;; User is queried first to check that objects should really be deleted." -;; (interactive) -;; (let ((objs) -;; (cmd "rm(")) -;; (save-excursion -;; (goto-line 2) -;; (while (< (count-lines (point-min) (point)) -;; (count-lines (point-min) (point-max))) -;; (beginning-of-line) -;; (if (looking-at "^D ") -;; (progn -;; (setq objs (cons (ess-rdired-object) objs )) -;; (setq cmd (concat cmd (ess-rdired-object) ", ")) -;; )) -;; (forward-line 1) -;; )) -;; (if (> (length objs) 0) -;; ;; found objects to delete -;; (if -;; (dired-mark-pop-up "*RDired deletions*" 'delete -;; objs dired-deletion-confirmer -;; (format "delete %s " -;; (dired-mark-prompt nil objs))) -;; ;; should delete the objects. -;; (progn -;; (setq cmd (concat (substring cmd 0 (- (length cmd) 2)) -;; ")\n")) -;; (ess-command cmd) -;; (ess-rdired))) -;; ;; else nothing to delete -;; (message "no objects set to delete") -;; ))) - -(defun ess-rdired-quit () - "Quit the R dired buffer." - (interactive) - (kill-buffer ess-rdired-buffer)) - -(defun ess-rdired-revert-buffer (ignore noconfirm) - "Update the buffer list (in case object list has changed). -Arguments IGNORE and NOCONFIRM currently not used." - (ess-rdired)) - -(defun ess-rdired-help () - "Show help for `ess-rdired-mode'." - (interactive) - (describe-function 'ess-rdired-mode)) +(defalias 'ess-rdired-expunge #'ess-rdired-delete) -(defun ess-rdired-sort () - "Sort the rdired output according to one of the columns. -Rotate between the alternative sorting methods." +(defun ess-rdired-delete () + "Delete the object at point." (interactive) - (setq ess-rdired-sort-num (1+ ess-rdired-sort-num)) - (let ((buffer-read-only nil) - (beg (save-excursion - (goto-char (point-min)) - (forward-line 1) - (point))) - (end (point-max))) - (if (> ess-rdired-sort-num 4) - (setq ess-rdired-sort-num 1)) - (cond ((eq ess-rdired-sort-num 1) - (sort-fields 1 beg end)) - ((eq ess-rdired-sort-num 2) - (sort-fields 2 beg end)) - ((eq ess-rdired-sort-num 3) - (sort-numeric-fields 3 beg end)) - ((eq ess-rdired-sort-num 4) - (sort-numeric-fields 4 beg end))))) - -(defun ess-rdired-reverse () - "Reverse the current sort order." - (interactive) - (let ((buffer-read-only nil) - (beg (save-excursion - (goto-char (point-min)) - (forward-line 1) - (point))) - (end (point-max))) - (reverse-region beg end))) - -(defun ess-rdired-next-line (arg) - "Move down lines then position at object. -Optional prefix ARG says how many lines to move; default is one line." - (interactive "p") - (forward-line arg) - (ess-rdired-move-to-object)) - -(defun ess-rdired-previous-line (arg) - "Move up lines then position at object. -Optional prefix ARG says how many lines to move; default is one line." - (interactive "p") - (forward-line (- (or arg 1))) ; -1 if arg was nil - (ess-rdired-move-to-object)) - -(defun ess-rdired-move-to-object () - "Put point at start of object." - (beginning-of-line) - (forward-char 2) - ) - -(defun ess-rdired-mouse-view (event) - "In rdired, visit the object on the line you click on." - (interactive "e") - (let (window pos) - (save-excursion - (setq window (posn-window (event-end event)) - pos (posn-point (event-end event))) - (if (not (windowp window)) - (error "No file chosen")) - (set-buffer (window-buffer window)) - (goto-char pos) - (ess-rdired-view)))) - -(defun ess-rdired-insert-set-properties (beg end) - "Add mouse highlighting to each object name in the R dired buffer." - (save-excursion - (goto-char beg) - (while (< (point) end) - (ess-rdired-move-to-object) - (add-text-properties - (point) - (save-excursion - (search-forward " ") - (1- (point))) - '(mouse-face highlight - help-echo "mouse-2: view object in other window")) - (forward-line 1)))) + (let ((objname (tabulated-list-get-id))) + (when (yes-or-no-p (format "Really delete %s? " objname)) + (ess-eval-linewise (format "rm(%s)" (ess-rdired-quote objname)) nil nil nil t) + (revert-buffer)))) (defun ess-rdired-switch-process () "Switch to examine different *R* process. @@ -496,6 +267,25 @@ (ess-switch-process) (ess-rdired)) +(defun ess-rdired--length-predicate (A B) + "Enable sorting by length in `ess-rdired' buffers. +Return t if A's length is < than B's length." + (let ((lenA (aref (cadr A) 2)) + (lenB (aref (cadr B) 2))) + (< (string-to-number lenA) (string-to-number lenB)))) + +(defun ess-rdired--size-predicate (A B) + "Enable sorting by size in `ess-rdired' buffers. +Return t if A's size is < than B's size." + (let ((lenA (aref (cadr A) 3)) + (lenB (aref (cadr B) 3))) + (< (string-to-number lenA) (string-to-number lenB)))) + +(define-obsolete-function-alias 'ess-rdired-quit #'quit-window "ESS 19.04") +(define-obsolete-function-alias 'ess-rdired-next-line #'forward-to-indentation "ESS 19.04") +(define-obsolete-function-alias 'ess-rdired-previous-line #'backward-to-indentation "ESS 19.04") +(define-obsolete-function-alias 'ess-rdired-move-to-object #'back-to-indentation "ESS 19.04") + (provide 'ess-rdired) ;;; ess-rdired.el ends here diff -Nru ess-18.10.2/lisp/ess-r-flymake.el ess-18.10.2+git20220915.f45542e/lisp/ess-r-flymake.el --- ess-18.10.2/lisp/ess-r-flymake.el 2018-11-10 09:41:11.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/lisp/ess-r-flymake.el 2022-10-15 08:06:36.000000000 +0000 @@ -1,43 +1,47 @@ ;;; ess-r-flymake.el --- A ess-r Flymake backend -*- lexical-binding: t; -*- -;; -;; Copyright (C) 2018 J. Alexander Branham (alex DOT branham AT gmail DOT com) -;; Copyright (C) 2018 ESS-core team + +;; Copyright (C) 2018-2020 Free Software Foundation, Inc. ;; Maintainer: ESS-core + + +;; This file is part of GNU Emacs. + +;;; License: ;; -;; This file is NOT part of GNU Emacs. -;; -;; This is free software; you can redistribute it and/or modify it under -;; the terms of the GNU General Public License as published by the Free -;; Software Foundation; either version 3, or (at your option) any later -;; version. -;; -;; This is distributed in the hope that it will be useful, but WITHOUT -;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -;; FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -;; for more details. +;; This program is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. +;; +;; This program is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. ;; ;; You should have received a copy of the GNU General Public License -;; along with GNU Emacs; see the file COPYING. If not, write to the -;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, -;; MA 02110-1301 USA. -;; +;; along with this program. If not, see +;; + ;;; Commentary: -;; + ;; Flymake is the built-in Emacs package that supports on-the-fly -;; syntax checking. This file adds support for this in R-mode by +;; syntax checking. This file adds support for this in ess-r-mode by ;; relying on the lintr package, available on CRAN and currently ;; hosted at https://github.com/jimhester/lintr. -;; -;; It is enabled by default. -;; + ;;; Code: (eval-when-compile (require 'cl-lib)) -(require 'ess-custom) (require 'ess-inf) (require 'flymake) -;; TODO: When remove support for Emacs 24, remove the nil t: -(require 'project nil t) + +;; Appease the byte compiler for Emacs 25. Remove after dropping +;; support for Emacs 25. +(declare-function flymake-diag-region "flymake") +(declare-function flymake-make-diagnostic "flymake") +(declare-function flymake--overlays "flymake") +(declare-function ess-r-project "ess-r-mode") +(declare-function ess-r-package-project "ess-r-package") (defcustom ess-r-flymake-linters '("closed_curly_linter = NULL" @@ -57,8 +61,8 @@ "trailing_whitespace_linter = NULL") "Default linters to use. Can be either a string with R expression to be used as -is (e.g. 'lintr::default_linters'). Or a list of strings where -each element is passed as argument to 'lintr::with_defaults'." +is (e.g. `lintr::default_linters'). Or a list of strings where +each element is passed as argument to `lintr::with_defaults'." :group 'ess-R :type '(choice string (repeat string)) :package-version '(ess . "18.10")) @@ -81,8 +85,8 @@ if (!suppressWarnings(require(lintr, quietly=T))) { cat('@@error: @@`lintr` package not installed') } else { - if (packageVersion('lintr') <= '1.0.2') { - cat('@@error: @@Need `lintr` version > v1.0.2') + if (packageVersion('lintr') <= '1.0.3') { + cat('@@error: @@Need `lintr` version > v1.0.3') } else { tryCatch(lintr::lint(commandArgs(TRUE), ...), error = function(e) { @@ -95,20 +99,24 @@ (defun ess-r--find-lintr-file () "Return the absolute path to the .lintr file. Check first the current directory, then the project root, then -the user's home directory. Return nil if we couldn't find a .lintr file." - (cond (;; current directory - (file-readable-p (expand-file-name ".lintr" default-directory)) - (expand-file-name ".lintr" default-directory)) - ;; Project root - ((and (fboundp 'ess-r-package-project) - (ess-r-package-project)) (expand-file-name ".lintr" (cdr (ess-r-package-project)))) - ((and (fboundp 'project-roots) ; checking that project-roots is defined can be removed when drop Emacs 24 - (project-current) - (project-roots (project-current))) - (expand-file-name ".lintr" (car (project-roots (project-current))))) - ;; Home directory - ((file-readable-p (expand-file-name ".lintr" (getenv "HOME"))) - (expand-file-name ".lintr" (getenv "HOME"))))) +the package root, then the user's home directory. Return nil if +we couldn't find a .lintr file." + ;; VS[2022-01-26]: Can't this entire thing be replaced by + ;; `(locate-dominating-file ".lintr")`? + (let* ((cur-file (expand-file-name ".lintr" default-directory)) + (pkg (cdr (ess-r-package-project))) + (pkg-file (and pkg (expand-file-name ".lintr" pkg))) + (proj (ess-r-project)) + (proj-file (and proj (expand-file-name ".lintr" proj))) + (home-file (expand-file-name ".lintr" (getenv "HOME")))) + (cond ((file-readable-p cur-file) + cur-file) + ((and proj-file (file-readable-p proj-file)) + proj-file) + ((and pkg-file (file-readable-p pkg-file)) + pkg-file) + ((file-readable-p home-file) + home-file)))) (defun ess-r--flymake-linters () "If `ess-r-flymake-linters' is a string, use that. @@ -234,9 +242,9 @@ ;; Enable flymake in Emacs 26+ (when (<= 26 emacs-major-version) (if (eval-when-compile (<= 26 emacs-major-version)) - (add-hook 'ess-mode-hook #'ess-r-setup-flymake) + (add-hook 'ess-r-mode-hook #'ess-r-setup-flymake) (when ess-use-flymake - (display-warning 'ess "ESS was compiled with older version of emacs;\n `ess-r-flymake' won't be available")))) + (display-warning 'ess "ESS was compiled with older version of Emacs;\n `ess-r-flymake' won't be available")))) (provide 'ess-r-flymake) diff -Nru ess-18.10.2/lisp/ess-r-gui.el ess-18.10.2+git20220915.f45542e/lisp/ess-r-gui.el --- ess-18.10.2/lisp/ess-r-gui.el 2018-11-10 09:41:11.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/lisp/ess-r-gui.el 1970-01-01 00:00:00.000000000 +0000 @@ -1,207 +0,0 @@ -;;; ess-r-gui.el --- Run Rgui on Windows as an inferior Emacs process - -;; Copyright (C) 2008 A.J. Rossini, Richard M. Heiberger, Martin -;; Maechler, Kurt Hornik, Rodney Sparapani, and Stephen Eglen. - -;; Author: Richard M. Heiberger -;; Created: 10 Mar 2008 -;; Maintainer: ESS-core - -;; 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 -;; https://www.r-project.org/Licenses/ - -;;; Commentary: - -;; In Rgui: -;; > library(tcltk2) ## >= 1.0-6 -;; > .ess.command <- function() source("c:/temp/ess-tempfile.R", echo=TRUE) -;; > tclFun(.ess.command) -;; [1] "R_call 0203A04C" - -;;; Code: - -(require 'ess-dde) ;; needed here because we override several definitions -(require 'ess-r-mode) - -(defun ess-ddeclient-p () - "Returns the name of the ddeclient iff `ess-local-process-name' -is associated with an `inferior-ess-ddeclient', and nil if the -ess-process is running as an ordinary inferior process. Alway -nil on Unix machines." - (interactive) - (if ess-microsoft-p - (let ((ess-ddeclient (ess-get-process-variable 'inferior-ess-ddeclient))) - (if (not (equal ess-ddeclient (default-value 'inferior-ess-ddeclient))) - ess-ddeclient)))) - -(defvar ess-command-file "c:/temp/ess-tempfile.R" - "File name for communication with Rgui.") -(defvar inferior-ess-execdde - (concat (getenv "R_HOME") "/site-library/tcltk2/bin/execdde.exe") - "Full pathname to execdde executable.") -(defvar ess-rgui-command " -s TclEval -t R -c .ess.command > NUL" - "Command to `inferior-ess-execdde' that will make Rgui read the command file.") - - -(defun ess-eval-region-execdde (start end even-empty) - "Loop through lines in region and send them to ESS via execdde." - (setq ;; set the following variables for the current ddeESS process. - inferior-ess-ddeclient (ess-get-process-variable 'inferior-ess-ddeclient) - ) - (write-region start end ess-command-file nil nil 'no-message) - (call-process-shell-command - (concat inferior-ess-execdde ess-rgui-command)) - ) - - -(if (not (getenv "R_HOME")) (setenv "R_HOME" "c:/progra~1/R/R-2.6.1")) -;; ^^^^^^^^^ FIXME! do something better -(defvar inferior-Rgui-program "cmd" "Rgui program name") -(defvar Rgui-pager "emacsclientw.exe" "Rgui pager program") -(defvar inferior-ess-language-start-rgui - "options(chmhelp=FALSE, htmlhelp=FALSE, help_type='text'); require(tcltk2)" - "additional arguments to rgui") - -(defun ess-dde-rgui-send-region (proc start end &optional visibly message) - "Loop through lines in region and send them to ESS via ddeclient. - -PROC, VISIBLY and MESSAGE are ignored." - (setq ;; set the following variables for the current ddeESS process. - inferior-ess-ddeclient (ess-get-process-variable 'inferior-ess-ddeclient) - inferior-ess-client-name (ess-get-process-variable 'inferior-ess-client-name) - inferior-ess-client-command (ess-get-process-variable 'inferior-ess-client-command)) - (narrow-to-region start end) - (goto-char (point-min)) - - (if (equal inferior-ess-ddeclient "execdde") - (ess-eval-region-execdde start end 'even-empty) - - (let ((beg)) - (while (or (< (point) (point-max)) - (= 1 (point-max))) - (setq beg (point)) - (end-of-line) - ;; call-process-region won't send over a 0-character line. - ;; We go outside the loop to create a 1-character line " " in the - ;; *ESS-temporary* buffer - (if (= beg (point)) ;; do empty line outside loop - (ess-dde-eval-linewise " " nil 'eob t) - (call-process-region - beg (point) - inferior-ess-ddeclient nil nil nil - inferior-ess-client-name inferior-ess-client-command)) - (forward-line 1)))) - (widen)) - - - -(defvar Rgui-customize-alist - (append - '((ess-local-customize-alist . 'Rgui-customize-alist) - (ess-dialect . "R") - (ess-suffix . "R") - (ess-dump-filename-template . (replace-regexp-in-string - "S$" ess-suffix ; in the one from custom: - ess-dump-filename-template-proto)) - (ess-mode-syntax-table . ess-r-syntax-table) - (ess-mode-editing-alist . ess-r-editing-alist) - (ess-change-sp-regexp . ess-r-change-sp-regexp) - (ess-help-sec-regex . ess-help-r-sec-regex) - (ess-help-sec-keys-alist . ess-help-r-sec-keys-alist) - (ess-function-pattern . ess-r-function-pattern) - (ess-object-name-db-file . "ess-r-namedb.el" ) - (ess-send-region-function . #'ess-dde-rgui-send-region) - (ess-load-file-function . #'ess-dde-load-file) - (ess-command-function . #'ess-dde-command) - (ess-eval-linewise-function . #'ess-dde-eval-linewise) - (ess-dump-object-function . #'ess-dde-dump-object) - (ess-read-object-name-function . #'ess-dde-read-object-name) - (ess-find-help-file-function . #'ess-dde-find-help-file) - (ess-display-help-on-object-function . #'ess-dde-display-help-on-object) - (inferior-ess-program . inferior-Rgui-program) - (inferior-ess-objects-command . inferior-ess-r-objects-command) - (inferior-ess-font-lock-keywords . 'inferior-ess-r-font-lock-keywords) - (inferior-ess-search-list-command . "search()\n") - (inferior-ess-help-command . "help(\"%s\")\n") - (inferior-ess-help-filetype . nil) ;; "chm") ;;? - (inferior-ess-exit-command . "q()") - (inferior-ess-exit-prompt . "Save workspace image? [y/n/c]: ") - (inferior-ess-primary-prompt . "\\([A-Z/][][A-Za-z0-9./]*\\)*[>$] ") - (inferior-ess-secondary-prompt . "+ ?") - ;;harmful for shell-mode's C-a: -- but "necessary" for ESS-help? - (inferior-ess-start-file . nil) ;; "~/.ess-R" - (inferior-ess-start-args . "") - (inferior-ess-ddeclient . "execdde") - (ess-STERM . "ddeSS") - (ess-editor . ess-r-editor) - (ess-pager . Rgui-pager) - ) - S-common-cust-alist) - "Variables to customize for Rgui") - - -(defun Rgui (&optional proc-name) - "Call 'Rgui for Windows'. Put R in an independent MS-Window (R -persists even if the '(ddeESS [R])' window is killed in emacs). -Do this by creating a comint process that calls cmd. This is a -placeholder buffer with mode '(ddeESS [R])'. Commands sent from -an (ESS[S] [R]) buffer to this process will be sourced into the -independent Rgui R Console." - (interactive) - (save-excursion - (setq ess-customize-alist Rgui-customize-alist) - (ess-write-to-dribble-buffer - (format "\n(Rgui): ess-dialect=%s, buf=%s\n" ess-dialect - (current-buffer))) - (setq ess-customize-alist ; change inferior-ess-primary-prompt - (append ess-customize-alist '((inferior-ess-primary-prompt . "^")))) - (when - ;; Silence byte compiler warns about this function - (fboundp 'w32-short-file-name) - (let ((default-ddeclient (default-value 'inferior-ess-ddeclient))) - (cd (w32-short-file-name (directory-file-name default-directory))) - ;; (setenv "S_PROJ" default-directory) - (setq-default inferior-ess-ddeclient "execdde") - (inferior-ess) - (setq-default inferior-ess-ddeclient default-ddeclient) - (sleep-for 2) ; need to wait, else working too fast! - )) - (setq comint-process-echoes nil) - - ;; *R* buffer - (goto-char (point-min)) - (insert - "This is a placeholder buffer. You can't type anything here.\n -You may ignore the 'options' error in this buffer.\n\n") - (goto-char (point-max)) - (set-process-coding-system (get-process ess-local-process-name) 'raw-text-dos 'raw-text-unix) - (setq buffer-read-only t) ; force buffer to be read-only - (setq mode-name "ddeESS") - - ;; initialization - (set-buffer (find-file-noselect ess-command-file 'nowarn)) - (erase-buffer) - (setq ;; set the following variables for the current ddeESS process. - inferior-ess-language-start (ess-get-process-variable 'inferior-ess-language-start)) - (if inferior-ess-language-start - (insert inferior-ess-language-start)) - (if inferior-ess-language-start-rgui - (insert (concat "\n" inferior-ess-language-start-rgui))) - (save-buffer 0) - (call-process-shell-command - (concat inferior-ess-execdde ess-rgui-command)) - )) - -;;; ess-r-gui.el ends here diff -Nru ess-18.10.2/lisp/ess-r-mode.el ess-18.10.2+git20220915.f45542e/lisp/ess-r-mode.el --- ess-18.10.2/lisp/ess-r-mode.el 2018-11-10 09:41:11.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/lisp/ess-r-mode.el 2022-10-15 08:06:36.000000000 +0000 @@ -1,30 +1,27 @@ -;;; 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. +;;; ess-r-mode.el --- R customization -*- lexical-binding: t; -*- +;; Copyright (C) 1997-2020 Free Software Foundation, Inc. ;; Author: A.J. Rossini ;; Created: 12 Jun 1997 ;; Maintainer: ESS-core -;; Keywords: languages, statistics - -;; This file is part of ESS. +;; This file is part of GNU Emacs. -;; This file is free software; you can redistribute it and/or modify +;;; License: +;; +;; This program is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 2, or (at your option) -;; any later version. - -;; This file is distributed in the hope that it will be useful, +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. +;; +;; This program is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. - -;; A copy of the GNU General Public License is available at -;; https://www.r-project.org/Licenses/ +;; +;; You should have received a copy of the GNU General Public License +;; along with this program. If not, see +;; ;;; Commentary: @@ -33,10 +30,10 @@ ;;; Code: +(eval-when-compile + (require 'subr-x)) (require 'cl-lib) (require 'compile) -(require 'easymenu) -(require 'eldoc) (require 'ess-mode) (require 'ess-help) (require 'ess-s-lang) @@ -45,120 +42,167 @@ (require 'ess-r-syntax) (require 'ess-r-package) (require 'ess-trns) -(when (>= emacs-major-version 25) (require 'ess-r-xref)) ;; Xref API was added in Emacs 25.1 -;; TODO: Remove when we drop support for Emacs 24: -(declare-function ess-r-xref-backend "ess-r-xref") +(require 'ess-r-xref) (when (>= emacs-major-version 26) (require 'ess-r-flymake)) ; Flymake rewrite in Emacs 26 +(declare-function ess-rdired "ess-rdired" ()) + +(defcustom ess-r-mode-hook nil + "Hook run when entering `ess-r-mode'." + :options '(electric-layout-local-mode) + :type 'hook + :group 'ess-R) + +;; Define and run old hook for backward compatibility. We don't +;; obsolete it with warnings because this is a historically important +;; user-facing variable and it would not be worth the trouble. +(defvar R-mode-hook nil + "This variable is obsolete since ESS 19.04; +use `ess-r-mode-hook' instead.") +(add-hook 'ess-r-mode-hook (lambda () (run-hooks 'R-mode-hook))) + +(defcustom ess-r-fetch-ESSR-on-remotes nil + "If non-nil, when loading ESSR, fetch it from the GitHub repository. +Otherwise source from local ESS installation. When the value is +\\='ess-remote, fetch only with ess-remote's and not with TRAMP +connections. When t, always fetch from remotes. Change this +variable when loading ESSR code on remotes fails for you. + +Fetching happens once per new ESSR version. The archive is stored +in ~/.config/ESSR/ESSRv[VERSION].rds file. You can download and +place it there manually if the remote has restricted network +access." + :type '(choice (const nil :tag "Never") + (const ess-remote :tag "With ess-remote only") + (const t :tag "Always")) + :group 'ess-R) + +;; Silence the byte compiler +(defvar add-log-current-defun-header-regexp) + ;; TODO: Refactor so as to not rely on dynamic scoping. After that ;; refactor, also remove the file-local-variable byte-compile-warnings ;; (not lexical) at the bottom. -(defvar block) (defvar containing-sexp) (defvar indent-point) -(defvar infinite) -(defvar last-newline) -(defvar last-pos) -(defvar offset) -(defvar prefix-break) (defvar prev-containing-sexp) -(defvar start) -(defvar start-pos) -(defvar style) -(defvar type) + +(define-obsolete-variable-alias 'ess-r-versions 'ess-r-runner-prefixes "ESS 19.04") +(defcustom ess-r-runner-prefixes + (let ((r-ver '("R-1" "R-2" "R-3" "R-4" "R-5" "R-6" "R-7" "R-devel" "R-patched"))) + (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 variable +`exec-path', a 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 `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 variable `exec-path' more than once), they are ignored by +calling `delete-dups'. Set this variable to nil to disable +searching for other versions of R. Setting this variable directly +does not take effect; use either \\[customize-option] or set the +value by using `ess-r-runners-reset'." + :group 'ess-R + :package-version '(ess . "19.04") + :type '(repeat string) + :set #'ess-r-runners-reset + ;; Use `custom-initialize-default' since we call + ;; `ess-r-define-runners' at the end of this file directly. + :initialize #'custom-initialize-default) ;;*;; Mode definition ;;;*;;; UI (Keymaps / Menus) -;;;###autoload (defvar ess-dev-map (let (ess-dev-map) (define-prefix-command 'ess-dev-map) - (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) + (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 "" #'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 "" #'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-check-map (let (ess-r-package-check-map) (define-prefix-command 'ess-r-package-check-map) - (define-key ess-r-package-check-map "\C-c" 'ess-r-devtools-check-package) - (define-key ess-r-package-check-map "c" 'ess-r-devtools-check-package) - (define-key ess-r-package-check-map "\C-w" 'ess-r-devtools-check-with-winbuilder) - (define-key ess-r-package-check-map "w" 'ess-r-devtools-check-with-winbuilder) - (define-key ess-r-package-check-map "h" 'ess-r-rhub-check-package) + (define-key ess-r-package-check-map "\C-c" #'ess-r-devtools-check-package) + (define-key ess-r-package-check-map "c" #'ess-r-devtools-check-package) + (define-key ess-r-package-check-map "\C-w" #'ess-r-devtools-check-with-winbuilder) + (define-key ess-r-package-check-map "w" #'ess-r-devtools-check-with-winbuilder) + (define-key ess-r-package-check-map "h" #'ess-r-rhub-check-package) ess-r-package-check-map) "Keymap for R package checks.") (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-e" 'ess-r-devtools-execute-command) - (define-key ess-r-package-dev-map "e" 'ess-r-devtools-execute-command) - (define-key ess-r-package-dev-map "\C-b" 'ess-r-devtools-build) - (define-key ess-r-package-dev-map "b" 'ess-r-devtools-build) + (define-key ess-r-package-dev-map "\C-s" #'ess-r-set-evaluation-env) + (define-key ess-r-package-dev-map "s" #'ess-r-set-evaluation-env) + (define-key ess-r-package-dev-map "\C-a" #'ess-r-devtools-execute-command) + (define-key ess-r-package-dev-map "a" #'ess-r-devtools-execute-command) + (define-key ess-r-package-dev-map "\C-e" #'ess-r-devtools-execute-command) + (define-key ess-r-package-dev-map "e" #'ess-r-devtools-execute-command) + (define-key ess-r-package-dev-map "\C-b" #'ess-r-devtools-build) + (define-key ess-r-package-dev-map "b" #'ess-r-devtools-build) (define-key ess-r-package-dev-map "\C-c" 'ess-r-package-check-map) - (define-key ess-r-package-dev-map "c" 'ess-r-package-check-map) - (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 "g" 'ess-r-devtools-install-github) - (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-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) + (define-key ess-r-package-dev-map "c" 'ess-r-package-check-map) + (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 "g" #'ess-r-devtools-install-github) + (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-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 @@ -217,31 +261,30 @@ (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-mode-map + (let ((map (make-sparse-keymap))) + (define-key map (kbd "C-c C-=") #'ess-cycle-assign) + (define-key map "\M-?" #'ess-complete-object-name) + (define-key map (kbd "C-c C-.") 'ess-rutils-map) + map)) + +(defvar ess-r-mode-syntax-table + (let ((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 ?` "\"" table) + (modify-syntax-entry ?% "\"" table) + ;; Underscore is valid in R symbols + (modify-syntax-entry ?_ "_" table) + (modify-syntax-entry ?: "." table) + (modify-syntax-entry ?@ "." table) + (modify-syntax-entry ?$ "." table) + (modify-syntax-entry ?\\ "." table) + table) + "Syntax table for `ess-r-mode'.") (defvar ess-r-completion-syntax-table - (let ((table (make-syntax-table ess-r-syntax-table))) + (let ((table (copy-syntax-table ess-r-mode-syntax-table))) (modify-syntax-entry ?. "_" table) (modify-syntax-entry ?: "_" table) (modify-syntax-entry ?$ "_" table) @@ -256,40 +299,99 @@ about which objects are exported and which stay hidden in the namespace.") -(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)) +;; The syntax class for '\' is punctuation character to handle R 4.1 +;; lambdas. Inside strings it should be treated as an escape +;; character which we ensure here. +(defun ess-r--syntax-propertize-backslash () + (when (nth 3 (save-excursion (syntax-ppss (1- (point))))) + (string-to-syntax "\\"))) + +;; Adapted from `python-syntax-stringify' +(defun ess-r--syntax-propertize-raw-string-opening () + (let* ((raw-beg (match-beginning 0)) + (quote-beg (1+ raw-beg)) + (ppss (save-excursion (goto-char raw-beg) (syntax-ppss))) + (string-start (and (eq t (nth 3 ppss)) (nth 8 ppss)))) (cond - ((eq (nth 3 state) ?%) - (if (eq (point) (1- string-end)) - (when (cdr (assq 'ess-fl-keyword:operators ess-R-font-lock-keywords)) - 'ess-operator-face) - (if (cdr (assq 'ess-R-fl-keyword:%op% ess-R-font-lock-keywords)) - 'ess-%op%-face - 'default))) - ((save-excursion - (and (cdr (assq 'ess-R-fl-keyword:fun-defs ess-R-font-lock-keywords)) - (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 (cdr (assq 'ess-fl-keyword:fun-calls ess-R-font-lock-keywords)) - (ess-goto-char string-end) - (ess-looking-at "("))) - ess-function-call-face) - ((eq (nth 3 state) ?`) - 'default) - ((nth 3 state) - font-lock-string-face) - (t - font-lock-comment-face)))) + ;; Inside a comment + ((nth 4 ppss) + nil) + ;; This set of quotes delimits the start of a string + ((null string-start) + (put-text-property quote-beg (1+ quote-beg) + 'syntax-table (string-to-syntax "|")))))) + +(defun ess-r--syntax-propertize-raw-string-closing () + (let* ((quote-end (match-end 0)) + (quote-chr (aref (match-string 3) 0)) + (dashes (match-string 2)) + (matching-delim (pcase (match-string 1) + (`")" ?\() (`"}" ?{) (`"]" ?\[))) + (ppss (save-excursion (goto-char quote-end) (syntax-ppss))) + (string-start (and (eq t (nth 3 ppss)) (nth 8 ppss)))) + (when string-start + (save-match-data + (save-excursion + (goto-char string-start) + (when (equal (char-after) quote-chr) + (forward-char) + (re-search-forward "-*" nil t) + (let ((matching-dashes (match-string 0))) + (when (or (not matching-dashes) + (string= matching-dashes dashes)) + (when (equal (char-after) matching-delim) + (put-text-property (1- quote-end) quote-end + 'syntax-table (string-to-syntax "|"))))))))))) + +(defconst ess-r--syntax-propertize-function + (syntax-propertize-rules + ("[rR]\\([\"']\\)\\(-*\\)\\([([{]\\)" + (0 (ignore (ess-r--syntax-propertize-raw-string-opening)))) + ("\\([])}]\\)\\(-*\\)\\([\"']\\)" + (0 (ignore (ess-r--syntax-propertize-raw-string-closing)))) + ("\\\\" + (0 (ess-r--syntax-propertize-backslash))))) + +(defun ess-r-font-lock-syntactic-face-function (state) + (if (nth 3 state) + ;; string case + (let ((string-end (save-excursion + (ess-goto-char (nth 8 state)) + (ess-forward-sexp) + (point)))) + (cond + ((eq (nth 3 state) ?%) + (if (eq (point) (1- string-end)) + (when (cdr (assq 'ess-fl-keyword:operators ess-R-font-lock-keywords)) + 'ess-operator-face) + (if (cdr (assq 'ess-R-fl-keyword:%op% ess-R-font-lock-keywords)) + 'ess-%op%-face + nil))) + ((save-excursion + (and (cdr (assq 'ess-R-fl-keyword:fun-defs ess-R-font-lock-keywords)) + (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 (cdr (assq 'ess-fl-keyword:fun-calls ess-R-font-lock-keywords)) + (ess-goto-char string-end) + (ess-looking-at "("))) + ess-function-call-face) + ((eq (nth 3 state) ?`) + nil) + (t + font-lock-string-face))) + font-lock-comment-face)) + +;; Don't fontify backquoted symbols as strings +(defun inferior-ess-r-font-lock-syntactic-face-function (state) + (if (nth 3 state) + (if (eq (nth 3 state) ?`) + nil + font-lock-string-face) + font-lock-comment-face)) (defvar ess-r--non-fn-kwds '("in" "else" "break" "next" "repeat")) @@ -340,25 +442,12 @@ '((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-format-command-alist . ess-r-format-command-alist) (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) @@ -369,31 +458,17 @@ (inferior-ess-objects-command . inferior-ess-r-objects-command) (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 . "") - (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 . 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 . ess-r-prettify-symbols)) + (ess-pager . ess-r-pager)) S-common-cust-alist) - "Variables to customize for R -- set up later than Emacs initialization.") + "Variables to customize for R.") -;; VS[24-08-2018]: FIXME: make initialization of custom-alist tail-to-top and -;; put this into the above alist -(setcdr (assoc 'ess-font-lock-keywords ess-r-customize-alist) - (quote 'ess-R-font-lock-keywords)) -(setcdr (assoc 'inferior-ess-font-lock-keywords ess-r-customize-alist) - (quote 'inferior-ess-r-font-lock-keywords)) - -(defvar ess-r-build-tags-command +(cl-defmethod ess-build-tags-command (&context (ess-dialect "R")) + "Return tags command for R." "rtags('%s', recursive = TRUE, pattern = '\\\\.[RrSs](rw)?$',ofile = '%s')") (defvar ess-r-traceback-command @@ -403,6 +478,14 @@ (defvar ess-r-call-stack-command "traceback(1)\n") +(defun ess-r-format-command (cmd &rest args) + (let ((sentinel (alist-get 'output-delimiter args))) + (format ".ess.command(local(%s), '%s')\n" cmd sentinel))) + +(defvar ess-r-format-command-alist + '((fun . ess-r-format-command) + (use-delimiter . t))) + (defvar ess-r-dump-filename-template (replace-regexp-in-string "S$" "R" ess-dump-filename-template-proto)) @@ -413,14 +496,6 @@ (defvar ess-r-company-backends '((company-R-library company-R-args company-R-objects :separate))) -(defvar ess-r-editing-alist - ;; copy the S-alist and modify : - (let ((S-alist (copy-alist S-editing-alist))) - (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.") @@ -438,57 +513,26 @@ ) "Alist of (key . string) pairs for use in help section searching.") -(defvar ess-r-error-regexp-alist '(R R1 R2 R3 R4 R-recover) +(defvar ess-r-error-regexp-alist '(R R1 R2 R3 R4 R-rlang 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 - ;; valgrind style (stl_numeric.h:183) - '(R1 "(\\([^ ):\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 - ;; Starts at bol or with ": " (patterns 3,4,5,6,9) - '(R3 "\\(?:^ *\\|: ?\\)\\([^-+[:digit:] \t\n]:?[^: \t\n]*\\):\\([0-9]+\\):\\(?:\\([0-9]+\\):\\)?" 1 2 3 2 1)) - -(add-to-list 'compilation-error-regexp-alist-alist +(dolist (l '(;; Takes precedence over R1 below in English locales, and allows spaces in file path + (R "\\(\\(?: at \\|(@\\)\\([^#()\n:]+\\)[#:]\\([0-9]+\\)\\)" 2 3 nil 2 1) + ;; valgrind, testthat, rlang/shiny style + ;; e.g. (stl_numeric.h:183), (test-parsers.R:238:3) [.../R/file.R#158] + (R1 "\\s(\\([^0-9][^ ():\n]+\\)[#:]\\([0-9]+\\)[#:]?\\([0-9]+\\)?\\s)" 1 2 nil 2) + (R2 "(\\(\\w+ \\([^())\n]+\\)#\\([0-9]+\\)\\))" 2 3 nil 2 1) + ;; Precedes R4 and allows spaces in file path, Starts at bol or with ": " (patterns 3,4,5,6,9) + (R3 "\\(?:^ *\\|: ?\\)\\([^-+[:digit:] \t\n]:?[^: \t\n]*\\):\\([0-9]+\\):\\(?:\\([0-9]+\\):\\)?" 1 2 3 2 1) ;; Don't start with digit; no 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)) - - -(defvar ess-r-versions - (let ((r-ver '("R-1" "R-2" "R-3" "R-devel" "R-patched"))) - (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 -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.") + (R4 "\\([^-+ [:digit:]][^: \t\n]+\\):\\([0-9]+\\):\\([0-9]+\\):" 1 2 3 2 1) + (R-rlang "^ *[0-9]+\\..* \\(\\([^ :]+\\):\\([0-9]+\\):\\([0-9]+\\)\\)$" 2 3 4 nil 1) + (R-recover " *[0-9]+: +\\([^:\n\t]+?\\)#\\([0-9]+:\\)" 1 2 nil 2 1))) + (cl-pushnew l compilation-error-regexp-alist-alist)) (define-obsolete-variable-alias 'ess-r-versions-created 'ess-r-created-runners "ESS 18.10") (defvar ess-r-created-runners nil - "List of R-versions found from `ess-r-versions' on the system.") + "List of R-versions found from `ess-r-runner-prefixes' on the system.") ;;;*;;; Mode init @@ -497,13 +541,6 @@ (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 run-ess-r (&optional start-args) "Call 'R', the 'GNU S' system from the R Foundation. @@ -520,10 +557,20 @@ (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)) + (unless (or (file-remote-p default-directory) + (when ess-startup-directory + (file-remote-p (if (symbolp ess-startup-directory) + (symbol-value ess-startup-directory) + ess-startup-directory))) + ;; TODO: Once we drop Emacs 26 support, can probably + ;; just use the REMOTE argument of `executable-find'. + (executable-find inferior-ess-r-program)) + (display-warning 'ess (format "%s could not be found on the system. Try running `run-ess-r-newest' instead, which searches your system for R." inferior-ess-r-program) :error) + (user-error "%s program not found" inferior-ess-r-program)) (let* ((r-always-arg (if (or ess-microsoft-p (eq system-type 'cygwin)) "--ess " - ;; else: "unix alike" + ;; else: "Unix alike" (if (not ess-R-readline) "--no-readline "))) (start-args (cond ((stringp start-args) @@ -542,143 +589,292 @@ (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)) + (debug (string-match-p " -d \\| --debugger=" 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) - (when (>= emacs-major-version 25) - (add-hook 'xref-backend-functions #'ess-r-xref-backend 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) - (comint-goto-process-mark)) - - (ess-write-to-dribble-buffer - (format "(R): inferior-ess-language-start=%s\n" - inferior-ess-language-start)))) + (let ((inf-buf (inferior-ess r-start-args ess-r-customize-alist debug))) + (with-current-buffer inf-buf + (ess-process-put 'funargs-pre-cache ess-r--funargs-pre-cache) + (if debug + (progn + ;; We need to use callback, because R might start with a gdb process + (ess-process-put 'callbacks '(inferior-ess-r--init-callback)) + ;; Trigger the callback + (process-send-string (get-buffer-process inf-buf) "r\n")) + (ess-wait-for-process) + (ess-r-initialize-on-start) + (comint-goto-process-mark)) + (ess-write-to-dribble-buffer + (format "(R): inferior-ess-language-start=%s\n" + inferior-ess-language-start))) + inf-buf))) ;;;###autoload -(defalias 'R #'run-ess-r) +(defun R (&optional start-args) + (interactive "P") + ;; FIXME: Current ob-R expects current buffer set to process buffer + (set-buffer (run-ess-r start-args))) + +(defun inferior-ess-r--init-callback (_proc _name) + (ess-r-initialize-on-start)) -(defun inferior-ess-r--adjust-startup-directory (dir dialect) - "Adjust startup directory DIR if DIALECT is R. -If in a package project, prefer the tests directory but only if -the package directory was selected in the first place." - (if (string= dialect "R") - (let* ((project-dir (cdr (ess-r-package-project))) - (tests-dir (expand-file-name (file-name-as-directory "tests") - project-dir))) - (if (and project-dir - (string= project-dir dir) - (string= default-directory tests-dir)) - tests-dir - dir)) - dir)) +(defmacro ess-r--without-format-command (&rest body) + (declare (indent 0) + (debug (&rest form))) + `(with-current-buffer (process-buffer (ess-command--get-proc nil nil)) + (let ((old-alist ess-format-command-alist)) + (unwind-protect + (progn + (setq ess-format-command-alist nil) + ,@body) + (setq ess-format-command-alist old-alist))))) -(defun R-initialize-on-start (&optional proc string) +(define-obsolete-function-alias 'R-initialize-on-start 'ess-r-initialize-on-start "ESS 19.04") +(defun ess-r-initialize-on-start () "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": - (let ((pager-cmd (format - "if(identical(getOption('pager'), - file.path(R.home(), 'bin', 'pager'))) - options(pager='%s')\n" - inferior-ess-pager))) - (ess-command pager-cmd)) - (inferior-ess-r-load-ESSR) + (ess-r--without-format-command + (ess-command (format + "if (identical(getOption('pager'), file.path(R.home(), 'bin', 'pager'))) + options(pager = '%s')\n" + inferior-ess-pager))) + (ess-r-load-ESSR) (when inferior-ess-language-start (ess-command (concat inferior-ess-language-start "\n"))) - (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))) + ;; tracebug + (when ess-use-tracebug (ess-tracebug 1)) + (add-hook 'ess-presend-filter-functions 'ess-R-scan-for-library-call nil 'local) + (run-hooks 'ess-r-post-run-hook)) + +(defun ess-r--skip-function () + ;; Assumes the point is at function start + (if (looking-at-p ess-r-set-function-start) + (forward-list 1) ; get over the entire setXyz(...) + (forward-list 1) ; get over arguments + (if (looking-at-p "[ \t\n]*{") + (forward-sexp 1) ;; move over {...} + ;; {..}-less case + (skip-chars-forward " \t\n") + (goto-char (cadr (ess-continuations-bounds)))))) + +;; `beginning-of-defun' protocol: +;; 1) assumes that defuns are at the top level (e.g. always moves to bol) +(defun ess-r-beginning-of-defun (&optional arg) + "Move to beginning a top level function. +ARG is as in `beginning-of-defun'." + (ess-r-beginning-of-function arg t)) + +;; `end-of-defun' protocol: +;; 1) Uses beginning-of-defun-function with negative arg +;; 2) Assumes that beginning-of-defun-function with -1 arg finds current defun +;; when point is just in front of the function +(defun ess-r-end-of-defun (&optional arg) + "End of top level function. +ARG is as in `end-of-defun'." + (ess-r-end-of-function arg t)) + +(defun ess-r-beginning-of-function (&optional arg top-level) + "Leave (and return) the point at the beginning of the current ESS function. +When ARG is positive, search for beginning of function backward, +otherwise forward. Value of ARG is currently ignored. Return the +new position, or nil if no-match. If TOP-LEVEL is non-nil, search +for top-level functions only." + (setq arg (or arg 1)) + (let ((start-point (point)) + done) + ;; In case we are at the start of a function, skip past new lines. + (when (> arg 0) + ;; Start search from a forward position in order to capture current + ;; function start. But not when arg < 0; see end-of-defun protocol above. + (forward-line 2)) + (while (and (not done) + (re-search-backward ess-r-function-pattern nil t arg)) + (unless (ess-inside-string-or-comment-p) + (setq done + (if top-level + (= (car (syntax-ppss (match-beginning 0))) 0) + t)) + (if (< arg 0) + ;; move to match-end to avoid the infloop in re-search-backward + (goto-char (if done (match-beginning 0) (match-end 0))) + ;; Backward regexp match stops at the minimal match (e.g. partial + ;; function name), so we need a bit more work here. + (beginning-of-line) + (re-search-forward ess-r-function-pattern) + (goto-char (match-beginning 0)) + (when (<= start-point (point)) + (setq done nil))))) + (if done + (point) + (goto-char start-point) + nil))) + +(defun ess-r-end-of-function (&optional arg top-level) + "Leave the point at the end of the current function. +When ARG is positive, search for end of function forward, +otherwise backward. Move to point and return point if search was +successful, otherwise nil. If TOP-LEVEL is non-nil, search for +top level functions only." + (setq arg (or arg 1)) + (let* ((start-pos (point)) + (search-fn (lambda (lim) + (let ((foundp nil)) + (while (and (not foundp) + (re-search-forward ess-r-function-pattern nil t)) + (when (< arg 0) + ;; re-search-backward is a forward search + ;; internally, so we need to bol in order to avoid + ;; the infloop + (beginning-of-line)) + (setq foundp + (unless (ess-inside-string-or-comment-p) + (if top-level + (= 0 (car (save-excursion (syntax-ppss (match-beginning 0))))) + (>= (point) lim))))) + (if foundp + (progn (goto-char (match-beginning 0)) + (ess-r--skip-function)) + (goto-char start-pos)))))) + (ess-r-beginning-of-function 1 top-level) + (if (< (point) start-pos) + ;; Moved back. We were either inside a function or after a function. + (progn + (ess-r--skip-function) + ;; For negative ARG we are done. + (when (and (> arg 0) + (<= (point) start-pos)) + (funcall search-fn start-pos))) + ;; No function before point; search forward on positive ARG. + (when (> arg 0) + (funcall search-fn start-pos))))) ;;;###autoload -(defun R-mode (&optional proc-name) +(define-derived-mode ess-r-mode ess-mode "ESS[R]" "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 + :group 'ess-R + (set-syntax-table ess-r-mode-syntax-table) + (ess-setq-vars-local ess-r-customize-alist) + (setq-local ess-font-lock-keywords 'ess-R-font-lock-keywords) + (setq-local paragraph-start (concat "\\s-*$\\|" page-delimiter)) + (setq-local paragraph-separate (concat "\\s-*$\\|" page-delimiter)) + (setq-local paragraph-ignore-fill-prefix t) + (setq-local indent-line-function #'ess-r-indent-line) + (setq-local comment-indent-function #'ess-calculate-indent) + (setq-local add-log-current-defun-header-regexp "^\\(.+\\)\\s-+<-[ \t\n]*function") + (setq-local font-lock-syntactic-face-function #'ess-r-font-lock-syntactic-face-function) + (setq-local syntax-propertize-function ess-r--syntax-propertize-function) + (setq-local electric-layout-rules '((?{ . after))) + ;; indentation + (add-hook 'hack-local-variables-hook #'ess-set-style nil t) + ;; eldoc + (ess--setup-eldoc #'ess-r-eldoc-function) + ;; auto-complete + (ess--setup-auto-complete ess-r-ac-sources) + ;; company + (ess--setup-company ess-r-company-backends) + (setq-local prettify-symbols-alist ess-r-prettify-symbols) + (setq font-lock-defaults '(ess-build-font-lock-keywords nil nil ((?\. . "w") (?\_ . "w")))) (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-r-package-completion nil 'local) (add-hook 'completion-at-point-functions 'ess-filename-completion nil 'local) - (when (>= emacs-major-version 25) - (add-hook 'xref-backend-functions #'ess-r-xref-backend nil 'local)) + (add-hook 'xref-backend-functions #'ess-r-xref-backend nil 'local) + (add-hook 'project-find-functions #'ess-r-project nil 'local) (if (fboundp 'ess-add-toolbar) (ess-add-toolbar)) + ;; imenu is needed for `which-function' + (setq imenu-generic-expression ess-imenu-S-generic-expression) (when ess-imenu-use-S - (setq imenu-generic-expression ess-imenu-S-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-mode-hooks 'R-mode-hook)) - + (setq-local beginning-of-defun-function #'ess-r-beginning-of-defun) + (setq-local end-of-defun-function #'ess-r-end-of-defun) + (ess-roxy-mode)) ;;;###autoload -(defalias 'r-mode #'R-mode) +(defalias 'R-mode 'ess-r-mode) ;;;###autoload -(defalias 'ess-r-mode #'R-mode) +(defalias 'r-mode 'ess-r-mode) + ;;;###autoload -(add-to-list 'auto-mode-alist '("/R/.*\\.q\\'" . R-mode)) +(add-to-list 'auto-mode-alist '("/R/.*\\.q\\'" . ess-r-mode)) ;;;###autoload -(add-to-list 'auto-mode-alist '("\\.[rR]\\'" . R-mode)) +(add-to-list 'auto-mode-alist '("\\.[rR]\\'" . ess-r-mode)) ;;;###autoload -(add-to-list 'auto-mode-alist '("\\.[rR]profile\\'" . R-mode)) +(add-to-list 'auto-mode-alist '("\\.[rR]profile\\'" . ess-r-mode)) ;;;###autoload -(add-to-list 'auto-mode-alist '("NAMESPACE\\'" . R-mode)) +(add-to-list 'auto-mode-alist '("NAMESPACE\\'" . ess-r-mode)) ;;;###autoload -(add-to-list 'auto-mode-alist '("CITATION\\'" . R-mode)) +(add-to-list 'auto-mode-alist '("CITATION\\'" . ess-r-mode)) + + +;;;*;;; Project detection + +(defvar-local ess-r-project--info-cache nil + "Current package info cache. +See `ess-r-project-info' for its structure.") + +(defun ess-r-project (&optional dir) + "Return the current project as an Emacs project instance. +R project is a directory XYZ containing either .Rprofile, +DESCRIPTION or XYZ.Rproj file. Return a list of the form (:name +\"XYZ\" :root \"/path/to/project\"). If DIR is provided, the +project is searched from that directory instead of +`default-directory'." + (let ((info (ess-r-project-info dir))) + (when (car info) + (cons 'ess-r-project (plist-get info :root))))) + +;; FIXME: remove when emacs 27 is dropped +(unless (eval-when-compile + (get 'project-roots 'byte-obsolete-info)) + (cl-defmethod project-roots ((project (head ess-r-project))) + "Return the project root for ESS R projects." + (list (cdr project)))) + +(cl-defmethod project-root ((project (head ess-r-project))) + "Return the project root for ESS R projects." + (cdr project)) + +(defun ess-r-project-info (&optional dir) + "Get the description of the R project in directory DIR. +Return an plist with the keys :name and :root. When not in a +project return \\='(nil). This value is cached buffer-locally for +efficiency reasons." + (let ((do-cache (null dir))) + (if (and do-cache ess-r-project--info-cache) + ess-r-project--info-cache + (setq dir (or dir (buffer-file-name) default-directory)) + (let ((out (or + (unless (file-remote-p dir) + (let ((dir (locate-dominating-file + dir + (lambda (dir) + (or (file-exists-p (expand-file-name ".Rprofile" dir)) + (file-exists-p (expand-file-name "DESCRIPTION" dir)) + (let ((nm (file-name-nondirectory (directory-file-name dir)))) + (file-exists-p (expand-file-name (concat nm ".Rproj") dir)))))))) + (when dir + (let ((dir (directory-file-name dir))) + (unless (member dir (list "~" (getenv "HOME"))) + (list :name (file-name-nondirectory dir) + :root (expand-file-name dir))))))) + '()))) + (when do-cache + (setq ess-r-project--info-cache out)) + out)))) + ;;*;; Miscellaneous (defun ess-R-arch-2-bit (arch) - "Translate R's architecture shortcuts/directory names to 'bits'. + "Translate R's architecture shortcuts/directory names to `bits'. ARCH \"32\" or \"64\" (for now)." (if (string= arch "i386") "32" ;; else: @@ -691,8 +887,8 @@ (\"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." +\"R-x.y.z/bin/i386/Rterm.exe\" return \"R-x.y.z-32bit\", for R-2.12.x and newer. +\"R-x.y.z/bin/x64/Rterm.exe\" 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 @@ -707,40 +903,61 @@ (cons val long-path) val))) -(defun ess-r-define-runners () +(defun ess-r-define-runners (&optional verbose) "Generate functions for starting other versions of R. -See `ess-r-versions' for strings that determine which functions +See `ess-r-runner-prefixes' for strings that determine which functions are created. On MS Windows, this works using `ess-rterm-version-paths' instead. The functions will normally be placed on the menubar and stored as `ess-r-created-runners' upon ESS initialization." - (when ess-r-versions - ;; try to find R versions in ess-r-versions. + (when ess-r-runner-prefixes (let ((versions ;; Find which versions of R we want. Remove the pathname, leaving just ;; the name of the executable. (if ess-microsoft-p (mapcar (lambda (v) (car (ess-rterm-arch-version v 'give-cons))) ess-rterm-version-paths) - (ess-uniq-list + (delete-dups (mapcar #'file-name-nondirectory (apply #'nconc (mapcar #'ess-find-exec-completions - ess-r-versions))))))) + ess-r-runner-prefixes))))))) ;; Iterate over each string in VERSIONS, creating a new defun each time. (setq ess-r-created-runners versions) - (if ess-microsoft-p - (cl-mapcar (lambda (v p) (ess-define-runner v "R" p)) versions ess-rterm-version-paths) - (mapc (lambda (v) (ess-define-runner v "R")) versions)) - ;; Add to menu - (when ess-r-created-runners - ;; 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-r-created-runners))) - (easy-menu-add-item ess-mode-menu '("Start Process") - (cons "Other" new-menu))))))) + (if verbose + (message "Recreated %d R versions known to ESS: %s" + (length versions) versions)) + (if ess-microsoft-p + (cl-mapcar (lambda (v p) (ess-define-runner v "R" p)) versions ess-rterm-version-paths) + (mapc (lambda (v) (ess-define-runner v "R")) versions)) + ;; Add to menu + (when ess-r-created-runners + ;; 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-r-created-runners))) + (easy-menu-add-item ess-mode-menu '("Start Process") + (cons "Other" new-menu)) + (easy-menu-add-item inferior-ess-mode-menu '("Process") + (cons "R processes" new-menu))))))) + +(defun ess-r-redefine-runners (&optional verbose) + "Regenerate runners, i.e. `M-x R-*` possibilities. + Call `fmakunbound' on all elements of `ess-r-created-runners', + then define new runners." + (interactive "P") + (dolist (f ess-r-created-runners) + (fmakunbound (intern f))) + (setq ess-r-created-runners nil) + (ess-r-define-runners verbose)) + +(defun ess-r-runners-reset (sym val) + "Regenerate runners. +Set SYM to VAL and call `ess-r-redefine-runners'." + (set-default sym val) + (ess-r-redefine-runners)) + (define-obsolete-function-alias 'ess-r-versions-create 'ess-r-define-runners "ESS 18.10") @@ -758,69 +975,44 @@ :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 + "Optionally remove 32bit Rterms from being candidate for `run-ess-r-newest'. +Return the list of candidates for being `run-ess-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)) + ;; 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-created-runners - inferior-ess-r-program)))))) - -(defun ess-check-R-program () - "Check if `inferior-ess-r-program' 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' accordingly." - (unless (executable-find inferior-ess-r-program) - ;; need to check if we can find another name. - (let ((newest (ess-find-newest-R))) - (if newest - (setq inferior-ess-r-program newest) - (message "Sorry, no version of R could be found on your system."))))) - -(defun R-newest (&optional start-args) +(defun run-ess-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 START-ARGS (\\[universal-argument]) will +Subsequent calls to `run-ess-r-newest' will run that version, +rather than searching again for the newest version. Providing +START-ARGS (interactively, with \\[universal-argument]) 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)))) + (unless ess-newest-R + (message "Finding all versions of R on your system...") + (setq ess-newest-R + (ess-find-newest-date + (mapcar #'ess-r-version-date + (if ess-microsoft-p + (ess-rterm-prefer-higher-bit) + (add-to-list 'ess-r-created-runners inferior-ess-r-program)))))) + (let ((inferior-ess-r-program ess-newest-R)) + (run-ess-r start-args))) + +(defun R-newest (&optional start-args) + (interactive "P") + ;; FIXME: Current ob-R expects current buffer set to process buffer + (set-buffer (run-ess-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") @@ -844,7 +1036,7 @@ rver) " --version")))) (when (string-match - "R \\(version \\)?[1-9][^\n]+ (\\(2[0-9-]+\\)\\( r[0-9]+\\)?)" + "R \\(version \\)?[1-9][^\n]+ (\\(2[0-9-]+\\)\\( r[0-9]+\\)?" ver-string) (setq date (match-string 2 ver-string))) (cons date rver))) @@ -862,19 +1054,6 @@ (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))) - (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 @@ -894,10 +1073,10 @@ 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. + "Find the full path of all occurrences 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 +occurrence of Rterm.exe in the `exec-path'. If there are no +occurrences 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 @@ -922,7 +1101,7 @@ (ess-flatten-list (mapcar (lambda (r-prefix) (file-name-all-completions r-prefix ess-R-root-dir)) - (append '("rw") ess-r-versions)))))) + (append '("rw") ess-r-runner-prefixes)))))) (mapcar (lambda (dir) (let ((R-path (concat ess-R-root-dir @@ -932,45 +1111,31 @@ 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-mode-hooks 'Rnw-mode-hook)) +(define-derived-mode ess-r-transcript-mode ess-transcript-mode "ESS R Transcript" + "A Major mode for R transcript files." + :syntax-table ess-r-mode-syntax-table + :group 'ess + (ess-setq-vars-local ess-r-customize-alist) + (setq-local comint-prompt-regexp inferior-S-prompt) + (setq-local ess-font-lock-keywords 'ess-R-font-lock-keywords) + (setq-local paragraph-start (concat "\\s-*$\\|" page-delimiter)) + (setq-local paragraph-separate (concat "\\s-*$\\|" page-delimiter)) + (setq-local paragraph-ignore-fill-prefix t) + (setq-local indent-line-function #'ess-r-indent-line) + (setq-local add-log-current-defun-header-regexp "^\\(.+\\)\\s-+<-[ \t\n]*function") + (setq-local font-lock-syntactic-face-function #'ess-r-font-lock-syntactic-face-function) + (setq-local prettify-symbols-alist ess-r-prettify-symbols) + (setq font-lock-defaults '(ess-build-font-lock-keywords + nil nil ((?\. . "w") (?\_ . "w") (?' . "."))))) -(fset 'Snw-mode 'Rnw-mode); just a synonym (for now or ever) +(fset 'r-transcript-mode 'ess-r-transcript-mode) ;;;###autoload -(add-to-list 'auto-mode-alist '("\\.[rR]nw\\'" . Rnw-mode)) +(add-to-list 'auto-mode-alist '("\\.[Rr]out\\'" . ess-r-transcript-mode)) ;;;###autoload -(add-to-list 'auto-mode-alist '("\\.[sS]nw\\'" . Snw-mode)) - +(add-to-list 'interpreter-mode-alist '("Rscript" . ess-r-mode)) ;;;###autoload -(defun R-transcript-mode () - "Does the right thing." - (interactive) - (ess-transcript-mode ess-r-customize-alist)) - -(fset 'r-transcript-mode 'R-transcript-mode) - -;;;###autoload -(add-to-list 'auto-mode-alist '("\\.[Rr]out" . R-transcript-mode)) -;;;###autoload -(add-to-list 'interpreter-mode-alist '("Rscript" . R-mode)) -;;;###autoload -(add-to-list 'interpreter-mode-alist '("r" . R-mode)) +(add-to-list 'interpreter-mode-alist '("r" . ess-r-mode)) (defun ess-r-fix-T-F (&optional from quietly) "Change T/F into TRUE and FALSE cautiously. @@ -995,26 +1160,25 @@ (defvar ess--CRAN-mirror nil "CRAN mirror name cache.") -(defun ess-r-install-library (&optional update pack) - "Prompt and install R package PACK. +(cl-defmethod ess-install-library--override (update package &context (ess-dialect "R")) + "Prompt and install R PACKAGE. With argument UPDATE, update cached packages list." - (interactive "P") (inferior-ess-r-force) (when (equal "@CRAN@" (car (ess-get-words-from-vector "getOption('repos')[['CRAN']]\n"))) (ess-set-CRAN-mirror ess--CRAN-mirror) (ess-wait-for-process (get-process ess-current-process-name)) - (unless pack (setq update t))) + (unless package (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"))) + (ess-get-words-from-vector--foreground "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)))) + (package (or package + (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)))))) + (format "install.packages('%s')\n" package)) + (display-buffer (buffer-name (ess-get-process-buffer))))) (defun ess-setRepositories () "Call setRepositories()." @@ -1029,16 +1193,12 @@ (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)))))) + (when-let ((M1 (ess-get-words-from-vector "local({out <- getCRANmirrors(local.only=TRUE); print(paste(out$Name,'[',out$URL,']', sep=''))})\n")) + (mirror (ess-completing-read "Choose CRAN mirror" M1 nil t)) + (url (car (cl-member mirror M1 :test #'string=)))) + (setq ess--CRAN-mirror (progn (string-match "\\(.*\\)\\[\\(.*\\)\\]$" url) + (match-string 2 url))) + (ess-command (format mirror-cmd ess--CRAN-mirror))))) (message "CRAN mirror: %s" (car (ess-get-words-from-vector "getOption('repos')[['CRAN']]\n")))) (define-obsolete-function-alias 'ess-setCRANMiror 'ess-set-CRAN-mirror "ESS 18.10") @@ -1047,15 +1207,15 @@ (unless (ess-boolean-command (format "print(requireNamespace('%s', quietly = TRUE))\n" pkg)) (if (y-or-n-p (format "Package '%s' is not installed. Install? " pkg)) (ess-eval-linewise (format "install.packages('%s')\n" pkg)) - (signal 'quit nil)) - (message nil))) + (signal 'quit nil)))) + +(define-obsolete-function-alias 'ess-r-sos #'ess-help-web-search "ESS 19.04") -(defun ess-r-sos (cmd) - "Interface to findFn in the library sos." - (interactive "sfindFn: ") +(cl-defmethod ess--help-web-search-override (cmd &context (ess-dialect "R")) (ess-r-check-install-package "sos") (ess-eval-linewise (format "sos::findFn(\"%s\", maxPages=10)" cmd))) + (defun ess-R-scan-for-library-call (string) "Detect `library/require' call in STRING and update tracking vars. Placed into `ess-presend-filter-functions' for R dialects." @@ -1063,24 +1223,13 @@ (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))))))) +(cl-defmethod ess-installed-packages (&context (ess-dialect "R")) + ;;; FIXME? .packages() does not cache; installed.packages() does but is slower first time + (ess-get-words-from-vector--foreground "print(.packages(T), max=1e6)\n")) + +(cl-defmethod ess-load-library--override (pack &context (ess-dialect "R")) + "Load an R package." + (ess-eval-linewise (format "library('%s')\n" pack))) (define-obsolete-function-alias 'ess-library 'ess-load-library "ESS[12.09-1]") @@ -1108,19 +1257,23 @@ (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 +(cl-defmethod ess-build-eval-command--override (string &context (ess-dialect "R") + &optional visibly output file &rest args) + "R method to build eval command." + (let* ((namespace (caar args)) + (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"))) + (rargs (ess-r-build-args visibly output namespace))) + (concat cmd "(\"" string "\"" rargs file ")\n"))) -(ess-defmethod R ess-build-load-command (file &optional visibly output namespace) - (let* ((namespace (or namespace (ess-r-get-evaluation-env))) +(cl-defmethod ess-build-load-command (string &context (ess-dialect "R") + &optional visibly output file &rest _args) + (let* ((namespace (or file (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"))) + (rargs (ess-r-build-args visibly output namespace))) + (concat cmd "('" string "'" rargs ")\n"))) (defun ess-r-build-eval-message (message) (let ((env (cond (ess-debug-minor-mode @@ -1139,9 +1292,7 @@ (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)))) + ess-r-evaluation-env) (defun ess-r-set-evaluation-env (&optional arg) "Select a package namespace for evaluation of R code. @@ -1159,7 +1310,6 @@ (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)))) @@ -1182,7 +1332,7 @@ (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) +(cl-defmethod ess-load-file--override (file &context (ess-dialect "R")) (cond ;; Namespaced evaluation ((ess-r-get-evaluation-env) @@ -1197,80 +1347,97 @@ 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) +(cl-defmethod ess-send-region--override (process start end visibly message type + &context (ess-dialect "R")) (cond ;; Namespaced evaluation ((ess-r-get-evaluation-env) - (ess-r-send-region-namespaced proc start end visibly message)) + (ess-r-send-region-namespaced process start end visibly message)) ;; Evaluation into current env (t - (ess-send-string proc (buffer-substring start end) visibly message type)))) + (ess-send-string process (buffer-substring start end) visibly message type)))) -(defun ess-r-send-region-namespaced (proc beg end &optional visibly message) +(defun ess-r-send-region-namespaced (proc start 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")))) + (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(utils::help('%s'))\n" object)))) - (when (> (length pkgs) 1) - (if dont-ask - (car pkgs) - (ess-completing-read "Choose location" pkgs nil t))))) +(cl-defmethod ess-build-help-command (object &context (ess-dialect "R")) + (let ((info (ess-r--split-namespace object))) + (if info + (ess-r-help--build-help-command--qualified (car info) (cdr info)) + (ess-r-help--build-help-command--unqualified object)))) + +(defun ess-r--split-namespace (sym) + (when (string-match "^[[:alnum:].]+::" sym) + (let ((pkg (substring-no-properties sym (match-beginning 0) (- (match-end 0) 2))) + (obj (substring-no-properties sym (match-end 0)))) + (cons pkg obj)))) + +(defvar-local ess-r-help--local-object nil) +(defvar-local ess-r-help--local-package nil) +(put 'ess-r-help--local-object 'permanent-local t) +(put 'ess-r-help--local-package 'permanent-local t) + +(defun ess-r-help--build-help-command--qualified (pkg obj) + (setq ess-r-help--local-package pkg) + (setq ess-r-help--local-object obj) + (let ((obj-arg (concat "'" obj "'")) + (pkg-arg (ess-r-arg "package" pkg t))) + (concat ".ess.help(" obj-arg pkg-arg ")\n"))) -(defun ess-r-build-help-command--unqualified (object dont-ask) +(defun ess-r-help--build-help-command--unqualified (obj) (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))) + ;; We are in index page, qualify with namespace + (ess-r-help--build-help-command--qualified ess-help-object obj) + (let ((pkg (ess-r-help--find-package obj))) + (unless pkg + (error "Can't find documentation for `%s'" obj)) + (ess-r-help--build-help-command--qualified pkg obj)))) + +(defun ess-r-help--find-package (object) + "Find package where to find OBJECT. +If there are multiple packages attached to the search path, the +user is prompted for a package location. If OBJECT is not +documented, returns nil." + (let* ((paths (ess-get-words-from-vector + (format "as.character(utils::help('%s'))\n" object))) + (paths (if (> (length paths) 1) + (cl-delete-if + (lambda (x) (string-match-p "reexports$" x)) + paths) + paths))) + (cond ((not paths) + nil) + ((and (> (length paths) 1) + (not noninteractive)) + (let ((path (ess-completing-read "Choose location" paths nil t))) + (ess-r-help--get-pkg-from-help-path path))) + (t + (ess-r-help--get-pkg-from-help-path (car paths)))))) + +(defun ess-r-help--get-pkg-from-help-path (path) + (file-name-nondirectory + (directory-file-name + (file-name-directory + (directory-file-name + (file-name-directory + path)))))) (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))) @@ -1279,22 +1446,21 @@ (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) + (ess-help-r--display-help-? 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) + (ess-r-transcript-mode) (process-send-string proc "\n"))) t))) -(defun ess-help-r--display-help-? (proc string help-?-match) +(defun ess-help-r--display-help-? (string help-?-match) (cond ((string-match "\\?\\?\\(.+\\)" help-?-match) (ess--display-indexed-help-page (concat help-?-match "\n") "^\\([^ \t\n]+::[^ \t\n]+\\)[ \t\n]+" @@ -1312,7 +1478,7 @@ (defun ess-help-r--sanitize-topic (string) "Enclose help topic STRING into `` to avoid ?while ?if etc hangs." - (if (string-match "\\([^:]*:+\\)\\(.*\\)$" string) ; treat foo::bar corectly + (if (string-match "\\([^:]*:+\\)\\(.*\\)$" string) ; treat foo::bar correctly (format "%s`%s`" (match-string 1 string) (match-string 2 string)) (format "`%s`" string))) @@ -1324,69 +1490,104 @@ (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({ +(defun ess-r-load-ESSR () + "Load ESSR functionality into ESSR environment. +On remotes, when `ess-r-fetch-ESSR-on-remotes' is non-nil we +fetch ESSR environment from github to the remote machine. +Otherwise (the default) we source ESSR files into the remote +process." + (interactive) + ;; `.ess.command()` is not defined until ESSR is loaded so disable + ;; it temporarily. Would be helpful to implement an `inferior-ess-let' + ;; macro . + (ess-r--without-format-command + (cond + ((file-remote-p (ess-get-process-variable 'default-directory)) + (if (eq ess-r-fetch-ESSR-on-remotes t) + (or (ess-r--fetch-ESSR-remote) + (ess-r--load-ESSR-remote)) + (ess-r--load-ESSR-remote))) + ((and (bound-and-true-p ess-remote)) + ;; NB: With ess-remote we send by chunks because sending large sources is + ;; fragile + (if ess-r-fetch-ESSR-on-remotes + (or (ess-r--fetch-ESSR-remote) + (ess-r--load-ESSR-remote t)) + (ess-r--load-ESSR-remote t))) + (t (ess-r--load-ESSR-local))))) + +(defun ess-r--load-ESSR-local () + "Load ESSR into a local process. +Source the etc/ESSR/.load.R file into the R process. The +.ess.ESSR.load function sources all of the contents of the +etc/ESSR/R directory into the ESSR environment and attaches the +environment to the search path." + (let* ((src-dir (expand-file-name "ESSR/R" ess-etc-directory)) + (cmd (format "local({ source('%s/.load.R', local=TRUE) #define load.ESSR - load.ESSR('%s') + .ess.ESSR.load('%s') })\n" - src-dir src-dir))) - (ess-write-to-dribble-buffer (format "load-ESSR cmd:\n%s\n" cmd)) + src-dir src-dir))) (with-current-buffer (ess-command cmd) (let ((msg (buffer-string))) (when (> (length msg) 1) - (message (format "load ESSR: %s" msg))))))) + (message (format "Messages while loading 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 +(defun ess-r--load-ESSR-remote (&optional chunked) + "Load ESSR into a remote process through the process connection. +Send the contents of the etc/ESSR/R directory to the remote +process through the process connection file by file. Then, +collect all the objects into an ESSR environment and attach to +the search path. If CHUNKED is non-nil, split each file by +separators and send chunk by chunk." + (ess-command (format ".ess.ESSRversion <<- '%s'\n" essr-version)) + (with-temp-message "Loading ESSR into remote ..." + (let ((src-dir (expand-file-name "ESSR/R" ess-etc-directory))) + (dolist (file (directory-files src-dir t "\\.R\\'")) + (ess--inject-code-from-file file chunked)) + (ess-command ".ess.collect.ESSR.objects()\n")))) + +(defun ess-r--fetch-ESSR-remote () + "Load ESSR into a remote process through a GitHub download. +Downloads a file with a serialized version of the R ESSR +environment from GitHub and attaches it to the search path. If +the file already exists on disk from a previous download then the +download step is omitted. This function returns t if the ESSR +load is successful, and nil otherwise." + (let ((loader (ess-file-content (expand-file-name "ESSR/LOADREMOTE" ess-etc-directory))) + (essr (or essr-version + ;; FIXME: Hack: on MELPA essr-version is not set + (lm-with-file (expand-file-name "ess.el" ess-lisp-directory) + (lm-header "ESSR-Version")) + (error "`essr-version' could not be automatically inferred from ess.el file")))) + (or (with-temp-message "Fetching and loading ESSR into the remote ..." + (ess-boolean-command (format loader essr))) + (let ((errmsg (with-current-buffer " *ess-command-output*" (buffer-string)))) + (message (format "Couldn't load or download ESSR.rds on the remote.\n Error: %s\n Injecting local copy of ESSR." errmsg)) + nil)))) + +(cl-defmethod ess-quit--override (arg &context (ess-dialect "R")) + "With ARG, do not offer to save the workspace." + (let ((cmd (format "base::q('%s')\n" (if arg "no" "default"))) (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))) + (ess-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) - (run-ess-r start-args) +(cl-defmethod inferior-ess-reload--override (start-name start-args &context (ess-dialect "R")) + "Call `run-ess-r' with START-ARGS. +Then run `inferior-ess-r-reload-hook'." + (let ((inferior-ess-r-program start-name)) + (run-ess-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") + (setq-local ess-dialect "R") (ess-force-buffer-current prompt force no-autostart ask-if-1)) @@ -1399,25 +1600,25 @@ (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)) + (when-let ((indent (ess-calculate-indent))) + (let ((case-fold-search nil) + (pos (- (point-max) (point))) + beg shift-amt) + (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 @@ -1468,7 +1669,7 @@ (append (cdr ess-prefixed-block-patterns) '("}?[ \t]*else"))))) -(defun ess-calculate-indent (&optional parse-start) +(defun ess-calculate-indent () "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." @@ -1478,7 +1679,7 @@ (state (syntax-ppss)) (containing-sexp (cadr state)) (prev-containing-sexp (car (last (butlast (nth 9 state)))))) - (ess-back-to-indentation) + (back-to-indentation) (cond ;; Strings ((ess-inside-string-p) @@ -1535,7 +1736,7 @@ (let ((indent (save-excursion (ess-calculate-indent--args))) (unindent (progn (skip-chars-forward " \t") - ;; return number of skiped chars + ;; return number of skipped chars (skip-chars-forward ", \t")))) (- indent unindent)))) @@ -1620,7 +1821,7 @@ (looking-at "{") (progn (forward-line) - (ess-back-to-indentation) + (back-to-indentation) (/= (line-number-at-pos) start-line)) (not (looking-at "[ \t]*\\(#\\|$\\)")) (save-excursion @@ -1636,7 +1837,7 @@ (goto-char containing-sexp) (ess-block-opening-p) (equal (point) (save-excursion - (ess-back-to-indentation) + (back-to-indentation) (point)))) (+ (current-column) offset)))))) @@ -1738,10 +1939,12 @@ (ess-calculate-indent--args-open-delim)) ;; Indent from attached name ((eq type 'prev-call) - (ess-calculate-indent--args-prev-call)) + (ess-calculate-indent--args-prev-call block)) ;; Indent from previous line indentation ((eq type 'prev-line) - (ess-calculate-indent--args-prev-line)) + (let ((out (ess-calculate-indent--args-prev-line type block offset))) + (setq offset (pop out)) + (pop out))) (t (error "Malformed offset"))))) (if max-col @@ -1752,7 +1955,7 @@ (forward-char) (current-column)) -(defun ess-calculate-indent--args-prev-call () +(defun ess-calculate-indent--args-prev-call (block) ;; Handle brackets chains such as ][ (cf data.table) (ess-climb-chained-delims) ;; Handle call chains @@ -1770,7 +1973,7 @@ (+ (ess-offset 'block) (current-column)) (current-column))) -(defun ess-calculate-indent--args-prev-line () +(defun ess-calculate-indent--args-prev-line (type block offset) (ess-at-indent-point (cond ;; Closing delimiters are actually not indented at @@ -1779,13 +1982,13 @@ (ess-up-list -1) (when (looking-at "{") (ess-climb-block-prefix)) - (current-indentation)) + (list offset (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)) + (list offset (current-indentation))) ;; Regular case (t ;; Find next non-empty line to indent from @@ -1801,15 +2004,16 @@ ;; 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))))) + (let ((offset (if (and block + containing-sexp + (not (eq block 'unbraced)) + (save-excursion + (/= (line-number-at-pos) + (progn (goto-char containing-sexp) + (line-number-at-pos))))) + 0 + offset))) + (list offset (current-indentation))))))) ;; Indentation of arguments needs to keep track of how previous ;; arguments are indented. If one of those has a smaller indentation, @@ -1832,11 +2036,10 @@ (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) + (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) @@ -1877,7 +2080,7 @@ (looking-at "### ")) (setq max-col (min max-col (current-column)))) (forward-line) - (ess-back-to-indentation))) + (back-to-indentation))) max-col)) (defun ess-calculate-indent--prefixed-block-curly () @@ -1900,9 +2103,7 @@ (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)) + (let* ((cascade (eq (ess-offset-type 'continued) 'cascade)) (climbed (ess-climb-continuations cascade)) max-col) (when climbed @@ -1966,14 +2167,12 @@ ;; 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) + (containing-sexp (ess-containing-sexp-position))) (goto-char (car bounds)) (goto-char (ess-code-end-position)) (while (and (/= (point) last-pos) (< (line-end-position) - (cadr bounds)) - (not prefix-break)) + (cadr bounds))) (setq last-pos (point)) ;; Check whether we ended up in a sub call. In this case, jump ;; over it, otherwise, join lines. @@ -1990,7 +2189,7 @@ ;; Jump over comments ((looking-at "#") (forward-line) - (ess-indent-line)) + (funcall indent-line-function)) (t (join-line 1)))) (goto-char (ess-code-end-position))) @@ -2059,120 +2258,128 @@ (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))))) +(let (_) + ;; FIXME: Transform these dynamic bindings to a state object + (defvar ess--infinite) + (defvar ess--prefix-break) + (defvar ess--start-pos) + (defvar ess--last-pos) + (defvar ess--last-newline) + + (declare-function ess-fill-args--roll-lines "ess-r-mode") + + (defun ess-fill-args (&optional style) + (let ((ess--start-pos (point-min)) + (bounds (ess-args-bounds 'marker)) + ;; Set undo boundaries manually + (undo-inhibit-record-point t) + ess--last-pos ess--last-newline ess--prefix-break + ess--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 - (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)) + (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 style) + ;; 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 (style) + (while (and (not (looking-at "[])]")) + (/= (point) (or ess--last-pos 1)) + (not ess--infinite)) + (setq ess--prefix-break nil) + ;; Record ess--start-pos as future breaking point to avoid breaking + ;; at `=' sign + (while (looking-at "[ \t]*[\n#]") + (forward-line) + (back-to-indentation)) + (setq ess--start-pos (point)) + (while (and (< (current-column) fill-column) + (not (looking-at "[])]")) + (/= (point) (or ess--last-pos 1)) + ;; Break after one pass if prefix is active + (not ess--prefix-break)) + (when (memq style '(2 3)) + (setq ess--prefix-break t)) + (ess-jump-token ",") + (setq ess--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 ess--last-newline nil)) + ((ess-token-after= ",") + (setq ess--last-newline nil) + (setq ess--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))) + (funcall indent-line-function) + (forward-line)))))) + (when (or (>= (current-column) fill-column) + ess--prefix-break + ;; Ensures closing delim on a newline + (and (= style 4) + (looking-at "[ \t]*[])]") + (setq ess--last-pos (point)))) + (if (and ess--last-pos (/= ess--last-pos ess--start-pos)) + (goto-char ess--last-pos) + (ess-jump-char ",")) + (cond ((looking-at "[ \t]*[#\n]") + (forward-line) + (funcall indent-line-function) + (setq ess--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 ess--last-newline)) + (newline-and-indent) + ;; Prevent indenting infinitely + (setq ess--last-newline t))) + ((not ess--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)))))) + (setq ess--last-newline t)) + (t + (setq ess--infinite t))))))) (defun ess-fill-continuations (&optional style) (let ((bounds (ess-continuations-bounds 'marker)) @@ -2219,12 +2426,493 @@ +;;;*;;; Inferior R mode + +(defvar inferior-ess-r-mode-map + (let ((map (make-sparse-keymap))) + (define-key map "\M-\r" #'ess-dirs) + (define-key map (kbd "C-c C-=") #'ess-cycle-assign) + (define-key map (kbd "C-c C-.") 'ess-rutils-map) + map) + "Keymap for `inferior-ess-r-mode'.") + +;; TOTHINK: Prevent string delimiting characters from messing up output in the +;; inferior buffer +(defvar inferior-ess-r-mode-syntax-table + (let ((table (copy-syntax-table ess-r-mode-syntax-table))) + (modify-syntax-entry ?% "." table) + (modify-syntax-entry ?\' "." table) + table) + "Syntax table for `inferior-ess-r-mode'.") + +(define-derived-mode inferior-ess-r-mode inferior-ess-mode "iESS" + "Major mode for interacting with inferior R processes." + :group 'ess-proc + (ess-setq-vars-local ess-r-customize-alist) + (setq-local ess-font-lock-keywords 'inferior-ess-r-font-lock-keywords) + (setq-local font-lock-syntactic-face-function #'ess-r-font-lock-syntactic-face-function) + (setq-local comint-process-echoes (eql ess-eval-visibly t)) + (setq-local comint-prompt-regexp inferior-S-prompt) + (setq-local syntax-propertize-function ess-r--syntax-propertize-function) + (setq comint-input-sender 'inferior-ess-r-input-sender) + (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) + (add-hook 'xref-backend-functions #'ess-r-xref-backend nil 'local) + (add-hook 'project-find-functions #'ess-r-project nil 'local) + ;; eldoc + (ess--setup-eldoc #'ess-r-eldoc-function) + ;; auto-complete + (ess--setup-auto-complete ess-r-ac-sources t) + ;; company + (ess--setup-company ess-r-company-backends t) + (setq comint-get-old-input #'inferior-ess-get-old-input) + (add-hook 'comint-input-filter-functions 'ess-search-path-tracker nil 'local)) + + + +;;;*;;; R Help mode + +(defvar ess-r-help-mode-map + (let ((map (make-sparse-keymap))) + (set-keymap-parent map (make-composed-keymap button-buffer-map + ess-help-mode-map)) + (define-key map "s<" #'beginning-of-buffer) + (define-key map "s>" #'end-of-buffer) + (define-key map "sa" #'ess-skip-to-help-section) + (define-key map "sd" #'ess-skip-to-help-section) + (define-key map "sD" #'ess-skip-to-help-section) + (define-key map "st" #'ess-skip-to-help-section) + (define-key map "se" #'ess-skip-to-help-section) + (define-key map "sn" #'ess-skip-to-help-section) + (define-key map "sr" #'ess-skip-to-help-section) + (define-key map "ss" #'ess-skip-to-help-section) + (define-key map "su" #'ess-skip-to-help-section) + (define-key map "sv" #'ess-skip-to-help-section) + map) + "Keymap for `ess-r-help-mode'.") + +(cl-defmethod ess--help-major-mode (&context (ess-dialect "R")) + (ess-r-help-mode)) + +(define-derived-mode ess-r-help-mode ess-help-mode "R Help" + "Major mode for help buffers." + :group 'ess-help + (setq ess-dialect "R" + ess-help-sec-regex ess-help-r-sec-regex + ess-help-sec-keys-alist ess-help-r-sec-keys-alist ; TODO: Still necessary? + inferior-ess-help-command inferior-ess-r-help-command) + (ess-r-help--add-links)) + +(define-button-type 'ess-r-help--link + 'follow-link t + 'action (lambda (_) (ess-r-help--button-action))) + +(defun ess-r-help--button-action () + "Display help for button at point." + (let ((text (get-text-property (point) 'ess-r-help--link-text))) + (ess-display-help-on-object text))) + +(defun ess-r-help--add-links () + "Add links to the help buffer." + (let ((links (when (ess-process-live-p) + (ess-get-words-from-vector + (format ".ess.helpLinks('%s' %s)\n" + ess-r-help--local-object + (ess-r-arg "package" ess-r-help--local-package t))))) + (inhibit-read-only t)) + (save-excursion + ;; Search for fancy quotes only. If users have + ;; options(useFancyQuotes) set to something other than TRUE this + ;; probably won't work. If it's FALSE, R outputs ascii ', but + ;; searching through the whole buffer takes too long. + (while (re-search-forward "‘\\([^[:space:]]+?\\)’" nil t) + (let* ((text (match-string 1)) + (text-stripped (if (string-match-p ".*()\\'" text) + (substring text nil (- (length text) 2)) + text))) + (when (member text-stripped links) + (delete-region (match-beginning 0) (match-end 0)) + (insert-text-button text + 'ess-r-help--link-text text-stripped + 'type 'ess-r-help--link + 'help-echo (format "mouse-2, RET: Help on %s" text)))))))) + +(cl-defmethod ess--display-vignettes-override (all &context (ess-dialect "R")) + "Display R vignettes in ess-help-like buffer.. +With (prefix) ALL non-nil, use `vignette(*, all=TRUE)`, i.e., +from all installed packages, which can be very slow." + (inferior-ess-r-force) + (let* ((vslist (with-current-buffer + (ess-command + (format ".ess_vignettes(%s)\n" (if all "TRUE" ""))) + (goto-char (point-min)) + (when (re-search-forward "(list" nil t) + (goto-char (match-beginning 0)) + (ignore-errors (eval (read (current-buffer))))))) + (proc-name ess-current-process-name) + (alist ess-local-customize-alist) + (remote (file-remote-p default-directory)) + (buff (get-buffer-create (format "*[%s]vignettes*" ess-dialect))) + (inhibit-modification-hooks t) + (inhibit-read-only t)) + (with-current-buffer buff + (setq buffer-read-only nil) + (delete-region (point-min) (point-max)) + (ess-setq-vars-local (eval alist)) + (setq ess-local-process-name proc-name) + (ess--help-major-mode) + (setq ess-help-sec-regex "^\\w+:$" + ess-help-type 'vignettes) + (set-buffer-modified-p 'nil) + (goto-char (point-min)) + (dolist (el vslist) + (let ((pack (car el))) + (insert (format "\n\n%s:\n\n" (propertize pack 'face 'underline))) + (dolist (el2 (cdr el)) + (let ((path (if remote + (with-no-warnings + ;; Have to wrap this in with-no-warnings because + ;; otherwise the byte compiler complains about + ;; calling tramp-make-tramp-file-name with an + ;; incorrect number of arguments on Both 26+ and 25 emacses. + (if (>= emacs-major-version 26) + (with-parsed-tramp-file-name default-directory nil + (tramp-make-tramp-file-name method user domain host port (nth 1 el2))) + (with-parsed-tramp-file-name default-directory nil + (tramp-make-tramp-file-name method user host (nth 1 el2))))) + (nth 1 el2)))) + (insert-text-button "doc" + 'mouse-face 'highlight + 'action (if remote + #'ess--action-open-in-emacs + #'ess--action-R-open-vignette) + 'follow-link t + 'vignette (file-name-sans-extension (nth 2 el2)) + 'package pack + 'help-echo (concat path "/doc/" (nth 2 el2))) + (insert " ") + (insert-text-button "source" + 'mouse-face 'highlight + 'action #'ess--action-open-in-emacs + 'follow-link t + 'help-echo (concat path "/doc/" (nth 3 el2))) + (insert " ") + (insert-text-button "R" + 'mouse-face 'highlight + 'action #'ess--action-open-in-emacs + 'follow-link t + 'help-echo (concat path "/doc/" (nth 4 el2))) + (insert (format "\t%s\n" (nth 0 el2))))))) + (goto-char (point-min)) + (insert (propertize "\t\t**** Vignettes ****\n" 'face 'bold-italic)) + (unless (eobp) (delete-char 1)) + (setq buffer-read-only t)) + (ess-display-help buff))) + + + +;; Support for listing R packages + +(define-obsolete-variable-alias 'ess-rutils-buf 'ess-r-package-menu-buf "ESS 19.04") +(define-obsolete-variable-alias 'ess-rutils-mode-map 'ess-r-package-menu-mode-map "ESS 19.04") +(define-obsolete-function-alias 'ess-rutils-mode #'ess-r-package-menu-mode "ESS 19.04") + +(defvar ess-rutils-map + (let ((map (define-prefix-command 'ess-rutils-map))) + (define-key map "l" #'ess-r-package-list-local-packages) + (define-key map "r" #'ess-r-package-list-available-packages) + (define-key map "u" #'ess-r-package-update-packages) + (define-key map "a" #'ess-display-help-apropos) + (define-key map "m" #'ess-rutils-rm-all) + (define-key map "o" #'ess-rdired) + (define-key map "w" #'ess-rutils-load-workspace) + (define-key map "s" #'ess-rutils-save-workspace) + (define-key map "d" #'ess-change-directory) + (define-key map "H" #'ess-rutils-html-docs) + map)) + +(easy-menu-define ess-rutils-mode-menu inferior-ess-mode-menu + "Package management." + '("Package management" + ["List local packages" ess-r-package-list-local-packages t] + ["List available packages" ess-r-package-list-available-packages t] + ["Update packages" ess-r-package-update-packages t])) + +(easy-menu-add-item inferior-ess-mode-menu nil ess-rutils-mode-menu "Utils") +(easy-menu-add-item ess-mode-menu nil ess-rutils-mode-menu "Process") + +(defvar ess-r-package-menu-buf "*R packages*" + "Name of buffer to display R packages in.") + +(defvar ess-r-package-menu-mode-map + (let ((map (make-sparse-keymap))) + (define-key map "l" #'ess-r-package-load) + (define-key map "i" #'ess-r-package-mark-install) + (define-key map "x" #'ess-r-package-execute-marks) + (define-key map "u" #'ess-r-package-unmark) + map) + "Keymap for `ess-rutils-mode'.") + +(define-derived-mode ess-r-package-menu-mode tabulated-list-mode "R utils" + "Major mode for `ess-rutils-local-pkgs' and `ess-rutils-repos-pkgs'." + :group 'ess-R + (setq ess-dialect "R") + (setq mode-name (concat "R packages: " ess-local-process-name)) + (setq tabulated-list-padding 2) + (setq tabulated-list-format + `[("Name" 10 t) + ("Description" 50 nil) + ("Version" 5 t)]) + (tabulated-list-init-header)) + +(define-obsolete-function-alias 'ess-rutils-local-pkgs #'ess-r-package-list-local-packages "ESS 19.04") + +(defun ess-r-package-list-local-packages () + "List all packages in all libraries." + (interactive) + (ess-r-package--list-packages (concat ".ess.rutils.ops <- options(width = 10000);" + "print(installed.packages(fields=c(\"Title\"))[, c(\"Title\", \"Version\")]);" + "options(.ess.rutils.ops); rm(.ess.rutils.ops);" + "\n"))) + +(defun ess-r-package--list-packages (cmd) + "Use CMD to list packages." + (let ((process ess-local-process-name) + des-col-beginning des-col-end entries) + (with-current-buffer (ess-command cmd (get-buffer-create " *ess-rutils-pkgs*")) + (goto-char (point-min)) + (delete-region (point) (1+ (point-at-eol))) + ;; Now we have a buffer with package name, description, and + ;; version. description and version are surrounded by quotes, + ;; description is separated by whitespace. + (re-search-forward "\\>[[:space:]]+") + (setq des-col-beginning (current-column)) + (goto-char (point-at-eol)) + ;; Unless someone has a quote character in their package version, + ;; two quotes back will be the end of the package description. + (dotimes (_ 2) (search-backward "\"")) + (re-search-backward "[[:space:]]*") + (setq des-col-end (current-column)) + (beginning-of-line) + (while (not (eobp)) + (beginning-of-line) + (let* ((name (string-trim (buffer-substring + (point) + (progn (forward-char (1- des-col-beginning)) + (point))))) + (description (string-trim (buffer-substring + (progn (forward-char 1) + (point)) + (progn (forward-char (- des-col-end des-col-beginning)) + (point))))) + (version (buffer-substring + (progn (end-of-line) + (search-backward "\"") + (search-backward "\"") + (forward-char 1) + (point)) + (progn (search-forward "\"") + (backward-char 1) + (point))))) + (push + (list name + `[(,name + help-echo "mouse-2, RET: help on this package" + action ess-rutils-help-on-package) + ,description + ,version]) + entries) + (forward-line))) + (pop-to-buffer ess-rutils-buf) + (setq ess-local-process-name process) + (setq tabulated-list-entries entries) + (ess-r-package-menu-mode) + (tabulated-list-print)))) + +(define-obsolete-function-alias 'ess-rutils-loadpkg #'ess-r-package-load "ESS 19.04") +(defun ess-r-package-load () + "Load package from a library." + (interactive) + (ess-execute (concat "library('" (tabulated-list-get-id) + "', character.only = TRUE)") + 'buffer)) + +(defun ess-rutils-help-on-package (&optional _button) + "Display help on the package at point." + (interactive) + ;; FIXME: Should go to a help buffer + (ess-execute (concat "help(" (tabulated-list-get-id) ", package = '" + (tabulated-list-get-id)"')") + 'buffer)) + +(define-obsolete-function-alias 'ess-rutils-repos-pkgs #'ess-r-package-list-available-packages "ESS 19.04") +(defun ess-r-package-list-available-packages () + "List available packages. +Use the repositories as listed by getOptions(\"repos\") in the +current R session." + (interactive) + (ess-r-package--list-packages + "{ + .ess.rutils.ops <- options(width = 10000) + print(available.packages(fields=c(\"Title\"))[, c(\"Title\", \"Version\")]) + options(.ess.rutils.ops); rm(.ess.rutils.ops) + }\n")) + +(define-obsolete-function-alias 'ess-rutils-mark-install #'ess-r-package-mark-install "ESS 19.04") +(defun ess-r-package-mark-install () + "Mark the current package for installing." + (interactive) + (tabulated-list-put-tag "i" t)) + +(define-obsolete-function-alias 'ess-rutils-unmark #'ess-r-package-unmark "ESS 19.04") +(defun ess-r-package-unmark () + "Unmark the packages." + (interactive) + (tabulated-list-put-tag " " t)) + +(define-obsolete-function-alias 'ess-rutils-execute-marks #'ess-r-package-execute-marks "ESS 19.04") +(defun ess-r-package-execute-marks () + "Perform all marked actions." + (interactive) + ;; Install + (save-excursion + (let ((cmd "install.packages(c(") + pkgs) + (goto-char (point-min)) + (while (not (eobp)) + (when (looking-at-p "i") + (setq pkgs (concat "\"" (tabulated-list-get-id) "\", " pkgs)) + (tabulated-list-put-tag " ")) + (forward-line)) + (if pkgs + (progn (setq pkgs (substring pkgs 0 (- (length pkgs) 2))) + (setq cmd (concat cmd pkgs "))")) + (ess-execute cmd 'buffer)) + (message "No packages marked for install"))))) + +(define-obsolete-function-alias 'ess-rutils-update-pkgs #'ess-r-package-update-packages "ESS 19.04") +(defun ess-r-package-update-packages (lib repo) + "Update packages in library LIB and repo REPO. +This also uses checkBuilt=TRUE to rebuild installed packages if +needed." + (interactive + (list (ess-completing-read "Library to update: " (ess-get-words-from-vector + "as.character(.libPaths())\n")) + (ess-completing-read "Repo: " (ess-get-words-from-vector + "as.character(getOption(\"repos\"))\n")))) + (ess-execute (format "update.packages(lib.loc='%s', repos='%s', ask=FALSE, checkBuilt=TRUE)" lib repo) 'buffer)) + +(define-obsolete-function-alias 'ess-rutils-apropos #'ess-display-help-apropos "ESS 19.04") + +;; Miscellaneous helper functions + +(defun ess-rutils-rm-all () + "Remove all R objects." + (interactive) + (when (y-or-n-p "Delete all objects? ") + (ess-execute "rm(list=ls())" 'buffer))) + +(defun ess-rutils-load-workspace (file) + "Load workspace FILE into R." + (interactive "fFile with workspace to load: ") + (ess-execute (concat "load('" file "')") 'buffer)) +(define-obsolete-function-alias 'ess-rutils-load-wkspc #'ess-rutils-load-workspace "ESS 19.04") + +(defun ess-rutils-save-workspace (file) + "Save FILE workspace as file.RData." + (interactive "FSave workspace to file (no extension): ") + (ess-execute (concat "save.image('" file ".RData')") 'buffer)) +(define-obsolete-function-alias 'ess-rutils-save-wkspc #'ess-rutils-save-workspace "ESS 19.04") + +(defun ess-rutils-quit () + "Kill the ess-rutils buffer and return to the iESS buffer." + (interactive) + (ess-switch-to-end-of-ESS) + (kill-buffer ess-rutils-buf)) + +(defun ess-rutils-html-docs (&optional remote) + "Use `browse-url' to navigate R html documentation. +Documentation is produced by a modified help.start(), that +returns the URL produced by GNU R's http server. If called with a +prefix, the modified help.start() is called with update=TRUE. The +optional REMOTE argument should be a string with a valid URL for +the 'R_HOME' directory on a remote server (defaults to NULL)." + (interactive) + (let* ((update (if current-prefix-arg "update=TRUE" "update=FALSE")) + (remote (if (or (and remote (not (string= "" remote)))) + (concat "remote=" remote) "remote=NULL")) + (proc ess-local-process-name) + (rhtml (format ".ess_help_start(%s, %s)\n" update remote))) + (with-temp-buffer + (ess-command rhtml (current-buffer) nil nil nil (get-process proc)) + (let* ((begurl (search-backward "http://")) + (endurl (search-forward "index.html")) + (url (buffer-substring-no-properties begurl endurl))) + (browse-url url))))) + +(defun ess-rutils-rsitesearch (string) + "Search the R archives for STRING, and show results using `browse-url'. +If called with a prefix, options are offered (with completion) +for matches per page, sections of the archives to search, +displaying results in long or short formats, and sorting by any +given field. Options should be separated by value of +`crm-default-separator'." + (interactive "sSearch string: ") + (let ((site "https://search.r-project.org/cgi-bin/namazu.cgi?query=") + (okstring (replace-regexp-in-string " +" "+" string))) + (if current-prefix-arg + (let ((mpp (concat + "&max=" + (completing-read + "Matches per page: " + '(("20" 1) ("30" 2) ("40" 3) ("50" 4) ("100" 5))))) + (format (concat + "&result=" + (completing-read + "Format: " '(("normal" 1) ("short" 2)) + nil t "normal" nil "normal"))) + (sortby (concat + "&sort=" + (completing-read + "Sort by: " + '(("score" 1) ("date:late" 2) ("date:early" 3) + ("field:subject:ascending" 4) + ("field:subject:decending" 5) + ("field:from:ascending" 6) ("field:from:decending" 7) + ("field:size:ascending" 8) ("field:size:decending" 9)) + nil t "score" nil "score"))) + (restrict (concat + "&idxname=" + (mapconcat + 'identity + (completing-read-multiple + "Limit search to: " + '(("Rhelp02a" 1) ("functions" 2) + ("docs" 3) ("Rhelp01" 4)) + nil t "Rhelp02a,functions,docs" nil + "Rhelp02a,functions,docs") "&idxname=")))) + (browse-url (concat site okstring mpp format sortby restrict))) + (browse-url (concat site okstring "&max=20&result=normal&sort=score" + "&idxname=Rhelp02a&idxname=functions&idxname=docs"))))) + +(defun ess-rutils-help-search (string) + "Search for STRING using help.search()." + (interactive "sString to search for? ") + (let ((proc ess-local-process-name)) + (pop-to-buffer "foobar") + (ess-command (concat "help.search('" string "')\n") + (current-buffer) nil nil nil (get-process proc)))) + +(make-obsolete 'ess-rutils-rhtml-fn "overwrite .ess_help_start instead." "ESS 18.10") + + ;; Create functions that can be called for running different versions ;; of R. ;; FIXME: Should be set in ess-custom (setq ess-rterm-version-paths (ess-flatten-list - (ess-uniq-list + (delete-dups (if (not ess-directory-containing-R) (if (getenv "ProgramW6432") (let ((P-1 (getenv "ProgramFiles(x86)")) @@ -2257,13 +2945,10 @@ ;;*;; Provide and auto-loads ;;;###autoload -(add-to-list 'auto-mode-alist '("/Makevars\\(\\.win\\)?$" . makefile-mode)) +(add-to-list 'auto-mode-alist '("/Makevars\\(\\.win\\)?\\'" . makefile-mode)) +;;;###autoload +(add-to-list 'auto-mode-alist '("DESCRIPTION\\'" . conf-colon-mode)) (provide 'ess-r-mode) -;;; Local variables: -;;; mode: emacs-lisp -;;; byte-compile-warnings: (not lexical) -;;; End: - ;;; ess-r-mode.el ends here diff -Nru ess-18.10.2/lisp/ess-roxy.el ess-18.10.2+git20220915.f45542e/lisp/ess-roxy.el --- ess-18.10.2/lisp/ess-roxy.el 2018-11-10 09:41:11.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/lisp/ess-roxy.el 2022-10-15 08:06:36.000000000 +0000 @@ -1,28 +1,25 @@ ;;; ess-roxy.el --- convenient editing of in-code roxygen documentation -;; -;; Copyright (C) 2009--2017 Henning Redestig, A.J. Rossini, Richard -;; M. Heiberger, Martin Maechler, Kurt Hornik, Rodney Sparapani, Stephen -;; Eglen and Vitalie Spinu. -;; + +;; Copyright (C) 2009-2020 Free Software Foundation, Inc. ;; Author: Henning Redestig -;; Keywords: convenience, tools -;; -;; This file is part of ESS + +;; This file is part of GNU Emacs. + +;;; License: ;; -;; This program is free software; you can redistribute it and/or -;; modify it under the terms of the GNU General Public License as -;; published by the Free Software Foundation; either version 3 of the -;; License, or (at your option) any later version. +;; This program is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. ;; -;; This program is distributed in the hope that it will be useful, but -;; WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -;; General Public License for more details. +;; This program is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. ;; ;; You should have received a copy of the GNU General Public License ;; along with this program. If not, see -;; . - +;; ;;; Commentary: @@ -36,11 +33,11 @@ ;; - C-c C-o C-o :: update template ;; - navigating and filling roxygen fields ;; - C-c TAB, M-q, C-a, ENTER, M-h :: advised tag completion, fill-paragraph, -;; move-beginning-of-line, newline-and-indent +;; ess-roxy-move-beginning-of-line, newline-and-indent ;; - C-c C-o n,p :: next, previous roxygen entry ;; - C-c C-o C-c :: Unroxygen region. Convenient for editing examples. ;; - folding visibility using hs-minor-mode -;; - TAB :: advised ess-ident-command, hide entry if in roxygen doc. +;; - TAB :: advised ess-indent-command, hide entry if in roxygen doc. ;; - preview ;; - C-c C-o C-r :: create a preview of the Rd file as generated ;; using roxygen @@ -57,93 +54,113 @@ ;; a replacement for hideshow. ;; - only limited functionality for S4 documentation. -;; this *is* enabled now via ess-mode-hook in ./ess-site.el - ;;; Code: (require 'ess-utils) -(require 'ess-custom) -(require 'ess-utils) (require 'hideshow) (require 'outline) (eval-when-compile - (require 'cl-lib)) -(require 'essddr "ess-rd.el") + (require 'cl-lib) + (require 'subr-x)) +(require 'ess-rd) +(require 'ess-r-syntax) (defvar roxy-str) +(defvar ess-r-mode-syntax-table) +(declare-function ess-fill-args "ess-r-mode") +(declare-function ess-fill-continuations "ess-r-mode") +(declare-function inferior-ess-r-force "ess-r-mode") + +(defvar-local ess-roxy-re nil + "Regular expression to recognize roxygen blocks.") ;;*;; Roxy Minor Mode (defvar ess-roxy-mode-map (let ((map (make-sparse-keymap))) - (if ess-roxy-hide-show-p - (define-key map (kbd "C-c C-o h") 'ess-roxy-hide-all)) - ;; short version (*first*: -> key binding shown in menu): - (define-key map (kbd "C-c C-o n") 'ess-roxy-next-entry) - (define-key map (kbd "C-c C-o p") 'ess-roxy-previous-entry) - ;; For consistency (e.g. C-c C-o C-h !): kept here *in* addition to above - (define-key map (kbd "C-c C-o C-o") 'ess-roxy-update-entry) - (define-key map (kbd "C-c C-o C-r") 'ess-roxy-preview-Rd) - (define-key map (kbd "C-c C-o C-w") 'ess-roxy-preview-HTML) - (define-key map (kbd "C-c C-o C-t") 'ess-roxy-preview-text) - (define-key map (kbd "C-c C-o C-c") 'ess-roxy-toggle-roxy-region) + (define-key map (kbd "C-c C-o h") #'ess-roxy-hide-all) + (define-key map (kbd "C-c C-o n") #'ess-roxy-next-entry) + (define-key map (kbd "C-c C-o p") #'ess-roxy-previous-entry) + (define-key map (kbd "C-c C-o C-o") #'ess-roxy-update-entry) + (define-key map (kbd "C-c C-o C-r") #'ess-roxy-preview-Rd) + (define-key map (kbd "C-c C-o C-w") #'ess-roxy-preview-HTML) + (define-key map (kbd "C-c C-o C-t") #'ess-roxy-preview-text) + (define-key map (kbd "C-c C-o C-c") #'ess-roxy-toggle-roxy-region) + (define-key map [remap back-to-indentation] #'ess-roxy-goto-end-of-roxy-comment) + (define-key map [remap newline] #'ess-roxy-newline) + (define-key map [remap newline-and-indent] #'ess-roxy-newline) + (define-key map [remap ess-indent-command] #'ess-roxy-ess-indent-command) + (define-key map [remap move-beginning-of-line] #'ess-roxy-move-beginning-of-line) + (define-key map [remap beginning-of-visual-line] #'ess-roxy-move-beginning-of-line) map)) -(defvar ess-roxy-font-lock-keywords - `((,(concat ess-roxy-re " *\\([@\\]" - (regexp-opt ess-roxy-tags-param t) - "\\)\\>") - (1 'font-lock-keyword-face prepend)) - (,(concat ess-roxy-re " *\\(@" - (regexp-opt '("param" "importFrom" "importClassesFrom" - "importMethodsFrom") - 'words) - "\\)\\(?:[ \t]+\\(\\(?:\\sw+,?\\)+\\)\\)") - (1 'font-lock-keyword-face prepend) - (3 'font-lock-variable-name-face prepend)) - (,(concat "[@\\]" (regexp-opt ess-roxy-tags-noparam t) "\\>") - (0 'font-lock-variable-name-face prepend)) - (,(concat ess-roxy-re) - (0 'bold prepend)))) +(defvar ess-roxy-font-lock-keywords nil + "Cache set by `ess-roxy-generate-keywords'. +Used to remove keywords added by function `ess-roxy-mode'.") + +(defun ess-roxy-generate-keywords () + "Generate a list of keywords suitable for `font-lock-add-keywords'." + (setq-local ess-roxy-font-lock-keywords + `((,(concat ess-roxy-re " *\\([@\\]" + (regexp-opt ess-roxy-tags-param t) + "\\)\\>") + (1 'font-lock-keyword-face prepend)) + (,(concat ess-roxy-re " *\\(@" + (regexp-opt '("param" "importFrom" "importClassesFrom" + "importMethodsFrom" "describeIn") + 'words) + "\\)\\(?:[ \t]+\\(\\(?:\\sw+,?\\)+\\)\\)") + (1 'font-lock-keyword-face prepend) + (3 'font-lock-variable-name-face prepend)) + (,(concat "[@\\]" (regexp-opt ess-roxy-tags-noparam t) "\\>") + (0 'font-lock-variable-name-face prepend)) + (,(concat ess-roxy-re) + (0 'bold prepend))))) (defvar ess-roxy-fold-examples nil "Whether to fold `@examples' when opening a buffer. Use you regular key for `outline-show-entry' to reveal it.") +;;;###autoload (define-minor-mode ess-roxy-mode "Minor mode for editing ROxygen documentation." :keymap ess-roxy-mode-map (if ess-roxy-mode + ;; Turn on `ess-roxy-mode': (progn - (font-lock-add-keywords nil ess-roxy-font-lock-keywords) - (add-hook 'completion-at-point-functions #'ess-roxy-complete-tag 'local) ;; should be first + (setq-local ess-roxy-re (concat "^" (string-trim comment-start) "+'")) + (font-lock-add-keywords nil (ess-roxy-generate-keywords)) + (add-hook 'completion-at-point-functions #'ess-roxy-complete-tag nil t) ;; Hideshow Integration - (when (and ess-roxy-hide-show-p (featurep 'hideshow)) + (when ess-roxy-hide-show-p (hs-minor-mode 1) (when ess-roxy-start-hidden-p (ess-roxy-hide-all))) ;; Outline Integration (when ess-roxy-fold-examples - (ess-roxy-hide-all-examples))) - (when (and ess-roxy-hide-show-p - (bound-and-true-p hs-minor-mode)) + (ess-roxy-hide-all-examples)) + ;; Autofill + (setq-local paragraph-start (concat "\\(" ess-roxy-re "\\)*" paragraph-start)) + (setq-local paragraph-separate (concat "\\(" ess-roxy-re "\\)*" paragraph-separate)) + (setq-local adaptive-fill-function 'ess-roxy-adaptive-fill-function) + ;; Hooks + (add-hook 'ess-presend-filter-functions 'ess-roxy-remove-roxy-re nil t)) + ;; Turn off `ess-roxy-mode': + ;; Hideshow + (when (and ess-roxy-hide-show-p hs-minor-mode) (hs-show-all) (hs-minor-mode)) + ;; Hooks + (remove-hook 'ess-presend-filter-functions 'ess-roxy-remove-roxy-re t) (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)) + ;; (setq-local syntax-propertize-function nil) + ;; (setq-local font-lock-fontify-region-function nil) + ;; (setq-local font-lock-unfontify-region-function nil) + ) + ;; Regardless of turning on or off we need to re-fontify the buffer: (when font-lock-mode - (if (fboundp 'font-lock-flush) - (font-lock-flush) - ;; font-lock-fontify-buffer call can be removed when we drop - ;; support for Emacs older than 25.1 - (with-no-warnings (font-lock-fontify-buffer)))) - ;; Autofill - (setq-local paragraph-start (concat "\\(" ess-roxy-re "\\)*" paragraph-start)) - (setq-local paragraph-separate (concat "\\(" ess-roxy-re "\\)*" paragraph-separate)) - (setq-local adaptive-fill-function 'ess-roxy-adaptive-fill-function)) + (font-lock-flush))) @@ -201,10 +218,9 @@ (defun ess-back-to-roxy () "Go to roxy prefix." - (progn - (end-of-line) - (re-search-backward (concat ess-roxy-re " ?") (point-at-bol)) - (goto-char (match-end 0)))) + (end-of-line) + (re-search-backward (concat ess-roxy-re " ?") (point-at-bol)) + (goto-char (match-end 0))) (defun ess-roxy-beg-of-entry () "Get point number at start of current entry, 0 if not in entry." @@ -292,10 +308,13 @@ end))) (defun ess-roxy-entry-p (&optional field) - "True if point is in a roxy entry." - (and (save-excursion + "Non-nil if point is in a roxy entry. +FIELD allows checking for a specific field with +`ess-roxy-current-field'." + (and ess-roxy-mode + (save-excursion (beginning-of-line) - (looking-at ess-roxy-re)) + (looking-at-p ess-roxy-re)) (or (null field) (string= (ess-roxy-current-field) field)))) @@ -309,8 +328,10 @@ (defun ess-roxy-extract-field () (let ((field (buffer-substring (ess-roxy-beg-of-entry) (ess-roxy-end-of-entry))) - (prefix-re (ess-roxy-guess-str))) + (prefix-re (ess-roxy-guess-str)) + (roxy-re ess-roxy-re)) (with-temp-buffer + (setq ess-roxy-re roxy-re) (insert field) (goto-char (point-min)) (while (re-search-forward prefix-re (point-max) 'noerror) @@ -360,7 +381,8 @@ (ess-roxy-goto-end-of-entry) (forward-line 1) (beginning-of-line)) - (goto-char (car (ess-end-of-function))))) + (unless (looking-at-p ess-function-pattern) + (beginning-of-defun)))) (defun ess-roxy-get-args-list-from-def () "Get args list for current function." @@ -373,27 +395,23 @@ "Insert an ARGS list to the end of the current roxygen entry. If HERE is supplied start inputting `here'. Finish at end of line." - (let* ((arg-des nil) - (roxy-str (ess-roxy-guess-str))) - (if (or (not here) (< here 1)) - (progn - (ess-roxy-goto-end-of-entry) - (beginning-of-line) - (if (not (looking-at "\=")) - (progn - (end-of-line)))) - (goto-char here)) - (while (stringp (car (car args))) + (let* ((roxy-str (ess-roxy-guess-str)) + arg-des) + (if (and here (< 1 here)) + (goto-char here) + (ess-roxy-goto-end-of-entry) + (beginning-of-line) + (when (not (looking-at-p "=")) + (end-of-line))) + (while (stringp (caar args)) (setq arg-des (pop args)) (unless (string= (car arg-des) "") - (progn - (insert (concat "\n" - roxy-str " @param " (car arg-des) " ")) - (insert - (ess-replace-in-string (concat (car (cdr arg-des))) "\n" - (concat "\n" roxy-str))) - (if ess-roxy-fill-param-p - (fill-paragraph))))))) + (insert (concat "\n" roxy-str " @param " (car arg-des) " ")) + (insert + (ess-replace-in-string (concat (car (cdr arg-des))) "\n" + (concat "\n" roxy-str))) + (when ess-roxy-fill-param-p + (fill-paragraph)))))) (defun ess-roxy-merge-args (fun ent) "Take two args lists (alists) and return their union. @@ -403,13 +421,13 @@ the empty string." (let ((res-arg nil) (arg-des)) - (while (stringp (car (car fun))) + (while (stringp (caar fun)) (setq arg-des (pop fun)) (if (assoc (car arg-des) ent) (setq res-arg (cons (cons (car arg-des) (cdr (assoc (car arg-des) ent))) res-arg)) (setq res-arg (cons (cons (car arg-des) '("")) res-arg)))) - (while (stringp (car (car ent))) + (while (stringp (caar ent)) (setq arg-des (pop ent)) (if (and (not (assoc (car arg-des) res-arg)) (not (string= (car (cdr arg-des)) ""))) (setq res-arg (cons (cons (car arg-des) (cdr arg-des)) res-arg)))) @@ -422,28 +440,26 @@ `ess-roxy-template-alist'. The parameter descriptions can are filled if `ess-roxy-fill-param-p' is non-nil." (interactive) + (unless (derived-mode-p 'ess-r-mode) + (user-error "%s mode not yet supported" major-mode)) (save-excursion (let* ((args-fun (ess-roxy-get-args-list-from-def)) (args-ent (ess-roxy-get-args-list-from-entry)) (args (ess-roxy-merge-args args-fun args-ent)) (roxy-str (ess-roxy-guess-str)) (line-break "") - here key template tag-def) + template tag-def) (ess-roxy-goto-func-def) - (if (not (= (forward-line -1) 0)) - (progn - (insert "\n") - (forward-line -1))) - (if (and (not (looking-at "^\n")) (not (ess-roxy-entry-p))) - (progn - (end-of-line) - (insert "\n"))) + (when (not (= (forward-line -1) 0)) + (insert "\n") + (forward-line -1)) + (when (and (not (looking-at "^\n")) (not (ess-roxy-entry-p))) + (end-of-line) + (insert "\n")) (if (ess-roxy-entry-p) - (progn - (setq here (1- (ess-roxy-delete-args))) - (ess-roxy-insert-args args here)) + (ess-roxy-insert-args args (1- (ess-roxy-delete-args))) (setq template (copy-sequence ess-roxy-template-alist)) - (while (stringp (car (car template))) + (while (stringp (caar template)) (setq tag-def (pop template)) (if (string= (car tag-def) "param") (ess-roxy-insert-args args (point)) @@ -453,23 +469,22 @@ (if (string= (car tag-def) "details") (insert (concat line-break roxy-str " " (cdr tag-def))) (insert (concat line-break roxy-str " @" - (car tag-def) " " (cdr tag-def)))) - )) + (car tag-def) " " (cdr tag-def)))))) (setq line-break "\n")))))) (defun ess-roxy-goto-end-of-entry () - "Put point at the top of the current entry or above the function at point. + "Put point at the bottom of the current entry or above the function at point. Return t if the point is left in a roxygen entry, otherwise nil. Error if point is not in function or roxygen entry." - (if (not (ess-roxy-entry-p)) - (progn - (goto-char (nth 0 (ess-end-of-function))) - (forward-line -1))) + (when (not (ess-roxy-entry-p)) + (beginning-of-defun) + (forward-line -1)) (if (ess-roxy-entry-p) - (progn - (goto-char (ess-roxy-end-of-entry)) - t) - (forward-line) nil)) + (progn (goto-char (ess-roxy-end-of-entry)) + t) + (forward-line) + nil) + (ess-roxy-entry-p)) (defun ess-roxy-goto-beg-of-entry () "Put point at the top of the entry at point or above the function at point. @@ -478,7 +493,7 @@ roxygen entry." (if (not (ess-roxy-entry-p)) (progn - (goto-char (nth 0 (ess-end-of-function))) + (goto-char (nth 0 (end-of-defun))) (forward-line -1))) (if (ess-roxy-entry-p) (progn @@ -491,8 +506,7 @@ Return 0 if no deletions were made other wise the point at where the last deletion ended" (save-excursion - (let* ((args nil) - (cont t) + (let* ((cont t) (field-beg 0) entry-beg entry-end field-end) (ess-roxy-goto-end-of-entry) @@ -548,12 +562,14 @@ nil)))) (defun ess-roxy-toggle-roxy-region (beg end) - "Remove prefix roxy string in this region if point is in a roxy -region, otherwise prefix all lines with the roxy -string. Convenient for editing example fields." + "Toggle prefix roxygen string from BEG to END. +Add the prefix if missing, remove if found. BEG and END default +to the region, if active, and otherwise the entire line. This is +convenient for editing example fields." (interactive "r") - (unless (use-region-p) - (error "Region is not active")) + (unless (and beg end) + (setq beg (line-beginning-position) + end (line-end-position))) (ess-roxy-roxy-region beg end (ess-roxy-entry-p))) (defun ess-roxy-roxy-region (beg end &optional on) @@ -572,20 +588,23 @@ (widen)))) (defun ess-roxy-preview () - "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." + "Generate documentation for roxygen entry at point. +Use a connected R session (starting one if necessary) and +`ess-roxy-package' to generate the Rd code for the entry at +point. Place it in a buffer and return that buffer." + (unless (derived-mode-p 'ess-r-mode) + (user-error "Preview only supported in R buffers, try `ess-r-devtools-document-package' instead")) (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)))" )) + "cat(vapply(..results, function(x) roxygen2:::rd_out_cache$compute(x, format(x)), character(1)), \"\\n\")" )) (R-new-roxy (concat "..results <- roc_proc_text(rd_roclet(), readChar(P, file.info(P)$size));" - "cat(vapply(..results, format, character(1)), \"\n\")" )) + "cat(vapply(..results, format, character(1)), \"\\n\")" )) (out-rd-roclet (cond ((string= "roxygen" ess-roxy-package) "make.Rd2.roclet()$parse") @@ -595,16 +614,19 @@ R-old-roxy "} else {" R-new-roxy "} })")) (t (error "Need to hard code the roclet output call for roxygen package '%s'" ess-roxy-package))))) - (if (= beg 0) - (error "Point is not in a Roxygen entry")) + (when (= beg 0) + (error "Point is not in a Roxygen entry")) (save-excursion (goto-char (ess-roxy-end-of-entry)) (forward-line 1) - (if (ess-end-of-function nil t) + (if (end-of-defun) (append-to-file beg (point) tmpf) - (while (and (forward-line 1) (not (looking-at "^$")) - (not (looking-at ess-roxy-re)))) + (while (and (forward-line 1) + (not (looking-at-p "^$")) + (not (eobp)) + (not (looking-at-p ess-roxy-re)))) (append-to-file beg (point) tmpf)) + (inferior-ess-r-force) (ess-force-buffer-current) (unless (ess-boolean-command (concat "print(suppressWarnings(require(" ess-roxy-package ", quietly=TRUE)))\n")) @@ -670,10 +692,7 @@ (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: - (with-no-warnings (font-lock-fontify-buffer))))) + (font-lock-ensure))) (defun ess-roxy-guess-str (&optional not-here) @@ -689,7 +708,9 @@ (search-backward-regexp ess-roxy-re))) (if (or not-here (ess-roxy-entry-p)) (match-string 0) - ess-roxy-str))) + (if (derived-mode-p 'ess-r-mode) + ess-roxy-str + (concat (string-trim comment-start) "'"))))) (defun ess-roxy-hide-block () "Hide current roxygen comment block." @@ -716,6 +737,8 @@ (defun ess-roxy-hide-all (&optional show) "Hide all Roxygen entries in current buffer." (interactive) + (when (not ess-roxy-hide-show-p) + (user-error "First enable hide-show with `ess-roxy-hide-show-p'")) (hs-life-goes-on (save-excursion (goto-char (point-min)) @@ -748,18 +771,17 @@ (goto-char (ess-roxy-beg-of-entry))) (defun ess-roxy-get-function-args () - "Return the arguments specified for the current function as a list of strings." + "Return the arguments specified for the current function as a list of strings. +Assumes point is at the beginning of the function." (save-excursion (let ((args-txt - (progn - (ess-beginning-of-function) - (buffer-substring-no-properties - (progn - (search-forward-regexp "\\([=,-]+ *function *\\|^\s*function\\)" nil nil 1) - (+ (point) 1)) - (progn - (ess-roxy-match-paren) - (point)))))) + (buffer-substring-no-properties + (progn + (search-forward-regexp "\\([=,-]+ *function *\\|^\s*function\\)" nil nil 1) + (+ (point) 1)) + (progn + (ess-roxy-match-paren) + (point))))) (setq args-txt (replace-regexp-in-string "#+[^\"']*\n" "" args-txt)) (setq args-txt (replace-regexp-in-string "([^)]+)" "" args-txt)) (setq args-txt (replace-regexp-in-string "=[^,]+" "" args-txt)) @@ -784,8 +806,7 @@ (defun ess-roxy-tag-completion () "Completion data for Emacs >= 24." (when (save-excursion (re-search-backward "@\\<\\(\\w*\\)" (point-at-bol) t)) - (let ((token (match-string-no-properties 1)) - (beg (match-beginning 1)) + (let ((beg (match-beginning 1)) (end (match-end 1))) (when (and end (= end (point))) (list beg end (append ess-roxy-tags-noparam ess-roxy-tags-param) :exclusive 'no))))) @@ -794,16 +815,20 @@ "Remove `ess-roxy-str' from STRING before sending to R process. Useful for sending code from example section. This function is placed in `ess-presend-filter-functions'." - ;; Only strip the prefix in the @examples field, and only when - ;; STRING is entirely contained inside it. This allows better - ;; behaviour for evaluation of regions. - (if (and (ess-roxy-entry-p "examples") - (with-temp-buffer - (insert string) - (ess-roxy-entry-p))) + ;; In the future we might want to detect chunks between markdown + ;; fences and strip everything that comes before `@examples` + (if (ess-roxy--all-prefixed string) (replace-regexp-in-string (concat ess-roxy-re "\\s-*") "" string) string)) -(add-hook 'ess-presend-filter-functions 'ess-roxy-remove-roxy-re nil) + +(defun ess-roxy--all-prefixed (string) + (let ((ess-roxy-re-lexical ess-roxy-re)) + (with-temp-buffer + (insert string) + (goto-char 0) + (while (and (looking-at-p ess-roxy-re-lexical) + (re-search-forward "\n" nil t))) + (looking-at-p ess-roxy-re-lexical)))) (defun ess-roxy-find-par-end (stop-point &rest stoppers) (mapc #'(lambda (stopper) @@ -818,60 +843,85 @@ ;;*;; Advices - (defmacro ess-roxy-with-filling-context (examples &rest body) - (declare (indent 0) (debug (&rest form))) - `(let ((comment-start "#+'[ \t]+#") - (comment-start-skip "#+'[ \t]+# *") + "Setup context (e.g. `comment-start') for filling roxygen BODY. +EXAMPLES should be non-nil if filling an example block." + (declare (indent 2) (debug (&rest form))) + `(let ((comment-start (concat ess-roxy-re "[ \t]+#")) + (comment-start-skip (concat ess-roxy-re "[ \t]+# *")) (comment-use-syntax nil) (adaptive-fill-first-line-regexp (concat ess-roxy-re "[ \t]*")) (paragraph-start (concat "\\(" ess-roxy-re "\\(" paragraph-start "\\|[ \t]*@" "\\)" "\\)\\|\\(" paragraph-start "\\)")) (temp-table (if ,examples - (make-syntax-table S-syntax-table) + (make-syntax-table ess-r-mode-syntax-table) Rd-mode-syntax-table))) (when ,examples ;; Prevent the roxy prefix to be interpreted as comment or string ;; starter (modify-syntax-entry ?# "w" temp-table) (modify-syntax-entry ?' "w" temp-table)) - ;; Neutralise (comment-normalize-vars) because it modifies the + ;; Neutralize (comment-normalize-vars) because it modifies the ;; comment-start regexp in such a way that paragraph filling of ;; comments in @examples fields does not work (cl-letf (((symbol-function 'comment-normalize-vars) #'ignore)) (with-syntax-table temp-table ,@body)))) -(defadvice ess-eval-line-and-step (around ess-eval-line-and-step-roxy) - "Evaluate line but do not skip over comment (roxy) lines." - (if (ess-roxy-entry-p) - (let ((simple-next t)) - ad-do-it) - ad-do-it)) - -(defadvice ess-indent-command (around ess-roxy-toggle-hiding) - "Hide this block if we are at the beginning of the line." - (if (and (= (point) (point-at-bol)) (ess-roxy-entry-p) 'ess-roxy-hide-show-p) +(defun ess-roxy-ess-indent-command (&optional whole-exp) + "Hide this block if we are at the beginning of the line. +Else call `ess-indent-command'." + (interactive "P") + (if (and (bolp) (ess-roxy-entry-p) ess-roxy-hide-show-p) (progn (ess-roxy-toggle-hiding)) - ad-do-it)) + (ess-indent-command whole-exp))) -(defadvice fill-paragraph (around ess-roxy-fill-advise) - "Fill roxygen paragraphs." +(defun ess--roxy-fill-block (fun &optional args) + "Fill a roxygen block. +FUN should be a filling function and ARGS gets passed to it." + (let* ((saved-pos (point)) + (par-start (save-excursion + (if (save-excursion + (and (backward-paragraph) + (forward-paragraph) + (<= (point) saved-pos))) + (line-beginning-position) + (progn (backward-paragraph) (point))))) + (par-end (ess-roxy-find-par-end + (save-excursion + (forward-paragraph) + (point)) + (concat ess-roxy-re "[ \t]*@examples\\b") "^[^#]"))) + ;; Refill the whole structural paragraph sequentially, field by + ;; field, stopping at @examples + (ess-roxy-with-filling-context nil + (save-excursion + (save-restriction + (narrow-to-region par-start par-end) + (goto-char (point-min)) + (while (< (point) (point-max)) + (ess-roxy-maybe-indent-line) + (apply fun args) + (forward-paragraph))))))) + +(defun ess-r--fill-paragraph (orig-fun &rest args) + "ESS fill paragraph for R mode. +Overrides `fill-paragraph' which is ORIG-FUN when necessary and +passes ARGS to it." (cond ;; Regular case - ((not (and (eq major-mode 'ess-mode) - (string= ess-dialect "R"))) - ad-do-it) + ((not (derived-mode-p 'ess-r-mode)) + (apply orig-fun args)) ;; Filling of code comments in @examples roxy field ((and (ess-roxy-entry-p) (save-excursion - (back-to-indentation) + (ess-roxy-goto-end-of-roxy-comment) (looking-at "#"))) (ess-roxy-with-filling-context t - ad-do-it)) + (apply orig-fun args))) ((and (not (ess-roxy-entry-p)) (ess-inside-comment-p)) - ad-do-it) + (apply orig-fun args)) ;; Filling of call arguments with point on call name ((and ess-fill-calls (ess-inside-call-name-p)) @@ -889,69 +939,51 @@ (ess-fill-args)) ;; Filling of roxy blocks ((ess-roxy-entry-p) - (save-excursion - (let* ((saved-pos (point)) - (saved-line (line-number-at-pos)) - (saved-col (current-column)) - (buffer (current-buffer)) - (par-start (save-excursion - (if (save-excursion - (and (backward-paragraph) - (forward-paragraph) - (<= (point) saved-pos))) - (line-beginning-position) - (progn (backward-paragraph) (point))))) - (par-end (ess-roxy-find-par-end - (save-excursion - (forward-paragraph) - (point)) - (concat ess-roxy-re "[ \t]*@examples\\b") "^[^#]"))) - ;; Refill the whole structural paragraph sequentially, field by - ;; field, stopping at @examples - (ess-roxy-with-filling-context nil - (save-excursion - (save-restriction - (narrow-to-region par-start par-end) - (goto-char 0) - (while (< (point) (point-max)) - (ess-roxy-maybe-indent-line) - ad-do-it - (forward-paragraph)))))))) + (ess--roxy-fill-block orig-fun args)) (t - ad-do-it))) + (apply orig-fun args)))) +(advice-add 'fill-paragraph :around #'ess-r--fill-paragraph) -(defadvice move-beginning-of-line (around ess-roxy-beginning-of-line) - "Move to start." +(defun ess-roxy-move-beginning-of-line (arg) + "Move point to the beginning of the current line or roxygen comment. +If not in a roxygen comment, call `move-beginning-of-line', which +see for ARG. If in a roxygen field, leave point at the end of a +roxygen comment. If already there, move to the beginning of the +line." + (interactive "^p") (if (ess-roxy-entry-p) - (let ((new-pos (save-excursion - (end-of-line) - (and (re-search-backward (concat ess-roxy-re " ?") (point-at-bol) t) - (match-end 0))))) - (if (or (bolp) - (< new-pos (point))) - (goto-char new-pos) - ad-do-it)) - ad-do-it)) - -(defadvice back-to-indentation (around ess-roxy-back-to-indentation) - "Handle `back-to-indentation' in roxygen doc." + (let ((pos (point))) + (ess-roxy-goto-end-of-roxy-comment) + (when (eql (point) pos) + (move-beginning-of-line nil))) + (move-beginning-of-line arg))) + +(defun ess-roxy-goto-end-of-roxy-comment () + "Leave point at the end of a roxygen comment. +If not in a roxygen entry, call `back-to-indentation'." + (interactive) (if (ess-roxy-entry-p) (progn (end-of-line) (re-search-backward (concat ess-roxy-re " *") (point-at-bol) t) (goto-char (match-end 0))) - ad-do-it)) + (back-to-indentation))) (defun ess-roxy-indent-new-comment-line () (if (not (ess-roxy-entry-p)) (indent-new-comment-line) (ess-roxy-indent-on-newline))) -(defun ess-roxy-newline-and-indent () - (if (or (not (ess-roxy-entry-p)) - (not ess-roxy-insert-prefix-on-newline)) - (newline-and-indent) - (ess-roxy-indent-on-newline))) +(define-obsolete-function-alias 'ess-roxy-newline-and-indent 'ess-roxy-newline "ESS 19.04") +(defun ess-roxy-newline () + "Start a newline and insert the roxygen prefix. +Only do this if in a roxygen block and +`ess-roxy-insert-prefix-on-newline' is non-nil." + (interactive) + (if (and (ess-roxy-entry-p) + ess-roxy-insert-prefix-on-newline) + (ess-roxy-indent-on-newline) + (newline nil t))) (defun ess-roxy-indent-on-newline () "Insert a newline in a roxygen field." @@ -970,6 +1002,40 @@ (newline-and-indent) (insert (concat (ess-roxy-guess-str t) " "))))) +(defun ess-roxy-cpp-fill-paragraph (&rest _args) + "Advice for `c-fill-paragraph' that accounts for roxygen comments." + (cond + ;; Fill roxy @example's. + ((ess-roxy-entry-p "examples") + (ess--roxy-fill-block 'fill-paragraph) nil) + ;; Fill roxy entries. + ((ess-roxy-entry-p) + (ess--roxy-fill-block 'fill-paragraph) nil) + ;; Return t to signal to go on to `c-fill-paragraph'. + (t t))) + +(advice-add 'c-fill-paragraph :before-while 'ess-roxy-cpp-fill-paragraph) + +(defun ess-roxy-enable-in-cpp () + "Enable `ess-roxy-mode' in C++ buffers in R packages." + (when (and (fboundp 'ess-r-package-project) + (ess-r-package-project)) + (ess-roxy-mode))) + +(with-eval-after-load "cc-mode" + (add-hook 'c++-mode-hook #'ess-roxy-enable-in-cpp)) + +(defun ess-roxy--region-p (beg end) + (when ess-roxy-re + (save-excursion + (goto-char beg) + (catch 'ess-r-not-roxy + (while (< (point) end) + (unless (looking-at-p ess-roxy-re) + (throw 'ess-r-not-roxy nil)) + (forward-line)) + t)))) + (provide 'ess-roxy) ;;; ess-roxy.el ends here diff -Nru ess-18.10.2/lisp/ess-r-package.el ess-18.10.2+git20220915.f45542e/lisp/ess-r-package.el --- ess-18.10.2/lisp/ess-r-package.el 2018-11-10 09:41:11.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/lisp/ess-r-package.el 2022-10-15 08:06:36.000000000 +0000 @@ -1,44 +1,48 @@ -;;; ess-r-package.el --- Package development mode for R. - -;; Copyright (C) 2011-2015 Lionel Henry, Vitalie Spinu, A.J. Rossini, Richard -;; M. Heiberger, Martin Maechler, Kurt Hornik, Rodney Sparapani, and -;; Stephen Eglen. +;;; ess-r-package.el --- Package development mode for R. -*- lexical-binding: t; -*- +;; Copyright (C) 2011-2020 Free Software Foundation, Inc. ;; Author: Lionel Henry, Vitalie Spinu ;; Maintainer: ESS-core -;; Keywords: languages, tools - -;; This file is part of ESS. +;; This file is part of GNU Emacs. -;; This file is free software; you can redistribute it and/or modify +;;; License: +;; +;; This program is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 2, or (at your option) -;; any later version. - -;; This file is distributed in the hope that it will be useful, +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. +;; +;; This program is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. - -;; A copy of the GNU General Public License is available at -;; https://www.r-project.org/Licenses/ +;; +;; You should have received a copy of the GNU General Public License +;; along with this program. If not, see +;; ;;; Commentary: -;; see apropriate documentation section of ESS user manual +;; see appropriate documentation section of ESS user manual ;;; Code: - -(require 'ess-custom) +(require 'cl-lib) (require 'ess-inf) -(require 'ess-utils) + +(eval-when-compile + (require 'subr-x) + (require 'tramp)) ;; Silence the byte compiler, OK because this file is only loaded by ;; ess-r-mode and has no autoloads. (defvar ess-r-customize-alist) +(declare-function ess-r-project "ess-r-mode") (declare-function inferior-ess-r-force "ess-r-mode") (declare-function ess-r-get-evaluation-env "ess-r-mode") (declare-function ess-r-set-evaluation-env "ess-r-mode") +(declare-function tramp-dissect-file-name "tramp" (name &optional nodefault)) +;; This can be drop after dropping support for Emacs 25: +(declare-function tramp-file-name-localname "tramp" (cl-x)) (defvar ess-r-prompt-for-attached-pkgs-only nil "If nil provide completion for all installed R packages. @@ -52,16 +56,15 @@ :group 'ess-r-package :type 'boolean) -(defvar-local ess-r-package--project-cache nil +(defvar-local ess-r-package--info-cache nil "Current package info cache. +See `ess-r-package-info' for its structure.") -Cons cell of two strings. CAR is the package name active in the -current buffer. CDR is the path to its source directory.") - -(define-obsolete-variable-alias 'ess-r-package-library-path 'ess-r-package-library-paths "v18.04") (defcustom ess-r-package-library-paths nil "Default path to find user packages. -Can be either a string specifying a directory or a list of directories." +Can be either a string specifying a directory or a list of +directories. This variable is also consulted by +`xref-find-definitions' in R buffers. See `ess-r-xref-backend'." :group 'ess-r-package-library-paths :type `(choice string (repeat string))) @@ -95,37 +98,54 @@ (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 +A project instance is a cons cell of the project type 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)))))) + (let ((pkg-info (ess-r-package-info dir))) + (when (car pkg-info) + (cons 'ess-r-package (plist-get pkg-info :root))))) + + +;; FIXME: remove when emacs 27 is dropped +(unless (eval-when-compile + (get 'project-roots 'byte-obsolete-info)) + (cl-defmethod project-roots ((project (head ess-r-package))) + "Return the project root for ESS R packages" + (list (cdr project)))) + +(cl-defmethod project-root ((project (head ess-r-package))) + "Return the project root for ESS R packages" + (cdr project)) (defun ess-r-package-name (&optional dir) "Return the name of the current package as a string." - (let ((project (ess-r-package-project dir))) - (when project - (symbol-name (car ess-r-package--project-cache))))) - -(defun ess-r-package-get-info () - "Deprecated function to get package info. -Please use `ess-r-package-project' instead." - (let ((project (ess-r-package-project))) - (if project - (cons (ess-r-package-name) (cdr project)) - (list nil)))) -(make-obsolete 'ess-r-package-get-info 'ess-r-package-project "17.11") + (plist-get (ess-r-package-info dir) :name)) + +(defun ess-r-package-info (&optional dir) + "Get the description of the R project in directory DIR. +Return an plist with the keys :name and :root. When not in a +package return \\='(nil). This value is cached buffer-locally for +efficiency reasons." + (if (and (null dir) (car ess-r-package--info-cache)) + ess-r-package--info-cache + (let* ((path (ess-r-package--find-package-path (or dir default-directory))) + (name (when path + (ess-r-package--find-package-name path))) + (local (if (and path (file-remote-p path)) + (tramp-file-name-localname (tramp-dissect-file-name path)) + path)) + (info (if name + (list :name name + :root local) + '(nil)))) + ;; If DIR was supplied we cannot cache in the current buffer. + (if dir + info + (setq-local ess-r-package--info-cache info))))) (defun ess-r-package--all-source-dirs (dir) (when (file-directory-p dir) - (cl-loop for f in (directory-files-and-attributes dir t "^[^.]") + (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)))))) @@ -134,9 +154,9 @@ Return nil if not in a package. Search sub-directories listed in `ess-r-package-source-roots' are searched recursively and return all physically present directories." - (let ((pkg-root (cdr (ess-r-package-project)))) + (let ((pkg-root (plist-get (ess-r-package-info) :root))) (when pkg-root - (let ((files (directory-files-and-attributes pkg-root t "^[^.]"))) + (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))) @@ -158,43 +178,44 @@ (ess-completing-read "Package" pkgs nil nil nil nil current-pkg))) (defun ess-r-package--find-package-path (&optional dir) - "Get the root of R package that contains current directory. -Root is determined by locating `ess-r-package-root-file'." - (let* ((path (cond - (dir) - ((buffer-file-name) - (file-name-directory (buffer-file-name))) - (t - default-directory))) - (pkg-path - (when path - (or - ;; First check current directory - (and (file-exists-p (expand-file-name ess-r-package-root-file path)) - path) - ;; Check for known directories in current path - (let ((current-dir (file-name-nondirectory (directory-file-name path))) - known-pkg-dir known-path presumptive-path) - (while (and path (not presumptive-path)) - (setq current-dir (file-name-nondirectory (directory-file-name path))) - (if (and (setq known-pkg-dir (assoc current-dir ess-r-package-dirs)) - (setq known-path (ess--parent-dir path (cdr known-pkg-dir))) - (file-exists-p (expand-file-name ess-r-package-root-file known-path))) - (setq presumptive-path known-path) - (setq path (ess--parent-dir path 1)))) - presumptive-path))))) - (when pkg-path - (directory-file-name pkg-path)))) + "Get the root of R package in directory DIR. +DIR defaults to the current buffer's file name (if non-nil) or +`default-directory'. Root is determined by locating +`ess-r-package-root-file'." + (when-let ((path (cond + (dir) + ((buffer-file-name) + (file-name-directory (buffer-file-name))) + (t + default-directory))) + (pkg-path + (when path + (or + ;; First check current directory + (and (file-exists-p (expand-file-name ess-r-package-root-file path)) + path) + ;; Check for known directories in current path + (let ((current-dir (file-name-nondirectory (directory-file-name path))) + known-pkg-dir known-path presumptive-path) + (while (and path (not presumptive-path)) + (setq current-dir (file-name-nondirectory (directory-file-name path))) + (if (and (setq known-pkg-dir (assoc current-dir ess-r-package-dirs)) + (setq known-path (ess--parent-dir path (cdr known-pkg-dir))) + (file-exists-p (expand-file-name ess-r-package-root-file known-path))) + (setq presumptive-path known-path) + (setq path (ess--parent-dir path 1)))) + presumptive-path))))) + (directory-file-name pkg-path))) (defun ess-r-package--find-package-name (path) (let ((file (expand-file-name ess-r-package-root-file path)) (case-fold-search t)) (when (file-exists-p file) (with-temp-buffer - (insert-file-contents file) + (insert-file-contents-literally file) (goto-char (point-min)) (when (re-search-forward "package: \\(.*\\)" nil t) - (intern (match-string 1))))))) + (match-string 1)))))) ;;;*;;; UI @@ -202,27 +223,10 @@ (defun ess-r-package-use-dir () "Set process directory to current package directory." (interactive) - (let ((dir (cdr (ess-r-package-project)))) - (ess-set-working-directory (abbreviate-file-name dir)))) - -(defun ess-r-package-set-package () - "Set a package for ESS r-package commands." - (interactive) - (let* ((pkg-path (read-directory-name - "Path: " (or (ess-r-package--find-package-path) - (if (stringp ess-r-package-library-paths) - ess-r-package-library-paths - (car ess-r-package-library-paths))) - nil t)) - (pkg-name (ess-r-package--find-package-name pkg-path)) - (pkg-info (cons pkg-name pkg-path))) - (unless (and pkg-name pkg-path - (file-exists-p (expand-file-name ess-r-package-root-file pkg-path))) - (error "Not a valid package. No '%s' found in `%s'" ess-r-package-root-file pkg-path)) - (message (format "%s selected and added to file-local variables" pkg-name)) - (save-excursion - (add-file-local-variable 'ess-r-package--project-cache pkg-info)) - (setq ess-r-package--project-cache pkg-info))) + (let ((pkg-root (plist-get (ess-r-package-info) :root))) + (if pkg-root + (ess-set-working-directory (abbreviate-file-name pkg-root)) + (user-error "Not in a project")))) ;;;*;;; Evaluation @@ -232,20 +236,20 @@ Namespaced evaluation is enabled if `ess-r-package-auto-enable-namespaced-evaluation' is non-nil." (when ess-r-package-auto-enable-namespaced-evaluation - (let ((path (cdr (ess-r-package-project)))) + (let ((root (plist-get (ess-r-package-info) :root))) ;; Check that we are in a file within R/ - (when (and path + (when (and root default-directory - (> (length default-directory) (1+ (length path))) + (> (length default-directory) (1+ (length root))) (let ((subpath (substring default-directory - (1+ (length path)) + (1+ (length root)) (length default-directory)))) (string= (directory-file-name subpath) "R"))) (ess-r-set-evaluation-env (ess-r-package-name)))))) -(add-hook 'R-mode-hook 'ess-r-package-enable-namespaced-evaluation) +(add-hook 'ess-r-mode-hook 'ess-r-package-enable-namespaced-evaluation) -(defun ess-r-package-eval-linewise (command &optional msg p actions pkg-path) +(defun ess-r-package-eval-linewise (command &optional msg p actions) "Send COMMAND to R process. COMMAND is a command string with %s placeholder for the arguments. MSG is the message displayed in minibuffer with %s @@ -256,16 +260,15 @@ list of strings (R arguments), or functions which return R arguments, or expressions which return R arguments." (inferior-ess-r-force) - (let* ((pkg-info (or (ess-r-package-project) - (ess-r-package-set-package))) - (pkg-name (ess-r-package-name)) - (pkg-path (or pkg-path (concat "'" (abbreviate-file-name (cdr pkg-info)) "'"))) - (args (ess-r-command--build-args p actions))) - (message msg pkg-name) - (with-ess-process-buffer nil - (setq ess-r-package--project-cache ess-r-package--project-cache)) - (ess-show-buffer (ess-get-process-buffer)) - (ess-eval-linewise (format command (concat pkg-path args))))) + (let ((pkg-info (ess-r-package-info)) + (args (ess-r-command--build-args p actions))) + (unless (car pkg-info) + (user-error "Not in a package")) + (ess-project-save-buffers) + (message msg (plist-get pkg-info :name)) + (display-buffer (ess-get-process-buffer)) + (let ((pkg-path (concat "'" (abbreviate-file-name (plist-get pkg-info :root)) "'"))) + (ess-eval-linewise (format command (concat pkg-path args)))))) (defun ess-r-command--build-args (ix &optional actions) (let* ((n (cond ((null ix) 0) @@ -308,31 +311,41 @@ '("" (read-string "Arguments: " "vignettes = FALSE")))) (defun ess-r-devtools-check-with-winbuilder (&optional arg) - "Interface for `devtools::buildwin()'. -With prefix ARG build with R-devel instead of R-patched." + "Interface for `devtools::check_win_XYZ()'. +With prefix argument, as for arguments to `devtools::check_win_XYZ()' function." (interactive "P") - (ess-r-package-eval-linewise - "devtools::build_win(%s)\n" "Checking %s on CRAN's Windows server" arg - '("" "version = 'R-devel'"))) + (let ((type (completing-read "Release: " '("devel" "release" "oldrelease") nil t))) + (ess-r-package-eval-linewise + (format "devtools:::check_win_%s(%%s)\n" type) + "Checking %s on CRAN's Windows server" arg + '("" (read-string "Arguments: "))))) (defvar ess-r-rhub--history nil) (declare-function ess-r-check-install-package "ess-r-mode.el") (defun ess-r-rhub-check-package (&optional arg) "Interface for `rhub::check()'. -With prefix ARG run with `valgrind = TRUE'." +With prefix ARG allow for editing of the `rhub::check_for_cran()' arguments." (interactive "P") (inferior-ess-r-force) (ess-r-check-install-package "rhub") - (let* ((platforms (ess-get-words-from-vector "rhub::platforms()$name\n")) + (let* ((platforms (cons "RECOMMENDED" (ess-get-words-from-vector "rhub::platforms()$name\n"))) (platform (completing-read "Platform: " platforms nil t nil ess-r-rhub--history (car ess-r-rhub--history))) - (cmd (format "rhub::check_for_cran(%%s, platform = '%s')\n" platform)) - (msg (format "Checking %%s on RHUB (%s)" platform))) - (ess-r-package-eval-linewise cmd msg arg '("" "valgrind = TRUE")))) + (cmd (if (string= "RECOMMENDED" platform) + "rhub::check_for_cran(%s)\n" + (format "rhub::check_for_cran(%%s, platforms = '%s')\n" platform))) + (msg (format "Checking %%s on RHUB (%s)" platform)) + ;; Solaris check is flaky and it seems that solaris check is not run on + ;; CRAN itself with --as-cran options https://github.com/r-hub/rhub/issues/339 + (args (cond ((string-match-p "solaris" platform) + "check_args = c('--no-stop-on-test-error', '--no-vignettes')") + (t "check_args = c('--as-cran', '--no-stop-on-test-error')")))) + (ess-r-package-eval-linewise cmd msg arg + `(,args (read-string "Arguments: " ,(concat args ", valgrind = FALSE")))))) (defun ess-r-devtools-build (&optional arg) "Interface for `devtools::build()'. -With prefix ARG, build with 'vignettes = FALSE'." +With prefix ARG, build with `vignettes = FALSE'." (interactive "P") (ess-r-package-eval-linewise "devtools::build(%s)\n" "Building %s" arg @@ -351,7 +364,7 @@ (file-name-nondirectory buffer-file-name)) (error "Buffer not visiting a file")))) (format "filter = \"%s\"" - (if (string-match "test-\\([[:alnum:]]+\\)\\.[rR]" file) + (if (string-match "test-\\([[:alnum:]_-]+\\)\\.[rR]" file) (match-string-no-properties 1 file) (file-name-base buffer-file-name))))) @@ -375,6 +388,16 @@ }) ") +(defun ess-project-save-buffers () + "Offer to save modified files in the current project. +Respects `ess-save-silently', which see." + (let ((cur-proj ess-r-package--info-cache)) + (dolist (buf (buffer-list)) + (when-let ((file (buffer-file-name buf)) + (buf-proj (buffer-local-value 'ess-r-package--info-cache buf))) + (when (equal cur-proj buf-proj) + (ess-save-file file)))))) + (defun ess-r-devtools-document-package (&optional arg) "Interface for `devtools::document()'. With prefix ARG ask for extra arguments." @@ -385,7 +408,7 @@ (defun ess-r-devtools-install-package (&optional arg) "Interface to `devtools::install()'. -By default the instalation is \"quick\" with arguments quick = +By default the installation is \"quick\" with arguments quick = TRUE, upgrade = FALSE, build = FALSE. On prefix ARG \\[universal-argument] install with the default `devtools::install()' arguments." @@ -398,7 +421,7 @@ (defvar ess-r-devtools--install-github-history nil) (defun ess-r-devtools-install-github (&optional arg) "Interface to `devtools::install_github()'. -Asks for github repository in the form of user/repo. Force +Asks for GitHub repository in the form of user/repo. Force re-installation when called with a prefix ARG." (interactive "P") (let ((command "devtools::install_github(%s%s)") @@ -410,7 +433,9 @@ (ess-r-command--build-args 0 '((read-string "Arguments: " "force = TRUE"))) ""))) (inferior-ess-r-force) - (ess-show-buffer (ess-get-process-buffer)) + (unless (derived-mode-p 'inferior-ess-mode) + (display-buffer (ess-get-process-buffer) + '(nil . ((inhibit-same-window . t))))) (message "Installing %s from github" repo) (ess-eval-linewise (format command repo args)))) @@ -443,7 +468,7 @@ (defcustom ess-r-package-auto-activate t "If non-nil, `ess-r-package-mode' is turned on within R packages. -If 't' the minor mode auto-activates in R packages. See +If `t' the minor mode auto-activates in R packages. See `ess-r-package-exclude-modes' if you wish to inhibit `ess-r-package-mode' in specific buffers." :group 'ess-r-package @@ -498,12 +523,13 @@ ess-getwd-command ess-quit-function inferior-ess-reload-function))) - (mapc (lambda (var) (set (make-local-variable var) - (eval (cdr (assq var ess-r-customize-alist))))) + (mapc (lambda (var) + (set (make-local-variable var) + (eval (cdr (assq var ess-r-customize-alist))))) vars)) - (add-hook 'project-find-functions #'ess-r-package-project) + (add-hook 'project-find-functions #'ess-r-project nil 'local) (run-hooks 'ess-r-package-enter-hook)) - (remove-hook 'project-find-functions #'ess-r-package-project) + (remove-hook 'project-find-functions #'ess-r-project) (run-hooks 'ess-r-package-exit-hook))) (add-hook 'after-change-major-mode-hook 'ess-r-package-auto-activate) @@ -522,9 +548,8 @@ (if ess-r-package-exclude-modes (not (apply #'derived-mode-p ess-r-package-exclude-modes)) t))) - (let ((pkg-info (ess-r-package-project))) - (when pkg-info - (ess-r-package-mode 1))))) + (when (car (ess-r-package-info)) + (ess-r-package-mode 1)))) (defun ess-r-package-re-activate () "Restart `ess-r-package-mode'. @@ -533,7 +558,7 @@ `default-directory' has changed." (when ess-r-package-mode (ess-r-package-mode -1)) - (setq ess-r-package--project-cache nil) + (setq ess-r-package--info-cache nil) (ess-r-package-auto-activate)) (defvar-local ess-r--old-default-dir nil) @@ -553,11 +578,11 @@ ;;;*;;; Deprecated variables and functions -(defun ess-developer (&optional val) +(defun ess-developer (&optional _val) (error "As of ESS 16.04, `ess-developer' is deprecated. Use `ess-r-set-evaluation-env' instead")) (defalias 'ess-toggle-developer 'ess-developer) -(define-obsolete-function-alias 'ess-r-devtools-check-package-buildwin 'ess-r-devtools-check-with-winbuilder) +(define-obsolete-function-alias 'ess-r-devtools-check-package-buildwin 'ess-r-devtools-check-with-winbuilder "18.04") (define-obsolete-function-alias 'ess-r-devtools-ask 'ess-r-devtools-execute-command "18.04") (make-obsolete-variable 'ess-developer "Please use `ess-developer-select-package' and `ess-r-set-evaluation-env' instead." "16.04") diff -Nru ess-18.10.2/lisp/ess-r-syntax.el ess-18.10.2+git20220915.f45542e/lisp/ess-r-syntax.el --- ess-18.10.2/lisp/ess-r-syntax.el 2018-11-10 09:41:11.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/lisp/ess-r-syntax.el 2022-10-15 08:06:36.000000000 +0000 @@ -1,25 +1,27 @@ ;;; ess-r-syntax.el --- Utils to work with R code -;; Copyright (C) 2015 Lionel Henry - +;; Copyright (C) 2015-2020 Free Software Foundation, Inc. ;; Author: Lionel Henry ;; Created: 12 Oct 2015 ;; Maintainer: ESS-core -;; This file is part of ESS +;; This file is part of GNU Emacs. -;; This file is free software; you can redistribute it and/or modify +;;; License: +;; +;; This program is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 2, or (at your option) -;; any later version. - -;; This file is distributed in the hope that it will be useful, +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. +;; +;; This program is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. - -;; A copy of the GNU General Public License is available at -;; https://www.r-project.org/Licenses/ +;; +;; You should have received a copy of the GNU General Public License +;; along with this program. If not, see +;; ;;; Commentary: @@ -63,7 +65,7 @@ t)) (defun ess-backward-char (&optional N) - (unless (= (point) (point-min)) + (unless (bobp) (forward-char (- (or N 1))) t)) @@ -79,15 +81,6 @@ (ess-skip-blanks-forward newlines) (looking-at regex))) -(defun ess-back-to-indentation () - "Move point to the first non-whitespace character on this line. -This non-interactive version of (back-to-indentation) should not -be advised" - (beginning-of-line 1) - (skip-syntax-forward " " (line-end-position)) - ;; Move back over chars that have whitespace syntax but have the p flag. - (backward-prefix-chars)) - (defmacro ess-save-excursion-when-nil (&rest body) (declare (indent 0) (debug (&rest form))) @@ -111,7 +104,7 @@ (debug (&rest form))) `(save-excursion (goto-char indent-point) - (ess-back-to-indentation) + (back-to-indentation) (progn ,@body))) (defvar containing-sexp) @@ -181,7 +174,7 @@ (defun ess-climb-token--back () (let* ((token-end (point)) - (token-type (if (= (point) (point-min)) + (token-type (if (bobp) "buffer-start" (ess-climb-token--operator))) (token-value (buffer-substring-no-properties (point) token-end))) @@ -215,7 +208,9 @@ (ess-backward-char)) (`?> (prog1 (ess-backward-char) - (or (ess-climb-token--char ?-) + (or (ess-climb-token--char ?|) + (ess-climb-token--char ?=) + (ess-climb-token--char ?-) (and (looking-back "->" (- (point) 2)) (goto-char (- (point) 2)))))) (`?- @@ -318,7 +313,8 @@ "&" "&&" "|" "||" "!" "?" "~" "==" "!=" "<" "<=" ">=" ">" "=" "<-" "<<-" "->" "->>" - "$" "@" ":" "::" ":::" ":=")) + "$" "@" ":" "::" ":::" ":=" + "|>" "=>")) (defvar ess-r-keywords-re (concat (regexp-opt ess-r-keywords-list) "\\_>")) @@ -801,14 +797,14 @@ "Skip blanks and newlines backward, taking end-of-line comments into account." (ess-any ((ess-skip-blanks-backward-1)) ((when newlines - (ess-while (and (/= (point) (point-min)) + (ess-while (and (not (bobp)) (= (point) (line-beginning-position))) (forward-line -1) (goto-char (ess-code-end-position)) (ess-skip-blanks-backward-1)))))) (defun ess-skip-blanks-backward-1 () - (and (/= (point) (point-min)) + (and (not (bobp)) (/= 0 (skip-syntax-backward " ")))) (defun ess-skip-blanks-forward (&optional newlines) @@ -820,7 +816,7 @@ ;; Handles corner cases such as point being on last line (let ((orig-point (point))) (forward-line) - (ess-back-to-indentation) + (back-to-indentation) (> (point) orig-point))) (skip-chars-forward " \t") t)))))) @@ -1359,8 +1355,7 @@ (defun ess-continuations-bounds (&optional marker) (save-excursion - (let ((orig-point (point)) - (beg (progn + (let ((beg (progn (ess-escape-continuations) (point)))) (when beg @@ -1509,9 +1504,10 @@ ,(skip-chars-backward "\"'"))) (setq climbed t))) ;; Recurse if we find an indexing char - (when (memq (char-before) '(?$ ?@)) - (forward-char -1) - (ess-climb-object)) + (let ((tok (ess-token-before))) + (when (member (ess-token-type tok) '("$" "@" "::" ":::")) + (goto-char (ess-token-start tok)) + (ess-climb-object))) climbed))) ;; Todo: split name and object climbing @@ -1532,7 +1528,7 @@ (defun ess-jump-name () (ess-save-excursion-when-nil - (let (climbed quote-char) + (let (climbed) (skip-chars-forward " \t") ;; Jump over backquoted names (cond ((and (eq (char-after) ?`) diff -Nru ess-18.10.2/lisp/ess-rutils.el ess-18.10.2+git20220915.f45542e/lisp/ess-rutils.el --- ess-18.10.2/lisp/ess-rutils.el 2018-11-10 09:41:11.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/lisp/ess-rutils.el 1970-01-01 00:00:00.000000000 +0000 @@ -1,434 +0,0 @@ -;;; ess-rutils.el --- R functions and keybindings to use in iESS. - -;; Author: Sebastian Luque -;; Created: Thu Nov 10 02:20:36 2004 (UTC) -;; Last-Updated: 2013-09-22T16:08:47+0000 -;; By: Sebastian P. Luque -;; Version: $Id$ - -;; Copyright (c) 2005-2013 Sebastian P. Luque - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) -;; any later version. -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; A copy of the GNU General Public License is available at -;; https://www.r-project.org/Licenses/ - -;;; Commentary: - -;; This library provides key bindings for performing basic R functions, -;; such as loading and managing packages, as well as object manipulation -;; (listing, viewing, and deleting), and an alternative to RSiteSearch() -;; that uses the browse-url function. Load the library with the method you -;; prefer (e.g. M-x load-file), but the easiest is probably to: a) make -;; sure your load-path variable includes the directory where ess-rutils.el -;; resides, and b) include (require 'ess-rutils) statement in your -;; ~/.emacs. -;; -;; Usage: -;; -;; Once R is started with M-x R, you should have the key bindings defined -;; at the end of this file working in your iESS process buffers. Simply -;; type the desired key binding. -;; -;; Acknowledgements: -;; -;; I am grateful to John Fox for having written his init.el file for -;; XEmacs, which motivated this Emacs alternative. I wanted to add some -;; object management comforts and came across Stephen Eglen's -;; ess-rdired.el, which provides a lot of these. ess-rutils.el builds upon -;; on a *lot* of ideas from ess-rdired.el. - -;; TODO: Refactor and remove byte-compile-warnings file-local variable. -;; TODO: This should be more tightly integrated with ess-r-mode and ESSR. -;; TODO: Should be active in ess-r-mode not only ess-inf -;; TODO: Both S level Utils and this package's Rutils are in the menu; confusing and inconvenient. -(defvar pkg) - -;;; Code: - -;; Autoloads and requires -(require 'ess-r-mode) -(require 'ess-rdired) - -(defvar ess-rutils-buf "*R temp*" - "Name of temporary R buffer.") - -(defvar ess-rutils-mode-map nil - "Keymap for the *R temp* buffer.") - -(unless ess-rutils-mode-map - (setq ess-rutils-mode-map (make-sparse-keymap)) - (define-key ess-rutils-mode-map "l" 'ess-rutils-loadpkg) - (define-key ess-rutils-mode-map "i" 'ess-rutils-mark-install) - (define-key ess-rutils-mode-map "I" 'ess-rutils-install) - (define-key ess-rutils-mode-map "u" 'ess-rutils-unmark) - (define-key ess-rutils-mode-map "q" 'ess-rutils-quit) - (define-key ess-rutils-mode-map "?" 'ess-rutils-help)) - -(defun ess-rutils-mode () - "Major mode for output from `ess-rutils-local-pkgs' and `ess-rutils-repos-pkgs'. -Useful bindings to handle package loading and installing. -\\{ess-rutils-mode-map}" - (kill-all-local-variables) - (use-local-map ess-rutils-mode-map) - (setq major-mode 'ess-rutils-mode) - (setq mode-name (concat "R utils " ess-local-process-name))) - -(defun ess-rutils-local-pkgs () - "List all packages in all libraries." - (interactive) - (if (get-buffer ess-rutils-buf) - (progn - (set-buffer ess-rutils-buf) - (setq buffer-read-only nil))) - (ess-execute - "writeLines(paste(' ', sort(.packages(all.available=TRUE)), sep=''))" - nil - (substring ess-rutils-buf 1 (- (length ess-rutils-buf) 1))) - (pop-to-buffer ess-rutils-buf) - (save-excursion - (beginning-of-line) (open-line 1) - (insert "**Available packages in all local R libraries**")) - (setq buffer-read-only t) - (ess-rutils-mode) - (if (fboundp 'fit-frame) - (fit-frame))) - -(defun ess-rutils-namepkg () - "Return name of the package on current line." - (save-excursion - (beginning-of-line) - (if (looking-at "*") - nil - (forward-char 2) - (let (beg) - (setq beg (point)) - (end-of-line) ;assume package names are separated by newlines. - (buffer-substring-no-properties beg (point)))))) - -(defun ess-rutils-loadpkg () - "Load package from a library." - (interactive) - (let ((oklocal nil)) - (save-excursion - (goto-char (point-min)) - (if (search-forward "libraries**" nil t) - (setq oklocal t))) - (if oklocal - (progn - (setq pkg (ess-rutils-namepkg)) - (ess-execute (concat "library('" pkg "', character.only=TRUE)") - 'buffer)) - nil))) - -(defun ess-rutils-repos-pkgs () - "List available packages. -Use the repositories as listed by getOptions(\"repos\") in the -current R session." - (interactive) - (if (get-buffer ess-rutils-buf) - (progn - (set-buffer ess-rutils-buf) - (setq buffer-read-only nil))) - (ess-execute (concat "writeLines(paste(' \"', " - "rownames(available.packages()), '\"', sep=''))") - nil - (substring ess-rutils-buf 1 (- (length ess-rutils-buf) 1))) - (pop-to-buffer ess-rutils-buf) - (save-excursion - (kill-line 5) - (insert "**packages available to install**\n")) - (setq buffer-read-only t) - (ess-rutils-mode) - (if (fboundp 'fit-frame) - (fit-frame))) - -(defun ess-rutils-mark-install (arg) - "Mark the current package for installing. -ARG lines to mark is passed to `ess-rutils-mark'." - (interactive "p") - ;; if this is not an install package buffer return nil. - (let ((okmark nil)) - (save-excursion - (goto-char (point-min)) - (if (search-forward "install**" nil t) - (setq okmark t))) - (if okmark - (ess-rutils-mark "I" arg) - nil))) - -(defun ess-rutils-unmark (arg) - "Unmark the packages, passing ARG lines to unmark to `ess-rutils-mark'." - (interactive "p") - (ess-rutils-mark " " arg)) - -;; The next two functions almost verbatim from ess-rdired.el. -(defun ess-rutils-mark (mark-char arg) - "Use MARK-CHAR to mark package on current line, or next ARG lines." - ;; If we are on first line, mark all lines. - (let ((buffer-read-only nil) - move) - (if (eq (point-min) - (save-excursion (beginning-of-line) (point))) - (progn - ;; we are on first line, so make a note of point, and count - ;; how many objects we want to delete. Then at end of defun, - ;; restore point. - (setq move (point)) - (forward-line 1) - (setq arg (count-lines (point) (point-max))))) - (while (and (> arg 0) (not (eobp))) - (setq arg (1- arg)) - (beginning-of-line) - (progn - (insert mark-char) - (delete-char 1) - (forward-line 1))) - (if move - (goto-char move)))) - -(defun ess-rutils-install () - "Install all packages flagged for installation, and return to the iESS buffer. -User is asked for confirmation." - (interactive) - (let ((inst "install.packages(c(") - (count 0)) - (save-excursion - (goto-char (point-min)) - (forward-line) - ;; as long as number of lines between buffer start and point is smaller - ;; than the total number of lines in buffer, go to the beginning of the - ;; line, check if line is flagged, and if it is, advance the counter by - ;; one, create the root of install function, add the package name, - ;; insert a comma, and move forward a line. - (while (< (count-lines (point-min) (point)) - (count-lines (point-min) (point-max))) - (beginning-of-line) - (if (looking-at "^I ") - (setq count (1+ count) - inst (concat inst (ess-rutils-namepkg) ", " ))) - (forward-line 1))) - (if (> count 0) ;found packages to install - (progn - ;; Fix the install function created before and close it. - (setq inst (concat - (substring inst 0 (- (length inst) 2)) "))")) - ;; - (if (yes-or-no-p (format "Install %d %s " count - (if (> count 1) "packages" "package"))) - (progn - (ess-execute inst 'buffer) - (ess-rutils-quit)))) - ;; else nothing to install - (message "no packages flagged to install")))) - -(defun ess-rutils-update-pkgs (lib repos) - "Update packages in library LIB and repos REPOS. -Defaults are the first element returned by .libPaths() for LIB, -and the repository named CRAN returned by getOption(\"repos\") -for REPOS. This also uses checkBuilt=TRUE to rebuild installed -packages if needed." - (interactive "DPath to library to update: \nsrepos: ") - (if (string= "" lib) - (setq lib - (car (ess-get-words-from-vector - "as.character(.libPaths())\n")))) - (if (string= "" repos) - (setq repos - (car (ess-get-words-from-vector - "as.character(getOption(\"repos\")[\"CRAN\"])\n")))) - (ess-execute (concat "update.packages(lib.loc='" - lib "', repos='" repos - "', ask=FALSE, checkBuilt=TRUE)") 'buffer)) - -(defun ess-rutils-apropos (string) - "Search for STRING using apropos." - (interactive "sApropos search for? ") - (if (get-buffer ess-rutils-buf) - (progn - (set-buffer ess-rutils-buf) - (setq buffer-read-only nil))) - (ess-execute (concat "apropos('" string "')") - nil - (substring ess-rutils-buf 1 (- (length ess-rutils-buf) 1))) - (pop-to-buffer ess-rutils-buf) - (setq buffer-read-only t) - (ess-rutils-mode)) - -(defun ess-rutils-rm-all () - "Remove all R objects." - (interactive) - (if (y-or-n-p "Delete all objects? ") - (ess-execute "rm(list=ls())" 'buffer))) - -(defun ess-rutils-load-wkspc (file) - "Load workspace FILE into R." - (interactive "fFile with workspace to load: ") - (ess-execute (concat "load('" file "')") 'buffer)) - -(defun ess-rutils-save-wkspc (file) - "Save FILE workspace. -File extension not required." - (interactive "FSave workspace to file (no extension): ") - (ess-execute (concat "save.image('" file ".RData')") 'buffer)) - -(defun ess-rutils-quit () - "Kill the ess-rutils buffer and return to the iESS buffer." - (interactive) - (ess-switch-to-end-of-ESS) - (kill-buffer ess-rutils-buf)) - -(defun ess-rutils-html-docs (&optional remote) - "Use `browse-url' to navigate R html documentation. -Documentation is produced by a modified help.start(), that -returns the URL produced by GNU R's http server. If called with a -prefix, the modified help.start() is called with update=TRUE. The -optional REMOTE argument should be a string with a valid URL for -the 'R_HOME' directory on a remote server (defaults to NULL)." - (interactive) - (let* ((update (if current-prefix-arg "update=TRUE" "update=FALSE")) - (remote (if (or (and remote (not (string= "" remote)))) - (concat "remote=" remote) "remote=NULL")) - (rhtml (format ".ess_help_start(%s, %s)\n" update remote)) - (tmpbuf (get-buffer-create "**ess-rutils-mode**"))) - (ess-command rhtml tmpbuf) - (set-buffer tmpbuf) - (let* ((begurl (search-backward "http://")) - (endurl (search-forward "index.html")) - (url (buffer-substring-no-properties begurl endurl))) - (browse-url url)) - (kill-buffer tmpbuf))) - -(defun ess-rutils-rsitesearch (string) - "Search the R archives for STRING, and show results using `browse-url'. -If called with a prefix, options are offered (with completion) -for matches per page, sections of the archives to search, -displaying results in long or short formats, and sorting by any -given field. Options should be separated by value of -`crm-default-separator'." - (interactive "sSearch string: ") - (let ((site "https://search.r-project.org/cgi-bin/namazu.cgi?query=") - (okstring (replace-regexp-in-string " +" "+" string))) - (if current-prefix-arg - (let ((mpp (concat - "&max=" - (completing-read - "Matches per page: " - '(("20" 1) ("30" 2) ("40" 3) ("50" 4) ("100" 5))))) - (format (concat - "&result=" - (completing-read - "Format: " '(("normal" 1) ("short" 2)) - nil t "normal" nil "normal"))) - (sortby (concat - "&sort=" - (completing-read - "Sort by: " - '(("score" 1) ("date:late" 2) ("date:early" 3) - ("field:subject:ascending" 4) - ("field:subject:decending" 5) - ("field:from:ascending" 6) ("field:from:decending" 7) - ("field:size:ascending" 8) ("field:size:decending" 9)) - nil t "score" nil "score"))) - (restrict (concat - "&idxname=" - (mapconcat - 'identity - (completing-read-multiple - "Limit search to: " - '(("Rhelp02a" 1) ("functions" 2) - ("docs" 3) ("Rhelp01" 4)) - nil t "Rhelp02a,functions,docs" nil - "Rhelp02a,functions,docs") "&idxname=")))) - (browse-url (concat site okstring mpp format sortby restrict))) - (browse-url (concat site okstring "&max=20&result=normal&sort=score" - "&idxname=Rhelp02a&idxname=functions&idxname=docs"))))) - -(defun ess-rutils-help () - "Show help on `ess-rutils-mode'." - (interactive) - (describe-function 'ess-rutils-mode)) - -(defun ess-rutils-help-search (string) - "Search for STRING using help.search()." - (interactive "sString to search for? ") - (if (get-buffer ess-rutils-buf) - (progn - (set-buffer ess-rutils-buf) - (setq buffer-read-only nil))) - (ess-execute (concat "help.search('" string "')") - nil - (substring ess-rutils-buf 1 (- (length ess-rutils-buf) 1))) - (pop-to-buffer ess-rutils-buf) - (setq buffer-read-only t) - (ess-rutils-mode)) - -;; Customizable variable to allow ess-rutils-keys to activate default key bindings. -;; Suggested by Richard M. Heiberger. -(defcustom ess-rutils-keys t - "Non-nil means activate ess-rutils keybindings and menu." - :group 'ess-R - :type 'boolean) - -;; Keybindings -(defun ess-rutils-keys () - "Provide key bindings." - (interactive) - (when ess-rutils-keys - (define-key inferior-ess-mode-map [(control c) (control \.) (l)] - 'ess-rutils-local-pkgs) - (define-key inferior-ess-mode-map [(control c) (control \.) (r)] - 'ess-rutils-repos-pkgs) - (define-key inferior-ess-mode-map [(control c) (control \.) (u)] - 'ess-rutils-update-pkgs) - (define-key inferior-ess-mode-map [(control c) (control \.) (a)] - 'ess-rutils-apropos) - (define-key inferior-ess-mode-map [(control c) (control \.) (m)] - 'ess-rutils-rm-all) - (define-key inferior-ess-mode-map [(control c) (control \.) (o)] - 'ess-rdired) - (define-key inferior-ess-mode-map [(control c) (control \.) (w)] - 'ess-rutils-load-wkspc) - (define-key inferior-ess-mode-map [(control c) (control \.) (s)] - 'ess-rutils-save-wkspc) - (define-key inferior-ess-mode-map [(control c) (control \.) (d)] - 'ess-change-directory) - (define-key inferior-ess-mode-map [(control c) (control \.) (H)] - 'ess-rutils-html-docs))) - -(easy-menu-define ess-rutils-mode-menu inferior-ess-mode-menu - "Submenu of `inferior-ess-mode' to use with RUtils." - '("RUtils" - ["Manage objects" ess-rdired t] - ["Remove objects" ess-rutils-rm-all t] - "------" - ["Local packages" ess-rutils-local-pkgs t] - ["Packages in repositories" ess-rutils-repos-pkgs t] - ["Update packages" ess-rutils-update-pkgs t] - "------" - ["Load workspace" ess-rutils-load-wkspc t] - ["Save workspace" ess-rutils-save-wkspc t] - ["Change directory" ess-change-directory t] - "------" - ["Browse HTML" ess-rutils-html-docs t] - ["Apropos" ess-rutils-apropos t])) - -(easy-menu-add-item inferior-ess-mode-menu nil ess-rutils-mode-menu "Utils") -(add-hook 'inferior-ess-mode-hook 'ess-rutils-keys) - -(make-obsolete 'ess-rutils-rhtml-fn "overwrite .ess_help_start instead." "ESS 18.10") - -(provide 'ess-rutils) - -;;; ess-rutils.el ends here - -;; Local Variables: -;; byte-compile-warnings: (not lexical) -;; End: diff -Nru ess-18.10.2/lisp/ess-r-xref.el ess-18.10.2+git20220915.f45542e/lisp/ess-r-xref.el --- ess-18.10.2/lisp/ess-r-xref.el 2018-11-10 09:41:11.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/lisp/ess-r-xref.el 2022-10-15 08:06:36.000000000 +0000 @@ -1,44 +1,40 @@ ;;; ess-r-xref.el --- An xref backend for R. -*- lexical-binding: t -*- -;; + +;; Copyright (C) 2018-2020 Free Software Foundation, Inc. ;; Author: Aaron Jacobs ;; Created: 21 January 2018 ;; Maintainer: ESS-core + +;; This file is part of GNU Emacs. + +;;; License: ;; -;; Keywords: languages, statistics, xref -;; Package-Requires: ((emacs "25")) -;; -;; This file is part of ESS. -;; -;; This file is free software; you can redistribute it and/or modify +;; This program is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 2, or (at your option) -;; any later version. +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. ;; -;; This file is distributed in the hope that it will be useful, +;; This program is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. ;; -;; A copy of the GNU General Public License is available at -;; https://www.r-project.org/Licenses/ +;; You should have received a copy of the GNU General Public License +;; along with this program. If not, see +;; ;;; Commentary: -;; This file contains an xref backend for `R-mode'. +;; This file contains an xref backend for `ess-r-mode'. ;;; Code: -(when (>= emacs-major-version 25) - (require 'subr-x) - (require 'xref)) -;; Cludge to silence the byte compiler until we drop support for Emacs 24. -(declare-function xref-make "xref") -(declare-function xref-make-buffer-location "xref") -(declare-function xref-make-file-location "xref") +(require 'xref) (require 'ess-inf) -(require 'ess-utils) (require 'ess-r-package) (require 'ess-tracebug) +(eval-when-compile + (require 'subr-x)) ;; Silence the byte compiler. OK because this file is only loaded by ess-r-mode. (declare-function inferior-ess-r-force "ess-r-mode") @@ -46,25 +42,24 @@ (defvar ess-r-xref-pkg-sources nil "Alist of R package->directory associations. -This variable is used as a cache of package->directory -associations, but could be used by the users for a more refined -control of package locations than `ess-r-package-library-paths'.") +Each element is a cons cell (PACKAGE . DIRECTORY). This variable +is used as a cache of package->directory associations, but could +be used by the users for a more refined control of package +locations than `ess-r-package-library-paths'.") (defun ess-r-xref-backend () - "An `xref-backend-functions' implementation for `R-mode'. + "An `xref-backend-functions' implementation for `ess-r-mode'. R's xref backend searches for `ess-r-package-library-paths' when srcrefs point to temporary locations." 'ess-r) (cl-defmethod xref-backend-identifier-at-point ((_backend (eql ess-r))) - (let ((sym (ess-symbol-at-point))) - (when sym - (symbol-name sym)))) + (when-let ((sym (ess-symbol-at-point))) + (symbol-name sym))) (cl-defmethod xref-backend-definitions ((_backend (eql ess-r)) symbol) - (let ((xref (ess-r-xref--xref symbol))) - (when xref - (list xref)))) + (when-let ((xref (ess-r-xref--xref symbol))) + (list xref))) (cl-defmethod xref-backend-apropos ((_backend (eql ess-r))) ;; Not yet supported. @@ -72,7 +67,7 @@ (cl-defmethod xref-backend-identifier-completion-table ((_backend (eql ess-r))) (inferior-ess-r-force) - (ess-get-words-from-vector ".ess_all_functions()\n")) + (ess-get-words-from-vector--foreground ".ess_all_functions()\n")) (defun ess-r-xref--srcref (symbol) (inferior-ess-r-force) @@ -83,56 +78,77 @@ "NULL"))) (with-current-buffer (ess-command (format ".ess_srcref(\"%s\", %s)\n" symbol pkg)) (goto-char (point-min)) - (when (re-search-forward "(" nil 'noerror) - (goto-char (match-beginning 0)) - (read (current-buffer)))))) - -(defun ess-r-xref--pkg-srcfile (symbol r-src-file) - "Look in the source directory of the R package containing symbol SYMBOL for R-SRC-FILE." - (let* ((env-name (ess-string-command (format ".ess_fn_pkg(\"%s\")\n" symbol))) - (pkg (if (string-equal env-name "") - (error "Can't find package for symbol %s" symbol) - env-name)) - (dir (or (assoc-default pkg ess-r-xref-pkg-sources) - (cond ((stringp ess-r-package-library-paths) - (expand-file-name pkg ess-r-package-library-paths)) - ((listp ess-r-package-library-paths) - (cl-loop for d in ess-r-package-library-paths - for p = (expand-file-name pkg d) - when (file-exists-p p) return p)) - (t (error "Invalid value of `ess-r-package-library-paths'"))))) - (file (when dir (expand-file-name r-src-file dir)))) + (if (re-search-forward "Error" nil t) + (progn (message "R srcref lookup failed:\n%s" (buffer-string)) + (sit-for 1) + nil) + (when (re-search-forward "(" nil 'noerror) + (goto-char (match-beginning 0)) + (read (current-buffer))))))) + +(defun ess-r-xref--pkg-srcfile (symbol src-file &optional default-pkg) + "Search the R package containing symbol SYMBOL for file SRC-FILE. +DEFAULT-PKG is the name of the package where presumably SYMBOL is located." + (let* ((pkgs (delq nil + (delete-dups + (or (cons default-pkg + (ess-get-words-from-vector (format ".ess_fn_pkg(\"%s\")\n" symbol))) + (user-error "Can't find package for symbol %s" symbol))))) + (lib-dirs (cond ((stringp ess-r-package-library-paths) + (list ess-r-package-library-paths)) + ((listp ess-r-package-library-paths) + ess-r-package-library-paths) + (t (user-error "Invalid value of `ess-r-package-library-paths'")))) + (loc (or (cl-loop for pkg in pkgs + for dir = (assoc-default pkg ess-r-xref-pkg-sources) + when (and dir (file-exists-p dir)) return (cons pkg dir)) + (cl-some (lambda (dir) + (cl-loop for pkg in pkgs + for path = (expand-file-name pkg dir) + when (file-exists-p path) return (cons pkg path))) + lib-dirs))) + (file (when loc (expand-file-name src-file (cdr loc))))) (when file (unless (file-readable-p file) (error "Can't read %s" file)) ;; Cache package's source directory. - (unless (assoc pkg ess-r-xref-pkg-sources) - (push `(,pkg . ,dir) ess-r-xref-pkg-sources)) + (unless (assoc (car loc) ess-r-xref-pkg-sources) + (push loc ess-r-xref-pkg-sources)) file))) (defun ess-r-xref--xref (symbol) "Create an xref for the source file reference of R symbol SYMBOL." - (let ((ref (ess-r-xref--srcref symbol))) - (when ref - (let ((file (nth 0 ref)) - (line (nth 1 ref)) - (col (nth 2 ref))) - (or - ;; 1) Result of ESS evaluation - (let* ((ess-ref (gethash file ess--srcrefs)) - (ess-buff (when ess-ref (ess--dbg-find-buffer (car ess-ref))))) - (when ess-buff - ;; FIXME: this breaks when eval is on larger spans than function - (xref-make symbol (xref-make-buffer-location ess-buff (nth 2 ess-ref))))) - ;; 2) Actual file location - (when (file-readable-p file) - (xref-make symbol (xref-make-file-location file line col))) - ;; 3) Temporary sources - truncate and locate in ess-r-package-library-paths - (when (string-match "/\\(R/.*\\)$" file) - (let ((pkg-file (ess-r-xref--pkg-srcfile symbol (match-string 1 file)))) - (when pkg-file - (xref-make symbol (xref-make-file-location - (expand-file-name pkg-file) line col)))))))))) + (when-let ((ref (ess-r-xref--srcref symbol))) + (let ((file (nth 0 ref)) + (line (nth 1 ref)) + (col (nth 2 ref))) + (or + ;; 1) Result of ESS evaluation + (let* ((ess-ref (gethash file ess--srcrefs)) + (ess-buff (when ess-ref (ess--dbg-find-buffer (car ess-ref))))) + (when ess-buff + ;; FIXME: this breaks when eval is on larger spans than function + (xref-make symbol (xref-make-buffer-location ess-buff (nth 2 ess-ref))))) + ;; 2) Real file from R proc working directory + (unless (file-name-absolute-p file) + (let ((file (expand-file-name file (ess-get-process-variable 'default-directory)))) + (when (file-readable-p file) + (xref-make symbol (xref-make-file-location file line col))))) + ;; 3) Real file from the R's working directory + (unless (file-name-absolute-p file) + (when-let ((wdir (car (ess-get-words-from-vector ess-getwd-command)))) + (let ((file (expand-file-name file wdir))) + (when (file-readable-p file) + (xref-make symbol (xref-make-file-location file line col)))))) + ;; 4) Real file location from the current directory + (when (file-readable-p file) + (xref-make symbol (xref-make-file-location file line col))) + ;; 5) Temporary sources - truncate and locate in ess-r-package-library-paths + (when (string-match "/\\([^/]+\\)/\\(R/.*\\)$" file) + (when-let ((pkg-file (ess-r-xref--pkg-srcfile + symbol (match-string 2 file) (match-string 1 file)))) + (xref-make symbol (xref-make-file-location + (expand-file-name pkg-file) line col)))))))) (provide 'ess-r-xref) diff -Nru ess-18.10.2/lisp/ess-s3-d.el ess-18.10.2+git20220915.f45542e/lisp/ess-s3-d.el --- ess-18.10.2/lisp/ess-s3-d.el 2018-11-10 09:41:11.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/lisp/ess-s3-d.el 1970-01-01 00:00:00.000000000 +0000 @@ -1,79 +0,0 @@ -;;; ess-s3-d.el --- S 3 (AT&T version) customization - -;; Copyright (C) 1997 A. J. Rossini -;; Copyright (C) 1998--2005 A.J. Rossini, Richard M. Heiberger, Martin -;; Maechler, Kurt Hornik, Rodney Sparapani, and Stephen Eglen. - -;; Author: A.J. Rossini -;; Created: 12 Jun 1997 -;; 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 -;; https://www.r-project.org/Licenses/ - -;;; Commentary: - -;; This file defines all the S 3 customizations for ess-mode. - -;;; Code: - -(require 'ess-s-lang) - -(defvar S3-customize-alist - (append - '((ess-local-customize-alist . 'S3-customize-alist) - (ess-dialect . "S3") - (ess-change-sp-regexp . ess-S-change-sp-regexp) - (ess-help-sec-keys-alist . ess-help-S3-sec-keys-alist) - (ess-object-name-db-file . "ess-s3-namedb.el" ) - (inferior-ess-program . inferior-S3-program) ; "S") - (inferior-ess-help-command . "help(\"%s\")\n") - (inferior-ess-help-filetype . nil) - (inferior-ess-search-list-command . "search()\n") - (inferior-ess-objects-command . "objects(%d)\n") - (inferior-ess-start-file . nil) ;"~/.ess-S3") - (inferior-ess-start-args . "") - (ess-STERM . "iESS") - ) - S+common-cust-alist); use S+ ones here; partly overwritten above!! - - "Variables to customize for S3") - -(defun S3 (&optional proc-name) - "Call 'S 3.x', the version from AT&T." - (interactive) - (setq ess-customize-alist S3-customize-alist) - (ess-write-to-dribble-buffer - (format "\n(S3): ess-dialect=%s, buf=%s\n" ess-dialect (current-buffer))) - (inferior-ess) - (if inferior-ess-language-start - (ess-eval-linewise inferior-ess-language-start))) - - -(defun S3-mode (&optional proc-name) - "Major mode for editing S3 source. See `ess-mode' for more help." - (interactive) - (setq ess-customize-alist S3-customize-alist) - (ess-mode S3-customize-alist proc-name) - (if ess-imenu-use-S (ess-imenu-S))) - - - ; Provide package - -(provide 'ess-s3-d) - -;;; ess-s3-d.el ends here diff -Nru ess-18.10.2/lisp/ess-s4-d.el ess-18.10.2+git20220915.f45542e/lisp/ess-s4-d.el --- ess-18.10.2/lisp/ess-s4-d.el 2018-11-10 09:41:11.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/lisp/ess-s4-d.el 1970-01-01 00:00:00.000000000 +0000 @@ -1,277 +0,0 @@ -;;; ess-s4-d.el --- S4 customization - -;; Copyright (C) 1997--2004 A.J. Rossini, Richard M. Heiberger, Martin -;; Maechler, Kurt Hornik, Rodney Sparapani, and Stephen Eglen. - -;; Author: A.J. Rossini -;; Created: 12 Jun 1997 -;; 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 -;; https://www.r-project.org/Licenses/ - - -;;; Commentary: - -;; DB contributed the changes from ess-s3-d.el to -;; ess-s4-d.el (removed the old ugly approach). -;; This file defines S4 customizations for ess-mode. Lots of thanks -;; to RMH and JMC for code and suggestions - -;;; Code: - -(require 'ess-s-lang) - -;; Some of this is based on files from: -;; Copyright (C) 1996, John M. Chambers. - -(defvar S4-customize-alist - (append - '((ess-local-customize-alist . 'S4-customize-alist) - (ess-dialect . "S4") - (ess-change-sp-regexp . ess-S-change-sp-regexp) - (ess-help-sec-keys-alist . ess-help-S3-sec-keys-alist) - (ess-object-name-db-file . "ess-s4-namedb.el") - (inferior-ess-program . inferior-S4-program) - (inferior-ess-objects-command . ".SmodeObs(%d, pattern=\"%s\")\n") - ;;(inferior-ess-objects-pattern . ".*") ; for new s4 stuff - (inferior-ess-help-command . "help(\"%s\")\n") - (inferior-ess-help-filetype . nil) - (inferior-ess-search-list-command . ".SmodePaths()\n") - (ess-load-command . ".SmodeLoad(\"%s\")\n") - (inferior-ess-dump-command . ".SmodeDump(\"%s\", \"%s\")\n") - - (inferior-ess-start-file . nil) ;"~/.ess-S3") - (inferior-ess-start-args . "") - (ess-STERM . "iESS") - ) - S+common-cust-alist); use S+ ones here; partly overwritten above!! - - "Variables to customize for S4.") - -;; For loading up the S code required for the above. -;;(add-hook 'ess-post-run-hook -;; (lambda () -;; (ess-command -;; (concat -;; "if(exists(\"Sversion\")) library(emacs) else source(\"" -;; ess-mode-run-file -;; "\")\n")) -;; (if ess-mode-run-file2 -;; (ess-command -;; (concat "source(\"" ess-mode-run-file2 "\")\n"))))) - - -(defun S4 () - "Call 'S version 4', from Bell Labs. New way to do it." - (interactive) - (setq ess-customize-alist S4-customize-alist) - (ess-write-to-dribble-buffer - (format "\n(S4): ess-dialect=%s, buf=%s\n" ess-dialect (current-buffer))) - (inferior-ess) - (if inferior-ess-language-start - (ess-eval-linewise inferior-ess-language-start))) - - -(defun S4-mode (&optional proc-name) - "Major mode for editing S4 source. See `ess-mode' for more help." - (interactive) - (setq ess-customize-alist S4-customize-alist) - (ess-mode S4-customize-alist proc-name) - (if ess-imenu-use-S (ess-imenu-S))) - - -;; From RMH: ALL THIS SHOULD BE INCORPORATED BY 5.0! - -;;; s4.el startup file -;;; Richard M. Heiberger -;;; rmh@temple.edu -;; -;;(load "S") -;;(setq inferior-S-program "/disk05/s4/betaJun96/S") -;;(setq S-plus nil) ;; needed for non S-plus -;;(add-to-list 'load-path "/disk05/s4/betaJun96") ;; S-namedb.el is here -;;(S) -;;(load-file "/disk05/s4/betaJun96/library/emacs/S-modeadds.el") ;; must come after (S) -;; -;; -;;;;; S4 __Help, no longer S3 .Help -;;(load "S-help") -;; ;; Must follow S-help -;;; S-help.file line 270 -;;(defun S-get-help-files-list nil -;; (mapcar 'list -;; (apply 'append -;; (mapcar (lambda (dirname) -;; (if (file-directory-p dirname) -;; (directory-files dirname))) -;; (mapcar (lambda (str) (concat str "/__Help")) -;; (S-search-list)))))) -;; -;; -;;;;; additional font-lock-keywords for S4 -;; -;;;;*;; based on S-inf.el line 107 -;;;;(add-to-list 'S-inf-font-lock-keywords -;;;; '("\\<\\(^Problem\\|^Warning\\|^Error\\|Debug ?\\|Browsing in frame of\\|Local Variables\\)\\>" . font-lock-reference-face) ; S-inf problems -;;;;) -;;;;(add-to-list 'S-inf-font-lock-keywords -;;;; '("^R>" . font-lock-keyword-face) ; debug prompt -;;;;) -;;(inferior-S-mode) -;; -;;; S-inf.el line 150 -;;(setq inferior-S-search-list-command "searchPaths()\n") -;; -;;;; fontify S-transcript-mode -;;;; overwrites S-trans.el lines 60-69 -;;;;(setq S-trans-font-lock-keywords S-inf-font-lock-keywords) -;; -;;(load "S-mode") -;; ;; Must follow S-mode -;;;;*;; based on S-mode.el line 219 -;;(add-to-list 'S-mode-font-lock-keywords -;; '("\\<\\(setGeneric\\|removeGeneric\\|setMethod\\|unsetMethod\\|setReplaceGeneric\\|setReplaceMethod\\|standardGeneric\\|setIs\\|setClass\\|representation\\)\\>" . font-lock-function-name-face) ; S4 method functions -;;) -;; -;; -;; -;;;;; fix to S-load-file to make C-c C-l work with S4 -;; -;;;When a file sourced into S4 by C-c C-l has a syntax error -;;;without the following changes, the system -;;;freezes until it is released with ^G. The reason is that the error -;;;messages, including the `Debug ?' request, go to the *S-errors* -;;;buffer. The *S-errors* buffer is not switched to, and couldn't accept -;;;a response if it were. -;;; -;;;The fix requires three modification to S-inf.el and two to S-mode.el. -;;;The correction to S-check-source noted in smode.cmt is also necessary. -;;; -;; -;;; S-inf.el line 92 NEW variable -;;(defvar inferior-S-debug-prompt "Debug \\? (y|n): " -;; "The expression S uses to offer to initiate debug tracing.") -;; -;;; S-inf.el line 458 -;;(defun inferior-S-wait-for-prompt () -;; "Wait until the S process is ready for input." -;; (let* ((cbuffer (current-buffer)) -;; (sprocess (get-S-process S-current-process-name)) -;; (sbuffer (process-buffer sprocess)) -;; r -;; (timeout 0)) -;; (set-buffer sbuffer) -;; (while (progn -;; (if (not (eq (process-status sprocess) 'run)) -;; (S-error "S process has died unexpectedly.") -;; (if (> (setq timeout (1+ timeout)) S-loop-timeout) -;; (S-error "Timeout waiting for prompt. Check inferior-S-prompt or S-loop-timeout.")) -;; (accept-process-output) -;; (goto-char (point-max)) -;;(setq end (point)) -;; (beginning-of-line) -;;(setq e (buffer-substring (point) end)) -;;(if (equal e inferior-S-debug-prompt) -;; (S-error "Debug prompt")) -;; (setq r (looking-at inferior-S-prompt)) -;; (not (or r (looking-at ".*\\?\\s *")))))) -;; (goto-char (point-max)) -;; (set-buffer cbuffer) -;; (symbol-value r))) -;; -;; -;; -;;; S-mode.el line 204 -;;(setq S-dump-error-re "Problem") -;; -;;;; S-mode.el line 655 -;;(defun S-parse-errors (showerr) -;; "Jump to error in last loaded S source file. -;;With prefix argument, only shows the errors S reported." -;; (interactive "P") -;; (S-make-buffer-current) -;; (let ((errbuff (get-buffer S-error-buffer-name))) -;; (if (not errbuff) -;; (error "You need to do a load first!") -;; (set-buffer errbuff) -;; (goto-char (point-max)) -;; (if -;; (re-search-backward ", file \"" nil t) -;; (let* ((beg-pos (progn (re-search-forward "\"" nil t) (point))) -;; (end-pos (progn (re-search-forward "\"" nil t) (- (point) 1))) -;; (filename (buffer-substring beg-pos end-pos)) -;; (fbuffer (get-file-buffer filename)) -;; (linenum (string-to-number -;; (progn (re-search-backward "," nil t) -;; (current-word)))) -;; (end-pos (point)) -;; (beg-pos (progn (goto-char (point-min)) -;; (re-search-forward ":" nil t) -;; (1+ (point)))) -;; (errmess (buffer-substring beg-pos end-pos)) -;; ) -;; (if showerr -;; (S-display-temp-buffer errbuff) -;; (if fbuffer nil -;; (setq fbuffer (find-file-noselect filename)) -;; (save-excursion -;; (set-buffer fbuffer) -;; (S-mode))) -;; (pop-to-buffer fbuffer) -;; (goto-line linenum)) -;; (princ errmess t)) -;; (message "Not a syntax error.") -;; (S-display-temp-buffer errbuff))))) -;; -;; -;; -;;;; S-inf.el line 584 -;;(defun S-prompt-wait (proc &optional start-of-output) -;; "Wait for a prompt to appear at BOL of current buffer -;;PROC is the S process. Does not change point" -;; (if start-of-output nil (setq start-of-output (point-min))) -;; (save-excursion -;; (while (progn -;; ;; get output if there is some ready -;; (accept-process-output proc 0 500) -;; (goto-char (marker-position (process-mark proc))) -;; (beginning-of-line) -;; -;; (if (re-search-forward inferior-S-debug-prompt nil t) -;; (if (equal (get-buffer S-error-buffer-name) -;; (get-buffer S-error-buffer-name)) -;; (let* ((sprocess (get-S-process S-current-process-name)) -;; (sbuffer (process-buffer sprocess))) -;; (set-buffer sbuffer) -;; (process-send-string sprocess "n\n") -;; (accept-process-output sprocess) -;; (beginning-of-line); delete inferior-S-debug-prompt -;; (kill-line) -;; (insert "> "))) -;; -;; (if (< (point) start-of-output) (goto-char start-of-output)) -;; (not (looking-at inferior-S-primary-prompt))))))) -;; - - - - ; Provide package - -(provide 'ess-s4-d) - -;;; ess-s4-d.el ends here diff -Nru ess-18.10.2/lisp/ess-sas-a.el ess-18.10.2+git20220915.f45542e/lisp/ess-sas-a.el --- ess-18.10.2/lisp/ess-sas-a.el 2018-11-10 09:41:11.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/lisp/ess-sas-a.el 2022-10-15 08:06:36.000000000 +0000 @@ -1,31 +1,33 @@ ;;; ess-sas-a.el --- clean-room implementation of many SAS-mode features -;; Copyright (C) 1997--2009 A.J. Rossini, Richard M. Heiberger, Martin -;; Maechler, Kurt Hornik, Rodney Sparapani, and Stephen Eglen. - +;; Copyright (C) 1997-2020 Free Software Foundation, Inc. ;; Author: Rodney A. Sparapani ;; Maintainer: ESS-core@r-project.org ;; Created: 17 November 1999 ;; Keywords: languages -;; This file is part of ESS +;; This file is part of GNU Emacs. -;; This file is free software; you can redistribute it and/or modify +;;; License: +;; +;; This program is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 2, or (at your option) -;; any later version. +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. ;; -;; This file is distributed in the hope that it will be useful, +;; This program is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. ;; -;; A copy of the GNU General Public License is available at -;; https://www.r-project.org/Licenses/ +;; You should have received a copy of the GNU General Public License +;; along with this program. If not, see +;; ;;; Code: (require 'ess-mode) +(require 'ess-utils) ;; Silence the byte compiler ;; FIXME: This is a lot, perhaps they can be moved? (defvar sas-indent-width) @@ -46,7 +48,7 @@ "Full path-name of the sas file to perform operations on.") (defcustom ess-sas-data-view-libname " " - "*SAS code to define a library for `ess-sas-data-view-fsview' + "SAS code to define a library for `ess-sas-data-view-fsview' or `ess-sas-data-view-insight'." :group 'ess-sas :type 'string) @@ -54,30 +56,31 @@ (defcustom ess-sas-data-view-submit-options (if ess-microsoft-p "-noenhancededitor -nosysin -log NUL:" "-nodms -nosysin -log /dev/null -terminal") - "*The command-line options necessary for your OS with respect to + "The command-line options necessary for your OS with respect to `ess-sas-data-view-fsview' and `ess-sas-data-view-insight'." :group 'ess-sas :type 'string) (defcustom ess-sas-data-view-fsview-command "; proc fsview data=" - "*SAS code to open a SAS dataset with `ess-sas-data-view-fsview'." + "SAS code to open a SAS dataset with `ess-sas-data-view-fsview'." :group 'ess-sas :type 'string) (defcustom ess-sas-data-view-fsview-statement " " - "*SAS code to perform a PROC FSVIEW statement with `ess-sas-data-view-fsview'." + "SAS code to perform a PROC FSVIEW statement with `ess-sas-data-view-fsview'." :group 'ess-sas :type 'string) + (make-variable-buffer-local 'ess-sas-data-view-fsview-statement) (defcustom ess-sas-data-view-insight-command "; proc insight data=" - "*SAS code to open a SAS dataset with `ess-sas-data-view-insight'." + "SAS code to open a SAS dataset with `ess-sas-data-view-insight'." :group 'ess-sas :type 'string) (defcustom ess-sas-data-view-insight-statement " " - "*SAS code to perform a PROC FSVIEW statement with `ess-sas-data-view-insight'." + "SAS code to perform a PROC FSVIEW statement with `ess-sas-data-view-insight'." :group 'ess-sas :type 'string) @@ -85,7 +88,7 @@ (defcustom ess-sas-graph-view-suffix-regexp "[.]\\([eE]?[pP][sS]\\|[pP][dD][fF]\\|[gG][iI][fF]\\|[jJ][pP][eE]?[gG]\\|[tT][iI][fF][fF]?\\)" - "*GSASFILE suffix regexp." + "GSASFILE suffix regexp." :group 'ess-sas :type 'string) @@ -115,17 +118,12 @@ (setq ess-tmp-alist (list (cons "[eE]?[pP][sS]" ess-tmp-ps) (cons "[pP][dD][fF]" ess-tmp-ps)))))) - "*Associate file name extensions with graphics image file viewers." + "Associate file name extensions with graphics image file viewers." :group 'ess-sas :type '(choice (const nil) (alist))) -;;(defcustom ess-sas-smart-back-tab nil -;; "*Set to t to make C-TAB insert an end/%end; statement to close a block." -;; :group 'ess-sas -;;) - (defcustom ess-sas-log-max 0 - "*If >0 and .log file exceeds this many bytes, just \"refresh\" this many bytes." + "If >0 and .log file exceeds this many bytes, just \"refresh\" this many bytes." :group 'ess-sas :type 'integer) @@ -135,28 +133,28 @@ :type 'string) (defcustom ess-sas-shell-buffer "*shell*" - "*Name that you want to use for the shell buffer; buffer-local." + "Name that you want to use for the shell buffer; buffer-local." :group 'ess-sas :type 'string) (make-variable-buffer-local 'ess-sas-shell-buffer) (defcustom ess-sas-shell-buffer-remote-host nil - "*Remote host that you want to open a shell on." + "Remote host that you want to open a shell on." :group 'ess-sas :type '(choice (const nil) string)) (make-variable-buffer-local 'ess-sas-shell-buffer-remote-host) (defcustom ess-sas-shell-buffer-remote-init "ssh" - "*Command to open a shell on a remote host." + "Command to open a shell on a remote host." :group 'ess-sas :type 'string) (make-variable-buffer-local 'ess-sas-shell-buffer-remote-init) (defcustom ess-sas-submit-mac-virtual-pc nil - "*Non-nil means that you want to run Windows SAS in a + "Non-nil means that you want to run Windows SAS in a Virtual PC emulator on your Mac; buffer-local." :group 'ess-sas :type 'boolean) @@ -164,25 +162,25 @@ (make-variable-buffer-local 'ess-sas-submit-mac-virtual-pc) (defcustom sas-program "sas" - "*Command to invoke SAS, default for buffer-local `ess-sas-submit-command'." + "Command to invoke SAS, default for buffer-local `ess-sas-submit-command'." :group 'ess-sas :type 'string) (defcustom ess-sas-submit-command sas-program - "*Command to invoke SAS in batch; buffer-local." + "Command to invoke SAS in batch; buffer-local." :group 'ess-sas :type 'string) (make-variable-buffer-local 'ess-sas-submit-command) (defcustom ess-sas-submit-command-options "-rsasuser" - "*Options to pass to SAS in batch; buffer-local." + "Options to pass to SAS in batch; buffer-local." :group 'ess-sas :type 'string) (make-variable-buffer-local 'ess-sas-submit-command-options) -(defvar ess-sas-submit-method +(defvar-local ess-sas-submit-method (if (and (and ess-microsoft-p (fboundp 'w32-shell-dos-semantics)) (w32-shell-dos-semantics)) @@ -190,32 +188,30 @@ "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'. -'sh if *shell* runs sh, ksh, csh, tcsh or bash -'ms-dos if *shell* follows MS-DOS semantics +\\='sh if *shell* runs sh, ksh, csh, tcsh or bash +\\='ms-dos if *shell* follows MS-DOS semantics -Unix users will get 'sh by default. +Unix users will get \\='sh by default. -Windows users running bash in *shell* will get 'sh by default. +Windows users running bash in *shell* will get \\='sh by default. -Windows users running MS-DOS in *shell* will get 'ms-dos by default. +Windows users running MS-DOS in *shell* will get \\='ms-dos by default. Users accessing a remote machine with `telnet', `rlogin', `ssh', etc., -should set this variable to 'sh regardless of their local shell -(since their remote shell is 'sh).") - -(make-variable-buffer-local 'ess-sas-submit-method) +should set this variable to \\='sh regardless of their local shell +(since their remote shell is \\='sh).") (defcustom ess-sas-graph-view-viewer-default (if ess-microsoft-p "explorer" (if (equal ess-sas-submit-method 'sh) "sdtimage")) - "*Default graphics image file viewer." + "Default graphics image file viewer." :group 'ess-sas :type 'string) (defcustom ess-sas-submit-post-command (if (equal ess-sas-submit-method 'sh) "&" (if ess-microsoft-p "-icon")) - "*Command-line statement to post-modify SAS invocation" + "Command-line statement to post-modify SAS invocation." :group 'ess-sas :type 'string) @@ -250,17 +246,17 @@ "nohup nice +6") (t "nohup nice"))) (if ess-microsoft-p "start")) - "*Command-line statement to precede SAS invocation, e.g. start or nohup" + "Command-line statement to precede SAS invocation, e.g. start or nohup." :group 'ess-sas :type 'string) (defcustom ess-sas-suffix-1 "txt" - "*The first suffix to associate with SAS." + "The first suffix to associate with SAS." :group 'ess-sas :type 'string) (defcustom ess-sas-suffix-2 "csv" - "*The second suffix to associate with SAS." + "The second suffix to associate with SAS." :group 'ess-sas :type 'string) @@ -271,7 +267,7 @@ (if ess-sas-suffix-2 (concat "\\|" (downcase ess-sas-suffix-2) "\\|" (upcase ess-sas-suffix-2))) "\\)") - "*Regular expression for SAS suffixes." + "Regular expression for SAS suffixes." :group 'ess-sas :type 'string) @@ -282,7 +278,7 @@ :group 'ess-sas) (defcustom ess-sas-temp-root "-temp" - "*Appended to root name of the temporary .sas file for `ess-sas-submit-region'." + "Appended to root name of the temporary .sas file for `ess-sas-submit-region'." :group 'ess-sas :type 'string) @@ -296,7 +292,7 @@ version of SAS. 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'. +ignored by calling `delete-dups'. If you set this variable, you need to restart Emacs (and set this variable before ess-site is loaded) for it to take effect.") @@ -315,7 +311,7 @@ (defun ess-ebcdic-to-ascii-search-and-replace () - "*Search and replace EBCDIC text with ASCII equivalents." + "Search and replace EBCDIC text with ASCII equivalents." (interactive) (let ((ess-tmp-dd (executable-find "dd")) (ess-tmp-recode (executable-find "recode")) (ess-tmp-util nil) (ess-tmp-util-args nil)) @@ -335,11 +331,10 @@ (defun ess-exit-notify-sh (string) "Detect completion or failure of submitted job and notify the user." - ;(let* ((exit-done "\\[[0-9]+\\]\\ *\\+*\\ *\\(Exit\\|Done\\).*$") - (let* ((exit-done "\\[[0-9]+\\]\\ *\\+*\\ *\\(Exit\\|Done\\)[^\r\n]*") ; GNU Emacs needs this + (let* ((exit-done "\\[[0-9]+\\] *\\+* *\\(Exit\\|Done\\)[^\r\n]*") (beg (string-match exit-done string))) (if beg - (message (substring string beg (match-end 0)))))) + (message "%s" (substring string beg (match-end 0)))))) (defun ess-sas-append-log () @@ -467,9 +462,12 @@ (cons (cons item value) alist)))) (defun ess-sas-create-local-variables-alist (&optional file-or-buffer) - "Create an alist of local variables from file-or-buffer, use the -current buffer if nil." - (if file-or-buffer (set-buffer (ess-get-file-or-buffer file-or-buffer))) + "Create an alist of local variables from file-or-buffer. +Use the current buffer if nil." + (declare (obsolete nil "ESS 19.04")) + (if file-or-buffer (set-buffer (if (bufferp file-or-buffer) + file-or-buffer + (find-buffer-visiting file-or-buffer)))) (ess-sas--change-alist 'ess-kermit-remote-directory ess-kermit-remote-directory nil)) (define-obsolete-function-alias @@ -564,7 +562,7 @@ (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 "\\)['\"]"))) + ; (concat "['\"]\\(.*" ess-sas-graph-suffix-regexp "\\)['\"]"))) (save-match-data (search-backward-regexp "[ \t=]" nil t) @@ -579,7 +577,7 @@ (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 + (if (and (bound-and-true-p 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? @@ -815,14 +813,14 @@ "And now for something completely different." (interactive) ;;(ess-sas-file-path) - (setq ess-customize-alist SAS-customize-alist) + (setq ess-local-customize-alist SAS-customize-alist) ;; (let ((ess-temp-sas-file ;; (nth 0 (split-string ;; (car (last (split-string ess-sas-file-path "\\([a-zA-Z][a-zA-Z]:\\|]\\)"))) "[.]")))) (setq ess-sas-shell-buffer "*iESS[SAS]*") (ess-sas-goto-shell) (ess-add-ess-process) - (ess-setq-vars-local ess-customize-alist) + (ess-setq-vars-local ess-local-customize-alist) (inferior-ess-mode) (ess-eval-linewise (concat ess-sas-submit-command " " ess-sas-submit-command-options " -stdio")) ;;" -altlog " ess-temp-sas-file ".log -altprint " @@ -1195,7 +1193,7 @@ (let ((versions ;; Find which versions of SAS we want. Remove the pathname, ;; leaving just the name of the executable. - (ess-uniq-list + (delete-dups (mapcar #'file-name-nondirectory (apply #'nconc (mapcar #'ess-find-exec-completions @@ -1220,16 +1218,11 @@ C-TAB is `ess-sas-backward-delete-tab' and RET is `newline'." (interactive) - - (if arg - (progn - (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 - (define-key sas-mode-local-map [return] 'newline-and-indent) - (define-key sas-mode-local-map "\t" 'sas-indent-line))) + (when arg + ;; TODO: Why is this set up this way? + (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))) (defvar ess-sas-edit-keys-toggle nil "Toggle TAB/RET key in `SAS-mode'. diff -Nru ess-18.10.2/lisp/ess-sas-d.el ess-18.10.2+git20220915.f45542e/lisp/ess-sas-d.el --- ess-18.10.2/lisp/ess-sas-d.el 2018-11-10 09:41:11.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/lisp/ess-sas-d.el 2022-10-15 08:06:36.000000000 +0000 @@ -1,29 +1,27 @@ ;;; ess-sas-d.el --- SAS customization -;; Copyright (C) 1997--2001 Richard M. Heiberger and A. J. Rossini -;; Copyright (C) 2002--2004 A.J. Rossini, Richard M. Heiberger, Martin -;; Maechler, Kurt Hornik, Rodney Sparapani, and Stephen Eglen. - +;; Copyright (C) 1997-2020 Free Software Foundation, Inc. ;; Author: Richard M. Heiberger ;; Created: 20 Aug 1997 ;; Maintainer: ESS-core -;; Keywords: languages - -;; This file is part of ESS. +;; This file is part of GNU Emacs. -;; This file is free software; you can redistribute it and/or modify +;;; License: +;; +;; This program is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 2, or (at your option) -;; any later version. - -;; This file is distributed in the hope that it will be useful, +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. +;; +;; This program is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. - -;; A copy of the GNU General Public License is available at -;; https://www.r-project.org/Licenses/ +;; +;; You should have received a copy of the GNU General Public License +;; along with this program. If not, see +;; ;;; Commentary: @@ -32,20 +30,43 @@ ;;; Code: -;;; Autoloads: - -(require 'comint) (require 'shell) -(require 'executable) (require 'ess-sas-l) +(defcustom SAS-mode-hook nil + "Hook to run when entering SAS mode." + :type 'hook + :group 'ess-sas) + (defvar inferior-SAS-args "-stdio -linesize 80 -noovp -nosyntaxcheck" - "*Arguments to use for starting SAS.") + "Arguments to use for starting SAS.") (defvar inferior-SAS-args-temp nil "Hack variable, needed for args preprocessing. Better logic needed! (see 2 uses, in this file).") +(defvar SAS-mode-syntax-table + (let ((tab (make-syntax-table))) + (modify-syntax-entry ?\\ "." tab) ;; backslash is punctuation + (modify-syntax-entry ?+ "." tab) + (modify-syntax-entry ?- "." tab) + (modify-syntax-entry ?= "." tab) + (modify-syntax-entry ?% "w" tab) + (modify-syntax-entry ?< "." tab) + (modify-syntax-entry ?> "." tab) + (modify-syntax-entry ?& "w" tab) + (modify-syntax-entry ?| "." tab) + (modify-syntax-entry ?\' "\"" tab) + (modify-syntax-entry ?* ". 23" tab) ; comment character + (modify-syntax-entry ?\; "." tab) + (modify-syntax-entry ?_ "w" tab) + (modify-syntax-entry ?< "." tab) + (modify-syntax-entry ?> "." tab) + (modify-syntax-entry ?/ ". 14" tab) ; comment character + (modify-syntax-entry ?. "w" tab) + tab) + "Syntax table for `SAS-mode'.") + (defun ess-SAS-pre-run-hook (temp-ess-dialect) "Set up log and list files for interactive SAS." @@ -88,26 +109,26 @@ ;; Construct the LST buffer for output (if (get-buffer ess-sas-lst-bufname) nil - (shell) - (accept-process-output (get-buffer-process (current-buffer))) - (sleep-for 2) ; need to wait, else working too fast! - (setq ess-sas-lst (ess-insert-accept "tty")) - (SAS-listing-mode) - (shell-mode) - (ess-listing-minor-mode t) - (rename-buffer ess-sas-lst-bufname t)) + (with-current-buffer (shell) + (accept-process-output (get-buffer-process (current-buffer)) 0.2) + (sleep-for 2) ; need to wait, else working too fast! + (setq ess-sas-lst (ess-insert-accept "tty")) + (SAS-listing-mode) + (shell-mode) + (ess-listing-minor-mode t) + (rename-buffer ess-sas-lst-bufname t))) ;; Construct the LOG buffer for output (if (get-buffer ess-sas-log-bufname) nil - (shell) - (accept-process-output (get-buffer-process (current-buffer))) - (sleep-for 2) ; need to wait, else working too fast! - (setq ess-sas-log (ess-insert-accept "tty")) + (with-current-buffer (shell) + (accept-process-output (get-buffer-process (current-buffer)) 0.2) + (sleep-for 2) ; need to wait, else working too fast! + (setq ess-sas-log (ess-insert-accept "tty")) ;(SAS-log-mode) - (shell-mode) - (ess-transcript-minor-mode t) - (rename-buffer ess-sas-log-bufname t)) + (shell-mode) + (ess-transcript-minor-mode t) + (rename-buffer ess-sas-log-bufname t))) (setq inferior-SAS-redirect-args (concat " " ess-sas-lst @@ -145,7 +166,7 @@ (goto-char (point-max)) (insert command) (comint-send-input) - (accept-process-output (get-buffer-process (current-buffer))) + (accept-process-output (get-buffer-process (current-buffer)) 0.2) (forward-line -1) (let* ((beg (point)) (ess-tty-name (progn (end-of-line) (buffer-substring beg (point))))) @@ -154,11 +175,9 @@ (defvar SAS-customize-alist - '((ess-local-customize-alist . 'SAS-customize-alist) + '((ess-local-customize-alist . SAS-customize-alist) (ess-language . "SAS") (ess-dialect . "SAS") - (ess-mode-editing-alist . SAS-editing-alist) ; from ess-sas-l.el - (ess-mode-syntax-table . SAS-syntax-table) (inferior-ess-program . inferior-SAS-program) (ess-help-sec-regex . "^[A-Z. ---]+:$") (ess-help-sec-keys-alist . " ") @@ -170,7 +189,6 @@ (inferior-ess-primary-prompt . "^") (inferior-ess-secondary-prompt . "^") (comint-use-prompt-regexp . t) - (inferior-ess-start-file . nil) ;"~/.ess-SAS") (inferior-ess-start-args . inferior-SAS-args-temp) ;; (ess-pre-run-hook . 'ess-SAS-pre-run-hook) ;; (ess-local-process-name . nil) @@ -180,15 +198,27 @@ ;;; The functions of interest (mode, inferior mode) ;;;###autoload -(defun SAS-mode (&optional proc-name) - "Major mode for editing SAS source. See ess-mode for more help." - (interactive) - (setq ess-customize-alist SAS-customize-alist) - (ess-mode SAS-customize-alist proc-name) - +(define-derived-mode SAS-mode ess-mode "[SAS]" + "Major mode for editing SAS source. See `ess-mode' for more help." + :group 'ess-sas + (ess-setq-vars-local SAS-customize-alist) + (setq ess-local-customize-alist SAS-customize-alist) + (setq-local sentence-end ";[\t\n */]*") + (setq-local paragraph-start "^[ \t]*$") + (setq-local paragraph-separate "^[ \t]*$") + (setq-local paragraph-ignore-fill-prefix t) + (setq-local adaptive-fill-mode nil) + (setq-local indent-line-function #'sas-indent-line) + (setq-local comment-start "/*") + (setq-local comment-start-skip "/[*]") + (setq-local comment-end "*/") + (setq-local comment-end-skip "[*]/") + (setq-local comment-column 40) + (setq-local ess-local-process-name nil) + (setq-local tab-stop-list ess-sas-tab-stop-list) + (setq-local font-lock-keywords-case-fold-search t) ;; Local map settings, AFTER initialization (only if not yet defined) - (if sas-mode-local-map - nil + (unless sas-mode-local-map (setq sas-mode-local-map (copy-keymap (current-local-map))) (ess-sas-edit-keys-set ess-sas-edit-keys-toggle) (if ess-sas-local-unix-keys (ess-sas-local-unix-keys)) @@ -196,7 +226,7 @@ (if ess-sas-global-unix-keys (ess-sas-global-unix-keys)) (if ess-sas-global-pc-keys (ess-sas-global-pc-keys))) (define-key sas-mode-local-map ";" 'ess-electric-run-semicolon) - + (define-key sas-mode-local-map (kbd "\C-c\C-w") 'ess-multi-frame-SAS) ;; this is a mess ;; interactive and batch commands share sas-mode-local-map, ;; but the associated commands are very different @@ -216,14 +246,9 @@ (use-local-map sas-mode-local-map) - (set (make-local-variable 'font-lock-defaults) - ;; KEYWORDS KEYWORDS-ONLY CASE-FOLD ..... - '(SAS-mode-font-lock-defaults nil t)) - ;; ^^ this *should* set - ;; font-lock-keywords-case-fold-search, but it fails for Emacs 22.[23] - ;; hence : - (setq font-lock-keywords-case-fold-search t) - (run-mode-hooks 'SAS-mode-hook)) + (setq font-lock-defaults + ;; KEYWORDS KEYWORDS-ONLY CASE-FOLD ..... + '(SAS-mode-font-lock-defaults nil t))) ;;;###autoload @@ -231,7 +256,9 @@ ;; rmh Jul 10 2003 (defun ess-electric-run-semicolon (arg) - "Insert character. If the line contains \"run;\" or \"quit;\" and nothing else then indent line." + "Insert character. +If the line contains \"run;\" or \"quit;\" and nothing else then +indent line." (interactive "P") (if ess-sas-edit-keys-toggle (insert ";") (let (insertpos) (if (and (not arg) @@ -245,7 +272,7 @@ (bolp))))) (progn (insert last-command-event) - (ess-indent-line) + (funcall indent-line-function) (save-excursion (if insertpos (goto-char (1+ insertpos))) (delete-char -1)))) @@ -255,7 +282,6 @@ (self-insert-command (prefix-numeric-value arg))) (self-insert-command (prefix-numeric-value arg)))))) -;;;###autoload (defun SAS-menu () "Start SAS from the menu." (interactive) @@ -267,7 +293,6 @@ (defun SAS () "Call 'SAS', from SAS Institute." (interactive) - (setq-default ess-customize-alist SAS-customize-alist) (let* ((temp-dialect "SAS")) ;(cdr (rassoc ess-dialect SAS-customize-alist)))) (ess-write-to-dribble-buffer (format "(SAS): ess-dial=%s, temp-dial=%s\n" @@ -275,10 +300,12 @@ temp-dialect)) (ess-SAS-pre-run-hook temp-dialect) (setq ess-eval-visibly-p nil) - (inferior-ess) - (with-current-buffer "*SAS*" - (use-local-map sas-mode-local-map)))) - + ;; FIXME: `inferior-SAS-args' is defined from + ;; `inferior-SAS-args-temp' in `ess-SAS-pre-run-hook' + (let ((inf-buf (inferior-ess nil SAS-customize-alist))) + (with-current-buffer inf-buf + (use-local-map sas-mode-local-map)) + inf-buf))) (defun ess-multi-frame-SAS () "Put running SAS buffers into separate frames. @@ -298,14 +325,8 @@ (with-current-buffer "*SAS.lst*" (make-frame))) - -(add-hook 'ess-mode-hook - (lambda () - (when (string= ess-language "SAS") ;; e.g. not for R-only users - (local-set-key "\C-c\C-w" 'ess-multi-frame-SAS)))) - (defun ess-num-or-zero (arg) - "*If a number, then return that number, otherwise return 0." + "If a number, then return that number, otherwise return 0." (or (and (numberp arg) arg) 0)) ; Provide package diff -Nru ess-18.10.2/lisp/ess-sas-l.el ess-18.10.2+git20220915.f45542e/lisp/ess-sas-l.el --- ess-18.10.2/lisp/ess-sas-l.el 2018-11-10 09:41:11.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/lisp/ess-sas-l.el 2022-10-15 08:06:36.000000000 +0000 @@ -1,31 +1,29 @@ ;;; ess-sas-l.el --- SAS customization -;; Copyright (C) 1997--2009 A.J. Rossini, Richard M. Heiberger, Martin -;; Maechler, Kurt Hornik, Rodney Sparapani, and Stephen Eglen. - +;; Copyright (C) 1997-2020 Free Software Foundation, Inc. ;; Authors: Richard M. Heiberger ;; A.J. Rossini ;; Rodney Sparapani ;; Created: 20 Aug 1997 ;; Maintainer: ESS-core -;; Keywords: languages - -;; This file is part of ESS (Emacs Speaks Statistics). +;; This file is part of GNU Emacs. -;; This file is free software; you can redistribute it and/or modify +;;; License: +;; +;; This program is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 2, or (at your option) -;; any later version. - -;; This file is distributed in the hope that it will be useful, +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. +;; +;; This program is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. - -;; A copy of the GNU General Public License is available at -;; https://www.r-project.org/Licenses/ - +;; +;; You should have received a copy of the GNU General Public License +;; along with this program. If not, see +;; ;;; Commentary: @@ -33,7 +31,6 @@ ;;; sas-mode: indent, run etc, SAS programs. -;;; Copyright (C) 1994--1997 Tom Cook ;;; Author: Tom Cook ;;; Dept. of Biostatistics ;;; University of Wisconsin - Madison @@ -50,7 +47,6 @@ ;;; Code: (require 'ess-mode) -(require 'ess-custom) (require 'ess-sas-a) (declare-function SAS-mode "ess-sas-d") @@ -137,25 +133,20 @@ (add-to-list 'magic-mode-alist '(ess-SAS-listing-mode-p . SAS-listing-mode)) -(defun SAS-log-mode () -"`ess-transcript-mode' for SAS." -(interactive) -(SAS-mode) -(setq mode-name "ESS[LOG]") -(ess-transcript-minor-mode 1) -(setq buffer-read-only t) ;; to protect the buffer. -(buffer-disable-undo)) +(define-derived-mode SAS-log-mode SAS-mode "ESS[LOG]" + "`ess-transcript-mode' for SAS." + :group 'ess-sas + (ess-transcript-minor-mode 1) + (setq buffer-read-only t) ;; to protect the buffer. + (buffer-disable-undo)) (defvar sas-mode-local-map nil "contains modified local keymap for SAS") -(defun SAS-listing-mode() -"Fundamental mode with `ess-listing-minor-mode' and read-only." -(interactive) -(fundamental-mode) -(setq mode-name "ESS[LST]") -(ess-listing-minor-mode 1) -(use-local-map sas-mode-local-map) -(setq buffer-read-only t) ;; to protect the buffer. -(buffer-disable-undo)) +(define-derived-mode SAS-listing-mode special-mode "ESS[LST]" + "Fundamental mode with `ess-listing-minor-mode' and read-only." + :keymap sas-mode-local-map + :group 'ess-sas + (ess-listing-minor-mode 1) + (buffer-disable-undo)) (fset 'sas-log-mode 'SAS-log-mode) (fset 'SAS-transcript-mode 'SAS-log-mode) @@ -164,17 +155,17 @@ (fset 'sas-listing-mode 'SAS-listing-mode) (defcustom sas-indent-width 4 - "*Amount to indent sas statements." + "Amount to indent sas statements." :group 'ess-sas :type 'integer) -(defcustom sas-indent-ignore-comment "*" - "*Comments that start with this string are ignored in indentation." +(defcustom sas-indent-ignore-comment "\\*" + "Comments that start with this regular expression are ignored in indentation." :group 'ess-sas :type 'string) (defcustom sas-require-confirmation t - "*Require confirmation when revisiting a modified sas-output file." + "Require confirmation when revisiting a modified sas-output file." :group 'ess-sas :type 'boolean) @@ -183,19 +174,13 @@ :group 'ess-sas :type 'hook) - ;never used--see ess-sas-submit-command-options in ess-sas-a.el - ;(defcustom sas-options-string "" - ; "*Options to be passed to sas as if typed on the command line." - ; :group 'ess-sas - ; :type 'string) - (defcustom sas-notify t - "*Beep and display message when job is done." + "Beep and display message when job is done." :group 'ess-sas :type 'boolean) (defcustom sas-error-notify t - "*If `sas-notify' t, indicate errors in log file upon completion." + "If `sas-notify' t, indicate errors in log file upon completion." :group 'ess-sas :type 'boolean) @@ -211,23 +196,23 @@ :group 'ess-sas) (defcustom sas-page-number-max-line 3 - "*Number of lines from the page break, to search for the page + "Number of lines from the page break, to search for the page number." :group 'ess-sas :type 'integer) (defcustom sas-notify-popup nil - "*If this and sas-notify are t), popup a window when SAS job ends." + "If this and `sas-notify' are t), popup a window when SAS job ends." :group 'ess-sas :type 'boolean) (defcustom sas-tmp-libname "_tmp_" - "*Libname to use for sas-get-dataset." + "Libname to use for sas-get-dataset." :group 'ess-sas :type 'string) (defcustom sas-file-name nil - "*The name of the current sas file." + "The name of the current sas file." :group 'ess-sas :type '(choice (const nil) file)) @@ -252,39 +237,6 @@ (defvar sas-file-root nil) (defvar sas-submitable nil) (defvar sas-dataset nil) -(defvar SAS-syntax-table nil "Syntax table for SAS code.") - -(if SAS-syntax-table nil - (setq SAS-syntax-table (make-syntax-table)) - - ;; (if (equal system-type 'windows-nt) - ;; ;; backslash is punctuation (used in MS file names) - ;; (modify-syntax-entry ?\\ "." SAS-syntax-table) - ;; ;; backslash is an escape character - ;; (modify-syntax-entry ?\\ "\\" SAS-syntax-table)) - (modify-syntax-entry ?\\ "." SAS-syntax-table) ;; backslash is punctuation - (modify-syntax-entry ?+ "." SAS-syntax-table) - (modify-syntax-entry ?- "." SAS-syntax-table) - (modify-syntax-entry ?= "." SAS-syntax-table) - (modify-syntax-entry ?% "w" SAS-syntax-table) - (modify-syntax-entry ?< "." SAS-syntax-table) - (modify-syntax-entry ?> "." SAS-syntax-table) - (modify-syntax-entry ?& "w" SAS-syntax-table) - (modify-syntax-entry ?| "." SAS-syntax-table) - (modify-syntax-entry ?\' "\"" SAS-syntax-table) - (modify-syntax-entry ?* ". 23" SAS-syntax-table) ; comment character - (modify-syntax-entry ?\; "." SAS-syntax-table) - (modify-syntax-entry ?_ "w" SAS-syntax-table) - (modify-syntax-entry ?< "." SAS-syntax-table) - (modify-syntax-entry ?> "." SAS-syntax-table) - (modify-syntax-entry ?/ ". 14" SAS-syntax-table) ; comment character - (modify-syntax-entry ?. "w" SAS-syntax-table)) - -(require 'font-lock); fontification also works in terminals! -;; (if (or window-system -;; noninteractive) ; compilation! -;;; ... - (defvar SAS-mode-font-lock-defaults (if ess-sas-run-regexp-opt @@ -827,34 +779,6 @@ )) "Font Lock regexs for SAS.") - -(defvar SAS-editing-alist - '((sentence-end . ";[\t\n */]*") - (paragraph-start . "^[ \t]*$") - (paragraph-separate . "^[ \t]*$") - (paragraph-ignore-fill-prefix . t) - ;;(fill-paragraph-function . 'lisp-fill-paragraph) - (adaptive-fill-mode . nil) - (indent-line-function . 'sas-indent-line) - ;;(indent-region-function . 'sas-indent-region) - (require-final-newline . mode-require-final-newline) - (comment-start . "/*") - (comment-start-skip . "/[*]") - (comment-end . "*/") - (comment-end-skip . "[*]/") - (comment-column . 40) - ;;(comment-indent-function . 'lisp-comment-indent) - (parse-sexp-ignore-comments . t) - (ess-style . ess-default-style) - (ess-local-process-name . nil) - ;;(ess-keep-dump-files . 'ask) - (tab-stop-list . ess-sas-tab-stop-list) - (ess-mode-syntax-table . SAS-syntax-table) - (font-lock-keywords-case-fold-search . t) - (font-lock-defaults . '(SAS-mode-font-lock-defaults))) - "General options for editing SAS source files.") - - (defun beginning-of-sas-statement (arg &optional comment-start) "Move point to beginning of current sas statement." (interactive "P") @@ -900,7 +824,7 @@ ;; added 6/27/94 to leave "* ;" comments alone. ((progn (back-to-indentation) - (and (not (looking-at "*/")) + (and (not (looking-at "\\*/")) (looking-at (concat sas-indent-ignore-comment "\\|/\\*")))) (setq indent (current-indentation))) ;; Case where current statement not DATA, PROC etc... @@ -933,7 +857,7 @@ ((save-excursion (progn (beginning-of-sas-statement 1 t) - (and (not (looking-at "*/")) + (and (not (looking-at "\\*/")) (looking-at sas-indent-ignore-comment)))) (setq indent cur-ind)) ((progn @@ -1006,7 +930,7 @@ (let ((prev-end (point))) (beginning-of-sas-statement 1) (while (and (not (bobp)) - (not (looking-at "*/")) + (not (looking-at "\\*/")) (looking-at sas-indent-ignore-comment)) (skip-chars-backward sas-white-chars) (if (bobp) nil @@ -1543,7 +1467,7 @@ "Add local variables code to end of sas source file." (interactive) (save-excursion - (if (re-search-forward "* *Local Variables: *;" nil t) + (if (re-search-forward "\\* *Local Variables: *;" nil t) () (goto-char (point-max)) (insert " @@ -1553,45 +1477,13 @@ page ; ")))) - - -;;-*-emacs-lisp-*- -;;; file name: sas-data.el -;;; -;;; Version 1.0 -;;; -;;; sas-data-mode: manage sas datasets -;;; Copyright (C) 1994 Tom Cook -;;; -;;; This program is free software; you can redistribute it and/or modify -;;; it under the terms of the GNU General Public License as published by -;;; the Free Software Foundation; either version 2 of the License, or -;;; (at your option) any later version. -;;; -;;; This program is distributed in the hope that it will be useful, -;;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;;; GNU General Public License for more details. -;;; -;;; A copy of the GNU General Public License is available at -;;; https://www.r-project.org/Licenses/ -;;; -;;; Author: Tom Cook -;;; Dept. of Biostatistics -;;; University of Wisconsin - Madison -;;; Madison, WI 53706 -;;; cook@biostat.wisc.edu -;; Created: 8/11/94 ;; variables section (defvar sas-dir-mode-map nil) -(defvar sas-directory-name nil +(defvar-local sas-directory-name nil "Name of directory associated with this buffer.") -(make-variable-buffer-local 'sas-directory-name) -(defvar sas-dir-buf-end nil) -(make-variable-buffer-local 'sas-dir-buf-end) -(defvar sas-sorted-by-num nil) -(make-variable-buffer-local 'sas-sorted-by-num) +(defvar-local sas-dir-buf-end nil) +(defvar-local sas-sorted-by-num nil) ;; user variables ;; keymaps etc... @@ -1626,17 +1518,10 @@ '("Submit File " . submit-sas)) ) - ;(require 'sas) - -(defun sas-dir-mode () +(define-derived-mode sas-dir-mode special-mode "SAS" "Major mode for managing sas files." - (interactive) - (kill-all-local-variables) - (use-local-map sas-dir-mode-map) - (setq major-mode 'sas-dir-mode) - (setq mode-name "SAS") - (setq sas-directory-name (expand-file-name default-directory)) - (setq buffer-read-only 1)) + :group 'ess-sas + (setq sas-directory-name (expand-file-name default-directory))) ;;(defun sas-make-library (directory &optional update) diff -Nru ess-18.10.2/lisp/ess-site.el ess-18.10.2+git20220915.f45542e/lisp/ess-site.el --- ess-18.10.2/lisp/ess-site.el 2018-11-10 09:41:11.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/lisp/ess-site.el 2022-10-15 08:06:36.000000000 +0000 @@ -1,141 +1,65 @@ -;;; ess-site.el --- user customization of ESS - -;; Copyright (C) 1993 David M. Smith -;; Copyright (C) 1997--2010 A.J. Rossini, Richard M. Heiberger, Martin -;; Maechler, Kurt Hornik, Rodney Sparapani, and Stephen Eglen. -;; Copyright (C) 2011--2018 A.J. Rossini, Richard M. Heiberger, Martin -;; Maechler, Kurt Hornik, Rodney Sparapani, Stephen Eglen, -;; Vitalie Spinu, and Lionel Henry. +;;; ess-site.el --- user customization of ESS -*- lexical-binding: t; -*- +;; Copyright (C) 1993-2020 Free Software Foundation, Inc. ;; Author: David Smith ;; Created: 12 Nov 1993 ;; Maintainer: ESS-core -;; Keywords: local -;; This file is part of ESS +;; This file is part of GNU Emacs. -;; This file is free software; you can redistribute it and/or modify +;;; License: +;; +;; This program is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 2, or (at your option) -;; any later version. - -;; This file is distributed in the hope that it will be useful, +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. +;; +;; This program is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. - -;; A copy of the GNU General Public License is available at -;; https://www.r-project.org/Licenses/ - +;; +;; You should have received a copy of the GNU General Public License +;; along with this program. If not, see +;; ;;; Commentary: -;; This file defines all the site-specific customizations for ESS. It should be -;; edited on a per-site basis. Read the comments (1.1 in Section 1 to see if -;; ess-site.el must be edited. The final directory location of this file must be -;; supplied in ess-lisp-directory. The editing of remaining sections is -;; optional. It should then be byte-compiled, and users who wish to use ESS -;; should add the path to ess-site to their `load-path' and require it: +;; Load path, autoloads, and major modes +;; ======================================== +;; +;; This file defines all the site-specific customizations for ESS. It should be +;; edited on a per-site basis. users who wish to use ESS should add the path to +;; ess-site to their `load-path' and require it: ;; ;; (add-to-list 'load-path "/path/to/ess/lisp-directory");; ;; (require 'ess-site) +;; +;; For most users the variable ess-lisp-directory will automatically be set +;; correctly. If you are working with an old Emacs, one in which file-truename +;; is not defined, then you might need to change the value of ess-lisp-directory +;; to the directory which is to contain the file ess-site.elc. This is probably +;; the current directory, or the value of LISPDIR if it was set in the Makefile. +;; +;; Debug startup: (setq ess-show-load-messages t) ;;; Code: -;;;; Load path, autoloads, and major modes -;;;; ======================================== -;; -;; For most users the variable ess-lisp-directory will automatically -;; be set correctly. If you are working with an old emacs, one in -;; which file-truename is not defined, then you might need to change -;; the value of ess-lisp-directory to the directory which is to -;; contain the file ess-site.elc. This is probably the current -;; directory, or the value of LISPDIR if it was set in the Makefile. - -;; DEBUG: (setq ess-show-load-messages t); instead of nil above - -;; This sets `ess-lisp-directory' either from the current directory -;; when the file is being `load'ed, or from the installed location -;; otherwise. This way, users can load ESS without having added ESS to -;; `load-path'. -(defvar ess-lisp-directory - ;; A nice default - (directory-file-name - (file-name-directory - (if load-file-name - (file-truename load-file-name) - (locate-library "ess-site") ))) - "Directory containing ess-site.el(c) and other ESS Lisp files.") - -(defvar ess-etc-directory nil - "Location of the ESS etc/ directory. -The ESS etc directory stores various auxillary files that are useful -for ESS, such as icons.") - - -;; Depending on how ESS is loaded the `load-path' might not contain -;; the `lisp' directory. For this reason we need to add it before we -;; start requiring ESS files -(add-to-list 'load-path (file-name-as-directory ess-lisp-directory)) -;; Add ess-lisp-directory/obsolete to load-path; files here will -;; automatically warn that they are obsolete when loaded. -(add-to-list 'load-path (file-name-as-directory (expand-file-name "obsolete" ess-lisp-directory))) - -(require 'ess-utils) -(ess-write-to-dribble-buffer - (format "[ess-site:] ess-lisp-directory = '%s'" ess-lisp-directory)) - - -;; If ess.info is not found, then ess-lisp-directory/../doc/info is added -;; resurrecting Stephen's version with a bug-fix -(unless (locate-file "ess.info" Info-default-directory-list) - (add-to-list 'Info-default-directory-list (expand-file-name "../doc/info/" ess-lisp-directory))) - +(when load-file-name + ;; Modify this if ess-site.el is not in the ./lisp/ directory + (defvar ess-lisp-directory (file-name-directory load-file-name) + "Directory containing ess-site.el(c) and other ESS Lisp files.") + (add-to-list 'load-path (directory-file-name ess-lisp-directory))) ;;; Loading popular dialects (they should become optional in the future) -;; R and Julia (require 'ess-r-mode) - -(when (require 'julia-mode nil 'no-error) - (require 'ess-julia)) - -;; S-PLUS (MathSoft/StatSci/Insightful/TIBCO) -(require 'ess-sp3-d) -(if ess-microsoft-p - (require 'ess-sp6w-d) - (require 'ess-sp6-d)) - -;; S-elsewhere, on another machine by telnet -(require 'essd-els) - -;; Stata, SAS, BUGS, and JAGS -(require 'ess-stata-mode) +(require 'essd-els) ;; ess-remote (require 'ess-sas-d) (require 'ess-bugs-d) (require 'ess-jags-d) - -(ess-write-to-dribble-buffer - (format "[ess-site.el]: ess-customize-alist=%s \n" - ess-customize-alist)) - -;;; Literate Data Analysis -(require 'ess-noweb) -(require 'ess-swv) - -(ess-write-to-dribble-buffer - (format "[ess-site.el _2_]: ess-customize-alist=%s \n" - ess-customize-alist)) - -;;; Speedbar and mouse -(require 'ess-mouse) - -;;; Toolbar support (require 'ess-toolbar) -(ess-write-to-dribble-buffer "[ess-site:] *very* end ...") - - (provide 'ess-site) ;;; ess-site.el ends here diff -Nru ess-18.10.2/lisp/ess-s-lang.el ess-18.10.2+git20220915.f45542e/lisp/ess-s-lang.el --- ess-18.10.2/lisp/ess-s-lang.el 2018-11-10 09:41:11.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/lisp/ess-s-lang.el 2022-10-15 08:06:36.000000000 +0000 @@ -1,28 +1,27 @@ -;;; 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. +;;; ess-s-lang.el --- Support for editing S source code -*- lexical-binding: t; -*- +;; Copyright (C) 1989-2020 Free Software Foundation, Inc. ;; Author: A.J. Rossini ;; Created: 26 Aug 1997 ;; Maintainer: ESS-core -;; This file is part of ESS (Emacs Speaks Statistics). +;; This file is part of GNU Emacs. -;; This file is free software; you can redistribute it and/or modify +;;; License: +;; +;; This program is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 2, or (at your option) -;; any later version. - -;; This file is distributed in the hope that it will be useful, +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. +;; +;; This program is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. - -;; A copy of the GNU General Public License is available at -;; https://www.r-project.org/Licenses/ +;; +;; You should have received a copy of the GNU General Public License +;; along with this program. If not, see +;; ;;; Commentary: @@ -30,14 +29,11 @@ ;;; Code: - ; Requires and autoloads - (require 'ess-mode) (require 'ess-help) -(require 'ess-utils) (require 'ess-inf) -(autoload 'speedbar-add-supported-extension "speedbar.el") +(declare-function speedbar-add-supported-extension "speedbar" (extension)) ; Configuration variables @@ -75,16 +71,10 @@ '((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")) "General options for S and S+ source files.") @@ -111,7 +101,6 @@ ;; (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 @@ -120,23 +109,18 @@ ;; inferior-ess-prompt is used by comint for navigation, only if ;; comint-use-prompt-regexp is t; (transcript-mode also relies on this regexp) (inferior-ess-prompt . inferior-S-prompt) - (ess-get-help-topics-function . #'ess-s-get-help-topics-function) (ess-getwd-command . "getwd()\n") (ess-setwd-command . "setwd('%s')\n") (ess-funargs-command . ".ess_funargs(\"%s\")\n") (fill-nobreak-predicate . 'ess-inside-string-p) - (normal-auto-fill-function . 'ess-do-auto-fill) (ess-execute-screen-options-command . "options(width=%d, length=99999)\n") - (inferior-ess-font-lock-keywords . 'inferior-S-font-lock-keywords) - (ess-font-lock-keywords . 'ess-S-font-lock-keywords) (font-lock-defaults . '(ess-build-font-lock-keywords nil nil ((?\. . "w") (?\_ . "w"))))) - "S-language common settings for all -customize-alist s") + "S-language common settings for all -customize-alist.") (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) @@ -157,7 +141,7 @@ (ess-editor . S-editor) (ess-pager . S-pager)) S-common-cust-alist) - "Common settings for all S+<*>-customize-alist s" + "Common settings for all S+<*>-customize-alist." ) ;;; Changes from S to S-PLUS 3.x. (standard S3 should be in ess-s-lang!). @@ -215,7 +199,7 @@ "Help section keys for S4.") -(defconst ess-help-S+-sec-regex "^[A-Z. ---]+:$" +(defconst ess-help-S+-sec-regex "^[A-Z.]+:$" "Reg(ular) Ex(pression) of section headers in help file.") ; Function Definitions @@ -234,185 +218,10 @@ (max (if (bolp) 0 (1+ (current-column))) comment-column)))) -;; VS: these are ess-indent-line and ess-calculate-indent from 2004 already,so -;; commented out to avoid confusion: - -;; (defun S-indent-line () -;; "Indent current line as S code. -;; Return the amount the indentation changed by." -;; (let ((indent (S-calculate-indent nil)) -;; beg shift-amt -;; (case-fold-search nil) -;; (pos (- (point-max) (point)))) -;; (beginning-of-line) -;; (setq beg (point)) -;; (cond ((eq indent nil) -;; (setq indent (current-indentation))) -;; (t -;; (skip-chars-forward " \t") -;; (cond ((and ess-indent-with-fancy-comments ;; ### or #! -;; (or (looking-at "###") -;; (and (looking-at "#!") (= 1 (line-number-at-pos))))) -;; (setq indent 0)) -;; ;; Single # comment -;; ((and ess-indent-with-fancy-comments -;; (looking-at "#") (not (looking-at "##"))) -;; (setq indent comment-column)) -;; (t -;; (if (eq indent t) (setq indent 0)) -;; (if (listp indent) (setq indent (car indent))) -;; (cond ((and (looking-at "else\\b") -;; (not (looking-at "else\\s_"))) -;; (setq indent (save-excursion -;; (ess-backward-to-start-of-if) -;; (+ ess-else-offset (current-indentation))))) -;; ((= (following-char) ?}) -;; (setq indent -;; (+ indent -;; (- ess-close-brace-offset ess-indent-offset)))) -;; ((= (following-char) ?{) -;; (setq indent (+ indent ess-brace-offset)))))))) -;; (skip-chars-forward " \t") -;; (setq shift-amt (- indent (current-column))) -;; (if (zerop shift-amt) -;; (if (> (- (point-max) pos) (point)) -;; (goto-char (- (point-max) pos))) -;; (delete-region beg (point)) -;; (indent-to indent) -;; ;; If initial point was within line's indentation, -;; ;; position after the indentation. -;; ;; Else stay at same point in text. -;; (if (> (- (point-max) pos) (point)) -;; (goto-char (- (point-max) pos)))) -;; shift-amt)) - -;; (defun S-calculate-indent (&optional parse-start) -;; "Return appropriate indentation for current line as S code. -;; In usual case returns an integer: the column to indent to. -;; Returns nil if line starts inside a string, t if in a comment." -;; (save-excursion -;; (beginning-of-line) -;; (let ((indent-point (point)) -;; (beginning-of-defun-function nil) ;; don't call ess-beginning-of-function -;; (case-fold-search nil) -;; state -;; containing-sexp) -;; (if parse-start -;; (goto-char parse-start) -;; (beginning-of-defun)) -;; (while (< (point) indent-point) -;; (setq parse-start (point)) -;; (setq state (parse-partial-sexp (point) indent-point 0)) -;; (setq containing-sexp (car (cdr state)))) -;; (cond ((or (nth 3 state) (nth 4 state)) -;; ;; return nil or t if should not change this line -;; (nth 4 state)) -;; ((null containing-sexp) -;; ;; Line is at top level. May be data or function definition, -;; (beginning-of-line) -;; (if (and (/= (following-char) ?\{) -;; (save-excursion -;; (ess-backward-to-noncomment (point-min)) -;; (ess-continued-statement-p))) -;; ess-continued-statement-offset -;; 0)) ; Unless it starts a function body -;; ((/= (char-after containing-sexp) ?{) -;; ;; line is expression, not statement: -;; ;; indent to just after the surrounding open. -;; (goto-char containing-sexp) -;; (let ((bol (save-excursion (beginning-of-line) (point)))) - -;; ;; modified by shiba@isac 7.3.1992 -;; (cond ((and (numberp ess-expression-offset) -;; (re-search-backward "[ \t]*expression[ \t]*" bol t)) -;; ;; This regexp match every "expression". -;; ;; modified by shiba -;; ;;(forward-sexp -1) -;; (beginning-of-line) -;; (skip-chars-forward " \t") -;; ;; End -;; (+ (current-column) ess-expression-offset)) -;; ((and (numberp ess-arg-function-offset) -;; (re-search-backward -;; "=[ \t]*\\s\"?\\(\\w\\|\\s_\\)+\\s\"?[ \t]*" -;; bol -;; t)) -;; (forward-sexp -1) -;; (+ (current-column) ess-arg-function-offset)) -;; ;; "expression" is searched before "=". -;; ;; End - -;; (t -;; (progn (goto-char (1+ containing-sexp)) -;; (current-column)))))) -;; (t -;; ;; Statement level. Is it a continuation or a new statement? -;; ;; Find previous non-comment character. -;; (goto-char indent-point) -;; (ess-backward-to-noncomment containing-sexp) -;; ;; Back up over label lines, since they don't -;; ;; affect whether our line is a continuation. -;; (while (eq (preceding-char) ?\,) -;; (ess-backward-to-start-of-continued-exp containing-sexp) -;; (beginning-of-line) -;; (ess-backward-to-noncomment containing-sexp)) -;; ;; Now we get the answer. -;; (if (ess-continued-statement-p) -;; ;; This line is continuation of preceding line's statement; -;; ;; indent ess-continued-statement-offset more than the -;; ;; previous line of the statement. -;; (progn -;; (ess-backward-to-start-of-continued-exp containing-sexp) -;; (+ ess-continued-statement-offset (current-column) -;; (if (save-excursion (goto-char indent-point) -;; (skip-chars-forward " \t") -;; (eq (following-char) ?{)) -;; ess-continued-brace-offset 0))) -;; ;; This line starts a new statement. -;; ;; Position following last unclosed open. -;; (goto-char containing-sexp) -;; ;; Is line first statement after an open-brace? -;; (or -;; ;; If no, find that first statement and indent like it. -;; (save-excursion -;; (forward-char 1) -;; (while (progn (skip-chars-forward " \t\n") -;; (looking-at "#")) -;; ;; Skip over comments following openbrace. -;; (forward-line 1)) -;; ;; The first following code counts -;; ;; if it is before the line we want to indent. -;; (and (< (point) indent-point) -;; (current-column))) -;; ;; If no previous statement, -;; ;; indent it relative to line brace is on. -;; ;; For open brace in column zero, don't let statement -;; ;; start there too. If ess-indent-offset is zero, use -;; ;; ess-brace-offset + ess-continued-statement-offset -;; ;; instead. -;; ;; For open-braces not the first thing in a line, -;; ;; add in ess-brace-imaginary-offset. -;; (+ (if (and (bolp) (zerop ess-indent-offset)) -;; (+ ess-brace-offset ess-continued-statement-offset) -;; ess-indent-offset) -;; ;; Move back over whitespace before the openbrace. -;; ;; If openbrace is not first nonwhite thing on the line, -;; ;; add the ess-brace-imaginary-offset. -;; (progn (skip-chars-backward " \t") -;; (if (bolp) 0 ess-brace-imaginary-offset)) -;; ;; If the openbrace is preceded by a parenthesized exp, -;; ;; move to the beginning of that; -;; ;; possibly a different line -;; (progn -;; (if (eq (preceding-char) ?\)) -;; (forward-sexp -1)) -;; ;; Get initial indentation of the line we are on. -;; (current-indentation)))))))))) - ;;*;; S/R Pretty-Editing (defun ess-fix-comments (&optional dont-query verbose) - "Fix ess-mode buffer so that single-line comments start with at least '##', + "Fix 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) @@ -420,20 +229,21 @@ "\\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." + "Make the change in an S - dump() file to improve human readability. +Optional arguments DONT-QUERY and VERBOSE are passed to +`ess-replace-regexp-dump-to-src'." (interactive "P") - (ess-mode) (ess-replace-regexp-dump-to-src "^\"\\([a-z.][a-z.0-9]*\\)\" *<-\n" "\n\\1 <- " dont-query verbose)) (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" + "Round endings like 000000 and 99999. +Optional argument DONT-QUERY means do not query. +Optional argument VERBOSE gives more verbose output." (interactive "P") (save-excursion (goto-char (point-min)) - (let ((num 0) (str "") (rgxp "000000+[1-9]?[1-9]?\\>") @@ -441,7 +251,6 @@ (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)) @@ -452,7 +261,9 @@ (setq num (1+ num)))))) (defun ess-fix-dot (before-chars &optional dont-query verbose) - "Remove trailing decimal '.' (\"dot\"), before BEFORE; typically from S-plus" + "Remove trailing decimal '.' (\"dot\"), before BEFORE-CHARS. +Optional argument DONT-QUERY and VERBOSE get passed to +`ess-replace-regexp-dump-to-src'." ;; typically, before-chars = "]:" or more (ess-replace-regexp-dump-to-src (concat "\\([0-9]\\)\\.\\( *[" before-chars "]\\)") @@ -467,13 +278,13 @@ (defun ess-fix-dot-more (&optional dont-query verbose) "Remove trailing decimal '.' (\"dot\", typically from S+) in more cases - than `ess-fix-dot-1'." +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., + "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) !" @@ -484,7 +295,6 @@ (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 "," @@ -492,26 +302,24 @@ ;; 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) - )) + 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." +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) - ) + (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." +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 @@ -593,6 +401,7 @@ (not (and (re-search-backward str (- (point) (length str)) t) (not (replace-match (car slist)))))))) + (delete-horizontal-space) (insert (car ess-assign-list))) (set-transient-map (let ((map (make-sparse-keymap)) @@ -603,9 +412,9 @@ (defun ess-insert-assign (arg) "Insert the first element of `ess-assign-list' unless in string or comment. If the character before point is the first element of -`ess-assign-list', replace it with the last character typed. If -`ess-smart-S-assign-key' is nil, do `self-insert-command' using -ARG as the number of times to insert." +`ess-assign-list', replace it with the last character typed. + +If `ess-language' is not \"S\", call `self-insert-command' with ARG." (interactive "p") (if (string= ess-language "S") (let* ((assign (car ess-assign-list)) @@ -617,188 +426,99 @@ (if (and char (numberp event)) (replace-match char t t) (replace-match ""))) - (t (insert assign)))) + (t (delete-horizontal-space) + (insert assign)))) (funcall #'self-insert-command arg))) -(defun ess-smart-S-assign (arg) - "Insert `ess-smart-S-assign-key'. -Please use `ess-insert-assign'." - (interactive "p") - (with-no-warnings ; Obsolete key variable - (if ess-smart-S-assign-key - (ess-insert-assign arg) - (self-insert-command arg)))) - -(make-obsolete 'ess-smart-S-assign 'ess-insert-assign "ESS 18.10") - -(defun ess-disable-smart-S-assign (&rest _ignore) - "Disable `ess-insert-assign'." - (declare (obsolete "Use ess-smart-S-assign-key instead." "ESS 18.10")) - (with-no-warnings ; Obsolete key variable - (setq ess-smart-S-assign-key nil))) +;; In case people had this in their config don't cause errors: +(define-obsolete-function-alias 'ess-smart-S-assign 'ess-insert-assign "ESS 18.10") +(define-obsolete-function-alias 'ess-disable-smart-S-assign #'ignore "ESS 18.10") (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 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-assign) - (define-key inferior-ess-mode-map [?\M--] 'ess-insert-assign) - ) + "Define MM's user keys." + (declare (obsolete "Setup your own keybindings." "ESS 19.04")) + (define-key inferior-ess-mode-map "\C-cw" #'ess-execute-screen-options) + (define-key ess-mode-map [?\M--] #'ess-insert-assign) + (define-key inferior-ess-mode-map [?\M--] #'ess-insert-assign)) - -(defun ess-dump-args-and-go (Sfunc) ; &optional buff) +(defun ess-dump-args-and-go (Sfunc) "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." - +and I need to relearn Emacs lisp (but I had to, anyway." + (declare (obsolete 'ess-execute "ESS 19.04")) (interactive "sFunction ? ") - (let* ((buffname "ess-complete.R") - (buf (ess-execute (format "args(%s)" Sfunc) t buffname))) - (pop-to-buffer buf) - (message "here yet?") + (let* ((buffname "ess-complete.R")) + (ess-execute (format "args(%s)" Sfunc) t buffname) + (pop-to-buffer (concat "*" buffname "*")) (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 ")"))) - + (when (fboundp 'ess-r-mode) + (ess-r-mode)))) ;;; S imenu support ;; don't use syntax classes, bad for etags (defvar ess-imenu-S-generic-expression - '(("Functions" "^\\(.+\\)[ \t\n]*<-[ \t\n]*function[ ]*(" 1) + '(("Functions" "^\\([^ \t\n]+\\)[ \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) + ("Package" "^.*\\(library\\|require\\)(\\([^)]*\\)" 2) + ("Data" "^\\(.+\\)[ \t\n]-*\\(?:<-\\|=\\)[ \t\n]*\\(read\\|.*data\\.frame\\).*(" 1)) + "Imenu generic expression for S modes. +See `imenu-generic-expression'.") + +(defun ess-imenu-S (&optional _arg) + "S Language Imenu support for ESS. +ARG is ignored." + (declare (obsolete "It is set automatically in major modes" "ESS 19.04")) (imenu-add-to-menubar "Imenu-S")) -(defalias 'ess-imenu-R 'ess-imenu-S) +(define-obsolete-function-alias 'ess-imenu-R 'ess-imenu-S "ESS 19.04") ;;; 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 + +(eval-after-load "speedbar" + '(progn + (speedbar-add-supported-extension ".R") + (speedbar-add-supported-extension ".S") + (speedbar-add-supported-extension ".s") + (speedbar-add-supported-extension ".q"))) + +(cl-defmethod ess-help-get-topics (proc &context (ess-dialect "R")) + "Return a list of current S help topics associated with process PROC. +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)) - (when (fboundp 'ess-help-r--check-last-help-type) - (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) + (delete-dups + (append (ess-get-object-list proc '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) +(cl-defmethod ess-help--reset-cache-override (&context (ess-dialect "R")) + (ess-command ".ess.getHelpAliases(reset = TRUE)\n" + nil nil nil nil nil nil ess-help--aliases-timeout)) + +(defalias 'S 'S+) +(defalias 's-mode 'S+-mode) +(defalias 's-transcript-mode 'S+-transcript-mode) +(defalias 'S-transcript-mode 's-transcript-mode) +(defalias 'S-mode 's-mode) (define-obsolete-function-alias 'ess-toggle-S-assign-key #'ignore "ESS 18.10") @@ -811,7 +531,7 @@ ;;;###autoload (add-to-list 'auto-mode-alist '("\\.[Ss]t\\'" . S-transcript-mode)) ;;;###autoload -(add-to-list 'auto-mode-alist '("\\.Sout" . S-transcript-mode)) +(add-to-list 'auto-mode-alist '("\\.Sout\\'" . S-transcript-mode)) (provide 'ess-s-lang) diff -Nru ess-18.10.2/lisp/ess-sp3-d.el ess-18.10.2+git20220915.f45542e/lisp/ess-sp3-d.el --- ess-18.10.2/lisp/ess-sp3-d.el 2018-11-10 09:41:11.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/lisp/ess-sp3-d.el 1970-01-01 00:00:00.000000000 +0000 @@ -1,85 +0,0 @@ -;;; ess-sp3-d.el --- S-PLUS 3.x customization - -;; Copyright (C) 1997--2004 A.J. Rossini, Richard M. Heiberger, Martin -;; Maechler, Kurt Hornik, Rodney Sparapani, and Stephen Eglen. - -;; Author: A.J. Rossini -;; Created: 12 Jun 1997 -;; 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 -;; https://www.r-project.org/Licenses/ - -;;; Commentary: - -;; This file defines all the S-PLUS 3.x customizations for ess-mode. - -;;; Code: - -(require 'ess-s-lang) -(require 'ess-trns) - -(defvar S+3-dialect-name "S+3" - "Name of 'dialect' for S-PLUS 3.x.");easily changeable in a user's .emacs - -(defvar S+3-customize-alist - (append - '((ess-local-customize-alist . 'S+3-customize-alist) - (ess-dialect . S+3-dialect-name) - (ess-object-name-db-file . "ess-s+3-namedb.el" ) - (inferior-ess-program . inferior-S+3-program) - (inferior-ess-help-command . "help(\"%s\", pager=\"cat\", window=FALSE)\n") - (inferior-ess-help-filetype . nil) - (inferior-ess-search-list-command . "search()\n") - (inferior-ess-start-file . nil) ;"~/.ess-S+3") - (inferior-ess-start-args . "") - (ess-STERM . "iESS") - ) - S+common-cust-alist) - - "Variables to customize for S+3.") - - -(defun S+3 (&optional proc-name) - "Call 'S-PLUS 3.x', the 'Real Thing' from StatSci." - (interactive) - (setq ess-customize-alist S+3-customize-alist) - (ess-write-to-dribble-buffer - (format "\n(S+3): ess-dialect=%s, buf=%s\n" ess-dialect (current-buffer))) - (inferior-ess) - (if inferior-ess-language-start - (ess-eval-linewise inferior-ess-language-start))) - -(defun S+3-mode (&optional proc-name) - "Major mode for editing S+3 source. See `ess-mode' for more help." - (interactive) - (setq ess-customize-alist S+3-customize-alist) - (ess-mode S+3-customize-alist proc-name) - (if ess-imenu-use-S (ess-imenu-S))) - -(defun S+3-transcript-mode () - "S-PLUS 3.x transcript mode." - (interactive) - (ess-transcript-mode S+3-customize-alist)) - - - - ; Provide package - -(provide 'ess-sp3-d) - -;;; ess-sp3-d.el ends here diff -Nru ess-18.10.2/lisp/ess-sp4-d.el ess-18.10.2+git20220915.f45542e/lisp/ess-sp4-d.el --- ess-18.10.2/lisp/ess-sp4-d.el 2018-11-10 09:41:11.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/lisp/ess-sp4-d.el 1970-01-01 00:00:00.000000000 +0000 @@ -1,419 +0,0 @@ -;;; ess-sp4-d.el --- S-PLUS 4.x customization - -;; Copyright (C) 1998--2002 Richard M. Heiberger -;; Copyright (C) 2003--2004 A.J. Rossini, Richard M. Heiberger, Martin -;; Maechler, Kurt Hornik, Rodney Sparapani, and Stephen Eglen. - -;; Author: Richard M. Heiberger -;; Created: December 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 -;; https://www.r-project.org/Licenses/ - -;;; Commentary: - -;; This file defines all the S-PLUS 4.x customizations for ess-mode -;; with ddeclient. - -;;; Code: - -;;; Requires and Autoloads: - -(require 'ess-mode) -(require 'ess-inf) -(require 'ess-s-lang) -(require 'ess-dde) -(require 'ess-trns) - -(defvar ess-S+-startup-delay) - -(defvar S+4-dialect-name "S+4" - "Name of 'dialect' for S-PLUS 4.x.");easily changeable in a user's .emacs - -(defvar inferior-S+4-multipleinstances "/MULTIPLEINSTANCES" - "Default \"/MULTIPLEINSTANCES\" opens up a new instance of S+4 in a -GUI window and connects it to the '(ddeESS [S+4])' window. The -alternative nil uses an existing S+4 GUI (if there is one) and -connects it to the '(ddeESS [S+4])' window.") - -(defvar S+4-customize-alist - (append - '((ess-local-customize-alist . 'S+4-customize-alist) - (ess-dialect . S+4-dialect-name) - (ess-object-name-db-file . "ess-sp4-namedb.el" ) - (inferior-ess-program . inferior-S+4-program) - (inferior-ess-help-command . "help(\"%s\")\n") - (inferior-ess-help-filetype . "chm") - - (ess-send-region-function . #'ess-dde-send-region) - (ess-load-file-function . #'ess-dde-load-file) - (ess-command-function . #'ess-dde-command) - (ess-eval-linewise-function . #'ess-dde-eval-linewise) - (ess-dump-object-function . #'ess-dde-dump-object) - (ess-read-object-name-function . #'ess-dde-read-object-name) - (ess-find-help-file-function . #'ess-dde-find-help-file) - (ess-display-help-on-object-function . #'ess-chm-display-help-on-object) - - (inferior-ess-start-file . nil) ;"~/.ess-S+4") - (inferior-ess-start-args . (concat - inferior-S+4-multipleinstances " " - inferior-S+4-print-command - " S_PROJ=" - (directory-file-name default-directory))) - ;; (inferior-ess-ddeclient . "ddeclient") - ;; (inferior-ess-client-name . "S-PLUS") - ;; (inferior-ess-client-command . "SCommand") - (ess-STERM . "ddeESS") - ) - S+common-cust-alist) - - "Variables to customize for S+4") - -(defvar Sqpe+4-customize-alist - (append - '((ess-local-customize-alist . 'Sqpe+4-customize-alist) - (ess-dialect . S+4-dialect-name) - (ess-loop-timeout . 500000 );fixme: dialect specific custom.v - (ess-object-name-db-file . "ess-sp4-namedb.el" ) - (ess-display-help-on-object-function . #'ess-chm-display-help-on-object) - (inferior-ess-program . inferior-Sqpe+4-program) - (inferior-ess-help-command . "help(\"%s\")\n") - (inferior-ess-help-filetype . "chm") - (inferior-ess-search-list-command . "searchPaths()\n") - (inferior-ess-start-file . nil) ;"~/.ess-S+4") - (inferior-ess-language-start . (concat - "options(" - "STERM='" ess-STERM "'" - (if ess-editor - (concat ", editor='" ess-editor "'")) - (if ess-pager - (concat ", pager='" ess-pager "'")) - ")")) - (ess-STERM . "iESS") - ) - S+common-cust-alist) - - "Variables to customize for Sqpe+4.") - - -;;; There are extra complications in S+4 (compared to S+3) because -;;; -;;; (1) The StatSci supplied Splus.exe doesn't work in an emacs -;;; buffer. It works as as a GUI window and we must send commands -;;; to it through ddeclient. Nonetheless, we need to give it a -;;; process name and be sure that that there is a valid running -;;; process in the '(ddeESS [S+4])' buffer. Therefore we create an -;;; ESS process in the buffer as a placeholder and start a shell -;;; in the ESS buffer. From the shell we start Splus. Once Splus -;;; finishes initializing and kills the original shell, we start -;;; another shell. We have a buffer-local variable -;;; inferior-ess-ddeclient, initialized to nil. When there is a -;;; non-nil value of inferior-ess-ddeclient we send lines to -;;; inferior-ess-ddeclient rather than to the Splus process. -;;; (2) There is no Splus process running in the '(ddeESS [S+4])' -;;; buffer. Therefore inferior-ess will never see a prompt, -;;; unless we first change it to the null prompt "^". Then once -;;; the process has started, we change it back. -;;; (3) When M-x S+4 starts Splus by a shell command, then Splus is an -;;; independent process and will be survive if the '(ddeESS [S+4])' -;;; buffer is killed (or emacs is quit). The '(ddeESS [S+4])' is -;;; made read-only and a warning is placed in it saying that "You -;;; can't type anything here." Actually, if the standalone Splus -;;; is killed and the '(ddeESS [S+4])' is made writable (C-x C-q), -;;; then '(ddeESS [S+4])' becomes a shell buffer. -;;; -(defun S+4 (&optional proc-name) - "Call 'S-PLUS 4.x', the 'GUI Thing' from StatSci. Put S-Plus in an -independent MS-Window (Splus persists even if the '(ddeESS [S+4])' -window is killed in emacs). Do this by creating a comint process that -calls sh. Send a shell command in that sh buffer to call Splus. When -it completes set up a shell as a placeholder in the '(ddeESS [S+4])' -buffer. The S-Plus options are correctly set. In particular, the -S-Plus Commands window is opened if the Options/General -Settings/Startup menu says it should be. There is a 30 second delay -during startup in which the screen will not be refreshed. This delay -is here to allow slow disks to start the Splus program." - (interactive) - (save-excursion - (setq ess-customize-alist S+4-customize-alist) - (ess-write-to-dribble-buffer - (format "\n(S+4): ess-dialect=%s, buf=%s\n" ess-dialect - (current-buffer))) - (setq ess-customize-alist ; change inferior-ess-program - (append ess-customize-alist '((inferior-ess-program . "sh")))) - (setq ess-customize-alist ; change inferior-ess-primary-prompt - (append ess-customize-alist '((inferior-ess-primary-prompt . "^")))) - (setq ess-customize-alist ; change inferior-ess-start-args - (append ess-customize-alist '((inferior-ess-start-args . "-i")))) - (let ((s-proj (getenv "S_PROJ")) - (manpath (getenv "MANPATH"))) - (if (fboundp 'w32-short-file-name) - (cd (w32-short-file-name (directory-file-name default-directory))) - (cd (directory-file-name default-directory))) - (setenv "S_PROJ" default-directory) - ;; I don't know why this PATH/MANPATH game is needed, - ;; except that it doesn't work without it. - (setenv "MANPATH" (getenv "PATH")) - (inferior-ess) - (sleep-for 2) ; need to wait, else working too fast! The Splus - ; command in '(ddeESS [S+4])' should follow the "$" - ; prompt. If not, then increase the sleep-for time! - (setenv "MANPATH" manpath) - (setenv "S_PROJ" s-proj)) - (setq ess-customize-alist S+4-customize-alist) - (ess-setq-vars-local ess-customize-alist) -;;; the next three lines belong in customize-alist, but can't be there -;;; because of the broken ess-setq-vars-default usage in ess-inf.el - (setq inferior-ess-ddeclient "ddeclient") - (setq inferior-ess-client-name "S-PLUS") - (setq inferior-ess-client-command "SCommand") -;;; end of what belongs in customize-alist - (setq comint-process-echoes nil) - (setq comint-input-sender 'comint-simple-send) - (goto-char (point-max)) - (insert (concat inferior-S+4-program " " - inferior-ess-start-args)) ; Note: there is no final "&". - ;; Without the "&", the results of !system.command come to '(ddeESS [S+4])' - ;; With the "&", the results of !system.command in S get lost. - (inferior-ess-send-input) - (sleep-for 30) ; Need to wait, else working too fast! - ; If the ess-current-process-name doesn't appear in the - ; Splus Commands window increase the sleep-for time! - (setq ess-local-process-name ess-current-process-name) - (ess-eval-linewise (concat "#" ess-current-process-name)) - (goto-char (point-min)) - (insert - "This is a placeholder buffer. You can't type anything here. -Use `C-x b RET' to return to your file.\n -Anything sent to this process from an S-mode buffer goes -directly to the associated Splus Commands window.\n -The S-Plus Commands window must be visible. -You may need to open the S-Plus Commands window manually (by clicking on -Splus/Window/Commands Window).\n -Any results of the !system.command typed at the S prompt in the -Splus Commands window appear in this buffer.\n\n") - (goto-char (point-max)) ; comint-mode-map makes '(ddeESS [S+4])' - ;; (use-local-map comint-mode-map) ;a shell buffer after Splus is finished. - (set-process-coding-system (get-process ess-local-process-name) 'raw-text-dos 'raw-text-unix) - (setq buffer-read-only t) ; force buffer to be read-only - (setq mode-name "ddeESS") - ;; (ess-eval-linewise inferior-S+4-editor-pager-command) - (if inferior-ess-language-start - (ess-eval-linewise inferior-ess-language-start)) - )) - - - - -(defun S+4-existing (&optional proc-name) - "Call 'S-PLUS 4.x', the 'GUI Thing' from StatSci. Do so by finding -an existing S-Plus in an independent MS-Window (if there is one) and -set up a '(ddeESS [S+4])' buffer in emacs. If there is no existing -S-Plus, then a new one will be opened in the default directory, -usually something like c:/Program Files/spls45se/users/yourname. -If you have a HOME environment variable, it will open it there." - (interactive) - (let* ((inferior-S+4-multipleinstances " & # ")) ; Note: there is a final "&". - ;; Without the "&", there is a core dump. - ;; With the "&", the results of !system.command in S get lost. - ;; We are picking up an existing S-Plus process for sending to. - ;; It doesn't know about us, so nothing comes back. - (S+4 proc-name)) - (with-current-buffer (car (buffer-list)) ; get the ESS buffer just created - (setq buffer-read-only nil) ; permit writing in ESS buffer - (goto-char (point-max)) - (beginning-of-line) - (forward-line -1) - (insert - "This is S+4-existing. -Results of the !system.command typed at the S prompt in the -Splus Commands window blink a DOS window and you won't see them.\n\n") - (setq buffer-read-only t) ; restore ESS buffer to be read-only - )) - - -;;; There are extra complications in Sqpe+4 (compared to S+3) because -;;; (1) The StatSci supplied Sqpe.exe won't work without SHOME as an -;;; environment variable and Sqpe does not take command line -;;; arguments and -;;; (2) Sqpe.exe comes up with options(interactive=F), which means it -;;; doesn't provide prompts by default, and we must change it to T so -;;; it will provide prompts. -;;; -(defun Sqpe+4 (&optional proc-name) - "Call 'Sqpe' from 'S-PLUS 4.x', the 'Real Thing' from StatSci." - (interactive) - (setq ess-customize-alist Sqpe+4-customize-alist) - (let* ((shome-nil-p (equal (getenv "SHOME") nil))) - (if shome-nil-p (setenv "SHOME" inferior-Sqpe+4-SHOME-name)) - (ess-write-to-dribble-buffer - (format "\n(Sqpe+4): ess-dialect=%s, buf=%s\n" ess-dialect - (current-buffer))) - (setq ess-customize-alist ; change inferior-ess-primary-prompt - (append ess-customize-alist '((inferior-ess-primary-prompt . "^")))) - (inferior-ess) - (setq ess-customize-alist Sqpe+4-customize-alist) ; restore i-e-p-p in alist - (ess-setq-vars-local ess-customize-alist) ; restore i-e-p-p in buffer - (setq inferior-ess-prompt ; define with correct i-e-p-p - ;; Do not anchor to bol with `^' ; (copied from ess-inf.el) - (concat "\\(" - inferior-ess-primary-prompt - "\\|" - inferior-ess-secondary-prompt - "\\)")) - (setq comint-prompt-regexp (concat "^" inferior-ess-prompt)) - ; define with correct i-e-p-p - (setq comint-input-sender 'inferior-ess-input-sender) - (add-hook 'comint-output-filter-functions 'shell-strip-ctrl-m nil t) - (goto-char (point-max)) - (insert "options(interactive=T)") - (inferior-ess-send-input) - (setq mode-name "iESS(Sqpe)") - ;; (ess-eval-linewise inferior-S+4-editor-pager-command) - (if inferior-ess-language-start - (ess-eval-linewise inferior-ess-language-start)) - (if shome-nil-p (setenv "SHOME" nil)))) - - - -(defun S+4-mode (&optional proc-name) - "Major mode for editing S+4 source. See `ess-mode' for more help." - (interactive) - (setq ess-customize-alist S+4-customize-alist) - (ess-mode S+4-customize-alist proc-name) - (if ess-imenu-use-S (ess-imenu-S))) - -(defun S+4-transcript-mode () - "S-PLUS 4.x transcript mode." - (interactive) - (ess-transcript-mode S+4-customize-alist)) - - -(defun S+4-msdos (&optional proc-name) - "Call 'S-PLUS 4.x', the 'GUI Thing' from StatSci. Put S-Plus in an -independent MS-Window (Splus persists even if the '(ddeESS [S+4])' -window is killed in emacs). Do this by creating a comint process that -calls sh. Send a shell command in that sh buffer to call Splus. When -it completes set up a shell as a placeholder in the '(ddeESS [S+4])' -buffer. The S-Plus options are correctly set. In particular, the -S-Plus Commands window is opened if the Options/General -Settings/Startup menu says it should be. There is a 30 second delay -during startup in which the screen will not be refreshed. This delay -is here to allow slow disks to start the Splus program." - (interactive) - (save-excursion - (setq ess-customize-alist S+4-customize-alist) - (ess-write-to-dribble-buffer - (format "\n(S+4): ess-dialect=%s, buf=%s\n" ess-dialect - (current-buffer))) - (setq ess-customize-alist ; change inferior-ess-program - (append ess-customize-alist '((inferior-ess-program - . (getenv "COMSPEC"))))) - (setq ess-customize-alist ; change inferior-ess-primary-prompt - (append ess-customize-alist '((inferior-ess-primary-prompt . "^")))) - (setq ess-customize-alist ; change inferior-ess-start-args - (append ess-customize-alist '((inferior-ess-start-args . "")))) - (let ((s-proj (getenv "S_PROJ"))) - (if (fboundp 'w32-short-file-name) - (cd (w32-short-file-name (directory-file-name default-directory))) - (cd (directory-file-name default-directory))) - (setenv "S_PROJ" default-directory) - (inferior-ess) - (sleep-for 2) ; need to wait, else working too fast! The Splus - ; command in '(ddeESS [S+4])' should follow the "$" - ; prompt. If not, then increase the sleep-for time! - (setenv "S_PROJ" s-proj)) - (setq ess-customize-alist S+4-customize-alist) - (ess-setq-vars-local ess-customize-alist) -;;; the next three lines belong in customize-alist, but can't be there -;;; because of the broken ess-setq-vars-default usage in ess-inf.el - (setq inferior-ess-ddeclient "ddeclient") - (setq inferior-ess-client-name "S-PLUS") - (setq inferior-ess-client-command "SCommand") -;;; end of what belongs in customize-alist - (setq comint-input-sender 'comint-simple-send) - (setq comint-process-echoes nil) - (set-process-coding-system (get-process ess-local-process-name) 'raw-text-dos 'raw-text-dos) - (goto-char (point-max)) - (insert (concat inferior-S+4-program " " - inferior-ess-start-args)) ; Note: there is no final "&". - ; Without the "&", the results of !system.command come to '(ddeESS [S+4])' - ; With the "&", the results of !system.command in S get lost. - (inferior-ess-send-input) - (sleep-for 30) ; Need to wait, else working too fast! - ; If the ess-current-process-name doesn't appear in the - ; Splus Commands window increase the sleep-for time! -;;; from msdos-minor-mode - (setq comint-process-echoes t) - (add-hook 'comint-output-filter-functions 'shell-strip-ctrl-m nil t) -;;; end from msdos-minor-mode - (setq ess-local-process-name ess-current-process-name) - (ess-eval-linewise (concat "#" ess-current-process-name)) - (goto-char (point-min)) - (insert - "This is a placeholder buffer. You can't type anything here. -Use 'C-x b RET' to return to your file.\n -Anything sent to this process from an S-mode buffer goes -directly to the associated Splus Commands window.\n -The S-Plus Commands window must be visible. -You may need to open the S-Plus Commands window manually - (by clicking on Splus/Window/Commands Window).\n There is a 30 -second delay when this program starts during which the emacs -screen will be partially blank.\n Remember to `q()' from S-Plus -and then C-x C-q exit from the `'(ddeESS [S+4])'' buffer, or take -the risk of not being able to shut down your computer and -suffering through scandisk.\n Any results of the !system.command -typed at the S prompt in the Splus Commands window (are supposed -to) appear in this buffer.\n\n") - (goto-char (point-max)) ; comint-mode-map makes '(ddeESS [S+4])' - (use-local-map comint-mode-map) ; a shell buffer after Splus is finished. - (setq buffer-read-only t) ; force buffer to be read-only - (setq mode-name "ddeESS") - ;; (ess-eval-linewise inferior-S+4-editor-pager-command) - (if inferior-ess-language-start - (ess-eval-linewise inferior-ess-language-start)) - )) - -(defun S+4-msdos-existing (&optional proc-name) - "Call 'S-PLUS 4.x', the 'GUI Thing' from StatSci. Do so by finding -an existing S-Plus in an independent MS-Window (if there is one) and -set up a '(ddeESS [S+4])' buffer in emacs. If there is no existing -S-Plus, then a new one will be opened in the default directory, -usually something like c:/Program Files/spls45se/users/yourname. -If you have a HOME environment variable, it will open it there." - (interactive) - (let* ((inferior-S+4-multipleinstances "")) - (S+4-msdos proc-name)) - (with-current-buffer - (car (buffer-list)) ; get the ESS buffer just created - (setq buffer-read-only nil) ; permit writing in ESS buffer - (goto-char (point-max)) - (beginning-of-line) - (forward-line -1) - (insert - "This is S+4-msdos-existing. -Results of the !system.command typed at the S prompt in the -Splus Commands window blink a DOS window and you won't see them.\n\n") - (setq buffer-read-only t) ; restore ESS buffer to be read-only - )) - - ; Provide package - -(provide 'ess-sp4-d) - -;;; ess-sp4-d.el ends here diff -Nru ess-18.10.2/lisp/ess-sp5-d.el ess-18.10.2+git20220915.f45542e/lisp/ess-sp5-d.el --- ess-18.10.2/lisp/ess-sp5-d.el 2018-11-10 09:41:11.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/lisp/ess-sp5-d.el 1970-01-01 00:00:00.000000000 +0000 @@ -1,106 +0,0 @@ -;;; ess-sp5-d.el --- S-plus 5 customization - -;; Copyright (C) 1998 A.J. Rossini -;; Copyright (C) 1999--2004 A.J. Rossini, Richard M. Heiberger, Martin -;; Maechler, Kurt Hornik, Rodney Sparapani, and Stephen Eglen. - -;; Author: A.J. Rossini -;; Created: 9 Nov 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 -;; https://www.r-project.org/Licenses/ - -;;; Commentary: - -;; AJR copied S4 to be S+5. -;; DB contributed the changes from ess-sp3-d.el to -;; ess-s4-d.el. (removed the old ugly approach). -;; This file defines Sp5 customizations for ess-mode. Lots of thanks -;; to RMH and JMC for code and suggestions -;; Thanks to MM for making this sensible. - -;;; Code: - -(require 'ess-s-lang) -(require 'ess-trns) - -;; You now need to make sure you've defined if you are running 5.0 or 5.1. -;; Lots of things are broken between them, GRR... - -(defvar S+5-dialect-name "S+5" - "Name of 'dialect' for S-PLUS 5.");easily changeable in a user's .emacs - -(defvar S+5-customize-alist - (append - '((ess-local-customize-alist . 'S+5-customize-alist) - (ess-dialect . S+5-dialect-name) - (ess-object-name-db-file . "ess-sp5-namedb.el") - (inferior-ess-program . inferior-S+5-program) - ;;(inferior-ess-objects-pattern . ".*") ; for new s4 stuff - (inferior-ess-help-command . "help(\"%s\", pager=\"slynx -dump\", window=FALSE)\n") - (inferior-ess-help-filetype . nil) - (inferior-ess-search-list-command . "searchPaths()\n") - (inferior-ess-start-args . inferior-S+-start-args) - (ess-STERM . "iESS") - ) - S+common-cust-alist) - - "Variables to customize for S+5.") - - -;; For loading up the S code required for the above. -;;(add-hook 'ess-post-run-hook -;; (lambda () -;; (ess-command -;; (concat -;; "if(exists(\"Sversion\")) library(emacs) else source(\"" -;; ess-mode-run-file -;; "\")\n")) -;; (if ess-mode-run-file2 -;; (ess-command -;; (concat "source(\"" ess-mode-run-file2 "\")\n"))))) - - -(defun S+5 (&optional proc-name) - "Call 'Splus5', based on S version 4, from Bell Labs. -New way to do it." - (interactive) - (setq ess-customize-alist S+5-customize-alist) - (ess-write-to-dribble-buffer - (format "\n(S+5): ess-dialect=%s, buf=%s\n" ess-dialect (current-buffer))) - (inferior-ess) - (if inferior-ess-language-start - (ess-eval-linewise inferior-ess-language-start))) - -(defun S+5-mode (&optional proc-name) - "Major mode for editing S+5 source. See `ess-mode' for more help." - (interactive) - (setq ess-customize-alist S+5-customize-alist) - (ess-mode S+5-customize-alist proc-name) - (if ess-imenu-use-S (ess-imenu-S))) - -(defun S+5-transcript-mode () - "S-PLUS 5 transcript mode." - (interactive) - (ess-transcript-mode S+5-customize-alist)) - - ; Provide package - -(provide 'ess-sp5-d) - -;;; ess-sp5-d.el ends here diff -Nru ess-18.10.2/lisp/ess-sp6-d.el ess-18.10.2+git20220915.f45542e/lisp/ess-sp6-d.el --- ess-18.10.2/lisp/ess-sp6-d.el 2018-11-10 09:41:11.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/lisp/ess-sp6-d.el 2022-10-15 08:06:36.000000000 +0000 @@ -1,28 +1,27 @@ ;;; ess-sp6-d.el --- S-Plus 6 & 7 & 8 customization -;; Copyright (C) 2001--2005 A.J. Rossini, Richard M. Heiberger, Martin -;; Maechler, Kurt Hornik, Rodney Sparapani, and Stephen Eglen. - +;; Copyright (C) 2001-2020 Free Software Foundation, Inc. ;; Author: A.J. Rossini ;; Created: 2001/02/06 ;; Maintainer: ESS Core Team -;; Keywords: languages - -;; This file is part of ESS. +;; This file is part of GNU Emacs. -;; This file is free software; you can redistribute it and/or modify +;;; License: +;; +;; This program is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 2, or (at your option) -;; any later version. - -;; This file is distributed in the hope that it will be useful, +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. +;; +;; This program is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. - -;; A copy of the GNU General Public License is available at -;; https://www.r-project.org/Licenses/ +;; +;; You should have received a copy of the GNU General Public License +;; along with this program. If not, see +;; ;;; Commentary: @@ -39,7 +38,6 @@ (require 'ess-mode) (require 'ess-inf) (require 'ess-s-lang) -(require 'ess-dde) (require 'ess-trns) @@ -69,30 +67,17 @@ (defvaralias 'S+6-customize-alist 'S+-customize-alist) (defvar S+-customize-alist (append - '((ess-local-customize-alist . 'S+-customize-alist) + '((ess-local-customize-alist . S+-customize-alist) (ess-dialect . S+-dialect-name) (ess-function-pattern . ess-r-function-pattern) (ess-object-name-db-file . "ess-sp6-namedb.el") (inferior-ess-program . inferior-S+-program) (inferior-ess-help-command . "help(\"%s\", pager=\"slynx -dump\", window=FALSE)\n") - (inferior-ess-help-filetype . nil) (inferior-ess-search-list-command . "searchPaths()\n") - (ess-send-region-function . #'ess-dde-send-region) - (ess-load-file-function . #'ess-dde-load-file) - (ess-command-function . #'ess-dde-command) - (ess-eval-linewise-function . #'ess-dde-eval-linewise) - (ess-dump-object-function . #'ess-dde-dump-object) - (ess-read-object-name-function . #'ess-dde-read-object-name) - (ess-find-help-file-function . #'ess-dde-find-help-file) - (ess-display-help-on-object-function . #'ess-dde-display-help-on-object) - - (ess-directory-function . S+-directory-function) - (ess-setup-directory-function . S+-setup-directory-function) - (inferior-ess-start-args . inferior-S+-start-args) - (ess-STERM . "iESS") - ) + (ess-startup-directory-function . S+-directory-function) + (ess-STERM . "iESS")) S+common-cust-alist) "Variables to customize for S+.") @@ -124,15 +109,15 @@ "Call 'Splus6', based on S version 4, from Bell Labs. New way to do it." (interactive) - (setq ess-customize-alist S+-customize-alist) (ess-write-to-dribble-buffer (format "\n(S+): ess-dialect=%s, buf=%s\n" ess-dialect (current-buffer))) - (inferior-ess) - (ess-command ess-S+--injected-code) - (if inferior-ess-language-start + (let ((inf-buf (inferior-ess nil S+-customize-alist))) + (ess-command ess-S+--injected-code) + (when inferior-ess-language-start (ess-eval-linewise inferior-ess-language-start)) - (with-ess-process-buffer nil - (run-mode-hooks 'ess-S+-post-run-hook))) + (with-current-buffer inf-buf + (run-mode-hooks 'ess-S+-post-run-hook)) + inf-buf)) (defalias 'S+6-mode 'S+-mode) @@ -140,16 +125,17 @@ (defun S+-mode (&optional proc-name) "Major mode for editing S+ source. See `ess-mode' for more help." (interactive) - (setq ess-customize-alist S+-customize-alist) - (ess-mode S+-customize-alist proc-name) + (setq-local ess-local-customize-alist S+-customize-alist) + (ess-mode) (if (fboundp 'ess-add-toolbar) (ess-add-toolbar)) - (if ess-imenu-use-S (ess-imenu-S))) + (setq imenu-generic-expression ess-imenu-S-generic-expression) + (when ess-imenu-use-S (imenu-add-to-menubar "Imenu-S"))) (defalias 'S+6-transcript-mode 'S+-transcript-mode) -(defun S+-transcript-mode () +(define-derived-mode S+-transcript-mode ess-transcript-mode "ESS S Transcript" "S-PLUS 6 transcript mode." - (interactive) - (ess-transcript-mode S+-customize-alist)) + :syntax-table S-syntax-table + :group 'ess-S) (defvar ess-s-versions '("Splus") "List of partial strings for versions of S to access within ESS. @@ -161,7 +147,7 @@ version of S. If duplicate versions of the same program are found (which happens if the same path is listed on `exec-path' more than once), they are -ignored by calling `ess-uniq-list'. +ignored by calling `delete-dups'. Set this variable to nil to disable searching for other versions of S using this method. If you set this variable, you need to restart Emacs (and set this variable @@ -179,7 +165,7 @@ ESS initialization." (when ess-s-versions (let ((versions - (ess-uniq-list + (delete-dups (mapcar #'file-name-nondirectory (apply #'nconc (mapcar #'ess-find-exec-completions @@ -197,11 +183,7 @@ (easy-menu-add-item ess-mode-menu '("Start Process") (cons "Other" new-menu))))))) ;; Define the runners -(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-define-runners)) +(ess-s-define-runners) (define-obsolete-function-alias 'ess-s-versions-create 'ess-s-define-runners "ESS 18.10") diff -Nru ess-18.10.2/lisp/ess-sp6w-d.el ess-18.10.2+git20220915.f45542e/lisp/ess-sp6w-d.el --- ess-18.10.2/lisp/ess-sp6w-d.el 2018-11-10 09:41:11.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/lisp/ess-sp6w-d.el 1970-01-01 00:00:00.000000000 +0000 @@ -1,603 +0,0 @@ -;;; ess-sp6w-d.el --- S-PLUS 6.x for Windows customization - -;;; copied and edited from ess-s4-d.el - Richard M. Heiberger, April 2001 - -;; Copyright (C) 2001 Richard M. Heiberger -;; Copyright (C) 2002--2005 A.J. Rossini, Richard M. Heiberger, Martin -;; Maechler, Kurt Hornik, Rodney Sparapani, and Stephen Eglen. - -;; Author: Richard M. Heiberger -;; Created: April 2001 -;; 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 -;; https://www.r-project.org/Licenses/ - -;;; Commentary: - -;; This file defines all the S-PLUS 6.x for Windows customizations -;; for ess-mode with ddeclient. - -;;; Code: - -;;; Requires and Autoloads: - -(require 'ess-s-lang) -(require 'ess-trns) -(defvar ess-S+-startup-delay) -(defvar version-function-name) -;;NO: this is autoloaded from other places (require 'ess-dde) - -(defvaralias 'inferior-S+6-multipleinstances 'inferior-S+-multipleinstances) -(defvar inferior-S+-multipleinstances "/MULTIPLEINSTANCES" - "Default \"/MULTIPLEINSTANCES\" opens up a new instance of S+[678] in a -GUI window and connects it to the '(ddeESS [S+])' window. The -alternative nil uses an existing S+ GUI (if there is one) and -connects it to the '(ddeESS [S+])' window.") - -(defvaralias 'S+6-customize-alist 'S+-customize-alist) -(defvar S+-customize-alist - (append - '((ess-local-customize-alist . 'S+-customize-alist) - (ess-dialect . S+-dialect-name) - (ess-object-name-db-file . "ess-sp6-namedb.el" ) - (ess-display-help-on-object-function . #'ess-chm-display-help-on-object) - (inferior-ess-program . inferior-S+-program) - (inferior-ess-help-command . "help(\"%s\")\n") - (inferior-ess-help-filetype . "chm") - (inferior-ess-search-list-command . "searchPaths()\n") - (inferior-ess-start-file . nil) ;"~/.ess-S+") - (inferior-ess-start-args . (concat - inferior-S+-multipleinstances - " " - inferior-S+-start-args - " " - inferior-S+-print-command - " S_PROJ=" - (when (fboundp 'w32-short-file-name) - (w32-short-file-name - (directory-file-name - default-directory))))) - ;; (inferior-ess-ddeclient . "ddeclient") - ;; (inferior-ess-client-name . "S-PLUS") - ;; (inferior-ess-client-command . "SCommand") - (ess-STERM . "ddeESS") - ) - S+common-cust-alist) - "Variables to customize for S+") - -(defvaralias 'Sqpe+6-customize-alist 'Sqpe+-customize-alist) -(defvar Sqpe+-customize-alist - (append - '((ess-local-customize-alist . 'Sqpe+-customize-alist) - (ess-dialect . S+-dialect-name) - (ess-loop-timeout . 500000 );fixme: dialect specific custom.var - (ess-object-name-db-file . "ess-sp6-namedb.el" ) - (ess-display-help-on-object-function . #'ess-chm-display-help-on-object) - (inferior-ess-program . inferior-Sqpe+-program) - (inferior-ess-help-command . "help(\"%s\")\n") - (inferior-ess-help-filetype . "chm") - (inferior-ess-search-list-command . "searchPaths()\n") - (inferior-ess-start-file . nil) ;"~/.ess-S+") - (inferior-ess-start-args . (concat - ;; workaround for bug in S-Plus 6 for Windows: - "ALWAYS_PROMPT=X" - " " - inferior-Sqpe+-start-args ;; e.g. license manager - )) - (ess-STERM . "iESS") - ) - S+common-cust-alist) - "Variables to customize for Sqpe+.") - - - -;;; There are extra complications in S+6 and S+7 and S+8 (compared to S+3) -;;; because -;;; -;;; (1) The StatSci supplied Splus.exe doesn't work in an emacs -;;; buffer. It works as as a GUI window and we must send commands -;;; to it through ddeclient. Nonetheless, we need to give it a -;;; process name and be sure that that there is a valid running -;;; process in the '(ddeESS [S+])' buffer. Therefore we create an -;;; ESS process in the buffer as a placeholder and start a shell -;;; in the ESS buffer. From the shell we start Splus. Once Splus -;;; finishes initializing and kills the original shell, we start -;;; another shell. We have a buffer-local variable -;;; inferior-ess-ddeclient, initialized to nil. When there is a -;;; non-nil value of inferior-ess-ddeclient we send lines to -;;; inferior-ess-ddeclient rather than to the Splus process. -;;; (2) There is no Splus process running in the '(ddeESS [S+])' -;;; buffer. Therefore inferior-ess will never see a prompt, -;;; unless we first change it to the null prompt "^". Then once -;;; the process has started, we change it back. -;;; (3) When M-x S+ starts Splus by a shell command, then Splus is an -;;; independent process and will be survive if the '(ddeESS [S+])' -;;; buffer is killed (or emacs is quit). The '(ddeESS [S+])' is -;;; made read-only and a warning is placed in it saying that "You -;;; can't type anything here." Actually, if thestandalone Splus -;;; is killed and the '(ddeESS [S+])' is made writable (C-x C-q), -;;; then '(ddeESS [S+])' becomes a shell buffer. -;;; -(defalias 'S+6 'S+) -(defun S+ (&optional proc-name) - "Verify that `inferior-S+-program' points to S-Plus 6 or -S-Plus 7 or S-Plus 8. Start normally for S-Plus 6.1 and later. -Inform the user to start S-Plus 6.0 from the icon and then -connect to it with `S+-existing'. Give an error message if -`inferior-S+-program' doesn't point to S-Plus 6 or S-Plus 7 -or S-Plus 8." - (interactive) - (with-current-buffer (find-file-noselect - (concat (executable-find inferior-S+-program) - "/../../versions") t) - (setq buffer-read-only 1) - (forward-line) - (if (not (search-backward-regexp "splus\t[678].[0-9]" (point-min) t)) - (error "The emacs variable `inferior-S+-program' does -not point to S-Plus 6 or 7 or 8. Please add `splus[678]?/cmd' (expand the -`[678]?' to match your setup) to your `exec-path' or specify the complete -path to `Splus.exe' in the variable `inferior-S+-program' in your -`.emacs' file.") - (forward-line) - (if (search-backward "splus\t6.0" (point-min) t) - (error "S-Plus 6.0 for Microsoft Windows has a bug that -prevents it from being started by emacs. Instead, you must start it -by double-clicking an icon. Then you can connect to it with -`S+-existing'. You should consider upgrading to a newer -release of S-Plus.")))) - (S+-initiate proc-name)) ;; normal start ; - -(defalias 'S+6-initiate 'S+-initiate) -(defun S+-initiate (&optional proc-name) - "Call 'S-PLUS [678].x for Windows', the 'GUI Thing' from StatSci. Put -S-Plus in an independent MS-Window (Splus persists even if the -'(ddeESS [S+])' window is killed in emacs). Do this by creating a -comint process that calls sh. Send a shell command in that sh buffer -to call Splus. When it completes set up a shell as a placeholder in -the '(ddeESS [S+])' buffer. The S-Plus options are correctly set. -In particular, the S-Plus Commands window is opened if the -Options/General Settings/Startup menu says it should be. There is a -startup delay of `ess-S+-startup-delay' seconds during which the -screen will not be refreshed. This delay is here to allow slow disks -to start the Splus program." - (interactive) - (save-excursion - (setq ess-customize-alist S+-customize-alist) - (ess-write-to-dribble-buffer - (format "\n(S+): ess-dialect=%s, buf=%s\n" ess-dialect - (current-buffer))) - (setq ess-customize-alist ; change inferior-ess-program - (append ess-customize-alist '((inferior-ess-program . "sh")))) - (setq ess-customize-alist ; change inferior-ess-primary-prompt - (append ess-customize-alist '((inferior-ess-primary-prompt . "^")))) - (setq ess-customize-alist ; change inferior-ess-start-args - (append ess-customize-alist '((inferior-ess-start-args . "-i")))) - (let ((s-proj (getenv "S_PROJ")) - (use-dialog-box (not (or ess-microsoft-p (eq system-type 'cygwin)))) - ) - (cd (when (fboundp 'w32-short-file-name) - (w32-short-file-name (directory-file-name default-directory)))) - (setenv "S_PROJ" (when - (fboundp 'w32-short-file-name) - (w32-short-file-name default-directory))) - (inferior-ess) - (sleep-for 2) ; need to wait, else working too fast! The Splus - ; command in '(ddeESS [S+])' should follow the "$" - ; prompt. If not, then increase the sleep-for time! - (setenv "S_PROJ" s-proj)) - (setq ess-customize-alist S+-customize-alist) - (ess-setq-vars-local ess-customize-alist) -;;; the next three lines belong in customize-alist, but can't be there -;;; because of the broken ess-setq-vars-default usage in ess-inf.el - (setq inferior-ess-ddeclient "ddeclient") - (setq inferior-ess-client-name "S-PLUS") - (setq inferior-ess-client-command "SCommand") -;;; end of what belongs in customize-alist - (setq comint-process-echoes nil) - (setq comint-input-sender 'comint-simple-send) - (goto-char (point-max)) - (insert (concat inferior-S+-program " " - inferior-ess-start-args)) ; Note: there is no final "&". - ;; Without the "&", the results of !system.command come to '(ddeESS [S+])' - ;; With the "&", the results of !system.command in S get lost. - (inferior-ess-send-input) - (sleep-for ess-S+-startup-delay) ; Need to wait, else working too fast! - ; If the ess-current-process-name doesn't appear in the - ; Splus Commands window increase the sleep-for time! - (setq ess-local-process-name ess-current-process-name) - (ess-eval-linewise (concat "#" ess-current-process-name)) - (goto-char (point-min)) - (insert - "This is a placeholder buffer. You can't type anything here. -Use `C-x b RET' to return to your file.\n -Anything sent to this process from an S-mode buffer goes -directly to the associated Splus Commands window.\n -The S-Plus Commands window must be visible. -You may need to open the S-Plus Commands window manually (by clicking on -Splus/Window/Commands Window).\n -Any results of the !system.command typed at the S prompt in the -Splus Commands window appear in this buffer.\n\n") - (goto-char (point-max)) ; comint-mode-map makes '(ddeESS [S+])' - ;; (use-local-map comint-mode-map) ;a shell buffer after Splus is finished. - (set-process-coding-system (get-buffer-process (current-buffer)) - 'raw-text-dos 'raw-text-unix) - (setq buffer-read-only t) ; force buffer to be read-only - (setq mode-name "ddeESS") - ;; (ess-eval-linewise inferior-S+-editor-pager-command) - (if inferior-ess-language-start - (ess-eval-linewise inferior-ess-language-start)) - )) - - -(defalias 'S+6-existing 'S+-existing) -(defun S+-existing (&optional proc-name) - "Call 'S-PLUS [678].x for Windows', the 'GUI Thing' from StatSci. Do so by -finding an existing S-Plus in an independent MS-Window (if there is one) and -set up a '(ddeESS [S+])' buffer in emacs. If there is no existing -S-Plus, then a new one will be opened in the default directory. The default -is usually something like 'c:/Program Files/Insightful/splus70/users/yourname' -for S-Plus before 8.0.4. Beginning with 8.0.4, S-Plus uses the default directory -'c:/Documents and Settings/yourname/My Documents/S-PLUS Projects/Project1'. -Beginning with TIBCO Spotfire S+ Version 8.1.1 for Microsft Windows, the default -directory is 'c:/DOCUME~1/yourname/MYDOCU~1/SPOTFI~1/Project1'. -If you have a HOME environment variable, it will open it there." - (interactive) - (let* ((inferior-S+-multipleinstances " & # ") ; Note: there is a final "&". - (ess-S+-startup-delay 0)) ;; No delay for existing S-Plus - ;; Without the "&", there is a core dump. - ;; With the "&", the results of !system.command in S get lost. - ;; We are picking up an existing S-Plus process for sending to. - ;; It doesn't know about us, so nothing comes back. - (S+-initiate proc-name)) - (with-current-buffer (car (buffer-list)) ; get the ESS buffer just created - (setq buffer-read-only nil) ; permit writing in ESS buffer - (goto-char (point-max)) - (beginning-of-line) - (forward-line -1) - (insert - "This is S+-existing. -Results of the !system.command typed at the S prompt in the -Splus Commands window blink a DOS window and you won't see them.\n\n") - (setq buffer-read-only t) ; restore ESS buffer to be read-only - )) - - -;;; There are extra complications in Sqpe+6 (compared to S+3) because -;;; (1) The StatSci supplied Sqpe.exe won't work without SHOME as an -;;; environment variable and Sqpe does not take command line -;;; arguments and -;;; (2) Sqpe.exe comes up with options(interactive=FALSE), which means it -;;; doesn't provide prompts by default, and we must change it to T so -;;; it will provide prompts. -;;; -(defalias 'Sqpe+6 'Sqpe+) -(defun Sqpe+ (&optional proc-name) - "Call 'Sqpe' from 'S-PLUS [678].x for Windows', the 'Real Thing' from StatSci." - (interactive) - (setq ess-customize-alist Sqpe+-customize-alist) - (let* ((shome-nil-p (equal (getenv "SHOME") nil)) - (use-dialog-box (not (or ess-microsoft-p (eq system-type 'cygwin)))) - ) - (if shome-nil-p (setenv "SHOME" inferior-Sqpe+-SHOME-name)) - (ess-write-to-dribble-buffer - (format "\n(Sqpe+6): ess-dialect=%s, buf=%s\n" ess-dialect - (current-buffer))) - (setq ess-customize-alist ; change inferior-ess-primary-prompt - (append ess-customize-alist '((inferior-ess-primary-prompt . "^")))) - (inferior-ess) - (setq ess-customize-alist Sqpe+-customize-alist) ; restore i-e-p-p in alist - (ess-setq-vars-local ess-customize-alist) ; restore i-e-p-p in buffer - (setq inferior-ess-prompt ; define with correct i-e-p-p - ;; Do not anchor to bol with `^' ; (copied from ess-inf.el) - (concat "\\(" - inferior-ess-primary-prompt - "\\|" - inferior-ess-secondary-prompt - "\\)")) - (setq comint-prompt-regexp (concat "^" inferior-ess-prompt)) - ; define with correct i-e-p-p - (setq comint-input-sender 'inferior-ess-input-sender) - (add-hook 'comint-output-filter-functions 'shell-strip-ctrl-m nil t) - (goto-char (point-max)) - (insert "options(interactive=TRUE)") - (inferior-ess-send-input) - (setq mode-name "iESS(Sqpe)") - ;; (ess-eval-linewise inferior-S+-editor-pager-command) - (if inferior-ess-language-start - (ess-eval-linewise inferior-ess-language-start)) - (if shome-nil-p (setenv "SHOME" nil)))) - -;;;###autoload -(add-to-list 'auto-mode-alist '("\\.sp\\'" . S-mode)) -;;;###autoload -(add-to-list 'auto-mode-alist '("\\.[qsS]\\'" . S-mode)) -;;;###autoload -(add-to-list 'auto-mode-alist '("\\.ssc\\'" . S-mode)) -;;;###autoload -(add-to-list 'auto-mode-alist '("\\.SSC\\'" . S-mode)) - -(defalias 'S+6-mode 'S+-mode) -(defun S+-mode (&optional proc-name) - "Major mode for editing S+[678] source. See `ess-mode' for more help." - (interactive) - (setq ess-customize-alist S+-customize-alist) - (ess-mode S+-customize-alist proc-name) - (if ess-imenu-use-S (ess-imenu-S))) - -(defalias 'S+6-transcript-mode 'S+-transcript-mode) -(defun S+-transcript-mode () - "S-PLUS transcript mode." - (interactive) - (ess-transcript-mode S+-customize-alist)) - -(defun S+-msdos (&optional proc-name) - "Verify that `inferior-S+-program' points to S-Plus 6 or -S-Plus 7 or S-Plus 8. Start normally for S-Plus 6.1 and later. -Inform the user to start S-Plus 6.0 from the icon and then -connect to it with `S+-msdos-existing'. Give an error message -if `inferior-S+-program' doesn't point to S-Plus 6 or -S-Plus 7 or S-Plus 8." - (interactive) - (with-current-buffer (find-file-noselect - (concat (executable-find inferior-S+-program) - "/../../versions") t) - (setq buffer-read-only 1) - (forward-line) - (if (not (search-backward-regexp "splus\t[678].[0-9]" (point-min) t)) - (error "The emacs variable `inferior-S+-program' does - not point to S-Plus 6 or 7 or 8. Please add `splus[678]?/cmd' - (expand the `[678]?' to match your setup) to your `exec-path' or - specify the complete path to `Splus.exe' in the variable -`inferior-S+-program' in your `.emacs' file.") ;;; " This comment keeps emacs font-lock from getting out of phase. - - (progn - (forward-line) - (if (search-backward "splus\t6.0" (point-min) t) - (error "S-Plus 6.0 for Microsoft Windows has a bug that -prevents it from being started by emacs. Instead, you must start it -by double-clicking an icon. Then you can connect to it with -`S+-msdos-existing'. You should consider upgrading to a newer -release of S-Plus.") - (S+-msdos-initiate proc-name))) ;; normal start ; - ))) - -(defalias 'S+6-msdos-initiate 'S+-msdos-initiate) -(defun S+-msdos-initiate (&optional proc-name) - "Call 'S-PLUS [678].x for Windows', the 'GUI Thing' from StatSci. Put -S-Plus in an independent MS-Window (Splus persists even if the -'(ddeESS [S+])' window is killed in emacs). Do this by creating a -comint process that calls sh. Send a shell command in that sh buffer -to call Splus. When it completes set up a shell as a placeholder in -the '(ddeESS [S+])' buffer. The S-Plus options are correctly set. -In particular, the S-Plus Commands window is opened if the -Options/General Settings/Startup menu says it should be. There is a -startup delay of `ess-S+-startup-delay' seconds during which the -screen will not be refreshed. This delay is here to allow slow disks -to start the Splus program." - (interactive) - (save-excursion - (setq ess-customize-alist S+-customize-alist) - (ess-write-to-dribble-buffer - (format "\n(S+): ess-dialect=%s, buf=%s\n" ess-dialect - (current-buffer))) - (setq ess-customize-alist ; change inferior-ess-program - (append ess-customize-alist '((inferior-ess-program - . (getenv "COMSPEC"))))) - (setq ess-customize-alist ; change inferior-ess-primary-prompt - (append ess-customize-alist '((inferior-ess-primary-prompt . "^")))) - (setq ess-customize-alist ; change inferior-ess-start-args - (append ess-customize-alist '((inferior-ess-start-args . "")))) - (let ((s-proj (getenv "S_PROJ")) - (use-dialog-box (not (or ess-microsoft-p (eq system-type 'cygwin)))) - ) - (cd (when (fboundp 'w32-short-file-name) - (w32-short-file-name (directory-file-name default-directory)))) - (setenv "S_PROJ" (when - (fboundp 'w32-short-file-name) - (w32-short-file-name default-directory))) - (inferior-ess) - (sleep-for 2) ; need to wait, else working too fast! The Splus - ; command in '(ddeESS [S+])' should follow the "$" - ; prompt. If not, then increase the sleep-for time! - (setenv "S_PROJ" s-proj)) - (setq ess-customize-alist S+-customize-alist) - (ess-setq-vars-local ess-customize-alist) -;;; the next three lines belong in customize-alist, but can't be there -;;; because of the broken ess-setq-vars-default usage in ess-inf.el - (setq inferior-ess-ddeclient "ddeclient") - (setq inferior-ess-client-name "S-PLUS") - (setq inferior-ess-client-command "SCommand") -;;; end of what belongs in customize-alist - (setq comint-input-sender 'comint-simple-send) - (setq comint-process-echoes nil) - (set-process-coding-system (get-buffer-process (current-buffer)) - 'raw-text-dos 'raw-text-dos) - (goto-char (point-max)) - (insert (concat inferior-S+-program " " - inferior-ess-start-args)) ; Note: there is no final "&". - ;; Without the "&", the results of !system.command come to '(ddeESS [S+])' - ;; With the "&", the results of !system.command in S get lost. - (inferior-ess-send-input) - (sleep-for ess-S+-startup-delay) ; Need to wait, else working too fast! - ; If the ess-current-process-name doesn't appear in the - ; Splus Commands window increase the sleep-for time! -;;; from msdos-minor-mode - (setq comint-process-echoes t) - (add-hook 'comint-output-filter-functions 'shell-strip-ctrl-m nil t) -;;; end from msdos-minor-mode - (setq ess-local-process-name ess-current-process-name) - (ess-eval-linewise (concat "#" ess-current-process-name)) - (goto-char (point-min)) - (insert - "This is a placeholder buffer. You can't type anything here. -Use `C-x b RET' to return to your file.\n -Anything sent to this process from an S-mode buffer goes -directly to the associated Splus Commands window.\n -The S-Plus Commands window must be visible. -You may need to open the S-Plus Commands window manually - (by clicking on Splus/Window/Commands Window).\n -There is a `ess-S+-startup-delay' second delay when this program starts -during which the emacs screen will be partially blank.\n -Remember to 'q()' from S-Plus and -then C-x C-q exit from the '(ddeESS [S+])' buffer, -or take the risk of not being able to shut down your computer -and suffering through scandisk.\n -Any results of the !system.command typed at the S prompt in the -Splus Commands window (are supposed to) appear in this buffer.\n\n") - (goto-char (point-max)) ; comint-mode-map makes '(ddeESS [S+])' - (use-local-map comint-mode-map) ; a shell buffer after Splus is finished. - (setq buffer-read-only t) ; force buffer to be read-only - (setq mode-name "ddeESS") - ;; (ess-eval-linewise inferior-S+-editor-pager-command) - (if inferior-ess-language-start - (ess-eval-linewise inferior-ess-language-start)) - )) - -(defalias 'S+6-msdos-existing 'S+-msdos-existing) -(defun S+-msdos-existing (&optional proc-name) - "Call 'S-PLUS [678].x for Windows', the 'GUI Thing' from StatSci. Do so by -finding an existing S-Plus in an independent MS-Window (if there is one) and -set up a '(ddeESS [S+])' buffer in emacs. If there is no existing -S-Plus, then a new one will be opened in the default directory. The default -is usually something like 'c:/Program Files/Insightful/splus70/users/yourname' -for S-Plus before 8.0.4. Beginning with 8.0.4, S-Plus uses the default directory -'c:/Documents and Settings/yourname/My Documents/S-PLUS Projects/Project1'. -Beginning with TIBCO Spotfire S+ Version 8.1.1 for Microsft Windows, the default -directory is 'c:/DOCUME~1/yourname/MYDOCU~1/SPOTFI~1/Project1'. -If you have a HOME environment variable, it will open it there." - (interactive) - (let* ((inferior-S+-multipleinstances "") - (ess-S+-startup-delay 0)) ;; No delay for existing S-Plus - (S+-msdos-initiate proc-name)) - (with-current-buffer (car (buffer-list)) ; get the ESS buffer just created - (setq buffer-read-only nil) ; permit writing in ESS buffer - (goto-char (point-max)) - (beginning-of-line) - (forward-line -1) - (insert - "This is S+-msdos-existing. -Results of the !system.command typed at the S prompt in the -Splus Commands window blink a DOS window and you won't see them.\n\n") - (setq buffer-read-only t) ; restore ESS buffer to be read-only - )) - -(defun ess-sqpe-versions-create (ess-SHOME-versions &optional x64) - "Generate the `M-x splusxy' functions for starting other versions of -Sqpe. `ESS-SHOME-VERSIONS' is normally taken from -`ess-sqpe-versions', a variable that contains strings that determine which -functions are created. This works by creating a temp buffer where the -template function `Sqpe+template' is edited by replacing the string -'Sqpe+template' by the version name. The list of functions actually -created appears in the `ess-dribble-buffer'. If `X64' is not nil, then -modify the function name to show \"-64bit\" in its name. - -The result `ess-sqpe-versions-created' will store a list of the new -Sqpe defuns, if any, that were created. The defuns will normally be -placed on the menubar upon ESS initialisation." - (let ((beg) - (versions) - (version) - (eval-buf (get-buffer-create "*ess-temp-sqpe-evals*")) - (ess-sqpe-versions-created) - ) - ;; - (with-current-buffer eval-buf - ;; clear the buffer. - (delete-region (point-min) (point-max)) - - ;; Find which versions of Sqpe we want. - (setq x64 (if x64 "-64bit")) - (setq versions (ess-uniq-list ess-SHOME-versions)) - ;; Iterate over each string in VERSIONS, creating a new defun each time. - (while versions - (setq version (car versions) - versions (cdr versions)) - (if (file-executable-p version) - (progn - (setq beg (point)) - (setq version-function-name (concat (file-name-nondirectory version) x64)) - (prin1 (symbol-function 'Sqpe+template) eval-buf) - (insert "\n\n") - (goto-char beg) - (while (search-forward "lambda" nil t 1) - (replace-match - (concat "defun " version-function-name) - t t)) - (while (search-forward "ess-SHOME" nil t) - (replace-match version t t)) - (goto-char (point-max)) - (setq ess-sqpe-versions-created - (cons version-function-name - ess-sqpe-versions-created)) - (ess-write-to-dribble-buffer - (format - "(Sqpe): ess-sqpe-versions-create making M-x defun %s for %s \n" - version-function-name version)) - ))) - ;; buffer has now been created with defuns, so eval them! - (eval-buffer) - (kill-buffer eval-buf)) - ess-sqpe-versions-created)) - -;; template function used by ess-sqpe-versions-create -(defun Sqpe+template (&optional proc-name) - "Call 'Sqpe' from 'S-PLUS for Windows ess-SHOME', -the 'Real Thing' from StatSci. -This function was generated by `ess-sqpe-versions-create'." - (interactive) - (setq ess-customize-alist Sqpe+-customize-alist) - (let* ((use-dialog-box) ;; MS dialog box won't return a directory - (shome-old (getenv "SHOME")) - (inferior-Sqpe+-SHOME-name "ess-SHOME") - (inferior-Sqpe+-program (concat "ess-SHOME" "/cmd/sqpe.exe"))) - (setenv "SHOME" "ess-SHOME") - (ess-write-to-dribble-buffer - (format "\n(Sqpe+template): ess-dialect=%s, buf=%s\n" ess-dialect - (current-buffer))) - (setq ess-customize-alist ; change inferior-ess-primary-prompt - (append ess-customize-alist - '((inferior-ess-primary-prompt . "^")))) - (inferior-ess) - (setq ess-customize-alist Sqpe+-customize-alist) ; restore i-e-p-p in alist - (ess-setq-vars-local ess-customize-alist) ; restore i-e-p-p in buffer - (setq inferior-ess-prompt ; define with correct i-e-p-p - ;; Do not anchor to bol with `^' ; (copied from ess-inf.el) - (concat "\\(" - inferior-ess-primary-prompt - "\\|" - inferior-ess-secondary-prompt - "\\)")) - (setq comint-prompt-regexp (concat "^" inferior-ess-prompt)) - ; define with correct i-e-p-p - (setq comint-input-sender 'inferior-ess-input-sender) - (add-hook 'comint-output-filter-functions 'shell-strip-ctrl-m nil t) - (goto-char (point-max)) - (insert "options(interactive=TRUE)") - (inferior-ess-send-input) - (setq mode-name "iESS(Sqpe)") - ;; (ess-eval-linewise inferior-S+-editor-pager-command) - (if inferior-ess-language-start - (ess-eval-linewise inferior-ess-language-start)) - (setenv "SHOME" shome-old))) - - - ; Provide package - -(provide 'ess-sp6w-d) - -;;; ess-sp6w-d.el ends here diff -Nru ess-18.10.2/lisp/ess-stata-lang.el ess-18.10.2+git20220915.f45542e/lisp/ess-stata-lang.el --- ess-18.10.2/lisp/ess-stata-lang.el 2018-11-10 09:41:11.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/lisp/ess-stata-lang.el 1970-01-01 00:00:00.000000000 +0000 @@ -1,1282 +0,0 @@ -;;; 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 -;; https://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 -(unless (boundp 'c-emacs-features) - (require 'cc-vars));; for syntax-table -(require 'comint) -(require 'ess-trns) - - ;(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) - -;;; ess-stata-lang.el ends here diff -Nru ess-18.10.2/lisp/ess-stata-mode.el ess-18.10.2+git20220915.f45542e/lisp/ess-stata-mode.el --- ess-18.10.2/lisp/ess-stata-mode.el 2018-11-10 09:41:11.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/lisp/ess-stata-mode.el 1970-01-01 00:00:00.000000000 +0000 @@ -1,174 +0,0 @@ -;;; 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 -;; https://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: - -(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 . "https://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-program . inferior-STA-program) - (inferior-ess-objects-command . "describe\n") - (inferior-ess-help-command . "help %s\n") ;; assumes set more off - (inferior-ess-exit-command . "exit\n") - ;; --more-- is necessary here (hangs otherwise if startup stata.msg is big) - (inferior-ess-primary-prompt . "[.:] \\|--more--") - (inferior-ess-secondary-prompt . "--more--") - (comint-use-prompt-regexp . t) - (inferior-ess-start-file . inferior-STA-start-file) ;"~/.ess-stata") - (inferior-ess-start-args . inferior-STA-start-args) - (ess-get-help-topics-function . 'ess-get-STA-help-topics) - (inferior-ess-search-list-command . "set more off\n search()\n") - (comment-start . "/\* ") - (comment-end . " \*/") - (comment-start-skip . "/\\*+ *") - (comment-use-syntax . t) ;; needed for multiline - (ess-execute-screen-options-command . "set linesize %s\n") - (ess-getwd-command . "pwd\n") - (ess-setwd-command . "cd \"%s\"\n") - (ess-load-command . "run \"%s\"\n")) - "Variables to customize for Stata.") - - -;;;###autoload -(defun STA-mode (&optional proc-name) - "Major mode for editing Stata source. See `ess-mode' for more help." - (interactive) - (setq ess-customize-alist STA-customize-alist) - (ess-mode STA-customize-alist proc-name)) - -(fset 'stata-mode 'STA-mode) -(fset 'Stata-mode 'STA-mode) - -;;;###autoload -(add-to-list 'auto-mode-alist '("\\.do\\'" . STA-mode)) -;;;###autoload -(add-to-list 'auto-mode-alist '("\\.ado\\'" . STA-mode)) - - -(defun ess-sta-remove-comments (string) - "Remove one-line comments before sending the STRING to process. - -This function is placed in `ess-presend-filter-functions'. -" - (replace-regexp-in-string "/\\*.*\\*/\\|^//.*$" "" string)) - -;; (ess-sta-remove-comments "aaa /* sdfdsf */ bbb -;; sdfsd -;; ccc -;; // sdfsf -;; sdf /* sdfdsf */ -;; sdfsf -;; " ) - - -(defvar ess-stata-post-run-hook nil - "Functions run in process buffer after the initialization of - stata process.") - -(defun stata (&optional start-args) - "Call Stata." - (interactive "P") - (setq ess-customize-alist STA-customize-alist) - (ess-write-to-dribble-buffer - (format "(STA): ess-dialect=%s , buf=%s \n" - ess-dialect - (current-buffer))) - (let ((sta-start-args - (concat inferior-STA-start-args - (when start-args (read-string "Starting Args [possibly -k####] ? "))))) - (inferior-ess sta-start-args) - (let ((proc (get-process ess-local-process-name))) - (while (process-get proc 'sec-prompt) - ;; get read of all --more-- if stata.msg is too long. - (ess-send-string proc "q") - (ess-wait-for-process proc t)) - (ess-send-string proc "set more off") - (goto-char (point-max)) - (with-current-buffer (process-buffer proc) - (add-hook 'ess-presend-filter-functions 'ess-sta-remove-comments nil 'local) - (run-mode-hooks 'ess-stata-post-run-hook))))) - - -(defun STA-transcript-mode () - "Stata transcript mode." - (interactive) - (ess-transcript-mode STA-customize-alist)) - -(defun ess--STA-retrive-topics-from-search () - (with-current-buffer (ess-command inferior-ess-search-list-command) - (goto-char (point-min)) - (let (topics) - (while (re-search-forward "(help \\(.+?\\)\\( if installed\\| for replacement.*\\)?)$" nil t) - (setq topics - (nconc (split-string (match-string-no-properties 1) ",\\|; +") - topics))) - (nreverse (delete-dups topics)) - ))) - -(defun ess-get-STA-help-topics (&optional name) - "Return a list of current STA help topics associated with process NAME." - (or (ess-process-get 'help-topics) - (progn - (ess-process-put 'help-topics (ess--STA-retrive-topics-from-search)) - (ess-process-get 'help-topics)))) - -(defun stata-eval-linewise (text &optional invisibly &rest args) - ;; The following is required to make sure things work! - (let ((ess-eval-linewise-function nil) - ;; RAS: mindless replacement of semi-colons - (text (if ess-sta-delimiter-friendly - (ess-replace-in-string text ";" "\n") - text))) - (apply #'ess-eval-linewise text t args))) - - ; Provide package - -(provide 'ess-stata-mode) - -;;; ess-stata-mode.el ends here diff -Nru ess-18.10.2/lisp/ess-swv.el ess-18.10.2+git20220915.f45542e/lisp/ess-swv.el --- ess-18.10.2/lisp/ess-swv.el 2018-11-10 09:41:11.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/lisp/ess-swv.el 1970-01-01 00:00:00.000000000 +0000 @@ -1,425 +0,0 @@ -;;; ess-swv.el --- Some simple functions for ESS and Sweave - -;; Copyright (C) 2005 David Whiting, A.J. Rossini, Richard M. Heiberger, Martin -;; Maechler, Kurt Hornik, Rodney Sparapani, and Stephen Eglen. -;; Copyright (C) 2006-2008 A.J. Rossini, Richard M. Heiberger, Martin Maechler, -;; Kurt Hornik, Rodney Sparapani, and Stephen Eglen. - -;; Author: David Whiting -;; Created: 15 April 2005 -;; Maintainer: ESS-core - -;; Keywords: statistics, tools - -;; This file is part of ESS. - -;; This file is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 2, or (at your option) -;; any later version. - -;; This file is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; A copy of the GNU General Public License is available at -;; https://www.r-project.org/Licenses/ - -;;; Commentary: - -;; -;; Some simple functions for ESS and Sweave -;; david.whiting at ncl.ac.uk -;; Wed Sep 1 14:55:52 CEST 2004 - -;; I have written some very simple elisp functions that I have found -;; useful and thought others might like to see. I dabble with elisp -;; occasionally at best so there are probably better ways to do what I -;; have done, but so far this seems to work for me. There are several -;; things that are hard-coded, I use Linux and I think that this would -;; probably not work in Windows (not as it is now anyway). - -;; With these functions and key bindings all I need to do is open a .Rnw -;; file and, assuming R is running, I press: - -;; M-n s to Sweave the file, then -;; M-n l to run latex on the results of Sweave, then -;; M-n p to make and display a postscript file , or -;; M-n P to make and display a PDF version. - -;; David Whiting to Anthony Rossini, Mar 30 -;; On Wed, Mar 30, 2005 at 11:51:26AM +0200, A.J. Rossini wrote: -;; > I'm going to go ahead and add this stuff to the distribution tonight -;; > if you don't mind. I'd forgotten about it! -;; It would make me very happy indeed. -;; > (however, need permission to do so). -;; Permission granted! - -;; Dave -;; -- -;; David Whiting -;; School of Clinical Medical Sciences, The Medical School -;; University of Newcastle upon Tyne, NE2 4HH, UK. - - -;;; TODO: -;;; -;;; 1. I want to be able to send ess-swv-latex a parameter to tell it -;;; the number of times to run LaTeX (to get references updated -;;; correctly). -;;; -;;; 2. Also need to add ess-swv-Bibtex. -;;; -;;; 3. Might be good to have a way to chain commands. -;;; -;;; 4. ADD to the ../doc/ess.texi !! - - -;;; Code: - -;;; Autoloads and Requires - -(eval-when-compile - (require 'ess-custom)) - -(require 'ess-utils) -(require 'ess-noweb-mode) -(require 'ess-r-mode); for Rnw-mode -(require 'easymenu) - -(defvar TeX-command-list) -(defvar TeX-command-default) -(defvar TeX-file-extensions) -(declare-function TeX-normal-mode "tex") - -(defcustom ess-swv-processing-command ".ess_weave(%s, %s)" - "Command used by `ess-swv-run-in-R'. - -First %s is literally replaced by the processing command (for -example: Sweave) second %s is replaced with a string containing a -processed file and possibly additional argument encoding (example: -\"path/to/foo.Rnw\", encoding='utf-8') - -.ess_weave changes the working directory to that of the supplied -file. - -If you want to simply call knitr or Sweave in global environment -set this command to \"%s(%s)\"." - :group 'ess-R - :type 'string) - -;; currently use exactly for "Sweave", "Stangle", "knit", and "purl" -(defun ess-swv-run-in-R (cmd &optional choose-process block) - "Run \\[cmd] on the current .Rnw file. Utility function not called by user." - (let* ((rnw-buf (current-buffer))) - (if choose-process ;; previous behavior - (ess-force-buffer-current "R process to load into: ") - ;; else - (update-ess-process-name-list) - (cond ((= 0 (length ess-process-name-list)) - (message "no ESS processes running; starting R") - (sit-for 1); so the user notices before the next msgs/prompt - (run-ess-r) - (set-buffer rnw-buf) - ) - ((not (string= "R" (ess-make-buffer-current))); e.g. Splus, need R - (ess-force-buffer-current "R process to load into: ")) - )) - - (save-excursion - ;; (ess-execute (format "require(tools)")) ;; Make sure tools is loaded. - (basic-save-buffer); do not Sweave/Stangle old version of file ! - (let* ((sprocess (ess-get-process ess-current-process-name)) - (sbuffer (process-buffer sprocess)) - (rnw-file (buffer-file-name)) - (Rnw-dir (file-name-directory rnw-file)) - (buf-coding (symbol-name buffer-file-coding-system)) - ;; could consider other encodings, but utf-8 is "R standard" for non-ASCII: - (cmd-args (concat "\"" rnw-file "\"" - (if (string-match "^utf-8" buf-coding) - ", encoding = \"utf-8\""))) - (Sw-cmd - (format ess-swv-processing-command cmd cmd-args))) - (message "%s()ing %S" cmd rnw-file) - ;; need to block when we are running ess-swv-weave-PDF so we - ;; know when to start compiling the generated .tex file - (if block - (progn - (ess-eval-linewise (concat Sw-cmd "\n") nil nil nil t) - (message "Finished %s()ing %S" cmd rnw-file)) - (ess-execute Sw-cmd 'buffer nil nil) - (switch-to-buffer rnw-buf) - (ess-show-buffer (buffer-name sbuffer) nil)))))) - -(defcustom ess-swv-processor 'sweave - "Processor to use for weaving and tangling. -Currently 'sweave or 'knitr" - :group 'ess-R - :type '(choice (const sweave) (const knitr))) - - -(defun ess-swv-tangle () - "Run Stangle/purl on the current .Rnw file. -Depending on the `ess-swv-processor' used." - (interactive) - (ess-swv-run-in-R (cond ((eq ess-swv-processor 'sweave) "Stangle") - ((eq ess-swv-processor 'knitr) "purl") - (t (error "Not a valid processor %s" ess-swv-processor))))) - -(defun ess-swv-weave (&optional choose) - "Run Sweave/knit on the current .Rnw file. -Depending on the `ess-swv-processor' used. - -If CHOOSE is non-nil, offer a menu of available weavers. -" - (interactive "P") - (let ((processor (if choose - (ess-completing-read "Weaver" '("sweave" "knitr") nil t) - (symbol-name ess-swv-processor)))) - (ess-swv-run-in-R (cond ((string= processor "sweave") "Sweave") - ((string= processor "knitr") "knit") - (t (error "Not a valid processor %s" processor)))))) - -(defun ess-swv-sweave () - "Run Sweave on the current .Rnw file." - (interactive) - (ess-swv-run-in-R "Sweave")) - -(defun ess-swv-stangle () - "Run Stangle on the current .Rnw file." - (interactive) - (ess-swv-run-in-R "Stangle")) - -(defun ess-swv-knit () - "Run knit on the current .Rnw file." - (interactive) - (ess-swv-run-in-R "knit")) - -(defun ess-swv-purl () - "Run purl on the current .Rnw file." - (interactive) - (ess-swv-run-in-R "purl")) - -(defun ess-swv-weave-PDF (&optional choose) - "Sweave/knit, compile TeX, and display PDF. -Run Sweave or knit depending on `ess-swv-processor' used. - -If CHOOSE is non-nil, offer a menu of available weavers. -" - (interactive "P") - (let ((processor (if choose - (ess-completing-read "Weaver" '("sweave" "knitr") nil t) - (symbol-name ess-swv-processor)))) - (ess-swv-run-in-R (cond ((string= processor "sweave") "Sweave") - ((string= processor "knitr") "knit") - (t (error "Not a valid processor %s" processor))) - nil t) - (ess-swv-PDF nil t))) - - -(defun ess-swv-latex () - "Run LaTeX on the product of Sweave()ing the current file." - (interactive) - (save-excursion - (let* ((namestem (file-name-sans-extension (buffer-file-name))) - (latex-filename (concat namestem ".tex")) - (tex-buf (get-buffer-create " *ESS-tex-output*"))) - (message "Running LaTeX on '%s' ..." latex-filename) - (switch-to-buffer tex-buf) - (call-process "latex" nil tex-buf 1 latex-filename) - (switch-to-buffer (buffer-name)) - (display-buffer tex-buf) - (message "Finished running LaTeX" )))) - - -(defun ess-swv-PS () - "Create a postscript file from a dvi file (name based on the current -Sweave file buffer name) and display it." - (interactive) - (let* ((buf (buffer-name)) - (namestem (file-name-sans-extension (buffer-file-name))) - (dvi-filename (concat namestem ".dvi")) - (psviewer (ess-get-ps-viewer))) - (shell-command (concat "dvips -o temp.ps " dvi-filename)) - (shell-command (concat psviewer " temp.ps & ")) - (switch-to-buffer buf) - )) - -(defun ess-swv-PDF (&optional pdflatex-cmd hide-compile-buffer) - "From LaTeX file, create a PDF (via 'texi2pdf' or 'pdflatex', ...), by -default using the first entry of `ess-swv-pdflatex-commands' and display it." - (interactive) - (setq pdflatex-cmd - (or pdflatex-cmd - (and (eq (length ess-swv-pdflatex-commands) 1) - (car ess-swv-pdflatex-commands)) - (ess-completing-read "pdf latex command" - ess-swv-pdflatex-commands ; <- collection to choose from - nil 'confirm ; or 'confirm-after-completion - nil nil (car ess-swv-pdflatex-commands)))) - (let* ((buf (buffer-name)) - (namestem (file-name-sans-extension (buffer-file-name))) - (latex-filename (concat namestem ".tex")) - (tex-buf (get-buffer-create "*ESS-tex-output*")) - (pdfviewer (ess-get-pdf-viewer)) - (pdf-status) - (cmdstr-win (format "start \"%s\" \"%s.pdf\"" pdfviewer namestem)) - (pdffile (format "%s.pdf" namestem)) - (cmd (if (stringp pdfviewer) - (list pdfviewer pdffile) - (append pdfviewer (list pdffile))))) - - ;;(shell-command (concat "pdflatex " latex-filename)) - (message "Running '%s' on '%s' ..." pdflatex-cmd latex-filename) - (with-current-buffer tex-buf (erase-buffer)) - (setq pdf-status - (call-process pdflatex-cmd nil tex-buf t - (if (string= "texi2" (substring pdflatex-cmd 0 5)) - ;; workaround (bug?): texi2pdf or texi2dvi *fail* to work with full path: - (file-name-nondirectory latex-filename) - latex-filename))) - (if (not (= 0 pdf-status)) - (progn (message "** OOPS: error in '%s' (%d)!" pdflatex-cmd pdf-status) - (display-buffer tex-buf)) - ;; else: pdflatex probably ok - ;; (set-process-sentinel proc 'shell-command-sentinel) - (if (and (and ess-microsoft-p - ;; Silence byte compiler warns about w32-fns - (fboundp 'w32-shell-dos-semantics)) - (w32-shell-dos-semantics)) - (shell-command cmdstr-win) - (message (mapconcat 'identity cmd " ")) - (apply 'start-process (car cmd) nil cmd)) - (unless hide-compile-buffer (display-buffer tex-buf)) - (message "%s finished with status %d" pdflatex-cmd pdf-status)))) - - -(defun ess-insert-Sexpr () - "Insert Sexpr{} into the buffer at point." - (interactive) - (insert "\\Sexpr{}") - (backward-char)) - - -;;; back-compatible wrappers: -(defun ess-makeSweave () "old *DEPRECATED* version of \\[ess-swv-weave]." - (interactive) (ding) - (message - "** warning: ess-makeSweave is deprecated. Do use (ess-swv-weave) instead!") - (ess-swv-weave)) - -(defun ess-makeLatex () "old *DEPRECATED* version of \\[ess-swv-latex]." - (interactive) (ding) - (message - "** warning: ess-makeLatex is deprecated. Do use (ess-swv-latex) instead!") - (ess-swv-latex)) - -(defun ess-makePS () "old *DEPRECATED* version of \\[ess-swv-PS]." - (interactive) (ding) - (message - "** warning: ess-makePS is deprecated. Do use (ess-swv-PS) instead!") - (ess-swv-PS)) - -(defun ess-makePDF () "old *DEPRECATED* version of \\[ess-swv-PDF]." - (interactive) (ding) - (message - "** warning: ess-makePDF is deprecated. Do use (ess-swv-PDF) instead!") - (ess-swv-PDF)) - - -;; AUCTeX integration. This is independent of this library, but it fits -;; here nonetheless since it's an alternative way of Sweave'ing without -;; starting iESS. - -(defun ess-swv-add-TeX-commands () - "Add commands to AUCTeX's \\[TeX-command-list]." - (unless (and (featurep 'tex-site) (featurep 'tex)) - (error "AUCTeX does not seem to be loaded")) - (add-to-list 'TeX-command-list - '("Sweave" "R CMD Sweave %t" - TeX-run-command nil (latex-mode) :help - "Run Sweave") t) - (add-to-list 'TeX-command-list - '("LaTeXSweave" "%l %(mode) %s" - TeX-run-TeX nil (latex-mode) :help - "Run LaTeX after Sweave") t) - (setq TeX-command-default "Sweave") - (mapc (lambda (suffix) - (add-to-list 'TeX-file-extensions suffix)) - '("nw" "Snw" "Rnw"))) - -(defun ess-swv-remove-TeX-commands (x) - "Helper function: check if car of X is one of the Sweave strings" - (let ((swv-cmds '("Sweave" "LaTeXSweave"))) - (unless (member (car x) swv-cmds) x))) - -(defun ess-swv-plug-into-AUCTeX () - "Add commands to AUCTeX's \\[TeX-command-list] to sweave the current noweb -file and latex the result." - (if ess-swv-plug-into-AUCTeX-p - (add-hook 'Rnw-mode-hook 'ess-swv-add-TeX-commands) - (remove-hook 'Rnw-mode-hook 'ess-swv-add-TeX-commands) - (setq TeX-command-list (mapcar 'ess-swv-remove-TeX-commands TeX-command-list) - ;; this will remove the items, leaving nils, so remove them. - TeX-command-list (delq nil TeX-command-list)))) -;; as ess-swv-plug-into-AUCTeX-p is customizable ... : -(if ess-swv-plug-into-AUCTeX-p - (eval-after-load "tex" '(ess-swv-plug-into-AUCTeX))) - -(defun ess-swv-toggle-plug-into-AUCTeX () - "Toggle inclusion of commands to sweave noweb files and latex the results in -\\[TeX-command-list] on and off. Commands are added via \\[Rnw-mode-hook]." - (interactive) - (unless (and (featurep 'tex-site) (featurep 'tex)) - (error "AUCTeX are not available")) - (setq ess-swv-plug-into-AUCTeX-p (not ess-swv-plug-into-AUCTeX-p)) - (ess-swv-plug-into-AUCTeX) - (TeX-normal-mode t) - (if ess-swv-plug-into-AUCTeX-p - (message "Sweave and LaTeXSweave are activated in AUCTeX.") - (message "Sweave and LaTeXSweave are de-activated in AUCTeX."))) - - -;;; Now bind some keys. -(define-key ess-noweb-minor-mode-map "\M-ns" 'ess-swv-sweave) -(define-key ess-noweb-minor-mode-map "\M-nT" 'ess-swv-tangle) -(define-key ess-noweb-minor-mode-map "\M-nl" 'ess-swv-latex) -(define-key ess-noweb-minor-mode-map "\M-np" 'ess-swv-PS) -(define-key ess-noweb-minor-mode-map "\M-nP" 'ess-swv-PDF) -(define-key ess-noweb-minor-mode-map "\M-nr" 'ess-swv-knit) -(define-key ess-noweb-minor-mode-map "\M-nu" 'ess-swv-purl) -(define-key ess-noweb-minor-mode-map "\M-nv" 'ess-swv-weave-PDF) -(define-key ess-noweb-minor-mode-map "\M-nw" 'ess-swv-weave); depends on proc. - -(define-key ess-noweb-minor-mode-map "\M-nx" 'ess-insert-Sexpr) - -;; AND add these to the noweb menu we have anyway ! : -(easy-menu-define ess-swv-menu - ess-noweb-minor-mode-menu - "Submenu for use in `Rnw-mode'." - - '("Sweaving, Tangling, ..." - ["Sweave" ess-swv-sweave t] - ["Tangle" ess-swv-tangle t] - ["LaTeX" ess-swv-latex t] - ["PDF(LaTeX)" ess-swv-PDF t] - ["PS (dvips)" ess-swv-PS t] - ["Knit" ess-swv-knit t] - ["Purl" ess-swv-purl t] - ["View PDF" ess-swv-weave-PDF t] - ["Weave (Sweave/Knit)" ess-swv-weave t] - ["Insert Sexpr" ess-insert-Sexpr t] - ["AUCTeX Interface" ess-swv-toggle-plug-into-AUCTeX - :style toggle :selected ess-swv-plug-into-AUCTeX-p] - )) - -(easy-menu-add-item ess-noweb-minor-mode-menu - nil ;; <= path - ess-swv-menu) - - ; provides - -(provide 'ess-swv) - -;;; ess-swv.el ends here diff -Nru ess-18.10.2/lisp/ess-toolbar.el ess-18.10.2+git20220915.f45542e/lisp/ess-toolbar.el --- ess-18.10.2/lisp/ess-toolbar.el 2018-11-10 09:41:11.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/lisp/ess-toolbar.el 2022-10-15 08:06:36.000000000 +0000 @@ -1,27 +1,27 @@ -;;; ess-toolbar.el --- Support for a toolbar in ESS. - -;; Copyright (C) 1997--2009 A.J. Rossini, Richard M. Heiberger, Martin -;; Maechler, Kurt Hornik, Rodney Sparapani, and Stephen Eglen. +;;; ess-toolbar.el --- Support for a toolbar in ESS. -*- lexical-binding: t; -*- +;; Copyright (C) 1997-2020 Free Software Foundation, Inc. ;; Author: Stephen Eglen ;; Created: 2004-05-06 -;; Revised: 2009-03-16 ;; Maintainer: ESS-core -;; This file is part of ESS +;; This file is part of GNU Emacs. -;; This file is free software; you can redistribute it and/or modify +;;; License: +;; +;; This program is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 2, or (at your option) -;; any later version. - -;; This file is distributed in the hope that it will be useful, +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. +;; +;; This program is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. - -;; A copy of the GNU General Public License is available at -;; https://www.r-project.org/Licenses/ +;; +;; You should have received a copy of the GNU General Public License +;; along with this program. If not, see +;; ;;; Commentary: @@ -31,7 +31,7 @@ ;; This code is experimental. It has been tested only on Linux ;; machines. All feedback appreciated. ;; -;; If your emacs can support images, the ESS toolbar should be loaded. +;; If your Emacs can support images, the ESS toolbar should be loaded. ;; ;; If you see a toolbar, but no icons, check out the value of ;; ess-icon-directory. @@ -50,7 +50,6 @@ ;;; Code: -(require 'ess-utils) (require 'ess-mode) (defgroup ess-toolbar nil @@ -72,7 +71,7 @@ :type 'boolean) (defcustom ess-toolbar-global nil - "*Non-nil means that the ESS toolbar is available in all emacs buffers. + "*Non-nil means that the ESS toolbar is available in all Emacs buffers. Otherwise, the ESS toolbar is present only in R/S mode buffers. For beginners, this is probably better set to a non-nil value." :type 'boolean) @@ -140,7 +139,8 @@ (mapc #'ess-add-icon ess-toolbar-items)))) (defun ess-add-icon (x) - "Add an ESS item to the Emacs toolbar." + "Add an ESS item to the Emacs toolbar. +X should be a list, see `ess-toolbar-items' for the format." ;; 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)) @@ -149,8 +149,8 @@ "Add the ESS toolbar to a particular mode. The toolbar is added iff `ess-toolbar-global' is nil, else the toolbar is added globally when ess-toolbar.el is loaded." - (if (and ess-toolbar (not ess-toolbar-global)) - (set (make-local-variable 'tool-bar-map) ess-toolbar))) + (when (and ess-toolbar (not ess-toolbar-global)) + (setq-local 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. @@ -169,7 +169,7 @@ (and (fboundp 'display-images-p) (display-images-p)) ;; if above tests failed, give a warning. (progn - (message "Toolbar support for ESS not available in this emacs.") + (message "Toolbar support for ESS not available in this Emacs.") ;; Not sure if we want to delay startup of ESS. ;;(sit-for 2) )) diff -Nru ess-18.10.2/lisp/ess-tracebug.el ess-18.10.2+git20220915.f45542e/lisp/ess-tracebug.el --- ess-18.10.2/lisp/ess-tracebug.el 2018-11-10 09:41:11.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/lisp/ess-tracebug.el 2022-10-15 08:06:36.000000000 +0000 @@ -1,39 +1,30 @@ -;; ess-tracebug.el --- Tracing and debugging facilities for ESS. -;; -;; 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 +;; ess-tracebug.el --- Tracing and debugging facilities for ESS. -*- lexical-binding: t; -*- + +;; Copyright (C) 2011-2020 Free Software Foundation, Inc. ;; Author: Vitalie Spinu ;; Maintainer: Vitalie Spinu -;; Copyright (C) 2010-2012, Vitalie Spinu, all rights reserved. ;; Created: Oct 14 14:15:22 2010 -;; URL: https://code.google.com/p/ess-tracebug/ -;; Keywords: tools, languages -;; -;; This file is *NOT* part of GNU Emacs. -;; -;; This program is free software; you can redistribute it and/or -;; modify it under the terms of the GNU General Public License as -;; published by the Free Software Foundation; either version 3, any later version. -;; -;; This program is distributed in the hope that it will be useful, but WITHOUT -;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -;; FOR A PARTICULAR PURPOSE. See the GNU General Public License for more -;; details. -;; -;; A copy of the GNU General Public License is available at -;; https://www.r-project.org/Licenses/ +;; This file is part of GNU Emacs. + +;;; License: ;; -;; Features that might be required by this library: -;; -;; ESS - required -;; ido, face-remap, cl - desirable and are part of default emacs +;; This program is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. ;; -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; This program is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. ;; +;; You should have received a copy of the GNU General Public License +;; along with this program. If not, see +;; + ;;; Commentary: + ;; Ess-tracebug is a package for interactive debugging of R code from ;; ESS and provides such features as: ;; - visual debugging @@ -43,24 +34,22 @@ ;; - highlighting of error source references and easy error navigation ;; - interactive traceback. ;; -;; For a complete description please see the documentation at -;; https://code.google.com/p/ess-tracebug/ and a brief tutorial at -;; https://code.google.com/p/ess-tracebug/wiki/GettingStarted -;; -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; +;; For a complete description please see the documentation in the ESS +;; manual. + ;;; Code: -(eval-when-compile - (require 'cl) +(eval-and-compile + (when (< emacs-major-version 26) + (require 'cl)) (require 'cl-lib) - (require 'tramp)) + (require 'tramp) + (require 'subr-x) + (require 'ess-utils)) (require 'comint) (require 'compile) -(require 'overlay) (require 'ring) -(require 'ess-custom) -(require 'ess-utils) + (defvar text-scale-mode-amount) (autoload 'text-scale-mode "face-remap" "[autoload]" nil) @@ -71,6 +60,7 @@ (defvar ess--dbg-del-empty-p) (defvar inferior-ess-mode-map) (defvar ess-mode-map) +(defvar ess--inhibit-presend-hooks) (declare-function ess--accumulation-buffer "ess-inf") (declare-function ess--if-verbose-write-process-state "ess-inf") (declare-function ess--run-presend-hooks "ess-inf") @@ -83,26 +73,37 @@ (declare-function ess-get-process "ess-inf") (declare-function ess-get-process-variable "ess-inf") (declare-function ess-get-words-from-vector "ess-inf") +(declare-function ess-get-words-from-vector--foreground "ess-inf") (declare-function ess-process-get "ess-inf") (declare-function ess-process-live-p "ess-inf") (declare-function ess-process-put "ess-inf") (declare-function ess-send-string "ess-inf") -(declare-function ess-show-buffer "ess-inf") +(declare-function ess-switch-process "ess-inf" ()) (declare-function ess-switch-to-ESS "ess-inf") (declare-function ess-wait-for-process "ess-inf") +(declare-function ess-switch-to-end-of-ESS "ess-inf" ()) +(declare-function ess-eval-region--normalise-region "ess-inf" ) (declare-function inferior-ess-run-callback "ess-inf") -(declare-function inferior-ess-set-status "ess-inf") +(declare-function inferior-ess--set-status "ess-inf") (declare-function ess-helpobjs-at-point--read-obj "ess-help") (declare-function ess-r-get-evaluation-env "ess-r-mode") (declare-function ess-r-package--all-source-dirs "ess-r-package") (declare-function ess-r-package-name "ess-r-package") (declare-function ess-r-package-source-dirs "ess-r-package") +(declare-function ess-roxy--region-p "ess-roxy") + ;; Do not require tramp at runtime. It is expensive to load. Instead, ;; guard calls with (require 'tramp) and silence the byte compiler ;; here. (declare-function tramp-dissect-file-name "tramp") (declare-function tramp-get-remote-tmpdir "tramp") +;; The following declares can be removed once we drop Emacs 25 +(declare-function tramp-file-name-method "tramp") +(declare-function tramp-file-name-user "tramp") +(declare-function tramp-file-name-host "tramp") +(declare-function tramp-file-name-localname "tramp") +(declare-function tramp-file-name-hop "tramp") (defgroup ess-tracebug nil @@ -115,42 +116,32 @@ "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)) - (defvar ess-watch-mode-map (let ((map (make-sparse-keymap))) - (set-keymap-parent map special-mode-map) - (define-key map "?" 'ess-watch-help) - (define-key map "k" 'ess-watch-kill) - ;; (define-key ess-watch-mode-map "u" 'ess-watch-undelete) + (define-key map "k" #'ess-watch-kill) + ;; (define-key ess-watch-mode-map "u" #'ess-watch-undelete) ;; editing requires a little more work. - (define-key map "a" 'ess-watch-add) - (define-key map "i" 'ess-watch-insert) - (define-key map "e" 'ess-watch-edit-expression) - (define-key map "r" 'ess-watch-rename) - (define-key map "q" 'ess-watch-quit) - (define-key map "u" 'ess-watch-move-up) - (define-key map "U" 'ess-watch-move-down) - (define-key map "d" 'ess-watch-move-down) - (define-key map "n" 'ess-watch-next-block) - (define-key map "p" 'ess-watch-previous-block) + (define-key map "a" #'ess-watch-add) + (define-key map "i" #'ess-watch-insert) + (define-key map "e" #'ess-watch-edit-expression) + (define-key map "r" #'ess-watch-rename) + (define-key map "q" #'ess-watch-quit) + (define-key map "u" #'ess-watch-move-up) + (define-key map "U" #'ess-watch-move-down) + (define-key map "d" #'ess-watch-move-down) + (define-key map "n" #'ess-watch-next-block) + (define-key map "p" #'ess-watch-previous-block) ;; R mode keybindings. - (define-key map "\C-c\C-s" 'ess-watch-switch-process) - (define-key map "\C-c\C-y" 'ess-switch-to-ESS) - (define-key map "\C-c\C-z" 'ess-switch-to-end-of-ESS) + (define-key map "\C-c\C-s" #'ess-switch-process) + (define-key map "\C-c\C-y" #'ess-switch-to-ESS) + (define-key map "\C-c\C-z" #'ess-switch-to-end-of-ESS) map) - "Keymap for the *R watch* buffer. - -\\{ess-watch-mode-map}") + "Keymap for `ess-watch-mode'.") (defcustom ess-tracebug-prefix nil - "*Key to be used as prefix for all `ess-tracebug' commands. -Set this to a key cominbation you don't use often, like: + "Key to be used as prefix for all `ess-tracebug' commands. +Set this to a key combination you don't use often, like: (setq ess-tracebug-prefix \"\\M-t\") @@ -159,10 +150,6 @@ :type '(choice (const nil) (string)) :group 'ess-tracebug) -;; (make-obsolete-variable 'ess-tracebug-prefix "ess-tracebug-prefix will be removed in future versions. -;; Electric debug keys are now on C-c and ess-dev maps." "ESS 13.05") -;; (define-obsolete-variable-alias 'ess-tracebug-command-prefix 'ess-tracebug-prefix) - (defcustom ess-tracebug-search-path nil "List of directories to search for source files. Elements should be directory names, not file names of directories." @@ -197,9 +184,8 @@ :group 'ess-debug :type 'integer) -(defvar ess-watch-current-block-overlay nil +(defvar-local ess-watch-current-block-overlay nil "The overlay for currently selected block in the R watch buffer .") -(make-variable-buffer-local 'ess-watch-current-block-overlay) (defcustom ess-inject-source 'function-and-buffer "Control the source injection into evaluated code. @@ -237,7 +223,7 @@ (defvar ess--tracebug-eval-index 0 "This is used by to track source references in evaluation with source. For example, each time `ess-eval-function' is called the evaluated -region is marked. When debugger enteres the code it desplayes +region is marked. When debugger enters the code it displays this reference number. Ess-debug finds this number in the referenced buffer.") @@ -250,7 +236,7 @@ through use of the :var header argument) this marker points to the outer-most code block.") -;; hash to store soruce references of the form: tmpname -> (filename . src_start) +;; hash to store source references of the form: tmpname -> (filename . src_start) (defvar ess--srcrefs (make-hash-table :test 'equal :size 100)) (defvar ess-tracebug-original-buffer-marker nil @@ -337,19 +323,30 @@ (defun ess-process-buffer-substring (process start end) (ess--run-presend-hooks process (buffer-substring-no-properties start end))) +;; Declare globally so that the bytecode compiler let-binds it +;; properly +(defvar-local ess-r-evaluation-env nil) + (defun ess-tracebug-send-region (process start end &optional visibly message type) "Send region to process adding source references as specified by `ess-inject-source' variable." - (let* ((inject-p (cond ((eq type 'function) + ;; Disable evaluation env if we're sending a roxy region. This is + ;; not the ideal place to do this. + (let* ((se (ess-eval-region--normalise-region start end)) + (start (car se)) + (end (cdr se)) + (ess-r-evaluation-env (unless (ess-roxy--region-p start end) + (ess-r-get-evaluation-env))) + (inject-p (cond ((eq type 'function) ess-inject-source) ((eq type 'buffer) (or (eq ess-inject-source t) (eq ess-inject-source 'function-and-buffer))) - (t (or (eq ess-inject-source t) - ;; We need to always inject with namespaced - ;; evaluation (fixme: not right place for - ;; this). - (ess-r-get-evaluation-env))))) + ((eq ess-inject-source t)) + ;; We need to always inject with namespaced + ;; evaluation (FIXME: not right place for + ;; this). + (ess-r-evaluation-env))) (ess--dbg-del-empty-p (unless inject-p ess--dbg-del-empty-p)) (string (if inject-p (ess-make-source-refd-command start end visibly process) @@ -369,57 +366,18 @@ "Like `ess-tracebug-send-region' but with tweaks for functions." (ess-tracebug-send-region proc start end visibly message 'function)) -(defvar ess-tracebug-help nil - "ess-dev-map prefix: \\[ess-dev-map] - -* 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) - -* 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' - -* Navigation to errors (general emacs functionality): - - C-x `, M-g n . `next-error' - M-g p . `previous-error'") - - ;; * Input Ring: ;; i . Goto input event marker forwards . `ess-debug-goto-input-event-marker' ;; I . Goto input event marker backwards . `ess-debug-goto-input-event-marker' -(defun ess-tracebug-show-help (&optional ev) +(defun ess-tracebug-show-help () "Show help for `ess-tracebug'." (interactive) - (describe-variable 'ess-tracebug-help)) + (if (fboundp 'describe-keymap) + (describe-keymap 'ess-tracebug-map) + (info "(ess) ESS tracebug"))) (defun ess-tracebug--propertize (dummy bitmap face &optional string ) "If `window-system' propertize DUMMY with fringe BITMAP and FACE. @@ -467,7 +425,7 @@ (prefix-numeric-value arg) (if (ess-process-get 'tracebug) -1 1))) (if (> arg 0) - (unless (ess-process-get 'tracebug) ;; only if already not active + (unless (ess-process-get 'tracebug) ;; only if not already active (ess--tb-start) (ess-debug-start) ;; (dolist (bf (buffer-list)) @@ -523,7 +481,7 @@ '((((background light) (min-colors 88)) (:foreground "medium blue" :overline "medium blue")) (((background dark) (min-colors 88)) (:foreground "deep sky blue" :overline "deep sky blue")) (((background light) (min-colors 8)) (:foreground "blue")) - (((background dark) (min-colors 8)) (:foreground "syan"))) + (((background dark) (min-colors 8)) (:foreground "cyan"))) "Face for fringe bitmap for last-input position." :group 'ess-tracebug) @@ -554,9 +512,8 @@ "Overlay to highlight the position of last input in iESS buffer. Local in iESS buffers.") -(defvar ess--busy-count 0 +(defvar-local ess--busy-count 0 "Used to compute the busy indicator.") -(make-variable-buffer-local 'ess--busy-count) ;; (unless (boundp 'ess--busy-slash) ;; (defvar ess--busy-slash '(32 ?\u2014 92 47)) @@ -582,15 +539,21 @@ (defvar ess--busy-timer nil "Timer used for busy process indication.") +(defcustom inferior-ess-fix-misaligned-output nil + "If non-nil, try to correct misaligned process output." + :group 'ess-tracebug + :type 'boolean) + (defcustom inferior-ess-replace-long+ t "Determines if ESS replaces long + sequences in output. -If 'strip, remove all such instances. Otherwise, if non-nil, '+ -+ + + ' containing more than 4 + is replaced by -`ess-long+replacement'." +If \\='strip, remove all such instances. Otherwise, if non-nil, `+ ++ + + ' containing 3 or more + is replaced by +`ess-long+replacement'. +This variable can be process-local but not buffer-local." :group 'ess-tracebug :type '(choice (const nil :tag "No replacement") - (const 'strip :tag "Replace all") - (const t :tag "Replace 4 or more +"))) + (const strip :tag "Replace all") + (const t :tag "Replace 3 or more +"))) (defvar ess-long+replacement ". + " "Replacement used for long + prompt. @@ -618,8 +581,7 @@ (with-current-buffer (process-buffer (get-process ess-local-process-name)) (unless ess-error-regexp-alist (error "Can not activate the traceback for %s dialect" ess-dialect)) - (set (make-local-variable 'compilation-error-regexp-alist) - ess-error-regexp-alist) + (setq-local compilation-error-regexp-alist ess-error-regexp-alist) (let (compilation-mode-font-lock-keywords) (compilation-setup t)) (setq next-error-function 'ess-tracebug-next-error-function) @@ -627,7 +589,7 @@ (make-local-variable 'ess--tb-last-input) (make-local-variable 'ess--tb-last-input-overlay) (make-local-variable 'compilation-search-path) - (setq compilation-search-path ess-tracebug-search-path) ;; todo: make this dialect specific + (setq compilation-search-path ess-tracebug-search-path) ;; TODO: make this dialect specific (ess-tracebug--set-left-margin) (save-excursion (goto-char comint-last-input-start) @@ -646,7 +608,7 @@ (add-hook 'comint-input-filter-functions 'ess-tracebug-set-last-input nil 'local) ;; redefine - ;; todo: all this part should go (partially gone now) + ;; TODO: all this part should go (partially gone now) (unless (fboundp 'orig-ess-parse-errors) (defalias 'orig-ess-parse-errors (symbol-function 'ess-parse-errors)) (defalias 'ess-parse-errors (symbol-function 'next-error))))) @@ -677,8 +639,9 @@ `ess--dbg-goto-input-point'.") (defvar ess--dbg-backward-ring (make-ring 10) - "Ring of markers to the positions from which `ess--dbg-goto-input-point' is called. -See the also `ess--dbg-goto-debug-point'") + "Ring of markers for the positions from `ess--dbg-goto-input-point'. +Marks the position from which it was called. See also +`ess--dbg-goto-debug-point'") ;; (setq ess-R--tb-regexp-alist '(R R2 R3 R-recover)) ;;(pop compilation-error-regexp-alist-alist) @@ -686,49 +649,40 @@ (defun ess-show-traceback () "Display R traceback and last error message. Pop up a compilation/grep/occur like buffer. Usual global key -bindings are available \(\\[next-error] and \\[previous-error]\) +bindings are available (\\[next-error] and \\[previous-error]) for `next-error' and `previous-error' respectively. -You can bind 'no-select' versions of this commands: -\(define-key compilation-minor-mode-map [(?n)] 'next-error-no-select\) -\(define-key compilation-minor-mode-map [(?p)] 'previous-error-no-select\)" - (interactive) - (if (null ess-traceback-command) - (error "Not implemented for dialect %s" ess-dialect) - (ring-insert ess--dbg-forward-ring (point-marker)) - (ess-force-buffer-current "R process to use: ") - (let ((trbuf (get-buffer-create "*ess-traceback*")) - (lproc-name ess-local-process-name) - (alist ess-mode-editing-alist) - (cmd ess-traceback-command)) - (setq next-error-last-buffer trbuf) - (with-current-buffer trbuf - (setq buffer-read-only nil) - (setq ess-local-process-name lproc-name) - (ess-command cmd trbuf) - (goto-char (point-min)) - ;; fixme: this is R specific check - (if (re-search-forward "No traceback available" nil t) - (message "No traceback available") - (ess-dirs) - (message nil) - (make-local-variable 'compilation-error-regexp-alist) - (when (boundp '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) - (font-lock-refresh-defaults) - (compilation-minor-mode 1) - (setq next-error-function 'ess-tracebug-next-error-function) - ;(use-local-map ess-traceback-minor-mode-map) - ;; ess keys - (local-set-key "\C-c\C-s" 'ess-watch-switch-process) - (local-set-key "\C-c\C-y" 'ess-switch-to-ESS) - (local-set-key "\C-c\C-z" 'ess-switch-to-end-of-ESS) - - (setq buffer-read-only t) - (pop-to-buffer trbuf)))))) +You can bind `no-select' versions of this commands: +\(define-key compilation-minor-mode-map [(?n)] #'next-error-no-select) +\(define-key compilation-minor-mode-map [(?p)] #'previous-error-no-select)" + (interactive) + (cl-assert ess-traceback-command nil + "Not implemented for dialect %s" ess-dialect) + (ring-insert ess--dbg-forward-ring (point-marker)) + (ess-force-buffer-current "R process to use: ") + (let ((trbuf (get-buffer-create "*ess-traceback*")) + (lproc-name ess-local-process-name) + (alist ess-mode-editing-alist) + (cmd ess-traceback-command) + (inhibit-read-only t)) + (setq next-error-last-buffer trbuf) + (with-current-buffer trbuf + (setq ess-local-process-name lproc-name) + (ess-command cmd trbuf) + (goto-char (point-min)) + ;; fixme: this is R specific check + (cl-assert (not (re-search-forward "No traceback available" nil t)) nil + "No traceback available") + (ess-dirs) + (when (boundp 'ess-r-error-regexp-alist) + (setq-local compilation-error-regexp-alist ess-r-error-regexp-alist)) + (setq-local compilation-search-path ess-tracebug-search-path) + (ess-setq-vars-local alist) + (font-lock-refresh-defaults) + (compilation-minor-mode 1) + (setq next-error-function #'ess-tracebug-next-error-function) + (setq buffer-read-only t) + (pop-to-buffer trbuf)))) (defvar ess-call-stack-command nil) (defun ess-show-call-stack () @@ -758,13 +712,11 @@ ;; Modified version of `compilation-next-error-function'. (interactive "p") (if reset (goto-char (point-max))) - (let* ((columns compilation-error-screen-columns) ; buffer's local value + (let* (;; (columns compilation-error-screen-columns) ; buffer's local value ;; (proc (or (get-buffer-process (current-buffer)) ;; (error "Current buffer has no process"))) (pbuff-p (get-buffer-process (current-buffer))) - (last 1) (n (or n 1)) - timestamp (beg-pos ; from where the search for next error starts (if (and pbuff-p (>= n 0) @@ -773,8 +725,8 @@ (point))) (at-error t) (msg - (condition-case err - (compilation-next-error n nil beg-pos) + (condition-case nil + (compilation-next-error n nil beg-pos) (error (when pbuff-p (ess--tb-next-error-goto-process-marker)) @@ -790,7 +742,7 @@ (message "Beyond last-input marker") (setq at-error nil))) (marker (point-marker)) - loc end-loc) + loc) (when at-error (setq compilation-current-error (point-marker) overlay-arrow-position (if (bolp) @@ -798,10 +750,7 @@ (copy-marker (line-beginning-position))) loc (if (fboundp 'compilation--message->loc) (compilation--message->loc msg) - (car msg)) - end-loc (if (fboundp 'compilation--message->end-loc) ;; emacs 24 - (compilation--message->end-loc msg) - (nth 2 msg))) + (car msg))) (let* ((file (caar (nth 2 loc))) (col (car loc)) (line (cadr loc)) @@ -830,12 +779,12 @@ '(( "" "NONE" "NULL" ) ( " r" "RECOVER" "utils::recover") ( " t" "TRACEBACK" "base::traceback")) - "Alist of 'on-error' actions. + "Alist of `on-error' actions. Toggled with `ess-debug-toggle-error-action'. Each element must have the form (DISP SYMB ACTION) where DISP is the string to be displayed in the mode line when the action is in place. SYMB is the symbolic name of an action. ACTION is the string giving the -actual expression to be assigned to 'error' user option. See R's +actual expression to be assigned to `error' user option. See R's help ?options for more details." :type '(alist :key-type string :value-type (group string string)) @@ -844,17 +793,14 @@ (defvar ess--dbg-output-buf-prefix " *ess.dbg" "The prefix of the buffer name the R debug output is directed to." ) -(defvar ess--dbg-current-ref (make-marker) +(defvar-local ess--dbg-current-ref (make-marker) "Current debug reference in *ess.dbg* buffers (a marker).") -(make-variable-buffer-local 'ess--dbg-current-ref) -(defvar ess--dbg-last-ref-marker (make-marker) +(defvar-local ess--dbg-last-ref-marker (make-marker) "Last debug reference in *ess.dbg* buffer (a marker).") -(make-variable-buffer-local 'ess--dbg-last-ref-marker) -(defvar ess--dbg-buf-p nil +(defvar-local ess--dbg-buf-p nil "This is t in ess.dbg buffers.") -(make-variable-buffer-local 'ess--dbg-buf-p) ;; (defcustom ess--dbg-auto-single-key-p t ;; "If t entering the debug state triggers single-key mode. @@ -888,7 +834,7 @@ (defcustom ess-debug-blink-interval .2 "Time in seconds to blink the background of the debug line. -Currently two events are defined 'ref-not-found' and 'same-ref'. +Currently two events are defined `ref-not-found' and `same-ref'. Blinking colors for these events can be customized by corresponding faces." :group 'ess-debug @@ -937,28 +883,26 @@ (let (ess-electric-selection-map) (define-prefix-command 'ess-electric-selection-map) ;; command-c and command-Q are not always working reliably - (define-key ess-electric-selection-map "\M-N" 'ess-debug-command-continue) - (define-key ess-electric-selection-map "\M-C" 'ess-debug-command-continue) - (define-key ess-electric-selection-map "\M-Q" 'ess-debug-command-quit) - (define-key ess-electric-selection-map "0" 'ess-debug-command-digit) - (define-key ess-electric-selection-map "1" 'ess-debug-command-digit) - (define-key ess-electric-selection-map "2" 'ess-debug-command-digit) - (define-key ess-electric-selection-map "3" 'ess-debug-command-digit) - (define-key ess-electric-selection-map "4" 'ess-debug-command-digit) - (define-key ess-electric-selection-map "5" 'ess-debug-command-digit) - (define-key ess-electric-selection-map "6" 'ess-debug-command-digit) - (define-key ess-electric-selection-map "7" 'ess-debug-command-digit) - (define-key ess-electric-selection-map "8" 'ess-debug-command-digit) - (define-key ess-electric-selection-map "9" 'ess-debug-command-digit) - (define-key ess-electric-selection-map "?" 'ess-tracebug-show-help) + (define-key ess-electric-selection-map "\M-N" #'ess-debug-command-continue) + (define-key ess-electric-selection-map "\M-C" #'ess-debug-command-continue) + (define-key ess-electric-selection-map "\M-Q" #'ess-debug-command-quit) + (define-key ess-electric-selection-map "0" #'ess-debug-command-digit) + (define-key ess-electric-selection-map "1" #'ess-debug-command-digit) + (define-key ess-electric-selection-map "2" #'ess-debug-command-digit) + (define-key ess-electric-selection-map "3" #'ess-debug-command-digit) + (define-key ess-electric-selection-map "4" #'ess-debug-command-digit) + (define-key ess-electric-selection-map "5" #'ess-debug-command-digit) + (define-key ess-electric-selection-map "6" #'ess-debug-command-digit) + (define-key ess-electric-selection-map "7" #'ess-debug-command-digit) + (define-key ess-electric-selection-map "8" #'ess-debug-command-digit) + (define-key ess-electric-selection-map "9" #'ess-debug-command-digit) + (define-key ess-electric-selection-map "?" #'ess-tracebug-show-help) ess-electric-selection-map) "Keymap used to define commands for single key input mode. This commands are triggered by `ess-electric-selection' . \\{ess-electric-selection-map}") -(ess-if-verbose-write "\n<- debug-vars done") - ;;;_ + debug functions (defun ess-debug-set-error-action (spec) "Set the on-error action. @@ -972,12 +916,11 @@ (error "Unknown action")))) (defun ess-debug-toggle-error-action () - "Toggle the 'on-error' action. + "Toggle the `on-error' action. The action list is in `ess-debug-error-action-alist'." (interactive) (ess-force-buffer-current) - (let* ((alist ess-debug-error-action-alist) - (ev last-command-event) + (let* ((ev last-command-event) (com-char (event-basic-type ev)) (cur-action (or (ess-process-get 'on-error-action) "")) actions act) @@ -1008,7 +951,8 @@ (move-marker ess--dbg-current-debug-position (point-at-bol))) (defun ess--dbg-deactivate-overlays () - "Deletes markers and overlays. Overlay arrow remains to indicate the last debug position." + "Delete debugger markers and overlays. +Overlay arrow remains to indicate the last debug position." (delete-overlay ess--dbg-current-debug-overlay) (set-marker ess--dbg-current-debug-position nil)) @@ -1018,7 +962,7 @@ "Jump to the point where the last debugger/traceback etc event occurred. Mainly useful during/after debugging, to jump to the place -from where the code was initialy executed. This is an +from where the code was initially executed. This is an electric-command, which means that after the command is triggered a single key event is enough to navigate through the input-event-S-ring. If the key-event which triggered the command is Shift modified @@ -1036,10 +980,10 @@ input-point) (if (memq 'shift (event-modifiers ev)) (setq input-point (ring-ref ess--dbg-backward-ring 0)) - (ring-insert ess--dbg-backward-ring (point-marker)) ;; insert in backward ring ;;todo: check if the marker to this (close by?) position is already in the ring + (ring-insert ess--dbg-backward-ring (point-marker)) ;; insert in backward ring ;;TODO: check if the marker to this (close by?) position is already in the ring (setq input-point (ring-ref ess--dbg-forward-ring 0))) - (when (marker-buffer input-point) ;; todo: give a message here if buff is not found - (switch-to-buffer (marker-buffer input-point)) + (when (marker-buffer input-point) ;; TODO: give a message here if buff is not found + (pop-to-buffer-same-window (marker-buffer input-point)) (when (marker-position input-point) (goto-char (marker-position input-point)))) (while (eq (event-basic-type (event-basic-type (setq ev (read-event)))) com-char) @@ -1051,7 +995,7 @@ ;; get it from forward-ring (setq input-point (ring-ref ess--dbg-forward-ring ring-el)) ) (when (marker-buffer input-point) - (switch-to-buffer (marker-buffer input-point)) + (pop-to-buffer-same-window (marker-buffer input-point)) (when (marker-position input-point) (goto-char (marker-position input-point))))) (push ev unread-command-events))) @@ -1070,10 +1014,10 @@ (ring-el 0)) (if (ess--dbg-is-active-p) (progn - (switch-to-buffer (marker-buffer ess--dbg-current-debug-position)) + (pop-to-buffer-same-window (marker-buffer ess--dbg-current-debug-position)) (goto-char (marker-position ess--dbg-current-debug-position )) (back-to-indentation)) - (switch-to-buffer (marker-buffer debug-point)) + (pop-to-buffer-same-window (marker-buffer debug-point)) (goto-char (marker-position debug-point))) (while (eq (event-basic-type (setq ev (read-event))) com-char) (if (memq 'shift (event-modifiers ev)) @@ -1081,7 +1025,7 @@ (setq ring-el (1+ ring-el))) (setq debug-point (ring-ref ess--dbg-backward-ring ring-el)) (when (marker-buffer debug-point) - (switch-to-buffer (marker-buffer debug-point)) + (pop-to-buffer-same-window (marker-buffer debug-point)) (when (marker-position debug-point) (goto-char (marker-position debug-point))))) (push ev unread-command-events))) @@ -1120,7 +1064,6 @@ (defun ess--dbg-remove-empty-lines (string) "Remove empty lines from STRING (which interfere with evals) during debug. This function is placed in `ess-presend-filter-functions'." - ;; the process here is an ugly reliance on dynamic scope (if (and ess--dbg-del-empty-p (ess-process-get 'dbg-active)) (replace-regexp-in-string "\n\\s *$" "" string) string)) @@ -1133,7 +1076,7 @@ `ess-tracebug-map' to `ess-tracebug-prefix' in `ess-mode-map' and `inferior-ess-mode-map' respectively." (interactive) - (let ((dbuff (get-buffer-create (concat ess--dbg-output-buf-prefix "." ess-current-process-name "*"))) ;todo: make dbuff a string! + (let ((dbuff (get-buffer-create (concat ess--dbg-output-buf-prefix "." ess-current-process-name "*"))) ;TODO: make dbuff a string! (proc (ess-get-process ess-local-process-name)) (lpn ess-local-process-name)) (process-put proc 'dbg-buffer dbuff); buffer were the look up takes place @@ -1164,7 +1107,7 @@ (defun ess-debug-stop () "End the debug session. Kill the *ess.dbg.[R_name]* buffer." - ;;; process plist is not removed, todo?low priority + ;;; process plist is not removed, TODO?low priority (interactive) (let ((proc (get-process ess-current-process-name))) ;;local? (with-current-buffer (process-buffer proc) @@ -1187,7 +1130,7 @@ (defun ess--make-busy-timer-function (process) - "Display the spiner of prompt if PROCESS is busy." + "Display the spinner of prompt if PROCESS is busy." `(lambda () (let ((pb ,process)) (when (eq (process-status pb) 'run) ;; only when the process is alive @@ -1199,7 +1142,6 @@ (redisplay)) (setq ess--busy-count (1+ (mod ess--busy-count (1- (length ess-busy-strings))))) (force-mode-line-update) - ;; looks like redisplay is necessary for emacs > 24.4 (redisplay))))))) ;; (ess--make-busy-prompt-function (get-process "R")) @@ -1214,10 +1156,10 @@ (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)))) +(defun ess-debug-active-p (&optional proc) + (and (ess-process-live-p proc) + (or (ess-process-get 'dbg-active proc) + (ess-process-get 'is-recover proc)))) (defvar ess--dbg-regexp-reference "debug \\w+ +\\(.+\\)#\\([0-9]+\\):") (defvar ess--dbg-regexp-jump "debug \\w+ ") ;; debug at ,debug bei ,etc @@ -1241,22 +1183,34 @@ ;;; MPI -(defvar ess-mpi-control-regexp "\\([^]+\\)\\([^]+\\)") +;; http://jkorpela.fi/chars/c0.html +;; https://en.wikipedia.org/wiki/ANSI_escape_code#Escape_sequences +(defvar ess-mpi-message-start-delimiter "_") +(defvar ess-mpi-message-field-separator "") +(defvar ess-mpi-message-end-delimiter "\\") + +(define-obsolete-variable-alias 'ess-mpi-alist 'ess-mpi-handlers "ESS 19.04") +(defvar ess-mpi-handlers + '(("message" . ess-mpi:message) + ("error" . ess-mpi:error) + ("eval" . ess-mpi:eval) + ("y-or-n" . ess-mpi:y-or-n)) + "Alist of the MPI handlers. +Each element is of the form (TYPE . HANDLER), where TYPE is the +message type and HANDLER is a function (symbol) to be called on +the payload list of each message.") -(defvar ess-mpi-alist - '(("message" . message) - ("error" . ess-mpi:error) - ("eval" . ess-mpi:eval) - ("y-or-n" . ess-mpi:y-or-n))) +(defun ess-mpi:message (msg) + (message "%s" msg)) (defun ess-mpi:error (msg) - (message (format "Error in inferior: %s" msg))) + (error "MPI error: %s" msg)) -(defun ess-mpi:eval (expr &optional callback) - "Evaluate EXP as Emacs expression. +(defun ess-mpi:eval (str &optional callback) + "Read STR and evaluate as Emacs expression. If present, the CALLBACK string is passed through `format' with returned value from EXPR and then sent to the subprocess." - (let ((result (eval (read expr)))) + (let ((result (eval (read str)))) (when callback (ess-send-string (ess-get-process) (format callback result))))) @@ -1266,40 +1220,59 @@ value from EXPR and then sent to the subprocess." (let ((result (y-or-n-p prompt))) (when callback - (ess-send-string (ess-get-process) (format callback result))))) + (let ((result (if result "TRUE" "FALSE"))) + (ess-send-string (ess-get-process) (format callback result)))))) + +(defun ess-mpi-convert (el) + (cond + ((string= el "nil") nil) + ((string= el "t") t) + (t el))) (defun ess-mpi-handle-messages (buf) - "Handle all mpi messages in BUF and delete them." - (let ((obuf (current-buffer))) + "Handle all mpi messages in BUF and delete them. +The MPI message has the form TYPEFIELD... where TYPE is the +type of the messages on which handlers in `ess-mpi-handlers' are +dispatched. And FIELDs are strings. Return :incomplete if BUF +ends with an incomplete message." + (let ((obuf (current-buffer)) + (out nil)) (with-current-buffer buf (goto-char (point-min)) - ;; This should be smarter because emacs might cut it in the middle of the + ;; This should be smarter because Emacs might cut it in the middle of the ;; message. In practice this almost never happen because we are ;; accumulating output into the cache buffer. - (while (re-search-forward ess-mpi-control-regexp nil t) - (let* ((mbeg (match-beginning 0)) - (mend (match-end 0)) - (head (match-string 1)) - (payload (split-string (match-string 2) "")) - (handler (cdr (assoc head ess-mpi-alist)))) - (if handler - (condition-case-unless-debug err - (with-current-buffer obuf - (apply handler payload)) - (error (message (format "Error in mpi `%s' handler: %%s" head) - (error-message-string err)))) - ;; don't throw error here. The buffer must be cleaned first. - (message "Now handler defined for MPI message '%s" head)) - (goto-char mbeg) - (delete-region mbeg mend)))))) + (while (search-forward ess-mpi-message-start-delimiter nil t) + (let ((mbeg0 (match-beginning 0)) + (mbeg (match-end 0))) + (if (search-forward ess-mpi-message-end-delimiter nil t) + (let* ((mend (match-beginning 0)) + (mend0 (match-end 0)) + (msg (buffer-substring mbeg mend)) + (payload (mapcar #'ess-mpi-convert + (split-string msg ess-mpi-message-field-separator))) + (head (pop payload)) + (handler (cdr (assoc head ess-mpi-handlers)))) + (unwind-protect + (if handler + (with-current-buffer obuf + (apply handler payload)) + (error "No handler defined for MPI message '%s" head)) + (goto-char mbeg0) + (delete-region mbeg0 mend0))) + (setq out :incomplete)))) + out))) -(defun ess--replace-long+-in-prompt (prompt is-final) +(defun ess--replace-long+-in-prompt (proc prompt is-final) "Replace long + + + in PROMPT based on `inferior-ess-replace-long+' value. If IS-FINAL means that PROMPT occurs at the end of the process chunk. If non-nil, special care is taken not to drop last '+' value as it might be a continuation prompt." ;; see #576 for interesting input examples - (let ((len (length prompt))) + (let ((len (length prompt)) + (inferior-ess-replace-long+ (buffer-local-value + 'inferior-ess-replace-long+ + (process-buffer proc)))) (if (or (null inferior-ess-replace-long+) (< len 2)) prompt @@ -1311,8 +1284,7 @@ "> ")) ((eq inferior-ess-replace-long+ t) (let ((prompt (replace-regexp-in-string "\\(\\+ \\)\\{2\\}\\(\\+ \\)+" - ess-long+replacement prompt)) - (len (length prompt))) + ess-long+replacement prompt))) (if (and last+ (not is-final)) ;; append > for aesthetic reasons (concat prompt "> ") @@ -1320,8 +1292,9 @@ (t (error "Invalid values of `inferior-ess-replace-long+'"))))))) (defun ess--offset-output (prev-prompt str) - "Add suitable offset to STR given the preceding PREV-PROMPT." - (if prev-prompt + "Add suitable offset to STR given the preceding PREV-PROMPT. +Do nothing if `inferior-ess-fix-misaligned-output' is nil." + (if (and inferior-ess-fix-misaligned-output prev-prompt) (let ((len (length prev-prompt))) ;; prompts have at least 2 chars (if (eq (elt prev-prompt (- len 2)) ?+) @@ -1346,81 +1319,90 @@ (when (timerp flush-timer) (cancel-timer flush-timer)) (if (eq (buffer-local-value 'major-mode pbuf) 'fundamental-mode) + ;; FIXME: this cannot be, ess-command changes the filter ;; Just in case if we are in *ess-command* buffer; restart the timer. (process-put proc 'flush-timer (run-at-time .02 nil #'ess--flush-accumulated-output proc)) - (ess-mpi-handle-messages abuf) - (with-current-buffer abuf - (goto-char (point-min)) - (let ((case-fold-search nil)) - (when (re-search-forward "Error\\(:\\| +in\\)" nil t) - (ess-show-buffer (process-buffer proc)))) - (goto-char (point-min)) - ;; First long + + in the output mirrors the sent input by the user and - ;; is unnecessary in nowait case. A single + can be a continuation in - ;; the REPL, thus we check if there is an extra output after the + . - (when nowait - (when (looking-at "\\([+>] \\)\\{2,\\}\n?") - (goto-char (match-end 0)) - (when (eq (point) (point-max)) - ;; if this is the last prompt in the output back-up one prompt - ;; (cannot happen after \n) - (backward-char 2)))) - (let ((do-clean (not (eq visibly t))) - (pos2 (point)) - (pos1 (point)) - (tpos nil) - (prompt nil) - (regexp (if nowait - ;; we cannot disambiguate printed input fields and - ;; prompts in output in this case; match 2+ pluses or - ;; > and 2+ spaces - "\\(^\\([+>] \\)\\{2,\\}\\)\\|\\(> \\) +" - "^\\([+>] \\)+")) - (prev-prompt (process-get proc 'prev-prompt)) - (eol (point-at-eol))) - (while (re-search-forward regexp nil t) - (setq pos1 (match-beginning 0) - tpos (if nowait - (or (match-end 1) (match-end 3)) - (match-end 0))) - ;; for debugging in R:accum window in order to see the pointer moving - ;; (set-window-point (get-buffer-window) tpos) - (when (> pos1 pos2) - (let ((str (buffer-substring pos2 pos1))) - (comint-output-filter proc (ess--offset-output prev-prompt str)))) - (setq pos2 tpos) - (setq prompt (let ((prompt (buffer-substring pos1 pos2))) - (if do-clean - (ess--replace-long+-in-prompt prompt (eq pos2 (point-max))) - prompt))) - ;; Cannot bypass this trivial call to comint-output-filter because - ;; external tools could rely on prompts (org-babel [#598] for - ;; example). Setting dummy regexp in order to avoid comint erasing - ;; this prompt which contrasts to how we output prompts in all - ;; other cases. - (with-current-buffer pbuf - (let ((comint-prompt-regexp "^$")) - (comint-output-filter proc prompt))) - (setq prev-prompt (and do-clean prompt) - pos1 pos2)) - ;; insert last chunk if any - (unless (eq pos1 (point-max)) - (let ((str (buffer-substring-no-properties pos1 (point-max)))) - (comint-output-filter proc (ess--offset-output prev-prompt str)) - (setq prev-prompt nil))) - (process-put proc 'prev-prompt prev-prompt) - (process-put proc 'flush-time (and (process-get proc 'busy) - (float-time))) - (erase-buffer))))))) + ;; Incomplete mpi should hardly happen. Only on those rare occasions + ;; when an mpi is issued after a long task and split by the Emacs input + ;; handler, or mpi printing itself takes very long. + (unless (eq :incomplete (ess-mpi-handle-messages abuf)) + (with-current-buffer abuf + ;; Uncomment this line when debugging. This pops up the + ;; accumulation buffer and causes point to follow + ;; automatically as the parsing progresses. + ;; (pop-to-buffer (current-buffer)) + (goto-char (point-min)) + (let ((case-fold-search nil)) + (when (re-search-forward "Error\\(:\\| +in\\)" nil t) + (unless (get-buffer-window pbuf 'visible) + (setq next-error-last-buffer pbuf) + (display-buffer pbuf nil t)))) + (goto-char (point-min)) + ;; First long + + in the output mirrors the sent input by the user and + ;; is unnecessary in nowait case. A single + can be a continuation in + ;; the REPL, thus we check if there is an extra output after the + . + (when nowait + (when (looking-at "\\([+>] \\)\\{2,\\}\n?") + (goto-char (match-end 0)) + (when (eq (point) (point-max)) + ;; if this is the last prompt in the output back-up one prompt + ;; (cannot happen after \n) + (backward-char 2)))) + (let ((do-clean (not (eq visibly t))) + (pos2 (point)) + (pos1 (point)) + (tpos nil) + (prompt nil) + (regexp (if nowait + ;; we cannot disambiguate printed input fields and + ;; prompts in output in this case; match 2+ pluses or + ;; > and 2+ spaces + "\\(^\\([+>] \\)\\{2,\\}\\)\\|\\(> \\) +" + "^\\([+>] \\)+")) + (prev-prompt (process-get proc 'prev-prompt))) + (while (re-search-forward regexp nil t) + (setq pos1 (match-beginning 0) + tpos (if nowait + (or (match-end 1) (match-end 3)) + (match-end 0))) + (when (> pos1 pos2) + (let ((str (buffer-substring pos2 pos1))) + (comint-output-filter proc (ess--offset-output prev-prompt str)))) + (setq pos2 tpos) + (setq prompt (let ((prompt (buffer-substring pos1 pos2))) + (if do-clean + (ess--replace-long+-in-prompt proc prompt (eq pos2 (point-max))) + prompt))) + ;; Cannot bypass this trivial call to comint-output-filter because + ;; external tools could rely on prompts (org-babel [#598] for + ;; example). Setting dummy regexp in order to avoid comint erasing + ;; this prompt which contrasts to how we output prompts in all + ;; other cases. + (with-current-buffer pbuf + (let ((comint-prompt-regexp "^$")) + (comint-output-filter proc prompt))) + (setq prev-prompt (and do-clean prompt) + pos1 pos2)) + ;; insert last chunk if any + (unless (eq pos1 (point-max)) + (let ((str (buffer-substring-no-properties pos1 (point-max)))) + (comint-output-filter proc (ess--offset-output prev-prompt str)) + (setq prev-prompt nil))) + (process-put proc 'prev-prompt prev-prompt) + (process-put proc 'flush-time (and (process-get proc 'busy) + (float-time))) + (erase-buffer)))))))) (defun inferior-ess-tracebug-output-filter (proc string) - "Standard output filter for the inferior ESS process when `ess-debug' is active. -Call `inferior-ess-output-filter'. Check for debug + "Standard output filter for the inferior ESS process. +When `ess-debug' is active, this is the filter. Call +`inferior-ess-output-filter'. Check for debug reg-expressions (see `ess--dbg-regexp-debug',...), when found puts iESS in the debugging state. If in debugging state, mirrors the output into *ess.dbg* buffer." - (let* ((is-iess (member major-mode (list 'inferior-ess-mode 'ess-watch-mode))) + (let* ((is-iess (or (derived-mode-p 'ess-watch-mode) + (derived-mode-p 'inferior-ess-mode))) (pbuf (process-buffer proc)) (abuf (ess--accumulation-buffer proc)) (dbuff (process-get proc 'dbg-buffer)) @@ -1436,7 +1418,7 @@ (string-match ess--dbg-regexp-skip string) (not (string-match ess--dbg-regexp-no-skip string)))) (match-dbg (or match-skip (and match-input (not match-selection)))) - (is-ready (not (inferior-ess-set-status proc string))) + (is-ready (inferior-ess--set-status proc string)) (new-time (float-time)) (last-time (process-get proc 'flush-time)) (flush-timer (process-get proc 'flush-timer))) @@ -1449,7 +1431,7 @@ (if (or (process-get proc 'suppress-next-output?) ess--suppress-next-output?) - ;; works only for surpressing short output, enough for now (for callbacks) + ;; works only for suppressing short output, enough for now (for callbacks) (process-put proc 'suppress-next-output? nil) (with-current-buffer abuf @@ -1472,18 +1454,17 @@ (if (or ;; theoretically we should flush asynchronously in all cases but ;; somewhat unexpectedly it introduces much more randomness during - ;; batch testing. todo: flush directly for now and either remove or + ;; batch testing. TODO: flush directly for now and either remove or ;; improve on the next refactoring iteration fast-flush (> (- new-time last-time) .5) - (and (boundp 'edebug-mode) edebug-mode) + (bound-and-true-p edebug-mode) ;; the flush is not getting called if the third party call ;; accept-process-output in a loop (e.g. org-babel-execute-src-block) - (and (boundp 'org-babel-current-src-block-location) - org-babel-current-src-block-location)) + (bound-and-true-p org-babel-current-src-block-location)) (ess--flush-accumulated-output proc) - ;; setup new flush timer; ideally also for fast-flush cased in order - ;; to avoid detecting intermediate prompts as end-of-output prompts + ;; Setup new flush timer. Ideally also for fast-flush case in order to + ;; avoid detecting intermediate prompts as end-of-output prompts. (let ((timeout (if fast-flush .01 .2))) (process-put proc 'flush-timer (run-at-time timeout nil #'ess--flush-accumulated-output proc)))))) @@ -1529,21 +1510,21 @@ (message (ess--debug-keys-message-string)) (unless match-jump - ;; no source reference, simply show the inferiro - (ess-show-buffer pbuf))) + ;; no source reference, simply show the inferior + (display-buffer pbuf))) - (when match-selection ;(and (not was-in-recover) match-selection) + (when (and match-selection (not is-iess)) ;(and (not was-in-recover) match-selection) (ess-electric-selection t)))) (defvar ess-debug-minor-mode-map (let ((map (make-sparse-keymap))) - (define-key map (kbd "M-C") 'ess-debug-command-continue) - (define-key map [(control meta ?C)] 'ess-debug-command-continue-multi) - (define-key map (kbd "M-N") 'ess-debug-command-next) - (define-key map [(control meta ?N)] 'ess-debug-command-next-multi) - (define-key map (kbd "M-Q") 'ess-debug-command-quit) - (define-key map (kbd "M-U") 'ess-debug-command-up) + (define-key map (kbd "M-C") #'ess-debug-command-continue) + (define-key map [(control meta ?C)] #'ess-debug-command-continue-multi) + (define-key map (kbd "M-N") #'ess-debug-command-next) + (define-key map [(control meta ?N)] #'ess-debug-command-next-multi) + (define-key map (kbd "M-Q") #'ess-debug-command-quit) + (define-key map (kbd "M-U") #'ess-debug-command-up) map) "Keymap active when ESS process is in debugging state. \\{ess-debug-minor-mode-map}") @@ -1555,12 +1536,11 @@ :keymap ess-debug-minor-mode-map) (defun ess--dbg-goto-last-ref-and-mark (dbuff &optional other-window) - "Open the most recent debug reference, and set all the necessary marks and overlays. + "Open the most recent debug reference and set the necessary marks and overlays. It's called from `inferior-ess-tracebug-output-filter'. DBUFF must be the *ess.dbg* buffer associated with the process. If OTHER-WINDOW is non nil, attempt to open the location in a different window." - (interactive) (let (t-debug-position ref) (with-current-buffer dbuff (setq ref (ess--dbg-get-next-ref -1 (point-max) ess--dbg-last-ref-marker @@ -1600,19 +1580,19 @@ (lpn ess-local-process-name)) (when mrk (let ((buf (marker-buffer mrk))) - (if (not other-window) - (switch-to-buffer buf) - (let ((this-frame (window-frame (get-buffer-window (current-buffer))))) - (display-buffer buf) - ;; simple save-frame-excursion - (unless (eq this-frame (window-frame (get-buffer-window buf t))) - (ess-select-frame-set-input-focus this-frame)))) - ;; set or re-set to lpn as this is the process with debug session on - (with-current-buffer buf - (setq ess-local-process-name lpn) - (goto-char mrk) + (if (not other-window) + (pop-to-buffer-same-window buf) + (let ((this-frame (window-frame (get-buffer-window (current-buffer))))) + (display-buffer buf) + ;; simple save-frame-excursion + (unless (eq this-frame (window-frame (get-buffer-window buf t))) + (ess-select-frame-set-input-focus this-frame)))) + ;; set or re-set to lpn as this is the process with debug session on + (with-current-buffer buf + (setq ess-local-process-name lpn) + (goto-char mrk) (set-window-point (get-buffer-window buf) mrk)) - buf)))) + buf)))) ;; temporary, hopefully org folks implement something similar (defvar org-babel-tangled-file nil) @@ -1651,66 +1631,69 @@ (if col (goto-char (+ (point-at-bol) col)) (back-to-indentation)) - (when (and (boundp 'org-babel-tangled-file) - org-babel-tangled-file) + (when (bound-and-true-p org-babel-tangled-file) (org-babel-tangle-jump-to-org)) (list (point-marker) (copy-marker (point-at-eol)))))))))) +(defvar ess-r-package-library-paths) (defun ess--dbg-find-buffer (filename) "Find a buffer for file FILENAME. 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'." +`ess-tracebug-search-path' and `ess-r-package-library-paths'." (let ((dirs (append (ess-r-package-source-dirs) - (cl-loop for d in ess-tracebug-search-path + ess-r-package-library-paths + (cl-loop for d in (append 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 - (when (and buffer-file-name - (or (and (file-name-absolute-p filename) - (string-match (format "%s\\'" filename) buffer-file-name)) - (equal filename (file-name-nondirectory buffer-file-name)))) - (setq buffer bf) - (cl-return)))) - ;; 2. The file name is absolute. Use its explicit directory as + (filematch (format "%s\\'" filename)) + buffer name) + (setq dirs (delq nil (cons (with-ess-process-buffer t default-directory) dirs))) + ;; 1. The file name is absolute. Use its explicit directory as ;; the first in the search path, and strip it from FILENAME. (when (and (null buffer) (file-name-absolute-p filename)) (setq filename (abbreviate-file-name (expand-file-name filename)) dirs (cons (file-name-directory filename) dirs) filename (file-name-nondirectory filename))) - ;; 3. Now search the path. - (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) - (save-excursion ;This save-excursion is probably not right. - (let* ((pop-up-windows t) - (name (read-file-name - (format "Find next line in (default %s): " filename) - nil filename t nil)) - (origname name)) - (cond - ((not (file-exists-p name)) - (message "Cannot find file `%s'" name) - (ding) (sit-for 2)) - ((and (file-directory-p name) - (not (file-exists-p - (setq name (expand-file-name filename name))))) - (message "No `%s' in directory %s" filename origname) - (ding) (sit-for 2)) - (t - (setq buffer (find-file-noselect name))))))) - ;; nil if not found - buffer)) + (or + ;; 2. Search the path. + (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))))) + buffer + + ;; 3. search already open buffers for match (associated file might not even exist yet) + (cl-dolist (bf (buffer-list)) + (with-current-buffer bf + (when (and buffer-file-name + (string-match filematch buffer-file-name)) + (setq buffer bf) + (cl-return)))) + buffer + + ;; 4. Ask for file if not found (tothink: maybe remove this part?) + (when ess-debug-ask-for-file + (save-excursion ;This save-excursion is probably not right. + (let* ((pop-up-windows t) + (name (read-file-name + (format "Find next line in (default %s): " filename) + nil filename t nil)) + (origname name)) + (cond + ((not (file-exists-p name)) + (message "Cannot find file `%s'" name) + (ding) (sit-for 2)) + ((and (file-directory-p name) + (not (file-exists-p + (setq name (expand-file-name filename name))))) + (message "No `%s' in directory %s" filename origname) + (ding) (sit-for 2)) + (t + (setq buffer (find-file-noselect name))))))) + buffer))) (defun ess--dbg-get-next-ref (n &optional pt BOUND REG nF nL nC) "Move point to the next reference in the *ess.dbg* buffer. @@ -1722,10 +1705,9 @@ if non-nil, specifies the value of point to start looking for the next message, default to (point). BOUND is the limiting position of the search. REG is the regular expression to search with. nF -- sub-expression of REG giving the 'file'; defaults to 1. nL - -giving the 'line'; defaults to 2. nC - sub-expr giving the -'column'; defaults to 3." - (interactive "p") +- sub-expression of REG giving the `file'; defaults to 1. nL - +giving the `line'; defaults to 2. nC - sub-expr giving the +`column'; defaults to 3." (unless ess--dbg-buf-p (error "Not in *ess.dbg* buffer")) (setq nF (or nF 1) @@ -1738,47 +1720,6 @@ (list (match-string nF) (match-string-no-properties nL) (match-string-no-properties nC)) nil)) -(defun ess--dbg-next-ref-function (n &optional reset) - "Advance to the next reference and visit the location given by the reference. -This is the value of `next-error-function' in *ess.dbg* buffers." - (interactive "p") - (if reset - (set-marker ess--dbg-current-ref ess--dbg-last-ref-marker)) - (let ((loc (ess--dbg-get-next-ref n nil ess--dbg-current-ref)) ;; moves point to next/prev ref if any - ; loc is (file . line_nr) - dbuff) - (if loc - (progn - (set-marker ess--dbg-current-ref (line-end-position)) - (set-marker overlay-arrow-position (line-beginning-position)) - (setq dbuff (ess--dbg-find-buffer (car loc))) - (switch-to-buffer dbuff) - (save-restriction - (widen) - (goto-char 1) - (forward-line (1- (cdr loc)))) - (move-marker ess--dbg-current-debug-position (line-beginning-position)) ; move the overlay-arrow - (back-to-indentation)) - (if (>= 0 (or n 1)) - (error "Moved past first debug line") - (error "Moved past last debug line"))))) - - -;; not used; remove in 13.09 -(defvar ess-electric-debug-map - (let ((map (make-sparse-keymap))) - (define-key map "c" 'ess-debug-command-continue) - (define-key map "C" 'ess-debug-command-continue-multi) - (define-key map "n" 'ess-debug-command-next) - (define-key map "N" 'ess-debug-command-next-multi) - (define-key map "q" 'ess-debug-command-quit) - (define-key map "u" 'ess-debug-command-up) - map) - "Keymap used to define commands for single key input mode. -This commands are triggered by `ess-electric-debug' . -\\{ess-electric-debug-map}") -(make-obsolete-variable 'ess-electric-debug-map nil "ESS 13.05") - (defun ess--debug-keys-message-string (&optional map) (let ((overriding-local-map (or map ess-debug-minor-mode-map))) (substitute-command-keys @@ -1791,48 +1732,18 @@ "(\\[ess-debug-command-quit])quit") " ")))) -;; not used anywhere; remove in ESS 13.09 -(defun ess-electric-debug (&optional wait) - "Call commands defined in `ess-electric-debug-map'. -Single-key input commands are those that once invoked do not -requre the prefix command for subsequent invocation. - -For example, if the prefix key is 'C-c C-t' and -`ess-debug-command-next' is bound to 'n' and `ess-debug-command-continue' is -bound to 'c' then 'C-c C-t n n c' executes `ess-debug-command-next' -twice and `ess-debug-command-continue' once. Any other input not defined -in `ess-electric-debug-map' will cause the exit from single-key -input mode. - -If WAIT is t, wait for next input and ignore the keystroke which -triggered the command." - (interactive) - (let ((help-mess (ess--debug-keys-message-string - ess-electric-debug-map))) - (ess--execute-electric-command - ess-electric-debug-map help-mess wait - (not (ess-process-get 'dbg-active))))) - -(define-obsolete-function-alias - 'ess-singlekey-debug 'ess-electric-debug "ESS 13.05") -(make-obsolete 'ess-electric-debug nil "ESS 13.05") - (defun ess-electric-selection (&optional wait) "Call commands defined in `ess-electric-selection-map'. Single-key input commands are those, which once executed do not -requre the prefix command for subsequent invocation. See -`ess-electric-debug' for more. +require the prefix command for subsequent invocation. If WAIT is t, wait for next input and ignore the keystroke which triggered the command." - (interactive) (ess--execute-electric-command ess-electric-selection-map "Selection: " wait (not (ess-process-get 'is-recover)))) -(make-obsolete 'ess-singlekey-selection 'ess-electric-selection "ESS 13.05") - (defun ess-debug-command-digit (&optional ev) "Digit commands in selection mode. If supplied, EV must be a proper key event or a string representing the digit." @@ -1863,9 +1774,9 @@ (ess-send-string proc ev-char) (move-marker (process-mark proc) (max-char))))) -(defun ess-debug-command-next (&optional ev) +(defun ess-debug-command-next () "Step next in debug mode. -Equivalent to 'n' at the R prompt." +Equivalent to `n' at the R prompt." (interactive) (ess-force-buffer-current) (unless (ess--dbg-is-active-p) @@ -1874,7 +1785,7 @@ (ess-send-string (ess-get-process) "0") (ess-send-string (ess-get-process) "n"))) -(defun ess-debug-command-next-multi (&optional ev N) +(defun ess-debug-command-next-multi (&optional N) "Ask for N and step (n) N times in debug mode." (interactive) (ess-force-buffer-current) @@ -1888,7 +1799,7 @@ (setq N (1- N)))) (ess-debug-command-next)) -(defun ess-debug-command-continue-multi (&optional ev N) +(defun ess-debug-command-continue-multi (&optional N) "Ask for N, and continue (c) N times in debug mode." (interactive) (ess-force-buffer-current) @@ -1902,9 +1813,8 @@ (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." +(defun ess-debug-command-up () + "Step up one call frame.." (interactive) (ess-force-buffer-current) (unless (ess--dbg-is-active-p) @@ -1919,21 +1829,21 @@ ;; (interactive) ;; (previous-error)) -(defun ess-debug-command-quit (&optional ev) +(defun ess-debug-command-quit () "Quits the browser/debug in R process. Equivalent of `Q' at the R prompt." (interactive) (ess-force-buffer-current) (cond ((ess--dbg-is-recover-p) (ess-send-string (ess-get-process) "0" t)) - ;; if recover is called in a loop the following stalls emacs + ;; if recover is called in a loop the following stalls Emacs ;; (ess-wait-for-process proc nil 0.05) ((ess--dbg-is-active-p) (ess-send-string (ess-get-process) "Q" t)) (t (error "Debugger is not active")))) -(defun ess-debug-command-continue (&optional ev) +(defun ess-debug-command-continue () "Continue the code execution. Equivalent of `c' at the R prompt." (interactive) @@ -1945,7 +1855,7 @@ (t (error "Debugger is not active")))) -(defun ess-tracebug-set-last-input (&rest ARGS) +(defun ess-tracebug-set-last-input (&rest _args) "Move `ess--tb-last-input' marker to the process mark. ARGS are ignored to allow using this function in process hooks." (let* ((last-input-process (get-process ess-local-process-name)) @@ -1980,7 +1890,7 @@ (((class color) (background dark) (min-colors 88)) (:foreground "deep sky blue")) (((background light) (min-colors 8)) (:foreground "blue")) (((background dark) (min-colors 8)) (:foreground "cyan"))) - "Face used to highlight 'browser' breakpoints." + "Face used to highlight `browser' breakpoints." :group 'ess-debug) (defface ess-bp-fringe-recover-face @@ -1988,7 +1898,7 @@ (((class color) (background dark) (min-colors 88)) (:foreground "magenta")) (((background light) (min-colors 8)) (:foreground "magenta")) (((background dark) (min-colors 8)) (:foreground "magenta"))) - "Face used to highlight 'recover' breakpoints fringe." + "Face used to highlight `recover' breakpoints fringe." :group 'ess-debug) (defun ess--bp-pipe-block-p () @@ -1997,11 +1907,20 @@ (inhibit-field-text-motion t)) (forward-line -1) (end-of-line) - (looking-back "\\%>\\%[ \t]*" (point-at-bol))))) + (looking-back "%>%[ \t]*" (point-at-bol))))) + +(defun ess--bp-pipe-native-block-p () + (save-excursion + (let ((inhibit-point-motion-hooks t) + (inhibit-field-text-motion t)) + (forward-line -1) + (end-of-line) + (looking-back "|>[ \t]*" (point-at-bol))))) (defvar ess--bp-identifier 1) (defcustom ess-bp-type-spec-alist '((pipe ".ess_pipe_browser() %%>%%" "B %>%\n" filled-square ess-bp-fringe-browser-face ess--bp-pipe-block-p) + (pipe-native ".ess_pipe_browser() |>" "B |>\n" filled-square ess-bp-fringe-browser-face ess--bp-pipe-native-block-p) (browser "browser(expr=is.null(.ESSBP.[[%s]]));" "B>\n" filled-square ess-bp-fringe-browser-face) (recover "recover()" "R>\n" filled-square ess-bp-fringe-recover-face)) "List of lists of breakpoint types. @@ -2011,7 +1930,8 @@ 3- string to be displayed instead of the expression 4- fringe bitmap to use 5- face for fringe and displayed string -6- optional, a function which should return nil if this BP doesn't apply to current context." +6- optional, a function which should return nil if this BP + doesn't apply to current context." :group 'ess-debug :type '(alist :key-type symbol :value-type (group string string symbol face))) @@ -2078,9 +1998,7 @@ (setq ess--bp-identifier (1+ ess--bp-identifier)))) (bp-command (concat (format (nth 1 bp-specs) bp-id) "##:ess-bp-end:##\n")) - (bp-length (length bp-command)) (dummy-string (format "##:ess-bp-start::%s@%s:##\n" (car bp-specs) condition)) - (dummy-length (length dummy-string)) insertion-pos) (when bp-specs (set-marker init-pos (1+ init-pos)) @@ -2091,15 +2009,15 @@ 'ess-bp t 'bp-id bp-id 'bp-active t - 'intangible 'ess-bp - 'rear-nonsticky '(intangible ess-bp bp-type) + 'cursor-intangible 'ess-bp + 'rear-nonsticky '(cursor-intangible ess-bp bp-type) 'bp-type type 'bp-substring 'command 'display displ-string)) (setq dummy-string (propertize (ess-tracebug--propertize dummy-string fringe-bitmap fringe-face "*") 'ess-bp t - 'intangible 'ess-bp + 'cursor-intangible 'ess-bp 'bp-type type 'bp-substring 'dummy)) (ess-tracebug--set-left-margin) @@ -2115,6 +2033,7 @@ (save-excursion (save-restriction (with-silent-modifications + (cursor-intangible-mode) (widen) (goto-char (point-min)) (while (re-search-forward @@ -2145,8 +2064,8 @@ (add-text-properties comm-beg comm-end (list 'ess-bp t 'bp-id bp-id - 'intangible 'ess-bp - 'rear-nonsticky '(intangible ess-bp bp-type) + 'cursor-intangible 'ess-bp + 'rear-nonsticky '(cursor-intangible ess-bp bp-type) 'bp-type type 'bp-substring 'command 'display displ-string)) @@ -2160,20 +2079,20 @@ (add-text-properties dum-beg dum-end (append dum-props (list 'ess-bp t - 'intangible 'ess-bp + 'cursor-intangible 'ess-bp 'bp-type type 'bp-substring 'dummy))) ;; (when comment-beg ;; (add-text-properties comment-beg comment-end ;; (list 'ess-bp t ;; 'bp-id bp-id - ;; 'intangible 'ess-bp + ;; 'cursor-intangible 'ess-bp ;; 'display (propertize (nth 1 ess-bp-inactive-spec) 'face fringe-face) ;; 'bp-type type ;; 'bp-substring 'comment))) )))))))) -(add-hook 'R-mode-hook 'ess-bp-recreate-all) +(add-hook 'ess-r-mode-hook 'ess-bp-recreate-all) (defun ess-bp-get-bp-position-nearby () @@ -2190,7 +2109,7 @@ (pos-start (if (get-char-property (point) 'ess-bp) ;;check for bobp (point) (next-single-property-change (point) 'ess-bp nil (window-end)))) - pos dist-up dist-down) + dist-up dist-down) (unless (eq pos-end (window-start)) (setq dist-up (- (line-number-at-pos (point)) (line-number-at-pos pos-end)))) @@ -2274,7 +2193,7 @@ (if (null pos) (if interactive? (message "No breakpoints nearby")) (if (eq (point) (point-at-eol)) - (goto-char (1- (point)))) ;; work-arround for issue 3 + (goto-char (1- (point)))) ;; work-around for issue 3 (set-marker init-pos (point)) (goto-char (car pos)) (delete-region (car pos) (cdr pos)) @@ -2320,8 +2239,8 @@ (save-excursion (let ((pos (ess-bp-get-bp-position-nearby)) (fringe-face (nth 3 ess-bp-inactive-spec)) - (inhibit-point-motion-hooks t) ;; deactivates intangible property - bp-id beg-pos-dummy end-pos-comment bp-specs beg-pos-command) + (cursor-sensor-inhibit 'ess-bp-toggle-state) + bp-id bp-specs beg-pos-command) (if (null pos) (message "No breakpoints in the visible region") (goto-char (car pos)) @@ -2344,7 +2263,7 @@ (ess-command (format ".ESSBP.[[%s]] <- NULL\n" bp-id)) ;; (insert (propertize "##" ;; 'ess-bp t - ;; 'intangible 'ess-bp + ;; 'cursor-intangible 'ess-bp ;; 'display (propertize (nth 1 ess-bp-inactive-spec) 'face fringe-face) ;; 'bp-type (get-char-property (point) 'bp-type) ;; 'bp-substring 'comment)) @@ -2362,13 +2281,11 @@ (defun ess-bp-next nil "Goto next breakpoint." (interactive) - (let ((cur-pos (point)) - (bp-pos (next-single-property-change (point) 'ess-bp))) - (when bp-pos - (save-excursion - (goto-char bp-pos) - (when (get-text-property (1- (point)) 'ess-bp) - (setq bp-pos (next-single-property-change bp-pos 'ess-bp))))) + (when-let ((bp-pos (next-single-property-change (point) 'ess-bp))) + (save-excursion + (goto-char bp-pos) + (when (get-text-property (1- (point)) 'ess-bp) + (setq bp-pos (next-single-property-change bp-pos 'ess-bp)))) (if bp-pos (goto-char bp-pos) (message "No breakpoints found")))) @@ -2377,13 +2294,10 @@ (defun ess-bp-previous nil "Goto previous breakpoint." (interactive) - (let ((cur-pos (point)) - (bp-pos (previous-single-property-change (point) 'ess-bp))) - (if bp-pos - (goto-char (or (previous-single-property-change bp-pos 'ess-bp) - bp-pos)) - ;; - (message "No breakpoints before the point found")))) + (if-let ((bp-pos (previous-single-property-change (point) 'ess-bp))) + (goto-char (or (previous-single-property-change bp-pos 'ess-bp) + bp-pos)) + (message "No breakpoints before the point found"))) ;;;_ + WATCH @@ -2391,7 +2305,7 @@ ;; assumes that every expression is a structure of length 1 as returned by parse. ".ess_watch_eval()\n") -(if (fboundp 'define-fringe-bitmap) ;;not clear to me why is this not bound in SSH session? - :todo check +(if (fboundp 'define-fringe-bitmap) ;;not clear to me why is this not bound in SSH session? - :TODO check (define-fringe-bitmap 'current-watch-bar [#b00001100] nil nil '(top t))) @@ -2402,67 +2316,56 @@ (setq left-margin-width 1) (set-window-buffer (selected-window) (current-buffer))))) -(defun ess-watch-mode () - "Major mode in `ess-watch' window. -\\{ess-watch-mode-map}" +(define-derived-mode ess-watch-mode special-mode "ESS watch" + "Major mode in `ess-watch' window." + :group 'ess-tracebug (let ((cur-block (max 1 (ess-watch-block-at-point))) (dummy-string (ess-tracebug--propertize "|" 'current-watch-bar 'font-lock-keyword-face))) - (kill-all-local-variables) (ess-tracebug--set-left-margin) - (make-local-variable 'revert-buffer-function) - (setq revert-buffer-function 'ess-watch-revert-buffer) - (use-local-map ess-watch-mode-map) - (setq major-mode 'ess-watch-mode) - (setq mode-name (concat "watch " ess-current-process-name)) + (setq-local revert-buffer-function 'ess-watch-revert-buffer) (turn-on-font-lock) (setq ess-watch-current-block-overlay (make-overlay (point-min) (point-max))) (overlay-put ess-watch-current-block-overlay 'line-prefix dummy-string) (overlay-put ess-watch-current-block-overlay 'face 'ess-watch-current-block-face) (ess-watch-set-current cur-block) ;; - (when (require 'face-remap nil t) - ;; scale the font - (setq text-scale-mode-amount ess-watch-scale-amount) - (text-scale-mode 1) ; (text-scale-mode -1) ;;restore to default - ))) + (require 'face-remap) + ;; scale the font + (setq text-scale-mode-amount ess-watch-scale-amount) + (text-scale-mode))) (defun ess-watch () - "Run `ess-watch' mode on R objects. + "Run `ess-watch-mode' on R objects. This is the trigger function. See documentation of -`ess-watch-mode' for more information. - -\\{ess-watch-mode-map}" +`ess-watch-mode' for more information." (interactive) (ess-force-buffer-current) (let ((wbuf (get-buffer-create ess-watch-buffer)) - (pname ess-local-process-name) - (alist (symbol-value ess-local-customize-alist))) - (set-buffer wbuf) - (ess-setq-vars-local alist) + (pname ess-local-process-name)) + (pop-to-buffer wbuf + ;; not strongly dedicated + '(nil . ((dedicated . 1)))) (setq ess-local-process-name pname) (ess-watch-mode) - (ess-watch-refresh-buffer-visibly wbuf) ;; evals the ess-command and displays the buffer if not visible - (pop-to-buffer wbuf) - (set-window-dedicated-p (selected-window) 1) ;; not strongly dedicated - )) + ;; evals the ess-command and displays the buffer if not visible + (ess-watch-refresh-buffer-visibly wbuf))) (defun ess-watch-refresh-buffer-visibly (wbuf &optional sleep no-prompt-check) "Eval `ess-watch-command' and direct the output into the WBUF. Call `ess-watch-buffer-show' to make the buffer visible, without -selecting it. +selecting it. SLEEP and NO-PROMPT-CHECK get passed to `ess-command'. This function is used for refreshing the watch window after each step during the debugging." ;; assumes that the ess-watch-mode is on!! ;; particularly ess-watch-current-block-overlay is installed - (interactive) (ess-watch-buffer-show wbuf) ;; if visible do nothing (let ((pname ess-local-process-name)) ;; watch might be used from different dialects, need to reset (with-current-buffer wbuf - (let ((curr-block (max 1 (ess-watch-block-at-point)))) ;;can be 0 if - (setq buffer-read-only nil) + (let ((curr-block (max 1 (ess-watch-block-at-point))) ;;can be 0 if + (inhibit-read-only t)) (when pname (setq ess-local-process-name pname)) (ess-command ess-watch-command wbuf sleep no-prompt-check) @@ -2470,11 +2373,10 @@ (goto-char (point-min)) (delete-region (point-at-bol) (+ 1 (point-at-eol))) (ess-watch-set-current curr-block) - (set-window-point (get-buffer-window wbuf) (point)) - (setq buffer-read-only t))))) + (set-window-point (get-buffer-window wbuf) (point)))))) (defun ess-watch-buffer-show (buffer-or-name) - "Make watch buffer BUFFER-OR-NAME visible, and position acordingly. + "Make watch buffer BUFFER-OR-NAME visible, and position accordingly. If already visible, do nothing. Currently the only positioning rule implemented is to split the R @@ -2498,7 +2400,7 @@ ))))) -(defun ess-watch-revert-buffer (ignore noconfirm) +(defun ess-watch-revert-buffer (_ignore _noconfirm) "Update the watch buffer. Arguments IGNORE and NOCONFIRM currently not used." (ess-watch) @@ -2522,16 +2424,6 @@ ;; :type 'string ) -(defvar ess-watch-help nil - "Keymap for the *R watch* buffer. - -\\{ess-watch-mode-map}") - -(defun ess-watch-help () - "Help on `ess-watch'." - (interactive) - (describe-variable 'ess-watch-help)) - (defun ess-watch-block-limits-at-point () "Return start and end positions of the watch block." (interactive) @@ -2593,8 +2485,10 @@ wal))) (defun ess-watch--parse-assoc (al) - "Return a string of the form 'assign(\".ess_watch_expressions\", list(a = parse(expr_a), b= parse(expr_b)), envir = .GlobalEnv)' -ready to be send to R process. AL is an association list as return by `ess-watch--make-alist'" + "Return a string command ready to be passed to R process. +The command is of the form `assign(\".ess_watch_expressions\", +list(a = parse(expr_a), b= parse(expr_b)), envir = .GlobalEnv)'. +AL is an association list as return by `ess-watch--make-alist'" (concat ".ess_watch_assign_expressions(list(" (mapconcat (lambda (el) (if (> (length (cadr el) ) 0) @@ -2611,7 +2505,7 @@ (interactive) (process-send-string (ess-get-process ess-current-process-name) (ess-watch--parse-assoc (ess-watch--make-alist))) - ;;todo: delete the prompt at the end of proc buffer todo: defun ess-send-string!! + ;;TODO: delete the prompt at the end of proc buffer TODO: defun ess-send-string!! (sleep-for 0.05) ;; need here, if ess-command is used immediately after, for some weird reason the process buffer will not be changed ) @@ -2667,7 +2561,7 @@ (setq start (match-beginning 1)) (setq end (match-end 1)) (goto-char start) - ;; todo: highlight the name in R-watch here + ;; TODO: highlight the name in R-watch here (setq name (read-string (concat "New name (" name "): ") nil nil name) ) (setq buffer-read-only nil) (delete-region start end) @@ -2690,7 +2584,7 @@ (setq start (match-beginning 1)) (setq end (match-end 1)) (goto-char start) - ;; todo: highlight the name in R-watch here + ;; TODO: highlight the name in R-watch here (setq expr (read-string "New expression: " expr nil expr) ) (setq buffer-read-only nil) (delete-region start end) @@ -2700,7 +2594,7 @@ (ess-watch-refresh-buffer-visibly (current-buffer)))) (defun ess-watch-add () - "Ask for new R expression and name and append it to the end of the list of watch expressions." + "Ask for new R expression and append to the current list of watch expressions." (interactive) (let (nr expr name) (goto-char (point-max)) @@ -2769,12 +2663,12 @@ (defun ess--dbg-get-signatures (method) "Get signatures for the method METHOD." (let ((tbuffer (get-buffer-create " *ess-command-output*")); initial space: disable-undo - signatures curr-point) + signatures) (save-excursion (ess-if-verbose-write (format "ess-get-signatures*(%s).. " method)) (ess-command (concat "showMethods(\"" method "\")\n") tbuffer) - (message ess-local-process-name) - (message ess-current-process-name) + (message "%s" ess-local-process-name) + (message "%s" ess-current-process-name) (ess-if-verbose-write " [ok] ..\n") (set-buffer tbuffer) (goto-char (point-min)) @@ -2784,7 +2678,7 @@ ;; (error "Cannot trace method '%s' (Is it a primitive method which you have already traced?)" method) ) ;; (setq curr-point (point)) - ;; (while (re-search-forward ", " nil t) ;replace all ", " with ":" for better redability in completion buffers?? + ;; (while (re-search-forward ", " nil t) ;replace all ", " with ":" for better readability in completion buffers?? ;; (replace-match ":")) ;; (goto-char curr-point) (while (re-search-forward "^.+$" nil t) @@ -2802,7 +2696,7 @@ (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 (ess-r-package-name)) - (all-functions (ess-get-words-from-vector + (all-functions (ess-get-words-from-vector--foreground (if pkg (format ".ess_all_functions(c('%s'))\n" pkg) ".ess_all_functions()\n"))) @@ -2815,7 +2709,7 @@ (car (sort matches (lambda (a b) (< (length a) (length b)))))))) (ufunc (ess-completing-read "Debug" all-functions nil nil nil nil (or default obj-at-point))) - signature default-string out-message) + signature) ;; FIXME: Most of the following logic should be in R (if (ess-boolean-command (format "as.character(isGeneric('%s'))\n" ufunc)) @@ -2832,7 +2726,7 @@ (ess-command (format "trace('%s', tracer = browser, signature = c('%s'))\n" ufunc signature) tbuffer)) (with-current-buffer tbuffer ;; give appropriate message or error - (message (buffer-substring-no-properties (point-min) (point-max))))) + (message "%s" (buffer-substring-no-properties (point-min) (point-max))))) ;;else, not an S4 generic (when (ess-boolean-command (format "as.character(.knownS3Generics['%s'])\n" ufunc)) @@ -2858,7 +2752,7 @@ (if nil ;; FIXME: was checking `ess-developer-packages` (format ".ess_dbg_getTracedAndDebugged(c('%s'))\n" (mapconcat 'identity ess-developer-packages "', '")) - ".ess_dbg_getTracedAndDebugged()\n"))) + ".ess_dbg_getTracedAndDebugged()\n"))) out-message fun def-val) ;; (prin1 debugged) (if (eq (length debugged) 0) @@ -2871,80 +2765,39 @@ (ess-command (concat ".ess_dbg_UndebugALL(c(\"" (mapconcat 'identity debugged "\", \"") "\"))\n") tbuffer) (ess-command (format ".ess_dbg_UntraceOrUndebug(\"%s\")\n" fun) tbuffer)) (with-current-buffer tbuffer - (if (= (point-max) 1) ;; not reliable todo: + (if (= (point-max) 1) ;; not reliable TODO: (setq out-message (format "Undebugged '%s' " fun)) (setq out-message (buffer-substring-no-properties (point-min) (point-max))) ;; untrace info or warning, or error occurred ))) - (message out-message))) + (message "%s" out-message))) ;;;_ * Kludges and Fixes ;;; delete-char and delete-backward-car do not delete whole intangible text -(defadvice delete-char (around ess-delete-backward-char-intangible activate) +(defun ess--tracebug-delete-char (n &rest _) "When deleting an intangible char, delete the whole intangible region. -Only do this when #chars is 1" - (if (and (eq major-mode 'ess-mode) - (= (ad-get-arg 0) 1) - (get-text-property (point) 'intangible)) - (progn - (kill-region (point) (or (next-single-property-change (point) 'intangible) - (point-max))) - (indent-for-tab-command)) - ad-do-it)) +Only do this when N is 1" + (when (and (ess-derived-mode-p) + (= n 1) + (get-text-property (point) 'cursor-intangible)) + (kill-region (point) (or (next-single-property-change (point) 'cursor-intangible) + (point-max))) + (indent-according-to-mode))) -(defadvice delete-backward-char (around ess-delete-backward-char-intangible activate) +(advice-add 'delete-char :before-until #'ess--tracebug-delete-char) + +(defun ess--tracebug-delete-backward-char (n &rest _) "When deleting an intangible char, delete the whole intangible region. -Only do this when called interactively and #chars is 1" - (if (and (eq major-mode 'ess-mode) - (= (ad-get-arg 0) 1) - (> (point) (point-min)) - (get-text-property (1- (point)) 'intangible)) - (progn - (let ((beg (or (previous-single-property-change (point) 'intangible) - (point-min)))) - (kill-region beg (point)))) - ad-do-it)) - -;; reported as bug#21368 - -;; ;; previous-line gets stuck if next char is intangible -;; 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" -;; (when (and (eq major-mode 'ess-mode) -;; (or (null (ad-get-arg 0)) -;; (= (ad-get-arg 0) 1)) -;; (get-text-property (point) 'intangible)) -;; (goto-char (1- (point)))) -;; ad-do-it) - -;; (ad-remove-advice 'previous-line 'around 'ess-fix-cursor-stuck-at-intangible-text) - -(make-obsolete-variable 'ess-dbg-blink-ref-not-found-face 'ess-debug-blink-ref-not-found-face "ESS 13.05") -(make-obsolete-variable 'ess-dbg-blink-same-ref-face 'ess-debug-blink-same-ref-face "ESS 13.05") -(make-obsolete-variable 'ess-dbg-current-debug-line-face 'ess-debug-current-debug-line-face "ESS 13.05") -(make-obsolete-variable 'ess-dbg-error-action nil "ESS 13.05") -(make-obsolete-variable 'ess-dbg-error-action-alist 'ess-debug-error-action-alist "ESS 13.05") -(make-obsolete-variable 'ess-dbg-blink-interval 'ess-debug-blink-interval "ESS 13.05") -(make-obsolete-variable 'ess-dbg-indicator 'ess-debug-indicator "ESS 13.05") -(make-obsolete-variable 'ess-dbg-ask-for-file 'ess-debug-ask-for-file "ESS 13.05") -(make-obsolete 'ess-dbg-set-error-action 'ess-debug-set-error-action "ESS 13.05") -(make-obsolete 'ess-dbg-toggle-error-action 'ess-debug-toggle-error-action "ESS 13.05") -(make-obsolete 'ess-dbg-goto-input-event-marker 'ess-debug-goto-input-event-marker "ESS 13.05") -(make-obsolete 'ess-dbg-goto-debug-point 'ess-debug-goto-debug-point "ESS 13.05") -(make-obsolete 'ess-dbg-insert-in-forward-ring 'ess-debug-insert-in-forward-ring "ESS 13.05") -(make-obsolete 'ess-dbg-start 'ess-debug-start "ESS 13.05") -(make-obsolete 'ess-dbg-stop 'ess-debug-stop "ESS 13.05") -(make-obsolete 'ess-dbg-command-digit 'ess-debug-command-digit "ESS 13.05") -(make-obsolete 'ess-dbg-command-n 'ess-debug-command-next "ESS 13.05") -(make-obsolete 'ess-dbg-command-Q 'ess-debug-command-quit "ESS 13.05") -(make-obsolete 'ess-dbg-command-c 'ess-debug-command-continue "ESS 13.05") -(make-obsolete 'ess-dbg-flag-for-debugging 'ess-debug-flag-for-debugging "ESS 13.05") -(make-obsolete 'ess-dbg-unflag-for-debugging 'ess-debug-unflag-for-debugging "ESS 13.05") -(make-obsolete-variable 'ess-tb-last-input-fringe-face 'ess-tracebug-last-input-fringe-face "ESS 13.05") -(make-obsolete-variable 'ess-tb-next-error-function 'ess-tracebug-next-error-function "ESS 13.05") +Only do this when called interactively and N is 1" + (when (and (ess-derived-mode-p) + (= n 1) + (> (point) (point-min)) + (get-text-property (1- (point)) 'cursor-intangible)) + (kill-region (or (previous-single-property-change (point) 'cursor-intangible) + (point-min)) + (point)))) + +(advice-add 'delete-backward-char :before-until #'ess--tracebug-delete-backward-char) -(ess-if-verbose-write "\n<- debug done") (provide 'ess-tracebug) ;;; ess-tracebug.el ends here diff -Nru ess-18.10.2/lisp/ess-trns.el ess-18.10.2+git20220915.f45542e/lisp/ess-trns.el --- ess-18.10.2/lisp/ess-trns.el 2018-11-10 09:41:11.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/lisp/ess-trns.el 2022-10-15 08:06:36.000000000 +0000 @@ -1,29 +1,26 @@ -;;; ess-trns.el --- Support for manipulating S transcript files - -;; Copyright (C) 1989--1994 Bates, Kademan, Ritter and Smith -;; Copyright (C) 1997--2010 A.J. Rossini, Richard M. Heiberger, Martin -;; Maechler, Kurt Hornik, Rodney Sparapani, and Stephen Eglen. -;; Copyright (C) 2011--2012 A.J. Rossini, Richard M. Heiberger, Martin Maechler, -;; Kurt Hornik, Rodney Sparapani, Stephen Eglen and Vitalie Spinu. +;;; ess-trns.el --- Support for manipulating S transcript files -*- lexical-binding: t; -*- +;; Copyright (C) 1989-2020 Free Software Foundation, Inc. ;; Author: David Smith ;; Maintainer: ESS-core -;; This file is part of ESS +;; This file is part of GNU Emacs. -;; This file is free software; you can redistribute it and/or modify +;;; License: +;; +;; This program is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 2, or (at your option) -;; any later version. - -;; This file is distributed in the hope that it will be useful, +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. +;; +;; This program is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. - -;; A copy of the GNU General Public License is available at -;; https://www.r-project.org/Licenses/ - +;; +;; You should have received a copy of the GNU General Public License +;; along with this program. If not, see +;; ;;; Commentary: @@ -37,6 +34,8 @@ (require 'ess-inf) (require 'comint) +(declare-function ess-display-help-on-object "ess-help" (object &optional command)) + ; ess-transcript-mode ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;; In this section: @@ -45,58 +44,50 @@ ;;;; * Commands for ess-transcript-mode ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +(defcustom ess-transcript-mode-hook nil + "Hook for customizing ESS transcript mode." + :group 'ess-hooks + :type 'hook) + ;;*;; Major mode definition -(defvar ess-transcript-mode-map nil "Keymap for `ess-transcript-mode'.") -(unless ess-transcript-mode-map - (setq ess-transcript-mode-map (make-sparse-keymap)) - - (define-key ess-transcript-mode-map "\C-c\C-s" 'ess-switch-process) - (define-key ess-transcript-mode-map "\C-c\C-r" 'ess-eval-region) - (define-key ess-transcript-mode-map "\C-c\M-r" 'ess-eval-region-and-go) - ;; (define-key ess-transcript-mode-map "\M-\C-x" 'ess-eval-function) - ;; (define-key ess-transcript-mode-map "\C-c\M-f" 'ess-eval-function-and-go) - ;; (define-key ess-transcript-mode-map "\C-c\C-j" 'ess-eval-line) - ;; (define-key ess-transcript-mode-map "\C-c\M-j" 'ess-eval-line-and-go) - - (define-key ess-transcript-mode-map "\C-c\C-k" 'ess-force-buffer-current) - (define-key ess-transcript-mode-map "\C-c\C-q" 'ess-quit) - - (define-key ess-transcript-mode-map "\C-c\C-j" 'ess-transcript-send-command) - (define-key ess-transcript-mode-map "\C-c\M-j" 'ess-transcript-send-command-and-move) - (define-key ess-transcript-mode-map "\M-\C-a" 'ess-goto-end-of-function-or-para) - (define-key ess-transcript-mode-map "\M-\C-e" 'ess-goto-end-of-function-or-para) - (define-key ess-transcript-mode-map "\C-c\C-y" 'ess-switch-to-ESS) - (define-key ess-transcript-mode-map "\C-c\C-z" 'ess-switch-to-end-of-ESS) - (define-key ess-transcript-mode-map "\C-c\C-v" 'ess-display-help-on-object) - (define-key ess-transcript-mode-map "\C-c\C-d" 'ess-dump-object-into-edit-buffer) - (define-key ess-transcript-mode-map "\C-c\t" 'ess-complete-object-name-deprecated) - (define-key ess-transcript-mode-map "\C-a" 'comint-bol) - (define-key ess-transcript-mode-map "\M-\t" 'comint-replace-by-expanded-filename) - (define-key ess-transcript-mode-map "\M-?" 'comint-dynamic-list-completions) - (define-key ess-transcript-mode-map "\C-c\C-k" 'ess-request-a-process) - (define-key ess-transcript-mode-map "{" 'skeleton-pair-insert-maybe) - (define-key ess-transcript-mode-map "}" 'skeleton-pair-insert-maybe) - (define-key ess-transcript-mode-map "\e\C-h" 'ess-mark-function) - (define-key ess-transcript-mode-map "\e\C-q" 'ess-indent-exp) - ;(define-key ess-transcript-mode-map "\177" 'backward-delete-char-untabify) - (define-key ess-transcript-mode-map "\t" 'ess-indent-command) - - (define-key ess-transcript-mode-map "\C-c\C-p" 'comint-previous-prompt) - (define-key ess-transcript-mode-map "\C-c\C-n" 'comint-next-prompt) - ;; (define-key ess-transcript-mode-map "\C-c\C-n" 'ess-eval-line-and-step) - - (define-key ess-transcript-mode-map "\r" 'ess-transcript-send-command-and-move) - (define-key ess-transcript-mode-map "\M-\r" 'ess-transcript-send-command) - (define-key ess-transcript-mode-map "\C-c\r" 'ess-transcript-copy-command) - (define-key ess-transcript-mode-map "\C-c\C-w" 'ess-transcript-DO-clean-region) - (define-key ess-transcript-mode-map "\C-c\M-c" 'ess-transcript-clean-buffer) - ) +(defvar ess-transcript-mode-map + (let ((map (make-sparse-keymap))) + (define-key map "\C-c\C-s" #'ess-switch-process) + (define-key map "\C-c\C-r" #'ess-eval-region) + (define-key map "\C-c\M-r" #'ess-eval-region-and-go) + (define-key map "\C-c\C-k" #'ess-force-buffer-current) + (define-key map "\C-c\C-q" #'ess-quit) + (define-key map "\C-c\C-j" #'ess-transcript-send-command) + (define-key map "\C-c\M-j" #'ess-transcript-send-command-and-move) + (define-key map "\M-\C-a" #'ess-goto-end-of-function-or-para) + (define-key map "\M-\C-e" #'ess-goto-end-of-function-or-para) + (define-key map "\C-c\C-y" #'ess-switch-to-ESS) + (define-key map "\C-c\C-z" #'ess-switch-to-end-of-ESS) + (define-key map "\C-c\C-v" #'ess-display-help-on-object) + (define-key map "\C-c\C-d" #'ess-dump-object-into-edit-buffer) + (define-key map "\C-a" #'comint-bol) + (define-key map "\M-\t" #'comint-replace-by-expanded-filename) + (define-key map "\M-?" #'comint-dynamic-list-completions) + (define-key map "\C-c\C-k" #'ess-request-a-process) + (define-key map "{" #'skeleton-pair-insert-maybe) + (define-key map "}" #'skeleton-pair-insert-maybe) + (define-key map "\e\C-h" #'ess-mark-function-or-para) + (define-key map "\e\C-q" #'ess-indent-exp) + (define-key map "\t" #'ess-indent-command) + (define-key map "\C-c\C-p" #'comint-previous-prompt) + (define-key map "\C-c\C-n" #'comint-next-prompt) + (define-key map "\r" #'ess-transcript-send-command-and-move) + (define-key map "\M-\r" #'ess-transcript-send-command) + (define-key map "\C-c\r" #'ess-transcript-copy-command) + (define-key map "\C-c\C-w" #'ess-transcript-DO-clean-region) + (define-key map "\C-c\M-c" #'ess-transcript-clean-buffer) + map) + "Keymap for `ess-transcript-mode'.") (easy-menu-define ess-transcript-mode-menu ess-transcript-mode-map "Menu for use in S transcript mode." '("ESS-trans" - ["What is this? (beta)" ess-mouse-me t] ["Describe" describe-mode t] ["About" (ess-goto-info "Transcript Mode") t] ["Send bug report" ess-submit-bug-report t] @@ -113,39 +104,22 @@ ["Switch S process" ess-switch-process t] )) -(if (featurep 'ess-trans) - (define-key ess-transcript-mode-map [menu-bar ess-trans] - (cons "ess-trans" ess-transcript-mode-menu)) - (eval-after-load "ess-trans" - '(define-key ess-transcript-mode-map - [menu-bar ess-trans] - (cons "ess-trans" - ess-transcript-mode-menu)))) ;;;###autoload -(defun ess-transcript-mode (alist &optional proc) - "Major mode for manipulating {ESS} transcript files. +(define-derived-mode ess-transcript-mode ess-mode "ESS Transcript" + "Major mode for transcript files. Type \\[ess-transcript-send-command] to send a command in the -transcript to the current S process. \\[ess-transcript-copy-command] +transcript to the current inferior process. \\[ess-transcript-copy-command] copies the command but does not execute it, allowing you to edit it in the process buffer first. Type \\[ess-transcript-clean-region] to delete all outputs and prompts -in the region, leaving only the S commands. Other keybindings are: - -\\{ess-transcript-mode-map}" - (kill-all-local-variables) - (setq buffer-read-only t) ;; to protect the buffer. - (ess-setq-vars-local alist); (current-buffer)) - (setq major-mode 'ess-transcript-mode) - (setq mode-name "ESS Transcript") - (use-local-map ess-transcript-mode-map) - (set-syntax-table (or inferior-ess-mode-syntax-table - ess-mode-syntax-table)) - (setq mode-line-process - '(" [" ess-local-process-name "]")) - (make-local-variable 'ess-local-process-name) - (setq ess-local-process-name nil) +in the region, leaving only the commands." + :group 'ess + (setq buffer-read-only t + ess-local-process-name nil + mode-line-process '(" [" ess-local-process-name "]")) + ;; TODO: Set this more normally in various major modes (unless inferior-ess-prompt ;; For S languages it is set in custom-alist (setq inferior-ess-prompt ;; Do not anchor to bol with `^' @@ -154,23 +128,12 @@ "\\|" inferior-ess-secondary-prompt "\\)"))) - (make-local-variable 'paragraph-start) - (setq paragraph-start (concat "^" inferior-ess-prompt "\\|^\^L")) - (make-local-variable 'paragraph-separate) - (setq paragraph-separate "^\^L") - (make-local-variable 'comint-use-prompt-regexp) - (setq comint-use-prompt-regexp t) - (make-local-variable 'comint-prompt-regexp) - (setq comint-prompt-regexp (concat "^" inferior-ess-prompt)) - (setq inferior-ess-font-lock-keywords 'inferior-ess-r-font-lock-keywords) + (setq-local paragraph-start (concat "^" inferior-ess-prompt "\\|^\^L")) + (setq-local paragraph-separate "^\^L") + (setq-local comint-use-prompt-regexp t) + (setq-local comint-prompt-regexp (concat "^" inferior-ess-prompt)) (setq font-lock-defaults '(ess-build-font-lock-keywords - nil nil ((?\. . "w") (?\_ . "w") (?' . ".")))) - - ;;; Keep out of the code. - (make-local-variable 'indent-tabs-mode) - (setq indent-tabs-mode nil) - - (run-mode-hooks 'ess-transcript-mode-hook)) + nil nil ((?\. . "w") (?\_ . "w") (?' . "."))))) ;;*;; Commands used in S transcript mode @@ -193,8 +156,6 @@ (defun ess-transcript-send-command-and-move () "Send the command on this line, and move point to the next command." (interactive) - ;; (ess-transcript-send-command) ;; This doesn't work properly - ;; replacement code begins (let* ((proc (or ess-local-process-name (ess-request-a-process "Evaluate into which process? " t))) (ess-buf (ess-get-process-buffer proc))) @@ -205,8 +166,6 @@ (with-current-buffer ess-buf (goto-char (point-max)) (ess-eval-linewise input nil nil nil 1)))) - ;; replacement code ends - (goto-char ess-temp-point) (comint-next-prompt 1)) (defun ess-transcript-copy-command () @@ -224,7 +183,6 @@ (insert input))) (ess-switch-to-end-of-ESS)) -;;;###autoload (defun ess-transcript-clean-region (beg end even-if-read-only) "Strip the transcript in the region, leaving only (R/S/Lsp/..) commands. Deletes any lines not beginning with a prompt, and then removes the @@ -258,30 +216,6 @@ (if do-toggle (setq buffer-read-only t))))) - -;; unfinished idea :----------------------- - -;; (defun ess-clean-region-in-new-transcript (beg end) -;; "Copy the region into a new ess-transcript buffer, and clean it there, -;; using \\[ess-transcript-clean-region]." -;; (interactive "r") - -;; (let ((bname (buffer-file-name))) -;; (setq bname (if bname .. ..)) -;; (let -;; (fbase (if fname (file-name-sans-extension (file-name-nondirectory fname)) -;; (buffer-name))) -;; -;; ;; the buffer name should be like a file name -;; (buf-nam ....) -;; (trns-buf (get-buffer-create fbase)) -;; (pop-to-buffer trns-buf) -;; (ess-transcript-mode .....) -;; ))) - - - - (defun ess-transcript-DO-clean-region (beg end) "Clean the current via \\[ess-transcript-clean-region] even if the buffer is read-only." (interactive "r") diff -Nru ess-18.10.2/lisp/ess-utils.el ess-18.10.2+git20220915.f45542e/lisp/ess-utils.el --- ess-18.10.2/lisp/ess-utils.el 2018-11-10 09:41:11.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/lisp/ess-utils.el 2022-10-15 08:06:36.000000000 +0000 @@ -1,114 +1,110 @@ -;;; ess-utils.el --- General Emacs utility functions used by ESS - -;; Copyright (C) 1998--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. +;;; ess-utils.el --- General Emacs utility functions used by ESS -*- lexical-binding: t; -*- +;; Copyright (C) 1998-2020 Free Software Foundation, Inc. ;; Author: Martin Maechler ;; Created: 9 Sept 1998 ;; Maintainer: ESS-core -;; This file is part of ESS (Emacs Speaks Statistics). +;; This file is part of GNU Emacs. -;; This file is free software; you can redistribute it and/or modify +;;; License: +;; +;; This program is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 2, or (at your option) -;; any later version. - -;; This file is distributed in the hope that it will be useful, +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. +;; +;; This program is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. - -;; A copy of the GNU General Public License is available at -;; https://www.r-project.org/Licenses/ - +;; +;; You should have received a copy of the GNU General Public License +;; along with this program. If not, see +;; ;;; Commentary: ;; Various utilities for ESS. ;;; Code: + (require 'cl-lib) +(require 'comint) +(require 'project) (eval-when-compile (require 'tramp)) ;; The only ESS file this file should depend on is ess-custom.el -(require 'comint) (require 'ess-custom) -(require 'ido) -(defvar ac-modes) -(declare-function evil-visual-state-p "evil") -(declare-function evil-normal-state "evil") -(declare-function color-lighten-name "color") -(declare-function tramp-dissect-file-name "tramp") - -;;*;; 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)))))) - -(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-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))) +(defvar ac-modes) +(declare-function ess-eval-linewise "ess-inf" (text &optional invisibly eob even-empty wait-last-prompt sleep-sec wait-sec)) +(declare-function color-lighten-name "color" (name percent)) +(declare-function tramp-dissect-file-name "tramp" (name &optional nodefault)) +;; The following declares can be removed once we drop Emacs 25 +(declare-function tramp-file-name-method "tramp") +(declare-function tramp-file-name-user "tramp") +(declare-function tramp-file-name-host "tramp") +(declare-function tramp-file-name-localname "tramp") +(declare-function tramp-file-name-hop "tramp") ;;*;; elisp tools +(defun ess-next-code-line (&optional arg skip-to-eob) + "Move ARG lines of code forward (backward if ARG is negative). +If `ess-eval-empty' is non-nil, skip past all empty and comment +lines. ARG is 1 by default. If ARG is 0 only comments are skipped +forward. Don't skip the last empty and comment lines in the +buffer unless SKIP-TO-EOB is non-nil. On success, return 0. +Otherwise go as far as possible and return -1." + (interactive "p") + (if (or ess-eval-empty + (and (fboundp 'ess-roxy-entry-p) + (ess-roxy-entry-p))) + (forward-line arg) + (setq arg (or arg 1)) + (beginning-of-line) + (let ((pos (point)) + (inc (if (>= arg 0) 1 -1)) + (cnt (if (= arg 0) 1 arg)) + (out 0)) + ;; when orig-arg == 0, we skip only comments + (while (and (/= cnt 0) (= out 0)) + (unless (= arg 0) + (setq out (forward-line inc))) ; out==0 means success + (comment-beginning) + (beginning-of-line) + (forward-comment (* inc (buffer-size))) ;; as suggested in info file + (if (or skip-to-eob + (not (looking-at ess-no-skip-regexp))) ;; don't go to eob or whatever + (setq cnt (- cnt inc)) + (goto-char pos) + (setq cnt 0) + (forward-line inc)) ;; stop at next empty line + (setq pos (point))) + (goto-char pos) + out))) + (defun ess-goto-line (line) + "Go to LINE in the widened buffer." (save-restriction (widen) (goto-char (point-min)) (forward-line (1- line)))) -(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-skip-thing (thing) + "Leave point at the end of THING. +THING can be \\='function, \\='paragraph, or \\='line." + (cond + ((eql thing 'line) (goto-char (line-end-position))) + ((eql thing 'paragraph) (forward-paragraph)) + ((eql thing 'function) (end-of-defun) (skip-chars-backward " \t\n")))) (defun ess-search-except (regexp &optional except backward) "Search for a REGEXP and store as match 1. -Optionally ignore strings that match exceptions." - (interactive) +Optionally ignore strings that match EXCEPT. If BACKWARD is +non-nil, search backward." (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))) @@ -117,31 +113,15 @@ (setq continue (and except (string-match except exit))) (if continue (setq exit nil))) ;;else - (setq continue nil)) - ) - + (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) - + (let ((ess-temp-return-value (buffer-modified-p))) + (save-buffer) + (hack-local-variables) ess-temp-return-value)) (defun ess-get-file-or-buffer (file-or-buffer) @@ -149,62 +129,49 @@ 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)))) - -(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))) + (declare (side-effect-free t) + (obsolete nil "ESS 19.04")) + (if (bufferp file-or-buffer) + file-or-buffer + (find-buffer-visiting file-or-buffer))) + +(defun ess-file-content (file) + "Return the content of FILE as string." + (if (file-exists-p file) + (with-temp-buffer + (insert-file-contents-literally file) + (buffer-string)) + (error "File '%s' does not exist" file))) - (mapcar (lambda (pair) - (make-local-variable (car pair)) - (set (car pair) (eval (cdr pair)))) - alist)) - -(defun ess-return-list (ess-arg) - "If ESS-ARG is a list return it, else return ESS-ARG in a list." - (if (listp ess-arg) ess-arg (list ess-arg))) - -;; 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'." +This function will work even if LIST is unsorted. See also `delete-dups'." + (declare (obsolete 'delete-dups "ESS 19.04")) (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-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)) +(define-obsolete-function-alias 'ess-uniq-list 'delete-dups "ESS 19.04") + +(defalias 'ess-flatten-list + ;; `flatten-tree' is a function in Emacs 27 + (if (fboundp 'flatten-tree) + 'flatten-tree + (lambda (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-1 list)))) (defun ess-flatten-list-1 (list) + "Internal helper for `ess-flatten-list', which see for LIST." (cond ((null list) (list)) ((consp list) @@ -212,31 +179,10 @@ (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))))) - -;; 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)))) +(define-obsolete-function-alias 'ess-delete-blank-lines + 'delete-blank-lines "ESS 19.04") + +(define-obsolete-function-alias 'ess-line-to-list-of-words #'split-string "ESS 19.04") ;;*;; System @@ -244,71 +190,34 @@ (defun ess-revert-wisely () "Revert from disk if file and buffer last modification times are different." (interactive) - - ; whether or not a revert is needed, force load local variables - ; for example, suppose that you change the local variables and then - ; save the file, a revert is unneeded, but a force load is + ;; whether or not a revert is needed, force load local variables + ;; for example, suppose that you change the local variables and then + ;; save the file, a revert is unneeded, but a force load is (hack-local-variables) + (unless (verify-visited-file-modtime (current-buffer)) + (progn + (let ((ess-temp-store-point (point))) + (revert-buffer t t) + (goto-char ess-temp-store-point)) + t))) - (if (not (verify-visited-file-modtime (current-buffer))) (progn - (let ((ess-temp-store-point (point))) - (revert-buffer t t) - (goto-char ess-temp-store-point)) - t) - nil)) - - -(defun ess-find-exec (ess-root-arg ess-root-dir) - "Given a root directory and the root of an executable file name, -find it's full name and path, if it exists, anywhere in the sub-tree." - (let* ((ess-tmp-dirs (directory-files ess-root-dir t "^[^.]")) - (ess-tmp-return (ess-find-exec-completions ess-root-arg ess-root-dir)) - (ess-tmp-dir nil)) - - (while ess-tmp-dirs - (setq ess-tmp-dir (car ess-tmp-dirs) - ess-tmp-dirs (cdr ess-tmp-dirs)) - (if (file-accessible-directory-p ess-tmp-dir) - (setq ess-tmp-return - (nconc ess-tmp-return - (ess-find-exec ess-root-arg ess-tmp-dir))))) - ess-tmp-return)) - -(defun ess-find-exec-completions (ess-root-arg &optional ess-exec-dir) - "Given the root of an executable file name, find all possible completions. -Search for the executables in ESS-EXEC-DIR (which defaults to -`exec-path' if no value is given)." - (let* ((ess-exec-path - (if ess-exec-dir (ess-return-list ess-exec-dir) exec-path)) - (ess-tmp-exec nil) - (ess-tmp-path-count (length ess-exec-path)) - (ess-tmp-dir nil) - (ess-tmp-files nil) - (ess-tmp-file nil)) - - (while ess-exec-path - (setq ess-tmp-dir (car ess-exec-path) - ess-exec-path (cdr ess-exec-path)) - (when - (and (> (length ess-tmp-dir) 0) - (file-accessible-directory-p ess-tmp-dir)) +(define-obsolete-function-alias 'ess-find-exec 'ess-find-exec-completions "ESS 19.04") +(defun ess-find-exec-completions (root) + "Given the ROOT of an executable file name, find all possible completions. +Search for the executables in the variable `exec-path'." + (let (executables) + (dolist (dir exec-path) + (when (and (> (length dir) 0) + (file-accessible-directory-p dir)) ;; the first test above excludes "" from exec-path, which can be ;; problematic with Tramp. - (setq ess-tmp-files - (file-name-all-completions ess-root-arg ess-tmp-dir)) - - (while ess-tmp-files - (setq ess-tmp-file - (concat (file-name-as-directory ess-tmp-dir) - (car ess-tmp-files)) - ess-tmp-files (cdr ess-tmp-files)) - (if (and (file-executable-p ess-tmp-file) - (not (backup-file-name-p ess-tmp-file)) - (not (file-directory-p ess-tmp-file))) - ;; we have found a possible executable, so keep it. - (setq ess-tmp-exec - (nconc ess-tmp-exec (list ess-tmp-file))))))) - ess-tmp-exec)) + (dolist (f (file-name-all-completions root dir)) + (setq f (expand-file-name f dir)) + (when (and (file-executable-p f) + (not (backup-file-name-p f)) + (not (file-directory-p f))) + (push f executables))))) + executables)) (defun ess-drop-non-directories (file-strings) "Drop all entries in FILE-STRINGS that do not \"look like\" directories." @@ -329,9 +238,9 @@ ;;*;; Interaction with inferiors (defmacro ess-when-new-input (time-var &rest body) - "BODY is evaluate only if the value of procss variable TIME-VAR + "BODY is evaluate only if the value of process 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 +`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'. @@ -357,84 +266,28 @@ (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")))))) - -(defcustom ess-idle-timer-interval 1 - "Number of idle seconds to wait before running function in `ess-idle-timer-functions'." - :type '(integer) - :group 'ess) - -(defvar ess-idle-timer-functions nil - "A list of functions to run each `ess-idle-timer-interval' idle seconds. - -If your function calls the process, you better use -`ess-when-new-input' to wrap your call. If you call the -subprocess please respect `ess-can-eval-in-background' variable. - -These functions are run with `run-hooks'. Use `add-hook' to add -symbols to this variable. - -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' -etc.") - -(defun ess--idle-timer-function nil - "Internal function executed by `ess--idle-timer'." - ;; (while-no-input - (run-hooks 'ess-idle-timer-functions)) - -(require 'timer) -(defvar ess--idle-timer - (run-with-idle-timer ess-idle-timer-interval 'repeat 'ess--idle-timer-function) - "Timer used to run `ess-idle-timer-functions'.") +(defmacro with-ess-process-buffer (no-error &rest body) + "Execute BODY in the process buffer of `ess-current-process-name'. +If NO-ERROR is t don't trigger error when there is not current +process. Symbol *proc* is bound to the current process during the +evaluation of BODY." + (declare (indent 1) (debug t)) + `(let ((*proc* (and ess-local-process-name (get-process ess-local-process-name)))) + (if *proc* + (with-current-buffer (process-buffer *proc*) + ,@body) + (unless ,no-error + (error "No current ESS process"))))) ;;*;; Emacs Integration -;;;*;;; Menus +(defun ess-derived-mode-p () + "Non-nil if the current major mode is an ESS major mode." + (or (derived-mode-p 'ess-mode) + (derived-mode-p 'ess-julia-mode))) -(defun ess--generate-eval-visibly-submenu (menu) +(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)) @@ -442,20 +295,17 @@ ["no" (lambda () (interactive) (setq ess-eval-visibly nil)) :style radio :enable t :selected (eq ess-eval-visibly nil) ])) -;;;*;;; Font Lock +;; Font Lock (defun ess--fl-keywords-values () "Return a cons (STANDARD-VALUE . CUSTOM-VALUE) of `ess-font-lock-keywords'." - (let ((sym (if (derived-mode-p 'ess-mode) - ess-font-lock-keywords - ;; also in transcript mode - inferior-ess-font-lock-keywords))) + (let ((sym ess-font-lock-keywords)) (if (and (symbolp sym) (custom-variable-p sym)) (cons (eval (car (get sym 'standard-value))) (symbol-value sym)) - (error "(inferior-)`ess-font-lock-keywords' must be a symbol of a custom variable")))) + (error "`ess-font-lock-keywords' must be a symbol of a custom variable")))) (defun ess--extract-fl-keywords () (let ((values (ess--fl-keywords-values))) @@ -470,26 +320,23 @@ "Retrieve `font-lock-keywords' from ess-[dialect]-font-lock-keywords. Merge the customized values of that variable on top of the standard values and return the new list. For this to work, -`ess-font-lock-keywords' and `inferior-ess-font-lock-keywords' -should hold a name of the ess-[dialect]-font-lock-keywords -variable." +`ess-font-lock-keywords' should be a name of the +ess-[dialect]-font-lock-keywords variable." (delq nil (mapcar (lambda (c) (when (cdr c) (symbol-value (car c)))) (ess--extract-fl-keywords)))) -(defun ess-font-lock-toggle-keyword (&optional keyword) - (interactive) +(defun ess-font-lock-toggle-keyword (keyword) + "Toggle KEYWORD font-lock." + (interactive + (list (intern (ess-completing-read + "Keyword to toggle" + (mapcar (lambda (el) (symbol-name (car el))) + (car (ess--fl-keywords-values))) + nil t)))) (let* ((values (ess--fl-keywords-values)) - (keyword (or keyword - (if (called-interactively-p 'any) - (intern (ess-completing-read - "Keyword to toggle" - (mapcar (lambda (el) (symbol-name (car el))) - (car values)) - nil t)) - (error "Wrong number of arguments")))) (kwd (cond ;; already in custom values ((assoc keyword (cdr values))) @@ -497,9 +344,7 @@ ;; we add new keywords but the user has the old value saved in ;; .emacs-custom.el) ((let ((kwd (assoc keyword (car values))) - (sym (if (derived-mode-p 'ess-mode) - ess-font-lock-keywords - inferior-ess-font-lock-keywords))) + (sym ess-font-lock-keywords)) (when kwd (set sym (cons kwd (symbol-value sym))) kwd))) @@ -515,8 +360,8 @@ (font-lock-refresh-defaults)))) (buffer-list))))) -(defun ess--generate-font-lock-submenu (menu) - "Generate ESS font-lock submenu in MENU." +(defun ess--generate-font-lock-submenu (_menu) + "Generate ESS font-lock submenu." (append (mapcar (lambda (el) `[,(symbol-name (car el)) (lambda () (interactive) @@ -528,26 +373,61 @@ (list "-----" ["Save to custom" (lambda () (interactive) - (customize-save-variable (if (derived-mode-p 'ess-mode) - ess-font-lock-keywords - inferior-ess-font-lock-keywords) + (customize-save-variable ess-font-lock-keywords (ess--extract-fl-keywords))) t]))) +(declare-function untrace-function "trace" ()) +(defvar ess--is-tracing nil) + +;;;###autoload +(define-minor-mode ess-elisp-trace-mode + "Toggle tracing of ess-prefixed functions. +Tracing is useful for debugging background ESS behaviour. When +enabled, all functions prefixed in `ess-' and `inferior-ess' are +instrumented with `trace-function'. Tracing is turned off by +calling `untrace-function' on these functions." + :global t + :group 'ess + (let ((fns (append (all-completions "ess-" obarray) + (all-completions "inferior-ess-" obarray) + (list "update-ess-process-name-list" + "forward-ess-r-expr" + "forward-ess-r-sexp" + "backward-ess-r-expr" + "backward-ess-r-sexp" + "company-ess-julia-objects" + "run-ess-r" + "run-ess-r-newest"))) + (do (symbol-function (if ess-elisp-trace-mode + #'untrace-function + #'trace-function)))) + (dolist (fn fns) + (funcall do (intern fn))))) -;;;*;;; External modes + +;;*;; External modes + +;; Define these here for the byte compiler since ido dynamically +;; let-binds them: +(defvar ido-choice-list) +(defvar ido-context-switch-command) +(defvar ido-directory-too-big) +(defvar ido-directory-nonreadable) +(defvar ido-current-directory) +(defvar ido-enable-flex-matching) +(declare-function ido-read-internal "ido" (item prompt hist &optional default require-match initial)) (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)))) +back on classical `completing-read' otherwise. Meaning of PROMPT, +COLLECTION, PREDICATE, REQUIRE-MATCH, INITIAL-INPUT, HIST, and +DEF is as in `completing-read'. PROMPT is automatically suffixed +with ': ' and (default %s) when needed. If HIST is nil use +`ess--completing-hist' as history. See also `ess-use-ido'." + (let ((use-ido (and ess-use-ido (require 'ido nil t)))) (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))) @@ -563,9 +443,6 @@ sel) (unwind-protect (progn - ;; Can remove this call when we drop support for Emacs - ;; < 25.1, as it is aliased to ignore then - (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)) @@ -579,59 +456,59 @@ ;; else usual completion (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) - (cl-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) - (eldoc-mode 1)) - - ;; tracebug - (when (and ess-use-tracebug inferior isR (fboundp 'ess-tracebug)) - (ess-tracebug 1)))) +(defun ess--setup-auto-complete (sources &optional inferior) + "Setup auto-complete depending on user settings. +SOURCES gets added to `ac-sources', INFERIOR should be t for +inferior buffers." + ;; auto-complete + (when (and (boundp 'ac-sources) + (if inferior + (eq ess-use-auto-complete t) + ess-use-auto-complete)) + (add-to-list 'ac-modes major-mode) + ;; files should be in front; ugly, but needed + (setq ac-sources + (delq 'ac-source-filename ac-sources)) + (mapc (lambda (el) (add-to-list 'ac-sources el)) + sources) + (add-to-list 'ac-sources 'ac-source-filename))) + +(defun ess--setup-company (sources &optional inferior) + "Setup company depending on user settings. +SOURCES gets added to `company-backends', and when t, INFERIOR +specifies inferior buffers." + ;; company + (when (and (boundp 'company-backends) + (if inferior + (eq ess-use-company t) + ess-use-company)) + (setq-local company-backends + (cl-copy-list (append sources company-backends))) + (delq 'company-capf company-backends))) + +(defun ess--setup-eldoc (fun) + "Setup support for eldoc. +FUN is the function to return data for eldoc." + (when ess-use-eldoc + (if (not (boundp 'eldoc-documentation-functions)) + ;; older versions of Eldoc included in Emacs 27 and previous + (add-function :before-until (local 'eldoc-documentation-function) + fun) + ;; new eldoc, in Emacs 28+ + (add-hook 'eldoc-documentation-functions fun nil t) + ;; Eldoc is on GNU ELPA so you can have new eldoc + Emacs 27.1 + ;; or older, see bug#1130 and Emacs bug # 47388 for why we have + ;; to do this + (when (and (fboundp 'eldoc-documentation-default) + (function-equal #'ignore eldoc-documentation-function)) + (setq-local eldoc-documentation-function #'eldoc-documentation-default))))) (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. - -Return the value of the lastly executed command. - + "Execute keys defined in MAP till a key is pressed which is not in MAP. Single-key input commands are those that once executed do not -requre the prefix command for subsequent invocation. - -PROMPT is passed to `read-event'. +require the prefix command for subsequent invocation. Return the +value of the lastly executed command. PROMPT is passed to +`read-event'. If WAIT is t, wait for next input and ignore the keystroke which triggered the command. @@ -663,21 +540,21 @@ (push ev unread-command-events)) out))) -(defvar ess-build-tags-command nil +(cl-defgeneric ess-build-tags-command () "Command passed to generate tags. - 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.") +expression. Otherwise, it should be a string with two %s +formats: one for directory and another for the output file." + nil) -;;;*;;; Emacs itself + +;;*;; 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." +the prompt from those lines that remain. Invoke this command with +\\[universal-argument] \\[universal-argument] \\\\[yank]." (setq yank-window-start (window-start)) (let ((beg (point))) (push-mark beg) @@ -688,11 +565,12 @@ (if (eq (point) beg) (message "No commands found")) (if (eq this-command t) - (setq this-command 'yank)) - )) + (setq this-command 'yank)))) (defun ess-yank (&optional arg) - "With double prefix ARG (C-u C-u) call `ess-yank-cleaned-commands'." + "Call `ess-yank-cleaned-commands' if ARG is 16. +With double prefix ARG (\\[universal-argument] +\\[universal-argument]) call `ess-yank-cleaned-commands'." (interactive "*P") (if (equal '(16) arg) (ess-yank-cleaned-commands) @@ -706,11 +584,10 @@ (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. +have `find' and `etags' programs installed. Use M-. to navigate to a tag. \\[visit-tags-table] to append/replace the currently used tag table. @@ -723,17 +600,17 @@ (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 :( + ;; 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) (require 'tramp) (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)) + (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!! + (unless imenu-generic-expression (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)) @@ -750,43 +627,6 @@ (when (= 0 (shell-command (format "%s | %s" find-cmd tags-cmd))) (message "Building tags .. ok!"))))) - -;;;*;;; 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." - (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) - (when (fboundp 'ess-get-words-from-vector) - (car (ess-get-words-from-vector - "getOption(\"pdfviewer\")\n")))))) - (when (stringp viewer) - (setq viewer (file-name-nondirectory viewer))) - viewer)) - ;;*;; UI @@ -797,6 +637,7 @@ "The overlay for highlighting currently evaluated region or line.") (defun ess-blink-region (start end) + "Blink from START to END depending on option `ess-blink-region'." (when ess-blink-region (move-overlay ess-current-region-overlay start end) (run-with-timer ess-blink-delay nil @@ -804,28 +645,31 @@ (delete-overlay ess-current-region-overlay))))) (defun ess-deactivate-mark () - (cond ((and (featurep 'evil) (bound-and-true-p evil-mode)) - (when (evil-visual-state-p) - (evil-normal-state))) - (mark-active - (deactivate-mark)))) + "Deactivate the mark, if active. +If `evil-mode' is on, switch to `evil-normal-state'." + (if (and (bound-and-true-p evil-mode) + (fboundp 'evil-visual-state-p) + (evil-visual-state-p)) + (when (fboundp 'evil-normal-state) + (evil-normal-state)) + (when mark-active + (deactivate-mark)))) ;; SJE: 2009-01-30 -- this contribution from ;; Erik Iverson (defun ess-tooltip-show-at-point (text xo yo) - "Show a tooltip displaying 'text' at (around) point, xo and yo are x- -and y-offsets for the toolbar from point." + "Show a tooltip displaying TEXT at (around) point. +XO and YO are x- and y-offsets for the toolbar from point." (let ( (fx (frame-parameter nil 'left)) (fy (frame-parameter nil 'top)) (fw (frame-pixel-width)) (fh (frame-pixel-height)) frame-left frame-top my-x-offset my-y-offset) - ;; The following comment was found before code looking much like that ;; of frame-left and frame-top below in the file - ;; tooltip-help.el. I include it here for acknowledgement, and I did observe + ;; tooltip-help.el. I include it here for acknowledgment, and I did observe ;; the same behavior with the Emacs window maximized under Windows XP. ;; -----original comment-------- @@ -835,34 +679,28 @@ ;; least on Windows XP. The handling code is "shamelessly ;; stolen" from cedet/speedbar/dframe.el ;; (contributed by Andrey Grigoriev) - (setq frame-left (if (not (consp fx)) fx (if (eq (car fx) '-) - (- (x-display-pixel-width) (car (cdr fx)) fw) + (- (display-pixel-width) (car (cdr fx)) fw) (car (cdr fx))))) - (setq frame-top (if (not (consp fy)) fy (if (eq (car fy) '-) - (- (x-display-pixel-height) (car (cdr fy)) fh) + (- (display-pixel-height) (car (cdr fy)) fh) (car (cdr fy))))) - ;; calculate the offset from point, use xo and yo to adjust to preference (setq my-x-offset (+ (car(window-inside-pixel-edges)) (car(posn-x-y (posn-at-point))) frame-left xo)) - (setq my-y-offset (+ (cadr(window-inside-pixel-edges)) (cdr(posn-x-y (posn-at-point))) frame-top yo)) - (let ((tooltip-frame-parameters (cons (cons 'top my-y-offset) (cons (cons 'left my-x-offset) tooltip-frame-parameters)))) - (tooltip-show text)) - )) + (tooltip-show text)))) (defun ess-select-frame-set-input-focus (frame) "Select FRAME, raise it, and set input focus, if possible. @@ -886,145 +724,13 @@ (when focus-follows-mouse (set-mouse-position frame (1- (frame-width frame)) 0))) -(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))))) - - ;; 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))) +(define-obsolete-function-alias 'ess-do-auto-fill 'do-auto-fill "ESS 19.04") ;;*;; Syntax (defun ess-containing-sexp-position () + "Return the `cadr' of `syntax-ppss'." (cadr (syntax-ppss))) (defun ess-code-end-position () @@ -1052,77 +758,76 @@ (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.")) - +(defvar ess--r-s-function-pattern + (let* ((Q "\\s\"") ; quote + (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. + (space "\\(\\s-\\|\n\\)*") ; white space + + (part-1 (concat + "\\(" ;;--------outer Either------- + "\\(\\(" ; EITHER + Q xSymb Q ; any function name between quotes + "\\)\\|\\(" + 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 + ))) + `(,part-1 ,part-2)) + "Partial regex for matching functions. + +Placeholder for use in constructing `ess-r-function-pattern' and +`ess-s-function-pattern'.") + +(defvar ess-r-function-pattern + (concat (car ess--r-s-function-pattern) + "\\s-*\\(<-\\|=\\)" ; whitespace, assign + (nth 1 ess--r-s-function-pattern)) + "The regular expression for matching the beginning of an R function.") + +(defvar ess-s-function-pattern + (concat (car ess--r-s-function-pattern) + "\\s-*\\(<-\\|_\\|=\\)" ; whitespace, assign (incl. "_") + (nth 1 ess--r-s-function-pattern)) + "The regular expression for matching the beginning of an S function.") (defvar ess--fn-name-start-cache nil) -(defun ess--fn-name-start (&optional look-back) +(defun ess--fn-name-start () "Return (FN-NAME . START-POS). FN-NAME is a function name located before the pointer. START-POS -is the position where FN-NAME starts. LOOK-BACK is a number of -characters to look back; defaults to 2000. Store this cons in -variable `ess--fn-name-start-cache'." +is the position where FN-NAME starts. Store this cons in variable +`ess--fn-name-start-cache'." (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 (fboundp 'ess-noweb-narrow-to-chunk) (bound-and-true-p ess-noweb-mode) (ess-noweb-narrow-to-chunk)) - (unless (ess-inside-string-p) (setq ess--fn-name-start-cache - (condition-case nil ;; check if it is inside a functon + (condition-case nil ;; check if it is inside a function (progn ;; for the sake of big buffers, look only 1000 chars back (narrow-to-region (max (point-min) (- (point) 1000)) (point)) @@ -1135,128 +840,11 @@ (cons funname (- (point) (length funname)))))) (error nil)))))))) -(defun ess-beginning-of-function (&optional no-error) - "Leave (and return) the point at the beginning of the current ESS function. -If the optional argument NO-ERROR is non-nil, the function returns nil when -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) - beg end done) - - ;; Note that we must be sure that we are past the 'function (' text, - ;; such that ess-function-pattern is found in BACKwards later. - ;; In case we're sitting in a function or setMethod() header, - ;; we need to move further. - ;; But not too far! {wrongly getting into next function} - (if (search-forward "(" - (ess-line-end-position 2) t) ; at most end of next line - (forward-char 1)) - ;; TODO: replace the above by hopefully more sucessful logic: - ;; 1. If we have 'function *(' in the same line, move to end of that line - ;; 2. if *not*, skip all comment lines (concat space comment-char .* "\n") - ;; and only* then do something like the - ;; (search-forward '(' .. (..line-end.. 2) ) above - - (setq end (point)) ; = init-point when nothing found - - (ess-write-to-dribble-buffer - (format "ess-BEG-of-fun after 'search-FWD (': Ini-pt %d, (p)-Ini-pt = %d\n" - init-point (- end init-point))) - (if (and (> end 1) - (re-search-backward ;; in case of setMethod() etc .. - ess-r-set-function-start - ;; at most 1 line earlier {2 is too much: finds previous sometimes} - (+ 1 (ess-line-end-position -1)) t)) - - (progn ;; yes we *have* an S4 setMethod(..)-like - (setq in-set-S4 t - beg (point)) - (ess-write-to-dribble-buffer - (format " set*() function start at position %d" beg)) - ;; often need to move even further to have 'function(' to our left - ;; (if (search-forward "function" end t) - ;; (ess-write-to-dribble-buffer - ;; (format " -> 'function' already at pos %d\n" (point))) - ;; ;; else need to move further - (goto-char end) - ;; search 4 lines, we are pretty sure now: - (search-forward - "function" (ess-line-end-position 4) t) - ;; ) - (search-forward "(" (ess-line-end-position) t)) - ;; else: regular function; no set*Method(..) - (ess-write-to-dribble-buffer "ELSE not in setMethod() header ...\n")) - - (while (not done) - ;; Need this while loop to skip over local function definitions - - ;; In the case of non-success, it is inefficiently - ;; going back in the buffer through all function definitions... - (unless - (and (re-search-backward ess-function-pattern (point-min) t) - (not (ess-inside-string-or-comment-p (point)))) - (goto-char init-point) - (if no-error - (setq done t beg nil) - ;; else [default]: - (error "Point is not in a function according to 'ess-function-pattern'"))) - (unless done - (setq beg (point)) - (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-r-set-function-start)) - (forward-list 1) ; get over arguments - - ;; The following used to bomb "Unbalanced parentheses", n1, n2 - ;; when the above (search-forward "(" ..) wasn't delimited : - (unless in-set-S4 (forward-sexp 1)) ; move over braces - ;;DBG (ess-write-to-dribble-buffer "|") - (setq end (point)) - (goto-char beg) - ;; current function must begin and end around point - (setq done (and (>= end init-point) (<= beg init-point))))) - beg)) - -(defun ess-end-of-function (&optional beginning no-error) - "Leave the point at the end of the current ESS function. -Optional argument for location of BEGINNING. Return '(beg end)." - (interactive) - (if beginning - (goto-char beginning) - (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-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)) - (forward-list 1) ; get over arguments || whole set*(..) - (unless in-set-S4 (forward-sexp 1)) ; move over braces - (ess-write-to-dribble-buffer - (format "ess-END-of-fun: found #1 : %d\n" (point))) - - ;; For one-line functions withOUT '{ .. }' body -- added 2008-07-23 -- - ;; particularly helpful for C-c C-c (ess-eval-function-or-paragraph-and-step): - (setq end-pos (ess-line-end-position)) - (while (< (point) end-pos) ; if not at end of line, move further forward - (goto-char ;; careful not to move too far; e.g. *not* over empty lines: - (min (save-excursion (forward-sexp 1) (point)) - (save-excursion (forward-paragraph 1) (point))))) - (list beginning (point))) - ;; else: 'no-error': we are not in a function - nil)) - (defun ess-symbol-at-point () "Like `symbol-at-point' but consider fully qualified names. Fully qualified names include accessor symbols (like aaa$bbb and aaa@bbb in R)." (with-syntax-table (or ess-mode-completion-syntax-table - ess-mode-syntax-table (syntax-table)) (symbol-at-point))) @@ -1264,13 +852,12 @@ "Get bounds of symbol at point. Intended for completion." (let ((bounds (with-syntax-table (or ess-mode-completion-syntax-table - ess-mode-syntax-table (syntax-table)) (bounds-of-thing-at-point 'symbol)))) (and bounds (not (save-excursion (goto-char (car bounds)) - (looking-at "/\\|.[0-9]"))) + (looking-at "/\\|[.0-9]"))) bounds))) (defun ess-symbol-start () @@ -1326,21 +913,12 @@ ;;*;; String manipulation (defun ess-quote-special-chars (string) + "Quote special characters in STRING." (replace-regexp-in-string "\"" "\\\\\\&" (replace-regexp-in-string ;; replace backslashes "\\\\" "\\\\" string nil t))) -;; 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-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. @@ -1358,12 +936,7 @@ (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)) - ) ) + (replace-match to-string fixedcase literal)))))) (defun ess-replace-regexp-dump-to-src (regexp to-string &optional dont-query verbose) "Replace REGEXP matches from beginning of buffer with TO-STRING. @@ -1376,7 +949,7 @@ (query-replace-regexp regexp to-string nil)))) (defun ess-space-around (word &optional from verbose) - "Replace-regexp .. ensuring space around all occurences of WORD. + "Replace-regexp .. ensuring space around all occurrences of WORD. Start at from FROM, which defaults to point." (interactive "d\nP"); Defaults: point and prefix (C-u) (save-excursion @@ -1385,13 +958,12 @@ "\\1 \\2" nil nil verbose) (goto-char from) (ess-rep-regexp (concat "\\(\\<" word "\\>\\)\\([^ \t\n]\\)") - "\\1 \\2" nil nil verbose) - ) - ) + "\\1 \\2" nil nil verbose))) (defun ess-time-string (&optional clock) "Return a string for use as a timestamp, like \"13 Mar 1992\". Include hr:min if CLOCK is non-nil. Redefine to taste." + (declare (obsolete format-time-string "ESS 19.04")) (format-time-string (concat "%e %b %Y" (if clock ", %H:%M")))) (defun ess-replace-in-string (str regexp newtext &optional literal) @@ -1445,25 +1017,8 @@ 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). + "[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 @@ -1473,19 +1028,17 @@ ;;; -- 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." +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 @@ -1503,6 +1056,9 @@ ;; always return nil, in case this is on write-file-hooks. nil)) +(defun ess--strip-final-newlines (string) + (replace-regexp-in-string "\n+$" "" string)) + ;;*;; Debugging tools @@ -1517,62 +1073,12 @@ "Write TEXT to `ess-dribble-buffer' only if `ess-verbose' is non-nil." (when ess-verbose (ess-write-to-dribble-buffer text))) - (defun ess-kill-last-line () (save-excursion (goto-char (point-max)) (forward-line -1) (delete-region (point-at-eol) (point-max)))) -(defvar ess-adjust-chunk-faces t - "Whether to adjust background color in code chunks.") - -(defvar-local ess-buffer-has-chunks nil - "Internal usage: indicates whether a buffer has chunks. -This is used to make face adjustment a no-op when a buffer does -not contain chunks.") - -(defvar ess-adjust-face-intensity 2 - "Default intensity for adjusting faces.") - -(defun ess-adjust-face-background (start end &optional intensity) - "Adjust face background between START and END. -On dark background, lighten. Oposite on light." - (let* ((intensity (or intensity ess-adjust-face-intensity)) - (color (color-lighten-name - (face-background 'default) - (if (eq (frame-parameter nil 'background-mode) 'light) - (- intensity) - intensity))) - (face (list (cons 'background-color color)))) - (with-silent-modifications - (ess-adjust-face-properties start end 'face face)))) - -;; Taken from font-lock.el. -(defun ess-adjust-face-properties (start end prop value) - "Tweaked `font-lock-prepend-text-property'. -Adds the `ess-face-adjusted' property so we only adjust face once." - (let ((val (if (listp value) value (list value))) next prev) - (while (/= start end) - (setq next (next-single-property-change start prop nil end) - prev (get-text-property start prop)) - ;; Canonicalize old forms of face property. - (and (memq prop '(face font-lock-face)) - (listp prev) - (or (keywordp (car prev)) - (memq (car prev) '(foreground-color background-color))) - (setq prev (list prev))) - (add-text-properties start next - (list prop (append val (if (listp prev) prev (list prev))) - 'ess-face-adjusted t)) - (setq start next)))) - -(defun ess-find-overlay (pos prop) - (cl-some (lambda (overlay) - (when (overlay-get overlay prop) - overlay)) - (overlays-at pos))) - (defun ess-sleep () "Put Emacs to sleep for `ess-sleep-for-shell' seconds (floats work)." (sleep-for ess-sleep-for-shell)) @@ -1583,20 +1089,32 @@ (mapc (lambda (pair) (make-local-variable (car pair)) (set (car pair) (eval (cdr pair))) - (when ess--make-local-vars-permanent + (when (bound-and-true-p ess--make-local-vars-permanent) (put (car pair) 'permanent-local t))) ;; hack for Rnw alist)) -(defun ess-setq-vars-default (alist &optional buf) - "Set language variables from ALIST, in buffer BUF, if desired." - (when buf (set-buffer buf)) - (mapc (lambda (pair) - (set-default (car pair) (eval (cdr pair)))) - alist)) +(defmacro ess--alist (vars) + "Build a self-named alist from VARS. +VARS must be a list of symbols." + (declare (debug 0)) + `(list ,@(mapcar (lambda (var) `(cons ',var ,var)) vars))) (defvar ess-error-regexp "^\\(Syntax error: .*\\) at line \\([0-9]*\\), file \\(.*\\)$" "Regexp to search for errors.") +(define-obsolete-function-alias 'ess-beginning-of-function 'beginning-of-defun "ESS 19.04") +(define-obsolete-function-alias 'ess-end-of-function 'end-of-defun "ESS 19.04") + +(with-no-warnings + (defalias 'ess--project-root + ;; TODO: Remove once we drop support for Emacs 27 + (if (and (fboundp 'project-root) + ;; Issues caused unless we confirm `project-roots' is obsolete, see bug#1052 + (get 'project-roots 'byte-obsolete-info)) + 'project-root + (lambda (project) "See `project-roots'." + (car (project-roots project)))))) + (provide 'ess-utils) ;;; ess-utils.el ends here diff -Nru ess-18.10.2/lisp/ess-vst-d.el ess-18.10.2+git20220915.f45542e/lisp/ess-vst-d.el --- ess-18.10.2/lisp/ess-vst-d.el 2018-11-10 09:41:11.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/lisp/ess-vst-d.el 1970-01-01 00:00:00.000000000 +0000 @@ -1,81 +0,0 @@ -;;; ess-vst-d.el --- ViSta customization - -;; Copyright (C) 1997 A. J. Rossini -;; Copyright (C) 1997--2004 A.J. Rossini, Richard M. Heiberger, Martin -;; Maechler, Kurt Hornik, Rodney Sparapani, and Stephen Eglen. - -;; Author: A.J. Rossini -;; Created: 26 Aug 1997 -;; 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 -;; https://www.r-project.org/Licenses/ - -;;; Commentary: - -;; This file extends the XLispStat configuration for ViSta. - -;;; Code: - -;;; Requires and Autoloads: - -(require 'ess-custom) -(require 'ess-lsp-l) -(require 'ess-utils) -(require 'ess-inf) - -(defvar VST-customize-alist - '((ess-customize-alist . VST-customize-alist ) - (ess-language . "XLS" ) - (ess-dialect . "ViSta" ) - (ess-object-name-db-file . "ess-xls-namedb.el" ) - (ess-help-sec-regex . " ") - (ess-help-sec-keys-alist . " ") - (inferior-ess-primary-prompt . "> ?" ) - (comint-use-prompt-regexp . t) - (inferior-ess-program . inferior-VST-program) - (inferior-ess-help-command . "(help '%s)\n" ) - (inferior-ess-objects-command . "(variables)\n" ) - (inferior-ess-exit-command . "(exit)\n" ) - (inferior-ess-start-file . nil) ;"~/.ess-VST") - ;;(inferior-ess-start-args . nil) - ) - "Variables to customize for XLS.") - - -(defun VST-mode (&optional proc-name) - "Major mode for editing ViSta source. NOT EVEN STARTED." - (interactive) - (setq ess-customize-alist VST-customize-alist) - (lisp-mode)) - - -(defun ViSta () - "Call 'ViSta', the extend XLispStat statistical system, from Forrest Young." - - (interactive) - (setq ess-customize-alist VST-customize-alist) - (ess-write-to-dribble-buffer - (format "(ViSta): ess-dialect=%s , buf=%s\n" - ess-dialect (current-buffer))) - (inferior-ess)) - - ; Provide package - -(provide 'ess-vst-d) - -;;; ess-vst-d.el ends here diff -Nru ess-18.10.2/lisp/ess-xls-d.el ess-18.10.2+git20220915.f45542e/lisp/ess-xls-d.el --- ess-18.10.2/lisp/ess-xls-d.el 2018-11-10 09:41:11.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/lisp/ess-xls-d.el 1970-01-01 00:00:00.000000000 +0000 @@ -1,105 +0,0 @@ -;;; ess-xls-d.el --- XLispStat customization for ESS. - -;; Copyright (C) 1997 A. J. Rossini -;; Copyright (C) 1998--2004 A.J. Rossini, Richard M. Heiberger, Martin -;; Maechler, Kurt Hornik, Rodney Sparapani, and Stephen Eglen. - -;; Author: A.J. Rossini -;; Created: 12 Jun 1997 -;; Maintainer: ESS-core - -;; Keywords: statistics, languages - -;; This file is part of ESS - -;; This file is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 2, or (at your option) -;; any later version. - -;; This file is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; A copy of the GNU General Public License is available at -;; https://www.r-project.org/Licenses/ - -;;; Commentary: - -;; This file defines all the XLispStat customizations for ESS. See -;; ess-lsp-l.el for general Lisp modifications. - -;;; Code: - -;;; Requires and Autoloads: - -(require 'ess-custom) -(require 'ess-lsp-l) -(require 'ess-utils) -(require 'ess-mode) -(require 'ess-inf) -(require 'ess-trns) - -(defvar ess-help-XLS-sec-keys-alist - '((?a . "Args:")) - "Sparse online XLS help.") - -(defvar XLS-editing-alist Lisp-editing-alist) - -(defvar XLS-customize-alist - '((ess-local-customize-alist . 'XLS-customize-alist) - (ess-language . "XLS" ) - (ess-dialect . "XLS" ) - (ess-mode-editing-alist . XLS-editing-alist ) - (ess-object-name-db-file . "ess-xls-namedb.el" ) - (ess-help-sec-regex . "^[A-Z. ---]+:$") - (ess-help-sec-keys-alist . ess-help-XLS-sec-keys-alist) - (inferior-ess-primary-prompt . "> ?" ) - (inferior-ess-secondary-prompt . "^" ) - (comint-use-prompt-regexp . t) - (inferior-ess-program . inferior-XLS-program) - (inferior-ess-help-command . "(help '%s)\n" ) - (inferior-ess-objects-command . "(variables)\n" ) - (inferior-ess-exit-command . "(exit)\n" ) - ;;(inferior-ess-start-args . "")) - (inferior-ess-start-file . nil)) - "Variables to customize for XLS.") - -;;; The functions of interest (mode, inferior mode) - -;;;###autoload -(defun XLS-mode (&optional proc-name) - "Major mode for editing XLispStat source. NOT EVEN STARTED." - (interactive) - (setq ess-customize-alist XLS-customize-alist) - (ess-mode XLS-customize-alist proc-name) - (setq major-mode 'XLS-mode)) - -;;;###autoload -(add-to-list 'auto-mode-alist '("\\.lsp\\'" . XLS-mode)) - -(fset 'xlispstat-mode 'XLS-mode) - -(defun XLS () - "Call 'XLispStat', the Lisp statistical system from Luke Tierney." - - (interactive) - (setq ess-customize-alist XLS-customize-alist) - (ess-write-to-dribble-buffer - (format "(XLS): ess-dialect=%s , buf=%s\n" - ess-dialect (current-buffer))) - (inferior-ess)) - -(defun xls-transcript-mode () - "Does the right thing." - (interactive) - (ess-transcript-mode XLS-customize-alist)) - -(fset 'XLS-transcript-mode 'xls-transcript-mode) - - ; Provide package - -(provide 'ess-xls-d) - -;;; ess-xls-d.el ends here diff -Nru ess-18.10.2/lisp/julia-mode.el ess-18.10.2+git20220915.f45542e/lisp/julia-mode.el --- ess-18.10.2/lisp/julia-mode.el 2018-07-30 08:31:20.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/lisp/julia-mode.el 1970-01-01 00:00:00.000000000 +0000 @@ -1,3278 +0,0 @@ -;;; 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 23 users who don't use -;; ELPA. -(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 - ;; delimiter - (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) - (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-hanging-operator-regexp - ;; taken from julia-parser.scm - (concat "^[^#\n]+ " - (regexp-opt - '( ;; conditional - "?" - ;; assignment - "=" ":=" "+=" "-=" "*=" "/=" "//=" ".//=" ".*=" "./=" "\\=" ".\\=" - "^=" ".^=" "÷=" ".÷=" "%=" ".%=" "|=" "&=" "$=" "=>" "<<=" ">>=" - ">>>=" "~" ".+=" ".-=" - ;; arrow - "--" "-->" "←" "→" "↔" "↚" "↛" "↠" "↣" "↦" "↮" "⇎" "⇏" "⇒" "⇔" "⇴" - "⇶" "⇷" "⇸" "⇹" "⇺" "⇻" "⇼" "⇽" "⇾" "⇿" "⟵" "⟶" "⟷" "⟷" "⟹" - "⟺" "⟻" "⟼" "⟽" "⟾" "⟿" "⤀" "⤁" "⤂" "⤃" "⤄" "⤅" "⤆" "⤇" "⤌" - "⤍" "⤎" "⤏" "⤐" "⤑" "⤔" "⤕" "⤖" "⤗" "⤘" "⤝" "⤞" "⤟" "⤠" "⥄" "⥅" - "⥆" "⥇" "⥈" "⥊" "⥋" "⥎" "⥐" "⥒" "⥓" "⥖" "⥗" "⥚" "⥛" "⥞" "⥟" "⥢" - "⥤" "⥦" "⥧" "⥨" "⥩" "⥪" "⥫" "⥬" "⥭" "⥰" "⧴" "⬱" "⬰" "⬲" "⬳" "⬴" - "⬵" "⬶" "⬷" "⬸" "⬹" "⬺" "⬻" "⬼" "⬽" "⬾" "⬿" "⭀" "⭁" "⭂" "⭃" "⭄" - "⭇" "⭈" "⭉" "⭊" "⭋" "⭌" "←" "→" - ;; or and and - "&&" "||" - ;; comparison - ">" "<" ">=" "≥" "<=" "≤" "==" "===" "≡" "!=" "≠" "!==" "≢" ".>" - ".<" ".>=" ".≥" ".<=" ".≤" ".==" ".!=" ".≠" ".=" ".!" "<:" ">:" "∈" - "∉" "∋" "∌" "⊆" "⊈" "⊂" "⊄" "⊊" "∝" "∊" "∍" "∥" "∦" "∷" "∺" "∻" "∽" - "∾" "≁" "≃" "≄" "≅" "≆" "≇" "≈" "≉" "≊" "≋" "≌" "≍" "≎" "≐" "≑" "≒" - "≓" "≔" "≕" "≖" "≗" "≘" "≙" "≚" "≛" "≜" "≝" "≞" "≟" "≣" "≦" "≧" "≨" - "≩" "≪" "≫" "≬" "≭" "≮" "≯" "≰" "≱" "≲" "≳" "≴" "≵" "≶" "≷" "≸" "≹" - "≺" "≻" "≼" "≽" "≾" "≿" "⊀" "⊁" "⊃" "⊅" "⊇" "⊉" "⊋" "⊏" "⊐" "⊑" "⊒" - "⊜" "⊩" "⊬" "⊮" "⊰" "⊱" "⊲" "⊳" "⊴" "⊵" "⊶" "⊷" "⋍" "⋐" "⋑" "⋕" "⋖" - "⋗" "⋘" "⋙" "⋚" "⋛" "⋜" "⋝" "⋞" "⋟" "⋠" "⋡" "⋢" "⋣" "⋤" "⋥" "⋦" "⋧" - "⋨" "⋩" "⋪" "⋫" "⋬" "⋭" "⋲" "⋳" "⋴" "⋵" "⋶" "⋷" "⋸" "⋹" "⋺" "⋻" "⋼" - "⋽" "⋾" "⋿" "⟈" "⟉" "⟒" "⦷" "⧀" "⧁" "⧡" "⧣" "⧤" "⧥" "⩦" "⩧" "⩪" "⩫" - "⩬" "⩭" "⩮" "⩯" "⩰" "⩱" "⩲" "⩳" "⩴" "⩵" "⩶" "⩷" "⩸" "⩹" "⩺" "⩻" "⩼" - "⩽" "⩾" "⩿" "⪀" "⪁" "⪂" "⪃" "⪄" "⪅" "⪆" "⪇" "⪈" "⪉" "⪊" "⪋" "⪌" "⪍" - "⪎" "⪏" "⪐" "⪑" "⪒" "⪓" "⪔" "⪕" "⪖" "⪗" "⪘" "⪙" "⪚" "⪛" "⪜" "⪝" "⪞" - "⪟" "⪠" "⪡" "⪢" "⪣" "⪤" "⪥" "⪦" "⪧" "⪨" "⪩" "⪪" "⪫" "⪬" "⪭" "⪮" "⪯" - "⪰" "⪱" "⪲" "⪳" "⪴" "⪵" "⪶" "⪷" "⪸" "⪹" "⪺" "⪻" "⪼" "⪽" "⪾" "⪿" "⫀" - "⫁" "⫂" "⫃" "⫄" "⫅" "⫆" "⫇" "⫈" "⫉" "⫊" "⫋" "⫌" "⫍" "⫎" "⫏" "⫐" "⫑" - "⫒" "⫓" "⫔" "⫕" "⫖" "⫗" "⫘" "⫙" "⫷" "⫸" "⫹" "⫺" "⊢" "⊣" - ;; pipe, colon - "|>" "<|" ":" ".." - ;; plus - "+" "-" "⊕" "⊖" "⊞" "⊟" ".+" ".-" "++" "|" "∪" "∨" "$" "⊔" "±" "∓" - "∔" "∸" "≂" "≏" "⊎" "⊻" "⊽" "⋎" "⋓" "⧺" "⧻" "⨈" "⨢" "⨣" "⨤" "⨥" "⨦" - "⨧" "⨨" "⨩" "⨪" "⨫" "⨬" "⨭" "⨮" "⨹" "⨺" "⩁" "⩂" "⩅" "⩊" "⩌" "⩏" "⩐" - "⩒" "⩔" "⩖" "⩗" "⩛" "⩝" "⩡" "⩢" "⩣" - ;; bitshift - "<<" ">>" ">>>" ".<<" ".>>" ".>>>" - ;; times - "*" "/" "./" "÷" ".÷" "%" "⋅" "∘" "×" ".%" ".*" "\\" - ".\\" "&" "∩" "∧" "⊗" "⊘" "⊙" "⊚" "⊛" "⊠" "⊡" "⊓" "∗" "∙" "∤" "⅋" - "≀" "⊼" "⋄" "⋆" "⋇" "⋉" "⋊" "⋋" "⋌" "⋏" "⋒" "⟑" "⦸" "⦼" "⦾" "⦿" "⧶" - "⧷" "⨇" "⨰" "⨱" "⨲" "⨳" "⨴" "⨵" "⨶" "⨷" "⨸" "⨻" "⨼" "⨽" "⩀" "⩃" "⩄" - "⩋" "⩍" "⩎" "⩑" "⩓" "⩕" "⩘" "⩚" "⩜" "⩞" "⩟" "⩠" "⫛" "⊍" "▷" "⨝" "⟕" - "⟖" "⟗" - ;; rational - "//" ".//" - ;; power - "^" ".^" "↑" "↓" "⇵" "⟰" "⟱" "⤈" "⤉" "⤊" "⤋" "⤒" "⤓" "⥉" "⥌" "⥍" - "⥏" "⥑" "⥔" "⥕" "⥘" "⥙" "⥜" "⥝" "⥠" "⥡" "⥣" "⥥" "⥮" "⥯" "↑" "↓" - ;; decl, dot - "::" ".")) - (regexp-opt '(" #" " \n" "#" "\n")))) - -(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)))) - (? "{" (* (not (any "}"))) "}") - "(" (* (or - (seq "(" (* (not (any "(" ")"))) ")") - (not (any "(" ")")))) - ")" - (* space) - (? "::" (* space) (1+ (not (any space)))) - (* space) - (* (seq "where" (or "{" (+ space)) (+ (not (any "="))))) - "=" - (not (any "=")))) - -(defconst julia-type-regex - (rx symbol-start (or "immutable" "type" ;; remove after 0.6 - "abstract type" "primitive type" "struct" "mutable struct") - (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" "function" "macro" "ccall" - "finally" "break" "continue" "global" "where" - "module" "using" "import" "export" "const" "let" "do" "in" - "baremodule" "importall" - "immutable" "type" "bitstype" "abstract" "typealias" ;; remove after 0.6 - "abstract type" "primitive type" "struct" "mutable struct") - '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" "String" "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 bol 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" "let" "macro" - "quote" "do" "module" - "immutable" "type" ;; remove after 0.6 - "abstract type" "primitive type" "struct" "mutable struct")) - -;; For keywords that begin a block without additional indentation -(defconst julia-block-start-keywords-no-indent - (list "module")) - -(defconst julia-block-end-keywords - (list "end" "else" "elseif" "catch" "finally")) - -(defun julia-stringify-triple-quote () - "Put `syntax-table' property on triple-quoted string delimiters. - -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)) ?:)))) - (not (looking-at "(")) ; handle "function(" when on ( - (member (current-word t) kw-list) - ;; '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))) - (not (julia-in-comment)))) - -;; 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-following-import-export-using () - "If the current line follows an `export` or `import` keyword -with valid syntax, return the position of the keyword, otherwise -`nil`. Works by stepping backwards through comma-separated -symbol, gives up when this is not true." - ;; Implementation accepts a single Module: right after the keyword, and saves - ;; the module name for future use, but does not enforce that `export` has no - ;; module name. - (let ((done nil) ; find keyword or give up - (module nil)) ; found "Module:" - (save-excursion - (beginning-of-line) - (while (and (not done) (< (point-min) (point))) - (julia-safe-backward-sexp) - (cond - ((looking-at (rx (or "import" "export" "using"))) - (setf done (point))) - ((looking-at (rx (group (* (or word (syntax symbol)))) (0+ space) ":")) - (if module - (setf done 'broken) - (setf module (match-string-no-properties 1)))) - ((looking-at (rx (* (or word (syntax symbol))) (0+ space) ",")) - (when module (setf done 'broken))) - (t (setf done 'broken))))) - (if (eq done 'broken) - nil - done))) - -(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)) - ((and (equal (current-word t) "end") - (not (julia-in-comment))) - (- 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))) - -(defcustom 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, but stops indenting in the middle of long blocks if set too low." - :type 'integer - :group 'julia) - -(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 - (beginning-of-line) - (let ((parser-state (syntax-ppss))) - (cond ((nth 3 parser-state) nil) ;; strings - ((= (nth 0 parser-state) 0) nil) ;; top level - (t - (ignore-errors ;; return nil if any of these movements fail - (beginning-of-line) - (skip-syntax-forward " ") - (let ((possibly-close-paren-point (point))) - (backward-up-list) - (let ((open-paren-point (point))) - (forward-char) - (skip-syntax-forward " ") - (if (eolp) - (progn - (up-list) - (backward-char) - (let ((paren-closed (= (point) possibly-close-paren-point))) - (goto-char open-paren-point) - (beginning-of-line) - (skip-syntax-forward " ") - (+ (current-column) - (if paren-closed - 0 - julia-indent-offset)))) - (current-column)))))))))) - -(defun julia-prev-line-skip-blank-or-comment () - "Move point to beginning of previous line skipping blank lines -and lines including only comments. Returns number of lines moved. -A return of -1 signals that we moved to the first line of -the (possibly narrowed) buffer, so there is nowhere else to go." - (catch 'result - (let ((moved 0) this-move) - (while t - (setq this-move (forward-line -1)) - (cond - ;; moved into comment or blank - ((and (= 0 this-move) - (or (looking-at-p "^\\s-*\\(?:#.*\\)*$") - (julia-in-comment))) - (incf moved)) - ;; success - ((= 0 this-move) - (throw 'result (1+ moved))) - ;; on first line and in comment - ((and (bobp) - (or (looking-at-p "^\\s-*\\(?:#.*\\)*$") - (julia-in-comment))) - (throw 'result -1)) - ((bobp) - (throw 'result moved)) - (t - (throw 'result 0))))))) - -(defun julia-indent-hanging () - "Calculate indentation for lines that follow \"hanging\" -operators (operators that end the previous line) as defined in -`julia-hanging-operator-regexp'. An assignment operator ending -the previous line increases the indent as do the other operators -unless another operator is found two lines up. Previous line -means previous line after skipping blank lines and lines with -only comments." - (let (prev-indent) - (save-excursion - (when (> (julia-prev-line-skip-blank-or-comment) 0) - (setq prev-indent (current-indentation)) - (when (looking-at-p julia-hanging-operator-regexp) - (if (and (> (julia-prev-line-skip-blank-or-comment) 0) - (looking-at-p julia-hanging-operator-regexp)) - ;; two preceding hanging operators => indent same as line - ;; above - prev-indent - ;; one preceding hanging operator => increase indent from line - ;; above - (+ julia-indent-offset prev-indent))))))) - -(defun julia-indent-in-string () - "Indentation inside strings with newlines is \"manual\", -meaning always increase indent on TAB and decrease on S-TAB." - (save-excursion - (beginning-of-line) - (when (julia-in-string) - (if (member this-command '(julia-latexsub-or-indent - ess-indent-or-complete)) - (+ julia-indent-offset (current-indentation)) - ;; return the current indentation to prevent other functions from - ;; indenting inside strings - (current-indentation))))) - -(defun julia-indent-import-export-using () - "Indent offset for lines that follow `import` or `export`, otherwise nil." - (when (julia-following-import-export-using) - julia-indent-offset)) - -(defun julia-indent-line () - "Indent current line of julia code." - (interactive) - (let* ((point-offset (- (current-column) (current-indentation)))) - (indent-line-to - (or - ;; note: if this first function returns nil the beginning of the line - ;; cannot be in a string - (julia-indent-in-string) - ;; If we're inside an open paren, indent to line up arguments. After this, - ;; we cannot be inside parens which includes brackets - (julia-paren-indent) - ;; indent due to hanging operators (lines ending in an operator) - (julia-indent-hanging) - ;; indent for import and export - (julia-indent-import-export-using) - ;; Indent according to how many nested blocks we are in. - (save-excursion - (beginning-of-line) - ;; jump out of any comments - (let ((state (syntax-ppss))) - (when (nth 4 state) - (goto-char (nth 8 state)))) - (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 (or endtok - (julia-at-keyword julia-block-start-keywords-no-indent)) - (- 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))))) - -(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")) - -(defun julia-manual-deindent () - "Deindent by `julia-indent-offset' regardless of current -indentation context. To be used to manually indent inside -strings." - (interactive) - (indent-line-to (max 0 (- (current-indentation) julia-indent-offset)))) -(define-key julia-mode-map (kbd "") 'julia-manual-deindent) - -(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 "\\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 "\\underleftrightarrow" "͍" 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 "\\varepsilon" "ε" 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" "ᴬ" julia-latexsubs) -(puthash "\\^B" "ᴮ" julia-latexsubs) -(puthash "\\^D" "ᴰ" julia-latexsubs) -(puthash "\\^E" "ᴱ" julia-latexsubs) -(puthash "\\^G" "ᴳ" julia-latexsubs) -(puthash "\\^H" "ᴴ" julia-latexsubs) -(puthash "\\^I" "ᴵ" julia-latexsubs) -(puthash "\\^J" "ᴶ" julia-latexsubs) -(puthash "\\^K" "ᴷ" julia-latexsubs) -(puthash "\\^L" "ᴸ" julia-latexsubs) -(puthash "\\^M" "ᴹ" julia-latexsubs) -(puthash "\\^N" "ᴺ" julia-latexsubs) -(puthash "\\^O" "ᴼ" julia-latexsubs) -(puthash "\\^P" "ᴾ" julia-latexsubs) -(puthash "\\^R" "ᴿ" julia-latexsubs) -(puthash "\\^T" "ᵀ" julia-latexsubs) -(puthash "\\^U" "ᵁ" julia-latexsubs) -(puthash "\\^W" "ᵂ" julia-latexsubs) -(puthash "\\^a" "ᵃ" julia-latexsubs) -(puthash "\\^alpha" "ᵅ" julia-latexsubs) -(puthash "\\^b" "ᵇ" julia-latexsubs) -(puthash "\\^d" "ᵈ" julia-latexsubs) -(puthash "\\^e" "ᵉ" julia-latexsubs) -(puthash "\\^epsilon" "ᵋ" julia-latexsubs) -(puthash "\\^g" "ᵍ" julia-latexsubs) -(puthash "\\^k" "ᵏ" julia-latexsubs) -(puthash "\\^m" "ᵐ" julia-latexsubs) -(puthash "\\^o" "ᵒ" julia-latexsubs) -(puthash "\\^p" "ᵖ" julia-latexsubs) -(puthash "\\^t" "ᵗ" julia-latexsubs) -(puthash "\\^u" "ᵘ" julia-latexsubs) -(puthash "\\^v" "ᵛ" julia-latexsubs) -(puthash "\\^beta" "ᵝ" julia-latexsubs) -(puthash "\\^gamma" "ᵞ" julia-latexsubs) -(puthash "\\^delta" "ᵟ" julia-latexsubs) -(puthash "\\^phi" "ᵠ" julia-latexsubs) -(puthash "\\^chi" "ᵡ" julia-latexsubs) -(puthash "\\_i" "ᵢ" julia-latexsubs) -(puthash "\\_r" "ᵣ" julia-latexsubs) -(puthash "\\_u" "ᵤ" julia-latexsubs) -(puthash "\\_v" "ᵥ" julia-latexsubs) -(puthash "\\_beta" "ᵦ" julia-latexsubs) -(puthash "\\_gamma" "ᵧ" julia-latexsubs) -(puthash "\\_rho" "ᵨ" julia-latexsubs) -(puthash "\\_phi" "ᵩ" julia-latexsubs) -(puthash "\\_chi" "ᵪ" julia-latexsubs) -(puthash "\\^c" "ᶜ" julia-latexsubs) -(puthash "\\^f" "ᶠ" julia-latexsubs) -(puthash "\\^iota" "ᶥ" julia-latexsubs) -(puthash "\\^Phi" "ᶲ" julia-latexsubs) -(puthash "\\^z" "ᶻ" julia-latexsubs) -(puthash "\\^theta" "ᶿ" 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 "\\ldots" "…" 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" "ₐ" julia-latexsubs) -(puthash "\\_e" "ₑ" julia-latexsubs) -(puthash "\\_o" "ₒ" julia-latexsubs) -(puthash "\\_x" "ₓ" julia-latexsubs) -(puthash "\\_schwa" "ₔ" julia-latexsubs) -(puthash "\\_h" "ₕ" julia-latexsubs) -(puthash "\\_k" "ₖ" julia-latexsubs) -(puthash "\\_l" "ₗ" julia-latexsubs) -(puthash "\\_m" "ₘ" julia-latexsubs) -(puthash "\\_n" "ₙ" julia-latexsubs) -(puthash "\\_p" "ₚ" julia-latexsubs) -(puthash "\\_s" "ₛ" julia-latexsubs) -(puthash "\\_t" "ₜ" 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" "⃬" julia-latexsubs) -(puthash "\\underleftharpoondown" "⃭" julia-latexsubs) -(puthash "\\underleftarrow" "⃮" julia-latexsubs) -(puthash "\\underrightarrow" "⃯" julia-latexsubs) -(puthash "\\asteraccent" "⃰" 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 "\\euler" "ℯ" 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" "ℼ" 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 "\\to" "→" 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 "\\leftwavearrow" "↜" julia-latexsubs) -(puthash "\\rightwavearrow" "↝" 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 "\\emptyset" "∅" 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 "\\xor" "⊻" 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 "\\varbarwedge" "⌅" 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 "\\overbrace" "⏞" julia-latexsubs) -(puthash "\\underbrace" "⏟" julia-latexsubs) -(puthash "\\trapezium" "⏢" julia-latexsubs) -(puthash "\\benzenr" "⏣" julia-latexsubs) -(puthash "\\strns" "⏤" julia-latexsubs) -(puthash "\\fltns" "⏥" julia-latexsubs) -(puthash "\\accurrent" "⏦" julia-latexsubs) -(puthash "\\elinters" "⏧" 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 "\\smallblacktriangleright" "▸" julia-latexsubs) -(puthash "\\smalltriangleright" "▹" 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 "\\smallblacktriangleleft" "◂" julia-latexsubs) -(puthash "\\smalltriangleleft" "◃" 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 "\\leftmoon" "☾" 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" "♾" 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" "⚥" julia-latexsubs) -(puthash "\\mdwhtcircle" "⚪" julia-latexsubs) -(puthash "\\mdblkcircle" "⚫" julia-latexsubs) -(puthash "\\mdsmwhtcircle" "⚬" julia-latexsubs) -(puthash "\\neuter" "⚲" 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" "⟀" julia-latexsubs) -(puthash "\\whiteinwhitetriangle" "⟁" julia-latexsubs) -(puthash "\\perp" "⟂" julia-latexsubs) -(puthash "\\bsolhsub" "⟈" julia-latexsubs) -(puthash "\\suphsol" "⟉" julia-latexsubs) -(puthash "\\wedgedot" "⟑" julia-latexsubs) -(puthash "\\upin" "⟒" julia-latexsubs) -(puthash "\\leftouterjoin" "⟕" julia-latexsubs) -(puthash "\\rightouterjoin" "⟖" julia-latexsubs) -(puthash "\\fullouterjoin" "⟗" julia-latexsubs) -(puthash "\\bigbot" "⟘" julia-latexsubs) -(puthash "\\bigtop" "⟙" julia-latexsubs) -(puthash "\\llbracket" "⟦" julia-latexsubs) -(puthash "\\openbracketleft" "⟦" julia-latexsubs) -(puthash "\\openbracketright" "⟧" julia-latexsubs) -(puthash "\\rrbracket" "⟧" 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 "\\impliedby" "⟸" julia-latexsubs) -(puthash "\\Longleftarrow" "⟸" julia-latexsubs) -(puthash "\\implies" "⟹" julia-latexsubs) -(puthash "\\Longrightarrow" "⟹" julia-latexsubs) -(puthash "\\Longleftrightarrow" "⟺" julia-latexsubs) -(puthash "\\iff" "⟺" 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 "\\Join" "⨝" 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" "⬒" julia-latexsubs) -(puthash "\\squarebotblack" "⬓" julia-latexsubs) -(puthash "\\squareurblack" "⬔" julia-latexsubs) -(puthash "\\squarellblack" "⬕" julia-latexsubs) -(puthash "\\diamondleftblack" "⬖" julia-latexsubs) -(puthash "\\diamondrightblack" "⬗" julia-latexsubs) -(puthash "\\diamondtopblack" "⬘" julia-latexsubs) -(puthash "\\diamondbotblack" "⬙" julia-latexsubs) -(puthash "\\dottedsquare" "⬚" julia-latexsubs) -(puthash "\\lgblksquare" "⬛" julia-latexsubs) -(puthash "\\lgwhtsquare" "⬜" julia-latexsubs) -(puthash "\\vysmblksquare" "⬝" julia-latexsubs) -(puthash "\\vysmwhtsquare" "⬞" julia-latexsubs) -(puthash "\\pentagonblack" "⬟" julia-latexsubs) -(puthash "\\pentagon" "⬠" julia-latexsubs) -(puthash "\\varhexagon" "⬡" julia-latexsubs) -(puthash "\\varhexagonblack" "⬢" julia-latexsubs) -(puthash "\\hexagonblack" "⬣" julia-latexsubs) -(puthash "\\lgblkcircle" "⬤" julia-latexsubs) -(puthash "\\mdblkdiamond" "⬥" julia-latexsubs) -(puthash "\\mdwhtdiamond" "⬦" julia-latexsubs) -(puthash "\\mdblklozenge" "⬧" julia-latexsubs) -(puthash "\\mdwhtlozenge" "⬨" julia-latexsubs) -(puthash "\\smblkdiamond" "⬩" julia-latexsubs) -(puthash "\\smblklozenge" "⬪" julia-latexsubs) -(puthash "\\smwhtlozenge" "⬫" julia-latexsubs) -(puthash "\\blkhorzoval" "⬬" julia-latexsubs) -(puthash "\\whthorzoval" "⬭" julia-latexsubs) -(puthash "\\blkvertoval" "⬮" julia-latexsubs) -(puthash "\\whtvertoval" "⬯" julia-latexsubs) -(puthash "\\circleonleftarrow" "⬰" julia-latexsubs) -(puthash "\\leftthreearrows" "⬱" julia-latexsubs) -(puthash "\\leftarrowonoplus" "⬲" julia-latexsubs) -(puthash "\\longleftsquigarrow" "⬳" julia-latexsubs) -(puthash "\\nvtwoheadleftarrow" "⬴" julia-latexsubs) -(puthash "\\nVtwoheadleftarrow" "⬵" julia-latexsubs) -(puthash "\\twoheadmapsfrom" "⬶" julia-latexsubs) -(puthash "\\twoheadleftdbkarrow" "⬷" julia-latexsubs) -(puthash "\\leftdotarrow" "⬸" julia-latexsubs) -(puthash "\\nvleftarrowtail" "⬹" julia-latexsubs) -(puthash "\\nVleftarrowtail" "⬺" julia-latexsubs) -(puthash "\\twoheadleftarrowtail" "⬻" julia-latexsubs) -(puthash "\\nvtwoheadleftarrowtail" "⬼" julia-latexsubs) -(puthash "\\nVtwoheadleftarrowtail" "⬽" julia-latexsubs) -(puthash "\\leftarrowx" "⬾" julia-latexsubs) -(puthash "\\leftcurvedarrow" "⬿" julia-latexsubs) -(puthash "\\equalleftarrow" "⭀" julia-latexsubs) -(puthash "\\bsimilarleftarrow" "⭁" julia-latexsubs) -(puthash "\\leftarrowbackapprox" "⭂" julia-latexsubs) -(puthash "\\rightarrowgtr" "⭃" julia-latexsubs) -(puthash "\\rightarrowsupset" "⭄" julia-latexsubs) -(puthash "\\LLeftarrow" "⭅" julia-latexsubs) -(puthash "\\RRightarrow" "⭆" julia-latexsubs) -(puthash "\\bsimilarrightarrow" "⭇" julia-latexsubs) -(puthash "\\rightarrowbackapprox" "⭈" julia-latexsubs) -(puthash "\\similarleftarrow" "⭉" julia-latexsubs) -(puthash "\\leftarrowapprox" "⭊" julia-latexsubs) -(puthash "\\leftarrowbsimilar" "⭋" julia-latexsubs) -(puthash "\\rightarrowbsimilar" "⭌" julia-latexsubs) -(puthash "\\medwhitestar" "⭐" julia-latexsubs) -(puthash "\\medblackstar" "⭑" julia-latexsubs) -(puthash "\\smwhitestar" "⭒" julia-latexsubs) -(puthash "\\rightpentagonblack" "⭓" julia-latexsubs) -(puthash "\\rightpentagon" "⭔" julia-latexsubs) -(puthash "\\_j" "ⱼ" julia-latexsubs) -(puthash "\\^V" "ⱽ" julia-latexsubs) -(puthash "\\postalmark" "〒" 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) -(puthash "\\mscrl" "𝓁" 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) -(puthash "\\imath" "𝚤" julia-latexsubs) -(puthash "\\jmath" "𝚥" 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) -(puthash "\\mbfDigamma" "𝟊" julia-latexsubs) -(puthash "\\mbfdigamma" "𝟋" 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 "^\\w*> " - "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) - -;;;###autoload -(defalias 'run-julia #'inferior-julia - "Run an inferior instance of `julia' inside Emacs.") - -(provide 'julia-mode) - -;; Local Variables: -;; coding: utf-8 -;; byte-compile-warnings: (not obsolete) -;; End: -;;; julia-mode.el ends here diff -Nru ess-18.10.2/lisp/Makefile ess-18.10.2+git20220915.f45542e/lisp/Makefile --- ess-18.10.2/lisp/Makefile 2018-11-10 09:41:11.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/lisp/Makefile 2022-10-15 08:06:36.000000000 +0000 @@ -1,81 +1,61 @@ ### Makefile - for compiled e-lisp of ESS distribution. -### ## Before making changes here, please take a look at Makeconf include ../Makeconf -## For noweb extraction of code and documentation. + +### Targets -NOTANGLE=notangle -L -#NOTANGLE=notangle for no indexing. -NOWEAVE=noweave - -## SUFFIXES are in ../Makeconf : -.nw.html: ; $(NOWEAVE) -filter l2h -index -html $*.nw > $*.html -.nw.tex: ; $(NOWEAVE) -index -delay $*.nw | cpif $*.tex -.nw.el: ; $(NOTANGLE) -R$*.el | cpif $*.el -##.nw.c: ; $(NOTANGLE) -R$*.c | cpif $*.c -##.nw.h: ; $(NOTANGLE) -R$*.h | cpif $*.h -.tex.dvi: ; latex '\scrollmode \input '"$*"; while grep -s 'Rerun to get cross-references right' $*.log; do latex '\scrollmode \input '"$*"; done - -# Have to preload the files that contain macro definitions or the byte compiler -# will compile everything that references them incorrectly. Also preload a file -# that sets byte compiler options. -COMPILE = $(EMACSBATCH) --directory . -f batch-byte-compile +.PHONY: all dist install uninstall distclean clean compile -ELS = $(wildcard *.el obsolete/*.el) -ELS := $(filter-out ess-autoloads.el, $(ELS)) +JULIAS := julia-mode.el julia-mode-latexsubs.el +ELS = $(filter-out ess-autoloads.el, $(wildcard *.el)) $(JULIAS) +##ELS = $(filter-out ess-autoloads.el, $(wildcard *.el obsolete/*.el)) $(JULIAS) ELC = $(ELS:.el=.elc) -# ESSR_VER =`cat ../etc/ESSR-VERSION` -##ESSR_VER = $(shell cat ../etc/ESSR-VERSION) - -### Targets - -all: julia-mode.el $(ELC) ess-custom.el ess-autoloads.el +all dist: compile ess-autoloads.el -.PHONY: dist -dist: all +compile: $(ELC) install: dist -$(INSTALLDIR) $(LISPDIR) + $(INSTALL) $(ELS) ess-autoloads.el $(LISPDIR) $(INSTALL) $(ELC) $(LISPDIR) if [ -f /etc/debian_version -a -n "$(SITELISP)" -a ! -f "$(SITELISP)/ess-site.el" ] ; \ then \ ln -s $(LISPDIR)/ess-site.el $(SITELISP)/ess-site.el ; \ fi; -# test "$(LISPDIR)" = "." || $(INSTALL) *.elc $(LISPDIR) -uninstall: - -cd $(LISPDIR) && $(UNINSTALL) *.elc *.el - if [ -n "$(SITELISP)" -a -h "$(SITELISP)/ess-site.el" ] ; \ - then \ - cd $(SITELISP) && $(UNINSTALL) ess-site.el ; \ - fi; +distclean clean: + rm -f $(ELC) ess-autoloads.el $(JULIAS) .dependencies -clean: - rm -f $(ELC) - rm -f ess-autoloads.el - -distclean: clean -# and potentially more - -### Targets below here are only for developers - and these must have perl - -### Replace Version numbers (as in ../doc/Makefile !): -## "../VERSION" if that changes, *definitely* need to update ess-custom.el -ess-custom.el: ../VERSION - EV='$(ESSVERSION)'; perl -pi -e "s/\".*\"/\"$$EV\"/ if /ess-version/" $@ + +### File Targets -# ess-r-mode.el: ../etc/ESSR-VERSION -# sed -i -e '/let.*ESSR-version/s/"[-.0-9]*"/"$(ESSR_VER)"/' $@ +.dependencies: $(ELS) + @echo Computing dependencies + @rm -f .dependencies + @for f in $(ELS); do \ + sed -n "s|^(require '\(ess.*\)).*$$|$${f}c: \1.elc|p" $${f} >> .dependencies;\ + done +## @for f in obsolete/*.el; do \ +## echo "$$(basename $${f}c):$${f}c" >> .dependencies;\ +## done -## Should happen before building ESS; definitely *NOT* after unpacking tarball : -julia-mode.el: - test -f ../etc/.IS.RELEASE || $(DOWNLOAD) \ - https://raw.githubusercontent.com/JuliaEditorSupport/julia-emacs/master/julia-mode.el > $@ +-include .dependencies -ess-julia.elc: julia-mode.elc +.el.elc: + $(COMPILE) $< +##obsolete/%.elc: obsolete/%.el +## $(COMPILE-SIMPLE) $< + +JULIA-REPO=https://raw.githubusercontent.com/JuliaEditorSupport/julia-emacs/master +## Should happen before building ESS; definitely *NOT* after unpacking tarball : +$(JULIAS): + test -f ../etc/.IS.RELEASE || $(DOWNLOAD) $(JULIA-REPO)/julia-mode.el > julia-mode.el + test -f ../etc/.IS.RELEASE || $(DOWNLOAD) $(JULIA-REPO)/julia-mode-latexsubs.el > julia-mode-latexsubs.el +julia-%.elc: julia-%.el + $(COMPILE-SIMPLE) $< ess-autoloads.el: @printf "\nGenerating $@\n" @@ -85,90 +65,3 @@ (setq find-file-visit-truename t)\ (update-directory-autoloads default-directory))" -### File Dependencies - -.el.elc: - $(COMPILE) $< - -ess-custom.elc: ess-custom.el - $(COMPILE) ess-custom.el - -ess.elc: ess.el ess-custom.elc - $(COMPILE) ess.el - -ess-site.elc: ess-site.el ess.elc - -ess-inf.elc: ess-inf.el $(CORE) -# @echo " " -# @echo "For the next compile, please disregard the messages" -# @echo " ** the function set-keymap-parent is not known to be defined." -# @echo " ** assignment to free variable comint-last-input-end" -# @echo "from the byte compiler if they occur. It is completely normal." - $(COMPILE) ess-inf.el - -ess-trns.elc: ess-trns.el $(CORE) - $(COMPILE) ess-trns.el - -ess-help.elc: ess-help.el $(CORE) - -## S languages - -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-lang.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-lang.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 - -## Lisp Languages - -ess-lsp-l.elc : ess-lsp-l.el ess.elc - -ess-xls-d.elc : ess-xls-d.el ess-lsp-l.elc ess.elc - -ess-vst-d.elc : ess-vst-d.el ess-lsp-l.elc ess.elc - -## SAS - -ess-sas-l.elc : ess-sas-l.el ess-sas-a.el ess.elc - -ess-sas-d.elc : ess-sas-d.el ess-sas-l.elc ess.elc - -## Stata - -ess-stata-lang.elc : ess-stata-lang.el ess.elc - -ess-stata-mode.elc : ess-stata-mode.el ess.elc - -## BUGS - -ess-bugs-l.elc : ess-bugs-l.el - -ess-bugs-d.elc : ess-bugs-d.el ess-bugs-l.elc - -## JAGS - -ess-jags-d.elc : ess-jags-d.el ess-bugs-l.elc ess-utils.elc ess-inf.elc - -## GRETL - -ess-gretl.elc : ess-gretl.el - -ess-r-gui.elc : ess-r-gui.el ess-dde.elc - - -# Ignore this. -#(defun S-insert-make-rule (file) -# (interactive "sFile:") -# (insert (format "%s.elc: %s.el $(CORE)\n\t@echo compiling %s.el...\n\t@$(COMPILE) %s.el" file file file file))) - -# Use this to print an envvar for debugging purposes. -# Example: make print-EMACS -print-%: ; @echo $* = $($*) diff -Nru ess-18.10.2/lisp/make-regexp.el ess-18.10.2+git20220915.f45542e/lisp/make-regexp.el --- ess-18.10.2/lisp/make-regexp.el 2018-11-10 09:41:11.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/lisp/make-regexp.el 1970-01-01 00:00:00.000000000 +0000 @@ -1,238 +0,0 @@ -;;; make-regexp.el --- generate efficient regexps to match strings. - -;; Copyright (C) 1994, 1995 Simon Marshall. - -;; Author: Simon Marshall -;; Keywords: lisp, matching -;; Version: 1.02 - -;; LCD Archive Entry: -;; make-regexp|Simon Marshall|simon@gnu.ai.mit.edu| -;; Generate efficient regexps to match strings.| -;; 11-Jul-1995|1.02|~/functions/make-regexp.el.gz| - -;; The archive is archive.cis.ohio-state.edu in /pub/gnu/emacs/elisp-archive. - -;;; This file is not part of GNU Emacs. - -;;; This program is free software; you can redistribute it and/or modify -;;; it under the terms of the GNU General Public License as published by -;;; the Free Software Foundation; either version 2, or (at your option) -;;; any later version. - -;;; This program is distributed in the hope that it will be useful, -;;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;;; GNU General Public License for more details. - -;; A copy of the GNU General Public License is available at -;; https://www.r-project.org/Licenses/ - -;;; Commentary: - -;; Purpose: -;; -;; To make efficient regexps from lists of strings. - -;; For example: -;; -;; (let ((strings '("cond" "if" "while" "let\\*?" "prog1" "prog2" "progn" -;; "catch" "throw" "save-restriction" "save-excursion" -;; "save-window-excursion" "save-match-data" -;; "unwind-protect" "condition-case" "track-mouse"))) -;; (concat "(" (make-regexp strings t))) -;; -;; => "(\\(c\\(atch\\|ond\\(\\|ition-case\\)\\)\\|if\\|let\\*?\\|prog[12n]\\|save-\\(excursion\\|match-data\\|restriction\\|window-excursion\\)\\|t\\(hrow\\|rack-mouse\\)\\|unwind-protect\\|while\\)" -;; -;; To search for the above regexp takes about 70% of the time as for the simple -;; (concat "(\\(" (mapconcat 'identity strings "\\|") "\\)") regexp. -;; -;; Obviously, the more the similarity between strings, the faster the regexp: -;; -;; (make-regexp '("abort" "abs" "accept" "access" "array" "begin" "body" "case" -;; "constant" "declare" "delay" "delta" "digits" "else" "elsif" -;; "entry" "exception" "exit" "function" "generic" "goto" "if" -;; "others" "limited" "loop" "mod" "new" "null" "out" "subtype" -;; "package" "pragma" "private" "procedure" "raise" "range" -;; "record" "rem" "renames" "return" "reverse" "select" -;; "separate" "task" "terminate" "then" "type" "when" "while" -;; "with" "xor")) -;; -;; => "a\\(b\\(ort\\|s\\)\\|cce\\(pt\\|ss\\)\\|rray\\)\\|b\\(egin\\|ody\\)\\|c\\(ase\\|onstant\\)\\|d\\(e\\(clare\\|l\\(ay\\|ta\\)\\)\\|igits\\)\\|e\\(ls\\(e\\|if\\)\\|ntry\\|x\\(ception\\|it\\)\\)\\|function\\|g\\(eneric\\|oto\\)\\|if\\|l\\(imited\\|oop\\)\\|mod\\|n\\(ew\\|ull\\)\\|o\\(thers\\|ut\\)\\|p\\(ackage\\|r\\(agma\\|ivate\\|ocedure\\)\\)\\|r\\(a\\(ise\\|nge\\)\\|e\\(cord\\|m\\|names\\|turn\\|verse\\)\\)\\|s\\(e\\(lect\\|parate\\)\\|ubtype\\)\\|t\\(ask\\|erminate\\|hen\\|ype\\)\\|w\\(h\\(en\\|ile\\)\\|ith\\)\\|xor" -;; -;; To search for the above regexp takes less than 60% of the time of the simple -;; mapconcat equivalent. -;; -;; But even small regexps may be worth it: -;; -;; (make-regexp '("and" "at" "do" "end" "for" "in" "is" "not" "of" "or" "use")) -;; => "a\\(nd\\|t\\)\\|do\\|end\\|for\\|i[ns]\\|not\\|o[fr]\\|use" -;; -;; as this is 10% faster than the mapconcat equivalent. - -;; Installation: -;; -;; (autoload 'make-regexp "make-regexp" -;; "Return a regexp to match a string item in STRINGS.") -;; -;; (autoload 'make-regexps "make-regexp" -;; "Return a regexp to REGEXPS.") -;; -;; Since these functions were written to produce efficient regexps, not regexps -;; efficiently, it is probably not a good idea to in-line too many calls in -;; your code, unless you use the following neat trick with `eval-when-compile': -;; -;; (defvar definition-regexp -;; (let ((regexp (eval-when-compile -;; (make-regexp '("defun" "defsubst" "defmacro" "defalias" -;; "defvar" "defconst" "defadvice") t)))) -;; (concat "^(" regexp))) -;; -;; The `byte-compile' code will be as if you had defined the variable thus: -;; -;; (defvar definition-regexp -;; "^(\\(def\\(a\\(dvice\\|lias\\)\\|const\\|macro\\|subst\\|un\\|var\\)\\)") - -;; Feedback: -;; -;; Originally written for font-lock, from an idea from Stig's hl319. -;; Please don't tell me that it doesn't produce optimal regexps; I know that -;; already. But (ideas or) code to improve things (are) is welcome. Please -;; test your code and tell me the speed up in searching an appropriate buffer. -;; -;; Please send me bug reports, bug fixes, and extensions, etc. -;; Simon Marshall - -;; History: -;; -;; 1.00--1.01: -;; - Made `make-regexp' take `lax' to force top-level parentheses. -;; - Fixed `make-regexps' for MATCH bug and new `font-lock-keywords'. -;; - Added `unfontify' to user timing functions. -;; 1.01--1.02: -;; - Made `make-regexp' `let' a big `max-lisp-eval-depth'. - -;; The basic idea is to find the shortest common non-"" prefix each time, and -;; squirrel it out. If there is no such prefix, we divide the list into two so -;; that (at least) one half will have at least a one-character common prefix. - -;; In addition, we (a) delay the addition of () parenthesis as long as possible -;; (until we're sure we need them), and (b) try to squirrel out one-character -;; sequences (so we can use [] rather than ()). - -;;; Code: - -(defun make-regexp (strings &optional paren lax) - "Return a regexp to match a string item in STRINGS. -If optional PAREN non-nil, output regexp parentheses around returned regexp. -If optional LAX non-nil, don't output parentheses if it doesn't require them. -Merges keywords to avoid backtracking in Emacs' regexp matcher." - (let* ((max-lisp-eval-depth (* 1024 1024)) - (strings (let ((l strings)) ; Paranoia---make strings unique! - (while l (setq l (setcdr l (delete (car l) (cdr l))))) - (sort strings 'string-lessp))) - (open-paren (if paren "\\(" "")) (close-paren (if paren "\\)" "")) - (open-lax (if lax "" open-paren)) (close-lax (if lax "" close-paren)) - (completion-ignore-case nil)) - (cond - ;; If there's only one string, just return it. - ((= (length strings) 1) - (concat open-lax (car strings) close-lax)) - ;; If there's an empty string, pull it out. - ((string= (car strings) "") - (if (and (= (length strings) 2) (= (length (nth 1 strings)) 1)) - (concat open-lax (nth 1 strings) "?" close-lax) - (concat open-paren "\\|" (make-regexp (cdr strings)) close-paren))) - ;; If there are only one-character strings, make a [] list instead. - ((= (length strings) (apply '+ (mapcar 'length strings))) - (concat open-lax "[" (mapconcat 'identity strings "") "]" close-lax)) - (t - ;; We have a list of strings. Is there a common prefix? - (let ((prefix (try-completion "" (mapcar 'list strings)))) - (if (> (length prefix) 0) - ;; Common prefix! Squirrel it out and recurse with the suffixes. - (let* ((len (length prefix)) - (sufs (mapcar (lambda (str) (substring str len)) strings))) - (concat open-paren prefix (make-regexp sufs t t) close-paren)) - ;; No common prefix. Is there a one-character sequence? - (let ((letters (let ((completion-regexp-list '("^.$"))) - (all-completions "" (mapcar 'list strings))))) - (if (> (length letters) 1) - ;; Do the one-character sequences, then recurse on the rest. - (let ((rest (let ((completion-regexp-list '("^..+$"))) - (all-completions "" (mapcar 'list strings))))) - (concat open-paren - (make-regexp letters) "\\|" (make-regexp rest) - close-paren)) - ;; No one-character sequence, so divide the list into two by - ;; dividing into those that start with a particular letter, and - ;; those that do not. - (let* ((char (substring (car strings) 0 1)) - (half1 (all-completions char (mapcar 'list strings))) - (half2 (nthcdr (length half1) strings))) - (concat open-paren - (make-regexp half1) "\\|" (make-regexp half2) - close-paren)))))))))) - -;; This stuff is realy for font-lock... - -;; Ahhh, the wonders of lisp... -(defun regexp-span (regexp &optional start) - "Return the span or depth of REGEXP. -This means the number of \"\\\\(...\\\\)\" pairs in REGEXP, optionally from START." - (let ((match (string-match (regexp-quote "\\(") regexp (or start 0)))) - (if (not match) 0 (1+ (regexp-span regexp (match-end 0)))))) - -;; The basic idea is to concat the regexps together, keeping count of the span -;; of the regexps so that we can get the correct match for hilighting. -(defun make-regexps (&rest regexps) - "Return a regexp to match REGEXPS -Each item of REGEXPS should be of the form: - - STRING ; A STRING to be used literally. - (STRING MATCH FACE DATA) ; Match STRING at depth MATCH with FACE - ; and highlight according to DATA. - (STRINGS FACE DATA) ; STRINGS is a list of strings FACE is - ; to highlight according to DATA. - -Returns a list of the form: - - (REGEXP (MATCH FACE DATA) ...) - -For example: - - (make-regexps \"^(\" - '((\"defun\" \"defalias\" \"defsubst\" \"defadvice\") keyword) - \"[ \t]*\" - '(\"\\\\([a-zA-Z-]+\\\\)?\" 1 function-name nil t)) - - => - - (\"^(\\\\(def\\\\(a\\\\(dvice\\\\|lias\\\\)\\\\|subst\\\\|un\\\\)\\\\)[ ]*\\\\([a-zA-Z-]+\\\\)?\" - (1 keyword) (4 function-name nil t)) - -Uses `make-regexp' to make efficient regexps." - (let ((regexp "") (data ())) - (while regexps - (cond ((stringp (car regexps)) - (setq regexp (concat regexp (car regexps)))) - ((stringp (nth 0 (car regexps))) - (setq data (cons (cons (+ (regexp-span regexp) - (nth 1 (car regexps))) - (nthcdr 2 (car regexps))) - data) - regexp (concat regexp (nth 0 (car regexps))))) - (t - (setq data (cons (cons (1+ (regexp-span regexp)) - (cdr (car regexps))) - data) - regexp (concat regexp (make-regexp (nth 0 (car regexps)) - t))))) - (setq regexps (cdr regexps))) - (cons regexp (nreverse data)))) - -;; timing functions removed due to name collisions with Gnus - -(provide 'make-regexp) - -;;; make-regexp.el ends here diff -Nru ess-18.10.2/lisp/mouseme.el ess-18.10.2+git20220915.f45542e/lisp/mouseme.el --- ess-18.10.2/lisp/mouseme.el 2018-11-10 09:41:11.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/lisp/mouseme.el 1970-01-01 00:00:00.000000000 +0000 @@ -1,355 +0,0 @@ -;;; mouseme.el --- mouse menu with commands that operate on strings - -;; Copyright (C) 1997 by Free Software Foundation, Inc. - -;; Author: Howard Melman -;; Keywords: mouse, menu - -;; This file is part of GNU Emacs. - -;; GNU Emacs 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. - -;; GNU Emacs 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 -;; https://www.r-project.org/Licenses/ - -;;; Commentary: - -;; This package provides a command `mouse-me' to be bound to a mouse -;; button. It pops up a menu of commands that operate on strings or a -;; region. The string passed to the selected command is the word or -;; symbol clicked on (with surrounding quotes or other punctuation -;; removed), or the region (if either it was just selected with the -;; mouse or if it was active with `transient-mark-mode' on). If the -;; command accepts a region, the selected region (or the region of the -;; word or symbol clicked on) will be passed to the command. - -;; The idea is that for any given string in a buffer you may want to -;; do different things regardless of the mode of the buffer. URLs -;; now appear in email, news articles, comments in code, and in plain -;; text. You may want to visit that URL in a browser or you may just -;; want to copy it to the kill-ring. For an email address you might -;; want to compose mail to it, finger it, look it up in bbdb, copy it to -;; the kill ring. For a word you may want to spell check it, copy it, -;; change its case, grep for it, etc. Mouse-me provides a menu to -;; make this easy. - -;; The menu popped up is generated by calling the function in the -;; variable `mouse-me-build-menu-function' which defaults to calling -;; `mouse-me-build-menu' which builds the menu from the variable -;; `mouse-me-menu-commands'. See the documentation for these -;; functions and variables for details. - -;; To install, add something like the following to your ~/.emacs: -;; (require 'mouseme) -;; (global-set-key [S-mouse-2] 'mouse-me) - -;;; Code: - -(require 'browse-url) -(require 'thingatpt) - -(eval-when-compile (require 'compile)) - -;;;; Variables - -(defgroup mouseme nil - "Popup menu of commands that work on strings." - :prefix "mouse-me-" - :group 'hypermedia) - -(defcustom mouse-me-get-string-function 'mouse-me-get-string - "*Function used by `mouse-me' to get string when no region selected. -The default is `mouse-me-get-string' but this variable may commonly -be made buffer local and set to something more appropriate for -a specific mode (e.g., `word-at-point'). The function will be called -with no arguments and with point at where the mouse was clicked. -It can return either the string or to be most efficient, a list of -three elements: the string and the beginning and ending points of the -string in the buffer." - :type 'function - :options '(mouse-me-get-string) - :group 'mouseme) - -(defcustom mouse-me-build-menu-function 'mouse-me-build-menu - "*Function used by `mouse-me' to build the popup menu. -The default is `mouse-me-build-menu' but this variable may commonly -be made buffer local and set to something more appropriate for -a specific mode. The function will be called with one argument, -the string selected, as returned by `mouse-me-get-string-function'." - :type 'function - :options '(mouse-me-build-menu) - :group 'mouseme) - -(defvar mouse-me-grep-use-extension 't - "*If non-nil `mouse-me-grep' grep's in files with current file's extension.") - -(defcustom mouse-me-menu-commands - '(("Copy" . kill-new) - ("Kill" . kill-region) - ("Capitalize" . capitalize-region) - ("Lowercase" . downcase-region) - ("Uppercase" . upcase-region) - ("ISpell" . ispell-region) - "----" - ("Browse URL" . browse-url) - ("Dired" . dired) - ("Execute File" . mouse-me-execute) - ("Mail to" . compose-mail) - ("Finger" . mouse-me-finger) - ("BBDB Lookup" . mouse-me-bbdb) - "----" - ("Imenu" . imenu) - ("Find Tag" . find-tag) - ("Grep" . mouse-me-grep) - ("Find-Grep" . mouse-me-find-grep) - "----" - ("Apropos" . apropos) - ("Describe Function" . mouse-me-describe-function) - ("Describe Variable" . mouse-me-describe-variable) - ("Command Info" . mouse-me-emacs-command-info) - ("Man Page" . (if (fboundp 'woman) 'woman 'man)) - ("Profile Function" . mouse-me-elp-instrument-function)) - "*Command menu used by `mouse-me-build-menu'. -A list of elements where each element is either a cons cell or a string. -If a cons cell the car is a string to be displayed in the menu and the -cdr is either a function to call passing a string to, or a list which evals -to a function to call passing a string to. If the element is a string -it makes a non-selectable element in the menu. To make a separator line -use a string consisting solely of hyphens. - -The function returned from this menu will be called with one string -argument. Or if the function has the symbol property `mouse-me-type' -and if its value is the symbol `region' it will be called with the -beginning and ending points of the selected string. If the value is -the symbol `string' it will be called with one string argument." - :type '(repeat sexp) - :group 'mouseme) - -(put 'kill-region 'mouse-me-type 'region) -(put 'ispell-region 'mouse-me-type 'region) -(put 'capitalize-region 'mouse-me-type 'region) -(put 'downcase-region 'mouse-me-type 'region) -(put 'upcase-region 'mouse-me-type 'region) - -;;;; Commands - -;;;###autoload -(defun mouse-me (event) - "Popup a menu of functions to run on selected string or region." - (interactive "e") - (mouse-me-helper event (lambda (name) - (or (x-popup-menu event (funcall mouse-me-build-menu-function name)) - (error "No command to run"))))) - -;;;; Exposed Functions - -;; Some tests: -;; -;; -;; http://foo.bar.com/sss/ss.html -;; http://www.ditherdog.com/howard/ -;; mailto:howard@silverstream.com -;; howard@silverstream.com -;; -;; import com.sssw.srv.agents.AgentsRsrc; -;; public AgoHttpRequestEvent(Object o, String db, Request r) -;;
    -;; d:\howard\elisp\spoon -;; \howard\elisp\spoon -;; \\absolut\howard\elisp\spoon -;; //absolut/d/Howard/Specs/servlet-2.1.pdf -;; \\absolut\d\Howard\Specs\servlet-2.1.pdf -;; gnuserv-frame. - -(defun mouse-me-get-string () - "Return a string from the buffer of text surrounding point. -Returns a list of three elements, the string and the beginning and -ending positions of the string in the buffer in that order." - (save-match-data - (save-excursion - (let ((start (point)) beg end str p) - (skip-syntax-forward "^ >()\"") - (setq end (point)) - (goto-char start) - (skip-syntax-backward "^ >()\"") - (setq beg (point)) - (setq str (buffer-substring-no-properties beg end)) - ;; remove junk from the beginning - (if (string-match "^\\([][\"'`.,?:;!@#$%^&*()_+={}|<>-]+\\)" str) - (setq str (substring str (match-end 1)) - beg (+ beg (match-end 1)))) - ;; remove URL: from the front, it's common in email - (if (string-match "^\\(URL:\\)" str) - (setq str (substring str (match-end 1)) - beg (+ beg (match-end 1)))) - ;; remove junk from the end - (if (string-match "\\([][\"'.,?:;!@#$%^&*()_+={}|<>-]+\\)$" str) - (setq end (- end (length (match-string 1 str))) ; must set end first - str (substring str 0 (match-beginning 1)))) - (list str beg end))))) - -(defun mouse-me-build-menu (name) - "Return a menu tailored for NAME for `mouse-me' from `mouse-me-menu-commands'." - (list "Mouse Me" (cons "Mouse Me" - (append (list (cons - (if (< (length name) 65) - name - "...Long String...") - 'kill-new) - "---") - mouse-me-menu-commands)))) - -;;;; Commands for the menu - -(defun mouse-me-emacs-command-info (string) - "Look in Emacs info for command named STRING." - (interactive "sCommand: ") - (let ((s (intern-soft string))) - (if (and s (commandp s)) - (Info-goto-emacs-command-node s) - (error "No command named `%s'" string)))) - -(defun mouse-me-describe-function (string) - "Describe function named STRING." - (interactive "sFunction: ") - (let ((s (intern-soft string))) - (if (and s (fboundp s)) - (describe-function s) - (error "No function named `%s'" string)))) - -(defun mouse-me-describe-variable (string) - "Desribe variable named STRING." - (interactive "sVariable: ") - (let ((s (intern-soft string))) - (if (and s (boundp s)) - (describe-variable s) - (error "No variable named `%s'" string)))) - -(defun mouse-me-elp-instrument-function (string) - "Instrument Lisp function named STRING." - (interactive "sFunction: ") - (let ((s (intern-soft string))) - (if (and s (fboundp s)) - (elp-instrument-function s) - (error "Must be the name of an existing Lisp function")))) - -(defun mouse-me-execute (string) - "Execute STRING as a filename." - (interactive "sFile: ") - (if (fboundp 'w32-shell-execute) - (w32-shell-execute "open" (convert-standard-filename string)) - (message "This function currently working only in W32."))) - - -(defun mouse-me-bbdb (string) - "Lookup STRING in bbdb." - (interactive "sBBDB Lookup: ") - (if (fboundp 'bbdb) - (bbdb string nil) - (error "BBDB not loaded"))) - -(defun mouse-me-finger (string) - "Finger a STRING mail address." - (interactive "sFinger: ") - (save-match-data - (if (string-match "\\(.*\\)@\\([-.a-zA-Z0-9]+\\)$" string) - (finger (match-string 1 string) (match-string 2 string)) - (error "Not in user@host form: %s" string)))) - -(defun mouse-me-grep (string) - "Grep for a STRING." - (interactive "sGrep: ") - (require 'compile) - (grep-compute-defaults) - (let ((ext (mouse-me-buffer-file-extension))) - (grep (concat grep-command string - (if mouse-me-grep-use-extension - (if ext - (concat " *" ext) - " *")))))) - -(defun mouse-me-find-grep (string) - "Grep for a STRING." - (interactive "sGrep: ") - (grep-compute-defaults) - (let ((reg grep-find-command) - (ext (mouse-me-buffer-file-extension)) - beg end) - (if (string-match "\\(^.+-type f \\)\\(.+$\\)" reg) - (setq reg (concat (match-string 1 reg) - (if mouse-me-grep-use-extension - (concat "-name \"*" ext "\" ")) - (match-string 2 reg)))) - (grep-find (concat reg string)))) - -;;;; Internal Functions - -(defun mouse-me-buffer-file-extension () - "Return the extension of the current buffer's filename or nil. -Returned extension is a string begining with a period." - (let* ((bfn (buffer-file-name)) - (filename (and bfn (file-name-sans-versions bfn))) - (index (and filename (string-match "\\.[^.]*$" filename)))) - (if index - (substring filename index) - ""))) - -(defun mouse-me-helper (event func) - "Determine the string to use to process EVENT and call FUNC to get cmd." - (let (name sp sm mouse beg end cmd mmtype) - ;; temporarily goto where the event occurred, get the name clicked - ;; on and enough info to figure out what to do with it - (save-match-data - (save-excursion - (setq sp (point)) ; saved point - (setq sm (mark t)) ; saved mark - (set-buffer (window-buffer (posn-window (event-start event)))) - (setq mouse (goto-char (posn-point (event-start event)))) - ;; if there is a region and point is inside it - ;; check for sm first incase (null (mark t)) - ;; set name to either the thing they clicked on or region - (if (and sm - (or (and transient-mark-mode mark-active) - (eq last-command 'mouse-drag-region)) - (>= mouse (setq beg (min sp sm))) - (<= mouse (setq end (max sp sm)))) - (setq name (buffer-substring beg end)) - (setq name (funcall mouse-me-get-string-function)) - (if (listp name) - (setq beg (nth 1 name) - end (nth 2 name) - name (car name)) - (goto-char mouse) - (while (not (looking-at (regexp-quote name))) - (backward-char 1)) - (setq beg (point)) - (setq end (search-forward name)))))) - ;; check if name is null, meaning they clicked on no word - (if (or (null name) - (and (stringp name) (string= name "" ))) - (error "No string to pass to function")) - ;; popup a menu to get a command to run - (setq cmd (funcall func)) - ;; run the command, eval'ing if it was a list - (if (listp cmd) - (setq cmd (eval cmd))) - (setq mmtype (get cmd 'mouse-me-type)) - (cond ((eq mmtype 'region) - (funcall cmd beg end)) - ((eq mmtype 'string) - (funcall cmd name)) - (t - (funcall cmd name))))) - -(provide 'mouseme) - -;;; mouseme.el ends here diff -Nru ess-18.10.2/lisp/obsolete/ess-eldoc.el ess-18.10.2+git20220915.f45542e/lisp/obsolete/ess-eldoc.el --- ess-18.10.2/lisp/obsolete/ess-eldoc.el 2018-11-10 09:41:11.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/lisp/obsolete/ess-eldoc.el 2022-10-15 08:06:36.000000000 +0000 @@ -1,26 +1,27 @@ ;;; ess-eldoc.el --- Use eldoc to report R function names. -;; Copyright (C) 1997--2009 A.J. Rossini, Richard M. Heiberger, Martin -;; Maechler, Kurt Hornik, Rodney Sparapani, and Stephen Eglen. - +;; Copyright (C) 1997-2020 Free Software Foundation, Inc. ;; Author: Stephen Eglen ;; Created: 2007-06-30 ;; Maintainer: ESS-core -;; This file is part of ESS +;; This file is part of GNU Emacs. -;; This file is free software; you can redistribute it and/or modify +;;; License: +;; +;; This program is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 2, or (at your option) -;; any later version. - -;; This file is distributed in the hope that it will be useful, +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. +;; +;; This program is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. - -;; A copy of the GNU General Public License is available at -;; http://www.r-project.org/Licenses/ +;; +;; You should have received a copy of the GNU General Public License +;; along with this program. If not, see +;; ;;; Commentary: @@ -167,10 +168,6 @@ "Does nothing. Defined not to break old users' code." (interactive)) -;; For now, while testing, switch on ess-eldoc. Later, ths could be removed -;; and instead ask user to add it. -;; (add-hook 'R-mode-hook 'ess-use-eldoc) - (provide 'ess-eldoc) ;;; ess-eldoc.el ends here diff -Nru ess-18.10.2/lisp/obsolete/ess-font-lock.el ess-18.10.2+git20220915.f45542e/lisp/obsolete/ess-font-lock.el --- ess-18.10.2/lisp/obsolete/ess-font-lock.el 1970-01-01 00:00:00.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/lisp/obsolete/ess-font-lock.el 2022-10-15 08:06:36.000000000 +0000 @@ -0,0 +1,150 @@ +;;; ess-font-lock.el --- font-lock color options + +;; Copyright (C) 2000-2022 Free Software Foundation, Inc. + +;; Author: Richard M. Heiberger +;; Created: 06 Feb 2000 + +;; Keywords: languages, faces + +;; This file is part of ESS + +;; This file is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation; either version 2, or (at your option) +;; any later version. +;; +;; This file is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. +;; +;; A copy of the GNU General Public License is available at +;; https://www.r-project.org/Licenses/ + +;;; Commentary: + +;; provides syntax highlighting support. + +;;; Code: + + ; Requires and autoloads + +(require 'font-lock) +(require 'paren) + +;; FIXME: What is this doing here!? +(if (fboundp 'show-paren-mode) (show-paren-mode 1)) + +;;; Emacs 20.x notes: + +;; font-lock faces are defined in /emacs/emacs-20.5/lisp/font-lock.el +;; The font-lock faces are applied to ESS buffers by +;; ess-mode.el ess-inf.el ess-trns.el ess-custom.el +;; The keywords for faces are defined in the ess[dl]*.el files. +;; All faces can be looked at, under Emacs 20.x, with +;; [menu-bar] [Edit] [Text Properties] [Display Faces} + +(defun ess-font-lock-rmh () + "Set font-lock colors to Richard Heiberger's usual choice." + ;; FIXME: Turn it into a Custom theme! + (interactive) + + (set-foreground-color "Black") + (set-background-color "lightcyan") + + (set-face-background 'mode-line "lightskyblue") + (set-face-foreground 'mode-line "midnightblue") + + (set-face-foreground 'font-lock-comment-face "Firebrick") + (set-face-foreground 'font-lock-function-name-face "Blue") + (set-face-foreground 'font-lock-keyword-face "Purple") + (set-face-foreground 'font-lock-constant-face "Brown") + (set-face-foreground 'font-lock-string-face "VioletRed") + (set-face-foreground 'font-lock-type-face "Sienna") + (set-face-foreground 'font-lock-variable-name-face "Black")) + +(defun ess-font-lock-blue () + "Set font-lock colors to Richard Heiberger's blue color scheme." + ;; FIXME: Turn it into a Custom theme! + (interactive) + + (set-foreground-color "Black") + (set-background-color "LightBlue") + + (set-face-foreground 'mode-line "LightBlue") + (set-face-background 'mode-line "DarkSlateBlue") + + (set-face-foreground 'font-lock-comment-face "Firebrick") + (set-face-foreground 'font-lock-function-name-face "Blue") + (set-face-foreground 'font-lock-keyword-face "Purple") + (set-face-foreground 'font-lock-constant-face "Brown") + (set-face-foreground 'font-lock-string-face "VioletRed") + (set-face-foreground 'font-lock-type-face "Sienna") + (set-face-foreground 'font-lock-variable-name-face "Black")) + +(defun ess-font-lock-wheat () + "Set font-lock colors to Richard Heiberger's wheat color scheme." + ;; FIXME: Turn it into a Custom theme! + (interactive) + + (set-foreground-color "Black") + (set-background-color "Wheat") + + (set-face-foreground 'mode-line "Wheat") + (set-face-background 'mode-line "Sienna") + + (set-face-foreground 'font-lock-comment-face "Firebrick") + (set-face-foreground 'font-lock-function-name-face "Blue") + (set-face-foreground 'font-lock-keyword-face "Purple") + (set-face-foreground 'font-lock-constant-face "Brown") + (set-face-foreground 'font-lock-string-face "VioletRed") + (set-face-foreground 'font-lock-type-face "Sienna") + (set-face-foreground 'font-lock-variable-name-face "Black")) + + +(defun ess-font-lock-bw () + "Set font-lock colors to Richard Heiberger's black and white color scheme." + ;; FIXME: Turn it into a Custom theme! + (interactive) + + (set-foreground-color "Black") + (set-background-color "white") + + (set-face-foreground 'mode-line "gray10") + (set-face-background 'mode-line "gray90") + + ;; modify-face is an interactive compiled Lisp function in `faces'. + ;; Sample usage: + + ;;(modify-face FACE FOREGROUND BACKGROUND STIPPLE BOLD-P ITALIC-P UNDERLINE-P &optional INVERSE-P FRAME) + + (modify-face 'mode-line "gray10" "gray90" nil nil t nil ) + (modify-face 'font-lock-comment-face "black" "white" nil nil t nil ) + (modify-face 'font-lock-function-name-face "black" "white" nil t nil nil ) + (modify-face 'font-lock-keyword-face "black" "white" nil nil nil t ) + (modify-face 'font-lock-constant-face "black" "white" nil t nil nil ) + (modify-face 'font-lock-string-face "black" "white" nil nil t t ) + (modify-face 'font-lock-type-face "black" "white" nil t t nil ) + (modify-face 'font-lock-variable-name-face "black" "white" nil nil nil nil ) + (modify-face 'font-lock-builtin-face "black" "white" nil t nil nil ) + (modify-face 'font-lock-warning-face "black" "white" nil t nil nil ) + (modify-face 'show-paren-match-face "gray20" "gray80" nil t nil nil ) + (modify-face 'show-paren-mismatch-face "white" "gray40" nil t t nil )) + +(defun ess-font-lock-db () + "Set font-lock colors (leave fore-/back-ground alone) courtesy David Brahm " + ;; FIXME: Turn it into a Custom theme! + (interactive) + (set-face-foreground 'font-lock-comment-face "Firebrick") ; #... %... + (set-face-foreground 'font-lock-string-face "SeaGreen") ; "..." "..." + (set-face-foreground 'font-lock-keyword-face "MediumBlue") ; if \end + (set-face-foreground 'font-lock-function-name-face "VioletRed") ; talk<- {center} + (set-face-foreground 'font-lock-variable-name-face "Blue") ; xv + (set-face-foreground 'font-lock-type-face "Goldenrod") ; T,F ? + (set-face-foreground 'font-lock-constant-face "Magenta") ; <- {eq1} + ) + +(provide 'ess-font-lock) + +;;; ess-font-lock.el ends here diff -Nru ess-18.10.2/lisp/obsolete/ess-mouse.el ess-18.10.2+git20220915.f45542e/lisp/obsolete/ess-mouse.el --- ess-18.10.2/lisp/obsolete/ess-mouse.el 1970-01-01 00:00:00.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/lisp/obsolete/ess-mouse.el 2022-10-15 08:06:36.000000000 +0000 @@ -0,0 +1,222 @@ +;;; ess-mouse.el --- Support for mouse- or cursor-sensitive actions + +;; Copyright (C) 2001-2020 Free Software Foundation, Inc. +;; Author: Richard M. Heiberger +;; Created: 25 Mar 2001 +;; Maintainer: ESS-core + +;; This file is part of GNU Emacs. + +;;; License: +;; +;; This program is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. +;; +;; This program is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. +;; +;; You should have received a copy of the GNU General Public License +;; along with this program. If not, see +;; + +;;; Commentary: + +;; Support for mouse- or cursor-sensitive actions. This is based on +;; and uses mouseme.el. mouseme.el only does mouse sensititivity. +;; The new functions ess-mouse-me and ess-mouse-me-helper do similar +;; things based on the cursor, not the mouse, and can be bound to a +;; keystroke. + +;;; Code: + + ; Requires and autoloads + +;;*;; Requires +(require 'mouseme) +(require 'ess-trns) +;;(if (or (equal window-system 'w32) +;; (equal window-system 'win32) +;; (equal window-system 'mswindows)) +;; (require 'essiw32b)) + +(defun ess-mouse-me () + "Popup a menu of functions to run on selected string or region." + (interactive) + (ess-mouse-me-helper + (lambda (name) + (or (x-popup-menu (list '(0 0) + (get-buffer-window (get-buffer (buffer-name)))) + (funcall mouse-me-build-menu-function name)) + (error "No command to run"))))) + + + +(defun ess-mouse-me-helper (func) + "Determine the string to use to process EVENT and call FUNC to get cmd." + (let (name sp sm mouse beg end cmd mmtype) + ;; temporarily goto where the event occurred, get the name clicked + ;; on and enough info to figure out what to do with it + (save-match-data + (save-excursion + (setq sp (point)) ; saved point + (setq sm (mark t)) ; saved mark +;;; (set-buffer (window-buffer (posn-window (event-start event)))) +;;; (setq mouse (goto-char (posn-point (event-start event)))) + (setq mouse (point)) ;; ess-mouse-me-helper + ;; if there is a region and point is inside it + ;; check for sm first incase (null (mark t)) + ;; set name to either the thing they clicked on or region + (if (and sm + (or (and transient-mark-mode mark-active) + (eq last-command 'mouse-drag-region)) + (>= mouse (setq beg (min sp sm))) + (<= mouse (setq end (max sp sm)))) + (setq name (buffer-substring beg end)) + (setq name (funcall mouse-me-get-string-function)) + (if (listp name) + (setq beg (nth 1 name) + end (nth 2 name) + name (car name)) + (goto-char mouse) + (while (not (looking-at (regexp-quote name))) + (backward-char 1)) + (setq beg (point)) + (setq end (search-forward name)))))) + ;; check if name is null, meaning they clicked on no word + (if (or (null name) + (and (stringp name) (string= name "" ))) + (error "No string to pass to function")) + ;; popup a menu to get a command to run + (setq cmd (funcall func name)) + ;; run the command, eval'ing if it was a list + (if (listp cmd) + (setq cmd (eval cmd))) + (setq mmtype (get cmd 'mouse-me-type)) + (cond ((eq mmtype 'region) + (funcall cmd beg end)) + ((eq mmtype 'string) + (funcall cmd name)) + (t + (funcall cmd name))))) + +(defcustom ess-S-mouse-me-menu-commands-alist + '("S-Plus 4 and 6 GUI under Windows" + ("Edit.data" . ess-mouse-me-Edit.data) + "----" + ("print" . ess-mouse-me-print) + ("summary" . ess-mouse-me-summary) + ("plot" . ess-mouse-me-plot) + ("show" . ess-mouse-me-show) + ("help" . ess-display-help-on-object) + ("args" . ess-mouse-me-args) + "----" + ("Browser on" . ess-mouse-me-browser-on) + ("Browser off" . ess-mouse-me-browser-off)) + "Command menu used by `mouse-me-build-menu'. +A alist of elements where each element is either a cons cell or a string. +If a cons cell the car is a string to be displayed in the menu and the +cdr is either a function to call passing a string to, or a list which evals +to a function to call passing a string to. If the element is a string +it makes a non-selectable element in the menu. To make a separator line +use a string consisting solely of hyphens. + +The function returned from this menu will be called with one string +argument. Or if the function has the symbol property `mouse-me-type' +and if its value is the symbol `region' it will be called with the +beginning and ending points of the selected string. If the value is +the symbol `string' it will be called with one string argument." + :type '(repeat sexp) + :group 'mouseme) + + +(defun ess-mouse-me-Edit.data (string) + (ess-mouse-me-eval-expanded string "Edit.data(" ")" nil nil nil)) + +(defun ess-mouse-me-print (string) + (ess-mouse-me-eval-expanded string "" "" nil nil t)) +(defun ess-mouse-me-summary (string) + (ess-mouse-me-eval-expanded string "summary(" ")" nil nil t)) +(defun ess-mouse-me-plot (string) + (ess-mouse-me-eval-expanded string "plot(" ")") nil nil nil) +(defun ess-mouse-me-show (string) + (ess-mouse-me-eval-expanded string "show(" ")") nil nil nil) +(defun ess-mouse-me-args (string) + (ess-mouse-me-eval-expanded string "args(" ")" nil nil t)) + +(defun ess-mouse-me-browser-on (string) + (if (equal (substring ess-dialect 0 1) "R") + (ess-eval-linewise (concat "debug(" string ")")) + (ess-mouse-me-eval-expanded string "trace(" ", exit=browser)") nil nil nil)) + +(defun ess-mouse-me-browser-off (string) + (if (equal (substring ess-dialect 0 1) "R") + (ess-eval-linewise (concat "undebug(" string ")")) + (ess-mouse-me-eval-expanded string "untrace(" ")") nil nil nil)) + + + +(defun ess-mouse-me-eval-expanded (string &optional head tail commands-buffer + page value-returned) + "Send the expanded STRING to the inferior-ess process using `ess-command' +after first concating the HEAD and TAIL. Put answer in COMMANDS-BUFFER if +specified, otherwise in \"tmp-buffer\". In either +case the buffer containing the answer is renamed to the value of the +constructed command. If PAGE is non-nil, expand +the string one more time by embedding it in a \"page()\" command." + (interactive) + (let* (scommand + page-scommand + (lproc-name ess-local-process-name) + (ess-mouse-customize-alist ess-local-customize-alist)) + (if (not head) (setq head "summary(")) + (if (not tail) (setq tail ")")) + (if (not commands-buffer) (setq commands-buffer + (get-buffer-create "tmp-buffer"))) + (setq scommand (concat head string tail)) + + (ess-make-buffer-current) + (pop-to-buffer-same-window commands-buffer) + (ess-setq-vars-local (eval ess-mouse-customize-alist) (current-buffer)) + (setq ess-local-process-name lproc-name) + (ess-command (concat scommand "\n") commands-buffer) + (if (not value-returned) (pop-to-buffer-same-window (nth 1 (buffer-list)))) + (if (not value-returned) + nil + (if ess-microsoft-p ;; there ought to be a filter + (while (search-forward "\r" nil t) ;; function to keep the ^M + (replace-match "" nil t))) ;; from showing up at all + (ess-transcript-mode) + (setq ess-local-process-name lproc-name) + (rename-buffer scommand)))) + + + ; Provide package + +(provide 'ess-mouse) + + + +;;;;;;;; STARTUP STUFF ;;;;;;;;;;;; + +(make-variable-buffer-local 'mouse-me-menu-commands) + +(defun ess-S-mouse-me-menu-commands () + (if (equal ess-language "S") + (setq mouse-me-menu-commands ess-S-mouse-me-menu-commands-alist))) + +;; (define-key ess-mode-map [S-mouse-3] 'ess-mouse-me) +;; (define-key inferior-ess-mode-map [S-mouse-3] 'ess-mouse-me) +;; (defun ess-S-mouse-me-ess-transcript-mode () +;; (define-key ess-transcript-mode-map [S-mouse-3] 'ess-mouse-me)) +;; +(add-hook 'ess-mode-hook 'ess-S-mouse-me-menu-commands) +(add-hook 'inferior-ess-mode-hook 'ess-S-mouse-me-menu-commands) +(add-hook 'ess-transcript-mode-hook 'ess-S-mouse-me-menu-commands) +;; (add-hook 'ess-transcript-mode-hook 'ess-S-mouse-me-ess-transcript-mode) + + +;;; ess-mouse.el ends here diff -Nru ess-18.10.2/lisp/obsolete/ess-r-a.el ess-18.10.2+git20220915.f45542e/lisp/obsolete/ess-r-a.el --- ess-18.10.2/lisp/obsolete/ess-r-a.el 1970-01-01 00:00:00.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/lisp/obsolete/ess-r-a.el 2022-10-15 08:06:36.000000000 +0000 @@ -0,0 +1,153 @@ +;;; ess-r-a.el -- Possible local customizations for R with ESS. -*- lexical-binding: t; -*- + +;; Copyright (C) 1997-2020 Free Software Foundation, Inc. +;; Author: A.J. Rossini +;; Created: 17 November 1999 +;; Maintainer: ESS-core + +;; This file is part of GNU Emacs. + +;;; License: +;; +;; This program is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. +;; +;; This program is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. +;; +;; You should have received a copy of the GNU General Public License +;; along with this program. If not, see +;; + +;;; Commentary: + +;; The purpose of this file is to demonstrate some of the extras that +;; have been constructed for the ESS R mode; if they prove +;; interesting, then they might be migrated to ess-r-mode, the primary +;; ESS R mode tools. + +;;; Code: +(require 'ess-inf) +(require 'ess-r-mode) + +;; you can invoke ESS/R from emacs by typing +;; C-u M-x essr +;; with vsize set to (for example) 40M, and nsize set to 600000. + +;; Undefined on non-apple devices +(declare-function ns-do-applescript "nsfns.m" (script)) +(declare-function do-applescript "ess-r-a" (script)) +(unless (fboundp 'do-applescript) + (defalias 'do-applescript 'ns-do-applescript)) + +(defalias 'essr + (read-kbd-macro + "C-u M-x R RET - - vsize = 40M SPC - - nsize = 600000 2*RET")) + +(defun ess-r-do-region (start end) + "Send from START to END to R via AppleScript." + (interactive "r\nP") + (message "Starting evaluation...") + (do-applescript (concat + "try\n" + "tell application \"R\"\n" + "activate\n" + "with timeout of 0 seconds\n" + "cmd \"" (buffer-substring start end) + "\"\n" + "end timeout\n" + "end tell\n" + "end try\n")) + (message "Finished evaluation")) + +(defun ess-r-do-line () + "Send the current line to R via AppleScript." + (interactive) ;; "r\nP") + (message "Starting evaluation...") + (save-excursion + (let ((end (point))) + (move-to-column 0) + (do-applescript (concat + "try\n" + "tell application \"R\"\n" + "activate\n" + "with timeout of 0 seconds\n" + "cmd \"" (buffer-substring (point) end) + "\"\n" + "end timeout\n" + "end tell\n" + "end try\n")))) + (message "Finished evaluation")) + +(defun ess-r-var (beg end) + "Load the current region of numbers into an R variable. +Prompts for a variable name. If none is given, it uses a default +variable name, e. BEG and END denote the region in the current +buffer to be sent." + (interactive "r") + (save-window-excursion + (let ((tmp-file (make-temp-file "ess-r-var")) + cmd + var) + (write-region beg end tmp-file) + + ;; Decide on the variable name to use in R; could use completion. + (setq var (read-string "R Variable name (default e): ")) + (if (equal var "") + (setq var "e")) + + ;; Command to send to the R process. Get R to delete the file + ;; rather than Emacs in case it takes R a long time to run the + ;; scan command. + (setq cmd (concat var " <- scan(\"" tmp-file "\"); " + "unlink(\"" tmp-file "\")" )) + + ;; Put the output from the scan command into the process buffer so + ;; the user has a record of it. + (ess-execute cmd 'buffer)))) + + +;;; Peter Dalgaard's code. +;;; This needs to be cleaned and validated! + +(defun pd::set-up-demo () + (run-ess-r) + (split-window-vertically 6) + (find-file "demos.R") + + ;; Don't need to run this as a function -- ought to be fine if set + ;; just once. + + (defun ajr::scroll-to-end::peterD (emacs) + "Goal: map prompt to bottom of the screen after every command. +Alternatively, use the scroll-in-place package, not sure where that +is)." + (interactive) + (other-buffer 1) + (if (= emacs "emacs") + (setq scroll-up-aggressively t) + (setq scroll-conservatively -4)) ;; <- change this + (other-buffer -1)) + + (defun show-max-other-window () + (interactive) + (other-window 1) + (comint-show-maximum-output) + (other-window -1)) + + ;; call this once + ;; (ajr::scroll-to-end::peterD "emacs") + + (global-set-key [f11] 'show-max-other-window) + (global-set-key [f12] 'ess-eval-line-visibly-and-step)) + + + ; Provide package + +(provide 'ess-r-a) + +;;; ess-r-a.el ends here diff -Nru ess-18.10.2/lisp/obsolete/ess-r-args.el ess-18.10.2+git20220915.f45542e/lisp/obsolete/ess-r-args.el --- ess-18.10.2/lisp/obsolete/ess-r-args.el 2018-11-10 09:41:11.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/lisp/obsolete/ess-r-args.el 1970-01-01 00:00:00.000000000 +0000 @@ -1,349 +0,0 @@ -;;; ess-r-args.el --- Insert R function's arguments - -;; Copyright (C) 2007 Sven Hartenstein -;; Copyright (C) 2007 A.J. Rossini, Richard M. Heiberger, Martin -;; Maechler, Kurt Hornik, Rodney Sparapani, and Stephen Eglen. - -;; 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/ - -;; Last update: 2012-02-27 - -;;; Commentary: - -;; == DOCUMENTATION == - -;; This file provides some functions that show or insert a -;; R-function's arguments (and their default values) by using R's -;; args() function. This code requires ESS (http://ess.r-project.org). -;; For screenshots as well as information on requirements, -;; installation, configuration and troubleshooting, please visit -;; http://www.svenhartenstein.de/emacs-ess.php - -;; == Requirements == - -;; * ESS mode must be loaded and running. -;; * A R process must be running within ESS. -;; * 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). - -;; == Installation == - -;; To make Emacs aware of the functions defined in this file load it -;; into Emacs by including something like the following in your -;; ~/.emacs file (adapt "/PATH/TO"!). -;; -;; (add-hook 'ess-mode-hook (lambda () (load "/PATH/TO/ess-r-args.el"))) -;; -;; This file is included with ESS; if you are reading this file as -;; part of the ESS distribution, then you do not need to add the above -;; line. - -;; == Configuration == - -;; Configuration should be done by setting some variables in your -;; ~/.emacs file, the following is an example only, adjust it to your -;; needs. - -;; ;; ess-r-args-noargsmsg is printed, if no argument information -;; ;; could be found. You could set it to an empty string ("") for no -;; ;; message. -;; (setq ess-r-args-noargsmsg "No args found.") -;; -;; ;; ess-r-args-show-as determines how (where) the information is -;; ;; displayed. Set it to 'tooltip little tooltip windows or to -;; ;; 'message (the default) which will use the echo area at the bottom of -;; ;; your Emacs frame. -;; (setq ess-r-args-show-as nil) -;; -;; ;; ess-r-args-show-prefix is a string that is printed in front of -;; ;; the arguments list. The default is "ARGS: ". -;; (setq ess-r-args-show-prefix "ARGS: ") - -;; == Usage == - -;; The functions should be called when point (text cursor) is between -;; two parentheses of a R function call (see screenshots above). It -;; will then (invisibly) query R for which arguments the respective -;; function knows as well as their default values and show or insert -;; the result. - -;; There are currently two functions: ess-r-args-show echoes the -;; arguments in the echo area or as tooltip, ess-r-args-insert prints -;; the arguments at point. - -;; In order to not having to type the whole function name each time -;; you want to see the arguments list, you most probably want to bind -;; the functions to a key which again should be done in your ~/.emacs -;; file. You can also let Emacs call the function each time you insert -;; an opening parenthesis ("("). - -;; -----> do this below - -;; Again, the following is an example only: - -;; bind ess-r-args-show to F2 -;; (define-key ess-mode-map [f2] 'ess-r-args-show) - -;; bind ess-r-args-insert to F3 -;; (define-key ess-mode-map [f3] 'ess-r-args-insert) - -;; == Setting the tooltip position == - -;; Unfortunately (?), tooltips are by default shown at the mouse -;; pointer's position, which is not necessarily where you are looking -;; at. If you use Emacs' mouse-avoidance-mode with option "banish" -;; then the mouse pointer will automatically be put at the upper right -;; corner of the Emacs window so that you know where to look for the -;; tooltip. Emacs also allows for setting the tooltip position -;; relative to the upper left corner of your screen. If you know how -;; to let Emacs determine the point (text cursor) position in pixels -;; from the upper left corner of the screen, please let me know. It -;; would then be possible to show the tooltip near the point, which I -;; would consider preferably. -;; SJE: see code at bottom 2009-01-30... - -;; ;; Put mouse away when using keyboard -;; (mouse-avoidance-mode 'banish) - -;; ;; Set the tooltip position in absolute pixels from the upper left -;; ;; corner of the screen -;; (setq tooltip-frame-parameters -;; '((name . "tooltip") -;; (left . 20) -;; (top . 20))) - -;; == Changelog == - -;; * 2007-04-03: The function should now do nothing (instead of -;; irritating cursor movement) if the current ESS process is -;; anything but R. -;; * 2007-04-05: Function names changed. Much more modular. GPLed. New -;; prefix configuration variable. Minor changes. -;; * 2007-04-30: Error handling added. Bugfix: Emacs used to lock up -;; when function was called within parentheses following the "#" -;; character (Thanks to John Bullock for his bug report!). - -;; == Troubleshooting == - -;; Before sending reports of problems, please check the following. - -;; * Doublecheck the requirements section above. -;; * Please be sure you tried both the "tooltip" option and the "echo -;; area" option and tell me whether both failed or just one. -;; * Check whether it is a key binding problem. Run the function with -;; M-x ess-r-args-show RET. If it works but not the key binding, try -;; binding it to another key. Some window managers might not pass -;; the function key keystrokes to Emacs. - -;; If you encounter problems, please send me detailed bug reports. -;; Please also indicate the ESS version you are running and the Emacs -;; type (GNU vs. X) and operating system. I will do my best to help -;; but please be aware that I'm everything but an emacs lisp expert. - -;; == TODO == - -;; These are things that I would like to see improved. Please let me -;; know if you know how it could be done. - -;; * As mentioned above, I would like to place the tooltip near the -;; point (text cursor) but I do not see how this could be done. -;; * Both the message in the echo area and the tooltip automatically -;; disappear as soon as a key is pressed. That is, you will need to -;; call the function again if you have entered the first -;; parameter(s) and wonder what additional parameters are possible. -;; I would prefer the information to be shown, say, five seconds or -;; so. - -;;; Code: - -(require 'ess-custom) -(require 'ess-inf) -(require 'ess-utils) -(eval-when-compile - (require 'tooltip)); for tooltip-show - -;; These defvars were previously defcustoms in ess-custom -(defvar ess-r-args-noargsmsg "No args found." - "Message returned if \\[ess-r-args-get] cannot find a list of arguments.") -(make-obsolete-variable 'ess-r-args-noargsmsg "Use `eldoc-mode' instead." "ESS 18.10") - -(defvar ess-r-args-show-prefix "ARGS: " - "A prefix string that is shown before the arguments list.") -(make-obsolete-variable 'ess-r-args-show-prefix "Use `eldoc-mode' instead." "ESS 18.10") - -(defvar ess-r-args-show-as 'message - "How ess-r-args-show should show the argument list. Possible values -are: 'message' (the default) or 'tooltip'.") -(make-obsolete-variable 'ess-r-args-show-as "Use `eldoc-mode' instead." "ESS 18.10") - -(defvar ess-r-args-keep-silent ess-S-non-functions - "List of functions names which should *not* trigger \\[ess-r-args-show]; -Defaults to `ess-S-non-functions'.") -(make-obsolete-variable 'ess-r-args-keep-silent "Use `eldoc-mode' instead." "ESS 18.10") - -(defvar ess-r-args-electric-paren nil - "Non-nil means re-assign \"(\" to \\[ess-r-args-auto-show].") -(make-obsolete-variable 'ess-r-args-electric-paren "Use `eldoc-mode' instead." "ESS 18.10") - -(defun ess-r-args-current-function () - "Returns the name of the R function assuming point is currently -within the argument list or nil if no possible function name is -found." - (save-excursion - (condition-case nil (up-list -1) - (error (message "Can't find opening parenthesis."))) - (let ((posend (point))) - (backward-sexp 1) - (let ((rfunname (buffer-substring-no-properties posend (point)))) - (if (posix-string-match "^[a-zA-Z0-9_\.]+$" rfunname) - rfunname nil))))) -(make-obsolete 'ess-r-args-current-function "See `eldoc-mode'" "ESS 18.10") - -(defun ess-r-args-get (&optional function trim) - "Returns string of arguments and their default values of R -function FUNCTION or nil if no possible function name -found. Calls `ess-r-args-current-function' if no argument given. -If TRIM is non-nill remove tabs and newlines and replace ' = ' -with '=' (useful for display in minibuffer to avoid window and -buffer readjustments for multiline string)." - (if (null function) - (setq function (ess-r-args-current-function))) - (when (and function - (or ess-current-process-name - (called-interactively-p 'any))) - (ess-force-buffer-current "R process to use: ") - ;; ^^^^^^^^^^^^^^^ has own error handler - (mapconcat (lambda (arg) (concat (car arg) "=" (cdr arg))) - (cadr (ess-function-arguments function)) - ", "))) - -(make-obsolete 'ess-r-args-get "See `eldoc-mode'" "ESS 18.10") - -;;;###autoload -(defun ess-r-args-show (&optional function) - "Show arguments and their default values of R function. Calls -\\[ess-r-args-current-function] if called without argument." - (interactive "*") - (ess-message "(ess-r-args-show): start") - (if (null function) - (setq function (ess-r-args-current-function))) - (ess-message ".... function='%s'" function) - (when function - (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) - (when args - (if (not tt) - (message args) - (require 'tooltip) - ;; value of 30 in next call is just a guess, - ;; should really be based - ;; on something like pixel height of 1-2 vertical - ;; lines of text - (ess-tooltip-show-at-point args 0 30)) - )))) -(make-obsolete 'ess-r-args-show "See `eldoc-mode'" "ESS 18.10") - -;;;###autoload -(defun ess-r-args-auto-show () - "Typically assigned to \"(\": If there's an ess-process, automatically show arguments -and their default values of an R function. Built on \\[ess-r-args-show]." - (interactive) - (insert "("); (skeleton-pair-insert-maybe nil) - (if (and (not eldoc-mode) - ess-local-process-name ; has a process and it must still be running - (ess-get-process ess-local-process-name)) - (ess-r-args-show))) -(make-obsolete 'ess-r-args-auto-show "See `eldoc-mode'" "ESS 18.10") - -;; MM: I would strongly discourage use of the following: -;; it leads to clueless newbie-users who indeed -;; explicitly call a function with all its default arguments; -;; instead of only setting the required arguments -(defun ess-r-args-insert (&optional function) - "Insert arguments and their default values of function. Calls -ess-r-args-current-function if no argument given." - (interactive "*") - (if (null function) - (setq function (ess-r-args-current-function))) - (if function - (let ((args (ess-r-args-get function)) - (pointpos (point))) - (insert args) - (goto-char pointpos)))) -(make-obsolete 'ess-r-args-insert "See `eldoc-mode'" "ESS 18.10") - - -;; (defvar ess-r-object-tooltip-alist -;; '((numeric . "summary") -;; (integer . "summary") -;; (factor . "table") -;; (lm . "summary") -;; (other . "str")) -;; "List of ( . ) to be used in \\[ess-r-object-tooltip]. -;; For example, when called while point is on a factor object, a table of that -;; factor will be shown in the tooltip. -;; The special key \"other\" in the alist defines which function to call when -;; the class is not mached in the alist. The default, str(), is a fairly useful -;; default for many, including data.frame and function objects.") - -;; From Erik Iversion, slightly modified, -;; http://www.sigmafield.org/2009/10/01/r-object-tooltips-in-ess/ -;; (defun ess-r-object-tooltip () -;; "Get info for object at point, and display it in a tooltip." -;; (interactive) -;; (let ((proc (ess-get-process)) -;; (objname (current-word)) -;; (curbuf (current-buffer)) -;; (tmpbuf (get-buffer-create " *ess-r-object-tooltip*")) -;; bs) -;; (when objname -;; (ess-write-to-dribble-buffer -;; (format "ess-r-object-tooltip: objname='%s'\n" objname)) -;; (ess-command (concat "class(" objname ")\n") tmpbuf nil nil nil proc) -;; (with-current-buffer tmpbuf -;; (goto-char (point-min)) -;; ;; CARE: The following can only work in an English language locale! -;; ;; .lang. <- Sys.getenv("LANGUAGE"); Sys.setenv(LANGUAGE="en") -;; ;; .lc. <- Sys.getlocale("LC_MESSAGES"); Sys.setlocale("LC_MESSAGES","en_US.utf-8") -;; ;; and *afterward* Sys.setenv(LANGUAGE=.lang.); Sys.setlocale("LC_MESSAGES", .lc.) -;; ;; but that fails sometimes, e.g., on Windows -;; (unless (re-search-forward "\(object .* not found\)\|unexpected" nil t) -;; (re-search-forward "\"\\(.*\\)\"" nil t) -;; (let* ((objcls (match-string 1)) -;; (myfun (or (cdr (assoc-string objcls ess-r-object-tooltip-alist)) -;; (cdr (assoc 'other ess-r-object-tooltip-alist))))) -;; (ess-command (concat myfun "(" objname ")\n") tmpbuf nil nil nil proc)) -;; (setq bs (buffer-string))))) -;; (if bs -;; (ess-tooltip-show-at-point bs 0 30)))) - -;; Erik: my default key map -;;(define-key ess-mode-map "\C-c\C-g" 'ess-r-object-tooltip) - -;; On http://www.sigmafield.org/2009/10/01/r-object-tooltips-in-ess/ -;; in the comments, "Charlie" recommended - -;; (custom-set-faces -;; '(tooltip ((t (:background "white" :foreground "blue" :foundry "fixed"))))) - - - -(provide 'ess-r-args) - -;;; ess-r-args.el ends here diff -Nru ess-18.10.2/lisp/obsolete/mouseme.el ess-18.10.2+git20220915.f45542e/lisp/obsolete/mouseme.el --- ess-18.10.2/lisp/obsolete/mouseme.el 1970-01-01 00:00:00.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/lisp/obsolete/mouseme.el 2022-10-15 08:06:36.000000000 +0000 @@ -0,0 +1,358 @@ +;;; mouseme.el --- mouse menu with commands that operate on strings + +;; Copyright (C) 1997-2020 by Free Software Foundation, Inc. + +;; Author: Howard Melman +;; Keywords: mouse, menu + +;; This file is part of GNU Emacs. + +;;; License: +;; +;; This program is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. +;; +;; This program is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. +;; +;; You should have received a copy of the GNU General Public License +;; along with this program. If not, see +;; + +;;; Commentary: + +;; This package provides a command `mouse-me' to be bound to a mouse +;; button. It pops up a menu of commands that operate on strings or a +;; region. The string passed to the selected command is the word or +;; symbol clicked on (with surrounding quotes or other punctuation +;; removed), or the region (if either it was just selected with the +;; mouse or if it was active with `transient-mark-mode' on). If the +;; command accepts a region, the selected region (or the region of the +;; word or symbol clicked on) will be passed to the command. + +;; The idea is that for any given string in a buffer you may want to +;; do different things regardless of the mode of the buffer. URLs +;; now appear in email, news articles, comments in code, and in plain +;; text. You may want to visit that URL in a browser or you may just +;; want to copy it to the kill-ring. For an email address you might +;; want to compose mail to it, finger it, look it up in bbdb, copy it to +;; the kill ring. For a word you may want to spell check it, copy it, +;; change its case, grep for it, etc. Mouse-me provides a menu to +;; make this easy. + +;; The menu popped up is generated by calling the function in the +;; variable `mouse-me-build-menu-function' which defaults to calling +;; `mouse-me-build-menu' which builds the menu from the variable +;; `mouse-me-menu-commands'. See the documentation for these +;; functions and variables for details. + +;; To install, add something like the following to your ~/.emacs: +;; (require 'mouseme) +;; (global-set-key [S-mouse-2] 'mouse-me) + +;;; Code: + +(require 'browse-url) +(require 'thingatpt) + +(eval-when-compile (require 'compile)) + +;;;; Variables + +(defgroup mouseme nil + "Popup menu of commands that work on strings." + :prefix "mouse-me-" + :group 'hypermedia) + +(defcustom mouse-me-get-string-function 'mouse-me-get-string + "Function used by `mouse-me' to get string when no region selected. +The default is `mouse-me-get-string' but this variable may commonly +be made buffer local and set to something more appropriate for +a specific mode (e.g., `word-at-point'). The function will be called +with no arguments and with point at where the mouse was clicked. +It can return either the string or to be most efficient, a list of +three elements: the string and the beginning and ending points of the +string in the buffer." + :type 'function + :options '(mouse-me-get-string) + :group 'mouseme) + +(defcustom mouse-me-build-menu-function 'mouse-me-build-menu + "Function used by `mouse-me' to build the popup menu. +The default is `mouse-me-build-menu' but this variable may commonly +be made buffer local and set to something more appropriate for +a specific mode. The function will be called with one argument, +the string selected, as returned by `mouse-me-get-string-function'." + :type 'function + :options '(mouse-me-build-menu) + :group 'mouseme) + +(defvar mouse-me-grep-use-extension 't + "If non-nil `mouse-me-grep' grep's in files with current file's extension.") + +(defcustom mouse-me-menu-commands + '(("Copy" . kill-new) + ("Kill" . kill-region) + ("Capitalize" . capitalize-region) + ("Lowercase" . downcase-region) + ("Uppercase" . upcase-region) + ("ISpell" . ispell-region) + "----" + ("Browse URL" . browse-url) + ("Dired" . dired) + ("Execute File" . mouse-me-execute) + ("Mail to" . compose-mail) + ("Finger" . mouse-me-finger) + ("BBDB Lookup" . mouse-me-bbdb) + "----" + ("Imenu" . imenu) + ("Find Tag" . find-tag) + ("Grep" . mouse-me-grep) + ("Find-Grep" . mouse-me-find-grep) + "----" + ("Apropos" . apropos) + ("Describe Function" . mouse-me-describe-function) + ("Describe Variable" . mouse-me-describe-variable) + ("Command Info" . mouse-me-emacs-command-info) + ("Man Page" . (if (fboundp 'woman) 'woman 'man)) + ("Profile Function" . mouse-me-elp-instrument-function)) + "Command menu used by `mouse-me-build-menu'. +A list of elements where each element is either a cons cell or a string. +If a cons cell the car is a string to be displayed in the menu and the +cdr is either a function to call passing a string to, or a list which evals +to a function to call passing a string to. If the element is a string +it makes a non-selectable element in the menu. To make a separator line +use a string consisting solely of hyphens. + +The function returned from this menu will be called with one string +argument. Or if the function has the symbol property `mouse-me-type' +and if its value is the symbol `region' it will be called with the +beginning and ending points of the selected string. If the value is +the symbol `string' it will be called with one string argument." + :type '(repeat sexp) + :group 'mouseme) + +(put 'kill-region 'mouse-me-type 'region) +(put 'ispell-region 'mouse-me-type 'region) +(put 'capitalize-region 'mouse-me-type 'region) +(put 'downcase-region 'mouse-me-type 'region) +(put 'upcase-region 'mouse-me-type 'region) + +;;;; Commands + +;;;###autoload +(defun mouse-me (event) + "Popup a menu of functions to run on selected string or region." + (interactive "e") + (mouse-me-helper event (lambda (name) + (or (x-popup-menu event (funcall mouse-me-build-menu-function name)) + (error "No command to run"))))) + +;;;; Exposed Functions + +;; Some tests: +;; +;; +;; http://foo.bar.com/sss/ss.html +;; http://www.ditherdog.com/howard/ +;; mailto:howard@silverstream.com +;; howard@silverstream.com +;; +;; import com.sssw.srv.agents.AgentsRsrc; +;; public AgoHttpRequestEvent(Object o, String db, Request r) +;;
    +;; d:\howard\elisp\spoon +;; \howard\elisp\spoon +;; \\absolut\howard\elisp\spoon +;; //absolut/d/Howard/Specs/servlet-2.1.pdf +;; \\absolut\d\Howard\Specs\servlet-2.1.pdf +;; gnuserv-frame. + +(defun mouse-me-get-string () + "Return a string from the buffer of text surrounding point. +Returns a list of three elements, the string and the beginning and +ending positions of the string in the buffer in that order." + (save-match-data + (save-excursion + (let ((start (point)) beg end str p) + (skip-syntax-forward "^ >()\"") + (setq end (point)) + (goto-char start) + (skip-syntax-backward "^ >()\"") + (setq beg (point)) + (setq str (buffer-substring-no-properties beg end)) + ;; remove junk from the beginning + (if (string-match "^\\([][\"'`.,?:;!@#$%^&*()_+={}|<>-]+\\)" str) + (setq str (substring str (match-end 1)) + beg (+ beg (match-end 1)))) + ;; remove URL: from the front, it's common in email + (if (string-match "^\\(URL:\\)" str) + (setq str (substring str (match-end 1)) + beg (+ beg (match-end 1)))) + ;; remove junk from the end + (if (string-match "\\([][\"'.,?:;!@#$%^&*()_+={}|<>-]+\\)$" str) + (setq end (- end (length (match-string 1 str))) ; must set end first + str (substring str 0 (match-beginning 1)))) + (list str beg end))))) + +(defun mouse-me-build-menu (name) + "Return a menu tailored for NAME for `mouse-me' from `mouse-me-menu-commands'." + (list "Mouse Me" (cons "Mouse Me" + (append (list (cons + (if (< (length name) 65) + name + "...Long String...") + 'kill-new) + "---") + mouse-me-menu-commands)))) + +;;;; Commands for the menu + +(defun mouse-me-emacs-command-info (string) + "Look in Emacs info for command named STRING." + (interactive "sCommand: ") + (let ((s (intern-soft string))) + (if (and s (commandp s)) + (Info-goto-emacs-command-node s) + (error "No command named `%s'" string)))) + +(defun mouse-me-describe-function (string) + "Describe function named STRING." + (interactive "sFunction: ") + (let ((s (intern-soft string))) + (if (and s (fboundp s)) + (describe-function s) + (error "No function named `%s'" string)))) + +(defun mouse-me-describe-variable (string) + "Desribe variable named STRING." + (interactive "sVariable: ") + (let ((s (intern-soft string))) + (if (and s (boundp s)) + (describe-variable s) + (error "No variable named `%s'" string)))) + +(defun mouse-me-elp-instrument-function (string) + "Instrument Lisp function named STRING." + (interactive "sFunction: ") + (let ((s (intern-soft string))) + (if (and s (fboundp s)) + (elp-instrument-function s) + (error "Must be the name of an existing Lisp function")))) + +(defun mouse-me-execute (string) + "Execute STRING as a filename." + (interactive "sFile: ") + (if (fboundp 'w32-shell-execute) + (w32-shell-execute "open" (convert-standard-filename string)) + (message "This function currently working only in W32."))) + + +(defun mouse-me-bbdb (string) + "Lookup STRING in bbdb." + (interactive "sBBDB Lookup: ") + (if (fboundp 'bbdb) + (bbdb string nil) + (error "BBDB not loaded"))) + +(defun mouse-me-finger (string) + "Finger a STRING mail address." + (interactive "sFinger: ") + (save-match-data + (if (string-match "\\(.*\\)@\\([-.a-zA-Z0-9]+\\)$" string) + (finger (match-string 1 string) (match-string 2 string)) + (error "Not in user@host form: %s" string)))) + +(defun mouse-me-grep (string) + "Grep for a STRING." + (interactive "sGrep: ") + (require 'compile) + (grep-compute-defaults) + (let ((ext (mouse-me-buffer-file-extension))) + (grep (concat grep-command string + (if mouse-me-grep-use-extension + (if ext + (concat " *" ext) + " *")))))) + +(defun mouse-me-find-grep (string) + "Grep for a STRING." + (interactive "sGrep: ") + (grep-compute-defaults) + (let ((reg grep-find-command) + (ext (mouse-me-buffer-file-extension)) + beg end) + (if (string-match "\\(^.+-type f \\)\\(.+$\\)" reg) + (setq reg (concat (match-string 1 reg) + (if mouse-me-grep-use-extension + (concat "-name \"*" ext "\" ")) + (match-string 2 reg)))) + (grep-find (concat reg string)))) + +;;;; Internal Functions + +(defun mouse-me-buffer-file-extension () + "Return the extension of the current buffer's filename or nil. +Returned extension is a string begining with a period." + (let* ((bfn (buffer-file-name)) + (filename (and bfn (file-name-sans-versions bfn))) + (index (and filename (string-match "\\.[^.]*$" filename)))) + (if index + (substring filename index) + ""))) + +(defun mouse-me-helper (event func) + "Determine the string to use to process EVENT and call FUNC to get cmd." + (let (name sp sm mouse beg end cmd mmtype) + ;; temporarily goto where the event occurred, get the name clicked + ;; on and enough info to figure out what to do with it + (save-match-data + (save-excursion + (setq sp (point)) ; saved point + (setq sm (mark t)) ; saved mark + (set-buffer (window-buffer (posn-window (event-start event)))) + (setq mouse (goto-char (posn-point (event-start event)))) + ;; if there is a region and point is inside it + ;; check for sm first incase (null (mark t)) + ;; set name to either the thing they clicked on or region + (if (and sm + (or (and transient-mark-mode mark-active) + (eq last-command 'mouse-drag-region)) + (>= mouse (setq beg (min sp sm))) + (<= mouse (setq end (max sp sm)))) + (setq name (buffer-substring beg end)) + (setq name (funcall mouse-me-get-string-function)) + (if (listp name) + (setq beg (nth 1 name) + end (nth 2 name) + name (car name)) + (goto-char mouse) + (while (not (looking-at (regexp-quote name))) + (backward-char 1)) + (setq beg (point)) + (setq end (search-forward name)))))) + ;; check if name is null, meaning they clicked on no word + (if (or (null name) + (and (stringp name) (string= name "" ))) + (error "No string to pass to function")) + ;; popup a menu to get a command to run + (setq cmd (funcall func)) + ;; run the command, eval'ing if it was a list + (if (listp cmd) + (setq cmd (eval cmd))) + (setq mmtype (get cmd 'mouse-me-type)) + (cond ((eq mmtype 'region) + (funcall cmd beg end)) + ((eq mmtype 'string) + (funcall cmd name)) + (t + (funcall cmd name))))) + +(provide 'mouseme) + +;;; mouseme.el ends here diff -Nru ess-18.10.2/lisp/obsolete/msdos.el ess-18.10.2+git20220915.f45542e/lisp/obsolete/msdos.el --- ess-18.10.2/lisp/obsolete/msdos.el 2018-11-10 09:41:11.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/lisp/obsolete/msdos.el 2022-10-15 08:06:36.000000000 +0000 @@ -1,50 +1,44 @@ ;;; msdos.el --- Run an MS-DOS shell in an NTemacs buffer with bash as the shell -;; Copyright (C) 1999 Richard M. Heiberger -;; Copyright (C) 2000--2004 A.J. Rossini, Richard M. Heiberger, Martin -;; Maechler, Kurt Hornik, Rodney Sparapani, and Stephen Eglen. - +;; Copyright (C) 1999-2020 Free Software Foundation, Inc. ;; Author: Richard M. Heiberger ;; Created: February 1999 ;; Maintainer: ESS-core -;; Keywords: processes - -;; This file is part of ESS. +;; This file is part of GNU Emacs. -;; This file is free software; you can redistribute it and/or modify +;;; License: +;; +;; This program is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 2, or (at your option) -;; any later version. - -;; This file is distributed in the hope that it will be useful, +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. +;; +;; This program is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. - -;; A copy of the GNU General Public License is available at -;; http://www.r-project.org/Licenses/ +;; +;; You should have received a copy of the GNU General Public License +;; along with this program. If not, see +;; ;;; Commentary: ;; The file msdos.el in the next mail message opens an *msdos* buffer ;; in shell-mode and msdos-minor-mode. When cmdproxy.exe/command.com -;; is the emacs shell, then this gets various setting right that M-x +;; is the Emacs shell, then this gets various setting right that M-x ;; shell currently misses. The function M-x msdos-minor-mode could be -;; automatically run by emacs in shell-mode in that case. +;; automatically run by Emacs in shell-mode in that case. -;; When bash is the emacs shell, msdos.el still opens a +;; When bash is the Emacs shell, msdos.el still opens a ;; cmdproxy.exe/command.com shell in the buffer *msdos*. There are ;; occasions when it is necessary to run DOS character-based programs -;; in an emacs window. +;; in an Emacs window. ;; I followed the suggestion by AndrewI to look at M-x shell and modify ;; it. It turns out not to have been trivial. -;; I've listed it as part of ESS (emacs speaks statistics) for now. I -;; will be happy to sign it over to FSF and have it become part of the -;; standard distribution for windows machines. - ;;; Code: (require 'shell); and hence 'comint @@ -66,8 +60,7 @@ :type '(choice (const :tag "None" nil) file) :group 'shell) -(make-variable-buffer-local 'msdos-minor-mode) -(defvar msdos-minor-mode nil +(defvar-local msdos-minor-mode nil "Non-nil if using msdos-minor mode as a minor mode of some other mode.") (defun msdos () @@ -150,7 +143,7 @@ (set (make-local-variable 'comint-completion-addsuffix) '("\\" . " ")) (setq comint-process-echoes t) (add-hook 'comint-output-filter-functions 'shell-strip-ctrl-m nil t) - (set-buffer-process-coding-system 'raw-text-dos 'raw-text-dos) + (set-process-coding-system (get-buffer-process (current-buffer)) 'raw-text-dos 'raw-text-dos) ;; buffer-process-coding-system is critical. ) diff -Nru ess-18.10.2/lisp/old/ess-debug.el ess-18.10.2+git20220915.f45542e/lisp/old/ess-debug.el --- ess-18.10.2/lisp/old/ess-debug.el 2018-11-10 09:41:11.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/lisp/old/ess-debug.el 1970-01-01 00:00:00.000000000 +0000 @@ -1,77 +0,0 @@ -;;; ess-debug.el --- debugging start up for ESS - -;; Copyright (C) 1997--2001 A.J. Rossini -;; Copyright (C) 2001--2006 A.J. Rossini, Richard M. Heiberger, Martin -;; Maechler, Kurt Hornik, Rodney Sparapani, and Stephen Eglen. - -;; Author: A.J. Rossini -;; Created: November 1997 -;; Maintainer: ESS-core - -;; Keywords: languages, tools - -;; This file is part of ESS. - -;; This file is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 2, or (at your option) -;; any later version. - -;; This file is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with GNU Emacs; see the file COPYING. If not, write to -;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - -;;; Commentary: - -;; Strictly for debugging and development. usage is: -;; emacs -Q -l ess-debug.el -f S4 -;; (or similar!) -;; -;; The whole point of this file is to enable debugging from a vanilla -;; environment. It probably isn't needed too much right now. - -;;; Code: - -(defun ess-add-path (path &rest options) - "Add PATH to `load-path' if it exists under `default-load-path' -directories and it does not exist in `load-path'. - -You can use following PATH styles: - load-path relative: \"PATH/\" - (it is searched from `default-load-path') - home directory relative: \"~/PATH/\" \"~USER/PATH/\" - absolute path: \"/HOO/BAR/BAZ/\" - -You can specify following OPTIONS: - 'all-paths search from `load-path' - instead of `default-load-path' - 'append add PATH to the last of `load-path'. - -For ESS, ONLY use load-path, since Emacs doesn't have -default-load-path." - - (let ((rest load-path) - p) - (if (and (catch 'tag - (while rest - (setq p (expand-file-name path (car rest))) - (if (file-directory-p p) - (throw 'tag p)) - (setq rest (cdr rest)))) - (not (member p load-path))) - (setq load-path - (if (memq 'append options) - (append load-path (list p)) - (cons p load-path)))))) - -(setq-default debug-on-error t) -(ess-add-path "~rossini/Repos/repos-svn/ess/lisp") -;; ^^adapt!!!^^^^^^^^^^^^^^^ -(require 'ess-site) - -;;; ess-debug.el ends here diff -Nru ess-18.10.2/lisp/old/ess-install.el ess-18.10.2+git20220915.f45542e/lisp/old/ess-install.el --- ess-18.10.2/lisp/old/ess-install.el 2018-11-10 09:41:11.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/lisp/old/ess-install.el 1970-01-01 00:00:00.000000000 +0000 @@ -1,228 +0,0 @@ -;;; ess-install.el --- Automatic installation of ESS. -;; Auto-install procedure. EXPERIMENTAL! - -;; Copyright (C) 2006 A.J. Rossini, Richard M. Heiberger, Martin -;; Maechler, Kurt Hornik, Rodney Sparapani, and Stephen Eglen. - -;; Author: Stephen Eglen - -;; 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/ -;; -;; -;; In short: you may use this code any way you like, as long as you -;; don't charge more than a distribution fee for it, do distribute the -;; source with any binaries, remove this notice, or hold anyone liable -;; for its results. - -;;; Commentary: - -;; Although installing ESS is relatively simple, sometimes people get -;; confused as to what to add to their init files, or even where their -;; init files are located. The following procedure should be a bit -;; simpler, as Emacs will add the necessary start-up lines itself. -;; (The instructions below assume you have downloaded ess as a zip -;; package, but it will work also for the .tar.gz version of ESS as -;; long as you know how to unpack a .tar.gz in step 3.) -;; -;; Installing ESS for the first time. -;; -;; 1. Create a folder (e.g C:/emacs) where you will store ESS. We will -;; assume that you are installing ESS into C:/emacs (unix users can use -;; ~/emacs). -;; -;; 2. Download ess-5.2.12.zip and store it in the folder you created. -;; -;; 3. Unpack the files from the zip archive, e.g. by right-clicking on it -;; within Windows explorer and selecting "Extract all". On unix, use -;; "unzip ess-5.2.12.zip". -;; -;; 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: -;; -;; C-x C-f c:/emacs/ess-5.2.12/lisp/ess-install.el RET -;; -;; You should now see a lisp file with the top line: -;; ;;; ess-install.el --- Automatic installation of ESS. -;; -;; 6. Type M-x eval-buffer RET -;; -;; What does this do? This will find your emacs initialisation file, and -;; it will add the following two lines to the end of the file: -;; -;; ;;; ESS setup for version 5.2.12 -;; (load "c:/emacs/ess-5.2.12/lisp/ess-site") -;; -;; Do not edit those two lines! They are useful if later you come to -;; upgrade ESS. -;; -;; 7. Start a new Emacs and you should find then that ESS is loaded. For -;; example, create a new file called "foo.R" and check that it opens -;; in R mode by looking at the mode line and menubar. -;; -;; Upgrading your version of ESS. -;; -;; If (and only if) you use the above instructions for installing ESS, -;; when a new version of ESS is released, you can use the same method to -;; install the new version. Repeat steps 2-7 for the new release of ESS, -;; and this time in step 6, if emacs finds that you already have the -;; special line ";;; ESS setup for version 5.2.12", it will highlight -;; those lines, and query whether you want to replace those two lines -;; with the new setup code. -;; -;; If you do upgrade ESS this way, bear in mind that your old version -;; will not be deleted from your filespace -- you will have to delete it -;; yourself. - -;; TODO: possibly add a call to (byte-recompile-directory ess-lisp-dir -;; 0) so that lisp files are byte compiled. - -;;; Code: - -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; Location where the new lisp files are stored. -(defvar ess-lisp-dir (file-name-directory - (abbreviate-file-name buffer-file-name)) - "Location where the new lisp files are stored.") - -(defvar ess-site-file (concat ess-lisp-dir "ess-site") - "Full path to the new ess-site file. -Do not include .el extension in case there is also a .elc around.") - -(defvar ess-new-version nil - "Version number of new ESS to be installed.") - -(defvar ess-installed nil) - - -(defun ess-install-byte-compile () - "Byte compile the ESS files. -This will probably generate warnings, but they can hopefully be -ignored." - ;; 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)) - -;; Check that ess-site-file is written using unix directory separators. -;; 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-utils.el - -(save-window-excursion - (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) - (setq ess-site-file - (ess-replace-in-string ess-site-file "\\\\" "/" t)) - ) - - -;; Get the version number of the new software. Open the file -;; ess-custom.el and then find the definition of the variable -;; ess-version. -(save-window-excursion - (let ((beg)) - (find-file (concat ess-lisp-dir "ess-custom.el")) - ;; go back to start, just in case file was previously open. - (goto-char (point-min)) - (search-forward "defvar ess-version \"") - (setq beg (point)) - (search-forward "\"") - (setq ess-new-version (buffer-substring beg (1- (point)))))) - -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;;; Highlighting (copied from reftex.el -- cheers Carsten!) -;; Only one highlight region is needed, whereas two are provided here, -;; so this code could be simplified. But we may want it again later. - -;; We keep a vector with several different overlays to do our highlighting. -(defvar ess-highlight-overlays [nil nil]) - -;; Initialize the overlays (here we provide two overlays) -(aset ess-highlight-overlays 0 (make-overlay 1 1)) -(overlay-put (aref ess-highlight-overlays 0) 'face 'highlight) -(aset ess-highlight-overlays 1 (make-overlay 1 1)) -(overlay-put (aref ess-highlight-overlays 1) 'face 'highlight) - -;; Two functions for activating and deactivation highlight overlays -(defun ess-highlight (index begin end &optional buffer) - "Highlight a region with overlay INDEX." - (move-overlay (aref ess-highlight-overlays index) - begin end (or buffer (current-buffer)))) -(defun ess-unhighlight (index) - "Detatch overlay INDEX." - (delete-overlay (aref ess-highlight-overlays index))) - -;;; End of highlighting code. -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - -;; Try to find the .emacs init file and edit it. -(save-window-excursion - - ;; Try to find the init file if one already exists, - ;; or create a new one if we can't find any. - (if (stringp user-init-file) - (find-file user-init-file) - ;; else, let's guess that the init file should be called ".emacs" - ;; and the tilde will be resolved okay. - (find-file "~/.emacs")) - (goto-char (point-min)) - - (let ((ess-commands - (concat "\n;;; ESS setup for version " ess-new-version "\n" - "(load \"" ess-site-file "\")\n")) - (new-install) - (beg)) - (if (search-forward ";;; ESS setup for version " nil t) - (progn - (message "You already have ESS installed.") - (setq ess-installed - (buffer-substring (point) - (save-excursion (end-of-line) (point)))) - - (beginning-of-line) - (setq beg (point)) - ;; We assume the next line contains a sexp that loads the - ;; the ess-site; this sexp can be multiple lines. - (forward-line 1) - (forward-list 1) - (ess-highlight 0 beg (point)) - - (setq new-install - (yes-or-no-p - (concat "Replace ESS version " ess-installed - " with version " - ess-new-version "? "))) - (when new-install - (kill-region beg (point)) - (insert ess-commands) - (save-buffer) - (ess-install-byte-compile) - (message (concat "ESS updated to version " ess-new-version)) - )) - ;; else, just insert commands at end. - (goto-char (point-max)) - (insert ess-commands) - (save-buffer) - (ess-install-byte-compile) - (message (concat "ESS version "ess-new-version" installed.")) - ))) - -;;; ess-install.el ends here diff -Nru ess-18.10.2/lisp/old/ess-old-contrib.el ess-18.10.2+git20220915.f45542e/lisp/old/ess-old-contrib.el --- ess-18.10.2/lisp/old/ess-old-contrib.el 2018-11-10 09:41:11.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/lisp/old/ess-old-contrib.el 1970-01-01 00:00:00.000000000 +0000 @@ -1,134 +0,0 @@ -;;; 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-18.10.2/lisp/old/ess-old-s.el ess-18.10.2+git20220915.f45542e/lisp/old/ess-old-s.el --- ess-18.10.2/lisp/old/ess-old-s.el 2018-11-10 09:41:11.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/lisp/old/ess-old-s.el 1970-01-01 00:00:00.000000000 +0000 @@ -1,25 +0,0 @@ - -(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-18.10.2/lisp/old/ess-old-site.el ess-18.10.2+git20220915.f45542e/lisp/old/ess-old-site.el --- ess-18.10.2/lisp/old/ess-old-site.el 2018-11-10 09:41:11.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/lisp/old/ess-old-site.el 1970-01-01 00:00:00.000000000 +0000 @@ -1,344 +0,0 @@ -;;; 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. 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. - -;;(setq-default inferior-S3-program "/disk05/s/S") -;;(setq-default inferior-S+3-program "Splus34") -;;(setq-default inferior-S4-program "/disk05/s4/S") -;;(setq-default inferior-S+4-program "Splus") -;;(setq-default inferior-S+5-program "Splus5") -;;(setq-default inferior-S+-program "Splus7") ; unix systems ; or -;;(setq-default inferior-S+-program "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 -;; if your version of R is not already auto-detected. -;;(setq-default inferior-R-program "R") ; unix systems -;;(setq-default inferior-R-program "Rterm") ; MS Windows, see below for path as well -;;(setq-default inferior-R-program "C:\\Program Files\\R\\R-2.5.0\\bin\\Rterm.exe") -;;(setq-default inferior-XLS-program "xlispstat") -;;(setq-default inferior-ARC-program "arc") -;;(setq-default inferior-VST-program "vista") -;;(setq-default inferior-SAS-program "sas") -;;(setq-default inferior-OMG-program "/home/rossini/src/anoncvs/Omegahat/org/omegahat/bin/omegahat") -;;(setq-default inferior-OMG-program "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 - - -;;; see essd-els.el - -;;(setq-default inferior-S-elsewhere-program "sh") -;;(setq-default inferior-S-elsewhere-program "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 inferior-S+3-program) - -;; (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-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-18.10.2/lisp/old/ess-send2.el ess-18.10.2+git20220915.f45542e/lisp/old/ess-send2.el --- ess-18.10.2/lisp/old/ess-send2.el 2018-11-10 09:41:11.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/lisp/old/ess-send2.el 1970-01-01 00:00:00.000000000 +0000 @@ -1,54 +0,0 @@ -;;(defun ess-eval-string (string) "" body) -;;(defun ess-eval-string-popup (string) "" body) -;;(defun ess-eval-string-buffer (string) "" body) - -(defun ess-region-or-word-at-point () - "If the region is active, return the contents of the region. -If the region is not active, return the word-at-point." - (interactive) - (if mark-active - (buffer-substring-no-properties (region-beginning) (region-end)) - (word-at-point))) - - -(defun ess-eval-expanded (&optional head tail commands-buffer) - "Send the expanded region or word-at-point to the inferior-ess -process after first concating the head and tail. If the region is -active, the function uses the current region. If the region is not -active, the function uses the word-at-point" - (interactive) - (if (not head) (setq head "summary(")) - (if (not tail) (setq tail ")")) - (if (not commands-buffer) (setq commands-buffer - (get-buffer-create "tmp-buffer"))) - (ess-command (concat head - (ess-region-or-word-at-point) - tail) - commands-buffer)) -(define-key ess-mode-map "\C-c\C-w" 'ess-eval-expanded) - -;; (defun ess-expand-string (string &optional head tail) -;; "Expand the STRING by concating the HEAD and TAIL. -;; Default result is 'summary(string)'." -;; (interactive) -;; (if (not head) (setq head "summary(")) -;; (if (not tail) (setq tail ")")) -;; (concat head string tail)) - - -;; Write a popup Edit-data-menubar that will allow attributes and components -;; to be displayed. -;; -;; popup menu items: -;; summary -;; print -;; show -;; help -;; dump to buffer -;; Edit.data (with optional location: window/buffer/frame) -;; drilldown -;; place in quotes (needed to get help on "[[" for example) -;; browser on -;; browser off -;; browser popup menu -;; add your own item to this menu diff -Nru ess-18.10.2/lisp/old/ess-send.el ess-18.10.2+git20220915.f45542e/lisp/old/ess-send.el --- ess-18.10.2/lisp/old/ess-send.el 2018-11-10 09:41:11.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/lisp/old/ess-send.el 1970-01-01 00:00:00.000000000 +0000 @@ -1,74 +0,0 @@ -;; First pass at context sensitive help. - -(defun ess-eval-expanded (&optional head tail commands-buffer) - "Send the expanded current region or word-at-point to the -inferior-ess process after first concating the head and tail. -If the region is active, the function uses the current region. -If the region is not active, the function uses the word-at-point" - (interactive) - (if (not head) (setq head "summary(")) - (if (not tail) (setq tail ")")) - (if (not commands-buffer) (setq commands-buffer (get-buffer-create "tmp-buffer"))) - (let (kill-ring - current-word) - (if mark-active - (progn - (copy-region-as-kill (region-beginning) (region-end)) - (setq current-word (current-kill 1))) - (setq current-word (word-at-point))) - (ess-command (concat head current-word tail) commands-buffer))) - -;; this is probably not the best key or key-map -(define-key ess-mode-map "\C-c\C-w" 'ess-eval-expanded) - - - - -;; previous version, sends expanded text to Commands window - -;;;(defun ess-eval-expanded (&optional head tail) "" -;;; (interactive) -;;; (if (not head) (setq head "summary(")) -;;; (if (not tail) (setq tail ")")) -;;; (let (kill-ring -;;; current-word) -;;; (if mark-active -;;; (progn -;;; (copy-region-as-kill (region-beginning) (region-end)) -;;; (setq current-word (current-kill 1))) -;;; (setq current-word (word-at-point))) -;;; (ess-eval-linewise (concat head current-word tail)))) -;;;(define-key ess-mode-map "\C-c\C-w" 'ess-eval-expanded) - - - - -;; First working version: set of three functions. -;; The region and word-at-point are in independent functions and -;; and are called by the main function. - -;;(defun ess-eval-expanded (&optional head tail) "" -;; (interactive) -;; (if mark-active (ess-eval-expanded-region -;; (region-beginning) (region-end) head tail) -;; (ess-eval-expanded-word-at-point head tail))) - -;;(defun ess-eval-expanded-region (start end &optional head tail) -;; "Send the expanded current region to the inferior ESS process after -;;first concating the head and tail." -;; (let (kill-ring -;; expanded-region) -;; (copy-region-as-kill start end) -;; (setq expanded-region (concat head (current-kill 1) tail)) -;; (ess-eval-linewise expanded-region)) -;;) - -;; (setq debug-on-error t) - -;;(defun ess-eval-expanded-word-at-point (&optional head tail) -;; "Send the expanded word-at-point to the inferior ESS process after -;;first concating the head and tail." -;; (let (expanded-region) -;; (setq expanded-region (concat head (word-at-point) tail)) -;; (ess-eval-linewise expanded-region)) -;;) diff -Nru ess-18.10.2/lisp/tmp/ess-dump.el ess-18.10.2+git20220915.f45542e/lisp/tmp/ess-dump.el --- ess-18.10.2/lisp/tmp/ess-dump.el 2018-11-10 09:41:11.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/lisp/tmp/ess-dump.el 1970-01-01 00:00:00.000000000 +0000 @@ -1,214 +0,0 @@ -;;; ess-dump.el --- Getting objects into text files for editing - -;; Copyright (C) 2000--2004 A.J. Rossini, Richard M. Heiberger, Martin -;; Maechler, Kurt Hornik, Rodney Sparapani, and Stephen Eglen. - -;; Original Author: A.J. Rossini -;; Created: 3 Sept 2000 -;; Maintainers: ESS-core - -;; This file is part of ESS - -;; This file is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 2, or (at your option) -;; any later version. - -;; This file is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; A copy of the GNU General Public License is available at -;; http://www.r-project.org/Licenses/ - -;;; Commentary: - -;; Code for sending statistical objects to text files for editing. -;; -;; THIS IS STRICTLY NOT USED, BUT IS FOR PLANNING. - -;;; Code: - - ; Requires and autoloads - -(require 'ess) - -(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 - (save-excursion - (set-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))))) - (save-excursion - (set-buffer buff) - (save-buffer)))) - (buffer-modified-p buff))))) - - -(defun ess-dump-object-into-edit-buffer (object) - "Edit an ESS object in its own buffer. - -Without a prefix argument, this simply finds the file pointed to by -`ess-source-directory'. If this file does not exist, or if a -prefix argument is given, a dump() command is sent to the ESS process to -generate the source buffer." - (interactive - (progn - (ess-force-buffer-current "Process to dump from: ") - (ess-read-object-name "Object to edit: "))) - (let* ((dirname (file-name-as-directory - (if (stringp ess-source-directory) - ess-source-directory - (save-excursion - (set-buffer - (process-buffer (get-ess-process - ess-local-process-name))) - (ess-setq-vars-local ess-customize-alist) - (apply ess-source-directory nil))))) - (filename (concat dirname (format ess-dump-filename-template object))) - (old-buff (get-file-buffer filename))) - - ;; If the directory doesn't exist, offer to create it - (if (file-exists-p (directory-file-name dirname)) nil - (if (y-or-n-p ; Approved - (format "Directory %s does not exist. Create it? " dirname)) - (make-directory (directory-file-name dirname)) - (error "Directory %s does not exist." dirname))) - - ;; Three options: - ;; (1) Pop to an existing buffer containing the file in question - ;; (2) Find an existing file - ;; (3) Create a new file by issuing a dump() command to S - ;; Force option (3) if there is a prefix arg - - (if current-prefix-arg - (ess-dump-object object filename) - (if old-buff - (progn - (pop-to-buffer old-buff) - (message "Popped to edit buffer.")) - ;; No current buffer containing desired file - (if (file-exists-p filename) - (progn - (ess-find-dump-file-other-window filename) - (message "Read %s" filename)) - ;; No buffer and no file - (ess-dump-object object filename)))))) - -(defun ess-dump-object (object filename) - "Dump the ESS object OBJECT into file FILENAME." - (let ((complete-dump-command (format inferior-ess-dump-command - object filename))) - (if (file-writable-p filename) nil - (error "Can't dump %s as %f is not writeable." object filename)) - - ;; Make sure we start fresh - (if (get-file-buffer filename) - (or (kill-buffer (get-file-buffer filename)) - (error "Aborted."))) - - (ess-command complete-dump-command) - (message "Dumped in %s" filename) - - (ess-find-dump-file-other-window filename) - - ;; PD, 1Apr97 - ;;This ensures that the object gets indented according to ess-mode, - ;;not as the R/S deparser does it. At the same time, it gets rid - ;;of the mess generated by sending TAB characters to the readline - ;;functions in R when you eval-buffer-*. - (indent-region (point-min-marker) (point-max-marker) nil) - (set-buffer-modified-p nil) - - ;; Don't make backups for temporary files; it only causes clutter. - ;; The ESS object itself is a kind of backup, anyway. - (if ess-keep-dump-files nil - (make-local-variable 'make-backup-files) - (setq make-backup-files nil)) - - ;; Don't get confirmation to delete dumped files when loading - (if (eq ess-keep-dump-files 'check) - (setq ess-keep-dump-files nil)) - - ;; Delete the file if necessary - (if ess-delete-dump-files - (delete-file (buffer-file-name))))) - -(defun ess-find-dump-file-other-window (filename) - "Find ESS source file FILENAME in another window." - - (if (file-exists-p filename) nil - (ess-write-to-dribble-buffer - (format "%s does not exist. Bad dump, starting fresh." filename))) - - ;; Generate a buffer with the dumped data - (find-file-other-window filename) - (ess-mode ess-customize-alist) - - (auto-save-mode 1) ; Auto save in this buffer - (setq ess-local-process-name ess-current-process-name) - - (if ess-function-template - (progn - (goto-char (point-max)) - (if (re-search-backward ess-dumped-missing-re nil t) - (progn - (replace-match ess-function-template t t) - (set-buffer-modified-p nil) ; Don't offer to save if killed now - (goto-char (point-min)) - (condition-case nil - ;; This may fail if there are no opens - (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))) - - - - - -(provide 'ess-dump) - - ; 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-dump.el ends here diff -Nru ess-18.10.2/lisp/tmp/ess-rlib.el ess-18.10.2+git20220915.f45542e/lisp/tmp/ess-rlib.el --- ess-18.10.2/lisp/tmp/ess-rlib.el 2018-11-10 09:41:11.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/lisp/tmp/ess-rlib.el 1970-01-01 00:00:00.000000000 +0000 @@ -1,246 +0,0 @@ -;;; ess-rlib.el --- browse contents of R packages. -;; Stephen Eglen, GPL applies. -;; -;; Primitive browswing facilities for the list of packages, and -;; the functions within a package. Use RET or mouse-2 to click on a -;; link and see either contents of a package or the function. -;; -;; To use, simply start a R session, eval this buffer, -;; then, in the R buffer, do -;; source("ess-rlib.R") -;; to load the changes to the data() and print.libraryIQR() functions. -;; -;; Then do M-x -;; ess-rpackage or use C-x C-e at end of one of following lines: -;; -;; (ess-rpackage "ctest") -;; okay -;; -;; (ess-rpackage "foreign") -;; okay, but fails on "S3 read functions" -;; -;; (ess-rpackage "eda") -;; shows help for lib, but won't show individual files unless package -;; has been loaded. How to show help without loading the package first? - -;; (ess-rpackage "ts") -;; not so good, due to regexp failure! - -;; (ess-rpackage "base") -;; (ess-rpackage "mva") -;; one problem, near end of buffer. - -;; Presumably, adding link markup to the output from library() command -;; would help here so that only functions will get converted into -;; links. This would be more robust than using regexps. - -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; (ess-rdata) -;; This command will browse the output of the data() command, using -;; the extra markup of data names. Output goes to the *ess-rdata* -;; buffer. It currently just converts the data names into links -;; (highlight with mouse; underline), but no action is made on the -;; links. Kurt suggested before making e.g. ? bring up help on that -;; data topic, and RET to load the package. -;; - - -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - -(defun ess-rpackage (package) - "View functions within the package named PACKAGE. The package must -have already been loaded; if the package is not loaded, the functions -in it can still be viewed, but the help for those functions cannot be -viewed. This function is therefore currently restricted to show -contents for loaded packages only. This calls an extra R funcition named -funs.for.package()." - (interactive (let () - (list - (completing-read "Package name: " - (mapcar 'list - (ess-rpackage-list)))))) - (let (beg str (all t)) - (setq str (concat "funs.for.package('" - package - "')\n")) - (ess-execute str nil "ess-rlib") - (pop-to-buffer "*ess-rlib*") - (goto-char (point-min)) - (while (re-search-forward "^[^ ]" nil t) - (beginning-of-line) - (setq beg (point)) - (re-search-forward "\\s-") - (add-text-properties beg (1- (point)) - '(face underline - mouse-face highlight - help-xref function)) - )) - - ;; End of mark up, so add some text to the top of buffer. - (goto-char (point-min)) - (insert "Functions in package " package ":\n\n") - (goto-char (point-min)) - (ess-rpackage-mode) - ) - -(defun ess-rpackage-list () - "Return list of packages currently loaded." - (save-window-excursion - (ess-execute "cat(.packages(), '\\n')") - (pop-to-buffer "*ess-output*") - (cdr (reverse - (split-string (buffer-substring (point-min) (point-max)) " "))))) - - -(defun ess-rpackage-1 (lib) - "View help available for a topic. Lib should either be blank or -name of a package. It currently uses regexps to guess which parts of -the output are function and package names. This mostly works, but for -a classic failure, see output from viewing the base package. -Old version." - (interactive "sPackage name (leave blank for lib list): ") - ;; todo: would it be worth getting completion for package list? - (let (beg str (all t)) - (setq str - (if (equal lib "") - "library()" - (setq all nil) - (concat "library(help=" - lib - ")\n"))) - (ess-execute str nil "ess-rlib") - (pop-to-buffer "*ess-rlib*") - (if all - (ess-markup-libnames) - (re-search-forward "^Index:") - (while (re-search-forward "^[^ ]+ " nil t) - (beginning-of-line) - (setq beg (point)) - (re-search-forward "[ \t]") - (add-text-properties beg (1- (point)) - '( face underline - mouse-face highlight - help-xref function)) - (end-of-line) - )) - - ;; end of mark up - (goto-char (point-min)) - (ess-rpackage-mode) - ) - ) - -(defun ess-markup-libnames () - "Markup the output from library() command." - (goto-char (point-min)) - (while (re-search-forward "^\\\\package{" nil t) - (delete-region (point) (progn (beginning-of-line) (point))) - (setq beg (point)) - (search-forward "}") - (delete-backward-char 1) - (add-text-properties beg (point) - '(face underline - mouse-face highlight - help-xref library)) - (end-of-line))) - - -(defun ess-markup-libnames-old () - "Markup the output from library() command." - (goto-char (point-min)) - (while (re-search-forward "^[^ ]+ " nil t) - (beginning-of-line) - (if (not (looking-at "Packages in library")) - (progn - (setq beg (point)) - (re-search-forward "[ \t]") - (add-text-properties beg (1- (point)) - '(face underline - mouse-face highlight - help-xref library)))) - (end-of-line) - )) - - -;;; Set up the major mode for viewing. - -(define-derived-mode ess-rpackage-mode - text-mode "Rlib" - "Major mode for browsing package contents. -\\{ess-rpackage-mode-map}" - (setq case-fold-search nil)) - - -;; define the keys. -(if (featurep 'xemacs) - (define-key ess-rpackage-mode-map [button2] 'ess-rpackage-mouse-view) - (define-key ess-rpackage-mode-map [mouse-2] 'ess-rpackage-mouse-view) - ) -(define-key ess-rpackage-mode-map [return] 'ess-rpackage-show-help) -(define-key ess-rpackage-mode-map "\t" 'help-next-ref) -(if (featurep 'xemacs) - (define-key ess-rpackage-mode-map [iso-left-tab] 'help-previous-ref) - (define-key ess-rpackage-mode-map [] 'help-previous-ref)) - - -(defun ess-rpackage-show-help () - "Show ESS help for item on current line." - (interactive) - (let - (beg fn type) - (save-excursion - (beginning-of-line) - (setq beg (point)) - (if (looking-at "[ \t\n]") - (message "No function on this line.") - (setq type (get-text-property (point) 'help-xref)) - (re-search-forward "\\s-") - (setq fn (buffer-substring-no-properties beg (1- (point)))) - (if (equal type 'function) - (ess-display-help-on-object fn) - (ess-rpackage fn)))))) - -(defun ess-rpackage-mouse-view (event) - "In rdired, visit the object on the line you click on." - ;; copied from ess-rdired. - (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)))) - (if (not (windowp window)) - (error "No file chosen")) - (set-buffer (window-buffer window)) - (goto-char pos) - (ess-rpackage-show-help)))) - -(defun ess-rdata () - "Show the data currently available. Currently the links are not -active -- nothing is set up to handle either pressing RET or mouse-2 -over a data name. Kurt suggested maybe `?' on a data item lists its -help, and RET to load the data set?" - (interactive) - (let (beg str (all t)) - (setq str "data()") - (ess-execute str nil "ess-rdata") - (pop-to-buffer "*ess-rdata*") - - ;; Now mark up the buffer. - (goto-char (point-min)) - (while (re-search-forward "^\\\\data{" nil t) - (delete-region (point) (progn (beginning-of-line) (point))) - (setq beg (point)) - (search-forward "}") - (delete-backward-char 1) - (add-text-properties beg (point) - '(face underline - mouse-face highlight - help-xref library)) - (end-of-line))) - (goto-char (point-min)) - ) diff -Nru ess-18.10.2/lisp/tmp/ess-rlib.R ess-18.10.2+git20220915.f45542e/lisp/tmp/ess-rlib.R --- ess-18.10.2/lisp/tmp/ess-rlib.R 2018-11-10 09:41:11.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/lisp/tmp/ess-rlib.R 1970-01-01 00:00:00.000000000 +0000 @@ -1,202 +0,0 @@ -## My modification of R 1.7.1 functions to help with iESS... Search for -## iESS to see the changes I made. -## source("ess-rlib.R") before running (ess-rpackage "") - -print.libraryIQR <- function (x, ...) -{ - sQuote <- function(s) paste("'", s, "'", sep = "") - db <- x$results - out <- if (nrow(db) == 0) - NULL - else lapply(split(1:nrow(db), db[, "LibPath"]), function(ind) db[ind, - c("Package", "Title"), drop = FALSE]) - outFile <- tempfile("RlibraryIQR") - outConn <- file(outFile, open = "w") - first <- TRUE - for (lib in names(out)) { - writeLines(paste(ifelse(first, "", "\n"), "Packages in library ", - sQuote(lib), ":\n", sep = ""), outConn) - if (!is.null(getOption("STERM")) && - grep("^iESS", getOption("STERM")) == 1) - writeLines(formatDL(paste("\\package{", out[[lib]][, "Package"], "}", - sep=''), - out[[lib]][, "Title"]), outConn) - else - writeLines(formatDL(out[[lib]][, "Package"], - out[[lib]][, "Title"]), outConn) - first <- FALSE - } - if (first) { - close(outConn) - unlink(outFile) - writeLines("no packages found") - } - else { - if (!is.null(x$footer)) - writeLines(c("\n", x$footer), outConn) - close(outConn) - file.show(outFile, delete.file = TRUE, title = "R packages available") - } - invisible(x) -} - - -data <- function (..., list = character(0), package = .packages(), - lib.loc = NULL, - verbose = getOption("verbose")) -{ - sQuote <- function(s) paste("'", s, "'", sep = "") - names <- c(as.character(substitute(list(...))[-1]), list) - if (!missing(package)) - if (is.name(y <- substitute(package))) - package <- as.character(y) - found <- FALSE - fsep <- .Platform$file.sep - paths <- .find.package(package, lib.loc, verbose = verbose) - if (is.null(lib.loc)) - paths <- c(.path.package(package, TRUE), getwd(), paths) - paths <- unique(paths[file.exists(paths)]) - nodata <- !(file.exists(file.path(paths, "data")) & file.info(file.path(paths, - "data"))$isdir) - if (any(nodata)) { - if (!missing(package) && (length(package) > 0)) { - packagesWithNoData <- package[package %in% sapply(paths[nodata], - basename)] - if (length(packagesWithNoData) > 1) { - warning(paste("packages", paste(sQuote(packagesWithNoData), - collapse = ", "), "contain no datasets")) - } - else if (length(packagesWithNoData) == 1) { - warning(paste("package", sQuote(packagesWithNoData), - "contains no datasets")) - } - } - paths <- paths[!nodata] - } - if (length(names) == 0) { - db <- matrix(character(0), nr = 0, nc = 4) - noindex <- character(0) - for (path in paths) { - entries <- NULL - if (file.exists(INDEX <- file.path(path, "Meta", - "data.rds"))) { - entries <- .readRDS(INDEX) - } - else if (file.exists(INDEX <- file.path(path, "data", - "00Index.rds"))) { - entries <- .readRDS(INDEX) - } - else if (file.exists(INDEX <- file.path(path, "data", - "00Index.dcf"))) { - entries <- read.dcf(INDEX) - entries <- cbind(colnames(entries), c(entries)) - } - else if (file.exists(INDEX <- file.path(path, "data", - "00Index"))) - entries <- read.00Index(INDEX) - else { - if (length(list.files(file.path(path, "data"))) > - 0) - noindex <- c(noindex, basename(path)) - } - - if (NROW(entries) > 0) { - ## SJE - if (!is.null(getOption("STERM")) && - grep("^iESS", getOption("STERM")) == 1) - entries[,1] <- paste("\\data{",entries[,1], "}", sep='' ) - - db <- rbind(db, cbind(basename(path), dirname(path), - entries)) - } - } - colnames(db) <- c("Package", "LibPath", "Item", "Title") - if (length(noindex) > 0) { - if (!missing(package) && (length(package) > 0)) { - packagesWithNoIndex <- package[package %in% noindex] - if (length(packagesWithNoIndex) > 1) { - warning(paste("packages", paste(sQuote(packagesWithNoIndex), - collapse = ", "), "contain data sets but no index")) - } - else if (length(packagesWithNoIndex) == 1) - warning(paste("package", sQuote(packagesWithNoIndex), - "contains data sets but no index")) - } - } - footer <- if (missing(package)) - paste("Use ", sQuote(paste("data(package =", ".packages(all.available = TRUE))")), - "\n", "to list the data sets in all *available* packages.", - sep = "") - else NULL - y <- list(type = "data", title = "Data sets", header = NULL, - results = db, footer = footer) - class(y) <- "packageIQR" - return(y) - } - paths <- file.path(paths, "data") - for (name in names) { - files <- NULL - for (p in paths) { - if (file.exists(file.path(p, "Rdata.zip"))) { - if (file.exists(fp <- file.path(p, "filelist"))) - files <- c(files, file.path(p, scan(fp, what = "", - quiet = TRUE))) - else warning(paste(sQuote("filelist"), "is missing for dir", - sQuote(p))) - } - else { - files <- c(files, list.files(p, full = TRUE)) - } - } - files <- files[grep(name, files)] - found <- FALSE - if (length(files) > 1) { - good <- c("R", "r", "RData", "rdata", "rda", "tab", - "txt", "TXT", "csv", "CSV") - exts <- sub(".*\\.", "", files) - o <- match(exts, good, nomatch = 100) - paths <- dirname(files) - paths <- factor(paths, levels = paths) - files <- files[order(paths, o)] - } - if (length(files) > 0) { - subpre <- paste(".*", fsep, sep = "") - for (file in files) { - if (verbose) - cat("name=", name, ":\t file= ...", fsep, sub(subpre, - "", file), "::\t", sep = "") - if (found) - break - found <- TRUE - ext <- sub(".*\\.", "", file) - if (sub(subpre, "", file) != paste(name, ".", - ext, sep = "")) - found <- FALSE - else { - zfile <- zip.file.extract(file, "Rdata.zip") - switch(ext, R = , r = source(zfile, chdir = TRUE), - RData = , rdata = , rda = load(zfile, envir = .GlobalEnv), - TXT = , txt = , tab = assign(name, read.table(zfile, - header = TRUE), env = .GlobalEnv), CSV = , - csv = assign(name, read.table(zfile, header = TRUE, - sep = ";"), env = .GlobalEnv), found <- FALSE) - if (zfile != file) - unlink(zfile) - } - if (verbose) - cat(if (!found) - "*NOT* ", "found\n") - } - } - if (!found) - warning(paste("Data set", sQuote(name), "not found")) - } - invisible(names) -} - -## This function needed for ess-rpackage, Sun 14 Sep 2003 -funs.for.package <- function(package) { - x <- .readRDS(file = system.file("Meta", "Rd.rds", package = package)) - writeLines(formatDL(unlist(x[,5]), - rep(x[,4], sapply(x[,5], length)))) -} diff -Nru ess-18.10.2/.mailmap ess-18.10.2+git20220915.f45542e/.mailmap --- ess-18.10.2/.mailmap 1970-01-01 00:00:00.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/.mailmap 2022-10-15 08:06:36.000000000 +0000 @@ -0,0 +1,20 @@ +Alex Branham +David Shepherd +David Whiting +Ernest Adrogué nfdisco +Ernest Adrogué nfdisco +Henning Redestig +Henning Redestig +Mark Lunt +Martin Maechler +Martin Maechler +Martin Maechler sfs +Rodney Sparapani +Shuguang Sun +Shuguang Sun ShuguangSun +Stefan Theussl theussl +Stephen Eglen Stephen J. Eglen +Wilfred Hughes +Yi Liu Yi Liu +Yi Liu YiLiu6240 +dickmao <7578770+dickmao@users.noreply.github.com> diff -Nru ess-18.10.2/Makeconf ess-18.10.2+git20220915.f45542e/Makeconf --- ess-18.10.2/Makeconf 2018-11-10 09:41:10.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/Makeconf 2022-10-15 08:06:36.000000000 +0000 @@ -1,39 +1,25 @@ -####======= Common Declarations for *all* ESS -*-Makefile-*-s ========== - ## To install ESS for all users on your unix system: -## 1. Edit Section 1 and 2 below -## 2. Execute: gmake install +## 1. Check variables below, edit as necessary +## 2. make +## 3. make install ## Section 1 -## Installation variables for your emacs variant +## Installation variables for your Emacs variant ## -## Variable Description -## EMACS use emacs for GNU Emacs, xemacs for XEmacs -## EMACSBATCH emacs/xemacs command for compiling elisp files -## SITELISP Destination of site-lisp; but some variants have no site-lisp -## LISPDIR Destination of compiled elisp files -## INFODIR Destination of info files -## ETCDIR Destination of script and icon files -## PREFIX(DESTDIR) Directory prepended to SITELISP, INFODIR, DOCDIR & ETCDIR -## Specify either PREFIX or DESTDIR to over-ride /usr -DESTDIR=/usr -PREFIX=$(DESTDIR) - +## Variable Description +## EMACS Path to GNU Emacs +## EMACSBATCH How to run Emacs as batch +## SITELISP Destination of site-lisp +## ESSDESTDIR Destination of ESS +DESTDIR ?= /usr +PREFIX ?= $(DESTDIR) ##__ GNU Emacs __ EMACS ?= emacs -SITELISP=$(PREFIX)/share/emacs/site-lisp -LISPDIR=$(SITELISP)/ess -INFODIR=$(PREFIX)/share/info -ETCDIR =$(PREFIX)/share/emacs/etc/ess - -##__ XEmacs __ -#EMACS=$(PREFIX)/bin/xemacs -#SITELISP=$(PREFIX)/share/xemacs/site-packages/lisp -#LISPDIR=$(SITELISP)/ess -#INFODIR=$(PREFIX)/share/xemacs/site-packages/info -#ETCDIR =$(PREFIX)/share/xemacs/site-packages/etc/ess +SITELISP ?= $(PREFIX)/share/emacs/site-lisp +ESSDESTDIR ?= $(SITELISP)/ess +EMACSBATCH ?= $(EMACS) -batch -Q -##__ GNU Emacs __ for Mac OS X with NeXTstep (Cocoa or GNUstep) +##__ GNU Emacs __ for macOS # PREFIX=/Applications/Emacs.app/Contents/Resources # EMACS=/Applications/Emacs.app/Contents/MacOS/Emacs # SITELISP=$(PREFIX)/site-lisp @@ -49,14 +35,14 @@ # INFODIR=/Applications/Aquamacs.app/Contents/Resources/info # ETCDIR=$(PREFIX)/ess-mode/etc -## the following command is the same for recent versions of both Emacs and XEmacs -EMACSBATCH = $(EMACS) -batch -no-site-file -no-init-file +## COMPILE-FLAGS is set in tests +COMPILE ?= $(EMACSBATCH) $(COMPILE-FLAGS) --directory . --directory ./obsolete -f batch-byte-compile +COMPILE-SIMPLE ?= $(EMACSBATCH) --directory . --directory ./obsolete -f batch-byte-compile ## Section 2 ## Installation variables for your unix variant ## ## Variable Description -## SHELL Bourne shell or XPG4 compliant shell ## MAKEINFO program to convert .texi{nfo} to .info ## MAKEHTML program to convert .texi{nfo} to .html ## MAKETXT program to convert .texi{nfo} to .txt @@ -67,60 +53,26 @@ ## DOCDIR Destination of other doc files ## DOWNLOAD Download internet file to stdout -SHELL = /bin/sh - -MAKEINFO = LC_ALL=C LANG=en makeinfo -# new: MAKEHTML .html .texi {necessary to build 'Index'} -MAKEHTML = $(MAKEINFO) --html --no-split --css-include=atouchofstyle.css -o -## ^^^^^^^^^^ today's bandwidth is fast -#MAKETXT = $(MAKEINFO) --no-validate --no-headers --no-split -o - -MAKETXT = $(MAKEINFO) --no-validate --plaintext --no-split -o - - -INSTALLDIR = mkdir -p -#INSTALLDIR = install -d - -INSTALL = cp -p -#INSTALL = install - -UNINSTALL = rm -f - -DOCDIR=$(PREFIX)/share/doc/ess - -# N.B. $(shell) is a GNU-ism: we need a workaround to be UNIX make friendly -DOWNLOAD=$(shell which wget > /dev/null && echo 'wget -qO -' || which curl) -##DOWNLOAD = wget -O - -##DOWNLOAD = curl +MAKEINFO ?= LC_ALL=C LANG=en makeinfo +MAKEHTML ?= $(MAKEINFO) --html --no-split --css-include=atouchofstyle.css -o +MAKETXT ?= $(MAKEINFO) --no-validate --plaintext --no-split -o - +INSTALLDIR ?= mkdir -p +INSTALL ?= cp -p +UNINSTALL ?= rm -f +TEXI2PDF ?= LANG=C texi2dvi --pdf +DOWNLOAD ?= $(shell which wget > /dev/null && echo 'wget -qO -' || which curl) +INSTALLINFO ?= install-info ## Section 3 ## For ESS developers only, not part of installation procedure ## ## Variable Description -## ESSVERSION set to the contents of VERSION -## ESSDIR ess- prepended to ESSVERSION -## ESSVERSIONTAG repository tags cannot contain .'s (no longer used) ## GNUTAR the name of GNU tar to support the z option ## SVN_URL SVN repository URL (repo retired) ## UPLOAD_DIR Martin's upload directory ## ESS_HOMEPAGE Martin's svn co https://svn.r-project.org/ESS-web/trunk ## -# 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` -#ESSVERSIONTAG=ESS-$(shell sed 's/\./-/g' VERSION) - -## SVN repo retired -## Currently only works when run in top ess/ directory; not in etc/ or lisp/ : -# ESSfromSVN=$(shell test -d .svn && echo 'yes') -# ifeq ($(ESSfromSVN),yes) -# ESSVERSIONsvn=$(shell svn up && echo "`date +%y-%m`-r`svnversion`") -# else -# ESSVERSIONsvn=$(shell echo "`date +%y-%m`_not_svn") -# endif -# ESSVERSIONTAG=$(ESSVERSIONsvn) - -ESSDIR=ess-$(ESSVERSION) GNUTAR=tar # SVN_URL = https://svn.r-project.org/ESS UPLOAD_DIR = /u/maechler/emacs/ess-WWW/downloads/ess @@ -128,6 +80,8 @@ GPG=$(shell (gpg2 --version > /dev/null 2>&1 && echo gpg2 ) || echo gpg ) - - .SUFFIXES: .i3 .m3 .nw .tex .dvi .html .c .h .el .elc + +# Local Variables: +# mode: makefile-gmake +# End: diff -Nru ess-18.10.2/Makefile ess-18.10.2+git20220915.f45542e/Makefile --- ess-18.10.2/Makefile 2018-11-10 09:41:10.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/Makefile 2022-10-15 08:06:36.000000000 +0000 @@ -3,70 +3,114 @@ ## Before making changes here, please take a look at Makeconf include ./Makeconf -## 'all' is the default target, i.e. 'make' and 'make all' are the same. -.PHONY: all install uninstall -all install uninstall: $(ETC_FILES) - cd lisp; $(MAKE) $@ - cd doc; $(MAKE) $@ - cd etc; $(MAKE) $@ +ESSVERSION := $(shell cat VERSION) +PKGVERSION := $(shell sed -n 's/;; Version: *\(.*\) */\1/p' lisp/ess.el) +ESSDIR := ess-$(ESSVERSION) +ifneq ($(ESSVERSION), $(PKGVERSION)) + $(shell sed -i 's/Version: .*/Version: $(ESSVERSION)/' VERSION) + ${shell sed -i 's/;; Version: .*/;; Version: $(ESSVERSION)/' lisp/ess.el} +endif + +ESSR-VERSION := $(shell sed -n "s/;; ESSR-Version: *\(.*\) */\1/p" lisp/ess.el) + +.PHONY: all +all: lisp doc etc autoloads .PHONY: version version: @echo "********************* VERSIONS **************************" @echo $(shell $(EMACS) --version | sed -n 1p) @echo ESS $(ESSVERSION) + @echo ESSR $(ESSR-VERSION) @echo "*********************************************************" .PHONY: lisp lisp: version - cd lisp; $(MAKE) + $(MAKE) -C lisp all .PHONY: doc doc: version - cd doc; $(MAKE) + $(MAKE) -C doc all .PHONY: etc etc: version - cd etc; $(MAKE) + $(MAKE) -C etc all .PHONY: test test: version - cd test; $(EMACS) --script run-tests + $(MAKE) -C test all -generate-indent-cases: - cd test; $(EMACS) --script generate-indent-cases +test-%: version + $(MAKE) -C test $* .PHONY: julia julia: - cd lisp; $(MAKE) julia-mode.el + @cd lisp; $(MAKE) julia-mode.el .PHONY: autoloads autoloads: cd lisp; $(MAKE) ess-autoloads.el +## Rebuild and publish ESSR package: +# 1. Update ESSR-Version in lisp/ess.el +# 2. make essr +.PHONY: essr +essr: VERSION + @echo "**********************************************************" + @echo "** Making ESSRv$(ESSR-VERSION) **" + @sed -i "s/^ *VERSION <- .*/ VERSION <- \"$(ESSR-VERSION)\"/" etc/ESSR/R/.load.R + cd etc/ESSR/; ./BUILDESSR; cd - + @git add etc/ESSR.rds lisp/ess.el etc/ESSR/R/.load.R + git commit -m"ESSR Version $(ESSR-VERSION)" + git tag "ESSRv"$(ESSR-VERSION) + git push + git push origin "ESSRv"$(ESSR-VERSION) + +install: all + mkdir -p $(ESSDESTDIR) + $(INSTALL) -R ./* $(ESSDESTDIR)/ + +uninstall: + rm -rf $(ESSDESTDIR) + + ## the rest of the targets are for ESS developer's use only : +.PHONY: tarballs sign-tarballs +TARBALLS = ess-$(ESSVERSION).tar ess-$(ESSVERSION).tgz ess-$(ESSVERSION).zip # TODO: ess-plus-$(VERSION).tar +tarballs: $(TARBALLS) + +SIGNED_TARBALLS = $(addsuffix .sig, $(TARBALLS)) +sign-tarballs: $(SIGNED_TARBALLS) +$(SIGNED_TARBALLS): $(TARBALLS) + @echo "Signing $@" + $(GPG) -ba -o $@ $< -## --- PRE-release --- -# Create .tgz and .zip files only -# GNUTAR=gtar make tarballs -tarballs: $(ESSDIR) - @echo "**********************************************************" - @echo "** Making distribution of ESS for (pre)release $(ESSVERSION) from $(ESSDIR)/" - @echo "** Making pdf and html documentation" - cd $(ESSDIR)/doc/ ; $(MAKE) pdf - cd $(ESSDIR)/doc/ ; $(MAKE) html +.PHONY: tgz +tgz: ess-$(ESSVERSION).tgz +ess-$(ESSVERSION).tgz: $(ESSDIR) @echo "** Creating .tgz file **" test -f $(ESSDIR).tgz && rm -rf $(ESSDIR).tgz || true $(GNUTAR) hcvofz $(ESSDIR).tgz $(ESSDIR) - @echo "Signing tgz file" - $(GPG) -ba -o $(ESSDIR).tgz.sig $(ESSDIR).tgz + +.PHONY: zip +zip: ess-$(ESSVERSION).zip +ess-$(ESSVERSION).zip: $(ESSDIR) @echo "** Creating .zip file **" test -f $(ESSDIR).zip && rm -rf $(ESSDIR).zip || true zip -r $(ESSDIR).zip $(ESSDIR) - @echo "Signing zip file" - $(GPG) -ba -o $(ESSDIR).zip.sig $(ESSDIR).zip - touch $@ + +.PHONY: package +package: ess-$(ESSVERSION).tar +ess-$(ESSVERSION).tar: + @echo "Creating $@" + @rm -rf $(ESSDIR) + @git archive HEAD -o ess-$(ESSVERSION).tar + @mkdir ess-$(ESSVERSION) + @$(GNUTAR) -C ess-$(ESSVERSION) -xf ess-$(ESSVERSION).tar + @cd ess-$(ESSVERSION) && $(EMACS) -Q --script "targets/create-pkg-file.el" + @$(GNUTAR) c -f ess-$(ESSVERSION).tar ess-$(ESSVERSION) + @rm -rf ess-$(ESSVERSION)/ # Create the "release" directory # run in the foreground so you can accept the certificate @@ -76,29 +120,28 @@ $(MAKE) all # remove previous ESSDIR, etc: $(MAKE) cleanup-dist - @echo "**********************************************************" - @echo "** Making $(ESSDIR) directory of ESS for release $(ESSVERSION)," - @echo "** (must have setup git / github with cached authentication, prior for security)" - @echo "**********************************************************" @echo "** Exporting Files **" - git clone git@github.com:emacs-ess/ESS.git $(ESSDIR)-git + git clone . $(ESSDIR)-git mkdir -p $(ESSDIR) (cd $(ESSDIR)-git; $(GNUTAR) cvf - --exclude=.git --exclude=.svn --no-wildcards .) | (cd $(ESSDIR); $(GNUTAR) xf - ) @echo "** Clean-up docs, Make docs, and Correct Write Permissions **" 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; $(INSTALL) ess-custom.el ../$(ESSDIR)/lisp/; cd .. +# just in case: update from VERSION: + cd lisp; $(INSTALL) ess.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 + $(shell git-rev-parse master | cut -c 1-12 ) > $(ESSDIR)/etc/git-ref dist: VERSION tarballs + @echo "** Making pdf and html documentation" + @cd $(ESSDIR)/doc/ ; $(MAKE) pdf + @cd $(ESSDIR)/doc/ ; $(MAKE) html grep -E 'defvar ess-(version|revision)' lisp/ess-custom.el \ $(ESSDIR)/lisp/ess-custom.el > $@ @@ -117,12 +160,8 @@ %.spec: %.spec.in VERSION sed 's/@@VERSION@@/$(ESSVERSION)/g' $< > $@ - ## --- RELEASE section --- -## NB: Typically use 'make -W VERSION ChangeLog' before 'make rel' <<--- MUST -## since ~~~~~~~~~~~~~~~~~~~~~~~~~ -## ChangeLog often ends up newer than VERSION ChangeLog: VERSION @echo "** Adding log-entry to ChangeLog file" mv ChangeLog ChangeLog.old @@ -133,7 +172,6 @@ @rm ChangeLog.old git commit -m 'Version $(ESSVERSION)' ChangeLog - tag: @echo "** Tagging the release ** 1) pull existing; 2) tag 3) push it" git pull --tags @@ -179,10 +217,8 @@ builddeb: dpkg-buildpackage -uc -us -rfakeroot -tc -## Old Note (clean and distclean are now the same): -## 'clean' shall remove *exactly* those things that are *not* in version control -## 'distclean' removes also things in VC (svn, when they are remade by "make"): clean distclean: cleanup-dist + rm -f ess-$(ESSVERSION).tar cd etc; $(MAKE) $@ cd lisp; $(MAKE) $@ cd doc; $(MAKE) $@ diff -Nru ess-18.10.2/mkinstalldirs ess-18.10.2+git20220915.f45542e/mkinstalldirs --- ess-18.10.2/mkinstalldirs 2018-11-10 09:41:11.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/mkinstalldirs 1970-01-01 00:00:00.000000000 +0000 @@ -1,32 +0,0 @@ -#!/bin/sh -# mkinstalldirs --- make directory hierarchy -# Author: Noah Friedman -# Created: 1993-05-16 -# Last modified: 1994-03-25 -# Public domain - -errstatus=0 - -for file in ${1+"$@"} ; do - set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'` - shift - - pathcomp= - for d in ${1+"$@"} ; do - pathcomp="$pathcomp$d" - case "$pathcomp" in - -* ) pathcomp=./$pathcomp ;; - esac - - if test ! -d "$pathcomp"; then - echo "mkdir $pathcomp" 1>&2 - mkdir "$pathcomp" || errstatus=$? - fi - - pathcomp="$pathcomp/" - done -done - -exit $errstatus - -# mkinstalldirs ends here diff -Nru ess-18.10.2/NEWS ess-18.10.2+git20220915.f45542e/NEWS --- ess-18.10.2/NEWS 2018-11-10 09:41:15.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/NEWS 1970-01-01 00:00:00.000000000 +0000 @@ -1,282 +0,0 @@ -Bug Fixes in 18.10.2: - * ESS[R] Fix namespace evaluation in non-installed packages. - Evaluation is directed into GlobalEnv as originally intended. - * 'Makefile' fixes, notably for 'make install' and including full - docs in the tarballs. - - Bug Fixes in 18.10-1: - * New functions 'ess-eval-line-visibly-and-step' ('C-c C-n' and - 'ess-eval-region-or-line-visibly-and-step' ('C-RET') which behave - as the old versions of 'ess-eval-line-and-step' and - 'ess-eval-region-or-line-and-step'. - - Changes and New Features in 18.10: - - * This is the last release to support Emacs older than 25.1. Going - forward, only GNU Emacs 25.1 and newer will be supported. Soon - after this release, support for older Emacs versions will be - dropped from the git master branch. Note that MELPA uses the git - master branch to produce ESS snapshots, so if you are using Emacs < - 25.1 from MELPA and are unable to upgrade, you should switch to - MELPA-stable. - - * ESS now displays the language dialect in the mode-line. So, for - example, R buffers will now show ESS[R] rather than ESS[S]. - - * The ESS manual has been updated and revised. - - * The ESS initialization process has been further streamlined. If - you update the autoloads (which installation from 'package-install' - does), you should not need to '(require 'ess-site)' at all, as - autoloads should automatically load ESS when it is needed (e.g. - the first time an R buffer is opened). In order to defer loading - your ESS config, you may want to do something like - '(with-require-after-load "ess" )' in your Emacs - init file. Users of the popular 'use-package' Emacs package can - now do '(use-package ess :defer t)' to take advantage of this - behavior. *Note (ess)Activating and Loading ESS:: for more - information on this feature. - - * ESS now respects Emacs conventions for keybindings. This means - that The 'C-c [letter]' bindings have been removed. This affects - 'C-c h', which was bound to 'ess-eval-line-and-step-invisibly' in - 'sas-mode-local-map'; 'C-c f', which was bound to - 'ess-insert-function-outline' in 'ess-add-MM-keys'; and 'C-c h', - which was bound to 'ess-handy-commands' in 'Rd-mode-map', - 'ess-noweb-minor-mode-map', and 'ess-help-mode-map' - - * Functions 'ess-eval-line-and-step' and - 'ess-eval-region-or-line-and-step' now behave consistently with - other evaluation function inside a package. - - * ESS[R]: 'ess-r-package-use-dir' now works with any mode. This sets - the working directory to the root of the current package including - for example C or C++ files within '/src'). - - * ESS[R]: Long + + prompts in the inferior no longer offset output. - - * ESS[R]: New option 'strip' for 'inferior-ess-replace-long+'. This - strips the entire + + sequence. - - * ESS modes now inherit from 'prog-mode'. In the next release, ESS - modes will use 'define-derived-mode' so that each mode will have - (for example) its own hooks and keymaps. - - * ESS[R]: Supports flymake in R buffers for Emacs 26 and newer. - Users need to install the 'lintr' package to use it. Customizable - options include 'ess-use-flymake', 'ess-r-flymake-linters', and - 'ess-r-flymake-lintr-cache'. - - * ESS[R]: Gained support for xref in Emacs 25+. *Note (emacs)Xref:: - - * ESS[R]: The startup screen is cleaner. It also displays the - startup directory with an explicit 'setwd()'. - - * ESS[R]: Changing the working directory is now always reflected in - the process buffer. - - * ESS[R]: 'Makevars' files open with 'makefile-mode'. - - * New variable 'ess-write-to-dribble'. This allows users to disable - the dribble ('*ESS*') buffer if they wish. - - * All of the '*-program-name' variables have been renamed to - '*-program'. Users who previously customized e.g. - 'inferior-ess-R-program-name' will need to update their - customization to 'inferior-ess-R-program'. These variables are - treated as risky variables. - - * 'ess-smart-S-assign' was renamed to 'ess-insert-assign'. It - provides similar functionality but for any keybinding, not just - '_'. For instance if you bind it to ';', repeated invokations - cycle through between assignment and inserting ';'. - - * 'C-c C-=' is now bound to 'ess-cycle-assign' by default. See the - documentation for details. New user customization option - 'ess-assign-list' controls which assignment operators are cycled. - - * ESS[R] In remote sessions, the ESSR package is now fetched from - GitHub. - - * Commands that send the region to the inferior process now deal with - rectangular regions. See the documentation of 'ess-eval-region' - for details. This only works on Emacs 25.1 and newer. - - * ESS[R]: Improvements to interacting with iESS in non-R files. - Interaction with inferior process in non-R files within packages - (for instance C or C++ files) has been improved. This is a work in - progress. - - * ESS[R]: Changing the working directory is now always reflected in - the process buffer. - - * ESS[JAGS]: *.jog and *.jmd files no longer automatically open in - JAGS mode. - - Many improvements to fontification: - - * Improved customization for faces. ESS now provides custom faces - for (nearly) all faces used and places face customization options - into their own group. Users can customize these options using 'M-x - customize-group RET ess-faces'. - - * Many new keywords were added to 'ess-R-keywords' and - 'ess-R-modifiers'. See the documentation for details. - - * ESS[R]: 'in' is now only fontified when inside a 'for' construct. - This avoids spurious fontification, especially in the output buffer - where 'in' is a commond English word. - - * ESS: Font-lock keywords are now generated lazily. That means you - can now add or remove keywords from variables like 'ess-R-keywords' - in your Emacs configuration file after loading ESS (i.e. in the - ':config' section for 'use-package' users). - - * ESS[R]: Fontification of roxygen '@param' keywords now supports - comma-separated parameters. - - * ESS[R]: Certain keywords are only fontified if followed by a - parenthesis. Function-like keywords such as 'if ()' or 'stop()' - are no longer fontified as keyword if not followed by an opening - parenthesis. The same holds for search path modifiers like - 'library()' or 'require()'. - - * ESS[R]: Fixed fontification toggling. Especially certain syntactic - elements such as '%op%' operators and backquoted function - definitions. - - * ESS[R]: 'ess-font-lock-toggle-keyword' can be called interactively. - This command asks with completion for a font-lock group to toggle. - This functionality is equivalent to the font-lock menu. - - Notable bug fixes: - - * 'prettify-symbols-mode' no longer breaks indentation. This is - accomplished by having the pretty symbols occupy the same number of - characters as their non-pretty cousins. You may customize the new - variable 'ess-r-prettify-symbols' to control this behavior. - - * ESS: Inferior process buffers are now always displayed on startup. - Additionally, they don't hang Emacs on failures. - - Obsolete libraries, functions, and variables: - - * The 'ess-r-args.el' library has been obsoleted and will be removed - in the next release. Use 'eldoc-mode' instead, which is on by - default. - - * Functions and options dealing with the smart assign key are - obsolete. The following functions have been made obsolete and will - be removed in the next release of ESS: 'ess-smart-S-assign', - 'ess-toggle-S-assign', 'ess-toggle-S-assign-key', - 'ess-disable-smart-S-assign'. - - The variable 'ess-smart-S-assign-key' is now deprecated and will be - removed in the next release. If you would like to continue using - '_' for insterting assign in future releases, please bind - 'ess-insert-assign' in 'ess-mode-map' the normal way. - - * ESS[S]: Variable 'ess-s-versions-list' is obsolete and ignored. - Use 'ess-s-versions' instead. You may pass arguments by starting - the inferior process with the universal argument. - - 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 - diff -Nru ess-18.10.2/ONEWS ess-18.10.2+git20220915.f45542e/ONEWS --- ess-18.10.2/ONEWS 2018-11-10 09:41:16.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/ONEWS 1970-01-01 00:00:00.000000000 +0000 @@ -1,1516 +0,0 @@ -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'. - - 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 (https://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 - (https://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-18.10.2/OONEWS ess-18.10.2+git20220915.f45542e/OONEWS --- ess-18.10.2/OONEWS 2018-11-10 09:41:10.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/OONEWS 1970-01-01 00:00:00.000000000 +0000 @@ -1,237 +0,0 @@ -== Changes up to version 5.0 : - -* Works with XLispStat, R, and S(plus). - - - -== Changes up to version 4.8.MM6.XE3 : - -* inferior S-mode: - C-c C-a is comint-bol (not attach directories) - Output cleaned up (thanks to PD). - -* Code cleaned up, more according to Emacs-Lisp Style Guide. - -* Added some code for S4 (not activated yet). (thanks to JMC). - -* Added some extra configuration code (not activated yet) (thanks to MM). - -* reports to proper authority (Hornik/Maechler/Rossini). - -* Makefile updated (i.e. Unpacks into a subdirectory (this has been - true for all XE versions, etc)). - -* Fixed up output from R (KH). - - - -== Changes up to version 4.8.MM6.XE2 : - -* Works with Emacs and XEmacs. I think. Documentation needs to be - updated . - - - -== Changes up to version 4.8.MM6.XE1 : - -* XEmacs compatibility added, Emacs compatibility broken. Easymenu - now in use. - - - -== Changes up to version 4.8.MM6 : - -* Lots of patches by Martin. S-eval, right? (AJR: I don't know). - - - -== Changes up to version 4.8: - -* Keybinding changes in S Transcript Mode. RET now simply executes - the current commant. M-RET executes and moves, C-c RET copies, - leaving you in the process buffer. These bindings mirror those in - Inferior S mode. - -* If S-source-directory is a lambda expression, it is evaluated with - the process buffer as the current buffer. - -* The default starting directory is always your home directory. Set - S-directory to `nil' to get the old behaviour (use the current - buffer's default directory). - -* In Inferior S mode, S mode and S transcript mode, M-? is now bound - to the new function S-list-object-completions. Also, S-resynch is - available from the Inf-S menu. - -* S-request-a-process is now bound to C-c C-k. This frees C-c C-p for - the standard comint binding of comint-previous-prompt. - -* Massive manual update. - - - -== Changes in version 4.7: - -* Probably *only* works with Emacs 19.29 - -* New semantics for S-keep-dump-files. Values may be nil, check, ask - or t; the default is 'check. It's also now buffer-local. See the - info file for more details. - -* New hook, S-post-run-hook, run just after the S process starts. Use - this to evaluate code at the start of a session. - - - -== Changes in version 4.6: - -* Works with Emacs 19.29 - -* Font-lock support in S-mode, inferior-S-mode and S-transcript-mode buffers - -* M-RET in inferior-S-mode is bound to S-transcript-send-command-and-move - -* S-site now much more lightweight to load. - - - -== Changes in version 4.5: - -* New, and hopefully simpler, installation procedure. - - - -== Changes in version 4.4: - -* There is now a command to send bug reports: S-submit-bug-report. It - is also available from menus (Send bug report). - -* Keybinding changes: S-view-at-bottom (on C-c C-v) has been deleted. - It's functionality is provided by comint's - comint-show-maximum-output, on C-c C-e. S-display-help-on-object - has moved from C-c C-h onto C-c C-v (and now has an alias, M-x - S-help), and S-execute (S-execute-in-tb in S-mode) has moved from - C-c C-e to C-c C-t. - - - -== Changes in version 4.3: - -* The variable S-source-directory-generator has been deleted. It's - functionality has been subsumed into the variable - S-source-directory; if this is not a string it is assumed to be a - lambda expression, and behaves in the same was as S-source-directory - used to. - -* New user option S-delete-dump-files. - - - -== Changes in version 4.2: - -* New user variable S-inf-filenames-map. Set this to nil if you are - using DOS or some other system with limited filename lengths. - -* S-local-variables-string and S-temp-buffer-p have been deleted. - S-mode no longer adds a local variables section to source files. - You should use file extensions to set the major mode. - -* S-insert-function-templates has been deleted. Its functionality has - been taken over by the user variable S-function-template. - -* S.el has been divided into four separate files, with autoloads. - -* New file S-site.el for site-level customizations. - -* S-ask-about-display and X-displays-list have been removed. - -* User variable: S-ask-about-transfile. If non-nil, asks for a - transcript file to use. - - - -== Changes in version 4.0: - -* The TAB key in inferior-S-mode is more versatile; it completes S - object names when point follows an object name, and completes - filenames when point is in a string. - -* New mode: S-transcript-mode, for dealing with S transcript files. - -* Multi-line inputs are now evaluated neatly - -* inferior-S-prompt is no longer a user variable. Instead, set - inferior-S-primary-prompt and inferior-S-secondary-prompt - -* Uses the comint.el supplied with Emacs 19.20 onwards. - -* Hook: S-send-input-hook - -* Emacs version 18 is no longer supported (sorry). Works with Emacs - 19 (and, unfortunately, only Emacs 19) - -* S-tek is no longer supported, and has been removed from the - distribution - -* Works with S version 3.1 - - - -== Changes in version 3.5: - -* Support for multiple S processes. Pass a numeric argument to M-x S - to start a new S process. The name of the process associated with - the cuurent buffer is shown in the mode line like this: [S2] - -* In the process buffer, a paragraph is a prompt, a command and its - output, to make the paragraph functions useful. Multiple S sessions - are delimited by ^L, to make the page functions useful - -* User variable S-synchronize-evals - -* New function S-request-a-process, bound to C-c C-p - -* New function S-clean-region - - - -== RELEASE 3.4 INFORMATION - -* Works with version 3.0 S - -* Command-line completion of S object names - -* Recognition of attached data frames - -* Dedicated S Help mode - -* Tek graphics support - -* Several bugfixes and code cleanups - -* Texinfo documentation - - - -== RELEASE 2.1 INFORMATION - -Improvements since last release (unnumbered of Summer 1990): - -* Better description provided of functions loaded. - -* Better header for this file. - -* S-directory is now a prescriptive rather than just - descriptive variable. - -* better syntax table, so |#; are better recognized and - commands using them work better. - -* we have a version number. - - - -Local Variables: -mode: text -fill-prefix: " " -End: diff -Nru ess-18.10.2/README ess-18.10.2+git20220915.f45542e/README --- ess-18.10.2/README 2018-11-10 09:41:15.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/README 1970-01-01 00:00:00.000000000 +0000 @@ -1,551 +0,0 @@ -1 General Information: README -***************************** - -This is the README file for the distribution of ESS version 18.10.2 - - 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 Installation -================ - -ESS supports GNU Emacs versions 24.3 and newer. - - ESS is most likely to work with current/recent versions of the -following statistical packages: R/S-PLUS, SAS, Stata, OpenBUGS and JAGS. - - To build the PDF documentation, you will need a version of TeX Live -or texinfo that includes texi2dvi. - - There are two main methods used for installing ESS. You may install -from a third-party repository or from source code. Once you install it, -you must also activate or load ESS in each Emacs session, though -installation from a third-party repository likely takes care of that for -you. See *note Activating and Loading ESS:: for more details. - -1.3 Installing from a third-party repository -============================================ - -ESS is packaged by many third party repositories. Many GNU/Linux -distributions package it, usually with the name "emacs-ess" or similar. - - ESS is also available through Milkypostman’s Emacs Lisp Package -Archive (MELPA), a popular repository for Emacs packages. Instructions -on how to do so are found on MELPA's website (https://melpa.org/). -MELPA also hosts MELPA-stable with stable ESS builds. You may choose -between MELPA with the latest and greatest features (and bugs) or -MELPA-stable, which may lag a bit behind but should be more stable. - - After installing, users should make sure ESS is activated or loaded -in each Emacs session. See *note Activating and Loading ESS::. -Depending on install method, this may be taken care of automatically. - -1.4 Installing from source -========================== - -Stable versions of ESS are available at the ESS web page -(https://ess.r-project.org) as a .tgz file or .zip file. ESS releases -are GPG-signed, you should check the signature by downloading the -accompanying '.sig' file and doing: - - gpg --verify ess-18.10.tgz.sig - - Alternatively, you may download the git repository. ESS is currently -hosted on Github: . 'git clone -https://github.com/emacs-ess/ESS.git' will download it to a new -directory 'ESS' in the current working directory. - - We will refer to the location of the ESS source files as -'/path/to/ESS/' hereafter. - - After installing, users should make sure they activate or load ESS in -each Emacs session, see *note Activating and Loading ESS:: - - Optionally, compile elisp files, build the documentation, and the -autoloads: - cd /path/to/ESS/ - make - Without this step the documentation, reference card, and autoloads -will not be available. Uncompiled ESS will also run slower. - - Optionally, you may make ESS available to all users of a machine by -installing it site-wide. To do so, run '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. - -1.5 Activating and Loading ESS -============================== - -After installing ESS, you must activate or load it each Emacs session. -ESS can be autoloaded, and if you used a third-party repository (such as -your Linux distribution or MELPA) to install, you can likely skip this -section and proceed directly to *note Check Installation:: - - Otherwise, you may need to add the path to ESS to 'load-path' with: - - (add-to-list 'load-path "/path/to/ESS/lisp") - - You then need to decide whether to take advantage of deferred loading -(which will result in a faster Emacs startup time) or require ESS when -Emacs is loaded. To autoload ESS when needed (note that if installed -from source, you must have run 'make'): - - (load "ess-autoloads") - - To require ESS on startup, you can either put - - (require 'ess-site) - - or - - (require 'ess-r-mode) - - In your configuration file, depending on whether you want all ESS -features or only R related features. - -1.6 Check Installation -====================== - -Restart Emacs and check that ESS was loaded from a correct location with -'M-x ess-version'. - -1.7 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.8 Current Features -==================== - - * Languages Supported: - * S family (R, S, and S+ AKA S-PLUS) - * SAS - * BUGS/JAGS - * Stata - * Julia - * Editing source code (S family, SAS, BUGS/JAGS, Stata, Julia) - * Syntactic indentation and highlighting of source code - * Partial evaluation of code - * Loading and error-checking of code - * Source code revision maintenance - * Batch execution (SAS, BUGS/JAGS) - * Use of imenu to provide links to appropriate functions - * Interacting with the process (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.9 New Features -================ - -Bug Fixes in 18.10.2: - * ESS[R] Fix namespace evaluation in non-installed packages. - Evaluation is directed into GlobalEnv as originally intended. - * 'Makefile' fixes, notably for 'make install' and including full - docs in the tarballs. - - Bug Fixes in 18.10-1: - * New functions 'ess-eval-line-visibly-and-step' ('C-c C-n' and - 'ess-eval-region-or-line-visibly-and-step' ('C-RET') which behave - as the old versions of 'ess-eval-line-and-step' and - 'ess-eval-region-or-line-and-step'. - - Changes and New Features in 18.10: - - * This is the last release to support Emacs older than 25.1. Going - forward, only GNU Emacs 25.1 and newer will be supported. Soon - after this release, support for older Emacs versions will be - dropped from the git master branch. Note that MELPA uses the git - master branch to produce ESS snapshots, so if you are using Emacs < - 25.1 from MELPA and are unable to upgrade, you should switch to - MELPA-stable. - - * ESS now displays the language dialect in the mode-line. So, for - example, R buffers will now show ESS[R] rather than ESS[S]. - - * The ESS manual has been updated and revised. - - * The ESS initialization process has been further streamlined. If - you update the autoloads (which installation from 'package-install' - does), you should not need to '(require 'ess-site)' at all, as - autoloads should automatically load ESS when it is needed (e.g. - the first time an R buffer is opened). In order to defer loading - your ESS config, you may want to do something like - '(with-require-after-load "ess" )' in your Emacs - init file. Users of the popular 'use-package' Emacs package can - now do '(use-package ess :defer t)' to take advantage of this - behavior. *Note (ess)Activating and Loading ESS:: for more - information on this feature. - - * ESS now respects Emacs conventions for keybindings. This means - that The 'C-c [letter]' bindings have been removed. This affects - 'C-c h', which was bound to 'ess-eval-line-and-step-invisibly' in - 'sas-mode-local-map'; 'C-c f', which was bound to - 'ess-insert-function-outline' in 'ess-add-MM-keys'; and 'C-c h', - which was bound to 'ess-handy-commands' in 'Rd-mode-map', - 'ess-noweb-minor-mode-map', and 'ess-help-mode-map' - - * Functions 'ess-eval-line-and-step' and - 'ess-eval-region-or-line-and-step' now behave consistently with - other evaluation function inside a package. - - * ESS[R]: 'ess-r-package-use-dir' now works with any mode. This sets - the working directory to the root of the current package including - for example C or C++ files within '/src'). - - * ESS[R]: Long + + prompts in the inferior no longer offset output. - - * ESS[R]: New option 'strip' for 'inferior-ess-replace-long+'. This - strips the entire + + sequence. - - * ESS modes now inherit from 'prog-mode'. In the next release, ESS - modes will use 'define-derived-mode' so that each mode will have - (for example) its own hooks and keymaps. - - * ESS[R]: Supports flymake in R buffers for Emacs 26 and newer. - Users need to install the 'lintr' package to use it. Customizable - options include 'ess-use-flymake', 'ess-r-flymake-linters', and - 'ess-r-flymake-lintr-cache'. - - * ESS[R]: Gained support for xref in Emacs 25+. *Note (emacs)Xref:: - - * ESS[R]: The startup screen is cleaner. It also displays the - startup directory with an explicit 'setwd()'. - - * ESS[R]: Changing the working directory is now always reflected in - the process buffer. - - * ESS[R]: 'Makevars' files open with 'makefile-mode'. - - * New variable 'ess-write-to-dribble'. This allows users to disable - the dribble ('*ESS*') buffer if they wish. - - * All of the '*-program-name' variables have been renamed to - '*-program'. Users who previously customized e.g. - 'inferior-ess-R-program-name' will need to update their - customization to 'inferior-ess-R-program'. These variables are - treated as risky variables. - - * 'ess-smart-S-assign' was renamed to 'ess-insert-assign'. It - provides similar functionality but for any keybinding, not just - '_'. For instance if you bind it to ';', repeated invokations - cycle through between assignment and inserting ';'. - - * 'C-c C-=' is now bound to 'ess-cycle-assign' by default. See the - documentation for details. New user customization option - 'ess-assign-list' controls which assignment operators are cycled. - - * ESS[R] In remote sessions, the ESSR package is now fetched from - GitHub. - - * Commands that send the region to the inferior process now deal with - rectangular regions. See the documentation of 'ess-eval-region' - for details. This only works on Emacs 25.1 and newer. - - * ESS[R]: Improvements to interacting with iESS in non-R files. - Interaction with inferior process in non-R files within packages - (for instance C or C++ files) has been improved. This is a work in - progress. - - * ESS[R]: Changing the working directory is now always reflected in - the process buffer. - - * ESS[JAGS]: *.jog and *.jmd files no longer automatically open in - JAGS mode. - - Many improvements to fontification: - - * Improved customization for faces. ESS now provides custom faces - for (nearly) all faces used and places face customization options - into their own group. Users can customize these options using 'M-x - customize-group RET ess-faces'. - - * Many new keywords were added to 'ess-R-keywords' and - 'ess-R-modifiers'. See the documentation for details. - - * ESS[R]: 'in' is now only fontified when inside a 'for' construct. - This avoids spurious fontification, especially in the output buffer - where 'in' is a commond English word. - - * ESS: Font-lock keywords are now generated lazily. That means you - can now add or remove keywords from variables like 'ess-R-keywords' - in your Emacs configuration file after loading ESS (i.e. in the - ':config' section for 'use-package' users). - - * ESS[R]: Fontification of roxygen '@param' keywords now supports - comma-separated parameters. - - * ESS[R]: Certain keywords are only fontified if followed by a - parenthesis. Function-like keywords such as 'if ()' or 'stop()' - are no longer fontified as keyword if not followed by an opening - parenthesis. The same holds for search path modifiers like - 'library()' or 'require()'. - - * ESS[R]: Fixed fontification toggling. Especially certain syntactic - elements such as '%op%' operators and backquoted function - definitions. - - * ESS[R]: 'ess-font-lock-toggle-keyword' can be called interactively. - This command asks with completion for a font-lock group to toggle. - This functionality is equivalent to the font-lock menu. - - Notable bug fixes: - - * 'prettify-symbols-mode' no longer breaks indentation. This is - accomplished by having the pretty symbols occupy the same number of - characters as their non-pretty cousins. You may customize the new - variable 'ess-r-prettify-symbols' to control this behavior. - - * ESS: Inferior process buffers are now always displayed on startup. - Additionally, they don't hang Emacs on failures. - - Obsolete libraries, functions, and variables: - - * The 'ess-r-args.el' library has been obsoleted and will be removed - in the next release. Use 'eldoc-mode' instead, which is on by - default. - - * Functions and options dealing with the smart assign key are - obsolete. The following functions have been made obsolete and will - be removed in the next release of ESS: 'ess-smart-S-assign', - 'ess-toggle-S-assign', 'ess-toggle-S-assign-key', - 'ess-disable-smart-S-assign'. - - The variable 'ess-smart-S-assign-key' is now deprecated and will be - removed in the next release. If you would like to continue using - '_' for insterting assign in future releases, please bind - 'ess-insert-assign' in 'ess-mode-map' the normal way. - - * ESS[S]: Variable 'ess-s-versions-list' is obsolete and ignored. - Use 'ess-s-versions' instead. You may pass arguments by starting - the inferior process with the universal argument. - - 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 - -1.10 Reporting Bugs -=================== - -Please send bug reports, suggestions etc. to , -or post them on our github issue tracker -(https://github.com/emacs-ess/ESS/issues) - - The easiest way to do this is within Emacs by typing - - 'M-x ess-submit-bug-report' - - This also gives the maintainers valuable information about your -installation which may help us to identify or even fix the bug. - - If Emacs reports an error, backtraces can help us debug the problem. -Type "M-x set-variable RET debug-on-error RET t RET". Then run the -command that causes the error and you should see a *Backtrace* buffer -containing debug information; send us that buffer. - - Note that comments, suggestions, words of praise and large cash -donations are also more than welcome. - -1.11 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.12 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) - * J. Alexander Branham (mailto:alex.branham@gmail.com) - diff -Nru ess-18.10.2/RPM.spec ess-18.10.2+git20220915.f45542e/RPM.spec --- ess-18.10.2/RPM.spec 2018-11-09 08:23:59.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/RPM.spec 1970-01-01 00:00:00.000000000 +0000 @@ -1,131 +0,0 @@ -# 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 18.10.2 -%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: https://ESS.R-project.org/downloads/ess/ess-%{version}.tgz -URL: https://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-18.10.2/RPM.spec.in ess-18.10.2+git20220915.f45542e/RPM.spec.in --- ess-18.10.2/RPM.spec.in 2018-11-10 09:41:10.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/RPM.spec.in 2022-10-15 08:06:36.000000000 +0000 @@ -27,7 +27,7 @@ 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 +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 diff -Nru ess-18.10.2/rsn.txt ess-18.10.2+git20220915.f45542e/rsn.txt --- ess-18.10.2/rsn.txt 2018-11-10 09:41:11.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/rsn.txt 1970-01-01 00:00:00.000000000 +0000 @@ -1,325 +0,0 @@ - -ESS User Poll Tally - -Stat package used with ESS -R 44 -SAS 7 -JAGS 6 -Stata 5 -Splus 4 -BUGS 1 -Other 1 Sage? - -emacs used with ESS -GNU Emacs 43 -XEmacs 3 -Aquamacs 2 -Other 0 - -OS used with ESS -Linux 38 -Windows 23 -Mac OS X 9 -Solaris 3 -Other 1 Cygwin - - -Feature Requests - -Kevin Wright: - -I want to change the background color of code chunks in noweb buffers. - - -Erik Iverson: - -I think ESS is very feature complete at this point. The only thing -I've looked at that seems interesting is some sort of 'intellisense' -feature that uses R's built-in completion mechanism to temporarily -display available completions using something like company-mode, -autocomplete, or completion-ui. I had at one point something that -almost worked, but I believe the library it was built in, -company-mode, has now changed significantly. - -Another separate point is that the manual could be slightly updated to -keep up with current features. For example, the main evaluation -command in R buffers, C-c C-c, is not documented. A great feature for -showing R function arguments when the '(' key is pressed only shows up -in the Changelog, and is claimed to be on be default -(ess-r-args-electric-paren), when that no longer seems to be the case. -Simple features like this can draw users to ESS who might not know why -it is useful to them otherwise. - - -Josh Wiley: - -This may be windows centric, but it would be minorly convenient if -options("width") in R was paired with the size of the window in Emacs. - - -Brendan Halpin: - -Clearer documentation - what I know how to do I found out often by -trial and error, and the mailing list. - - -Bill Venables: - -Better default customisation of iESS - nothing that can't be fixed -with a hook, though. - - -Felix Andrews: - -ESS eval seems to be very slow: when I do C-c C-b it takes a very long -time and there is no visual indication that anything is happening (it -says "Starting evaluation..."). I know this can be avoided using -ess-eval-visibly-p but it would often be helpful to see the code -echoed as well. - - -Kjetil Halvorsen: - -A good cheatsheet to print and put on the wall. - - -Andreas Kiermeier: - -When writing code using lattice (e.g. xyplot) and I have a panel -function, then C-c C-c when pressed inside the panel function only -submits the panel function rather than the whole plotting -expression. I would love if this could be extended (same goes for -apply functions and probably others) to cover the whole expression (or -even 'paragraph') rather than just the panel function. - - -Gray Calhoun: - -I'd like to be able to direct graphical output to a buffer, have -graphics with multiple pages sent to multiple buffers, and have -multiple graphics open at a time. - - -Ista Zahn: - -Function/variable completion in script files (maybe this already is -supposed to work, but for me completion only works in interactive -sessions). - - -Gerhard Schon: - -For consulting, I need to use SPSS 18. It would be nice, to interact -with SPSS 18. - - -Derek Eder: - -Easier configuration! "font lock" and "visible execution" are 2 -features which I always have trouble turning off (on multiple -machines) because I can never remember where they are in the -configuration menus. - - -Paul Hewson: - -Object browser (e.g. open another frame listing variable names of a dataframe) - - -Deepayan Sarkar: - -Not have R output be fontified as if it were R code. - - -David Carslaw: - -The one feature I really miss is the showing of function arguments in -the R buffer. I think I saw an explanation for why this is not made -available as "the source is real" paradigm. However, showing the -function options in the R buffer in my view would be very useful and -not take anything away from the "source is real" approach. The simple -reason is it is difficult to remember what the options are! It's very -useful when writing the scripts - where it is available. RKward does -this too and it's useful. - - -Gerald Jean: - -Having function arguments show up in the mini-buffer UNTIL the -closing parenthesis is typed. By the way, in R it shows up briefly, -but not at all in Splus; would be great to have it for all "S" -variants. - - -Charles Berry: - -Handle \Sexpr{}'s in Sweave code. - -How 'about - - ess-eval-sexpr - - Tangle the current contents of \Sexpr{ } and send it to the - inferior ESS process. - - - ess-eval-sexprs-in-region - - Tangle the contents of \Sexpr{ }'s in region and send them to the - inferior ESS process. (Maybe even open a *Sexpr* buffer (say) and - place the region contents in that buffer with the \Sexpr{}'s - replaced by their printed results.) - -More than a few times, I have had Sweave terminate with an error or -deliver unreadable results because of a silly error in an \Sexpr. - - -Sven Hartenstein: - -I am sometimes annoyed by emacs "popup" windows, e.g. after expanding -some string or when a R help buffer was opened. My request would be a -simple key binding that - whatever the current window layout and -active buffers are - gives me my two pane view with the latest *.R -file as the active buffer in the upper 3/4 of the frame and the R -process the other 1/4 of the frame. - - -Francois Pepin: - -I haven't looked recently to see how hard this currently is, but I -often run R on another linux machine through ssh and screen. I would -love it if there was an easy way to connect ESS to the other R -instance more or less seamlessly. Last time I looked, the proposed -solutions seemed to be a bit clunky. - - -Patrick Connolly and Emanuel Heitlinger: - -A clever way of dealing with the unbalanced quotes (to R's way of -thinking) that can be returned to Emacs from a bash call. The ` -character screws up the font colouring. Can't imagine how it could be -done, and I realize it's really a bash issue, but I'd be very grateful -if someone could work out a way of dealing with it. I invariably see -colours as though it's all a string irrespective of function names or -anything else. - - -Brian Diggs: - -Interactive integration with SAS on Windows. I realize this is a -problem with SAS, not ESS, though. - - -Tengfei Yin: - -I would say, supporting more with Rsweave, especially some convenient key -binding. That may require more work with AUCTeX guys, I don't know. It -will be wonderful if I can just press Ctrl-C C, Rnw --> Latex->pdf viewer, -and all the error messages could show up and I don't have to open another -TeX file and click Ctrl-C C to see the output - - -Keith Ponting: - -(Vaguely related to other comments about font locking, which I second, -but probably an issue for two-mode-mode rather than for ESS) I use -Sweave a lot with emacs two-mode-mode. When in an ESS block (for which I -use \begin{Scode}...\end{Scode}) the font locking is often corrupted by -characters in the rest of the file. It appears that the two modes are -not completely isolated, so that an unbalanced $ in an ESS block will -cause the LaTeX sections to be treated as in math mode, conversely -unbalanced ' in the LaTeX sections causes the ESS sections to be treated -as strings. There is a work-around - adding the balancing symbol as a -comment in the appropriate language, but it does take a bit of finding -sometimes. - - -Jeff Arnold: - -I would like to see closer integration with CEDET -(http://cedet.sourceforge.net/); adding the ESS languages to CEDET -would open up a lot of development environment tools without -reinventing the wheel. This would require writing a grammar for the -parser for each language, but external parsers like etags/ctags can be -used to bootstrap language support. - -I also find the fact that ESS includes several unrelated languages to -be confusing. From what I have seen of the code, there doesn't appear -to much shared code between the S/R, SAS, Stata, and BUGS/JAGS parts -of ESS. I found this confusing both as a user and as a contributor, -primarily because sometimes it is not immediately clear whether an -ess-* function is generic to all the languages, or just a S/R related -function. Refactoring the ESS package into four major modes (S, SAS, -Stata, and BUGS) released by the ESS project would seem to make for a -cleaner code base. Consistency among the major modes could still be -enforced through conventions for the functions and key-bindings -included in a major mode. - - -John Maindonald: - -A GUI interface to commonly used commands, organised -structured a/c the general nature of the command. There -are a few Emacs commands that should also be noted, -in a separate category. You might want to take a poll on -which are the commands that get used, or would be used -if one could remember them: - - - - - - - - -5F - -p -n -; (with region selected) -\ and x 1 - -r -x ess-rdired -x occur << RET (lines with <<) --x ess-font-lock- - -Commands for creating & handling transcript files: -X - - -Don MacQueen: - -An option to send R output to a separate window, with the commands -that caused the output echoed before the output. - - -Ross Boylan: - -I wish that ?foo, where foo is a non-existent -command, didn't leave a *help[R](foo)* buffer lying around. -ACTUALLY, IT HAS ALREADY BEEN IMPLEMENTED: JUST CUSTOMISE -ess-help-kill-bogus-buffers TO t (thanks to Sam Steingold) -t IS NOW THE DEFAULT IN ESS 12.03 (Rodney) - -Johan Sandblom: - -Some manner of font-lock integration with AUCTeX (I use mmm-mode) -though I realize that may be more a matter for AUCTeX. - - -Rasmus Pank: - -Improvements of AUCTeX integration. Sometimes results are -weird. Compilation works poorly. It would be nice to easily specify -new compilers to use for example pgfsweave. - - -Mathieu Basille: - -Integration of Rubber as I said earlier! But I would definitely second -Rasmus request of integration with AUCTeX. As I use mostly R in Sweave -docs, I'd like to be able to use C-c C-c to compile, as I'm used to do -for LateX documents. Well, of course it would go in two passes instead -of one: 1) with Sweave, 2) with Rubber. - diff -Nru ess-18.10.2/targets/create-pkg-file.el ess-18.10.2+git20220915.f45542e/targets/create-pkg-file.el --- ess-18.10.2/targets/create-pkg-file.el 1970-01-01 00:00:00.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/targets/create-pkg-file.el 2022-10-15 08:06:36.000000000 +0000 @@ -0,0 +1,25 @@ +;;; create-pkg-file.el --- Create ess-pkg.el -*- lexical-binding: t; -*- + +;; Copyright (C) 2018-2022 Free Software Foundation, Inc. + +;;; Commentary: +;; Creates ess-pkg.el + + +(require 'package) + +;; This script is called from one directory up + +;; Copy lisp into top-level +(copy-directory "lisp" "." t t t) +(delete-directory "lisp" t nil) +;; Make documentation +(shell-command "make -C doc info/ess.info") +(dolist (file '("doc/info/ess.info" "doc/info/dir")) + (copy-file file (file-name-nondirectory file)) + (delete-file file)) +;; Generate ess-pkg.el +(find-file "ess.el") +(package-generate-description-file (package-buffer-info) "ess-pkg.el") + +;;; create-pkg-file.el ends here diff -Nru ess-18.10.2/targets/travis-install-package.el ess-18.10.2+git20220915.f45542e/targets/travis-install-package.el --- ess-18.10.2/targets/travis-install-package.el 1970-01-01 00:00:00.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/targets/travis-install-package.el 2022-10-15 08:06:36.000000000 +0000 @@ -0,0 +1,33 @@ +;;; travis-install-package.el -*- lexical-binding: t; -*- + +;; Copyright (C) 2018-2022 Free Software Foundation, Inc. + +;;; Commentary: +;; This file simulates a user installing the ess-$VERSION.tar file and +;; then loading ess. It's meant to be used for testing purposes only. + +;;; Code: + +(require 'package) +(require 'subr-x) + +(add-to-list 'package-archives (cons "melpa" "https://melpa.org/packages/") t) + +(package-initialize) + +;; Get julia-mode and install +(package-refresh-contents) +(package-install 'julia-mode) + +;; This file gets called from one directory up +(when-let ((file (directory-files default-directory t ".tar$"))) + (package-install-file (car file))) + +(require 'ess-site) + + +;;; travis-install-package.el ends here + +;; Local Variables: +;; no-byte-compile: t +;; End: diff -Nru ess-18.10.2/test/dummy-pkg/man/doc.Rd ess-18.10.2+git20220915.f45542e/test/dummy-pkg/man/doc.Rd --- ess-18.10.2/test/dummy-pkg/man/doc.Rd 1970-01-01 00:00:00.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/test/dummy-pkg/man/doc.Rd 2022-10-15 08:06:36.000000000 +0000 @@ -0,0 +1,5 @@ +\name{doc} + +\examples{ +letters +} diff -Nru ess-18.10.2/test/ess-indentation-tests.el ess-18.10.2+git20220915.f45542e/test/ess-indentation-tests.el --- ess-18.10.2/test/ess-indentation-tests.el 2018-11-10 09:41:11.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/test/ess-indentation-tests.el 1970-01-01 00:00:00.000000000 +0000 @@ -1,122 +0,0 @@ -;; ess-tests.el --- Tests for ESS -;; -;; -;; Filename: ess-tests.el -;; Created: 07-05-2015 (ESS 15.09) -;; Keywords: tests, indentation -;; -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; -;; This file is *NOT* part of GNU Emacs. -;; This file is part of ESS -;; -;; This program is free software; you can redistribute it and/or -;; modify it under the terms of the GNU General Public License as -;; published by the Free Software Foundation; either version 3, or -;; (at your option) any later version. -;; -;; This file is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. -;; -;; A copy of the GNU General Public License is available at -;; https://www.r-project.org/Licenses/ -;; -;; -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; -;;; Commentary: -;; -;; To run these tests: -;; All tests: M-x ert t -;; -;; To apply styles for manual testing: -;; M-: (let ((ess-style-alist ess-test-style-alist)) -;; (ess-set-style 'misc1)) -;; -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; -;;; Code: - -(require 'ert) -(require 'ess-r-tests-utils) - -;;; Indentation tests - -(defvar ess-test-style-alist - `((RRR - ,@(cdr (assq 'RRR ess-style-alist))) - (RRR+ - ,@(cdr (assq 'RRR+ ess-style-alist))) - (RStudio- - ,@(cdr (assq 'RStudio- ess-style-alist))) - (C++ - ,@(cdr (assq 'C++ ess-style-alist))) - (misc1 - (ess-indent-offset . 3) - (ess-offset-block . open-delim) - (ess-offset-arguments . (prev-call 5)) - (ess-offset-arguments-newline . open-delim) - (ess-offset-continued . cascade) - (ess-align-nested-calls . ("ifelse")) - (ess-align-arguments-in-calls . nil) - (ess-align-continuations-in-calls . nil) - (ess-align-blocks . (fun-decl bare-blocks)) - (ess-indent-from-lhs . nil) - (ess-indent-from-chain-start . nil) - (ess-indent-with-fancy-comments . t)))) - -(defun ess-test-get-pos-from-undo-elt (e) - "If E represents an edit, return a position value in E, the position -where the edit took place. Return nil if E represents no real change. -\nE is an entry in the buffer-undo-list." - ;; stolen from goto-chg.el - (cond - ;; ((numberp e) e) ; num==changed position - ;; ((atom e) nil) ; nil==command boundary - ((numberp (car e)) (cdr e)) ; (beg . end)==insertion - ((stringp (car e)) (abs (cdr e))) ; (string . pos)==deletion - ;; ((null (car e)) (nthcdr 4 e)) ; (nil ...)==text property change - ;; ((atom (car e)) nil) ; (t ...)==file modification time - (t nil))) ; (marker ...)==marker moved - -(defun not-change-on-indent (buffer) - "Return t if BUFFER wasn't modified on indent." - (with-current-buffer buffer - (setq buffer-undo-list nil) - (indent-region (point-min) (point-max)) - (not (buffer-modified-p buffer)))) - -(defun ess-test-explain-change-on-indent (buffer) - "Explainer function for `not-change-on-indent'." - (when (buffer-modified-p buffer) - (with-current-buffer buffer - (let ((bul buffer-undo-list) - (change-pos (point-min))) - (while (and bul - (null (setq change-pos (ess-test-get-pos-from-undo-elt (car bul))))) - (pop bul)) - (let ((diff-file (concat (buffer-name) ".diff"))) - (diff-buffer-with-file buffer) - (with-current-buffer "*Diff*" - (write-region (point-min) (point-max) diff-file)) - `(,(buffer-name buffer) was modified on line ,(count-lines 1 change-pos) - (diff was writen to ,diff-file))))))) - -(put 'not-change-on-indent 'ert-explainer 'ess-test-explain-change-on-indent) - -(ert-deftest test-ess-R-indentation-RRR () - (ess-test-R-indentation "styles/RRR.R" 'RRR)) - -(ert-deftest test-ess-R-indentation-RRR+ () - (ess-test-R-indentation "styles/RRR+.R" 'RRR+)) - -(ert-deftest test-ess-R-indentation-RStudio- () - (ess-test-R-indentation "styles/RStudio-.R" 'RStudio-)) - -(ert-deftest test-ess-R-indentation-C++ () - (ess-test-R-indentation "styles/C++.R" 'C++)) - -(ert-deftest test-ess-R-indentation-misc1 () - (ess-test-R-indentation "styles/misc1.R" 'misc1)) diff -Nru ess-18.10.2/test/ess-inf-tests.el ess-18.10.2+git20220915.f45542e/test/ess-inf-tests.el --- ess-18.10.2/test/ess-inf-tests.el 2018-11-10 09:41:11.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/test/ess-inf-tests.el 1970-01-01 00:00:00.000000000 +0000 @@ -1,194 +0,0 @@ - -(require 'ert) - -;; As we use the R inferior for the generic tests -(require 'ess-r-tests-utils) - - -;;; Startup - -(defun ess-r-tests-startup-output () - (let* ((proc (ess-vanila-R)) - (output-buffer (process-buffer proc))) - (unwind-protect - (with-current-buffer output-buffer - (buffer-string)) - (kill-process proc)))) - -(ert-deftest ess-startup-verbose-setwd-test () - (should (string-match "to quit R.\n\n> setwd(.*)$" (ess-r-tests-startup-output)))) - -(ert-deftest ess-startup-default-directory-preserved-test () - (let ((default-directory "foo") - (ess-startup-directory temporary-file-directory) - ess-ask-for-ess-directory) - (with-r-running nil - (should (string= default-directory "foo")) - (should (string= (inferior-ess-default-directory) temporary-file-directory))) - (should (string= default-directory "foo")))) - - -;;; Evaluation - -(ert-deftest ess-command-test () - (with-r-running nil - (let ((output-buffer (get-buffer-create " *ess-test-command-output*"))) - (ess-command "identity(TRUE)\n" output-buffer) - (should (string= (with-current-buffer output-buffer - (ess-kill-last-line) - (buffer-string)) - "[1] TRUE"))))) - -(ert-deftest ess-run-presend-hooks-test () - (with-r-running nil - (let ((ess-presend-filter-functions (list (lambda (string) "\"bar\"")))) - (should (output= (ess-send-string (ess-get-process) "\"foo\"") - "[1] \"bar\""))))) - -(ert-deftest ess-load-file-test () - (with-r-running nil - (should (string-match "^\\[1\\] \"foo\"\nSourced file" - (output nil (ess-load-file "fixtures/file.R")))))) - - - -;;; Inferior interaction - -(ert-deftest ess-verbose-setwd-test () - (with-r-running nil - (should (output= (ess-set-working-directory temporary-file-directory) - (format "setwd('%s')" temporary-file-directory))))) - - -;;; Sending input - -(ert-deftest ess-inf-send-input-invisible-test () - (let ((ess-eval-visibly nil)) - (should (string= "> " - (ess-send-input-to-R "\n\n"))) - (should (string= "> " - (ess-send-input-to-R "invisible(0)"))) - (should (string= "invisible(0)\n> " - (ess-send-input-to-R "invisible(0)" 'repl))))) - -(ert-deftest ess-inf-send-complex-input-test () - (let ((ess-eval-visibly nil) - (input "identity( - identity( - identity( - head(mtcars[, c('wt', 'vs')], 3)))) -'+ + + + > some-output >' -cat('+ + + + > cleaned-prompts >\n') -") - (output "> - wt vs -Mazda RX4 2.620 0 -Mazda RX4 Wag 2.875 0 -Datsun 710 2.320 1 -> -[1] \"+ + + + > some-output >\" -> -cleaned-prompts > -> ")) - (let ((inferior-ess-replace-long+ t)) - (should (string= output (ess-send-input-to-R input)))))) - -(ert-deftest ess-inf-send-fn-test () - (let ((input "fn <- function() { -} -") - (output "> ") - (output-nowait "> fn <- function() { -+ } -> ")) - (let ((inferior-ess-replace-long+ t)) - (let ((ess-eval-visibly nil)) - (should (string= output - (ess-send-input-to-R input 'c-c)))) - ;;; this fails randomly in batch - ;; (let ((ess-eval-visibly 'nowait)) - ;; (should (string= output-nowait - ;; (ess-send-input-to-R input 'c-c)))) - ))) - -(ert-deftest ess-inf-send-cat-some.text-test () - (let ((input "cat(\"some. text\\n\") -head(cars, 2) -") - (output " -some. text -> - speed dist -1 4 2 -2 4 10 -> ") - (output-nowait "cat(\"some. text\\n\") -+ head(cars, 2) -some. text -> - speed dist -1 4 2 -2 4 10 -> ")) - (let ((inferior-ess-replace-long+ t)) - (let ((ess-eval-visibly nil)) - (should (string= output - (ess-send-input-to-R input 'c-c)))) - ;; these test fails randomly in batch - ;; (let ((ess-eval-visibly 'nowait)) - ;; (should (string= output-nowait - ;; (ess-send-input-to-R input 'c-c)))) - ))) - - -;;; Inferior utils - -(ert-deftest ess-build-eval-command-test () - (should (not (ess-build-eval-command "command()"))) - (let ((ess-eval-command "%s - %f")) - (should (string= (ess-build-eval-command "command(\"string\")" nil nil "file") - "command(\\\"string\\\") - file")))) - -(ert-deftest ess-build-load-command-test () - (should (string= (ess-build-load-command "file") - "source('file')\n"))) - -;; Test runners - -;; Note that we add R-3.2.1 to continuous integration via a symlink to -;; the actual R binary. These tests will likely fail locally for you -;; unless you have R-3.2.1 somewhere on `exec-path' when ESS was first -;; loaded. They're skipped unless you've defined the environment -;; variable CONTINUOUS_INTEGRATION or R-3.2.1 is found by -;; `executable-find'. -(when (> emacs-major-version 24) ; ERT lacks `skip-unless' in Emacs 24 - (ert-deftest runner-R-3.2.1-defined () - (skip-unless (or (executable-find "R-3.2.1") - (getenv "CONTINUOUS_INTEGRATION"))) - (should (fboundp 'R-3.2.1))) - - (ert-deftest runner-R-3.2.1-buffer-name () - (skip-unless (or (executable-find "R-3.2.1") - (getenv "CONTINUOUS_INTEGRATION"))) - (should - (string= "*R-3.2.1*" - (let ((ess-use-inferior-program-in-buffer-name t) - (ess-gen-proc-buffer-name-function #'ess-gen-proc-buffer-name:simple) - (ess-ask-for-ess-directory nil) - (name)) - (R-3.2.1) - (setq name (buffer-name)) - (set-process-query-on-exit-flag (get-buffer-process (current-buffer)) nil) - (kill-buffer name) - name))) - (should - (string= "*R-3.2.1*" - (let ((ess-use-inferior-program-name-in-buffer-name t) - (ess-gen-proc-buffer-name-function #'ess-gen-proc-buffer-name:simple) - (ess-ask-for-ess-directory nil) - (name)) - (R-3.2.1) - (setq name (buffer-name)) - (set-process-query-on-exit-flag (get-buffer-process (current-buffer)) nil) - (kill-buffer name) - name))))) diff -Nru ess-18.10.2/test/ess-literate-tests.el ess-18.10.2+git20220915.f45542e/test/ess-literate-tests.el --- ess-18.10.2/test/ess-literate-tests.el 2018-11-10 09:41:11.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/test/ess-literate-tests.el 1970-01-01 00:00:00.000000000 +0000 @@ -1,307 +0,0 @@ - -(eval-when-compile - (require 'cl-lib)) -(require 'ert) - -(defmacro elt-deftest (name args file) - `(ert-deftest ,name ,args - (let ((inhibit-message ess-inhibit-message-in-tests) - (path (expand-file-name ,file "literate"))) - (elt-do 'test path)))) - -(defun elt--activate-font-lock-keywords () - "Activate font-lock keywords for some of ELT's symbols." - (font-lock-add-keywords - nil - '(("(\\(\\\\s *\\(\\(?:\\sw\\|\\s_\\)+\\)?" - (1 font-lock-keyword-face nil t) - (2 font-lock-function-name-face nil t))))) -(add-hook 'emacs-lisp-mode-hook #'elt--activate-font-lock-keywords) - -(defvar elt-ess-r-chunk-pattern "^###[ \t]*\\([0-9]+[a-zA-Z]*\\) \\([^\n]*\\)$") -(defvar elt-ess-r-code-start-pattern "^##!") -(defvar elt-ess-r-code-cont-pattern "^##>") -(defvar elt-ess-r-code-pattern "^##[!>]") -(defvar elt-ess-r-section-pattern "^##### \\([^\n]*\\)$") -(defvar elt-ess-r-mode-init '((mode . R))) - -(defun elt-do (action file) - (unless (memq action '(test regenerate)) - (error "Invalid literate test action")) - (let ((verb (if (eq action 'test) - "Testing" - "Regenerating"))) - (message "---%s %s" verb (file-name-nondirectory file))) - (let* ((src-buffer (if (file-exists-p file) - (find-file-noselect file) - (error "Can't find literate test file"))) - (src-string (with-current-buffer src-buffer - (buffer-string))) - (output (elt-buffer-string file src-string))) - (pcase action - (`test (should (string= src-string output))) - (`regenerate (with-current-buffer src-buffer - (erase-buffer) - (insert output) - (save-buffer)))))) - -(defun elt-buffer-string (file src-string) - (let ((el-file (concat (file-name-sans-extension file) ".el"))) - (when (file-exists-p el-file) - (load-file el-file))) - (with-temp-buffer - (insert src-string) - ;; Don't check safety of local variables declared in test files - (cl-letf (((symbol-function 'safe-local-variable-p) (lambda (sym val) t))) - (let ((enable-dir-local-variables nil)) - (hack-local-variables))) - (let ((elt-chunk-pattern elt-ess-r-chunk-pattern) - (elt-code-cont-pattern elt-ess-r-code-cont-pattern) - (elt-code-pattern elt-ess-r-code-pattern) - (elt-section-pattern elt-ess-r-section-pattern) - (elt-mode-init (append (assq-delete-all 'mode file-local-variables-alist) - elt-ess-r-mode-init))) - (elt-this-buffer) - (buffer-string)))) - -(defun elt-this-buffer () - (goto-char 1) - (let ((undo-inhibit-record-point t)) - (undo-boundary) - ;; Print first section header - (elt-print-section-header) - (when (elt-search-chunk nil t) - (while (looking-at elt-chunk-pattern) - (elt-print-chunk-id) - (elt-process-next-chunk))) - (skip-chars-backward "\n") - (let ((point-max (or (elt-local-variables-pos) - (point-max)))) - (delete-region (1+ (point)) point-max) - (insert "\n")) - (when (looking-at (concat "\n" comment-start "+ +Local Variables:")) - (insert "\n")) - (undo-boundary))) - -(defun elt-local-variables-pos () - (save-excursion - (let ((pattern (concat "^" comment-start "+ +Local Variables:"))) - (when (re-search-forward pattern nil t) - (match-beginning 0))))) - -(defun elt-print-section-header () - (save-excursion - (skip-chars-forward " \n\t") - (when (looking-at elt-section-pattern) - (message (match-string-no-properties 1))))) - -(defun elt-print-chunk-id () - (let ((number (concat "#" (match-string-no-properties 1))) - (msg (match-string-no-properties 2))) - (setq msg (substring msg 0 (string-match "-+$" msg))) - (message (if (> (length msg) 0) - (concat number " - " msg) - number)))) - -(defun elt-search-chunk (&optional n skip-section) - (let* ((next-chunk (save-excursion - (cond ((re-search-forward elt-chunk-pattern - nil t (or n 1)) - (match-beginning 0)) - ((elt-local-variables-pos)) - (t - (point-max))))) - (next-section (save-excursion - (when (re-search-forward elt-section-pattern - next-chunk t) - (match-beginning 0))))) - (goto-char (if (and (not skip-section) next-section) - next-section - next-chunk)))) - -(defun elt-process-next-chunk () - (let* ((chunk-beg (point)) - (chunk-end (progn - (forward-line) - (save-excursion - (elt-search-chunk) - (point-marker)))) - (orig-chunk (buffer-substring chunk-beg chunk-end))) - (condition-case cnd - (let* ((test-case (progn - (skip-chars-forward " \t\n") - (elt-process-case))) - (test-case-state test-case)) - (while (looking-at elt-code-pattern) - (elt-process-next-subchunk chunk-end)) - (insert "\n") - (elt-print-section-header) - (when (looking-at elt-section-pattern) - (insert "\n") - (elt-search-chunk nil t))) - (ert-test-skipped - (message (concat " Skipping test: " (cadr cnd))) - (goto-char chunk-beg) - (delete-region chunk-beg chunk-end) - (insert orig-chunk) - nil)))) - -(defun elt-process-next-subchunk (chunk-end) - (let* ((continuation (looking-at elt-code-cont-pattern)) - (test-code (elt-process-code)) - (test-result (elt-run- (if continuation test-case-state test-case) - test-code elt-mode-init - continuation)) - (subchunk-end (save-excursion - (if (re-search-forward elt-code-pattern chunk-end t) - (match-beginning 0) - chunk-end)))) - (setq test-case-state test-result) - (delete-region (point) subchunk-end) - (insert (concat "\n" test-result "\n\n")))) - -(defun elt-process-case () - (let ((case-start (progn - (skip-chars-forward " \t\n") - (goto-char (line-beginning-position)) - (point))) - (code-start (if (re-search-forward elt-code-pattern chunk-end t) - (goto-char (match-beginning 0)) - (error "No test code found"))) - (case-end (progn - (skip-chars-backward " \t\n") - (point)))) - (forward-char 1) - (delete-region (point) code-start) - (insert "\n") - (buffer-substring-no-properties case-start case-end))) - -(defun elt-process-code () - (let* ((test-start (point)) - (test-end (if (re-search-forward "^$" chunk-end t) - (1- (match-beginning 0)) - (goto-char chunk-end))) - (test-code (buffer-substring-no-properties test-start test-end))) - ;; Remove comment prefix - (while (string-match (concat (substring elt-code-pattern 1) "[ \t]?") - test-code) - (setq test-code (replace-match "" t t test-code))) - ;; Parse elisp - (setq test-code (concat "(" test-code ")")) - (car (read-from-string test-code)))) - - -;; The following functions are borrowed from Lispy's testing -;; framework. The main difference is that they restore state when -;; `keep-state' is t. They also run `(kbd)' on strings. - -(defvar elt--state-buffer nil - "Evaluation buffer of previous test chunk.") - -(defmacro elt-run (init &rest body) - (apply 'elt-run- `(,init (,@body)))) - -(defun elt-run- (init body local-variables &optional keep-state) - (unless keep-state - (and elt--state-buffer - (buffer-name elt--state-buffer) - (kill-buffer elt--state-buffer)) - (setq elt--state-buffer (generate-new-buffer " *temp*"))) - (save-window-excursion - (switch-to-buffer elt--state-buffer) - (if keep-state - (delete-region (point-min) (point-max)) - (transient-mark-mode 1) - (setq-local file-local-variables-alist (copy-alist local-variables)) - (hack-local-variables-apply)) - (insert init) - (goto-char (point-min)) - (when (search-forward "×" nil t) - (backward-delete-char 1) - (set-mark (point)) - (when (search-forward "×" nil t) - (error "There can only be one mark cursor"))) - (goto-char (point-max)) - (let (cursors-start - cursors-end) - (while (search-backward "¶" nil t) - (delete-char 1) - (let ((marker (point-marker))) - (set-marker-insertion-type marker t) - (push marker cursors-start))) - (unless cursors-start - (error "There must be at least one point cursor")) - ;; Fontification must take place after removing "¶" - ;; FIXME Emacs 25: Use `font-lock-ensure' - (font-lock-default-fontify-buffer) - (dolist (cursor cursors-start) - (goto-char cursor) - ;; Reset Emacs state - (unless keep-state - (setq last-command nil) - (setq current-prefix-arg nil)) - (mapcar (lambda (x) - (cond ((equal x '(kbd "C-u")) - (setq current-prefix-arg (list 4))) - ((stringp x) - (if (string= x "C-u") - (setq current-prefix-arg (list 4)) - (elt-unalias (kbd x)))) - ((and (listp x) - (eq (car x) 'kbd)) - (elt-unalias x)) - (t (eval x)))) - body) - (let ((marker (point-marker))) - (set-marker-insertion-type marker t) - (push marker cursors-end))) - (dolist (cursor cursors-end) - (goto-char cursor) - (insert "¶"))) - (when (region-active-p) - (exchange-point-and-mark) - (insert "×")) - (buffer-substring-no-properties - (point-min) - (point-max)))) - -(defun elt-decode-keysequence (str) - "Decode STR from e.g. \"23ab5c\" to '(23 \"a\" \"b\" 5 \"c\")" - (let ((table (copy-sequence (syntax-table)))) - (cl-loop for i from ?0 to ?9 do - (modify-syntax-entry i "." table)) - (cl-loop for i from ? to ? do - (modify-syntax-entry i "w" table)) - (cl-loop for i in '(? ?\( ?\) ?\[ ?\] ?{ ?} ?\" ?\' ?\ ) - do (modify-syntax-entry i "w" table)) - (cl-mapcan (lambda (x) - (let ((y (ignore-errors (read x)))) - (if (numberp y) - (list y) - (mapcar #'string x)))) - (with-syntax-table table - (split-string str "\\b" t))))) - -(defun elt-unalias (seq) - "Emulate pressing keys decoded from SEQ." - (if (vectorp seq) - (elt--unalias-key seq) - (let ((lkeys (elt-decode-keysequence seq)) - key) - (while (setq key (pop lkeys)) - (if (numberp key) - (let ((current-prefix-arg (list key))) - (when lkeys - (elt--unalias-key (pop lkeys)))) - (elt--unalias-key key)))))) - -(defun elt--unalias-key (key) - "Call command that corresponds to KEY. -Insert KEY if there's no command." - (setq last-input-event (aref key 0)) - (let ((cmd (key-binding key))) - (if (eq cmd 'self-insert-command) - (insert key) - (setq last-command-event (aref key 0)) - (call-interactively cmd) - (setq last-command cmd)))) diff -Nru ess-18.10.2/test/ess-org-tests.el ess-18.10.2+git20220915.f45542e/test/ess-org-tests.el --- ess-18.10.2/test/ess-org-tests.el 2018-11-10 09:41:11.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/test/ess-org-tests.el 1970-01-01 00:00:00.000000000 +0000 @@ -1,44 +0,0 @@ -;; ess-org-test.el --- Test for org-babel integration -*- lexical-binding: t -*- - -(require 'ert) -(require 'ess-r-tests-utils) -(require 'ob-R) - -(defun test-org-R-ouput (expect input) - (declare (indent 1)) - (let ((proc (ess-vanila-R)) - (org-confirm-babel-evaluate nil) - (ess-ask-for-ess-directory nil) - (inhibit-message ess-inhibit-message-in-tests)) - (unwind-protect - (with-current-buffer (get-buffer-create "*ess-org-test*") - (erase-buffer) - (insert input) - (org-mode) - (goto-char (point-min)) - (forward-line 1) - (org-ctrl-c-ctrl-c) - (goto-char (point-max)) - (should (re-search-backward expect nil t))) - (kill-process proc)))) - -(ert-deftest test-org-ob-R-output () - (test-org-R-ouput "hello" - "#+BEGIN_SRC R :results output\n \"hello\"\n#+END_SRC")) - -(ert-deftest test-org-ob-R-session-output () - (test-org-R-ouput "hello" - "#+BEGIN_SRC R :session :results output\n \"hello\"\n#+END_SRC")) - -(ert-deftest test-org-ob-R-value () - (test-org-R-ouput "hello" - "#+BEGIN_SRC R :results value\n \"hello\"\n#+END_SRC")) - -(ert-deftest test-org-ob-R-session-value () - (test-org-R-ouput "hello" - "#+BEGIN_SRC R :session :results value\n \"hello\"\n#+END_SRC")) - -(ert-deftest test-org-ob-R-data-frame () - (test-org-R-ouput "| 3 | c |" - "#+BEGIN_SRC R :session :results value :colnames yes\n data.frame(x=1:3, y=c(\"a\",\"b\",\"c\"))\n#+END_SRC")) - diff -Nru ess-18.10.2/test/ess-r-tests.el ess-18.10.2+git20220915.f45542e/test/ess-r-tests.el --- ess-18.10.2/test/ess-r-tests.el 2018-11-10 09:41:11.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/test/ess-r-tests.el 1970-01-01 00:00:00.000000000 +0000 @@ -1,272 +0,0 @@ - -(require 'ert) -(require 'ess-site) -(require 'ess-r-tests-utils) - -;;; R - -(ert-deftest ess-r-inherits-prog-mode () - (let ((prog-mode-hook (lambda () (setq ess-test-prog-hook t)))) - (with-r-file nil - (should (derived-mode-p 'prog-mode)) - (should ess-test-prog-hook) - (should - ;; Test that prog-mode-map is a keymap-parent - (let ((map (current-local-map)) - found) - (while (and map (not found)) - (if (eq (keymap-parent map) prog-mode-map) - (setq found t) - (setq map (keymap-parent map)))) - found))))) - -(ert-deftest ess-build-eval-command:R () - (let ((command "command(\"string\")")) - (should (string= (ess-build-eval-command:R command) - ".ess.eval(\"command(\"string\")\", visibly = FALSE, output = FALSE)\n")) - (should (string= (ess-build-eval-command:R command nil t) - ".ess.eval(\"command(\"string\")\", visibly = FALSE, output = TRUE)\n")) - (should (string= (ess-build-eval-command:R command t t "file.ext" "foo") - ".ess.ns_eval(\"command(\"string\")\", visibly = TRUE, output = TRUE, package = 'foo', verbose = TRUE, file = 'file.ext')\n")) - (with-r-file nil - (let ((command "command(\"string\")")) - (should (string= (ess-build-eval-command command) - (ess-build-eval-command:R (ess-quote-special-chars command)))))))) - -(ert-deftest ess-build-load-command:R () - (should (string= (ess-build-load-command:R "file.ext") - ".ess.source('file.ext', visibly = FALSE, output = FALSE)\n")) - (should (string= (ess-build-load-command:R "file.ext" t t) - ".ess.source('file.ext', visibly = TRUE, output = TRUE)\n")) - (should (string= (ess-build-load-command:R "file.ext" nil t "foo") - ".ess.ns_source('file.ext', visibly = FALSE, output = TRUE, package = 'foo', verbose = TRUE)\n")) - (with-r-file nil - (should (string= (ess-build-load-command "file") - (ess-build-load-command:R "file"))))) - -(ert-deftest ess-r-send-single-quoted-strings () - (with-r-running nil - (insert "'hop'\n") - (let (ess-eval-visibly) - (should (output= (ess-eval-buffer nil) - "[1] \"hop\""))))) - -(ert-deftest ess-r-send-double-quoted-strings () - (with-r-running nil - (insert "\"hop\"\n") - (let (ess-eval-visibly) - (should (output= (ess-eval-buffer nil) - "[1] \"hop\""))))) - -(when (> emacs-major-version 24) - ;; Skip before Emacs 25 when rectangle-mark-mode was improved. We - ;; have to wrap the whole thing in that when statement because ert's - ;; skip-unless was only introduced in Emacs 24.4 and we're testing - ;; all the way back to Emacs 24.3 still, ugh. - (ert-deftest ess-r-eval-rectangle-mark-mode () - (with-r-running nil - (insert "x <- 1\nx\nx + 1\nx + 2\n") - (let (ess-eval-visibly) - (should (output= (progn - (goto-char (point-min)) - (transient-mark-mode) - (rectangle-mark-mode) - (forward-line 3) - (end-of-line) - (ess-eval-region-or-line-and-step)) - "> [1] 1\n> [1] 2\n> [1] 3")))))) - -(ert-deftest ess-set-working-directory () - (with-r-running nil - (ess-set-working-directory "/") - (ess-eval-linewise "getwd()" 'invisible) - (should (output= (ess-eval-buffer nil) - "setwd('/')\n> [1] \"/\"")) - (should (string= default-directory "/")))) - -(ert-deftest ess-inferior-force () - (with-r-running nil - (should (equal (ess-get-words-from-vector "letters[1:2]\n") - (list "a" "b"))))) - - -;;; ess-r-package-mode - -(ert-deftest ess-r-package-auto-activation () - (let ((inhibit-message ess-inhibit-message-in-tests)) - (with-temp-buffer - (text-mode) - (hack-local-variables) - (should (not ess-r-package-mode))) - (with-r-file "dummy-pkg/R/test.R" - (hack-local-variables) - (should ess-r-package-mode)))) - -(ert-deftest ess-r-package-auto-activation-in-shell () - (let ((kill-buffer-query-functions nil)) - (with-r-file "dummy-pkg/R/test.R" - (shell) - (should ess-r-package-mode) - (kill-buffer)) - (with-r-file "dummy-pkg/R/test.R" - (let ((ess-r-package-auto-activate t)) - (shell) - (should ess-r-package-mode)) - (kill-buffer)))) - -(ert-deftest ess-r-package-auto-no-activation-in-shell () - (let ((kill-buffer-query-functions nil)) - (with-r-file "dummy-pkg/R/test.R" - (let ((ess-r-package-exclude-modes '(shell-mode))) - (shell) - (should (not ess-r-package-mode)) - (kill-buffer))) - (with-r-file "dummy-pkg/R/test.R" - (let ((ess-r-package-auto-activate nil)) - (shell) - (should (not ess-r-package-mode)) - (kill-buffer))))) - -(ert-deftest ess-r-package-vars () - (with-c-file "dummy-pkg/src/test.c" - (let ((r-setwd-cmd (cdr (assq 'ess-setwd-command ess-r-customize-alist))) - (r-getwd-cmd (cdr (assq 'ess-getwd-command ess-r-customize-alist)))) - (should (string= ess-setwd-command r-setwd-cmd)) - (should (string= ess-getwd-command r-getwd-cmd))) - (let ((pkg-dir (file-truename (cdr (ess-r-package-project)))) - ;; Not sure why this is needed: - ess-ask-for-ess-directory) - (ess-set-working-directory (expand-file-name "src" pkg-dir)) - (ess-r-package-use-dir) - (should (string= pkg-dir (file-truename (directory-file-name default-directory)))) - (ess-wait-for-process) - (should (string= pkg-dir (file-truename (ess-get-working-directory)))) - (ess-wait-for-process) - (let ((proc-buffer (ess-get-process-buffer))) - (inferior-ess-reload) - (should (string-match "Process R\\(:.\\)? \\(finished\\|killed\\)" - (with-current-buffer proc-buffer - (buffer-string)))))))) - - -;;; Namespaced evaluation - -(ert-deftest ess-r-run-presend-hooks () - (with-r-running nil - (let ((ess-presend-filter-functions (list (lambda (string) "\"bar\""))) - (ess-r-evaluation-env "base") - ess-eval-visibly) - (insert "\"foo\"\n") - (should (output= (ess-eval-region (point-min) (point-max) nil) - "[1] \"bar\""))))) - -(ert-deftest ess-r-namespaced-eval-no-sourced-message () - (with-r-running nil - (let ((ess-r-evaluation-env "base") - ess-eval-visibly) - (insert "\"foo\"\n") - (should (output= (ess-eval-region (point-min) (point-max) nil) - "[1] \"foo\""))))) - -(ert-deftest ess-r-namespaced-eval-no-srcref-in-errors () - ;; Fails since https://github.com/emacs-ess/ESS/commit/3a7d913 - (when nil - (with-r-running nil - (let ((ess-r-evaluation-env "base") - (error-msg "Error: unexpected symbol") - ess-eval-visibly) - (insert "(foo bar)\n") - (let ((output (output (ess-eval-region (point-min) (point-max) nil)))) - (should (string= (substring output 0 (length error-msg)) - error-msg))))))) - - -;;; Misc - -(ert-deftest ess-r-makevars-mode () - (save-window-excursion - (mapc (lambda (file) - (switch-to-buffer (find-file-noselect file)) - (should (eq major-mode 'makefile-mode))) - '("fixtures/Makevars" "fixtures/Makevars.win")))) - -(ert-deftest ess-find-newest-date () - (should (equal (ess-find-newest-date '(("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"))) - "R-dev"))) - -(ert-deftest ess-insert-S-assign () - ;; one call should insert assignment: - (should - (string= " <- " - (ess-r-test-with-temp-text "" - (progn - (setq last-input-event ?_) - (call-interactively 'ess-insert-S-assign) - (buffer-substring (point-min) (point-max))))))) - -(ert-deftest ess-Rout-file () - (let ((buf (find-file-noselect "fixtures/file.Rout"))) - (with-current-buffer buf - (should (eq major-mode 'ess-transcript-mode)) - (font-lock-default-fontify-buffer) - (should (eq (face-at-point) 'font-lock-function-name-face))))) - -(ert-deftest inferior-ess-r-fontification () - (with-r-running nil - (with-ess-process-buffer nil - ;; Function-like keywords - (should (eq major-mode 'inferior-ess-mode)) - (insert-fontified "for") - (should (not (face-at -1))) - (insert-fontified "(") - (should (eq (face-at -2) 'ess-keyword-face)) - ;; `in` keyword - (insert-fontified "foo in bar)") - (search-backward "in") - (should (eq (face-at-point) 'ess-keyword-face)) - (erase-buffer) - (insert-fontified "for foo in bar") - (search-backward "in") - (should (not (face-at-point)))))) - -;; roxy - -;; Emacs 24 doesn't have ERT's skip-unless -(when (> emacs-major-version 24) - (ert-deftest ess-roxy-preview-Rd () - ;; (skip-unless (member "roxygen2" (ess-r-installed-packages))) - (with-r-running nil - (should (member "roxygen2" (ess-r-installed-packages))) - (should - (string= "% Generated by roxygen2: do not edit by hand -\\name{add} -\\alias{add} -\\title{Add together two numbers. -add(10, 1)} -\\usage{ -add(x, y) -} -\\description{ -Add together two numbers. add(10, 1) -} -" - (with-temp-buffer - (R-mode) - (insert - "##' Add together two numbers. -##' add(10, 1) -add <- function(x, y) { - x + y -}") - (goto-char (point-min)) - (ess-roxy-preview-Rd) - ;; Delete the reference to the file which isn't - ;; reproducible across different test environments - (goto-char (point-min)) - (forward-line 1) - (kill-whole-line) - (buffer-substring-no-properties (point-min) (point-max)))))))) diff -Nru ess-18.10.2/test/ess-r-tests-utils.el ess-18.10.2+git20220915.f45542e/test/ess-r-tests-utils.el --- ess-18.10.2/test/ess-r-tests-utils.el 2018-11-10 09:41:11.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/test/ess-r-tests-utils.el 1970-01-01 00:00:00.000000000 +0000 @@ -1,209 +0,0 @@ -;; ess-r-tests-utils.el --- Various utilities for ess R tests - -(defvar ess-inhibit-message-in-tests nil) - -(defmacro with-r-file (file &rest body) - (declare (indent 1) (debug (&rest body))) - `(apply #'with-r-file- (list ,file '(,@body)))) - -(defun with-r-file- (file body) - (let ((inhibit-message ess-inhibit-message-in-tests) - (r-file-buffer (if file - (find-file-noselect file) - (generate-new-buffer " *with-r-file-temp*")))) - (save-window-excursion - (switch-to-buffer r-file-buffer) - (R-mode) - (mapcar #'eval body)))) - -(defmacro with-c-file (file &rest body) - (declare (indent 1) (debug (&rest body))) - `(apply #'with-c-file- (list ,file '(,@body)))) - -(defun with-c-file- (file body) - (let ((inhibit-message ess-inhibit-message-in-tests) - (c-file-buffer (if file - (find-file-noselect file) - (generate-new-buffer " *with-c-file-temp*")))) - (save-window-excursion - (switch-to-buffer c-file-buffer) - (c-mode) - (mapcar #'eval body)))) - -;; Borrowed from org -(defmacro ess-r-test-with-temp-text (text &rest body) - "Run body in a temporary buffer with `R-mode' as the active -mode holding TEXT. If the string \"¶\" appears in TEXT -then remove it and place the point there before running BODY, -otherwise place the point at the beginning of the inserted text." - (declare (indent 1)) - `(let ((inside-text (if (stringp ,text) ,text (eval ,text))) - (org-mode-hook nil)) - (with-temp-buffer - (R-mode) - (let ((point (string-match "¶" inside-text))) - (if point - (progn - (insert (replace-match "" nil nil inside-text)) - (goto-char (1+ (match-beginning 0)))) - (insert inside-text) - (goto-char (point-min)))) - ,@body))) -(def-edebug-spec org-test-with-temp-text (form body)) - -(defun ess-vanila-R () - "Start vanila R process and return the process object." - (save-window-excursion - (let ((inhibit-message ess-inhibit-message-in-tests) - (ess-ask-for-ess-directory nil)) - (R "--vanilla")) - (ess-get-process))) - -(defun ess-send-input-to-R (input &optional type) - "Eval INPUT and return the entire content of the REPL buffer. -TYPE can be one of 'string, 'region 'c-c or 'repl. If nil or -'string, use `ess-send-string' (lowest level primitive); if -'region use `ess-eval-region' if 'c-c use -`ess-eval-region-or-function-or-paragraph' which is by default -bound to C-c C-c; if 'repl, eval interactively at the REPL. All -prompts in the output are replaced with '> '. There is no full -proof way to test for prompts given that process output could be -split arbitrary." - (let ((prompt-regexp "^\\([+.>] \\)\\{2,\\}") - (proc (ess-vanila-R)) - (inhibit-message ess-inhibit-message-in-tests)) - ;; just in case - (ess-wait-for-process proc) - (ess--flush-accumulated-output proc) - (unwind-protect - (with-current-buffer (process-buffer proc) - (let ((inhibit-read-only t)) - (erase-buffer) - ;; (switch-to-buffer (current-buffer)) ; for debugging - (cond - ((or (null type) (eq type 'string)) - (ess-send-string proc input)) - ((eq type 'repl) - (insert input) - (inferior-ess-send-input)) - ((or (eq type 'region) - (eq type 'c-c)) - (with-temp-buffer - (insert input) - (goto-char (point-min)) - (R-mode) - (setq ess-current-process-name (process-name proc)) - (if (eq type 'region) - (ess-eval-region (point-min) (point-max) nil) - (ess-eval-region-or-function-or-paragraph nil)))) - (t (error "Invalid TYPE parameter"))) - (process-send-string proc "cat('END')\n") - ;; wait till we have our end marker - (while (not (looking-back "\n?END> " nil t)) - (sleep-for 0.01) - (goto-char (point-max))) - ;; remove END> - (delete-region (match-beginning 0) (match-end 0)) - ;; (buffer-substring-no-properties (point-min) (point-max)) - (replace-regexp-in-string - prompt-regexp "> " - (buffer-substring-no-properties (point-min) (point-max)))) - ) - (kill-process proc) - ;; fixme: kill in sentinel; this doesn't work in batch mode - ;; (kill-buffer (process-buffer proc)) - ))) - - -(defun ess-test-R-indentation (file style) - (let ((ess-style-alist ess-test-style-alist) - (buff (find-file-noselect file t t)) - (inhibit-message ess-inhibit-message-in-tests)) - (with-current-buffer buff - (R-mode) - (ess-set-style style) - (set-buffer-modified-p nil) - (should (not-change-on-indent buff))))) - -;; !!! NB: proc functionality from now on uses inferior-ess-ordinary-filter and -;; !!! *proc* dynamic var -(defmacro with-r-running (buffer-or-file &rest body) - "Run BODY within BUFFER-OR-FILE with attached R process. -If BUFFER-OR-FILE is a file, the file is visited first. The R -process is run with `inferior-ess-ordinary-filter' which is not -representative to the common interactive use with tracebug on." - (declare (indent 1) (debug (form body))) - `(let* ((inhibit-message ess-inhibit-message-in-tests) - (buffer-or-file ,buffer-or-file) - (r-file-buffer (cond ((bufferp buffer-or-file) - buffer-or-file) - ((stringp buffer-or-file) - (find-file-noselect buffer-or-file)) - (t - (generate-new-buffer " *with-r-file-temp*"))))) - (save-window-excursion - (switch-to-buffer r-file-buffer) - (R-mode) - (let* ((*proc* (ess-vanila-R)) - (ess-local-process-name (process-name *proc*)) - (output-buffer (process-buffer *proc*))) - (unwind-protect - (progn - (setq ess-r-tests-current-output-buffer (process-buffer *proc*)) - (let ((inhibit-read-only t)) - (with-current-buffer ess-r-tests-current-output-buffer - (erase-buffer))) - (set-process-filter *proc* 'inferior-ess-ordinary-filter) - (prog1 (progn ,@body) - (ess-wait-for-process *proc*))) - (kill-process *proc*) - (setq ess-r-tests-current-output-buffer nil)))))) - -(defvar ess-r-tests-current-output-buffer nil) - -;; The following retrieve the last output and clean the output -;; buffer. This is useful to continue testing without restarting a -;; fresh R session. - -;; In case of other side effects than mere output, it's probably safer -;; to perform ulterior tests with a fresh R to avoid contaminating -;; them. - -(defmacro output (&rest body) - (declare (indent 1) (debug (&rest body))) - `(progn - (ess-wait-for-process *proc*) - ,@body - (ess-wait-for-process *proc*) - (with-current-buffer ess-r-tests-current-output-buffer - (ess-kill-last-line) - (prog1 (buffer-substring-no-properties (point-min) (point-max)) - (erase-buffer))))) - -(defmacro output= (body expected) - (declare (indent 0) (debug (sexp sexp))) - `(progn - (let ((output (output ,body)) - (expected (eval ,expected))) - (if (string= output expected) - output - ;; Probably a better way but this gets the job done - (signal 'ert-test-failed (list (concat "Expected: \n" expected) - (concat "Result: \n" output))))))) - -(defun face-at-point () - (get-char-property (point) 'face)) - -(defun face-at (point) - (save-excursion - (if (>= point 0) - (goto-char point) - (forward-char point)) - (get-char-property (point) 'face))) - -(defun insert-fontified (&rest args) - (apply #'insert args) - (font-lock-default-fontify-buffer)) - - -(provide 'ess-r-tests-utils) diff -Nru ess-18.10.2/test/ess-test.el ess-18.10.2+git20220915.f45542e/test/ess-test.el --- ess-18.10.2/test/ess-test.el 1970-01-01 00:00:00.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/test/ess-test.el 2022-10-15 08:06:36.000000000 +0000 @@ -0,0 +1,60 @@ +;;; ess-test.el --- ESS tests -*- lexical-binding: t; -*- +;; +;; 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 +;; https://www.r-project.org/Licenses/ +;; +;;; Commentary: +;; ESS tests + +(require 'ert) +(require 'ess-site) + +;;; Code: + +(unless (fboundp 'provided-mode-derived-p) + ;; From dev Emacs + (defun provided-mode-derived-p (mode &rest modes) + (while (and (not (memq mode modes)) + (setq mode (get mode 'derived-mode-parent)))) + mode)) + +(ert-deftest ess-mode-inherits-prog-mode () + (should (unless nil (provided-mode-derived-p 'ess-mode 'prog-mode)))) + +;; Ensure that major modes can be invoked without errors: + +(ert-deftest R-mode () + (should (string= 'ess-r-mode (with-temp-buffer (R-mode) major-mode)))) + +(ert-deftest ess-jags-mode () + (should (string= 'ess-jags-mode (with-temp-buffer (ess-jags-mode) major-mode)))) + +(ert-deftest ess-bugs-mode () + (should (string= 'ess-bugs-mode (with-temp-buffer (ess-bugs-mode) major-mode)))) + +(ert-deftest ess-julia-mode () + (skip-unless (and (require 'julia-mode nil t) (require 'ess-julia))) + (should (string= 'ess-julia-mode (with-temp-buffer (ess-julia-mode) major-mode)))) + +(ert-deftest sas-mode () + (should (string= 'SAS-mode (with-temp-buffer (SAS-mode) major-mode)))) + +;; Various tests from e.g. ess-utils.el + +(ert-deftest ess-flatten-list () + (should (equal (list 'a 'b 'c 'd 'e 'f 'g 'h 'i 'j) + (ess-flatten-list '((a . b) c (d . e) (f g h) i . j))))) + +(provide 'ess-test) + +;;; ess-test.el ends here diff -Nru ess-18.10.2/test/ess-test-indentation.el ess-18.10.2+git20220915.f45542e/test/ess-test-indentation.el --- ess-18.10.2/test/ess-test-indentation.el 1970-01-01 00:00:00.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/test/ess-test-indentation.el 2022-10-15 08:06:36.000000000 +0000 @@ -0,0 +1,142 @@ +;; ess-test-indentation.el --- Tests for ESS indentation -*- lexical-binding: t; -*- +;; +;; Filename: ess-tests.el +;; Created: 07-05-2015 (ESS 15.09) +;; Keywords: tests, indentation +;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; +;; This file is *NOT* part of GNU Emacs. +;; This file is part of ESS +;; +;; This program is free software; you can redistribute it and/or +;; modify it under the terms of the GNU General Public License as +;; published by the Free Software Foundation; either version 3, or +;; (at your option) any later version. +;; +;; This file is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. +;; +;; A copy of the GNU General Public License is available at +;; https://www.r-project.org/Licenses/ +;; +;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; +;;; Commentary: +;; +;; To run these tests: +;; All tests: M-x ert t +;; +;; To apply styles for manual testing: +;; M-: (let ((ess-style-alist ess-test-style-alist)) +;; (ess-set-style 'misc1)) +;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; +;;; Code: + +(require 'ert) +(require 'ess-r-mode) +(require 'ess-test-r-utils) + +;;; Indentation tests + +(defvar ess-test-style-alist + `((RRR + ,@(cdr (assq 'RRR ess-style-alist))) + (RRR+ + ,@(cdr (assq 'RRR+ ess-style-alist))) + (RStudio- + ,@(cdr (assq 'RStudio- ess-style-alist))) + (C++ + ,@(cdr (assq 'C++ ess-style-alist))) + (DEFAULT + ,@(cdr (assq 'DEFAULT ess-style-alist))) + (misc1 + (ess-indent-offset . 3) + (ess-offset-block . open-delim) + (ess-offset-arguments . (prev-call 5)) + (ess-offset-arguments-newline . open-delim) + (ess-offset-continued . cascade) + (ess-align-nested-calls . ("ifelse")) + (ess-align-arguments-in-calls . nil) + (ess-align-continuations-in-calls . nil) + (ess-align-blocks . (fun-decl bare-blocks)) + (ess-indent-from-lhs . nil) + (ess-indent-from-chain-start . nil) + (ess-indent-with-fancy-comments . t)))) + +(defun ess-test-get-pos-from-undo-elt (e) + "If E represents an edit, return a position value in E, the position +where the edit took place. Return nil if E represents no real change. +\nE is an entry in the buffer-undo-list." + ;; stolen from goto-chg.el + (cond + ;; ((numberp e) e) ; num==changed position + ;; ((atom e) nil) ; nil==command boundary + ((numberp (car e)) (cdr e)) ; (beg . end)==insertion + ((stringp (car e)) (abs (cdr e))) ; (string . pos)==deletion + ;; ((null (car e)) (nthcdr 4 e)) ; (nil ...)==text property change + ;; ((atom (car e)) nil) ; (t ...)==file modification time + (t nil))) ; (marker ...)==marker moved + +(defun not-change-on-indent (buffer) + "Return t if BUFFER wasn't modified on indent." + (with-current-buffer buffer + (setq buffer-undo-list nil) + (indent-region (point-min) (point-max)) + (if (buffer-modified-p buffer) + (progn (switch-to-buffer buffer) nil) + t))) + +(defun ess-test-explain-change-on-indent (buffer) + "Explainer function for `not-change-on-indent'." + (when (buffer-modified-p buffer) + (with-current-buffer buffer + (let ((bul buffer-undo-list) + (change-pos (point-min))) + (while (and bul + (null (setq change-pos (ess-test-get-pos-from-undo-elt (car bul))))) + (pop bul)) + (let ((diff-file (concat (buffer-name) ".diff"))) + (diff-buffer-with-file buffer) + (with-current-buffer "*Diff*" + (write-region (point-min) (point-max) diff-file)) + `(,(buffer-name buffer) was modified on line ,(count-lines 1 change-pos) + (diff was writen to ,diff-file))))))) + +(put 'not-change-on-indent 'ert-explainer 'ess-test-explain-change-on-indent) + +;; Don't overwrite user settings (#911). +(ert-deftest ess-r-no-user-style-overwrite-test () + (let ((ess-style 'RRR) + (ess-r-mode-hook '((lambda () (setq-local ess-indent-offset 1))))) + (with-temp-buffer + (ess-r-mode) + (should (eq ess-indent-offset 1)) + (ess-set-style) + (should (eq ess-indent-offset 1)) + (ess-set-style 'C++) + (should (eq ess-indent-offset 4))))) + +(ert-deftest test-ess-R-indentation-RRR () + (ess-test-R-indentation "styles/RRR.R" 'RRR)) + +(ert-deftest test-ess-R-indentation-RRR+ () + (ess-test-R-indentation "styles/RRR+.R" 'RRR+)) + +(ert-deftest test-ess-R-indentation-RStudio- () + (ess-test-R-indentation "styles/RStudio-.R" 'RStudio-)) + +(ert-deftest test-ess-R-indentation-C++ () + (ess-test-R-indentation "styles/C++.R" 'C++)) + +(ert-deftest test-ess-R-indentation-misc1 () + (ess-test-R-indentation "styles/misc1.R" 'misc1)) + +(provide 'ess-test-indentation) + +;;; ess-test-indentation.el ends here diff -Nru ess-18.10.2/test/ess-test-inf.el ess-18.10.2+git20220915.f45542e/test/ess-test-inf.el --- ess-18.10.2/test/ess-test-inf.el 1970-01-01 00:00:00.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/test/ess-test-inf.el 2022-10-15 08:06:36.000000000 +0000 @@ -0,0 +1,628 @@ +;;; ess-test-inf.el --- ESS tests for inferiors -*- lexical-binding: t; -*- +;; +;; 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 +;; https://www.r-project.org/Licenses/ +;; +;;; Commentary: +;; Tests for inferior processes. + +(require 'ert) +(require 'etest) +(require 'cl-lib) + +;; As we use the R inferior for the generic tests +(require 'ess-test-r-utils) + + +;;*;; Startup + +(defun ess-r-tests-startup-output () + (let ((inf-buf (run-ess-test-r-vanilla))) + (ess-test-unwind-protect inf-buf + (with-current-buffer inf-buf + (buffer-string))))) + +(ert-deftest ess-startup-verbose-setwd-test () + (should (string-match "to quit R.\n\n> setwd(.*)$" (ess-r-tests-startup-output)))) + +(ert-deftest ess-startup-default-directory-preserved-test () + (let ((default-directory user-emacs-directory) + (ess-startup-directory temporary-file-directory) + ess-ask-for-ess-directory) + (with-r-running nil + (should (string= default-directory user-emacs-directory)) + (should (string= (inferior-ess-default-directory) temporary-file-directory))) + (should (string= default-directory user-emacs-directory)))) + +(ert-deftest ess-test-inferior-live-process-error () + (let* ((ess-gen-proc-buffer-name-function + ;; Generate same inferior name each time + (lambda (&rest args) "" "foo")) + (error-msg "Can't start a new session in buffer `foo` because one already exists") + (inf-buf (run-ess-test-r-vanilla))) + (ess-test-unwind-protect inf-buf + (should (string= (cadr (should-error (run-ess-test-r-vanilla))) + (format-message error-msg)))))) + +(ert-deftest ess-test-inferior-local-start-args () + (with-r-running nil + (let ((inf-data (buffer-local-value 'inferior-ess--local-data *inf-buf*))) + (should (equal (car inf-data) "R")) + (should (equal (cdr inf-data) "--no-readline --no-init-file --no-site-file"))))) + +(ert-deftest ess-test-inferior-reload-start-data () + (let* ((r-path (executable-find "R")) + (inferior-ess-r-program r-path) + (inf-buf (run-ess-test-r-vanilla))) + (ess-test-unwind-protect inf-buf + (let ((inf-data (buffer-local-value 'inferior-ess--local-data inf-buf))) + (should (equal (car inf-data) r-path)) + (should (equal (cdr inf-data) "--no-readline --no-init-file --no-site-file")))))) + + +;;*;; Evaluation + +(etest-deftest ess-command-test () + "`ess-command' saves output in specified buffer." + (let ((output-buffer (get-buffer-create " *ess-test-command-output*"))) + (ess-command "identity(TRUE)\n" output-buffer) + (should (string= (with-current-buffer output-buffer + (ess-kill-last-line) + (buffer-string)) + "[1] TRUE"))) + ;; No impact on inferior output + :inf-result "") + +(ert-deftest ess-async-command-test () + ;; (ess-async-command "{cat(1:5);Sys.sleep(5);cat(2:6)}\n" nil (get-process "R") + ;; (lambda (proc) (message "done"))) + ;; (ess-async-command "{cat(1:5);Sys.sleep(5);cat(2:6)}\n" nil (get-process "R") + ;; (lambda (proc) (message "done")) + ;; t) + ;; (ess-async-command "{cat(1:5);Sys.sleep(5);cat(2:6)}\n" nil (get-process "R") + ;; (lambda (proc) (message "done")) + (with-r-running nil + (let ((inf-proc *proc*) + semaphore) + (ess-async-command "{cat(1:5);Sys.sleep(0.5);cat(2:6, '\n')}\n" + (get-buffer-create " *ess-async-text-command-output*") + inf-proc + (lambda (&rest args) (setq semaphore t))) + (should (process-get inf-proc 'callbacks)) + (cl-loop repeat 3 + until (and semaphore (null (process-get inf-proc 'callbacks))) + do (sleep-for 0 600) + finally (should-not (process-get inf-proc 'callbacks)))))) + +(ert-deftest ess-run-presend-hooks-test () + (with-r-running nil + (let ((ess-presend-filter-functions (list (lambda (string) "\"bar\"")))) + (should (output= (ess-send-string (ess-get-process) "\"foo\"") + "[1] \"bar\""))))) + +(ert-deftest ess-load-file-test () + (with-r-running nil + (should (string-match "^\\[1\\] \"foo\"\nSourced file" + (output nil (ess-load-file (expand-file-name "file.R" ess-test-fixtures-directory))))))) + +(etest-deftest ess-command-incomplete-test () + "`ess-command' fails with incomplete input." + (should-error (ess-command "list(" nil nil nil nil nil nil 0.01)) + + ;; No impact on inferior output + :inf-result "" + + ;; Process has been interrupted, is no longer busy, and we can run a + ;; command again + (should (inferior-ess-available-p)) + (should-error (ess-command "list(" nil nil nil nil nil nil 0.01)) + :inf-result "") + +(etest-deftest ess-command-hanging-test () + "`ess-command' fails with hanging command." + (should-error (ess-command "Sys.sleep(2)\n" nil nil nil nil nil nil 0.01)) + :inf-result "" + (should (inferior-ess-available-p))) + +(defun ess-test--browser () + (ess-send-string (ess-get-process) "{ browser(); NULL }\n") + (ess-wait-for-process)) + +(defun ess-test--browser-cleanup () + (ess-debug-command-quit) + (ess-wait-for-process) + (etest-clear-inferior-buffer)) + +(etest-deftest ess--command-browser-timeout-test () + "`ess-command' fails with hanging command within browser (#1081)." + :cleanup (ess-test--browser-cleanup) + (ess-test--browser) + :inf-result "Called from: top level +Browse[1]> debug at #1: NULL +Browse[1]> " + + (should-error (ess-command "Sys.sleep(2)\n" nil nil nil nil nil nil 0.01)) + + ;; No impact on inferior + :inf-result "" + (should (inferior-ess-available-p)) + + ;; We're still in the browser + (ess-send-string (ess-get-process) "NULL\n") + (ess-wait-for-process) + :inf-result "NULL +Browse[1]> ") + +(etest-deftest ess-command-browser-curly-braces () + "`{` expressions when debugger is active do not interrupt command." + :cleanup (ess-test--browser-cleanup) + (ess-test--browser) + :inf-result "Called from: top level +Browse[1]> debug at #1: NULL +Browse[1]> " + + (should (string= (ess-string-command "{ 1; 2 }\n") + "[1] 2")) + :inf-result "" + (should (inferior-ess-available-p))) + +(etest-deftest ess-command-environment () + "Can access current env with `.ess.environment()`" + :cleanup (ess-test--browser-cleanup) + (ess-send-string (ess-get-process) + "local({ foo <- 1; browser(); NULL })\n") + (ess-wait-for-process) + (should (string= (ess-string-command "ls(envir = .ess.environment())\n") + "[1] \"foo\""))) + +(etest-deftest ess-command-quit-test () + "`ess-command' does not leak output on quit (#794, #842). +This is especially important within `while-no-input' used by +packages like eldoc and company-quickhelp. `throw-on-input' sets +`quit-flag'." + ;; Simulate a quit by throwing from a timer + (run-at-time 0.1 nil (lambda () (throw 'my-quit 'thrown))) + (should (eq (catch 'my-quit + (ess-command "{ cat('output\n'); Sys.sleep(10) }\n" nil nil nil nil nil nil 0.5)) + 'thrown)) + ;; There should be no output after the early exit + :inf-result "" + (should (inferior-ess-available-p))) + +(etest-deftest ess-command-quit-async-interrupt-test () + "`ess-command' interrupts asynchronously on quits (#1091, #1102). +Needed with slow-responding processes." + (should (eq (identity (marker-buffer (process-mark (ess-get-process)))) + (ess-get-process-buffer))) + (run-at-time 0.1 nil (lambda () (throw 'my-quit 'thrown))) + (should (eq (catch 'my-quit + (ess-command "{ + cat('output\n') + withCallingHandlers( + interrupt = function(...) Sys.sleep(0.2), + Sys.sleep(10) + ) + } + " + nil nil nil nil nil nil 0.5)) + 'thrown)) + ;; Wait for the async interrupt + (should (ess-wait-for-process (ess-get-process) nil nil 0.5)) + ;; Check that marker buffer was properly restored + (should (eq (marker-buffer (process-mark (ess-get-process))) + (ess-get-process-buffer))) + + ;; There should be no output after the early exit or async restoration + :inf-result "") + +(etest-deftest ess-command-newlines-test () + "`ess-command' doesn't garble new lines (#1110)." + (should (string= (ess--strip-final-newlines "1\n2") + "1\n2")) + (should (equal (ess-get-words-from-vector "{ 'foo'\n'bar'\n }\n") + (list "bar")))) + +(etest-deftest ess-command-multiline-test () + "`ess-command' output doesn't include continuation prompts (#1116)." + (let ((buf (generate-new-buffer "ess-command-multiline-test"))) + (ess-command "{ 1\n 2 }\n" buf) + (should (string= (with-current-buffer buf + (buffer-string)) + "[1] 2")))) + +(ert-deftest ess--command-output-info-test () + ;; No output + (with-temp-buffer + (insert "baz> ") + (should (equal (ess--command-output-info (current-buffer)) + (list 1 1 nil)))) + ;; Command output and no new output + (with-temp-buffer + (insert " +foo +bar +baz> ") + (should (equal (ess--command-output-info (current-buffer)) + (list 1 9 nil)))) + ;; Command output and new output + (with-temp-buffer + (insert " +foo +bar +baz> + +new output") + (should (equal (ess--command-output-info (current-buffer)) + (list 1 9 16))))) + +(ert-deftest ess--command-delimited-output-info-test () + ;; No output + (with-temp-buffer + (insert " +my-sentinel-START +my-sentinel-END +baz> ") + (should (equal (ess--command-delimited-output-info (current-buffer) "my-sentinel") + (list 20 20 nil)))) + ;; Command output and no new output + (with-temp-buffer + (insert " +my-sentinel-START +foo +bar +my-sentinel-END +baz> ") + (should (equal (ess--command-delimited-output-info (current-buffer) "my-sentinel") + (list 20 27 nil)))) + ;; Command output and new output + (with-temp-buffer + (insert " +my-sentinel-START +foo +bar +my-sentinel-END +baz> + +new output") + (should (equal (ess--command-delimited-output-info (current-buffer) "my-sentinel") + (list 20 27 49))))) + +(etest-deftest command-without-trailing-newline-test () + "It is a bug when a command doesn't output a trailing newline. +With delimiters it might be possible to figure out the output. +However if they are not available then the output is +indistinguishable from the prompt." + (should-error (ess-command "cat(1)\n")) + (ess-wait-for-process) + ;; Leaks output after the error but that seems fine since errors in + ;; filters are bugs + :inf-result " +> ") + +(etest-deftest ess-command-intervening-input-test () + "Test that user can send input while command is interrupting (#1119)." + (run-at-time 0.1 nil (lambda () (throw 'my-quit 'thrown))) + (should (eq (catch 'my-quit + (ess-command "{ + cat('output\n') + withCallingHandlers( + interrupt = function(...) Sys.sleep(0.2), + Sys.sleep(10) + ) + } + " + nil nil nil nil nil nil 0.5)) + 'thrown)) + ;; Send intervening input right away. Since we wait on the R side + ;; on interrupt, the process hasn't been restored yet + (ess-send-string (ess-get-process) "cat('foobar\\n')\n") + ;; Wait for the async interrupt + (should (ess-wait-for-process nil nil nil 0.5)) + ;; The output for the intervening input should be shown in the + ;; process buffer + :inf-result "foobar +> ") + +;;*;; Inferior interaction + +(defmacro ess-test-interactive-eval (out-string &rest body) + "Evaluate BODY in a temp buffer with `R-mode' on. +OUT-STRING is the content of the region captured by +`ess-send-region' function." + (declare (indent 1) (debug (form body))) + `(cl-letf (((symbol-function 'ess-force-buffer-current) #'ignore) + ((symbol-function 'ess-get-process) #'ignore) + ((symbol-function 'ess-process-get) #'ignore) + ((symbol-function 'ess-send-region) + (lambda (_ start end &rest _ignore) + (should (string= (buffer-substring-no-properties start end) + ,out-string))))) + (with-temp-buffer + (R-mode) + ,@body))) + +(ert-deftest ess-eval-paragraph-test () + (let ((inhibit-message ess-inhibit-message-in-tests)) + (let ((output "library(bbb)")) + (ess-test-interactive-eval output + (insert (format "## a comment\n\n%s\n\nmore_code4" output)) + (goto-char (point-min)) + (search-forward "lib") + (ess-eval-paragraph) + (should (looking-at-p "rary")) + (ess-eval-region-or-function-or-paragraph) + (should (looking-at-p "rary")))))) + +(ert-deftest ess-eval-and-step-test () + (let ((inhibit-message ess-inhibit-message-in-tests)) + + (let ((output "real <- code")) + (ess-test-interactive-eval output + (insert (format "## comment\n\n%s" output)) + (forward-line -1) + (ess-eval-region-or-function-or-paragraph-and-step))) + + (let ((output "xyz <- function () {\n}")) + (ess-test-interactive-eval output + (insert (format "## comment\n\n%s" output)) + (goto-char (point-min)) + (forward-line 1) + (ess-eval-region-or-function-or-paragraph-and-step))) + + (let ((output "xyz <- function () {\n}")) + (ess-test-interactive-eval output + (insert (format "## comment\n%s\nsome_code\n\nmore_code" output)) + (goto-char (point-min)) + (forward-line 1) + (ess-eval-region-or-function-or-paragraph-and-step) + (should (looking-at-p "some_code")))) + + (let ((output "a <- 1\nb <- 2")) + (ess-test-interactive-eval output + (insert (format "%s\n\nmore_code1()" output)) + (goto-char (point-min)) + (ess-eval-region-or-function-or-paragraph-and-step) + (should (looking-at-p "more_code1")))) + + (let ((output "a <- 1\nb <- 2")) + (ess-test-interactive-eval output + (insert (format "%s\n\nmore_code2()" output)) + (goto-char (point-min)) + (ess-eval-region-or-function-or-paragraph-and-step) + (should (looking-at-p "more_code2")))) + + (let ((output "library(aaaa)")) + (ess-test-interactive-eval output + (insert (format "%s\n\nmore_code3\n" output)) + (goto-char (point-min)) + (ess-eval-region-or-function-or-paragraph-and-step) + (should (looking-at-p "more_code3")))) + + (let ((output "library(bbb)")) + (ess-test-interactive-eval output + (insert (format "## a comment\n\n%s\n\nmore_code4" output)) + (goto-char (point-min)) + (ess-eval-region-or-function-or-paragraph-and-step) + (should (looking-at-p "more_code4")))) + )) + +(ert-deftest ess-setwd-test () + (with-r-running nil + ;; Working directory is set verbosely + (should (output= (ess-set-working-directory temporary-file-directory) + (format "setwd('%s')" temporary-file-directory))) + ;; Update process default-directory but not caller's buffer + (let* ((cur-dir default-directory) + (temp-dir (file-name-as-directory (make-temp-file "setwd-dir" t)))) + (unwind-protect + (progn + (setq default-directory temp-dir) + (ess-set-working-directory temporary-file-directory) + (should (equal default-directory temp-dir)) + (should (equal (ess-get-process-variable 'default-directory) + temporary-file-directory)) + (ess-set-working-directory temp-dir) + (should (equal (ess-get-process-variable 'default-directory) + temp-dir))) + (setq default-directory cur-dir))))) + + +;;*;; Sending input + +(ert-deftest ess-inf-send-input-invisible-test () + (let ((ess-eval-visibly nil)) + (should (string= "> " + (ess-send-input-to-R "\n\n"))) + (should (string= "> " + (ess-send-input-to-R "invisible(0)"))) + (should (string= "invisible(0)\n> " + (ess-send-input-to-R "invisible(0)" 'repl))))) + +(ert-deftest ess-inf-send-complex-input-test () + (let ((ess-eval-visibly nil) + (inferior-ess-fix-misaligned-output t) + (input "identity( + identity( + identity( + head(mtcars[, c('wt', 'vs')], 3)))) +'+ + + + > some-output >' +cat('+ + + + > cleaned-prompts >\n') +") + (output "> + wt vs +Mazda RX4 2.620 0 +Mazda RX4 Wag 2.875 0 +Datsun 710 2.320 1 +> +[1] \"+ + + + > some-output >\" +> +cleaned-prompts > +> ")) + (let ((inferior-ess-replace-long+ t)) + (should (string= output (ess-send-input-to-R input)))))) + +(ert-deftest ess-inf-send-fn-test () + (let ((input "fn <- function() { +} +") + (output "> ") + (output-nowait "> fn <- function() { ++ } +> ")) + (let ((inferior-ess-replace-long+ t)) + (let ((ess-eval-visibly nil)) + (should (string= output + (ess-send-input-to-R input 'c-c)))) + ;;; this fails randomly in batch + ;; (let ((ess-eval-visibly 'nowait)) + ;; (should (string= output-nowait + ;; (ess-send-input-to-R input 'c-c)))) + ))) + +(ert-deftest ess-inf-send-cat-some.text-test () + (let ((inferior-ess-fix-misaligned-output t) + (input "cat(\"some. text\\n\") +head(cars, 2) +") + (output "some. text +> + speed dist +1 4 2 +2 4 10 +> ") + (output-nowait "cat(\"some. text\\n\") ++ head(cars, 2) +some. text +> + speed dist +1 4 2 +2 4 10 +> ")) + (let ((inferior-ess-replace-long+ t)) + (let ((ess-eval-visibly nil)) + (should (string= output + (ess-send-input-to-R input 'c-c)))) + ;; these test fails randomly in batch + ;; (let ((ess-eval-visibly 'nowait)) + ;; (should (string= output-nowait + ;; (ess-send-input-to-R input 'c-c)))) + ))) + + +;;*;; Help + +(etest-deftest ess-help-aliases-test () + (let ((aliases (ess-get-help-aliases-list))) + (should (member "list" aliases))) + :inf-result "" + + (ess-help--reset-cache) + (let ((aliases (ess-get-help-aliases-list))) + (should (member "list" aliases)))) + + +;;*;; Inferior utils + +(ert-deftest ess-build-eval-command-test () + (should (not (ess-build-eval-command "command()"))) + (let ((ess-eval-command "%s - %f")) + (should (string= (ess-build-eval-command "command(\"string\")" nil nil "file") + "command(\\\"string\\\") - file")))) + +(ert-deftest ess-build-load-command-test () + (let ((ess-dialect nil)) + (should (string= (ess-build-load-command "file") + "source('file')\n")))) + +(ert-deftest ess-get-words-from-vector-test () + (with-r-running nil + (should (cl-every #'string= (ess-get-words-from-vector "c('1')\n") '("1"))) + (should (cl-every #'string= (ess-get-words-from-vector "c('1', \"2\")\n") '("1" "2"))) + (should (cl-every #'string= (ess-get-words-from-vector "c('aaa','bbb\"ccc', 'dddd')\n") + '("aaa" "bbb\\\"ccc" "dddd"))))) + +(ert-deftest ess--derive-connection-path () + (let* ((old-localname "/path/to/file") + (new-localname "/home/username/projects") + (connection-basic "/ssh:melancholia.danann.net:") + (connection-ip4 "/ssh:10.0.1.213:") + (connection-ip6 "/ssh:[::1]:") + (connection-user "/scp:user@host:") + (connection-port "/ssh:daniel@melancholia#42:") + (connection-domain "/smb:daniel%BIZARRE@melancholia:") + (connection-hop "/ssh:bird@bastion|ssh:news.my.domain:") + (make-check-replacement + (lambda (new-connection) + (lambda (old-connection) + (let ((old-path (concat old-connection old-localname)) + (new-path (concat new-connection new-localname))) + (string= (ess--derive-connection-path old-path new-path) + (concat old-connection new-localname)))))) + (check-new-localpath (funcall make-check-replacement "")) + (check-new-remotepath (funcall make-check-replacement connection-basic))) + (should (funcall check-new-localpath "")) + (should (funcall check-new-localpath connection-basic)) + (should (funcall check-new-localpath connection-ip4)) + (should (funcall check-new-localpath connection-ip6)) + (should (funcall check-new-localpath connection-user)) + (should (funcall check-new-localpath connection-port)) + (should (funcall check-new-localpath connection-domain)) + (should (funcall check-new-localpath connection-hop)) + (should (funcall check-new-remotepath "")) + (should (funcall check-new-remotepath connection-basic)))) + +;; Test runners + +;; Note that we add R-3.2.1 to continuous integration via a symlink to +;; the actual R binary. These tests will likely fail locally for you +;; unless you have R-3.2.1 somewhere on `exec-path' when ESS was first +;; loaded. They're skipped unless you've defined the environment +;; variable CONTINUOUS_INTEGRATION or R-3.2.1 is found by +;; `executable-find'. +(ert-deftest runner-R-3.2.1-defined-test () + (skip-unless (or (executable-find "R-3.2.1") + (getenv "CONTINUOUS_INTEGRATION"))) + (should (fboundp 'R-3.2.1))) + +(ert-deftest runner-R-3.2.1-buffer-name-test () + (skip-unless (and (or (executable-find "R-3.2.1") + (getenv "CONTINUOUS_INTEGRATION")) + (> emacs-major-version 25))) + (let ((ess-use-inferior-program-in-buffer-name t) + (ess-plain-first-buffername nil) + (ess-gen-proc-buffer-name-function #'ess-gen-proc-buffer-name:simple) + (ess-ask-for-ess-directory nil) + (inhibit-message ess-inhibit-message-in-tests)) + (let ((inf-buf (R-3.2.1))) + (ess-test-unwind-protect inf-buf + (with-current-buffer inf-buf + (should (string= (buffer-name) "*R-3.2.1:1*"))) + (let ((other-inf-buf (R-3.2.1))) + (ess-test-unwind-protect other-inf-buf + (with-current-buffer other-inf-buf + (should (string= (buffer-name) "*R-3.2.1:2*"))))))))) + +(ert-deftest ess-switch-to-inferior-or-script-buffer-test () + (with-r-running nil + (should (derived-mode-p 'ess-mode)) + (ess-switch-to-inferior-or-script-buffer nil) + (should (derived-mode-p 'inferior-ess-mode)))) + + +(provide 'ess-test-inf) + +;; Local Variables: +;; etest-local-config: etest-r-config +;; End: + +;;; ess-test-inf.el ends here diff -Nru ess-18.10.2/test/ess-test-literate.el ess-18.10.2+git20220915.f45542e/test/ess-test-literate.el --- ess-18.10.2/test/ess-test-literate.el 1970-01-01 00:00:00.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/test/ess-test-literate.el 2022-10-15 08:06:36.000000000 +0000 @@ -0,0 +1,229 @@ +;;; ess-test-literate.el --- ESS literate tests -*- lexical-binding: t; -*- + + +;;; Commentary: +;; Literate tests + + +;;; Code: + +(require 'ess-r-mode) +(eval-when-compile + (require 'cl-lib)) +(require 'etest) + +(defvar elt-section-pattern) +(defvar elt-chunk-pattern) +(defvar elt-code-pattern) +(defvar chunk-end) +(defvar elt-code-cont-pattern) +(defvar test-case) +(defvar test-case-state) +(defvar elt-mode-init) + +(defmacro elt-deftest (name args file) + `(ert-deftest ,name ,args + (let ((inhibit-message ess-inhibit-message-in-tests) + (path (expand-file-name ,file "literate"))) + (elt-do 'test path)))) + +(defun elt--activate-font-lock-keywords () + "Activate font-lock keywords for some of ELT's symbols." + (font-lock-add-keywords + nil + '(("(\\(\\\\s *\\(\\(?:\\sw\\|\\s_\\)+\\)?" + (1 font-lock-keyword-face nil t) + (2 font-lock-function-name-face nil t))))) +(add-hook 'emacs-lisp-mode-hook #'elt--activate-font-lock-keywords) + +(defvar elt-ess-r-chunk-pattern "^###[ \t]*\\([0-9]+[a-zA-Z]*\\) \\([^\n]*\\)$") +(defvar elt-ess-r-code-start-pattern "^##!") +(defvar elt-ess-r-code-cont-pattern "^##>") +(defvar elt-ess-r-code-pattern "^##[!>]") +(defvar elt-ess-r-section-pattern "^##### \\([^\n]*\\)$") +(defvar elt-ess-r-mode-init '((mode . R))) + +(defun elt-do (action file) + (unless (memq action '(test regenerate)) + (error "Invalid literate test action")) + (let ((verb (if (eq action 'test) + "Testing" + "Regenerating"))) + (message "---%s %s" verb (file-name-nondirectory file))) + (let* ((src-buffer (if (file-exists-p file) + (find-file-noselect file) + (error "Can't find literate test file"))) + (src-string (with-current-buffer src-buffer + (buffer-string))) + (output (elt-buffer-string file src-string))) + (pcase action + (`test (should (string= src-string output))) + (`regenerate (with-current-buffer src-buffer + (erase-buffer) + (insert output) + (save-buffer)))))) + +(defun elt-buffer-string (file src-string) + (let ((el-file (concat (file-name-sans-extension file) ".el"))) + (when (file-exists-p el-file) + (load-file el-file))) + (with-temp-buffer + (insert src-string) + ;; Don't check safety of local variables declared in test files + (cl-letf (((symbol-function 'safe-local-variable-p) (lambda (sym val) t))) + (let ((enable-dir-local-variables nil)) + (hack-local-variables))) + (let ((elt-chunk-pattern elt-ess-r-chunk-pattern) + (elt-code-cont-pattern elt-ess-r-code-cont-pattern) + (elt-code-pattern elt-ess-r-code-pattern) + (elt-section-pattern elt-ess-r-section-pattern) + (elt-mode-init (append (assq-delete-all 'mode file-local-variables-alist) + elt-ess-r-mode-init))) + (elt-this-buffer) + (buffer-string)))) + +(defun elt-this-buffer () + (goto-char 1) + (let ((undo-inhibit-record-point t)) + (undo-boundary) + ;; Print first section header + (elt-print-section-header) + (when (elt-search-chunk nil t) + (while (looking-at elt-chunk-pattern) + (elt-print-chunk-id) + (elt-process-next-chunk))) + (skip-chars-backward "\n") + (let ((point-max (or (elt-local-variables-pos) + (point-max)))) + (delete-region (1+ (point)) point-max) + (insert "\n")) + (when (looking-at (concat "\n" comment-start "+ +Local Variables:")) + (insert "\n")) + (undo-boundary))) + +(defun elt-local-variables-pos () + (save-excursion + (let ((pattern (concat "^" comment-start "+ +Local Variables:"))) + (when (re-search-forward pattern nil t) + (match-beginning 0))))) + +(defun elt-print-section-header () + (save-excursion + (skip-chars-forward " \n\t") + (when (looking-at elt-section-pattern) + (message (match-string-no-properties 1))))) + +(defun elt-print-chunk-id () + (let ((number (concat "#" (match-string-no-properties 1))) + (msg (match-string-no-properties 2))) + (setq msg (substring msg 0 (string-match "-+$" msg))) + (message (if (> (length msg) 0) + (concat number " - " msg) + number)))) + +(defun elt-search-chunk (&optional n skip-section) + (let* ((next-chunk (save-excursion + (cond ((re-search-forward elt-chunk-pattern + nil t (or n 1)) + (match-beginning 0)) + ((elt-local-variables-pos)) + (t + (point-max))))) + (next-section (save-excursion + (when (re-search-forward elt-section-pattern + next-chunk t) + (match-beginning 0))))) + (goto-char (if (and (not skip-section) next-section) + next-section + next-chunk)))) + +(defun elt-process-next-chunk () + (let* ((chunk-beg (point)) + (chunk-end (progn + (forward-line) + (save-excursion + (elt-search-chunk) + (point-marker)))) + (orig-chunk (buffer-substring chunk-beg chunk-end))) + (condition-case cnd + (let* ((test-case (progn + (skip-chars-forward " \t\n") + (elt-process-case))) + (test-case-state test-case)) + (while (looking-at elt-code-pattern) + (elt-process-next-subchunk chunk-end)) + (insert "\n") + (elt-print-section-header) + (when (looking-at elt-section-pattern) + (insert "\n") + (elt-search-chunk nil t))) + (ert-test-skipped + (message (concat " Skipping test: " (cadr cnd))) + (goto-char chunk-beg) + (delete-region chunk-beg chunk-end) + (insert orig-chunk) + nil)))) + +(defun elt-process-next-subchunk (chunk-end) + (let* ((continuation (looking-at elt-code-cont-pattern)) + (test-code (elt-process-code)) + (test-result (elt-run-chunk test-code + elt-mode-init + continuation)) + (subchunk-end (save-excursion + (if (re-search-forward elt-code-pattern chunk-end t) + (match-beginning 0) + chunk-end)))) + (setq test-case-state test-result) + (delete-region (point) subchunk-end) + (insert (concat "\n" test-result "\n\n")))) + +(defun elt-process-case () + (let ((case-start (progn + (skip-chars-forward " \t\n") + (goto-char (line-beginning-position)) + (point))) + (code-start (if (re-search-forward elt-code-pattern chunk-end t) + (goto-char (match-beginning 0)) + (error "No test code found"))) + (case-end (progn + (skip-chars-backward " \t\n") + (point)))) + (forward-char 1) + (delete-region (point) code-start) + (insert "\n") + (buffer-substring-no-properties case-start case-end))) + +(defun elt-process-code () + (let* ((test-start (point)) + (test-end (if (re-search-forward "^$" chunk-end t) + (1- (match-beginning 0)) + (goto-char chunk-end))) + (test-code (buffer-substring-no-properties test-start test-end))) + ;; Remove comment prefix + (while (string-match (concat (substring elt-code-pattern 1) "[ \t]?") + test-code) + (setq test-code (replace-match "" t t test-code))) + ;; Parse elisp + (setq test-code (concat "(" test-code ")")) + (car (read-from-string test-code)))) + + +(defvar elt--state-buffer nil + "Evaluation buffer of previous test chunk.") + +(defun elt-run-chunk (body local-variables &optional keep-state) + (unless keep-state + (when (and elt--state-buffer + (buffer-name elt--state-buffer)) + (kill-buffer elt--state-buffer)) + (setq elt--state-buffer (etest--new-buffer local-variables))) + (with-current-buffer elt--state-buffer + (delete-region (point-min) (point-max)) + (insert (if keep-state test-case-state test-case))) + (etest-run elt--state-buffer body (not keep-state)) + (etest--result elt--state-buffer)) + +(provide 'ess-test-literate) + +;;; ess-test-literate.el ends here diff -Nru ess-18.10.2/test/ess-test-org.el ess-18.10.2+git20220915.f45542e/test/ess-test-org.el --- ess-18.10.2/test/ess-test-org.el 1970-01-01 00:00:00.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/test/ess-test-org.el 2022-10-15 08:06:36.000000000 +0000 @@ -0,0 +1,72 @@ +;; ess-test-org.el --- Test for org-babel integration -*- lexical-binding: t -*- +;; +;; 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 +;; https://www.r-project.org/Licenses/ +;; +;;; Commentary: +;; Tests for org babel functionality. + +;;; Code: + +(require 'ert) +(require 'ess-r-mode) +(require 'ess-test-r-utils) +(require 'ob-R) + +;; ob-R let-binds `ess-local-process-name' to the process of the +;; session buffer. This session buffer is set to `*R*` by default. It +;; is safer to pass a dedicated inferior buffer as `:session' keyword + +(defun test-org-R-ouput (expect input) + (declare (indent 1)) + (let* ((inf-buf (run-ess-test-r-vanilla)) + (inf-proc (get-buffer-process inf-buf))) + (setq input (format input (buffer-name inf-buf))) + (ess-test-unwind-protect inf-buf + (with-current-buffer (get-buffer-create "*ess-org-test*") + (let ((org-confirm-babel-evaluate nil) + (ess-ask-for-ess-directory nil) + (inhibit-message ess-inhibit-message-in-tests)) + (erase-buffer) + (insert input) + (org-mode) + (goto-char (point-min)) + (forward-line 1) + (org-ctrl-c-ctrl-c) + (goto-char (point-max)) + (should (re-search-backward expect nil t))))))) + +(ert-deftest test-org-ob-R-output-test () + (test-org-R-ouput "hello" + "#+BEGIN_SRC R :results output\n \"hello\"\n#+END_SRC")) + +(ert-deftest test-org-ob-R-session-output-test () + (test-org-R-ouput "hello" + "#+BEGIN_SRC R :session %s :results output\n \"hello\"\n#+END_SRC")) + +(ert-deftest test-org-ob-R-value-test () + (test-org-R-ouput "hello" + "#+BEGIN_SRC R :results value\n \"hello\"\n#+END_SRC")) + +(ert-deftest test-org-ob-R-session-value-test () + (test-org-R-ouput "hello" + "#+BEGIN_SRC R :session %s :results value\n \"hello\"\n#+END_SRC")) + +(ert-deftest test-org-ob-R-data-frame-test () + (test-org-R-ouput "| 3 | c |" + "#+BEGIN_SRC R :session :results value :colnames yes\n data.frame(x=1:3, y=c(\"a\",\"b\",\"c\"))\n#+END_SRC")) + + +(provide 'ess-test-org) + +;;; ess-test-org.el ends here diff -Nru ess-18.10.2/test/ess-test-rd.el ess-18.10.2+git20220915.f45542e/test/ess-test-rd.el --- ess-18.10.2/test/ess-test-rd.el 1970-01-01 00:00:00.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/test/ess-test-rd.el 2022-10-15 08:06:36.000000000 +0000 @@ -0,0 +1,68 @@ +;;; ess-test-rd.el --- ESS tests for Rd-mode -*- lexical-binding: t; -*- +;; +;; 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 +;; https://www.r-project.org/Licenses/ +;; +;;; Commentary: +;; + +(require 'ert) +(require 'etest) +(require 'ess-r-mode) +(require 'ess-test-r-utils) +(require 'ess-rd) + +;;; Code: + +(defun ess-r-test-rd-init () + (Rd-mode) + (ess-test-r-set-local-process)) + +(etest-deftest ess-rd-eval-linewise-visibly-test () + "C-c C-n always evaluates visibly. +https://github.com/emacs-ess/ESS/issues/725#issuecomment-431781558" + :init ((eval . (ess-r-test-rd-init))) + :case " +\\examples{ +¶1 +2 +3 +} +" + + (setq-local ess-eval-visibly-p 'nowait) + "C-c C-n" + :result " +\\examples{ +1 +¶2 +3 +} +" + :inf-result "1 +[1] 1 +> " + + (setq-local ess-eval-visibly-p nil) + "C-c C-n" + :result " +\\examples{ +1 +2 +¶3 +} +" + :inf-result "2 +[1] 2 +> " + ) diff -Nru ess-18.10.2/test/ess-test-r.el ess-18.10.2+git20220915.f45542e/test/ess-test-r.el --- ess-18.10.2/test/ess-test-r.el 1970-01-01 00:00:00.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/test/ess-test-r.el 2022-10-15 08:06:36.000000000 +0000 @@ -0,0 +1,913 @@ +;;; ess-test-r.el --- ESS tests for R -*- lexical-binding: t; -*- +;; +;; 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 +;; https://www.r-project.org/Licenses/ +;; +;;; Commentary: +;; + +(require 'ert) +(require 'etest) +(require 'ess-r-mode) +(require 'ess-test-r-utils) +(require 'cc-mode) +(require 'imenu) +(with-no-warnings + (when (< emacs-major-version 26) + (require 'cl))) + +;;; R + +;;; Code: + +(ert-deftest ess-r-inherits-prog-mode-test () + (let ((prog-mode-hook (lambda () (setq ess-test-prog-hook t)))) + (with-ess-test-r-file nil + (should (derived-mode-p 'prog-mode)) + (should ess-test-prog-hook) + (should + ;; Test that prog-mode-map is a keymap-parent + (let ((map (current-local-map)) + found) + (while (and map (not found)) + (if (eq (keymap-parent map) prog-mode-map) + (setq found t) + (setq map (keymap-parent map)))) + found))))) + +(ert-deftest ess-build-eval-command-R-test () + (let ((command "command(\"string\")") + (ess-dialect "R")) + (should (string= (ess-build-eval-command command) + ".ess.eval(\"command(\\\"string\\\")\", visibly = FALSE, output = FALSE)\n")) + (should (string= (ess-build-eval-command command nil t) + ".ess.eval(\"command(\\\"string\\\")\", visibly = FALSE, output = TRUE)\n")) + (should (string= (ess-build-eval-command command t t "file.ext" "foo") + ".ess.ns_eval(\"command(\\\"string\\\")\", visibly = TRUE, output = TRUE, package = 'foo', verbose = TRUE, file = 'file.ext')\n")))) + +(ert-deftest ess-build-load-command-R-test () + (let ((ess-dialect "R")) + (should (string= (ess-build-load-command "file.ext") + ".ess.source('file.ext', visibly = FALSE, output = FALSE)\n")) + (should (string= (ess-build-load-command "file.ext" t t) + ".ess.source('file.ext', visibly = TRUE, output = TRUE)\n")) + (should (string= (ess-build-load-command "file.ext" nil t "foo") + ".ess.ns_source('file.ext', visibly = FALSE, output = TRUE, package = 'foo', verbose = TRUE)\n")))) + +(ert-deftest inferior-ess-inherits-from-comint-test () + (let ((inhibit-message ess-inhibit-message-in-tests)) + (with-temp-buffer + (inferior-ess-r-mode) + ;; Derive from comint + (should (derived-mode-p 'comint-mode)) + (should + ;; Test that comint-mode-map is a keymap-parent + (let ((map (current-local-map)) + found) + (while (and map (not found)) + (if (eq (keymap-parent map) comint-mode-map) + (setq found t) + (setq map (keymap-parent map)))) + found))))) + +(ert-deftest ess-r-send-single-quoted-strings-test () + (with-r-running nil + (insert "'hop'\n") + (let (ess-eval-visibly) + (should (output= (ess-eval-buffer nil) + "[1] \"hop\""))))) + +(ert-deftest ess-r-send-double-quoted-strings-test () + (with-r-running nil + (insert "\"hop\"\n") + (let (ess-eval-visibly) + (should (output= (ess-eval-buffer nil) + "[1] \"hop\""))))) + +(ert-deftest ess-eval-line-test () + (with-r-running nil + (insert "1 + 1") + (let (ess-eval-visibly) + (should (output= (ess-eval-line) + "[1] 2"))) + (let ((ess-eval-visibly t)) + (should (output= (ess-eval-line) + "1 + 1\n[1] 2"))))) + +(ert-deftest ess-eval-region-test () + (with-r-running nil + (insert "1 + \n1") + (let (ess-eval-visibly) + (should (output= (ess-eval-region (point-min) (point-max) nil) + "+ [1] 2"))) + (let ((ess-eval-visibly t)) + (should (output= (ess-eval-region (point-min) (point-max) nil) + "1 + \n+ 1\n[1] 2"))))) + +(ert-deftest ess-eval-function () + (with-r-running nil + (let (ess-eval-visibly) + (insert "x <- function(a){\n a + 1\n}") + (forward-line -1) + (ess-eval-function) + (delete-region (progn (beginning-of-defun) (point)) + (progn (end-of-defun) (point))) + (insert "x(1)") + (should (output= (ess-eval-region (point-min) (point-max) nil) + "+ + > [1] 2"))))) + +(ert-deftest ess-r-eval-rectangle-mark-mode-test () + (with-r-running nil + (insert "x <- 1\nx\nx + 1\nx + 2\n") + (let (ess-eval-visibly) + (should (output= (progn + (goto-char (point-min)) + (transient-mark-mode) + (rectangle-mark-mode) + (forward-line 3) + (end-of-line) + (ess-eval-region-or-line-and-step)) + "> [1] 1\n> [1] 2\n> [1] 3"))))) + +(ert-deftest ess-set-working-directory-test () + (with-r-running nil + (ess-set-working-directory "/") + (ess-eval-linewise "getwd()" 'invisible) + (should (output= (ess-eval-buffer nil) + "setwd('/')\n> [1] \"/\"")) + (should (string= (ess-get-process-variable 'default-directory) "/")))) + +(ert-deftest ess-inferior-force-test () + (with-r-running nil + (should (equal (ess-get-words-from-vector "letters[1:2]\n") + (list "a" "b"))))) + +;;; Namespaced evaluation + +(ert-deftest ess-r-run-presend-hooks-test () + (with-r-running nil + (let ((ess-presend-filter-functions (list (lambda (string) "\"bar\""))) + (ess-r-evaluation-env "base") + ess-eval-visibly) + (insert "\"foo\"\n") + (should (output= (ess-eval-region (point-min) (point-max) nil) + "[1] \"bar\""))))) + +(ert-deftest ess-r-namespaced-eval-no-sourced-message-test () + (with-r-running nil + (let ((ess-r-evaluation-env "base") + ess-eval-visibly) + (insert "\"foo\"\n") + (should (output= (ess-eval-region (point-min) (point-max) nil) + "[1] \"foo\""))))) + +(ert-deftest ess-r-namespaced-eval-no-srcref-in-errors-test () + ;; Fails since https://github.com/emacs-ess/ESS/commit/3a7d913 + (when nil + (with-r-running nil + (let ((ess-r-evaluation-env "base") + (error-msg "Error: unexpected symbol") + ess-eval-visibly) + (insert "(foo bar)\n") + (let ((output (output (ess-eval-region (point-min) (point-max) nil)))) + (should (string= (substring output 0 (length error-msg)) + error-msg))))))) + + +;;; Misc + +(ert-deftest ess-r-makevars-mode-test () + (save-window-excursion + (mapc (lambda (file) + (switch-to-buffer (find-file-noselect file)) + (should (eq major-mode 'makefile-mode))) + `(,(expand-file-name "Makevars" ess-test-fixtures-directory) + ,(expand-file-name "Makevars.win" ess-test-fixtures-directory))))) + +(ert-deftest ess-find-newest-date-test () + (should (equal (ess-find-newest-date '(("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"))) + "R-dev"))) + +(defun ess-test-init-insert-assign () + (let ((map (make-sparse-keymap))) + (define-key map "_" 'ess-insert-assign) + (use-local-map map))) + +(etest-deftest ess-insert-assign-test () + "Repeated calls cycle between assignment and self-insert." + :init ((mode . r) + (eval . (ess-test-init-insert-assign))) + :case "foo¶" + "_" :result "foo <- ¶" + "_" :result "foo_¶" + "_" :result "foo_ <- ¶") + +(etest-deftest ess-insert-assign-whitespace-test () + "Whitespace is cleaned up before insertion." + :init ((mode . r) + (eval . (ess-test-init-insert-assign))) + :case "foo ¶" "_" :result "foo <- ¶" + :case "foo ¶" "_" :result "foo <- ¶") + +(etest-deftest ess-cycle-assign-test () + "Repeated calls cycle trough assignment operators." + :init ((mode . r)) + :case "foo¶" + "C-c C-=" :result "foo <- ¶" + "C-c C-=" :result "foo <<- ¶" + "C-c C-=" :result "foo = ¶" + "C-c C-=" :result "foo -> ¶" + "C-c C-=" :result "foo ->> ¶" + "C-c C-=" :result "foo <- ¶" + "C-c C-=" :result "foo <<- ¶") + +(etest-deftest ess-cycle-assign-whitespace-test () + "Whitespace is cleaned up before insertion" + :init ((mode . r)) + :case "foo ¶" + "C-c C-=" :result "foo <- ¶" + "C-c C-=" :result "foo <<- ¶" + + :case "foo ¶" + "C-c C-=" :result "foo <- ¶" + "C-c C-=" :result "foo <<- ¶") + +(ert-deftest ess-skip-thing-test () + (should (eql 18 + (ess-r-test-with-temp-text "x <- function(x){\n mean(x)\n }\n \n \n x(3)\n " + (goto-char (point-min)) + (ess-skip-thing 'line) + (point)))) + (should (eql 30 + (ess-r-test-with-temp-text "x <- function(x){\n mean(x)\n }\n \n \n x(3)\n " + (goto-char (point-min)) + (ess-skip-thing 'function) + (point)))) + (should (eql 31 + (ess-r-test-with-temp-text "x <- function(x){\n mean(x)\n }\n \n \n x(3)\n " + (goto-char (point-min)) + (ess-skip-thing 'paragraph) + (point)))) + + ;; The following fails because end-of-defun assume that beggining-of-defun + ;; always moves the pointer. We currently don't in ess-r-beginning-of-function + ;; when there is no function. This might change when we have aproper + ;; ess-r-beggining-of-defun. + ;; (should (eql 1 (ess-r-test-with-temp-text "mean(1:10)" + ;; (goto-char (point-min)) + ;; (ess-skip-thing 'function) + ;; (point)))) + ) + +(ert-deftest ess-next-code-line-test () + (should (eql 5 + (ess-r-test-with-temp-text "1+1\n#2+2\n#3+3\n4+4" + (let ((ess-eval-empty t)) + (goto-char (point-min)) + (ess-next-code-line) + (point))))) + (should (eql 15 + (ess-r-test-with-temp-text "1+1\n#2+2\n#3+3\n4+4" + (let (ess-eval-empty) + (goto-char (point-min)) + (ess-next-code-line) + (point))))) + (should (eql 5 + (ess-r-test-with-temp-text "1+1\n" + (let (ess-eval-empty) + (goto-char (point-min)) + (end-of-line) + (ess-next-code-line) + (point)))))) + +(ert-deftest ess-Rout-file-test () + (let* ((file (expand-file-name "file.Rout" ess-test-fixtures-directory)) + (buf (or (find-buffer-visiting file) + (find-file-noselect file)))) + (with-current-buffer buf + (should (eq major-mode 'ess-r-transcript-mode)) + (goto-char (point-min)) + (font-lock-default-fontify-buffer) + (should (eq (face-at-point) 'font-lock-function-name-face))))) + +(ert-deftest inferior-ess-r-fontification-test () + (with-r-running nil + (with-ess-process-buffer nil + ;; Function-like keywords + (should (eq major-mode 'inferior-ess-r-mode)) + (insert-fontified "for") + (should (not (face-at -1))) + (insert-fontified "(") + (should (eq (face-at -2) 'ess-keyword-face)) + ;; `in` keyword + (insert-fontified "foo in bar)") + (search-backward "in") + (should (eq (face-at-point) 'ess-keyword-face)) + (erase-buffer) + (insert-fontified "for foo in bar") + (search-backward "in") + (should (not (face-at-point)))))) + +;; roxy +(ert-deftest ess-roxy-preview-Rd-test () + (let ((buf (generate-new-buffer " *temp*"))) + (with-r-running buf + (if (member "roxygen2" (ess-installed-packages)) + (should + (string= "% Generated by roxygen2: do not edit by hand +\\name{add} +\\alias{add} +\\title{Add together two numbers. add(10, 1)} +\\usage{ +add(x, y) +} +\\description{ +Add together two numbers. add(10, 1) +} " + (with-current-buffer buf + (R-mode) + (ess-roxy-mode) + (insert + "##' Add together two numbers. add(10, 1) +add <- function(x, y) { + x + y +}") + (goto-char (point-min)) + (ess-roxy-preview-Rd) + ;; Delete the reference to the file which isn't + ;; reproducible across different test environments + (goto-char (point-min)) + (forward-line 1) + (kill-whole-line) + (buffer-substring-no-properties (point-min) (point-max))))) + (ert-skip "Roxygen2 not installed"))))) + +(ert-deftest ess-test-roxy-font-lock () + (ess-r-test-with-temp-text + "#' a function +#' +#' @param x the param +#' @param y the other param +my_mean <- function(x, y){ + mean(x) + mean(y) +}" + (font-lock-ensure) + (goto-char (point-min)) + (search-forward "@par") + (should (equal (face-at-point) 'font-lock-keyword-face)) + (search-forward "x") + (forward-char -1) + (should (equal (face-at-point) 'font-lock-variable-name-face)) + (search-forward "the para") + (should (equal (face-at-point) 'font-lock-comment-face))) + (ess-r-test-with-temp-text + "#' @describeIn foo +#' @export +foo <- function(x){ + mean(x) +}" + (font-lock-ensure) + (goto-char (point-min)) + (search-forward "@des") + (should (equal (face-at-point) 'font-lock-keyword-face)) + (search-forward "@exp") + (should (equal (face-at-point) 'font-lock-variable-name-face)))) + +(ert-deftest ess-roxy-get-function-args-test () + (ess-r-test-with-temp-text + "#' a function +#' +#' @param x the param +my_mean <- function(x, y){ + mean(x) + mean(y) +} + +#' another function +#' +#' @param z the param +my_mean2 <- function(z){ + mean(z) +}" + (should (equal (ess-roxy-get-function-args) '("x" "y"))) + (search-forward "param z the param") + (should (equal (ess-roxy-get-function-args) '("z"))))) + +(ert-deftest ess-roxy-update-entry-test () + (should (string= + "fun1 <- function(x) x +##' .. content for \\description{} (no empty lines) .. +##' +##' .. content for \\details{} .. +##' @title +##' @param x +##' @return +##' @author Jane Doe +fun2 <- function(x) x" + (ess-r-test-with-temp-text "fun1 <- function(x) x + +¶fun2 <- function(x) x" + (let ((ess-roxy-template-alist '(("description" . ".. content for \\description{} (no empty lines) ..") + ("details" . ".. content for \\details{} ..") + ("title" . "") + ("param" . "") + ("return" . "") + ("author" . "Jane Doe")))) + (ess-roxy-update-entry)) + (buffer-substring-no-properties (point-min) (point-max)))))) + +(ert-deftest ess-roxy-cpp-test () + ;; Test M-q + (should (string= + "//' Title +//' +//' @param Lorem ipsum dolor sit amet, consectetur adipiscing elit, +//' sed do eiusmod. +//' @param Lorem ipsum dolor sit amet, consectetur adipiscing elit, +//' sed do eiusmod. +//' @examples +//' mean() +" + (ess-cpp-test-with-temp-text + "//' Title +//' +//' @param Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod. +//' @param ¶Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod. +//' @examples +//' mean() +" + (c-fill-paragraph) + (buffer-substring-no-properties (point-min) (point-max))))) + ;; Test newline + (should (string= + "//'\n//' " + (ess-cpp-test-with-temp-text "//' ¶" + (ess-roxy-newline) + (buffer-substring-no-properties (point-min) (point-max))))) + (should (string= + "//\n" + (ess-cpp-test-with-temp-text "//¶" + (ess-roxy-newline) + (buffer-substring-no-properties (point-min) (point-max)))))) + +;; Navigation +(ert-deftest ess-r-function-beg-end-test () + (ess-r-test-with-temp-text + "x <- function(a){\n a + 1\n}" + (search-forward "(a)") + (beginning-of-defun) + (should (eql (point) 1)) + (search-forward "(a)") + (end-of-defun) + (should (eql (point) 28)))) + +(ert-deftest ess-r-beginning/defun-limits-test () + (with-ess-test-r-file (expand-file-name "navigation.R" ess-test-fixtures-directory) + (goto-char (point-min)) + (end-of-defun 1) + (should (looking-back "end of fn1\n")) + (beginning-of-defun 1) + (should (looking-at "fn1 <-")) + (beginning-of-defun -1) + (should (looking-at "fn1 <-")) + (end-of-defun 3) + (should (looking-back "end of fn3\n")) + (beginning-of-defun) + (should (looking-at "fn3 <-")) + (end-of-defun 2) + (should (looking-back "setMethod\n")) + (end-of-defun 1) + (should (looking-back "end of fn4\n")) + (beginning-of-defun 1) + (should (looking-at "fn4 <-")) + (beginning-of-defun 1) + (should (looking-at "setMethod(")) + (end-of-defun -1) + (should (looking-back "fn3\n")) + (re-search-forward "^f8 <-") + (beginning-of-line) + (end-of-defun 1) + (should (looking-back "end of f8\n")) + (end-of-defun -1) + (should (looking-back "end of f5\n")))) + +(ert-deftest ess-r-beginning/function-limits-test-1 () + (with-ess-test-r-file (expand-file-name "navigation.R" ess-test-fixtures-directory) + (goto-char (point-min)) + (ess-r-end-of-function 1) + (should (looking-at " ## end of fn1")) + (ess-r-beginning-of-function 1) + (should (looking-at "fn1 <-")) + (ess-r-beginning-of-function -1) + (should (looking-at "fn1 <-")) + (ess-r-end-of-function) + (ess-r-end-of-function) + (ess-r-end-of-function) + (should (looking-at " ## end of fn3\n")) + (ess-r-beginning-of-function) + (should (looking-at "fn3 <-")) + (ess-r-end-of-function) + (ess-r-end-of-function) + (should (looking-at " ## end of setMethod")) + (ess-r-end-of-function 1) + (should (looking-at " ## end of fn4")) + (ess-r-beginning-of-function 1) + (should (looking-at "inner_fn5 <-")) + (ess-r-beginning-of-function 1) + (should (looking-at "fn4 <-")) + (ess-r-beginning-of-function 1) + (should (looking-at "setMethod(")) + (ess-r-end-of-function -1) + (should (looking-at " ## end of fn3")))) + +(ert-deftest ess-r-beginning/function-limits-test-2 () + (with-ess-test-r-file (expand-file-name "navigation.R" ess-test-fixtures-directory) + (goto-char (point-min)) + (re-search-forward "after f5") + (ess-r-end-of-function) + (should (looking-at ".* end of f6$")) + (ess-r-end-of-function) + (should (looking-at ".* end of f7")) + + (goto-char (point-min)) + (re-search-forward "some_code6") + (ess-r-beginning-of-function) + (should (looking-at-p "f6 = function")) + (re-search-forward "some_code7") + (ess-r-beginning-of-function) + (should (looking-at-p "f7 = function")) + + (goto-char (point-min)) + (search-forward "f8 <-") + (ess-r-beginning-of-function) + (should (looking-at-p "f8 <-")) + + (goto-char (point-min)) + (search-forward "f9 <-") + (beginning-of-line 1) + (ess-r-beginning-of-function) + (should (looking-at-p "f8 <-")))) + +(ert-deftest ess-r-goto-beginning/end-of-function-or-para-test () + (with-ess-test-r-file (expand-file-name "navigation.R" ess-test-fixtures-directory) + (goto-char (point-min)) + (ess-goto-end-of-function-or-para) + (should (looking-back "fn1\n")) + (ess-goto-beginning-of-function-or-para) + (should (looking-at "fn1 <-")) + (ess-goto-end-of-function-or-para) + (ess-goto-end-of-function-or-para) + (should (looking-back "fn2\n")) + (ess-goto-end-of-function-or-para) + (should (looking-back "fn3\n")) + (ess-goto-end-of-function-or-para) + (should (looking-back "par1\n")) + (ess-goto-end-of-function-or-para) + (should (looking-back "setMethod\n")) + (ess-goto-beginning-of-function-or-para) + (should (looking-at "setMethod")) + (ess-goto-beginning-of-function-or-para) + (should (looking-at "par1 <-")) + (ess-goto-beginning-of-function-or-para) + (should (looking-at "fn3 <-")))) + +(ert-deftest ess-r-beggining/end-of-defun-ignore-inner-fn-test () + (with-ess-test-r-file (expand-file-name "navigation.R" ess-test-fixtures-directory) + (re-search-forward "fn5_body") + (beginning-of-defun) + (should (looking-at "fn4 <- ")) + (re-search-forward "fn5_body") + (end-of-defun) + (should (looking-back "fn4\n")))) + +(ert-deftest ess-r-comment-dwim-test () + "Test `comment-dwim' and Bug #434." + (let ((ess-style 'RRR)) + (ess-r-test-with-temp-text "#¶ " + (let ((ess-indent-with-fancy-comments t)) + (comment-dwim nil) + (should (eql 42 (current-column))) + (ess-indent-or-complete) + (should (eql 42 (current-column))))) + (ess-r-test-with-temp-text "#¶ " + (let ((ess-indent-with-fancy-comments nil)) + (comment-dwim nil) + (should (eql 2 (current-column))) + (ess-indent-or-complete) + (should (eql 2 (current-column))))))) + +;; imenu +(ert-deftest ess-imenu-test () + (ess-r-test-with-temp-text + " +library(knitr) +x <- function(a) mean(a) + +y = function(c){ + sum(c) +} + +the_dat <- read.csv(\"foo.csv\")" + (let ((result (funcall imenu-create-index-function))) + (should (equal (car (nth 0 result)) "Data")) + (should (equal (caadr (nth 0 result)) "the_dat")) + (should (equal (car (nth 1 result)) "Package")) + (should (equal (caadr (nth 1 result)) "knitr")) + (should (equal (car (nth 2 result)) "Functions")) + (should (equal (caadr (nth 2 result)) "x")) + (should (equal (caaddr (nth 2 result)) "y"))))) + +(ert-deftest ess-narrow-to-defun-or-para-test () + (ess-r-test-with-temp-text + "mean(1:10) + +x <- function(x){ + mean(x) +}) +" + (goto-char (point-min)) + (search-forward "mean(x)") + (ess-narrow-to-defun-or-para) + (goto-char (point-min)) + (should (looking-at-p "x <- function(x){$")))) + +(ert-deftest ess-test-r-help-mode () + (with-r-running nil + (let ((ess-pop-to-buffer t)) + (ess-display-help-on-object "plot") + (should (equal ess-help-object "plot")) + (should (derived-mode-p 'ess-r-help-mode)) + ;; Ensure help buffers after button presses are also in + ;; `ess-r-help-mode', Bug#836 + (forward-button 2) + (push-button) + (should (or (equal ess-help-object "plot.default") + (equal ess-help-object "plot"))) + (should (derived-mode-p 'ess-r-help-mode))))) + +(ert-deftest ess-test-r-index-mode () + (skip-unless (not noninteractive)) + (with-r-running nil + (let ((ess-pop-to-buffer t)) + (ess-display-package-index "stats") + (should (equal ess-help-object "stats")) + (should (derived-mode-p 'ess-r-help-mode)) + ;; Ensure help buffers after button presses are also in + ;; `ess-r-help-mode', Bug#836 + (forward-button 2) + (push-button) + (should (equal ess-help-object "plot.default")) + (should (derived-mode-p 'ess-r-help-mode))))) + +(ert-deftest ess-transcript-comint-prompt-test () + ;; Bug#853 + (insert "> set.seed(1); (i <- rnorm(7)) +[1] -0.6264538 0.1836433 -0.8356286 1.5952808 0.3295078 -0.8204684 0.4874291 +> rep(i, 3) + [1] -0.6264538 0.1836433 -0.8356286 1.5952808 0.3295078 -0.8204684 0.4874291 + [8] -0.6264538 0.1836433 -0.8356286 1.5952808 0.3295078 -0.8204684 0.4874291 +[15] -0.6264538 0.1836433 -0.8356286 1.5952808 0.3295078 -0.8204684 0.4874291 +> sum(i) +[1] 0.3133101") + (ess-r-transcript-mode) + (goto-char (point-min)) + (comint-next-prompt 1) + (should (equal (line-number-at-pos) 3))) + +(ert-deftest ess-test-r-startup-directory () + (let ((proj-dir (expand-file-name "..")) + (cur-dir (directory-file-name (expand-file-name default-directory)))) + (let ((ess-startup-directory nil)) + (with-r-running nil + (with-current-buffer (ess-get-process-buffer) + (should (string= proj-dir (directory-file-name (expand-file-name default-directory))))))) + (let ((ess-startup-directory 'default-directory)) + (with-r-running nil + (with-current-buffer (ess-get-process-buffer) + (should (string= cur-dir (directory-file-name (expand-file-name default-directory))))))))) + +(ert-deftest ess-test-r-comint-input-ring-file-name () + (let ((ess-history-file t) + (ess-startup-directory 'default-directory) ; don't start in the project + ess-history-directory) + (with-r-running nil + (should (string= (expand-file-name ".Rhistory" default-directory) + (buffer-local-value 'comint-input-ring-file-name (ess-get-process-buffer)))))) + (let ((ess-history-file "foo") + (ess-history-directory temporary-file-directory)) + (with-r-running nil + (should (string= (expand-file-name "foo" temporary-file-directory) + (buffer-local-value 'comint-input-ring-file-name (ess-get-process-buffer)))))) + (let ((ess-history-file t) + (ess-history-directory temporary-file-directory)) + (with-r-running nil + (should (string= (expand-file-name ".Rhistory" temporary-file-directory) + (buffer-local-value 'comint-input-ring-file-name (ess-get-process-buffer)))))) + (let (ess-history-file + ess-history-directory) + (with-r-running nil + (should-not (buffer-local-value 'comint-input-ring-file-name (ess-get-process-buffer)))))) + +(ert-deftest ess-test-roxy-prefix-strip () + "Only strip prefix if the whole string is prefixed (#1020)" + (let ((ess-roxy-re "^#+'")) + (should (equal (ess-roxy-remove-roxy-re "#' 1\n#' 2") + "1\n2")) + (should (equal (ess-roxy-remove-roxy-re "#' 1\n#' 2\nNULL") + "#' 1\n#' 2\nNULL")))) + +(defun ess-r-test-transcript-init () + (ess-r-transcript-mode) + (read-only-mode -1) + (ess-test-r-set-local-process)) + +(etest-deftest ess-r-transcript-motions-test () + "[enter] handles commands, non-commands, and prompts (#1013)." + :init ((eval . (ess-r-test-transcript-init))) + :case " +¶R is free software and comes with ABSOLUTELY NO WARRANTY. +You are welcome to redistribute it under certain conditions. +Type 'license()' or 'licence()' for distribution details. +" + "RET" + :result " +R is free software and comes with ABSOLUTELY NO WARRANTY. +You are welcome to redistribute it under certain conditions. +Type 'license()' or 'licence()' for distribution details. +¶" + + :inf-result " +> " + + :messages "No command at this point" + + :case " +> ¶for(i in 1:3) { ++ print(i) ++ } +[1] 1 +[1] 2 +[1] 3 +" + "RET" + :result " +> for(i in 1:3) { ++ print(i) ++ } +[1] 1 +[1] 2 +[1] 3 +¶" + + :inf-result "for(i in 1:3) { ++ print(i) ++ } +[1] 1 +[1] 2 +[1] 3 +> ") + +(etest-deftest ess-r-eval-linewise-visibly-test () + "C-c C-n always evaluates visibly. +https://github.com/emacs-ess/ESS/issues/725#issuecomment-431781558" + :init ((mode . r) + (eval . (ess-test-r-set-local-process))) + :case " +¶1 +2 +3 +" + + (setq-local ess-eval-visibly-p 'nowait) + "C-c C-n" + :result " +1 +¶2 +3 +" + :inf-result "1 +[1] 1 +> " + + (setq-local ess-eval-visibly-p nil) + "C-c C-n" + :result " +1 +2 +¶3 +" + :inf-result "2 +[1] 2 +> ") + +(ert-deftest ess-r-commands-test () + "M-x R works (#1035)" + (should (commandp 'R)) + (should (commandp 'R-newest))) + +(etest-deftest ess-command-last-value-test () + "`ess-command` preserves `.Last.value (#1058)" + :case "100¶" + "C-c C-c" + :inf-result "100 +[1] 100 +> " + :case ".Last.value¶" + "C-c C-c" + :inf-result ".Last.value +[1] 100 +> " + (ess-command "-1\n") + :case ".Last.value¶" + "C-c C-c" + :inf-result ".Last.value +[1] 100 +> ") + +(etest-deftest ess-r-pager-test () + (should (string= (car (ess-get-words-from-vector "getOption('pager')\n")) + "cat"))) + +;; rdired + +(require 'ess-rdired) + +(etest-deftest ess-rdired-test () + :inf-cleanup + (progn + (kill-buffer ess-rdired-buffer) + (ess-command "rm(my_rdired_variable, envir = globalenv())\n")) + + (ess-command "assign('my_rdired_variable', TRUE, envir = globalenv())\n") + (save-window-excursion + (ess-rdired)) + (with-current-buffer ess-rdired-buffer + (goto-char (point-min)) + (should (re-search-forward "my_rdired_variable" nil t)))) + +;; help + +(ert-deftest ess-help-get-pkg-from-help-path-test () + "Handles packages with `.` in name (#1101)." + (should (string= (ess-r-help--get-pkg-from-help-path "~/library/4.0/data.table/help/data.table") + "data.table"))) + +;; Utils for inferior R process + +(ert-deftest ess-mock-remote-process () + ;; Check that our test is doing what we think it should, namely that it is + ;; creating a mock remote process (i.e. a test of our test setup) + (with-ess-test-r-file (ess-test-create-remote-path "dummy-pkg/R/test.R") + (with-r-running (current-buffer) + (should (file-remote-p (ess-get-process-variable 'default-directory)))) + (kill-buffer))) + +;; The assertions in this test do NOT require an internet connection +(ert-deftest ess-r-load-ESSR-github-fetch-no () + ;; Local ESSR load + (ess--essr-load-or-throw-error "dummy-pkg/R/test.R" + #'ess-r--load-ESSR-local) + ;; Remote ESSR injection through process connection + (ess--essr-load-or-throw-error (ess-test-create-remote-path "dummy-pkg/R/test.R") + #'ess-r--load-ESSR-remote)) + +;; The assertions in this test DO require an internet connection +(ert-deftest ess-r-load-ESSR-github-fetch-yes () + ;; Skip test when performing as part of the CI + (when (equal (getenv "TRAVIS") "true") + (ert-skip "Running on TRAVIS")) + (let* ((remote-file-path (ess-test-create-remote-path "dummy-pkg/R/test.R")) + (essr-nm (concat "ESSRv" essr-version ".rds")) + (essr-path (expand-file-name essr-nm "~/.config/ESSR"))) + ;; Ensure that ESSR doesn't currently exist on the machine which in turn + ;; ensures that a GitHub fetch will be required to load ESSR. Note that for + ;; Emacs <= 25 `delete-file' throws an error if the file doesn't exist. + (ignore-errors (delete-file essr-path)) + ;; Remote ESSR load through GitHub fetch + (ess--essr-load-or-throw-error remote-file-path #'ess-r--fetch-ESSR-remote) + ;; ESSR has already been loaded on the remote machine, so this time the + ;; function doesn't make a GitHub fetch + (should (file-exists-p essr-path)) + (ess--essr-load-or-throw-error remote-file-path #'ess-r--fetch-ESSR-remote))) + +(provide 'ess-test-r) + + +;; Local Variables: +;; etest-local-config: etest-r-config +;; End: + +;;; ess-test-r.el ends here diff -Nru ess-18.10.2/test/ess-test-r-eval.el ess-18.10.2+git20220915.f45542e/test/ess-test-r-eval.el --- ess-18.10.2/test/ess-test-r-eval.el 1970-01-01 00:00:00.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/test/ess-test-r-eval.el 2022-10-15 08:06:36.000000000 +0000 @@ -0,0 +1,274 @@ +;;; ess-test-rd.el --- ESS tests for Rd-mode -*- lexical-binding: t; -*- +;; +;; 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 +;; https://www.r-project.org/Licenses/ +;; +;;; Commentary: +;; + +(require 'ert) +(require 'etest) +(require 'ess-r-mode) +(require 'ess-test-r-utils) + +;; Make sure inferiors have been loaded so that messages etc. do not +;; interfere with the tests +(ess-r-test-proc-buf 'output) +(ess-r-test-proc-buf 'tracebug) + +(etest-deftest ess-r-eval-visibility-eval-standard-filter-test () + "`ess-eval-region' respects `ess-eval-visibly'. +Standard filter." + :init ((mode . r) + (ess-eval-deactivate-mark . nil) + (eval . (ess-test-r-set-local-process 'output))) + + :case " +¶1 +2 +{ + 3 + 4 +} +5; 6× +" + + (setq-local ess-eval-visibly t) + "C-c C-r" + + :inf-result "1 +[1] 1 +> 2 +[1] 2 +> { ++ 3 ++ 4 ++ } +[1] 4 +> 5; 6 +[1] 5 +[1] 6 +> " + + (setq-local ess-eval-visibly 'nowait) + "C-c C-r" + + :inf-result "1 ++ 2 ++ { ++ 3 ++ 4 ++ } ++ 5; 6 +[1] 1 +> [1] 2 +> + + + [1] 4 +> [1] 5 +[1] 6 +> " + + (setq-local ess-eval-visibly nil) + "C-c C-r" + + :inf-result "[1] 1 +> [1] 2 +> + + + [1] 4 +> [1] 5 +[1] 6 +> ") + +(etest-deftest ess-r-eval-visibility-eval-test () + "`ess-eval-region' respects `ess-eval-visibly'. +Default filter" + :init ((mode . r) + (eval . (ess-test-r-set-local-process 'tracebug)) + (ess-eval-deactivate-mark . nil)) + + :case " +¶1 +2 +{ + 3 + 4 +} +5; 6× +" + + ;; 'nowait curiously causes sporadic failures with the { block + ;; output. The number of continuation `+` varies. The chance of + ;; failure increases when input has already been sent to the + ;; process. Probably because of the special `nowait` handling in the + ;; tracebug filter. + + ;; (setq-local ess-eval-visibly 'nowait) + ;; "C-c C-r" + ;; :inf-result "1 + ;; + 2 + ;; + { + ;; + 3 + ;; + 4 + ;; + } + ;; + 5; 6 + ;; [1] 1 + ;; > [1] 2 + ;; > + + + [1] 4 + ;; > [1] 5 + ;; [1] 6 + ;; > " + + (setq-local ess-eval-visibly t) + "C-c C-r" + + :inf-result "1 +[1] 1 +> 2 +[1] 2 +> { ++ 3 ++ 4 ++ } +[1] 4 +> 5; 6 +[1] 5 +[1] 6 +> " + + (setq-local ess-eval-visibly nil) + "C-c C-r" + + :inf-result "[1] 1 +> [1] 2 +> + + + [1] 4 +> [1] 5 +[1] 6 +> ") + +(etest-deftest ess-r-eval-ns-env-roxy-standard-test () + "Roxygen blocks are not evaluated in current eval-env (#1026). +Standard filter." + :init ((mode . r) + (ess-r-evaluation-env . "base") + (eval . (ess-test-r-set-local-process 'output))) + + :case "#' ¶identical(environment(), globalenv())" + + "C-c C-j" + :inf-result "identical(environment(), globalenv()) +[1] TRUE +> " + ;; Shouldn't mention "[base]" + :messages "Starting evaluation... +Loading line: #' identical(environment(), globalenv())" + + :case " +#' ¶identical(environment(), globalenv()) +NULL×" + + "C-c C-r" + :inf-result "+ > identical(environment(), globalenv()) +[1] FALSE +> NULL +NULL +> " + ;; Mentions "[base]" + :messages "Starting evaluation... +[base] Eval region") + +(etest-deftest ess-r-eval-ns-env-roxy-tracebug-test () + "Roxygen blocks are not evaluated in current eval-env (#1026). +Tracebug filter." + :init ((mode . r) + (eval . (ess-test-r-set-local-process 'tracebug)) + (ess-r-evaluation-env . "base") + (ess-eval-visibly . nil)) + :case "#' ¶identical(environment(), globalenv())" + + "C-c C-j" + :inf-result "[1] TRUE +> " + ;; Shouldn't mention "[base]" + :messages "Starting evaluation... +Loading line: #' identical(environment(), globalenv())" + + :case " +#' ¶identical(environment(), globalenv()) +NULL×" + + "C-c C-r" + :inf-result "+ [1] FALSE +NULL +> " + ;; Mentions "[base]" + :messages "Starting evaluation... +[base] Eval region") + +(ert-deftest ess-rd-eval-ns-env-test () + "Namespaced eval is disabled in doc files (#1026)." + (with-temp-buffer + (find-file-noselect "dummy-pkg/man/doc.Rd") + (Rd-mode) + (should (not ess-r-evaluation-env)))) + +(etest-deftest ess-r-eval-sink-freeze-test () + "Completions don't freeze Emacs when output is sinked. +TODO: Install company-mode dependency in CI." + :init ((mode . r) + (eval ess-test-r-set-local-process)) + + :inf-cleanup + (process-send-string + ess-local-process-name + "if (sink.number() != 0) sink(NULL)\n") + + :case " + ¶file <- tempfile() + sink(file)×" + + (setq-local ess-eval-visibly t) + "C-c C-r" + :inf-result "file <- tempfile() +> sink(file) +> " + + (should (equal (ess-get-words-from-vector "letters[1:3]\n") + '("a" "b" "c"))) + :inf-result "" + + :case "si¶" + (when (require 'company nil 'noerror) + (company-complete-common)) + :inf-result "" + + :case "¶{ + sink(NULL) + if (length(readLines(file))) + stop('sinked output should be empty') + unlink(file) + rm(file) +}×" + + (setq-local ess-eval-visibly nil) + "C-c C-r" + :inf-result "+ + + + + + > ") + +(etest-deftest ess-string-command-test () + "`ess-string-command` handles multiline outputs (#922)." + (should (string= (ess-string-command "quote({ 1 })\n") + "{\n 1\n}")) + (should (string= (ess-string-command "list(1)\n") + "[[1]]\n[1] 1\n"))) + + +;; Local Variables: +;; etest-local-config: etest-r-config +;; End: diff -Nru ess-18.10.2/test/ess-test-r-mode.el ess-18.10.2+git20220915.f45542e/test/ess-test-r-mode.el --- ess-18.10.2/test/ess-test-r-mode.el 1970-01-01 00:00:00.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/test/ess-test-r-mode.el 2022-10-15 08:06:36.000000000 +0000 @@ -0,0 +1,30 @@ +;;; ess-test-r-mode.el --- ESS tests for R mode -*- lexical-binding: t; -*- +;; +;; 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 +;; https://www.r-project.org/Licenses/ +;; +;;; Commentary: +;; + +(etest-deftest test-ess-inferior-r-backticked () + "Backticked symbols are not fontified as strings." + :case "¶`f¶oo¶`" + (setq-local font-lock-syntactic-face-function + 'inferior-ess-r-font-lock-syntactic-face-function) + (font-lock-ensure) + (should (not (face-at-point)))) + + +;; Local Variables: +;; etest-local-config: etest-r-config +;; End: diff -Nru ess-18.10.2/test/ess-test-r-package.el ess-18.10.2+git20220915.f45542e/test/ess-test-r-package.el --- ess-18.10.2/test/ess-test-r-package.el 1970-01-01 00:00:00.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/test/ess-test-r-package.el 2022-10-15 08:06:36.000000000 +0000 @@ -0,0 +1,126 @@ +;;; ess-test-r-package.el --- ESS tests for R package functionality -*- lexical-binding: t; -*- +;; +;; 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 +;; https://www.r-project.org/Licenses/ +;; +;;; Commentary: +;; + +(require 'ert) +(require 'ess-r-mode) +(require 'ess-r-package) +(require 'ess-test-r-utils) + +;;; Code: + +(ert-deftest ess-r-package-auto-activation-test () + (let ((inhibit-message ess-inhibit-message-in-tests)) + (with-temp-buffer + (text-mode) + (hack-local-variables) + (should (not ess-r-package-mode))) + (with-ess-test-r-file "dummy-pkg/R/test.R" + (hack-local-variables) + (should ess-r-package-mode)))) + +(ert-deftest ess-r-package-auto-activation-in-shell-test () + (skip-unless (executable-find "bash")) + (let ((inhibit-message ess-inhibit-message-in-tests) + (kill-buffer-query-functions nil) + (explicit-shell-file-name "bash") + (explicit-bash-args '("--noediting" "-i" "--norc" "--noprofile"))) + (with-ess-test-r-file "dummy-pkg/R/test.R" + (shell) + (should ess-r-package-mode) + (kill-buffer)) + (with-ess-test-r-file "dummy-pkg/R/test.R" + (let ((ess-r-package-auto-activate t)) + (shell) + (should ess-r-package-mode)) + (kill-buffer)))) + +(ert-deftest ess-r-package-auto-no-activation-in-shell-test () + ;; FIXME: This test fails in batch in Emacs 27. + (skip-unless (and (>= 27 emacs-major-version) + (not noninteractive) + (executable-find "bash"))) + (let ((kill-buffer-query-functions nil) + (explicit-shell-file-name "bash") + (explicit-bash-args '("--noediting" "-i" "--norc" "--noprofile"))) + (with-ess-test-r-file "dummy-pkg/R/test.R" + (let ((ess-r-package-exclude-modes '(shell-mode))) + (shell) + (should (not ess-r-package-mode)) + (kill-buffer))) + (with-ess-test-r-file "dummy-pkg/R/test.R" + (let ((ess-r-package-auto-activate nil)) + (shell) + (should (not ess-r-package-mode)) + (kill-buffer))))) + +(ert-deftest ess-r-package-vars-test () + (with-ess-test-c-file "dummy-pkg/src/test.c" + (let* ((inf-buf (run-ess-test-r-vanilla)) + (inf-proc (get-buffer-process inf-buf)) + (ess-local-process-name (process-name inf-proc))) + (ess-test-unwind-protect inf-buf + (let ((r-setwd-cmd (cdr (assq 'ess-setwd-command ess-r-customize-alist))) + (r-getwd-cmd (cdr (assq 'ess-getwd-command ess-r-customize-alist)))) + (should (string= ess-setwd-command r-setwd-cmd)) + (should (string= ess-getwd-command r-getwd-cmd))) + (let ((pkg-dir (file-truename (cdr (ess-r-package-project)))) + ;; Not sure why this is needed: + ess-ask-for-ess-directory) + (ess-set-working-directory (expand-file-name "src" pkg-dir)) + (ess-r-package-use-dir) + (should (string= pkg-dir (file-truename + (directory-file-name + (ess-get-process-variable 'default-directory))))) + (ess-wait-for-process) + (should (string= pkg-dir (file-truename (ess-get-working-directory)))) + (ess-wait-for-process) + (inferior-ess-reload) + (should (string-match "Process R\\(:.\\)? \\(finished\\|killed\\)" + (with-current-buffer inf-buf + (buffer-string))))))))) + +(ert-deftest ess-r-package-package-info-test () + (let ((kill-buffer-query-functions nil) + (ess-r-package-auto-activate nil)) + (with-ess-test-r-file "dummy-pkg/R/test.R" + (let ((pkg-info (ess-r-package-info))) + (should (string= (plist-get pkg-info :name) "foo")) + (should (string-match-p "dummy-pkg$" (plist-get pkg-info :root))) + (kill-buffer))) + (with-ess-test-c-file "dummy-pkg/src/test.c" + (let ((pkg-info (ess-r-package-info))) + (should (string= (plist-get pkg-info :name) "foo")) + (should (string-match-p "dummy-pkg$" (plist-get pkg-info :root))) + (kill-buffer))))) + + +;;; Project Tests +(ert-deftest ess-r-project-auto-activation-test () + (let ((inhibit-message ess-inhibit-message-in-tests) + (root (expand-file-name "dummy-pkg"))) + (with-ess-test-r-file "dummy-pkg/R/test.R" + (should (equal (ess-r-project-info) + (list :name "dummy-pkg" :root root))) + (should (equal (cdr (ess-r-project)) root))) + (should (not (ess-r-project-info "~"))) + (should (not (ess-r-project "~"))))) + + +(provide 'ess-test-r-package) + +;;; ess-test-r-package.el ends here diff -Nru ess-18.10.2/test/ess-test-r-syntax.el ess-18.10.2+git20220915.f45542e/test/ess-test-r-syntax.el --- ess-18.10.2/test/ess-test-r-syntax.el 1970-01-01 00:00:00.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/test/ess-test-r-syntax.el 2022-10-15 08:06:36.000000000 +0000 @@ -0,0 +1,97 @@ +;;; ess-test-r-tokens.el --- ESS tests for R tokens -*- lexical-binding: t; -*- +;; +;; 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 +;; https://www.r-project.org/Licenses/ +;; +;;; Commentary: +;; + +(require 'ert) +(require 'etest) +(require 'ess-r-mode) +(require 'ess-test-r-utils) + +(etest-deftest ess-r-syntax-backslash-test () + :case "sapply(x, ¶\\(y) y" + (should (equal (syntax-after (point)) + (string-to-syntax "."))) + :case "c(\"¶\\\"\")" + (should (equal (syntax-after (point)) + (string-to-syntax "\\")))) + +(etest-deftest ess-r-font-lock-boolean-operator-test () + :case "foo ¶| foo ¶|¶| foo ¶& foo ¶&¶& foo" + (ess-with-enabled-font-lock-keyword 'ess-fl-keyword:operators + (font-lock-ensure) + (should (eq (face-at-point) 'ess-operator-face)))) + +(etest-deftest ess-r-font-lock-pipe-operator-test () + :case "a ¶|¶> b" + (ess-with-enabled-font-lock-keyword 'ess-fl-keyword:operators + (font-lock-ensure) + (should (eq (face-at-point) 'ess-operator-face)))) + +(etest-deftest ess-r-tokens-pipe-operator-test () + :case "a ¶|> b" + (should (token= "|>")) + :result "a |>¶ b") + +(etest-deftest ess-r-raw-strings-test () + :case " +r¶\"(foo\"bar))¶\" +r¶\"(foo}\"bar))¶\" +r¶\"(foo)'bar))¶\" +r¶\"---[foo\"bar]---¶\" +r¶\"---[foo\"bar]--\"baz]---¶\" +r¶'{foo'bar}¶' +r¶\"---{foobar}-\\--\" +" + (should (equal (syntax-after (point)) + (string-to-syntax "|"))) + + :case " +r\"¶(foo\"¶bar))¶\" +r\"¶(foo}\"¶bar))¶\" +r\"¶(foo)'¶bar))¶\" +r\"¶---[foo\"¶bar]---¶\" +r\"¶---[foo\"¶bar]--\"¶baz]---¶\" +r'¶{foo'¶bar}¶' +r\"¶---{foobar}¶-\\--\"¶ +" + (should (ess-inside-string-p)) + + :case " +¶r\"(foo\"bar))\"¶, +¶r\"(foo}\"bar))\"¶, +¶r\"(foo)'bar))\"¶, +¶r\"---[foo\"bar]---\"¶, +¶r\"---[foo\"bar]--\"baz]---\"¶, +¶r'{foo'bar}'¶, +¶r\"---{foobar}-\\--\" +" + (should (not (ess-inside-string-p))) + + :case "r\"(foor\"()\"ba¶r))\"" + (should (not (ess-inside-string-p))) + + :case " +r\"(foor¶'()¶'bar))\" +# r¶\"{foo}¶\" +" + (should (not (equal (syntax-after (point)) + (string-to-syntax "|"))))) + + +;; Local Variables: +;; etest-local-config: etest-r-config +;; End: diff -Nru ess-18.10.2/test/ess-test-r-utils.el ess-18.10.2+git20220915.f45542e/test/ess-test-r-utils.el --- ess-18.10.2/test/ess-test-r-utils.el 1970-01-01 00:00:00.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/test/ess-test-r-utils.el 2022-10-15 08:06:36.000000000 +0000 @@ -0,0 +1,424 @@ +;; ess-test-r-utils.el --- Various utilities for ess R tests -*- lexical-binding: t; -*- +;; +;; 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 +;; https://www.r-project.org/Licenses/ +;; +;;; Commentary: +;; Various utilities for ESS tests. + +;;; Code: +(require 'ert) +(require 'etest) +(require 'ess-r-mode) +(require 'tramp) +(require 'seq) + +(defvar etest-r-config + '(:init ((mode . r) + (eval . (ess-test-r-set-local-process))))) + +(defvar ess-test-fixtures-directory + (expand-file-name "fixtures" + (file-name-directory (or load-file-name + buffer-file-name))) + "Location of the fixtures directory.") + +(defvar ess-inhibit-message-in-tests nil) + +(defmacro with-ess-test-file (file &rest body) + (declare (indent 1) (debug (&rest body))) + `(let ((inhibit-message ess-inhibit-message-in-tests) + (*file* ,file)) + (save-window-excursion + (set-buffer (if *file* + (find-file-noselect *file*) + (generate-new-buffer " *with-r-file-temp*"))) + ,@body))) + +(defmacro with-ess-test-r-file (file &rest body) + (declare (indent 1) (debug (sexp body))) + `(with-ess-test-file ,file + (R-mode) + ,@body)) + +(defmacro with-ess-test-c-file (file &rest body) + (declare (indent 1) (debug (sexp body))) + `(with-ess-test-file ,file + (c-mode) + ,@body)) + +;; Borrowed from org +(defmacro ess-r-test-with-temp-text (text &rest body) + "Run body in a temporary buffer with `ess-r-mode' as the active +mode holding TEXT. If the string \"¶\" appears in TEXT +then remove it and place the point there before running BODY, +otherwise place the point at the beginning of the inserted text." + (declare (indent 1) (debug (form body))) + `(let ((inside-text (if (stringp ,text) ,text (eval ,text))) + (ess-r-mode-hook nil)) + (with-temp-buffer + (ess-r-mode) + (let ((point (string-match "¶" inside-text))) + (if point + (progn + (insert (replace-match "" nil nil inside-text)) + (goto-char (1+ (match-beginning 0)))) + (insert inside-text) + (goto-char (point-min)))) + ,@body))) + +(defmacro ess-cpp-test-with-temp-text (text &rest body) + "Run body in a temporary buffer with `cpp-mode' as the active +mode holding TEXT. Turn on `ess-roxy-mode'. If the string \"¶\" +appears in TEXT then remove it and place the point there before +running BODY, otherwise place the point at the beginning of the +inserted text." + (declare (indent 1) (debug (form body))) + `(let ((inside-text (if (stringp ,text) ,text (eval ,text))) + (c++-mode-hook nil)) + (with-temp-buffer + (c++-mode) + (ess-roxy-mode) + (let ((point (string-match "¶" inside-text))) + (if point + (progn + (insert (replace-match "" nil nil inside-text)) + (goto-char (1+ (match-beginning 0)))) + (insert inside-text) + (goto-char (point-min)))) + ,@body))) + +(defun run-ess-test-r-vanilla () + "Start vanilla R process and return the process object." + (save-window-excursion + (let ((inhibit-message ess-inhibit-message-in-tests) + (ess-ask-for-ess-directory nil)) + (R "--no-init-file --no-site-file")))) + + +(let ((inf-bufs '((output . nil) + (tracebug . nil)))) + (defun ess-r-test-proc-buf--init (type) + (setf (cdr (assq type inf-bufs)) + (run-ess-test-r-vanilla)) + (let* ((inf-buf (cdr (assq type inf-bufs))) + (inf-proc (get-buffer-process inf-buf)) + (inf-filter (pcase type + (`output 'inferior-ess-output-filter) + (`tracebug 'inferior-ess-tracebug-output-filter) + (_ (error "Unknown filter type"))))) + (ess-wait-for-process (get-buffer-process inf-buf)) + (set-process-filter inf-proc inf-filter) + (with-current-buffer inf-buf + ;; Replacing strings of " +" causes random failures, probably + ;; because of the buffered output + (setq-local inferior-ess-replace-long+ nil) + (let ((inhibit-read-only t)) + (erase-buffer))) + inf-buf)) + + (defun ess-r-test-proc-buf (type &optional force) + "Common process buffer for tests." + (or (unless force + (cdr (assq type inf-bufs))) + (ess-r-test-proc-buf--init type)))) + +(defun ess-send-input-to-R (input &optional type) + "Eval INPUT and return the entire content of the REPL buffer. +TYPE can be one of 'string, 'region 'c-c or 'repl. If nil or +'string, use `ess-send-string' (lowest level primitive); if +'region use `ess-eval-region' if 'c-c use +`ess-eval-region-or-function-or-paragraph' which is by default +bound to C-c C-c; if 'repl, eval interactively at the REPL. All +prompts in the output are replaced with '> '. There is no full +proof way to test for prompts given that process output could be +split arbitrary." + (let* ((prompt-regexp "^\\([+.>] \\)\\{2,\\}") + (inf-buf (run-ess-test-r-vanilla)) + (inf-proc (get-buffer-process inf-buf)) + (inhibit-message ess-inhibit-message-in-tests)) + ;; just in case + (ess-wait-for-process inf-proc) + (ess--flush-accumulated-output inf-proc) + (ess-test-unwind-protect inf-buf + (with-current-buffer (process-buffer inf-proc) + (let ((inhibit-read-only t)) + (erase-buffer) + ;; (switch-to-buffer (current-buffer)) ; for debugging + (cond + ((or (null type) (eq type 'string)) + (ess-send-string inf-proc input)) + ((eq type 'repl) + (insert input) + (inferior-ess-send-input)) + ((or (eq type 'region) + (eq type 'c-c)) + (with-temp-buffer + (insert input) + (goto-char (point-min)) + (R-mode) + (setq ess-current-process-name (process-name inf-proc)) + (if (eq type 'region) + (ess-eval-region (point-min) (point-max) nil) + (ess-eval-region-or-function-or-paragraph nil)))) + (t (error "Invalid TYPE parameter"))) + (process-send-string inf-proc "cat('END')\n") + ;; wait till we have our end marker + (while (not (looking-back "\n?END> " nil t)) + (sleep-for 0.01) + (goto-char (point-max))) + ;; remove END> + (delete-region (match-beginning 0) (match-end 0)) + ;; (buffer-substring-no-properties (point-min) (point-max)) + (replace-regexp-in-string + prompt-regexp "> " + (buffer-substring-no-properties (point-min) (point-max)))))))) + + +(defun ess-test-R-indentation (file style) + (let ((ess-style-alist ess-test-style-alist) + (buff (find-file-noselect file t t)) + (inhibit-message ess-inhibit-message-in-tests)) + (with-current-buffer buff + (R-mode) + (ess-set-style style) + (set-buffer-modified-p nil) + (should (not-change-on-indent buff))))) + +;; !!! NB: proc functionality from now on uses inferior-ess-ordinary-filter and +;; !!! *proc* dynamic var +(defmacro with-r-running (buffer-or-file &rest body) + "Run BODY within BUFFER-OR-FILE with attached R process. +If BUFFER-OR-FILE is a file, the file is visited first. The R +process is run with `inferior-ess-ordinary-filter' which is not +representative to the common interactive use with tracebug on." + (declare (indent 1) (debug (form body))) + `(let* ((inhibit-message ess-inhibit-message-in-tests) + (buffer-or-file ,buffer-or-file) + (r-file-buffer (cond ((bufferp buffer-or-file) + buffer-or-file) + ((stringp buffer-or-file) + (find-file-noselect buffer-or-file)) + (t + (generate-new-buffer " *with-r-file-temp*"))))) + (save-window-excursion + (switch-to-buffer r-file-buffer) + (R-mode) + (let* ((*proc* (get-buffer-process (run-ess-test-r-vanilla))) + (ess-local-process-name (process-name *proc*)) + (*inf-buf* (process-buffer *proc*))) + (unwind-protect + (ess-test-unwind-protect *inf-buf* + (setq ess-r-tests-current-output-buffer *inf-buf*) + (let ((inhibit-read-only t)) + (with-current-buffer ess-r-tests-current-output-buffer + (erase-buffer))) + (set-process-filter *proc* 'inferior-ess-output-filter) + (prog1 (progn ,@body) + (ess-wait-for-process *proc*))) + (setq ess-r-tests-current-output-buffer nil)))))) + +(defvar ess-r-tests-current-output-buffer nil) + +;; The following retrieve the last output and clean the output +;; buffer. This is useful to continue testing without restarting a +;; fresh R session. + +;; In case of other side effects than mere output, it's probably safer +;; to perform ulterior tests with a fresh R to avoid contaminating +;; them. + +(defmacro output (&rest body) + (declare (indent 1) (debug (&rest body))) + `(progn + (ess-wait-for-process *proc*) + ,@body + (ess-wait-for-process *proc*) + (with-current-buffer ess-r-tests-current-output-buffer + (ess-kill-last-line) + (prog1 (buffer-substring-no-properties (point-min) (point-max)) + (erase-buffer))))) + +(defmacro output= (body expected) + (declare (indent 0) (debug (sexp sexp))) + `(progn + (let ((output (output ,body)) + (expected (eval ,expected))) + (if (string= output expected) + output + ;; Probably a better way but this gets the job done + (signal 'ert-test-failed (list (concat "Expected: \n" expected) + (concat "Result: \n" output))))))) + +(defun face-at (point) + (save-excursion + (if (>= point 0) + (goto-char point) + (forward-char point)) + (get-char-property (point) 'face))) + +(defun insert-fontified (&rest args) + (apply #'insert args) + (font-lock-default-fontify-buffer)) + +(defmacro ess-test-sleep-while (test seconds timeout &optional msg) + `(let ((_seconds ,seconds) + (_timeout ,timeout) + (_time-start (current-time))) + (while ,test + (when (time-less-p _timeout (time-subtract (current-time) _time-start)) + (error (or ,msg "Exceeded timeout"))) + (sleep-for _seconds)) + t)) + +;; It is safer to kill the buffer synchronously, otherwise it might be +;; reused in another test +(defmacro ess-test-unwind-protect (inf-buf &rest body) + (declare (indent 1)) + `(unwind-protect (progn ,@body) + (let* ((inf-buf ,inf-buf) + (inf-proc (get-buffer-process inf-buf))) + (when (and inf-proc (process-live-p inf-proc)) + (set-process-query-on-exit-flag inf-proc nil) + (kill-process inf-proc) + (ess-test-sleep-while (process-live-p inf-proc) 0.001 1 + "Expected dead process")) + (kill-buffer inf-buf)))) + +(defun ess-test-r-set-local-process (&optional type) + (let* ((proc-buf (ess-r-test-proc-buf (or type 'tracebug))) + (proc (get-buffer-process proc-buf))) + (unless proc + (ess-r-test-proc-buf (or type 'tracebug) 'force) + (error "process for unit tests died unexpectedly in a previous test and was just relaunched")) + (setq ess-local-process-name (process-name (get-buffer-process proc-buf))) + (setq etest-local-inferior-buffer proc-buf))) + +;; Utilities for testing remote functionality + +;; Define a mock TRAMP method to use for testing. This code is taken from +;; `tramp-tests.el'. +(add-to-list + 'tramp-methods + '("mock" + (tramp-login-program "sh") + (tramp-login-args (("-i"))) + (tramp-direct-async-args (("-c"))) + (tramp-remote-shell "/bin/sh") + (tramp-remote-shell-args ("-c")) + (tramp-connection-timeout 10))) + +(defun ess-test-create-remote-path (path) + "Construct a remote path using the 'mock' TRAMP method. +Take a string PATH representing a local path, and construct a +remote path that uses the 'mock' TRAMP method." + (let ((full-path (abbreviate-file-name (expand-file-name path)))) + (concat "/mock::" full-path))) + +;; Utilities for testing ESSR injection + +(defun ess--essr-remove () + "Ensure that ESSR objects are removed. +Note that if `ess--essr-detach' is successful then it is critical +that we don't run `ess--essr-remove-global-objs' because +.ess.command doesn't exist in the R runtime environment (and +which is relied upon by `ess-command')." + (or (ess--essr-detach) + (ess--essr-remove-global-objs))) + +(defun ess--essr-detach () + "Ensure that ESSR is not attached." + (ess-boolean-command "tryCatch({detach('ESSR'); 'TRUE'}, error = function(e) 'FALSE')\n")) + +(defun ess--essr-remove-global-objs () + "Ensure that all ESSR objects are removed from the global env." + (ess-command "rm(list = grep('\\\\.(ess|ESS)', ls(all.names = TRUE), value = TRUE))\n")) + +(defun ess--essr-check-if-attached () + "Check whether ESSR is attached to the search path." + (let ((attached-nms (ess-get-words-from-vector "search()\n"))) + (seq-some (lambda (str) (string= str "ESSR")) attached-nms))) + +(defun ess--essr-check-if-in-globalenv () + "Check whether any ESSR objects are in the global env." + (let* ((r-input "grep('\\\\.(ess|ESS)', ls(all.names = TRUE), value = TRUE)\n") + (output-list (ess-get-words-from-vector r-input))) + (> (length output-list) 0))) + +(defun ess--essr-check-if-in-essrenv () + "Check whether any ESSR objects are in the ESSR env." + (let* ((r-input "grep('\\\\.(ess|ESS)', ls('ESSR', all.names = TRUE), value = TRUE)\n") + (output-list (ess-get-words-from-vector r-input))) + (> (length output-list) 0))) + +(defun ess--essr-load-or-throw-error (file ess-r--load-ESSR-fcn) + "Attempt to attach the ESSR environment. +Throws an error if unsuccesful." + (with-ess-test-r-file file + (with-r-running (current-buffer) + ;; ensure that there is no ESSR environment nor any ESSR objects in the + ;; global environment + (ess--essr-remove) + ;; inject environment and attach + (ess-r--without-format-command (funcall ess-r--load-ESSR-fcn)) + ;; check for successful ESSR injection + (should (not (ess--essr-check-if-in-globalenv))) + (should (ess--essr-check-if-attached)) + (should (ess--essr-check-if-in-essrenv))) + (kill-buffer))) + +(defun token= (type &optional value) + "Check that the next token conforms to TYPE and VALUE. +This checks it back and forth and moves the point after the +token." + (and (ess-jump-token type value) + (ess-token-before= type value))) + +(defmacro ess-with-toggled-font-lock-keyword (enable keywords &rest body) + (declare (indent 2) + (debug (&rest form))) + `(progn + (let* ((enable ,enable) + (keywords ,keywords) + (keywords (if (listp keywords) + keywords + (list keywords))) + toggled) + (mapc (lambda (kw) + (if (not (eq enable (cdr (assq kw ess-R-font-lock-keywords)))) + (progn + (ess-font-lock-toggle-keyword kw) + (push kw toggled)))) + keywords) + ,@body + (mapc #'ess-font-lock-toggle-keyword + toggled)))) + +(defmacro ess-with-disabled-font-lock-keyword (keywords &rest body) + (declare (indent 1) + (debug (&rest form))) + `(ess-with-toggled-font-lock-keyword nil ,keywords ,@body)) + +(defmacro ess-with-enabled-font-lock-keyword (keywords &rest body) + (declare (indent 1) + (debug (&rest form))) + `(ess-with-toggled-font-lock-keyword t ,keywords ,@body)) + +(provide 'ess-test-r-utils) + + +;; Local Variables: +;; etest-local-config: etest-r-config +;; End: + +;;; ess-test-r-utils.el ends here diff -Nru ess-18.10.2/test/ess-tests.el ess-18.10.2+git20220915.f45542e/test/ess-tests.el --- ess-18.10.2/test/ess-tests.el 2018-11-10 09:41:11.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/test/ess-tests.el 1970-01-01 00:00:00.000000000 +0000 @@ -1,35 +0,0 @@ - -(require 'ert) - -(unless (fboundp 'provided-mode-derived-p) - ;; From dev Emacs - (defun provided-mode-derived-p (mode &rest modes) - (while (and (not (memq mode modes)) - (setq mode (get mode 'derived-mode-parent)))) - mode)) - -(ert-deftest ess-mode-inherits-prog-mode () - (should (unless nil (provided-mode-derived-p 'ess-mode 'prog-mode)))) - -;; Ensure that major modes can be invoked without errors: - -(ert-deftest R-mode () - (should (string= 'ess-mode (with-temp-buffer (R-mode) major-mode)))) - -(ert-deftest STA-mode () - (should (string= 'ess-mode (with-temp-buffer (STA-mode) major-mode)))) - -(ert-deftest S-mode () - (should (string= 'ess-mode (with-temp-buffer (S-mode) major-mode)))) - -(ert-deftest ess-jags-mode () - (should (string= 'ess-jags-mode (with-temp-buffer (ess-jags-mode) major-mode)))) - -(ert-deftest ess-bugs-mode () - (should (string= 'ess-bugs-mode (with-temp-buffer (ess-bugs-mode) major-mode)))) - -(ert-deftest ess-julia-mode () - (should (string= 'ess-julia-mode (with-temp-buffer (ess-julia-mode) major-mode)))) - -(ert-deftest sas-mode () - (should (string= 'ess-mode (with-temp-buffer (SAS-mode) major-mode)))) diff -Nru ess-18.10.2/test/etest/etest.el ess-18.10.2+git20220915.f45542e/test/etest/etest.el --- ess-18.10.2/test/etest/etest.el 1970-01-01 00:00:00.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/test/etest/etest.el 2022-10-15 08:06:36.000000000 +0000 @@ -0,0 +1,400 @@ +;;; etest.el --- Emacs behavioural test framework -*- lexical-binding: t; -*- + +;; Copyright (C) 2014-2022 Free Software Foundation, Inc. + +;; Author: +;; Lionel Henry +;; Oleh Krehel +;; Version: 1.0.0 +;; Package-Requires: ((ert)) +;; Keywords: tools, unit-test +;; URL: https://github.com/emacs-ess/ESS/tree/master/test/etest + + +;;; Commentary: + +;; etest makes it easy to test the behaviour of Emacs commands. See +;; the project README for documentation. + + +;;; Code: + +(require 'ert) +(eval-when-compile + (require 'cl-lib)) + +(defvar-local etest-local-inferior-buffer nil + "External buffer containing output to check. +Use the `:inf-result' to flush this buffer and test its +contents.") + +(defvar-local etest-local-config nil + "Local configuration for `etest-deftest'. +List of etest keywords and commands, e.g. an `:init' spec to set +up a particular mode.") + +;; Evaluate symbols to make it easier to set local variables +(defmacro etest--push-local-config (place) + `(unless (eq (car ,place) :config) + (let ((etest--config (cond ((not etest-local-config) + nil) + ((symbolp etest-local-config) + (eval etest-local-config t)) + (t + etest-local-config)))) + (when etest--config + (setq ,place (append etest--config ,place)))))) + +(cl-defmacro etest-deftest (name args &body body) + (declare (doc-string 3) + (indent 2)) + (let ((etest--docstring (when (stringp (car body)) + (list (pop body))))) + ;; Record this at compile time because ert doesn't run tests locally + (etest--push-local-config body) + `(ert-deftest ,name ,args + ,@etest--docstring + (etest--run-test (quote ,body) + (lambda (actual expected) + (should (string= actual expected))))))) + +(defmacro etest--setup-body (place) + `(progn + (when (eq (car ,place) :config) + (pop ,place) + (setq ,place (append (eval (pop ,place) t) ,place))) + (etest--pop-init ,place))) + +(defmacro etest--pop-init (place) + `(let (local) + (while (eq (car ,place) :init) + (pop ,place) + (setq local (append local (pop ,place)))) + local)) + +(defmacro etest--with-test-buffer (init &rest body) + (declare (indent 1) + (debug (&rest form))) + `(let ((etest--buf (etest--new-buffer ,init))) + (unwind-protect + (with-current-buffer etest--buf + ,@body) + (kill-buffer etest--buf)))) + +(defun etest--new-buffer (init) + (let ((buf (generate-new-buffer " *elt-temp*"))) + (with-current-buffer buf + (setq-local file-local-variables-alist (nreverse (copy-alist init))) + (hack-local-variables-apply) + (transient-mark-mode 1)) + buf)) + +(defun etest--run-test (body do-result) + "Parse BODY as list of expressions. +`:eval' arguments are evaluated in a dedicated buffer. The +keyword can be a command or a list of commands. Strings are +interpreted as `kbd' commands. + + The buffer is initialised with the list of local variables found +in `:init' keywords. The `:cleanup' keyword takes +unwind-protected expressions that are evaluated in LIFO order +after the test succeeds or fails. + +`:result' keywords are processed with DO-RESULT. This should be a +function taking ACTUAL and EXPECTED strings. + +`:inf-buffer' takes an auxiliary buffer whose contents can be +tested with `:inf-result'. The latter keyword work similarly to +`:result' but returns the current output in the inferior buffer. +This buffer is flushed. The inferior buffer is stored in the +buffer-local variable `etest-local-inferior-buffer'. + +`:messages' keywords check the contents of the messages buffers +and are processed with DO-RESULT." + (etest--with-test-buffer (etest--setup-body body) + (let ((etest--msg-sentinel (etest--make-message-sentinel)) + etest--cleanup) + (unwind-protect + (while body + (if (keywordp (car body)) + (let ((etest--key (pop body)) + (etest--value (pop body))) + (pcase etest--key + (`:inf-buffer (setq etest-local-inferior-buffer (eval etest--value t))) + (`:cleanup (push etest--value etest--cleanup)) + (`:inf-cleanup (push `(progn + ,etest--value + (etest--wait-for-inferior) + (etest-clear-inferior-buffer)) + etest--cleanup)) + (`:case (progn + (erase-buffer) + (setq last-command nil) + (insert etest--value))) + (`:eval (etest-run (current-buffer) (etest--wrap-test etest--value))) + (`:result (funcall do-result + (etest--result (current-buffer)) + etest--value)) + (`:inf-result (etest--flush-inferior-buffer do-result etest--value)) + (`:messages (progn + (etest--flush-messages etest--msg-sentinel do-result etest--value) + (setq etest--msg-sentinel (etest--make-message-sentinel)))) + (_ (error (format "Expected an etest keyword, not `%s`" etest--key))))) + (etest-run (current-buffer) (etest--wrap-test (pop body))))) + (mapc #'eval etest--cleanup))))) + +(defun etest--wrap-test (x) + (if (or (not (listp x)) + (symbolp (car x))) + (list x) + x)) + +(defun etest--wait-for-inferior () + (unless etest-local-inferior-buffer + (error "Must set `etest-local-inferior-buffer'")) + (let* ((inf-buf etest-local-inferior-buffer) + (inf-proc (get-buffer-process inf-buf))) + ;; Wait until a trailing prompt for maximum 10ms + (with-current-buffer inf-buf + (save-excursion + (let ((times 0)) + (while (and (< times 10) + (not (re-search-forward "> \\'" nil t))) + (accept-process-output inf-proc 0.001) + (goto-char (point-min)) + (setq times (1+ times)))))))) + +(defun etest--flush-inferior-buffer (do-result value) + (unwind-protect + (progn + (etest--wait-for-inferior) + (funcall do-result + (etest--result etest-local-inferior-buffer t) + value)) + (etest-clear-inferior-buffer))) + +(defun etest-clear-inferior-buffer () + (with-current-buffer etest-local-inferior-buffer + (let ((inhibit-read-only t)) + (erase-buffer)))) + +(defun etest--make-message-sentinel () + (let ((sentinel (format "etest-messages-%s" (gensym))) + (inhibit-message t)) + (message sentinel) + sentinel)) + +(defun etest--flush-messages (msg-sentinel do-result value) + (let ((msgs (with-current-buffer (get-buffer "*Messages*") + (save-excursion + (goto-char (point-min)) + (re-search-forward msg-sentinel nil t) + (let ((start (1+ (point)))) + (buffer-substring start (max start (1- (point-max))))))))) + (funcall do-result msgs value))) + + +;;; Update expected results in a test block + +(defvar etest--result-re "[ \n\t]*:\\(\\(inf-\\)?result\\|messages\\) *\s\"") + +;;;###autoload +(defun etest-update () + "Update all result keywords for the etest block at point. +Move point into an `etest-deftest' block and call this function +to update the value of `:result', `:inf-result', and `:messages' +keywords." + (interactive) + (save-window-excursion + (save-excursion + (let* ((beg (etest--climb-deftest)) + (end (progn (forward-sexp) (point-marker))) + (str (buffer-substring-no-properties beg end)) + (body (car (read-from-string str)))) + ;; Skip `etest-deftest` and initial arguments + (dotimes (_i 3) + (pop body)) + (when (stringp (car body)) + (pop body)) + (etest--push-local-config body) + (let ((results (etest--read-results body))) + (goto-char beg) + (forward-char 1) + (while results + (while (and (etest--forward-sexp) + (prog1 t + (while (forward-comment 1))) + (not (looking-at-p etest--result-re)))) + (unless (looking-at-p etest--result-re) + (error "Can't find any result keyword")) + (re-search-forward etest--result-re end t) + (let ((result-beg (1- (point))) + (result-end (progn + (etest--backward-up-strings) + (etest--forward-sexp) + (point))) + (result-str (prin1-to-string (pop results)))) + (goto-char result-beg) + (delete-region result-beg result-end) + (insert result-str) + (etest--forward-sexp -1)))))))) + +(defun etest--read-results (body) + (let (results) + (etest--run-test body (lambda (actual _expected) + (push actual results))) + (nreverse results))) + +(defun etest--forward-sexp (&optional N) + (or N (setq N 1)) + (condition-case nil + (prog1 t + (goto-char (or (scan-sexps (point) N) + (buffer-end N)))) + (error nil))) + +(defun etest--backward-up-strings () + (let ((syntax (syntax-ppss (point)))) + (while (nth 3 syntax) + (goto-char (nth 8 syntax)) + (setq syntax (syntax-ppss (point)))))) + +(defun etest--climb-deftest () + ;; Climb one character when point is in front of a parenthesis. + ;; This puts the cursor inside the `etest-deftest` when it is in + ;; front. + (etest--backward-up-strings) + (unless (looking-at "(") + (ignore-errors (backward-char 1)) + (unless (looking-at ")") + (ignore-errors (forward-char 1)))) + ;; Climb enclosing lists until we find the `test-deftest` + (while (and (not (looking-at "(etest-deftest")) + (ignore-errors (prog1 t (backward-up-list nil t t))))) + (point)) + + +;;; Run commands with cursor and mark tracking + +;; The following code is adapted from the `lispy-with' macro by Oleh +;; Krehel in . +;; The main difference is support for multiple cursors. + +(defun etest-run (buf cmds &optional _reset-state) + "Run CMDS in BUF. +If RESET-STATE is non-nil, `last-command' and +`current-prefix-arg' are set to nil for all cursors." + ;; FIXME: `reset-state' is not used! + (with-current-buffer buf + (goto-char (point-min)) + (when (search-forward "×" nil t) + (backward-delete-char 1) + (set-mark (point)) + (when (search-forward "×" nil t) + (error "There can only be one mark cursor"))) + (goto-char (point-max)) + (let (cursors-start + cursors-end) + (while (search-backward "¶" nil t) + (delete-char 1) + (let ((marker (point-marker))) + (set-marker-insertion-type marker t) + (push marker cursors-start))) + (unless cursors-start + (setq cursors-start (list (point-min)))) + ;; Fontification must take place after removing "¶" + (font-lock-ensure) + (let ((current-lc last-command) + (current-cpa current-prefix-arg)) + (dolist (cursor cursors-start) + (goto-char cursor) + ;; Reset Emacs state for each cursor + (setq last-command current-lc) + (setq current-prefix-arg current-cpa) + (mapc (lambda (x) + (cond ((equal x '(kbd "C-u")) + (setq current-prefix-arg (list 4))) + ((stringp x) + (if (string= x "C-u") + (setq current-prefix-arg (list 4)) + (etest--unalias (kbd x)))) + ((and (listp x) + (eq (car x) 'kbd)) + (etest--unalias x)) + (t (let ((inhibit-message t)) + (eval x t))))) + cmds) + (let ((marker (point-marker))) + (set-marker-insertion-type marker t) + (push marker cursors-end)))) + (dolist (cursor cursors-end) + (goto-char cursor) + (insert "¶"))) + (when (region-active-p) + (exchange-point-and-mark) + (insert "×") + (exchange-point-and-mark)) + t)) + +(defun etest--result (buf &optional trim-last-newline) + (with-current-buffer buf + (let ((beg (point-min)) + (end (point-max))) + (when (and trim-last-newline + (> end beg) + (string= (buffer-substring (1- end) end) "\n")) + (setq end (1- end))) + (buffer-substring-no-properties beg end)))) + +(defun etest--unalias (seq) + "Emulate pressing keys decoded from SEQ." + (if (vectorp seq) + (etest--unalias-key seq (key-binding seq)) + (let ((lkeys (etest--decode-keysequence seq)) + (current-prefix-arg current-prefix-arg) + key) + (while (setq key (pop lkeys)) + (when (numberp key) + (setq current-prefix-arg (list key)) + (setq key (pop lkeys))) + (let ((cmd (key-binding key))) + (while (keymapp cmd) + (setq key (pop lkeys)) + (setq cmd (lookup-key cmd key))) + (etest--unalias-key key cmd)))))) + +(defun etest--unalias-key (key cmd) + "Call command that corresponds to KEY. +Insert KEY if there's no command." + (setq last-input-event (aref key 0)) + (cond ((eq cmd 'self-insert-command) + (insert key)) + ((null cmd) + (error "Can't find binding in keymap")) + (t + (setq last-command-event (aref key 0)) + (setq this-command cmd) + (let ((inhibit-message t)) + (call-interactively cmd)) + (setq last-command cmd)))) + +(defun etest--decode-keysequence (str) + "Decode STR from e.g. \"23ab5c\" to ='(23 \"a\" \"b\" 5 \"c\")" + (let ((table (copy-sequence (syntax-table)))) + (cl-loop for i from ?0 to ?9 do + (modify-syntax-entry i "." table)) + (cl-loop for i from ? to ? do + (modify-syntax-entry i "w" table)) + (cl-loop for i in '(? ?\( ?\) ?\[ ?\] ?{ ?} ?\" ?\' ?\ ) + do (modify-syntax-entry i "w" table)) + (cl-mapcan (lambda (x) + (let ((y (ignore-errors (read x)))) + (if (numberp y) + (list y) + (mapcar #'string x)))) + (with-syntax-table table + (split-string str "\\b" t))))) + +(provide 'etest) + +;;; etest.el ends here diff -Nru ess-18.10.2/test/etest/README.md ess-18.10.2+git20220915.f45542e/test/etest/README.md --- ess-18.10.2/test/etest/README.md 1970-01-01 00:00:00.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/test/etest/README.md 2022-10-15 08:06:36.000000000 +0000 @@ -0,0 +1,283 @@ + +# Introduction + +etest is an ERT extension to make it easier to test Emacs behavior such as cursor and mark movement and inferior buffer output. + +This package contains programming tools as well as user commands. Add `ESS/test/etest/` to your load-path or install it with: + +``` +M-x package-install-file +``` + + +# Usage + +The interface of etest is inspired by the ERT and use-package macros. Like ERT, the `etest-deftest` macro has a similar syntax to `defun` and `defmacro`. It takes an ERT test name, an empty list of arguments, and an optional documentation string: + +```elisp +(etest-deftest my-test () + "Documentation string for the unit test.") +``` + +This macro wraps around `ert-deftest` so these tests can be run with the usual ERT tools. + + +## Defining test cases + +At its heart, the `etest-deftest` macro is an interpreter of lisp forms and keywords command. The main keywords to know about are `:case` and `:result`. + + +### `:case` + +All etest tests are run in a dedicated buffer. The `:case` takes a string that defines the content of the test buffer. The special characters `¶` and `×` specify the positions of the Emacs point and mark cursors in that buffer. These characters were chosen to be 1 character wide so they don't distract from the general structure of the test case, and outside of the ASCII range so they don't conflict with valid symbols in the tested languages. + +```elisp +(etest-deftest my-test () + :case "¶Initial text in the test buffer.") +``` + +The mark cursor `×` is optional. When the point cursor `¶` is omitted, the cursor is set at `(point-min)`. + + +### Lisp forms and commands + +Any lisp form that isn't prefixed with a keyword is evaluated as lisp. These forms may contain ert code such as `should` or may cause side effects in the test buffer. + +```elisp +(etest-deftest my-test () + :case "¶Initial text in the test buffer." + (forward-word) +``` + +These free forms may also be commands described in strings as key descriptions (the sort that you would pass to `kbd`). The key is looked up in the active keymaps of the test buffer: + +```elisp +(etest-deftest my-test () + :case "¶Initial text in the test buffer." + "M-f" +``` + +These can be freely mixed: + +```elisp +(etest-deftest my-test () + :case "¶Initial text in the test buffer." + "M-f" + (forward-word) + "M-f" +``` + + +### `:result` + +You can test how these commands affect the test buffer with the `:result` keyword. An easy way to add this keyword is to first supply an empty string: + +```elisp +(etest-deftest my-test () + :case "¶Initial text in the test buffer." + "M-f" + :result "") +``` + +Then move the point inside the `etest-deftest` block and call `M-x etest-update`. This function runs the test command in the dedicated test buffer, examines the state of the buffer for each `:result` keyword, and updates it in place. You should now see the `:result` value filled in: + +```elisp +(etest-deftest my-test () + :case "¶Initial text in the test buffer." + "M-f" + :result "Initial¶ text in the test buffer.") +``` + +This block has now become a unit test for the behavior of the `"M-f"` keybinding. When ERT runs the test, the contents of the buffer as well as the position of the cursor after typin `"M-f"` must correspond to the comparison case recorded in `:result`, otherwise the test fails. + +Note that you don't need a `:result` keyword to perform tests. You can also use `should` statement or any other ERT testing device in keyword-free forms: + +```elisp +(etest-deftest my-test () + :case "¶Initial text in the test buffer." + (should (looking-at "Initial"))) +``` + + +## Initializing and cleaning up the test buffer + +### `:init` + +By default, the test buffer is in fundamental mode. The `:init` keyword offers a convenient initialization syntax. It takes an alist of local variables with the same syntax as [directory local variables](https://www.gnu.org/software/emacs/manual/html_node/emacs/Directory-Variables.html). + +```elisp +(etest-deftest my-test () + :init ((mode . text) + (var . value))) +``` + +The `eval` command supports arbitrary lisp code. This is a convenient way of abstracting initialization in a function: + +```elisp +(defun my-init () + (text-mode 1) + (setq var value)) + +(etest-deftest my-test () + :init ((eval . (my-init)))) +``` + + +### `:cleanup` + +The `:cleanup` takes lisp expressions evaluated in LIFO order with unwind protection when the test exits. It is useful to clean up side effects introduced in your tests: + +```elisp +(defun my-init () + (setq-local my-buf (get-buffer-create "my-buffer"))) + +(etest-deftest my-test () + :init ((eval . (my-init))) + :cleanup (kill-buffer my-buf)) +``` + + +## Reusing mode-specific configuration + +Mode-specific configuration can be stored in a variable or created with a function. This typically includes an `:init` keyword that sets up the major-mode for the test buffer: + +```elisp +(defvar my-config '(:init ((mode . text)))) +``` + +The configuration may contain any valid etest code and is registered with the `:config` keyword. This keyword must appear before any other keywords: + +```elisp +(etest-deftest my-test () + :config my-config)) +``` + +You can also set it with the buffer-local variable `etest-local-config`. It is convenient to set it as a file-local variable, this way `etest-update` is automatically aware of the configuration relevant to the test file. + +```elisp +(etest-deftest my-test ()) + +;; Local Variables: +;; etest-local-config: my-config +;; End: +``` + +If supplied, the `:config` keyword has precedence over the configuration stored in `etest-local-config` and completely replaces it. + + +## Checking the contents of an inferior buffer + +In addition to checking the side effects in the test buffer, it is often useful to check the side effects in an auxiliary buffer. For instance, checking the output in an inferior process buffer. + + +### `:inf-buffer` + +Let's define rudimentary initialization and cleanup functions for an R inferior. These save the inferior buffer in a buffer-local variable `inf-buf`. + +```elisp +(defun my-inferior-init () + (setq-local inf-buf (run-ess-r)) + (setq-local inf-proc (get-buffer-process inf-buf)) + (setq ess-local-process-name (process-name inf-proc)) + (with-current-buffer inf-buf + (comint-clear))) + +(defun my-inferior-cleanup () + (kill-process inf-proc)) +``` + +Use `:inf-buffer` keyword to set up `inf-buf` as the inferior buffer to monitor: + +```elisp +(etest-deftest my-test () + :init ((mode . r) + (eval . (my-inferior-init))) + :cleanup (my-inferior-cleanup) + :inf-buffer inf-buf) +``` + +This enables usage of `:inf-result`. + + +### `:inf-result` + +We'll test the result of calling `C-c C-c` in a buffer containing `1 + 1`. The `:inf-result` keyword is similar to `:result`. Set it to the empty string to start with: + +```elisp +(etest-deftest my-test () + :init ((mode . r) + (eval . (my-inferior-init))) + :cleanup (my-inferior-cleanup) + :inf-buffer inf-buf + :case "1 + 1" + "C-c C-c" + :inf-result "") +``` + +After calling `etest-update` we get: + +```elisp +(etest-deftest my-test () + :init ((mode . r) + (eval . (my-inferior-init))) + :cleanup (my-inferior-cleanup) + :inf-buffer inf-buf + :case "1 + 1" + "C-c C-c" + :inf-result "> 1 + 1 +[1] 2 +> ") +``` + + +## Other features + +### Using multiple cursors + +Use multiple `¶` characters to define multiple cursors. Lisp code and commands are run once for each cursor. This is useful for testing motions on many keywords at a time for instance: + +```elisp +(etest-deftest my-test () + :case "¶if ¶while ¶for" + "M-f" + :result "if¶ while¶ for¶") +``` + +Or for testing properties of many keywords: + +```elisp +(etest-deftest my-test () + "Test that control flow keywords are only fontified if they are +followed by an open parenthesis." + :init ((mode . r)) + + :case "¶if ¶while ¶for" + (should (not (face-at-point))) + + :case "¶if () ¶while () ¶for ()" + (should (eq (face-at-point) 'ess-keyword-face))) +``` + + +### Checking messages + +#### `:messages` + +Messages are normally inhibited during the duration of the test. If you want to check the messages, use the `:messages` keyword. As usual, start with an empty string value: + +```elisp +(etest-deftest my-test () + (message "foo") + (message "bar") + :messages "") +``` + +And call `etest-update` to define a comparison case: + +```elisp +(etest-deftest my-test () + (message "foo") + (message "bar") + :messages "foo +bar") +``` diff -Nru ess-18.10.2/test/etest/test-etest.el ess-18.10.2+git20220915.f45542e/test/etest/test-etest.el --- ess-18.10.2/test/etest/test-etest.el 1970-01-01 00:00:00.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/test/etest/test-etest.el 2022-10-15 08:06:36.000000000 +0000 @@ -0,0 +1,290 @@ +;; -*- lexical-binding: t -*- + +(require 'ert) +(require 'etest) + +(etest-deftest etest-local-vars-test () + "`:init' keyword specifies local variables." + :init ((mode . text) + (foo . t)) + :init ((bar . t)) + (should (eq major-mode 'text-mode)) + (should foo) + (should bar)) + +(etest-deftest etest-test-result-test () + "`:eval' causes side effects in test buffer and `:result' checks output." + :case "¶foo bar" + :eval (forward-word) + :result "foo¶ bar" + :eval ((forward-char) + (forward-char)) + :eval ((forward-char) + "RET") + :result "foo ba\n¶r") + +(etest-deftest etest-climb-deftest-test () + "Find enclosing `etest-deftest'." + + ;; Within parentheses + :case " +(etest-deftest name () + (foo (bar¶)) +" + (etest--climb-deftest) + :result " +¶(etest-deftest name () + (foo (bar)) +" + + ;; Within a string + :case " +(etest-deftest name () + (foo \"bar¶\") +" + (etest--climb-deftest) + :result " +¶(etest-deftest name () + (foo \"bar\") +" + + ;; Behind deftest + :case " +¶(etest-deftest name () + :foo) +" + (etest--climb-deftest) + :result " +¶(etest-deftest name () + :foo) +" + + ;; In front of deftest + :case " +(etest-deftest name () + :foo)¶ +" + (etest--climb-deftest) + :result " +¶(etest-deftest name () + :foo) +") + +(etest-deftest etest-update-test () + "`etest-update' updates test block at point." + :case " + (etest-deftest test-etest-update () + :case \"¶foo bar\" + (forward-word) + :result \"\" + (forward-char) + (forward-char) + (forward-char) + \"RET\" + :result \"\") +" + (etest-update) + :result " + (etest-deftest test-etest-update () + :case \"¶foo bar\" + (forward-word) + :result \"foo¶ bar\" + (forward-char) + (forward-char) + (forward-char) + \"RET\" + :result \"foo ba +¶r\") +") + +(etest-deftest etest-update-result-not-on-bol-test () + "`etest-update' works when `:result` is not at bol." + :case " + (etest-deftest test-etest-update () + :case \"¶foo bar\" + (forward-word) :result \"\" + (forward-word) :result \"\") +" + (etest-update) + :result " + (etest-deftest test-etest-update () + :case \"¶foo bar\" + (forward-word) :result \"foo¶ bar\" + (forward-word) :result \"foo bar¶\") +") + +(etest-deftest etest-keep-state-test () + "`last-command' is preserved. +Using multiple cursors in the test to make sure Emacs state is +reset after a cursor has finished evaluating." + :case "¶foo ¶bar" + "M-f" + (should (eq last-command 'forward-word)) + ;; Ideally we'd test `this-command` at the time "M-f" is + ;; called but for simplicity we do it here + (should (eq this-command 'forward-word)) + "M-b" + (should (eq last-command 'backward-word)) + (should (eq this-command 'backward-word)) + :result "¶foo ¶bar") + +(ert-deftest etest-wrap-test-keyword-test () + "`:eval' keywords are appropriately wrapped in lists." + (should (equal (etest--wrap-test "foo") + '("foo"))) + (should (equal (etest--wrap-test 'foo) + '(foo))) + (should (equal (etest--wrap-test '(foo)) + '((foo)))) + (should (equal (etest--wrap-test '((foo))) + '((foo))))) + +(etest-deftest etest-cleanup-test () + "`:cleanup' keywords are evaluated in LIFO order." + :init ((foo . "foo") + (bar . "bar")) + :cleanup (progn + (should (equal foo "FOO")) + (should (equal bar "BAR"))) + :cleanup (progn + (should (equal foo "foo")) + (should (equal bar "BAR")) + (setq foo "FOO")) + :cleanup (progn + (should (equal foo "foo")) + (should (equal bar "bar")) + (setq bar "BAR"))) + +(etest-deftest etest-inferior-buffer-test () + "Inferior buffer is flushed and tested." + :inf-buffer (get-buffer-create "aux-buffer") + (with-current-buffer etest-local-inferior-buffer + (insert "foo")) + :inf-result "foo" + :inf-result "" + (with-current-buffer etest-local-inferior-buffer + (insert "foobar")) + :inf-result "foobar" + :inf-result "") + +(etest-deftest etest-messages-test () + "Can retrieve messages with `:messages'." + :messages "" + (message "foo") + (message "bar") + :messages "foo +bar" + :messages "") + +(ert-deftest etest-unalias-prefix-key () + "Can supply keymap prefix commands like `C-c C-c`." + (with-temp-buffer + (let ((map (make-sparse-keymap)) + called) + (define-key map (kbd "C-c C-c") (lambda () (interactive) (setq called t))) + (use-local-map map) + (etest--unalias (kbd "C-c C-c")) + (should called)))) + +(etest-deftest etest-multiple-results-test () + "Parser is not fazed by multiple consecutive results." + :case " +(etest-deftest etest-multiple-results-test () + :case \"¶1\" + \"\" + :result \"\" + :result \"\") +" + (etest-update) + :result " +(etest-deftest etest-multiple-results-test () + :case \"¶1\" + \"\" + :result \"1¶\" + :result \"1¶\") +") + +(etest-deftest etest-skip-comments-test () + "Parser skips any comments when looking for `:result' keywords." + :case " +(etest-deftest test () + :case \"¶1\" + \"\" + ;; Comment + ;; Comment + + ;; Comment + :result \"\") +" + (etest-update) + :result " +(etest-deftest test () + :case \"¶1\" + \"\" + ;; Comment + ;; Comment + + ;; Comment + :result \"1¶\") +") + +(etest-deftest etest-mark-test () + "Mark is properly handled." + :case "¶foo×" + "" + :result "f¶oo×" + "" + :result "fo¶o×") + + +(defun etest-make-config () + '(:init ((mode . text)))) + +(etest-deftest etest-config-fun-test () + "Configuration is picked up from function." + :config (etest-make-config) + (should (eq major-mode 'text-mode))) + + +(defvar etest-some-config '(:init ((mode . text)))) + +(etest-deftest etest-config-var-test () + "Configuration is picked up from variable." + :config etest-some-config + (should (eq major-mode 'text-mode))) + + +;; `let' doesn't seem to work here, perhaps an interaction between +;; scoping in macros and file-local variables +(setq etest-local-config '(:init ((mode . text)))) + +(etest-deftest etest-config-local-test () + "Local configuration is picked up." + (should (eq major-mode 'text-mode))) + +(etest-deftest etest-config-keyword-test () + "Keyword config has precedence over local config." + :config nil + (should (eq major-mode 'fundamental-mode))) + +(setq etest-local-config nil) + +(etest-deftest etest-default-mode () + "Default mode is fundamental. +Also tests local config test is cleaned up properly." + (should (eq major-mode 'fundamental-mode))) + + +(etest-deftest etest-truncation-test () + "`backward-up-list' isn't confused by syntax in strings." + :case " +(etest-deftest test () + :result \"\") +\")\" +" + (etest-update) + :result "¶ +(etest-deftest test () + :result \"\") +\")\" +") diff -Nru ess-18.10.2/test/fixtures/navigation.R ess-18.10.2+git20220915.f45542e/test/fixtures/navigation.R --- ess-18.10.2/test/fixtures/navigation.R 1970-01-01 00:00:00.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/test/fixtures/navigation.R 2022-10-15 08:06:36.000000000 +0000 @@ -0,0 +1,81 @@ +fn1 <- function(a, b) something(aaa) + + aa / bb %>% + cc ## end of fn1 + + + +fn2 <- function(a, b) + something(aaa) + + aa / bb %>% + cc ## end of fn2 + +### Some comments +## extra comments + +## more comments + +fn3 <- function() { + ## comment + + a <- 1 + + b <- 3 + + a + b + +} ## end of fn3 + +## some paragraph +par1 <- 1 +par1 <- par1 + +setMethod("method1", + function() { + }) ## end of setMethod + + +fn4 <- function() { + ## comment + + inner_fn5 <- function() { + fn5_body + } + + b <- 3 + + a + b + +} ## end of fn4 + + +f5 <- function(){} ## end of f5 + +"after f5" + +funcs <- + list(f6 = function(){ + some_code6 <- here + + }, ## end of f6 + + f7 = function(){ + + some_code7 -> there + }) ## end of f7 + + +f8 <- + function(aaa, + bb = bbb(), + cc = "cccc") +{ + Call <- match.call() + miss.data <- missing(data) || !is.data.frame(data) + + ... +} ## end of f8 + +f9 <- function (x, ...) some_code + + +## navigation.R ends here diff -Nru ess-18.10.2/test/generate-indent-cases ess-18.10.2+git20220915.f45542e/test/generate-indent-cases --- ess-18.10.2/test/generate-indent-cases 2018-11-10 09:41:11.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/test/generate-indent-cases 2022-10-15 08:06:36.000000000 +0000 @@ -4,13 +4,15 @@ (let ((current-directory (file-name-directory load-file-name))) (setq ess-test-path (expand-file-name "." current-directory)) (setq ess-styles-path (expand-file-name "./styles/" current-directory)) - (setq ess-root-path (expand-file-name "../lisp/" current-directory))) + (setq ess-root-path (expand-file-name "../lisp/" current-directory)) + (setq etest-path (expand-file-name "etest/" ess-test-path))) (add-to-list 'load-path ess-root-path) (add-to-list 'load-path ess-test-path) +(add-to-list 'load-path etest-path) -(require 'ess-site) -(load (expand-file-name "ess-indentation-tests.el" ess-test-path) nil t) +(require 'ess-r-mode) +(load (expand-file-name "ess-test-indentation.el" ess-test-path) nil t) ;; The RRR file is taken as a model, so modify this file to add or ;; adjust test cases. diff -Nru ess-18.10.2/test/generate-literate-cases ess-18.10.2+git20220915.f45542e/test/generate-literate-cases --- ess-18.10.2/test/generate-literate-cases 2018-11-10 09:41:11.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/test/generate-literate-cases 2022-10-15 08:06:36.000000000 +0000 @@ -3,15 +3,17 @@ (let ((current-directory (file-name-directory load-file-name))) (setq ess-test-path (expand-file-name "." current-directory)) + (setq ess-etest-path (expand-file-name "./etest/" current-directory)) (setq ess-literate-path (expand-file-name "./literate/" current-directory)) (setq ess-root-path (expand-file-name "../lisp/" current-directory))) (add-to-list 'load-path ess-root-path) (add-to-list 'load-path ess-test-path) +(add-to-list 'load-path ess-etest-path) (require 'ert) -(require 'ess-site) -(load (expand-file-name "ess-literate-tests.el" ess-test-path) nil t) +(require 'ess-r-mode) +(load (expand-file-name "ess-test-literate.el" ess-test-path) nil t) (message "\nStarting literate tests") diff -Nru ess-18.10.2/test/literate/fontification.el ess-18.10.2+git20220915.f45542e/test/literate/fontification.el --- ess-18.10.2/test/literate/fontification.el 2018-11-10 09:41:11.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/test/literate/fontification.el 2022-10-15 08:06:36.000000000 +0000 @@ -1,7 +1,3 @@ - -(unless (fboundp 'font-lock-ensure) - (defalias 'font-lock-ensure 'font-lock-default-fontify-buffer)) - (defun face-at-point () (get-char-property (point) 'face)) diff -Nru ess-18.10.2/test/literate/keybindings.R ess-18.10.2+git20220915.f45542e/test/literate/keybindings.R --- ess-18.10.2/test/literate/keybindings.R 2018-11-10 09:41:11.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/test/literate/keybindings.R 2022-10-15 08:06:36.000000000 +0000 @@ -5,6 +5,7 @@ foo¶ +##! (define-key ess-mode-map "_" #'ess-insert-assign) ##! "_" foo <- ¶ @@ -18,40 +19,6 @@ foo_ <- ¶ -### 1b Can set `ess-smart-S-assign` to nil at any time --------------- - -foo¶ - -##! (setq ess-smart-S-assign-key nil) -##! "_" - -foo_¶ - -##> "_" - -foo__¶ - -##> (setq ess-smart-S-assign-key "_") ; Reset -##> "_" - -foo__ <- ¶ - - -### 2 Unbinding smart key -------------------------------------------- - -foo¶ - -##! (define-key ess-mode-map "_" nil) -##! "_" - -foo_¶ - -##> (define-key ess-mode-map "_" #'ess-smart-S-assign) ; Reset -##> "_" - -foo_ <- ¶ - - ### 3a Binding `ess-insert-assign` to simple key --------------------- foo¶ @@ -110,6 +77,7 @@ foo¶ +##! (local-set-key "_" #'ess-insert-assign) ##! (setq-local ess-assign-list '(" <~ ")) ##! "_" diff -Nru ess-18.10.2/test/literate/roxy.R ess-18.10.2+git20220915.f45542e/test/literate/roxy.R --- ess-18.10.2/test/literate/roxy.R 2018-11-10 09:41:11.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/test/literate/roxy.R 2022-10-15 08:06:36.000000000 +0000 @@ -9,6 +9,7 @@ ##' @param Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. NULL +##> (ess-roxy-mode) ##! (fill-paragraph) ##' Title diff -Nru ess-18.10.2/test/literate/syntax.R ess-18.10.2+git20220915.f45542e/test/literate/syntax.R --- ess-18.10.2/test/literate/syntax.R 2018-11-10 09:41:11.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/test/literate/syntax.R 2022-10-15 08:06:36.000000000 +0000 @@ -58,6 +58,15 @@ stuff1¶ %% stuff2 +### 1f --------------------------------------------------------------- + +stuff1 => ¶stuff2 + +##! (ess-climb-operator) + +stuff1¶ => stuff2 + + ##### Bare blocks @@ -91,3 +100,94 @@ if (test2) stuff2 + + +##### Continutations + +### 1a --------------------------------------------------------------- + +object <- + fun_call() %>% + ¶fun_call() + +##! (ess-climb-continuations) + +¶object <- + fun_call() %>% + fun_call() + + +### 1b --------------------------------------------------------------- + +object <- + fun_call() %>% fun_call() %>% + ¶fun_call() + +##! (ess-climb-continuations) + +¶object <- + fun_call() %>% fun_call() %>% + fun_call() + + +### 1c --------------------------------------------------------------- + +object <- + namespace::fun_call() %>% + ¶fun_call() + +object <- + namespace:::fun_call() %>% + ¶fun_call() + +object <- + object@fun_call() %>% + ¶fun_call() + +object <- + object$fun_call() %>% + ¶fun_call() + +##! (ess-climb-continuations) + +¶object <- + namespace::fun_call() %>% + fun_call() + +¶object <- + namespace:::fun_call() %>% + fun_call() + +¶object <- + object@fun_call() %>% + fun_call() + +¶object <- + object$fun_call() %>% + fun_call() + + + +##### Expressions + +### 1 Sticky operators ----------------------------------------------- + +object@field¶ +object$field¶ +namespace::object¶ +namespace:::object¶ + +##! (ess-climb-expression) + +¶object@field +¶object$field +¶namespace::object +¶namespace:::object + +##! (ess-climb-object) + +¶object@field +¶object$field +¶namespace::object +¶namespace:::object + diff -Nru ess-18.10.2/test/Makefile ess-18.10.2+git20220915.f45542e/test/Makefile --- ess-18.10.2/test/Makefile 2018-11-10 09:41:11.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/test/Makefile 2022-10-15 08:06:36.000000000 +0000 @@ -1,9 +1,14 @@ -EMACS?=emacs -.PHONY: literate +include ../Makeconf +.PHONY: literate all julia lisp ess inf org r r-indent literate cases indent-cases literate-cases -all: +all: compile lisp + +julia: + @$(MAKE) -C .. julia + +lisp: julia ${EMACS} -Q --script run-tests ess: @@ -12,16 +17,21 @@ inf: ${EMACS} -Q --script run-tests --inf -r: - ${EMACS} -Q --script run-tests --rstats +org: + ${EMACS} -Q --script run-tests --org + +r r-core: + ${EMACS} -Q --script run-tests --r-core r-indent: - ${EMACS} -Q --script run-tests --rstats-indent + ${EMACS} -Q --script run-tests --r-indent + +r-pkg: + ${EMACS} -Q --script run-tests --r-pkg literate: ${EMACS} -Q --script run-tests --literate - cases: indent-cases literate-cases indent-cases: @@ -29,3 +39,8 @@ literate-cases: ${EMACS} -Q --script generate-literate-cases + +.PHONY: compile +compile: + @cd .. && make -k lisp \ + "COMPILE-FLAGS = --eval \"(setq byte-compile-error-on-warn t)\"" diff -Nru ess-18.10.2/test/manual/R-error-patterns.R ess-18.10.2+git20220915.f45542e/test/manual/R-error-patterns.R --- ess-18.10.2/test/manual/R-error-patterns.R 1970-01-01 00:00:00.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/test/manual/R-error-patterns.R 2022-10-15 08:06:36.000000000 +0000 @@ -0,0 +1,111 @@ +## TODO: automate this somehow. +## +## For now manually +## +## (progn +## (setq-local compilation-error-regexp-alist ess-error-regexp-alist) +## (compilation-minor-mode)) +## +## and check if everything is highlighted as expected + +## 1 +Error: chunk 7 (label = OP4) +Error in disp.Rnw:656:31: unexpected symbol +655: par(mgp = c(2.5, 1, 1), mar = c(0, 0, 0, 0), + 656: plt= c(0.08, 0.9, 0.25, 0.p9 +)) + +## 2 +Browse[2]> Error in x %*% y (from models.R#46) : + Cholmod error 'X and/or Y have wrong dimensions' at file ../MatrixOps/cholmod_sdmult.c, line 90 + +## 3 +Error in source("~/works/protoClasses/R/funcs.R") (from hierarchy.R#6) : + ~/works/protoClasses/R/funcs.R:1797:5: unexpected '[[' +1796: b[[2]] <- quote(browser()) +1797: [[ + ^ +## 4 +source("basicModel.R") +Error in source("basicModel.R") : basicModel.R:95:1: unexpected symbol +94: +95: ixQ + ^ + +## 5.a +> + Error in source(file = "/home/vitoshka/works/pbm/R/S4.R") (from #1) : + /home/vitoshka/works/pbm/R/S4.R:36:62: unexpected ')' +35: }, list(vname = as.name(".pix_v")), +36: pname = as.name(".pix_p")))) + ^ + +## 5.b +> + Error in source(file = "/home/vitoshka/works/pbm/R/S4.R") (from #1) : + c:/home/vitoshka/works/pbm/R/S4.R:36:62: unexpected ')' +35: }, list(vname = as.name(".pix_v")), +36: pname = as.name(".pix_p")))) + ^ + +## 6 first line is not a pattern! ++ . + Error in base::source(file = file, echo = echo, local = local, print.eval = print.eval, (from #95) : + /tmp/model_mixture.R@4:5:13: unexpected symbol +4: Mq$DATA$ixs$clust <- data$ixQ +5: Mq + +## 7 don't highlight dates + id lat lon obs_date + Min. : 1.00 Min. :21.57 Min. :-179.88 01/02/1997 04:16:53: 1 + 1st Qu.: 99.25 1st Qu.:24.36 1st Qu.:-147.38 01/02/1997 05:56:25: 1 + Median :197.50 Median :25.64 Median :-119.64 01/04/1997 17:41:54: 1 + Mean :197.50 Mean :27.21 Mean : -21.52 01/05/1997 17:20:07: 1 + 3rd Qu.:295.75 3rd Qu.:27.41 3rd Qu.: 153.66 01/06/1997 04:31:13: 1 + Max. :394.00 Max. :39.84 Max. : 179.93 01/06/1997 06:12:56: 1 + (Other) :388 +## 8 valgrind errors +==25269== Invalid read of size 8 +==25269== at 0x9EC363C: inner_product (stl_numeric.h:183) +==25269== by 0x9EC363C: distance (rwmd.cpp:21) +==25269== by 0x9EC90C9: operator()(unsigned long, unsigned long) (rwmd.cpp:137) + +## 9 testhat new patterns +test_embeddings.R:20: failure: average embedding works +embed_vocab(vocab, embs) not equal to embs[, 1:N]. +Attributes: < Length mismatch: comparison on first 1 components > + +test_embeddings.R:59: error: average embedding works with missing values +no 'dimnames' attribute for array +1: expect_equal(e[, "dd"], e[, "ee"]) at /store/Dropbox/dev/mlvocab/tests/testthat/test_embeddings.R:59 +2: quasi_label(enquo(object), label) at /tmp/Rtmp6McxD6/R.INSTALL70c948e315c6/testthat/R/expect-equality.R:51 +3: eval_bare(get_expr(quo), get_env(quo)) at /tmp/Rtmp6McxD6/R.INSTALL70c948e315c6/testthat/R/expectation.R:90 + +# 10 rlang backtrace +Backtrace: + █ + 1. ├─global::update_orders(self, mm()) + 2. │ └─self$orders(name) ~/dev/foo/bla.R:157:2 + 3. │ └─purrr::keep(...) ~/dev/foo/bla.R:85:14 + 4. │ └─purrr:::probe(.x, .p, ...) + 5. │ └─purrr::map_lgl(.x, .p, ...) + 6. └─purrr:::stop_bad_type(...) + +# 11 "at" rlang backtrace + 10. └─shapvis::shiny_xdeps_ui(shads, name = "SHAP TS", per_page = per_page) at shiny/R/bootstrap.R:761:2 + 11. └─shapvis:::shiny_ui(...) at shapvis/R/app.R:72:2 + 12. └─shapvis:::var_groups(shad, exclude_regexp) at shapvis/R/app.R:106:2 + 13. ├─base::unique(...) at shapvis/R/app.R:33:2 + 14. └─base::colnames(shad$extra) at shapvis/R/app.R:33:2 + 15. └─base::is.data.frame(x) + +# 12 testhat failure +Failure (test-kmeans.R:430:3): predict_KMeans returns the correct output if the input is a data frame AND + +# 13 shiny pattern +Warning: Error in *: non-numeric argument to binary operator + 173: plot_shap_deps_internal [/home/joe/proj/R/plot.R#219] + 172: fn [/home/joe/proj/R/plot.R#184] + +## but not these ranges: +> str(list(1:3)) +List of 1 + $ : int [1:3] 1 2 3 +> diff -Nru ess-18.10.2/test/manual/R-ESS-bugs.R ess-18.10.2+git20220915.f45542e/test/manual/R-ESS-bugs.R --- ess-18.10.2/test/manual/R-ESS-bugs.R 1970-01-01 00:00:00.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/test/manual/R-ESS-bugs.R 2022-10-15 08:06:36.000000000 +0000 @@ -0,0 +1,958 @@ +#### File showing off things that go wrong or *went* wrong in the past #### -- with R-mode (mostly coded in ../lisp/ess-mode.el ) + +### NOTE: this file is indented with RRR style !!!!! +### but do not change indentations anymore of anything in here: +### expressions are written as we *want* them, not as ESS currently puts them + +options(keep.source = FALSE) # so we see R's deparse() + print() indentation + + +### --- 1 --------- extraneous comment chars : This seems fixed + +## From: Robert Gentleman +## To: Martin Maechler +## Subject: ESS buglet +## Date: Sun, 01 Jul 2007 21:41:24 -0700 + +## Hi Martin, +## It seems that the following buglet exists (at least in what ever +## version I am using) + +##a silly comment +##and a second one +foo <- function(x=a, abc = list("def", a=1,3,3), more.args, and, bla, + blu, bl, + another, plus, yet.another, and_mbasd, + lots = NULL, + more = NULL, + args = NULL) { + x +} + +##- when the line before a function def is a comment, and adding args, +##- then new lines, when generated have a comment char at the beginning of +##- the line. It is slightly annoying as I have to remove the comment char. +##- +##- If I add a blank line after the comment line, then the problem does not +##- occur. +## and another ''anonymous'' function: +function(x=a, abc = list("def", a=c(1,3,3)), more.args, and, bla, blu, + blo, Abc, + def, + another, and_another, and_this) { + ...; ... +} + +## This is a "TRUE" example (from Matrix/tests/ ): +NA.or.True <- function(x) is.na(x) | x + +abc <- function(x, y, ...) this.is.just.a.one.liner(x,y, z=TRUE, ...) + +## A more-liner function with no "{...}" -- this one even works (but not all!) +mindiff <- function(df) df[which.min(df$diff), + which.max(df$daff)] + +## Two functions in one line - can I "send" just one of them? {no, not "simply"} +f1 <- function(x) be.friendly(x, force=TRUE); f2 <- function(x,y) x*sin(pi*x) + +### --- 2 ---------------------------------------------------------------- +### --- Suggestion (Jenny Brian): --> Create a (defun ess-eval-multiline .) +## Here is useful valid R "test code": + +## From 'example(plot.default)' : + +Speed <- cars$speed +Distance <- cars$dist +plot(Speed, Distance, panel.first = grid(8,8), + pch = 0, cex = 1.2, col = "blue") +pp <- plot(Speed, Distance, panel.first = grid(8,8), + pch = 0, cex = 1.2, col = "blue") +plot(Speed, Distance, + panel.first = lines(lowess(Speed, Distance), lty = "dashed"), + pch = 0, cex = 1.2, col = "blue") + +## Note: We now at least C-c C-c {ess-eval-function-or-paragraph-and-step} + +### --- 3 ---------------------------------------------------------------- +###--- This one (from the Matrix package) is for testing ess-roxy..., +## i.e., C-c C-o + +## not exported but used more than once for "dimnames<-" method : +## -- or do only once for all "Matrix" classes ?? +dimnamesGets <- function (x, value) { + d <- dim(x) + if (!is.list(value) || length(value) != 2 || + !(is.null(v1 <- value[[1]]) || length(v1) == d[1]) || + !(is.null(v2 <- value[[2]]) || length(v2) == d[2])) + stop(gettextf("invalid dimnames given for '%s' object", class(x))) + x@Dimnames <- list(if(!is.null(v1)) as.character(v1), + if(!is.null(v2)) as.character(v2)) + x +} + +### --- 4 ---------------------------------------------------------------- +### continued statements +a <- function(ch) { + if(ch == Inf) { + E.cond <- numeric(nb) + } + else { + indic <- ifelse(jinf+1 <= 1 & jsup >= 1,1,0) + E.cond <- ch*(-pbinom(jinf,ni,prb) + 1-pbinom(js.n,ni,prb)) + + ifelse(ni == 1, prb*indic, + mu*(pbinom(js.n-1,pmax(ni-1,1),prb) - + pbinom(jinf-1,pmax(ni-1,1),prb))) / sV - +### ^-- now here (better) + mu/sV*(pbinom(js.n,ni,prb) - pbinom(jinf,ni,prb)) +### ^-- now here (ok; more indentation would also be ok) + indic2 <- ifelse(jinf+1 <= 1 & jsup >= 1 & ni == 2,1,0) + } +} + + +### --- 5 ---------------------------------------------------------------- +### The beginning of function is not found correctly, and hence +### all "ess-*-function" (C-M-a, C-M-e, ...) fail: + +setMeneric <- + ## It is clearly allowed to have comments here. + ## S version 4, and John Chambers in particular like it. + ## + ## BUG: M-C-e or M-C-a fails from ``here'' -- + ## --- effectively because of ess-beginning-of-function fails + ## and that really relies on finding ess-function-pattern; + ## i.e., ess-R-function-pattern in ~/emacs/ess/lisp/ess-cust.el + ## + function(name, def = NULL, group = list(), valueClass = character(), + where = topenv(parent.frame()), genericFunction = NULL) +{ + ## comments in here are at least kept via "source" attribute + if(exists(name, "package:base") && + typeof(get(name, "package:base")) != "closure") { + FALSE + } + "ABC" +} + +### --- 6 ---------------------------------------------------------------- +## In one-liners without "{ ... }" body, the end-of-function is also +## not correctly found: +## Use C-M-e to see: In these two, the "end-of-function" is after +## 'class' : +## ---- these all work now (ESS version 5.3.8) : +## no it doesn't VS[10-03-2012|ESS 12.03]: +onelinerFails <- function(x, ...) class(x) + +onelinerFailsToo <- + function(x, ...) + class(x) + +onelinerWorks <- function(x, ...) { class(x) } + +onelinerWorksToo <- + function(x, ...) { + class(x) + } + +### --- 7 ---------------------------------------------------------------- +## idem: +## this has one line more before 'function' than "typically:" +setMethod("[", signature(x = "dgTMatrix", i = "numeric", j = "missing", + drop = "logical"), + function (x, i, j, ..., drop) { ## select rows + storage.mode(i) <- "integer" + xi <- x@i + 1:1 # 1-indexing + ## ................... + if (drop && any(nd == 1)) drop(as(x,"matrix")) else x + }) + +### --- 8 ---------------------------------------------------------------- +## idem: +## all bellow are ok VS[10-03-2012|ESS 12.03]: +"dimnames<-.data.frame" <- function(x, value) { + d <- dim(x) + if(!is.list(value) || length(value) != 2 + || d[[1]] != length(value[[1]]) + || d[[2]] != length(value[[2]])) + stop("invalid 'dimnames' given for data frame") + row.names(x) <- as.character(value[[1]]) # checks validity + names(x) <- as.character(value[[2]]) + x +} + +'[.foo' <- function(x, i, value) +{ +### + y <- x + y[i] <- value + y +} + +'[[.bar' <- function(x, i, value) +{ + ## bla bla bla + y <- as.foo(x) ; y[[i]] <- value + y +} + +"[<-.foobar" <- function(x,i,j,value) { + ## just something + x +} + +"names<-.foobar" <- function(x, value) { + ## just something else + x +} + +`[<-.data.frame` <- function(x, i, j, value) +{ + nA <- nargs() # value is never missing, so 3 or 4. + +###.......... + + class(x) <- cl + x +} + +"[[<-.data.frame"<- function(x, i, j, value) +{ + cl <- oldClass(x) + ## delete class: Version 3 idiom + ## to avoid any special methods for [[<- + class(x) <- NULL + +###........... + + class(x) <- cl + x +} + + +"$<-.data.frame" <- function(x, i, value) +{ + cl <- oldClass(x) + ## delete class: Version 3 idiom + ## to avoid any special methods for [[<- + +###........... + + class(x) <- cl + return(x) +} + +## swanky functions: +`swank:quit-inspector` <- function(slimeConnection, sldbState) { + resetInspector(slimeConnection) + FALSE +} + +'swank:quit-inspector' <- function(slimeConnection, sldbState) { + resetInspector(slimeConnection) + FALSE +} + + +### --- 9 ---------------------------------------------------------------- +## VS[03-2012|12.03]:FIXED: + +## From: "Sebastian P. Luque" +## To: ess-bugs@stat.math.ethz.ch +## Subject: [ESS-bugs] ess-mode 5.12; `ess-indent-line' error +## Date: Tue, 17 Aug 2010 13:08:25 -0500 + +## With the following input, and point on the line with "Table 8.3": +## it was the parenthetical expression at the beg of line + +if (require(lme4)) { + ## Model in p. 213 + (fm1 <- lmer(logFEV1 ~ age + log(height) + age0 + log(height0) + (age | id), + data=fev1, subset=logFEV1 > -0.5)) + ## Table 8.3 + VarCorr(fm1)$id * 100 + + ## Model in p. 216 + (fm2 <- update(fm1, . ~ . - (age | id) + (log(height) | id))) +} + +### ----- +## hitting TAB (`ess-indent-command'), which calls `ess-indent-line' I get +## the following trace: + +## ....: (scan-error "Containing expression ends prematurely" 20 20) +## scan-sexps(177 -2) +## forward-sexp(-2) +## ... +## ess-continued-statement-p() +## ...... + +## Interestingly, if the lines 2-4 are absent, then the problem is gone. +## The problem is also there in ESS 5.11. + +## I'll try to find out what is going on in `ess-continued-statement-p' but +## given that I'm not very familiar with the stuff in ess-mode.el, I'm +## submitting the report in case somebody can detect the issue sooner. + +## another example: hitting Tab at }else line +.essDev_differs <- function(f1, f2){ + if (is.function(f1) && is.function(f2)){ + !(identical(body(f1), body(f2)) && identical(args(f1), args(f2))) + }else + !identical(f1, f2) +} + + + +### --- 10 --------------------------------------------------------------- +## indent at 0 after }else: +## VS:[03-2012|12.03]:FIXED: +if (is.function(f1) && is.function(f2)){ + !(identical(body(f1), body(f2)) && identical(args(f1), args(f2))) +}else + !identical(f1, f2) + + +### --- 11 --------------------------------------------------------------- +## --------------- C-c C-c was finding the wrong "beginning of function" +## [:FIXED:, 2011-05-28] +foobar <- function(...) {} +rm(list=ls()) + +##--------> consequence of the above experiments: +## the 2nd form is numerically "uniformly better" than the first +##--------> 2011-05-27: Change Frank's psiInv() to +## psiInv = function(t,theta) +## -log1p(exp(-theta)*expm1((1-t)*theta)/expm1(-theta)) + +### --- 12 --------------------------------------------------------------- +##--- In the following block, in the first line, C-c C-c does *NOT* behave +## VS[10-03-2012|ESS 12.03]: works fine for me: +th <- 48 # now do ls() and see what happened ... the horror !!! +d <- 3 +cpF <- list("Frank", list(th, 1:d)) +cop <- acF <- cpF$copula + +### --- 13 --------------------------------------------------------------- +## VS[05-05-2012|ESS 12.04]: looks like :FIXED: + +## From: Aleksandar Blagotic +## To: +## Subject: [ESS] R-mode: forward-sexp: Scan error: "Unbalanced parentheses" +## Date: Tue, 6 Dec 2011 01:24:11 +0100 + # +## Let's presuppose that I have a function like this: + # +fn <- function(x, ...){ + re <- "^#{1,6} [[:print:]]+$" + grepl(re, x, ...) +} +## As soon as I put my cursor at the end of the line with regexp, and +## press RET, I get this error: + +## forward-sexp: Scan error: "Unbalanced parentheses" +## +##------- +## Rodney S: I can reproduce it ... +## Martin M: I can NOT reproduce it, neither with 'emacs -Q'; +## tried both ESS 5.14 and ESS from svn +## VS[03-2012|12.03]: Cannot reproduce it either, solved? + + +### --- 14 --------------------------------------------------------------- +## check the behavior of ess-arg-function-offset-new-line + +a <- some.function( + arg1, + arg2) +## ^--- RRR has ess-arg-function-offset-new-line (4) ==> should indent here + +a <- some.function(arg1, + arg2) +## ^--- here + + +### --- 15 -------------------------------------------------------------- +## VS[05-05-2012|ESS 12.04]:FIXED: +## indentation of the 3rd line is wrong +for(s in seq(10, 50, len = 5)) + for(a in seq(.5, 1, len = 5)) + pt_dif_plot(s, a) +## ^-- here + +### --- 16 ---- +## VS[05-05-2012|ESS 12.04]:FIXED: +## MM[2014-04-28]: added '}' before else (=> "{" after if(.)) +## so parse() works at all! +## Gives error unbalanced para at else lines and indentation is wrong +## error: Point is not in a function according to 'ess-function-pattern'. +getOrCreateForm <- function(bindName, whereEnv) + if(exists(bindName, envir = get(".forms", envir = whereEnv))) { + get(bindName, envir = whereEnv) +### ^-- here + } else + new("protoForm") +### ^-- here + + + +parentContainer <- + if(is.null(.getPrototype(.Object@host))) { emptyenv() + } else sdf +### ^-- here + +parentContainer <- + if(is.null(.getPrototype(.Object@host))) emptyenv() + else sdf +### ^-- here + +### --- 17 --- +## Indentation ----- "expression" is special +expremmion <- c(1, 3, + 9876)# was always ok +## Had wrong indentation here: +expression <- c(2343, + 23874, 239487) + +## or here: +foo <- function(x) { + expression <- c(2343, + 23874, 239487) + 10 + expression +} + +## Where as here, we *do* want the indentation to +## *NOT* go all the way to the right: + +{ + my.long.Expression <- expression( + x[a[j]] == exp(theta[1] + theta[2]^2), + x[b[i]] == sin(theta[3] ~~ theta[4]) + ) + ausdruck <- expression + my.long.Expr...... <- ausdruck( + x[a[j]] == exp(theta[1] + theta[2]^2), + ) +} + +## VS[18-08-2012]: redundant feature. This is a feature for long subexpressions +## imidiately folowing new line. Documented in ess-arg-function-offset-new-line + +### --- 18 --- +## M-C-a (beginning of function) +## ----- anywhere inside the following function, M-C-a must go to beginning +Ops.x.x <- function(e1, e2) +{ + d <- dimCheck(e1,e2) + if((dens1 <- extends(c1 <- class(e1), "denseMatrix"))) + gen1 <- extends(c1, "generalMatrix") + if((dens2 <- extends(c2 <- class(e2), "denseMatrix"))) + gen2 <- extends(c2, "generalMatrix") + if(dens1 && dens2) { ## both inherit from ddense* + geM <- TRUE + if(!gen1) { + if(!gen2) { ## consider preserving "triangular" / "symmetric" + geM <- FALSE + le <- prod(d) + isPacked <- function(x) length(x@x) < le + } + } + ## now, in all cases @x should be matching & correct {only "uplo" part is used} + r <- callGeneric(e1@x, e2@x) + if(geM) + new(paste0(.M.kind(r), "geMatrix"), x = r, Dim = d, Dimnames = dimnames(e1)) + else + new(paste0(.M.kind(r), Mclass), x = r, Dim = d, .....) + } + else { + r <- .... + + ## criterion "2 * nnz(.) < ." as in sparseDefault() in Matrix() [./Matrix.R] : + if(2 * nnzero(r, na.counted = TRUE) < prod(d)) + as(r, "sparseMatrix") else r + } +} + + +### --- 19 --- +## indentation with regexp (bug in ess-backward-to-noncomment) +parse_roc <- function(lines, match = "^\\s*+\' ?") { + lines <- lines[str_detect(lines, match)] + if (length(lines) == 0) return(NULL) +### ^-- here (2014-11: fixed) +} + + +### --- 20 --- +## continuation indentation must be consistent in/out {}: + +{ + a <- ggplot(data = overtime.by.month, + aes(x="", y=Percent, fill = Overtime)) + + geom_bar(width = 1) + + xlab('') + + ylab(sub.txt) + + labs(title = title.txt) + + facet_wrap(~Year.Month) +} + +a <- ggplot(data = overtime.by.month, + aes(x="", y=Percent, fill = Overtime)) + + geom_bar(width = 1) + + xlab('') + + ylab(sub.txt) + + labs(title = title.txt) + + facet_wrap(~Year.Month) +### ^-- face_wrap must be here + + +### --- 20b --- +## From https://github.com/emacs-ess/ESS/issues/120 + +mean(rnorm(100, mean = runif(1, 1, 10)), na.rm =TRUE) + + 2 +## ^--- 2 is here + +mean(rnorm(100, mean = runif(1, 1, 10)), + na.rm =TRUE) + + 2 +## ^--- 2 is here + +mean(rnorm(100, + mean = runif(1, 1, 10)), na.rm=TRUE) + + 2 +## ^--- 2 is here + +### --- 21 --- + +## From: Marius Hofert +## Date: Fri, 15 Mar 2013 21:00:45 +0100 +## Hi, +## The following bug happens in ESS 12.09-2 [rev. 5395 (2013-01-10)]. Put the +## cursor in the line before the function head and hit C-c C-c. + +foo <- function(x) + x # bar +x <- 1:10 + +## I'll see +## > + > [1] 1 2 3 4 5 6 7 8 9 10 +## ESS 15.03: Error in eval(expr, .... : object 'x' not found + +foo <- function(x) x*x +bar <- function(y) y +## via C-c C-c leads to "Error: object 'bar' not found". -- fixed + + +### --- 22 ---- +## now correct indentation (inspite of # {was same reason as 19}) +if (!grepl("#", x)) + return(res) + +### --- 23 ---- +### three ways to indent closing parent depending on context: +foo <- + function_call( + a, + b, + c + ) +### ^-- ) is here now + +foo <- function_call( + a, + b, + c +) +### ")" is at column 0 + +foo <- function_call(a, + b, + c + ) +### ^-- ) is here + +### --- 24 --- +### shift comma in function calls + +foo <- function_call(a + , b + , c +### ^-- c is here + ) +### ^-- ) is here + +### --- 25 --- +## if/else in function calls and nested + +function_call(abc = + if (test) + do_something + else + do_something_else) + +function_call( + abc = + if (test) + do_something + else + do_something_else) + + +function_call(abc = if (test) + do_something + else + do_something_else) + +## real example is smooth.spline() source code [still (2015-04-08) wrong / bug!] +ss <- function (x, all.knots, nknots, ...) +{ + if (all.knots) { + if (!missing(nknots) && !is.null(nknots)) + warning("'all.knots' is TRUE; 'nknots' specification is disregarded") + nknots <- nx + } else if (is.null(nknots)) # <- for back compatibility + nknots <- .nknots.smspl(nx) + else { +### ^ want 'else' there + if (is.function(nknots)) + nknots <- nknots(nx) + else if (!is.numeric(nknots)) + stop("'nknots' must be numeric (in {1,..,n})") + if (nknots < 1) + stop("'nknots' must be at least 1") + else if (nknots > nx) + stop("cannot use more inner knots than unique 'x' values") + } +### ^-- want '}' there +} + +## "if" conditional is an exception of the continuation rules: +## Here, we do not want subsequently further indentation of the c1 || c2 || c3 +## part: +t2 <- function(x) { + if(long.expression.of.some.size(x, pi) || + another.longish.expression(sin(x)*exp(x)) || + a.third.condition.under.which.A.is.chosen) +### ^-- here + A + else + B +} + + +r <- + (some.function (x, 2342) + + another.f (x^3) + sdfsdf - sdfsdf + + and(x) + the(x) - last(x)*part(3)) + + +### --- 26 ---- +## This is formally correct R, though help(parse) mentions the line-length limit of +## 4095 __when reading from the console__ +## ESS gives syntax errors ("Error: unexpected ','" ...) when evaluating this +## because line length >= 4096 : +## +x <- c(1, 3.075819, 1.515999, 2.156169, 1.480742, 1.765485, 1.460206, 1.603707, 1.427429, 1.504712, 1.334528, 1.48297, 1.355308, 1.383867, 1.319241, 1.36065, 1.307467, 1.365596, 1.255259, 1.352741, 1.239381, 3.15342, 1.799889, 2.258497, 1.688312, 1.906779, 1.548203, 1.724785, 1.500873, 1.573442, 1.417137, 1.540805, 1.395945, 1.472596, 1.394247, 1.377487, 1.337394, 1.369354, 1.333378, 1.3181, 1.313813, 1.315528, 2.12777, 2.718898, 1.993509, 2.220433, 1.820585, 1.97782, 1.672455, 1.770151, 1.587478, 1.685352, 1.539295, 1.584536, 1.499487, 1.50702, 1.41952, 1.449058, 1.393042, 1.432999, 1.369964, 1.400997, 1.333824, 2.950549, 2.145387, 2.382224, 1.927077, 2.032489, 1.8371, 1.877833, 1.710891, 1.756053, 1.620778, 1.657761, 1.558978, 1.56257, 1.508633, 1.534406, 1.46709, 1.468734, 1.432529, 1.455283, 1.386975, 1.417532, 2.229573, 2.494447, 2.016117, 2.190061, 1.877996, 1.978964, 1.767284, 1.836948, 1.677372, 1.743316, 1.616383, 1.655964, 1.55484, 1.594831, 1.502185, 1.543723, 1.467005, 1.491123, 1.44402, 1.446915, 1.401578, 2.580264, 2.109121, 2.240741, 1.944719, 2.043397, 1.821808, 1.89725, 1.748788, 1.786988, 1.659333, 1.697012, 1.610622, 1.616503, 1.538529, 1.562024, 1.499964, 1.529344, 1.474519, 1.483264, 1.441552, 1.434448, 2.165233, 2.320281, 2.007836, 2.086471, 1.884052, 1.950563, 1.76926, 1.843328, 1.708941, 1.741039, 1.627206, 1.644755, 1.580563, 1.593402, 1.527312, 1.568418, 1.501462, 1.502542, 1.464583, 1.467921, 1.431141, 2.340443, 2.048262, 2.161097, 1.926082, 1.995422, 1.81446, 1.853165, 1.738533, 1.784456, 1.679444, 1.696463, 1.612931, 1.629483, 1.548186, 1.580026, 1.52198, 1.531111, 1.482914, 1.484824, 1.442726, 1.447838, 2.093386, 2.185793, 1.948989, 2.02804, 1.867137, 1.907732, 1.771923, 1.800413, 1.691612, 1.720603, 1.642705, 1.649769, 1.589028, 1.598955, 1.539759, 1.55096, 1.503965, 1.50703, 1.471349, 1.469791, 1.436959, 2.218315, 1.997369, 2.041128, 1.887059, 1.928524, 1.79626, 1.827538, 1.716748, 1.735696, 1.658329, 1.664211, 1.599286, 1.611511, 1.553925, 1.562637, 1.516805, 1.529894, 1.476064, 1.482474, 1.453253, 1.458467, 2.0247, 2.07899, 1.921976, 1.949376, 1.824629, 1.851671, 1.744713, 1.765647, 1.683525, 1.685592, 1.625113, 1.624961, 1.571921, 1.581223, 1.535257, 1.537464, 1.497165, 1.504879, 1.468682, 1.469319, 1.448344, 2.092315, 1.941412, 1.969843, 1.844093, 1.866133, 1.766145, 1.783829, 1.703613, 1.709714, 1.646078, 1.654264, 1.594523, 1.598488, 1.545105, 1.555356, 1.514627, 1.521353, 1.483958, 1.487677, 1.449191, 1.459721, 1.958987, 1.985144, 1.87739, 1.879643, 1.786823, 1.799642, 1.720015, 1.724688, 1.663539, 1.662997, 1.609267, 1.615124, 1.56746, 1.562026, 1.520586, 1.52503, 1.493008, 1.502496, 1.471983, 1.468546, 1.435064, 1.994706, 1.880348, 1.894254, 1.805827, 1.815965, 1.744296, 1.743389, 1.665481, 1.681644, 1.624466, 1.626109, 1.584028, 1.5818, 1.54376, 1.547237, 1.504878, 1.515087, 1.479032, 1.47936, 1.450758, 1.45073, 1.892685, 1.91087, 1.825301, 1.827176, 1.745363, 1.746115, 1.693373, 1.701692, 1.648247, 1.637112, 1.594648, 1.592013, 1.554849, 1.55013, 1.522186, 1.520901, 1.492606, 1.493072, 1.460868, 1.46733, 1.440956, 1.92771, 1.835696, 1.841979, 1.775991, 1.766092, 1.703807, 1.708791, 1.654985, 1.655917, 1.602388, 1.611867, 1.570765, 1.573368, 1.53419, 1.529033, 1.506767, 1.503596, 1.481126, 1.471806, 1.444917, 1.451682, 1.850262, 1.855034, 1.778997, 1.789995, 1.718871, 1.717326, 1.667357, 1.666291, 1.619743, 1.631475, 1.582624, 1.58766, 1.546302, 1.545063, 1.512222, 1.517888, 1.489127, 1.487271, 1.466722, 1.463618, 1.444137, 1.8709, 1.794033, 1.80121, 1.736376, 1.740201, 1.673776, 1.682541, 1.638153, 1.642294, 1.604417, 1.597721, 1.559534, 1.559108, 1.533942, 1.529348, 1.499517, 1.501586, 1.473147, 1.473031, 1.457615, 1.452348, 1.805753, 1.812952, 1.746549, 1.747222, 1.696924, 1.694957, 1.652157, 1.650568, 1.607807, 1.613666, 1.577295, 1.570712, 1.543704, 1.538272, 1.515369, 1.517113, 1.487451, 1.491593, 1.464514, 1.464658, 1.439359, 1.823222, 1.758781, 1.767358, 1.70872, 1.712926, 1.666956, 1.667838, 1.62077, 1.621445, 1.592891, 1.58549, 1.55603, 1.559042, 1.521501, 1.523342, 2, 3, 4) + +### --- 27 ---- +## Indentation after open brace +.a.lst <- + list(ex1 = function(p) { + cMah <- qchisq(0.975, p) + function(d) as.numeric(d < cMah) +### ^--- now here (less indented than prev.) + }, + ex2 = function(p) { + cM <- qchisq(0.95, p) + function(d) as.numeric(d < cM) +### ^--- here + }) +### ^--- '}' here + + +.a.lst <- list(ex1 = function(p) { + cMah <- qchisq(0.975, p) + function(d) as.numeric(d < cMah) +}, ## <- now at column 0 {also the next line} +ex2 = function(p) { + cM <- qchisq(0.95, p) + function(d) as.numeric(d < cM) +}) + + +.a.lst <- list(list(aa = { + bbb +### ^--- here +}, +aaa = function(p) { + qchisq(0.95, p) +### ^--- here +}, +aaaa = { + cccc +### ^--- here +})) + +list(function(p){ + abc +### ^-- here + ## <-- Press [Tab] before/at the first '#': should *NOT* insert '...=' +}) +### at column 0 + +(ab) { + sfdsf +### ^-- here +} + +### --- 27b --- [new, 2015-04-09] +print.MethodsFunction <- function(x, byclass = attr(x, "byclass"), ...) +{ + info <- attr(x, "info") + values <- if (byclass) { + unique(info$generic) + } else { + visible <- ifelse(info$visible, "", "*") + paste0(rownames(info), visible) +### ^-- both lines above should start here + } +### ^-- "}" here + + ## 2nd version: + val <- + if (byclass) { + unique(info$generic) + } else { + visible <- ifelse(info$visible, "", "*") + paste0(rownames(info), visible) +### ^-- both lines above should start here + } +### ^-- "}" here + invisible(x) +} + + + +### --- 28 --- [2015-02-17; still unfixed, 2015-11-21] +## Indentation of end-line comments (to column 40 = 'indent-column') +## {this is part of "real" code in Rmpfr/R/hjk.R}: +hjk <- function(x,n) { # <--- C-M-q "on {" -- does *no longer* indent the "# .." + ##-- Setting steps and stepsize ----- + nsteps <- floor(log2(1/tol)) # number of steps + steps <- 2^c(-(0:(nsteps-1))) # decreasing step size + dir <- diag(1, n, n) # orthogonal directions + + x <- par # start point + fx <- f(x) # smallest value so far + fcount <- 1 # counts number of function calls + + if (info) cat(sprintf("step nofc %-12s | %20s\n", + "fmin", "xpar")) + + ##-- Start the main loop ------------ + ns <- 0 + while (ns < nsteps && fcount < maxfeval && abs(fx) < target) { + ns <- ns + 1 + hjs <- .hjsearch(x, f, steps[ns], dir, fcount, maxfeval, target) + } + hjs +} + +### --- 29 --- +foreach(a = 1:3) %do% { + a^2 +### ^--- here +} + +foreach(a = 1:3) %:% + foreach(b = 10:13) %dopar% { +### ^--- here + a + b +### ^---- here + } +### ^--- here + +read.csv('file.csv') %>% + mutate(X = X+2, Y = Y/2) %>% +### ^--- here + filter(X < 5) +### ^-- here (*was* indented earlier) + + +### --- 30 --- +## a) ok: +{ + r <- array(if (d[3L] == 3L) + rgb(t(x[,,1L]), t(x[,,2L]), t(x[,,3L]), maxColorValue = max) + else if (d[3L] == 4L) + rgb(t(x[,,1L]), t(x[,,2L]), t(x[,,3L]), t(x[,,4L]), maxColorValue = max) + else stop("foo"), + dim = d[1:2]) +} + +## b) ok : +{ + obj <- obj && (condition1 || class2 %in% .BasicClasses || + condition3) +} + +## c) ok: +{ + if (any(abs(d) < .001*abs(dd) | + (is.na(d) & x == y))) + TRUE +} + + +### --- 31 -------- +## C-s "recog"; M-C-a -- should go to beginning of function, does not + +glmmTMB <- function (formula, data = NULL) +{ + ## glFormula <- function(formula, data=NULL, family = gaussian, + ## subset, weights, na.action, offset, + ## contrasts = NULL, mustart, etastart, + ## control = glmerControl(), ...) { + + ## FIXME: check for offsets in ziformula/dispformula, throw an error + + call <- mf <- mc <- match.call() + + if (is.null(family$family)) { + print(family) + stop("'family' not recognized") + } +} + + +### --- 32 --- 2015-11-07 --- indentation again! -------- +{ + yl <- if(strictlim) { + ylim + } + else { + range(y, ylim) + } + ## room below for weights + dy <- 4*dy +} +## -- 32 b) +{ + yl <- if(strictlim) { + ylim + } + else + range(y, ylim) + ## continue +} +## -- 32 c) +{ + U <- if(is.matrix(x)) + apply(x, 2, foo) / (nrow(x) + 1) + else + foo(x) / (length(x) + 1) +} +## 'else' now aligns with 'if' (and their code too) + +### --- 33 -- Treat `<<-` as `<-` +{ + f(X <- + callme(arg)) + f(X <<- + callme(arg)) +} +## the 2nd callme() now indents like the first + + +### --- 34 --- "eval-function" (e.g. C-c C-c) fails with this + +##' checking pretty(): +chkPretty <- function(x, n = 5, min.n = NULL, ..., max.D = 1) { + if(is.null(min.n)) { + ## work with both pretty.default() and greDevices::prettyDate() + ## *AND* these have a different default for 'min.n' we must be "extra smart": + min.n <- + if(inherits(x, "Date") || inherits(x, "POSIXt")) + n %/% 2 # grDevices:::prettyDate + else + n %/% 3 # pretty.default + } + pr <- pretty(x, n=n, min.n=min.n, ...) + ## if debugging: pr <- grDevices:::prettyDate(x, n=n, min.n=min.n, ...) + stopifnot(length(pr) >= (min.n+1), + abs(length(pr) - (n+1)) <= max.D, + ## must be equidistant [may need fuzz, i.e., signif(.) ?]: + length(pr) == 1 || length(unique(diff(pr))) == 1, + ## pretty(x, *) must cover range of x: + min(pr) <= min(x), max(x) <= max(pr)) + invisible(pr) +} + + +### --- 35 --- indentation of conditional function definitions: +## from a robustbase vignette: +{ + ## calculate robustness weights + lwgts <- Mwgt(lresid, lctrl$tuning.psi, lctrl$psi) + ## function to calculate robustified leverages + tfun <- + if (is.function(attr(estlist$design, 'gen'))) + function(i) { + if (all(is.na(wi <- lwgts[i,]))) wi + else .lmrob.hat(lXs[,,i,lcdn[2]],wi) + } + else +### \-<-- 'else' (and all below) should indent 4 more, 'else' matching the above 'if' + function(i) { + if (all(is.na(wi <- lwgts[i,]))) wi else .lmrob.hat(lX, wi) + } +} + +### --- 36 --- indentation of '#' inside string plus a '#' after that, issue #446 +A <- f("abc") + + f("abc") + f("abc") + + f("abc # abc") + + ## The above is now ok, + f("abc # abc") + # <- comment w/o quotes or hashtag -- fixed now: next line was indented to beginning of line + f("ABCDEF") + + f(g(h("abc # def"), "foo ## bar")) + + f("another") + + +### --- 37 ----------Github issue #432 ---- now fixed +## Indentation after string with "*" +fo4 <- function(x, ...) { + if(length(x) > 0) + warning("Result gave strings of *different* #{characters}") + x + ## 'x' was wrongly indented --here: ^ +} + +### --- 38 ----------Mario Bouguin to ESS-bugs, Nov 21, 2017 ---- +scored <- read.csv(scored_path, comment.char="#") +## writes +## When I'm on the line and execute ess-eval-region-or-function-or-paragraph-and-step (i.e. C-c C-c), R only receives this: +## +## > scored <- read.csv(scored_path, comment.char=" +## + +## MM: but I don't see this, so told him to upgrade ESS (he had 16.10, Windows) + + +### --- 39 --issue ..: problem *only* inside package code [ess-tracebug related] +rm(old,new) +old <- 10 # line 1, use ess-eval-line, i.e., C-c C-j +new <- old+1 # line 2, use ess-eval-line-and-step, i.e., C-c C-n + +### --- 40 -- C-M-e / C-M-a problems : +## (ess-goto-end-of-function-or-para) / (ess-goto-beginning-of-function-or-para) + +## If inside a function go to end of it. +## Otherwise go to the end of paragraph. +## ---------------------------------------------------------- + +## MM: have other examples which are still buggy (but not "here") + + +### Local Variables: +### page-delimiter: "^### --- [1-9]" +### End: diff -Nru ess-18.10.2/test/run-tests ess-18.10.2+git20220915.f45542e/test/run-tests --- ess-18.10.2/test/run-tests 2018-11-10 09:41:11.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/test/run-tests 2022-10-15 08:06:36.000000000 +0000 @@ -1,18 +1,20 @@ #!/usr/bin/env -S emacs --script +;; -*- mode: emacs-lisp -*- ;; This script must be run from the test directory ;; With no argument, run all tests. Otherwise run only mentioned tests. -;; Possible arguments: --rstats --rstats-indent +;; Possible arguments: --r --r-indent etc. (let ((current-directory (file-name-directory load-file-name))) + (setq ess-root-path (expand-file-name "../lisp/" current-directory)) (setq ess-test-path (expand-file-name "." current-directory)) - (setq ess-root-path (expand-file-name "../lisp/" current-directory))) + (setq etest-path (expand-file-name "etest/" ess-test-path))) (add-to-list 'load-path ess-root-path) (add-to-list 'load-path ess-test-path) +(add-to-list 'load-path etest-path) -(require 'ess-site) -(require 'ess-r-tests-utils) +(require 'ess-test-r-utils) (setq ess-inhibit-message-in-tests t) (setq ert-batch-backtrace-right-margin 130) @@ -21,27 +23,45 @@ (setq ess-use-flymake nil) (when (= (length argv) 0) - (setq argv '("--ess" "--inf" "--rstats" "--rstats-indent" "--literate"))) + (setq argv '("--ess" "--inf" "--org" "--r-core" "--r-indent" "--r-pkg" "--literate"))) + +;; Enable file-local variables while loading +(defun ess-test-load-locally (name &optional dir) + (let ((file (expand-file-name name dir))) + (unless (assoc file load-history) + (with-current-buffer (find-file-noselect file) + (load file nil t))))) + +(put 'etest-local-config 'safe-local-variable #'symbolp) (when (member "--ess" argv) - (load (expand-file-name "ess-tests.el" ess-test-path) nil t)) + (ess-test-load-locally "ess-test.el" ess-test-path)) (when (member "--inf" argv) - (load (expand-file-name "ess-inf-tests.el" ess-test-path) nil t) - (load (expand-file-name "ess-org-tests.el" ess-test-path) nil t)) -(when (member "--rstats" argv) - (load (expand-file-name "ess-r-tests.el" ess-test-path) nil t)) -(when (member "--rstats-indent" argv) - (load (expand-file-name "ess-indentation-tests.el" ess-test-path) nil t)) + (ess-test-load-locally "ess-test-inf.el" ess-test-path)) +(when (member "--org" argv) + (ess-test-load-locally "ess-test-org.el" ess-test-path)) +(when (member "--r-core" argv) + (ess-test-load-locally "ess-test-r-eval.el" ess-test-path) + (ess-test-load-locally "ess-test-r-mode.el" ess-test-path) + (ess-test-load-locally "ess-test-r-package.el" ess-test-path) + (ess-test-load-locally "ess-test-r-syntax.el" ess-test-path) + (ess-test-load-locally "ess-test-r.el" ess-test-path) + (ess-test-load-locally "ess-test-rd.el" ess-test-path)) +(when (member "--r-indent" argv) + (ess-test-load-locally "ess-test-indentation.el" ess-test-path)) +(when (member "--r-pkg" argv) + (ess-test-load-locally "ess-test-r-package.el" ess-test-path)) (when (member "--literate" argv) - (load (expand-file-name "ess-literate-tests.el" ess-test-path) nil t) + (ess-test-load-locally "ess-test-literate.el" ess-test-path) + (ess-test-load-locally "test-etest.el" etest-path) (elt-deftest test-elt () "elt.R") (elt-deftest test-ess-roxy-literate () "roxy.R") - (elt-deftest test-ess-r-code-fill () "code-fill.R") + ;; (elt-deftest test-ess-r-code-fill () "code-fill.R") (elt-deftest test-ess-r-misc () "misc.R") (elt-deftest test-ess-r-syntax () "syntax.R") (elt-deftest test-ess-r-tokens () "tokens.R") (elt-deftest test-ess-r-fontification () "fontification.R") - (elt-deftest test-ess-r-fontification () "keybindings.R")) + (elt-deftest test-ess-r-keybindings () "keybindings.R")) ;; run tests (ert-run-tests-batch-and-exit t) diff -Nru ess-18.10.2/test/styles/C++.R ess-18.10.2+git20220915.f45542e/test/styles/C++.R --- ess-18.10.2/test/styles/C++.R 2018-11-10 09:41:11.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/test/styles/C++.R 2022-10-15 08:06:36.000000000 +0000 @@ -1102,6 +1102,62 @@ funcall(!stuff1 || stuff2) +## 37 (issue #857) +fun_call({ + + stuff <- + namespace:::fun_call() %>% + fun_call() + + stuff +}) + +fun_call({ + stuff <- + namespace::fun_call() %>% + fun_call() + stuff +}) + +## 38a (issue #412) + +namespace::fun_call() %>% + namespace::fun_call() %>% + namespace::fun_call() %>% + namespace::fun_Call() + +## 38b + +namespace:::fun_call() %>% + namespace:::fun_call() %>% + namespace:::fun_call() %>% + namespace:::fun_Call() + +## 38c + +object@fun_call() %>% + object@fun_call() %>% + object@fun_call() %>% + object@fun_Call() + +## 38d + +object$fun_call() %>% + object$fun_call() %>% + object$fun_call() %>% + object$fun_Call() + + +## 39 +x |> + f1() |> + f2() |> + f3() + +## 40 +\(x) x + + 2 + ### Comments @@ -1226,9 +1282,14 @@ ### Specific situations and overrides -## 1 +## 10 fun_call( ifelse(condition1, argument1, ifelse(condition2, argument2, ifelse)) ) + +## 11 +1:10 |> + x => 2 ** x %>% + sum() diff -Nru ess-18.10.2/test/styles/misc1.R ess-18.10.2+git20220915.f45542e/test/styles/misc1.R --- ess-18.10.2/test/styles/misc1.R 2018-11-10 09:41:11.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/test/styles/misc1.R 2022-10-15 08:06:36.000000000 +0000 @@ -1102,6 +1102,62 @@ funcall(!stuff1 || stuff2) +## 37 (issue #857) +fun_call({ + + stuff <- + namespace:::fun_call() %>% + fun_call() + + stuff + }) + +fun_call({ + stuff <- + namespace::fun_call() %>% + fun_call() + stuff + }) + +## 38a (issue #412) + +namespace::fun_call() %>% + namespace::fun_call() %>% + namespace::fun_call() %>% + namespace::fun_Call() + +## 38b + +namespace:::fun_call() %>% + namespace:::fun_call() %>% + namespace:::fun_call() %>% + namespace:::fun_Call() + +## 38c + +object@fun_call() %>% + object@fun_call() %>% + object@fun_call() %>% + object@fun_Call() + +## 38d + +object$fun_call() %>% + object$fun_call() %>% + object$fun_call() %>% + object$fun_Call() + + +## 39 +x |> + f1() |> + f2() |> + f3() + +## 40 +\(x) x + + 2 + ### Comments @@ -1226,9 +1282,14 @@ ### Specific situations and overrides -## 1 +## 10 fun_call( ifelse(condition1, argument1, ifelse(condition2, argument2, ifelse)) ) + +## 11 +1:10 |> + x => 2 ** x %>% + sum() diff -Nru ess-18.10.2/test/styles/RRR.R ess-18.10.2+git20220915.f45542e/test/styles/RRR.R --- ess-18.10.2/test/styles/RRR.R 2018-11-10 09:41:11.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/test/styles/RRR.R 2022-10-15 08:06:36.000000000 +0000 @@ -1102,6 +1102,62 @@ funcall(!stuff1 || stuff2) +## 37 (issue #857) +fun_call({ + + stuff <- + namespace:::fun_call() %>% + fun_call() + + stuff +}) + +fun_call({ + stuff <- + namespace::fun_call() %>% + fun_call() + stuff +}) + +## 38a (issue #412) + +namespace::fun_call() %>% + namespace::fun_call() %>% + namespace::fun_call() %>% + namespace::fun_Call() + +## 38b + +namespace:::fun_call() %>% + namespace:::fun_call() %>% + namespace:::fun_call() %>% + namespace:::fun_Call() + +## 38c + +object@fun_call() %>% + object@fun_call() %>% + object@fun_call() %>% + object@fun_Call() + +## 38d + +object$fun_call() %>% + object$fun_call() %>% + object$fun_call() %>% + object$fun_Call() + + +## 39 +x |> + f1() |> + f2() |> + f3() + +## 40 +\(x) x + + 2 + ### Comments @@ -1226,9 +1282,14 @@ ### Specific situations and overrides -## 1 +## 10 fun_call( ifelse(condition1, argument1, ifelse(condition2, argument2, ifelse)) ) + +## 11 +1:10 |> + x => 2 ** x %>% + sum() diff -Nru ess-18.10.2/test/styles/RRR+.R ess-18.10.2+git20220915.f45542e/test/styles/RRR+.R --- ess-18.10.2/test/styles/RRR+.R 2018-11-10 09:41:11.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/test/styles/RRR+.R 2022-10-15 08:06:36.000000000 +0000 @@ -1102,6 +1102,62 @@ funcall(!stuff1 || stuff2) +## 37 (issue #857) +fun_call({ + + stuff <- + namespace:::fun_call() %>% + fun_call() + + stuff + }) + +fun_call({ + stuff <- + namespace::fun_call() %>% + fun_call() + stuff + }) + +## 38a (issue #412) + +namespace::fun_call() %>% + namespace::fun_call() %>% + namespace::fun_call() %>% + namespace::fun_Call() + +## 38b + +namespace:::fun_call() %>% + namespace:::fun_call() %>% + namespace:::fun_call() %>% + namespace:::fun_Call() + +## 38c + +object@fun_call() %>% + object@fun_call() %>% + object@fun_call() %>% + object@fun_Call() + +## 38d + +object$fun_call() %>% + object$fun_call() %>% + object$fun_call() %>% + object$fun_Call() + + +## 39 +x |> + f1() |> + f2() |> + f3() + +## 40 +\(x) x + + 2 + ### Comments @@ -1226,9 +1282,14 @@ ### Specific situations and overrides -## 1 +## 10 fun_call( ifelse(condition1, argument1, ifelse(condition2, argument2, ifelse)) ) + +## 11 +1:10 |> + x => 2 ** x %>% + sum() diff -Nru ess-18.10.2/test/styles/RStudio-.R ess-18.10.2+git20220915.f45542e/test/styles/RStudio-.R --- ess-18.10.2/test/styles/RStudio-.R 2018-11-10 09:41:11.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/test/styles/RStudio-.R 2022-10-15 08:06:36.000000000 +0000 @@ -1102,6 +1102,62 @@ funcall(!stuff1 || stuff2) +## 37 (issue #857) +fun_call({ + + stuff <- + namespace:::fun_call() %>% + fun_call() + + stuff +}) + +fun_call({ + stuff <- + namespace::fun_call() %>% + fun_call() + stuff +}) + +## 38a (issue #412) + +namespace::fun_call() %>% + namespace::fun_call() %>% + namespace::fun_call() %>% + namespace::fun_Call() + +## 38b + +namespace:::fun_call() %>% + namespace:::fun_call() %>% + namespace:::fun_call() %>% + namespace:::fun_Call() + +## 38c + +object@fun_call() %>% + object@fun_call() %>% + object@fun_call() %>% + object@fun_Call() + +## 38d + +object$fun_call() %>% + object$fun_call() %>% + object$fun_call() %>% + object$fun_Call() + + +## 39 +x |> + f1() |> + f2() |> + f3() + +## 40 +\(x) x + + 2 + ### Comments @@ -1226,9 +1282,14 @@ ### Specific situations and overrides -## 1 +## 10 fun_call( ifelse(condition1, argument1, ifelse(condition2, argument2, ifelse)) ) + +## 11 +1:10 |> + x => 2 ** x %>% + sum() diff -Nru ess-18.10.2/.travis.yml ess-18.10.2+git20220915.f45542e/.travis.yml --- ess-18.10.2/.travis.yml 2018-11-10 09:41:10.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/.travis.yml 2022-10-15 08:06:36.000000000 +0000 @@ -1,9 +1,14 @@ language: emacs-lisp env: - - EVM_EMACS=emacs-24.3-travis + # When there's a new major Emacs release, also update + # byte-compile-error-on-warn to the new release, below + - EVM_EMACS=emacs-25.1-travis - EVM_EMACS=emacs-25.3-travis - - EVM_EMACS=emacs-26.1-travis - - EVM_EMACS=emacs-git-snapshot-travis + - EVM_EMACS=emacs-26.1-travis-linux-xenial + - EVM_EMACS=emacs-26.2-travis-linux-xenial + - EVM_EMACS=emacs-26.3-travis-linux-xenial + - EVM_EMACS=emacs-27.1-travis-linux-xenial + - EVM_EMACS=emacs-git-snapshot-travis-linux-xenial before_install: - echo "deb https://cloud.r-project.org/bin/linux/ubuntu trusty/" | sudo tee -a /etc/apt/sources.list @@ -34,5 +39,11 @@ script: - emacs --version - R --version -- make all -- make test +- cd lisp; make julia-mode.elc +- cd .. +- make -C test -k all +- make -C doc ../README +# Create package.el-installable tar file, test that it installs +# successfully: +- make package +- emacs --script targets/travis-install-package.el diff -Nru ess-18.10.2/VERSION ess-18.10.2+git20220915.f45542e/VERSION --- ess-18.10.2/VERSION 2018-11-10 09:41:10.000000000 +0000 +++ ess-18.10.2+git20220915.f45542e/VERSION 2022-10-15 08:06:36.000000000 +0000 @@ -1 +1 @@ -18.10.2 +18.10.3snapshot