Does sweeprolog load spurious files?

Hello, I’m using the new sweeprolog-mode in Emacs. When I use sweeprolog-top-level (C-c C-t) in a project buffer, it brings in buffers that are not related to my project but were opened in the past. For example, when I run the code:
source_file(X), atom_prefix(X, '/home')
I can see many files that do not belong to my project.
Is this intentional? And where is this information stored?

It seems that if I close and reopen emacs the problem goes away, but still I think it should go away when I kill a top-level.

Hi there,
In Sweep, each top-level buffer is backed by a separate SWI-Prolog thread, but all these threads as part of the same process and share global resources (such as source_file/1).
Hence, top-level buffers are not strongly associated with the project in which you create them.
That’s something I’d be really interested to improve upon, but the path leading to such per-project top-levels is not that clear. For example, in SWI-Prolog all threads share the same working directory…

Thanks @oskardrums, I see the problem; as a stopgap measure, maybe being able to properly kill the prolog process so that we can return at a pristine state would be ok. What do you think? Is this already possible?

Yes, M-x sweeprolog-restart (or Sweep → Reset Sweep in the menu) should reset the embedded SWI-Prolog runtime.

1 Like

Perfect then, I’ll do that if the need arises. Thank you!