3

I've installed SWI-Prolog and Emacs' prolog mode. I have a first_steps.pl file with prolog in it, and I do C-c C-b to consult the buffer. This opens a second buffer, *prolog*, whose mode is (Inferior Prolog: run).

All well and good. However, it's completely unclear how to interact with that inferior prolog mode buffer. There is no prompt. Typing things and pressing return does nothing. How can I execute queries based on the code consulted from the buffer, i.e, interact with SWI-prolog?

Note that this related question does not seem to address usage of the inferior mode, only installation of prolog mode: Using prolog with emacs

Erik Kaplun
  • 37,128
  • 15
  • 99
  • 111
Jake
  • 2,852
  • 7
  • 32
  • 39
  • It's hard to tell the exact nature of the problem, but please confirm that you see something like this in the inferior Prolog buffer: `?- % /tmp/prolcomp18321k_m.pl compiled 0.00 sec, 2 clauses true.` – Daniel Lyons May 07 '13 at 19:36
  • Thanks. Yes, I see that, but in the emacs command buffer, not the prolog buffer. The prolog buffer remains blank. It wrote it to var/folders/.... – Jake May 08 '13 at 15:16
  • I think for this one you need to find somebody who can look over your shoulder and see what's going on with the screen while you're using it. – Daniel Lyons May 08 '13 at 15:25
  • You should have two buffers: one file buffer in Prolog mode and one inferior prolog buffer. You'll type your code in the file buffer but then interactively query the inferior prolog buffer. C-c C-b throws you into the inferior prolog buffer so you should be able to just type a query after that and get a response. – Daniel Lyons May 08 '13 at 15:27
  • Thanks Daniel. I am doing that, but the inferior prolog window doesn't do anything in response to the things I type there, and it's not clear what the incantation is. In the file buffer, I have a definition for a conc predicate (list concatentation). I do C-c C-b, and that says that it wrote the temp file, and puts me in the inferior buffer. In the inferior buffer, I type conc([], [], L). and press enter. Nothing happens. There's also no prompt. Is there a special key sequence to get it to process what I typed as a query? – Jake May 08 '13 at 15:33
  • On my computer, it either works fine, or it says it couldn't launch Prolog. It never silently fails. Hence, I think you need in-person help. – Daniel Lyons May 08 '13 at 15:39
  • Ok thanks. Could you tell me what you see in the inferior process? Does it just give you a prompt like the command-line swipl program? – Jake May 08 '13 at 15:46
  • More or less: `Welcome to SWI-Prolog (Multi-threaded, 64 bits, Version 6.2.2) Copyright (c) 1990-2012 University of Amsterdam, VU Amsterdam SWI-Prolog comes with ABSOLUTELY NO WARRANTY. This is free software, and you are welcome to redistribute it under certain conditions. Please visit http://www.swi-prolog.org for details. For help, use ?- help(Topic). or ?- apropos(Word). ?- % /tmp/prolcomp12345C2y.pl compiled 0.00 sec, 4 clauses true.` – Daniel Lyons May 08 '13 at 15:48
  • There are some newlines in there but that's the gist of it. – Daniel Lyons May 08 '13 at 15:49
  • let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/29610/discussion-between-daniel-lyons-and-jake) – Daniel Lyons May 08 '13 at 15:49
  • Ah I see. So mine is definitely just failing to start up silently. Ok, thanks very much for the help. – Jake May 08 '13 at 15:49
  • Enter the chatroom, maybe we can beat it into working... – Daniel Lyons May 08 '13 at 15:52

1 Answers1

0

In my case, I changed the variable prolog-program-name to use the full path to my swipl executable, then it was fine. Emacs might just not be able to find your interpreter.

Thirumalai murugan
  • 5,698
  • 8
  • 32
  • 54