Is it possible to use Ropemacs with TRAMP in Emacs?
Asked Answered
V

1

18

I recently installed the hg tip version of Ropemacs and I'd like to use it when editing remote files using TRAMP. Has anyone done this? When I try to use M-/ to complete a variable name, I am asked to enter the Rope project root folder and I enter: /ssh:myhost:/path/to/myproject/ and it gives me the following error:

Opening [/ssh:myhost:/path/to/myproject/] project ... 
pymacs-report-error: Python: Traceback (most recent call last):
  File "/home/saltycrane/lib/python-environments/default/lib/python2.6/site-packages/Pymacs/pymacs.py", line 147, in loop
    value = eval(text)
  File "<string>", line 1, in <module>
  File "/home/saltycrane/lib/python-environments/default/lib/python2.6/site-packages/ropemode/decorators.py", line 53, in newfunc
    return func(*args, **kwds)
  File "/home/saltycrane/lib/python-environments/default/lib/python2.6/site-packages/ropemode/interface.py", line 254, in code_assist
    _CodeAssist(self, self.env).code_assist(prefix)
  File "/home/saltycrane/lib/python-environments/default/lib/python2.6/site-packages/ropemode/interface.py", line 538, in code_assist
    proposals = self._calculate_proposals()
  File "/home/saltycrane/lib/python-environments/default/lib/python2.6/site-packages/ropemode/interface.py", line 597, in _calculate_proposals
    self.interface._check_project()
  File "/home/saltycrane/lib/python-environments/default/lib/python2.6/site-packages/ropemode/interface.py", line 448, in _check_project
    self.open_project()
  File "/home/saltycrane/lib/python-environments/default/lib/python2.6/site-packages/ropemode/decorators.py", line 53, in newfunc
    return func(*args, **kwds)
  File "/home/saltycrane/lib/python-environments/default/lib/python2.6/site-packages/ropemode/interface.py", line 88, in open_project
    self.project = rope.base.project.Project(root)
  File "/home/saltycrane/lib/python-environments/default/lib/python2.6/site-packages/rope/base/project.py", line 134, in __init__
    os.mkdir(self._address)
OSError: [Errno 2] No such file or directory: '/ssh:myhost:/path/to/myproject'

I imagine ropemacs doesn't support remote files with TRAMP. Just wondering if anyone has found a workaround. Maybe some custom elisp? Or maybe I should use sshfs and mount the remote filesystem locally...

I installed ropemacs in a virtualenv located at /home/saltycrane/lib/python-environments/default. I am using GNU Emacs 23.1.50.1 on Ubuntu Lucid.

I should mention that completion with M-/ works fine when I'm not using TRAMP.

Valleau answered 11/5, 2010 at 23:52 Comment(2)
Using sshfs is probably the pragmatic approach. Waiting till ropemacs gets support for working over TRAMP, or patching ropemacs yourself, is definitely more effort.Issuant
+1 for sshfs, which follows the modularity principle of the Unix philosophy and does not only work with Emacs.Survey
T
6

No, this is not possible using TRAMP, because the Python rope library does not make calls back into Emacs when it wants to scan the filesystem for Python files to find their classes and functions — instead, it uses calls like listdir() and open() on the filesystem directly, without giving Emacs a chance to get in the way and intercept the special TRAMP-prefixed paths that you are editing.

Using sshfs might be possible, as the comments have mentioned, but for rope I imagine that it would be a very slow solution, since rope has to open so many files to find out the state of your project.

I generally leave rope off, or else figure out how to export an Emacs session from the remote system, when editing across a remote-filesystem link. I wonder if you could use something like rsync or dropbox or even a DVCS so that the files would be present on your local hard drive as immediately-accessible copies, but so that changes you save would get copied across?

Thoughtout answered 13/9, 2011 at 23:7 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.