I would like to increase the length of the swi prolog top-level history but I can’t find how to do it.
I’m on linux, so I suppose that swi prolog is using the readline library to store the history.
I managed to find the history files in ~/.config/swi-prolog/dir-history as documented here.
But none of the history files I have exceed 101 lines which makes me thing that the length of my history is 100 but I can’t find anywhere how to configure this ?
Readline manual says that when not configured the history length is unlimited.
So the weird thing is that the readline manual states that when not set, the history size is not limited:
Set the maximum number of history entries saved in the
history list. If set to zero, any existing history
entries are deleted and no new entries are saved. If set
to a value less than zero, the number of history entries
is not limited. By default, the number of history entries
is not limited. If an attempt is made to set history-size
to a non-numeric value, the maximum number of history
entries will be set to 500.
Since I don’t have a ~/.inputrc file, I believe readline only reads /etc/inputrc, which on my system (fedora) does not set the history-size setting.
It would be nice know why my history is limited to 100 by default…
I suppose I’ll have to spend some time configuring readline now.
I’m more on the Vim camp myself Which also provide unlimited scrollback.
But the problem is that I often restart vim which I know is not the habit of people using emacs ^^
By the way, is emacs shell able to capture the history of swi prolog queries ? like how readline does ?
# do not bell on tab-completion
#set bell-style none
set meta-flag on
set input-meta on
set convert-meta off
set output-meta on
# Completed names which are symbolic links to
# directories have a slash appended.
set mark-symlinked-directories on
# for linux console and RH/Debian xterm
# commented out keymappings for pgup/pgdown to reach begin/end of history
# for rxvt
# for non RH/Debian xterm, can't hurt for RH/DEbian xterm
# for freebsd console
FWIW, in the Sweep top-level (also in Emacs), you have top-level specific history (not mangled with the shell’s history) and you can control how and when history is persisted (see Top-level History (Sweep: SWI-Prolog Embedded in Emacs)). It is also a comint-mode derivative, just like shell-mode, so all the usual comint commands work (such as M-p and M-n for cycling through history). But unlike shell-mode, it has a bunch of Prolog-specific goodies
No using Emacs, history on non-Windows is provided by GNU readline or BSD editline, using the latter as default. History management is explicit in Prolog itself and controlled by the flag history. So, I think this should help in ~/.config/swi-prolog/init.pl:
:- set_prolog_flag(history, 1000).
I use 50, which sets the prompt to 100 and scrolling back it seems it restores the 50 entries as 50…100. 1…50 would have been cleaner …