Listing/1 - Expected module variable to be bound to module name

Currently using SWI-Prolog (threaded, 64 bits, version 8.3.8) on Windows 10 but can upgrade if needed.

Side note explaining how I bumped into this predicament.
In using multifile/1 the code was not working as expected until I realized that multifile/1 does not mean multiple modules. In other words the modules for the predicate had to be the same module name even though the predicates are in multiple files. Or as more of a matter of fact, putting code in modules by default then using multifile, one has to remember that while the predicate name may be the same, the module name can be different and you have to think about the actual module name when the call is made.

Out of curiosity I decided to use listing/1 with a variable for the module to see the module names for the predicates in the various files. Here is an example that shows a multifile predicate displayed using listing/1 with M for the module name.

?- make.
?- listing(M:goal_expansion/4).

Upon running listing/1 was expecting M to be bound to the module name(s). To my surprise, M was not even displayed in the output.

I checked the documentation for listing/N and found nothing that could clear up my confusion.

  1. Am I using listing/1 as intended?
  2. What can be done to see the module names for multifile predicates using listing/1?
  3. Should there be a warning about multifile predicates that have different module names when compiling (think make/0) ?

I seem to recall a similar discussion but can not find the topic.