# Progressing the SWI-Prolog environment

**URL:** <https://swi-prolog.discourse.group/t/progressing-the-swi-prolog-environment/9090>\
**Category:** Request For Comments\
**Tags:** xpce, ide, gui\
**Created:** [July 4, 2025, 7:48am UTC](https://swi-prolog.discourse.group/t/progressing-the-swi-prolog-environment/9090 "2025-07-04T07:48:25Z")\
**Posts on this page:** 1\
**Showing post:** 49

<div class="post-metadata">

**Author:** ![stassa.p](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/stassa.p/32/712_2.png) [@stassa.p](https://swi-prolog.discourse.group/u/stassa.p)\
**Post date:** [October 31, 2025, 11:56am UTC](https://swi-prolog.discourse.group/t/progressing-the-swi-prolog-environment/9090/49 "2025-10-31T11:56:29Z")

</div>

Uh oh, I see I posted my previous comment about history in this thread by mistake. I meant to post it in this new topic:

> [@Command line history gone](https://swi-prolog.discourse.group/t/command-line-history-gone/9365):
>
> I reported some issues I had with the new SWI version 3.33 in this thread: To be able to work as fast as before while I get used to the new Epilog console and editor, I’ve re-installed my previous Prolog version, 9.3.24, alongside the new one. After I did that, I noticed that I no longer have any command-line history in any of my Prolog projects. What I mean by that is that up-arrow doesn’t fill in any commands, and ?- !!. says there’s nothing there: 1 ?- !!. ! No such event ! No such even…

Apologies for the confusion. I guess the newer topic can be merged into this one?

> [@jan](#):
>
> I think that explains some of the situation. If the system has a commandline editor, it by default does not initialize the `!!` based history. That is mainly because some people do not like that `!` can get ambiguous at the toplevel. You can enable `!!` based history using
> 
> ```prolog
> :- set_prolog_flag(history, 50).
> 
> ```
> 
> in your `init.pl` (adjust 50 to the number of commands you want to be recalled).

I added that in my init.pl file in an effort to resolve my history issues, but I still don’t get any history in the newer versions (9.3.24 and 9.3.33, which I keep referring to as 3.33- sorry).

Btw, I guess all versions pick up the same `init.pl` file so that could cause trouble, for instance if there’s a `readline` setting for one version that’s not supported by another. Is there a way to have an `init.pl` file specific to a version, e.g. in a folder named the same as a version? Sounds hacky though.

> [@jan](#):
>
> Next, the versions before the move the SDL used a little Win32 console I wrong ages ago in native Windows code. The new one uses the Epilog terminal emulator in xpce and then uses BSD libedit for the commandline editor. The `_HiStOrY_V2_` comes from the history save/load of this commandline editor. Before that, the old console used a different format for saving the history.

Thanks, that clarifies things a bit. So the history files written by earlier versions (prior to the switch to SDL?) can’t be read, or updated by, newer versions (after the switch)?

> [@jan](#):
>
> - Remove (or empty) the `dir-history` directory in the config dir to get rid of the old history
> - Make sure there is no setting for the `readline` Prolog flag in `init.pl`.

So that’s where the history is! The hint is in the name I guess 😅

I can also see a `dir_history.bak` for backup I guess.

I had a look in my `dir_history` and there’s a bunch of files (40 of them) in there that hold the history for all my projects going back to 2022. They’re just plaintext files so I can see all the stored commands in my text editor. I like that! But if I remove `dir-history` then I lose all of them. _That_ I don’t like!

The files in `dir_history` are named with hashes that I’m guessing must record the path to the directory of the Prolog session that created the history file. Is that correct?

Is there a way to re-activate those history files, and make them available to their respective SWI-Prolog sessions again in the newer SWI-Prolog versions? By “respective” I mean any SWI-Prolog session starting from the same directory as the session that originally created the history file (assuming my model about that is correct)?

I would really like to be able to hold on to my command history. I start so many different projects that it’s difficult to remember what I was doing in every one. I usually document the important queries but not always.

Clearly, I have some attachment issues. 😝

---

_[View the full topic](https://swi-prolog.discourse.group/t/progressing-the-swi-prolog-environment/9090)._
