update of packages
This commit is contained in:
@@ -1,11 +0,0 @@
|
||||
;;; Directory Local Variables
|
||||
;;; For more information see (info "(emacs) Directory Variables")
|
||||
|
||||
((nil
|
||||
(bug-reference-bug-regexp . "#\\(?2:[0-9]+\\)")
|
||||
(bug-reference-url-format . "https://github.com/emacs-ess/ess/issues/%s")
|
||||
(sentence-end-double-space))
|
||||
(emacs-lisp-mode
|
||||
(outline-regexp . "\f\\|\\`;\\|;;\\*\\|;;;\\*\\|(def[cvum]\\|(setq\\|;;;;\\*")
|
||||
(indent-tabs-mode))
|
||||
(ess-r-mode . ((ess-style . RRR))))
|
||||
@@ -1,6 +1,6 @@
|
||||
;;; ess-bugs-d.el --- ESS[BUGS] dialect -*- lexical-binding: t; -*-
|
||||
|
||||
;; Copyright (C) 2008-2020 Free Software Foundation, Inc.
|
||||
;; Copyright (C) 2008-2022 Free Software Foundation, Inc.
|
||||
|
||||
;; Author: Rodney Sparapani
|
||||
;; Maintainer: ESS-help <ess-help@r-project.org>
|
||||
@@ -251,7 +251,7 @@
|
||||
(setq ess-language "S") ; mimic S for ess-smart-underscore
|
||||
(unless (when (fboundp 'w32-shell-dos-semantics)
|
||||
(w32-shell-dos-semantics))
|
||||
(add-hook 'comint-output-filter-functions 'ess-bugs-exit-notify-sh)))
|
||||
(add-hook 'comint-output-filter-functions #'ess-bugs-exit-notify-sh)))
|
||||
|
||||
;;;###autoload
|
||||
(add-to-list 'auto-mode-alist '("\\.[Bb][Uu][Gg]\\'" . ess-bugs-mode))
|
||||
|
||||
@@ -323,7 +323,7 @@ Value of `ess-startup-directory' has precedence over this function."
|
||||
(defvaralias 'ess-directory 'ess-startup-directory)
|
||||
(defcustom ess-startup-directory nil
|
||||
"The directory to run ESS processes from.
|
||||
If a string it should bi a directory from which to start the
|
||||
If a string it should be 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
|
||||
@@ -1322,7 +1322,7 @@ these values, use the customize interface. See the documentation
|
||||
of each variable for its meaning."
|
||||
:group 'ess-edit
|
||||
:type 'alist
|
||||
:initialize 'custom-initialize-set
|
||||
:initialize #'custom-initialize-set
|
||||
:set (lambda (symbol value)
|
||||
(set symbol value)
|
||||
(ess-add-style 'OWN value)))
|
||||
@@ -1400,7 +1400,11 @@ Good for setting up your directory."
|
||||
|
||||
(defcustom ess-post-run-hook nil
|
||||
"Hook to call just after the ESS process starts up.
|
||||
Good for evaluating ESS code."
|
||||
Currently this should not be used to interact with the inferior
|
||||
process because this hook runs too early, before the inferior
|
||||
mode had a chance to properly start up the process. To interact
|
||||
with the process, you must use a mode-specific hook like
|
||||
'ess-r-post-run-hook'."
|
||||
:group 'ess-hooks
|
||||
:type 'hook)
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
;; ess-gretl.el --- ESS gretl mode and inferior interaction -*- lexical-binding: t; -*-
|
||||
|
||||
;; Copyright (C) 2012-2020 Free Software Foundation, Inc.
|
||||
;; Copyright (C) 2012-2022 Free Software Foundation, Inc.
|
||||
;; Author: Ahmadou Dicko, Spinu Vitalie and Allin Cottrell
|
||||
;; Maintainer: ESS Core Team <ESS-core@r-project.org>
|
||||
;; Created: 01-10-2012 (ESS 12.09)
|
||||
@@ -254,19 +254,13 @@ parenthetical grouping.")
|
||||
(defconst gretl-font-lock-keywords
|
||||
(list
|
||||
;; Fontify all builtin keywords.
|
||||
(cons (concat "\\<\\("
|
||||
(mapconcat 'identity gretl-keywords "\\|")
|
||||
"\\)\\>")
|
||||
(cons (concat "\\<\\(" (regexp-opt gretl-keywords) "\\)\\>")
|
||||
'font-lock-keyword-face)
|
||||
;; Fontify all option flags.
|
||||
(cons (concat "[ \t]--\\("
|
||||
(mapconcat 'identity gretl-option-flags "\\|")
|
||||
"\\)")
|
||||
(cons (concat "[ \t]--\\(" (regexp-opt gretl-option-flags) "\\)")
|
||||
'font-lock-constant-face)
|
||||
;; Fontify all command words.
|
||||
(cons (concat "\\<\\("
|
||||
(mapconcat 'identity gretl-command-words "\\|")
|
||||
"\\)\\>")
|
||||
(cons (concat "\\<\\(" (regexp-opt gretl-command-words) "\\)\\>")
|
||||
'font-lock-builtin-face)
|
||||
;; Fontify all builtin operators.
|
||||
(cons "\\(&\\||\\|<=\\|>=\\|==\\|<\\|>\\|!=\\|!\\)"
|
||||
@@ -274,15 +268,11 @@ parenthetical grouping.")
|
||||
'font-lock-builtin-face
|
||||
'font-lock-preprocessor-face))
|
||||
;; Fontify all internal variables.
|
||||
(cons (concat "\\$\\("
|
||||
(mapconcat 'identity gretl-internal-vars "\\|")
|
||||
"\\)\\>")
|
||||
(cons (concat "\\$\\(" (regexp-opt gretl-internal-vars) "\\)\\>")
|
||||
'font-lock-variable-name-face)
|
||||
|
||||
;; Fontify all genr functions.
|
||||
(cons (concat "\\<\\("
|
||||
(mapconcat 'identity gretl-genr-functions "\\|")
|
||||
"\\)\\>")
|
||||
(cons (concat "\\<\\(" (regexp-opt gretl-genr-functions) "\\)\\>")
|
||||
'font-lock-variable-name-face)
|
||||
;; Fontify all function declarations.
|
||||
(list gretl-function-header-regexp
|
||||
@@ -292,19 +282,13 @@ parenthetical grouping.")
|
||||
|
||||
|
||||
(defvar gretl-block-begin-regexp
|
||||
(concat "\\<\\("
|
||||
(mapconcat 'identity gretl-block-start-keywords "\\|")
|
||||
"\\)\\>"))
|
||||
(concat "\\<\\(" (regexp-opt gretl-block-start-keywords) "\\)\\>"))
|
||||
|
||||
(defvar gretl-block-else-regexp
|
||||
(concat "\\<\\("
|
||||
(mapconcat 'identity gretl-block-other-keywords "\\|")
|
||||
"\\)\\>"))
|
||||
(concat "\\<\\(" (regexp-opt gretl-block-other-keywords) "\\)\\>"))
|
||||
|
||||
(defvar gretl-block-end-regexp
|
||||
(concat "\\<\\("
|
||||
(mapconcat 'identity gretl-block-end-keywords "\\|")
|
||||
"\\)\\>"))
|
||||
(concat "\\<\\(" (regexp-opt gretl-block-end-keywords) "\\)\\>"))
|
||||
|
||||
(defvar gretl-block-begin-or-end-regexp
|
||||
(concat gretl-block-begin-regexp "\\|" gretl-block-end-regexp))
|
||||
@@ -378,7 +362,7 @@ end keywords as associated values.")
|
||||
(interactive)
|
||||
(end-of-line)
|
||||
(indent-line-to
|
||||
(or (and (ess-inside-string-p (point-at-bol)) 0)
|
||||
(or (and (ess-inside-string-p (line-beginning-position)) 0)
|
||||
(save-excursion (ignore-errors (gretl-form-indent)))
|
||||
(save-excursion
|
||||
(let ((endtok (progn
|
||||
@@ -544,7 +528,7 @@ to gretl, put them in the variable `inferior-gretl-args'."
|
||||
"'] ? "))
|
||||
nil)))
|
||||
(inf-buf (inferior-ess r-start-args gretl-customize-alist)))
|
||||
(setq-local indent-line-function 'gretl-indent-line)
|
||||
(setq-local indent-line-function #'gretl-indent-line)
|
||||
(setq-local gretl-basic-offset 4)
|
||||
(setq indent-tabs-mode nil)
|
||||
(goto-char (point-max))
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
;;; ess-help.el --- Support for viewing ESS help files -*- 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
|
||||
@@ -168,7 +168,7 @@ ignored."
|
||||
(ess-process-put 'sp-for-help-changed? t)
|
||||
(ess-display-help-on-object ess-help-object))
|
||||
|
||||
(defalias 'ess-help 'ess-display-help-on-object)
|
||||
(defalias 'ess-help #'ess-display-help-on-object)
|
||||
|
||||
(cl-defgeneric ess-build-help-command (object)
|
||||
"Build a string command for retrieving help on OBJECT."
|
||||
@@ -282,7 +282,7 @@ REG-START gives the start location from where to search linkifying,
|
||||
(delete-region (point-min) (point-max))
|
||||
(setq ess-local-process-name pname)
|
||||
(ess--help-major-mode)
|
||||
(ess-setq-vars-local (eval alist))
|
||||
(ess-setq-vars-local (eval alist t))
|
||||
(setq ess-help-object help-object
|
||||
ess-help-sec-regex "\\(^\\s-.*\n\\)\\|\\(^\n\\)")
|
||||
(ess--foreground-command command buff)
|
||||
@@ -376,7 +376,7 @@ See `ess-display-vignettes' for ALL."
|
||||
(get-text-property pos 'vignette)
|
||||
(get-text-property pos 'package))))
|
||||
|
||||
(defalias 'ess-help-quit 'quit-window)
|
||||
(defalias 'ess-help-quit #'quit-window)
|
||||
(make-obsolete 'ess-help-quit 'quit-window "16.04")
|
||||
|
||||
(defun ess-display-help (buff)
|
||||
@@ -659,7 +659,7 @@ nil otherwise."
|
||||
|
||||
(defun ess-get-help-files-list ()
|
||||
"Return a list of files which have help available."
|
||||
(apply 'nconc
|
||||
(apply #'nconc
|
||||
(mapcar (lambda (str)
|
||||
(let ((dirname (concat str "/.Help")))
|
||||
(and (file-directory-p dirname)
|
||||
@@ -758,7 +758,8 @@ other dialects)."
|
||||
(ess-symbol-at-point)))
|
||||
ess--descr-o-a-p-commands) ;; used in ess--describe-object-at-point
|
||||
(unless objname (error "No object at point "))
|
||||
(define-key map (vector last-command-event) 'ess--describe-object-at-point)
|
||||
(define-key map (vector last-command-event)
|
||||
#'ess--describe-object-at-point)
|
||||
;; todo: put digits into the map
|
||||
(let* ((inhibit-quit t) ;; C-g removes the buffer
|
||||
(buf (ess--execute-electric-command
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
;;; ess-inf.el --- Support for running S as an inferior Emacs process -*- lexical-binding: t; -*-
|
||||
|
||||
;; Copyright (C) 1989-2022 Free Software Foundation, Inc.
|
||||
;; Copyright (C) 1989-2023 Free Software Foundation, Inc.
|
||||
|
||||
;; Author: David Smith <dsmith@stats.adelaide.edu.au>
|
||||
;; Created: 7 Jan 1994
|
||||
@@ -103,7 +103,8 @@ been initialized."
|
||||
(progn
|
||||
(setq-local inferior-ess-mode-syntax-table
|
||||
(eval (or (alist-get 'inferior-ess-mode-syntax-table ess-local-customize-alist)
|
||||
(alist-get 'ess-mode-syntax-table ess-local-customize-alist))))
|
||||
(alist-get 'ess-mode-syntax-table ess-local-customize-alist))
|
||||
t))
|
||||
(inferior-ess-mode)))))
|
||||
|
||||
;;*;; Process handling
|
||||
@@ -129,6 +130,11 @@ If `ess-plain-first-buffername', then initial process is number-free."
|
||||
(defvar-local inferior-ess--local-data nil
|
||||
"Program name and arguments used to start the inferior process.")
|
||||
|
||||
(defvar inferior-ess--last-started-process-buffer nil
|
||||
"Useful in unit tests to check initialisation errors.
|
||||
In that case the command fails before it can return the process
|
||||
buffer to us. This global variable can be checked instead.")
|
||||
|
||||
(defun inferior-ess (start-args customize-alist &optional no-wait)
|
||||
"Start inferior ESS process.
|
||||
Without a prefix argument, starts a new ESS process, or switches
|
||||
@@ -160,7 +166,7 @@ This may be useful for debugging."
|
||||
;; This function is primarily used to figure out the Process and
|
||||
;; buffer names to use for inferior-ess.
|
||||
(run-hooks 'ess-pre-run-hook)
|
||||
(let* ((dialect (eval (cdr (assoc 'ess-dialect customize-alist))))
|
||||
(let* ((dialect (eval (cdr (assoc 'ess-dialect customize-alist)) t))
|
||||
(process-environment process-environment)
|
||||
;; Use dialect if not R, R program name otherwise
|
||||
(temp-dialect (if ess-use-inferior-program-in-buffer-name ;VS[23-02-2013]: FIXME: this should not be here
|
||||
@@ -202,15 +208,14 @@ This may be useful for debugging."
|
||||
(ess-wait-for-process proc nil 0.01 t))
|
||||
(unless (and proc (eq (process-status proc) 'run))
|
||||
(error "Process %s failed to start" proc-name))
|
||||
(when ess-setwd-command
|
||||
(ess-set-working-directory default-directory))
|
||||
(setq-local font-lock-fontify-region-function #'inferior-ess-fontify-region)
|
||||
(setq-local ess-sl-modtime-alist nil)
|
||||
(run-hooks 'ess-post-run-hook)
|
||||
;; User initialization can take some time ...
|
||||
(unless no-wait
|
||||
(ess-write-to-dribble-buffer "(inferior-ess 3): waiting for process after hook")
|
||||
(ess-write-to-dribble-buffer "(inferior-ess): waiting for process (after hook)\n")
|
||||
(ess-wait-for-process proc)))
|
||||
(setq inferior-ess--last-started-process-buffer inf-buf)
|
||||
inf-buf)))
|
||||
|
||||
(defun inferior-ess--get-proc-buffer-create (name)
|
||||
@@ -288,7 +293,6 @@ Default depends on the ESS language/dialect and hence made buffer local")
|
||||
BEG and END signify the bounds, VERBOSE gets passed to
|
||||
`font-lock-default-fontify-region'."
|
||||
(let* ((buffer-undo-list t)
|
||||
(inhibit-point-motion-hooks t)
|
||||
(font-lock-dont-widen t)
|
||||
(font-lock-extend-region-functions nil)
|
||||
(pos1 beg)
|
||||
@@ -356,14 +360,13 @@ defined. If no project directory has been found, use
|
||||
;; This ensures that people who have this set in their init file don't
|
||||
;; get errors about undefined functions after upgrading ESS:
|
||||
(define-obsolete-function-alias 'ess-gen-proc-buffer-name:projectile-or-simple
|
||||
'ess-gen-proc-buffer-name:project-or-simple "ESS 19.04")
|
||||
#'ess-gen-proc-buffer-name:project-or-simple "ESS 19.04")
|
||||
(define-obsolete-function-alias 'ess-gen-proc-buffer-name:projectile-or-directory
|
||||
'ess-gen-proc-buffer-name:project-or-directory "ESS 19.04")
|
||||
#'ess-gen-proc-buffer-name:project-or-directory "ESS 19.04")
|
||||
|
||||
(defun inferior-ess-available-p (&optional proc)
|
||||
"Return non-nil if PROC is not busy."
|
||||
(when-let ((proc (or proc (and ess-local-process-name
|
||||
(get-process ess-local-process-name)))))
|
||||
(when-let ((proc (or proc (ess-get-current-process))))
|
||||
(unless (process-get proc 'busy)
|
||||
(or (ess-debug-active-p proc) ; don't send empty lines in debugger
|
||||
(when-let ((last-check (process-get proc 'last-availability-check)))
|
||||
@@ -478,10 +481,16 @@ inserted in the process buffer instead of the command buffer."
|
||||
(process-put proc 'busy nil))))
|
||||
|
||||
(defun ess--delimiter-start-re (delim)
|
||||
(concat "\\(" delim "-START$\\)"))
|
||||
(concat "\\(" delim "-START\r*$\\)"))
|
||||
|
||||
(defun ess--delimiter-end-re (delim)
|
||||
(concat "\\(" delim "-END\\)"))
|
||||
(concat "\\(" delim "-END\r*\\)"))
|
||||
|
||||
(defun ess--delimiter-error-start-re ()
|
||||
"ESSR::ERROR \\(\"\\)")
|
||||
|
||||
(defun ess--delimiter-error-end-re ()
|
||||
"\\(\"\\)")
|
||||
|
||||
(defun inferior-ess-mark-as-busy (proc)
|
||||
"Put PROC's busy value to t."
|
||||
@@ -518,8 +527,9 @@ inserted in the process buffer instead of the command buffer."
|
||||
--> busy:%s busy-end:%s sec-prompt:%s interruptable:%s <--
|
||||
--> running-async:%s callback:%s suppress-next-output:%s <--
|
||||
--> dbg-active:%s is-recover:%s <--
|
||||
--> string:%s\n"
|
||||
(or filter "NORMAL-FILTER")
|
||||
--> cmd-buffer:%s cmd-output-delimiter:%s <--
|
||||
--> string:%s<--\n"
|
||||
(upcase (or filter "normal-filter"))
|
||||
(process-get proc 'busy)
|
||||
(process-get proc 'busy-end?)
|
||||
(process-get proc 'sec-prompt)
|
||||
@@ -529,6 +539,8 @@ inserted in the process buffer instead of the command buffer."
|
||||
(process-get proc 'suppress-next-output?)
|
||||
(process-get proc 'dbg-active)
|
||||
(process-get proc 'is-recover)
|
||||
(process-get proc 'cmd-buffer)
|
||||
(process-get proc 'cmd-output-delimiter)
|
||||
(if (> (length string) 150)
|
||||
(format "%s .... %s" (substring string 0 50) (substring string -50))
|
||||
string))))
|
||||
@@ -608,8 +620,8 @@ process-less buffer because it was created with
|
||||
(split-string switches))))
|
||||
(let ((proc (get-buffer-process buf)))
|
||||
;; Set the process hooks
|
||||
(set-process-sentinel proc 'ess-process-sentinel)
|
||||
(set-process-filter proc 'inferior-ess-output-filter)
|
||||
(set-process-sentinel proc #'ess-process-sentinel)
|
||||
(set-process-filter proc #'inferior-ess-output-filter)
|
||||
(inferior-ess-mark-as-busy proc)
|
||||
;; Add this process to ess-process-name-list, if needed
|
||||
(let ((conselt (assoc proc-name ess-process-name-list)))
|
||||
@@ -640,7 +652,9 @@ the name of the inferior process (e.g. \"R:1\"), and DIALECT is
|
||||
the language dialect (e.g. \"R\")."
|
||||
(let ((default-dir (inferior-ess--get-startup-directory)))
|
||||
(if ess-ask-for-ess-directory
|
||||
(let ((prompt (format "%s starting project directory? " procname)))
|
||||
(let ((prompt (format "%s starting project directory? " procname))
|
||||
(display-buffer-overriding-action nil) ; hack to let helm display a buffer
|
||||
)
|
||||
(ess-prompt-for-directory default-dir prompt))
|
||||
default-dir)))
|
||||
|
||||
@@ -668,7 +682,7 @@ local ESS vars like `ess-local-process-name'."
|
||||
(,dialect ess-dialect)
|
||||
(,alist ess-local-customize-alist))
|
||||
(with-current-buffer ,buffer
|
||||
(ess-setq-vars-local (eval ,alist))
|
||||
(ess-setq-vars-local (eval ,alist t))
|
||||
(setq ess-local-process-name ,lpn)
|
||||
(setq ess-dialect ,dialect)
|
||||
,@body))))
|
||||
@@ -754,10 +768,8 @@ Returns the name of the process, or nil if the current buffer has none."
|
||||
"Check if the local ess process is alive.
|
||||
Return nil if current buffer has no associated process, or
|
||||
process was killed. PROC defaults to `ess-local-process-name'"
|
||||
(and (or proc ess-local-process-name)
|
||||
(let ((proc (or proc (get-process ess-local-process-name))))
|
||||
(and (processp proc)
|
||||
(process-live-p proc)))))
|
||||
(when-let ((proc (or proc (ess-get-current-process))))
|
||||
(process-live-p proc)))
|
||||
|
||||
(defun ess-process-get (propname &optional proc)
|
||||
"Return the variable PROPNAME (symbol) of the current ESS process.
|
||||
@@ -830,8 +842,10 @@ to `ess-completing-read'."
|
||||
'ess-dialect
|
||||
(process-buffer (get-process
|
||||
(car pname-list))))))))
|
||||
;; try to start "the appropriate" process, don't show the buffer
|
||||
;; Try to start "the appropriate" process, don't show the buffer
|
||||
;; since we handle that explicitly with no-switch
|
||||
(ess-if-verbose-write
|
||||
"ess-request-a-process: Can't find a process, starting a new one\n")
|
||||
(ess--with-no-pop-to-buffer
|
||||
(ess-start-process-specific ess-language ess-dialect))
|
||||
(setq num-processes 1
|
||||
@@ -857,6 +871,8 @@ to `ess-completing-read'."
|
||||
;; Prevent new process buffer from being popped
|
||||
;; because we handle display depending on the value
|
||||
;; of `no-switch`
|
||||
(ess-if-verbose-write
|
||||
"ess-request-a-process: User requested a new process\n")
|
||||
(ess--with-no-pop-to-buffer
|
||||
(ess-start-process-specific ess-language ess-dialect))
|
||||
(caar ess-process-name-list))))))
|
||||
@@ -866,7 +882,12 @@ to `ess-completing-read'."
|
||||
(let ((proc-buf (ess-get-process-buffer proc)))
|
||||
(if noswitch
|
||||
(display-buffer proc-buf)
|
||||
(pop-to-buffer proc-buf))))
|
||||
(pop-to-buffer proc-buf))
|
||||
;; If inferior startup has already finished, set screen
|
||||
;; options again in case the post-run hook ran before a new
|
||||
;; screen config was created by `pop-to-buffer' (#1243).
|
||||
(with-current-buffer proc-buf
|
||||
(ess--execute-screen-options-bg))))
|
||||
proc))
|
||||
|
||||
(defun ess-force-buffer-current (&optional prompt force no-autostart ask-if-1)
|
||||
@@ -900,26 +921,50 @@ it was successfully forced, throws an error otherwise."
|
||||
(interactive)
|
||||
(ess-force-buffer-current "Process to use: " 'force nil 'ask-if-1))
|
||||
|
||||
(defun ess-get-next-available-process (&optional dialect ignore-busy)
|
||||
(defun ess-get-current-process ()
|
||||
(when ess-local-process-name
|
||||
(get-process ess-local-process-name)))
|
||||
|
||||
(defun ess-get-current-process-buffer ()
|
||||
(when-let ((proc (ess-get-current-process)))
|
||||
(process-buffer proc)))
|
||||
|
||||
(defun ess-get-next-available-process (&optional dialect ignore-busy background)
|
||||
"Return first available (aka not busy) process of dialect DIALECT.
|
||||
DIALECT defaults to the local value of ess-dialect. Return nil if
|
||||
no such process has been found."
|
||||
no such process has been found. If BACKGROUND is non-nil, only
|
||||
processes that are allowed to evaluate in the background are
|
||||
matched."
|
||||
(setq dialect (or dialect ess-dialect))
|
||||
(when dialect
|
||||
(when (and dialect (or (not background)
|
||||
ess-can-eval-in-background))
|
||||
(let (proc)
|
||||
(catch 'found
|
||||
(dolist (p (cons ess-local-process-name
|
||||
(mapcar 'car ess-process-name-list)))
|
||||
(mapcar #'car ess-process-name-list)))
|
||||
(when p
|
||||
(setq proc (get-process p))
|
||||
(when (and proc
|
||||
(process-live-p proc)
|
||||
(equal dialect
|
||||
(buffer-local-value 'ess-dialect (process-buffer proc)))
|
||||
;; Check that we can evaluate in background
|
||||
;; before checking for availability to
|
||||
;; avoid issues with newline handshakes
|
||||
(or (not background)
|
||||
(ess-can-eval-in-background proc))
|
||||
(or ignore-busy
|
||||
(inferior-ess-available-p proc)))
|
||||
(throw 'found proc))))))))
|
||||
|
||||
(defun ess-get-next-available-bg-process (&optional proc dialect ignore-busy)
|
||||
"Returns first avaiable process only if background evaluations are allowed.
|
||||
Same as `ess-get-next-available-process' but checks for
|
||||
`ess-can-eval-in-background'."
|
||||
(if proc
|
||||
(ess-can-eval-in-background proc)
|
||||
(ess-get-next-available-process dialect ignore-busy 'background)))
|
||||
|
||||
|
||||
;;*;;; Commands for switching to the process buffer
|
||||
|
||||
@@ -1049,38 +1094,42 @@ Returns nil if TIMEOUT was reached, non-nil otherwise."
|
||||
(setq wait .3))))
|
||||
(< elapsed timeout)))
|
||||
|
||||
;; This filter is active under `ess-command`
|
||||
(defun inferior-ess-ordinary-filter (proc string)
|
||||
(ess--if-verbose-write-process-state proc string "ordinary-filter")
|
||||
(let* ((cmd-buf (process-get proc 'cmd-buffer))
|
||||
(cmd-delim (process-get proc 'cmd-output-delimiter))
|
||||
(early-exit t))
|
||||
(cmd-delim (process-get proc 'cmd-output-delimiter)))
|
||||
(when (buffer-live-p cmd-buf)
|
||||
(unwind-protect
|
||||
(ess--exit-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))
|
||||
(if-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)))
|
||||
(ess-if-verbose-write
|
||||
"ess-command (filter): Found prompt\n")
|
||||
(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))))))
|
||||
(ess-if-verbose-write
|
||||
"ess-command (filter): Accumulating output\n")))
|
||||
;; 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)))))))
|
||||
(ess-if-verbose-write
|
||||
"ess-command (filter): Early exit\n")
|
||||
(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.
|
||||
@@ -1154,7 +1203,7 @@ Hide all the junk output in temporary buffer."
|
||||
;; this is to avoid putting junk in user's buffer on process
|
||||
;; interruption
|
||||
(set-process-buffer proc buf)
|
||||
(set-process-filter proc 'inferior-ess-ordinary-filter)
|
||||
(set-process-filter proc #'inferior-ess-ordinary-filter)
|
||||
(interrupt-process proc)
|
||||
(when cb
|
||||
(ess-if-verbose-write "executing interruption callback ... ")
|
||||
@@ -1286,19 +1335,6 @@ This handles Tramp when working on a remote."
|
||||
(user-error "ESS process not ready. Finish your command before trying again")))
|
||||
proc)
|
||||
|
||||
(defvar-local ess-format-command-alist nil
|
||||
"Alist of mode-specific parameters for formatting a command.
|
||||
All elements are optional.
|
||||
|
||||
- `fun': A formatting function for running a command. First
|
||||
argument is the background command to run. Must include a
|
||||
catch-all `&rest` parameter for extensibility.
|
||||
|
||||
- `use-delimiter' : Whether to wait for an output sentinel. If
|
||||
non-nil, `fun' should get the `cmd-output-delimiter' element of the
|
||||
alist of parameters and ensure the sentinel is written to the
|
||||
process output at the end of the command.")
|
||||
|
||||
(defvar inferior-ess--output-delimiter-count 0)
|
||||
(defun inferior-ess--output-delimiter ()
|
||||
(setq inferior-ess--output-delimiter-count (1+ inferior-ess--output-delimiter-count))
|
||||
@@ -1345,71 +1381,112 @@ wrapping the code into:
|
||||
(delim (inferior-ess--output-delimiter))
|
||||
(timeout (or timeout ess--command-default-timeout)))
|
||||
(with-current-buffer (process-buffer proc)
|
||||
(let ((proc-forward-alist (ess--alist (ess-local-process-name
|
||||
inferior-ess-primary-prompt)))
|
||||
(use-delimiter (alist-get 'use-delimiter ess-format-command-alist))
|
||||
(rich-cmd (if-let ((cmd-fun (alist-get 'fun ess-format-command-alist)))
|
||||
(funcall cmd-fun
|
||||
(ess--strip-final-newlines cmd)
|
||||
(cons 'output-delimiter delim))
|
||||
cmd))
|
||||
(early-exit t))
|
||||
(ess-if-verbose-write (format "(ess-command %s ..)" cmd))
|
||||
(let* ((proc-forward-alist (ess--alist (ess-local-process-name
|
||||
inferior-ess-primary-prompt)))
|
||||
(format-command-alist (ess-process-get 'format-command-alist))
|
||||
(use-delimiter (alist-get 'use-delimiter format-command-alist))
|
||||
(rich-cmd (if-let ((cmd-fun (alist-get 'fun format-command-alist)))
|
||||
(funcall cmd-fun
|
||||
(ess--strip-final-newlines cmd)
|
||||
(cons 'output-delimiter delim))
|
||||
cmd))
|
||||
(early-exit t))
|
||||
(ess-if-verbose-write (format "(ess-command '%s' ..)\n" cmd))
|
||||
;; Swap the process buffer with the output buffer before
|
||||
;; sending the command
|
||||
(unwind-protect
|
||||
(progn
|
||||
;; The process is restored from the filter once it's
|
||||
;; available again (i.e. a prompt or 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
|
||||
;; common cause of early exits are interrupts sent by
|
||||
;; Emacs when the user types (see `when-no-input'). In
|
||||
;; these cases we forward the interrupt to the process
|
||||
;; and return to the caller right away. We can't restore
|
||||
;; synchronously after an interrupt because the output
|
||||
;; of the background command would spill into the
|
||||
;; process buffer of the user when the process doesn't
|
||||
;; interrupt in time.
|
||||
(process-put proc 'cmd-restore-function
|
||||
(ess--command-make-restore-function proc))
|
||||
(when use-delimiter
|
||||
(process-put proc 'cmd-output-delimiter delim))
|
||||
(process-put proc 'cmd-buffer out-buffer)
|
||||
(set-process-filter proc 'inferior-ess-ordinary-filter)
|
||||
(with-current-buffer out-buffer
|
||||
(ess-setq-vars-local proc-forward-alist)
|
||||
(setq buffer-read-only nil)
|
||||
(erase-buffer)
|
||||
(inferior-ess-mark-as-busy proc)
|
||||
(process-send-string proc rich-cmd)
|
||||
;; Need time for ess-create-object-name-db on PC
|
||||
(if no-prompt-check
|
||||
(sleep-for 0.02) ; 0.1 is noticeable!
|
||||
(unless (ess-wait-for-process proc nil wait force-redisplay timeout)
|
||||
(error "Timeout during background ESS command `%s'"
|
||||
(ess--strip-final-newlines cmd)))))
|
||||
(setq early-exit nil))
|
||||
(when early-exit
|
||||
;; Protect process interruption from further quits
|
||||
(let ((inhibit-quit t))
|
||||
;; In case of early exit send an interrupt to the
|
||||
;; process to abort the command
|
||||
(with-current-buffer out-buffer
|
||||
(goto-char (point-min))
|
||||
(when (and use-delimiter
|
||||
(not (re-search-forward (ess--delimiter-start-re delim) nil t)))
|
||||
;; CMD probably failed to parse if the start delimiter
|
||||
;; can't be found in the output. Disable the delimiter
|
||||
;; before interrupt to avoid a freeze.
|
||||
(ess-write-to-dribble-buffer
|
||||
"Disabling output delimiter because CMD failed to parse")
|
||||
(process-put proc 'cmd-output-delimiter nil))
|
||||
(goto-char (point-max))
|
||||
(ess--interrupt proc)))))))
|
||||
(condition-case err
|
||||
(progn
|
||||
;; The process is restored from the filter once it's
|
||||
;; 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
|
||||
;; common cause of early exits are interrupts sent by
|
||||
;; Emacs when the user types (see `when-no-input'). In
|
||||
;; these cases we forward the interrupt to the process
|
||||
;; and return to the caller right away. We can't restore
|
||||
;; synchronously after an interrupt because the output
|
||||
;; of the background command would spill into the
|
||||
;; process buffer of the user when the process doesn't
|
||||
;; interrupt in time.
|
||||
(process-put proc 'cmd-restore-function
|
||||
(ess--command-make-restore-function proc))
|
||||
(when use-delimiter
|
||||
(process-put proc 'cmd-output-delimiter delim))
|
||||
(process-put proc 'cmd-buffer out-buffer)
|
||||
(set-process-filter proc #'inferior-ess-ordinary-filter)
|
||||
(with-current-buffer out-buffer
|
||||
(ess-setq-vars-local proc-forward-alist)
|
||||
(setq buffer-read-only nil)
|
||||
(erase-buffer)
|
||||
(inferior-ess-mark-as-busy proc)
|
||||
(process-send-string proc rich-cmd)
|
||||
;; Need time for ess-create-object-name-db on PC
|
||||
(if no-prompt-check
|
||||
(sleep-for 0.02) ; 0.1 is noticeable!
|
||||
(unless (ess-wait-for-process proc nil wait force-redisplay timeout)
|
||||
(error "Timeout during background ESS command `%s'"
|
||||
(ess--strip-final-newlines cmd))))
|
||||
(setq early-exit nil)))
|
||||
(error (setq early-exit err))
|
||||
(quit (setq early-exit err)))
|
||||
(if early-exit
|
||||
(ess--command-error-handler proc out-buffer use-delimiter delim early-exit)
|
||||
(with-current-buffer out-buffer
|
||||
(goto-char (point-min))
|
||||
(when (re-search-forward (ess--delimiter-error-start-re) nil t)
|
||||
(let ((start (1+ (match-beginning 1))))
|
||||
(when (re-search-forward (ess--delimiter-error-end-re) nil t)
|
||||
(let ((end (match-beginning 1)))
|
||||
(error "R error during background ESS command `%s'\nError: %s"
|
||||
(ess--strip-final-newlines cmd)
|
||||
(buffer-substring start end)))))))))))
|
||||
out-buffer))
|
||||
|
||||
(defun ess--command-error-handler (proc
|
||||
out-buffer
|
||||
use-delimiter
|
||||
delim
|
||||
early-exit)
|
||||
(let ((inhibit-quit t))
|
||||
;; In case of early exit send an interrupt to the
|
||||
;; process to abort the command
|
||||
(with-current-buffer out-buffer
|
||||
(goto-char (point-min))
|
||||
(when (and use-delimiter
|
||||
(not (re-search-forward (ess--delimiter-start-re delim) nil t)))
|
||||
;; CMD probably failed to parse if the start delimiter
|
||||
;; can't be found in the output. Disable the delimiter
|
||||
;; before interrupt to avoid a freeze.
|
||||
(ess-write-to-dribble-buffer
|
||||
"Disabling output delimiter because CMD failed to parse\n")
|
||||
(process-put proc 'cmd-output-delimiter nil))
|
||||
(goto-char (point-max))
|
||||
(ess--interrupt proc)))
|
||||
;; Can be `t` when early exit is caused e.g. by a throw instead of
|
||||
;; an error or a quit. This happens in tests and within
|
||||
;; `while-no-input'.
|
||||
(unless (eq early-exit t)
|
||||
(when (and (eq (car early-exit) 'quit)
|
||||
(y-or-n-p (concat "Background background command interrupted with a user quit.\n"
|
||||
"Would you like to disable background evaluations in this process?")))
|
||||
(process-put proc 'bg-eval-disabled t))
|
||||
(signal (car early-exit) (cdr early-exit))))
|
||||
|
||||
;; (ess-process-get 'ess-format-command-alist)
|
||||
;; "Alist of mode-specific parameters for formatting a command.
|
||||
;; All elements are optional.
|
||||
;;
|
||||
;; - `fun': A formatting function for running a command. First
|
||||
;; argument is the background command to run. Must include a
|
||||
;; catch-all `&rest` parameter for extensibility.
|
||||
;;
|
||||
;; - `use-delimiter' : Whether to wait for an output sentinel. If
|
||||
;; non-nil, `fun' should get the `cmd-output-delimiter' element of the
|
||||
;; alist of parameters and ensure the sentinel is written to the
|
||||
;; process output at the end of the command."
|
||||
|
||||
(defun ess--command-make-restore-function (proc)
|
||||
(let ((old-pf (process-filter proc)))
|
||||
(lambda ()
|
||||
@@ -1680,7 +1757,7 @@ Prefix arg VIS toggles visibility of ess-code as for
|
||||
(setq msg (format "Eval function: %s"
|
||||
(if (looking-at add-log-current-defun-header-regexp)
|
||||
(match-string 1)
|
||||
(buffer-substring (point) (point-at-eol)))))
|
||||
(buffer-substring (point) (line-end-position)))))
|
||||
(setq beg (point))
|
||||
(end-of-defun)
|
||||
(setq end (point))
|
||||
@@ -1696,7 +1773,7 @@ Prefix arg VIS toggles visibility of ess-code as for
|
||||
Prefix arg VIS toggles visibility of ess-code as for `ess-eval-region'."
|
||||
(interactive "P")
|
||||
(let ((start-pos (point)))
|
||||
(if (= (point-at-bol) (point-min))
|
||||
(if (= (line-beginning-position) (point-min))
|
||||
(ess-next-code-line 0)
|
||||
;; Evaluation is forward oriented
|
||||
(forward-line -1)
|
||||
@@ -1787,8 +1864,8 @@ input will fail."
|
||||
"Send the current line to the inferior ESS process.
|
||||
VIS has same meaning as for `ess-eval-region'."
|
||||
(interactive "P")
|
||||
(let* ((beg (point-at-bol))
|
||||
(end (point-at-eol))
|
||||
(let* ((beg (line-beginning-position))
|
||||
(end (line-end-position))
|
||||
(msg (format "Loading line: %s" (buffer-substring beg end))))
|
||||
(ess-eval-region beg end vis msg)))
|
||||
|
||||
@@ -1832,7 +1909,8 @@ Evaluate all comments and empty lines."
|
||||
(interactive)
|
||||
(let ((ess-eval-visibly nil))
|
||||
(ess-eval-line-and-step)))
|
||||
(define-obsolete-function-alias 'ess-eval-line-and-step-invisibly 'ess-eval-line-invisibly-and-step "18.10")
|
||||
(define-obsolete-function-alias 'ess-eval-line-and-step-invisibly
|
||||
#'ess-eval-line-invisibly-and-step "18.10")
|
||||
|
||||
|
||||
;;;*;;; Evaluate and switch to S
|
||||
@@ -2013,9 +2091,10 @@ node `(ess)Top'. If you accidentally suspend your process, use
|
||||
"]: %s"))
|
||||
|
||||
;;; Completion support ----------------
|
||||
(remove-hook 'completion-at-point-functions 'comint-completion-at-point t) ;; reset the hook
|
||||
(add-hook 'completion-at-point-functions 'comint-c-a-p-replace-by-expanded-history nil 'local)
|
||||
(add-hook 'completion-at-point-functions 'ess-filename-completion nil 'local)
|
||||
(remove-hook 'completion-at-point-functions #'comint-completion-at-point t) ;; reset the hook
|
||||
(add-hook 'completion-at-point-functions
|
||||
#'comint-c-a-p-replace-by-expanded-history nil 'local)
|
||||
(add-hook 'completion-at-point-functions #'ess-filename-completion nil 'local)
|
||||
|
||||
;; hyperlinks support
|
||||
(goto-address-mode t)
|
||||
@@ -2149,13 +2228,13 @@ If in the output field, goes to the beginning of previous input."
|
||||
(if (looking-at inferior-ess-prompt) ; cust.var, might not include sec-prompt
|
||||
(progn
|
||||
(comint-skip-prompt)
|
||||
(setq command (buffer-substring-no-properties (point) (point-at-eol)))
|
||||
(setq command (buffer-substring-no-properties (point) (line-end-position)))
|
||||
(when inferior-ess-secondary-prompt
|
||||
(while (progn (forward-line 1)
|
||||
(looking-at inferior-ess-secondary-prompt))
|
||||
(re-search-forward inferior-ess-secondary-prompt (point-at-eol) t)
|
||||
(re-search-forward inferior-ess-secondary-prompt (line-end-position) t)
|
||||
(setq command (concat command "\n"
|
||||
(buffer-substring-no-properties (point) (point-at-eol))))))
|
||||
(buffer-substring-no-properties (point) (line-end-position))))))
|
||||
(forward-line -1)
|
||||
command)
|
||||
(message "No command at this point")
|
||||
@@ -2167,6 +2246,17 @@ If in the output field, goes to the beginning of previous input."
|
||||
(inferior-ess--get-old-input:regexp)
|
||||
(inferior-ess--get-old-input:field)))
|
||||
|
||||
(defun ess-can-eval-in-background (&optional proc)
|
||||
"Can the current process be used for background commands.
|
||||
Inspects the `ess-can-eval-in-background' variable as well as the
|
||||
`bg-eval-disabled' property of PROC or of the current process, if
|
||||
any. This makes it possible to disable background evals for a
|
||||
specific process, for instance in case it was not initialized
|
||||
properly."
|
||||
(when ess-can-eval-in-background
|
||||
(when-let ((proc (or proc (ess-get-current-process))))
|
||||
(not (process-get proc 'bg-eval-disabled)))))
|
||||
|
||||
|
||||
;;;*;;; Hot key commands
|
||||
|
||||
@@ -2220,6 +2310,8 @@ Also sets the \"length\" option to 99999. When INVISIBLY is
|
||||
non-nil, don't echo to R subprocess. This is a good thing to put
|
||||
in `ess-r-post-run-hook' or `ess-S+-post-run-hook'."
|
||||
(interactive)
|
||||
(ess-if-verbose-write
|
||||
(format "ess-execute-screen-options: invisibly=%s\n" invisibly))
|
||||
(if (null ess-execute-screen-options-command)
|
||||
(message "Not implemented for '%s'" ess-dialect)
|
||||
(let ((command (ess-calculate-width 'window)))
|
||||
@@ -2227,6 +2319,12 @@ in `ess-r-post-run-hook' or `ess-S+-post-run-hook'."
|
||||
(ess-command command)
|
||||
(ess-eval-linewise command nil nil nil 'wait-prompt)))))
|
||||
|
||||
;; Runs in background if inferior is not busy
|
||||
(defun ess--execute-screen-options-bg ()
|
||||
(when (and ess-execute-screen-options-command
|
||||
(inferior-ess-available-p))
|
||||
(ess-execute-screen-options t)))
|
||||
|
||||
(defun ess-calculate-width (opt)
|
||||
"Calculate width command given OPT.
|
||||
OPT can be \\='window, \\='frame, or an integer. Return a command
|
||||
@@ -2650,7 +2748,7 @@ name that contains :,$ or @."
|
||||
(goto-char (point-min))
|
||||
(when (re-search-forward "(list" nil t)
|
||||
(goto-char (match-beginning 0))
|
||||
(setq args (ignore-errors (eval (read (current-buffer)))))
|
||||
(setq args (ignore-errors (eval (read (current-buffer)) t)))
|
||||
(when args
|
||||
(setcar args (cons (car args) (current-time)))))
|
||||
;; push even if nil
|
||||
@@ -2911,8 +3009,8 @@ P-STRING is the prompt string."
|
||||
(car ess--handy-history))))
|
||||
(call-interactively
|
||||
(cdr (assoc (ess-completing-read "Execute"
|
||||
(sort (mapcar 'car commands)
|
||||
'string-lessp)
|
||||
(sort (mapcar #'car commands)
|
||||
#'string-lessp)
|
||||
nil t nil 'ess--handy-history hist)
|
||||
commands)))))
|
||||
|
||||
@@ -2955,9 +3053,9 @@ NO-ERROR prevents errors when this has not been implemented for
|
||||
(unless no-error
|
||||
(error "Not implemented for dialect %s" ess-dialect))))
|
||||
|
||||
(defalias 'ess-change-directory 'ess-set-working-directory)
|
||||
(defalias 'ess-change-directory #'ess-set-working-directory)
|
||||
(define-obsolete-function-alias
|
||||
'ess-use-dir 'ess-set-working-directory "ESS 18.10")
|
||||
'ess-use-dir #'ess-set-working-directory "ESS 18.10")
|
||||
|
||||
(defun ess-use-this-dir (&rest _ignore)
|
||||
"Set the current process directory to the directory of this file.
|
||||
@@ -2978,7 +3076,7 @@ NO-ERROR prevents errors when this has not been implemented for
|
||||
(defun ess-synchronize-dirs ()
|
||||
"Set Emacs' current directory to be the same as the subprocess directory.
|
||||
To be used in `ess-idle-timer-functions'."
|
||||
(when (and ess-can-eval-in-background
|
||||
(when (and (ess-can-eval-in-background)
|
||||
ess-getwd-command
|
||||
(inferior-ess-available-p))
|
||||
(ess-when-new-input last-sync-dirs
|
||||
@@ -3018,7 +3116,7 @@ path, and can be a remote path"
|
||||
|
||||
(defun ess-cache-search-list ()
|
||||
"To be used in `ess-idle-timer-functions', to set search path related variables."
|
||||
(when (and ess-can-eval-in-background
|
||||
(when (and (ess-can-eval-in-background)
|
||||
inferior-ess-search-list-command)
|
||||
(ess-when-new-input last-cache-search-list
|
||||
(let ((path (ess-search-list 'force))
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
;;; ess-jags-d.el --- ESS[JAGS] dialect -*- lexical-binding: t; -*-
|
||||
|
||||
;; Copyright (C) 2009-2020 Free Software Foundation, Inc.
|
||||
;; Copyright (C) 2009-2022 Free Software Foundation, Inc.
|
||||
|
||||
;; Author: Rodney Sparapani
|
||||
;; Created: 13 March 2008
|
||||
@@ -246,7 +246,7 @@
|
||||
(setq ess-language "S") ; mimic S for ess-smart-underscore
|
||||
(unless (and (fboundp 'w32-shell-dos-semantics)
|
||||
(w32-shell-dos-semantics))
|
||||
(add-hook 'comint-output-filter-functions 'ess-bugs-exit-notify-sh))
|
||||
(add-hook 'comint-output-filter-functions #'ess-bugs-exit-notify-sh))
|
||||
)
|
||||
|
||||
;;;###autoload
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
;; ess-julia.el --- ESS julia mode and inferior interaction -*- lexical-binding: t; -*-
|
||||
|
||||
;; Copyright (C) 2012-2020 Free Software Foundation, Inc.
|
||||
;; Copyright (C) 2012-2022 Free Software Foundation, Inc.
|
||||
;; Author: Vitalie Spinu
|
||||
;; Maintainer: Vitalie Spinu
|
||||
;; Created: 02-04-2012 (ESS 12.03)
|
||||
@@ -137,7 +137,7 @@ See `comint-input-sender'."
|
||||
(+ beg 1 (length obj))
|
||||
beg)))
|
||||
(list beg (point)
|
||||
(nreverse (mapcar 'car (ess-julia--get-objects proc obj)))
|
||||
(nreverse (mapcar #'car (ess-julia--get-objects proc obj)))
|
||||
:exclusive 'no)))
|
||||
(when (string-match "complet" (symbol-name last-command))
|
||||
(message "No ESS process of dialect %s started" ess-dialect)
|
||||
@@ -231,7 +231,7 @@ objects from that MODULE."
|
||||
|
||||
(declare-function company-begin-backend "company.el")
|
||||
|
||||
(defun company-ess-julia-objects (command &optional arg &rest ignored)
|
||||
(defun company-ess-julia-objects (command &optional arg &rest _ignored)
|
||||
(interactive (list 'interactive))
|
||||
(cl-case command
|
||||
(interactive (company-begin-backend 'company-ess-julia-objects))
|
||||
@@ -262,7 +262,7 @@ objects from that MODULE."
|
||||
"Return the doc string, or nil.
|
||||
If an ESS process is not associated with the buffer, do not try
|
||||
to look up any doc strings. Honors `eldoc-echo-area-use-multiline-p'."
|
||||
(when (and ess-can-eval-in-background
|
||||
(when (and (ess-can-eval-in-background)
|
||||
(ess-process-live-p)
|
||||
(not (ess-process-get 'busy)))
|
||||
(let ((funname (or (and ess-eldoc-show-on-symbol ;; aggressive completion
|
||||
@@ -289,7 +289,7 @@ to look up any doc strings. Honors `eldoc-echo-area-use-multiline-p'."
|
||||
'((inferior-ess-primary-prompt . "\\w*> ")
|
||||
(inferior-ess-secondary-prompt . nil)
|
||||
(inferior-ess-prompt . "\\w*> ")
|
||||
(ess-local-customize-alist . ess-julia-customize-alist)
|
||||
(ess-local-customize-alist . 'ess-julia-customize-alist)
|
||||
(inferior-ess-program . inferior-julia-program)
|
||||
(ess-load-command . "include(expanduser(\"%s\"))\n")
|
||||
(ess-funargs-command . "ESS.fun_args(\"%s\")\n")
|
||||
@@ -366,10 +366,10 @@ It makes underscores and dots word constituent chars.")
|
||||
;; company
|
||||
(ess--setup-company '(company-ess-julia-objects))
|
||||
;; for emacs >= 24
|
||||
(remove-hook 'completion-at-point-functions 'ess-filename-completion 'local) ;; should be first
|
||||
(add-hook 'completion-at-point-functions 'ess-julia-object-completion nil 'local)
|
||||
(add-hook 'completion-at-point-functions 'ess-filename-completion nil 'local)
|
||||
(add-hook 'completion-at-point-functions 'ess-julia-latexsub-completion nil 'local)
|
||||
(remove-hook 'completion-at-point-functions #'ess-filename-completion 'local) ;; should be first
|
||||
(add-hook 'completion-at-point-functions #'ess-julia-object-completion nil 'local)
|
||||
(add-hook 'completion-at-point-functions #'ess-filename-completion nil 'local)
|
||||
(add-hook 'completion-at-point-functions #'ess-julia-latexsub-completion nil 'local)
|
||||
(if (fboundp 'ess-add-toolbar) (ess-add-toolbar)))
|
||||
|
||||
;; Inferior mode
|
||||
@@ -390,10 +390,10 @@ It makes underscores and dots word constituent chars.")
|
||||
(ess--setup-auto-complete '(ac-source-ess-julia-objects) t)
|
||||
;; company
|
||||
(ess--setup-company '(company-ess-julia-objects) t)
|
||||
(remove-hook 'completion-at-point-functions 'ess-filename-completion 'local) ;; should be first
|
||||
(add-hook 'completion-at-point-functions 'ess-julia-object-completion nil 'local)
|
||||
(add-hook 'completion-at-point-functions 'ess-filename-completion nil 'local)
|
||||
(add-hook 'completion-at-point-functions 'ess-julia-latexsub-completion nil 'local)
|
||||
(remove-hook 'completion-at-point-functions #'ess-filename-completion 'local) ;; should be first
|
||||
(add-hook 'completion-at-point-functions #'ess-julia-object-completion nil 'local)
|
||||
(add-hook 'completion-at-point-functions #'ess-filename-completion nil 'local)
|
||||
(add-hook 'completion-at-point-functions #'ess-julia-latexsub-completion nil 'local)
|
||||
(setq comint-input-sender #'ess-julia-input-sender))
|
||||
|
||||
(defvar ess-julia-mode-hook nil)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
;;; ess-mode.el -- Emacs Speaks Statistics root mode. -*- lexical-binding: t; -*-
|
||||
|
||||
;; Copyright (C) 1994-2020 Free Software Foundation, Inc.
|
||||
;; Copyright (C) 1994-2022 Free Software Foundation, Inc.
|
||||
;; Maintainer: ESS-core <ESS-core@r-project.org>
|
||||
|
||||
;; This file is part of GNU Emacs.
|
||||
@@ -103,8 +103,8 @@
|
||||
;; 27 binds M-j to `default-indent-new-line' which calls
|
||||
;; `comment-line-break-function' if point is in a comment. We set this
|
||||
;; function in the mode init.
|
||||
(substitute-key-definition 'indent-new-comment-line
|
||||
'ess-indent-new-comment-line
|
||||
(substitute-key-definition #'indent-new-comment-line
|
||||
#'ess-indent-new-comment-line
|
||||
ess-mode-map global-map)
|
||||
|
||||
(defvar ess-extra-map
|
||||
@@ -309,7 +309,7 @@ indentation style. See `ess-style-alist' for predefined styles."
|
||||
(:eval (ess--get-mode-line-indicator))
|
||||
ess--local-mode-line-process-indicator
|
||||
"]"))
|
||||
(add-hook 'ess-idle-timer-functions 'ess-synchronize-dirs nil 'local))
|
||||
(add-hook 'ess-idle-timer-functions #'ess-synchronize-dirs nil 'local))
|
||||
|
||||
(defun ess--get-mode-line-indicator ()
|
||||
"Get `ess--mode-line-process-indicator' from process buffer.
|
||||
@@ -319,7 +319,8 @@ Internal function to be used for dynamic mode-line display in
|
||||
(let* ((proc (get-process ess-local-process-name))
|
||||
(buff (when proc (process-buffer proc))))
|
||||
(if (and proc (buffer-live-p buff))
|
||||
(with-current-buffer buff (mapcar 'eval ess--mode-line-process-indicator))
|
||||
(with-current-buffer buff
|
||||
(mapcar (lambda (e) (eval e t)) ess--mode-line-process-indicator))
|
||||
"none"))
|
||||
"none"))
|
||||
|
||||
@@ -392,7 +393,8 @@ Otherwise go to the end of paragraph."
|
||||
(ess-goto-end-of-function-or-para)
|
||||
(exchange-point-and-mark))
|
||||
|
||||
(define-obsolete-function-alias 'ess-mark-function 'ess-mark-function-or-para "15.09")
|
||||
(define-obsolete-function-alias 'ess-mark-function
|
||||
#'ess-mark-function-or-para "15.09")
|
||||
|
||||
(defun ess-narrow-to-defun-or-para ()
|
||||
"Make text outside current function invisible.
|
||||
@@ -407,7 +409,8 @@ current function."
|
||||
(point))))
|
||||
(narrow-to-region beg end))))
|
||||
|
||||
(define-obsolete-function-alias 'ess-narrow-to-defun 'ess-narrow-to-defun-or-para "15.09")
|
||||
(define-obsolete-function-alias 'ess-narrow-to-defun
|
||||
#'ess-narrow-to-defun-or-para "15.09")
|
||||
|
||||
;; FIXME: Support soft breaks with `insert-and-inherit'. See
|
||||
;; https://www.gnu.org/software/emacs/manual/html_node/emacs/Hard-and-Soft-Newlines.html
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
(define-package "ess" "20221204.1348" "Emacs Speaks Statistics"
|
||||
(define-package "ess" "20230807.1422" "Emacs Speaks Statistics"
|
||||
'((emacs "25.1"))
|
||||
:commit "b6aefb9ca231c3cbb1a6532b8afa4022c2678f81" :authors
|
||||
:commit "d8914196ceb2061d850cc899aed79342519972ff" :authors
|
||||
'(("David Smith" . "dsmith@stats.adelaide.edu.au")
|
||||
("A.J. Rossini" . "blindglobe@gmail.com")
|
||||
("Richard M. Heiberger" . "rmh@temple.edu")
|
||||
@@ -13,6 +13,8 @@
|
||||
("Vitalie Spinu" . "spinuvit@gmail.com")
|
||||
("Lionel Henry" . "lionel.hry@gmail.com")
|
||||
("J. Alexander Branham" . "alex.branham@gmail.com"))
|
||||
:maintainers
|
||||
'(("ESS Core Team" . "ESS-core@r-project.org"))
|
||||
:maintainer
|
||||
'("ESS Core Team" . "ESS-core@r-project.org")
|
||||
:url "https://ess.r-project.org/")
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
;;; ess-r-completion.el --- R completion -*- lexical-binding: t; -*-
|
||||
|
||||
;; Copyright (C) 2015-2020 Free Software Foundation, Inc.
|
||||
;; Copyright (C) 2015-2022 Free Software Foundation, Inc.
|
||||
;; Author: Vitalie Spinu
|
||||
;; Maintainer: ESS-core <ESS-core@r-project.org>
|
||||
|
||||
@@ -53,37 +53,36 @@
|
||||
"Return the doc string, or nil.
|
||||
If an ESS process is not associated with the buffer, do not try
|
||||
to look up any doc strings."
|
||||
(when (and eldoc-mode ess-can-eval-in-background)
|
||||
(let* ((proc (ess-get-next-available-process))
|
||||
(funname (and proc (or (and ess-eldoc-show-on-symbol ;; Aggressive completion
|
||||
(thing-at-point 'symbol))
|
||||
(car (ess--fn-name-start))))))
|
||||
(when funname
|
||||
(let* ((args (ess-function-arguments funname proc))
|
||||
(bargs (cadr args))
|
||||
(doc (mapconcat (lambda (el)
|
||||
(if (equal (car el) "...")
|
||||
"..."
|
||||
(concat (car el) "=" (cdr el))))
|
||||
bargs ", "))
|
||||
(margs (nth 2 args))
|
||||
(W (- (window-width (minibuffer-window)) (+ 4 (length funname))))
|
||||
(multiline (eq t eldoc-echo-area-use-multiline-p))
|
||||
doc1)
|
||||
(when doc
|
||||
(setq doc (ess-eldoc-docstring-format funname doc (not multiline)))
|
||||
(when (or multiline (and margs (< (length doc1) W)))
|
||||
(setq doc1 (concat doc (propertize " || " 'face font-lock-function-name-face)))
|
||||
(while (and margs (< (length doc1) W))
|
||||
(let ((head (pop margs)))
|
||||
(unless (assoc head bargs)
|
||||
(setq doc doc1
|
||||
doc1 (concat doc1 head "=, ")))))
|
||||
(when (equal (substring doc -2) ", ")
|
||||
(setq doc (substring doc 0 -2)))
|
||||
(when (and margs (< (length doc) W))
|
||||
(setq doc (concat doc " {--}"))))
|
||||
doc))))))
|
||||
(when eldoc-mode
|
||||
(when-let ((proc (ess-get-next-available-bg-process))
|
||||
(funname (or (and ess-eldoc-show-on-symbol ;; Aggressive completion
|
||||
(thing-at-point 'symbol))
|
||||
(car (ess--fn-name-start)))))
|
||||
(let* ((args (ess-function-arguments funname proc))
|
||||
(bargs (cadr args))
|
||||
(doc (mapconcat (lambda (el)
|
||||
(if (equal (car el) "...")
|
||||
"..."
|
||||
(concat (car el) "=" (cdr el))))
|
||||
bargs ", "))
|
||||
(margs (nth 2 args))
|
||||
(W (- (window-width (minibuffer-window)) (+ 4 (length funname))))
|
||||
(multiline (eq t eldoc-echo-area-use-multiline-p))
|
||||
doc1)
|
||||
(when doc
|
||||
(setq doc (ess-eldoc-docstring-format funname doc (not multiline)))
|
||||
(when (or multiline (and margs (< (length doc1) W)))
|
||||
(setq doc1 (concat doc (propertize " || " 'face font-lock-function-name-face)))
|
||||
(while (and margs (< (length doc1) W))
|
||||
(let ((head (pop margs)))
|
||||
(unless (assoc head bargs)
|
||||
(setq doc doc1
|
||||
doc1 (concat doc1 head "=, ")))))
|
||||
(when (equal (substring doc -2) ", ")
|
||||
(setq doc (substring doc 0 -2)))
|
||||
(when (and margs (< (length doc) W))
|
||||
(setq doc (concat doc " {--}"))))
|
||||
doc)))))
|
||||
|
||||
(defun ess-eldoc-docstring-format (funname doc &optional truncate)
|
||||
(save-match-data
|
||||
@@ -292,9 +291,9 @@ To be used instead of ESS' completion engine for R versions >= 2.7.0."
|
||||
(setq ess--cached-sp-objects (cdr ess-sl-modtime-alist)))
|
||||
;; reread new package, but not rda, much faster and not needed anyways
|
||||
(process-put *proc* 'sp-for-ac-changed? nil)))
|
||||
(apply 'append
|
||||
(apply #'append
|
||||
(cl-cddar ess-sl-modtime-alist) ; .GlobalEnv
|
||||
(mapcar 'cddr ess--cached-sp-objects)))))
|
||||
(mapcar #'cddr ess--cached-sp-objects)))))
|
||||
|
||||
|
||||
;;;*;;; ARGUMENTS
|
||||
@@ -325,7 +324,7 @@ To be used instead of ESS' completion engine for R versions >= 2.7.0."
|
||||
|
||||
(defun ess-r-get-object-help-string (sym)
|
||||
"Help string for ac."
|
||||
(let ((proc (ess-get-next-available-process)))
|
||||
(let ((proc (ess-get-next-available-bg-process)))
|
||||
(if (null proc)
|
||||
"No free ESS process found"
|
||||
(let ((buf (get-buffer-create " *ess-command-output*")))
|
||||
@@ -342,7 +341,7 @@ To be used instead of ESS' completion engine for R versions >= 2.7.0."
|
||||
(defun ess-r-get-arg-help-string (sym &optional proc)
|
||||
"Help string for ac."
|
||||
(setq sym (replace-regexp-in-string " *= *\\'" "" sym))
|
||||
(let ((proc (or proc (ess-get-next-available-process))))
|
||||
(let ((proc (ess-get-next-available-bg-process proc)))
|
||||
(if (null proc)
|
||||
"No free ESS process found"
|
||||
(let ((fun (car ess--fn-name-start-cache)))
|
||||
@@ -356,7 +355,7 @@ To be used instead of ESS' completion engine for R versions >= 2.7.0."
|
||||
;;;*;;; COMPANY
|
||||
;; https://company-mode.github.io
|
||||
|
||||
(defun company-R-objects (command &optional arg &rest ignored)
|
||||
(defun company-R-objects (command &optional arg &rest _ignored)
|
||||
(interactive (list 'interactive))
|
||||
(cl-case command
|
||||
(interactive (company-begin-backend 'company-R-objects))
|
||||
@@ -364,14 +363,12 @@ 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 (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)))))))
|
||||
(candidates (when-let ((proc (ess-get-next-available-bg-process)))
|
||||
(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)
|
||||
(defun company-R-args (command &optional arg &rest _ignored)
|
||||
(interactive (list 'interactive))
|
||||
(cl-case command
|
||||
(interactive (company-begin-backend 'company-R-args))
|
||||
@@ -383,21 +380,18 @@ 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 (when ess-can-eval-in-background
|
||||
(let* ((proc (ess-get-next-available-process))
|
||||
(args (delete "..." (nth 2 (ess-function-arguments
|
||||
(candidates (when-let ((proc (ess-get-next-available-bg-process)))
|
||||
(let* ((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 (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)
|
||||
(not (file-remote-p default-directory))))
|
||||
(meta (when (bound-and-true-p ess-r--company-meta)
|
||||
(when-let ((proc (ess-get-next-available-bg-process)))
|
||||
(when (with-current-buffer (process-buffer proc)
|
||||
(not (file-remote-p default-directory)))
|
||||
;; fixme: ideally meta should be fetched with args
|
||||
(let ((doc (ess-r-get-arg-help-string arg proc)))
|
||||
(replace-regexp-in-string "^ +\\| +$" ""
|
||||
@@ -406,7 +400,7 @@ To be used instead of ESS' completion engine for R versions >= 2.7.0."
|
||||
(require-match 'never)
|
||||
(doc-buffer (company-doc-buffer (ess-r-get-arg-help-string arg)))))
|
||||
|
||||
(defun company-R-library (command &optional arg &rest ignored)
|
||||
(defun company-R-library (command &optional arg &rest _ignored)
|
||||
(interactive (list 'interactive))
|
||||
(cl-case command
|
||||
(interactive (company-begin-backend 'company-R-library))
|
||||
@@ -414,7 +408,7 @@ 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 (when ess-can-eval-in-background
|
||||
(candidates (when (ess-can-eval-in-background)
|
||||
(all-completions arg (ess-installed-packages))))
|
||||
(annotation "<pkg>")
|
||||
(duplicates nil)
|
||||
@@ -425,7 +419,7 @@ 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 (and ess-can-eval-in-background
|
||||
(when (and (ess-can-eval-in-background)
|
||||
(member (car (ess--fn-name-start))
|
||||
'("library" "require")))
|
||||
(list (ess-symbol-start)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
;;; ess-r-flymake.el --- A ess-r Flymake backend -*- lexical-binding: t; -*-
|
||||
|
||||
;; Copyright (C) 2018-2020 Free Software Foundation, Inc.
|
||||
;; Copyright (C) 2018-2022 Free Software Foundation, Inc.
|
||||
;; Maintainer: ESS-core <ESS-core@r-project.org>
|
||||
|
||||
|
||||
@@ -155,7 +155,7 @@ into a list and call REPORT-FN on it."
|
||||
(if (ess-r--flymake-check-errors)
|
||||
(with-current-buffer src-buffer
|
||||
;; we are in the sentinel here; don't throw but remove our hook instead
|
||||
(remove-hook 'flymake-diagnostic-functions 'ess-r-flymake t))
|
||||
(remove-hook 'flymake-diagnostic-functions #'ess-r-flymake t))
|
||||
(goto-char (point-min))
|
||||
(cl-loop
|
||||
while (search-forward-regexp
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
;;; ess-r-mode.el --- R customization -*- lexical-binding: t; -*-
|
||||
|
||||
;; Copyright (C) 1997-2020 Free Software Foundation, Inc.
|
||||
;; Copyright (C) 1997-2022 Free Software Foundation, Inc.
|
||||
;; Author: A.J. Rossini
|
||||
;; Created: 12 Jun 1997
|
||||
;; Maintainer: ESS-core <ESS-core@r-project.org>
|
||||
@@ -442,7 +442,6 @@ To be used as part of `font-lock-defaults' keywords."
|
||||
'((ess-local-customize-alist . 'ess-r-customize-alist)
|
||||
(ess-dialect . "R")
|
||||
(ess-suffix . "R")
|
||||
(ess-format-command-alist . ess-r-format-command-alist)
|
||||
(ess-traceback-command . ess-r-traceback-command)
|
||||
(ess-call-stack-command . ess-r-call-stack-command)
|
||||
(ess-mode-completion-syntax-table . ess-r-completion-syntax-table)
|
||||
@@ -480,7 +479,7 @@ fill=TRUE); try(traceback(), silent=TRUE)})\n")
|
||||
|
||||
(defun ess-r-format-command (cmd &rest args)
|
||||
(let ((sentinel (alist-get 'output-delimiter args)))
|
||||
(format ".ess.command(local(%s), '%s')\n" cmd sentinel)))
|
||||
(ess-r--format-call ".ess.command(local(%s), '%s')\n" cmd sentinel)))
|
||||
|
||||
(defvar ess-r-format-command-alist
|
||||
'((fun . ess-r-format-command)
|
||||
@@ -538,8 +537,18 @@ fill=TRUE); try(traceback(), silent=TRUE)})\n")
|
||||
;;;*;;; Mode init
|
||||
|
||||
(define-obsolete-variable-alias 'ess-R-post-run-hook 'ess-r-post-run-hook "ESS 18.10.2")
|
||||
|
||||
;; We moved the set-wd instruction from `inferior-ess' to here to
|
||||
;; avoid sending R code to gdb or lldb before we had a chance to
|
||||
;; send "run". So this is no longer generic and inferior modes need
|
||||
;; to call this manually. One way to fix this would be to make
|
||||
;; `inferior-ess' a `cl-defgeneric'.
|
||||
(defvar ess-r-post-run-hook nil
|
||||
"Functions run in process buffer after the initialization of R process.")
|
||||
"Functions run in process buffer after the initialization of R process.
|
||||
Make sure to call blocking commands (e.g. based on `ess-command')
|
||||
first. Streaming commands (e.g. based on `ess-send-string')
|
||||
should come last, otherwise they will make R busy and the
|
||||
blocking commands will throw an error.")
|
||||
|
||||
;;;###autoload
|
||||
(defun run-ess-r (&optional start-args)
|
||||
@@ -577,8 +586,8 @@ will be prompted to enter arguments interactively."
|
||||
start-args)
|
||||
((and start-args
|
||||
(listp start-args)
|
||||
(cl-every 'stringp start-args))
|
||||
(mapconcat 'identity start-args " "))
|
||||
(cl-every #'stringp start-args))
|
||||
(mapconcat #'identity start-args " "))
|
||||
(start-args
|
||||
(read-string
|
||||
(concat "Starting Args"
|
||||
@@ -606,12 +615,8 @@ will be prompted to enter arguments interactively."
|
||||
(ess-process-put 'callbacks '(inferior-ess-r--init-callback))
|
||||
;; Trigger the callback
|
||||
(process-send-string (get-buffer-process inf-buf) "r\n"))
|
||||
(ess-wait-for-process)
|
||||
(ess-r-initialize-on-start)
|
||||
(comint-goto-process-mark))
|
||||
(ess-write-to-dribble-buffer
|
||||
(format "(R): inferior-ess-language-start=%s\n"
|
||||
inferior-ess-language-start)))
|
||||
(ess-r-initialize)
|
||||
(comint-goto-process-mark)))
|
||||
inf-buf)))
|
||||
|
||||
;;;###autoload
|
||||
@@ -621,36 +626,73 @@ will be prompted to enter arguments interactively."
|
||||
(set-buffer (run-ess-r start-args)))
|
||||
|
||||
(defun inferior-ess-r--init-callback (_proc _name)
|
||||
(ess-r-initialize-on-start))
|
||||
(ess-r-initialize))
|
||||
|
||||
(defmacro ess-r--without-format-command (&rest body)
|
||||
(declare (indent 0)
|
||||
(debug (&rest form)))
|
||||
`(with-current-buffer (process-buffer (ess-command--get-proc nil nil))
|
||||
(let ((old-alist ess-format-command-alist))
|
||||
(unwind-protect
|
||||
(progn
|
||||
(setq ess-format-command-alist nil)
|
||||
,@body)
|
||||
(setq ess-format-command-alist old-alist)))))
|
||||
(defvar ess-r--init-timeout 5
|
||||
"Maximum time for R to become available on startup.
|
||||
If the timeout is reached, an error is thrown advising the user
|
||||
to run `ess-r-initialize' again.")
|
||||
|
||||
(define-obsolete-function-alias 'R-initialize-on-start 'ess-r-initialize-on-start "ESS 19.04")
|
||||
(defun ess-r-initialize-on-start ()
|
||||
(define-obsolete-function-alias 'R-initialize-on-start
|
||||
#'ess-r-initialize "ESS 19.04")
|
||||
|
||||
(defun ess-r-initialize ()
|
||||
"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')))
|
||||
options(pager = '%s')\n"
|
||||
inferior-ess-pager)))
|
||||
(ess-r-load-ESSR)
|
||||
(when inferior-ess-language-start
|
||||
(ess-command (concat inferior-ess-language-start "\n")))
|
||||
;; tracebug
|
||||
(when ess-use-tracebug (ess-tracebug 1))
|
||||
(add-hook 'ess-presend-filter-functions 'ess-R-scan-for-library-call nil 'local)
|
||||
(run-hooks 'ess-r-post-run-hook))
|
||||
(condition-case err
|
||||
(progn
|
||||
(unless (ess-wait-for-process nil nil nil nil ess-r--init-timeout)
|
||||
(error "Process is busy"))
|
||||
(ess-command (ess-r--init-options-command))
|
||||
(ess-r-load-ESSR))
|
||||
(error (ess-r--init-error-handler err))
|
||||
(quit (ess-r--init-error-handler)))
|
||||
(ess-process-put 'format-command-alist ess-r-format-command-alist)
|
||||
(ess-process-put 'bg-eval-disabled nil)
|
||||
(ess-execute-screen-options t)
|
||||
(ess-set-working-directory default-directory)
|
||||
(when ess-use-tracebug
|
||||
(ess-tracebug 1))
|
||||
(add-hook 'ess-presend-filter-functions #'ess-R-scan-for-library-call nil 'local)
|
||||
;; Wait before running user hook so they can call blocking commands
|
||||
(ess-wait-for-process)
|
||||
(run-hooks 'ess-r-post-run-hook)
|
||||
(ess-wait-for-process))
|
||||
|
||||
(defun ess-r--init-error-handler (&optional err)
|
||||
(ess-write-to-dribble-buffer "Failed to start ESSR\n")
|
||||
(when-let ((proc (and ess-local-process-name
|
||||
(get-process ess-local-process-name))))
|
||||
(process-put proc 'bg-eval-disabled t))
|
||||
(let ((msgs `("ESSR failed to start, please call `ess-r-initialize' to recover"
|
||||
,@(when err
|
||||
(concat "Caused by error: " (error-message-string err))))))
|
||||
(error (mapconcat 'identity msgs "\n"))))
|
||||
|
||||
;; FIXME: Should we stop setting `str.dendogram.last`? See:
|
||||
;; https://emacs.stackexchange.com/questions/27673/ess-dendrograms-appearance-of-last-branch/27729#27729
|
||||
;;
|
||||
;; FIXME: We don't use `ess-r-pager`? It's nil by default and
|
||||
;; documented that this should not normally be set
|
||||
(defun ess-r--init-options-command ()
|
||||
(let ((args (list (format "STERM = '%s'" ess-STERM)
|
||||
"str.dendrogram.last = '\\''"
|
||||
(format "editor = '%s'" ess-r-editor)
|
||||
(ess-r--update-opt-if-eq "pager"
|
||||
"file.path(R.home(), 'bin', 'pager')"
|
||||
(format "'%s'" inferior-ess-pager))
|
||||
"show.error.locations = TRUE")))
|
||||
(format "options(%s)\n" (mapconcat 'identity args ", "))))
|
||||
|
||||
(defun ess-r--update-opt-if-eq (opt old new)
|
||||
(let ((actual (format "getOption('%s')" opt)))
|
||||
(format "%s = if (identical(%s, %s)) %s else %s"
|
||||
opt
|
||||
actual
|
||||
old
|
||||
new
|
||||
actual)))
|
||||
|
||||
(defun ess-r--skip-function ()
|
||||
;; Assumes the point is at function start
|
||||
@@ -780,10 +822,10 @@ top level functions only."
|
||||
(ess--setup-company ess-r-company-backends)
|
||||
(setq-local prettify-symbols-alist ess-r-prettify-symbols)
|
||||
(setq font-lock-defaults '(ess-build-font-lock-keywords nil nil ((?\. . "w") (?\_ . "w"))))
|
||||
(remove-hook 'completion-at-point-functions 'ess-filename-completion 'local) ;; should be first
|
||||
(add-hook 'completion-at-point-functions 'ess-r-object-completion nil 'local)
|
||||
(remove-hook 'completion-at-point-functions #'ess-filename-completion 'local) ;; should be first
|
||||
(add-hook 'completion-at-point-functions #'ess-r-object-completion nil 'local)
|
||||
(add-hook 'completion-at-point-functions #'ess-r-package-completion nil 'local)
|
||||
(add-hook 'completion-at-point-functions 'ess-filename-completion nil 'local)
|
||||
(add-hook '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)
|
||||
|
||||
@@ -796,9 +838,9 @@ top level functions only."
|
||||
(setq-local end-of-defun-function #'ess-r-end-of-defun)
|
||||
(ess-roxy-mode))
|
||||
;;;###autoload
|
||||
(defalias 'R-mode 'ess-r-mode)
|
||||
(defalias 'R-mode #'ess-r-mode)
|
||||
;;;###autoload
|
||||
(defalias 'r-mode 'ess-r-mode)
|
||||
(defalias 'r-mode #'ess-r-mode)
|
||||
|
||||
|
||||
;;;###autoload
|
||||
@@ -959,7 +1001,7 @@ Set SYM to VAL and call `ess-r-redefine-runners'."
|
||||
(ess-r-redefine-runners))
|
||||
|
||||
(define-obsolete-function-alias
|
||||
'ess-r-versions-create 'ess-r-define-runners "ESS 18.10")
|
||||
'ess-r-versions-create #'ess-r-define-runners "ESS 18.10")
|
||||
|
||||
(defvar ess-newest-R nil
|
||||
"Stores the newest version of R that has been found.
|
||||
@@ -1044,7 +1086,8 @@ returned."
|
||||
(defun ess-current-R-version ()
|
||||
"Get the version of R currently running in the ESS buffer as a string."
|
||||
(ess-make-buffer-current)
|
||||
(car (ess-get-words-from-vector "as.character(.ess.Rversion)\n")))
|
||||
(car (ess-get-words-from-vector (format "base::as.character(%s)\n"
|
||||
(ess-r--format-call ".ess.Rversion")))))
|
||||
|
||||
(defun ess-current-R-at-least (version)
|
||||
"Is the version of R (in the ESS buffer) at least (\">=\") VERSION ?
|
||||
@@ -1053,7 +1096,9 @@ Examples: (ess-current-R-at-least '2.7.0)
|
||||
(ess-make-buffer-current)
|
||||
(string= "TRUE"
|
||||
(car (ess-get-words-from-vector
|
||||
(format "as.character(.ess.Rversion >= \"%s\")\n" version)))))
|
||||
(format "base::as.character(%s >= \"%s\")\n"
|
||||
(ess-r--format-call ".ess.Rversion")
|
||||
version)))))
|
||||
(defun ess-find-newest-date (rvers)
|
||||
"Find the newest version of R given in the a-list RVERS.
|
||||
Each element of RVERS is a dotted pair (date . R-version), where
|
||||
@@ -1128,7 +1173,7 @@ use \"bin/Rterm.exe\"."
|
||||
(setq font-lock-defaults '(ess-build-font-lock-keywords
|
||||
nil nil ((?\. . "w") (?\_ . "w") (?' . ".")))))
|
||||
|
||||
(fset 'r-transcript-mode 'ess-r-transcript-mode)
|
||||
(defalias 'r-transcript-mode #'ess-r-transcript-mode)
|
||||
|
||||
;;;###autoload
|
||||
(add-to-list 'auto-mode-alist '("\\.[Rr]out\\'" . ess-r-transcript-mode))
|
||||
@@ -1150,7 +1195,7 @@ not issue messages."
|
||||
(goto-char from)
|
||||
(ess-rep-regexp "\\(\\([][=,()]\\|<-\\) *\\)F\\>" "\\1FALSE"
|
||||
'fixcase nil (not quietly))))
|
||||
(define-obsolete-function-alias 'R-fix-T-F 'ess-r-fix-T-F
|
||||
(define-obsolete-function-alias 'R-fix-T-F #'ess-r-fix-T-F
|
||||
"ESS 18.10")
|
||||
|
||||
(defvar ess--packages-cache nil
|
||||
@@ -1200,7 +1245,7 @@ With argument UPDATE, update cached packages list."
|
||||
(match-string 2 url)))
|
||||
(ess-command (format mirror-cmd ess--CRAN-mirror)))))
|
||||
(message "CRAN mirror: %s" (car (ess-get-words-from-vector "getOption('repos')[['CRAN']]\n"))))
|
||||
(define-obsolete-function-alias 'ess-setCRANMiror 'ess-set-CRAN-mirror "ESS 18.10")
|
||||
(define-obsolete-function-alias 'ess-setCRANMiror #'ess-set-CRAN-mirror "ESS 18.10")
|
||||
|
||||
(defun ess-r-check-install-package (pkg)
|
||||
"Check if package PKG is installed and offer to install if not."
|
||||
@@ -1231,7 +1276,7 @@ Placed into `ess-presend-filter-functions' for R dialects."
|
||||
"Load an R package."
|
||||
(ess-eval-linewise (format "library('%s')\n" pack)))
|
||||
|
||||
(define-obsolete-function-alias 'ess-library 'ess-load-library "ESS[12.09-1]")
|
||||
(define-obsolete-function-alias 'ess-library #'ess-load-library "ESS[12.09-1]")
|
||||
|
||||
;;; smart-comma was a bad idea
|
||||
(eval-after-load "eldoc"
|
||||
@@ -1257,13 +1302,19 @@ Placed into `ess-presend-filter-functions' for R dialects."
|
||||
(ess-r-arg "verbose" "TRUE"))))
|
||||
(concat visibly output pkg verbose)))
|
||||
|
||||
(defun ess-r--format-call (cmd &rest objects)
|
||||
"Prefix an ESSR command with a namespace qualifier.
|
||||
CMD is formatted with OBJECTS using `format'."
|
||||
(concat "base::as.environment('ESSR')$"
|
||||
(apply #'format cmd objects)))
|
||||
|
||||
(cl-defmethod ess-build-eval-command--override (string &context (ess-dialect "R")
|
||||
&optional visibly output file &rest args)
|
||||
"R method to build eval command."
|
||||
(let* ((namespace (caar args))
|
||||
(namespace (unless ess-debug-minor-mode
|
||||
(or namespace (ess-r-get-evaluation-env))))
|
||||
(cmd (if namespace ".ess.ns_eval" ".ess.eval"))
|
||||
(cmd (ess-r--format-call (if namespace ".ess.ns_eval" ".ess.eval")))
|
||||
(file (when file (ess-r-arg "file" file t)))
|
||||
(rargs (ess-r-build-args visibly output namespace)))
|
||||
(concat cmd "(\"" string "\"" rargs file ")\n")))
|
||||
@@ -1271,7 +1322,7 @@ Placed into `ess-presend-filter-functions' for R dialects."
|
||||
(cl-defmethod ess-build-load-command (string &context (ess-dialect "R")
|
||||
&optional visibly output file &rest _args)
|
||||
(let* ((namespace (or file (ess-r-get-evaluation-env)))
|
||||
(cmd (if namespace ".ess.ns_source" ".ess.source"))
|
||||
(cmd (ess-r--format-call (if namespace ".ess.ns_source" ".ess.source")))
|
||||
(rargs (ess-r-build-args visibly output namespace)))
|
||||
(concat cmd "('" string "'" rargs ")\n")))
|
||||
|
||||
@@ -1394,7 +1445,7 @@ selected (see `ess-r-set-evaluation-env')."
|
||||
(setq ess-r-help--local-object obj)
|
||||
(let ((obj-arg (concat "'" obj "'"))
|
||||
(pkg-arg (ess-r-arg "package" pkg t)))
|
||||
(concat ".ess.help(" obj-arg pkg-arg ")\n")))
|
||||
(ess-r--format-call ".ess.help(%s%s)\n" obj-arg pkg-arg)))
|
||||
|
||||
(defun ess-r-help--build-help-command--unqualified (obj)
|
||||
(if (eq ess-help-type 'index)
|
||||
@@ -1500,21 +1551,20 @@ process."
|
||||
;; `.ess.command()` is not defined until ESSR is loaded so disable
|
||||
;; it temporarily. Would be helpful to implement an `inferior-ess-let'
|
||||
;; macro .
|
||||
(ess-r--without-format-command
|
||||
(cond
|
||||
((file-remote-p (ess-get-process-variable 'default-directory))
|
||||
(if (eq ess-r-fetch-ESSR-on-remotes t)
|
||||
(or (ess-r--fetch-ESSR-remote)
|
||||
(ess-r--load-ESSR-remote))
|
||||
(ess-r--load-ESSR-remote)))
|
||||
((and (bound-and-true-p ess-remote))
|
||||
;; NB: With ess-remote we send by chunks because sending large sources is
|
||||
;; fragile
|
||||
(if ess-r-fetch-ESSR-on-remotes
|
||||
(or (ess-r--fetch-ESSR-remote)
|
||||
(ess-r--load-ESSR-remote t))
|
||||
(ess-r--load-ESSR-remote t)))
|
||||
(t (ess-r--load-ESSR-local)))))
|
||||
(cond
|
||||
((file-remote-p (ess-get-process-variable 'default-directory))
|
||||
(if (eq ess-r-fetch-ESSR-on-remotes t)
|
||||
(or (ess-r--fetch-ESSR-remote)
|
||||
(ess-r--load-ESSR-remote))
|
||||
(ess-r--load-ESSR-remote)))
|
||||
((and (bound-and-true-p ess-remote))
|
||||
;; NB: With ess-remote we send by chunks because sending large sources is
|
||||
;; fragile
|
||||
(if ess-r-fetch-ESSR-on-remotes
|
||||
(or (ess-r--fetch-ESSR-remote)
|
||||
(ess-r--load-ESSR-remote t))
|
||||
(ess-r--load-ESSR-remote t)))
|
||||
(t (ess-r--load-ESSR-local))))
|
||||
|
||||
(defun ess-r--load-ESSR-local ()
|
||||
"Load ESSR into a local process.
|
||||
@@ -1523,16 +1573,26 @@ Source the etc/ESSR/.load.R file into the R process. The
|
||||
etc/ESSR/R directory into the ESSR environment and attaches the
|
||||
environment to the search path."
|
||||
(let* ((src-dir (expand-file-name "ESSR/R" ess-etc-directory))
|
||||
(cmd (format "local({
|
||||
source('%s/.load.R', local=TRUE) #define load.ESSR
|
||||
.ess.ESSR.load('%s')
|
||||
})\n"
|
||||
src-dir src-dir)))
|
||||
(with-current-buffer (ess-command cmd)
|
||||
(buf (ess-command (ess-r--load-ESSR-command src-dir))))
|
||||
(with-current-buffer buf
|
||||
(let ((msg (buffer-string)))
|
||||
(when (> (length msg) 1)
|
||||
(message (format "Messages while loading ESSR: %s" msg)))))))
|
||||
|
||||
(defun ess-r--load-ESSR-command (src-dir)
|
||||
(format "base::tryCatch(
|
||||
base::local({
|
||||
base::source('%s/.load.R', local=TRUE) #define load.ESSR
|
||||
.ess.ESSR.load('%s')
|
||||
}),
|
||||
error = function(cnd) {
|
||||
msg <- paste0('ESSR::ERROR \"', conditionMessage(cnd), '\"')
|
||||
writeLines(msg)
|
||||
}
|
||||
)\n"
|
||||
src-dir
|
||||
src-dir))
|
||||
|
||||
(defun ess-r--load-ESSR-remote (&optional chunked)
|
||||
"Load ESSR into a remote process through the process connection.
|
||||
Send the contents of the etc/ESSR/R directory to the remote
|
||||
@@ -1642,7 +1702,8 @@ Return the amount the indentation changed by."
|
||||
(indent-region start (point)))))
|
||||
|
||||
(defun ess-offset (offset)
|
||||
(setq offset (eval (intern (concat "ess-offset-" (symbol-name offset)))))
|
||||
(setq offset
|
||||
(symbol-value (intern (concat "ess-offset-" (symbol-name offset)))))
|
||||
(when (and (not (eq offset nil))
|
||||
(listp offset)
|
||||
(or (numberp (cadr offset))
|
||||
@@ -1657,7 +1718,8 @@ Return the amount the indentation changed by."
|
||||
ess-indent-offset)))
|
||||
|
||||
(defun ess-offset-type (offset)
|
||||
(setq offset (eval (intern (concat "ess-offset-" (symbol-name offset)))))
|
||||
(setq offset
|
||||
(symbol-value (intern (concat "ess-offset-" (symbol-name offset)))))
|
||||
(if (listp offset)
|
||||
(car offset)
|
||||
offset))
|
||||
@@ -1788,7 +1850,7 @@ Returns nil if line starts inside a string, t if in a comment."
|
||||
(when (ess-at-containing-sexp
|
||||
(looking-at "{"))
|
||||
(ess-escape-prefixed-block))))
|
||||
(cl-some 'looking-at
|
||||
(cl-some #'looking-at
|
||||
(ess-overridden-blocks)))
|
||||
(+ (current-column) offset))))))
|
||||
|
||||
@@ -1920,7 +1982,7 @@ Returns nil if line starts inside a string, t if in a comment."
|
||||
(override (and ess-align-arguments-in-calls
|
||||
(save-excursion
|
||||
(ess-climb-object)
|
||||
(cl-some 'looking-at
|
||||
(cl-some #'looking-at
|
||||
ess-align-arguments-in-calls))))
|
||||
(type-sym (cond (block 'block)
|
||||
((looking-at "[[:blank:]]*[([][[:blank:]]*\\($\\|#\\)")
|
||||
@@ -2149,7 +2211,7 @@ Returns nil if line starts inside a string, t if in a comment."
|
||||
|
||||
(defun ess-calculate-indent--nested-calls ()
|
||||
(when ess-align-nested-calls
|
||||
(let ((calls (mapconcat 'identity ess-align-nested-calls "\\|"))
|
||||
(let ((calls (mapconcat #'identity ess-align-nested-calls "\\|"))
|
||||
match)
|
||||
(save-excursion
|
||||
(and containing-sexp
|
||||
@@ -2455,9 +2517,9 @@ state.")
|
||||
(setq-local comint-prompt-regexp inferior-S-prompt)
|
||||
(setq-local syntax-propertize-function ess-r--syntax-propertize-function)
|
||||
(setq comint-input-sender 'inferior-ess-r-input-sender)
|
||||
(remove-hook 'completion-at-point-functions 'ess-filename-completion 'local) ;; should be first
|
||||
(add-hook 'completion-at-point-functions 'ess-r-object-completion nil 'local)
|
||||
(add-hook 'completion-at-point-functions 'ess-filename-completion nil 'local)
|
||||
(remove-hook 'completion-at-point-functions #'ess-filename-completion 'local) ;; should be first
|
||||
(add-hook 'completion-at-point-functions #'ess-r-object-completion nil 'local)
|
||||
(add-hook 'completion-at-point-functions #'ess-filename-completion nil 'local)
|
||||
(add-hook 'xref-backend-functions #'ess-r-xref-backend nil 'local)
|
||||
(add-hook 'project-find-functions #'ess-r-project nil 'local)
|
||||
;; eldoc
|
||||
@@ -2467,7 +2529,7 @@ state.")
|
||||
;; company
|
||||
(ess--setup-company ess-r-company-backends t)
|
||||
(setq comint-get-old-input #'inferior-ess-get-old-input)
|
||||
(add-hook 'comint-input-filter-functions 'ess-search-path-tracker nil 'local))
|
||||
(add-hook 'comint-input-filter-functions #'ess-search-path-tracker nil 'local))
|
||||
|
||||
|
||||
|
||||
@@ -2517,9 +2579,10 @@ state.")
|
||||
"Add links to the help buffer."
|
||||
(let ((links (when (ess-process-live-p)
|
||||
(ess-get-words-from-vector
|
||||
(format ".ess.helpLinks('%s' %s)\n"
|
||||
ess-r-help--local-object
|
||||
(ess-r-arg "package" ess-r-help--local-package t)))))
|
||||
(ess-r--format-call
|
||||
".ess.helpLinks('%s' %s)\n"
|
||||
ess-r-help--local-object
|
||||
(ess-r-arg "package" ess-r-help--local-package t)))))
|
||||
(inhibit-read-only t))
|
||||
(save-excursion
|
||||
;; Search for fancy quotes only. If users have
|
||||
@@ -2549,7 +2612,7 @@ from all installed packages, which can be very slow."
|
||||
(goto-char (point-min))
|
||||
(when (re-search-forward "(list" nil t)
|
||||
(goto-char (match-beginning 0))
|
||||
(ignore-errors (eval (read (current-buffer)))))))
|
||||
(ignore-errors (eval (read (current-buffer)) t)))))
|
||||
(proc-name ess-current-process-name)
|
||||
(alist ess-local-customize-alist)
|
||||
(remote (file-remote-p default-directory))
|
||||
@@ -2559,7 +2622,7 @@ from all installed packages, which can be very slow."
|
||||
(with-current-buffer buff
|
||||
(setq buffer-read-only nil)
|
||||
(delete-region (point-min) (point-max))
|
||||
(ess-setq-vars-local (eval alist))
|
||||
(ess-setq-vars-local (eval alist t))
|
||||
(setq ess-local-process-name proc-name)
|
||||
(ess--help-major-mode)
|
||||
(setq ess-help-sec-regex "^\\w+:$"
|
||||
@@ -2682,13 +2745,13 @@ from all installed packages, which can be very slow."
|
||||
des-col-beginning des-col-end entries)
|
||||
(with-current-buffer (ess-command cmd (get-buffer-create " *ess-rutils-pkgs*"))
|
||||
(goto-char (point-min))
|
||||
(delete-region (point) (1+ (point-at-eol)))
|
||||
(delete-region (point) (1+ (line-end-position)))
|
||||
;; Now we have a buffer with package name, description, and
|
||||
;; version. description and version are surrounded by quotes,
|
||||
;; description is separated by whitespace.
|
||||
(re-search-forward "\\>[[:space:]]+")
|
||||
(setq des-col-beginning (current-column))
|
||||
(goto-char (point-at-eol))
|
||||
(goto-char (line-end-position))
|
||||
;; Unless someone has a quote character in their package version,
|
||||
;; two quotes back will be the end of the package description.
|
||||
(dotimes (_ 2) (search-backward "\""))
|
||||
@@ -2861,7 +2924,8 @@ given field. Options should be separated by value of
|
||||
(interactive "sSearch string: ")
|
||||
(let ((site "https://search.r-project.org/cgi-bin/namazu.cgi?query=")
|
||||
(okstring (replace-regexp-in-string " +" "+" string)))
|
||||
(if current-prefix-arg
|
||||
(browse-url
|
||||
(if current-prefix-arg
|
||||
(let ((mpp (concat
|
||||
"&max="
|
||||
(completing-read
|
||||
@@ -2885,16 +2949,17 @@ given field. Options should be separated by value of
|
||||
(restrict (concat
|
||||
"&idxname="
|
||||
(mapconcat
|
||||
'identity
|
||||
#'identity
|
||||
(completing-read-multiple
|
||||
"Limit search to: "
|
||||
'(("Rhelp02a" 1) ("functions" 2)
|
||||
("docs" 3) ("Rhelp01" 4))
|
||||
nil t "Rhelp02a,functions,docs" nil
|
||||
"Rhelp02a,functions,docs") "&idxname="))))
|
||||
(browse-url (concat site okstring mpp format sortby restrict)))
|
||||
(browse-url (concat site okstring "&max=20&result=normal&sort=score"
|
||||
"&idxname=Rhelp02a&idxname=functions&idxname=docs")))))
|
||||
"Rhelp02a,functions,docs")
|
||||
"&idxname="))))
|
||||
(concat site okstring mpp format sortby restrict))
|
||||
(concat site okstring "&max=20&result=normal&sort=score"
|
||||
"&idxname=Rhelp02a&idxname=functions&idxname=docs")))))
|
||||
|
||||
(defun ess-rutils-help-search (string)
|
||||
"Search for STRING using help.search()."
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
;;; ess-r-package.el --- Package development mode for R. -*- lexical-binding: t; -*-
|
||||
|
||||
;; Copyright (C) 2011-2020 Free Software Foundation, Inc.
|
||||
;; Copyright (C) 2011-2022 Free Software Foundation, Inc.
|
||||
;; Author: Lionel Henry, Vitalie Spinu
|
||||
;; Maintainer: ESS-core <ESS-core@r-project.org>
|
||||
|
||||
@@ -247,7 +247,7 @@ Namespaced evaluation is enabled if
|
||||
(string= (directory-file-name subpath) "R")))
|
||||
(ess-r-set-evaluation-env (ess-r-package-name))))))
|
||||
|
||||
(add-hook 'ess-r-mode-hook 'ess-r-package-enable-namespaced-evaluation)
|
||||
(add-hook 'ess-r-mode-hook #'ess-r-package-enable-namespaced-evaluation)
|
||||
|
||||
(defun ess-r-package-eval-linewise (command &optional msg p actions)
|
||||
"Send COMMAND to R process.
|
||||
@@ -279,7 +279,7 @@ arguments, or expressions which return R arguments."
|
||||
(args (cond ((null action) "")
|
||||
((stringp action) action)
|
||||
((functionp action) (funcall action))
|
||||
((listp action) (eval action))
|
||||
((listp action) (eval action t))
|
||||
(t (error "Invalid action")))))
|
||||
(if (string= "" args)
|
||||
args
|
||||
@@ -525,14 +525,14 @@ Set this variable to nil to disable the mode line entirely."
|
||||
inferior-ess-reload-function)))
|
||||
(mapc (lambda (var)
|
||||
(set (make-local-variable var)
|
||||
(eval (cdr (assq var ess-r-customize-alist)))))
|
||||
(eval (cdr (assq var ess-r-customize-alist)) t)))
|
||||
vars))
|
||||
(add-hook 'project-find-functions #'ess-r-project nil 'local)
|
||||
(run-hooks 'ess-r-package-enter-hook))
|
||||
(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)
|
||||
(add-hook 'after-change-major-mode-hook #'ess-r-package-auto-activate)
|
||||
|
||||
|
||||
;;;*;;; Activation
|
||||
@@ -568,22 +568,21 @@ package mode. Use this function if state of the buffer such as
|
||||
(ess-r-package-re-activate)))
|
||||
|
||||
(defun ess-r-package-activate-directory-tracker ()
|
||||
(add-hook 'after-change-functions 'ess-r-package-default-directory-tracker t t))
|
||||
(add-hook 'after-change-functions #'ess-r-package-default-directory-tracker t t))
|
||||
|
||||
(add-hook 'shell-mode-hook 'ess-r-package-activate-directory-tracker t)
|
||||
(add-hook 'eshell-mode-hook 'ess-r-package-activate-directory-tracker t)
|
||||
(when (fboundp 'advice-add)
|
||||
(require 'shell)
|
||||
(advice-add 'shell-resync-dirs :after 'ess-r-package-re-activate))
|
||||
(add-hook 'shell-mode-hook #'ess-r-package-activate-directory-tracker t)
|
||||
(add-hook 'eshell-mode-hook #'ess-r-package-activate-directory-tracker t)
|
||||
;; (require 'shell)
|
||||
(advice-add 'shell-resync-dirs :after #'ess-r-package-re-activate)
|
||||
|
||||
|
||||
;;;*;;; Deprecated variables and functions
|
||||
(defun ess-developer (&optional _val)
|
||||
(error "As of ESS 16.04, `ess-developer' is deprecated. Use `ess-r-set-evaluation-env' instead"))
|
||||
|
||||
(defalias 'ess-toggle-developer 'ess-developer)
|
||||
(define-obsolete-function-alias 'ess-r-devtools-check-package-buildwin 'ess-r-devtools-check-with-winbuilder "18.04")
|
||||
(define-obsolete-function-alias 'ess-r-devtools-ask 'ess-r-devtools-execute-command "18.04")
|
||||
(defalias 'ess-toggle-developer #'ess-developer)
|
||||
(define-obsolete-function-alias 'ess-r-devtools-check-package-buildwin #'ess-r-devtools-check-with-winbuilder "18.04")
|
||||
(define-obsolete-function-alias 'ess-r-devtools-ask #'ess-r-devtools-execute-command "18.04")
|
||||
|
||||
(make-obsolete-variable 'ess-developer "Please use `ess-developer-select-package' and `ess-r-set-evaluation-env' instead." "16.04")
|
||||
(make-obsolete-variable 'ess-developer-root-file "Please use `ess-r-package-root-file' instead." "16.04")
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
;;; ess-r-syntax.el --- Utils to work with R code
|
||||
;;; ess-r-syntax.el --- Utils to work with R code -*- lexical-binding: t; -*-
|
||||
|
||||
;; Copyright (C) 2015-2020 Free Software Foundation, Inc.
|
||||
;; Copyright (C) 2015-2022 Free Software Foundation, Inc.
|
||||
;; Author: Lionel Henry <lionel.hry@gmail.com>
|
||||
;; Created: 12 Oct 2015
|
||||
;; Maintainer: ESS-core <ESS-core@r-project.org>
|
||||
@@ -123,7 +123,7 @@ This is useful to trigger side-effects. FORMS follows the same
|
||||
syntax as arguments to `cond'."
|
||||
(declare (indent 0) (debug nil))
|
||||
`(let ((forms (list ,@(mapcar (lambda (form) `(progn ,@form)) forms))))
|
||||
(cl-some 'identity (mapcar 'eval forms))))
|
||||
(cl-some #'identity (mapcar (lambda (e) (eval e t)) forms))))
|
||||
|
||||
(defun ess-char-syntax (string)
|
||||
(char-to-string (char-syntax (string-to-char string))))
|
||||
@@ -340,25 +340,6 @@ content. Return nil when the end of the buffer is reached."
|
||||
(ess-forward-sexp)
|
||||
"%infix%")))
|
||||
|
||||
(defun ess-escape-token ()
|
||||
(ess-escape-comment)
|
||||
(ess-skip-blanks-forward)
|
||||
(or (ess-escape-string)
|
||||
(when (ess-token-delimiter-p (ess-token-after))
|
||||
(prog1 t
|
||||
(mapc (lambda (delims)
|
||||
(while (and (ess-token-after= nil delims)
|
||||
(eq (char-before) (string-to-char
|
||||
(car delims))))
|
||||
(ess-backward-char)))
|
||||
'(("[" "[[") ("]" "]]")))))
|
||||
(ess-token-after= '("," ";"))
|
||||
(and (ess-token-after= "identifier")
|
||||
(not (memq (char-syntax (char-before)) '(?w ?_))))
|
||||
(progn (skip-syntax-backward ".")
|
||||
(ess-token-operator-p (ess-token-after)))
|
||||
(/= (skip-syntax-backward "w_") 0)))
|
||||
|
||||
(defun ess-refine-token (token)
|
||||
(let ((refined-type
|
||||
(pcase (ess-token-type token)
|
||||
@@ -407,15 +388,6 @@ content. Return nil when the end of the buffer is reached."
|
||||
(nth 1 token))
|
||||
token)))
|
||||
|
||||
(defun ess-token-balancing-delim (token)
|
||||
(pcase (ess-token-type token)
|
||||
(`"(" ")")
|
||||
(`")" "(")
|
||||
(`"[" "]")
|
||||
(`"]" "[")
|
||||
(`"[[" "]]")
|
||||
(`"]]" "[[")))
|
||||
|
||||
|
||||
;;;*;;; Token predicates
|
||||
|
||||
@@ -457,294 +429,6 @@ content. Return nil when the end of the buffer is reached."
|
||||
(member (ess-token-type token) ess-r-keywords-list))
|
||||
|
||||
|
||||
;;;*;;; Tokens properties and accessors
|
||||
|
||||
(defun ess-token-make-hash (&rest specs)
|
||||
(let ((table (make-hash-table :test #'equal)))
|
||||
(mapc (lambda (spec)
|
||||
;; alist
|
||||
(if (listp (cdr spec))
|
||||
(mapc (lambda (cell)
|
||||
(puthash (car cell) (cdr cell) table))
|
||||
spec)
|
||||
;; Cons cell
|
||||
(mapc (lambda (token)
|
||||
(puthash token (cdr spec) table))
|
||||
(car spec))))
|
||||
specs)
|
||||
table))
|
||||
|
||||
(defvar ess-token-r-powers-delimiters
|
||||
'(("(" . 100)
|
||||
("[" . 100)
|
||||
("[[" . 100)))
|
||||
|
||||
(defvar ess-token-r-powers-operator
|
||||
'(("?" . 5)
|
||||
("else" . 8)
|
||||
("<-" . 10)
|
||||
("<<-" . 10)
|
||||
("=" . 15)
|
||||
("->" . 20)
|
||||
("->>" . 20)
|
||||
("~" . 25)
|
||||
("|" . 30)
|
||||
("||" . 30)
|
||||
("&" . 35)
|
||||
("&&" . 35)
|
||||
("!" . 40)
|
||||
("<" . 45)
|
||||
(">" . 45)
|
||||
("<=" . 45)
|
||||
(">=" . 45)
|
||||
("==" . 45)
|
||||
("+" . 50)
|
||||
("-" . 50)
|
||||
("*" . 55)
|
||||
("/" . 55)
|
||||
("%infix%" . 60)
|
||||
(":" . 65)
|
||||
("^" . 70)
|
||||
("$" . 75)
|
||||
("@" . 75)
|
||||
("::" . 80)
|
||||
(":::" . 80)))
|
||||
|
||||
(defvar ess-token-r-power-table
|
||||
(ess-token-make-hash ess-token-r-powers-operator
|
||||
ess-token-r-powers-delimiters))
|
||||
|
||||
(defvar ess-token-r-right-powers-operator
|
||||
'((")" . 1)))
|
||||
|
||||
(defvar ess-token-r-right-power-table
|
||||
(ess-token-make-hash ess-token-r-powers-operator
|
||||
ess-token-r-right-powers-operator))
|
||||
|
||||
(defvar ess-token-r-nud-table
|
||||
(ess-token-make-hash
|
||||
'(("identifier" . identity)
|
||||
("literal" . identity)
|
||||
("number" . identity)
|
||||
("function" . identity)
|
||||
("if" . identity)
|
||||
("while" . identity)
|
||||
("for" . identity))
|
||||
'(("(" . ess-parser-nud-block)
|
||||
("{" . ess-parser-nud-block))))
|
||||
|
||||
(defvar ess-token-r-rnud-table
|
||||
(ess-token-make-hash
|
||||
'(("identifier" . identity)
|
||||
("literal" . identity)
|
||||
("number" . identity))
|
||||
'((")" . ess-parser-rnud-paren)
|
||||
("}" . ess-parser-nud-block))))
|
||||
|
||||
(defvar ess-token-r-leds-operator
|
||||
(let ((operators-list (append '("%infix%" "else") ess-r-operators-list)))
|
||||
(cons operators-list #'ess-parser-led-lassoc)))
|
||||
|
||||
(defvar ess-token-r-leds-delimiter
|
||||
'(("(" . ess-parser-led-funcall)
|
||||
("[" . ess-parser-led-funcall)
|
||||
("[[" . ess-parser-led-funcall)))
|
||||
|
||||
(defvar ess-token-r-led-table
|
||||
(ess-token-make-hash ess-token-r-leds-operator
|
||||
ess-token-r-leds-delimiter))
|
||||
|
||||
(defvar ess-token-r-rid-table
|
||||
(ess-token-make-hash
|
||||
'((")" . ess-parser-rid-expr-prefix))))
|
||||
|
||||
|
||||
;;;*;;; Nud, led and rid functions
|
||||
|
||||
(defun ess-parser-nud-block (prefix-token)
|
||||
(let ((right (list (cons "TODO" nil))))
|
||||
(ess-parser-advance-pair nil prefix-token)
|
||||
(ess-node (cons "block" nil)
|
||||
(cons (ess-token-start prefix-token) (point))
|
||||
(list prefix-token right))))
|
||||
|
||||
(defun ess-parser-led-lassoc (start infix-token)
|
||||
(let* ((power (ess-parser-power infix-token))
|
||||
(end (ess-parse-expression power)))
|
||||
(ess-node (cons "binary-op" nil)
|
||||
(cons (ess-parser-token-start start) (point))
|
||||
(list start infix-token end))))
|
||||
|
||||
(defun ess-parser-led-funcall (left infix-token)
|
||||
(when (ess-token= left (append '("identifier" "string" "node")
|
||||
ess-r-prefix-keywords-list))
|
||||
(let* ((power (ess-parser-power infix-token))
|
||||
(right (ess-parse-arglist power infix-token))
|
||||
(type (if (ess-token= left ess-r-prefix-keywords-list)
|
||||
"prefixed-expr"
|
||||
"funcall")))
|
||||
(when (string= type "prefixed-expr")
|
||||
(setq right (list right (ess-parse-expression 0))))
|
||||
(ess-node (cons type nil)
|
||||
(cons (ess-parser-token-start left) (point))
|
||||
(list left right)))))
|
||||
|
||||
(defun ess-parser-rid-expr-prefix (right suffix-token)
|
||||
(when (ess-refined-token= suffix-token "prefixed-expr-delimiter")
|
||||
(ess-parser-rnud-paren suffix-token right)))
|
||||
|
||||
(defun ess-parser-rnud-paren (suffix-token &optional prefixed-expr)
|
||||
(let* ((infix-token (save-excursion
|
||||
(ess-parser-advance-pair nil suffix-token)))
|
||||
(power (ess-parser-power infix-token))
|
||||
(args (ess-parse-arglist power suffix-token))
|
||||
(left (if prefixed-expr
|
||||
(ess-parser-advance)
|
||||
(ess-parse-expression power)))
|
||||
(type (cond (prefixed-expr "prefixed-expr")
|
||||
(left "funcall")
|
||||
(t "enclosed-expr"))))
|
||||
(when prefixed-expr
|
||||
(setcdr (car prefixed-expr) (list infix-token suffix-token)))
|
||||
(ess-node (cons type nil)
|
||||
(cons (ess-parser-token-start suffix-token) (point))
|
||||
(if prefixed-expr
|
||||
(list prefixed-expr args left)
|
||||
(list args left)))))
|
||||
|
||||
|
||||
;;;*;;; Parsing
|
||||
|
||||
(defun ess-parser-advance (&optional type value)
|
||||
(if (bound-and-true-p ess-parser--backward)
|
||||
(ess-climb-token type value)
|
||||
(ess-jump-token type value)))
|
||||
|
||||
(defun ess-parser-advance-pair (&optional type token)
|
||||
(if (bound-and-true-p ess-parser--backward)
|
||||
(ess-climb-paired-delims type token)
|
||||
(ess-jump-paired-delims type token)))
|
||||
|
||||
(defun ess-parser-next-token ()
|
||||
(if (bound-and-true-p ess-parser--backward)
|
||||
(ess-token-before)
|
||||
(ess-token-after)))
|
||||
|
||||
(defun ess-parser-token-start (token)
|
||||
(if (bound-and-true-p ess-parser--backward)
|
||||
(ess-token-end token)
|
||||
(ess-token-start token)))
|
||||
|
||||
(defun ess-parser-power (token)
|
||||
(or (if (bound-and-true-p ess-parser--backward)
|
||||
(gethash (ess-token-type token) ess-token-r-right-power-table)
|
||||
(gethash (ess-token-type token) ess-token-r-power-table))
|
||||
0))
|
||||
|
||||
(defun ess-node (type pos contents)
|
||||
(let ((pos (if (bound-and-true-p ess-parser--backward)
|
||||
(cons (cdr pos) (car pos))
|
||||
pos))
|
||||
(contents (if (bound-and-true-p ess-parser--backward)
|
||||
(nreverse contents)
|
||||
contents)))
|
||||
(list type pos contents)))
|
||||
|
||||
(defalias 'ess-node-start #'ess-token-start)
|
||||
(defalias 'ess-node-end #'ess-token-end)
|
||||
|
||||
(defun ess-parse-start-token (token)
|
||||
(let* ((table (if (bound-and-true-p ess-parser--backward)
|
||||
ess-token-r-rnud-table
|
||||
ess-token-r-nud-table))
|
||||
(nud (gethash (ess-token-type token) table)))
|
||||
(when (fboundp nud)
|
||||
(funcall nud token))))
|
||||
|
||||
(defun ess-parse-infix-token (infix-token left)
|
||||
(let ((infix-power (ess-parser-power infix-token))
|
||||
(led (or (when (bound-and-true-p ess-parser--backward)
|
||||
(gethash (ess-token-type infix-token) ess-token-r-rid-table))
|
||||
(gethash (ess-token-type infix-token) ess-token-r-led-table))))
|
||||
(funcall led left infix-token)))
|
||||
|
||||
(defun ess-parse-expression (&optional power)
|
||||
(let ((current (ess-parse-start-token (ess-parser-advance)))
|
||||
(power (or power 0))
|
||||
(next (ess-parser-next-token))
|
||||
(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-successful-pos (point))
|
||||
(setq last-success current))
|
||||
(setq next (ess-parser-next-token)))
|
||||
(goto-char last-successful-pos)
|
||||
last-success))
|
||||
|
||||
(defun ess-parse-arglist (power start-token)
|
||||
(let ((start-pos (point))
|
||||
(arg-start-pos (point))
|
||||
(arglist (list start-token))
|
||||
(closing-delim (ess-token-balancing-delim start-token))
|
||||
expr)
|
||||
(while (and (setq expr (ess-parse-expression))
|
||||
(push (ess-node (cons "arg" nil)
|
||||
(cons arg-start-pos (point))
|
||||
(list expr))
|
||||
arglist)
|
||||
(ess-parser-advance ","))
|
||||
(setq arg-start-pos (point)))
|
||||
(push (ess-parser-advance closing-delim) arglist)
|
||||
(ess-node (cons "arglist" nil)
|
||||
(cons start-pos (1- (point)))
|
||||
(nreverse arglist))))
|
||||
|
||||
(defun forward-ess-r-expr ()
|
||||
(interactive)
|
||||
(ess-save-excursion-when-nil
|
||||
(ess-escape-token)
|
||||
(ess-parse-expression)))
|
||||
|
||||
(defun forward-ess-r-sexp ()
|
||||
(interactive)
|
||||
(ess-save-excursion-when-nil
|
||||
(ess-escape-token)
|
||||
(let* ((orig-token (ess-token-after))
|
||||
(tree (ess-parse-expression))
|
||||
(sexp-node (ess-parser-tree-assoc orig-token tree)))
|
||||
(when sexp-node
|
||||
(goto-char (ess-token-end sexp-node))
|
||||
sexp-node))))
|
||||
|
||||
(defun backward-ess-r-expr ()
|
||||
(interactive)
|
||||
(let ((ess-parser--backward t))
|
||||
(ess-parse-expression)))
|
||||
|
||||
(defun backward-ess-r-sexp ()
|
||||
(interactive)
|
||||
(error "Todo"))
|
||||
|
||||
(defun ess-parser-tree-assoc (key tree)
|
||||
(let ((next tree)
|
||||
stack last-node result)
|
||||
(while (and next (null result))
|
||||
(cond ((eq next 'node-end)
|
||||
(pop last-node))
|
||||
((nth 2 next)
|
||||
(push 'node-end stack)
|
||||
(dolist (node (nth 2 next))
|
||||
(push node stack))
|
||||
(push next last-node))
|
||||
((equal next key)
|
||||
(setq result (car last-node))))
|
||||
(setq next (pop stack)))
|
||||
result))
|
||||
|
||||
|
||||
;;*;; Point predicates
|
||||
|
||||
(defun ess-inside-call-p (&optional call)
|
||||
@@ -914,7 +598,7 @@ nil, return the prefix."
|
||||
(defun ess-behind-prefixed-block-p (&optional call)
|
||||
(if call
|
||||
(looking-at (concat call "[ \t]*("))
|
||||
(cl-some 'looking-at ess-prefixed-block-patterns)))
|
||||
(cl-some #'looking-at ess-prefixed-block-patterns)))
|
||||
|
||||
(defun ess-unbraced-block-p (&optional ignore-ifelse)
|
||||
"This indicates whether point is in front of an unbraced
|
||||
@@ -926,7 +610,7 @@ position of the control flow function (if, for, while, etc)."
|
||||
(not ignore-ifelse))
|
||||
(and (looking-at "(")
|
||||
(ess-backward-sexp)
|
||||
(cl-some 'looking-at ess-prefixed-block-patterns)
|
||||
(cl-some #'looking-at ess-prefixed-block-patterns)
|
||||
(if ignore-ifelse
|
||||
(not (looking-at "if\\b"))
|
||||
t)))
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
;; ess-rd.el --- Support for editing R documentation (Rd) source -*- lexical-binding: t; -*-
|
||||
|
||||
;; Copyright (C) 1997-2020 Free Software Foundation, Inc.
|
||||
;; Copyright (C) 1997-2023 Free Software Foundation, Inc.
|
||||
;; Author: KH <Kurt.Hornik@ci.tuwien.ac.at>
|
||||
;; Created: 25 July 1997
|
||||
;; Maintainer: ESS-core <ESS-core@r-project.org>
|
||||
@@ -150,12 +150,12 @@ All Rd mode abbrevs start with a grave accent (`)."
|
||||
(list
|
||||
(cons
|
||||
(concat "\\\\\\("
|
||||
(mapconcat 'identity Rd-section-names "\\|")
|
||||
(mapconcat #'identity Rd-section-names "\\|")
|
||||
"\\>\\)")
|
||||
'font-lock-reference-face) ; Rd-bold-face
|
||||
'font-lock-constant-face) ; Rd-bold-face
|
||||
(cons
|
||||
(concat "\\\\\\("
|
||||
(mapconcat 'identity Rd-keywords "\\|")
|
||||
(mapconcat #'identity Rd-keywords "\\|")
|
||||
"\\>\\)")
|
||||
'font-lock-keyword-face)
|
||||
'("^#\\(ifn?def\\)\\s-+\\(\\sw+\\)"
|
||||
@@ -241,12 +241,12 @@ Type \\[list-abbrevs] to display the built-in abbrevs for Rd
|
||||
keywords.To automatically turn on the abbrev(iate) features, add
|
||||
the following to your Emacs configuration file:
|
||||
|
||||
(add-hook 'Rd-mode-hook #'abbrev-mode)"
|
||||
(add-hook \\='Rd-mode-hook #\\='abbrev-mode)"
|
||||
(setq ess-language "S" ess-dialect "R")
|
||||
(require 'ess-r-mode)
|
||||
(ess-setq-vars-local ess-r-customize-alist)
|
||||
|
||||
(setq-local indent-line-function 'Rd-mode-indent-line)
|
||||
(setq-local indent-line-function #'Rd-mode-indent-line)
|
||||
(setq fill-column 72)
|
||||
(setq-local comment-start-skip "\\s<+\\s-*")
|
||||
(setq-local comment-start "% ")
|
||||
@@ -306,7 +306,7 @@ the following to your Emacs configuration file:
|
||||
0)
|
||||
(t
|
||||
(let ((p (progn
|
||||
(re-search-forward "[ \t]*\\s)*" (point-at-eol) t)
|
||||
(re-search-forward "[ \t]*\\s)*" (line-end-position) t)
|
||||
(point))))
|
||||
(if (or (< (forward-line -1) 0)
|
||||
(Rd-mode-in-verbatim-p))
|
||||
@@ -316,7 +316,7 @@ the following to your Emacs configuration file:
|
||||
(Rd-mode-in-preprocessor-line-p))
|
||||
(not (bobp)))
|
||||
(forward-line -1))
|
||||
(re-search-forward "[ \t]*\\s)*" (point-at-eol) t)
|
||||
(re-search-forward "[ \t]*\\s)*" (line-end-position) t)
|
||||
(prog1
|
||||
(+ (current-indentation)
|
||||
(* (car (parse-partial-sexp (point) p))
|
||||
@@ -478,7 +478,7 @@ temporary one in variable `temporary-file-directory'."
|
||||
(unless (get-buffer-window pbuf 'visible)
|
||||
(display-buffer pbuf t))))
|
||||
|
||||
(define-obsolete-function-alias 'Rd-submit-bug-report 'ess-submit-bug-report "2018-08-16")
|
||||
(define-obsolete-function-alias 'Rd-submit-bug-report #'ess-submit-bug-report "2018-08-16")
|
||||
|
||||
(provide 'ess-rd)
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
;;; ess-rdired.el --- prototype object browser for R, looks like dired mode. -*- lexical-binding: t; -*-
|
||||
|
||||
;; Copyright (C) 2002-2020 Free Software Foundation, Inc.
|
||||
;; Copyright (C) 2002-2022 Free Software Foundation, Inc.
|
||||
;; Author: Stephen Eglen <stephen@anc.ed.ac.uk>
|
||||
;; Created: Thu 24 Oct 2002
|
||||
;; Maintainer: ESS-core <ESS-core@r-project.org>
|
||||
@@ -153,7 +153,7 @@ details."
|
||||
(goto-char (point-min))
|
||||
;; Delete two lines. One filled with +'s from R's prompt
|
||||
;; printing, the other with the header info from the data.frame
|
||||
(delete-region (point-min) (1+ (point-at-eol 2)))
|
||||
(delete-region (point-min) (1+ (line-end-position 2)))
|
||||
(setq text (split-string (buffer-string) "\n" t "\n"))
|
||||
(erase-buffer))
|
||||
(with-current-buffer buff
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
;;; ess-roxy.el --- convenient editing of in-code roxygen documentation
|
||||
;;; ess-roxy.el --- convenient editing of in-code roxygen documentation -*- lexical-binding: t; -*-
|
||||
|
||||
;; Copyright (C) 2009-2020 Free Software Foundation, Inc.
|
||||
;; Copyright (C) 2009-2022 Free Software Foundation, Inc.
|
||||
;; Author: Henning Redestig <henning.red * go0glemail c-m>
|
||||
|
||||
;; This file is part of GNU Emacs.
|
||||
@@ -143,16 +143,16 @@ Use you regular key for `outline-show-entry' to reveal it.")
|
||||
;; Autofill
|
||||
(setq-local paragraph-start (concat "\\(" ess-roxy-re "\\)*" paragraph-start))
|
||||
(setq-local paragraph-separate (concat "\\(" ess-roxy-re "\\)*" paragraph-separate))
|
||||
(setq-local adaptive-fill-function 'ess-roxy-adaptive-fill-function)
|
||||
(setq-local adaptive-fill-function #'ess-roxy-adaptive-fill-function)
|
||||
;; Hooks
|
||||
(add-hook 'ess-presend-filter-functions 'ess-roxy-remove-roxy-re nil t))
|
||||
(add-hook 'ess-presend-filter-functions #'ess-roxy-remove-roxy-re nil t))
|
||||
;; Turn off `ess-roxy-mode':
|
||||
;; Hideshow
|
||||
(when (and ess-roxy-hide-show-p hs-minor-mode)
|
||||
(hs-show-all)
|
||||
(hs-minor-mode))
|
||||
;; Hooks
|
||||
(remove-hook 'ess-presend-filter-functions 'ess-roxy-remove-roxy-re t)
|
||||
(remove-hook 'ess-presend-filter-functions #'ess-roxy-remove-roxy-re t)
|
||||
(font-lock-remove-keywords nil ess-roxy-font-lock-keywords)
|
||||
;; (setq-local syntax-propertize-function nil)
|
||||
;; (setq-local font-lock-fontify-region-function nil)
|
||||
@@ -200,17 +200,12 @@ Use you regular key for `outline-show-entry' to reveal it.")
|
||||
(when (ess-roxy-entry-p "examples")
|
||||
(ess-roxy-hide-example)))))
|
||||
|
||||
(when (featurep 'outline-magic)
|
||||
(substitute-key-definition 'outline-cyle
|
||||
'ess-roxy-cyle-example
|
||||
ess-roxy-mode-map outline-mode-menu-bar-map))
|
||||
|
||||
(substitute-key-definition 'outline-hide-entry
|
||||
'ess-roxy-hide-example
|
||||
(substitute-key-definition #'outline-hide-entry
|
||||
#'ess-roxy-hide-example
|
||||
ess-roxy-mode-map outline-minor-mode-map)
|
||||
|
||||
(substitute-key-definition 'outline-show-entry
|
||||
'ess-roxy-show-example
|
||||
(substitute-key-definition #'outline-show-entry
|
||||
#'ess-roxy-show-example
|
||||
ess-roxy-mode-map outline-minor-mode-map)
|
||||
|
||||
|
||||
@@ -219,7 +214,7 @@ Use you regular key for `outline-show-entry' to reveal it.")
|
||||
(defun ess-back-to-roxy ()
|
||||
"Go to roxy prefix."
|
||||
(end-of-line)
|
||||
(re-search-backward (concat ess-roxy-re " ?") (point-at-bol))
|
||||
(re-search-backward (concat ess-roxy-re " ?") (line-beginning-position))
|
||||
(goto-char (match-end 0)))
|
||||
|
||||
(defun ess-roxy-beg-of-entry ()
|
||||
@@ -702,7 +697,7 @@ block before the point."
|
||||
(save-excursion
|
||||
(if (ess-roxy-entry-p)
|
||||
(progn
|
||||
(goto-char (point-at-bol))
|
||||
(goto-char (line-beginning-position))
|
||||
(search-forward-regexp ess-roxy-re))
|
||||
(if not-here
|
||||
(search-backward-regexp ess-roxy-re)))
|
||||
@@ -725,7 +720,7 @@ block before the point."
|
||||
See `hs-show-block' and `ess-roxy-hide-block'."
|
||||
(interactive)
|
||||
(hs-life-goes-on
|
||||
(if (hs-overlay-at (point-at-eol))
|
||||
(if (hs-overlay-at (line-end-position))
|
||||
(hs-show-block)
|
||||
(ess-roxy-hide-block))))
|
||||
|
||||
@@ -805,7 +800,7 @@ Assumes point is at the beginning of the function."
|
||||
|
||||
(defun ess-roxy-tag-completion ()
|
||||
"Completion data for Emacs >= 24."
|
||||
(when (save-excursion (re-search-backward "@\\<\\(\\w*\\)" (point-at-bol) t))
|
||||
(when (save-excursion (re-search-backward "@\\<\\(\\w*\\)" (line-beginning-position) t))
|
||||
(let ((beg (match-beginning 1))
|
||||
(end (match-end 1)))
|
||||
(when (and end (= end (point)))
|
||||
@@ -965,7 +960,8 @@ If not in a roxygen entry, call `back-to-indentation'."
|
||||
(if (ess-roxy-entry-p)
|
||||
(progn
|
||||
(end-of-line)
|
||||
(re-search-backward (concat ess-roxy-re " *") (point-at-bol) t)
|
||||
(re-search-backward (concat ess-roxy-re " *")
|
||||
(line-beginning-position) t)
|
||||
(goto-char (match-end 0)))
|
||||
(back-to-indentation)))
|
||||
|
||||
@@ -974,7 +970,8 @@ If not in a roxygen entry, call `back-to-indentation'."
|
||||
(indent-new-comment-line)
|
||||
(ess-roxy-indent-on-newline)))
|
||||
|
||||
(define-obsolete-function-alias 'ess-roxy-newline-and-indent 'ess-roxy-newline "ESS 19.04")
|
||||
(define-obsolete-function-alias 'ess-roxy-newline-and-indent
|
||||
#'ess-roxy-newline "ESS 19.04")
|
||||
(defun ess-roxy-newline ()
|
||||
"Start a newline and insert the roxygen prefix.
|
||||
Only do this if in a roxygen block and
|
||||
@@ -1014,7 +1011,7 @@ Only do this if in a roxygen block and
|
||||
;; Return t to signal to go on to `c-fill-paragraph'.
|
||||
(t t)))
|
||||
|
||||
(advice-add 'c-fill-paragraph :before-while 'ess-roxy-cpp-fill-paragraph)
|
||||
(advice-add 'c-fill-paragraph :before-while #'ess-roxy-cpp-fill-paragraph)
|
||||
|
||||
(defun ess-roxy-enable-in-cpp ()
|
||||
"Enable `ess-roxy-mode' in C++ buffers in R packages."
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
;;; ess-s-lang.el --- Support for editing S source code -*- lexical-binding: t; -*-
|
||||
|
||||
;; Copyright (C) 1989-2020 Free Software Foundation, Inc.
|
||||
;; Copyright (C) 1989-2022 Free Software Foundation, Inc.
|
||||
;; Author: A.J. Rossini <rossini@biostat.washington.edu>
|
||||
;; Created: 26 Aug 1997
|
||||
;; Maintainer: ESS-core <ESS-core@r-project.org>
|
||||
@@ -431,7 +431,7 @@ If `ess-language' is not \"S\", call `self-insert-command' with ARG."
|
||||
(funcall #'self-insert-command arg)))
|
||||
|
||||
;; In case people had this in their config don't cause errors:
|
||||
(define-obsolete-function-alias 'ess-smart-S-assign 'ess-insert-assign "ESS 18.10")
|
||||
(define-obsolete-function-alias 'ess-smart-S-assign #'ess-insert-assign "ESS 18.10")
|
||||
(define-obsolete-function-alias 'ess-disable-smart-S-assign #'ignore "ESS 18.10")
|
||||
|
||||
(defun ess-add-MM-keys ()
|
||||
@@ -479,8 +479,6 @@ ARG is ignored."
|
||||
(declare (obsolete "It is set automatically in major modes" "ESS 19.04"))
|
||||
(imenu-add-to-menubar "Imenu-S"))
|
||||
|
||||
(define-obsolete-function-alias 'ess-imenu-R 'ess-imenu-S "ESS 19.04")
|
||||
|
||||
|
||||
;;; Speedbar stuff.
|
||||
|
||||
@@ -514,19 +512,9 @@ return it. Otherwise, return `ess-help-topics-list'."
|
||||
(ess-command ".ess.getHelpAliases(reset = TRUE)\n"
|
||||
nil nil nil nil nil nil ess-help--aliases-timeout))
|
||||
|
||||
(defalias 'S 'S+)
|
||||
(defalias 's-mode 'S+-mode)
|
||||
(defalias 's-transcript-mode 'S+-transcript-mode)
|
||||
(defalias 'S-transcript-mode 's-transcript-mode)
|
||||
(defalias 'S-mode 's-mode)
|
||||
|
||||
|
||||
(define-obsolete-function-alias 'ess-toggle-S-assign-key #'ignore "ESS 18.10")
|
||||
(define-obsolete-function-alias 'ess-smart-underscore 'ess-insert-assign "ESS 18.10")
|
||||
(define-obsolete-function-alias 'ess-insert-S-assign 'ess-insert-assign "ESS 18.10")
|
||||
|
||||
(define-obsolete-function-alias 'ess-toggle-underscore 'ess-disable-smart-S-assign "ESS 18.10")
|
||||
(define-obsolete-function-alias 'ess-toggle-S-assign 'ess-disable-smart-S-assign "ESS 18.10")
|
||||
(define-obsolete-function-alias 'ess-smart-underscore #'ess-insert-assign "ESS 18.10")
|
||||
(define-obsolete-function-alias 'ess-insert-S-assign #'ess-insert-assign "ESS 18.10")
|
||||
|
||||
;;;###autoload
|
||||
(add-to-list 'auto-mode-alist '("\\.[Ss]t\\'" . S-transcript-mode))
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
;;; ess-sas-a.el --- clean-room implementation of many SAS-mode features
|
||||
;;; ess-sas-a.el --- clean-room implementation of many SAS-mode features -*- lexical-binding: t; -*-
|
||||
|
||||
;; Copyright (C) 1997-2020 Free Software Foundation, Inc.
|
||||
;; Copyright (C) 1997-2022 Free Software Foundation, Inc.
|
||||
;; Author: Rodney A. Sparapani
|
||||
;; Maintainer: ESS-core@r-project.org
|
||||
;; Created: 17 November 1999
|
||||
@@ -95,28 +95,13 @@ or `ess-sas-data-view-insight'."
|
||||
(defcustom ess-sas-graph-view-viewer-alist
|
||||
;;creates something like
|
||||
;;'(("[pP][dD][fF]" . "/usr/local/bin/acroread") ("[eE]?[pP][sS]" . "/usr/local/bin/gv")))
|
||||
(let ((ess-tmp-alist nil)
|
||||
(ess-tmp-ps nil) (ess-tmp-pdf nil))
|
||||
|
||||
(let ((ess-tmp-ps nil) (ess-tmp-pdf nil))
|
||||
(setq ess-tmp-ps (executable-find (if ess-microsoft-p "gsview32" "gsview")))
|
||||
|
||||
(if (not ess-tmp-ps) (setq ess-tmp-ps (executable-find "gv")))
|
||||
|
||||
(if (not ess-tmp-ps) (setq ess-tmp-ps (executable-find "ghostview")))
|
||||
|
||||
(setq ess-tmp-pdf (executable-find "evince"))
|
||||
|
||||
(if (not ess-tmp-pdf) (setq ess-tmp-pdf (executable-find "xpdf")))
|
||||
|
||||
(if (not ess-tmp-pdf) (setq ess-tmp-pdf (if ess-microsoft-p "acrord32" "acroread")))
|
||||
|
||||
(if (and ess-tmp-ps ess-tmp-pdf)
|
||||
(setq ess-tmp-alist (list (cons "[eE]?[pP][sS]" ess-tmp-ps)
|
||||
(cons "[pP][dD][fF]" ess-tmp-pdf)))
|
||||
|
||||
(if ess-tmp-ps
|
||||
(setq ess-tmp-alist (list (cons "[eE]?[pP][sS]" ess-tmp-ps)
|
||||
(cons "[pP][dD][fF]" ess-tmp-ps))))))
|
||||
(if (not ess-tmp-pdf) (setq ess-tmp-pdf (if ess-microsoft-p "acrord32" "acroread"))))
|
||||
|
||||
"Associate file name extensions with graphics image file viewers."
|
||||
:group 'ess-sas
|
||||
@@ -471,7 +456,7 @@ Use the current buffer if nil."
|
||||
(ess-sas--change-alist 'ess-kermit-remote-directory ess-kermit-remote-directory nil))
|
||||
|
||||
(define-obsolete-function-alias
|
||||
'ess-change-alist 'ess-sas--change-alist "ESS 18.10")
|
||||
'ess-change-alist #'ess-sas--change-alist "ESS 18.10")
|
||||
|
||||
(defun ess-sas-data-view-fsview (&optional ess-sas-data)
|
||||
"Open a dataset for viewing with PROC FSVIEW."
|
||||
@@ -806,7 +791,7 @@ optional argument is non-nil, then set-buffer rather than switch."
|
||||
)
|
||||
|
||||
(if (eq ess-sas-submit-method 'sh)
|
||||
(add-hook 'comint-output-filter-functions 'ess-exit-notify-sh)) ;; 19.28
|
||||
(add-hook 'comint-output-filter-functions #'ess-exit-notify-sh)) ;; 19.28
|
||||
;; nil t) works for newer emacsen
|
||||
)
|
||||
)
|
||||
@@ -888,30 +873,25 @@ optional argument is non-nil, then set-buffer rather than switch."
|
||||
)
|
||||
|
||||
; else
|
||||
(defun ess-sas-rtf-portrait (&optional ess-tmp-font-size)
|
||||
(defun ess-sas-rtf-portrait (&optional _ess-tmp-font-size)
|
||||
"Creates an MS RTF portrait file from the current buffer."
|
||||
(interactive)
|
||||
; (ess-sas-file-path t)
|
||||
(ess-revert-wisely)
|
||||
|
||||
(set-visited-file-name (concat (buffer-name) ".rtf"))
|
||||
; (ess-sas-goto "rtf" t)
|
||||
(if 'buffer-read-only (setq buffer-read-only nil))
|
||||
(ess-rtf-replace-chars)
|
||||
|
||||
(goto-char (point-min))
|
||||
(insert (concat
|
||||
"{\\rtf1\\ansi{\\fonttbl\\f1\\fmodern " ess-sas-rtf-font-name ";}\n"
|
||||
"\\margl720\\margr720\\margt720\\margb720\n"
|
||||
"{\\colortbl;\\red0\\green0\\blue0;\\red0\\green0\\blue255;\\red0\\green255\\blue255;\\red0\\green255\\blue0;\\red255\\green0\\blue255;\\red255\\green0\\blue0;\\red255\\green255\\blue0;\\red255\\green255\\blue255;\\red0\\green0\\blue128;\\red0\\green128\\blue128;\\red0\\green128\\blue0;\\red128\\green0\\blue128;\\red128\\green0\\blue0;\\red128\\green128\\blue0;\\red128\\green128\\blue128;\\red192\\green192\\blue192;}\n"
|
||||
"{\\stylesheet{\\s15\\plain\\f1\\fs16\\cf1\\cb8\\lang1024 Emacs Text;}{\\*\\cs16 \\additive\\f1\\fs16\\cf1\\cb8\\lang1024 Emacs Base Style;}}\n"
|
||||
"{\\plain\\s15{\\cs16\\cs16\\f1\\fs16\\cf1\\cb8\\lang1024{\\cs16\\f1\\fs16\\cf1\\cb8\\lang1024\n"))
|
||||
|
||||
(goto-char (point-max))
|
||||
(insert "}}}}\n")
|
||||
|
||||
(save-buffer)
|
||||
(kill-buffer (current-buffer)))
|
||||
(when buffer-read-only
|
||||
(setq buffer-read-only nil))
|
||||
(ess-rtf-replace-chars)
|
||||
(goto-char (point-min))
|
||||
(insert (concat
|
||||
"{\\rtf1\\ansi{\\fonttbl\\f1\\fmodern " ess-sas-rtf-font-name ";}\n"
|
||||
"\\margl720\\margr720\\margt720\\margb720\n"
|
||||
"{\\colortbl;\\red0\\green0\\blue0;\\red0\\green0\\blue255;\\red0\\green255\\blue255;\\red0\\green255\\blue0;\\red255\\green0\\blue255;\\red255\\green0\\blue0;\\red255\\green255\\blue0;\\red255\\green255\\blue255;\\red0\\green0\\blue128;\\red0\\green128\\blue128;\\red0\\green128\\blue0;\\red128\\green0\\blue128;\\red128\\green0\\blue0;\\red128\\green128\\blue0;\\red128\\green128\\blue128;\\red192\\green192\\blue192;}\n"
|
||||
"{\\stylesheet{\\s15\\plain\\f1\\fs16\\cf1\\cb8\\lang1024 Emacs Text;}{\\*\\cs16 \\additive\\f1\\fs16\\cf1\\cb8\\lang1024 Emacs Base Style;}}\n"
|
||||
"{\\plain\\s15{\\cs16\\cs16\\f1\\fs16\\cf1\\cb8\\lang1024{\\cs16\\f1\\fs16\\cf1\\cb8\\lang1024\n"))
|
||||
(goto-char (point-max))
|
||||
(insert "}}}}\n")
|
||||
(save-buffer)
|
||||
(kill-buffer (current-buffer)))
|
||||
|
||||
(defun ess-rtf-replace-chars ()
|
||||
"Convert a text file to an MS RTF file."
|
||||
@@ -923,32 +903,28 @@ optional argument is non-nil, then set-buffer rather than switch."
|
||||
(goto-char (point-min))
|
||||
(while (re-search-forward "\t" nil t) (replace-match "\\tab" nil t)))
|
||||
|
||||
(defun ess-sas-rtf-landscape (&optional ess-tmp-font-size)
|
||||
(defun ess-sas-rtf-landscape (&optional _ess-tmp-font-size)
|
||||
"Creates an MS RTF landscape file from the current buffer."
|
||||
(interactive)
|
||||
(ess-revert-wisely)
|
||||
|
||||
(set-visited-file-name (concat (buffer-name) ".rtf"))
|
||||
|
||||
(if 'buffer-read-only (setq buffer-read-only nil))
|
||||
(ess-rtf-replace-chars)
|
||||
|
||||
(goto-char (point-min))
|
||||
(insert (concat
|
||||
"{\\rtf1\\ansi{\\fonttbl\\f1\\fmodern " ess-sas-rtf-font-name ";}\n"
|
||||
"\\margl720\\margr720\\margt720\\margb720\n"
|
||||
"{\\*\\pgdsctbl\n"
|
||||
"{\\pgdsc0\\pgdscuse195\\lndscpsxn\\pgwsxn15840\\pghsxn12240\\marglsxn1800\\margrsxn1800\\margtsxn1440\\margbsxn1440\\pgdscnxt0 Default;}}\n"
|
||||
"\\landscape\\paperh12240\\paperw15840\\margl1800\\margr1800\\margt1440\\margb1440\\sectd\\sbknone\\lndscpsxn\\pgwsxn15840\\pghsxn12240\\marglsxn1800\\margrsxn1800\\margtsxn1440\\margbsxn1440\\ftnbj\\ftnstart1\\ftnrstcont\\ftnnar\\aenddoc\\aftnrstcont\\aftnstart1\\aftnnrlc\n"
|
||||
"{\\colortbl;\\red0\\green0\\blue0;\\red0\\green0\\blue255;\\red0\\green255\\blue255;\\red0\\green255\\blue0;\\red255\\green0\\blue255;\\red255\\green0\\blue0;\\red255\\green255\\blue0;\\red255\\green255\\blue255;\\red0\\green0\\blue128;\\red0\\green128\\blue128;\\red0\\green128\\blue0;\\red128\\green0\\blue128;\\red128\\green0\\blue0;\\red128\\green128\\blue0;\\red128\\green128\\blue128;\\red192\\green192\\blue192;}\n"
|
||||
"{\\stylesheet{\\s15\\plain\\f1\\fs16\\cf1\\cb8\\lang1024 Emacs Text;}{\\*\\cs16 \\additive\\f1\\fs16\\cf1\\cb8\\lang1024 Emacs Base Style;}}\n"
|
||||
"{\\plain\\s15{\\cs16\\cs16\\f1\\fs16\\cf1\\cb8\\lang1024{\\cs16\\f1\\fs16\\cf1\\cb8\\lang1024\n"))
|
||||
|
||||
(goto-char (point-max))
|
||||
(insert "}}}}\n")
|
||||
|
||||
(save-buffer)
|
||||
(kill-buffer (current-buffer)))
|
||||
(when buffer-read-only
|
||||
(setq buffer-read-only nil))
|
||||
(ess-rtf-replace-chars)
|
||||
(goto-char (point-min))
|
||||
(insert (concat
|
||||
"{\\rtf1\\ansi{\\fonttbl\\f1\\fmodern " ess-sas-rtf-font-name ";}\n"
|
||||
"\\margl720\\margr720\\margt720\\margb720\n"
|
||||
"{\\*\\pgdsctbl\n"
|
||||
"{\\pgdsc0\\pgdscuse195\\lndscpsxn\\pgwsxn15840\\pghsxn12240\\marglsxn1800\\margrsxn1800\\margtsxn1440\\margbsxn1440\\pgdscnxt0 Default;}}\n"
|
||||
"\\landscape\\paperh12240\\paperw15840\\margl1800\\margr1800\\margt1440\\margb1440\\sectd\\sbknone\\lndscpsxn\\pgwsxn15840\\pghsxn12240\\marglsxn1800\\margrsxn1800\\margtsxn1440\\margbsxn1440\\ftnbj\\ftnstart1\\ftnrstcont\\ftnnar\\aenddoc\\aftnrstcont\\aftnstart1\\aftnnrlc\n"
|
||||
"{\\colortbl;\\red0\\green0\\blue0;\\red0\\green0\\blue255;\\red0\\green255\\blue255;\\red0\\green255\\blue0;\\red255\\green0\\blue255;\\red255\\green0\\blue0;\\red255\\green255\\blue0;\\red255\\green255\\blue255;\\red0\\green0\\blue128;\\red0\\green128\\blue128;\\red0\\green128\\blue0;\\red128\\green0\\blue128;\\red128\\green0\\blue0;\\red128\\green128\\blue0;\\red128\\green128\\blue128;\\red192\\green192\\blue192;}\n"
|
||||
"{\\stylesheet{\\s15\\plain\\f1\\fs16\\cf1\\cb8\\lang1024 Emacs Text;}{\\*\\cs16 \\additive\\f1\\fs16\\cf1\\cb8\\lang1024 Emacs Base Style;}}\n"
|
||||
"{\\plain\\s15{\\cs16\\cs16\\f1\\fs16\\cf1\\cb8\\lang1024{\\cs16\\f1\\fs16\\cf1\\cb8\\lang1024\n"))
|
||||
(goto-char (point-max))
|
||||
(insert "}}}}\n")
|
||||
(save-buffer)
|
||||
(kill-buffer (current-buffer)))
|
||||
|
||||
(defun ess-sas-rtf-us-landscape ()
|
||||
"Creates an MS RTF US landscape file from the current buffer."
|
||||
@@ -1146,10 +1122,11 @@ Keep in mind that the maximum command line length in MS-DOS is
|
||||
"Each place is given by: (Number of times) at (Line):(Column).\\|"
|
||||
"[0-9][0-9]:[0-9][0-9] [MTWFS][aeioudhnrst]+day, [JFMASOND]"
|
||||
"[aeiouybcghlmnprstv]+ [1-9][0-9]?, 20[0-9][0-9]\\)\\)")
|
||||
nil t) (replace-match (if strip " " "/*\\&*/") t))
|
||||
nil t)
|
||||
(replace-match (if strip " " "/*\\&*/") t))
|
||||
))
|
||||
|
||||
(defun ess-sas-toggle-sas-listing-mode (&optional force)
|
||||
(defun ess-sas-toggle-sas-listing-mode (&optional _force)
|
||||
"Toggle SAS-listing-mode for .lst files."
|
||||
(interactive)
|
||||
(ess-sas-goto-lst)
|
||||
@@ -1209,7 +1186,7 @@ be placed on the menubar upon ESS initialization."
|
||||
(setq ess-sas-created-runners
|
||||
(mapc (lambda (v) (ess-define-runner v "SAS")) versions))))
|
||||
(define-obsolete-function-alias
|
||||
'ess-sas-create-versions 'ess-sas-define-runners "ESS 18.10")
|
||||
'ess-sas-create-versions #'ess-sas-define-runners "ESS 18.10")
|
||||
|
||||
|
||||
;;; Section 3: Key Definitions
|
||||
@@ -1237,7 +1214,7 @@ nil binds TAB to `sas-indent-line' and RET to `newline-and-indent'.
|
||||
Non-nil binds TAB to `ess-sas-tab-to-tab-stop',
|
||||
C-TAB to `ess-sas-backward-delete-tab', and RET to `newline'.")
|
||||
|
||||
(defun ess-sas-edit-keys-toggle (&optional arg)
|
||||
(defun ess-sas-edit-keys-toggle (&optional _arg)
|
||||
"Toggle `ess-sas-edit-keys-toggle'. Optional arg is still
|
||||
accepted for backward compatibility, however, arg is ignored."
|
||||
(interactive)
|
||||
@@ -1252,27 +1229,27 @@ accepted for backward compatibility, however, arg is ignored."
|
||||
(defun ess-sas-global-pc-keys ()
|
||||
"PC-like SAS key definitions"
|
||||
(interactive)
|
||||
(global-set-key [(control f1)] 'ess-sas-rtf-portrait)
|
||||
(global-set-key [(control f2)] 'ess-sas-rtf-landscape)
|
||||
(global-set-key (quote [f2]) 'ess-revert-wisely)
|
||||
(global-set-key (quote [f3]) 'ess-sas-goto-shell)
|
||||
(global-set-key (quote [f4]) 'ess-sas-goto-file-1)
|
||||
(global-set-key (quote [f5]) 'ess-sas-goto-sas)
|
||||
(global-set-key (quote [f6]) 'ess-sas-goto-log)
|
||||
(global-set-key [(control f6)] 'ess-sas-append-log)
|
||||
(global-set-key (quote [f7]) 'ess-sas-goto-lst)
|
||||
(global-set-key [(control f7)] 'ess-sas-append-lst)
|
||||
(global-set-key (quote [f8]) 'ess-sas-submit)
|
||||
(global-set-key [(control f8)] 'ess-sas-submit-region)
|
||||
(global-set-key (quote [f9]) 'ess-sas-data-view-fsview)
|
||||
(global-set-key [(control f9)] 'ess-sas-data-view-insight)
|
||||
;; (global-set-key (quote [f10]) 'ess-sas-toggle-sas-log-mode)
|
||||
;; (global-set-key [(control f10)] 'ess-sas-toggle-sas-listing-mode)
|
||||
;; (global-set-key (quote [f11]) 'ess-sas-goto-file-2)
|
||||
;; (global-set-key [(control f11)] 'ess-ebcdic-to-ascii-search-and-replace)
|
||||
(global-set-key (quote [f12]) 'ess-sas-graph-view)
|
||||
(global-set-key [(control tab)] 'ess-sas-backward-delete-tab)
|
||||
;; (define-key sas-mode-local-map "\C-c\C-p" 'ess-sas-file-path)
|
||||
(global-set-key [(control f1)] #'ess-sas-rtf-portrait)
|
||||
(global-set-key [(control f2)] #'ess-sas-rtf-landscape)
|
||||
(global-set-key (quote [f2]) #'ess-revert-wisely)
|
||||
(global-set-key (quote [f3]) #'ess-sas-goto-shell)
|
||||
(global-set-key (quote [f4]) #'ess-sas-goto-file-1)
|
||||
(global-set-key (quote [f5]) #'ess-sas-goto-sas)
|
||||
(global-set-key (quote [f6]) #'ess-sas-goto-log)
|
||||
(global-set-key [(control f6)] #'ess-sas-append-log)
|
||||
(global-set-key (quote [f7]) #'ess-sas-goto-lst)
|
||||
(global-set-key [(control f7)] #'ess-sas-append-lst)
|
||||
(global-set-key (quote [f8]) #'ess-sas-submit)
|
||||
(global-set-key [(control f8)] #'ess-sas-submit-region)
|
||||
(global-set-key (quote [f9]) #'ess-sas-data-view-fsview)
|
||||
(global-set-key [(control f9)] #'ess-sas-data-view-insight)
|
||||
;; (global-set-key (quote [f10]) #'ess-sas-toggle-sas-log-mode)
|
||||
;; (global-set-key [(control f10)] #'ess-sas-toggle-sas-listing-mode)
|
||||
;; (global-set-key (quote [f11]) #'ess-sas-goto-file-2)
|
||||
;; (global-set-key [(control f11)] #'ess-ebcdic-to-ascii-search-and-replace)
|
||||
(global-set-key (quote [f12]) #'ess-sas-graph-view)
|
||||
(global-set-key [(control tab)] #'ess-sas-backward-delete-tab)
|
||||
;; (define-key sas-mode-local-map "\C-c\C-p" #'ess-sas-file-path)
|
||||
(setq ess-sas-global-pc-keys t)
|
||||
(setq ess-sas-global-unix-keys nil)
|
||||
(setq ess-sas-local-pc-keys nil)
|
||||
@@ -1282,27 +1259,27 @@ accepted for backward compatibility, however, arg is ignored."
|
||||
(defun ess-sas-global-unix-keys ()
|
||||
"Unix/Mainframe-like SAS key definitions"
|
||||
(interactive)
|
||||
(global-set-key [(control f1)] 'ess-sas-rtf-portrait)
|
||||
(global-set-key [(control f2)] 'ess-sas-rtf-landscape)
|
||||
(global-set-key (quote [f2]) 'ess-revert-wisely)
|
||||
(global-set-key (quote [f3]) 'ess-sas-submit)
|
||||
(global-set-key [(control f3)] 'ess-sas-submit-region)
|
||||
(global-set-key (quote [f4]) 'ess-sas-goto-sas)
|
||||
(global-set-key (quote [f5]) 'ess-sas-goto-log)
|
||||
(global-set-key [(control f5)] 'ess-sas-append-log)
|
||||
(global-set-key (quote [f6]) 'ess-sas-goto-lst)
|
||||
(global-set-key [(control f6)] 'ess-sas-append-lst)
|
||||
(global-set-key (quote [f7]) 'ess-sas-goto-file-1)
|
||||
(global-set-key (quote [f8]) 'ess-sas-goto-shell)
|
||||
(global-set-key (quote [f9]) 'ess-sas-data-view-fsview)
|
||||
(global-set-key [(control f9)] 'ess-sas-data-view-insight)
|
||||
;; (global-set-key (quote [f10]) 'ess-sas-toggle-sas-log-mode)
|
||||
;; (global-set-key [(control f10)] 'ess-sas-toggle-sas-listing-mode)
|
||||
;; (global-set-key (quote [f11]) 'ess-sas-goto-file-2)
|
||||
;; (global-set-key [(control f11)] 'ess-ebcdic-to-ascii-search-and-replace)
|
||||
(global-set-key (quote [f12]) 'ess-sas-graph-view)
|
||||
(global-set-key [(control tab)] 'ess-sas-backward-delete-tab)
|
||||
;;(define-key sas-mode-local-map "\C-c\C-p" 'ess-sas-file-path)
|
||||
(global-set-key [(control f1)] #'ess-sas-rtf-portrait)
|
||||
(global-set-key [(control f2)] #'ess-sas-rtf-landscape)
|
||||
(global-set-key (quote [f2]) #'ess-revert-wisely)
|
||||
(global-set-key (quote [f3]) #'ess-sas-submit)
|
||||
(global-set-key [(control f3)] #'ess-sas-submit-region)
|
||||
(global-set-key (quote [f4]) #'ess-sas-goto-sas)
|
||||
(global-set-key (quote [f5]) #'ess-sas-goto-log)
|
||||
(global-set-key [(control f5)] #'ess-sas-append-log)
|
||||
(global-set-key (quote [f6]) #'ess-sas-goto-lst)
|
||||
(global-set-key [(control f6)] #'ess-sas-append-lst)
|
||||
(global-set-key (quote [f7]) #'ess-sas-goto-file-1)
|
||||
(global-set-key (quote [f8]) #'ess-sas-goto-shell)
|
||||
(global-set-key (quote [f9]) #'ess-sas-data-view-fsview)
|
||||
(global-set-key [(control f9)] #'ess-sas-data-view-insight)
|
||||
;; (global-set-key (quote [f10]) #'ess-sas-toggle-sas-log-mode)
|
||||
;; (global-set-key [(control f10)] #'ess-sas-toggle-sas-listing-mode)
|
||||
;; (global-set-key (quote [f11]) #'ess-sas-goto-file-2)
|
||||
;; (global-set-key [(control f11)] #'ess-ebcdic-to-ascii-search-and-replace)
|
||||
(global-set-key (quote [f12]) #'ess-sas-graph-view)
|
||||
(global-set-key [(control tab)] #'ess-sas-backward-delete-tab)
|
||||
;;(define-key sas-mode-local-map "\C-c\C-p" #'ess-sas-file-path)
|
||||
(setq ess-sas-global-pc-keys nil)
|
||||
(setq ess-sas-global-unix-keys t)
|
||||
(setq ess-sas-local-pc-keys nil)
|
||||
@@ -1312,26 +1289,26 @@ accepted for backward compatibility, however, arg is ignored."
|
||||
(defun ess-sas-local-pc-keys ()
|
||||
"PC-like SAS key definitions."
|
||||
(interactive)
|
||||
(define-key sas-mode-local-map [(control f1)] 'ess-sas-rtf-portrait)
|
||||
(define-key sas-mode-local-map [(control f2)] 'ess-sas-rtf-landscape)
|
||||
(define-key sas-mode-local-map (quote [f2]) 'ess-revert-wisely)
|
||||
(define-key sas-mode-local-map (quote [f3]) 'ess-sas-goto-shell)
|
||||
(define-key sas-mode-local-map (quote [f4]) 'ess-sas-goto-file-1)
|
||||
(define-key sas-mode-local-map (quote [f5]) 'ess-sas-goto-sas)
|
||||
(define-key sas-mode-local-map (quote [f6]) 'ess-sas-goto-log)
|
||||
(define-key sas-mode-local-map [(control f6)] 'ess-sas-append-log)
|
||||
(define-key sas-mode-local-map (quote [f7]) 'ess-sas-goto-lst)
|
||||
(define-key sas-mode-local-map [(control f7)] 'ess-sas-append-lst)
|
||||
(define-key sas-mode-local-map (quote [f8]) 'ess-sas-submit)
|
||||
(define-key sas-mode-local-map [(control f8)] 'ess-sas-submit-region)
|
||||
(define-key sas-mode-local-map (quote [f9]) 'ess-sas-data-view-fsview)
|
||||
(define-key sas-mode-local-map [(control f9)] 'ess-sas-data-view-insight)
|
||||
(define-key sas-mode-local-map (quote [f10]) 'ess-sas-toggle-sas-log-mode)
|
||||
(define-key sas-mode-local-map [(control f10)] 'ess-sas-toggle-sas-listing-mode)
|
||||
(define-key sas-mode-local-map (quote [f11]) 'ess-sas-goto-file-2)
|
||||
(define-key sas-mode-local-map [(control f11)] 'ess-ebcdic-to-ascii-search-and-replace)
|
||||
(define-key sas-mode-local-map (quote [f12]) 'ess-sas-graph-view)
|
||||
;(define-key sas-mode-local-map "\C-c\C-p" 'ess-sas-file-path)
|
||||
(define-key sas-mode-local-map [(control f1)] #'ess-sas-rtf-portrait)
|
||||
(define-key sas-mode-local-map [(control f2)] #'ess-sas-rtf-landscape)
|
||||
(define-key sas-mode-local-map (quote [f2]) #'ess-revert-wisely)
|
||||
(define-key sas-mode-local-map (quote [f3]) #'ess-sas-goto-shell)
|
||||
(define-key sas-mode-local-map (quote [f4]) #'ess-sas-goto-file-1)
|
||||
(define-key sas-mode-local-map (quote [f5]) #'ess-sas-goto-sas)
|
||||
(define-key sas-mode-local-map (quote [f6]) #'ess-sas-goto-log)
|
||||
(define-key sas-mode-local-map [(control f6)] #'ess-sas-append-log)
|
||||
(define-key sas-mode-local-map (quote [f7]) #'ess-sas-goto-lst)
|
||||
(define-key sas-mode-local-map [(control f7)] #'ess-sas-append-lst)
|
||||
(define-key sas-mode-local-map (quote [f8]) #'ess-sas-submit)
|
||||
(define-key sas-mode-local-map [(control f8)] #'ess-sas-submit-region)
|
||||
(define-key sas-mode-local-map (quote [f9]) #'ess-sas-data-view-fsview)
|
||||
(define-key sas-mode-local-map [(control f9)] #'ess-sas-data-view-insight)
|
||||
(define-key sas-mode-local-map (quote [f10]) #'ess-sas-toggle-sas-log-mode)
|
||||
(define-key sas-mode-local-map [(control f10)] #'ess-sas-toggle-sas-listing-mode)
|
||||
(define-key sas-mode-local-map (quote [f11]) #'ess-sas-goto-file-2)
|
||||
(define-key sas-mode-local-map [(control f11)] #'ess-ebcdic-to-ascii-search-and-replace)
|
||||
(define-key sas-mode-local-map (quote [f12]) #'ess-sas-graph-view)
|
||||
;(define-key sas-mode-local-map "\C-c\C-p" #'ess-sas-file-path)
|
||||
(setq ess-sas-global-pc-keys nil)
|
||||
(setq ess-sas-global-unix-keys nil)
|
||||
(setq ess-sas-local-pc-keys t)
|
||||
@@ -1341,26 +1318,26 @@ accepted for backward compatibility, however, arg is ignored."
|
||||
(defun ess-sas-local-unix-keys ()
|
||||
"Unix/Mainframe-like SAS key definitions"
|
||||
(interactive)
|
||||
(define-key sas-mode-local-map [(control f1)] 'ess-sas-rtf-portrait)
|
||||
(define-key sas-mode-local-map [(control f2)] 'ess-sas-rtf-landscape)
|
||||
(define-key sas-mode-local-map (quote [f2]) 'ess-revert-wisely)
|
||||
(define-key sas-mode-local-map (quote [f3]) 'ess-sas-submit)
|
||||
(define-key sas-mode-local-map [(control f3)] 'ess-sas-submit-region)
|
||||
(define-key sas-mode-local-map (quote [f4]) 'ess-sas-goto-sas)
|
||||
(define-key sas-mode-local-map (quote [f5]) 'ess-sas-goto-log)
|
||||
(define-key sas-mode-local-map [(control f5)] 'ess-sas-append-log)
|
||||
(define-key sas-mode-local-map (quote [f6]) 'ess-sas-goto-lst)
|
||||
(define-key sas-mode-local-map [(control f6)] 'ess-sas-append-lst)
|
||||
(define-key sas-mode-local-map (quote [f7]) 'ess-sas-goto-file-1)
|
||||
(define-key sas-mode-local-map (quote [f8]) 'ess-sas-goto-shell)
|
||||
(define-key sas-mode-local-map (quote [f9]) 'ess-sas-data-view-fsview)
|
||||
(define-key sas-mode-local-map [(control f9)] 'ess-sas-data-view-insight)
|
||||
(define-key sas-mode-local-map (quote [f10]) 'ess-sas-toggle-sas-log-mode)
|
||||
(define-key sas-mode-local-map [(control f10)] 'ess-sas-toggle-sas-listing-mode)
|
||||
(define-key sas-mode-local-map (quote [f11]) 'ess-sas-goto-file-2)
|
||||
(define-key sas-mode-local-map [(control f11)] 'ess-ebcdic-to-ascii-search-and-replace)
|
||||
(define-key sas-mode-local-map (quote [f12]) 'ess-sas-graph-view)
|
||||
;(define-key sas-mode-local-map "\C-c\C-p" 'ess-sas-file-path)
|
||||
(define-key sas-mode-local-map [(control f1)] #'ess-sas-rtf-portrait)
|
||||
(define-key sas-mode-local-map [(control f2)] #'ess-sas-rtf-landscape)
|
||||
(define-key sas-mode-local-map (quote [f2]) #'ess-revert-wisely)
|
||||
(define-key sas-mode-local-map (quote [f3]) #'ess-sas-submit)
|
||||
(define-key sas-mode-local-map [(control f3)] #'ess-sas-submit-region)
|
||||
(define-key sas-mode-local-map (quote [f4]) #'ess-sas-goto-sas)
|
||||
(define-key sas-mode-local-map (quote [f5]) #'ess-sas-goto-log)
|
||||
(define-key sas-mode-local-map [(control f5)] #'ess-sas-append-log)
|
||||
(define-key sas-mode-local-map (quote [f6]) #'ess-sas-goto-lst)
|
||||
(define-key sas-mode-local-map [(control f6)] #'ess-sas-append-lst)
|
||||
(define-key sas-mode-local-map (quote [f7]) #'ess-sas-goto-file-1)
|
||||
(define-key sas-mode-local-map (quote [f8]) #'ess-sas-goto-shell)
|
||||
(define-key sas-mode-local-map (quote [f9]) #'ess-sas-data-view-fsview)
|
||||
(define-key sas-mode-local-map [(control f9)] #'ess-sas-data-view-insight)
|
||||
(define-key sas-mode-local-map (quote [f10]) #'ess-sas-toggle-sas-log-mode)
|
||||
(define-key sas-mode-local-map [(control f10)] #'ess-sas-toggle-sas-listing-mode)
|
||||
(define-key sas-mode-local-map (quote [f11]) #'ess-sas-goto-file-2)
|
||||
(define-key sas-mode-local-map [(control f11)] #'ess-ebcdic-to-ascii-search-and-replace)
|
||||
(define-key sas-mode-local-map (quote [f12]) #'ess-sas-graph-view)
|
||||
;;(define-key sas-mode-local-map "\C-c\C-p" #'ess-sas-file-path)
|
||||
(setq ess-sas-global-pc-keys nil)
|
||||
(setq ess-sas-global-unix-keys nil)
|
||||
(setq ess-sas-local-pc-keys nil)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
;;; ess-sas-d.el --- SAS customization
|
||||
;;; ess-sas-d.el --- SAS customization -*- lexical-binding: t; -*-
|
||||
|
||||
;; Copyright (C) 1997-2020 Free Software Foundation, Inc.
|
||||
;; Copyright (C) 1997-2022 Free Software Foundation, Inc.
|
||||
;; Author: Richard M. Heiberger <rmh@temple.edu>
|
||||
;; Created: 20 Aug 1997
|
||||
;; Maintainer: ESS-core <ESS-core@r-project.org>
|
||||
@@ -225,8 +225,8 @@ Better logic needed! (see 2 uses, in this file).")
|
||||
(if ess-sas-local-pc-keys (ess-sas-local-pc-keys))
|
||||
(if ess-sas-global-unix-keys (ess-sas-global-unix-keys))
|
||||
(if ess-sas-global-pc-keys (ess-sas-global-pc-keys)))
|
||||
(define-key sas-mode-local-map ";" 'ess-electric-run-semicolon)
|
||||
(define-key sas-mode-local-map (kbd "\C-c\C-w") 'ess-multi-frame-SAS)
|
||||
(define-key sas-mode-local-map ";" #'ess-electric-run-semicolon)
|
||||
(define-key sas-mode-local-map (kbd "\C-c\C-w") #'ess-multi-frame-SAS)
|
||||
;; this is a mess
|
||||
;; interactive and batch commands share sas-mode-local-map,
|
||||
;; but the associated commands are very different
|
||||
@@ -260,27 +260,23 @@ Better logic needed! (see 2 uses, in this file).")
|
||||
If the line contains \"run;\" or \"quit;\" and nothing else then
|
||||
indent line."
|
||||
(interactive "P")
|
||||
(if ess-sas-edit-keys-toggle (insert ";") (let (insertpos)
|
||||
(if (and (not arg)
|
||||
(eolp)
|
||||
(save-excursion
|
||||
(skip-chars-backward " \t")
|
||||
(backward-word 1)
|
||||
(and (looking-at "run\\|quit")
|
||||
(progn
|
||||
(skip-chars-backward " \t")
|
||||
(bolp)))))
|
||||
(progn
|
||||
(insert last-command-event)
|
||||
(funcall indent-line-function)
|
||||
(save-excursion
|
||||
(if insertpos (goto-char (1+ insertpos)))
|
||||
(delete-char -1))))
|
||||
(if insertpos
|
||||
(save-excursion
|
||||
(goto-char insertpos)
|
||||
(self-insert-command (prefix-numeric-value arg)))
|
||||
(self-insert-command (prefix-numeric-value arg))))))
|
||||
(if ess-sas-edit-keys-toggle
|
||||
(insert ";")
|
||||
(if (and (not arg)
|
||||
(eolp)
|
||||
(save-excursion
|
||||
(skip-chars-backward " \t")
|
||||
(backward-word 1)
|
||||
(and (looking-at "run\\|quit")
|
||||
(progn
|
||||
(skip-chars-backward " \t")
|
||||
(bolp)))))
|
||||
(progn
|
||||
(insert last-command-event)
|
||||
(funcall indent-line-function)
|
||||
(save-excursion
|
||||
(delete-char -1))))
|
||||
(self-insert-command (prefix-numeric-value arg))))
|
||||
|
||||
(defun SAS-menu ()
|
||||
"Start SAS from the menu."
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
;;; ess-sas-l.el --- SAS customization
|
||||
;;; ess-sas-l.el --- SAS customization -*- lexical-binding: t; -*-
|
||||
|
||||
;; Copyright (C) 1997-2020 Free Software Foundation, Inc.
|
||||
;; Copyright (C) 1997-2022 Free Software Foundation, Inc.
|
||||
;; Authors: Richard M. Heiberger
|
||||
;; A.J. Rossini
|
||||
;; Rodney Sparapani
|
||||
@@ -148,11 +148,11 @@ A .lst file is a SAS listing file when:
|
||||
(ess-listing-minor-mode 1)
|
||||
(buffer-disable-undo))
|
||||
|
||||
(fset 'sas-log-mode 'SAS-log-mode)
|
||||
(fset 'SAS-transcript-mode 'SAS-log-mode)
|
||||
(fset 'sas-transcript-mode 'SAS-log-mode)
|
||||
(fset 'sas-mode 'SAS-mode)
|
||||
(fset 'sas-listing-mode 'SAS-listing-mode)
|
||||
(defalias 'sas-log-mode #'SAS-log-mode)
|
||||
(defalias 'SAS-transcript-mode #'SAS-log-mode)
|
||||
(defalias 'sas-transcript-mode #'SAS-log-mode)
|
||||
(defalias 'sas-mode #'SAS-mode)
|
||||
(defalias 'sas-listing-mode #'SAS-listing-mode)
|
||||
|
||||
(defcustom sas-indent-width 4
|
||||
"Amount to indent sas statements."
|
||||
@@ -779,7 +779,7 @@ number."
|
||||
))
|
||||
"Font Lock regexs for SAS.")
|
||||
|
||||
(defun beginning-of-sas-statement (arg &optional comment-start)
|
||||
(defun beginning-of-sas-statement (arg &optional comstart)
|
||||
"Move point to beginning of current sas statement."
|
||||
(interactive "P")
|
||||
(let ((pos (point))
|
||||
@@ -787,7 +787,7 @@ number."
|
||||
(if (search-forward ";" nil 1) (forward-char -1))
|
||||
(re-search-backward ";[ \n*/]*$" (point-min) 1 arg)
|
||||
(skip-chars-forward sas-comment-chars)
|
||||
(if comment-start nil
|
||||
(if comstart nil
|
||||
(if (looking-at "\\*/")
|
||||
(progn (forward-char 2)
|
||||
(skip-chars-forward sas-comment-chars)))
|
||||
@@ -1305,7 +1305,7 @@ be submitted instead. `sas-submitable' is automatically sets to t."
|
||||
(message "---- SAS job submitted ---- ")
|
||||
|
||||
(if sas-notify;; added 4/7/94
|
||||
(set-process-sentinel (get-process proc-name) 'sas-sentinel)
|
||||
(set-process-sentinel (get-process proc-name) #'sas-sentinel)
|
||||
(display-buffer buf t))))
|
||||
(message "---- File not submitted ----")))
|
||||
|
||||
@@ -1490,30 +1490,26 @@ page ;
|
||||
|
||||
(if sas-dir-mode-map ()
|
||||
(setq sas-dir-mode-map (make-sparse-keymap))
|
||||
;;(define-key sas-dir-mode-map "c" 'sas-contents)
|
||||
(define-key sas-dir-mode-map "p" 'sas-print)
|
||||
(define-key sas-dir-mode-map "m" 'sas-mark-item)
|
||||
(define-key sas-dir-mode-map "u" 'sas-unmark-item)
|
||||
(define-key sas-dir-mode-map " " 'sas-next-line)
|
||||
(define-key sas-dir-mode-map "\C-n" 'sas-next-line)
|
||||
(define-key sas-dir-mode-map "\C-p" 'sas-prev-line)
|
||||
(define-key sas-dir-mode-map "\177" 'sas-prev-line-undo)
|
||||
(define-key sas-dir-mode-map "\C-b" 'sas-backward-page-narrow)
|
||||
(define-key sas-dir-mode-map "\C-v" 'sas-forward-page-narrow)
|
||||
(define-key sas-dir-mode-map "\C-m" 'sas-goto-dataset)
|
||||
(define-key sas-dir-mode-map [mouse-2] 'sas-mouse-goto-dataset)
|
||||
(define-key sas-dir-mode-map "t" 'sas-dir-goto-page)
|
||||
(define-key sas-dir-mode-map "q" 'bury-buffer)
|
||||
(define-key sas-dir-mode-map "g" 'sas-revert-library)
|
||||
(define-key sas-dir-mode-map "1" 'digit-argument)
|
||||
(define-key sas-dir-mode-map "2" 'digit-argument)
|
||||
(define-key sas-dir-mode-map "3" 'digit-argument)
|
||||
(define-key sas-dir-mode-map "4" 'digit-argument)
|
||||
(define-key sas-dir-mode-map "5" 'digit-argument)
|
||||
(define-key sas-dir-mode-map "6" 'digit-argument)
|
||||
(define-key sas-dir-mode-map "7" 'digit-argument)
|
||||
(define-key sas-dir-mode-map "8" 'digit-argument)
|
||||
(define-key sas-dir-mode-map "9" 'digit-argument)
|
||||
(define-key sas-dir-mode-map "m" #'sas-mark-item)
|
||||
(define-key sas-dir-mode-map "u" #'sas-unmark-item)
|
||||
(define-key sas-dir-mode-map " " #'sas-next-line)
|
||||
(define-key sas-dir-mode-map "\C-n" #'sas-next-line)
|
||||
(define-key sas-dir-mode-map "\C-p" #'sas-prev-line)
|
||||
(define-key sas-dir-mode-map "\177" #'sas-prev-line-undo)
|
||||
(define-key sas-dir-mode-map "\C-b" #'sas-backward-page-narrow)
|
||||
(define-key sas-dir-mode-map "\C-v" #'sas-forward-page-narrow)
|
||||
(define-key sas-dir-mode-map "\C-m" #'sas-goto-dataset)
|
||||
(define-key sas-dir-mode-map "t" #'sas-dir-goto-page)
|
||||
(define-key sas-dir-mode-map "q" #'bury-buffer)
|
||||
(define-key sas-dir-mode-map "1" #'digit-argument)
|
||||
(define-key sas-dir-mode-map "2" #'digit-argument)
|
||||
(define-key sas-dir-mode-map "3" #'digit-argument)
|
||||
(define-key sas-dir-mode-map "4" #'digit-argument)
|
||||
(define-key sas-dir-mode-map "5" #'digit-argument)
|
||||
(define-key sas-dir-mode-map "6" #'digit-argument)
|
||||
(define-key sas-dir-mode-map "7" #'digit-argument)
|
||||
(define-key sas-dir-mode-map "8" #'digit-argument)
|
||||
(define-key sas-dir-mode-map "9" #'digit-argument)
|
||||
(define-key sas-dir-mode-map [menu-bar sas run]
|
||||
'("Submit File " . submit-sas))
|
||||
)
|
||||
@@ -1602,9 +1598,9 @@ page ;
|
||||
;;(forward-line arg)
|
||||
;;(sas-move-to-filename sas-dir-buf-end)))
|
||||
|
||||
(defun sas-prev-line (arg)
|
||||
(defun sas-prev-line (&optional _arg)
|
||||
"Move up one line."
|
||||
(interactive "p")
|
||||
(interactive)
|
||||
(beginning-of-line)
|
||||
(re-search-backward "^ *[0-9]+ *<*[^:0-9\n]" (point-min) t)
|
||||
(sas-move-to-filename sas-dir-buf-end))
|
||||
@@ -1645,20 +1641,6 @@ page ;
|
||||
(buffer-substring (match-beginning 0)
|
||||
(match-end 0))))))
|
||||
|
||||
;;(defun sas-contents ()
|
||||
;; "Run proc contents on current file."
|
||||
;; (interactive)
|
||||
;; (let ((buffer-read-only nil) (sas-get-options "linesize=70"))
|
||||
;; (sas-get-dataset (sas-get-filename) 2 t t (buffer-name))
|
||||
;; (end-of-buffer)
|
||||
;; (backward-page-top-of-window 1)))
|
||||
;;
|
||||
;;(defun sas-print ()
|
||||
;; "Run proc contents on current file."
|
||||
;; (interactive)
|
||||
;; (sas-get-dataset (sas-get-filename) 1 nil nil nil
|
||||
;; (sas-create-var-string)))
|
||||
|
||||
(defun sas-goto-page (arg)
|
||||
"Goto top of page ARG. If no ARG, then goto top of file."
|
||||
(interactive "P")
|
||||
@@ -1736,21 +1718,6 @@ whose beginning matches the regexp `page-delimiter'."
|
||||
(sas-narrow-to-page)
|
||||
(goto-char (point-min)))))))
|
||||
|
||||
;;(defun sas-mouse-goto-dataset (event)
|
||||
;; (interactive "e")
|
||||
;; (let (page buf)
|
||||
;; (save-window-excursion
|
||||
;; (save-excursion
|
||||
;; (set-buffer (window-buffer (posn-window (event-end event))))
|
||||
;; (save-excursion
|
||||
;; (goto-char (posn-point (event-end event)))
|
||||
;; (setq page (sas-get-file-number)))
|
||||
;; (sas-goto-dataset page)
|
||||
;; (setq buf (buffer-name))))
|
||||
;; (set-buffer buf)
|
||||
;; (goto-char (point-min))
|
||||
;; (display-buffer buf)))
|
||||
|
||||
|
||||
(defun sas-dir-goto-page (page)
|
||||
(interactive "p")
|
||||
@@ -1795,19 +1762,13 @@ whose beginning matches the regexp `page-delimiter'."
|
||||
str)))
|
||||
|
||||
|
||||
(defun ess-imenu-SAS (&optional arg)
|
||||
(defun ess-imenu-SAS (&optional _arg)
|
||||
"SAS language Imenu support for ESS."
|
||||
(interactive)
|
||||
(setq imenu-generic-expression
|
||||
'( (nil "[ \t\n=]\\([a-zA-Z_][a-zA-Z_0-9]*[.][a-zA-Z_][a-zA-Z_0-9]*\\)[ ,()\t\n;]" 1)))
|
||||
'( (nil "[ \t\n=]\\([[:alpha:]_][[:alnum:]_]*[.][[:alpha:]_][[:alnum:]_]*\\)[ ,()\t\n;]" 1)))
|
||||
(imenu-add-to-menubar "SAS Datasets"))
|
||||
|
||||
;;(defun sas-revert-library ()
|
||||
;; "Update current library."
|
||||
;; (interactive)
|
||||
;; (if sas-directory-name
|
||||
;; (sas-make-library sas-directory-name t)))
|
||||
|
||||
(provide 'ess-sas-l)
|
||||
|
||||
;;; ess-sas-l.el ends here
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
;;; ess-sp6-d.el --- S-Plus 6 & 7 & 8 customization
|
||||
;;; ess-sp6-d.el --- S-Plus 6 & 7 & 8 customization -*- lexical-binding: t; -*-
|
||||
|
||||
;; Copyright (C) 2001-2020 Free Software Foundation, Inc.
|
||||
;; Copyright (C) 2001-2022 Free Software Foundation, Inc.
|
||||
;; Author: A.J. Rossini <rossini@u.washington.edu>
|
||||
;; Created: 2001/02/06
|
||||
;; Maintainer: ESS Core Team <ESS-core@r-project.org>
|
||||
@@ -104,9 +104,9 @@
|
||||
}
|
||||
")
|
||||
|
||||
(defalias 'S+6 'S+)
|
||||
(defun S+ (&optional proc-name)
|
||||
"Call 'Splus6', based on S version 4, from Bell Labs.
|
||||
(defalias 'S+6 #'S+)
|
||||
(defun S+ (&optional _proc-name)
|
||||
"Call `Splus6', based on S version 4, from Bell Labs.
|
||||
New way to do it."
|
||||
(interactive)
|
||||
(ess-write-to-dribble-buffer
|
||||
@@ -120,9 +120,9 @@ New way to do it."
|
||||
inf-buf))
|
||||
|
||||
|
||||
(defalias 'S+6-mode 'S+-mode)
|
||||
(defalias 'S+6-mode #'S+-mode)
|
||||
;;;###autoload
|
||||
(defun S+-mode (&optional proc-name)
|
||||
(defun S+-mode (&optional _proc-name)
|
||||
"Major mode for editing S+ source. See `ess-mode' for more help."
|
||||
(interactive)
|
||||
(setq-local ess-local-customize-alist S+-customize-alist)
|
||||
@@ -131,7 +131,7 @@ New way to do it."
|
||||
(setq imenu-generic-expression ess-imenu-S-generic-expression)
|
||||
(when ess-imenu-use-S (imenu-add-to-menubar "Imenu-S")))
|
||||
|
||||
(defalias 'S+6-transcript-mode 'S+-transcript-mode)
|
||||
(defalias 'S+6-transcript-mode #'S+-transcript-mode)
|
||||
(define-derived-mode S+-transcript-mode ess-transcript-mode "ESS S Transcript"
|
||||
"S-PLUS 6 transcript mode."
|
||||
:syntax-table S-syntax-table
|
||||
@@ -185,7 +185,7 @@ ESS initialization."
|
||||
;; Define the runners
|
||||
(ess-s-define-runners)
|
||||
(define-obsolete-function-alias
|
||||
'ess-s-versions-create 'ess-s-define-runners "ESS 18.10")
|
||||
'ess-s-versions-create #'ess-s-define-runners "ESS 18.10")
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
;; ess-tracebug.el --- Tracing and debugging facilities for ESS. -*- lexical-binding: t; -*-
|
||||
|
||||
;; Copyright (C) 2011-2020 Free Software Foundation, Inc.
|
||||
;; Copyright (C) 2011-2022 Free Software Foundation, Inc.
|
||||
;; Author: Vitalie Spinu
|
||||
;; Maintainer: Vitalie Spinu
|
||||
;; Created: Oct 14 14:15:22 2010
|
||||
@@ -61,6 +61,7 @@
|
||||
(defvar inferior-ess-mode-map)
|
||||
(defvar ess-mode-map)
|
||||
(defvar ess--inhibit-presend-hooks)
|
||||
|
||||
(declare-function ess--accumulation-buffer "ess-inf")
|
||||
(declare-function ess--if-verbose-write-process-state "ess-inf")
|
||||
(declare-function ess--run-presend-hooks "ess-inf")
|
||||
@@ -69,6 +70,7 @@
|
||||
(declare-function ess-build-load-command "ess-inf")
|
||||
(declare-function ess-command "ess-inf")
|
||||
(declare-function ess-dirs "ess-inf")
|
||||
(declare-function ess-eval-region--normalise-region "ess-inf" )
|
||||
(declare-function ess-force-buffer-current "ess-inf")
|
||||
(declare-function ess-get-process "ess-inf")
|
||||
(declare-function ess-get-process-variable "ess-inf")
|
||||
@@ -80,17 +82,19 @@
|
||||
(declare-function ess-send-string "ess-inf")
|
||||
(declare-function ess-switch-process "ess-inf" ())
|
||||
(declare-function ess-switch-to-ESS "ess-inf")
|
||||
(declare-function ess-wait-for-process "ess-inf")
|
||||
(declare-function ess-switch-to-end-of-ESS "ess-inf" ())
|
||||
(declare-function ess-eval-region--normalise-region "ess-inf" )
|
||||
(declare-function inferior-ess-run-callback "ess-inf")
|
||||
(declare-function ess-wait-for-process "ess-inf")
|
||||
(declare-function inferior-ess--set-status "ess-inf")
|
||||
(declare-function inferior-ess-output-filter "ess-inf")
|
||||
(declare-function inferior-ess-run-callback "ess-inf")
|
||||
|
||||
(declare-function ess-helpobjs-at-point--read-obj "ess-help")
|
||||
(declare-function ess-r-get-evaluation-env "ess-r-mode")
|
||||
(declare-function ess-roxy--region-p "ess-roxy")
|
||||
|
||||
(declare-function ess-r-package--all-source-dirs "ess-r-package")
|
||||
(declare-function ess-r-package-name "ess-r-package")
|
||||
(declare-function ess-r-package-source-dirs "ess-r-package")
|
||||
(declare-function ess-roxy--region-p "ess-roxy")
|
||||
|
||||
|
||||
;; Do not require tramp at runtime. It is expensive to load. Instead,
|
||||
@@ -99,11 +103,11 @@
|
||||
(declare-function tramp-dissect-file-name "tramp")
|
||||
(declare-function tramp-get-remote-tmpdir "tramp")
|
||||
;; The following declares can be removed once we drop Emacs 25
|
||||
(declare-function tramp-file-name-method "tramp")
|
||||
(declare-function tramp-file-name-user "tramp")
|
||||
(declare-function tramp-file-name-hop "tramp")
|
||||
(declare-function tramp-file-name-host "tramp")
|
||||
(declare-function tramp-file-name-localname "tramp")
|
||||
(declare-function tramp-file-name-hop "tramp")
|
||||
(declare-function tramp-file-name-method "tramp")
|
||||
(declare-function tramp-file-name-user "tramp")
|
||||
|
||||
|
||||
(defgroup ess-tracebug nil
|
||||
@@ -457,7 +461,7 @@ See `ess-tracebug-help' for the overview of ess-tracebug functionality."
|
||||
(run-hooks 'ess-tracebug-exit-hook)
|
||||
(message "ess-tracebug mode disabled"))))))
|
||||
|
||||
(defalias 'ess-toggle-tracebug 'ess-tracebug)
|
||||
(defalias 'ess-toggle-tracebug #'ess-tracebug)
|
||||
|
||||
|
||||
;;;_* TRACEBACK
|
||||
@@ -596,7 +600,7 @@ ESS internal code assumes default R prompts.")
|
||||
(setq ess--tb-last-input (point))
|
||||
(setq ess--tb-last-input-overlay
|
||||
(ess--tb-make-last-input-overlay
|
||||
(point-at-bol) (point-at-eol))))
|
||||
(line-beginning-position) (line-end-position))))
|
||||
;; busy timer
|
||||
(setq mode-line-buffer-identification
|
||||
(list (car (propertized-buffer-identification "%3b"))
|
||||
@@ -605,22 +609,18 @@ ESS internal code assumes default R prompts.")
|
||||
(setq ess--busy-timer
|
||||
(run-with-timer 2 .5 (ess--make-busy-timer-function (get-buffer-process (current-buffer)))))
|
||||
(add-hook 'kill-buffer-hook (lambda () (when ess--busy-timer (cancel-timer ess--busy-timer))))
|
||||
(add-hook 'comint-input-filter-functions 'ess-tracebug-set-last-input nil 'local)
|
||||
(add-hook 'comint-input-filter-functions #'ess-tracebug-set-last-input nil 'local)
|
||||
|
||||
;; redefine
|
||||
;; TODO: all this part should go (partially gone now)
|
||||
(unless (fboundp 'orig-ess-parse-errors)
|
||||
(defalias 'orig-ess-parse-errors (symbol-function 'ess-parse-errors))
|
||||
(defalias 'ess-parse-errors (symbol-function 'next-error)))))
|
||||
(advice-add 'ess-parse-errors :override #'next-error)))
|
||||
|
||||
(defun ess--tb-stop ()
|
||||
"Stop ess traceback session in the current ess process."
|
||||
(with-current-buffer (process-buffer (get-process ess-current-process-name))
|
||||
;; restore original definitions
|
||||
(when (equal ess-dialect "R")
|
||||
(when (fboundp 'orig-ess-parse-errors)
|
||||
(defalias 'ess-parse-errors (symbol-function 'orig-ess-parse-errors))
|
||||
(fmakunbound 'orig-ess-parse-errors)))
|
||||
(advice-remove 'ess-parse-errors #'next-error))
|
||||
(if (local-variable-p 'ess--tb-last-input-overlay)
|
||||
(delete-overlay ess--tb-last-input-overlay))
|
||||
(kill-local-variable 'ess--tb-last-input-overlay)
|
||||
@@ -630,7 +630,7 @@ ESS internal code assumes default R prompts.")
|
||||
(kill-local-variable 'compilation-error-regexp-alist)
|
||||
(kill-local-variable 'compilation-search-path)
|
||||
(cancel-timer ess--busy-timer)
|
||||
(remove-hook 'comint-input-filter-functions 'ess-tracebug-set-last-input 'local)
|
||||
(remove-hook 'comint-input-filter-functions #'ess-tracebug-set-last-input 'local)
|
||||
(setq mode-line-buffer-identification (propertized-buffer-identification "%12b"))))
|
||||
|
||||
(defvar ess--dbg-forward-ring (make-ring 10)
|
||||
@@ -653,8 +653,8 @@ bindings are available (\\[next-error] and \\[previous-error])
|
||||
for `next-error' and `previous-error' respectively.
|
||||
|
||||
You can bind `no-select' versions of this commands:
|
||||
\(define-key compilation-minor-mode-map [(?n)] #'next-error-no-select)
|
||||
\(define-key compilation-minor-mode-map [(?p)] #'previous-error-no-select)"
|
||||
\(define-key compilation-minor-mode-map [(?n)] #\\='next-error-no-select)
|
||||
\(define-key compilation-minor-mode-map [(?p)] #\\='previous-error-no-select)"
|
||||
(interactive)
|
||||
(cl-assert ess-traceback-command nil
|
||||
"Not implemented for dialect %s" ess-dialect)
|
||||
@@ -692,7 +692,7 @@ Also see `ess-show-traceback'"
|
||||
(let ((ess-traceback-command ess-call-stack-command))
|
||||
(ess-show-traceback)))
|
||||
|
||||
(defalias 'ess-show-R-traceback 'ess-show-traceback)
|
||||
(defalias 'ess-show-R-traceback #'ess-show-traceback)
|
||||
|
||||
(defun ess--tb-next-error-goto-process-marker ()
|
||||
;; assumes current buffer is the process buffer with compilation enabled
|
||||
@@ -763,7 +763,7 @@ This is the value of `next-error-function' in iESS buffers."
|
||||
|
||||
(defun inferior-ess-move-last-input-overlay ()
|
||||
"Move the overlay to the point."
|
||||
(let ((pbol (point-at-bol)))
|
||||
(let ((pbol (line-beginning-position)))
|
||||
(move-overlay ess--tb-last-input-overlay
|
||||
pbol (max (- (point) 2) (+ pbol 2)))))
|
||||
|
||||
@@ -946,9 +946,9 @@ The action list is in `ess-debug-error-action-alist'."
|
||||
(defun ess--dbg-activate-overlays ()
|
||||
"Initialize active debug line overlays."
|
||||
(move-overlay ess--dbg-current-debug-overlay
|
||||
(point-at-bol) (1+ (point-at-eol)) (current-buffer))
|
||||
(line-beginning-position) (1+ (line-end-position)))
|
||||
;; used by overlay-arrow functionality on no-X, should be bol
|
||||
(move-marker ess--dbg-current-debug-position (point-at-bol)))
|
||||
(move-marker ess--dbg-current-debug-position (line-beginning-position)))
|
||||
|
||||
(defun ess--dbg-deactivate-overlays ()
|
||||
"Delete debugger markers and overlays.
|
||||
@@ -1082,14 +1082,14 @@ watch and loggers. Integrates into ESS and iESS modes by binding
|
||||
(process-put proc 'dbg-buffer dbuff); buffer were the look up takes place
|
||||
(process-put proc 'dbg-active nil) ; t if the process is in active debug state.
|
||||
; Active debug states are usually those, in which prompt start with Browser[d]>
|
||||
(set-process-filter proc 'inferior-ess-tracebug-output-filter)
|
||||
(set-process-filter proc #'inferior-ess-tracebug-output-filter)
|
||||
(with-current-buffer (process-buffer proc)
|
||||
(unless (equal ess-dialect "R")
|
||||
(error "Can not activate the debugger for %s dialect" ess-dialect))
|
||||
(add-to-list 'ess--mode-line-process-indicator 'ess--dbg-mode-line-debug t)
|
||||
(add-to-list 'ess--mode-line-process-indicator 'ess--dbg-mode-line-error-action t)
|
||||
|
||||
(add-hook 'ess-presend-filter-functions 'ess--dbg-remove-empty-lines nil 'local))
|
||||
(add-hook 'ess-presend-filter-functions #'ess--dbg-remove-empty-lines nil 'local))
|
||||
(with-current-buffer dbuff
|
||||
(setq ess-local-process-name lpn)
|
||||
(buffer-disable-undo)
|
||||
@@ -1115,8 +1115,8 @@ Kill the *ess.dbg.[R_name]* buffer."
|
||||
(error "Can not deactivate the debugger for %s dialect" ess-dialect))
|
||||
(delq 'ess--dbg-mode-line-debug ess--mode-line-process-indicator)
|
||||
(delq 'ess--dbg-mode-line-error-action ess--mode-line-process-indicator)
|
||||
(remove-hook 'ess-presend-filter-functions 'ess--dbg-remove-empty-lines 'local))
|
||||
(set-process-filter proc 'inferior-ess-output-filter)
|
||||
(remove-hook 'ess-presend-filter-functions #'ess--dbg-remove-empty-lines 'local))
|
||||
(set-process-filter proc #'inferior-ess-output-filter)
|
||||
(kill-buffer (process-get proc 'dbg-buffer))
|
||||
(process-put proc 'dbg-buffer nil)
|
||||
(process-put proc 'dbg-active nil)
|
||||
@@ -1210,7 +1210,7 @@ the payload list of each message.")
|
||||
"Read STR and evaluate as Emacs expression.
|
||||
If present, the CALLBACK string is passed through `format' with
|
||||
returned value from EXPR and then sent to the subprocess."
|
||||
(let ((result (eval (read str))))
|
||||
(let ((result (eval (read str) t)))
|
||||
(when callback
|
||||
(ess-send-string (ess-get-process) (format callback result)))))
|
||||
|
||||
@@ -1424,7 +1424,7 @@ the output into *ess.dbg* buffer."
|
||||
(flush-timer (process-get proc 'flush-timer)))
|
||||
|
||||
;; current-buffer is still the user's input buffer here
|
||||
(ess--if-verbose-write-process-state proc string)
|
||||
(ess--if-verbose-write-process-state proc string "tracebug-filter")
|
||||
(inferior-ess-run-callback proc string)
|
||||
(process-put proc 'is-recover match-selection)
|
||||
|
||||
@@ -1546,15 +1546,15 @@ different window."
|
||||
(setq ref (ess--dbg-get-next-ref -1 (point-max) ess--dbg-last-ref-marker
|
||||
ess--dbg-regexp-reference)) ; sets point at the end of found ref
|
||||
(when ref
|
||||
(move-marker ess--dbg-last-ref-marker (point-at-eol))
|
||||
(move-marker ess--dbg-last-ref-marker (line-end-position))
|
||||
;; each new step repositions the current-ref!
|
||||
(move-marker ess--dbg-current-ref ess--dbg-last-ref-marker)))
|
||||
(when ref
|
||||
(let ((buf (apply 'ess--dbg-goto-ref other-window ref)))
|
||||
(let ((buf (apply #'ess--dbg-goto-ref other-window ref)))
|
||||
(if buf
|
||||
;; if referenced buffer has been found, put overlays:
|
||||
(with-current-buffer buf
|
||||
(setq t-debug-position (copy-marker (point-at-bol)))
|
||||
(setq t-debug-position (copy-marker (line-beginning-position)))
|
||||
(if (equal t-debug-position ess--dbg-current-debug-position)
|
||||
(progn ;; highlights the overlay for ess--dbg-blink-interval seconds
|
||||
(overlay-put ess--dbg-current-debug-overlay 'face 'ess--dbg-blink-same-ref-face)
|
||||
@@ -1629,11 +1629,11 @@ nil, or TB-INDEX is not found return nil."
|
||||
(goto-char pos)
|
||||
(forward-line (1- line))
|
||||
(if col
|
||||
(goto-char (+ (point-at-bol) col))
|
||||
(goto-char (+ (line-beginning-position) col))
|
||||
(back-to-indentation))
|
||||
(when (bound-and-true-p org-babel-tangled-file)
|
||||
(org-babel-tangle-jump-to-org))
|
||||
(list (point-marker) (copy-marker (point-at-eol))))))))))
|
||||
(list (point-marker) (copy-marker (line-end-position))))))))))
|
||||
|
||||
(defvar ess-r-package-library-paths)
|
||||
(defun ess--dbg-find-buffer (filename)
|
||||
@@ -1723,7 +1723,7 @@ giving the `line'; defaults to 2. nC - sub-expr giving the
|
||||
(defun ess--debug-keys-message-string (&optional map)
|
||||
(let ((overriding-local-map (or map ess-debug-minor-mode-map)))
|
||||
(substitute-command-keys
|
||||
(mapconcat 'identity
|
||||
(mapconcat #'identity
|
||||
'("(\\[ess-debug-command-continue])cont"
|
||||
"(\\[ess-debug-command-continue-multi])cont-multi"
|
||||
"(\\[ess-debug-command-next])next"
|
||||
@@ -1766,10 +1766,10 @@ If supplied, EV must be a proper key event or a string representing the digit."
|
||||
(when (re-search-backward "\\(?: \\|^\\)\\([0-9]+\\):[^\t]+Selection:" ess--tb-last-input t)
|
||||
(setq depth (string-to-number (match-string 1)))
|
||||
(when (> depth 9)
|
||||
(setq ev-char (ess-completing-read "Selection" (mapcar 'number-to-string
|
||||
(setq ev-char (ess-completing-read "Selection" (mapcar #'number-to-string
|
||||
(number-sequence depth 0 -1))
|
||||
nil t ev-char nil)))))
|
||||
(setq prompt (delete-and-extract-region (point-at-bol) mark-pos))
|
||||
(setq prompt (delete-and-extract-region (line-beginning-position) mark-pos))
|
||||
(insert (concat prompt ev-char "\n"))
|
||||
(ess-send-string proc ev-char)
|
||||
(move-marker (process-mark proc) (max-char)))))
|
||||
@@ -1903,19 +1903,17 @@ ARGS are ignored to allow using this function in process hooks."
|
||||
|
||||
(defun ess--bp-pipe-block-p ()
|
||||
(save-excursion
|
||||
(let ((inhibit-point-motion-hooks t)
|
||||
(inhibit-field-text-motion t))
|
||||
(let ((inhibit-field-text-motion t))
|
||||
(forward-line -1)
|
||||
(end-of-line)
|
||||
(looking-back "%>%[ \t]*" (point-at-bol)))))
|
||||
(looking-back "%>%[ \t]*" (line-beginning-position)))))
|
||||
|
||||
(defun ess--bp-pipe-native-block-p ()
|
||||
(save-excursion
|
||||
(let ((inhibit-point-motion-hooks t)
|
||||
(inhibit-field-text-motion t))
|
||||
(let ((inhibit-field-text-motion t))
|
||||
(forward-line -1)
|
||||
(end-of-line)
|
||||
(looking-back "|>[ \t]*" (point-at-bol)))))
|
||||
(looking-back "|>[ \t]*" (line-beginning-position)))))
|
||||
|
||||
(defvar ess--bp-identifier 1)
|
||||
(defcustom ess-bp-type-spec-alist
|
||||
@@ -2092,7 +2090,7 @@ Returns the beginning position of the hidden text."
|
||||
;; 'bp-substring 'comment)))
|
||||
))))))))
|
||||
|
||||
(add-hook 'ess-r-mode-hook 'ess-bp-recreate-all)
|
||||
(add-hook 'ess-r-mode-hook #'ess-bp-recreate-all)
|
||||
|
||||
|
||||
(defun ess-bp-get-bp-position-nearby ()
|
||||
@@ -2141,8 +2139,8 @@ to the current position, nil if not found."
|
||||
(interactive)
|
||||
(let* ((pos (ess-bp-get-bp-position-nearby))
|
||||
(same-line (and pos
|
||||
(<= (point-at-bol) (cdr pos))
|
||||
(>= (point-at-eol) (car pos))))
|
||||
(<= (line-beginning-position) (cdr pos))
|
||||
(>= (line-end-position) (car pos))))
|
||||
(types ess-bp-type-spec-alist)
|
||||
(ev last-command-event)
|
||||
(com-char (event-basic-type ev))
|
||||
@@ -2192,14 +2190,14 @@ to the current position, nil if not found."
|
||||
(init-pos (make-marker)))
|
||||
(if (null pos)
|
||||
(if interactive? (message "No breakpoints nearby"))
|
||||
(if (eq (point) (point-at-eol))
|
||||
(if (eq (point) (line-end-position))
|
||||
(goto-char (1- (point)))) ;; work-around for issue 3
|
||||
(set-marker init-pos (point))
|
||||
(goto-char (car pos))
|
||||
(delete-region (car pos) (cdr pos))
|
||||
(indent-for-tab-command)
|
||||
(goto-char init-pos)
|
||||
(if (eq (point) (point-at-eol)) (forward-char)))))
|
||||
(if (eq (point) (line-end-position)) (forward-char)))))
|
||||
|
||||
(defun ess-bp-kill-all nil
|
||||
"Delete all breakpoints in current buffer."
|
||||
@@ -2323,7 +2321,7 @@ If there is no active R session, this command triggers an error."
|
||||
(dummy-string
|
||||
(ess-tracebug--propertize "|" 'current-watch-bar 'font-lock-keyword-face)))
|
||||
(ess-tracebug--set-left-margin)
|
||||
(setq-local revert-buffer-function 'ess-watch-revert-buffer)
|
||||
(setq-local revert-buffer-function #'ess-watch-revert-buffer)
|
||||
(turn-on-font-lock)
|
||||
(setq ess-watch-current-block-overlay
|
||||
(make-overlay (point-min) (point-max)))
|
||||
@@ -2371,7 +2369,7 @@ the debugging."
|
||||
(ess-command ess-watch-command wbuf sleep no-prompt-check)
|
||||
;; delete the ++++++> line ;; not very reliable but works fine so far.
|
||||
(goto-char (point-min))
|
||||
(delete-region (point-at-bol) (+ 1 (point-at-eol)))
|
||||
(delete-region (line-beginning-position) (+ 1 (line-end-position)))
|
||||
(ess-watch-set-current curr-block)
|
||||
(set-window-point (get-buffer-window wbuf) (point))))))
|
||||
|
||||
@@ -2458,7 +2456,7 @@ Arguments IGNORE and NOCONFIRM currently not used."
|
||||
(goto-char (point-min))
|
||||
(re-search-forward ess-watch-start-expression nil t nr)
|
||||
(goto-char (match-end 0))
|
||||
(apply 'move-overlay ess-watch-current-block-overlay (ess-watch-block-limits-at-point)))
|
||||
(apply #'move-overlay ess-watch-current-block-overlay (ess-watch-block-limits-at-point)))
|
||||
|
||||
|
||||
(defun ess-watch--make-alist ()
|
||||
@@ -2529,7 +2527,7 @@ Optional N if supplied gives the number of steps forward `backward-char'."
|
||||
(unless (re-search-forward ess-watch-start-expression nil t n)
|
||||
(goto-char (point-min)) ;;circular but always moves to start!
|
||||
(re-search-forward ess-watch-start-expression nil t 1))
|
||||
(apply 'move-overlay ess-watch-current-block-overlay (ess-watch-block-limits-at-point)))
|
||||
(apply #'move-overlay ess-watch-current-block-overlay (ess-watch-block-limits-at-point)))
|
||||
|
||||
(defun ess-watch-previous-block (&optional n)
|
||||
"Move the overlay over the previous block.
|
||||
@@ -2541,7 +2539,7 @@ Optional N if supplied gives the number of backward steps."
|
||||
(goto-char (point-max)) ;;circular but always moves to last!
|
||||
(re-search-backward ess-watch-start-expression nil t 1))
|
||||
(goto-char (match-end 0))
|
||||
(apply 'move-overlay ess-watch-current-block-overlay (ess-watch-block-limits-at-point)))
|
||||
(apply #'move-overlay ess-watch-current-block-overlay (ess-watch-block-limits-at-point)))
|
||||
|
||||
;;;_ + BLOCK MANIPULATION and EDITING
|
||||
(defun ess-watch-rename ()
|
||||
@@ -2555,7 +2553,7 @@ Optional N if supplied gives the number of backward steps."
|
||||
;; (reg-expr (concat "^" ess-watch-start-expression "\\s-*\\(.*\\)$"))
|
||||
;; (reg-all (concat "\\(" reg-name "\\)\n\\(" reg-expr "\\)"))
|
||||
;; (pos 0) wal name expr)
|
||||
(unless (re-search-forward reg-name (point-at-eol) t)
|
||||
(unless (re-search-forward reg-name (line-end-position) t)
|
||||
(error "Can not find the name substring in the current watch block "))
|
||||
(setq name (match-string-no-properties 1))
|
||||
(setq start (match-beginning 1))
|
||||
@@ -2628,7 +2626,7 @@ Optional N if supplied gives the number of backward steps."
|
||||
wbl)
|
||||
(when (> nr 1)
|
||||
(setq buffer-read-only nil)
|
||||
(setq wbl (apply 'delete-and-extract-region (ess-watch-block-limits-at-point)))
|
||||
(setq wbl (apply #'delete-and-extract-region (ess-watch-block-limits-at-point)))
|
||||
(re-search-backward ess-watch-start-block nil t 1) ;; current block was deleted, point is at the end of previous block
|
||||
(insert wbl)
|
||||
(ess-watch--install-.ess_watch_expressions)
|
||||
@@ -2644,7 +2642,7 @@ Optional N if supplied gives the number of backward steps."
|
||||
wbl)
|
||||
(when (< nr nr-all)
|
||||
(setq buffer-read-only nil)
|
||||
(setq wbl (apply 'delete-and-extract-region (ess-watch-block-limits-at-point)))
|
||||
(setq wbl (apply #'delete-and-extract-region (ess-watch-block-limits-at-point)))
|
||||
(end-of-line)
|
||||
(when (re-search-forward ess-watch-start-block nil t 1) ;; current block was deleted, point is at the end of previous block or point-max
|
||||
(goto-char (match-beginning 0)))
|
||||
@@ -2656,7 +2654,7 @@ Optional N if supplied gives the number of backward steps."
|
||||
"Kill the current block."
|
||||
(interactive)
|
||||
(setq buffer-read-only nil)
|
||||
(apply 'delete-region (ess-watch-block-limits-at-point))
|
||||
(apply #'delete-region (ess-watch-block-limits-at-point))
|
||||
(ess-watch--install-.ess_watch_expressions))
|
||||
|
||||
;;;_ + Debug/Undebug at point
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
;;; ess-utils.el --- General Emacs utility functions used by ESS -*- lexical-binding: t; -*-
|
||||
|
||||
;; Copyright (C) 1998-2020 Free Software Foundation, Inc.
|
||||
;; Copyright (C) 1998-2022 Free Software Foundation, Inc.
|
||||
;; Author: Martin Maechler <maechler@stat.math.ethz.ch>
|
||||
;; Created: 9 Sept 1998
|
||||
;; Maintainer: ESS-core <ESS-core@r-project.org>
|
||||
@@ -155,7 +155,7 @@ This function will work even if LIST is unsorted. See also `delete-dups'."
|
||||
(setq list (setcdr list (funcall predicate (car list) (cdr list))))))
|
||||
list)
|
||||
|
||||
(define-obsolete-function-alias 'ess-uniq-list 'delete-dups "ESS 19.04")
|
||||
(define-obsolete-function-alias 'ess-uniq-list #'delete-dups "ESS 19.04")
|
||||
|
||||
(defalias 'ess-flatten-list
|
||||
;; `flatten-tree' is a function in Emacs 27
|
||||
@@ -180,10 +180,24 @@ Drops `nil' entries."
|
||||
(t (list list))))
|
||||
|
||||
(define-obsolete-function-alias 'ess-delete-blank-lines
|
||||
'delete-blank-lines "ESS 19.04")
|
||||
#'delete-blank-lines "ESS 19.04")
|
||||
|
||||
(define-obsolete-function-alias 'ess-line-to-list-of-words #'split-string "ESS 19.04")
|
||||
|
||||
(defmacro ess--exit-protect (body &rest exit)
|
||||
"Run EXIT when BODY exits early.
|
||||
Unlike `unwind-protect', the unwind forms only run in case of
|
||||
early exits. Unlike `condition-case', they run inconditionally,
|
||||
no matter the reason for exiting early (e.g. error or quit)."
|
||||
(declare
|
||||
(indent 1)
|
||||
(debug (form &rest form)))
|
||||
`(let ((--early-exit t))
|
||||
(unwind-protect
|
||||
(prog1 ,body (setq --early-exit nil))
|
||||
(when --early-exit
|
||||
,@exit))))
|
||||
|
||||
|
||||
;;*;; System
|
||||
|
||||
@@ -201,7 +215,7 @@ Drops `nil' entries."
|
||||
(goto-char ess-temp-store-point))
|
||||
t)))
|
||||
|
||||
(define-obsolete-function-alias 'ess-find-exec 'ess-find-exec-completions "ESS 19.04")
|
||||
(define-obsolete-function-alias 'ess-find-exec #'ess-find-exec-completions "ESS 19.04")
|
||||
(defun ess-find-exec-completions (root)
|
||||
"Given the ROOT of an executable file name, find all possible completions.
|
||||
Search for the executables in the variable `exec-path'."
|
||||
@@ -221,7 +235,7 @@ Search for the executables in the variable `exec-path'."
|
||||
|
||||
(defun ess-drop-non-directories (file-strings)
|
||||
"Drop all entries in FILE-STRINGS that do not \"look like\" directories."
|
||||
(ess-flatten-list (mapcar 'file-name-directory file-strings)))
|
||||
(ess-flatten-list (mapcar #'file-name-directory file-strings)))
|
||||
|
||||
(defun ess--parent-dir (path n)
|
||||
"Return Nth parent of PATH."
|
||||
@@ -303,7 +317,7 @@ evaluation of BODY."
|
||||
(if (and (symbolp sym)
|
||||
(custom-variable-p sym))
|
||||
(cons
|
||||
(eval (car (get sym 'standard-value)))
|
||||
(eval (car (get sym 'standard-value)) t)
|
||||
(symbol-value sym))
|
||||
(error "`ess-font-lock-keywords' must be a symbol of a custom variable"))))
|
||||
|
||||
@@ -417,6 +431,8 @@ calling `untrace-function' on these functions."
|
||||
(defvar ido-directory-nonreadable)
|
||||
(defvar ido-current-directory)
|
||||
(defvar ido-enable-flex-matching)
|
||||
(declare-function ido-choose-completion-string "ido")
|
||||
(declare-function ido-minibuffer-setup "ido")
|
||||
(declare-function ido-read-internal "ido" (item prompt hist &optional default require-match initial))
|
||||
|
||||
(defun ess-completing-read (prompt collection &optional predicate
|
||||
@@ -444,15 +460,15 @@ with ': ' and (default %s) when needed. If HIST is nil use
|
||||
sel)
|
||||
(unwind-protect
|
||||
(progn
|
||||
(add-hook 'minibuffer-setup-hook 'ido-minibuffer-setup)
|
||||
(add-hook 'choose-completion-string-functions 'ido-choose-completion-string)
|
||||
(add-hook 'minibuffer-setup-hook #'ido-minibuffer-setup)
|
||||
(add-hook 'choose-completion-string-functions #'ido-choose-completion-string)
|
||||
(setq sel (ido-read-internal 'list prompt hist def require-match initial-input))
|
||||
(when hist ;; ido does not push into hist the whole match if C-SPC or RET is used (reported)
|
||||
(unless (string= sel (car (symbol-value hist)))
|
||||
(set hist (cons sel (symbol-value hist))))))
|
||||
(when reset-ido
|
||||
(remove-hook 'minibuffer-setup-hook 'ido-minibuffer-setup)
|
||||
(remove-hook 'choose-completion-string-functions 'ido-choose-completion-string)))
|
||||
(remove-hook 'minibuffer-setup-hook #'ido-minibuffer-setup)
|
||||
(remove-hook 'choose-completion-string-functions #'ido-choose-completion-string)))
|
||||
sel)
|
||||
;; else usual completion
|
||||
(completing-read prompt collection predicate require-match initial-input hist def))))
|
||||
@@ -569,9 +585,10 @@ the prompt from those lines that remain. Invoke this command with
|
||||
(setq this-command 'yank))))
|
||||
|
||||
(defun ess-yank (&optional arg)
|
||||
"Call `ess-yank-cleaned-commands' if ARG is 16.
|
||||
With double prefix ARG (\\[universal-argument]
|
||||
\\[universal-argument]) call `ess-yank-cleaned-commands'."
|
||||
"Variant of `yank' that optionally extracts commands from transcripts.
|
||||
When called with double prefix ARG (\\[universal-argument]
|
||||
\\[universal-argument]), calls `ess-transcript-clean-region'
|
||||
before yanking. See `ess-yank-cleaned-commands'."
|
||||
(interactive "*P")
|
||||
(if (equal '(16) arg)
|
||||
(ess-yank-cleaned-commands)
|
||||
@@ -623,7 +640,7 @@ GTags file (default TAGS): ")
|
||||
(nth 2 l))))
|
||||
imenu-generic-expression)))
|
||||
(tags-cmd (format "etags -o %s --regex='%s' -" tagfile
|
||||
(mapconcat 'identity regs "' --regex='"))))
|
||||
(mapconcat #'identity regs "' --regex='"))))
|
||||
(message "Building tags: %s" tagfile)
|
||||
(when (= 0 (shell-command (format "%s | %s" find-cmd tags-cmd)))
|
||||
(message "Building tags .. ok!")))))
|
||||
@@ -725,7 +742,7 @@ Copied almost verbatim from gnus-utils.el (but with test for mac added)."
|
||||
(when focus-follows-mouse
|
||||
(set-mouse-position frame (1- (frame-width frame)) 0)))
|
||||
|
||||
(define-obsolete-function-alias 'ess-do-auto-fill 'do-auto-fill "ESS 19.04")
|
||||
(define-obsolete-function-alias 'ess-do-auto-fill #'do-auto-fill "ESS 19.04")
|
||||
|
||||
|
||||
;;*;; Syntax
|
||||
@@ -1078,7 +1095,7 @@ nil and not t, query for each instance."
|
||||
(save-excursion
|
||||
(goto-char (point-max))
|
||||
(forward-line -1)
|
||||
(delete-region (point-at-eol) (point-max))))
|
||||
(delete-region (line-end-position) (point-max))))
|
||||
|
||||
(defun ess-sleep ()
|
||||
"Put Emacs to sleep for `ess-sleep-for-shell' seconds (floats work)."
|
||||
@@ -1089,7 +1106,7 @@ nil and not t, query for each instance."
|
||||
(when buf (set-buffer buf))
|
||||
(mapc (lambda (pair)
|
||||
(make-local-variable (car pair))
|
||||
(set (car pair) (eval (cdr pair)))
|
||||
(set (car pair) (eval (cdr pair) t))
|
||||
(when (bound-and-true-p ess--make-local-vars-permanent)
|
||||
(put (car pair) 'permanent-local t))) ;; hack for Rnw
|
||||
alist))
|
||||
@@ -1103,8 +1120,8 @@ VARS must be a list of symbols."
|
||||
(defvar ess-error-regexp "^\\(Syntax error: .*\\) at line \\([0-9]*\\), file \\(.*\\)$"
|
||||
"Regexp to search for errors.")
|
||||
|
||||
(define-obsolete-function-alias 'ess-beginning-of-function 'beginning-of-defun "ESS 19.04")
|
||||
(define-obsolete-function-alias 'ess-end-of-function 'end-of-defun "ESS 19.04")
|
||||
(define-obsolete-function-alias 'ess-beginning-of-function #'beginning-of-defun "ESS 19.04")
|
||||
(define-obsolete-function-alias 'ess-end-of-function #'end-of-defun "ESS 19.04")
|
||||
|
||||
(with-no-warnings
|
||||
(defalias 'ess--project-root
|
||||
|
||||
@@ -101,7 +101,8 @@ Is set by \\[ess-version-string].")
|
||||
(git-rev (when (file-exists-p git-fname)
|
||||
(with-current-buffer (find-file-noselect git-fname)
|
||||
(goto-char (point-min))
|
||||
(concat "git: "(buffer-substring 1 (point-at-eol))))))
|
||||
(concat "git: "(buffer-substring
|
||||
(point-min) (line-end-position))))))
|
||||
(elpa-fname (concat ess-dir "ess-pkg.el"))
|
||||
(elpa-rev (when (file-exists-p elpa-fname)
|
||||
;; Get it from ELPA dir name, (probably won't work if installed manually)
|
||||
@@ -188,7 +189,8 @@ etc.")
|
||||
|
||||
(require 'timer)
|
||||
(defvar ess--idle-timer
|
||||
(run-with-idle-timer ess-idle-timer-interval 'repeat 'ess--idle-timer-function)
|
||||
(run-with-idle-timer ess-idle-timer-interval 'repeat
|
||||
#'ess--idle-timer-function)
|
||||
"Timer used to run `ess-idle-timer-functions'.")
|
||||
|
||||
|
||||
|
||||
2813
lisp/ess/ess.info
2813
lisp/ess/ess.info
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,6 @@
|
||||
;;; essd-els.el --- S-PLUS 3.x at another location customization -*- lexical-binding: t; -*-
|
||||
|
||||
;; Copyright (C) 1998-2020 Free Software Foundation, Inc.
|
||||
;; Copyright (C) 1998-2022 Free Software Foundation, Inc.
|
||||
|
||||
;; Author: Richard M. Heiberger <rmh@temple.edu>
|
||||
;; Created: December 1998
|
||||
@@ -79,8 +79,6 @@ The default value is nil."
|
||||
(setq-local ess-local-customize-alist S+elsewhere-customize-alist)
|
||||
(ess-mode))
|
||||
|
||||
(define-obsolete-function-alias 'S+elsewhere-transcript-mode #'S-transcript-mode "2000")
|
||||
|
||||
;; This REALLY shouldn't need an editing mode. Just a transcript and
|
||||
;; an inferior process handler.
|
||||
|
||||
@@ -108,7 +106,7 @@ buffer on the local computer."
|
||||
(let ((proc (get-buffer-process (buffer-name))))
|
||||
(if (not proc)
|
||||
(error "No process is associated with this buffer")
|
||||
(set-process-filter proc 'inferior-ess-output-filter)
|
||||
(set-process-filter proc #'inferior-ess-output-filter)
|
||||
(setq ess-current-process-name (process-name proc))
|
||||
(add-to-list 'ess-process-name-list
|
||||
(list ess-current-process-name)))))
|
||||
|
||||
Binary file not shown.
@@ -235,9 +235,18 @@ if(.ess.Rversion < "1.8")
|
||||
invokeRestart("browser")
|
||||
}
|
||||
|
||||
out <- withCallingHandlers(
|
||||
interrupt = restart,
|
||||
withVisible(expr)
|
||||
## Should be an exiting handler to be able to catch
|
||||
## stack overflow errors
|
||||
rethrow <- function(cnd) {
|
||||
stop('ESSR::ERROR \"', conditionMessage(cnd), '\"')
|
||||
}
|
||||
|
||||
out <- tryCatch(
|
||||
error = rethrow,
|
||||
withCallingHandlers(
|
||||
interrupt = restart,
|
||||
withVisible(expr)
|
||||
)
|
||||
)
|
||||
|
||||
## Print result manually because we can't rely on auto-print
|
||||
|
||||
@@ -11,6 +11,9 @@
|
||||
## load .base.R and all other files into ESSR environment; then attach ESSR
|
||||
.ess.ESSR.load <- function(dir) {
|
||||
|
||||
if (nzchar(Sys.getenv("ESSR_TEST_LOAD_ERROR")))
|
||||
stop('Loading failed with a nice message.')
|
||||
|
||||
Rver <- .ess.ESSR.get.rver()
|
||||
ESSR <- .ess.ESSR.create.env(Rver)
|
||||
.ess.ESSR.source.files(ESSR, dir, Rver)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
;;; ess-eldoc.el --- Use eldoc to report R function names.
|
||||
;;; ess-eldoc.el --- Use eldoc to report R function names. -*- lexical-binding: t; -*-
|
||||
|
||||
;; Copyright (C) 1997-2020 Free Software Foundation, Inc.
|
||||
;; Copyright (C) 1997-2022 Free Software Foundation, Inc.
|
||||
;; Author: Stephen Eglen
|
||||
;; Created: 2007-06-30
|
||||
;; Maintainer: ESS-core <ESS-core@r-project.org>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
;;; ess-font-lock.el --- font-lock color options
|
||||
;;; ess-font-lock.el --- font-lock color options -*- lexical-binding: t; -*-
|
||||
|
||||
;; Copyright (C) 2000-2022 Free Software Foundation, Inc.
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
;;; ess-mouse.el --- Support for mouse- or cursor-sensitive actions
|
||||
;;; ess-mouse.el --- Support for mouse- or cursor-sensitive actions -*- lexical-binding: t; -*-
|
||||
|
||||
;; Copyright (C) 2001-2020 Free Software Foundation, Inc.
|
||||
;; Copyright (C) 2001-2022 Free Software Foundation, Inc.
|
||||
;; Author: Richard M. Heiberger <rmh@temple.edu>
|
||||
;; Created: 25 Mar 2001
|
||||
;; Maintainer: ESS-core <ESS-core@r-project.org>
|
||||
@@ -94,7 +94,7 @@
|
||||
(setq cmd (funcall func name))
|
||||
;; run the command, eval'ing if it was a list
|
||||
(if (listp cmd)
|
||||
(setq cmd (eval cmd)))
|
||||
(setq cmd (eval cmd t)))
|
||||
(setq mmtype (get cmd 'mouse-me-type))
|
||||
(cond ((eq mmtype 'region)
|
||||
(funcall cmd beg end))
|
||||
@@ -160,7 +160,7 @@ the symbol `string' it will be called with one string argument."
|
||||
|
||||
|
||||
(defun ess-mouse-me-eval-expanded (string &optional head tail commands-buffer
|
||||
page value-returned)
|
||||
_page value-returned)
|
||||
"Send the expanded STRING to the inferior-ess process using `ess-command'
|
||||
after first concating the HEAD and TAIL. Put answer in COMMANDS-BUFFER if
|
||||
specified, otherwise in \"tmp-buffer\". In either
|
||||
@@ -169,7 +169,7 @@ constructed command. If PAGE is non-nil, expand
|
||||
the string one more time by embedding it in a \"page()\" command."
|
||||
(interactive)
|
||||
(let* (scommand
|
||||
page-scommand
|
||||
;; page-scommand
|
||||
(lproc-name ess-local-process-name)
|
||||
(ess-mouse-customize-alist ess-local-customize-alist))
|
||||
(if (not head) (setq head "summary("))
|
||||
@@ -180,7 +180,7 @@ the string one more time by embedding it in a \"page()\" command."
|
||||
|
||||
(ess-make-buffer-current)
|
||||
(pop-to-buffer-same-window commands-buffer)
|
||||
(ess-setq-vars-local (eval ess-mouse-customize-alist) (current-buffer))
|
||||
(ess-setq-vars-local (eval ess-mouse-customize-alist t) (current-buffer))
|
||||
(setq ess-local-process-name lproc-name)
|
||||
(ess-command (concat scommand "\n") commands-buffer)
|
||||
(if (not value-returned) (pop-to-buffer-same-window (nth 1 (buffer-list))))
|
||||
@@ -213,9 +213,9 @@ the string one more time by embedding it in a \"page()\" command."
|
||||
;; (defun ess-S-mouse-me-ess-transcript-mode ()
|
||||
;; (define-key ess-transcript-mode-map [S-mouse-3] 'ess-mouse-me))
|
||||
;;
|
||||
(add-hook 'ess-mode-hook 'ess-S-mouse-me-menu-commands)
|
||||
(add-hook 'inferior-ess-mode-hook 'ess-S-mouse-me-menu-commands)
|
||||
(add-hook 'ess-transcript-mode-hook 'ess-S-mouse-me-menu-commands)
|
||||
(add-hook 'ess-mode-hook #'ess-S-mouse-me-menu-commands)
|
||||
(add-hook 'inferior-ess-mode-hook #'ess-S-mouse-me-menu-commands)
|
||||
(add-hook 'ess-transcript-mode-hook #'ess-S-mouse-me-menu-commands)
|
||||
;; (add-hook 'ess-transcript-mode-hook 'ess-S-mouse-me-ess-transcript-mode)
|
||||
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
;;; ess-r-a.el -- Possible local customizations for R with ESS. -*- lexical-binding: t; -*-
|
||||
|
||||
;; Copyright (C) 1997-2020 Free Software Foundation, Inc.
|
||||
;; Copyright (C) 1997-2022 Free Software Foundation, Inc.
|
||||
;; Author: A.J. Rossini <blindglobe@gmail.com>
|
||||
;; Created: 17 November 1999
|
||||
;; Maintainer: ESS-core <ESS-core@r-project.org>
|
||||
@@ -42,7 +42,7 @@
|
||||
(declare-function ns-do-applescript "nsfns.m" (script))
|
||||
(declare-function do-applescript "ess-r-a" (script))
|
||||
(unless (fboundp 'do-applescript)
|
||||
(defalias 'do-applescript 'ns-do-applescript))
|
||||
(defalias 'do-applescript #'ns-do-applescript))
|
||||
|
||||
(defalias 'essr
|
||||
(read-kbd-macro
|
||||
@@ -142,8 +142,8 @@ is)."
|
||||
;; call this once
|
||||
;; (ajr::scroll-to-end::peterD "emacs")
|
||||
|
||||
(global-set-key [f11] 'show-max-other-window)
|
||||
(global-set-key [f12] 'ess-eval-line-visibly-and-step))
|
||||
(global-set-key [f11] #'show-max-other-window)
|
||||
(global-set-key [f12] #'ess-eval-line-visibly-and-step))
|
||||
|
||||
|
||||
; Provide package
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
;;; mouseme.el --- mouse menu with commands that operate on strings
|
||||
;;; mouseme.el --- mouse menu with commands that operate on strings -*- lexical-binding: t; -*-
|
||||
|
||||
;; Copyright (C) 1997-2020 by Free Software Foundation, Inc.
|
||||
;; Copyright (C) 1997-2022 by Free Software Foundation, Inc.
|
||||
|
||||
;; Author: Howard Melman <howard@silverstream.com>
|
||||
;; Keywords: mouse, menu
|
||||
@@ -78,8 +78,7 @@ It can return either the string or to be most efficient, a list of
|
||||
three elements: the string and the beginning and ending points of the
|
||||
string in the buffer."
|
||||
:type 'function
|
||||
:options '(mouse-me-get-string)
|
||||
:group 'mouseme)
|
||||
:options '(mouse-me-get-string))
|
||||
|
||||
(defcustom mouse-me-build-menu-function 'mouse-me-build-menu
|
||||
"Function used by `mouse-me' to build the popup menu.
|
||||
@@ -88,8 +87,7 @@ be made buffer local and set to something more appropriate for
|
||||
a specific mode. The function will be called with one argument,
|
||||
the string selected, as returned by `mouse-me-get-string-function'."
|
||||
:type 'function
|
||||
:options '(mouse-me-build-menu)
|
||||
:group 'mouseme)
|
||||
:options '(mouse-me-build-menu))
|
||||
|
||||
(defvar mouse-me-grep-use-extension 't
|
||||
"If non-nil `mouse-me-grep' grep's in files with current file's extension.")
|
||||
@@ -133,8 +131,7 @@ argument. Or if the function has the symbol property `mouse-me-type'
|
||||
and if its value is the symbol `region' it will be called with the
|
||||
beginning and ending points of the selected string. If the value is
|
||||
the symbol `string' it will be called with one string argument."
|
||||
:type '(repeat sexp)
|
||||
:group 'mouseme)
|
||||
:type '(repeat sexp))
|
||||
|
||||
(put 'kill-region 'mouse-me-type 'region)
|
||||
(put 'ispell-region 'mouse-me-type 'region)
|
||||
@@ -179,7 +176,7 @@ Returns a list of three elements, the string and the beginning and
|
||||
ending positions of the string in the buffer in that order."
|
||||
(save-match-data
|
||||
(save-excursion
|
||||
(let ((start (point)) beg end str p)
|
||||
(let ((start (point)) beg end str)
|
||||
(skip-syntax-forward "^ >()\"")
|
||||
(setq end (point))
|
||||
(goto-char start)
|
||||
@@ -285,8 +282,7 @@ ending positions of the string in the buffer in that order."
|
||||
(interactive "sGrep: ")
|
||||
(grep-compute-defaults)
|
||||
(let ((reg grep-find-command)
|
||||
(ext (mouse-me-buffer-file-extension))
|
||||
beg end)
|
||||
(ext (mouse-me-buffer-file-extension)))
|
||||
(if (string-match "\\(^.+-type f \\)\\(.+$\\)" reg)
|
||||
(setq reg (concat (match-string 1 reg)
|
||||
(if mouse-me-grep-use-extension
|
||||
@@ -344,7 +340,7 @@ Returned extension is a string beginning with a period."
|
||||
(setq cmd (funcall func))
|
||||
;; run the command, eval'ing if it was a list
|
||||
(if (listp cmd)
|
||||
(setq cmd (eval cmd)))
|
||||
(setq cmd (eval cmd t)))
|
||||
(setq mmtype (get cmd 'mouse-me-type))
|
||||
(cond ((eq mmtype 'region)
|
||||
(funcall cmd beg end))
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
;;; msdos.el --- Run an MS-DOS shell in an NTemacs buffer with bash as the shell
|
||||
;;; msdos.el --- Run an MS-DOS shell in an NTemacs buffer with bash as the shell -*- lexical-binding: t; -*-
|
||||
|
||||
;; Copyright (C) 1999-2020 Free Software Foundation, Inc.
|
||||
;; Copyright (C) 1999-2022 Free Software Foundation, Inc.
|
||||
;; Author: Richard M. Heiberger <rmh@temple.edu>
|
||||
;; Created: February 1999
|
||||
;; Maintainer: ESS-core <ESS-core@r-project.org>
|
||||
@@ -104,7 +104,7 @@ its value is used as a list of arguments when invoking the shell.
|
||||
(save-excursion
|
||||
(setenv "COMSPEC" explicit-msdos-comspec-file-name)
|
||||
(setenv "SHELL" explicit-msdos-shell-file-name)
|
||||
(set-buffer (apply 'make-comint "msdos" prog
|
||||
(set-buffer (apply #'make-comint "msdos" prog
|
||||
(if (and xargs-name (boundp xargs-name))
|
||||
(symbol-value xargs-name))
|
||||
(if (file-exists-p startfile)
|
||||
@@ -142,7 +142,7 @@ d. strips ctrl-m from output.
|
||||
(setq msdos-minor-mode t)
|
||||
(set (make-local-variable 'comint-completion-addsuffix) '("\\" . " "))
|
||||
(setq comint-process-echoes t)
|
||||
(add-hook 'comint-output-filter-functions 'shell-strip-ctrl-m nil t)
|
||||
(add-hook 'comint-output-filter-functions #'shell-strip-ctrl-m nil t)
|
||||
(set-process-coding-system (get-buffer-process (current-buffer)) 'raw-text-dos 'raw-text-dos)
|
||||
;; buffer-process-coding-system is critical.
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user