Search code examples
emacsswi-prologxpce

Turn off XPCE in SWI-Prolog


I'd like to get the output of apropos/1 and help/1 etc. inside my Emacs buffer, instead of an XPCE window. I'm using SWI-Prolog under Linux.

What I have tried:

  • Setting flags in the init file (~/.plrc):

    :- set_prolog_flag(gui, false).
    :- set_prolog_flag(xpce, false).
    
  • Calling swipl with the --nopce flag (a wild guess looking at /usr/lib/swi-prolog/xpce.rc)

  • ssh localhost, effectively emulating a terminal-only machine, which worked, but there must be a better solution...

And yes, I could just uninstall the swi-prolog-x package, but I may want to write GUI programs in the future. Ideally I would like to turn off the GUI only for the documentation / debugging.

EDIT:

I've found out part of the solution: the goals online_help:give_help/1 and online_help:give_apropos seem to be what I need. I just need to re-hook these onto help and apropos, maybe via prolog:help_hook/1. Any ideas?


Solution

  • [~]# unset DISPLAY
    
    swipl --nopce 
    

    This a an undocumented flag... Normally it is only used when building the system/