The history file is determined by dir_history_file/2 in library(prolog_history). The name is not a hash, but the base32-encoding of the absolute file name. Upper or lower case should not matter. The predicate is bi-directional, so you can find the project directory from the file and the other way around.
Dealing with the old history is probably something that should be fixed. Should not be too hard. It will write in the new format though, so you cannot jump forward and backward easily. The libedit format uses a bit proprietary encoding of characters that is not easy to handle without libedit (at least, not for non-ASCII).
If you want to share the init.pl file, use e.g.,
:- if((current_prolog_flag(version, V), V >= 90333)).
<code>
:- endif.
The history is saved on program exit. How do you terminate Prolog? I normally use Ctrl-D (end-of-file) in the console. That seems to work fine. Note there is a flag save_history that should be set to true. If it is not, something is wrong ā¦
Thanks! I missed that predicate, and the entire library too. Iāll go have a look.
I think if the history is only (easily) backwards compatible nobody will complain. I sure wonāt. If I can get my old history in the new version thatās all I need. I think for most people theyāll tend to upgrade monotonically, as it were, but of course thatās something for the community to discuss.
I have two main ways that I usually terminate Prolog:
enter ?- halt.
Cause a catastrophic error.
Iām used to losing the last few lines of history when 2. happens.
I got the save_history flag set to true in v.9.3.24 and in v.9.3.33.
Btw, forgot to say:
Yeah, I think thatās nice to have
Edit: Actually, I think I didnāt understand what you mean by ānumbered history accessā. You mean by !<number>?
Btw, I noticed that in some SWI versions you get a number at the start of a new prompt line. I mean that if a query terminates and then the listener returns to the ?-, thereās a number at the start of the line like 2 ?- . I think I only see that in the OS terminal sessions, not in the IDE, but at this point Iām a bit confused about which version does what so Iād have to check, sorrry!
Is that query numbering related to the lines in the history file also?
Probably a lot of it should be rewritten. There is too much history in the history implementation Now everything seems to have a solid common ground on all platforms, so we can delete and simplify a lot of stuff.
Thanks. Iāll check that out. Ctrl-D is shorter and (AFAIK) works.
History ⦠Before all this began and commandline editors were not common, history was based on storing commands in the Prolog database and allow reused using !<expr>. Then commandline editors came into place. By default, the commandline editor takes over and !!, etc are gone. Using
:- set_prolog_flag(history, 50).
Both are enabled and kept in sync. Given the current state it might be better to remove the old pure Prolog history and integrate !! expansion with the commandline editor. That would remove quite a bit of very old code
Hey, I wonder if I managed to confuse you with my awful sense of humour. I realise that my previous comment could be interpreted as saying that after halt I get a ācatastrophic errorā. What I meant was that I usually exit Prolog with halt, but sometimes I manage to crash the console so I āterminate Prologā that way instead. I donāt think Iāve ever seen the console crash after halt.
I was not confused Actually, there is a problem with halt executed in the context of the Epilog consoles. Try
swipl-win -g "mygoal,halt"
That does crash I know why, but I still have to find an elegant solution.
P.s. Todayās Windows binaries give you a native file dialog for the Epilog file related actions. Works (for me) on Windows-11, MacOS and Fedora Linux using Gnome.
Oh. OK, yeah, that crashes. Funny thing, Iāve seen something like that before but I think it was exit status 4. It happens occasionally but Iām not sure when.