Storing corrected query in history

I’m finding the correction suggestion for predicates helpful when working in top level, esp. when dealing with modules.

I was wondering if it would be possible to “remember” the correction, so that when I hit arrow-up in history, the previously corrected query is used. Is there perhaps already a flag for this behaviour? If not, how would I go about adding this to SWI-Prolog?

That would indeed be useful. The correction code is in boot/dwim.pl. Interacting with the history is in boot/history.pl while the low-level command line editor is in packages/readline and packages/libedit, where the last one the default command line editor. Adding a new event is probably quite easy. Removing or modifying the last one probably requires extending the interface to libreadline and libedit, but I’m not sure.

If you figure it out, please also consider a down at the end of the history to predict the command by looking at the last commands :slight_smile: And notably the libedit one is mostly programmed in Prolog and thus you could do a lot smarter TAB-completion!