Thanks Paulo.
I think I got your explanation. Thanks.
However still I did not get what I want to do in (edi)prolog-mode
on emacs buffer.
That works at least when the module is "user":
?- module(user).
%@ true.
a :- writeln(hello).
b :- writeln(world).
( "region-consulted" in the mini-buffer,
after M-X ediprolog-consult)
?-listing(a/0).
%@ a :-
%@ writeln(hello).
%@
%@ true.
?-listing(b/0).
%@ b :-
%@ writeln(world).
%@
%@ true.
?- a.
%@ hello
%@ true.
?- b.
%@ world
%@ true.
I expected the directive "?- module(user)" above could be
replaced with "?- module(temp)" to work fine for the module "temp".
But it did not work:
?- module(temp).
%@ Warning: temp is not a current module (created)
%@ true.
a :- writeln(hello).
b :- writeln(world).
(*ediprolog-conulst* buffer)
ERROR: No permission to load source `'/Users/cantor/tmp/ediprologeRom6T'' (Non-module file already loaded into module user; trying to load into temp)
ERROR: In:
ERROR: [22] throw(error(permission_error(load,source,'/Users/cantor/tmp/ediprologeRom6T'),context(...,'Non-module file already loaded into module user; trying to load into temp')))
ERROR: [20] '$assert_load_context_module'('/Users/cantor/tmp/ediprologeRom6T',temp,[expand(false),...]) at /Users/cantor/build/lib/swipl-7.7.17/boot/
init.pl:2537
ERROR: [19] '$mt_do_load'(<clause>(0x7fc69a23b570),'/Users/cantor/tmp/ediprologeRom6T','/Users/cantor/tmp/ediprologeRom6T',temp,[expand(false),...]) at /Users/cantor/build/lib/swipl-7.7.17/boot/
init.pl:2156
ERROR: [18] setup_call_catcher_cleanup(system:with_mutex('$load_file',...),system:'$mt_do_load'(<clause>(0x7fc69a23b570),'/Users/cantor/tmp/ediprologeRom6T','/Users/cantor/tmp/ediprologeRom6T',temp,...),_5022,system:'$mt_end_load'(<clause>(0x7fc69a23b570))) at /Users/cantor/build/lib/swipl-7.7.17/boot/
init.pl:444
ERROR: [15] '$load_file'('/Users/cantor/tmp/ediprologeRom6T',temp,[expand(false),...]) at /Users/cantor/build/lib/swipl-7.7.17/boot/
init.pl:2044
ERROR: [7] <user>
ERROR:
ERROR: Note: some frames are missing due to last-call optimization.
ERROR: Re-run your program in debug mode (:- debug.) to get more detail.
^ Call: (20) call(system:'$mt_end_load'(<clause>(0x7fc69a23b570))) ?
I tried to find a way for years, but so far it seems work only
for the "user" module. I wanted it works for temporary modules
because of avoiding possible name coflicts of predicates
in the user module.
Kuniaki Mukai