From bbfef1c2d8b83fbbfa4645ea077f139630dd557c Mon Sep 17 00:00:00 2001 From: Andreas Gerler Date: Thu, 31 Oct 2019 14:59:41 +0100 Subject: [PATCH] update ess --- elpa/ess-20190121.1430/ess-autoloads.el | 603 ----- elpa/ess-20190121.1430/ess-rutils.el | 407 ---- elpa/ess-20190121.1430/ess-site.el | 124 -- elpa/ess-20190121.1430/etc/ESSR/R/mpi.R | 23 - elpa/ess-20190121.1430/etc/R-ESS-bugs.R | 961 -------- elpa/ess-20190121.1430/etc/R-ESS-bugs.el | 91 - elpa/ess-20190121.1430/etc/R-error-patterns.R | 71 - elpa/ess-20190121.1430/etc/completion_ideas.R | 30 - elpa/ess-20190121.1430/etc/gpl-check | 56 - elpa/ess-20190121.1430/etc/pkg-Maintainers | 3 - .../.dir-locals.el | 0 .../allnews.info | 60 +- .../announc.info | 96 +- .../authors.info | 0 .../bugrept.info | 0 .../credits.info | 0 .../currfeat.info | 0 .../dir | 0 elpa/ess-20191014.1343/ess-autoloads.el | 405 ++++ .../ess-bugs-d.el | 7 +- .../ess-bugs-l.el | 46 +- .../ess-custom.el | 762 +++---- .../ess-defs.info | 0 .../ess-gretl.el | 208 +- .../ess-help.el | 600 +++-- .../ess-inf.el | 1004 ++++----- .../ess-jags-d.el | 7 +- .../ess-julia.el | 112 +- .../ess-mode.el | 370 ++-- .../ess-pkg.el | 2 +- .../ess-r-completion.el | 109 +- .../ess-r-flymake.el | 41 +- .../ess-r-mode.el | 1257 +++++++---- .../ess-r-package.el | 109 +- .../ess-r-syntax.el | 20 +- .../ess-r-xref.el | 1 - .../ess-rd.el | 177 +- .../ess-rdired.el | 95 +- .../ess-roxy.el | 138 +- .../ess-s-lang.el | 350 +-- .../ess-sas-a.el | 20 +- .../ess-sas-d.el | 23 +- .../ess-sas-l.el | 16 +- elpa/ess-20191014.1343/ess-site.el | 71 + .../ess-sp6-d.el | 20 +- .../ess-stata-lang.el | 38 +- .../ess-stata-mode.el | 105 +- .../ess-toolbar.el | 16 +- .../ess-tracebug.el | 549 +++-- .../ess-trns.el | 73 +- .../ess-utils.el | 386 +--- .../ess.el | 91 +- .../ess.info | 669 +++--- .../essd-els.el | 55 +- .../etc/ESSR.rds | Bin .../etc/ESSR/BUILDESSR | 2 +- .../etc/ESSR/LOADREMOTE | 0 .../etc/ESSR/R/.basic.R | 0 .../etc/ESSR/R/.load.R | 2 +- .../etc/ESSR/R/completion.R | 14 +- .../etc/ESSR/R/debug.R | 13 +- .../etc/ESSR/R/misc.R | 4 +- elpa/ess-20191014.1343/etc/ESSR/R/mpi.R | 28 + .../etc/ESSR/R/ns-eval.R | 6 + .../etc/ESSR/R/pkg.R | 0 .../etc/Makefile | 0 .../etc/ess-julia.jl | 11 +- .../etc/ess-sas-sh-command | 0 .../license.info | 0 .../mailing.info | 2 +- .../make-regexp.el | 0 .../news.info | 56 +- elpa/ess-20191014.1343/obsolete/ess-eldoc.el | 172 ++ .../obsolete}/ess-mouse.el | 0 .../obsolete/ess-noweb-font-lock-mode.el | 392 ++++ .../obsolete/ess-noweb-mode.el | 1938 +++++++++++++++++ elpa/ess-20191014.1343/obsolete/ess-noweb.el | 138 ++ .../obsolete}/ess-r-a.el | 13 +- elpa/ess-20191014.1343/obsolete/ess-r-args.el | 354 +++ elpa/ess-20191014.1343/obsolete/ess-rutils.el | 41 + elpa/ess-20191014.1343/obsolete/ess-swv.el | 491 +++++ .../obsolete}/mouseme.el | 0 elpa/ess-20191014.1343/obsolete/msdos.el | 169 ++ .../onews.info | 4 +- .../readme.info | 94 +- .../requires.info | 0 86 files changed, 7995 insertions(+), 6426 deletions(-) delete mode 100644 elpa/ess-20190121.1430/ess-autoloads.el delete mode 100644 elpa/ess-20190121.1430/ess-rutils.el delete mode 100644 elpa/ess-20190121.1430/ess-site.el delete mode 100644 elpa/ess-20190121.1430/etc/ESSR/R/mpi.R delete mode 100644 elpa/ess-20190121.1430/etc/R-ESS-bugs.R delete mode 100644 elpa/ess-20190121.1430/etc/R-ESS-bugs.el delete mode 100644 elpa/ess-20190121.1430/etc/R-error-patterns.R delete mode 100644 elpa/ess-20190121.1430/etc/completion_ideas.R delete mode 100755 elpa/ess-20190121.1430/etc/gpl-check delete mode 100644 elpa/ess-20190121.1430/etc/pkg-Maintainers rename elpa/{ess-20190121.1430 => ess-20191014.1343}/.dir-locals.el (100%) rename elpa/{ess-20190121.1430 => ess-20191014.1343}/allnews.info (97%) rename elpa/{ess-20190121.1430 => ess-20191014.1343}/announc.info (90%) rename elpa/{ess-20190121.1430 => ess-20191014.1343}/authors.info (100%) rename elpa/{ess-20190121.1430 => ess-20191014.1343}/bugrept.info (100%) rename elpa/{ess-20190121.1430 => ess-20191014.1343}/credits.info (100%) rename elpa/{ess-20190121.1430 => ess-20191014.1343}/currfeat.info (100%) rename elpa/{ess-20190121.1430 => ess-20191014.1343}/dir (100%) create mode 100644 elpa/ess-20191014.1343/ess-autoloads.el rename elpa/{ess-20190121.1430 => ess-20191014.1343}/ess-bugs-d.el (98%) rename elpa/{ess-20190121.1430 => ess-20191014.1343}/ess-bugs-l.el (89%) rename elpa/{ess-20190121.1430 => ess-20191014.1343}/ess-custom.el (78%) rename elpa/{ess-20190121.1430 => ess-20191014.1343}/ess-defs.info (100%) rename elpa/{ess-20190121.1430 => ess-20191014.1343}/ess-gretl.el (78%) rename elpa/{ess-20190121.1430 => ess-20191014.1343}/ess-help.el (59%) rename elpa/{ess-20190121.1430 => ess-20191014.1343}/ess-inf.el (81%) rename elpa/{ess-20190121.1430 => ess-20191014.1343}/ess-jags-d.el (98%) rename elpa/{ess-20190121.1430 => ess-20191014.1343}/ess-julia.el (87%) rename elpa/{ess-20190121.1430 => ess-20191014.1343}/ess-mode.el (66%) rename elpa/{ess-20190121.1430 => ess-20191014.1343}/ess-pkg.el (92%) rename elpa/{ess-20190121.1430 => ess-20191014.1343}/ess-r-completion.el (89%) rename elpa/{ess-20190121.1430 => ess-20191014.1343}/ess-r-flymake.el (88%) rename elpa/{ess-20190121.1430 => ess-20191014.1343}/ess-r-mode.el (65%) rename elpa/{ess-20190121.1430 => ess-20191014.1343}/ess-r-package.el (85%) rename elpa/{ess-20190121.1430 => ess-20191014.1343}/ess-r-syntax.el (99%) rename elpa/{ess-20190121.1430 => ess-20191014.1343}/ess-r-xref.el (99%) rename elpa/{ess-20190121.1430 => ess-20191014.1343}/ess-rd.el (75%) rename elpa/{ess-20190121.1430 => ess-20191014.1343}/ess-rdired.el (77%) rename elpa/{ess-20190121.1430 => ess-20191014.1343}/ess-roxy.el (92%) rename elpa/{ess-20190121.1430 => ess-20191014.1343}/ess-s-lang.el (59%) rename elpa/{ess-20190121.1430 => ess-20191014.1343}/ess-sas-a.el (98%) rename elpa/{ess-20190121.1430 => ess-20191014.1343}/ess-sas-d.el (96%) rename elpa/{ess-20190121.1430 => ess-20191014.1343}/ess-sas-l.el (99%) create mode 100644 elpa/ess-20191014.1343/ess-site.el rename elpa/{ess-20190121.1430 => ess-20191014.1343}/ess-sp6-d.el (94%) rename elpa/{ess-20190121.1430 => ess-20191014.1343}/ess-stata-lang.el (97%) rename elpa/{ess-20190121.1430 => ess-20191014.1343}/ess-stata-mode.el (70%) rename elpa/{ess-20190121.1430 => ess-20191014.1343}/ess-toolbar.el (93%) rename elpa/{ess-20190121.1430 => ess-20191014.1343}/ess-tracebug.el (88%) rename elpa/{ess-20190121.1430 => ess-20191014.1343}/ess-trns.el (79%) rename elpa/{ess-20190121.1430 => ess-20191014.1343}/ess-utils.el (76%) rename elpa/{ess-20190121.1430 => ess-20191014.1343}/ess.el (77%) rename elpa/{ess-20190121.1430 => ess-20191014.1343}/ess.info (93%) rename elpa/{ess-20190121.1430 => ess-20191014.1343}/essd-els.el (82%) rename elpa/{ess-20190121.1430 => ess-20191014.1343}/etc/ESSR.rds (100%) rename elpa/{ess-20190121.1430 => ess-20191014.1343}/etc/ESSR/BUILDESSR (90%) rename elpa/{ess-20190121.1430 => ess-20191014.1343}/etc/ESSR/LOADREMOTE (100%) rename elpa/{ess-20190121.1430 => ess-20191014.1343}/etc/ESSR/R/.basic.R (100%) rename elpa/{ess-20190121.1430 => ess-20191014.1343}/etc/ESSR/R/.load.R (98%) rename elpa/{ess-20190121.1430 => ess-20191014.1343}/etc/ESSR/R/completion.R (94%) rename elpa/{ess-20190121.1430 => ess-20191014.1343}/etc/ESSR/R/debug.R (98%) rename elpa/{ess-20190121.1430 => ess-20191014.1343}/etc/ESSR/R/misc.R (98%) create mode 100644 elpa/ess-20191014.1343/etc/ESSR/R/mpi.R rename elpa/{ess-20190121.1430 => ess-20191014.1343}/etc/ESSR/R/ns-eval.R (99%) rename elpa/{ess-20190121.1430 => ess-20191014.1343}/etc/ESSR/R/pkg.R (100%) rename elpa/{ess-20190121.1430 => ess-20191014.1343}/etc/Makefile (100%) rename elpa/{ess-20190121.1430 => ess-20191014.1343}/etc/ess-julia.jl (89%) rename elpa/{ess-20190121.1430 => ess-20191014.1343}/etc/ess-sas-sh-command (100%) rename elpa/{ess-20190121.1430 => ess-20191014.1343}/license.info (100%) rename elpa/{ess-20190121.1430 => ess-20191014.1343}/mailing.info (91%) rename elpa/{ess-20190121.1430 => ess-20191014.1343}/make-regexp.el (100%) rename elpa/{ess-20190121.1430 => ess-20191014.1343}/news.info (88%) create mode 100644 elpa/ess-20191014.1343/obsolete/ess-eldoc.el rename elpa/{ess-20190121.1430 => ess-20191014.1343/obsolete}/ess-mouse.el (100%) create mode 100644 elpa/ess-20191014.1343/obsolete/ess-noweb-font-lock-mode.el create mode 100644 elpa/ess-20191014.1343/obsolete/ess-noweb-mode.el create mode 100644 elpa/ess-20191014.1343/obsolete/ess-noweb.el rename elpa/{ess-20190121.1430 => ess-20191014.1343/obsolete}/ess-r-a.el (92%) create mode 100644 elpa/ess-20191014.1343/obsolete/ess-r-args.el create mode 100644 elpa/ess-20191014.1343/obsolete/ess-rutils.el create mode 100644 elpa/ess-20191014.1343/obsolete/ess-swv.el rename elpa/{ess-20190121.1430 => ess-20191014.1343/obsolete}/mouseme.el (100%) create mode 100644 elpa/ess-20191014.1343/obsolete/msdos.el rename elpa/{ess-20190121.1430 => ess-20191014.1343}/onews.info (99%) rename elpa/{ess-20190121.1430 => ess-20191014.1343}/readme.info (90%) rename elpa/{ess-20190121.1430 => ess-20191014.1343}/requires.info (100%) diff --git a/elpa/ess-20190121.1430/ess-autoloads.el b/elpa/ess-20190121.1430/ess-autoloads.el deleted file mode 100644 index a04d2710..00000000 --- a/elpa/ess-20190121.1430/ess-autoloads.el +++ /dev/null @@ -1,603 +0,0 @@ -;;; ess-autoloads.el --- automatically extracted autoloads -;; -;;; Code: - -(add-to-list 'load-path (directory-file-name - (or (file-name-directory #$) (car load-path)))) - - -;;;### (autoloads nil "ess" "ess.el" (0 0 0 0)) -;;; Generated autoloads from ess.el - -(autoload 'ess-version "ess" "\ -Return a string with ESS version information. - -\(fn)" t nil) - -(autoload 'ess-submit-bug-report "ess" "\ -Submit a bug report to the ESS maintainers. - -\(fn)" t nil) - -(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ess" '("ess"))) - -;;;*** - -;;;### (autoloads nil "ess-bugs-d" "ess-bugs-d.el" (0 0 0 0)) -;;; Generated autoloads from ess-bugs-d.el - -(autoload 'ess-bugs-mode "ess-bugs-d" "\ -Major mode for BUGS. - -\(fn)" t nil) - -(add-to-list 'auto-mode-alist '("\\.[Bb][Uu][Gg]\\'" . ess-bugs-mode)) - -(add-to-list 'auto-mode-alist '("\\.[Bb][Oo][Gg]\\'" . ess-bugs-mode)) - -(add-to-list 'auto-mode-alist '("\\.[Bb][Mm][Dd]\\'" . ess-bugs-mode)) - -(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ess-bugs-d" '("ess-"))) - -;;;*** - -;;;### (autoloads nil "ess-bugs-l" "ess-bugs-l.el" (0 0 0 0)) -;;; Generated autoloads from ess-bugs-l.el - -(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ess-bugs-l" '("ess-bugs-"))) - -;;;*** - -;;;### (autoloads nil "ess-custom" "ess-custom.el" (0 0 0 0)) -;;; Generated autoloads from ess-custom.el - (put 'ess-style 'safe-local-variable #'symbolp) - -(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ess-custom" '("ess-" "inferior-" "comint-highlight-prompt" "SAS-mode-hook" "S+" "S-" "Rnw-mode-hook" "R-"))) - -;;;*** - -;;;### (autoloads nil "ess-gretl" "ess-gretl.el" (0 0 0 0)) -;;; Generated autoloads from ess-gretl.el - -(autoload 'ess-gretl-mode "ess-gretl" "\ -Major mode for editing gretl source. See `ess-mode' for more help. - -\(fn)" t nil) - -(autoload 'gretl "ess-gretl" "\ -Call 'gretl', -Optional prefix (C-u) allows to set command line arguments, such as ---vsize. This should be OS agnostic. -If you have certain command line arguments that should always be passed -to gretl, put them in the variable `inferior-gretl-args'. - -\(fn &optional START-ARGS)" t nil) - -(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ess-gretl" '("ess-gretl-" "inferior-gretl-args" "gretl-"))) - -;;;*** - -;;;### (autoloads nil "ess-help" "ess-help.el" (0 0 0 0)) -;;; Generated autoloads from ess-help.el - -(autoload 'ess-display-help-on-object "ess-help" "\ -Display documentation for OBJECT in another window. -If prefix arg is given, force an update of the cached help topics -and query the ESS process for the help file instead of reusing an -existing buffer if it exists. Uses the variable -`inferior-ess-help-command' for the actual help command. Prompts -for the object name based on the cursor location for all cases -except the S-Plus GUI. With S-Plus on Windows (both GUI and in an -inferior Emacs buffer) the GUI help window is used. If COMMAND is -suplied, it is used instead of `inferior-ess-help-command'. - -\(fn OBJECT &optional COMMAND)" t nil) - -(defalias 'ess-help 'ess-display-help-on-object) - -(autoload 'ess-goto-info "ess-help" "\ -Display node NODE from `ess-mode' info. - -\(fn NODE)" nil nil) - -(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ess-help" '("ess-"))) - -;;;*** - -;;;### (autoloads nil "ess-inf" "ess-inf.el" (0 0 0 0)) -;;; Generated autoloads from ess-inf.el - -(autoload 'ess-load-file "ess-inf" "\ -Load FILENAME into an inferior ESS process. -This handles Tramp when working on a remote. - -\(fn &optional FILENAME)" t nil) - -(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ess-inf" '("ess-" "inferior-ess" "update-ess-process-name-list" "with-ess-process-buffer"))) - -;;;*** - -;;;### (autoloads nil "ess-jags-d" "ess-jags-d.el" (0 0 0 0)) -;;; Generated autoloads from ess-jags-d.el - -(autoload 'ess-jags-mode "ess-jags-d" "\ -Major mode for JAGS. - -\(fn)" t nil) - -(add-to-list 'auto-mode-alist '("\\.[Jj][Aa][Gg]\\'" . ess-jags-mode)) - -(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ess-jags-d" '("ess-jags-"))) - -;;;*** - -;;;### (autoloads nil "ess-julia" "ess-julia.el" (0 0 0 0)) -;;; Generated autoloads from ess-julia.el - -(autoload 'ess-julia-mode "ess-julia" "\ -Major mode for julia files. - -\(fn)" t nil) - -(autoload 'julia "ess-julia" "\ -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'. - -\(fn &optional START-ARGS)" t nil) - -(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ess-julia" '("ess-" "inferior-" "company-ess-julia-objects" "ac-source-ess-julia-objects"))) - -;;;*** - -;;;### (autoloads nil "ess-mode" "ess-mode.el" (0 0 0 0)) -;;; Generated autoloads from ess-mode.el - -(autoload 'ess-mode "ess-mode" "\ -Major mode for editing ESS source. -Optional arg ALIST describes how to customize the editing mode. -Optional arg PROC-NAME is name of associated inferior process. - -\\{ess-mode-map} - -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-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. See `ess-style-alist' for predefined styles. - -\(fn)" t nil) - -(autoload 'ess-dump-object-into-edit-buffer "ess-mode" "\ -Edit an ESS OBJECT in its own buffer. -Without a prefix argument, this simply finds the file pointed to by -`ess-source-directory'. If this file does not exist, or if a -prefix argument is given, a dump() command is sent to the ESS process to -generate the source buffer. - -\(fn OBJECT)" t nil) - -(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ess-mode" '("ess-"))) - -;;;*** - -;;;### (autoloads nil "ess-mouse" "ess-mouse.el" (0 0 0 0)) -;;; Generated autoloads from ess-mouse.el - -(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ess-mouse" '("ess-"))) - -;;;*** - -;;;### (autoloads nil "ess-r-a" "ess-r-a.el" (0 0 0 0)) -;;; Generated autoloads from ess-r-a.el - -(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ess-r-a" '("pd::set-up-demo" "ess"))) - -;;;*** - -;;;### (autoloads nil "ess-r-completion" "ess-r-completion.el" (0 -;;;;;; 0 0 0)) -;;; Generated autoloads from ess-r-completion.el - -(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ess-r-completion" '("ess-" "ac-source-R" "company-R-"))) - -;;;*** - -;;;### (autoloads nil "ess-r-flymake" "ess-r-flymake.el" (0 0 0 0)) -;;; Generated autoloads from ess-r-flymake.el - -(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ess-r-flymake" '("ess-r-"))) - -;;;*** - -;;;### (autoloads nil "ess-r-mode" "ess-r-mode.el" (0 0 0 0)) -;;; Generated autoloads from ess-r-mode.el - -(defvar ess-dev-map (let (ess-dev-map) (define-prefix-command 'ess-dev-map) (define-key ess-dev-map "" 'ess-r-set-evaluation-env) (define-key ess-dev-map "s" 'ess-r-set-evaluation-env) (define-key ess-dev-map "T" 'ess-toggle-tracebug) (define-key ess-dev-map "\f" 'ess-r-devtools-load-package) (define-key ess-dev-map "l" 'ess-r-devtools-load-package) (define-key ess-dev-map "`" 'ess-show-traceback) (define-key ess-dev-map "~" 'ess-show-call-stack) (define-key ess-dev-map "" 'ess-watch) (define-key ess-dev-map "w" 'ess-watch) (define-key ess-dev-map "" 'ess-debug-flag-for-debugging) (define-key ess-dev-map "d" 'ess-debug-flag-for-debugging) (define-key ess-dev-map "" 'ess-debug-unflag-for-debugging) (define-key ess-dev-map "u" 'ess-debug-unflag-for-debugging) (define-key ess-dev-map [(control 68)] 'ess-debug-unflag-for-debugging) (define-key ess-dev-map "" 'ess-bp-set) (define-key ess-dev-map "b" 'ess-bp-set) (define-key ess-dev-map [(control 66)] 'ess-bp-set-conditional) (define-key ess-dev-map "B" 'ess-bp-set-conditional) (define-key ess-dev-map "\f" 'ess-bp-set-logger) (define-key ess-dev-map "L" 'ess-bp-set-logger) (define-key ess-dev-map "" 'ess-bp-toggle-state) (define-key ess-dev-map "o" 'ess-bp-toggle-state) (define-key ess-dev-map " " 'ess-bp-kill) (define-key ess-dev-map "k" 'ess-bp-kill) (define-key ess-dev-map " " 'ess-bp-kill-all) (define-key ess-dev-map "K" 'ess-bp-kill-all) (define-key ess-dev-map "" 'ess-bp-next) (define-key ess-dev-map "n" 'ess-bp-next) (define-key ess-dev-map "i" 'ess-debug-goto-input-event-marker) (define-key ess-dev-map "I" 'ess-debug-goto-input-event-marker) (define-key ess-dev-map "" 'ess-bp-previous) (define-key ess-dev-map "p" 'ess-bp-previous) (define-key ess-dev-map "" 'ess-debug-toggle-error-action) (define-key ess-dev-map "e" 'ess-debug-toggle-error-action) (define-key ess-dev-map "0" 'ess-electric-selection) (define-key ess-dev-map "1" 'ess-electric-selection) (define-key ess-dev-map "2" 'ess-electric-selection) (define-key ess-dev-map "3" 'ess-electric-selection) (define-key ess-dev-map "4" 'ess-electric-selection) (define-key ess-dev-map "5" 'ess-electric-selection) (define-key ess-dev-map "6" 'ess-electric-selection) (define-key ess-dev-map "7" 'ess-electric-selection) (define-key ess-dev-map "8" 'ess-electric-selection) (define-key ess-dev-map "9" 'ess-electric-selection) (define-key ess-dev-map "?" 'ess-tracebug-show-help) ess-dev-map) "\ -Keymap for commands related to development and debugging.") - -(autoload 'run-ess-r "ess-r-mode" "\ -Call 'R', the 'GNU S' system from the R Foundation. -Optional prefix (\\[universal-argument]) allows to set command line arguments, such as ---vsize. This should be OS agnostic. -If you have certain command line arguments that should always be passed -to R, put them in the variable `inferior-R-args'. - -START-ARGS can be a string representing an argument, a list of -such strings, or any other non-nil value. In the latter case, you -will be prompted to enter arguments interactively. - -\(fn &optional START-ARGS)" t nil) - -(defalias 'R #'run-ess-r) - -(autoload 'ess-r-mode "ess-r-mode" "\ -Major mode for editing R source. See `ess-mode' for more help. - -\(fn)" t nil) - -(defalias 'R-mode 'ess-r-mode) - -(defalias 'r-mode 'ess-r-mode) - -(add-to-list 'auto-mode-alist '("/R/.*\\.q\\'" . ess-r-mode)) - -(add-to-list 'auto-mode-alist '("\\.[rR]\\'" . ess-r-mode)) - -(add-to-list 'auto-mode-alist '("\\.[rR]profile\\'" . ess-r-mode)) - -(add-to-list 'auto-mode-alist '("NAMESPACE\\'" . ess-r-mode)) - -(add-to-list 'auto-mode-alist '("CITATION\\'" . ess-r-mode)) - -(autoload 'ess-r-transcript-mode "ess-r-mode" "\ -A Major mode for R transcript files. - -\(fn)" t nil) - -(add-to-list 'auto-mode-alist '("\\.[Rr]out" . ess-r-transcript-mode)) - -(add-to-list 'interpreter-mode-alist '("Rscript" . ess-r-mode)) - -(add-to-list 'interpreter-mode-alist '("r" . ess-r-mode)) - -(add-to-list 'auto-mode-alist '("/Makevars\\(\\.win\\)?$" . makefile-mode)) - -(add-to-list 'auto-mode-alist '("DESCRIPTION$" . conf-colon-mode)) - -(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ess-r-mode" '("ess-" "inferior-ess-r-" "R-"))) - -;;;*** - -;;;### (autoloads nil "ess-r-package" "ess-r-package.el" (0 0 0 0)) -;;; Generated autoloads from ess-r-package.el - -(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ess-r-package" '("ess-"))) - -;;;*** - -;;;### (autoloads nil "ess-r-syntax" "ess-r-syntax.el" (0 0 0 0)) -;;; Generated autoloads from ess-r-syntax.el - -(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ess-r-syntax" '("ess-" "backward-ess-r-" "forward-ess-r-"))) - -;;;*** - -;;;### (autoloads nil "ess-r-xref" "ess-r-xref.el" (0 0 0 0)) -;;; Generated autoloads from ess-r-xref.el - -(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ess-r-xref" '("ess-r-xref-"))) - -;;;*** - -;;;### (autoloads nil "ess-rd" "ess-rd.el" (0 0 0 0)) -;;; Generated autoloads from ess-rd.el - -(autoload 'Rd-mode "ess-rd" "\ -Major mode for editing R documentation source files. - -Type \\[list-abbrevs] to display the built-in abbrevs for Rd -keywords.To automatically turn on the abbrev(iate) features, add -the following to your Emacs configuration file: - - (add-hook 'Rd-mode-hook #'abbrev-mode) - -\(fn)" t nil) - -(add-to-list 'auto-mode-alist '("\\.Rd\\'" . Rd-mode)) - -(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ess-rd" '("Rd-" "ess-point"))) - -;;;*** - -;;;### (autoloads nil "ess-rdired" "ess-rdired.el" (0 0 0 0)) -;;; Generated autoloads from ess-rdired.el - -(autoload 'ess-rdired "ess-rdired" "\ -Show R objects from the global environment in a separate buffer. -You may interact with these objects, see `ess-rdired-mode' for -details. - -\(fn)" t nil) - -(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ess-rdired" '("ess-rdired-"))) - -;;;*** - -;;;### (autoloads nil "ess-roxy" "ess-roxy.el" (0 0 0 0)) -;;; Generated autoloads from ess-roxy.el - -(autoload 'ess-roxy-mode "ess-roxy" "\ -Minor mode for editing ROxygen documentation. - -\(fn &optional ARG)" t nil) - -(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ess-roxy" '("ess-"))) - -;;;*** - -;;;### (autoloads nil "ess-rutils" "ess-rutils.el" (0 0 0 0)) -;;; Generated autoloads from ess-rutils.el - -(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ess-rutils" '("ess-rutils-"))) - -;;;*** - -;;;### (autoloads nil "ess-s-lang" "ess-s-lang.el" (0 0 0 0)) -;;; Generated autoloads from ess-s-lang.el - -(add-to-list 'auto-mode-alist '("\\.[Ss]t\\'" . S-transcript-mode)) - -(add-to-list 'auto-mode-alist '("\\.Sout" . S-transcript-mode)) - -(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ess-s-lang" '("ess-" "S+common-cust-alist" "S-" "inferior-S-language-start"))) - -;;;*** - -;;;### (autoloads nil "ess-sas-a" "ess-sas-a.el" (0 0 0 0)) -;;; Generated autoloads from ess-sas-a.el - -(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ess-sas-a" '("ess-" "sas-program"))) - -;;;*** - -;;;### (autoloads nil "ess-sas-d" "ess-sas-d.el" (0 0 0 0)) -;;; Generated autoloads from ess-sas-d.el - -(autoload 'SAS-mode "ess-sas-d" "\ -Major mode for editing SAS source. See `ess-mode' for more help. - -\(fn)" t nil) - -(add-to-list 'auto-mode-alist '("\\.[Ss][Aa][Ss]\\'" . SAS-mode)) - -(autoload 'SAS-menu "ess-sas-d" "\ -Start SAS from the menu. - -\(fn)" t nil) - -(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ess-sas-d" '("ess-" "SAS" "inferior-SAS-args"))) - -;;;*** - -;;;### (autoloads nil "ess-sas-l" "ess-sas-l.el" (0 0 0 0)) -;;; Generated autoloads from ess-sas-l.el - -(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ess-sas-l" '("ess-" "set-sas-file-" "submit-sas" "switch-to-" "sas-" "beginning-of-sas-" "backward-page-top-of-window" "fix-page-breaks" "forward-page-top-of-window" "next-sas-proc" "indent-sas-statement" "SAS-"))) - -;;;*** - -;;;### (autoloads nil "ess-site" "ess-site.el" (0 0 0 0)) -;;; Generated autoloads from ess-site.el - -(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ess-site" '("ess-"))) - -;;;*** - -;;;### (autoloads nil "ess-sp6-d" "ess-sp6-d.el" (0 0 0 0)) -;;; Generated autoloads from ess-sp6-d.el - -(autoload 'S+-mode "ess-sp6-d" "\ -Major mode for editing S+ source. See `ess-mode' for more help. - -\(fn &optional PROC-NAME)" t nil) - -(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ess-sp6-d" '("ess-" "S+"))) - -;;;*** - -;;;### (autoloads nil "ess-stata-lang" "ess-stata-lang.el" (0 0 0 -;;;;;; 0)) -;;; Generated autoloads from ess-stata-lang.el - -(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ess-stata-lang" '("ess-" "stata-" "STA-editing-alist" "ado-set-font-lock-keywords"))) - -;;;*** - -;;;### (autoloads nil "ess-stata-mode" "ess-stata-mode.el" (0 0 0 -;;;;;; 0)) -;;; Generated autoloads from ess-stata-mode.el - -(autoload 'ess-stata-mode "ess-stata-mode" "\ -Major mode for editing Stata source. - -\(fn)" t nil) - -(add-to-list 'auto-mode-alist '("\\.do\\'" . ess-stata-mode)) - -(add-to-list 'auto-mode-alist '("\\.ado\\'" . ess-stata-mode)) - -(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ess-stata-mode" '("stata" "ess-" "Stata-mode" "STA-" "inferior-ess-stata-mode"))) - -;;;*** - -;;;### (autoloads nil "ess-toolbar" "ess-toolbar.el" (0 0 0 0)) -;;; Generated autoloads from ess-toolbar.el - -(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ess-toolbar" '("ess-"))) - -;;;*** - -;;;### (autoloads nil "ess-tracebug" "ess-tracebug.el" (0 0 0 0)) -;;; Generated autoloads from ess-tracebug.el - -(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ess-tracebug" '("ess-" "org-" "inferior-ess-"))) - -;;;*** - -;;;### (autoloads nil "ess-trns" "ess-trns.el" (0 0 0 0)) -;;; Generated autoloads from ess-trns.el - -(autoload 'ess-transcript-mode "ess-trns" "\ -Major mode for transcript files. - -Type \\[ess-transcript-send-command] to send a command in the -transcript to the current inferior process. \\[ess-transcript-copy-command] -copies the command but does not execute it, allowing you to edit it in -the process buffer first. - -Type \\[ess-transcript-clean-region] to delete all outputs and prompts -in the region, leaving only the commands. - -\(fn)" t nil) - -(autoload 'ess-transcript-clean-region "ess-trns" "\ -Strip the transcript in the region, leaving only (R/S/Lsp/..) commands. -Deletes any lines not beginning with a prompt, and then removes the -prompt from those lines that remain. Prefix argument means to -clean even if the buffer is \\[read-only]. - -\(fn BEG END EVEN-IF-READ-ONLY)" t nil) - -(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ess-trns" '("ess-transcript-"))) - -;;;*** - -;;;### (autoloads nil "ess-utils" "ess-utils.el" (0 0 0 0)) -;;; Generated autoloads from ess-utils.el - -(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ess-utils" '("ess-"))) - -;;;*** - -;;;### (autoloads nil "essd-els" "essd-els.el" (0 0 0 0)) -;;; Generated autoloads from essd-els.el - -(autoload 'ess-remote "essd-els" "\ -Execute this command from within a buffer running a process. It -runs `ess-add-ess-process' to add the process to -`ess-process-name-alist' and to make it the -`ess-current-process-name'. It then prompts the user for an ESS -language and sets the editing characteristics appropriately. - -To use this command, first start a process on a remote computer by -manual use of telnet, rlogin, ssh, or some other protocol. Start the -relevant program (\"S\" or \"R\" or \"sas -stdio\") in that buffer. Once -you are talking to S or R or SAS, then execute `ess-remote' to make -the current buffer an inferior-ess buffer with the right behavior for -the language you are currently working with. With S and R, use C-c -C-n to send lines over. With SAS, use C-c i -`ess-eval-line-and-step-invisibly' to send lines over invisibly. - -DIALECT is the desired ess-dialect. If nil, ask for dialect - -\(fn &optional PROC-NAME DIALECT)" t nil) - -(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "essd-els" '("ess-" "S+elsewhere" "inferior-ess-remote-pager"))) - -;;;*** - -;;;### (autoloads nil "make-regexp" "make-regexp.el" (0 0 0 0)) -;;; Generated autoloads from make-regexp.el - -(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "make-regexp" '("make-regexp" "regexp-span"))) - -;;;*** - -;;;### (autoloads nil "mouseme" "mouseme.el" (0 0 0 0)) -;;; Generated autoloads from mouseme.el - -(autoload 'mouse-me "mouseme" "\ -Popup a menu of functions to run on selected string or region. - -\(fn EVENT)" t nil) - -(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "mouseme" '("mouse-me-"))) - -;;;*** - -;;;### (autoloads nil nil ("ess-pkg.el") (0 0 0 0)) - -;;;*** - -;; Local Variables: -;; version-control: never -;; no-byte-compile: t -;; no-update-autoloads: t -;; coding: utf-8 -;; End: -;;; ess-autoloads.el ends here diff --git a/elpa/ess-20190121.1430/ess-rutils.el b/elpa/ess-20190121.1430/ess-rutils.el deleted file mode 100644 index ed5bb541..00000000 --- a/elpa/ess-20190121.1430/ess-rutils.el +++ /dev/null @@ -1,407 +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 - (let ((map (make-sparse-keymap))) - (define-key map "l" 'ess-rutils-loadpkg) - (define-key map "i" 'ess-rutils-mark-install) - (define-key map "I" 'ess-rutils-install) - (define-key map "u" 'ess-rutils-unmark) - (define-key map "q" 'ess-rutils-quit) - map) - "Keymap for the *R temp* buffer.") - -(define-derived-mode ess-rutils-mode special-mode "R utils" - "Major mode for output from `ess-rutils-local-pkgs' and `ess-rutils-repos-pkgs'. -Useful bindings to handle package loading and installing." - (setq ess-dialect "R")) - -(defun ess-rutils-local-pkgs () - "List all packages in all libraries." - (interactive) - (with-current-buffer (get-buffer-create 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**")) - (ess-rutils-mode)) - -(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) - (with-current-buffer (get-buffer-create 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")) - (ess-rutils-mode)) - -(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? ") - (with-current-buffer (get-buffer-create 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) - (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-search (string) - "Search for STRING using help.search()." - (interactive "sString to search for? ") - (with-current-buffer (get-buffer-create 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) - (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 --git a/elpa/ess-20190121.1430/ess-site.el b/elpa/ess-20190121.1430/ess-site.el deleted file mode 100644 index 45b74867..00000000 --- a/elpa/ess-20190121.1430/ess-site.el +++ /dev/null @@ -1,124 +0,0 @@ -;;; ess-site.el --- user customization of ESS - -;; Copyright (C) 1993 David M. Smith -;; Copyright (C) 1997--2010 A.J. Rossini, Richard M. Heiberger, Martin -;; Maechler, Kurt Hornik, Rodney Sparapani, and Stephen Eglen. -;; Copyright (C) 2011--2018 A.J. Rossini, Richard M. Heiberger, Martin -;; Maechler, Kurt Hornik, Rodney Sparapani, Stephen Eglen, -;; Vitalie Spinu, and Lionel Henry. - -;; Author: David Smith -;; Created: 12 Nov 1993 -;; Maintainer: ESS-core -;; Keywords: local - -;; This file is part of ESS - -;; This file is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 2, or (at your option) -;; any later version. - -;; This file is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; A copy of the GNU General Public License is available at -;; https://www.r-project.org/Licenses/ - - -;;; Commentary: - -;; This file defines all the site-specific customizations for ESS. It should be -;; edited on a per-site basis. Read the comments (1.1 in Section 1 to see if -;; ess-site.el must be edited. The final directory location of this file must be -;; supplied in ess-lisp-directory. The editing of remaining sections is -;; optional. It should then be byte-compiled, and users who wish to use ESS -;; should add the path to ess-site to their `load-path' and require it: -;; -;; (add-to-list 'load-path "/path/to/ess/lisp-directory");; -;; (require 'ess-site) - -;;; Code: - -;;;; 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))) - - -;;; Loading popular dialects (they should become optional in the future) - -;; R and Julia -(require 'ess-sp6-d) -(require 'ess-r-mode) - -(when (require 'julia-mode nil 'no-error) - (require 'ess-julia)) - -;; ess-remote -(require 'essd-els) - -;; Stata, SAS, BUGS, and JAGS -(require 'ess-stata-mode) -(require 'ess-sas-d) -(require 'ess-bugs-d) -(require 'ess-jags-d) - -;;; 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 --git a/elpa/ess-20190121.1430/etc/ESSR/R/mpi.R b/elpa/ess-20190121.1430/etc/ESSR/R/mpi.R deleted file mode 100644 index 5a5ff807..00000000 --- a/elpa/ess-20190121.1430/etc/ESSR/R/mpi.R +++ /dev/null @@ -1,23 +0,0 @@ -## simple Message Parsing Inerface - -.ess_mpi_send <- function(head, ...){ - payload <- paste(..., sep = "") - cat(sprintf("%s%s", head, payload)) -} - -.ess_mpi_message <- function(msg){ - .ess_mpi_send("message", msg) -} - -.ess_mpi_y_or_n <- function(prompt, callback){ - .ess_mpi_send("y-or-n", prompt, callback) -} - -.ess_mpi_eval <- function(expr, callback){ - .ess_mpi_send("eval", expr, callback) -} - -.ess_mpi_error <- function(msg) { - .ess_mpi_send("error", msg) -} - diff --git a/elpa/ess-20190121.1430/etc/R-ESS-bugs.R b/elpa/ess-20190121.1430/etc/R-ESS-bugs.R deleted file mode 100644 index c28f2f8b..00000000 --- a/elpa/ess-20190121.1430/etc/R-ESS-bugs.R +++ /dev/null @@ -1,961 +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) - - -### --- 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 --issue ..: new in 18.10(-1) - but ok in git(2018-10-29) -Fedora.ver <- "F28"; biocLibrary <- "/usr/local.nfs/app/R/Bioconductor/library_F28" -cat(sprintf("Fedora version: %s\nBioc. library - where packages are installed now:\n %s\n", - Fedora.ver, biocLibrary)) -## After sending (C-c C-n) the first line, the `*Messages*` buffer shows -Loading line: Fedora.ver <- "F28"; biocLibrary <- "/usr/local.nfs/app/R/Bioconductor/library_F28" -Starting evaluation... -ess-send-string: Not enough arguments for format string -## and the user indeed gets the "Not enough arguments ..." -## message in the minibuffer/message area *and* the R process hangs (with a '+ ') -## expecting the continuation, but inside this buffer, further C-c C-n do nothing! - - -### Local Variables: -### page-delimiter: "^### --- [1-9]" -### End: diff --git a/elpa/ess-20190121.1430/etc/R-ESS-bugs.el b/elpa/ess-20190121.1430/etc/R-ESS-bugs.el deleted file mode 100644 index a5c831c3..00000000 --- a/elpa/ess-20190121.1430/etc/R-ESS-bugs.el +++ /dev/null @@ -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 --git a/elpa/ess-20190121.1430/etc/R-error-patterns.R b/elpa/ess-20190121.1430/etc/R-error-patterns.R deleted file mode 100644 index 995d9c43..00000000 --- a/elpa/ess-20190121.1430/etc/R-error-patterns.R +++ /dev/null @@ -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 --git a/elpa/ess-20190121.1430/etc/completion_ideas.R b/elpa/ess-20190121.1430/etc/completion_ideas.R deleted file mode 100644 index bb4dc558..00000000 --- a/elpa/ess-20190121.1430/etc/completion_ideas.R +++ /dev/null @@ -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 --git a/elpa/ess-20190121.1430/etc/gpl-check b/elpa/ess-20190121.1430/etc/gpl-check deleted file mode 100755 index a3340b54..00000000 --- a/elpa/ess-20190121.1430/etc/gpl-check +++ /dev/null @@ -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 --git a/elpa/ess-20190121.1430/etc/pkg-Maintainers b/elpa/ess-20190121.1430/etc/pkg-Maintainers deleted file mode 100644 index 28537cdf..00000000 --- a/elpa/ess-20190121.1430/etc/pkg-Maintainers +++ /dev/null @@ -1,3 +0,0 @@ -Debian: Dirk Eddelbuettel -RPM: Tom Moertel -SuSe: Detlef Steuer diff --git a/elpa/ess-20190121.1430/.dir-locals.el b/elpa/ess-20191014.1343/.dir-locals.el similarity index 100% rename from elpa/ess-20190121.1430/.dir-locals.el rename to elpa/ess-20191014.1343/.dir-locals.el diff --git a/elpa/ess-20190121.1430/allnews.info b/elpa/ess-20191014.1343/allnews.info similarity index 97% rename from elpa/ess-20190121.1430/allnews.info rename to elpa/ess-20191014.1343/allnews.info index 7116607a..405663f2 100644 --- a/elpa/ess-20190121.1430/allnews.info +++ b/elpa/ess-20191014.1343/allnews.info @@ -3,12 +3,28 @@ allnews.texi. Changes and New Features in 19.04 (unreleased): + * ESS[R]: There is a new menu entry for reloading the R process. It + is otherwise bound to 'C-c C-e C-r'. Reloading now reuses the same + process name and start arguments that were used to start the + process. + + * 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 + 'with-current-buffer' with the return value of the inferior. + + * iESS[SAS]: The SAS keymap was only set in iESS buffers called + '*SAS*'. This is now fixed. + + * ESS[R]: Fixed longstanding indentation issues involving '::' and + ':::' operators. + * 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. - * Activate 'goto-address-mode' for url and emal highlighting in + * Activate 'goto-address-mode' for url and email highlighting in inferior buffers. * 'smart-underscore' and 'ess-smart-S-assign-key' have been removed. @@ -26,8 +42,8 @@ Changes and New Features in 19.04 (unreleased): * 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 docstring for details. 'ess-auto-width-visible' - controls visibility. + integer. See the documentation for details. + 'ess-auto-width-visible' controls visibility. * ESS now respects 'display-buffer-alist'. Users can now use 'display-buffer-alist' to manage how and where windows appear. See @@ -53,6 +69,10 @@ Changes and New Features in 19.04 (unreleased): suggests, these now rely on project.el (included with Emacs) rather than projectile.el, which is a third-party package. + * ESS[R]: devtools commands ask about saving modified buffers before + running. Users can disable the questioning with + 'ess-save-silently'. + * ESS[R] help pages now provide links to other help topics. This is similar with what you would see with, for example 'options(help_type = ``html'')' but works with the plain-text @@ -63,6 +83,17 @@ Changes and New Features in 19.04 (unreleased): should look better and be a bit faster overall. The size column now displays object sizes in bytes. + * 'ess-rdired' buffers now auto-update. The frequency is governed by + the new option 'ess-rdired-auto-update-interval'. + + * ESS[R]: 'electric-layout-mode' is now supported. This + automatically inserts a newline after an opening curly brace in R + buffers. To enable it, customize 'ess-r-mode-hook'. + + * ESS[R]: imenu now supports assignment with the equals sign. + + * ESS[Rd]: Rd no longer writes abbrevs to user's abbrev file. + * ESS removed support for many unused languages. This includes old versions of S+, ARC, OMG, VST, and XLS. @@ -77,11 +108,18 @@ documentation for more detail: , or markdown-mode with edit-indirect . + * Support for 'auto-complete' is obsolete. The 'auto-complete' + package is unmaintained and so ESS support is now obsolete. Users + are encouraged to switch to 'company-mode' instead. + * User options for controlling display of buffers. This includes 'ess-show-buffer-action', 'inferior-ess-same-window', 'inferior-ess-own-frame', and 'inferior-ess-frame-alist'. See above about ESS respecting 'display-buffer-alist'. + * Variables 'ess-tab-always-indent' and 'ess-tab-complete-in-script'. + Use the Emacs-wide setting of 'tab-always-indent' instead. + * '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 @@ -180,7 +218,7 @@ documentation for more detail: * '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 + '_'. For instance if you bind it to ';', repeated invocations cycle through between assignment and inserting ';'. * 'C-c C-=' is now bound to 'ess-cycle-assign' by default. See the @@ -217,7 +255,7 @@ documentation for more detail: * 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. + where 'in' is a common 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' @@ -265,7 +303,7 @@ documentation for more detail: 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 + '_' for inserting 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. @@ -274,7 +312,7 @@ documentation for more detail: Changes and New Features in 17.11: - * The ESS initialisation process has been streamlined. You can now + * The ESS initialization 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 @@ -307,9 +345,9 @@ documentation for more detail: * 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 + identifiers). Furthermore they are now correctly recognized when they are function definitions or function calls. - * ESS[R]: Backquoted names and '%op%' operators are recognised as + * ESS[R]: Backquoted names and '%op%' operators are recognized 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. @@ -525,8 +563,8 @@ documentation for more detail: 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[R]: 'head' and 'tail' methods were replaced by '.ess_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 diff --git a/elpa/ess-20190121.1430/announc.info b/elpa/ess-20191014.1343/announc.info similarity index 90% rename from elpa/ess-20190121.1430/announc.info rename to elpa/ess-20191014.1343/announc.info index 9eb70b9f..d2d23aef 100644 --- a/elpa/ess-20190121.1430/announc.info +++ b/elpa/ess-20191014.1343/announc.info @@ -13,12 +13,12 @@ The ESS Developers proudly announce the release of ESS 18.10.3snapshot 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. +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 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 @@ -97,7 +97,7 @@ 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 +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. @@ -236,7 +236,7 @@ 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. + * discussing aspects of using ESS. * suggestions for improvements. * announcements of new releases of ESS. * posting small patches to ESS. @@ -308,12 +308,28 @@ File: announc.info, Node: New Features, Prev: License, Up: Announce Changes and New Features in 19.04 (unreleased): + * ESS[R]: There is a new menu entry for reloading the R process. It + is otherwise bound to 'C-c C-e C-r'. Reloading now reuses the same + process name and start arguments that were used to start the + process. + + * 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 + 'with-current-buffer' with the return value of the inferior. + + * iESS[SAS]: The SAS keymap was only set in iESS buffers called + '*SAS*'. This is now fixed. + + * ESS[R]: Fixed longstanding indentation issues involving '::' and + ':::' operators. + * 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. - * Activate 'goto-address-mode' for url and emal highlighting in + * Activate 'goto-address-mode' for url and email highlighting in inferior buffers. * 'smart-underscore' and 'ess-smart-S-assign-key' have been removed. @@ -331,8 +347,8 @@ Changes and New Features in 19.04 (unreleased): * 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 docstring for details. 'ess-auto-width-visible' - controls visibility. + integer. See the documentation for details. + 'ess-auto-width-visible' controls visibility. * ESS now respects 'display-buffer-alist'. Users can now use 'display-buffer-alist' to manage how and where windows appear. See @@ -358,6 +374,10 @@ Changes and New Features in 19.04 (unreleased): suggests, these now rely on project.el (included with Emacs) rather than projectile.el, which is a third-party package. + * ESS[R]: devtools commands ask about saving modified buffers before + running. Users can disable the questioning with + 'ess-save-silently'. + * ESS[R] help pages now provide links to other help topics. This is similar with what you would see with, for example 'options(help_type = ``html'')' but works with the plain-text @@ -368,6 +388,17 @@ Changes and New Features in 19.04 (unreleased): should look better and be a bit faster overall. The size column now displays object sizes in bytes. + * 'ess-rdired' buffers now auto-update. The frequency is governed by + the new option 'ess-rdired-auto-update-interval'. + + * ESS[R]: 'electric-layout-mode' is now supported. This + automatically inserts a newline after an opening curly brace in R + buffers. To enable it, customize 'ess-r-mode-hook'. + + * ESS[R]: imenu now supports assignment with the equals sign. + + * ESS[Rd]: Rd no longer writes abbrevs to user's abbrev file. + * ESS removed support for many unused languages. This includes old versions of S+, ARC, OMG, VST, and XLS. @@ -382,11 +413,18 @@ documentation for more detail: , or markdown-mode with edit-indirect . + * Support for 'auto-complete' is obsolete. The 'auto-complete' + package is unmaintained and so ESS support is now obsolete. Users + are encouraged to switch to 'company-mode' instead. + * User options for controlling display of buffers. This includes 'ess-show-buffer-action', 'inferior-ess-same-window', 'inferior-ess-own-frame', and 'inferior-ess-frame-alist'. See above about ESS respecting 'display-buffer-alist'. + * Variables 'ess-tab-always-indent' and 'ess-tab-complete-in-script'. + Use the Emacs-wide setting of 'tab-always-indent' instead. + * '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 @@ -485,7 +523,7 @@ documentation for more detail: * '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 + '_'. For instance if you bind it to ';', repeated invocations cycle through between assignment and inserting ';'. * 'C-c C-=' is now bound to 'ess-cycle-assign' by default. See the @@ -522,7 +560,7 @@ documentation for more detail: * 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. + where 'in' is a common 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' @@ -570,7 +608,7 @@ documentation for more detail: 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 + '_' for inserting 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. @@ -579,7 +617,7 @@ documentation for more detail: Changes and New Features in 17.11: - * The ESS initialisation process has been streamlined. You can now + * The ESS initialization 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 @@ -612,9 +650,9 @@ documentation for more detail: * 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 + identifiers). Furthermore they are now correctly recognized when they are function definitions or function calls. - * ESS[R]: Backquoted names and '%op%' operators are recognised as + * ESS[R]: Backquoted names and '%op%' operators are recognized 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. @@ -681,17 +719,17 @@ documentation for more detail:  Tag Table: Node: Announce75 -Node: Latest Version1311 -Node: Installing from a third-party repository2254 -Node: Installing from source3205 -Node: Activating and Loading ESS4801 -Node: Check Installation5879 -Node: Current Features6103 -Node: Requirements7646 -Node: Mailing List8081 -Node: Reporting Bugs8807 -Node: Authors9687 -Node: License10371 -Node: New Features11021 +Node: Latest Version1298 +Node: Installing from a third-party repository2241 +Node: Installing from source3192 +Node: Activating and Loading ESS4788 +Node: Check Installation5866 +Node: Current Features6090 +Node: Requirements7633 +Node: Mailing List8068 +Node: Reporting Bugs8774 +Node: Authors9654 +Node: License10338 +Node: New Features10988  End Tag Table diff --git a/elpa/ess-20190121.1430/authors.info b/elpa/ess-20191014.1343/authors.info similarity index 100% rename from elpa/ess-20190121.1430/authors.info rename to elpa/ess-20191014.1343/authors.info diff --git a/elpa/ess-20190121.1430/bugrept.info b/elpa/ess-20191014.1343/bugrept.info similarity index 100% rename from elpa/ess-20190121.1430/bugrept.info rename to elpa/ess-20191014.1343/bugrept.info diff --git a/elpa/ess-20190121.1430/credits.info b/elpa/ess-20191014.1343/credits.info similarity index 100% rename from elpa/ess-20190121.1430/credits.info rename to elpa/ess-20191014.1343/credits.info diff --git a/elpa/ess-20190121.1430/currfeat.info b/elpa/ess-20191014.1343/currfeat.info similarity index 100% rename from elpa/ess-20190121.1430/currfeat.info rename to elpa/ess-20191014.1343/currfeat.info diff --git a/elpa/ess-20190121.1430/dir b/elpa/ess-20191014.1343/dir similarity index 100% rename from elpa/ess-20190121.1430/dir rename to elpa/ess-20191014.1343/dir diff --git a/elpa/ess-20191014.1343/ess-autoloads.el b/elpa/ess-20191014.1343/ess-autoloads.el new file mode 100644 index 00000000..7de8a602 --- /dev/null +++ b/elpa/ess-20191014.1343/ess-autoloads.el @@ -0,0 +1,405 @@ +;;; ess-autoloads.el --- automatically extracted autoloads +;; +;;; Code: +(add-to-list 'load-path (directory-file-name (or (file-name-directory #$) (car load-path)))) + +;;;### (autoloads nil "ess" "ess.el" (23994 46764 990680 902000)) +;;; Generated autoloads from ess.el + +(autoload 'ess-version "ess" "\ +Return a string with ESS version information. + +\(fn)" t nil) + +(autoload 'ess-submit-bug-report "ess" "\ +Submit a bug report to the ESS maintainers. + +\(fn)" t nil) + +;;;*** + +;;;### (autoloads nil "ess-bugs-d" "ess-bugs-d.el" (23994 46764 917667 +;;;;;; 161000)) +;;; Generated autoloads from ess-bugs-d.el + +(autoload 'ess-bugs-mode "ess-bugs-d" "\ +Major mode for BUGS. + +\(fn)" t nil) + +(add-to-list 'auto-mode-alist '("\\.[Bb][Uu][Gg]\\'" . ess-bugs-mode)) + +(add-to-list 'auto-mode-alist '("\\.[Bb][Oo][Gg]\\'" . ess-bugs-mode)) + +(add-to-list 'auto-mode-alist '("\\.[Bb][Mm][Dd]\\'" . ess-bugs-mode)) + +;;;*** + +;;;### (autoloads nil "ess-custom" "ess-custom.el" (23994 46764 953959 +;;;;;; 908000)) +;;; Generated autoloads from ess-custom.el + +(defvar ess-lisp-directory (file-name-directory (or load-file-name buffer-file-name)) "\ +Directory containing ess-site.el(c) and other ESS Lisp files.") + +(custom-autoload 'ess-lisp-directory "ess-custom" t) + +(add-to-list 'load-path ess-lisp-directory) + +(add-to-list 'load-path (file-name-as-directory (expand-file-name "obsolete" ess-lisp-directory))) + +(put 'ess-indent-offset 'safe-local-variable #'numberp) + +(put 'ess-style 'safe-local-variable #'symbolp) + +;;;*** + +;;;### (autoloads nil "ess-gretl" "ess-gretl.el" (23994 46764 949104 +;;;;;; 258000)) +;;; Generated autoloads from ess-gretl.el + +(autoload 'ess-gretl-mode "ess-gretl" "\ +Major mode for editing gretl source. See `ess-mode' for more help. + +\(fn)" t nil) + +(autoload 'gretl "ess-gretl" "\ +Call 'gretl', +Optional prefix (C-u) allows to set command line arguments, such as +--vsize. This should be OS agnostic. +If you have certain command line arguments that should always be passed +to gretl, put them in the variable `inferior-gretl-args'. + +\(fn &optional START-ARGS)" t nil) + +;;;*** + +;;;### (autoloads nil "ess-inf" "ess-inf.el" (23994 46764 956265 +;;;;;; 802000)) +;;; Generated autoloads from ess-inf.el + +(autoload 'ess-load-file "ess-inf" "\ +Load FILENAME into an inferior ESS process. +This handles Tramp when working on a remote. + +\(fn &optional FILENAME)" t nil) + +;;;*** + +;;;### (autoloads nil "ess-jags-d" "ess-jags-d.el" (23994 46764 989659 +;;;;;; 375000)) +;;; Generated autoloads from ess-jags-d.el + +(autoload 'ess-jags-mode "ess-jags-d" "\ +Major mode for JAGS. + +\(fn)" t nil) + +(add-to-list 'auto-mode-alist '("\\.[Jj][Aa][Gg]\\'" . ess-jags-mode)) + +;;;*** + +;;;### (autoloads nil "ess-julia" "ess-julia.el" (23994 46764 987711 +;;;;;; 280000)) +;;; Generated autoloads from ess-julia.el + +(autoload 'ess-julia-mode "ess-julia" "\ +Major mode for julia files. + +\(fn)" t nil) + +(autoload 'run-ess-julia "ess-julia" "\ +Start an inferior julia process. +Optional prefix START-ARGS (\\[universal-argument]) allows to set +command line arguments, such as --load=. This should be OS +agnostic. If you have certain command line arguments that should +always be passed to julia, put them in the variable +`inferior-julia-args'. + +\(fn &optional START-ARGS)" t nil) + +(defalias 'julia #'run-ess-julia) + +;;;*** + +;;;### (autoloads nil "ess-mode" "ess-mode.el" (23994 46764 952949 +;;;;;; 668000)) +;;; Generated autoloads from ess-mode.el + +(autoload 'ess-mode "ess-mode" "\ +Major mode for editing ESS source. +Optional arg ALIST describes how to customize the editing mode. +Optional arg PROC-NAME is name of associated inferior process. + +\\{ess-mode-map} + +You can send text to the inferior ESS process from other buffers containing +ESS source. + `ess-eval-region' sends the current region to the ESS process. + `ess-eval-buffer' sends the current buffer to the ESS process. + `ess-eval-function' sends the current function to the ESS process. + `ess-eval-line' sends the current line to the ESS process. + `ess-switch-to-ESS' switches the current buffer to the ESS process buffer. + `ess-switch-to-end-of-ESS' switches the current buffer to the ESS process + buffer and puts point at the end of it. + + `ess-eval-region-and-go', `ess-eval-buffer-and-go', + `ess-eval-function-and-go', and `ess-eval-line-and-go' switch to the S + process buffer after sending their text. + + `ess-load-file' sources a file of commands to the ESS process. + +\\[ess-indent-command] indents for ESS code. +\\[backward-delete-char-untabify] converts tabs to spaces as it moves back. +Comments are indented in a similar way to Emacs-lisp mode: + `###' beginning of line + `##' the same level of indentation as the code + `#' the same column on the right, or to the right of such a + column if that is not possible.(default value 40). + \\[indent-for-comment] command automatically inserts such a + `#' in the right place, or aligns such a comment if it is + already inserted. +\\[ess-indent-exp] command indents each line of the syntactic unit following point. + +Variables controlling indentation style: + `ess-indent-offset' + Indentation of ESS statements within surrounding block. + The surrounding block's indentation is the indentation of the line on + which the open-brace appears. + `ess-offset-block' + Indentation of blocks opened with curly braces or anonymous parentheses. + `ess-offset-arguments' + Indentation of function arguments or bracket indices. + `ess-offset-arguments-newline' + Indentation of function arguments or bracket indices when the opening + delimiter is immediately followed by a newline. + `ess-offset-continued' + Indentation style for continued statements. + `ess-align-nested-calls' + Functions whose nested calls should be aligned. + `ess-align-arguments-in-calls' + Calls in which arguments should be aligned. + `ess-align-continuations-in-calls' + Whether ignore indentation after an operator in calls + `ess-align-blocks' + Blocks that should always be aligned vertically. + `ess-indent-from-lhs' + Whether function calls given as argument should be indented from the + parameter name. + `ess-indent-from-chain-start' + Whether to indent arguments from the first of several consecutive calls. + `ess-indent-with-fancy-comments' + Non-nil means distinguish between #, ##, and ### for indentation. + +Furthermore, \\[ess-set-style] command enables you to set up predefined ess-mode +indentation style. See `ess-style-alist' for predefined styles. + +\(fn)" t nil) + +;;;*** + +;;;### (autoloads nil "ess-r-mode" "ess-r-mode.el" (23994 46764 919684 +;;;;;; 960000)) +;;; Generated autoloads from ess-r-mode.el + +(autoload 'run-ess-r "ess-r-mode" "\ +Call 'R', the 'GNU S' system from the R Foundation. +Optional prefix (\\[universal-argument]) allows to set command line arguments, such as +--vsize. This should be OS agnostic. +If you have certain command line arguments that should always be passed +to R, put them in the variable `inferior-R-args'. + +START-ARGS can be a string representing an argument, a list of +such strings, or any other non-nil value. In the latter case, you +will be prompted to enter arguments interactively. + +\(fn &optional START-ARGS)" t nil) + +(defalias 'R #'run-ess-r) + +(autoload 'ess-r-mode "ess-r-mode" "\ +Major mode for editing R source. See `ess-mode' for more help. + +\(fn)" t nil) + +(defalias 'R-mode 'ess-r-mode) + +(defalias 'r-mode 'ess-r-mode) + +(add-to-list 'auto-mode-alist '("/R/.*\\.q\\'" . ess-r-mode)) + +(add-to-list 'auto-mode-alist '("\\.[rR]\\'" . ess-r-mode)) + +(add-to-list 'auto-mode-alist '("\\.[rR]profile\\'" . ess-r-mode)) + +(add-to-list 'auto-mode-alist '("NAMESPACE\\'" . ess-r-mode)) + +(add-to-list 'auto-mode-alist '("CITATION\\'" . ess-r-mode)) + +(autoload 'ess-r-transcript-mode "ess-r-mode" "\ +A Major mode for R transcript files. + +\(fn)" t nil) + +(add-to-list 'auto-mode-alist '("\\.[Rr]out" . ess-r-transcript-mode)) + +(add-to-list 'interpreter-mode-alist '("Rscript" . ess-r-mode)) + +(add-to-list 'interpreter-mode-alist '("r" . ess-r-mode)) + +(add-to-list 'auto-mode-alist '("/Makevars\\(\\.win\\)?$" . makefile-mode)) + +(add-to-list 'auto-mode-alist '("DESCRIPTION$" . conf-colon-mode)) + +;;;*** + +;;;### (autoloads nil "ess-rd" "ess-rd.el" (23994 46764 952078 13000)) +;;; Generated autoloads from ess-rd.el + +(autoload 'Rd-mode "ess-rd" "\ +Major mode for editing R documentation source files. + +Type \\[list-abbrevs] to display the built-in abbrevs for Rd +keywords.To automatically turn on the abbrev(iate) features, add +the following to your Emacs configuration file: + + (add-hook 'Rd-mode-hook #'abbrev-mode) + +\(fn)" t nil) + +(add-to-list 'auto-mode-alist '("\\.Rd\\'" . Rd-mode)) + +;;;*** + +;;;### (autoloads nil "ess-rdired" "ess-rdired.el" (23994 46764 947244 +;;;;;; 10000)) +;;; Generated autoloads from ess-rdired.el + +(autoload 'ess-rdired "ess-rdired" "\ +Show R objects from the global environment in a separate buffer. +You may interact with these objects, see `ess-rdired-mode' for +details. + +\(fn)" t nil) + +;;;*** + +;;;### (autoloads nil "ess-roxy" "ess-roxy.el" (23994 46764 944362 +;;;;;; 342000)) +;;; Generated autoloads from ess-roxy.el + +(autoload 'ess-roxy-mode "ess-roxy" "\ +Minor mode for editing ROxygen documentation. + +\(fn &optional ARG)" t nil) + +;;;*** + +;;;### (autoloads nil "ess-s-lang" "ess-s-lang.el" (23994 46764 906213 +;;;;;; 450000)) +;;; Generated autoloads from ess-s-lang.el + +(add-to-list 'auto-mode-alist '("\\.[Ss]t\\'" . S-transcript-mode)) + +(add-to-list 'auto-mode-alist '("\\.Sout" . S-transcript-mode)) + +;;;*** + +;;;### (autoloads nil "ess-sas-d" "ess-sas-d.el" (23994 46764 991721 +;;;;;; 22000)) +;;; Generated autoloads from ess-sas-d.el + +(autoload 'SAS-mode "ess-sas-d" "\ +Major mode for editing SAS source. See `ess-mode' for more help. + +\(fn)" t nil) + +(add-to-list 'auto-mode-alist '("\\.[Ss][Aa][Ss]\\'" . SAS-mode)) + +;;;*** + +;;;### (autoloads nil "ess-sp6-d" "ess-sp6-d.el" (23994 46764 922686 +;;;;;; 856000)) +;;; Generated autoloads from ess-sp6-d.el + +(autoload 'S+-mode "ess-sp6-d" "\ +Major mode for editing S+ source. See `ess-mode' for more help. + +\(fn &optional PROC-NAME)" t nil) + +;;;*** + +;;;### (autoloads nil "ess-stata-mode" "ess-stata-mode.el" (23994 +;;;;;; 46764 927433 996000)) +;;; Generated autoloads from ess-stata-mode.el + +(autoload 'ess-stata-mode "ess-stata-mode" "\ +Major mode for editing Stata source. + +\(fn)" t nil) + +(add-to-list 'auto-mode-alist '("\\.do\\'" . ess-stata-mode)) + +(add-to-list 'auto-mode-alist '("\\.ado\\'" . ess-stata-mode)) + +;;;*** + +;;;### (autoloads nil "ess-trns" "ess-trns.el" (23994 46764 942470 +;;;;;; 496000)) +;;; Generated autoloads from ess-trns.el + +(autoload 'ess-transcript-mode "ess-trns" "\ +Major mode for transcript files. + +Type \\[ess-transcript-send-command] to send a command in the +transcript to the current inferior process. \\[ess-transcript-copy-command] +copies the command but does not execute it, allowing you to edit it in +the process buffer first. + +Type \\[ess-transcript-clean-region] to delete all outputs and prompts +in the region, leaving only the commands. + +\(fn)" t nil) + +;;;*** + +;;;### (autoloads nil "essd-els" "essd-els.el" (23994 46764 908205 +;;;;;; 460000)) +;;; Generated autoloads from essd-els.el + +(autoload 'ess-remote "essd-els" "\ +Execute this command from within a buffer running a process. +It runs `ess-add-ess-process' to add the PROC-NAME to +`ess-process-name-alist' and to make it the +`ess-current-process-name'. It then prompts the user for an ESS +language and sets the editing characteristics appropriately. + +To use this command, first start a process on a remote computer by +manual use of telnet, rlogin, ssh, or some other protocol. Start the +relevant program (\"S\" or \"R\" or \"sas -stdio\") in that buffer. Once +you are talking to S or R or SAS, then do \\[ess-remote] to make +the current buffer an inferior-ess buffer with the right behavior for +the language you are currently working with. With S and R, use C-c +C-n to send lines over. With SAS, use C-c i +`ess-eval-line-and-step-invisibly' to send lines over invisibly. + +DIALECT is the desired ess-dialect. If nil, ask for dialect + +\(fn &optional PROC-NAME DIALECT)" t nil) + +;;;*** + +;;;### (autoloads nil nil ("ess-bugs-l.el" "ess-help.el" "ess-pkg.el" +;;;;;; "ess-r-completion.el" "ess-r-flymake.el" "ess-r-package.el" +;;;;;; "ess-r-syntax.el" "ess-r-xref.el" "ess-sas-a.el" "ess-sas-l.el" +;;;;;; "ess-site.el" "ess-stata-lang.el" "ess-toolbar.el" "ess-tracebug.el" +;;;;;; "ess-utils.el" "make-regexp.el") (23994 46764 993654 130000)) + +;;;*** + +;; Local Variables: +;; version-control: never +;; no-byte-compile: t +;; no-update-autoloads: t +;; End: +;;; ess-autoloads.el ends here diff --git a/elpa/ess-20190121.1430/ess-bugs-d.el b/elpa/ess-20191014.1343/ess-bugs-d.el similarity index 98% rename from elpa/ess-20190121.1430/ess-bugs-d.el rename to elpa/ess-20191014.1343/ess-bugs-d.el index a2dee0df..9ae86d1d 100644 --- a/elpa/ess-20190121.1430/ess-bugs-d.el +++ b/elpa/ess-20191014.1343/ess-bugs-d.el @@ -1,4 +1,4 @@ -;;; ess-bugs-d.el --- ESS[BUGS] dialect +;;; ess-bugs-d.el --- ESS[BUGS] dialect -*- lexical-binding: t; -*- ;; Copyright (C) 2008-2011 Rodney Sparapani @@ -26,7 +26,6 @@ (require 'ess-bugs-l) (require 'ess-utils) (require 'ess-inf) -(require 'ess-custom) (require 'ess-mode) (defvar ess-bugs-command "OpenBUGS" "Default BUGS program in PATH.") @@ -119,7 +118,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)) @@ -190,7 +189,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") diff --git a/elpa/ess-20190121.1430/ess-bugs-l.el b/elpa/ess-20191014.1343/ess-bugs-l.el similarity index 89% rename from elpa/ess-20190121.1430/ess-bugs-l.el rename to elpa/ess-20191014.1343/ess-bugs-l.el index a63f837f..dc886c26 100644 --- a/elpa/ess-20190121.1430/ess-bugs-l.el +++ b/elpa/ess-20191014.1343/ess-bugs-l.el @@ -1,4 +1,4 @@ -;;; ess-bugs-l.el --- ESS[BUGS] languages +;;; ess-bugs-l.el --- ESS[BUGS] languages -*- lexical-binding: t; -*- ;; Copyright (C) 2006-2011 Rodney Sparapani @@ -24,11 +24,8 @@ ;;; 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,7 +43,11 @@ :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'. @@ -135,27 +136,26 @@ Users whose default is not 'sh, but are accessing a remote machine with (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,7 +181,7 @@ and `ess-bugs-file-dir'." (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 "%s" (substring string beg (match-end 0)))))) diff --git a/elpa/ess-20190121.1430/ess-custom.el b/elpa/ess-20191014.1343/ess-custom.el similarity index 78% rename from elpa/ess-20190121.1430/ess-custom.el rename to elpa/ess-20191014.1343/ess-custom.el index 8cc5d006..c07f24ae 100644 --- a/elpa/ess-20190121.1430/ess-custom.el +++ b/elpa/ess-20191014.1343/ess-custom.el @@ -26,18 +26,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 +48,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 +77,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 @@ -106,17 +102,12 @@ :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-extras nil @@ -127,6 +118,7 @@ (defgroup ess-faces nil "Faces and face options for ESS modes." :group 'ess + :group 'faces :prefix "ess-") @@ -134,6 +126,45 @@ ;;*;; 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")) + +(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")) + +;; 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 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 (file-name-as-directory (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. (defcustom ess-imenu-use-p (fboundp 'imenu) @@ -163,8 +194,8 @@ the width to the window width. If an integer, set the width to that integer. 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) + (const :tag "Frame width" :value frame) + (const :tag "Window width" :value window) (integer :tag "Integer value")) :package-version '(ess . "19.04")) @@ -181,8 +212,9 @@ that integer. Anything else is treated as 'window." ("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) @@ -194,18 +226,16 @@ that integer. Anything else is treated as 'window." 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. @@ -225,8 +255,8 @@ implementation." (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) @@ -257,8 +287,8 @@ See also `ess-blink-delay'" :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) @@ -296,7 +326,8 @@ A nil value means use the current buffer's default directory." (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)) @@ -312,7 +343,9 @@ for all projects." 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) @@ -334,26 +367,24 @@ By default ESS uses enables IDO flex matching. See `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 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. @@ -366,8 +397,7 @@ punctuation +-=% etc, or closed paren or symbol. 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) @@ -378,7 +408,7 @@ aggressive and dangerous). (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 'script-only activate in `ess-mode' buffers only. See also `ess-eldoc-show-on-symbol'." :group 'ess-extras @@ -392,13 +422,18 @@ If nil show only when the point is in a function call, i.e. after (." :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. + +- 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. @@ -420,8 +455,10 @@ If 'process, only check if the buffer has an inferior process." :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. @@ -432,11 +469,13 @@ documentation (http://cx4a.org/software/auto-complete/) for how 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))) @@ -448,7 +487,7 @@ only." 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) @@ -456,8 +495,7 @@ only." "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) @@ -473,11 +511,11 @@ settings, such as `ess-r-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]*\\'" @@ -488,7 +526,7 @@ buffer or end chunks etc.") (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 @@ -522,29 +560,28 @@ if you want to disable R specific prettification." :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) - )) + (const :tag "Always delete" :value nil))) (defcustom ess-delete-dump-files nil "Non-nil means delete dump files after they are created. @@ -575,7 +612,8 @@ back into S." :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: @@ -606,8 +644,9 @@ When `ess-fill-calls-newlines' is t, the second style becomes: 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, @@ -626,7 +665,8 @@ The blinking of the refilled region can be disabled with :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'. @@ -651,7 +691,8 @@ The blinking of the refilled region can be disabled with :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: @@ -663,21 +704,28 @@ intended for example for dplyr-style code: ) 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 @@ -693,26 +741,15 @@ bracket." ;;;*;;; 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-local ess-indent-line-function nil - "Function to be used for the current dialect -nil means to use R/S indentation.") +(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. @@ -759,7 +796,7 @@ relative to the opening parenthesis of the closest function call: )) -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( @@ -785,10 +822,10 @@ type and the offset size, such as `'(prev-call 2)'. Otherwise, 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: @@ -842,8 +879,8 @@ for other offsets controlling indentation.") (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: @@ -858,17 +895,17 @@ When set to 'cascade: other_function() The 'straight and 'cascade settings are actually equivalent to -'(straight . t) and '(cascade . t), where `t' represents the +'(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)) @@ -876,10 +913,10 @@ resulting in the following indentation for nested ifelse calls: 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 @@ -901,8 +938,8 @@ vertically aligned: 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) @@ -941,9 +978,9 @@ an offset: 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 @@ -953,9 +990,8 @@ declaration will always be aligned with the call to (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: @@ -1006,18 +1042,18 @@ align the function body from the LHS to save horizontal space. 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 @@ -1028,7 +1064,7 @@ See `ess-style-alist' for for an overview of ESS indentation.") ;;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) @@ -1178,14 +1214,14 @@ See `ess-style-alist' for for an overview of ESS indentation." (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-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 @@ -1247,8 +1283,9 @@ Control variables: ### 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))) @@ -1264,7 +1301,8 @@ of each variable for its meaning." (set symbol value) (ess-add-style 'OWN value))) -;;;###autoload (put 'ess-style 'safe-local-variable #'symbolp) +;;;###autoload +(put 'ess-style 'safe-local-variable #'symbolp) (define-obsolete-variable-alias 'ess-default-style 'ess-style "ESS 19.04") (defcustom ess-style 'RRR @@ -1275,9 +1313,10 @@ 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. -This variable only 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'." +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) @@ -1292,7 +1331,7 @@ directory local variable (see Info node `(emacs) File Variables'." :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) @@ -1309,7 +1348,7 @@ working directory (i.e. first elt of search list)." :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. @@ -1327,14 +1366,6 @@ to edit more than one object at a time, though. :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." @@ -1347,58 +1378,11 @@ Good for evaluating ESS code." :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) - -(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) - -(define-obsolete-variable-alias 'R-mode-hook 'ess-r-mode-hook "19.04") -(defcustom ess-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" @@ -1407,8 +1391,8 @@ If nil, ESS will try finding one from a list." :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)) @@ -1424,7 +1408,7 @@ to decide highlighting and tag completion." "importFrom" "importClassesFrom" "importMethodsFrom" "useDynLib" "rdname" "section" "slot" "description" - "md") + "md" "eval") "The tags used in roxygen fields that require a parameter. Used to decide highlighting and tag completion." :group 'ess-roxy @@ -1453,7 +1437,7 @@ syntactically correct roxygen entries)" (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))) @@ -1465,15 +1449,14 @@ syntactically correct roxygen entries)" (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) (defvar ess-roxy-insert-prefix-on-newline t - "When non-nil, `ess-roxy-newline-and-indent' will make sure the new -line starts with the roxy prefix.") + "When non-nil, `ess-roxy-newline-and-indent' makes newlines start with the roxy prefix.") ; System variables @@ -1485,8 +1468,7 @@ line starts with the roxy prefix.") (put 'ess-local-process-name 'permanent-local t) (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) @@ -1545,8 +1527,7 @@ there is no project root in the current directory." ;; 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 -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) @@ -1592,22 +1573,24 @@ node `(ess)Customizing startup'. For example: :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-args "" - "String of switches used when starting stata. + "String of switches used when starting Stata. Also see `inferior-STA-program'." :group 'ess-Stata :type 'string) @@ -1620,11 +1603,11 @@ Used in e.g., \\[ess-execute-objects] or \\[ess-display-help-on-object]." :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 +Should contain a formatting %s to be replaced by a path (as in 'setwd(%s)\\n'.") (defcustom ess-program-files ;; 32 bit version @@ -1646,92 +1629,33 @@ path (as in 'setwd(%s)\\n'.") :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" @@ -1739,58 +1663,6 @@ menu." :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") @@ -1799,29 +1671,6 @@ version of the pathname." :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. @@ -1829,10 +1678,6 @@ 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 @@ -1844,7 +1689,7 @@ On Unix/Linux, use the Splus executable. On Windows, the default 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))) @@ -1857,61 +1702,15 @@ These arguments are currently passed only to S+6 and higher." :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. @@ -1930,16 +1729,11 @@ ask - ask the user whether the S buffers should be killed." '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 +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) - (defvaralias 'R-editor 'ess-r-editor) (defcustom ess-r-editor "emacsclient" "Editor called by R process with 'edit()' command." @@ -1973,23 +1767,16 @@ for editing and then to be returned to the process.") (defvar-local inferior-ess-language-start nil "Initialization commands sent to the ESS process.") -(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) - -(defvar inferior-S-program inferior-S+3-program - "Program name for invoking an inferior ESS with S.") - (define-obsolete-variable-alias 'inferior-ess-program-name 'inferior-ess-program "ESS 18.10") -(defvar-local 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-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'.") @@ -2035,7 +1822,7 @@ Otherwise, they get their own temporary buffer." "Non-nil means ess-eval- commands display commands in the process buffer. 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). +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 @@ -2045,14 +1832,12 @@ 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 :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) @@ -2077,8 +1862,8 @@ 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 @@ -2094,13 +1879,10 @@ status. "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) -(defvar ess-process-name-list nil - "Alist of active ESS processes.") - ;;*;; Inferior ESS commands (defvar-local ess-load-command "source('%s')\n" @@ -2131,40 +1913,24 @@ transitory output. See also `ess-eval-visibly-command' and (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-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.") (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-local ess-get-help-topics-function nil - "Dialect specific help topics retrieval") - -(defvar-local ess-display-help-on-object-function nil - "Dialect specific function for displaying help on object.") - -(defvar-local ess-find-help-file-function nil - "Dialect specific function for displaying help on object.") - -(defvar-local ess-build-help-command-function nil - "Dialect specific function for building an help command.") - (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-local inferior-ess-search-list-command nil @@ -2178,13 +1944,8 @@ Really set in -customize-alist in ess[dl]-*.el") "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) @@ -2195,7 +1956,7 @@ Really set in -customize-alist in ess[dl]-*.el") 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'.") @@ -2206,10 +1967,6 @@ from `inferior-ess-primary-prompt' and `inferior-ess-secondary-prompt'.") "\\(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(\\)" @@ -2217,18 +1974,9 @@ from `inferior-ess-primary-prompt' and `inferior-ess-secondary-prompt'.") ;;*;; 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-local ess-sl-modtime-alist nil "Alist of modification times for all ess directories accessed this session.") -(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 "This symbol saves the (directory . file) pair used in the last `ess-load-file' command. Used for determining the default in the next one.") @@ -2246,10 +1994,6 @@ from `inferior-ess-primary-prompt' and `inferior-ess-secondary-prompt'.") ;;*;; 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" @@ -2324,9 +2068,9 @@ See also function `ess-create-object-name-db'.") 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.") + "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)) @@ -2363,7 +2107,7 @@ for an example.") (defvar ess-S-fl-keyword:assign-ops (cons (regexp-opt ess-S-assign-ops) 'ess-assignment-face) - "Font-lock assign operators") + "Font-lock assign operators.") (defvar ess-S-fl-keyword:constants (cons (regexp-opt ess-S-constants 'words) 'ess-constant-face) @@ -2513,8 +2257,9 @@ default." (defcustom ess-help-pop-to-buffer t "If non-nil ess-help buffers are given focus during the display. -The default is t (except when `focus-follows-mouse' and -`mouse-autoselect-window' are both t)." +If non-nil, `ess-display-help' uses `pop-to-buffer' to display +help, otherwise it uses `display-buffer', which does not select +the help window." :group 'ess-help :type 'boolean) @@ -2526,19 +2271,17 @@ Possible values are: 'one: All help buffers are shown in one dedicated frame. t: Each help buffer gets its own frame. -Note if you set this to t you should also set -`ess-help-reuse-window' to nil to ensure that help buffers are -displayed in a new frame. - -The parameters of the own frame are stored in `ess-help-frame-alist'. -See also `inferior-ess-own-frame'." +If this is non-nil,`ess-help-reuse-window' is ignored. The +parameters of the own frame are stored in +`ess-help-frame-alist'." :group 'ess-help :type '(choice (const :tag "Display in current frame" nil) (const :tag "Display in one frame" one) (const :tag "Always display in a new frame" t))) (defcustom ess-help-reuse-window t - "If t, ESS tries to display new help buffers in the existing help window." + "If t, ESS tries to display new help buffers in the existing help window. +This variable is ignored if `ess-help-own-frame' is non-nil." :type 'boolean :group 'ess-help) @@ -2645,18 +2388,6 @@ highlighted with the same face as `ess-R-keywords'" (defvar ess-execute-screen-options-command nil "Dialect specific command run by `ess-execute-screen-options'.") -(defvar-local ess-help-web-search-command nil - "Dialect specific command web help search. -Passed to `ess-execute-dialect-specific' which see.") - -(defvar-local ess-manual-lookup-command nil - "Dialect specific command manual lookup. -Passed to `ess-execute-dialect-specific' which see.") - -(defvar-local ess-reference-lookup-command nil - "Dialect specific command for reference lookup. -Passed to `ess-execute-dialect-specific' which see.") - (defvar-local ess-funargs-command nil "Dialect specific command to return a list of function arguments. See `ess-function-arguments' and .ess_funargs command in R and @@ -2716,13 +2447,6 @@ See also `ess-verbose'." (defvar ess-dribble-buffer "*ESS*" "Buffer or name of buffer for printing debugging information.") -(defvar ess-customize-alist nil - "Variable settings to use for proper behavior. -Not buffer local!") -;; TODO: fixme We cannot make it local as yet, Not list is set on inferior startup. -;; (make-variable-buffer-local 'ess-customize-alist) -;; (defvaralias 'ess-local-customize-alist 'ess-customize-alist) - (defvar-local ess-local-customize-alist nil "Buffer local settings for proper behavior. Used to store the values for passing on to newly created buffers.") diff --git a/elpa/ess-20190121.1430/ess-defs.info b/elpa/ess-20191014.1343/ess-defs.info similarity index 100% rename from elpa/ess-20190121.1430/ess-defs.info rename to elpa/ess-20191014.1343/ess-defs.info diff --git a/elpa/ess-20190121.1430/ess-gretl.el b/elpa/ess-20191014.1343/ess-gretl.el similarity index 78% rename from elpa/ess-20190121.1430/ess-gretl.el rename to elpa/ess-20191014.1343/ess-gretl.el index e65d5860..12454612 100644 --- a/elpa/ess-20190121.1430/ess-gretl.el +++ b/elpa/ess-20191014.1343/ess-gretl.el @@ -1,4 +1,4 @@ -;; ess-gretl.el --- ESS gretl mode and inferior interaction +;; ess-gretl.el --- ESS gretl mode and inferior interaction -*- lexical-binding: t; -*- ;; ;; Copyright (C) 2012 Allin Cottrell ;; Copyright (C) 2012 Ahmadou DICKO @@ -14,7 +14,6 @@ ;; ;; 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 @@ -112,25 +111,25 @@ parenthetical grouping.") ;; "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 @@ -165,58 +164,58 @@ parenthetical grouping.") (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,7 +383,6 @@ end keywords as associated values.") (defun gretl-indent-line () "Indent current line of gretl code." (interactive) - ; (save-excursion (end-of-line) (indent-line-to (or (and (ess-inside-string-p (point-at-bol)) 0) @@ -398,16 +396,16 @@ end keywords as associated values.") (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)) + (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)) + (current-indentation)) 0)) (when (gretl-at-keyword gretl-block-end-keywords) (forward-word 1))) @@ -423,8 +421,8 @@ end keywords as associated values.") ;; (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))) @@ -438,14 +436,14 @@ end keywords as associated values.") (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) @@ -464,7 +462,6 @@ end keywords as associated values.") (inferior-ess-prompt . "\\? ") (ess-local-customize-alist . 'gretl-customize-alist) (inferior-ess-program . "gretlcli") - (ess-get-help-topics-function . 'gretl-get-help-topics-function) (ess-load-command . "open \"%s\"\n") ;; (ess-dump-error-re . "in \\w* at \\(.*\\):[0-9]+") ;; (ess-error-regexp . "\\(^\\s-*at\\s-*\\(?3:.*\\):\\(?2:[0-9]+\\)\\)") @@ -488,7 +485,6 @@ end keywords as associated values.") (ess-smart-operators . ess-r-smart-operators) (inferior-ess-exit-command . "exit\n") ;;harmful for shell-mode's C-a: -- but "necessary" for ESS-help? - (inferior-ess-start-args . "") (inferior-ess-language-start . nil) (ess-STERM . "iESS") ) @@ -506,16 +502,13 @@ end keywords as associated values.") ;; 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 (define-derived-mode ess-gretl-mode ess-mode "ESS[gretl]" "Major mode for editing gretl source. See `ess-mode' for more help." - ;; (setq ess-customize-alist gretl-customize-alist) ;;(setq imenu-generic-expression R-imenu-generic-expression) (ess-setq-vars-local gretl-customize-alist) (setq font-lock-defaults `(,gretl-font-lock-keywords)) @@ -526,7 +519,7 @@ been created using the variable `ess-r-versions'." (setq-local comment-add 1) (setq-local comment-start-skip "\\s<+\\s-*") (setq-local comment-column 40) - (setq-local ess-indent-line-function 'gretl-indent-line) + (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))) @@ -545,30 +538,29 @@ to gretl, put them in the variable `inferior-gretl-args'." ;; 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 diff --git a/elpa/ess-20190121.1430/ess-help.el b/elpa/ess-20191014.1343/ess-help.el similarity index 59% rename from elpa/ess-20190121.1430/ess-help.el rename to elpa/ess-20191014.1343/ess-help.el index 7d4c7f26..02bb8a75 100644 --- a/elpa/ess-20190121.1430/ess-help.el +++ b/elpa/ess-20191014.1343/ess-help.el @@ -31,7 +31,7 @@ ;;; 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: @@ -39,15 +39,21 @@ (require 'cl-lib) (eval-when-compile (require 'tramp)) -(require 'easymenu) (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-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.") @@ -59,13 +65,10 @@ ;;;; * The major mode ess-help-mode ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -(defun ess--help-major-mode (&optional dialect) +(cl-defgeneric ess--help-major-mode () "Determine which help major mode to call, and call it. -DIALECT defaults to `ess-dialect'." - (let ((ess-dialect (or dialect ess-dialect))) - (cond ((string= ess-dialect "R") (require 'ess-r-mode) (ess-r-help-mode)) - ((string= ess-dialect "stata") (require 'ess-stata-lang) (ess-stata-help-mode)) - (t (ess-help-mode))))) +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. @@ -111,7 +114,7 @@ the first 150 characters of the buffer are searched." (buffer-list))) (defvar-local ess-help-type nil - "Type of help file, help, index, vingettes etc. + "Type of help file, help, index, vignettes etc. Local in `ess-help' buffers.") (defvar-local ess-help-object nil @@ -120,49 +123,50 @@ Is name of the package for package index. Local in `ess-help' buffers.") (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)) (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 - (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--switch-to-help-buffer tbuffer))))) - -;;;###autoload + (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-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)) + (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) (let ((inhibit-modification-hooks t) @@ -193,9 +197,9 @@ suplied, it is used instead of `inferior-ess-help-command'." (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 + ;; Three ways to find HTML help, 1) ask sub-process 2) get URL/file from subprocess ;; 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 @@ -230,10 +234,8 @@ suplied, it is used instead of `inferior-ess-help-command'." "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))) (cl-defgeneric ess-help-commands () @@ -247,31 +249,32 @@ Currently understood commands: - 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 ((string= ess-dialect "R") (eql t))) +(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 () +(defun ess-display-package-index (&optional package) "Prompt for package name and display its index." - (interactive) - (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))))) - (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 (cdr (assoc 'package-index coms)) pack) + (format (cdr (assoc 'package-index coms)) package) (cdr (assoc 'index-keyword-reg coms)) - (format "*help[%s](index:%s)*" ess-dialect pack) - 'index nil nil (cdr (assoc 'index-start-reg coms)) pack))) + (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) @@ -283,12 +286,11 @@ 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'." - (interactive) (let ((inhibit-modification-hooks t) (alist ess-local-customize-alist) (pname ess-local-process-name) (buff (get-buffer-create title))) - (with-current-buffer buff + (ess-with-current-buffer buff (setq buffer-read-only nil) (delete-region (point-min) (point-max)) (setq ess-local-process-name pname) @@ -300,7 +302,7 @@ REG-START gives the start location from where to search linkifying, and HELP-OBJ (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 @@ -312,15 +314,17 @@ REG-START gives the start location from where to search linkifying, and HELP-OBJ '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." @@ -358,7 +362,6 @@ REG-START gives the start location from where to search linkifying, and HELP-OBJ "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") @@ -372,81 +375,12 @@ if necessary. It is bound to RET and C-m in R-index pages." 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) - (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 "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)))) @@ -458,139 +392,123 @@ With (prefix) ALL non-nil, use `vignette(*, all=TRUE)`, i.e., from all installed (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 (with-current-buffer (window-buffer w) (derived-mode-p '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)) +(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 - (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 [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) - ;;-- 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) @@ -600,28 +518,28 @@ For internal use. Take into account variable `ess-help-own-frame'." ;; 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]) "Menu used in ess-help mode.") @@ -631,15 +549,17 @@ For internal use. Take into account variable `ess-help-own-frame'." (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'. @@ -647,28 +567,32 @@ Use \\[ess-describe-sec-map] to see which keystrokes find which 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)))))) - -(defun ess-skip-to-next-section nil + (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 () "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-kill-buffer-and-go nil @@ -712,7 +636,7 @@ Keystroke Section "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))) @@ -731,22 +655,17 @@ nil otherwise." (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 @@ -772,7 +691,7 @@ Note that we can't search SAS, Stata or XLispStat for additional information." (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) @@ -810,12 +729,10 @@ Note that we can't search SAS, Stata or XLispStat for additional information." (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))) @@ -866,7 +783,7 @@ other dialects)." (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)))))) @@ -888,7 +805,8 @@ other dialects)." (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) @@ -896,5 +814,61 @@ other dialects)." (set-window-point (get-buffer-window buf) pos) ;; don't move window point buf))) +(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 --git a/elpa/ess-20190121.1430/ess-inf.el b/elpa/ess-20191014.1343/ess-inf.el similarity index 81% rename from elpa/ess-20190121.1430/ess-inf.el rename to elpa/ess-20191014.1343/ess-inf.el index 873d6e70..815b8313 100644 --- a/elpa/ess-20190121.1430/ess-inf.el +++ b/elpa/ess-20191014.1343/ess-inf.el @@ -38,27 +38,32 @@ (require 'tramp) (require 'subr-x)) (require 'ess-utils) +(require 'ess) +(require 'ess-tracebug) (require 'ansi-color) (require 'comint) -(require 'overlay) -(require 'project) (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") -(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 ess-mode "ess") -(declare-function ess-complete-object-name "ess-r-completion") +(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) @@ -69,12 +74,19 @@ (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 ess--inferior-major-mode (dialect) +(defun inferior-ess--set-major-mode (dialect) "Set major mode according to DIALECT." (cond ((string= "R" dialect) (progn (require 'ess-r-mode) @@ -93,8 +105,8 @@ (t (progn (setq-local inferior-ess-mode-syntax-table - (eval (or (alist-get 'inferior-ess-mode-syntax-table ess-customize-alist) - (alist-get 'ess-mode-syntax-table ess-customize-alist)))) + (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 @@ -117,14 +129,16 @@ If `ess-plain-first-buffername', then initial process is number-free." (= n 1))) ; if not both first and plain-first add number (concat ":" (number-to-string n))))) -(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 @@ -132,8 +146,6 @@ buffer name will be like *R* or *R2*, determined by `ess-gen-proc-buffer-name-function'. Takes the program name from the variable `inferior-ess-program'. -Arguments to `inferior-ess-program' can be given with -`inferior-ess-start-args'. See Info node `(ess)Customizing startup' and `display-buffer-alist' to control where and how the buffer is @@ -150,138 +162,105 @@ This may be useful for debugging." ;; If no transfile, use buffer *S* ;; This function is primarily used to figure out the Process and ;; buffer names to use for inferior-ess. - (let* ((ess-customize-alist (or customize-alist ess-customize-alist)) - (temp-ess-dialect (eval (cdr (assoc 'ess-dialect 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)) - ;; 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))) - (derived-mode-p '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) + (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)) + (cur-dir (inferior-ess--maybe-prompt-startup-directory proc-name temp-dialect)) + (default-directory cur-dir)) + (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 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 - (ess--inferior-major-mode ess-dialect) - (setq ess-local-process-name procname) - (with-current-buffer buf - (rename-buffer buf-name-str t)) - ;; Show the buffer - ;; TODO: Remove inferior-ess-own-frame after ESS 19.04, then just have: - ;; (pop-to-buffer buf) - (pop-to-buffer buf (with-no-warnings + (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 cur-dir) + (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)))) - ;; create the process - (setq buf - (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)) - - (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) - - ;; 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))))))) + (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 cur-dir)) + (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) (let ((abuf (process-get proc :accum-buffer))) @@ -307,9 +286,6 @@ Default depends on the ESS language/dialect and hence made buffer local") "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") -(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." (let* ((buffer-undo-list t) @@ -412,10 +388,9 @@ defined. If no project directory has been found, use (not (process-get proc 'busy))))))) (defun inferior-ess--set-status (proc string) - "Internal function to set the satus of the PROC. -Return non-nil if the process is in a ready (aka not busy) -state." - ;; todo: do it in one search, use starting position, use prog1 + "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. @@ -438,7 +413,7 @@ state." (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) @@ -489,7 +464,7 @@ Taken from octave-mod.el." (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)))) @@ -522,42 +497,53 @@ This marks the process with a message, at a particular time point." (format "\nProcess %s %s at %s\n" (process-name proc) message (current-time-string)))))))) -(defun inferior-ess-make-comint (bufname procname switches) - "Make a comint process in buffer BUFNAME with process PROCNAME. -SWITCHES is passed to `comint-exec'." - (let* ((buffer (get-buffer-create bufname)) - (proc (get-process procname))) - ;; If no process, or nuked process, crank up a new one 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))))) - (comint-exec buffer - procname - inferior-ess-program - nil - (ess-line-to-list-of-words - switches))))) - buffer)) +;; 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 + (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'? +;; Deprecate `ess-directory-function' in favor of `project-find-functions'? (defun inferior-ess--get-startup-directory () (let ((dir (or (and ess--enable-experimental-projects (fboundp 'project-current) @@ -612,12 +598,15 @@ evaluation of BODY." 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)) @@ -634,41 +623,29 @@ running (anymore), try to connect to another if there is one. By 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) - (error "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)) - + (cl-assert name nil "No ESS process is associated with this buffer now") + (update-ess-process-name-list) + (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 - (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))))))) + (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 () (ess-get-process-variable 'default-directory)) @@ -689,6 +666,8 @@ happens interactively (when possible)." ;;*;; 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." @@ -764,11 +743,11 @@ Returns the name of the selected process." (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") + (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" "XLS" "ViSta"))))) - (let* ((pname-list (delq nil ;; keep only those mathing dialect + (let* ((pname-list (delq nil ;; keep only those matching dialect (append (mapcar (lambda (lproc) (and (equal ess-dialect @@ -841,20 +820,21 @@ process if process associated with current buffer has 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))) - (setq ess-local-process-name proc)))))) + (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) @@ -895,18 +875,13 @@ With (prefix) EOB-P non-nil, positions cursor at end of buffer." '(nil . ((inhibit-same-window . t)))) (when eob-p (goto-char (point-max)))) -(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)")) - (defun ess-switch-to-end-of-ESS () "Switch to the end of the inferior ESS process buffer." (interactive) (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 @@ -915,32 +890,28 @@ function switches to the end of process buffer. If TOGGLE-EOB is 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 (derived-mode-p '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 - (ess-derived-mode-p) - (equal dialect ess-dialect) - (null ess-local-process-name)) - (and - (ess-derived-mode-p) - (equal loc-proc-name ess-local-process-name)))))) - (pop blist)) - (if blist - (pop-to-buffer (car blist)) - (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)) + (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) @@ -993,7 +964,7 @@ 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 +FORCE-REDISPLAY to avoid excessive redisplay. If TIMEOUT is non-nil stop waiting for output after TIMEOUT seconds." (setq proc (or proc (get-process ess-local-process-name))) (setq wait (or wait 0.005)) @@ -1184,7 +1155,7 @@ type of the region." (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 @@ -1203,22 +1174,13 @@ This handles Tramp when working on a remote." (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)) - (ess-load-file--override filename)) + (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 ((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)) + (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")) @@ -1262,7 +1224,11 @@ wrapping the code into: ... })" (let ((out-buffer (or out-buffer (get-buffer-create " *ess-command-output*"))) - (proc (ess-command--get-proc proc no-prompt-check))) + (proc (ess-command--get-proc proc no-prompt-check)) + ;; Set `inhibit-quit' to t to avoid dumping R output to the + ;; process buffer if `ess-command' gets interrupted for some + ;; reason. See bugs #794 and #842 + (inhibit-quit t)) (with-current-buffer (process-buffer proc) (let ((primary-prompt inferior-ess-primary-prompt) (oldpb (process-buffer proc)) @@ -1286,7 +1252,11 @@ wrapping the code into: (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)) + ;; Should (almost) never be incomplete unless the message + ;; contains "> " and was accidentally split by the process + ;; right there. + (while (eq :incomplete (ess-mpi-handle-messages (current-buffer))) + (ess-wait-for-process proc nil wait force-redisplay)) ;; Remove prompt ;; If output is cat(..)ed this deletes the output (goto-char (point-max)) @@ -1310,9 +1280,14 @@ Example (ess-boolean-command \"2>1\n\")" (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)))) + (let ((prompt inferior-ess-prompt)) + (with-current-buffer (ess-command com buf nil nil wait) + (goto-char (point-min)) + ;; remove leading prompt + (when (and prompt (re-search-forward (concat "^" prompt) (point-at-eol) t)) + (delete-region (point-min) (match-end 0))) + (ess-kill-last-line) + (buffer-substring (point-min) (point-max))))) (defun ess-async-command (com &optional buf proc callback interrupt-callback) "Asynchronous version of `ess-command'. @@ -1343,7 +1318,7 @@ up in user's main buffer." (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 @@ -1354,8 +1329,6 @@ until the command manages to run completely. DELAY defaults to 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* ((delay (or delay (+ ess-idle-timer-interval 3))) (int-cb `(lambda (proc) @@ -1372,7 +1345,7 @@ of `ess-async-command' with an explicit interrupt-callback." (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 +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." @@ -1382,8 +1355,7 @@ similar to `load-library' Emacs function." pack) (setq pack (ess-completing-read "Load" packs)) (ess-load-library--override pack) - (ess--mark-search-list-as-changed) - (display-buffer (buffer-name (process-buffer (get-process ess-current-process-name)))))) + (ess--mark-search-list-as-changed))) (cl-defgeneric ess-installed-packages () "Return a list of installed packages.") @@ -1454,7 +1426,7 @@ TEXT." (when win (with-selected-window win (goto-char (point)) - ;; this is crucial to avoid reseting window-point + ;; this is crucial to avoid resetting window-point (recenter (- -1 scroll-margin)))))) (if (numberp sleep-sec) (sleep-for sleep-sec))) @@ -1489,11 +1461,7 @@ the lines of the rectangle separately to the inferior process." ;; 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))))) @@ -1538,6 +1506,7 @@ VIS has same meaning as for `ess-eval-region'." 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) (save-excursion (ignore-errors ;; Evaluation is forward oriented @@ -1548,12 +1517,11 @@ Prefix arg VIS toggles visibility of ess-code as for (end-of-defun) (beginning-of-defun) ;; While we are the beginning of the function, get the function - ;; name + ;; name. FIXME: should use our ess-function-pattern. (setq msg (format "Eval function: %s" - (propertize (if (looking-at-p add-log-current-defun-header-regexp) - (add-log-current-defun) - (buffer-substring-no-properties (point) (point-at-eol))) - 'face 'font-lock-function-name-face))) + (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)) @@ -1568,14 +1536,18 @@ Prefix arg VIS toggles visibility of ess-code as for "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 - (ignore-errors + (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)) - (let ((beg (progn (backward-paragraph) (point))) - (end (progn (forward-paragraph) (point)))) - (ess-eval-region beg end vis)))) + (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 (&optional vis) "Send the current function if \\[point] is inside one. @@ -1641,7 +1613,14 @@ place (see `ess-r-set-evaluation-env') evaluation of multiline input will fail." (interactive) (ess-force-buffer-current) - (display-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))) @@ -1674,7 +1653,14 @@ place (see `ess-r-set-evaluation-env'), the evaluation of multiline input will fail." (interactive "P") (ess-force-buffer-current) - (display-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-empty (or ess-eval-empty simple-next))) (ess-eval-line) @@ -1751,35 +1737,31 @@ meaning as for `ess-eval-region'." (defvar inferior-ess-mode-map (let ((map (make-sparse-keymap))) - (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) + ;;(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.") @@ -1787,13 +1769,13 @@ meaning as for `ess-eval-region'." 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) @@ -1805,16 +1787,16 @@ meaning as for `ess-eval-region'." :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); <-- ?? @@ -1833,10 +1815,10 @@ meaning as for `ess-eval-region'." (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'.") @@ -1845,23 +1827,10 @@ meaning as for `ess-eval-region'." 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." - ;; initialize all custom vars: - (when ess-customize-alist - (ess-setq-vars-local ess-customize-alist)) + :group 'ess-proc (setq-local comint-input-sender 'inferior-ess-input-sender) - - (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)) - (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 (setq-local comint-process-echoes (not (member ess-language '("SAS" "XLS" "OMG" "julia")))) @@ -1912,7 +1881,7 @@ node `(ess)Top'. If you accidentally suspend your process, use (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)))) @@ -1931,13 +1900,13 @@ node `(ess)Top'. If you accidentally suspend your process, use (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 @@ -1951,8 +1920,8 @@ Note: `inferior-ess-secondary-prompt' should match exactly." (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 @@ -1988,13 +1957,13 @@ field. NOTE: to be used only with fields, see (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)) @@ -2004,7 +1973,7 @@ If in the output field, goes to the begining of previous input." (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 () @@ -2029,7 +1998,6 @@ If in the output field, goes to the begining of previous input." (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") "")))) @@ -2157,7 +2125,7 @@ to the command if BUFF is not given.)" (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)) @@ -2170,18 +2138,14 @@ to the command if BUFF is not given.)" 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 - (ansi-color-apply-on-region (point-min) (point-max)) - (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 @@ -2199,7 +2163,9 @@ to the command if BUFF is not given.)" Runs `ess-cleanup'. ARG gets passed to a language specific method, see `ess-quit--override'." (interactive "P") - (ess-force-buffer-current "Process to quit: " nil 'no-autostart) + (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) (ess-quit--override arg)) @@ -2236,12 +2202,14 @@ If you want to finish your session, use \\[ess-quit] instead." (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 @@ -2259,29 +2227,35 @@ before you quit. It is run automatically by \\[ess-quit]." ess-local-process-name (equal ess-local-process-name the-procname)) (kill-buffer buf))))) - (ess-switch-to-ESS nil))) + (display-buffer buf) + buf)) (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)) - (inferior-ess-reload--override start-args)))) - -(cl-defmethod inferior-ess-reload--override (start-args) - (user-error "Reloading not implemented for %s %s" ess-dialect start-args)) + (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) + (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 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. @@ -2293,11 +2267,6 @@ after issuing a quit command as the latter assumes a live process." (when (> (- (float-time) start-time) 1) (error "Timeout while quitting process"))))) -(defun ess-list-object-completions nil - "List all possible completions of the object name at point." - (interactive) - (ess-complete-object-name)) - ;;;*;;; Support functions @@ -2390,7 +2359,7 @@ print(out, max=1e6) })\n\"." " *ess-get-words*")); initial space: disable-undo (word-RE (concat "\\(" - "\\\\\\\"" "\\|" "[^\"]" ; \" or non-"-char + "\\\\\"" "\\|" "[^\"]" ; \" or non-"-char "\\)*")) (full-word-regexp (concat "\"" "\\(" word-RE "\\)" @@ -2555,26 +2524,30 @@ directory in the `load-path'." (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 () "Return completion only within string or comment." - (save-restriction ;; explicitely handle inferior-ess + (save-restriction ;; explicitly handle inferior-ess (ignore-errors (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 + (save-restriction ;; explicitly handle inferior-ess (ignore-errors (when (and (derived-mode-p 'inferior-ess-mode) (> (point) (process-mark (get-buffer-process (current-buffer))))) @@ -2654,7 +2627,7 @@ dirnames. Don't try to use cache if FORCE-UPDATE is non-nil. Is (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 @@ -2664,19 +2637,18 @@ don't recompile first object in the search list." (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" @@ -2814,7 +2786,7 @@ NO-ERROR prevents errors when this has not been implemented for (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 @@ -2863,56 +2835,6 @@ To be used in `ess-idle-timer-functions'." ;;*;; 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 @@ -2921,15 +2843,31 @@ Uses `temp-buffer-show-function' and respects (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 @@ -2964,33 +2902,26 @@ if this is the case." 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 @@ -3035,10 +2966,9 @@ is for compatibility with `next-error' and is ignored." (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 diff --git a/elpa/ess-20190121.1430/ess-jags-d.el b/elpa/ess-20191014.1343/ess-jags-d.el similarity index 98% rename from elpa/ess-20190121.1430/ess-jags-d.el rename to elpa/ess-20191014.1343/ess-jags-d.el index a5797765..fcf7b872 100644 --- a/elpa/ess-20190121.1430/ess-jags-d.el +++ b/elpa/ess-20191014.1343/ess-jags-d.el @@ -1,4 +1,4 @@ -;;; ess-jags-d.el --- ESS[JAGS] dialect +;;; ess-jags-d.el --- ESS[JAGS] dialect -*- lexical-binding: t; -*- ;; Copyright (C) 2008-2011 Rodney Sparapani @@ -23,7 +23,6 @@ ;;; Code: -(require 'ess-bugs-l) (require 'ess-bugs-d) (require 'ess-utils) (require 'ess-inf) @@ -175,7 +174,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") @@ -250,8 +249,6 @@ ;;;###autoload (add-to-list 'auto-mode-alist '("\\.[Jj][Aa][Gg]\\'" . ess-jags-mode)) -;; FIXME: What is this doing here!? -(setq features (delete 'ess-bugs-d features)) (provide 'ess-jags-d) ;;; ess-jags-d.el ends here diff --git a/elpa/ess-20190121.1430/ess-julia.el b/elpa/ess-20191014.1343/ess-julia.el similarity index 87% rename from elpa/ess-20190121.1430/ess-julia.el rename to elpa/ess-20191014.1343/ess-julia.el index b4f4bfcc..5f244236 100644 --- a/elpa/ess-20190121.1430/ess-julia.el +++ b/elpa/ess-20191014.1343/ess-julia.el @@ -30,7 +30,7 @@ ;; ;;; 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 @@ -41,19 +41,18 @@ ;; ;;; Code: -(require 'compile) -(require 'ess-utils) -(require 'ess-r-mode) (require 'ess-help) -(require 'julia-mode) (require 'ess-inf) +(require 'ess-r-mode) +(require 'ess-utils) +(require 'julia-mode) (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) @@ -70,7 +69,7 @@ VISIBLY is not currently used." ;;; HELP -(defun ess-julia-get-help-topics (&optional proc) +(cl-defmethod ess-help-get-topics (proc &context (ess-dialect "julia")) (append (with-current-buffer (ess-command "ESS.all_help_topics()\n") (split-string (buffer-string) "\n")) (ess-julia--get-objects proc))) @@ -80,7 +79,8 @@ VISIBLY is not currently used." (require 'url) (goto-char (point-min)) (let (out) - (while (re-search-forward "toctree.*href=\"\\(.+\\)\">\\(.+\\)]+\\)\">\\([^<]+\\)Introduction (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)))) @@ -110,12 +109,12 @@ See `comint-input-sender'." (t ;; normal command (inferior-ess-input-sender proc string)))))) -(cl-defmethod ess-installed-packages (&context ((string= ess-dialect "julia") (eql 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 ((string= ess-dialect "julia") (eql t))) +(cl-defmethod ess-load-library--override (pack &context (ess-dialect "julia")) (ess-eval-linewise (format "using %s\n" pack))) @@ -265,7 +264,6 @@ objects from that MODULE." "Return the doc string, or nil. If an ESS process is not associated with the buffer, do not try to look up any doc strings." - (interactive) (when (and ess-can-eval-in-background (ess-process-live-p) (not (ess-process-get 'busy))) @@ -287,30 +285,14 @@ to look up any doc strings." (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 - '((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) (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]+") @@ -336,7 +318,6 @@ to look up any doc strings." (ess-smart-operators . ess-r-smart-operators) (inferior-ess-exit-command . "exit()\n") ;;harmful for shell-mode's C-a: -- but "necessary" for ESS-help? - (inferior-ess-start-args . "") (inferior-ess-language-start . nil) (ess-STERM . "iESS") (ess-editor . ess-r-editor) @@ -345,6 +326,10 @@ to look up any doc strings." (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 (copy-syntax-table ess-r-mode-syntax-table))) (modify-syntax-entry ?. "_" table) @@ -355,7 +340,7 @@ to look up any doc strings." "Syntax table used for completion and help symbol lookup. It makes underscores and dots word constituent chars.") -(cl-defmethod ess-help-commands (&context ((string= ess-dialect "julia") (eql t))) +(cl-defmethod ess-help-commands (&context (ess-dialect "julia")) '((packages . "_ess_list_categories()\n") (package-index . "_ess_print_index(\"%s\")\n") (index-keyword-reg . "^\\(.*+\\):$*") @@ -372,6 +357,7 @@ It makes underscores and dots word constituent chars.") ;;;###autoload (define-derived-mode ess-julia-mode julia-mode "ESS[julia]" "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) @@ -387,9 +373,8 @@ It makes underscores and dots word constituent chars.") (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)) - (setq imenu-generic-expression ess-julia-imenu-generic-expression) - (imenu-add-to-menubar "Imenu-jl")) + (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 @@ -398,8 +383,10 @@ It makes underscores and dots word constituent chars.") (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 (add-function :before-until (local 'eldoc-documentation-function) @@ -420,7 +407,7 @@ It makes underscores and dots word constituent chars.") "Functions run in process buffer after starting julia process.") ;;;###autoload -(defun julia (&optional start-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 @@ -431,7 +418,6 @@ always be passed to julia, put them in the variable ;; 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" @@ -445,23 +431,37 @@ always be passed to julia, put them in the variable (concat " [other than '" inferior-julia-args "']")) " ? ")) nil)))) - (inferior-ess jl-start-args) - - (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))))) + (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)) + +(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 --git a/elpa/ess-20190121.1430/ess-mode.el b/elpa/ess-20191014.1343/ess-mode.el similarity index 66% rename from elpa/ess-20190121.1430/ess-mode.el rename to elpa/ess-20191014.1343/ess-mode.el index 0c2c34c3..84a4b3f8 100644 --- a/elpa/ess-20190121.1430/ess-mode.el +++ b/elpa/ess-20191014.1343/ess-mode.el @@ -21,7 +21,7 @@ ;; https://www.r-project.org/Licenses/ ;; ;;; Commentary: -;; +;; ;;; Code: (require 'ess) @@ -29,66 +29,70 @@ (eval-when-compile (require 'cl-lib) (require 'subr-x)) -(require 'ess-custom) -(require 'ess-utils) (require 'ess-inf) ;; Silence the byte compiler -(declare-function run-ess-r "ess-r-mode") -(declare-function S+ "ess-sp6-d") -(declare-function SAS "ess-sas-d") +(declare-function run-ess-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) + (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) + (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\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\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) - (define-key map (kbd "C-c C-=") 'ess-cycle-assign) map) "Keymap for `ess-mode'.") @@ -100,23 +104,23 @@ (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) + (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.") @@ -124,7 +128,6 @@ 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] @@ -135,7 +138,7 @@ ("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] + ["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] @@ -145,7 +148,7 @@ ["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 + ;; See `ess-r-define-runners' and ess-site.el ("Other" ["No other R or Sqpe versions" nil nil]) ["About" @@ -153,35 +156,32 @@ ;; :help "Read about starting a new ESS process" :active t] ) ("Eval visibly " - :filter ess--generate-eval-visibly-submenu)) + :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" 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 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 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] - ["Eval chunk" ess-eval-chunk-and-go ess-noweb-mode] - ["Eval thread" ess-eval-thread-and-go ess-noweb-mode] + ["Eval paragraph" ess-eval-paragraph-and-go t] ["About" (ess-goto-info "Evaluating code") t] ) ("Motion" @@ -190,14 +190,14 @@ "-----" ["Backward list" backward-list t] ["Forward list" forward-list t] - ["Next parenthesis" down-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] + ["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] @@ -258,12 +258,6 @@ Comments are indented in a similar way to Emacs-lisp mode: \\[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 @@ -295,6 +289,7 @@ Variables controlling indentation style: 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)) @@ -304,30 +299,16 @@ indentation style. See `ess-style-alist' for predefined styles." ;; Keep out of the code. (setq-local 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 'hack-local-variables-hook #'ess--set-style-in-buffer nil t) (add-hook 'ess-idle-timer-functions 'ess-synchronize-dirs nil 'local)) -(defun ess--set-style-in-buffer () - "Set `ess-style' taking into account file and directory local variables. -This is added to `hack-local-variables-hook'." - (setq-local ess-style (or (alist-get 'ess-style file-local-variables-alist) - ess-style)) - (ess-set-style ess-style t)) - (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 +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)) @@ -358,23 +339,24 @@ With UPDATE, update cached package list." "If inside a function go to the beginning of it. Otherwise go to the beginning of paragraph." (interactive) - (let ((pos (point)) + (let ((start-pos (point)) beg end) (beginning-of-defun) (setq beg (point)) (end-of-defun) (setq end (point)) (goto-char beg) - (when (or (< beg pos) - (> end pos)) + (unless (and (< beg start-pos) + (> end start-pos)) (let ((par-pos (save-excursion - (goto-char pos) + (goto-char start-pos) (forward-comment most-negative-fixnum) (backward-paragraph) (forward-comment most-positive-fixnum) (point)))) - (when (<= end par-pos) - (goto-char par-pos)))))) + (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. @@ -414,8 +396,10 @@ current function." (interactive) (save-excursion (widen) - (let* ((beg (ess-goto-beginning-of-function-or-para)) - (end (ess-goto-end-of-function-or-para))) + (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") @@ -431,42 +415,57 @@ current function." ;;; 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) +(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-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)) +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 `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. +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' @@ -481,10 +480,10 @@ instead of indenting." (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)) + (let ((shift-amt (funcall indent-line-function)) beg end) (save-excursion - (if ess-tab-always-indent + (if tab-always-indent (beginning-of-line)) (setq beg (point)) (backward-up-list 1) @@ -495,26 +494,27 @@ instead of indenting." (setq beg (point))) (if (> end beg) (indent-code-rigidly beg end shift-amt)))) - ((and (not ess-tab-always-indent) + ((and (not tab-always-indent) (save-excursion (skip-chars-backward " \t") (not (bolp)))) (insert-tab)) - ;; call ess-indent-line (t (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. The -default of `ess-tab-complete-in-script' is nil. Also see +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 (ess-indent-command))) - (when (and ess-tab-complete-in-script - (numberp shift) ;; can be nil if ess-tab-always-indent is nil + (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) @@ -544,19 +544,12 @@ default of `ess-tab-complete-in-script' is nil. Also see (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)))) + (declare (obsolete 'indent-line-function "ESS 19.04")) + (funcall indent-line-function)) ;;; Dump Objects -;;;###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 @@ -572,14 +565,13 @@ generate the source buffer." ess-source-directory (with-current-buffer (process-buffer (ess-get-process ess-local-process-name)) - (ess-setq-vars-local ess-customize-alist) + (ess-setq-vars-local ess-local-customize-alist) (apply ess-source-directory nil))))) - (filename (concat dirname (format ess-dump-filename-template object))) + (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 - (if (file-exists-p (directory-file-name dirname)) nil - (if (y-or-n-p ; Approved - (format "Directory %s does not exist. Create it? " dirname)) + (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: @@ -587,19 +579,14 @@ generate the source buffer." ;; (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)))))) + (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." @@ -633,28 +620,21 @@ generate the source buffer." (defun ess-find-dump-file-other-window (filename) "Find ESS source file FILENAME in another window." - (if (file-exists-p filename) nil + (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) - (setq-local ess-local-customize-alist ess-customize-alist) - (ess-mode) (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))))))) - + (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 diff --git a/elpa/ess-20190121.1430/ess-pkg.el b/elpa/ess-20191014.1343/ess-pkg.el similarity index 92% rename from elpa/ess-20190121.1430/ess-pkg.el rename to elpa/ess-20191014.1343/ess-pkg.el index b78a11f6..5bdb9ac4 100644 --- a/elpa/ess-20190121.1430/ess-pkg.el +++ b/elpa/ess-20191014.1343/ess-pkg.el @@ -1,4 +1,4 @@ -(define-package "ess" "20190121.1430" "Emacs Speaks Statistics" +(define-package "ess" "20191014.1343" "Emacs Speaks Statistics" '((emacs "25.1") (julia-mode "0.3")) :authors diff --git a/elpa/ess-20190121.1430/ess-r-completion.el b/elpa/ess-20191014.1343/ess-r-completion.el similarity index 89% rename from elpa/ess-20190121.1430/ess-r-completion.el rename to elpa/ess-20191014.1343/ess-r-completion.el index 42ae394e..2eeca6e5 100644 --- a/elpa/ess-20190121.1430/ess-r-completion.el +++ b/elpa/ess-20191014.1343/ess-r-completion.el @@ -31,10 +31,12 @@ ;;; ElDoc (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 +44,15 @@ (declare-function company-begin-backend "company") (declare-function company-doc-buffer "company") +(defcustom ess-R-argument-suffix " = " + "Suffix appended by `ac-source-R' and `ac-source-R-args' to candidates." + :group 'ess-R + :type 'string) + (defun ess-r-eldoc-function () "Return the doc string, or nil. If an ESS process is not associated with the buffer, do not try to look up any doc strings." - (interactive) (when (and eldoc-mode ess-can-eval-in-background) (let* ((proc (ess-get-next-available-process)) (funname (and proc (or (and ess-eldoc-show-on-symbol ;; Aggressive completion @@ -155,9 +161,9 @@ to look up any doc strings." 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 @@ -168,17 +174,7 @@ or \\[ess-internal-complete-object-name] otherwise." (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 () @@ -195,7 +191,6 @@ This is done automatically (and transparently) if a directory is modified (S only!), so the most up-to-date list of object names is always available. However attached dataframes are *not* updated, so this command may be necessary if you modify an attached dataframe." - (interactive) (ess-make-buffer-current) (if (memq (char-syntax (preceding-char)) '(?w ?_)) (let* ((comint-completion-addsuffix nil) @@ -253,9 +248,10 @@ token. Needs version of R >= 2.7.0." (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")))) @@ -264,7 +260,6 @@ token. Needs version of R >= 2.7.0." (defun ess-r-complete-object-name () "Completion in R via R's completion utilities (formerly 'rcompgen'). To be used instead of ESS' completion engine for R versions >= 2.7.0." - (interactive) (let ((possible-completions (ess-r-get-rcompletions)) token-string) (when possible-completions @@ -307,12 +302,6 @@ To be used instead of ESS' completion engine for R versions >= 2.7.0." ;;; 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 'ess-R - :type 'string) - (defvar ess-r--funargs-pre-cache '(("plot" (("graphics") @@ -414,21 +403,6 @@ To be used instead of ESS' completion engine for R versions >= 2.7.0." (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 @@ -437,43 +411,67 @@ packages are installed." '("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 +;; 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 @@ -482,14 +480,16 @@ packages are installed." (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 @@ -499,22 +499,21 @@ packages are installed." ;; (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 --git a/elpa/ess-20190121.1430/ess-r-flymake.el b/elpa/ess-20191014.1343/ess-r-flymake.el similarity index 88% rename from elpa/ess-20190121.1430/ess-r-flymake.el rename to elpa/ess-20191014.1343/ess-r-flymake.el index 0e70f629..dc00a3a1 100644 --- a/elpa/ess-20190121.1430/ess-r-flymake.el +++ b/elpa/ess-20191014.1343/ess-r-flymake.el @@ -33,10 +33,8 @@ ;;; Code: (eval-when-compile (require 'cl-lib)) -(require 'ess-custom) (require 'ess-inf) (require 'flymake) -(require 'project) ;; Appease the byte compiler for Emacs 25. Remove after dropping ;; support for Emacs 25. @@ -87,7 +85,7 @@ each element is passed as argument to 'lintr::with_defaults'." cat('@@error: @@`lintr` package not installed') } else { if (packageVersion('lintr') <= '1.0.3') { - cat('@@error: @@Need `lintr` version > v1.0.2') + cat('@@error: @@Need `lintr` version > v1.0.3') } else { tryCatch(lintr::lint(commandArgs(TRUE), ...), error = function(e) { @@ -101,18 +99,27 @@ each element is passed as argument to 'lintr::with_defaults'." "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 (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"))))) + (let ((cur-dir-file (expand-file-name ".lintr" default-directory)) + (ess-proj-file (and (fboundp 'ess-r-package-project) + (ess-r-package-project) + (expand-file-name ".lintr" (cdr (ess-r-package-project))))) + (proj-file (and (project-current) + (project-roots (project-current)) + (expand-file-name ".lintr" (car (project-roots (project-current)))))) + (home-file (expand-file-name ".lintr" (getenv "HOME")))) + (cond (;; current directory + (file-readable-p cur-dir-file) + cur-dir-file) + ;; Project root according to `ess-r-package-project' + ((and ess-proj-file + (file-readable-p ess-proj-file)) + ess-proj-file) + ;; Project root according to `project-roots' + ((and proj-file + (file-readable-p proj-file))) + ;; Home directory + ((file-readable-p home-file) + home-file)))) (defun ess-r--flymake-linters () "If `ess-r-flymake-linters' is a string, use that. @@ -238,9 +245,9 @@ Activate flymake only if `ess-use-flymake' is non-nil." ;; 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 --git a/elpa/ess-20190121.1430/ess-r-mode.el b/elpa/ess-20191014.1343/ess-r-mode.el similarity index 65% rename from elpa/ess-20190121.1430/ess-r-mode.el rename to elpa/ess-20191014.1343/ess-r-mode.el index c8b9dae8..64aed8e2 100644 --- a/elpa/ess-20190121.1430/ess-r-mode.el +++ b/elpa/ess-20191014.1343/ess-r-mode.el @@ -37,9 +37,6 @@ (require 'subr-x)) (require 'cl-lib) (require 'compile) -(require 'easymenu) -(require 'eldoc) -(require 'seq) (require 'ess-mode) (require 'ess-help) (require 'ess-s-lang) @@ -51,6 +48,31 @@ (require 'ess-r-xref) (when (>= emacs-major-version 26) (require 'ess-r-flymake)) ; Flymake rewrite in Emacs 26 +(declare-function ess-rdired "ess-rdired" ()) + +(define-obsolete-variable-alias 'R-mode-hook 'ess-r-mode-hook "19.04") +(defcustom ess-r-mode-hook nil + "Hook run when entering `ess-r-mode'." + :options '(electric-layout-local-mode) + :type 'hook + :group 'ess-R) + + +(defcustom ess-r-fetch-ESSR-on-remotes nil + "If non-nil, fetch ESSR from the GitHub repository. +Otherwise source from local ESS installation. When 'ess-remote, +fetch only with `ess-remote'. When t, always fetch from remotes. +Change this variable when loading ESSR code on remotes fails +systematically. + +Fetching happens once per new ESSR version. The archive is stored +in ~/.config/ESSR/ folder. 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) @@ -66,103 +88,125 @@ (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-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 + :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 @@ -221,6 +265,13 @@ (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") +(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 @@ -253,39 +304,37 @@ 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)) - (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)))) + (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 + '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) + (t + font-lock-string-face))) + font-lock-comment-face)) (defvar ess-r--non-fn-kwds '("in" "else" "break" "next" "repeat")) @@ -340,8 +389,6 @@ To be used as part of `font-lock-defaults' keywords." (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-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-change-sp-regexp . ess-r-change-sp-regexp) (ess-help-sec-regex . ess-help-r-sec-regex) @@ -354,7 +401,6 @@ To be used as part of `font-lock-defaults' keywords." (inferior-ess-search-list-command . "search()\n") (inferior-ess-help-command . inferior-ess-r-help-command) (inferior-ess-exit-command . "q()") - (inferior-ess-start-args . "") (ess-error-regexp-alist . ess-r-error-regexp-alist) (ess-describe-object-at-point-commands . 'ess-r-describe-object-at-point-commands) (ess-STERM . "iESS") @@ -363,7 +409,7 @@ To be used as part of `font-lock-defaults' keywords." S-common-cust-alist) "Variables to customize for R.") -(cl-defmethod ess-build-tags-command (&context ((string= ess-dialect "R") (eql t))) +(cl-defmethod ess-build-tags-command (&context (ess-dialect "R")) "Return tags command for R." "rtags('%s', recursive = TRUE, pattern = '\\\\.[RrSs](rw)?$',ofile = '%s')") @@ -404,54 +450,21 @@ fill=TRUE); try(traceback(), silent=TRUE)})\n") (defvar ess-r-error-regexp-alist '(R R1 R2 R3 R4 R-recover) "List of symbols which are looked up in `compilation-error-regexp-alist-alist'.") -;; Takes precidence over R1 below in english locales, and allows spaces in file path -(add-to-list 'compilation-error-regexp-alist-alist - '(R "\\(\\(?: at \\|(@\\)\\([^#()\n]+\\)[#:]\\([0-9]+\\)\\)" 2 3 nil 2 1)) - -(add-to-list 'compilation-error-regexp-alist-alist +(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 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 + (R1 "(\\([^ ):\n]+\\):\\([0-9]+\\)?)" 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 `delete-dups'. -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-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 @@ -476,10 +489,18 @@ will be prompted to enter arguments interactively." (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) + (and ess-startup-directory + (file-remote-p 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) @@ -498,44 +519,31 @@ will be prompted to enter arguments interactively." (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) - (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) + (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))) + ;; FIXME: Current ob-R expects current buffer set to process buffer + (set-buffer inf-buf)))) ;;;###autoload (defalias 'R #'run-ess-r) @@ -555,26 +563,24 @@ the package directory was selected in the first place." dir)) dir)) -(defun R-initialize-on-start (&optional proc string) +(defun inferior-ess-r--init-callback (_proc _name) + (R-initialize-on-start)) + +(defun 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'), + (ess-command (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) + inferior-ess-pager)) + (ess-r-load-ESSR) (when inferior-ess-language-start (ess-command (concat inferior-ess-language-start "\n"))) ;; tracebug (when ess-use-tracebug (ess-tracebug 1)) - (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))) + (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 @@ -587,70 +593,113 @@ Executed in process buffer." (skip-chars-forward " \t\n") (goto-char (cadr (ess-continuations-bounds)))))) -(defun ess-r-beginning-of-function (&optional arg) +;; `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." - (interactive) +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 ((init-point (point)) + (let ((start-point (point)) done) - ;; ;; in case we are at the start of a function, skip past new lines + ;; In case we are at the start of a function, skip past new lines. (when (> arg 0) - (skip-chars-backward " \t\n")) - ;; start search from eol to capture current function start - (end-of-line 1) + ;; 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-function-pattern nil t arg)) + (re-search-backward ess-r-function-pattern nil t arg)) (unless (ess-inside-string-or-comment-p) - ;; capture top level forms only - (when (= (car (syntax-ppss (match-beginning 0))) 0) - (setq done t)))) + (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 init-point)))) + (goto-char start-point) + nil))) -(defun ess-r-end-of-function (&optional arg) +(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. Value of ARG is currently ignored. Return the -new position." - (interactive) +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 () + (search-fn (lambda (lim) (let ((foundp nil)) (while (and (not foundp) (re-search-forward ess-r-function-pattern nil t)) - (setq foundp (not (ess-inside-string-or-comment-p)))) + (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) + (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))) - (funcall search-fn)) - (point))) + (funcall search-fn start-pos))) + ;; No function before point; search forward on positive ARG. + (when (> arg 0) + (funcall search-fn start-pos))))) ;;;###autoload (define-derived-mode ess-r-mode ess-mode "ESS[R]" "Major mode for editing R source. See `ess-mode' for more help." + :group 'ess-R (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-indent-line) + (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 electric-layout-rules '((?{ . after))) + ;; indentation + (add-hook 'hack-local-variables-hook #'ess-set-style nil t) ;; eldoc (add-function :before-until (local 'eldoc-documentation-function) #'ess-r-eldoc-function) @@ -663,6 +712,7 @@ new position." (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) (add-hook 'xref-backend-functions #'ess-r-xref-backend nil 'local) @@ -671,8 +721,8 @@ new position." (setq imenu-generic-expression ess-imenu-S-generic-expression) (when ess-imenu-use-S (imenu-add-to-menubar "Imenu-R")) - (setq-local beginning-of-defun-function #'ess-r-beginning-of-function) - (setq-local end-of-defun-function #'ess-r-end-of-function) + (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 'ess-r-mode) @@ -724,16 +774,15 @@ Returns either Name, a string, or a (Name . Path) cons, such as (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. @@ -744,9 +793,12 @@ as `ess-r-created-runners' upon ESS initialization." (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 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)) @@ -757,7 +809,25 @@ as `ess-r-created-runners' upon ESS initialization." (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))))))) + (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") @@ -775,8 +845,8 @@ by the code on Windows for finding the newest version of R." :type 'boolean) (defun ess-rterm-prefer-higher-bit () - "Optionally remove 32bit Rterms from being candidate for `R-newest'. -Return the list of candidates for being `R-newest'. Filtering is + "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 @@ -791,40 +861,25 @@ Windows when running `ess-find-newest-R'." 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 - (message "Finding all versions of R on your system...") - (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 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 "%s" (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))) + +(defalias 'R-newest 'run-ess-r-newest) ;; (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") @@ -866,13 +921,6 @@ Examples: (ess-current-R-at-least '2.7.0) (string= "TRUE" (car (ess-get-words-from-vector (format "as.character(.ess.Rversion >= \"%s\")\n" version))))) - -(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))) - (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 @@ -892,10 +940,10 @@ If the value returned is nil, no valid newest version of R could be found." 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 @@ -920,7 +968,7 @@ use \"bin/Rterm.exe\"." (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 @@ -936,12 +984,14 @@ use \"bin/Rterm.exe\"." (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-indent-line) + (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) @@ -980,8 +1030,7 @@ Used by `ess-r-install-library'.") (defvar ess--CRAN-mirror nil "CRAN mirror name cache.") -(cl-defmethod ess-install-library--override - (update package &context ((string= ess-dialect "R") (eql t))) +(cl-defmethod ess-install-library--override (update package &context (ess-dialect "R")) "Prompt and install R PACKAGE. With argument UPDATE, update cached packages list." (inferior-ess-r-force) @@ -999,7 +1048,7 @@ With argument UPDATE, update cached packages list." (ess-completing-read "Package to install" ess--packages-cache)))) (process-send-string (get-process ess-current-process-name) (format "install.packages('%s')\n" package)) - (display-buffer (buffer-name (process-buffer (get-process ess-current-process-name)))))) + (display-buffer (buffer-name (ess-get-process-buffer))))) (defun ess-setRepositories () "Call setRepositories()." @@ -1016,7 +1065,7 @@ With argument UPDATE, update cached packages list." (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 (seq-contains M1 mirror #'string=))) + (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))))) @@ -1030,12 +1079,13 @@ With argument UPDATE, update cached packages list." (ess-eval-linewise (format "install.packages('%s')\n" pkg)) (signal 'quit nil)))) -(defun ess-r-sos (cmd) - "Interface to findFn in the library sos." - (interactive "sfindFn: ") +(define-obsolete-function-alias 'ess-r-sos #'ess-help-web-search "ESS 19.04") + +(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." @@ -1043,11 +1093,11 @@ Placed into `ess-presend-filter-functions' for R dialects." (ess--mark-search-list-as-changed)) string) -(cl-defmethod ess-installed-packages (&context ((string= ess-dialect "R") (eql t))) +(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 "print(.packages(T), max=1e6)\n")) -(cl-defmethod ess-load-library--override (pack &context ((string= ess-dialect "R") (eql t))) +(cl-defmethod ess-load-library--override (pack &context (ess-dialect "R")) "Load an R package." (ess-eval-linewise (format "library('%s')\n" pack))) @@ -1077,9 +1127,8 @@ Placed into `ess-presend-filter-functions' for R dialects." (ess-r-arg "verbose" "TRUE")))) (concat visibly output pkg verbose))) -(cl-defmethod ess-build-eval-command--override - (string &context ((string= ess-dialect "R") (eql t)) - &optional visibly output file &rest args) +(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 @@ -1089,8 +1138,8 @@ Placed into `ess-presend-filter-functions' for R dialects." (rargs (ess-r-build-args visibly output namespace))) (concat cmd "(\"" string "\"" rargs file ")\n"))) -(cl-defmethod ess-build-load-command (string &context ((string= ess-dialect "R") (eql t)) - &optional visibly output file &rest args) +(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")) (rargs (ess-r-build-args visibly output namespace))) @@ -1156,7 +1205,7 @@ attached packages." (defvar ess-r-namespaced-load-only-existing t "Whether to load only objects already existing in a namespace.") -(cl-defmethod ess-load-file--override (file &context ((string= ess-dialect "R") (eql t))) +(cl-defmethod ess-load-file--override (file &context (ess-dialect "R")) (cond ;; Namespaced evaluation ((ess-r-get-evaluation-env) @@ -1171,14 +1220,13 @@ attached packages." 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))) (cl-defmethod ess-send-region--override (process start end visibly message type - &context ((string= ess-dialect "R") (eql t))) + &context (ess-dialect "R")) (cond ;; Namespaced evaluation ((ess-r-get-evaluation-env) @@ -1187,11 +1235,11 @@ selected (see `ess-r-set-evaluation-env')." (t (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)) @@ -1207,45 +1255,32 @@ selected (see `ess-r-set-evaluation-env')." (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) +(defun ess-r-build-help-command--get-package-dir (object) ;; 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))))) + (ess-completing-read "Choose location" pkgs nil t)))) -(defun ess-r-build-help-command--unqualified (object dont-ask) +(defun ess-r-build-help-command--unqualified (object) (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)) + (let ((pkg-dir (ess-r-build-help-command--get-package-dir object)) (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) +(cl-defmethod ess-build-help-command (object &context (ess-dialect "R")) (or (ess-r-build-help-command--qualified object) - (ess-r-build-help-command--unqualified object dont-ask))) + (ess-r-build-help-command--unqualified object))) (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))) @@ -1254,12 +1289,11 @@ If it changes, we flush the cache.") (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 @@ -1269,7 +1303,7 @@ If it changes, we flush the cache.") (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]+" @@ -1287,7 +1321,7 @@ If it changes, we flush the cache.") (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))) @@ -1299,51 +1333,53 @@ If it changes, we flush the cache.") (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." + (cond + ((file-remote-p (ess-get-process-variable 'default-directory)) + (if (eq ess-r-fetch-ESSR-on-remotes t) + (ess-r--fetch-ESSR-remote) + (ess-r--load-ESSR-remote))) + ((and (bound-and-true-p ess-remote)) + (if ess-r-fetch-ESSR-on-remotes + (ess-r--fetch-ESSR-remote) + (ess-r--load-ESSR-remote t))) + (t (ess-r--load-ESSR-local)))) + +(defun ess-r--load-ESSR-local () + (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.load.ESSR('%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))))))) - -(defun inferior-ess-r-load-ESSR--remote (pkg-dir src-dir) - (let* ((loadremote (expand-file-name "LOADREMOTE" pkg-dir)) - (r-load-code (if (file-exists-p loadremote) - (with-temp-buffer - (insert-file-contents loadremote) - (buffer-string)) - (error "Cannot find ESSR source code")))) - (unless (ess-boolean-command (format r-load-code essr-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") - ;; For this case we cannot do it at R level - (ess-command (format ".ess.ESSRversion <- '%s'\n" essr-version)) - (mapc #'ess--inject-code-from-file files))))) - -(cl-defmethod ess-quit--override (arg &context ((string= ess-dialect "R") (eql t))) + (message (format "Messages while loading ESSR: %s" msg))))))) + +(defun ess-r--load-ESSR-remote (&optional chunked) + (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))))) + +(defun ess-r--fetch-ESSR-remote () + (let ((loader (ess-file-content (expand-file-name "ESSR/LOADREMOTE" ess-etc-directory)))) + (unless (ess-boolean-command (format loader essr-version) nil 0.1) + (let* ((errmsg (with-current-buffer " *ess-command-output*" (buffer-string))) + (src-dir (expand-file-name "ESSR/R" ess-etc-directory)) + (files (directory-files src-dir t "\\.R$"))) + (message (format "Couldn't load ESSR.rds. Injecting from local.\n Error: %s\n" errmsg)) + (ess-r--load-ESSR-remote))))) + +(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) - (goto-char (marker-position (process-mark sprocess))) (ess-send-string sprocess cmd t))) (defcustom inferior-ess-r-reload-hook nil @@ -1351,15 +1387,15 @@ If it changes, we flush the cache.") :type 'hook :group 'ess-R) -(cl-defmethod inferior-ess-reload--override (start-args - &context ((string= ess-dialect "R") (eql t))) +(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'." - (run-ess-r start-args) + (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)) @@ -1372,25 +1408,25 @@ Then run `inferior-ess-r-reload-hook'." (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 @@ -1441,7 +1477,7 @@ Return the amount the indentation changed by." (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." @@ -1508,7 +1544,7 @@ Returns nil if line starts inside a string, t if in a comment." (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)))) @@ -1805,7 +1841,6 @@ Returns nil if line starts inside a string, t if in a comment." (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) @@ -1873,9 +1908,7 @@ Returns nil if line starts inside a string, t if in a comment." (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 @@ -1963,7 +1996,7 @@ Returns nil if line starts inside a string, t if in a comment." ;; Jump over comments ((looking-at "#") (forward-line) - (ess-indent-line)) + (funcall indent-line-function)) (t (join-line 1)))) (goto-char (ess-code-end-position))) @@ -2034,8 +2067,6 @@ state.") (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) @@ -2118,7 +2149,7 @@ state.") (ess-goto-line (1+ cur-line)) (while (and (<= (line-number-at-pos) end-line) (/= (point) (point-max))) - (ess-indent-line) + (funcall indent-line-function) (forward-line)))))) (when (or (>= (current-column) fill-column) prefix-break @@ -2131,7 +2162,7 @@ state.") (ess-jump-char ",")) (cond ((looking-at "[ \t]*[#\n]") (forward-line) - (ess-indent-line) + (funcall indent-line-function) (setq last-newline nil)) ;; With levels 2 and 3, closing delim goes on a newline ((looking-at "[ \t]*[])]") @@ -2196,7 +2227,9 @@ state.") (defvar inferior-ess-r-mode-map (let ((map (make-sparse-keymap))) - (define-key map "\M-\r" 'ess-dirs) + (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'.") @@ -2211,8 +2244,16 @@ state.") (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 comint-process-echoes (eql ess-eval-visibly t)) + (setq-local comint-prompt-regexp inferior-S-prompt) + (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) ;; eldoc (add-function :before-until (local 'eldoc-documentation-function) #'ess-r-eldoc-function) @@ -2232,32 +2273,70 @@ state.") (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) + (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-web-search-command #'ess-r-sos - ess-build-help-command-function #'ess-r-build-help-command 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-get-help-topics-function #'ess-s-get-help-topics-function) + inferior-ess-help-command inferior-ess-r-help-command) (ess-r-help-add-links)) +(defun ess-r-help-usage-objects () + "Return a list of objects in the usage section for the current help buffer. +In other words, if in the help buffer for \"qt\", return + +'((\"dt\" \"x\" \"df\" \"ncp\" \"log\") + (\"pt\" \"q\" \"df\" \"ncp\" \"lower.tail\" \"log.p\") + (\"qt\" \"p\" \"df\" \"ncp\" \"lower.tail\" \"log.p\") + (\"rt\" \"n\" \"df\" \"ncp\")). + +If the current buffer does not have a usage section, return nil." + (unless (derived-mode-p 'ess-r-help-mode) + (error "Not an R help buffer")) + (save-excursion + (save-restriction + (let (usage-objects) + (widen) + (goto-char (point-min)) + ;; Narrow the buffer to just the "Usage" section + (when-let ((usage-beg (re-search-forward "^Usage:" nil t)) + (usage-end (re-search-forward "^[^[:space:]]" nil t))) + (forward-line -1) + (narrow-to-region usage-beg (point)) + (goto-char (point-min)) + ;; Match objects until a parens + (while (re-search-forward (rx bol (0+ whitespace) (not (syntax comment-delimiter)) + (group (1+ (not (any "("))))) + usage-end t) + (push (match-string-no-properties 1) usage-objects) + ;; Skip past function arguments + (forward-list))) + (when usage-objects + ;; Get arguments: + (setq usage-objects + (mapcar (lambda (u) (cons u (ess-get-words-from-vector (concat "names(formals(" u "))\n")))) + usage-objects))) + (nreverse usage-objects))))) + (define-button-type 'ess-r-help-link 'follow-link t 'action (lambda (_) (ess-r-help-button-action))) @@ -2270,8 +2349,9 @@ state.") (defun ess-r-help-add-links () "Add links to the help buffer." (let ((help-topics (when (ess-process-live-p) - (ess-s-get-help-topics-function ess-local-process-name))) - (inhibit-read-only t)) + (ess-help-get-topics ess-local-process-name))) + (inhibit-read-only t) + (usage-objects (ess-flatten-list (ess-r-help-usage-objects)))) (save-excursion ;; Search for fancy quotes only. If users have ;; options(useFancyQuotes) set to something other than TRUE this @@ -2283,15 +2363,374 @@ state.") (substring text nil (- (length text) 2)) text))) (when (and (member text help-topics) - (not (string= text ess-help-object))) + (not (member text usage-objects)) + (not (member text usage-objects))) (delete-region (match-beginning 0) (match-end 0)) (insert-text-button text 'ess-r-help-link-text text '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 "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-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 "o" #'ess-rdired) + (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 (concat ".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-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 as file.RData." + (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")) + (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. diff --git a/elpa/ess-20190121.1430/ess-r-package.el b/elpa/ess-20191014.1343/ess-r-package.el similarity index 85% rename from elpa/ess-20190121.1430/ess-r-package.el rename to elpa/ess-20191014.1343/ess-r-package.el index 3b5155bf..88d1b33e 100644 --- a/elpa/ess-20190121.1430/ess-r-package.el +++ b/elpa/ess-20191014.1343/ess-r-package.el @@ -26,23 +26,24 @@ ;;; Commentary: -;; see apropriate documentation section of ESS user manual +;; see appropriate documentation section of ESS user manual ;;; Code: (require 'cl-lib) -(require 'project) -(require 'ess-custom) (require 'ess-inf) -(require 'ess-utils) (eval-when-compile - (require 'subr-x)) + (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 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. @@ -102,7 +103,7 @@ and the project path as string. If DIR is provided, the package is searched from that directory instead of `default-directory'." (let ((pkg-info (ess-r-package-info dir))) (when (car pkg-info) - (cons 'ess-r-package (alist-get :root pkg-info))))) + (cons 'ess-r-package (plist-get pkg-info :root))))) (cl-defmethod project-roots ((project (head ess-r-package))) "Return the project root for ESS R packages" @@ -110,11 +111,11 @@ is searched from that directory instead of `default-directory'." (defun ess-r-package-name (&optional dir) "Return the name of the current package as a string." - (alist-get :name (ess-r-package-info dir))) + (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 alist with the keys :name and :root. When not in a +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)) @@ -123,7 +124,8 @@ efficiency reasons." (name (when path (ess-r-package--find-package-name path))) (info (if name - `((:name . ,name) (:root . ,path)) + (list :name name + :root path) '(nil)))) ;; If DIR was supplied we cannot cache in the current buffer. (if dir @@ -141,7 +143,7 @@ efficiency reasons." 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 (alist-get :root (ess-r-package-info)))) + (let ((pkg-root (plist-get (ess-r-package-info) :root))) (when pkg-root (let ((files (directory-files-and-attributes pkg-root t "^[^.]"))) (cl-loop for f in files @@ -165,32 +167,36 @@ return all physically present directories." (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 + "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'. If the path looks like a tramp file, +remove the remote information." + (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))))) + (if (file-remote-p pkg-path) + (tramp-file-name-localname (tramp-dissect-file-name pkg-path)) (directory-file-name pkg-path)))) (defun ess-r-package--find-package-name (path) @@ -198,7 +204,7 @@ Root is determined by locating `ess-r-package-root-file'." (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) (match-string 1)))))) @@ -209,7 +215,7 @@ Root is determined by locating `ess-r-package-root-file'." (defun ess-r-package-use-dir () "Set process directory to current package directory." (interactive) - (let ((pkg-root (alist-get :root (ess-r-package-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")))) @@ -222,7 +228,7 @@ Root is determined by locating `ess-r-package-root-file'." Namespaced evaluation is enabled if `ess-r-package-auto-enable-namespaced-evaluation' is non-nil." (when ess-r-package-auto-enable-namespaced-evaluation - (let ((root (alist-get :root (ess-r-package-info)))) + (let ((root (plist-get (ess-r-package-info) :root))) ;; Check that we are in a file within R/ (when (and root default-directory @@ -250,9 +256,10 @@ arguments, or expressions which return R arguments." (args (ess-r-command--build-args p actions))) (unless (car pkg-info) (user-error "Not in a package")) - (message msg (alist-get :name pkg-info)) + (ess-project-save-buffers) + (message msg (plist-get pkg-info :name)) (display-buffer (ess-get-process-buffer)) - (let ((pkg-path (concat "'" (abbreviate-file-name (alist-get :root pkg-info)) "'"))) + (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) @@ -339,7 +346,7 @@ With prefix argument ARG, run tests on current file only." (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))))) @@ -363,6 +370,16 @@ With prefix argument ARG, run tests on current file only." }) ") +(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." @@ -373,7 +390,7 @@ With prefix ARG ask for extra arguments." (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." @@ -386,7 +403,7 @@ TRUE, upgrade = FALSE, build = FALSE. On prefix ARG (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)") @@ -398,7 +415,9 @@ re-installation when called with a prefix ARG." (ess-r-command--build-args 0 '((read-string "Arguments: " "force = TRUE"))) ""))) (inferior-ess-r-force) - (display-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)))) diff --git a/elpa/ess-20190121.1430/ess-r-syntax.el b/elpa/ess-20191014.1343/ess-r-syntax.el similarity index 99% rename from elpa/ess-20190121.1430/ess-r-syntax.el rename to elpa/ess-20191014.1343/ess-r-syntax.el index be660afe..58169aaf 100644 --- a/elpa/ess-20190121.1430/ess-r-syntax.el +++ b/elpa/ess-20191014.1343/ess-r-syntax.el @@ -63,7 +63,7 @@ t)) (defun ess-backward-char (&optional N) - (unless (= (point) (point-min)) + (unless (bobp) (forward-char (- (or N 1))) t)) @@ -172,7 +172,7 @@ Cons cell containing the token type and string representation." (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))) @@ -792,14 +792,14 @@ nil, return the prefix." "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) @@ -1350,8 +1350,7 @@ expression." (defun ess-continuations-bounds (&optional marker) (save-excursion - (let ((orig-point (point)) - (beg (progn + (let ((beg (progn (ess-escape-continuations) (point)))) (when beg @@ -1500,9 +1499,10 @@ without curly braces." ,(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 @@ -1523,7 +1523,7 @@ without curly braces." (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 --git a/elpa/ess-20190121.1430/ess-r-xref.el b/elpa/ess-20191014.1343/ess-r-xref.el similarity index 99% rename from elpa/ess-20190121.1430/ess-r-xref.el rename to elpa/ess-20191014.1343/ess-r-xref.el index 456df45f..c0e40e7d 100644 --- a/elpa/ess-20190121.1430/ess-r-xref.el +++ b/elpa/ess-20191014.1343/ess-r-xref.el @@ -29,7 +29,6 @@ (require 'xref) (require 'ess-inf) -(require 'ess-utils) (require 'ess-r-package) (require 'ess-tracebug) diff --git a/elpa/ess-20190121.1430/ess-rd.el b/elpa/ess-20191014.1343/ess-rd.el similarity index 75% rename from elpa/ess-20190121.1430/ess-rd.el rename to elpa/ess-20191014.1343/ess-rd.el index 24a92d53..e8f03b8a 100644 --- a/elpa/ess-20190121.1430/ess-rd.el +++ b/elpa/ess-20191014.1343/ess-rd.el @@ -29,8 +29,9 @@ ;; ;;; 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? @@ -38,42 +39,50 @@ (defvar ess-help-r-sec-keys-alist) (defvar ess-r-customize-alist) -(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")) +All Rd mode abbrevs start with a grave accent (`)." + :case-fixed t) + +(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))) @@ -159,26 +168,22 @@ All Rd mode abbrevs start with a grave accent (`).") (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-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.") @@ -200,18 +205,14 @@ All Rd mode abbrevs start with a grave accent (`).") ["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{" "}") @@ -239,6 +240,7 @@ 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) @@ -255,7 +257,6 @@ the following to your Emacs configuration file: ;; https://debbugs.gnu.org/cgi/bugreport.cgi?bug=14328 (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) @@ -264,25 +265,13 @@ the following to your Emacs configuration file: ;;;###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 @@ -296,13 +285,13 @@ the following to your Emacs configuration file: 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 @@ -314,7 +303,7 @@ the following to your Emacs configuration file: 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)) @@ -324,7 +313,7 @@ the following to your Emacs configuration file: (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)) @@ -333,23 +322,23 @@ the following to your Emacs configuration file: (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: " @@ -360,6 +349,7 @@ the following to your Emacs configuration file: (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?! @@ -423,11 +413,10 @@ WHAT determines the font to use, as specified by `Rd-font-list'." (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) diff --git a/elpa/ess-20190121.1430/ess-rdired.el b/elpa/ess-20191014.1343/ess-rdired.el similarity index 77% rename from elpa/ess-20190121.1430/ess-rdired.el rename to elpa/ess-20191014.1343/ess-rdired.el index e226d9ca..312a0f9a 100644 --- a/elpa/ess-20190121.1430/ess-rdired.el +++ b/elpa/ess-20191014.1343/ess-rdired.el @@ -52,7 +52,7 @@ ;; 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'. @@ -73,9 +73,11 @@ ;;; Code: -(require 'ess-custom) (require 'ess-inf) +(eval-when-compile + (require 'subr-x)) + (defvar ess-rdired-objects "local({.rdired.objects <- function(objs) { if (length(objs)==0) { \"No objects to view!\" @@ -107,17 +109,26 @@ the function which prints the output for rdired.") (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 ((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) + (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)) (define-derived-mode ess-rdired-mode tabulated-list-mode "Rdired" @@ -125,15 +136,20 @@ the function which prints the output for 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." + :group 'ess-R (setq mode-name (concat "RDired " ess-local-process-name)) (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 nil t) - (tabulated-list-init-header) - (tabulated-list-print)) + (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 () @@ -141,23 +157,46 @@ can then examine these objects, plot them, and so on." You may interact with these objects, see `ess-rdired-mode' for details." (interactive) - (let ((proc ess-local-process-name) - (buff (get-buffer-create ess-rdired-buffer))) - (ess-command ess-rdired-objects buff nil nil nil (get-buffer-process proc)) - (with-current-buffer buff - (setq ess-local-process-name proc) - (goto-char (point-min)) - (let ((buffer-read-only nil) - text) + (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-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")) - (delete-region (point-min) (point-max)) + (erase-buffer)) + (with-current-buffer buff (setq tabulated-list-entries (mapcar #'ess-rdired--tabulated-list-entries text)) - (ess-rdired-mode))) - (pop-to-buffer buff))) + (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." @@ -231,9 +270,9 @@ Like `ess-rdired-view', but the object gets its own buffer name." (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))))) (defalias 'ess-rdired-expunge #'ess-rdired-delete) diff --git a/elpa/ess-20190121.1430/ess-roxy.el b/elpa/ess-20191014.1343/ess-roxy.el similarity index 92% rename from elpa/ess-20190121.1430/ess-roxy.el rename to elpa/ess-20191014.1343/ess-roxy.el index 007395b3..290deefa 100644 --- a/elpa/ess-20190121.1430/ess-roxy.el +++ b/elpa/ess-20191014.1343/ess-roxy.el @@ -40,7 +40,7 @@ ;; - 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 @@ -59,8 +59,6 @@ ;;; Code: -(require 'ess-utils) -(require 'ess-custom) (require 'ess-utils) (require 'hideshow) (require 'outline) @@ -74,6 +72,7 @@ (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.") @@ -83,20 +82,20 @@ (defvar ess-roxy-mode-map (let ((map (make-sparse-keymap))) - (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-and-indent) - (define-key map [remap newline-and-indent] 'ess-roxy-newline-and-indent) - (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) + (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-and-indent) + (define-key map [remap newline-and-indent] #'ess-roxy-newline-and-indent) + (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 nil @@ -112,7 +111,7 @@ Used to remove keywords added by function `ess-roxy-mode'.") (1 'font-lock-keyword-face prepend)) (,(concat ess-roxy-re " *\\(@" (regexp-opt '("param" "importFrom" "importClassesFrom" - "importMethodsFrom") + "importMethodsFrom" "describeIn") 'words) "\\)\\(?:[ \t]+\\(\\(?:\\sw+,?\\)+\\)\\)") (1 'font-lock-keyword-face prepend) @@ -135,7 +134,7 @@ Use you regular key for `outline-show-entry' to reveal it.") (progn (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 'local) ;; should be first + (add-hook 'completion-at-point-functions #'ess-roxy-complete-tag nil t) ;; Hideshow Integration (when ess-roxy-hide-show-p (hs-minor-mode 1) @@ -313,7 +312,7 @@ Use you regular key for `outline-show-entry' to reveal it.") (defun ess-roxy-entry-p (&optional field) "Non-nil if point is in a roxy entry. -FIELD allows checkinf for a specific field with +FIELD allows checking for a specific field with `ess-roxy-current-field'." (and ess-roxy-mode (save-excursion @@ -385,7 +384,8 @@ roxygen entry, error otherwise" (ess-roxy-goto-end-of-entry) (forward-line 1) (beginning-of-line)) - (beginning-of-defun))) + (unless (looking-at-p ess-function-pattern) + (beginning-of-defun)))) (defun ess-roxy-get-args-list-from-def () "Get args list for current function." @@ -398,27 +398,23 @@ roxygen entry, error otherwise" "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. @@ -428,13 +424,13 @@ drop entries from ent that are not in fun and are associated with 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)))) @@ -455,22 +451,18 @@ filled if `ess-roxy-fill-param-p' is non-nil." (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)) @@ -480,8 +472,7 @@ filled if `ess-roxy-fill-param-p' is non-nil." (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 () @@ -518,8 +509,7 @@ roxygen entry." 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) @@ -639,6 +629,7 @@ point. Place it in a buffer and return that buffer." (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")) @@ -783,18 +774,17 @@ See `hs-show-block' and `ess-roxy-hide-block'." (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 - (beginning-of-defun) - (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)) @@ -819,8 +809,7 @@ See `hs-show-block' and `ess-roxy-hide-block'." (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))))) @@ -831,7 +820,7 @@ 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. + ;; behavior for evaluation of regions. (let ((roxy-re ess-roxy-re)) (if (and (ess-roxy-entry-p "examples") ;; don't send just @examples if we're looking at a line @@ -878,7 +867,7 @@ EXAMPLES should be non-nil if filling an example block." ;; 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)) @@ -897,9 +886,6 @@ Else call `ess-indent-command'." "Fill a roxygen block. FUN should be a filling function and ARGS gets passed to it." (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) diff --git a/elpa/ess-20190121.1430/ess-s-lang.el b/elpa/ess-20191014.1343/ess-s-lang.el similarity index 59% rename from elpa/ess-20190121.1430/ess-s-lang.el rename to elpa/ess-20191014.1343/ess-s-lang.el index f7c697f8..738ef5b4 100644 --- a/elpa/ess-20190121.1430/ess-s-lang.el +++ b/elpa/ess-20191014.1343/ess-s-lang.el @@ -1,4 +1,4 @@ -;;; ess-s-lang.el --- Support for editing S source code +;;; ess-s-lang.el --- Support for editing S source code -*- lexical-binding: t; -*- ;; Copyright (C) 1989-1997 D. Bates, Kademan, Ritter, D.M. Smith, K. Hornik, ;; R.M. Heiberger, M. Maechler, and A.J. Rossini. @@ -34,10 +34,9 @@ (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 @@ -77,9 +76,7 @@ (paragraph-ignore-fill-prefix . t) ;;(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) ;;(ess-keep-dump-files . 'ask) ;; For Changelog add, require ' ' before <- : "attr<-" is a function name : (add-log-current-defun-header-regexp . "^\\(.+\\)\\s-+<-[ \t\n]*function")) @@ -115,7 +112,6 @@ ;; 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") @@ -123,7 +119,7 @@ (ess-execute-screen-options-command . "options(width=%d, length=99999)\n") (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 @@ -148,7 +144,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!). @@ -206,7 +202,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 @@ -225,185 +221,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) @@ -411,15 +232,18 @@ and ensure space before subsequent text." "\\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-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)) @@ -440,7 +264,8 @@ and ensure space before subsequent text." (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 "]\\)") @@ -455,7 +280,7 @@ in cases where it's ugly and nonsense. DO-QUERY(prefix) asks before replacing." (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)) @@ -485,7 +310,7 @@ nil (as by default) !" (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) @@ -496,7 +321,7 @@ and one that is well formatted in emacs ess-mode." (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 @@ -610,58 +435,47 @@ If `ess-language' is not \"S\", call `self-insert-command' with ARG." (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." (interactive "sFunction ? ") - (let* ((buffname "ess-complete.R") - (buf (ess-execute (format "args(%s)" Sfunc) t buffname))) - (pop-to-buffer buf) + (declare (obsolete 'ess-execute "ESS 19.04")) + (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)) (when (fboundp 'ess-r-mode) (ess-r-mode)))) -(defun ess-chm-display-help-on-object (object &rest args) - (ess-eval-linewise (concat "help(" object ")"))) - - ;;; S imenu support ;; don't use syntax classes, bad for etags (defvar ess-imenu-S-generic-expression - '(("Functions" "^\\([^ \t\n]+\\)[ \t\n]*<-[ \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))) + ("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." +(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")) @@ -669,48 +483,20 @@ and I need to relearn emacs lisp (but I had to, anyway." ;;; 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. + +(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 - (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) @@ -718,51 +504,17 @@ return it. Otherwise, return `ess-help-topics-list'." (ess-process-put 'sp-for-help-changed? nil) (setq ess-help-topics-list (delete-dups - (append (ess-get-object-list name 'exclude-1st) + (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) +(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") diff --git a/elpa/ess-20190121.1430/ess-sas-a.el b/elpa/ess-20191014.1343/ess-sas-a.el similarity index 98% rename from elpa/ess-20190121.1430/ess-sas-a.el rename to elpa/ess-20191014.1343/ess-sas-a.el index c961b32c..7cb6f6cb 100644 --- a/elpa/ess-20190121.1430/ess-sas-a.el +++ b/elpa/ess-20191014.1343/ess-sas-a.el @@ -329,8 +329,7 @@ in SAS-mode and related modes.") (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 "%s" (substring string beg (match-end 0)))))) @@ -461,9 +460,12 @@ return new alist whose car is the new pair and cdr is ALIST. (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 @@ -558,7 +560,7 @@ current buffer if nil." (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) @@ -573,7 +575,7 @@ current buffer if nil." (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? @@ -809,14 +811,14 @@ optional argument is non-nil, then set-buffer rather than switch." "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 " diff --git a/elpa/ess-20190121.1430/ess-sas-d.el b/elpa/ess-20191014.1343/ess-sas-d.el similarity index 96% rename from elpa/ess-20190121.1430/ess-sas-d.el rename to elpa/ess-20191014.1343/ess-sas-d.el index 7929e070..af3ec492 100644 --- a/elpa/ess-20190121.1430/ess-sas-d.el +++ b/elpa/ess-20191014.1343/ess-sas-d.el @@ -34,11 +34,14 @@ ;;; 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.") @@ -201,8 +204,8 @@ Better logic needed! (see 2 uses, in this file).") ;;;###autoload (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-customize-alist SAS-customize-alist) (setq ess-local-customize-alist SAS-customize-alist) (setq-local sentence-end ";[\t\n */]*") (setq-local paragraph-start "^[ \t]*$") @@ -271,7 +274,7 @@ Better logic needed! (see 2 uses, in this file).") (bolp))))) (progn (insert last-command-event) - (ess-indent-line) + (funcall indent-line-function) (save-excursion (if insertpos (goto-char (1+ insertpos))) (delete-char -1)))) @@ -281,7 +284,6 @@ Better logic needed! (see 2 uses, in this file).") (self-insert-command (prefix-numeric-value arg))) (self-insert-command (prefix-numeric-value arg)))))) -;;;###autoload (defun SAS-menu () "Start SAS from the menu." (interactive) @@ -293,7 +295,6 @@ Better logic needed! (see 2 uses, in this file).") (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" @@ -301,10 +302,12 @@ Better logic needed! (see 2 uses, in this file).") 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. diff --git a/elpa/ess-20190121.1430/ess-sas-l.el b/elpa/ess-20191014.1343/ess-sas-l.el similarity index 99% rename from elpa/ess-20190121.1430/ess-sas-l.el rename to elpa/ess-20191014.1343/ess-sas-l.el index dcec9252..726842b9 100644 --- a/elpa/ess-20190121.1430/ess-sas-l.el +++ b/elpa/ess-20191014.1343/ess-sas-l.el @@ -50,7 +50,6 @@ ;;; Code: (require 'ess-mode) -(require 'ess-custom) (require 'ess-sas-a) (declare-function SAS-mode "ess-sas-d") @@ -139,6 +138,7 @@ A .lst file is a SAS listing file when: (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)) @@ -147,6 +147,7 @@ A .lst file is a SAS listing file when: (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)) @@ -161,8 +162,8 @@ A .lst file is a SAS listing file when: :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) @@ -826,7 +827,7 @@ number." ;; 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... @@ -859,7 +860,7 @@ number." ((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 @@ -932,7 +933,7 @@ This will (hopefully) be fixed in later versions." (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 @@ -1469,7 +1470,7 @@ be submitted instead. `sas-submitable' is automatically sets to t." "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 " @@ -1551,6 +1552,7 @@ page ; (define-derived-mode sas-dir-mode special-mode "SAS" "Major mode for managing sas files." + :group 'ess-sas (setq sas-directory-name (expand-file-name default-directory))) diff --git a/elpa/ess-20191014.1343/ess-site.el b/elpa/ess-20191014.1343/ess-site.el new file mode 100644 index 00000000..917bc906 --- /dev/null +++ b/elpa/ess-20191014.1343/ess-site.el @@ -0,0 +1,71 @@ +;;; ess-site.el --- user customization of ESS -*- lexical-binding: t; -*- + +;; Copyright (C) 1993 David M. Smith +;; Copyright (C) 1997--2010 A.J. Rossini, Richard M. Heiberger, Martin +;; Maechler, Kurt Hornik, Rodney Sparapani, and Stephen Eglen. +;; Copyright (C) 2011--2018 A.J. Rossini, Richard M. Heiberger, Martin +;; Maechler, Kurt Hornik, Rodney Sparapani, Stephen Eglen, +;; Vitalie Spinu, and Lionel Henry. + +;; Author: David Smith +;; Created: 12 Nov 1993 +;; Maintainer: ESS-core +;; Keywords: local + +;; This file is part of ESS + +;; This file is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation; either version 2, or (at your option) +;; any later version. + +;; This file is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; A copy of the GNU General Public License is available at +;; https://www.r-project.org/Licenses/ + +;;; Commentary: + +;; 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: + +(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 ess-lisp-directory)) + +;;; Loading popular dialects (they should become optional in the future) + +(require 'ess-r-mode) +(require 'ess-julia) +(require 'essd-els) ;; ess-remote +(require 'ess-stata-mode) +(require 'ess-sas-d) +(require 'ess-bugs-d) +(require 'ess-jags-d) +(require 'ess-toolbar) + +(provide 'ess-site) + +;;; ess-site.el ends here diff --git a/elpa/ess-20190121.1430/ess-sp6-d.el b/elpa/ess-20191014.1343/ess-sp6-d.el similarity index 94% rename from elpa/ess-20190121.1430/ess-sp6-d.el rename to elpa/ess-20191014.1343/ess-sp6-d.el index 6fe58c6a..a90ecd0c 100644 --- a/elpa/ess-20190121.1430/ess-sp6-d.el +++ b/elpa/ess-20191014.1343/ess-sp6-d.el @@ -79,9 +79,7 @@ (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-STERM . "iESS")) S+common-cust-alist) "Variables to customize for S+.") @@ -113,15 +111,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) @@ -129,7 +127,6 @@ New way to do it." (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) (setq-local ess-local-customize-alist S+-customize-alist) (ess-mode) (if (fboundp 'ess-add-toolbar) (ess-add-toolbar)) @@ -139,7 +136,8 @@ New way to do it." (defalias 'S+6-transcript-mode 'S+-transcript-mode) (define-derived-mode S+-transcript-mode ess-transcript-mode "ESS S Transcript" "S-PLUS 6 transcript mode." - :syntax-table S-syntax-table) + :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. diff --git a/elpa/ess-20190121.1430/ess-stata-lang.el b/elpa/ess-20191014.1343/ess-stata-lang.el similarity index 97% rename from elpa/ess-20190121.1430/ess-stata-lang.el rename to elpa/ess-20191014.1343/ess-stata-lang.el index 806cf1b9..a3360b53 100644 --- a/elpa/ess-20190121.1430/ess-stata-lang.el +++ b/elpa/ess-20191014.1343/ess-stata-lang.el @@ -1,4 +1,4 @@ -;;; ess-stata-lang.el --- Stata customization +;;; ess-stata-lang.el --- Stata customization -*- lexical-binding: t; -*- ;; Copyright (C) 1999--2000, Thomas Lumley, A. J. Rossini, Brendan Halpin. ;; Copyright (C) 1997--2004 A.J. Rossini, Richard M. Heiberger, Martin @@ -33,7 +33,7 @@ ;; Stata modes. Emacs modes for using the Stata statistical package ;; Modified from S-mode, comint-mode ;; -;; (c) thomas lumley 1997 +;; (c) Thomas Lumley 1997 ;; ;; version 0.4 20/7/97 ;; @@ -1095,9 +1095,7 @@ ado-mode of Bill Rising , and uses make-regexp." (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) (ess-local-process-name . nil) ;;(ess-keep-dump-files . 'ask) (font-lock-defaults . '(ess-STA-mode-font-lock-defaults @@ -1176,32 +1174,6 @@ ado-mode of Bill Rising , and uses make-regexp." (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." @@ -1215,10 +1187,14 @@ PROC is the stata process. Does not change point." (if (< (point) start-of-output) (goto-char start-of-output)) (not (looking-at "^. ")))))) +(cl-defmethod ess--help-major-mode (&context (ess-dialect "stata")) + (ess-stata-help-mode)) + (define-derived-mode ess-stata-help-mode ess-help-mode "Stata help" "Major mode for displaying Stata help in a read-only buffer. Active commands are Help (\\[stata-help]) and hyperlink -(\\[stata-rehelp] or mouse-2).") +(\\[stata-rehelp] or mouse-2)." + :group 'ess-Stata) ;;; Suggested function from Brendan Halpin: (defvar ess-STA-delimit-do-file "delimit-do.do") diff --git a/elpa/ess-20190121.1430/ess-stata-mode.el b/elpa/ess-20191014.1343/ess-stata-mode.el similarity index 70% rename from elpa/ess-20190121.1430/ess-stata-mode.el rename to elpa/ess-20191014.1343/ess-stata-mode.el index c99a00a5..b56299a2 100644 --- a/elpa/ess-20190121.1430/ess-stata-mode.el +++ b/elpa/ess-20191014.1343/ess-stata-mode.el @@ -1,4 +1,4 @@ -;;; ess-stata-mode.el --- Stata customization +;;; ess-stata-mode.el --- Stata customization -*- lexical-binding: t; -*- ;; Copyright (C) 1997--1999 A. J. Rossini, Thomas Lumley ;; Copyright (C) 1997--2004 A.J. Rossini, Richard M. Heiberger, Martin @@ -44,13 +44,11 @@ (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 ------------------ + ;; asterisk at bol comments taken care of by + ;; `syntax-propertize-function'. + (modify-syntax-entry ?* ". 23b" tbl) + (modify-syntax-entry ?\n ">" tbl) (modify-syntax-entry ?+ "." tbl) (modify-syntax-entry ?- "." tbl) (modify-syntax-entry ?= "." tbl) @@ -73,41 +71,42 @@ (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-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--") + (inferior-ess-primary-prompt . "[.:] \\|--more--") + (inferior-ess-secondary-prompt . ">\\|--more--") + (inferior-ess-prompt . "\\([.:>] \\|--more--\\)") (comint-use-prompt-regexp . t) - (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.") +(cl-defmethod ess--help-web-search-override (cmd &context (ess-dialect "stata")) + "Browse the web for documentation about CMD in Stata." + (browse-url + (format + "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" + cmd))) ;;;###autoload (define-derived-mode ess-stata-mode ess-mode "ESS[STA]" "Major mode for editing Stata source." + :group 'ess-Stata (ess-setq-vars-local STA-customize-alist) (setq-local comint-use-prompt-regexp t) (setq-local comment-column 40) - (setq-local comment-end " \*/") - (setq-local comment-start "/\* ") + (setq-local comment-end " */") + (setq-local comment-start "/* ") (setq-local comment-start-skip "/\\*+ *") (setq-local comment-use-syntax t) - (setq-local indent-line-function 'ess-indent-line) + (setq-local syntax-propertize-function + (syntax-propertize-rules ("^\\*" (0 "<")))) (setq-local paragraph-ignore-fill-prefix t) (setq-local paragraph-separate (concat "[ \t\f]*$\\|" page-delimiter)) (setq-local paragraph-start (concat "[ \t\f]*$\\|" page-delimiter)) @@ -126,8 +125,7 @@ (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'. -" +This function is placed in `ess-presend-filter-functions'." (replace-regexp-in-string "/\\*.*\\*/\\|^//.*$" "" string)) ;; (ess-sta-remove-comments "aaa /* sdfdsf */ bbb @@ -140,31 +138,30 @@ This function is placed in `ess-presend-filter-functions'. (defvar ess-stata-post-run-hook nil - "Functions run in process buffer after the initialization of - stata process.") + "Functions run in process buffer after the initialization of stata process.") (defun stata (&optional start-args) - "Call Stata." + "Call Stata with START-ARGS." (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))))) + (let* ((sta-start-args + (concat inferior-STA-start-args + (when start-args (read-string "Starting Args [possibly -k####] ? ")))) + (inf-buf (inferior-ess sta-start-args STA-customize-alist)) + (inf-proc (get-buffer-process inf-buf))) + (while (process-get inf-proc 'sec-prompt) + ;; get read of all --more-- if stata.msg is too long. + (ess-send-string inf-proc "q") + (ess-wait-for-process inf-proc t)) + (ess-send-string inf-proc "set more off") + (goto-char (point-max)) + (with-current-buffer inf-buf + (add-hook 'ess-presend-filter-functions 'ess-sta-remove-comments nil 'local) + (run-mode-hooks 'ess-stata-post-run-hook)) + inf-buf)) (defvar inferior-ess-stata-mode-syntax-table (let ((tab (copy-syntax-table ess-stata-mode-syntax-table))) @@ -173,22 +170,25 @@ This function is placed in `ess-presend-filter-functions'. (define-derived-mode inferior-ess-stata-mode inferior-ess-mode "iESS" "Inferior `stata' mode." + :group 'ess-proc (ess-setq-vars-local STA-customize-alist) + (setq comint-prompt-regexp (concat "^" inferior-ess-prompt)) (setq-local comint-use-prompt-regexp t) (setq font-lock-defaults '(ess-STA-mode-font-lock-defaults nil nil ((?\. . "w"))))) (define-derived-mode ess-stata-transcript-mode ess-transcript-mode "ESS Transcript" - :syntax-table ess-stata-mode-syntax-table "Stata transcript mode." + :group 'ess-Stata + :syntax-table ess-stata-mode-syntax-table (ess-setq-vars-local STA-customize-alist) + (setq comint-prompt-regexp (concat "^" inferior-ess-prompt)) (setq-local comint-use-prompt-regexp t) (setq-local comment-column 40) - (setq-local comment-end " \*/") - (setq-local comment-start "/\* ") + (setq-local comment-end " */") + (setq-local comment-start "/* ") (setq-local comment-start-skip "/\\*+ *") (setq-local comment-use-syntax t) - (setq-local indent-line-function 'ess-indent-line) (setq-local paragraph-ignore-fill-prefix t) (setq-local paragraph-separate (concat "[ \t\f]*$\\|" page-delimiter)) (setq-local paragraph-start (concat "[ \t\f]*$\\|" page-delimiter)) @@ -207,22 +207,13 @@ This function is placed in `ess-presend-filter-functions'. (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) +(cl-defmethod ess-help-get-topics (proc &context (ess-dialect "stata")) + "Return a list of current STA help topics associated with process PROC." + (or (ess-process-get 'help-topics proc) (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 'ess-stata-mode) ;;; ess-stata-mode.el ends here diff --git a/elpa/ess-20190121.1430/ess-toolbar.el b/elpa/ess-20191014.1343/ess-toolbar.el similarity index 93% rename from elpa/ess-20190121.1430/ess-toolbar.el rename to elpa/ess-20191014.1343/ess-toolbar.el index face0b8f..0ba4a832 100644 --- a/elpa/ess-20190121.1430/ess-toolbar.el +++ b/elpa/ess-20191014.1343/ess-toolbar.el @@ -1,4 +1,4 @@ -;;; ess-toolbar.el --- Support for a toolbar in ESS. +;;; ess-toolbar.el --- Support for a toolbar in ESS. -*- lexical-binding: t; -*- ;; Copyright (C) 1997--2009 A.J. Rossini, Richard M. Heiberger, Martin ;; Maechler, Kurt Hornik, Rodney Sparapani, and Stephen Eglen. @@ -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 @@ The standard toolbar items are copied from the default toolbar." :type 'boolean) (defcustom ess-toolbar-global nil - "*Non-nil means that the ESS toolbar is available in all emacs buffers. + "*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 @@ If `ess-icon-directory' is invalid, please report a bug.") (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 @@ If `ess-icon-directory' is invalid, please report a bug.") "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 @@ is added globally when ess-toolbar.el is loaded." (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 --git a/elpa/ess-20190121.1430/ess-tracebug.el b/elpa/ess-20191014.1343/ess-tracebug.el similarity index 88% rename from elpa/ess-20190121.1430/ess-tracebug.el rename to elpa/ess-20191014.1343/ess-tracebug.el index a0380b63..1e4518eb 100644 --- a/elpa/ess-20190121.1430/ess-tracebug.el +++ b/elpa/ess-20191014.1343/ess-tracebug.el @@ -43,15 +43,14 @@ ;;; Code: (eval-when-compile - (require 'cl) + (when (< emacs-major-version 26) + (require 'cl)) (require 'cl-lib) (require 'tramp) (require 'subr-x)) (require 'comint) (require 'compile) -(require 'overlay) (require 'ring) -(require 'ess-custom) (require 'ess-utils) (defvar text-scale-mode-amount) @@ -80,8 +79,10 @@ (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-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") @@ -116,30 +117,30 @@ Indicates that ess-tracebug-mode is turned on.") (defvar ess-watch-mode-map (let ((map (make-sparse-keymap))) - (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 `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: +Set this to a key combination you don't use often, like: (setq ess-tracebug-prefix \"\\M-t\") @@ -221,7 +222,7 @@ Use `add-hook' to insert append your functions to this list." (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.") @@ -234,7 +235,7 @@ multiple blocks are being executed (e.g., in chained execution 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 @@ -361,7 +362,7 @@ by `ess-inject-source' variable." 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 BP . `ess-bp-kill' K . Kill all BPs . `ess-bp-kill-all' o . Toggle BP state . `ess-bp-toggle-state' l . Set logger BP . `ess-bp-set-logger' @@ -389,7 +390,7 @@ by `ess-inject-source' variable." M-U . Up frame . `ess-debug-command-up' M-Q . Quit debugging . `ess-debug-command-quit' -* Navigation to errors (general emacs functionality): +* Navigation to errors (general Emacs functionality): C-x `, M-g n . `next-error' M-g p . `previous-error'") @@ -602,8 +603,7 @@ ESS internal code assumes default R prompts.") (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) @@ -611,7 +611,7 @@ ESS internal code assumes default R prompts.") (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) @@ -630,7 +630,7 @@ ESS internal code assumes default R prompts.") (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))))) @@ -670,48 +670,40 @@ See the also `ess--dbg-goto-debug-point'") (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\)" +\(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) - (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)))))) + (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 () @@ -912,28 +904,26 @@ by default." (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. @@ -992,7 +982,7 @@ The action list is in `ess-debug-error-action-alist'." "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 @@ -1010,9 +1000,9 @@ See the more info at https://code.google.com/p/ess-tracebug/#Work-Flow" 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 + (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)))) @@ -1094,7 +1084,6 @@ highlighted.") (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)) @@ -1107,7 +1096,7 @@ watch and loggers. Integrates into ESS and iESS modes by binding `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 @@ -1138,7 +1127,7 @@ watch and loggers. Integrates into ESS and iESS modes by binding (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) @@ -1161,7 +1150,7 @@ Kill the *ess.dbg.[R_name]* buffer." (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 @@ -1214,22 +1203,31 @@ Kill the *ess.dbg.[R_name]* buffer." ;;; 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 "\\") -(defvar ess-mpi-alist +(define-obsolete-variable-alias 'ess-mpi-alist 'ess-mpi-handlers "ESS 19.04") +(defvar ess-mpi-handlers '(("message" . message) - ("error" . ess-mpi:error) - ("eval" . ess-mpi:eval) - ("y-or-n" . ess-mpi:y-or-n))) + ("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.") (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))))) @@ -1239,32 +1237,48 @@ The CALLBACK string is passed through `format' with returned 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) "Replace long + + + in PROMPT based on `inferior-ess-replace-long+' value. @@ -1322,69 +1336,73 @@ prompts." ;; 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) - (display-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))) - (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 + (goto-char (point-min)) + (let ((case-fold-search nil)) + (when (re-search-forward "Error\\(:\\| +in\\)" nil t) + (unless (get-buffer-window pbuf 'visible) + (display-buffer (process-buffer proc) 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))) + ;; 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)))))))) (defun inferior-ess-tracebug-output-filter (proc string) "Standard output filter for the inferior ESS process. @@ -1423,7 +1441,7 @@ the output into *ess.dbg* buffer." (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 @@ -1446,18 +1464,17 @@ the output into *ess.dbg* buffer." (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)))))) @@ -1503,7 +1520,7 @@ the output into *ess.dbg* buffer." (message (ess--debug-keys-message-string)) (unless match-jump - ;; no source reference, simply show the inferiro + ;; no source reference, simply show the inferior (display-buffer pbuf))) (when match-selection ;(and (not was-in-recover) match-selection) @@ -1512,12 +1529,12 @@ the output into *ess.dbg* buffer." (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}") @@ -1534,7 +1551,6 @@ 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 @@ -1625,8 +1641,7 @@ nil, or TB-INDEX is not found return nil." (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)))))))))) @@ -1642,7 +1657,7 @@ If FILENAME is not found at all, ask the user where to find it if buffer name) (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)) + (cl-dolist (bf (buffer-list)) (with-current-buffer bf (when (and buffer-file-name (or (and (file-name-absolute-p filename) @@ -1699,7 +1714,6 @@ 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") (unless ess--dbg-buf-p (error "Not in *ess.dbg* buffer")) (setq nF (or nF 1) @@ -1712,31 +1726,6 @@ giving the 'line'; defaults to 2. nC - sub-expr giving the (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))) - (pop-to-buffer-same-window 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"))))) - (defun ess--debug-keys-message-string (&optional map) (let ((overriding-local-map (or map ess-debug-minor-mode-map))) (substitute-command-keys @@ -1752,7 +1741,7 @@ This is the value of `next-error-function' in *ess.dbg* buffers." (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. +require the prefix command for subsequent invocation. If WAIT is t, wait for next input and ignore the keystroke which triggered the command." @@ -1854,7 +1843,7 @@ Equivalent of `Q' at the R prompt." (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)) @@ -1925,7 +1914,7 @@ ARGS are ignored to allow using this function in process hooks." (inhibit-field-text-motion t)) (forward-line -1) (end-of-line) - (looking-back "\\%>\\%[ \t]*" (point-at-bol))))) + (looking-back "%>%[ \t]*" (point-at-bol))))) (defvar ess--bp-identifier 1) (defcustom ess-bp-type-spec-alist @@ -2017,15 +2006,15 @@ Returns the beginning position of the hidden text." '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) @@ -2041,6 +2030,7 @@ Returns the beginning position of the hidden text." (save-excursion (save-restriction (with-silent-modifications + (cursor-intangible-mode) (widen) (goto-char (point-min)) (while (re-search-forward @@ -2071,8 +2061,8 @@ Returns the beginning position of the hidden text." (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)) @@ -2086,14 +2076,14 @@ Returns the beginning position of the hidden text." (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))) @@ -2200,7 +2190,7 @@ to the current position, nil if not found." (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)) @@ -2246,7 +2236,7 @@ If there is no active R session, this command triggers an error." (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 + (cursor-sensor-inhibit 'ess-bp-toggle-state) bp-id bp-specs beg-pos-command) (if (null pos) (message "No breakpoints in the visible region") @@ -2270,7 +2260,7 @@ If there is no active R session, this command triggers an error." (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)) @@ -2312,7 +2302,7 @@ If there is no active R session, this command triggers an error." ;; 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))) @@ -2325,6 +2315,7 @@ If there is no active R session, this command triggers an error." (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))) @@ -2348,33 +2339,30 @@ This is the trigger function. See documentation of (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) @@ -2382,11 +2370,10 @@ the debugging." (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 @@ -2513,7 +2500,7 @@ ready to be send to R process. AL is an association list as return by `ess-watch (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 ) @@ -2569,7 +2556,7 @@ Optional N if supplied gives the number of backward steps." (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) @@ -2592,7 +2579,7 @@ Optional N if supplied gives the number of backward steps." (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) @@ -2686,7 +2673,7 @@ Optional N if supplied gives the number of backward steps." ;; (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) @@ -2760,7 +2747,7 @@ for signature and trace it with browser tracer." (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) @@ -2773,7 +2760,7 @@ for signature and trace it with browser tracer." (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 ))) @@ -2781,30 +2768,30 @@ for signature and trace it with browser tracer." ;;;_ * 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 (ess-derived-mode-p) - (= (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)) - -(defadvice delete-backward-char (around ess-delete-backward-char-intangible activate) +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))) + +(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 (ess-derived-mode-p) - (= (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)) +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) (provide 'ess-tracebug) diff --git a/elpa/ess-20190121.1430/ess-trns.el b/elpa/ess-20191014.1343/ess-trns.el similarity index 79% rename from elpa/ess-20190121.1430/ess-trns.el rename to elpa/ess-20191014.1343/ess-trns.el index 3ceef730..19fa8059 100644 --- a/elpa/ess-20190121.1430/ess-trns.el +++ b/elpa/ess-20191014.1343/ess-trns.el @@ -37,6 +37,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,39 +47,43 @@ ;;;; * 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 (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-c\t" 'ess-complete-object-name-deprecated) - (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) - (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) + (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'.") @@ -85,7 +91,6 @@ 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,6 +118,7 @@ the process buffer first. Type \\[ess-transcript-clean-region] to delete all outputs and prompts 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 "]")) @@ -153,8 +159,6 @@ is not already." (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))) @@ -165,8 +169,6 @@ is not already." (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 () @@ -184,7 +186,6 @@ is not already." (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 diff --git a/elpa/ess-20190121.1430/ess-utils.el b/elpa/ess-20191014.1343/ess-utils.el similarity index 76% rename from elpa/ess-20190121.1430/ess-utils.el rename to elpa/ess-20191014.1343/ess-utils.el index 9e7e874c..6c49e11c 100644 --- a/elpa/ess-20190121.1430/ess-utils.el +++ b/elpa/ess-20191014.1343/ess-utils.el @@ -30,21 +30,16 @@ ;;; Code: (require 'cl-lib) +(require 'comint) (eval-when-compile (require 'tramp)) ;; The only ESS file this file should depend on is ess-custom.el -(require 'cl-lib) -(require 'comint) -(require 'ess) (require 'ess-custom) -(require 'ido) -(require 'newcomment) + (defvar ac-modes) -(declare-function ess-eval-linewise "ess-inf") -(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") +(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") @@ -52,48 +47,46 @@ (declare-function tramp-file-name-localname "tramp") (declare-function tramp-file-name-hop "tramp") -;;; FIXME: Used in ./obsolete/xyz.el only; remove once gone. -(defun ess-message (format-string &rest args) - "Shortcut for \\[message] only if `ess-show-load-messages' is non-nil." - (when (bound-and-true-p ess-show-load-messages) - (message format-string args))) - ;;*;; elisp tools (defun ess-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. 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." +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") - (or arg (setq arg 1)) (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)) - (n 0) - (inc (if (> arg 0) 1 -1))) - (while (and (/= arg 0) (= n 0)) - (setq n (forward-line inc)) ; n=0 is success + (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 arg (- arg inc)) + (setq cnt (- cnt inc)) (goto-char pos) - (setq arg 0) - (forward-line 1)) ;; stop at next empty line + (setq cnt 0) + (forward-line inc)) ;; stop at next empty line (setq pos (point))) (goto-char pos) - n))) + out))) (defun ess-goto-line (line) + "Go to LINE in the widened buffer." (save-restriction (widen) (goto-char (point-min)) @@ -107,16 +100,10 @@ THING can be 'function, 'paragraph, or 'line." ((eql thing 'paragraph) (forward-paragraph)) ((eql thing 'function) (end-of-defun) (skip-chars-backward " \t\n")))) -(defun ess-line-end-position (&optional N) - "Return the 'point' at the end of N lines. N defaults to 1, i.e., current line." - (save-excursion - (end-of-line N) - (point))) - (defun ess-search-except (regexp &optional except backward) "Search for a REGEXP 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)) @@ -132,20 +119,9 @@ Optionally ignore strings that match exceptions." (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) @@ -153,14 +129,19 @@ Return t if buffer was modified, nil otherwise." 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-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))) + (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))) (defun ess-uniq (list predicate) "Uniquify LIST, stably, deleting elements using PREDICATE. @@ -176,16 +157,21 @@ This function will work even if LIST is unsorted. See also `delete-dups'." (define-obsolete-function-alias 'ess-uniq-list 'delete-dups "ESS 19.04") -(defun ess-flatten-list (&rest list) - "Take the arguments and flatten them into one long LIST. +(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)) + ;; 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) @@ -196,21 +182,7 @@ Drops 'nil' entries." (define-obsolete-function-alias 'ess-delete-blank-lines 'delete-blank-lines "ESS 19.04") -;; 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-line-to-list-of-words #'split-string "ESS 19.04") ;;*;; System @@ -230,38 +202,22 @@ Drops 'nil' entries." t))) (define-obsolete-function-alias 'ess-find-exec 'ess-find-exec-completions "ESS 19.04") -(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-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)) +(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." @@ -282,9 +238,9 @@ Search for the executables in ESS-EXEC-DIR (which defaults to ;;*;; 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'. @@ -310,47 +266,6 @@ process to avoid excessive requests." (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")))))) - ;;; Emacs Integration @@ -400,17 +315,15 @@ ess-[dialect]-font-lock-keywords variable." (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))) @@ -460,16 +373,20 @@ ess-[dialect]-font-lock-keywords variable." (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))) @@ -529,7 +446,7 @@ specifies inferior buffers." (delq 'company-capf company-backends))) (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. + "Execute single-key commands defined in MAP till a key is pressed which is not part of map. Single-key input commands are those that once executed do not require the prefix command for subsequent invocation. Return the value of the lastly executed command. PROMPT is passed to @@ -579,7 +496,7 @@ formats: one for directory and another for the output file." "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." +\\[universal-argument] \\[universal-argument] \\\\[yank]." (setq yank-window-start (window-start)) (let ((beg (point))) (push-mark beg) @@ -593,7 +510,9 @@ C-u C-u C-y." (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) @@ -623,7 +542,7 @@ GTags file (default TAGS): ") (when (or (eq (length (file-name-nondirectory tagfile)) 0) (file-directory-p tagfile)) (setq tagfile (concat (file-name-as-directory tagfile) "TAGS"))) - ;; emacs find-tags doesn't play well with remote TAG files :( + ;; 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))) @@ -650,43 +569,6 @@ GTags file (default TAGS): ") (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 @@ -697,6 +579,7 @@ Otherwise try a list of fixed known viewers." "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 @@ -704,18 +587,22 @@ Otherwise try a list of fixed known viewers." (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)) @@ -724,7 +611,7 @@ and y-offsets for the toolbar from point." 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-------- @@ -785,6 +672,7 @@ Copied almost verbatim from gnus-utils.el (but with test for mac added)." ;;; Syntax (defun ess-containing-sexp-position () + "Return the `cadr' of `syntax-ppss'." (cadr (syntax-ppss))) (defun ess-code-end-position () @@ -818,15 +706,14 @@ Copied almost verbatim from gnus-utils.el (but with test for mac added)." (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. - (regex-or "\\)\\|\\(") ; OR (space "\\(\\s-\\|\n\\)*") ; white space (part-1 (concat "\\(" ;;--------outer Either------- "\\(\\(" ; EITHER Q xSymb Q ; any function name between quotes - regex-or - "\\(^\\|[ ]\\)" Symb ; (beginning of name) + ess-r-symbol-pattern + "\\)\\|\\(" + Symb ; (beginning of name) + ess-r-symbol-pattern "\\)\\)")) ; END EITHER OR (set-S4-exp @@ -879,7 +766,7 @@ is the position where FN-NAME starts. Store this cons in variable (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)) @@ -965,6 +852,7 @@ also return t if inside curly brackets." ;;; String manipulation (defun ess-quote-special-chars (string) + "Quote special characters in STRING." (replace-regexp-in-string "\"" "\\\\\\&" (replace-regexp-in-string ;; replace backslashes @@ -1000,7 +888,7 @@ If DONT-QUERY is non-nil, call `ess-rep-regexp' else call (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 @@ -1014,6 +902,7 @@ Start at from FROM, which defaults to point." (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) @@ -1143,55 +1032,6 @@ nil and not t, query for each instance." (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)) @@ -1202,7 +1042,7 @@ Adds the `ess-face-adjusted' property so we only adjust face once." (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)) diff --git a/elpa/ess-20190121.1430/ess.el b/elpa/ess-20191014.1343/ess.el similarity index 77% rename from elpa/ess-20190121.1430/ess.el rename to elpa/ess-20191014.1343/ess.el index fc69a9bd..8ad45957 100644 --- a/elpa/ess-20190121.1430/ess.el +++ b/elpa/ess-20191014.1343/ess.el @@ -43,58 +43,22 @@ ;; ;;; Code: -(require 'ess-custom) +(require 'ess-utils) +(require 'cl-generic) (defvar reporter-prompt-for-summary-p) - -;;*;; 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-local ess--make-local-vars-permanent nil - "If this variable is non-nil in a buffer make all variable permannet. -Used in noweb modes.") -(put 'ess--make-local-vars-permanent 'permanent-local t) - ;; Versions -;; updated by 'make'! -(defconst ess-version "18.10.3snapshot" +(defconst ess-version (eval-when-compile + (require 'lisp-mnt) + (lm-version (or load-file-name buffer-file-name))) "Version of ESS currently loaded.") -;; updated by 'make'! -(defconst essr-version "1.5" +(defconst essr-version (eval-when-compile + (require 'lisp-mnt) + (save-excursion (lm-header "ESSR-Version"))) "Version of ESSR package.") (defvar ess-revision nil @@ -202,9 +166,9 @@ 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 +the LOCAL argument to `add-hook' and initialize 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' +specialized hooks `ess-r-post-run-hook',`ess-stata-post-run-hook' etc.") (defun ess--idle-timer-function nil @@ -216,6 +180,41 @@ etc.") (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 --git a/elpa/ess-20190121.1430/ess.info b/elpa/ess-20191014.1343/ess.info similarity index 93% rename from elpa/ess-20190121.1430/ess.info rename to elpa/ess-20191014.1343/ess.info index cbc3baaa..0ab70e35 100644 --- a/elpa/ess-20190121.1430/ess.info +++ b/elpa/ess-20191014.1343/ess.info @@ -88,7 +88,7 @@ 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 +modes. ESS major modes are displayed in the mode-line in the format 'ESS[dialect]', where 'dialect' can take values such as 'R', 'SAS', or 'S'. @@ -139,12 +139,12 @@ File: ess.info, Node: Features, Next: New features, Up: Introduction ========================= 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. +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 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 @@ -251,12 +251,28 @@ File: ess.info, Node: New features, Next: Credits, Prev: Features, Up: Intro Changes and New Features in 19.04 (unreleased): + * ESS[R]: There is a new menu entry for reloading the R process. It + is otherwise bound to 'C-c C-e C-r'. Reloading now reuses the same + process name and start arguments that were used to start the + process. + + * 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 + 'with-current-buffer' with the return value of the inferior. + + * iESS[SAS]: The SAS keymap was only set in iESS buffers called + '*SAS*'. This is now fixed. + + * ESS[R]: Fixed longstanding indentation issues involving '::' and + ':::' operators. + * 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. - * Activate 'goto-address-mode' for url and emal highlighting in + * Activate 'goto-address-mode' for url and email highlighting in inferior buffers. * 'smart-underscore' and 'ess-smart-S-assign-key' have been removed. @@ -274,8 +290,8 @@ Changes and New Features in 19.04 (unreleased): * 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 docstring for details. 'ess-auto-width-visible' - controls visibility. + integer. See the documentation for details. + 'ess-auto-width-visible' controls visibility. * ESS now respects 'display-buffer-alist'. Users can now use 'display-buffer-alist' to manage how and where windows appear. See @@ -301,6 +317,10 @@ Changes and New Features in 19.04 (unreleased): suggests, these now rely on project.el (included with Emacs) rather than projectile.el, which is a third-party package. + * ESS[R]: devtools commands ask about saving modified buffers before + running. Users can disable the questioning with + 'ess-save-silently'. + * ESS[R] help pages now provide links to other help topics. This is similar with what you would see with, for example 'options(help_type = ``html'')' but works with the plain-text @@ -311,6 +331,17 @@ Changes and New Features in 19.04 (unreleased): should look better and be a bit faster overall. The size column now displays object sizes in bytes. + * 'ess-rdired' buffers now auto-update. The frequency is governed by + the new option 'ess-rdired-auto-update-interval'. + + * ESS[R]: 'electric-layout-mode' is now supported. This + automatically inserts a newline after an opening curly brace in R + buffers. To enable it, customize 'ess-r-mode-hook'. + + * ESS[R]: imenu now supports assignment with the equals sign. + + * ESS[Rd]: Rd no longer writes abbrevs to user's abbrev file. + * ESS removed support for many unused languages. This includes old versions of S+, ARC, OMG, VST, and XLS. @@ -325,11 +356,18 @@ documentation for more detail: , or markdown-mode with edit-indirect . + * Support for 'auto-complete' is obsolete. The 'auto-complete' + package is unmaintained and so ESS support is now obsolete. Users + are encouraged to switch to 'company-mode' instead. + * User options for controlling display of buffers. This includes 'ess-show-buffer-action', 'inferior-ess-same-window', 'inferior-ess-own-frame', and 'inferior-ess-frame-alist'. See above about ESS respecting 'display-buffer-alist'. + * Variables 'ess-tab-always-indent' and 'ess-tab-complete-in-script'. + Use the Emacs-wide setting of 'tab-always-indent' instead. + * '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 @@ -428,7 +466,7 @@ documentation for more detail: * '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 + '_'. For instance if you bind it to ';', repeated invocations cycle through between assignment and inserting ';'. * 'C-c C-=' is now bound to 'ess-cycle-assign' by default. See the @@ -465,7 +503,7 @@ documentation for more detail: * 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. + where 'in' is a common 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' @@ -513,7 +551,7 @@ documentation for more detail: 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 + '_' for inserting 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. @@ -522,7 +560,7 @@ documentation for more detail: Changes and New Features in 17.11: - * The ESS initialisation process has been streamlined. You can now + * The ESS initialization 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 @@ -555,9 +593,9 @@ documentation for more detail: * 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 + identifiers). Furthermore they are now correctly recognized when they are function definitions or function calls. - * ESS[R]: Backquoted names and '%op%' operators are recognised as + * ESS[R]: Backquoted names and '%op%' operators are recognized 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. @@ -813,7 +851,7 @@ 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 +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. @@ -1138,10 +1176,30 @@ the source code and the other frame has the inferior process. To achieve this, use this example. *Note (elisp)Buffer Display Action Alists:: for a detailed description of 'reusable-frames'. - (setq 'display-buffer-alist - '("*R" - (display-buffer-reuse-window display-buffer-pop-up-frame) - (reusable-frames . 0))) + (setq display-buffer-alist + '(("*R" + (display-buffer-reuse-window display-buffer-pop-up-frame) + (reusable-frames . 0)))) + + 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. *Note +(elisp)Dedicated Windows::. For example, this prevents help buffers +from being displayed in the window showing the inferior R process. + + (setq display-buffer-alist + '(("*R" + nil + (dedicated . t)))) + + 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: + + (setq display-buffer-alist + '(("*R" . ((display-buffer-same-window) (inhibit-same-window . nil))) + ("\\.R$" . ((display-buffer-same-window) (inhibit-same-window . nil)))))  File: ess.info, Node: Entering commands, Next: Evaluating code, Prev: Interactive ESS, Up: Top @@ -2032,13 +2090,9 @@ in the source code as comments *Note Roxygen::. 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 + 'tab-always-indent' is ''complete'. 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 @@ -2476,6 +2530,13 @@ 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'. + Help buffers are displayed by calling the function +'ess-display-help'. You can customize where these buffers are displayed +by adding an entry in 'display-buffer-alist' (see *Note (ess)Controlling +buffer display:: for examples) or by customizing the options +'ess-help-own-frame', 'ess-help-frame-alist', and +'ess-display-buffer-reuse-frame'. +  File: ess.info, Node: Completion, Next: Developing with ESS, Prev: Help, Up: Top @@ -2487,7 +2548,6 @@ File: ess.info, Node: Completion, Next: Developing with ESS, Prev: Help, Up: * Object names:: * Function arguments:: * Minibuffer completion:: -* Auto-complete:: * Company:: * Icicles:: @@ -2498,10 +2558,9 @@ File: ess.info, Node: Object names, Next: Function arguments, Up: Completion ============================== 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. +'ess-first-tab-never-complete' 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 @@ -2524,7 +2583,7 @@ 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 + -- Command: ess-complete-object-name 'M-?' List all possible completions of the object name at point. ESS also provides completion over the components of named lists and @@ -2557,11 +2616,20 @@ 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'. + 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 +'?rc.options' at the prompt. For example, to have the equals sign for +function arguments contain spaces on both sides (e.g. 'lm(for)' +suggests 'formula = ' rather than 'formula='), you can adjust +'funarg.suffix': + + utils::rc.options(funarg.suffix = " = ") + 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 +File: ess.info, Node: Minibuffer completion, Next: Company, Prev: Function arguments, Up: Completion 9.3 Minibuffer completion ========================= @@ -2573,48 +2641,9 @@ completion if the 'ido' package is available and the value of 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) +File: ess.info, Node: Company, Next: Icicles, Prev: Minibuffer completion, Up: Completion - '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 +9.4 Company =========== Another popular package for completion is company, short for complete @@ -2625,7 +2654,7 @@ company support, set 'ess-use-company' to 'nil'. You can set it to  File: ess.info, Node: Icicles, Prev: Company, Up: Completion -9.6 Icicles +9.5 Icicles =========== Another option for comprehensively handling completion in Emacs is via @@ -2840,13 +2869,6 @@ 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. @@ -2948,7 +2970,7 @@ function can look like this: 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. +provided. Roxygen is customized by the variables in the customization group "Ess Roxy". Customizables include the Roxygen prefix, use of folding to @@ -3084,7 +3106,7 @@ ESS has a few extra features, which didn't fit anywhere else. * 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 @@ -3338,7 +3360,7 @@ 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 +File: ess.info, Node: Rdired, Next: Package listing, Prev: Xref, Up: Extras 11.10 Rdired ============ @@ -3370,44 +3392,28 @@ 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: +File: ess.info, Node: Package listing, Next: Org, Prev: Rdired, Up: Extras - (require 'ess-rutils) +11.11 Package listing +===================== - 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: +ESS[R] provides several commands to list and manage packages and objects +under the 'C-c C-.' keymap: - -- Command: ess-rutils-local-pkgs + -- Command: ess-r-package-list-local-packages 'C-c C-. l' List all packages in all available libraries. - -- Command: ess-rutils-repos-pkgs + -- Command: ess-r-package-list-available-packages '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 + -- Command: ess-r-package-update-packages 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. @@ -3420,21 +3426,13 @@ several key bindings become available in iESS process buffers: -- 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 +File: ess.info, Node: Org, Next: Sweave and AUCTeX, Prev: Package listing, Up: Extras 11.12 Interaction with Org mode =============================== @@ -3522,7 +3520,7 @@ File: ess.info, Node: ESS for R, Next: ESS for SAS, Prev: Extras, Up: Top * 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 +File: ess.info, Node: ESS(R)--Editing files, Next: iESS(R)--Inferior ESS processes, Up: ESS for R 12.1 ESS[R]-Editing files ========================= @@ -3546,7 +3544,7 @@ To start up iESS mode for R, use: 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 +(for R, S-PLUS 3.x, S4, S+5, S+6 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 @@ -3563,7 +3561,7 @@ 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 +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 @@ -3571,10 +3569,10 @@ 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. +change the variable 'ess-r-runners-prefixes'. 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 @@ -3586,48 +3584,10 @@ created for starting different versions of R, type 'M-x rw' and then hit "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 +new function, called '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 '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 @@ -3656,62 +3616,51 @@ File: ess.info, Node: Example ESS usage, Prev: Philosophies for using ESS(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 +Comments as to what should be happening are prefixed by "##". + + ### 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. - - ## Return to the script (prefix with C-c if you have pressed other keys) - C-z + ## in this buffer. The buffer is in iESS [R] mode. - ## 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 + ## Return to the script + C-z (or C-c C-z if you have pressed other keys in between) - ## 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 (if active), or function, or paragraph at + point with + C-M-x - ## 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. + ## Send current region or function or paragraph and step with + C-c C-c + ## Send current line with + C-RET + ## or load the entire buffer with + C-c C-l - 2: ## Program revision example (source code is real) + ## Save the revised myfile.R with + C-x C-s. - ## Start R in a process buffer (this will be *R*) - M-x R + ## Save the entire *R* interaction buffer with + C-x C-s. - ## Load the file you want to work with - C-x C-f myfile.R + ## Search for documentation with + C-c C-d - ## 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 + ## Investigate available ESS commands with + C-c C-h - ## save the revised myfile.R when you have finished - C-c C-s + ## 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.  @@ -3738,7 +3687,7 @@ 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 +File: ess.info, Node: ESS(SAS)--Design philosophy, Next: ESS(SAS)--Editing files, Up: ESS for SAS 13.1 ESS[SAS]-Design philosophy =============================== @@ -3871,7 +3820,7 @@ it can be set at the end of the program: 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 +'~/.emacs' or '~/.emacs.d/init.el' file (you may also use 'M-x customize-variable'): ;'sh default (setq ess-sas-submit-pre-command "nohup") @@ -3894,7 +3843,7 @@ 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: +'~/.emacs' or '~/.emacs.d/init.el' file by: (setq ess-sleep-for 0.2) For example, '(setq ess-sas-global-unix-keys t)' keys shown, '(setq @@ -4053,7 +4002,7 @@ 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: +example in your '~/.emacs' or '~/.emacs.d/init.el' file: (setq ess-sas-suffix-1 "csv") ; for example will prompt you for the name of a permanent SAS dataset near @@ -4460,7 +4409,7 @@ 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. + * discussing aspects of using ESS. * suggestions for improvements. * announcements of new releases of ESS. * posting small patches to ESS. @@ -4519,18 +4468,16 @@ Key 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) +* {: Indenting. (line 53) +* }: Indenting. (line 53) +* C-c C-. d: Package listing. (line 30) +* C-c C-. H: Package listing. (line 33) +* C-c C-. l: Package listing. (line 10) +* C-c C-. m: Package listing. (line 21) +* C-c C-. r: Package listing. (line 13) +* C-c C-. s: Package listing. (line 27) +* C-c C-. u: Package listing. (line 17) +* C-c C-. w: Package listing. (line 24) * C-c C-b: Evaluating code. (line 66) * C-c C-c: Other. (line 9) * C-c C-c <1>: Evaluating code. (line 39) @@ -4562,14 +4509,14 @@ Key index * 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-j: Indenting. (line 60) * 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-q: Indenting. (line 49) * C-M-x: Evaluating code. (line 36) * C-RET: Evaluating code. (line 32) * ESC C-a: Other edit buffer commands. @@ -4578,10 +4525,10 @@ Key index (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) +* ESC C-q: Indenting. (line 49) +* M-;: Indenting. (line 65) +* M-?: Object names. (line 33) +* M-C-q: Indenting. (line 49) * M-n l: Sweave and AUCTeX. (line 24) * M-n P: Sweave and AUCTeX. (line 30) * M-n s: Sweave and AUCTeX. (line 20) @@ -4607,7 +4554,7 @@ Function and program index (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-dynamic-complete: Object names. (line 12) * comint-forward-matching-input: Process buffer motion. (line 32) * comint-history-isearch-backward-regexp: Command History. (line 32) @@ -4624,15 +4571,16 @@ Function and program index (line 11) * comint-show-output: Last command. (line 20) * dump(): Edit buffer. (line 35) -* ess-change-directory: Rutils. (line 45) +* ess-change-directory: Package listing. (line 29) * ess-cleanup: Hot keys. (line 71) -* ess-cleanup <1>: Help. (line 163) +* ess-cleanup <1>: Help. (line 170) +* ess-complete-object-name: Object names. (line 32) * 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-electric-brace: Indenting. (line 52) * ess-eval-buffer: Evaluating code. (line 65) * ess-eval-buffer-and-go: Evaluating code. (line 68) * ess-eval-function: Evaluating code. (line 51) @@ -4656,9 +4604,8 @@ Function and program index * 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-exp: Indenting. (line 48) * 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. @@ -4666,15 +4613,18 @@ Function and program index * 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-quit <1>: Help. (line 170) * ess-R-complete-object-name: Roxygen. (line 80) +* ess-r-package-list-available-packages: Package listing. (line 12) +* ess-r-package-list-local-packages: Package listing. (line 9) +* ess-r-package-update-packages: Package listing. (line 16) * 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-resynch: Object names. (line 52) * ess-roxy-hide-all: Roxygen. (line 71) * ess-roxy-move-beginning-of-line: Roxygen. (line 97) * ess-roxy-next-entry: Roxygen. (line 68) @@ -4683,16 +4633,10 @@ Function and program index * 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-rutils-html-docs: Package listing. (line 32) +* ess-rutils-load-wkspc: Package listing. (line 23) +* ess-rutils-rm-all: Package listing. (line 20) +* ess-rutils-save-wkspc: Package listing. (line 26) * ess-set-style: Styles. (line 14) * ess-skip-to-help-section: Help. (line 55) * ess-skip-to-next-section: Help. (line 46) @@ -4725,7 +4669,7 @@ Function and program index * R: Starting up. (line 11) * S: Starting up. (line 11) * search(): Hot keys. (line 34) -* search() <1>: Object names. (line 20) +* search() <1>: Object names. (line 19) * source(): Evaluating code. (line 18) * source() <1>: Loading. (line 11) * STERM: Statistical Process running in ESS?. @@ -4740,9 +4684,6 @@ 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) @@ -4759,7 +4700,7 @@ Variable index * 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: Indenting. (line 42) * ess-first-tab-never-complete <1>: Object names. (line 6) * ess-function-template: Edit buffer. (line 17) * ess-handy-commands: Handy commands. (line 6) @@ -4779,18 +4720,17 @@ Variable index * ess-style-alist: Styles. (line 28) * ess-switch-to-end-of-proc-buffer: Other. (line 21) * ess-swv-pdflatex-commands: Sweave and AUCTeX. (line 35) -* 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 48) * inferior-ess-program: Customizing startup. (line 48) * inferior-R-font-lock-keywords: Highlighting. (line 12) * Rd-indent-level: R documentation files. - (line 85) + (line 78) * Rd-mode-hook: R documentation files. - (line 82) + (line 75) * Rd-to-help-command: R documentation files. - (line 89) + (line 82)  File: ess.info, Node: Concept index, Prev: Variable index, Up: Indices @@ -4806,7 +4746,6 @@ Concept Index * arguments to R program: Customizing startup. (line 51) * arguments to S program: Customizing startup. (line 51) * 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) @@ -4827,13 +4766,13 @@ Concept Index * 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 on file names: Object names. (line 39) +* completion on lists: Object names. (line 37) * 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) +* data frames: Object names. (line 20) * deleting output: Last command. (line 24) * directories: Starting up. (line 11) * dump file directories: Source Directories. (line 20) @@ -4884,7 +4823,7 @@ Concept Index * 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) +* lists, completion on: Object names. (line 37) * motion in transcript mode: Transcript Mode. (line 17) * multi-line commands, resubmitting: Transcript resubmit. (line 33) * multiple ESS processes: Multiple ESS processes. @@ -4921,11 +4860,12 @@ Concept Index * search list: Hot keys. (line 34) * search list <1>: Source Directories. (line 55) * sending input: Entering commands. (line 6) +* Space in function argument completion: Function arguments. (line 10) * 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: Help. (line 169) * temporary buffers, killing: Hot keys. (line 71) * tracebug tutorial: Getting started with tracebug. (line 6) @@ -4951,108 +4891,107 @@ Concept Index Tag Table: Node: Top268 Node: Introduction2914 -Node: Features5667 -Node: Current Features6503 -Node: New features9954 -Node: Credits27847 -Node: Manual31464 -Node: Installation34130 -Node: Installing from a third-party repository35067 -Node: Installing from source36014 -Node: Activating and Loading ESS37606 -Node: Check Installation38680 -Node: Interactive ESS38900 -Node: Starting up39745 -Node: Multiple ESS processes40489 -Node: ESS processes on Remote Computers41570 -Node: Customizing startup45673 -Node: Controlling buffer display48563 -Node: Entering commands50289 -Node: Command-line editing51447 -Node: Transcript52680 -Node: Last command54449 -Node: Process buffer motion55875 -Node: Transcript resubmit57378 -Node: Saving transcripts59343 -Node: Command History61133 -Node: Saving History64542 -Node: History expansion65303 -Node: Hot keys68514 -Node: Statistical Process running in ESS?72584 -Node: Emacsclient73863 -Node: Other74655 -Node: Evaluating code75674 -Node: Transcript Mode79355 -Node: Resubmit80508 -Node: Clean81571 -Node: Editing objects82567 -Node: Edit buffer83685 -Node: Loading85731 -Node: Error Checking86758 -Node: Indenting87807 -Node: Styles90996 -Node: Other edit buffer commands93370 -Node: Source Files95026 -Node: Source Directories99630 -Node: Help102783 -Node: Completion106881 -Node: Object names107114 -Node: Function arguments109787 -Node: Minibuffer completion110326 -Node: Auto-complete110806 -Node: Company112353 -Node: Icicles112732 -Node: Developing with ESS114052 -Node: ESS tracebug114498 -Node: Getting started with tracebug117505 -Node: Editing documentation119663 -Node: R documentation files120213 -Node: Roxygen124140 -Node: Namespaced Evaluation128543 -Node: Extras130541 -Node: ESS ElDoc131565 -Node: ESS Flymake133061 -Node: Handy commands134155 -Node: Highlighting135352 -Node: Parens136387 -Node: Graphics136863 -Node: printer137534 -Node: X11138290 -Node: winjava138629 -Node: Imenu139041 -Node: Toolbar139888 -Node: Xref140296 -Node: Rdired140619 -Node: Rutils141673 -Node: Org144067 -Node: Sweave and AUCTeX145012 -Node: ESS for R147564 -Node: ESS(R)--Editing files147864 -Node: iESS(R)--Inferior ESS processes148383 -Node: Philosophies for using ESS(R)153132 -Node: Example ESS usage154059 -Node: ESS for SAS156280 -Node: ESS(SAS)--Design philosophy157003 -Node: ESS(SAS)--Editing files157956 -Node: ESS(SAS)--TAB key159810 -Node: ESS(SAS)--Batch SAS processes161176 -Node: ESS(SAS)--Function keys for batch processing166202 -Node: iESS(SAS)--Interactive SAS processes175688 -Node: iESS(SAS)--Common problems179442 -Node: ESS(SAS)--Graphics180965 -Node: ESS(SAS)--Windows181748 -Node: ESS for BUGS182326 -Node: ESS for JAGS184082 -Node: Mailing lists/bug reports187434 -Node: Bugs187698 -Node: Reporting Bugs189323 -Node: Mailing Lists190216 -Node: Help with Emacs190963 -Node: Customization191495 -Node: Indices192269 -Node: Key index192444 -Node: Function and program index197722 -Node: Variable index207361 -Node: Concept index211214 +Node: Features5668 +Node: Current Features6494 +Node: New features9945 +Node: Credits29468 +Node: Manual33085 +Node: Installation35751 +Node: Installing from a third-party repository36688 +Node: Installing from source37635 +Node: Activating and Loading ESS39227 +Node: Check Installation40301 +Node: Interactive ESS40521 +Node: Starting up41366 +Node: Multiple ESS processes42110 +Node: ESS processes on Remote Computers43191 +Node: Customizing startup47294 +Node: Controlling buffer display50184 +Node: Entering commands52782 +Node: Command-line editing53940 +Node: Transcript55173 +Node: Last command56942 +Node: Process buffer motion58368 +Node: Transcript resubmit59871 +Node: Saving transcripts61836 +Node: Command History63626 +Node: Saving History67035 +Node: History expansion67796 +Node: Hot keys71007 +Node: Statistical Process running in ESS?75077 +Node: Emacsclient76356 +Node: Other77148 +Node: Evaluating code78167 +Node: Transcript Mode81848 +Node: Resubmit83001 +Node: Clean84064 +Node: Editing objects85060 +Node: Edit buffer86178 +Node: Loading88224 +Node: Error Checking89251 +Node: Indenting90300 +Node: Styles93342 +Node: Other edit buffer commands95716 +Node: Source Files97372 +Node: Source Directories101976 +Node: Help105129 +Node: Completion109573 +Node: Object names109788 +Node: Function arguments112422 +Node: Minibuffer completion113365 +Node: Company113839 +Node: Icicles114226 +Node: Developing with ESS115546 +Node: ESS tracebug115992 +Node: Getting started with tracebug118999 +Node: Editing documentation121157 +Node: R documentation files121707 +Node: Roxygen125409 +Node: Namespaced Evaluation129783 +Node: Extras131781 +Node: ESS ElDoc132805 +Node: ESS Flymake134301 +Node: Handy commands135395 +Node: Highlighting136592 +Node: Parens137627 +Node: Graphics138103 +Node: printer138774 +Node: X11139530 +Node: winjava139869 +Node: Imenu140281 +Node: Toolbar141128 +Node: Xref141536 +Node: Rdired141859 +Node: Package listing142922 +Node: Org144298 +Node: Sweave and AUCTeX145252 +Node: ESS for R147804 +Node: ESS(R)--Editing files148104 +Node: iESS(R)--Inferior ESS processes148605 +Node: Philosophies for using ESS(R)151255 +Node: Example ESS usage152182 +Node: ESS for SAS153587 +Node: ESS(SAS)--Design philosophy154310 +Node: ESS(SAS)--Editing files155243 +Node: ESS(SAS)--TAB key157097 +Node: ESS(SAS)--Batch SAS processes158463 +Node: ESS(SAS)--Function keys for batch processing163491 +Node: iESS(SAS)--Interactive SAS processes172978 +Node: iESS(SAS)--Common problems176732 +Node: ESS(SAS)--Graphics178255 +Node: ESS(SAS)--Windows179038 +Node: ESS for BUGS179616 +Node: ESS for JAGS181372 +Node: Mailing lists/bug reports184724 +Node: Bugs184988 +Node: Reporting Bugs186613 +Node: Mailing Lists187506 +Node: Help with Emacs188233 +Node: Customization188765 +Node: Indices189539 +Node: Key index189714 +Node: Function and program index194846 +Node: Variable index204266 +Node: Concept index207827  End Tag Table diff --git a/elpa/ess-20190121.1430/essd-els.el b/elpa/ess-20191014.1343/essd-els.el similarity index 82% rename from elpa/ess-20190121.1430/essd-els.el rename to elpa/ess-20191014.1343/essd-els.el index 8940cd22..1ed6ef98 100644 --- a/elpa/ess-20190121.1430/essd-els.el +++ b/elpa/ess-20191014.1343/essd-els.el @@ -1,4 +1,4 @@ -;;; 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 @@ -39,9 +39,13 @@ (require 'ess-stata-mode) (require 'ess-trns) (require 'ess-utils) + +;; 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 + +(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. @@ -57,29 +61,26 @@ The default value is nil." (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-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) + (declare (obsolete ess-remote "2000")) (setq-local ess-local-customize-alist S+elsewhere-customize-alist) (ess-mode)) @@ -89,7 +90,7 @@ The default value is nil." ;; 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")) @@ -111,27 +112,27 @@ buffer on the local computer." (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 @@ -142,13 +143,13 @@ DIALECT is the desired ess-dialect. If nil, ask for dialect" (interactive) (ess-add-ess-process) ;; Need to select a remote-customize-alist - (let ((ess-customize-alist (ess-select-alist-dialect dialect))) + (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)) @@ -158,7 +159,7 @@ DIALECT is the desired ess-dialect. If nil, ask for dialect" (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)) diff --git a/elpa/ess-20190121.1430/etc/ESSR.rds b/elpa/ess-20191014.1343/etc/ESSR.rds similarity index 100% rename from elpa/ess-20190121.1430/etc/ESSR.rds rename to elpa/ess-20191014.1343/etc/ESSR.rds diff --git a/elpa/ess-20190121.1430/etc/ESSR/BUILDESSR b/elpa/ess-20191014.1343/etc/ESSR/BUILDESSR similarity index 90% rename from elpa/ess-20190121.1430/etc/ESSR/BUILDESSR rename to elpa/ess-20191014.1343/etc/ESSR/BUILDESSR index 86a87dd7..5fe79863 100755 --- a/elpa/ess-20190121.1430/etc/ESSR/BUILDESSR +++ b/elpa/ess-20191014.1343/etc/ESSR/BUILDESSR @@ -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.load.ESSR('./R/') saveRDS(ESSR, file = "../ESSR.rds") diff --git a/elpa/ess-20190121.1430/etc/ESSR/LOADREMOTE b/elpa/ess-20191014.1343/etc/ESSR/LOADREMOTE similarity index 100% rename from elpa/ess-20190121.1430/etc/ESSR/LOADREMOTE rename to elpa/ess-20191014.1343/etc/ESSR/LOADREMOTE diff --git a/elpa/ess-20190121.1430/etc/ESSR/R/.basic.R b/elpa/ess-20191014.1343/etc/ESSR/R/.basic.R similarity index 100% rename from elpa/ess-20190121.1430/etc/ESSR/R/.basic.R rename to elpa/ess-20191014.1343/etc/ESSR/R/.basic.R diff --git a/elpa/ess-20190121.1430/etc/ESSR/R/.load.R b/elpa/ess-20191014.1343/etc/ESSR/R/.load.R similarity index 98% rename from elpa/ess-20190121.1430/etc/ESSR/R/.load.R rename to elpa/ess-20191014.1343/etc/ESSR/R/.load.R index 1634a0ee..e1c64e88 100644 --- a/elpa/ess-20190121.1430/etc/ESSR/R/.load.R +++ b/elpa/ess-20191014.1343/etc/ESSR/R/.load.R @@ -3,7 +3,7 @@ ## Do not use _ in names, nor :: as they cannot be parsed in old R versions ## load .base.R and all other files into ESSR environment; then attach ESSR -load.ESSR <- function(dir){ +.ess.load.ESSR <- function(dir) { .source <- if(any("keep.source" == names(formals(sys.source)))) sys.source diff --git a/elpa/ess-20190121.1430/etc/ESSR/R/completion.R b/elpa/ess-20191014.1343/etc/ESSR/R/completion.R similarity index 94% rename from elpa/ess-20190121.1430/etc/ESSR/R/completion.R rename to elpa/ess-20191014.1343/etc/ESSR/R/completion.R index 44c60f93..2a2acc06 100644 --- a/elpa/ess-20190121.1430/etc/ESSR/R/completion.R +++ b/elpa/ess-20191014.1343/etc/ESSR/R/completion.R @@ -18,7 +18,7 @@ local({ } }) - + .ess_eval <- function(str, env = globalenv()) { ## don't remove; really need eval(parse( here!! tryCatch(base::eval(base::parse(text=str), envir = env), @@ -49,6 +49,7 @@ local({ cat(out) } + .ess_fn_pkg <- function(fn_name) { fn <- .ess_eval(fn_name) env_name <- base::environmentName(base::environment(fn)) @@ -93,7 +94,7 @@ local({ sep = '', collapse = ' ')) allargs <- if (special) fmls_names - else tryCatch(gsub('=', '', utils:::functionArgs(funname, ''), fixed = TRUE), + else tryCatch(gsub(' ?= ?', '', utils:::functionArgs(funname, ''), fixed = FALSE), error=function(e) NULL) allargs <- sprintf("'(\"%s\")", paste(allargs, collapse = '\" "')) @@ -106,11 +107,14 @@ local({ } } -.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) @@ -160,4 +164,4 @@ local({ )) i <- i + 1 cat('\n\n', as.character(out), '\n') -}; +} diff --git a/elpa/ess-20190121.1430/etc/ESSR/R/debug.R b/elpa/ess-20191014.1343/etc/ESSR/R/debug.R similarity index 98% rename from elpa/ess-20190121.1430/etc/ESSR/R/debug.R rename to elpa/ess-20191014.1343/etc/ESSR/R/debug.R index 8154b047..a4fcf638 100644 --- a/elpa/ess-20190121.1430/etc/ESSR/R/debug.R +++ b/elpa/ess-20191014.1343/etc/ESSR/R/debug.R @@ -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() @@ -170,12 +172,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 +201,7 @@ invisible(NULL) } + .ess_package_attached <- function(pack_name){ as.logical(match(paste0("package:", pack_name), search())) } diff --git a/elpa/ess-20190121.1430/etc/ESSR/R/misc.R b/elpa/ess-20191014.1343/etc/ESSR/R/misc.R similarity index 98% rename from elpa/ess-20190121.1430/etc/ESSR/R/misc.R rename to elpa/ess-20191014.1343/etc/ESSR/R/misc.R index c1e36183..e3bba966 100644 --- a/elpa/ess-20190121.1430/etc/ESSR/R/misc.R +++ b/elpa/ess-20191014.1343/etc/ESSR/R/misc.R @@ -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 @@ htsummary <- function(x, hlength = 4, tlength = 4, digits = 3) { invisible(NULL) } + .ess_vignettes <- function(all=FALSE) { vs <- unclass(browseVignettes(all = all)) vs <- vs[sapply(vs, length) > 0] diff --git a/elpa/ess-20191014.1343/etc/ESSR/R/mpi.R b/elpa/ess-20191014.1343/etc/ESSR/R/mpi.R new file mode 100644 index 00000000..53d7e470 --- /dev/null +++ b/elpa/ess-20191014.1343/etc/ESSR/R/mpi.R @@ -0,0 +1,28 @@ +## simple Message Parsing Inerface + +.ess_mpi_send <- function(head, ...){ + 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 = NULL){ + .ess_mpi_send("y-or-n", prompt, callback) +} + +.ess_mpi_eval <- function(expr, callback = NULL){ + .ess_mpi_send("eval", expr, callback) +} + +.ess_mpi_error <- function(msg) { + .ess_mpi_send("error", msg) +} + diff --git a/elpa/ess-20190121.1430/etc/ESSR/R/ns-eval.R b/elpa/ess-20191014.1343/etc/ESSR/R/ns-eval.R similarity index 99% rename from elpa/ess-20190121.1430/etc/ESSR/R/ns-eval.R rename to elpa/ess-20191014.1343/etc/ESSR/R/ns-eval.R index ffdcc25d..83bbaec2 100644 --- a/elpa/ess-20190121.1430/etc/ESSR/R/ns-eval.R +++ b/elpa/ess-20191014.1343/etc/ESSR/R/ns-eval.R @@ -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. @@ -269,6 +270,7 @@ invisible(env) } + .ess.ns_insertMethods <- function(tableEnv, tablePkg, envns) { inserted <- character() for(m in ls(envir = tableEnv, all.names = T)){ @@ -311,6 +313,7 @@ env } + .ess.assign <- function(x, value, envir) { ## Cannot add bindings to locked environments exists <- exists(x, envir = envir, inherits = FALSE) @@ -349,6 +352,7 @@ !identical(f1, f2) } + .ess.is_package <- function(envName) { isPkg <- identical(substring(envName, 0, 8), "package:") isPkg && (envName != "package:base") @@ -365,6 +369,7 @@ containsObj } + .ess.ns_format_deps <- function(dependentPkgs) { pkgs <- unique(unlist(dependentPkgs, use.names = FALSE)) @@ -384,6 +389,7 @@ name } + .ess.ns_insert_essenv <- function(nsenv) { if (is.character(nsenv)) nsenv <- base::asNamespace(nsenv) diff --git a/elpa/ess-20190121.1430/etc/ESSR/R/pkg.R b/elpa/ess-20191014.1343/etc/ESSR/R/pkg.R similarity index 100% rename from elpa/ess-20190121.1430/etc/ESSR/R/pkg.R rename to elpa/ess-20191014.1343/etc/ESSR/R/pkg.R diff --git a/elpa/ess-20190121.1430/etc/Makefile b/elpa/ess-20191014.1343/etc/Makefile similarity index 100% rename from elpa/ess-20190121.1430/etc/Makefile rename to elpa/ess-20191014.1343/etc/Makefile diff --git a/elpa/ess-20190121.1430/etc/ess-julia.jl b/elpa/ess-20191014.1343/etc/ess-julia.jl similarity index 89% rename from elpa/ess-20190121.1430/etc/ess-julia.jl rename to elpa/ess-20191014.1343/etc/ess-julia.jl index ed770491..efa1ce0c 100644 --- a/elpa/ess-20190121.1430/etc/ess-julia.jl +++ b/elpa/ess-20191014.1343/etc/ess-julia.jl @@ -15,7 +15,13 @@ function all_help_topics() 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 @@ end 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 diff --git a/elpa/ess-20190121.1430/etc/ess-sas-sh-command b/elpa/ess-20191014.1343/etc/ess-sas-sh-command similarity index 100% rename from elpa/ess-20190121.1430/etc/ess-sas-sh-command rename to elpa/ess-20191014.1343/etc/ess-sas-sh-command diff --git a/elpa/ess-20190121.1430/license.info b/elpa/ess-20191014.1343/license.info similarity index 100% rename from elpa/ess-20190121.1430/license.info rename to elpa/ess-20191014.1343/license.info diff --git a/elpa/ess-20190121.1430/mailing.info b/elpa/ess-20191014.1343/mailing.info similarity index 91% rename from elpa/ess-20190121.1430/mailing.info rename to elpa/ess-20191014.1343/mailing.info index 550b538a..1cf83d79 100644 --- a/elpa/ess-20190121.1430/mailing.info +++ b/elpa/ess-20191014.1343/mailing.info @@ -10,7 +10,7 @@ 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. + * discussing aspects of using ESS. * suggestions for improvements. * announcements of new releases of ESS. * posting small patches to ESS. diff --git a/elpa/ess-20190121.1430/make-regexp.el b/elpa/ess-20191014.1343/make-regexp.el similarity index 100% rename from elpa/ess-20190121.1430/make-regexp.el rename to elpa/ess-20191014.1343/make-regexp.el diff --git a/elpa/ess-20190121.1430/news.info b/elpa/ess-20191014.1343/news.info similarity index 88% rename from elpa/ess-20190121.1430/news.info rename to elpa/ess-20191014.1343/news.info index d0e83caa..b476aa29 100644 --- a/elpa/ess-20190121.1430/news.info +++ b/elpa/ess-20191014.1343/news.info @@ -2,12 +2,28 @@ This is news.info, produced by makeinfo version 6.5 from news.texi. Changes and New Features in 19.04 (unreleased): + * ESS[R]: There is a new menu entry for reloading the R process. It + is otherwise bound to 'C-c C-e C-r'. Reloading now reuses the same + process name and start arguments that were used to start the + process. + + * 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 + 'with-current-buffer' with the return value of the inferior. + + * iESS[SAS]: The SAS keymap was only set in iESS buffers called + '*SAS*'. This is now fixed. + + * ESS[R]: Fixed longstanding indentation issues involving '::' and + ':::' operators. + * 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. - * Activate 'goto-address-mode' for url and emal highlighting in + * Activate 'goto-address-mode' for url and email highlighting in inferior buffers. * 'smart-underscore' and 'ess-smart-S-assign-key' have been removed. @@ -25,8 +41,8 @@ Changes and New Features in 19.04 (unreleased): * 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 docstring for details. 'ess-auto-width-visible' - controls visibility. + integer. See the documentation for details. + 'ess-auto-width-visible' controls visibility. * ESS now respects 'display-buffer-alist'. Users can now use 'display-buffer-alist' to manage how and where windows appear. See @@ -52,6 +68,10 @@ Changes and New Features in 19.04 (unreleased): suggests, these now rely on project.el (included with Emacs) rather than projectile.el, which is a third-party package. + * ESS[R]: devtools commands ask about saving modified buffers before + running. Users can disable the questioning with + 'ess-save-silently'. + * ESS[R] help pages now provide links to other help topics. This is similar with what you would see with, for example 'options(help_type = ``html'')' but works with the plain-text @@ -62,6 +82,17 @@ Changes and New Features in 19.04 (unreleased): should look better and be a bit faster overall. The size column now displays object sizes in bytes. + * 'ess-rdired' buffers now auto-update. The frequency is governed by + the new option 'ess-rdired-auto-update-interval'. + + * ESS[R]: 'electric-layout-mode' is now supported. This + automatically inserts a newline after an opening curly brace in R + buffers. To enable it, customize 'ess-r-mode-hook'. + + * ESS[R]: imenu now supports assignment with the equals sign. + + * ESS[Rd]: Rd no longer writes abbrevs to user's abbrev file. + * ESS removed support for many unused languages. This includes old versions of S+, ARC, OMG, VST, and XLS. @@ -76,11 +107,18 @@ documentation for more detail: , or markdown-mode with edit-indirect . + * Support for 'auto-complete' is obsolete. The 'auto-complete' + package is unmaintained and so ESS support is now obsolete. Users + are encouraged to switch to 'company-mode' instead. + * User options for controlling display of buffers. This includes 'ess-show-buffer-action', 'inferior-ess-same-window', 'inferior-ess-own-frame', and 'inferior-ess-frame-alist'. See above about ESS respecting 'display-buffer-alist'. + * Variables 'ess-tab-always-indent' and 'ess-tab-complete-in-script'. + Use the Emacs-wide setting of 'tab-always-indent' instead. + * '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 @@ -179,7 +217,7 @@ documentation for more detail: * '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 + '_'. For instance if you bind it to ';', repeated invocations cycle through between assignment and inserting ';'. * 'C-c C-=' is now bound to 'ess-cycle-assign' by default. See the @@ -216,7 +254,7 @@ documentation for more detail: * 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. + where 'in' is a common 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' @@ -264,7 +302,7 @@ documentation for more detail: 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 + '_' for inserting 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. @@ -273,7 +311,7 @@ documentation for more detail: Changes and New Features in 17.11: - * The ESS initialisation process has been streamlined. You can now + * The ESS initialization 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 @@ -306,9 +344,9 @@ documentation for more detail: * 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 + identifiers). Furthermore they are now correctly recognized when they are function definitions or function calls. - * ESS[R]: Backquoted names and '%op%' operators are recognised as + * ESS[R]: Backquoted names and '%op%' operators are recognized 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. diff --git a/elpa/ess-20191014.1343/obsolete/ess-eldoc.el b/elpa/ess-20191014.1343/obsolete/ess-eldoc.el new file mode 100644 index 00000000..d43d640a --- /dev/null +++ b/elpa/ess-20191014.1343/obsolete/ess-eldoc.el @@ -0,0 +1,172 @@ +;;; 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. + +;; Author: Stephen Eglen +;; Created: 2007-06-30 +;; 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 +;; http://www.r-project.org/Licenses/ + +;;; Commentary: + +;;;;; eldoc funcitonality has been moved into the core ;;;;; +;;;;; this file has no effect and is left in ESS in order not to break +;;;;; users configuration + +;; This is an initial attempt to use the emacs facility ELDOC in R +;; buffers. Eldoc is used in Emacs lisp buffers to show the function +;; arglist and docstrings for variables. To try it, view an emacs +;; lisp buffer, and then do M-x turn-on-eldoc-mode, and move over +;; function and variable names. + +;; This file extends eldoc to work in R buffers. It currently uses +;; Sven's ess-r-args.el file to retrieve args for a given R function +;; (via ess-r-args-get). Note that it works slightly different to +;; Sven's code, in that you just need to have the point over the name +;; of an R function, or inside its arguments list, for eldoc to show +;; the arg list. + +;; To use this functionality, simply add +;; +;; (require 'ess-eldoc) +;; +;; to your .emacs file. When you visit a R mode, eldoc will be turned +;; on. However, you will first need to associate the R buffer with an +;; *R* process so that args can be looked up -- otherwise, eldoc will +;; silently not report anything. So, e.g. try: +;; C-x C-f somefile.R +;; M-x R (so that somefile.R is associated with *R*) +;; eldoc should then work. + +;; e.g. put the following rnorm() command in an R buffer. The line +;; underneath shows a key of what arg list will be shown as you move +;; across the rnorm line. + +;; rnorm(n=100, mean=sqrt(20), sd=10) +;; 1111111111111222223333333311444111 +;; 1: rnorm +;; 2: mean +;; 3: sqrt +;; 4: sd +;; + +;; Note that the arg list for rnorm() should be shown either when you +;; are on the function name, or in the arg list. However, since the +;; 2nd and 3rd arguments are also function names, the arg lists of +;; those function names are reported instead. This might be seen as +;; undesirable behaviour, in which case a solution would be to only +;; look up the function name if it is followed by (. + +;; If you want to use this feature in *R* buffers, add the following +;; to .emacs: +;; (add-hook 'inferior-ess-mode-hook 'ess-use-eldoc) + + +;; In the current version, I do not cache the arg list, but that was +;; done in an earlier version, to save repeated calls to +;; ess-r-args-get. + +;; This code has been tested only in Emacs 22.1. It will not work on +;; Emacs 21, because it needs the variable +;; eldoc-documentation-function. + +;;;; VS [25-02-2012]: all these issues were at least partially addresed in the +;;;; new implementation: + +;; Bug (in eldoc?): the arg list for legend() is too long to fit in +;; minibuffer, and it seems that we see the last N lines of the arg +;; list, rather than the first N lines. It would be better to see the +;; first N lines since the more important args come first. + +;; Doc issue: the eldoc vars (e.g. eldoc-echo-area-use-multiline-p) +;; work only for elisp mode. + +;; Issue: You will probably see the message "Using process 'R'" flash; +;; this is generated by `ess-request-a-process', and I'd like to avoid +;; that appearing, non-interactively. + +;; If *R* is currently busy (e.g. processing Sys.sleep(999)), then the +;; eldoc commands won't work; ess-command could be silenced in this +;; regard perhaps with a new SILENT arg for example to prevent the +;; call to (ess-error). + + +;;; Code: + +;; ;; This could be done on buffer local basis. +;; (setq ess-r-args-noargsmsg "") + +;; ;; following two defvars are not currently used. +;; (defvar ess-eldoc-last-name nil +;; "Name of the last function looked up in eldoc. +;; We remember this to see whether we need to look up documentation, or used +;; the cached value in `ess-eldoc-last-args'.") + +;; (defvar ess-eldoc-last-args nil +;; "Args list last looked up for eldoc. Used as cache.") + +;; (defun ess-eldoc-2 () +;; ;; simple, old version. +;; (interactive) +;; (ess-r-args-get (ess-read-object-name-default))) + +;; (defun ess-eldoc-1 () +;; "Return the doc string, or nil. +;; This is the first version; works only on function name, not within arg list." +;; (interactive) + +;; ;; Possible ways to get the function at point. +;; ;;(setq name (thing-at-point 'sexp)) +;; ;;(setq name (ess-read-object-name-default)) +;; ;;(setq name (find-tag-default)) + +;; (if ess-current-process-name +;; (progn +;; (setq name (ess-guess-fun)) ;guess the word at point. +;; (if (equal (length name) 0) +;; nil +;; ;; else +;; (unless (equal name ess-eldoc-last-name) +;; ;; name is different to the last name we lookedup, so get +;; ;; new args from R and store them. +;; (setq ess-eldoc-last-args (ess-r-args-get name) +;; ess-eldoc-last-name name)) +;; ess-eldoc-last-args)) +;; ;; no ESS process current. +;; nil) +;; ) + + +;; (defsubst ess-guess-fun () +;; "Guess what the function at point is." +;; ;; Derived from Man-default-man-entry in man.el +;; (let (word) +;; (save-excursion +;; (skip-chars-backward "-a-zA-Z0-9._+:") +;; (let ((start (point))) +;; (skip-chars-forward "-a-zA-Z0-9._+:") +;; (setq word (buffer-substring-no-properties start (point))))) +;; word)) + +(defun ess-use-eldoc () + "Does nothing. Defined not to break old users' code." + (interactive)) + +(provide 'ess-eldoc) + +;;; ess-eldoc.el ends here diff --git a/elpa/ess-20190121.1430/ess-mouse.el b/elpa/ess-20191014.1343/obsolete/ess-mouse.el similarity index 100% rename from elpa/ess-20190121.1430/ess-mouse.el rename to elpa/ess-20191014.1343/obsolete/ess-mouse.el diff --git a/elpa/ess-20191014.1343/obsolete/ess-noweb-font-lock-mode.el b/elpa/ess-20191014.1343/obsolete/ess-noweb-font-lock-mode.el new file mode 100644 index 00000000..b9ebfbca --- /dev/null +++ b/elpa/ess-20191014.1343/obsolete/ess-noweb-font-lock-mode.el @@ -0,0 +1,392 @@ +;;; 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 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 --git a/elpa/ess-20191014.1343/obsolete/ess-noweb-mode.el b/elpa/ess-20191014.1343/obsolete/ess-noweb-mode.el new file mode 100644 index 00000000..392693c9 --- /dev/null +++ b/elpa/ess-20191014.1343/obsolete/ess-noweb-mode.el @@ -0,0 +1,1938 @@ +;;; 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) + +(defcustom Rnw-mode-hook nil + "Hook run when entering Rnw mode." + :type 'hook + :group 'ess-R) + +(defvar-local ess--make-local-vars-permanent nil + "If this variable is non-nil in a buffer make all variable permannet. +Used in noweb modes.") +(put 'ess--make-local-vars-permanent 'permanent-local t) + +(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-local ess--make-local-vars-permanent nil + "If this variable is non-nil in a buffer make all variable permannet. +Used in noweb modes.") +(put 'ess--make-local-vars-permanent 'permanent-local t) + +(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 + +(defvar ess-version) +(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))) + (pop-to-buffer-same-window (get-buffer-create "*noweb-log*")) + (goto-char (point-max)) + (setq buffer-read-only nil) + (insert s) + (setq buffer-read-only t) + (pop-to-buffer-same-window 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 + +;;;###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)) + +(fset 'Snw-mode 'Rnw-mode); just a synonym (for now or ever) + +;;;###autoload +(add-to-list 'auto-mode-alist '("\\.[rR]nw\\'" . Rnw-mode)) +;;;###autoload +(add-to-list 'auto-mode-alist '("\\.[sS]nw\\'" . Snw-mode)) + + +;;; 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 --git a/elpa/ess-20191014.1343/obsolete/ess-noweb.el b/elpa/ess-20191014.1343/obsolete/ess-noweb.el new file mode 100644 index 00000000..23744dcf --- /dev/null +++ b/elpa/ess-20191014.1343/obsolete/ess-noweb.el @@ -0,0 +1,138 @@ +;;; 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-noweb-create-tangle-buffer (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)) + +(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-noweb-create-tangle-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-noweb-create-tangle-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 --git a/elpa/ess-20190121.1430/ess-r-a.el b/elpa/ess-20191014.1343/obsolete/ess-r-a.el similarity index 92% rename from elpa/ess-20190121.1430/ess-r-a.el rename to elpa/ess-20191014.1343/obsolete/ess-r-a.el index 02fdadce..ccd958f1 100644 --- a/elpa/ess-20190121.1430/ess-r-a.el +++ b/elpa/ess-20191014.1343/obsolete/ess-r-a.el @@ -1,4 +1,4 @@ -;;; ess-r-a.el -- Possible local customizations for R with ESS. +;;; ess-r-a.el -- Possible local customizations for R with ESS. -*- lexical-binding: t; -*- ;; Copyright (C) 1997--2005 A.J. Rossini, Richard M. Heiberger, Martin ;; Maechler, Kurt Hornik, Rodney Sparapani, and Stephen Eglen. @@ -49,8 +49,8 @@ (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." +(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 @@ -85,9 +85,10 @@ (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." + "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")) diff --git a/elpa/ess-20191014.1343/obsolete/ess-r-args.el b/elpa/ess-20191014.1343/obsolete/ess-r-args.el new file mode 100644 index 00000000..207ad998 --- /dev/null +++ b/elpa/ess-20191014.1343/obsolete/ess-r-args.el @@ -0,0 +1,354 @@ +;;; 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-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))) + +(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 --git a/elpa/ess-20191014.1343/obsolete/ess-rutils.el b/elpa/ess-20191014.1343/obsolete/ess-rutils.el new file mode 100644 index 00000000..82813e26 --- /dev/null +++ b/elpa/ess-20191014.1343/obsolete/ess-rutils.el @@ -0,0 +1,41 @@ +;;; ess-rutils.el --- Convenience features for package and object control. -*- lexical-binding: t; -*- + +;; Author: J. Alexander Branham +;; Maintainer: ESS-Core +;; Keywords: processes + +;; Copyright (c) 2019 Free Software Foundation +;; Copyright (c) 2013-2019 ESS Core +;; 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 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 . + +;;; History: + +;; This file was originally written by Sebastian Luque in 2004. It was +;; completely rewritten in 2019 and then merged into ess-r-mode as +;; part of contributing ESS to GNU Emacs. + +;;; Commentary: + +;; This file used to have support for listing packages and a few other +;; misc functions. That is now in ess-r-mode. This file is provided +;; only so that users who have (require 'ess-rutils) in their init +;; files don't encounter errors when they update ESS. + +;;; Code: + +(provide 'ess-rutils) + +;;; ess-rutils.el ends here diff --git a/elpa/ess-20191014.1343/obsolete/ess-swv.el b/elpa/ess-20191014.1343/obsolete/ess-swv.el new file mode 100644 index 00000000..e54f6db0 --- /dev/null +++ b/elpa/ess-20191014.1343/obsolete/ess-swv.el @@ -0,0 +1,491 @@ +;;; 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") + +(defgroup ess-sweave nil + "Mode for editing Sweave (*.[SR]nw) files." + :group 'ess-S + :prefix "ess-") + +(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"))) + +(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)) + +(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))) + +(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) + (pop-to-buffer-same-window rnw-buf) + (display-buffer (buffer-name sbuffer))))))) + +(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")) + +;; 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)) + +(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 "%s" (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 --git a/elpa/ess-20190121.1430/mouseme.el b/elpa/ess-20191014.1343/obsolete/mouseme.el similarity index 100% rename from elpa/ess-20190121.1430/mouseme.el rename to elpa/ess-20191014.1343/obsolete/mouseme.el diff --git a/elpa/ess-20191014.1343/obsolete/msdos.el b/elpa/ess-20191014.1343/obsolete/msdos.el new file mode 100644 index 00000000..c76fdbe5 --- /dev/null +++ b/elpa/ess-20191014.1343/obsolete/msdos.el @@ -0,0 +1,169 @@ +;;; 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. + +;; Author: Richard M. Heiberger +;; Created: February 1999 +;; Maintainer: ESS-core + +;; Keywords: processes + +;; This file is part of ESS. + +;; This file is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation; either version 2, or (at your option) +;; any later version. + +;; This file is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; A copy of the GNU General Public License is available at +;; http://www.r-project.org/Licenses/ + +;;; Commentary: + +;; The 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 +;; shell currently misses. The function M-x msdos-minor-mode could be +;; automatically run by emacs in shell-mode in that case. + +;; 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. + +;; 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 + +;;; Customization and Buffer Variables + +(defcustom explicit-msdos-shell-file-name "cmdproxy.exe" + "*If non-nil, is file name to use for explicitly requested msdos +inferior shell." + :type '(choice (const :tag "None" nil) file) + :group 'shell) + +(defcustom explicit-msdos-comspec-file-name + (if (w32-using-nt) + "cmd.exe" + "command.com") + "*If non-nil, is file name to use for explicitly requested COMSPEC +environment variable." + :type '(choice (const :tag "None" nil) file) + :group 'shell) + +(defvar-local msdos-minor-mode nil + "Non-nil if using msdos-minor mode as a minor mode of some other mode.") + +(defun msdos () + "Run an inferior msdos shell, with I/O through buffer *msdos*. +This function is intended to be used in an Ntemacs session in which +bash is the primary shell. But sometimes an MSDOS window, within emacs, +is also needed. + +If buffer exists but shell process is not running, make new shell. +If buffer exists and shell process is running, just switch to buffer `*msdos*'. +Program used comes from variable `explicit-msdos-shell-file-name'. +If a file `~/.emacs_SHELLNAME' exists, it is given as initial input + (Note that this may lose due to a timing error if the shell + discards input when it starts up.) +The buffer is put in Shell mode, giving commands for sending input +and controlling the subjobs of the shell. See `shell-mode'. +See also the variable `shell-prompt-pattern'. + +The buffer is put into \\[msdos-minor-mode]. See `msdos-minor-mode'. + +The COMSPEC environment variable in the inferior shell, but not in the emacs +process, is set to `explicit-msdos-comspec-file-name'. +The SHELL environment variable in the inferior shell, but not in the emacs +process, is set to `explicit-msdos-shell-file-name'. + +The shell file name (sans directories) is used to make a symbol name +such as `explicit-csh-args'. If that symbol is a variable, +its value is used as a list of arguments when invoking the shell. + +\(Type \\[describe-mode] in the shell buffer for a list of commands.)" + (interactive) + (if (not (comint-check-proc "*msdos*")) + (let* ((prog explicit-msdos-shell-file-name) + (name (file-name-nondirectory prog)) + (startfile (concat "~/.emacs_" name)) + (xargs-name (intern-soft (concat "explicit-" name "-args"))) + shell-buffer + (comspec (getenv "COMSPEC")) + (shell (getenv "SHELL")) + ) + (save-excursion + (setenv "COMSPEC" explicit-msdos-comspec-file-name) + (setenv "SHELL" explicit-msdos-shell-file-name) + (set-buffer (apply 'make-comint "msdos" prog + (if (and xargs-name (boundp xargs-name)) + (symbol-value xargs-name)) + (if (file-exists-p startfile) + (concat "/k " startfile)))) + (setenv "COMSPEC" comspec) + (setenv "SHELL" shell) + (setq shell-buffer (current-buffer)) + (shell-mode) + (msdos-minor-mode) + (sleep-for 4) ; need to wait, else working too fast! + ;;; The `exit' warning should precede the "c:\" prompt. + ;;; If not, then increase the sleep-for time! + (goto-char (point-min)) + (insert + "Remember to exit this buffer with `exit'. If you kill the +buffer without exiting, you may not be able to shut down Windows cleanly.") + (goto-char (point-max))) + (pop-to-buffer shell-buffer)) + (pop-to-buffer "*msdos*"))) + + +(defun msdos-minor-mode () + "Minor mode for running msdos in a shell-mode buffer: +a. Uses \\[set-buffer-process-coding-system] to set the coding system +to `'raw-text-dos'. The DOS C-m C-l end-of-line is critical. The +shell freezes without it. + +b. The variable `comint-completion-addsuffix' is set to `\\' for directories. + +c. Prevents echoing of commands. + +d. strips ctrl-m from output. +" + (interactive) + (setq msdos-minor-mode t) + (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-process-coding-system (get-buffer-process (current-buffer)) 'raw-text-dos 'raw-text-dos) + ;; buffer-process-coding-system is critical. + ) + +;; Install ourselves: + + +(put 'msdos-minor-mode 'permanent-local t) +(or (assq 'msdos-minor-mode minor-mode-alist) + (setq minor-mode-alist + (append minor-mode-alist + (list '(msdos-minor-mode " msdos"))))) + +;; Provide ourselves: + +(provide 'msdos) + +;;; msdos.el ends here diff --git a/elpa/ess-20190121.1430/onews.info b/elpa/ess-20191014.1343/onews.info similarity index 99% rename from elpa/ess-20190121.1430/onews.info rename to elpa/ess-20191014.1343/onews.info index 2a5a0bc5..f7c08421 100644 --- a/elpa/ess-20190121.1430/onews.info +++ b/elpa/ess-20191014.1343/onews.info @@ -153,8 +153,8 @@ Changes and New Features in 15.09: 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[R]: 'head' and 'tail' methods were replaced by '.ess_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 diff --git a/elpa/ess-20190121.1430/readme.info b/elpa/ess-20191014.1343/readme.info similarity index 90% rename from elpa/ess-20190121.1430/readme.info rename to elpa/ess-20191014.1343/readme.info index ddcb57d7..589dcea9 100644 --- a/elpa/ess-20190121.1430/readme.info +++ b/elpa/ess-20191014.1343/readme.info @@ -9,11 +9,11 @@ File: readme.info, Node: General Information This is the README file for the distribution of ESS version 18.10.3snapshot - 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. + 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 consistent union of their +features in one package. Installation instructions are provided in sections for both Unix and Windows; see below. @@ -122,7 +122,7 @@ 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 +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. @@ -252,12 +252,28 @@ File: readme.info, Node: New Features, Next: Reporting Bugs, Prev: Current Fe Changes and New Features in 19.04 (unreleased): + * ESS[R]: There is a new menu entry for reloading the R process. It + is otherwise bound to 'C-c C-e C-r'. Reloading now reuses the same + process name and start arguments that were used to start the + process. + + * 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 + 'with-current-buffer' with the return value of the inferior. + + * iESS[SAS]: The SAS keymap was only set in iESS buffers called + '*SAS*'. This is now fixed. + + * ESS[R]: Fixed longstanding indentation issues involving '::' and + ':::' operators. + * 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. - * Activate 'goto-address-mode' for url and emal highlighting in + * Activate 'goto-address-mode' for url and email highlighting in inferior buffers. * 'smart-underscore' and 'ess-smart-S-assign-key' have been removed. @@ -275,8 +291,8 @@ Changes and New Features in 19.04 (unreleased): * 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 docstring for details. 'ess-auto-width-visible' - controls visibility. + integer. See the documentation for details. + 'ess-auto-width-visible' controls visibility. * ESS now respects 'display-buffer-alist'. Users can now use 'display-buffer-alist' to manage how and where windows appear. See @@ -302,6 +318,10 @@ Changes and New Features in 19.04 (unreleased): suggests, these now rely on project.el (included with Emacs) rather than projectile.el, which is a third-party package. + * ESS[R]: devtools commands ask about saving modified buffers before + running. Users can disable the questioning with + 'ess-save-silently'. + * ESS[R] help pages now provide links to other help topics. This is similar with what you would see with, for example 'options(help_type = ``html'')' but works with the plain-text @@ -312,6 +332,17 @@ Changes and New Features in 19.04 (unreleased): should look better and be a bit faster overall. The size column now displays object sizes in bytes. + * 'ess-rdired' buffers now auto-update. The frequency is governed by + the new option 'ess-rdired-auto-update-interval'. + + * ESS[R]: 'electric-layout-mode' is now supported. This + automatically inserts a newline after an opening curly brace in R + buffers. To enable it, customize 'ess-r-mode-hook'. + + * ESS[R]: imenu now supports assignment with the equals sign. + + * ESS[Rd]: Rd no longer writes abbrevs to user's abbrev file. + * ESS removed support for many unused languages. This includes old versions of S+, ARC, OMG, VST, and XLS. @@ -326,11 +357,18 @@ documentation for more detail: , or markdown-mode with edit-indirect . + * Support for 'auto-complete' is obsolete. The 'auto-complete' + package is unmaintained and so ESS support is now obsolete. Users + are encouraged to switch to 'company-mode' instead. + * User options for controlling display of buffers. This includes 'ess-show-buffer-action', 'inferior-ess-same-window', 'inferior-ess-own-frame', and 'inferior-ess-frame-alist'. See above about ESS respecting 'display-buffer-alist'. + * Variables 'ess-tab-always-indent' and 'ess-tab-complete-in-script'. + Use the Emacs-wide setting of 'tab-always-indent' instead. + * '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 @@ -429,7 +467,7 @@ documentation for more detail: * '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 + '_'. For instance if you bind it to ';', repeated invocations cycle through between assignment and inserting ';'. * 'C-c C-=' is now bound to 'ess-cycle-assign' by default. See the @@ -466,7 +504,7 @@ documentation for more detail: * 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. + where 'in' is a common 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' @@ -514,7 +552,7 @@ documentation for more detail: 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 + '_' for inserting 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. @@ -523,7 +561,7 @@ documentation for more detail: Changes and New Features in 17.11: - * The ESS initialisation process has been streamlined. You can now + * The ESS initialization 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 @@ -556,9 +594,9 @@ documentation for more detail: * 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 + identifiers). Furthermore they are now correctly recognized when they are function definitions or function calls. - * ESS[R]: Backquoted names and '%op%' operators are recognised as + * ESS[R]: Backquoted names and '%op%' operators are recognized 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. @@ -661,7 +699,7 @@ 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. + * discussing aspects of using ESS. * suggestions for improvements. * announcements of new releases of ESS. * posting small patches to ESS. @@ -688,17 +726,17 @@ File: readme.info, Node: Authors, Prev: Mailing Lists, Up: General Informatio  Tag Table: Node: General Information73 -Node: License1719 -Node: Installation2389 -Node: Installing from a third-party repository3306 -Node: Installing from source4256 -Node: Activating and Loading ESS5851 -Node: Check Installation6928 -Node: Starting up7151 -Node: Current Features7534 -Node: New Features9084 -Node: Reporting Bugs26988 -Node: Mailing Lists27886 -Node: Authors28622 +Node: License1711 +Node: Installation2381 +Node: Installing from a third-party repository3298 +Node: Installing from source4248 +Node: Activating and Loading ESS5843 +Node: Check Installation6920 +Node: Starting up7143 +Node: Current Features7526 +Node: New Features9076 +Node: Reporting Bugs28610 +Node: Mailing Lists29508 +Node: Authors30224  End Tag Table diff --git a/elpa/ess-20190121.1430/requires.info b/elpa/ess-20191014.1343/requires.info similarity index 100% rename from elpa/ess-20190121.1430/requires.info rename to elpa/ess-20191014.1343/requires.info -- 2.47.3