summaryrefslogtreecommitdiff
path: root/lisp/ess-roxy.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-roxy.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-roxy.el')
-rw-r--r--lisp/ess-roxy.el38
1 files changed, 20 insertions, 18 deletions
diff --git a/lisp/ess-roxy.el b/lisp/ess-roxy.el
index 80e4fc7..fc7bb37 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."