I think there’s a minor inaccuracy in the documentation for edit/0.
If Prolog files are passed directly to swipl, the first of these becomes the “associated file” and it’s the one edit/0 opens by default.
This is stated on passing here (at the beginning), but I see that the documentation for edit/0 mentions the script file instead (the one possibly loaded with -s).
I just tried and the script file is neither registered as the associated file nor opened by edit/0 by default. So I think it’s just an issue with the documentation.
Also, and a bit unrelated (but I didn’t want to start another thread about it): files passed freely to swipl seem to be requiring the extension, while ones passed to -s or -l do not (so, say, swipl -s f1 works but swipl f1 does not).
Is this intentional? (I’m fine with it, just takes one to know)
I’ve been using SP for several years now, but I thought about making it the backbone of some real application only recently, so I’ve started “studying” it more thoroughly to be more knowledgeable about it (this only to explain why I’m starting a few threads about documentation discrepancies or to understand things better).
Your suggestion matches what I saw yesterday while trying out the several ways to run an initial goal (the “whens” of initialization/2, the -g option etc).
I saw that init/main is probably the best way to execute an initial goal both because it comes last after everything else and because it suppresses both the banner and the top level automatically (no need for -g true and no % halt messages).
I saw that this forum has a “Nice to know” category meant for future reference/searches, so I might be using that to write a final wrap-up about this.
(The docs are fine, but sometimes information is scattered among many pages and there are default behaviors involved that one may lose track of.)