I have been trying to install SWI-prolog today and everything seems to work fine except for the arrow up/down keys not working as expected across sessions. If i load the prolog terminal with swipl the terminal saves the history from that session, but when I close that session and start a new one the history is gone. I never had this problem on my old Mac. I am currently on an M1 pro. I have tried installing via the website both the stable and development versions and I have tried installing via Homebrew. With all of them I have this problem. It is very likely that it doesn’t have to do with the application at all but I don’t really know what I can try to get this functionality working. If anyone can provide some ideas that would be great.
There are a few things to check
- I assume up/down arrow for history works in a single session? If not, no command line editor is configured.
- History must be enabled, typically by setting the Prolog flag
history
in~/.config/swi-prolog/init.pl
, e.g.:- set_prolog_flag(history, 50).
to remember the last 50 commands. - The history is kept in
~/.config/swi-prolog/dir-history/
. If this is not writeable, the history is silently discarded. You can check that stopping Prolog creates or updates a file in this directory.
Thank you, my problem was solved with a simple $sudo chown -R .config. I suggest people that run into this problem try that first. In my case there wasn’t even a .config/swi-prolog directory to begin with because for some reason the permissions were not right. Off topic but I like prolog and how involved you are with this forum Jan, keep up the great work
1 Like