diff options
| author | Stefan Monnier <monnier@iro.umontreal.ca> | 2022-11-01 10:47:17 -0400 |
|---|---|---|
| committer | Stefan Monnier <monnier@iro.umontreal.ca> | 2022-11-01 10:47:17 -0400 |
| commit | fbc2ef3606243c4f86021af8c097470a98847969 (patch) | |
| tree | 5e09863605ccb0844444189494e0c83a474661d1 /lisp/ess-inf.el | |
| parent | 60e9790b35fdac1b254b66438fedaeebb8a82c91 (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-inf.el')
| -rw-r--r-- | lisp/ess-inf.el | 56 |
1 files changed, 29 insertions, 27 deletions
diff --git a/lisp/ess-inf.el b/lisp/ess-inf.el index 167cf91..3674ecf 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. |
