summaryrefslogtreecommitdiff
path: root/lisp/ess-utils.el
diff options
context:
space:
mode:
authorStefan Monnier <monnier@iro.umontreal.ca>2022-11-01 10:47:17 -0400
committerStefan Monnier <monnier@iro.umontreal.ca>2022-11-01 10:47:17 -0400
commitfbc2ef3606243c4f86021af8c097470a98847969 (patch)
tree5e09863605ccb0844444189494e0c83a474661d1 /lisp/ess-utils.el
parent60e9790b35fdac1b254b66438fedaeebb8a82c91 (diff)
Fix compilation of package installed from Git; plus cosmeticsscratch/ess
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.
Diffstat (limited to 'lisp/ess-utils.el')
-rw-r--r--lisp/ess-utils.el32
1 files changed, 16 insertions, 16 deletions
diff --git a/lisp/ess-utils.el b/lisp/ess-utils.el
index e6e7dc3..73a4f6c 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