pkg update and first config fix

org-brain not working, add org-roam
This commit is contained in:
2022-12-19 23:02:34 +01:00
parent 02b3e07185
commit 82f05baffe
885 changed files with 356098 additions and 36993 deletions

View File

@@ -52,20 +52,20 @@
"Method used by `ess-bugs-batch'.
The default is based on the value of the Emacs variable `system-type'
and, on Windows machines, the function `w32-shell-dos-semantics'.
'sh if *shell* runs a Bourne-like or a C-like Unix shell
'dos if *shell* runs a DOS-like Windows shell
\\='sh if *shell* runs a Bourne-like or a C-like Unix shell
\\='dos if *shell* runs a DOS-like Windows shell
Unix users will get 'sh by default.
Unix users will get \\='sh by default.
Windows users running a DOS-like *shell* will get 'dos by default,
while those running a Unix-like *shell* will get 'sh by default.
Windows users running a DOS-like *shell* will get \\='dos by default,
while those running a Unix-like *shell* will get \\='sh by default.
Users whose default is not 'sh, but are accessing a remote machine with
Users whose default is not \\='sh, but are accessing a remote machine with
`telnet' or `ssh', should have the following in their init file:
(setq-default ess-bugs-batch-method 'sh)"
(setq-default ess-bugs-batch-method \\='sh)"
:group 'ess-bugs
:type '(choice (const 'sh :tag "Bourne/C-like Unix Shell")
(const 'dos :tag "DOS-like Windows shell")))
:type '(choice (const sh :tag "Bourne/C-like Unix Shell")
(const dos :tag "DOS-like Windows shell")))
(defcustom ess-bugs-batch-post-command
(if (equal ess-bugs-batch-method 'sh) "&" " ")

View File

@@ -196,11 +196,11 @@ lot."
(defcustom ess-auto-width nil
"When non-nil, set the width option when the window configuration changes.
When 'frame, set the width to the frame width. When 'window, set
When \\='frame, set the width to the frame width. When \\='window, set
the width to the window width. If an integer, set the width to
that integer. If it's a negative integer, set the width to the
window's width minus that number. Anything else is treated as
'window."
\\='window."
:group 'ess
:type '(choice (const :tag "Do nothing" :value nil)
(const :tag "Frame width" :value frame)
@@ -232,7 +232,7 @@ These are available for call by function `ess-handy-commands' and
(defcustom ess-describe-at-point-method nil
"Whether `ess-describe-object-at-point' should use a tooltip.
If nil display in an electric buffer. If 'tooltip display in
If nil display in an electric buffer. If \\='tooltip display in
a tooltip.
See also `tooltip-hide-delay' and variable `tooltip-delay'."
@@ -286,7 +286,9 @@ See also `ess-blink-delay'"
:type 'number)
(defcustom ess-ask-for-ess-directory t
"Non-nil means request the process directory each time S is run."
"When non-nil ask the process directory when ESS process starts.
When set to nil, and the process is invoked with an universal
argument, the directory is prompted for."
:group 'ess
:type 'boolean)
@@ -311,26 +313,41 @@ This, plus `ess-language', should be able to determine the exact
version of the statistical package being executed in the particular
buffer.")
(defcustom ess-directory-function nil
(defvaralias 'ess-directory-function 'ess-startup-directory-function)
(defcustom ess-startup-directory-function nil
"Function to return the directory that ESS is run from.
If nil or if the function returns nil then you get `ess-startup-directory'."
:group 'ess
:type '(choice (const nil) function))
(defcustom ess-setup-directory-function nil
"Function to setup the directory that ESS is run from.
This function can be called to set environment variables or to create
a workspace."
Value of `ess-startup-directory' has precedence over this function."
:group 'ess
:type '(choice (const nil) function))
(defvaralias 'ess-directory 'ess-startup-directory)
(defcustom ess-startup-directory nil
"The directory ESS is run from. It must end in a slash.
Provided as a default if `ess-ask-for-ess-directory' is non-nil.
A nil value means use the current buffer's default directory."
"The directory to run ESS processes from.
If a string it should bi a directory from which to start the
process. If a symbol, the symbol's value should be a directory.
For example, the following setting would always start the process
in the directory of the current file:
(setq ess-startup-directory 'default-directory)
If `ess-startup-directory' is nil (the default) and
`ess-startup-directory-function' is non-nil, the value returned
by `ess-startup-directory-function' is used as a directory.
If `ess-startup-directory-function' is nil, then the current
project as returned by `project-current' is used. For files which
mark an R project see `ess-r-project'. For example you can add
.Rprofile to a sub-directory of a project to mark it as R
sub-project.
Finally, if not in a project (`project-current' returned nil) the
`default-directory' is used. It is normally the directory of the
current file.
See also `ess-ask-for-ess-directory'."
:group 'ess
:type '(choice (const nil) directory))
:type '(choice (const nil) directory symbol))
(defcustom ess-history-directory nil
@@ -394,16 +411,16 @@ See also `ess-first-tab-never-complete'."
'ess-first-tab-never-complete "ESS 19.04")
(defcustom ess-first-tab-never-complete 'symbol
"If t, first TAB never tries to complete in `ess-mode'.
If 'symbol first TAB doesn't try to complete if next char is a
If \\='symbol first TAB doesn't try to complete if next char is a
valid symbol constituent.
If 'symbol-or-paren don't complete if next char is closed paren
If \\='symbol-or-paren don't complete if next char is closed paren
)}] or symbol character.
If 'symbol-or-paren-or-punct don't complete if next char is
If \\='symbol-or-paren-or-punct don't complete if next char is
punctuation +-=% etc, or closed paren or symbol.
If 'unless-eol - first TAB completes only at end of line.
If \\='unless-eol - first TAB completes only at end of line.
If nil first TAB always tries to complete (this might be too
aggressive and dangerous)."
@@ -417,7 +434,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
@@ -444,7 +461,7 @@ A symbol which can be
- aggressive (or t): Try strong + truncate the doc string to fit
into minibuffer.
The default style is 'normal.
The default style is \\='normal.
Ess-eldoc also honors the value of
`eldoc-echo-area-use-multiline-p'. If this variable is not t (the
@@ -456,7 +473,7 @@ truncation."
(defcustom ess-use-flymake t
"If non-nil activate flymake in `ess-mode' buffers.
If 'process, only check if the buffer has an inferior process."
If \\='process, only check if the buffer has an inferior process."
:group 'ess
:type '(choice (const :tag "Always" t)
(const :tag "With running inferior process" process)
@@ -466,7 +483,7 @@ If 'process, only check if the buffer has an inferior process."
(defcustom ess-use-auto-complete t
"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'
`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
@@ -484,7 +501,7 @@ to install your custom sources."
(defcustom ess-use-company t
"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)))
@@ -587,10 +604,10 @@ 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."
:group 'ess-edit
:type '(choice (const :tag "Check" :value 'check)
(const :tag "Ask" :value 'ask)
(const :tag "Always keep" :value t)
(const :tag "Always delete" :value nil)))
:type '(choice (const :tag "Check" :value check)
(const :tag "Ask" :value ask)
(const :tag "Always keep" :value t)
(const :tag "Always delete" :value nil)))
(defcustom ess-delete-dump-files nil
"Non-nil means delete dump files after they are created.
@@ -726,7 +743,7 @@ set refill styles."
(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
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
@@ -891,21 +908,21 @@ for other offsets controlling indentation.")
"This setting controls indentation of continued statements.
That is, consecutive statements separated by operators.
When set to 'straight, continued statements are indented as follows:
When set to \\='straight, continued statements are indented as follows:
object %>%
some_function() %>%
other_function()
When set to 'cascade:
When set to \\='cascade:
object %>%
some_function() %>%
other_function()
The 'straight and 'cascade settings are actually equivalent to
'(straight . t) and '(cascade . t), where t represents the
base indent size. More generally, you can supply '(straight . N)
The \\='straight and \\='cascade settings are actually equivalent to
\\='(straight . t) and \\='(cascade . t), where t represents the
base indent size. More generally, you can supply \\='(straight . N)
to control the size of indentation.
See `ess-style-alist' for for an overview of ESS indentation.")
@@ -922,7 +939,7 @@ indented like this:
See `ess-style-alist' for for an overview of ESS indentation.")
(defvar ess-align-arguments-in-calls '("function[ \t]*(")
"A list of refexes where `ess-offset-arguments' is ignored.
"A list of regexes 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.
@@ -1556,8 +1573,8 @@ This variable is deprecated.
please add an entry to `display-buffer-alist' instead. See Info
node `(ess)Customizing startup'. For example:
\(add-to-list 'display-buffer-alist
'(\"*R\"
\(add-to-list \\='display-buffer-alist
\\='(\"*R\"
(display-buffer-reuse-window display-buffer-pop-up-frame)))")
(make-obsolete-variable 'inferior-ess-own-frame 'display-buffer-alist "ESS 19.04")
(make-obsolete-variable 'inferior-ess-frame-alist "It is ignored. Use `display-buffer-alist' and `pop-up-frame-alist' instead." "ESS 19.04")
@@ -1611,7 +1628,7 @@ Used in e.g., \\[ess-execute-objects] or \\[ess-display-help-on-object]."
(defvar ess-setwd-command nil
"Command string to set working directory.
Should contain a formatting %s to be replaced by a
path (as in 'setwd(%s)\\n'.")
path (as in `setwd(%s)\\n'.")
(defcustom ess-program-files ;; 32 bit version
(if (and ess-microsoft-p
@@ -1682,7 +1699,7 @@ file."
(defvaralias 'S+6-dialect-name 'S+-dialect-name)
(defcustom S+-dialect-name "S+"
"Name of 'dialect' for S-PLUS 6.x and later.
"Name of `dialect' for S-PLUS 6.x and later.
Easily changeable in a user's `.emacs'."
:group 'ess-SPLUS
:type 'string)
@@ -1736,24 +1753,24 @@ ask - ask the user whether the S buffers should be killed."
(defvaralias 'R-editor 'ess-r-editor)
(defcustom ess-r-editor "emacsclient"
"Editor called by R process with 'edit()' command."
"Editor called by R process with `edit()' command."
:group 'ess
:type 'string)
(defvaralias 'R-pager 'ess-r-pager)
(defcustom ess-r-pager 'nil ; Usually nil is correct as ESS and page() cooperate.
"Pager called by R process with 'page()' command."
"Pager called by R process with `page()' command."
:group 'ess
:type '(choice (const nil) string))
(defcustom S-editor "emacsclient"
"Editor called by S process with 'edit()' command."
"Editor called by S process with `edit()' command."
:group 'ess
:type 'string)
(defcustom S-pager
(if ess-microsoft-p "emacsclientw.exe" "emacsclient")
"Pager called by S process with 'page()' command."
"Pager called by S process with `page()' command."
:group 'ess
:type 'string)
@@ -1822,7 +1839,7 @@ Otherwise, they get their own temporary buffer."
(defcustom ess-eval-visibly 'nowait
"Non-nil means ess-eval- commands display commands in the process buffer.
If 'nowait, ESS shows input commands in the process buffer, but
If \\='nowait, ESS shows input commands in the process buffer, but
doesn't wait for the process. Thus all the output is printed
after the input lines.
@@ -1870,7 +1887,7 @@ Each symbol must evaluate to one of the standard mode line
objects. See info node `(elisp)Mode Line Data'). Add a symbol
with `add-to-list' and remove with `delq'. Note that the symbols
which are part of this list should better have
'risky-local-variable property set to t, otherwise the text
\\='risky-local-variable property set to t, otherwise the text
properties are not displayed.
External utilities such as `ess-tracebug' and `ess-developer'
@@ -1948,7 +1965,7 @@ Really set in <ess-lang>-customize-alist in ess[dl]-*.el")
"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'."
frame, but in R also e.g., `package:stats'."
:group 'ess-command
:type 'string)
@@ -2273,7 +2290,7 @@ the help window."
Possible values are:
nil: Display help in current frame.
'one: All help buffers are shown in one dedicated frame.
\\='one: All help buffers are shown in one dedicated frame.
t: Each help buffer gets its own frame.
If this is non-nil,`ess-help-reuse-window' is ignored. The
@@ -2465,9 +2482,6 @@ Used to store the values for passing on to newly created buffers.")
(defvar-local ess-listing-minor-mode nil
"Non-nil if using `ess-listing-minor-mode'.")
(defvar ess--enable-experimental-projects nil
"Enable experimental project support in ESS.")
(defvar ess-STERM nil
"Placeholder for dialect-specific STERM.")

View File

@@ -522,7 +522,7 @@ end keywords as associated values.")
;;;###autoload
(defun gretl (&optional start-args)
"Call 'gretl',
"Call `gretl',
Optional prefix (C-u) allows to set command line arguments, such as
--vsize. This should be OS agnostic.
If you have certain command line arguments that should always be passed

View File

@@ -271,7 +271,8 @@ TITLE of the help page,
HELP-TYPE to be stored in `ess-help-type' local variable,
ACTION is a function with no argument (default is `ess--button-action'),
HELP-ECHO if given becomes the help-echo property of the button,
REG-START gives the start location from where to search linkifying, and HELP-OBJECT becomes `ess-help-object'."
REG-START gives the start location from where to search linkifying,
and HELP-OBJECT becomes `ess-help-object'."
(let ((inhibit-modification-hooks t)
(alist ess-local-customize-alist)
(pname ess-local-process-name)
@@ -329,7 +330,7 @@ REG-START gives the start location from where to search linkifying, and HELP-OBJ
(ess--display-indexed-help-page
(format com pattern) regexp
(format "*ess-apropos[%s](%s)*" ess-current-process-name pattern)
'appropos)))
'apropos)))
(defun ess-display-demos ()
"Create an ess-demos buffer with a *linked* list of available demos."
@@ -739,11 +740,11 @@ If region is active use it instead of the object at point.
This is an electric command (`ess--execute-electric-command'),
which means that you can use the last key to cycle through the
action set (in this case `C-e'). After invocation of this command
all standard Emacs commands, except those containing 'window' in
all standard Emacs commands, except those containing `window' in
their names, remove the electric *ess-describe* buffer. Use
`other-window' to switch to *ess-describe* window.
Customize `ess-describe-at-point-method' if you wan to display
Customize `ess-describe-at-point-method' if you want to display
the description in a tooltip. See also
`ess-r-describe-object-at-point-commands' (and similar option for
other dialects)."

View File

@@ -1,6 +1,6 @@
;;; ess-inf.el --- Support for running S as an inferior Emacs process -*- lexical-binding: t; -*-
;; Copyright (C) 1989-2020 Free Software Foundation, Inc.
;; Copyright (C) 1989-2022 Free Software Foundation, Inc.
;; Author: David Smith <dsmith@stats.adelaide.edu.au>
;; Created: 7 Jan 1994
@@ -169,9 +169,7 @@ This may be useful for debugging."
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))
(proc-name (buffer-local-value 'ess-local-process-name inf-buf)))
(with-current-buffer inf-buf
;; TODO: Get rid of this, we should rely on modes to set the
;; variables they need.
@@ -179,7 +177,8 @@ This may be useful for debugging."
(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 default-directory
(inferior-ess--maybe-prompt-startup-directory proc-name temp-dialect))
(setq inferior-ess--local-data (cons inferior-ess-program start-args))
;; Read the history file
(when ess-history-file
@@ -204,7 +203,7 @@ This may be useful for debugging."
(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))
(ess-set-working-directory default-directory))
(setq-local font-lock-fontify-region-function #'inferior-ess-fontify-region)
(setq-local ess-sl-modtime-alist nil)
(run-hooks 'ess-post-run-hook)
@@ -395,7 +394,7 @@ Return non-nil if the process is in a ready (not busy) state."
;; When "\n" inserted from inferior-ess-available-p, delete the prompt.
(when (and ready
(process-get proc 'availability-check)
(string-match-p (concat "^" inferior-ess-primary-prompt "\\'") string))
(string-match-p (concat inferior-ess-primary-prompt "\\'") string))
(process-put proc 'suppress-next-output? t))
(process-put proc 'availability-check nil)
(when ready
@@ -513,7 +512,7 @@ inserted in the process buffer instead of the command buffer."
(error (message "%s" (error-message-string err))))))))
(defun ess--if-verbose-write-process-state (proc string &optional filter)
"Write informaiton about PROC, STRING, and FILTER to the dribble buffer."
"Write information about PROC, STRING, and FILTER to the dribble buffer."
(ess-if-verbose-write
(format "\n%s:
--> busy:%s busy-end:%s sec-prompt:%s interruptable:%s <--
@@ -621,29 +620,25 @@ process-less buffer because it was created with
;;*;; Requester functions called at startup
;; FIXME EMACS 25.1:
;; Deprecate `ess-directory-function' in favor of `project-find-functions'?
(defun inferior-ess--get-startup-directory ()
"Return a startup directory."
(let ((dir (or (and ess--enable-experimental-projects
(fboundp 'project-current)
(cdr (project-current)))
(and ess-directory-function
(funcall ess-directory-function))
ess-startup-directory
(let ((dir (or (when (boundp 'ess-startup-directory)
(if (symbolp ess-startup-directory)
(symbol-value ess-startup-directory)
ess-startup-directory))
(and ess-startup-directory-function
(funcall ess-startup-directory-function))
(when-let ((proj (project-current)))
(ess--project-root proj))
default-directory)))
(directory-file-name dir)))
(defun inferior-ess--maybe-prompt-startup-directory (procname dialect)
(defun inferior-ess--maybe-prompt-startup-directory (procname _dialect)
"Possibly prompt for a startup directory.
When `ess-ask-for-ess-directory' is non-nil, prompt. PROCNAME is
the name of the inferior process (e.g. \"R:1\"), and DIALECT is
the language dialect (e.g. \"R\")."
(let ((default-dir (if (fboundp 'inferior-ess-r--adjust-startup-directory)
(inferior-ess-r--adjust-startup-directory
(inferior-ess--get-startup-directory) dialect)
(inferior-ess--get-startup-directory))))
(let ((default-dir (inferior-ess--get-startup-directory)))
(if ess-ask-for-ess-directory
(let ((prompt (format "%s starting project directory? " procname)))
(ess-prompt-for-directory default-dir prompt))
@@ -661,18 +656,6 @@ the language dialect (e.g. \"R\")."
;;*;; General process handling code
(defmacro with-ess-process-buffer (no-error &rest body)
"Execute BODY in the process buffer of `ess-current-process-name'.
If NO-ERROR is t don't trigger error when there is not current
process. Symbol *proc* is bound to the current process during the
evaluation of BODY."
(declare (indent 1) (debug t))
`(let ((*proc* (and ess-local-process-name (get-process ess-local-process-name))))
(if *proc*
(with-current-buffer (process-buffer *proc*)
,@body)
(unless ,no-error
(error "No current ESS process")))))
(defmacro ess-with-current-buffer (buffer &rest body)
"Like `with-current-buffer' but with transfer of some essential
@@ -1033,7 +1016,7 @@ and `ess-load-command', in that order."
(format ess-load-command file)))
(defun ess-wait-for-process (&optional proc sec-prompt wait force-redisplay timeout)
"Wait for 'busy property of the process to become nil.
"Wait for \\='busy property of the process to become nil.
If SEC-PROMPT is non-nil return if secondary prompt is detected
regardless of whether primary prompt was detected or not. If WAIT
is non-nil wait for WAIT seconds for process output before the
@@ -1071,32 +1054,33 @@ Returns nil if TIMEOUT was reached, non-nil otherwise."
(let* ((cmd-buf (process-get proc 'cmd-buffer))
(cmd-delim (process-get proc 'cmd-output-delimiter))
(early-exit t))
(unwind-protect
(progn
(with-current-buffer cmd-buf
(goto-char (point-max))
(insert string))
(when-let ((info (if cmd-delim
(ess--command-delimited-output-info cmd-buf cmd-delim)
(ess--command-output-info cmd-buf))))
(let ((new-output (ess--command-set-status proc cmd-buf info)))
(when (not (process-get proc 'busy))
;; Store new output until restoration
(when new-output
(process-put proc 'pending-output new-output))
;; Restore the user's process filter as soon as process is
;; available
(funcall (process-get proc 'cmd-restore-function))
;; Run callback with command output
(when (process-get proc 'callbacks)
(inferior-ess-run-callback proc (with-current-buffer cmd-buf
(buffer-string)))))))
(setq early-exit nil))
;; Be defensive when something goes wrong. Restore process to a
;; usable state.
(when early-exit
(process-put proc 'busy nil)
(funcall (process-get proc 'cmd-restore-function))))))
(when (buffer-live-p cmd-buf)
(unwind-protect
(progn
(with-current-buffer cmd-buf
(goto-char (point-max))
(insert string))
(when-let ((info (if cmd-delim
(ess--command-delimited-output-info cmd-buf cmd-delim)
(ess--command-output-info cmd-buf))))
(let ((new-output (ess--command-set-status proc cmd-buf info)))
(when (not (process-get proc 'busy))
;; Store new output until restoration
(when new-output
(process-put proc 'pending-output new-output))
;; Restore the user's process filter as soon as process is
;; available
(funcall (process-get proc 'cmd-restore-function))
;; Run callback with command output
(when (process-get proc 'callbacks)
(inferior-ess-run-callback proc (with-current-buffer cmd-buf
(buffer-string)))))))
(setq early-exit nil))
;; Be defensive when something goes wrong. Restore process to a
;; usable state.
(when early-exit
(process-put proc 'busy nil)
(funcall (process-get proc 'cmd-restore-function)))))))
(defvar ess-presend-filter-functions nil
"List of functions to call before sending the input string to the process.
@@ -1125,7 +1109,7 @@ process buffer is appended to the hook from the current buffer.")
;; also run proc buffer local hooks
(functions (unless (eq pbuf (current-buffer))
(buffer-local-value 'ess-presend-filter-functions pbuf))))
(setq functions (append (delq t (copy-sequence functions)) ;; even in let, delq distructs
(setq functions (append (delq t (copy-sequence functions)) ;; even in let, delq destructs
ess-presend-filter-functions))
(while (and functions string)
;; cannot use run-hook-with-args here because string must be passed from one
@@ -1189,8 +1173,8 @@ Hide all the junk output in temporary buffer."
"ESS wrapper for `process-send-string'.
Run `comint-input-filter-functions' and current buffer's and
PROCESS' `ess-presend-filter-functions' hooks on the input
STRING. VISIBLY can be nil, t, 'nowait or a string. If string
the behavior is as with 'nowait with the differences that
STRING. VISIBLY can be nil, t, \\='nowait or a string. If string
the behavior is as with \\='nowait with the differences that
inserted string is VISIBLY instead of STRING (evaluated command
is still STRING). In all other cases the behavior is as
described in `ess-eval-visibly'. STRING need not end with
@@ -1322,7 +1306,7 @@ All elements are optional.
(defvar ess--command-default-timeout most-positive-fixnum)
;; NOTE: We might want to switch to somethig like `cl-defun' with
;; NOTE: We might want to switch to something like `cl-defun' with
;; keyword arguments given the length of the signature. Would also
;; make it easier to deprecate arguments.
(defun ess-command (cmd &optional out-buffer _sleep no-prompt-check wait proc
@@ -1345,7 +1329,7 @@ seconds. The process is interrupted with `interrupt-process' when
the timeout is reached or when an error occurs.
PROC should be a process, if nil the process name is taken from
`ess-local-process-name'. This command doesn't set 'last-eval
`ess-local-process-name'. This command doesn't set \\='last-eval
process variable.
Note: for critical, or error prone code you should consider
@@ -1376,7 +1360,7 @@ wrapping the code into:
(unwind-protect
(progn
;; The process is restored from the filter once it's
;; available again (i.e. a prompt or delimeter is
;; available again (i.e. a prompt or delimiter is
;; detected). This handles the synchronous case when the
;; command runs to completion, as well as the
;; asynchronous case when an early exit occurs. The most
@@ -1433,7 +1417,7 @@ wrapping the code into:
(process-put proc 'cmd-output-delimiter nil)
(process-put proc 'cmd-buffer nil)
(when-let ((pending (process-get proc 'pending-output)))
(process-put proc 'pending nil)
(process-put proc 'pending-output nil)
(funcall old-pf proc pending)))))
;; TODO: Needs some Julia tests as well
@@ -1515,7 +1499,7 @@ of `ess-async-command' with an explicit interrupt-callback."
(defun ess-load-library ()
"Prompt and load dialect specific library/package/module.
Note that in R these are called 'packages' and the name of this
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."
@@ -1547,7 +1531,7 @@ arg EOB is non-nil, display ESS process buffer after evaluation.
If optional 4th arg EVEN-EMPTY is non-nil, also send empty
text (e.g. an empty line). If 5th arg WAIT-LAST-PROMPT is
non-nil, also wait for the prompt after the last line; if 6th arg
SLEEP-SEC is a number, ESS will call '(\\[sleep-for] SLEEP-SEC)
SLEEP-SEC is a number, ESS will call `(\\[sleep-for] SLEEP-SEC)'
at the end of this function. If the 7th arg WAIT-SEC is set, it
will be used instead of the default .001s and be passed to
\\[ess-wait-for-process].
@@ -1618,7 +1602,8 @@ they might throw off the debugger."
(ess-blink-region start end))
(goto-char end)
(skip-chars-backward "\n\t ")
(setq end (point))))
(setq end (point))
(cons start end)))
(defun ess-eval-region (start end vis &optional message type)
"Send the region from START to END to the inferior ESS process.
@@ -1645,15 +1630,17 @@ the lines of the rectangle separately to the inferior process."
(defun ess--eval-region (start end vis &optional message type)
"Helper function for `ess-eval-region', which see.
START, END, VIS, MESSAGE, and TYPE described there."
(ess-eval-region--normalise-region start end)
(let ((visibly (if vis (not ess-eval-visibly) ess-eval-visibly))
(message (or message "Eval region"))
(proc (ess-get-process)))
(save-excursion
(ess-send-region proc start end visibly message type)))
(when ess-eval-deactivate-mark
(ess-deactivate-mark))
(list start end))
(let* ((se (ess-eval-region--normalise-region start end))
(start (car se))
(end (cdr se)))
(let ((visibly (if vis (not ess-eval-visibly) ess-eval-visibly))
(message (or message "Eval region"))
(proc (ess-get-process)))
(save-excursion
(ess-send-region proc start end visibly message type)))
(when ess-eval-deactivate-mark
(ess-deactivate-mark))
(list start end)))
(defun ess-eval-buffer (&optional vis)
"Send the current buffer to the inferior ESS process.
@@ -1725,8 +1712,8 @@ Prefix arg VIS toggles visibility of ess-code as for `ess-eval-region'."
"Send the current function if \\[point] is inside one.
Otherwise send the current paragraph to the inferior ESS process.
Prefix arg VIS toggles visibility of ess-code as for
`ess-eval-region'. Returns 'function if a function was evaluated
or 'paragraph if a paragraph."
`ess-eval-region'. Returns \\='function if a function was evaluated
or \\='paragraph if a paragraph."
(interactive "P")
(condition-case nil
(progn (ess-eval-function vis)
@@ -2206,8 +2193,8 @@ A negative prefix argument gets the objects for that position
(ess-execute the-command invert "S objects" the-message)))
(defun ess-execute-search (invert)
"Send the `inferior-ess-search-list-command' command to the `ess-language' process.
[search(..) in S]"
"Send the `inferior-ess-search-list-command' command.
INVERT is as in `ess-execute'. E.g. search(..) in S."
(interactive "P")
(ess-execute inferior-ess-search-list-command invert "S search list"))
@@ -2242,8 +2229,9 @@ in `ess-r-post-run-hook' or `ess-S+-post-run-hook'."
(defun ess-calculate-width (opt)
"Calculate width command given OPT.
OPT can be 'window, 'frame, or an integer. Return a command
suitable to send to the inferior process (e.g. \"options(width=80, length=999999)\")."
OPT can be \\='window, \\='frame, or an integer. Return a command
suitable to send to the inferior process (e.g.
\"options(width=80, length=999999)\")."
(when (null ess-execute-screen-options-command)
(error "Not implemented for %s" ess-dialect))
(let (command)
@@ -2293,7 +2281,7 @@ buffers."
"Send a command to the ESS process.
A newline is automatically added to COMMAND. Prefix arg (or second arg
INVERT) means invert the meaning of
`ess-execute-in-process-buffer'. If INVERT is 'buffer, output is
`ess-execute-in-process-buffer'. If INVERT is \\='buffer, output is
forced to go to the process buffer. If the output is going to a
buffer, name it *BUFF*. This buffer is erased before use. Optional
fourth arg MESSAGE is text to print at the top of the buffer (defaults
@@ -2433,7 +2421,7 @@ START-ARGS gets passed to the dialect-specific
;; 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-function nil)
(ess-startup-directory (ess-get-process-variable 'default-directory))
(ess-ask-for-ess-directory nil))
(ess-quit 'no-save)
@@ -2502,7 +2490,7 @@ Returns nil if that file cannot be found, i.e., for R or any non-S language!"
(defun ess-get-object-list (name &optional exclude-first)
"Return a list of current S object names associated with process NAME.
Uses `ess-object-list' if that is non-nil. If EXCLUDE-FIRST is
non-nil, don't return objects in first positon (.GlobalEnv)."
non-nil, don't return objects in first position (.GlobalEnv)."
(or ess-object-list ;; <<- MM: this is now always(?) nil; we cache the *-modtime-alist
(with-current-buffer (process-buffer (ess-get-process name))
(ess-make-buffer-current)
@@ -2538,7 +2526,7 @@ Return the elements of the result of COMMAND as an alist of
strings. COMMAND should have a terminating newline.
NO-PROMPT-CHECK, WAIT, PROC, and TIMEOUT are passed to `ess-command'.
FILTER may be the keyword 'non-... or nil. To avoid truncation of
FILTER may be the keyword \\='non-... or nil. To avoid truncation of
long vectors, wrap your command (%s) like this, or a version with
explicit options(max.print=1e6): \"local({ out <- try({%s});
print(out, max=1e6) })\n\"."
@@ -2713,7 +2701,7 @@ directory in the `load-path'."
(setq ess-object-name-db temp-object-name-db)))
(defun ess-resynch nil
"Reread all directories/objects in variable `ess-search-list' to form completions."
"Reread all directories and objects in `ess-search-list' for completions."
(interactive)
(if (ess-make-buffer-current) nil
(error "Not an ESS process buffer"))
@@ -2854,7 +2842,7 @@ don't recompile first object in the search list."
(defun ess-search-path-tracker (str)
"Check if input STR changed the search path.
This function monitors user input to the inferior ESS process so
that Emacs can keep the process variable 'search-list' up to
that Emacs can keep the process variable `search-list' up to
date. `ess-completing-read' in \\[ess-read-object-name] uses this
list indirectly when it prompts for help or for an object to
dump. From ESS 12.09 this is not necessary anymore, as the search

View File

@@ -72,7 +72,7 @@ VISIBLY is not currently used."
(split-string (buffer-string) "\n"))
(ess-julia--get-objects proc)))
(defun ess-julia--retrive-topics (url)
(defun ess-julia--retrieve-topics (url)
(with-current-buffer (url-retrieve-synchronously url)
(require 'url)
(goto-char (point-min))
@@ -90,7 +90,7 @@ VISIBLY is not currently used."
"Look up topics at https://docs.julialang.org/en/latest/manual/."
(let* ((pages (or ess-julia--manual-topics
(setq ess-julia--manual-topics
(ess-julia--retrive-topics
(ess-julia--retrieve-topics
"https://docs.julialang.org/en/latest/"))))
(page (ess-completing-read "Lookup:" pages nil t)))
(browse-url (get-text-property 1 :manual page))))
@@ -118,14 +118,14 @@ See `comint-input-sender'."
;;; COMPLETION
(defun ess-julia-latexsub-completion ()
"Complete latex input, and return format required by `completion-at-point-functions'."
"Complete latex input in format required by `completion-at-point-functions'."
(if (julia-latexsub) ; julia-latexsub returns nil if it performed a completion, the point otherwise
nil
(lambda () t) ;; bypass other completion methods
))
(defun ess-julia-object-completion ()
"Return completions at point in a format required by `completion-at-point-functions'."
"Return completions in format required by `completion-at-point-functions'."
(let ((proc (ess-get-next-available-process ess-dialect t))
(beg (ess-symbol-start)))
(if proc
@@ -155,7 +155,7 @@ See `comint-input-sender'."
(defun ess-julia--get-objects (&optional proc obj)
"Return all available objects.
Local caching might be used. If MODULE is givven, return only
Local caching might be used. If MODULE is given, return only
objects from that MODULE."
(setq proc (or proc (ess-get-process)))
(when (stringp proc)
@@ -170,7 +170,7 @@ objects from that MODULE."
(or (cdr (assoc obj objects))
;; don't cache composite objects and datatypes
(ess-julia--get-components proc obj))
;; this segment is entered when user completon at top level is
;; this segment is entered when user completion at top level is
;; requested, either Tab or AC. Hence Main is always updated.
(let ((modules (ess-get-words-from-vector
"ESS.main_modules()\n" nil nil proc))

View File

@@ -150,7 +150,7 @@
["R" R :help "Start a new R process" :active t]
["S" S :help "Start a new S process" :active t]
["Sqpe" Sqpe ess-microsoft-p] ;; :help "Start a new Sqpe process" :active t
["S+6-exisiting" S+6-existing ess-microsoft-p] ;; :help "Access an existing S process" :active t
["S+6-existing" S+6-existing ess-microsoft-p] ;; :help "Access an existing S process" :active t
["SAS" SAS-menu t] ;; :help "Start a new SAS process" :active t
;; The following menu item "Other" is a place-holder that will
;; be replaced with the other versions of R and Sqpe that can be run.
@@ -513,7 +513,7 @@ instead of indenting."
(defun ess-indent-or-complete ()
"When region is selected indent the region.
Otherwise, if `tab-always-indent' is 'complete, try to indent, if
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)

View File

@@ -1,6 +1,6 @@
(define-package "ess" "20211231.1746" "Emacs Speaks Statistics"
(define-package "ess" "20221204.1348" "Emacs Speaks Statistics"
'((emacs "25.1"))
:commit "5ec55b95940ac63ef6209c76035a13d02a3248cd" :authors
:commit "b6aefb9ca231c3cbb1a6532b8afa4022c2678f81" :authors
'(("David Smith" . "dsmith@stats.adelaide.edu.au")
("A.J. Rossini" . "blindglobe@gmail.com")
("Richard M. Heiberger" . "rmh@temple.edu")

View File

@@ -145,7 +145,7 @@ to look up any doc strings."
;;;*;;; OBJECTS
(defun ess-r-object-completion ()
"Return completions at point in a format required by `completion-at-point-functions'."
"Return completions at point as required in `completion-at-point-functions'."
(if (ess-make-buffer-current)
(let* ((funstart (cdr (ess--fn-name-start)))
(completions (ess-r-get-rcompletions funstart))
@@ -255,7 +255,7 @@ token. Needs version of R >= 2.7.0."
(ess-get-words-from-vector cmd)))
(defun ess-r-complete-object-name ()
"Completion in R via R's completion utilities (formerly 'rcompgen').
"Completion in R via R's completion utilities (formerly `rcompgen').
To be used instead of ESS' completion engine for R versions >= 2.7.0."
(let ((possible-completions (ess-r-get-rcompletions))
token-string)
@@ -364,10 +364,11 @@ To be used instead of ESS' completion engine for R versions >= 2.7.0."
(let ((start (ess-symbol-start)))
(when start
(buffer-substring-no-properties start (point))))))
(candidates (let ((proc (ess-get-next-available-process)))
(when proc
(with-current-buffer (process-buffer proc)
(all-completions arg (ess--get-cached-completions arg))))))
(candidates (when ess-can-eval-in-background
(let ((proc (ess-get-next-available-process)))
(when proc
(with-current-buffer (process-buffer proc)
(all-completions arg (ess--get-cached-completions arg)))))))
(doc-buffer (company-doc-buffer (ess-r-get-object-help-string arg)))))
(defun company-R-args (command &optional arg &rest ignored)
@@ -382,15 +383,17 @@ To be used instead of ESS' completion engine for R versions >= 2.7.0."
(cons prefix (>= (length prefix)
ess-company-arg-prefix-length))
prefix))))))
(candidates (let* ((proc (ess-get-next-available-process))
(args (delete "..." (nth 2 (ess-function-arguments
(car ess--fn-name-start-cache) proc))))
(args (mapcar (lambda (a) (concat a ess-R-argument-suffix))
args)))
(all-completions arg args)))
(candidates (when ess-can-eval-in-background
(let* ((proc (ess-get-next-available-process))
(args (delete "..." (nth 2 (ess-function-arguments
(car ess--fn-name-start-cache) proc))))
(args (mapcar (lambda (a) (concat a ess-R-argument-suffix))
args)))
(all-completions arg args))))
;; Displaying help for the argument in the echo area is disabled
;; by default for performance reasons. It causes delays or hangs (#1062).
(meta (when (bound-and-true-p ess-r--company-meta)
(meta (when (and ess-can-eval-in-background
(bound-and-true-p ess-r--company-meta))
(let ((proc (ess-get-next-available-process)))
(when (and proc
(with-current-buffer (process-buffer proc)
@@ -411,7 +414,8 @@ To be used instead of ESS' completion engine for R versions >= 2.7.0."
'("library" "require"))
(let ((start (ess-symbol-start)))
(and start (buffer-substring start (point))))))
(candidates (all-completions arg (ess-installed-packages)))
(candidates (when ess-can-eval-in-background
(all-completions arg (ess-installed-packages))))
(annotation "<pkg>")
(duplicates nil)
(sorted t)))
@@ -421,8 +425,9 @@ To be used instead of ESS' completion engine for R versions >= 2.7.0."
(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"))
(when (and ess-can-eval-in-background
(member (car (ess--fn-name-start))
'("library" "require")))
(list (ess-symbol-start)
(point)
(ess-installed-packages)

View File

@@ -40,6 +40,8 @@
(declare-function flymake-diag-region "flymake")
(declare-function flymake-make-diagnostic "flymake")
(declare-function flymake--overlays "flymake")
(declare-function ess-r-project "ess-r-mode")
(declare-function ess-r-package-project "ess-r-package")
(defcustom ess-r-flymake-linters
'("closed_curly_linter = NULL"
@@ -59,8 +61,8 @@
"trailing_whitespace_linter = NULL")
"Default linters to use.
Can be either a string with R expression to be used as
is (e.g. 'lintr::default_linters'). Or a list of strings where
each element is passed as argument to 'lintr::with_defaults'."
is (e.g. `lintr::default_linters'). Or a list of strings where
each element is passed as argument to `lintr::with_defaults'."
:group 'ess-R
:type '(choice string (repeat string))
:package-version '(ess . "18.10"))
@@ -97,26 +99,22 @@ each element is passed as argument to 'lintr::with_defaults'."
(defun ess-r--find-lintr-file ()
"Return the absolute path to the .lintr file.
Check first the current directory, then the project root, then
the user's home directory. Return nil if we couldn't find a .lintr file."
(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)
(ess--project-root (project-current))
(expand-file-name ".lintr" (ess--project-root (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 `ess--project-root'
((and proj-file
(file-readable-p proj-file)))
;; Home directory
the package root, then the user's home directory. Return nil if
we couldn't find a .lintr file."
;; VS[2022-01-26]: Can't this entire thing be replaced by
;; `(locate-dominating-file ".lintr")`?
(let* ((cur-file (expand-file-name ".lintr" default-directory))
(pkg (cdr (ess-r-package-project)))
(pkg-file (and pkg (expand-file-name ".lintr" pkg)))
(proj (ess-r-project))
(proj-file (and proj (expand-file-name ".lintr" proj)))
(home-file (expand-file-name ".lintr" (getenv "HOME"))))
(cond ((file-readable-p cur-file)
cur-file)
((and proj-file (file-readable-p proj-file))
proj-file)
((and pkg-file (file-readable-p pkg-file))
pkg-file)
((file-readable-p home-file)
home-file))))

View File

@@ -64,7 +64,7 @@ use `ess-r-mode-hook' instead.")
(defcustom ess-r-fetch-ESSR-on-remotes nil
"If non-nil, when loading ESSR, fetch it from the GitHub repository.
Otherwise source from local ESS installation. When the value is
'ess-remote, fetch only with ess-remote's and not with TRAMP
\\='ess-remote, fetch only with ess-remote's and not with TRAMP
connections. When t, always fetch from remotes. Change this
variable when loading ESSR code on remotes fails for you.
@@ -73,7 +73,7 @@ in ~/.config/ESSR/ESSRv[VERSION].rds file. You can download and
place it there manually if the remote has restricted network
access."
:type '(choice (const nil :tag "Never")
(const 'ess-remote :tag "With ess-remote only")
(const ess-remote :tag "With ess-remote only")
(const t :tag "Always"))
:group 'ess-R)
@@ -558,8 +558,10 @@ will be prompted to enter arguments interactively."
"\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))
(when ess-startup-directory
(file-remote-p (if (symbolp ess-startup-directory)
(symbol-value ess-startup-directory)
ess-startup-directory)))
;; TODO: Once we drop Emacs 26 support, can probably
;; just use the REMOTE argument of `executable-find'.
(executable-find inferior-ess-r-program))
@@ -605,7 +607,7 @@ will be prompted to enter arguments interactively."
;; Trigger the callback
(process-send-string (get-buffer-process inf-buf) "r\n"))
(ess-wait-for-process)
(R-initialize-on-start)
(ess-r-initialize-on-start)
(comint-goto-process-mark))
(ess-write-to-dribble-buffer
(format "(R): inferior-ess-language-start=%s\n"
@@ -618,23 +620,8 @@ will be prompted to enter arguments interactively."
;; FIXME: Current ob-R expects current buffer set to process buffer
(set-buffer (run-ess-r start-args)))
(defun inferior-ess-r--adjust-startup-directory (dir dialect)
"Adjust startup directory DIR if DIALECT is R.
If in a package project, prefer the tests directory but only if
the package directory was selected in the first place."
(if (string= dialect "R")
(let* ((project-dir (cdr (ess-r-package-project)))
(tests-dir (expand-file-name (file-name-as-directory "tests")
project-dir)))
(if (and project-dir
(string= project-dir dir)
(string= default-directory tests-dir))
tests-dir
dir))
dir))
(defun inferior-ess-r--init-callback (_proc _name)
(R-initialize-on-start))
(ess-r-initialize-on-start))
(defmacro ess-r--without-format-command (&rest body)
(declare (indent 0)
@@ -647,9 +634,11 @@ the package directory was selected in the first place."
,@body)
(setq ess-format-command-alist old-alist)))))
(defun R-initialize-on-start ()
(define-obsolete-function-alias 'R-initialize-on-start 'ess-r-initialize-on-start "ESS 19.04")
(defun ess-r-initialize-on-start ()
"This function is run after the first R prompt.
Executed in process buffer."
(interactive)
(ess-r--without-format-command
(ess-command (format
"if (identical(getOption('pager'), file.path(R.home(), 'bin', 'pager')))
@@ -796,6 +785,7 @@ top level functions only."
(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)
(add-hook 'project-find-functions #'ess-r-project nil 'local)
(if (fboundp 'ess-add-toolbar) (ess-add-toolbar))
;; imenu is needed for `which-function'
@@ -822,11 +812,69 @@ top level functions only."
;;;###autoload
(add-to-list 'auto-mode-alist '("CITATION\\'" . ess-r-mode))
;;;*;;; Project detection
(defvar-local ess-r-project--info-cache nil
"Current package info cache.
See `ess-r-project-info' for its structure.")
(defun ess-r-project (&optional dir)
"Return the current project as an Emacs project instance.
R project is a directory XYZ containing either .Rprofile,
DESCRIPTION or XYZ.Rproj file. Return a list of the form (:name
\"XYZ\" :root \"/path/to/project\"). If DIR is provided, the
project is searched from that directory instead of
`default-directory'."
(let ((info (ess-r-project-info dir)))
(when (car info)
(cons 'ess-r-project (plist-get info :root)))))
;; FIXME: remove when emacs 27 is dropped
(unless (eval-when-compile
(get 'project-roots 'byte-obsolete-info))
(cl-defmethod project-roots ((project (head ess-r-project)))
"Return the project root for ESS R projects."
(list (cdr project))))
(cl-defmethod project-root ((project (head ess-r-project)))
"Return the project root for ESS R projects."
(cdr project))
(defun ess-r-project-info (&optional dir)
"Get the description of the R project in directory DIR.
Return an plist with the keys :name and :root. When not in a
project return \\='(nil). This value is cached buffer-locally for
efficiency reasons."
(let ((do-cache (null dir)))
(if (and do-cache ess-r-project--info-cache)
ess-r-project--info-cache
(setq dir (or dir (buffer-file-name) default-directory))
(let ((out (or
(unless (file-remote-p dir)
(let ((dir (locate-dominating-file
dir
(lambda (dir)
(or (file-exists-p (expand-file-name ".Rprofile" dir))
(file-exists-p (expand-file-name "DESCRIPTION" dir))
(let ((nm (file-name-nondirectory (directory-file-name dir))))
(file-exists-p (expand-file-name (concat nm ".Rproj") dir))))))))
(when dir
(let ((dir (directory-file-name dir)))
(unless (member dir (list "~" (getenv "HOME")))
(list :name (file-name-nondirectory dir)
:root (expand-file-name dir)))))))
'())))
(when do-cache
(setq ess-r-project--info-cache out))
out))))
;;*;; Miscellaneous
(defun ess-R-arch-2-bit (arch)
"Translate R's architecture shortcuts/directory names to 'bits'.
"Translate R's architecture shortcuts/directory names to `bits'.
ARCH \"32\" or \"64\" (for now)."
(if (string= arch "i386") "32"
;; else:
@@ -839,8 +887,8 @@ Returns either Name, a string, or a (Name . Path) cons, such as
(\"R-2.12.1-64bit\" . \"C:/Program Files/R/R-2.12.1/bin/x64/Rterm.exe\")
\"R-x.y.z/bin/Rterm.exe\" will return \"R-x.y.z\", for R-2.11.x and older.
\"R-x.y.z/bin/i386/Rterm.exe\" will return \"R-x.y.z-32bit\", for R-2.12.x and newer.
\"R-x.y.z/bin/x64/Rterm.exe\" will return \"R-x.y.z-64bit\", for R-2.12.x and newer."
\"R-x.y.z/bin/i386/Rterm.exe\" return \"R-x.y.z-32bit\", for R-2.12.x and newer.
\"R-x.y.z/bin/x64/Rterm.exe\" return \"R-x.y.z-64bit\", for R-2.12.x and newer."
(let* ((dir (directory-file-name (file-name-directory long-path)))
(dir2 (directory-file-name (file-name-directory dir)))
(v-1up (file-name-nondirectory dir));; one level up
@@ -896,7 +944,8 @@ as `ess-r-created-runners' upon ESS initialization."
(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."
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)))
@@ -987,7 +1036,7 @@ returned."
rver)
" --version"))))
(when (string-match
"R \\(version \\)?[1-9][^\n]+ (\\(2[0-9-]+\\)\\( r[0-9]+\\)?)"
"R \\(version \\)?[1-9][^\n]+ (\\(2[0-9-]+\\)\\( r[0-9]+\\)?"
ver-string)
(setq date (match-string 2 ver-string)))
(cons date rver)))
@@ -1082,7 +1131,7 @@ use \"bin/Rterm.exe\"."
(fset 'r-transcript-mode 'ess-r-transcript-mode)
;;;###autoload
(add-to-list 'auto-mode-alist '("\\.[Rr]out" . ess-r-transcript-mode))
(add-to-list 'auto-mode-alist '("\\.[Rr]out\\'" . ess-r-transcript-mode))
;;;###autoload
(add-to-list 'interpreter-mode-alist '("Rscript" . ess-r-mode))
;;;###autoload
@@ -1176,7 +1225,7 @@ Placed into `ess-presend-filter-functions' for R dialects."
(cl-defmethod ess-installed-packages (&context (ess-dialect "R"))
;;; FIXME? .packages() does not cache; installed.packages() does but is slower first time
(ess-get-words-from-vector--foreground "print(.packages(T), max=1e6)\n"))
(ess-get-words-from-vector--foreground "print(.packages(TRUE), max=1e6)\n"))
(cl-defmethod ess-load-library--override (pack &context (ess-dialect "R"))
"Load an R package."
@@ -1417,7 +1466,7 @@ documented, returns nil."
"^\\([^ \t\n]+::[^ \t\n]+\\)[ \t\n]+"
(format "*ess-apropos[%s](%s)*"
ess-current-process-name (match-string 1 help-?-match))
'appropos))
'apropos))
((string-match "^ *\\? *\\([^ \t]+\\)$" help-?-match)
(ess-display-help-on-object (match-string 1 help-?-match)))
;; Anything else we send to process almost unchanged
@@ -1447,6 +1496,7 @@ On remotes, when `ess-r-fetch-ESSR-on-remotes' is non-nil we
fetch ESSR environment from github to the remote machine.
Otherwise (the default) we source ESSR files into the remote
process."
(interactive)
;; `.ess.command()` is not defined until ESSR is loaded so disable
;; it temporarily. Would be helpful to implement an `inferior-ess-let'
;; macro .
@@ -1504,9 +1554,14 @@ environment from GitHub and attaches it to the search path. If
the file already exists on disk from a previous download then the
download step is omitted. This function returns t if the ESSR
load is successful, and nil otherwise."
(let ((loader (ess-file-content (expand-file-name "ESSR/LOADREMOTE" ess-etc-directory))))
(let ((loader (ess-file-content (expand-file-name "ESSR/LOADREMOTE" ess-etc-directory)))
(essr (or essr-version
;; FIXME: Hack: on MELPA essr-version is not set
(lm-with-file (expand-file-name "ess.el" ess-lisp-directory)
(lm-header "ESSR-Version"))
(error "`essr-version' could not be automatically inferred from ess.el file"))))
(or (with-temp-message "Fetching and loading ESSR into the remote ..."
(ess-boolean-command (format loader essr-version)))
(ess-boolean-command (format loader essr)))
(let ((errmsg (with-current-buffer " *ess-command-output*" (buffer-string))))
(message (format "Couldn't load or download ESSR.rds on the remote.\n Error: %s\n Injecting local copy of ESSR." errmsg))
nil))))
@@ -2112,14 +2167,12 @@ Returns nil if line starts inside a string, t if in a comment."
;; Unroll arguments to a single line until closing marker is found.
(defun ess-fill--unroll-lines (bounds &optional jump-cont)
(let* ((last-pos (point-min))
(containing-sexp (ess-containing-sexp-position))
prefix-break)
(containing-sexp (ess-containing-sexp-position)))
(goto-char (car bounds))
(goto-char (ess-code-end-position))
(while (and (/= (point) last-pos)
(< (line-end-position)
(cadr bounds))
(not prefix-break))
(cadr bounds)))
(setq last-pos (point))
;; Check whether we ended up in a sub call. In this case, jump
;; over it, otherwise, join lines.
@@ -2406,6 +2459,7 @@ state.")
(add-hook 'completion-at-point-functions 'ess-r-object-completion nil 'local)
(add-hook 'completion-at-point-functions 'ess-filename-completion nil 'local)
(add-hook 'xref-backend-functions #'ess-r-xref-backend nil 'local)
(add-hook 'project-find-functions #'ess-r-project nil 'local)
;; eldoc
(ess--setup-eldoc #'ess-r-eldoc-function)
;; auto-complete
@@ -2415,8 +2469,8 @@ state.")
(setq comint-get-old-input #'inferior-ess-get-old-input)
(add-hook 'comint-input-filter-functions 'ess-search-path-tracker nil 'local))
;;;*;;; R Help mode
(defvar ess-r-help-mode-map
@@ -2824,9 +2878,9 @@ given field. Options should be separated by value of
"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))
("field:subject:descending" 5)
("field:from:ascending" 6) ("field:from:descending" 7)
("field:size:ascending" 8) ("field:size:descending" 9))
nil t "score" nil "score")))
(restrict (concat
"&idxname="

View File

@@ -36,6 +36,7 @@
;; Silence the byte compiler, OK because this file is only loaded by
;; ess-r-mode and has no autoloads.
(defvar ess-r-customize-alist)
(declare-function ess-r-project "ess-r-mode")
(declare-function inferior-ess-r-force "ess-r-mode")
(declare-function ess-r-get-evaluation-env "ess-r-mode")
(declare-function ess-r-set-evaluation-env "ess-r-mode")
@@ -104,9 +105,13 @@ is searched from that directory instead of `default-directory'."
(when (car 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"
(list (cdr project)))
;; FIXME: remove when emacs 27 is dropped
(unless (eval-when-compile
(get 'project-roots 'byte-obsolete-info))
(cl-defmethod project-roots ((project (head ess-r-package)))
"Return the project root for ESS R packages"
(list (cdr project))))
(cl-defmethod project-root ((project (head ess-r-package)))
"Return the project root for ESS R packages"
@@ -119,7 +124,7 @@ is searched from that directory instead of `default-directory'."
(defun ess-r-package-info (&optional dir)
"Get the description of the R project in directory DIR.
Return an plist with the keys :name and :root. When not in a
package return '(nil). This value is cached buffer-locally for
package return \\='(nil). This value is cached buffer-locally for
efficiency reasons."
(if (and (null dir) (car ess-r-package--info-cache))
ess-r-package--info-cache
@@ -340,7 +345,7 @@ With prefix ARG allow for editing of the `rhub::check_for_cran()' arguments."
(defun ess-r-devtools-build (&optional arg)
"Interface for `devtools::build()'.
With prefix ARG, build with 'vignettes = FALSE'."
With prefix ARG, build with `vignettes = FALSE'."
(interactive "P")
(ess-r-package-eval-linewise
"devtools::build(%s)\n" "Building %s" arg
@@ -463,7 +468,7 @@ When called with prefix ARG asks for additional arguments."
(defcustom ess-r-package-auto-activate t
"If non-nil, `ess-r-package-mode' is turned on within R packages.
If 't' the minor mode auto-activates in R packages. See
If `t' the minor mode auto-activates in R packages. See
`ess-r-package-exclude-modes' if you wish to inhibit
`ess-r-package-mode' in specific buffers."
:group 'ess-r-package
@@ -522,9 +527,9 @@ Set this variable to nil to disable the mode line entirely."
(set (make-local-variable var)
(eval (cdr (assq var ess-r-customize-alist)))))
vars))
(add-hook 'project-find-functions #'ess-r-package-project)
(add-hook 'project-find-functions #'ess-r-project nil 'local)
(run-hooks 'ess-r-package-enter-hook))
(remove-hook 'project-find-functions #'ess-r-package-project)
(remove-hook 'project-find-functions #'ess-r-project)
(run-hooks 'ess-r-package-exit-hook)))
(add-hook 'after-change-major-mode-hook 'ess-r-package-auto-activate)

View File

@@ -209,6 +209,7 @@ Cons cell containing the token type and string representation."
(`?>
(prog1 (ess-backward-char)
(or (ess-climb-token--char ?|)
(ess-climb-token--char ?=)
(ess-climb-token--char ?-)
(and (looking-back "->" (- (point) 2))
(goto-char (- (point) 2))))))
@@ -313,7 +314,7 @@ content. Return nil when the end of the buffer is reached."
"==" "!=" "<" "<=" ">=" ">"
"=" "<-" "<<-" "->" "->>"
"$" "@" ":" "::" ":::" ":="
"|>"))
"|>" "=>"))
(defvar ess-r-keywords-re
(concat (regexp-opt ess-r-keywords-list) "\\_>"))
@@ -671,16 +672,16 @@ content. Return nil when the end of the buffer is reached."
(let ((current (ess-parse-start-token (ess-parser-advance)))
(power (or power 0))
(next (ess-parser-next-token))
(last-sucessful-pos (point))
(last-successful-pos (point))
last-success)
(setq last-success current)
(while (and current (< power (ess-parser-power next)))
(ess-parser-advance)
(when (setq current (ess-parse-infix-token next current))
(setq last-sucessful-pos (point))
(setq last-successful-pos (point))
(setq last-success current))
(setq next (ess-parser-next-token)))
(goto-char last-sucessful-pos)
(goto-char last-successful-pos)
last-success))
(defun ess-parse-arglist (power start-token)

View File

@@ -87,7 +87,7 @@ srcrefs point to temporary locations."
(read (current-buffer)))))))
(defun ess-r-xref--pkg-srcfile (symbol src-file &optional default-pkg)
"Look in the source directory of the R package containing symbol SYMBOL for SRC-FILE.
"Search the R package containing symbol SYMBOL for file SRC-FILE.
DEFAULT-PKG is the name of the package where presumably SYMBOL is located."
(let* ((pkgs (delq nil
(delete-dups

View File

@@ -175,6 +175,7 @@ All Rd mode abbrevs start with a grave accent (`)."
(define-key map "\C-c\C-p" #'Rd-preview-help)
(define-key map "\C-c\C-j" #'Rd-mode-insert-item)
(define-key map "\C-c\C-e" #'Rd-mode-insert-skeleton)
(define-key map "\C-c\C-d" #'Rd-mode-insert-data-skeleton)
(define-key map "\C-c\C-f" #'Rd-font)
(define-key map "\C-c\C-s" #'Rd-mode-insert-section)
(define-key map "\C-c\C-n" #'ess-eval-line-visibly-and-step)
@@ -194,6 +195,7 @@ All Rd mode abbrevs start with a grave accent (`)."
["Insert Item" Rd-mode-insert-item t]
["Insert Section" Rd-mode-insert-section t]
["Insert Skeleton" Rd-mode-insert-skeleton t]
["Insert Data Skeleton" Rd-mode-insert-data-skeleton t]
"-"
["Preview" Rd-preview-help t]
"-"
@@ -368,6 +370,25 @@ the following to your Emacs configuration file:
(insert "\\author{}\n")
(insert "\\keyword{}\n"))
(defun Rd-mode-insert-data-skeleton ()
"Insert several empty Rd fields."
(interactive)
;; Hmm: in theory this should be kept in sync with prompt()
;; --- maybe using prompt() [or promptClass()...] would be better anyway?!
(insert "\\name{}\n")
(insert "\\docType{}\n")
(insert "\\alias{}\n")
(insert "\\title{}\n")
(insert "\\description{\n}\n")
(insert "\\usage{\n}\n")
(insert "\\format{\n}\n")
(insert "\\details{\n}\n")
(insert "\\source{}\n")
(insert "\\references{\n}\n")
(insert "\\examples{\n}\n")
(insert "\\keyword{datasets}\n"))
;; This is an `easy' version of (defun TeX-font ..) in AUCtex's tex.el ;
;; see TeX-font-list and also LaTeX-font-list in latex.el

View File

@@ -180,7 +180,7 @@ Use you regular key for `outline-show-entry' to reveal it.")
(unless (featurep 'outline-magic)
(error "Please install and load outline-magic"))
;; Don't show children when cycling @examples
(let ((this-command 'outline-cycle-overwiew))
(let ((this-command 'outline-cycle-overview))
(ess-roxy-substitute-outline-regexp #'outline-cycle)))
(defun ess-roxy-show-example ()

View File

@@ -262,7 +262,8 @@ Optional argument VERBOSE gives more verbose output."
(defun ess-fix-dot (before-chars &optional dont-query verbose)
"Remove trailing decimal '.' (\"dot\"), before BEFORE-CHARS.
Optional argument DONT-QUERY and VERBOSE get passed to `ess-replace-regexp-dump-to-src'."
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 "]\\)")
@@ -283,7 +284,7 @@ than `ess-fix-dot-1'."
(ess-fix-dot ",)" dont-query verbose))
(defun ess-fix-EQ-assign (&optional dont-query verbose not-all)
"Replace \"=\" by \"<-\" in places where it 'might make sense', e.g.,
"Replace \"=\" by \"<-\" in places where it `might make sense', e.g.,
for function assignments and lines not ending in \",\".
Be *careful* for list()s of functions and when argument not-all is
nil (as by default) !"
@@ -448,8 +449,8 @@ Currently, this needs to:
2. format the statement,
3. c/function/Sfunc/
and I need to relearn Emacs lisp (but I had to, anyway."
(interactive "sFunction ? ")
(declare (obsolete 'ess-execute "ESS 19.04"))
(interactive "sFunction ? ")
(let* ((buffname "ess-complete.R"))
(ess-execute (format "args(%s)" Sfunc) t buffname)
(pop-to-buffer (concat "*" buffname "*"))
@@ -492,7 +493,7 @@ ARG is ignored."
(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
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
@@ -530,7 +531,7 @@ return it. Otherwise, return `ess-help-topics-list'."
;;;###autoload
(add-to-list 'auto-mode-alist '("\\.[Ss]t\\'" . S-transcript-mode))
;;;###autoload
(add-to-list 'auto-mode-alist '("\\.Sout" . S-transcript-mode))
(add-to-list 'auto-mode-alist '("\\.Sout\\'" . S-transcript-mode))
(provide 'ess-s-lang)

View File

@@ -87,7 +87,7 @@ or `ess-sas-data-view-insight'."
(make-variable-buffer-local 'ess-sas-data-view-insight-statement)
(defcustom ess-sas-graph-view-suffix-regexp
"[.]\\([eE]?[pP][sS]\\|[pP][dD][fF]\\|[gG][iI][fF]\\|[jJ][pP][eE]?[gG]\\|[tT][iI][fF][fF]?\\)"
"[.]\\([eE]?[pP][sS]\\|[pP][dD][fF]\\|[gG][iI][fF]\\|[jJ][pP][eE]?[gG]\\|[tT][iI][fF][fF]?\\|[pP][nN][gG]\\)"
"GSASFILE suffix regexp."
:group 'ess-sas
:type 'string)
@@ -188,18 +188,18 @@ Virtual PC emulator on your Mac; buffer-local."
"Method used by `ess-sas-submit'.
The default is based on the value of the emacs variable `system-type'
and, on Windows, the function `w32-shell-dos-semantics'.
'sh if *shell* runs sh, ksh, csh, tcsh or bash
'ms-dos if *shell* follows MS-DOS semantics
\\='sh if *shell* runs sh, ksh, csh, tcsh or bash
\\='ms-dos if *shell* follows MS-DOS semantics
Unix users will get 'sh by default.
Unix users will get \\='sh by default.
Windows users running bash in *shell* will get 'sh by default.
Windows users running bash in *shell* will get \\='sh by default.
Windows users running MS-DOS in *shell* will get 'ms-dos by default.
Windows users running MS-DOS in *shell* will get \\='ms-dos by default.
Users accessing a remote machine with `telnet', `rlogin', `ssh', etc.,
should set this variable to 'sh regardless of their local shell
(since their remote shell is 'sh).")
should set this variable to \\='sh regardless of their local shell
(since their remote shell is \\='sh).")
(defcustom ess-sas-graph-view-viewer-default
(if ess-microsoft-p "explorer"
@@ -576,15 +576,22 @@ Use the current buffer if nil."
(setq ess-tmp-graph (read-string "GSASFILE: "
(or ess-tmp-graph ess-sas-file-path)))
;;GNU Emacs graphics file image viewing mode loaded?
(if (and (bound-and-true-p auto-image-file-mode)
;; whether the image libraries are configured is what is important here
(if (and (string-match "JPEG" system-configuration-features)
(string-match "[.][jJ][pP][eE]?[gG]" ess-tmp-graph))
(find-file ess-tmp-graph)
;;else XEmacs graphics file image viewing mode loaded?
(if (and (fboundp 'image-mode)
(string-match "[.]\\([jJ][pP][eE]?[gG]\\|[gG][iI][fF]\\)"
ess-tmp-graph))
(find-file ess-tmp-graph)
(if (and (string-match "PNG" system-configuration-features)
(string-match "[.][pP][nN][gG]" ess-tmp-graph))
(find-file ess-tmp-graph)
;; ;;GNU Emacs graphics file image viewing mode loaded?
;; (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?
;; (if (and (fboundp 'image-mode)
;; (string-match "[.]\\([jJ][pP][eE]?[gG]\\|[gG][iI][fF]\\)"
;; ess-tmp-graph))
;; (find-file ess-tmp-graph)
;;else use the appropriate graphics file image viewer
(while (< ess-tmp-counter ess-tmp-length)
(setq ess-tmp-graph-alist
@@ -1397,7 +1404,7 @@ directory that you specify with the same name, but without the
(comint-send-input)
;; (insert (read-string "Press Return to connect to Kermit: " nil nil "\C-\\c"))
;; (comint-send-input)
;; (insert (read-string "Press Return when Kermit is ready to recieve: " nil nil
;; (insert (read-string "Press Return when Kermit is ready to receive: " nil nil
;; (concat "receive ]" ess-sas-temp-file)))
;; (comint-send-input)
;; (insert (read-string "Press Return when transfer is complete: " nil nil "c"))
@@ -1441,7 +1448,7 @@ directory with the same name, but without the `ess-kermit-prefix'."
(comint-send-input)
;; (insert (read-string "Press Return to connect to Kermit: " nil nil "\C-\\c"))
;; (comint-send-input)
;; (insert (read-string "Press Return when Kermit is ready to recieve: " nil nil
;; (insert (read-string "Press Return when Kermit is ready to receive: " nil nil
;; (concat "receive ]" ess-sas-temp-file)))
;; (comint-send-input)
;; (insert (read-string "Press Return when transfer is complete: " nil nil "c"))

View File

@@ -256,7 +256,9 @@ Better logic needed! (see 2 uses, in this file).")
;; rmh Jul 10 2003
(defun ess-electric-run-semicolon (arg)
"Insert character. If the line contains \"run;\" or \"quit;\" and nothing else then indent line."
"Insert character.
If the line contains \"run;\" or \"quit;\" and nothing else then
indent line."
(interactive "P")
(if ess-sas-edit-keys-toggle (insert ";") (let (insertpos)
(if (and (not arg)

View File

@@ -76,8 +76,7 @@
(inferior-ess-help-command . "help(\"%s\", pager=\"slynx -dump\", window=FALSE)\n")
(inferior-ess-search-list-command . "searchPaths()\n")
(ess-directory-function . S+-directory-function)
(ess-setup-directory-function . S+-setup-directory-function)
(ess-startup-directory-function . S+-directory-function)
(ess-STERM . "iESS"))
S+common-cust-alist)

View File

@@ -39,16 +39,17 @@
;;; Code:
(eval-when-compile
(eval-and-compile
(when (< emacs-major-version 26)
(require 'cl))
(require 'cl-lib)
(require 'tramp)
(require 'subr-x))
(require 'subr-x)
(require 'ess-utils))
(require 'comint)
(require 'compile)
(require 'ring)
(require 'ess-utils)
(defvar text-scale-mode-amount)
(autoload 'text-scale-mode "face-remap" "[autoload]" nil)
@@ -91,6 +92,7 @@
(declare-function ess-r-package-source-dirs "ess-r-package")
(declare-function ess-roxy--region-p "ess-roxy")
;; Do not require tramp at runtime. It is expensive to load. Instead,
;; guard calls with (require 'tramp) and silence the byte compiler
;; here.
@@ -328,10 +330,12 @@ command conforms to VISIBLY."
(defun ess-tracebug-send-region (process start end &optional visibly message type)
"Send region to process adding source references as specified
by `ess-inject-source' variable."
(ess-eval-region--normalise-region start end)
;; Disable evaluation env if we're sending a roxy region. This is
;; not the ideal place to do this.
(let* ((ess-r-evaluation-env (unless (ess-roxy--region-p start end)
(let* ((se (ess-eval-region--normalise-region start end))
(start (car se))
(end (cdr se))
(ess-r-evaluation-env (unless (ess-roxy--region-p start end)
(ess-r-get-evaluation-env)))
(inject-p (cond ((eq type 'function)
ess-inject-source)
@@ -542,13 +546,13 @@ can use `ess--busy-slash', `ess--busy-B',`ess--busy-stars',
(defcustom inferior-ess-replace-long+ t
"Determines if ESS replaces long + sequences in output.
If 'strip, remove all such instances. Otherwise, if non-nil, '+
If \\='strip, remove all such instances. Otherwise, if non-nil, `+
+ + + ' containing 3 or more + is replaced by
`ess-long+replacement'.
This variable can be process-local but not buffer-local."
:group 'ess-tracebug
:type '(choice (const nil :tag "No replacement")
(const 'strip :tag "Replace all")
(const strip :tag "Replace all")
(const t :tag "Replace 3 or more +")))
(defvar ess-long+replacement ". + "
@@ -648,7 +652,7 @@ Pop up a compilation/grep/occur like buffer. Usual global key
bindings are available (\\[next-error] and \\[previous-error])
for `next-error' and `previous-error' respectively.
You can bind 'no-select' versions of this commands:
You can bind `no-select' versions of this commands:
\(define-key compilation-minor-mode-map [(?n)] #'next-error-no-select)
\(define-key compilation-minor-mode-map [(?p)] #'previous-error-no-select)"
(interactive)
@@ -722,7 +726,7 @@ This is the value of `next-error-function' in iESS buffers."
(at-error t)
(msg
(condition-case nil
(compilation-next-error n nil beg-pos)
(compilation-next-error n nil beg-pos)
(error
(when pbuff-p
(ess--tb-next-error-goto-process-marker))
@@ -775,12 +779,12 @@ This is the value of `next-error-function' in iESS buffers."
'(( "" "NONE" "NULL" )
( " r" "RECOVER" "utils::recover")
( " t" "TRACEBACK" "base::traceback"))
"Alist of 'on-error' actions.
"Alist of `on-error' actions.
Toggled with `ess-debug-toggle-error-action'. Each element must
have the form (DISP SYMB ACTION) where DISP is the string to be
displayed in the mode line when the action is in place. SYMB is
the symbolic name of an action. ACTION is the string giving the
actual expression to be assigned to 'error' user option. See R's
actual expression to be assigned to `error' user option. See R's
help ?options for more details."
:type '(alist :key-type string
:value-type (group string string))
@@ -830,7 +834,7 @@ In no-windowed Emacs an `overlay-arrow' is displayed at this position.")
(defcustom ess-debug-blink-interval .2
"Time in seconds to blink the background of the debug line.
Currently two events are defined 'ref-not-found' and 'same-ref'.
Currently two events are defined `ref-not-found' and `same-ref'.
Blinking colors for these events can be customized by
corresponding faces."
:group 'ess-debug
@@ -912,7 +916,7 @@ The SPEC should be one of the components of
(error "Unknown action"))))
(defun ess-debug-toggle-error-action ()
"Toggle the 'on-error' action.
"Toggle the `on-error' action.
The action list is in `ess-debug-error-action-alist'."
(interactive)
(ess-force-buffer-current)
@@ -947,7 +951,8 @@ The action list is in `ess-debug-error-action-alist'."
(move-marker ess--dbg-current-debug-position (point-at-bol)))
(defun ess--dbg-deactivate-overlays ()
"Deletes markers and overlays. Overlay arrow remains to indicate the last debug position."
"Delete debugger markers and overlays.
Overlay arrow remains to indicate the last debug position."
(delete-overlay ess--dbg-current-debug-overlay)
(set-marker ess--dbg-current-debug-position nil))
@@ -1531,7 +1536,7 @@ the output into *ess.dbg* buffer."
:keymap ess-debug-minor-mode-map)
(defun ess--dbg-goto-last-ref-and-mark (dbuff &optional other-window)
"Open the most recent debug reference, and set all the necessary marks and overlays.
"Open the most recent debug reference and set the necessary marks and overlays.
It's called from `inferior-ess-tracebug-output-filter'. DBUFF
must be the *ess.dbg* buffer associated with the process. If
OTHER-WINDOW is non nil, attempt to open the location in a
@@ -1630,59 +1635,65 @@ nil, or TB-INDEX is not found return nil."
(org-babel-tangle-jump-to-org))
(list (point-marker) (copy-marker (point-at-eol))))))))))
(defvar ess-r-package-library-paths)
(defun ess--dbg-find-buffer (filename)
"Find a buffer for file FILENAME.
If FILENAME is not found at all, ask the user where to find it if
`ess--dbg-ask-for-file' is non-nil. Search the directories in
`ess-tracebug-search-path'."
`ess-tracebug-search-path' and `ess-r-package-library-paths'."
(let ((dirs (append
(ess-r-package-source-dirs)
(cl-loop for d in ess-tracebug-search-path
ess-r-package-library-paths
(cl-loop for d in (append ess-tracebug-search-path)
append (ess-r-package--all-source-dirs d))))
(filematch (format "%s\\'" filename))
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)
(cl-dolist (bf (buffer-list))
(with-current-buffer bf
(when (and buffer-file-name
(string-match (format "%s\\'" filename) buffer-file-name))
(setq buffer bf)
(cl-return))))
;; 2. The file name is absolute. Use its explicit directory as
(setq dirs (delq nil (cons (with-ess-process-buffer t default-directory) dirs)))
;; 1. The file name is absolute. Use its explicit directory as
;; the first in the search path, and strip it from FILENAME.
(when (and (null buffer)
(file-name-absolute-p filename))
(setq filename (abbreviate-file-name (expand-file-name filename))
dirs (cons (file-name-directory filename) dirs)
filename (file-name-nondirectory filename)))
;; 3. Now search the path.
(while (and (null buffer) dirs)
(let ((thisdir (pop dirs)))
(setq name (expand-file-name filename thisdir)
buffer (and (file-exists-p name)
(find-file-noselect name)))))
;; 4. Ask for file if not found (tothink: maybe remove this part?)
(if (and (null buffer)
ess-debug-ask-for-file)
(save-excursion ;This save-excursion is probably not right.
(let* ((pop-up-windows t)
(name (read-file-name
(format "Find next line in (default %s): " filename)
nil filename t nil))
(origname name))
(cond
((not (file-exists-p name))
(message "Cannot find file `%s'" name)
(ding) (sit-for 2))
((and (file-directory-p name)
(not (file-exists-p
(setq name (expand-file-name filename name)))))
(message "No `%s' in directory %s" filename origname)
(ding) (sit-for 2))
(t
(setq buffer (find-file-noselect name)))))))
;; nil if not found
buffer))
(or
;; 2. Search the path.
(while (and (null buffer) dirs)
(let ((thisdir (pop dirs)))
(setq name (expand-file-name filename thisdir)
buffer (and (file-exists-p name)
(find-file-noselect name)))))
buffer
;; 3. search already open buffers for match (associated file might not even exist yet)
(cl-dolist (bf (buffer-list))
(with-current-buffer bf
(when (and buffer-file-name
(string-match filematch buffer-file-name))
(setq buffer bf)
(cl-return))))
buffer
;; 4. Ask for file if not found (tothink: maybe remove this part?)
(when ess-debug-ask-for-file
(save-excursion ;This save-excursion is probably not right.
(let* ((pop-up-windows t)
(name (read-file-name
(format "Find next line in (default %s): " filename)
nil filename t nil))
(origname name))
(cond
((not (file-exists-p name))
(message "Cannot find file `%s'" name)
(ding) (sit-for 2))
((and (file-directory-p name)
(not (file-exists-p
(setq name (expand-file-name filename name)))))
(message "No `%s' in directory %s" filename origname)
(ding) (sit-for 2))
(t
(setq buffer (find-file-noselect name)))))))
buffer)))
(defun ess--dbg-get-next-ref (n &optional pt BOUND REG nF nL nC)
"Move point to the next reference in the *ess.dbg* buffer.
@@ -1694,9 +1705,9 @@ to move forwards (or backwards, if negative). Optional arg PT,
if non-nil, specifies the value of point to start looking for the
next message, default to (point). BOUND is the limiting position
of the search. REG is the regular expression to search with. nF
- sub-expression of REG giving the 'file'; defaults to 1. nL -
giving the 'line'; defaults to 2. nC - sub-expr giving the
'column'; defaults to 3."
- sub-expression of REG giving the `file'; defaults to 1. nL -
giving the `line'; defaults to 2. nC - sub-expr giving the
`column'; defaults to 3."
(unless ess--dbg-buf-p
(error "Not in *ess.dbg* buffer"))
(setq nF (or nF 1)
@@ -1765,7 +1776,7 @@ If supplied, EV must be a proper key event or a string representing the digit."
(defun ess-debug-command-next ()
"Step next in debug mode.
Equivalent to 'n' at the R prompt."
Equivalent to `n' at the R prompt."
(interactive)
(ess-force-buffer-current)
(unless (ess--dbg-is-active-p)
@@ -1879,7 +1890,7 @@ ARGS are ignored to allow using this function in process hooks."
(((class color) (background dark) (min-colors 88)) (:foreground "deep sky blue"))
(((background light) (min-colors 8)) (:foreground "blue"))
(((background dark) (min-colors 8)) (:foreground "cyan")))
"Face used to highlight 'browser' breakpoints."
"Face used to highlight `browser' breakpoints."
:group 'ess-debug)
(defface ess-bp-fringe-recover-face
@@ -1887,7 +1898,7 @@ ARGS are ignored to allow using this function in process hooks."
(((class color) (background dark) (min-colors 88)) (:foreground "magenta"))
(((background light) (min-colors 8)) (:foreground "magenta"))
(((background dark) (min-colors 8)) (:foreground "magenta")))
"Face used to highlight 'recover' breakpoints fringe."
"Face used to highlight `recover' breakpoints fringe."
:group 'ess-debug)
(defun ess--bp-pipe-block-p ()
@@ -1898,9 +1909,18 @@ ARGS are ignored to allow using this function in process hooks."
(end-of-line)
(looking-back "%>%[ \t]*" (point-at-bol)))))
(defun ess--bp-pipe-native-block-p ()
(save-excursion
(let ((inhibit-point-motion-hooks t)
(inhibit-field-text-motion t))
(forward-line -1)
(end-of-line)
(looking-back "|>[ \t]*" (point-at-bol)))))
(defvar ess--bp-identifier 1)
(defcustom ess-bp-type-spec-alist
'((pipe ".ess_pipe_browser() %%>%%" "B %>%\n" filled-square ess-bp-fringe-browser-face ess--bp-pipe-block-p)
(pipe-native ".ess_pipe_browser() |>" "B |>\n" filled-square ess-bp-fringe-browser-face ess--bp-pipe-native-block-p)
(browser "browser(expr=is.null(.ESSBP.[[%s]]));" "B>\n" filled-square ess-bp-fringe-browser-face)
(recover "recover()" "R>\n" filled-square ess-bp-fringe-recover-face))
"List of lists of breakpoint types.
@@ -2465,8 +2485,10 @@ string giving the actual R expression."
wal)))
(defun ess-watch--parse-assoc (al)
"Return a string of the form 'assign(\".ess_watch_expressions\", list(a = parse(expr_a), b= parse(expr_b)), envir = .GlobalEnv)'
ready to be send to R process. AL is an association list as return by `ess-watch--make-alist'"
"Return a string command ready to be passed to R process.
The command is of the form `assign(\".ess_watch_expressions\",
list(a = parse(expr_a), b= parse(expr_b)), envir = .GlobalEnv)'.
AL is an association list as return by `ess-watch--make-alist'"
(concat ".ess_watch_assign_expressions(list("
(mapconcat (lambda (el)
(if (> (length (cadr el) ) 0)
@@ -2572,7 +2594,7 @@ Optional N if supplied gives the number of backward steps."
(ess-watch-refresh-buffer-visibly (current-buffer))))
(defun ess-watch-add ()
"Ask for new R expression and name and append it to the end of the list of watch expressions."
"Ask for new R expression and append to the current list of watch expressions."
(interactive)
(let (nr expr name)
(goto-char (point-max))

View File

@@ -94,7 +94,7 @@ Otherwise go as far as possible and return -1."
(defun ess-skip-thing (thing)
"Leave point at the end of THING.
THING can be 'function, 'paragraph, or 'line."
THING can be \\='function, \\='paragraph, or \\='line."
(cond
((eql thing 'line) (goto-char (line-end-position)))
((eql thing 'paragraph) (forward-paragraph))
@@ -163,7 +163,7 @@ This function will work even if LIST is unsorted. See also `delete-dups'."
'flatten-tree
(lambda (list)
"Take the arguments and flatten them into one long LIST.
Drops 'nil' entries."
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
@@ -266,6 +266,19 @@ process to avoid excessive requests."
(process-put *proc* ',time-var (current-time))
out)))))
(defmacro with-ess-process-buffer (no-error &rest body)
"Execute BODY in the process buffer of `ess-current-process-name'.
If NO-ERROR is t don't trigger error when there is not current
process. Symbol *proc* is bound to the current process during the
evaluation of BODY."
(declare (indent 1) (debug t))
`(let ((*proc* (and ess-local-process-name (get-process ess-local-process-name))))
(if *proc*
(with-current-buffer (process-buffer *proc*)
,@body)
(unless ,no-error
(error "No current ESS process")))))
;;*;; Emacs Integration
@@ -390,7 +403,8 @@ calling `untrace-function' on these functions."
#'untrace-function
#'trace-function))))
(dolist (fn fns)
(funcall do (intern fn)))))
(when (symbol-function (intern fn))
(funcall do (intern fn))))))
;;*;; External modes
@@ -491,7 +505,7 @@ FUN is the function to return data for eldoc."
(setq-local eldoc-documentation-function #'eldoc-documentation-default)))))
(defmacro ess--execute-electric-command (map &optional prompt wait exit-form &rest args)
"Execute single-key commands defined in MAP till a key is pressed which is not part of map.
"Execute keys defined in MAP till a key is pressed which is not in MAP.
Single-key input commands are those that once executed do not
require the prefix command for subsequent invocation. Return the
value of the lastly executed command. PROMPT is passed to
@@ -574,7 +588,7 @@ With double prefix ARG (\\[universal-argument]
If the current language defines `ess-build-tags-command' use it
and ask the subprocess to build the tags. Otherwise use imenu
regexp and call find .. | etags .. in a shell command. You must
have 'find' and 'etags' programs installed.
have `find' and `etags' programs installed.
Use M-. to navigate to a tag. \\[visit-tags-table] to
append/replace the currently used tag table.

View File

@@ -1,6 +1,6 @@
;;; ess.el --- Emacs Speaks Statistics -*- lexical-binding: t; -*-
;; Copyright (C) 1997-2020 Free Software Foundation, Inc.
;; Copyright (C) 1997-2022 Free Software Foundation, Inc.
;; Author: David Smith <dsmith@stats.adelaide.edu.au>
;; A.J. Rossini <blindglobe@gmail.com>
@@ -20,7 +20,7 @@
;; Version: 18.10.3snapshot
;; URL: https://ess.r-project.org/
;; Package-Requires: ((emacs "25.1"))
;; ESSR-Version: 1.7
;; ESSR-Version: 1.8
;; This file is part of GNU Emacs.
@@ -51,20 +51,24 @@
(require 'ess-utils)
(require 'cl-generic)
(require 'lisp-mnt)
(defvar reporter-prompt-for-summary-p)
;; Versions
(defconst ess-version (eval-when-compile
(require 'lisp-mnt)
(lm-version (or load-file-name buffer-file-name)))
(lm-version (or (and (boundp 'load-true-file-name)
load-true-file-name)
load-file-name
buffer-file-name)))
"Version of ESS currently loaded.")
(defconst essr-version (eval-when-compile
(require 'lisp-mnt)
(lm-with-file (or load-file-name buffer-file-name)
(lm-with-file (or (and (boundp 'load-true-file-name)
load-true-file-name)
load-file-name
buffer-file-name)
(lm-header "ESSR-Version")))
"Version of ESSR package.")

File diff suppressed because it is too large Load Diff

View File

@@ -37,7 +37,7 @@
;; Easily changeable in a user's .emacs
(defvar S+elsewhere-dialect-name "S+6"
"Name of 'dialect' for S-PLUS at another location.")
"Name of `dialect' for S-PLUS at another location.")
(defvar S+elsewhere-start-args "-i"
"Arguments for `S+elsewhere-dialect-name'.")

Binary file not shown.

View File

@@ -1,6 +1,6 @@
#!/usr/bin/env Rscript
## -*- mode: R -*-
## code to build ESSR environemnt.
## code to build ESSR environment.
## Assume that current directory is etc/ESSR
## run "./BUILDESSR" to create ../ESSR.rda

View File

@@ -1,6 +1,6 @@
#### Essential functionality needed by ESS
## Should work on *all* vesions of R.
## Should work on *all* versions of R.
## Do not use _ in names, nor :: , nor 1L etc, as they
## cannot be parsed in old R versions
@@ -32,15 +32,18 @@
## utils:::print.help_files_with_topic (used internally when there's
## more than one a package) uses the quoted call
## MM: don't understand; more specifically?
.ess.help <- function(...) {
..help <- function(...) {
do.call(get("help", envir = .GlobalEnv), list(...))
}
if (.ess.Rversion > "2.10") {
## Abbreviating help_type to avoid underscore
.ess.help(..., help = help.type)
if(!is.null(getOption("warnPartialMatchArgs"))) {
op <- options(warnPartialMatchArgs = FALSE); on.exit(options(op))
}
..help(..., help = help.type)
} else {
.ess.help(..., htmlhelp = help.type == "html")
..help(..., htmlhelp = help.type == "html")
}
}
@@ -145,7 +148,7 @@
## The following on.exit infloops in R 3.3.0
## https://github.com/emacs-ess/ESS/issues/334
## https://bugs.r-project.org/bugzilla/show_bug.cgi?id=16971
## So we are cleanning it in .ess.source instead.
## So we are cleaning it in .ess.source instead.
## on.exit(file.remove(file))
.ess.source(file, visibly = visibly, output = output,
max.deparse.length = max.deparse.length,

View File

@@ -35,7 +35,7 @@
assign(".ess.Rversion", Rver, envir = ESSR)
## updated by make !!
VERSION <- "1.7"
VERSION <- "1.8"
assign(".ess.ESSRversion", VERSION, envir = ESSR)
ESSR

View File

@@ -9,7 +9,7 @@ if(!exists("local"))
local <- function(expr, envir = environment()) { invisible(eval(expr, envir=envir)) }
##' Robust version of
##' utils:::.addFunctionInfo(c = c("recursive", "use.names"))
##' utils:::.addFunctionInfo(c = c("recursive", "use.names")) # needed only for R <= 3.y.z
local({
U <- asNamespace("utils"); fn <- ".addFunctionInfo"
EX <- exists(fn, envir=U)
@@ -30,6 +30,7 @@ local({
else x
}
## not needed for completion; called from (ess-r-xref--srcref *) in ../../../lisp/ess-r-xref.el
.ess_srcref <- function(name, pkg) {
if (!is.null(pkg) && requireNamespace(pkg)) {
env <- asNamespace(pkg)
@@ -39,19 +40,17 @@ local({
fn <- .ess_eval(name, env)
if (is.null(fn)) {
objs <- utils::getAnywhere(name)$objs
for (o in objs) {
if (is.function(o)) {
fn <- o
break;
}
for (fn in objs) {
if(is.function(fn))
break
}
}
out <- "()\n"
if (is.function(fn) && !is.null(utils::getSrcref(fn))) {
file <- utils::getSrcFilename(fn, full.names = TRUE)
if (file != "") {
line <- .ess_nonull(utils::getSrcLocation(fn, "line"), 1)
col <- .ess_nonull(utils::getSrcLocation(fn, "column"), 1)
line <- .ess_nonull(utils::getSrcLocation(fn, "line" ), 1)
col <- .ess_nonull(utils::getSrcLocation(fn, "column"), 1)
out <- sprintf("(\"%s\" %d %d)\n", file, line, col - 1)
}
}
@@ -112,7 +111,11 @@ local({
.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'){
sett <- utils::rc.settings
oldDots <- sett()[["dots"]]
on.exit(sett(dots=oldDots), add=TRUE)
sett(dots = FALSE)
if(.ess.Rversion > '2.14.1') {
comp <- compiler::enableJIT(0)
op <- options(error=NULL)
on.exit({ options(op); compiler::enableJIT(comp)}, add = TRUE)
@@ -125,7 +128,7 @@ local({
utils:::.retrieveCompletions())
}
.ess_arg_help <- function(arg, func){
.ess_arg_help <- function(arg, func) {
op <- options(error=NULL)
on.exit(options(op))
fguess <-
@@ -151,9 +154,9 @@ local({
}
}
funcs <- c(fguess, tryCatch(methods(fguess),
warning=function(w) {NULL},
error=function(e) {NULL}))
if(length(funcs) > 1 && length(pos <- grep('default', funcs))){
warning= function(w) NULL,
error = function(e) NULL))
if(length(funcs) > 1 && length(pos <- grep('default', funcs))) {
funcs <- c(funcs[[pos[[1]]]], funcs[-pos[[1]]])
}
i <- 1; found <- FALSE

View File

@@ -82,7 +82,7 @@
paste0(pkgname, ':::`', dbged, '`')
}))
env <- parent.frame()
## traced function don't appear here. Not realy needed and would affect performance.
## traced function don't appear here. Not really needed and would affect performance.
all <- .ess_all_functions(packages = packages, env = env)
which_deb <- lapply(all, function(nm){
## if isdebugged is called with string it doess find
@@ -160,10 +160,13 @@
.essWEnames <- allNames(exps)
len0p <- !nzchar(.essWEnames)
.essWEnames[len0p] <- seq_along(len0p)[len0p]
oo <- options(width = 10000)
on.exit(options(oo))
for(i in seq_along(exps)) {
cat('\n@---- ', .essWEnames[[i]], ' ',
rep.int('-', max(0, 35 - nchar(.essWEnames[[i]]))), '-@\n', sep = '')
cat(paste('@---:', deparse(exps[[i]][[1]])), ' \n', sep = '')
expr <- gsub(" +", " ", paste(deparse(exps[[i]][[1]]), collapse = " "))
cat(paste('@---:', expr), ' \n', sep = '')
tryCatch(print(eval(exps[[i]],
envir = .parent_frame)),
error = function(e) cat('Error:', e$message, '\n' ),

View File

@@ -51,7 +51,7 @@
} else {
if (is.matrix(x))
x <- data.frame(unclass(x))
## conversion needed, to avoid problems with derived classes suchs
## conversion needed, to avoid problems with derived classes such
## as data.table
h <- as.data.frame(head(x, hlength))
t <- as.data.frame(tail(x, tlength))

View File

@@ -1,4 +1,4 @@
## simple Message Parsing Inerface
## simple Message Parsing Interface
.ess_mpi_send <- function(head, ...){
dots <- lapply(list(...), function(el) {

View File

@@ -223,7 +223,7 @@
## table is used. When ess-developer is used to source method definitions the
## two copies of the functions are identical up to the environment. The
## environment of the cached object has namespace:foo as it's parent but the
## environment of the object in local table is precisely namspace:foo. This
## environment of the object in local table is precisely namespace:foo. This
## does not cause any difference in evaluation.
methodNames <- allMethodTables
methods <- sub(methods:::.TableMetaPrefix(), "", methodNames)

View File

@@ -25,7 +25,7 @@
;;; Commentary:
;;;;; eldoc funcitonality has been moved into the core ;;;;;
;;;;; eldoc functionality has been moved into the core ;;;;;
;;;;; this file has no effect and is left in ESS in order not to break
;;;;; users configuration
@@ -86,7 +86,7 @@
;; Emacs 21, because it needs the variable
;; eldoc-documentation-function.
;;;; VS [25-02-2012]: all these issues were at least partially addresed in the
;;;; VS [25-02-2012]: all these issues were at least partially addressed in the
;;;; new implementation:
;; Bug (in eldoc?): the arg list for legend() is too long to fit in

View File

@@ -1,7 +1,6 @@
;;; ess-font-lock.el --- font-lock color options
;; Copyright (C) 2000--2006 A.J. Rossini, Richard M. Heiberger, Martin
;; Maechler, Kurt Hornik, Rodney Sparapani, and Stephen Eglen.
;; Copyright (C) 2000-2022 Free Software Foundation, Inc.
;; Author: Richard M. Heiberger <rmh@temple.edu>
;; Created: 06 Feb 2000

View File

@@ -26,7 +26,7 @@
;;; Commentary:
;; Support for mouse- or cursor-sensitive actions. This is based on
;; and uses mouseme.el. mouseme.el only does mouse sensititivity.
;; and uses mouseme.el. mouseme.el only does mouse sensitivity.
;; The new functions ess-mouse-me and ess-mouse-me-helper do similar
;; things based on the cursor, not the mouse, and can be bound to a
;; keystroke.

View File

@@ -298,7 +298,7 @@ ending positions of the string in the buffer in that order."
(defun mouse-me-buffer-file-extension ()
"Return the extension of the current buffer's filename or nil.
Returned extension is a string begining with a period."
Returned extension is a string beginning with a period."
(let* ((bfn (buffer-file-name))
(filename (and bfn (file-name-sans-versions bfn)))
(index (and filename (string-match "\\.[^.]*$" filename))))