[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] scratch/ess fbc2ef3606: Fix compilation of package installed from
From: |
Stefan Monnier |
Subject: |
[elpa] scratch/ess fbc2ef3606: Fix compilation of package installed from Git; plus cosmetics |
Date: |
Tue, 1 Nov 2022 10:47:41 -0400 (EDT) |
branch: scratch/ess
commit fbc2ef3606243c4f86021af8c097470a98847969
Author: Stefan Monnier <monnier@iro.umontreal.ca>
Commit: Stefan Monnier <monnier@iro.umontreal.ca>
Fix compilation of package installed from Git; plus cosmetics
In `test/*.el`: Provide "test/etest/etest" to `require` so Emacs can find
the file when the package is compiled.
In `*.el`: Prefer #' to quote named functions.
Use `lexical-binding` in all the remaining files.
Use lexical-binding also in `eval`.
Remove redundant let-bindings of obsolete variable
`inhibit-point-motion-hooks`.
Replace uses of `point-at-bol` and `point-at-eol`, both marked obsolete
in Emacs-29. Use `defalias` rather than `fset` to define a function.
Fix occasional incorrect uses of ' in docstrings.
Remove some redundant `:group` arguments.
Add leading `_` to unused args.
In addition to the above, a few, more specifc, tweaks:
* lisp/ess-r-mode.el (ess-offset, ess-offset-type): Strength-reduce
`eval` to `symbol-value`.
(ess-rutils-rsitesearch): Hoist the common `browse-url` out of the `if`.
* lisp/ess-r-package.el: Don't test `fboundp` before `advice-add` since
we require Emacs≥25. Don't require `shell` since `advice-add` also
works when the function is not yet defined.
* lisp/ess-r-syntax.el (ess-parser--backward): Give it a global nil
value, both to declare it as dynamically scoped and to simplify
the code. All users adjusted not to bother with `bound-and-true-p`.
(ess-node): Hoist common `gethash` out of the `if`.
* lisp/ess-sas-a.el (ess-sas-rtf-portrait, ess-sas-rtf-landscape):
Add FIXME.
* lisp/ess-sas-d.el (ess-electric-run-semicolon): Re-indent. Add FIXME.
* lisp/ess-sas-l.el (beginning-of-sas-statement): Rename statically
scoped arg to avoid conflict with dynamically scoped var.
(sas-prev-line): Make (unused) arg optional.
(ess-imenu-SAS): Use [:alpha:] and [:alnum:].
* lisp/ess-tracebug.el (ess--tb-start, ess--tb-stop):
Use `advice-add/remove` to redefine `ess-parse-errors`.
* lisp/ess.el (ess-version-string): Don't presume `point-min` is `1`.
* lisp/obsolete/ess-mouse.el (ess-mouse-me-eval-expanded):
Remove unused var `page-scommand`.
* lisp/obsolete/mouseme.el (mouse-me-get-string, mouse-me-find-grep):
Remove unnused vars `p`, `beg`, and `end`.
* test/ess-test-inf.el (ess-test-inferior-local-start-args):
Use `*proc*` rather than undocumented `*inf-buf*`.
(ess-inf-send-fn-test, ess-inf-send-cat-some.text-test): Remove unused
var `output-nowait`.
* test/ess-test-literate.el (chunk-end): Remove `defvar`.
(elt-process-next-chunk, elt-process-next-subchunk, elt-process-case)
(elt-process-code): Pass/take `chunk-end` as argument instead.
* test/ess-test-org.el (test-org-R-ouput): Remove unused var `inf-proc`.
* test/ess-test-r-utils.el (with-ess-test-file): Add FIXME.
(ess-test-sleep-while, ess-test-unwind-protect): Move before first use.
Split the bulk of the code into a function, to ease debugging, avoid
name captures, and improve error messages.
(with-r-running): Split the bulk of the code into a function.
Document the `*proc*` var. Add FIXME.
(output, face-at, token=): Add FIXME.
(output=): Remove redundant `eval`.
* test/ess-test-r.el (ess-r-inherits-prog-mode-test): Turn global
`ess-test-prog-hook` var into local `pmh-was-run`.
* test/literate/fontification.el (face-at-point): Remove unused function.
* test/literate/roxy.el (face-at-point, faces-at-point):
Remove unused functions.
---
lisp/ess-bugs-d.el | 4 +-
lisp/ess-custom.el | 2 +-
lisp/ess-gretl.el | 24 +++---
lisp/ess-help.el | 13 +--
lisp/ess-inf.el | 56 ++++++------
lisp/ess-jags-d.el | 4 +-
lisp/ess-julia.el | 22 ++---
lisp/ess-mode.el | 17 ++--
lisp/ess-r-completion.el | 12 +--
lisp/ess-r-flymake.el | 4 +-
lisp/ess-r-mode.el | 73 ++++++++--------
lisp/ess-r-package.el | 27 +++---
lisp/ess-r-syntax.el | 37 ++++----
lisp/ess-rd.el | 16 ++--
lisp/ess-rdired.el | 4 +-
lisp/ess-roxy.el | 38 +++++----
lisp/ess-s-lang.el | 24 +++---
lisp/ess-sas-a.el | 189 +++++++++++++++++++++--------------------
lisp/ess-sas-d.el | 52 ++++++------
lisp/ess-sas-l.el | 74 ++++++++--------
lisp/ess-sp6-d.el | 18 ++--
lisp/ess-tracebug.el | 94 ++++++++++----------
lisp/ess-utils.el | 32 +++----
lisp/ess.el | 8 +-
lisp/essd-els.el | 4 +-
lisp/obsolete/ess-eldoc.el | 4 +-
lisp/obsolete/ess-font-lock.el | 2 +-
lisp/obsolete/ess-mouse.el | 18 ++--
lisp/obsolete/ess-r-a.el | 8 +-
lisp/obsolete/mouseme.el | 20 ++---
lisp/obsolete/msdos.el | 8 +-
test/ess-test-inf.el | 35 ++++----
test/ess-test-literate.el | 13 ++-
test/ess-test-org.el | 2 +-
test/ess-test-r-eval.el | 2 +-
test/ess-test-r-mode.el | 2 +-
test/ess-test-r-syntax.el | 2 +-
test/ess-test-r-utils.el | 140 ++++++++++++++++--------------
test/ess-test-r.el | 13 +--
test/ess-test-rd.el | 2 +-
test/etest/test-etest.el | 2 +-
test/literate/fontification.el | 5 +-
test/literate/roxy.el | 15 ++--
test/literate/tokens.el | 1 +
44 files changed, 586 insertions(+), 556 deletions(-)
diff --git a/lisp/ess-bugs-d.el b/lisp/ess-bugs-d.el
index 8c6922266f..44605856a9 100644
--- a/lisp/ess-bugs-d.el
+++ b/lisp/ess-bugs-d.el
@@ -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))
diff --git a/lisp/ess-custom.el b/lisp/ess-custom.el
index 39d2c88223..84d26a2216 100644
--- a/lisp/ess-custom.el
+++ b/lisp/ess-custom.el
@@ -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)))
diff --git a/lisp/ess-gretl.el b/lisp/ess-gretl.el
index 9e3fa30104..feba05cf73 100644
--- a/lisp/ess-gretl.el
+++ b/lisp/ess-gretl.el
@@ -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)
@@ -252,20 +252,22 @@ parenthetical grouping.")
(defconst gretl-font-lock-keywords
+ ;; FIXME: Instead of `mapconcat #'identity', if these vars only contain
+ ;; strings (rather than regexps), we should use `regexp-opt'.
(list
;; Fontify all builtin keywords.
(cons (concat "\\<\\("
- (mapconcat 'identity gretl-keywords "\\|")
+ (mapconcat #'identity gretl-keywords "\\|")
"\\)\\>")
'font-lock-keyword-face)
;; Fontify all option flags.
(cons (concat "[ \t]--\\("
- (mapconcat 'identity gretl-option-flags "\\|")
+ (mapconcat #'identity gretl-option-flags "\\|")
"\\)")
'font-lock-constant-face)
;; Fontify all command words.
(cons (concat "\\<\\("
- (mapconcat 'identity gretl-command-words "\\|")
+ (mapconcat #'identity gretl-command-words "\\|")
"\\)\\>")
'font-lock-builtin-face)
;; Fontify all builtin operators.
@@ -275,13 +277,13 @@ parenthetical grouping.")
'font-lock-preprocessor-face))
;; Fontify all internal variables.
(cons (concat "\\$\\("
- (mapconcat 'identity gretl-internal-vars "\\|")
+ (mapconcat #'identity gretl-internal-vars "\\|")
"\\)\\>")
'font-lock-variable-name-face)
;; Fontify all genr functions.
(cons (concat "\\<\\("
- (mapconcat 'identity gretl-genr-functions "\\|")
+ (mapconcat #'identity gretl-genr-functions "\\|")
"\\)\\>")
'font-lock-variable-name-face)
;; Fontify all function declarations.
@@ -293,17 +295,17 @@ parenthetical grouping.")
(defvar gretl-block-begin-regexp
(concat "\\<\\("
- (mapconcat 'identity gretl-block-start-keywords "\\|")
+ (mapconcat #'identity gretl-block-start-keywords "\\|")
"\\)\\>"))
(defvar gretl-block-else-regexp
(concat "\\<\\("
- (mapconcat 'identity gretl-block-other-keywords "\\|")
+ (mapconcat #'identity gretl-block-other-keywords "\\|")
"\\)\\>"))
(defvar gretl-block-end-regexp
(concat "\\<\\("
- (mapconcat 'identity gretl-block-end-keywords "\\|")
+ (mapconcat #'identity gretl-block-end-keywords "\\|")
"\\)\\>"))
(defvar gretl-block-begin-or-end-regexp
@@ -378,7 +380,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 +546,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))
diff --git a/lisp/ess-help.el b/lisp/ess-help.el
index c10bb8a8fe..d666ab81fd 100644
--- a/lisp/ess-help.el
+++ b/lisp/ess-help.el
@@ -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
diff --git a/lisp/ess-inf.el b/lisp/ess-inf.el
index 167cf9158f..3674ecf2e0 100644
--- a/lisp/ess-inf.el
+++ b/lisp/ess-inf.el
@@ -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
@@ -160,7 +161,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
@@ -288,7 +289,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,9 +356,9 @@ 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."
@@ -608,8 +608,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)))
@@ -668,7 +668,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))))
@@ -909,7 +909,7 @@ no such process has been found."
(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
@@ -1154,7 +1154,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 ... ")
@@ -1377,7 +1377,7 @@ wrapping the code into:
(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)
+ (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)
@@ -1680,7 +1680,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 +1696,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 +1787,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 +1832,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 +2014,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 +2151,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")
@@ -2650,7 +2652,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 +2913,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 +2957,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.
diff --git a/lisp/ess-jags-d.el b/lisp/ess-jags-d.el
index e16d44d797..5700f337ee 100644
--- a/lisp/ess-jags-d.el
+++ b/lisp/ess-jags-d.el
@@ -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
diff --git a/lisp/ess-julia.el b/lisp/ess-julia.el
index b25da27610..2c8d442f1a 100644
--- a/lisp/ess-julia.el
+++ b/lisp/ess-julia.el
@@ -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))
@@ -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)
diff --git a/lisp/ess-mode.el b/lisp/ess-mode.el
index 91ebaf52fa..d580aeb683 100644
--- a/lisp/ess-mode.el
+++ b/lisp/ess-mode.el
@@ -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
diff --git a/lisp/ess-r-completion.el b/lisp/ess-r-completion.el
index 71e5a4d5cd..779a3c022a 100644
--- a/lisp/ess-r-completion.el
+++ b/lisp/ess-r-completion.el
@@ -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>
@@ -292,9 +292,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
@@ -356,7 +356,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))
@@ -370,7 +370,7 @@ To be used instead of ESS' completion engine for R versions
>= 2.7.0."
(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))
@@ -403,7 +403,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))
diff --git a/lisp/ess-r-flymake.el b/lisp/ess-r-flymake.el
index 23038a90c7..dae2467944 100644
--- a/lisp/ess-r-flymake.el
+++ b/lisp/ess-r-flymake.el
@@ -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
diff --git a/lisp/ess-r-mode.el b/lisp/ess-r-mode.el
index 26253e5bf3..1c2817668a 100644
--- a/lisp/ess-r-mode.el
+++ b/lisp/ess-r-mode.el
@@ -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>
@@ -577,8 +577,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"
@@ -634,7 +634,8 @@ will be prompted to enter arguments interactively."
,@body)
(setq ess-format-command-alist old-alist)))))
-(define-obsolete-function-alias 'R-initialize-on-start
'ess-r-initialize-on-start "ESS 19.04")
+(define-obsolete-function-alias 'R-initialize-on-start
+ #'ess-r-initialize-on-start "ESS 19.04")
(defun ess-r-initialize-on-start ()
"This function is run after the first R prompt.
Executed in process buffer."
@@ -649,7 +650,7 @@ Executed in process buffer."
(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)
+ (add-hook 'ess-presend-filter-functions #'ess-R-scan-for-library-call nil
'local)
(run-hooks 'ess-r-post-run-hook))
(defun ess-r--skip-function ()
@@ -780,10 +781,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 +797,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 +960,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.
@@ -1128,7 +1129,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 +1151,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 +1201,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 +1232,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"
@@ -1642,7 +1643,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 +1659,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 +1791,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 +1923,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 +2152,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 +2458,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 +2470,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))
@@ -2549,7 +2552,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 +2562,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 +2685,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 +2864,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 +2889,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()."
diff --git a/lisp/ess-r-package.el b/lisp/ess-r-package.el
index e49791357d..3513cc4624 100644
--- a/lisp/ess-r-package.el
+++ b/lisp/ess-r-package.el
@@ -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")
diff --git a/lisp/ess-r-syntax.el b/lisp/ess-r-syntax.el
index 0a15582fec..b26f6cef5b 100644
--- a/lisp/ess-r-syntax.el
+++ b/lisp/ess-r-syntax.el
@@ -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))))
@@ -615,37 +615,40 @@ content. Return nil when the end of the buffer is
reached."
;;;*;;; Parsing
+(defvar ess-parser--backward nil)
+
(defun ess-parser-advance (&optional type value)
- (if (bound-and-true-p ess-parser--backward)
+ (if 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)
+ (if 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)
+ (if ess-parser--backward
(ess-token-before)
(ess-token-after)))
(defun ess-parser-token-start (token)
- (if (bound-and-true-p ess-parser--backward)
+ (if 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))
+ (or (gethash (ess-token-type token)
+ (if ess-parser--backward
+ ess-token-r-right-power-table
+ ess-token-r-power-table))
0))
(defun ess-node (type pos contents)
- (let ((pos (if (bound-and-true-p ess-parser--backward)
+ (let ((pos (if ess-parser--backward
(cons (cdr pos) (car pos))
pos))
- (contents (if (bound-and-true-p ess-parser--backward)
+ (contents (if ess-parser--backward
(nreverse contents)
contents)))
(list type pos contents)))
@@ -654,7 +657,7 @@ content. Return nil when the end of the buffer is reached."
(defalias 'ess-node-end #'ess-token-end)
(defun ess-parse-start-token (token)
- (let* ((table (if (bound-and-true-p ess-parser--backward)
+ (let* ((table (if ess-parser--backward
ess-token-r-rnud-table
ess-token-r-nud-table))
(nud (gethash (ess-token-type token) table)))
@@ -663,7 +666,7 @@ content. Return nil when the end of the buffer is reached."
(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)
+ (led (or (when 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)))
@@ -684,7 +687,7 @@ content. Return nil when the end of the buffer is reached."
(goto-char last-sucessful-pos)
last-success))
-(defun ess-parse-arglist (power start-token)
+(defun ess-parse-arglist (_power start-token)
(let ((start-pos (point))
(arg-start-pos (point))
(arglist (list start-token))
@@ -914,7 +917,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 +929,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)))
diff --git a/lisp/ess-rd.el b/lisp/ess-rd.el
index d891ed7a56..05252b2380 100644
--- a/lisp/ess-rd.el
+++ b/lisp/ess-rd.el
@@ -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-2022 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
(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)
diff --git a/lisp/ess-rdired.el b/lisp/ess-rdired.el
index 222f99e998..35449f339d 100644
--- a/lisp/ess-rdired.el
+++ b/lisp/ess-rdired.el
@@ -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
diff --git a/lisp/ess-roxy.el b/lisp/ess-roxy.el
index 80e4fc70d8..fc7bb3740a 100644
--- a/lisp/ess-roxy.el
+++ b/lisp/ess-roxy.el
@@ -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)
@@ -201,16 +201,16 @@ Use you regular key for `outline-show-entry' to reveal
it.")
(ess-roxy-hide-example)))))
(when (featurep 'outline-magic)
- (substitute-key-definition 'outline-cyle
- 'ess-roxy-cyle-example
+ (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 +219,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 +702,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 +725,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 +805,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 +965,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 +975,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 +1016,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."
diff --git a/lisp/ess-s-lang.el b/lisp/ess-s-lang.el
index 0d678ca5bf..e456f9d167 100644
--- a/lisp/ess-s-lang.el
+++ b/lisp/ess-s-lang.el
@@ -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,7 +479,7 @@ 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")
+(define-obsolete-function-alias 'ess-imenu-R #'ess-imenu-S "ESS 19.04")
;;; Speedbar stuff.
@@ -514,19 +514,19 @@ 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)
+(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-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-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")
;;;###autoload
(add-to-list 'auto-mode-alist '("\\.[Ss]t\\'" . S-transcript-mode))
diff --git a/lisp/ess-sas-a.el b/lisp/ess-sas-a.el
index ef8384babc..9df82d834f 100644
--- a/lisp/ess-sas-a.el
+++ b/lisp/ess-sas-a.el
@@ -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
@@ -471,7 +471,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."
@@ -799,7 +799,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
)
)
@@ -881,7 +881,7 @@ 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)
@@ -889,7 +889,7 @@ optional argument is non-nil, then set-buffer rather than
switch."
(set-visited-file-name (concat (buffer-name) ".rtf"))
; (ess-sas-goto "rtf" t)
- (if 'buffer-read-only (setq buffer-read-only nil))
+ (if 'buffer-read-only (setq buffer-read-only nil)) ;FIXME: Why quoted?
(ess-rtf-replace-chars)
(goto-char (point-min))
@@ -916,14 +916,14 @@ 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))
+ (if 'buffer-read-only (setq buffer-read-only nil)) ;FIXME: Why quoted?
(ess-rtf-replace-chars)
(goto-char (point-min))
@@ -1139,10 +1139,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)
@@ -1202,7 +1203,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
@@ -1230,7 +1231,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)
@@ -1245,27 +1246,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)
@@ -1275,27 +1276,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)
@@ -1305,26 +1306,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)
@@ -1334,26 +1335,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)
diff --git a/lisp/ess-sas-d.el b/lisp/ess-sas-d.el
index ede56537fc..a3e398088d 100644
--- a/lisp/ess-sas-d.el
+++ b/lisp/ess-sas-d.el
@@ -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,29 @@ 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 ";")
+ (let (insertpos) ;; FIXME: Always nil?
+ (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))))))
(defun SAS-menu ()
"Start SAS from the menu."
diff --git a/lisp/ess-sas-l.el b/lisp/ess-sas-l.el
index addaa9ddbe..6a1645a56c 100644
--- a/lisp/ess-sas-l.el
+++ b/lisp/ess-sas-l.el
@@ -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 ----")))
@@ -1491,29 +1491,29 @@ 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 "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 [menu-bar sas run]
'("Submit File " . submit-sas))
)
@@ -1602,9 +1602,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))
@@ -1795,11 +1795,11 @@ 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 ()
diff --git a/lisp/ess-sp6-d.el b/lisp/ess-sp6-d.el
index 93921ff3b9..087c7cad27 100644
--- a/lisp/ess-sp6-d.el
+++ b/lisp/ess-sp6-d.el
@@ -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")
diff --git a/lisp/ess-tracebug.el b/lisp/ess-tracebug.el
index 21b50b50f2..5c101789e0 100644
--- a/lisp/ess-tracebug.el
+++ b/lisp/ess-tracebug.el
@@ -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
@@ -457,7 +457,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 +596,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 +605,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 +626,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 +649,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 +688,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 +759,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 +942,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 +1078,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 +1111,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 +1206,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)))))
@@ -1546,15 +1542,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 +1625,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 +1719,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 +1762,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 +1899,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 +2086,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 +2135,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 +2186,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 +2317,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 +2365,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 +2452,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 +2523,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 +2535,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 +2549,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 +2622,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 +2638,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 +2650,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
diff --git a/lisp/ess-utils.el b/lisp/ess-utils.el
index e6e7dc3a45..73a4f6cad3 100644
--- a/lisp/ess-utils.el
+++ b/lisp/ess-utils.el
@@ -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,7 +180,7 @@ 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")
@@ -201,7 +201,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 +221,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 +303,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"))))
@@ -443,15 +443,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))))
@@ -622,7 +622,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!")))))
@@ -724,7 +724,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
@@ -1077,7 +1077,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)."
@@ -1088,7 +1088,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))
@@ -1102,8 +1102,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
diff --git a/lisp/ess.el b/lisp/ess.el
index 06644849db..542c080cfc 100644
--- a/lisp/ess.el
+++ b/lisp/ess.el
@@ -1,6 +1,6 @@
;;; ess.el --- Emacs Speaks Statistics -*- lexical-binding: t; -*-
-;; Copyright (C) 1997-2020 Free Software Foundation, Inc.
+;; Copyright (C) 1997-2022 Free Software Foundation, Inc.
;; Author: David Smith <dsmith@stats.adelaide.edu.au>
;; A.J. Rossini <blindglobe@gmail.com>
@@ -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'.")
diff --git a/lisp/essd-els.el b/lisp/essd-els.el
index 2977dc3c61..0fe4bc8f22 100644
--- a/lisp/essd-els.el
+++ b/lisp/essd-els.el
@@ -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
@@ -108,7 +108,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)))))
diff --git a/lisp/obsolete/ess-eldoc.el b/lisp/obsolete/ess-eldoc.el
index 3e9700a90d..4394b9477b 100644
--- a/lisp/obsolete/ess-eldoc.el
+++ b/lisp/obsolete/ess-eldoc.el
@@ -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>
diff --git a/lisp/obsolete/ess-font-lock.el b/lisp/obsolete/ess-font-lock.el
index b948fd3854..0487b5500f 100755
--- a/lisp/obsolete/ess-font-lock.el
+++ b/lisp/obsolete/ess-font-lock.el
@@ -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.
diff --git a/lisp/obsolete/ess-mouse.el b/lisp/obsolete/ess-mouse.el
index 972878c3db..001170a3be 100644
--- a/lisp/obsolete/ess-mouse.el
+++ b/lisp/obsolete/ess-mouse.el
@@ -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)
diff --git a/lisp/obsolete/ess-r-a.el b/lisp/obsolete/ess-r-a.el
index 030a83f0fc..7872fbaca3 100644
--- a/lisp/obsolete/ess-r-a.el
+++ b/lisp/obsolete/ess-r-a.el
@@ -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
diff --git a/lisp/obsolete/mouseme.el b/lisp/obsolete/mouseme.el
index 7233da5c54..d21112e644 100644
--- a/lisp/obsolete/mouseme.el
+++ b/lisp/obsolete/mouseme.el
@@ -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 begining 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))
diff --git a/lisp/obsolete/msdos.el b/lisp/obsolete/msdos.el
index c73a81462a..f3e1d9a823 100644
--- a/lisp/obsolete/msdos.el
+++ b/lisp/obsolete/msdos.el
@@ -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.
)
diff --git a/test/ess-test-inf.el b/test/ess-test-inf.el
index 980c8d412d..15fa0657bd 100644
--- a/test/ess-test-inf.el
+++ b/test/ess-test-inf.el
@@ -17,7 +17,7 @@
;; Tests for inferior processes.
(require 'ert)
-(require 'etest)
+(require 'etest "test/etest/etest")
(require 'cl-lib)
;; As we use the R inferior for the generic tests
@@ -47,7 +47,7 @@
(ert-deftest ess-test-inferior-live-process-error ()
(let* ((ess-gen-proc-buffer-name-function
;; Generate same inferior name each time
- (lambda (&rest args) "" "foo"))
+ (lambda (&rest _) "" "foo"))
(error-msg "Can't start a new session in buffer `foo` because one
already exists")
(inf-buf (run-ess-test-r-vanilla)))
(ess-test-unwind-protect inf-buf
@@ -56,7 +56,8 @@
(ert-deftest ess-test-inferior-local-start-args ()
(with-r-running nil
- (let ((inf-data (buffer-local-value 'inferior-ess--local-data *inf-buf*)))
+ (let ((inf-data (buffer-local-value 'inferior-ess--local-data
+ (process-buffer *proc*))))
(should (equal (car inf-data) "R"))
(should (equal (cdr inf-data) "--no-readline --no-init-file
--no-site-file")))))
@@ -97,7 +98,7 @@
(ess-async-command "{cat(1:5);Sys.sleep(0.5);cat(2:6, '\n')}\n"
(get-buffer-create " *ess-async-text-command-output*")
inf-proc
- (lambda (&rest args) (setq semaphore t)))
+ (lambda (&rest _) (setq semaphore t)))
(should (process-get inf-proc 'callbacks))
(cl-loop repeat 3
until (and semaphore (null (process-get inf-proc 'callbacks)))
@@ -106,7 +107,7 @@
(ert-deftest ess-run-presend-hooks-test ()
(with-r-running nil
- (let ((ess-presend-filter-functions (list (lambda (string) "\"bar\""))))
+ (let ((ess-presend-filter-functions (list (lambda (_string) "\"bar\""))))
(should (output= (ess-send-string (ess-get-process) "\"foo\"")
"[1] \"bar\"")))))
@@ -476,9 +477,10 @@ cleaned-prompts >
}
")
(output "> ")
- (output-nowait "> fn <- function() {
-+ }
-> "))
+ ;; (output-nowait "> fn <- function() {
+;; + }
+;; > ")
+ )
(let ((inferior-ess-replace-long+ t))
(let ((ess-eval-visibly nil))
(should (string= output
@@ -500,14 +502,15 @@ head(cars, 2)
1 4 2
2 4 10
> ")
- (output-nowait "cat(\"some. text\\n\")
-+ head(cars, 2)
-some. text
->
- speed dist
-1 4 2
-2 4 10
-> "))
+ ;; (output-nowait "cat(\"some. text\\n\")
+;; + head(cars, 2)
+;; some. text
+;; >
+;; speed dist
+;; 1 4 2
+;; 2 4 10
+;; > ")
+ )
(let ((inferior-ess-replace-long+ t))
(let ((ess-eval-visibly nil))
(should (string= output
diff --git a/test/ess-test-literate.el b/test/ess-test-literate.el
index fd49c38e19..01872f59ef 100644
--- a/test/ess-test-literate.el
+++ b/test/ess-test-literate.el
@@ -10,12 +10,11 @@
(require 'ess-r-mode)
(eval-when-compile
(require 'cl-lib))
-(require 'etest)
+(require 'etest "test/etest/etest")
(defvar elt-section-pattern)
(defvar elt-chunk-pattern)
(defvar elt-code-pattern)
-(defvar chunk-end)
(defvar elt-code-cont-pattern)
(defvar test-case)
(defvar test-case-state)
@@ -70,7 +69,7 @@
(with-temp-buffer
(insert src-string)
;; Don't check safety of local variables declared in test files
- (cl-letf (((symbol-function 'safe-local-variable-p) (lambda (sym val) t)))
+ (cl-letf (((symbol-function 'safe-local-variable-p) (lambda (_sym _val)
t)))
(let ((enable-dir-local-variables nil))
(hack-local-variables)))
(let ((elt-chunk-pattern elt-ess-r-chunk-pattern)
@@ -148,7 +147,7 @@
(condition-case cnd
(let* ((test-case (progn
(skip-chars-forward " \t\n")
- (elt-process-case)))
+ (elt-process-case chunk-end)))
(test-case-state test-case))
(while (looking-at elt-code-pattern)
(elt-process-next-subchunk chunk-end))
@@ -166,7 +165,7 @@
(defun elt-process-next-subchunk (chunk-end)
(let* ((continuation (looking-at elt-code-cont-pattern))
- (test-code (elt-process-code))
+ (test-code (elt-process-code chunk-end))
(test-result (elt-run-chunk test-code
elt-mode-init
continuation))
@@ -178,7 +177,7 @@
(delete-region (point) subchunk-end)
(insert (concat "\n" test-result "\n\n"))))
-(defun elt-process-case ()
+(defun elt-process-case (chunk-end)
(let ((case-start (progn
(skip-chars-forward " \t\n")
(goto-char (line-beginning-position))
@@ -194,7 +193,7 @@
(insert "\n")
(buffer-substring-no-properties case-start case-end)))
-(defun elt-process-code ()
+(defun elt-process-code (chunk-end)
(let* ((test-start (point))
(test-end (if (re-search-forward "^$" chunk-end t)
(1- (match-beginning 0))
diff --git a/test/ess-test-org.el b/test/ess-test-org.el
index e79b738ad8..7303d835df 100644
--- a/test/ess-test-org.el
+++ b/test/ess-test-org.el
@@ -30,7 +30,7 @@
(defun test-org-R-ouput (expect input)
(declare (indent 1))
(let* ((inf-buf (run-ess-test-r-vanilla))
- (inf-proc (get-buffer-process inf-buf)))
+ ) ;; (inf-proc (get-buffer-process inf-buf))
(setq input (format input (buffer-name inf-buf)))
(ess-test-unwind-protect inf-buf
(with-current-buffer (get-buffer-create "*ess-org-test*")
diff --git a/test/ess-test-r-eval.el b/test/ess-test-r-eval.el
index 538d4bb073..a019c69e6c 100644
--- a/test/ess-test-r-eval.el
+++ b/test/ess-test-r-eval.el
@@ -17,7 +17,7 @@
;;
(require 'ert)
-(require 'etest)
+(require 'etest "test/etest/etest")
(require 'ess-r-mode)
(require 'ess-test-r-utils)
diff --git a/test/ess-test-r-mode.el b/test/ess-test-r-mode.el
index 2173e434b0..232c683d57 100644
--- a/test/ess-test-r-mode.el
+++ b/test/ess-test-r-mode.el
@@ -20,7 +20,7 @@
"Backticked symbols are not fontified as strings."
:case "¶`f¶oo¶`"
(setq-local font-lock-syntactic-face-function
- 'inferior-ess-r-font-lock-syntactic-face-function)
+ #'inferior-ess-r-font-lock-syntactic-face-function)
(font-lock-ensure)
(should (not (face-at-point))))
diff --git a/test/ess-test-r-syntax.el b/test/ess-test-r-syntax.el
index 199e329629..497cb41caf 100644
--- a/test/ess-test-r-syntax.el
+++ b/test/ess-test-r-syntax.el
@@ -17,7 +17,7 @@
;;
(require 'ert)
-(require 'etest)
+(require 'etest "test/etest/etest")
(require 'ess-r-mode)
(require 'ess-test-r-utils)
diff --git a/test/ess-test-r-utils.el b/test/ess-test-r-utils.el
index 2288500521..c7b528e6ae 100644
--- a/test/ess-test-r-utils.el
+++ b/test/ess-test-r-utils.el
@@ -18,7 +18,7 @@
;;; Code:
(require 'ert)
-(require 'etest)
+(require 'etest "test/etest/etest")
(require 'ess-r-mode)
(require 'tramp)
(require 'seq)
@@ -39,7 +39,7 @@
(declare (indent 1) (debug (&rest body)))
`(let ((inhibit-message ess-inhibit-message-in-tests)
(*file* ,file))
- (save-window-excursion
+ (save-window-excursion ;; FIXME: Why not `save-current-buffer'?
(set-buffer (if *file*
(find-file-noselect *file*)
(generate-new-buffer " *with-r-file-temp*")))
@@ -98,6 +98,32 @@ inserted text."
(goto-char (point-min))))
,@body)))
+(defmacro ess-test-sleep-while (test seconds timeout &optional msg)
+ (declare (debug t))
+ `(ess--test-sleep-while-1 (lambda () ,test) ,seconds ,timeout ,msg))
+
+(defun ess--test-sleep-while-1 (test-fun seconds timeout msg)
+ (let ((time-start (current-time)))
+ (while (funcall test-fun)
+ (when (time-less-p timeout (time-subtract (current-time) time-start))
+ (error (or msg "Exceeded timeout")))
+ (sleep-for seconds))
+ t))
+
+(defmacro ess-test-unwind-protect (inf-buf &rest body)
+ (declare (indent 1) (debug t))
+ `(ess--test-unwind-protect-1 ,inf-buf (lambda () ,@body)))
+
+(defun ess--test-unwind-protect-1 (inf-buf body-fun)
+ (unwind-protect (funcall body-fun)
+ (let* ((inf-proc (get-buffer-process inf-buf)))
+ (when (and inf-proc (process-live-p inf-proc))
+ (set-process-query-on-exit-flag inf-proc nil)
+ (kill-process inf-proc)
+ (ess-test-sleep-while (process-live-p inf-proc) 0.001 1
+ "Expected dead process"))
+ (kill-buffer inf-buf))))
+
(defun run-ess-test-r-vanilla ()
"Start vanilla R process and return the process object."
(save-window-excursion
@@ -135,14 +161,14 @@ inserted text."
(defun ess-send-input-to-R (input &optional type)
"Eval INPUT and return the entire content of the REPL buffer.
-TYPE can be one of 'string, 'region 'c-c or 'repl. If nil or
-'string, use `ess-send-string' (lowest level primitive); if
-'region use `ess-eval-region' if 'c-c use
+TYPE can be one of `string', `region', `c-c' or `repl'. If nil or
+`string', use `ess-send-string' (lowest level primitive); if
+`region' use `ess-eval-region' if `c-c' use
`ess-eval-region-or-function-or-paragraph' which is by default
-bound to C-c C-c; if 'repl, eval interactively at the REPL. All
-prompts in the output are replaced with '> '. There is no full
+bound to `C-c C-c'; if `repl', eval interactively at the REPL.
+All prompts in the output are replaced with \"> \". There is no fool
proof way to test for prompts given that process output could be
-split arbitrary."
+split arbitrarily."
(let* ((prompt-regexp "^\\([+.>] \\)\\{2,\\}")
(inf-buf (run-ess-test-r-vanilla))
(inf-proc (get-buffer-process inf-buf))
@@ -197,36 +223,44 @@ split arbitrary."
;; !!! NB: proc functionality from now on uses inferior-ess-ordinary-filter and
;; !!! *proc* dynamic var
-(defmacro with-r-running (buffer-or-file &rest body)
+(defmacro with-r-running (buffer-or-file &rest body) ;; FIXME: "ess-" prefix!
"Run BODY within BUFFER-OR-FILE with attached R process.
-If BUFFER-OR-FILE is a file, the file is visited first. The R
+If BUFFER-OR-FILE is a file, the file is visited first. The R
process is run with `inferior-ess-ordinary-filter' which is not
-representative to the common interactive use with tracebug on."
+representative to the common interactive use with tracebug on.
+BODY can refer to the process via the variable `*proc*'."
(declare (indent 1) (debug (form body)))
- `(let* ((inhibit-message ess-inhibit-message-in-tests)
- (buffer-or-file ,buffer-or-file)
- (r-file-buffer (cond ((bufferp buffer-or-file)
- buffer-or-file)
- ((stringp buffer-or-file)
- (find-file-noselect buffer-or-file))
- (t
- (generate-new-buffer " *with-r-file-temp*")))))
- (save-window-excursion
- (switch-to-buffer r-file-buffer)
- (R-mode)
- (let* ((*proc* (get-buffer-process (run-ess-test-r-vanilla)))
- (ess-local-process-name (process-name *proc*))
- (*inf-buf* (process-buffer *proc*)))
- (unwind-protect
- (ess-test-unwind-protect *inf-buf*
- (setq ess-r-tests-current-output-buffer *inf-buf*)
- (let ((inhibit-read-only t))
- (with-current-buffer ess-r-tests-current-output-buffer
- (erase-buffer)))
- (set-process-filter *proc* 'inferior-ess-output-filter)
- (prog1 (progn ,@body)
- (ess-wait-for-process *proc*)))
- (setq ess-r-tests-current-output-buffer nil))))))
+ `(ess--with-r-running-1 ,buffer-or-file
+ (lambda (*proc*) (ignore *proc*) ,@body)))
+
+(defun ess--with-r-running-1 (buffer-or-file body-fun)
+ (let* ((inhibit-message ess-inhibit-message-in-tests)
+ (r-file-buffer (cond ((bufferp buffer-or-file)
+ buffer-or-file)
+ ((stringp buffer-or-file)
+ (find-file-noselect buffer-or-file))
+ (t
+ (generate-new-buffer " *with-r-file-temp*")))))
+ ;; FIXME: If you don't want to display `r-file-buffer', then why not
+ ;; use `with-current-buffer' rather than using `switch-to-buffer'
+ ;; and then having to try and undo its damage with `save-window-excursion'
+ ;; (which can't work when `switch-to-buffer' created a new frame)?
+ (save-window-excursion
+ (switch-to-buffer r-file-buffer)
+ (R-mode)
+ (let* ((*proc* (get-buffer-process (run-ess-test-r-vanilla)))
+ (ess-local-process-name (process-name *proc*))
+ (*inf-buf* (process-buffer *proc*)))
+ (unwind-protect
+ (ess-test-unwind-protect *inf-buf*
+ (setq ess-r-tests-current-output-buffer *inf-buf*)
+ (let ((inhibit-read-only t))
+ (with-current-buffer ess-r-tests-current-output-buffer
+ (erase-buffer)))
+ (set-process-filter *proc* #'inferior-ess-output-filter)
+ (prog1 (funcall body-fun *proc*)
+ (ess-wait-for-process *proc*)))
+ (setq ess-r-tests-current-output-buffer nil))))))
(defvar ess-r-tests-current-output-buffer nil)
@@ -238,7 +272,7 @@ representative to the common interactive use with tracebug
on."
;; to perform ulterior tests with a fresh R to avoid contaminating
;; them.
-(defmacro output (&rest body)
+(defmacro output (&rest body) ;; FIXME: `ess-' prefix?
(declare (indent 1) (debug (&rest body)))
`(progn
(ess-wait-for-process *proc*)
@@ -249,18 +283,18 @@ representative to the common interactive use with
tracebug on."
(prog1 (buffer-substring-no-properties (point-min) (point-max))
(erase-buffer)))))
-(defmacro output= (body expected)
+(defmacro output= (body expected) ;; FIXME: `ess-' prefix?
(declare (indent 0) (debug (sexp sexp)))
`(progn
(let ((output (output ,body))
- (expected (eval ,expected)))
+ (expected ,expected))
(if (string= output expected)
output
;; Probably a better way but this gets the job done
(signal 'ert-test-failed (list (concat "Expected: \n" expected)
(concat "Result: \n" output)))))))
-(defun face-at (point)
+(defun face-at (point) ;; FIXME: `ess-' prefix?
(save-excursion
(if (>= point 0)
(goto-char point)
@@ -271,30 +305,8 @@ representative to the common interactive use with tracebug
on."
(apply #'insert args)
(font-lock-default-fontify-buffer))
-(defmacro ess-test-sleep-while (test seconds timeout &optional msg)
- `(let ((_seconds ,seconds)
- (_timeout ,timeout)
- (_time-start (current-time)))
- (while ,test
- (when (time-less-p _timeout (time-subtract (current-time) _time-start))
- (error (or ,msg "Exceeded timeout")))
- (sleep-for _seconds))
- t))
-
;; It is safer to kill the buffer synchronously, otherwise it might be
;; reused in another test
-(defmacro ess-test-unwind-protect (inf-buf &rest body)
- (declare (indent 1))
- `(unwind-protect (progn ,@body)
- (let* ((inf-buf ,inf-buf)
- (inf-proc (get-buffer-process inf-buf)))
- (when (and inf-proc (process-live-p inf-proc))
- (set-process-query-on-exit-flag inf-proc nil)
- (kill-process inf-proc)
- (ess-test-sleep-while (process-live-p inf-proc) 0.001 1
- "Expected dead process"))
- (kill-buffer inf-buf))))
-
(defun ess-test-r-set-local-process (&optional type)
(let* ((proc-buf (ess-r-test-proc-buf (or type 'tracebug)))
(proc (get-buffer-process proc-buf)))
@@ -319,9 +331,9 @@ representative to the common interactive use with tracebug
on."
(tramp-connection-timeout 10)))
(defun ess-test-create-remote-path (path)
- "Construct a remote path using the 'mock' TRAMP method.
+ "Construct a remote path using the `mock' TRAMP method.
Take a string PATH representing a local path, and construct a
-remote path that uses the 'mock' TRAMP method."
+remote path that uses the `mock' TRAMP method."
(let ((full-path (abbreviate-file-name (expand-file-name path))))
(concat "/mock::" full-path)))
@@ -377,7 +389,7 @@ Throws an error if unsuccesful."
(should (ess--essr-check-if-in-essrenv)))
(kill-buffer)))
-(defun token= (type &optional value)
+(defun token= (type &optional value) ;; FIXME: `ess-' prefix?
"Check that the next token conforms to TYPE and VALUE.
This checks it back and forth and moves the point after the
token."
diff --git a/test/ess-test-r.el b/test/ess-test-r.el
index 6f59e4b465..9c885d8a7b 100644
--- a/test/ess-test-r.el
+++ b/test/ess-test-r.el
@@ -17,24 +17,25 @@
;;
(require 'ert)
-(require 'etest)
+(require 'etest "test/etest/etest")
(require 'ess-r-mode)
(require 'ess-test-r-utils)
(require 'cc-mode)
(require 'imenu)
(with-no-warnings
(when (< emacs-major-version 26)
- (require 'cl)))
+ (require 'cl))) ;; FIXME: For?
;;; R
;;; Code:
(ert-deftest ess-r-inherits-prog-mode-test ()
- (let ((prog-mode-hook (lambda () (setq ess-test-prog-hook t))))
+ (let* ((pmh-was-run nil)
+ (prog-mode-hook (lambda () (setq pmh-was-run t))))
(with-ess-test-r-file nil
(should (derived-mode-p 'prog-mode))
- (should ess-test-prog-hook)
+ (should pmh-was-run)
(should
;; Test that prog-mode-map is a keymap-parent
(let ((map (current-local-map))
@@ -156,7 +157,7 @@
(ert-deftest ess-r-run-presend-hooks-test ()
(with-r-running nil
- (let ((ess-presend-filter-functions (list (lambda (string) "\"bar\"")))
+ (let ((ess-presend-filter-functions (list (lambda (_string) "\"bar\"")))
(ess-r-evaluation-env "base")
ess-eval-visibly)
(insert "\"foo\"\n")
@@ -204,7 +205,7 @@
(defun ess-test-init-insert-assign ()
(let ((map (make-sparse-keymap)))
- (define-key map "_" 'ess-insert-assign)
+ (define-key map "_" #'ess-insert-assign)
(use-local-map map)))
(etest-deftest ess-insert-assign-test ()
diff --git a/test/ess-test-rd.el b/test/ess-test-rd.el
index bb519fa847..e06060aa80 100644
--- a/test/ess-test-rd.el
+++ b/test/ess-test-rd.el
@@ -17,7 +17,7 @@
;;
(require 'ert)
-(require 'etest)
+(require 'etest "test/etest/etest")
(require 'ess-r-mode)
(require 'ess-test-r-utils)
(require 'ess-rd)
diff --git a/test/etest/test-etest.el b/test/etest/test-etest.el
index 896920bcb2..25f0b8185a 100644
--- a/test/etest/test-etest.el
+++ b/test/etest/test-etest.el
@@ -1,7 +1,7 @@
;; -*- lexical-binding: t -*-
(require 'ert)
-(require 'etest)
+(require 'etest "test/etest/etest")
(etest-deftest etest-local-vars-test ()
"`:init' keyword specifies local variables."
diff --git a/test/literate/fontification.el b/test/literate/fontification.el
index 41bed7c612..f3e6827edb 100644
--- a/test/literate/fontification.el
+++ b/test/literate/fontification.el
@@ -1,5 +1,6 @@
-(defun face-at-point ()
- (get-char-property (point) 'face))
+;; -*- lexical-binding: t; -*-
+;; (defun face-at-point ()
+;; (get-char-property (point) 'face))
(defmacro with-ess-toggled-font-lock-keyword (enable keywords &rest body)
(declare (indent 2)
diff --git a/test/literate/roxy.el b/test/literate/roxy.el
index 1d0de6968c..d11f5da1f0 100644
--- a/test/literate/roxy.el
+++ b/test/literate/roxy.el
@@ -1,9 +1,10 @@
+;; -*- lexical-binding: t; -*-
-(defun face-at-point ()
- (get-char-property (point) 'face))
+;; (defun face-at-point ()
+;; (get-char-property (point) 'face))
-(defun faces-at-point ()
- (let ((face (get-char-property (point) 'face)))
- (if (listp face)
- face
- (list face))))
+;; (defun faces-at-point ()
+;; (let ((face (get-char-property (point) 'face)))
+;; (if (listp face)
+;; face
+;; (list face))))
diff --git a/test/literate/tokens.el b/test/literate/tokens.el
index 3351dcfc25..03298696f2 100644
--- a/test/literate/tokens.el
+++ b/test/literate/tokens.el
@@ -1,3 +1,4 @@
+;; -*- lexical-binding: t; -*-
(defun token= (type &optional value)
"Check that the next token conforms to TYPE and VALUE.