|
Good afternoon,
My development environment at work involves using a Vagrant-managed virtual machine for running and testing code. The source lives outside of the VM, and is made available over NFS. The relevant detail of this configuration is that the file path my Python interpreter runs is not the same as the path my Emacs editor uses. For example, on the Emacs side I might edit /Volumes/project/src/foo.py, and when I run that inside the virtual machine I'm running /mnt/project/src/foo.py. This means that pdbtrack can not find the files to open when I'm trying to debug the code. I'd like to fix that :). Looking at python-mode.el, I *think* the thing to do is modify py-pdbtrack-get-source-buffer, and add another condition between the file-exists-p and pdbtrack-grub-for-buffer ones. This condition would try to match the filename against a regular expression and replace the matched portion with the mapping. My hacking in the scratch buffer leads me to believe that an alist mapping things to replace with their replacement (ie, "/mnt/project" to "/Volumes/project" above) will give hte results I want. I think this mapping could be directory local if you wanted more granular control. Does this seem like a reasonable approach? Or does something like this already exist in python-mode that I'm not aware of? Thanks for your help, NRY _______________________________________________ Python-mode mailing list [hidden email] http://mail.python.org/mailman/listinfo/python-mode |
|
I took a first pass at implementing this approach yesterday evening,
and have something that works for me. You can find my branch with the new functionality at https://code.launchpad.net/~nyergler/python-mode/pdbtrack-mapping. Feedback much appreciated. NRY On Sun, Apr 15, 2012 at 1:41 PM, Nathan Yergler <[hidden email]> wrote: > Good afternoon, > > My development environment at work involves using a Vagrant-managed > virtual machine for running and testing code. The source lives outside > of the VM, and is made available over NFS. The relevant detail of this > configuration is that the file path my Python interpreter runs is not > the same as the path my Emacs editor uses. For example, on the Emacs > side I might edit /Volumes/project/src/foo.py, and when I run that > inside the virtual machine I'm running /mnt/project/src/foo.py. This > means that pdbtrack can not find the files to open when I'm trying to > debug the code. I'd like to fix that :). > > Looking at python-mode.el, I *think* the thing to do is modify > py-pdbtrack-get-source-buffer, and add another condition between the > file-exists-p and pdbtrack-grub-for-buffer ones. This condition would > try to match the filename against a regular expression and replace the > matched portion with the mapping. My hacking in the scratch buffer > leads me to believe that an alist mapping things to replace with their > replacement (ie, "/mnt/project" to "/Volumes/project" above) will give > hte results I want. I think this mapping could be directory local if > you wanted more granular control. > > Does this seem like a reasonable approach? Or does something like this > already exist in python-mode that I'm not aware of? > > Thanks for your help, > > NRY Python-mode mailing list [hidden email] http://mail.python.org/mailman/listinfo/python-mode |
| Powered by Nabble | Edit this page |
