Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modify package info to return remote path #1100

Open
wants to merge 21 commits into
base: master
Choose a base branch
from

Conversation

dapritchard
Copy link
Contributor

Fixes #1057.

As noted in #1057, the main source of the problem is that ess-r-package-info was returning a local path, even when the package was located on a remote system and hence should be addressed using a Tramp filename. I am proposing in this PR that ess-r-package-info should return the remote path and let functions be responsible for converting the remote path into a local path if the local path is what is needed (for example, when providing a path as in input for an R process).

This change does affects a fair amount functions that make use of ess-r-package-info, and some functions had to be modified to continue to work properly after the change. In order to provide some assurance that nothing would get broken by this change, I tried to add some tests for most of the effected functions. In particular, I borrowed some code from the Tramp tests that creates a mock remote file protocol that can be used to test functions with files on remote systems.

The following are some notes that I created for myself to track what functions where effected by the change to ess-r-package-info, and whether anything and/or what needed to be done to incorporate the change.

Functions and variables that are effected by the change to ess-r-package-info

  • ess-r-package--info-cache. This results in the variable being changed since
    it is used to cache the result of ess-r-package-info.
  • ess-r-package-project. Changes the behavior of the function since it returns
    a list with one of the elements being the remote project path rather than a
    local path. A test was added for this function.
  • ess-r-package-name. Doesn’t affect the function since the :name part of
    the plist doesn’t change.
  • ess-r-package-source-dirs. The entire reason for changing
    ess-r-package-info is that it fixes a bug in this function. A test was added
    for this function.
  • ess-r-package-use-dir. The internals of this function are updated with the
    net result of there being no change to the behavior of the function. A test
    was added for this function.
  • ess-r-package-enable-namespaced-evaluation. This shouldn’t change the
    behavior of this function since it just checks for a non-nil value of the
    :root portion of the (ess-r-package-info) plist.
  • ess-r-package-eval-linewise. The internals of this function are updated with
    the net result of there being no change to the behavior of the function. A
    test was added for this function.
  • ess-r-package-auto-activate. Doesn’t affect the function since it just
    checks for a non-nil value of (ess-r-package-info).

So in summary, ess-r-package--info-cache, ess-r-package-project, and
ess-r-package-source-dirs are effected by the change. Next, each of these
functions or variables are examined for their effect on other functions.

Functions that make use of ess-r-package--info-cache

  • ess-r-package-info. The change in ess-r-package--info-cache is required
    for the correct behavior of the function. A test was added for this function.
  • ess-project-save-buffers. The change in ess-r-package-info should actually
    have a side benefit of fixing the behavior of this function on remote
    machines. A test was added for this function.
  • ess-r-package-re-activate. This function isn’t effected since the function
    simply overwrites the current value of ess-r-package--info-cache.

Functions that make use of ess-r-package-project

  • ess-r-package-mode. The function ess-r-package-project is added to the
    hook project-find-functions.
  • ess-roxy-enable-in-cpp. Doesn’t affect this function since it just checks for
    a non-nil value returned by ess-r-package-project.
  • inferior-ess-r--adjust-startup-directory. This update provides the correct
    behavior since it’s comparing filenames based on the result of
    ess-r-package-project to the value of =default-directory, the latter of
    which has a remote file path when appropriate. A test was added for this
    function.
  • ess-r--find-lintr-file. This change should provide the correct behavior
    since it will now look for a .lintr file using a remote path when on a
    remote machine. A test was added for this function.

Functions that make use of ess-r-package-source-dirs

  • ess--dbg-find-buffer. This is the function that calls the faulty version of
    ess-r-package-source-dirs, so this should be fixed now.

@lionel- lionel- added this to the next milestone Mar 31, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Error when debugging R functions on a remote machine
2 participants