[ESS] Roxygen Update is "off by one" in function

Alex Branham @|ex@br@nh@m @end|ng |rom gm@||@com
Tue Feb 5 17:25:40 CET 2019


On Tue 05 Feb 2019 at 10:13, Paul Johnson via ESS-help <ess-help using r-project.org> wrote:

> Those newly inserted arguments come from the one before.
>
> Between functions in the R file, I have NULL because that was recommended
> for Roxygen authors in the old days.  Nothing else special.
>
> Can you reproduce?

Yes, I can. Thanks for the report.

Looks like we call 'beginning-of-defun' once too many times. Since we're
already at the beginning of the function, we skip back to the previous
one. This diff solves the issue, 'ess-roxy-get-function-args' doesn't
seem to get called from anywhere other than that one function so I think
this is safe to install. WDYT, Vitalie?

Alex

diff --git a/lisp/ess-roxy.el b/lisp/ess-roxy.el
index 007395b3..c8326ae6 100644
--- a/lisp/ess-roxy.el
+++ b/lisp/ess-roxy.el
@@ -783,11 +783,11 @@ See `hs-show-block' and `ess-roxy-hide-block'."
   (goto-char (ess-roxy-beg-of-entry)))

 (defun ess-roxy-get-function-args ()
-  "Return the arguments specified for the current function as a list of strings."
+  "Return the arguments specified for the current function as a list of strings.
+Assumes point is at the beginning of the function.."
   (save-excursion
     (let ((args-txt
            (progn
-             (beginning-of-defun)
              (buffer-substring-no-properties
               (progn
                 (search-forward-regexp "\\([=,-]+ *function *\\|^\s*function\\)" nil nil 1)



More information about the ESS-help mailing list