Issue #5 resolved

Opening source file by ??

Rafael Villarroel
created an issue

I'm using a just pulled sage-mode in GNU Emacs 23.3.1 (i686-pc-linux-gnu, GTK+ Version 2.24.10) of 2012-03-25 on roseapple, modified by Debian.

When giving this commands:

{{{ sage: g=graphs.HouseXGraph() sage: g._subgraph_by_adding?? }}}

a blank buffer named /usr/devel/sage/sage/graphs/ appears, while the correct source file is /usr/local/share/sage-5.0.1/devel/sage/sage/graphs/ I have set sage-command to "/usr/local/share/sage-5.0.1/sage", but apparently the base directory for the source files is not picked up...

Comments (4)

  1. Ivan Andrus repo owner

    Hmm. I can't reproduce this. I think what file to open is entirely determined by the Sage process. Is there anything "weird" about your Sage install?

    If you type (without hitting enter)

    sage: g._subgraph_by_adding?

    then TAB, you should get the help in another buffer. It will say near the top of that buffer what file it is from. Does that have the right files? If you do

    M-x sage-find-symbol RET g._subgraph_by_adding RET

    does that work right?

  2. Ivan Andrus repo owner

    Actually, I think I might know what the problem is. There is code to change a file in site-packages to one in devel, like


    However, it does this by looking for local.*site-packages. Unfortunately in your case it picks up the local in /usr/local instead of sage-xxx/local since it comes first. At least that's my theory. You can try tightening up the regexp to be

    (setq sage-site-packages-regexp "\\(local/lib/python[0-9.]*/site-packages.*?\\)/sage")

    I don't know if that will work correctly in every circumstance, so please tell me of any problems you have. You can also disable it entirely, but then you'll end up editing files in site-packages which is probably not what you want.

    (setq sage-site-packages-regexp "some long expression that no file with match")

    If the tightened regexp works for both of us for, say a few weeks, then I'll go ahead and make the change.

  3. Rafael Villarroel reporter

    Yes, that fixes it, thanks! If I evaluate

    (setq sage-site-packages-regexp "\\(local/lib/python[0-9.]*/site-packages.*?\\)/sage")

    and running the commands I mentioned first, I get the source file where _subgraph_by_adding is defined. Nice!

  4. Log in to comment