Macaulay2 / M2

The primary source code repository for Macaulay2, a system for computing in commutative algebra, algebraic geometry and related fields.
https://macaulay2.com
343 stars 230 forks source link

viewHelp String results in wrong file path #1853

Closed pzinn closed 3 years ago

pzinn commented 3 years ago

I don't know exactly when this issue began, but on the current development branch it seems asking for help about a string results in an incorrect package and therefore the wrong path (see o3 below, compared to the correct path o5). What am I missing? or is something messed up with my configuration?

i1 : debug Core

i2 : makeDocumentTag "trim(Ideal)"

o2 = User :: trim(Ideal)

o2 : DocumentTag

i3 : htmlFilename oo

o3 = (/home/pzinn/.Macaulay2/local/, share/doc/Macaulay2/User/html/_trim_lp__Ideal_rp.html)

o3 : Sequence

i4 : makeDocumentTag (trim,Ideal)

o4 = Macaulay2Doc :: trim(Ideal)

o4 : DocumentTag

i5 : htmlFilename oo

o5 = (/home/pzinn/M2/M2/BUILD/fedora/usr-dist/, common/share/doc/Macaulay2/Macaulay2Doc/html/_trim_lp__Ideal_rp.html)

o5 : Sequence
mahrud commented 3 years ago

makeDocumentTag makes very little effort to detect the correct package in the three cases below, and this is on purpose: package calls fetchAnyRawDocumentation makeDocumentTag, so we need to avoid an infinite loop. https://github.com/Macaulay2/M2/blob/244e8ea71ec6fe665e4741d2b1708b520173b1b7/M2/Macaulay2/m2/document.m2#L151-L156

One way to get the correct package is to call fetchAnyRawDocumentation on the tag:

i14 : package (fetchAnyRawDocumentation makeDocumentTag "trim(Ideal)").DocumentTag 

o14 = Macaulay2Doc

o14 : Package

Regarding the bigger issue with viewHelp, I just pushed a commit to deal with this situation; see the commit linked above.