Yes delete ![]()
Hi Jan
Thanks for the quick change; working nicely. I did see this debug output in the swipl-win console:
101 ?- Grabbing window (0xaaaaef4c4b40,epilog_dialog) (freed) lost?
Hi Jan
The Epilog terminal launched by the File - Shell menu in Emacs works well but I notice that terminating Prolog via the Epilog File - Halt prolog menu doesn’t clean up the same way as File - Halt prolog does when executed from the main console. Specifically a web server created by http_server/2 leaves a port open so that when I restart my application is see this:
ERROR: /home/mike/mifis/src/load.pl:17:
ERROR: Socket error: Address already in use
Warning: /home/mike/mifis/src/load.pl:17:
Warning: Goal (directive) failed: user:mifis_web_server
Thanks
Mike
Should work now. If epilog/0 was started from swipl, halting Prolog through the Epilog menu did not work.
Should be fixed too
Claude also found a memory leak while hunting this.
Hi Jan
I assumed you were on holiday rather than in hospital - I hope you are recovering well. So apologies for adding to your to do list, but halting Prolog from a standalone console is still not cleaning up my http socket. To be clear, the sequence is:
Start swipl-win with a load.pl that calls emacs/1
From emacs File - Shell
In the console that pops up File - Halt prolog
Then when I start swipl-win sr/load.pl again:
Cheers
Mike
That is surely a bit different scenario than what I assumed. Can you include a limimal load.pl? Also, I see two Epilog consoles. If these belong to the same process, how was the second (that you seem to use for halt) started?
Hi Jan
load.pl attached.
mike@meepi01:~/mifis$ sudo ss -tlnp sport = :3040
State Recv-Q Send-Q Local Address:Port Peer Address:Port Process
mike@meepi01:~/xxx$ swipl-win load.pl
mike@meepi01:~/xxx$ sudo ss -tlnp sport = :3040
State Recv-Q Send-Q Local Address:Port Peer Address:Port Process
LISTEN 0 64 0.0.0.0:3040 0.0.0.0:* users:((“bash”,pid=3651698,fd=43))
So after executing:
swipl-win load.pl
the console window appears as well as the emacs window. In the emacs window I select File - Shell creating a second console with a shell prompt. Then in that second console I select File - Halt prolog. After a short pause the windows all disappear and port 3040 is tied up.
Hope that helps.
Cheers
Mike
(attachments)
load.pl (184 Bytes)
Thanks. Should be fixed, There were two issues: the HTTP socket being ingerited by the shell and the shell not terminating when Prolog did.
Hi Jan
After I did a rebuild the problem persisted so I did a complete checkout and rebuild like this:
rm -rf ~/lib/swipl
cd ~
rm -rf swipl-devel
git clone --recurse-submodules https://github.com/SWI-Prolog/swipl-devel.git
cd swipl-devel
mkdir build
cd build
cmake -DCMAKE_INSTALL_PREFIX=$HOME -DCMAKE_BUILD_TYPE=PGO -G Ninja ..
cmake .
ninja
ctest -j $(nproc) --output-on-failure
ninja install
but things did not go well:
moded_path 0.572 0.000
det 0.221 0.000
eval 0.232 0.000
average 0.219 0.001
[2002/2412] Building C object packages/xpce/CMakeFiles/plugin_pl2xpce.dir/src/txt/terminal.c.o
FAILED: [code=1] packages/xpce/CMakeFiles/plugin_pl2xpce.dir/src/txt/terminal.c.o
/usr/bin/cc -Dplugin_pl2xpce_EXPORTS -I/home/mike/swipl-devel/build/packages/xpce -I/home/mike/swipl-devel/packages/xpce/src -I/home/mike/swipl-devel/src/os -I/home/mike/swipl-devel/src -isystem /usr/include/cairo -isystem /usr/include/freetype2 -isystem /usr/include/libpng16 -isystem /usr/include/pixman-1 -isystem /usr/include/pango-1.0 -isystem /usr/include/harfbuzz -isystem /usr/include/glib-2.0 -isystem /usr/lib/aarch64-linux-gnu/glib-2.0/include -isystem /usr/include/libmount -isystem /usr/include/blkid -isystem /usr/include/fribidi -isystem /usr/include/sysprof-6 -O3 -gdwarf-2 -g3 -std=gnu11 -fPIC -fvisibility=hidden -Wall -DHAVE_CONFIG_H -DSWI -D__SWI_PROLOG__ -pthread -MD -MT packages/xpce/CMakeFiles/plugin_pl2xpce.dir/src/txt/terminal.c.o -MF packages/xpce/CMakeFiles/plugin_pl2xpce.dir/src/txt/terminal.c.o.d -o packages/xpce/CMakeFiles/plugin_pl2xpce.dir/src/txt/terminal.c.o -c /home/mike/swipl-devel/packages/xpce/src/txt/terminal.c
/home/mike/swipl-devel/packages/xpce/src/txt/terminal.c: In function ‘rlc_open_pty_pair’:
/home/mike/swipl-devel/packages/xpce/src/txt/terminal.c:7782:61: error: ‘O_CLOEXEC’ undeclared (first use in this function); did you mean ‘FD_CLOEXEC’?
7782 | b->pty.slave_fd = open(b->pty.slave_name, O_RDWR|O_NOCTTY|O_CLOEXEC);
^~~~~~~~~
FD_CLOEXEC
/home/mike/swipl-devel/packages/xpce/src/txt/terminal.c:7782:61: note: each undeclared identifier is reported only once for each function it appears in
/home/mike/swipl-devel/packages/xpce/src/txt/terminal.c: In function ‘rlc_reclaim_pty’:
/home/mike/swipl-devel/packages/xpce/src/txt/terminal.c:7828:52: error: ‘O_CLOEXEC’ undeclared (first use in this function); did you mean ‘FD_CLOEXEC’?
7828 | int fd = open(b->pty.slave_name, O_RDWR|O_NOCTTY|O_CLOEXEC);
^~~~~~~~~
FD_CLOEXEC
[2007/2412] Building C object packages/xpce/CMakeFiles/plugin_pl2xpce.dir/src/txt/textbuffer.c.o
ninja: build stopped: subcommand failed.
Test project /home/mike/swipl-devel/build
Start 1: swipl:abi-version
Start 2: swipl:basic
Start 3: swipl:unprotected
Start 4: swipl:core
1/102 Test #1: swipl:abi-version … Passed 0.03 sec
Start 5: swipl:db
2/102 Test #4: swipl:core …***Failed 0.30 sec
ERROR: [Thread main] /home/mike/swipl-devel/tests/test.pl:1972: user:test test/0: Unknown procedure: argv_options/3
Start 6: swipl:attvar
3/102 Test #3: swipl:unprotected …***Failed 0.44 sec
ERROR: [Thread main] /home/mike/swipl-devel/tests/test.pl:1972: user:test test/0: Unknown procedure: argv_options/3
Start 7: swipl:debug
4/102 Test #5: swipl:db …***Failed 0.54 sec
ERROR: [Thread main] /home/mike/swipl-devel/tests/test.pl:1972: user:test test/0: Unknown procedure: argv_options/3
Start 8: swipl:tabling
Then it won’t work … Fixed. Right now developing under MacOS X …
Fixed. Thanks Jan.
A lot of new stuff has been pushed to git. Notably
- A lot more messages provide working clickable links to (predicate) source. For example, possible candidates if a predicate cannot be found lists these candidates as links. Also, the commandline debugger prints goals as links to the location where it is called if this can be inferred.
- Making a (short) selection in Epilog now provides the same feedback as (also recently added) incremental search and pre-arms incremental search, so you can use ^R/^S to find earlier/later occurrences of the same string/word.
- We adopted OSC 133 escape sequences to tell the terminal where the prompts, user input and process output live. Terminals that are sensitive to this (swipl-win’s Epilog) use this to theme the prompt and input and provide folding, copying, etc. of command output. There is a somewhat experimental resource
prolog_terminal.fold_previousthat allows folding the output of the previous command when we start executing a new command. This is current practice in SWI-Tinker, the WASM frontend. Other modern terminals may provide alternative feedback and styling based on these semantic marks.
The default for prolog_terminal.fold_previous is false. You can play with this by setting the GUI preference
prolog_terminal.fold_previous: @on
Please share your experience. I’m tempted to make folding the default as I think it greatly improves the toplevel experience.
The overall plan is to improve the toplevel by exploiting standard escape sequences of modern terminals and make the built-in Epilog terminal handle these and act on them in a Prolog friendly manner. A weak point in this plan are Emacs inferior processes. Ideally, these should also leverage these modern terminal sequences, but I have the impression they don’t :(. Hopefully they will as more and more CLI tools develop in this direction.
MacOS 15.6 (Sequoia), SWIP 10.1.14 (GUI version)
Nothing urgent. The GUI keeps improving but the console line editor is a bit clunky. Without going into details, I would expect the micro behaviour (i.e., response to mouse clicks and drags, key commands and presses) of editing the console input line would largely mimic the builtin file editor behaviour, but that’s not always the case, e.g., compare mouse-down, drag,mouse-up to make a selection, effect of paste or delete keys on a selection, etc.
I also find the momentary selection “status” at the bottom is a bit annoying., but maybe that’s just me. This doesn’t occur in other text windows.
I realize the console text window is a bit complicated since only the input line is editable; other content being read-only. So there some differences are inevitable.
Also no cut or undo shortcuts. A console window Edit menu (subset of editor Edit menu) would be nice, perhaps even expected.
I assume these observations apply to all platforms, not just MacOS.
Thanks for the observations. Most of this is indeed platform independent now. I pushed a number of enhancements:
- (MacOS) Use the MacOS central menu at the top of the display. Half a year ago, Codex thought this was not possible, but Claude thought it was and created Cocoa Objective C code to access the MacOS menu, maintain a MacOS copy of an xpce menu_bar, hiding the menu bar itself and relaying all MacOS actions back over the hidden menu bar. Seems to work pretty nice. This can be disabled using
menu_bar.native: @off - Using a commandline editor and terminal is a bit limited for mouse based interaction, but a lot can be realised anyway. As we have our own copy of libedit (needed for Windows, but it was enhanced quite a bit for all platforms too), I added undo. I also extended Epilog to not only translate click to position the caret, but also for handling selection based editing (delete, type, paste).
- The feedback overlay is now a bit smarter. It now displays at the top if you have the caret or selection at the bottom. It can be controlled using several preferences:
epilog_report.background: #0008 ! Last is alpha (transparency) epilog_report.colour: white epilog_report.hide_after: 5 ! seconds epilog_report.placement: smart ! or top, bottom, none
I have pushed as extensive number of changes to modernize the GUI. The main change is to allow for both tabs and splitting windows, providing tiled subwindows. PceEmacs now supports horizontal and vertical splits. “Panes” have a little icon at the top-right that allows re-arranging splits, moving panes to another window, etc. Basically all development tools participate in this UI, so we can create windows like this:
The system records window layouts you use and if it adds a new tool to the UI it will try to reuse your most commonly used layout for the current set of tools.
If you use the source version, please try and report your findings. There are surely enough rough edges to sort out!
Hi Jan. Looks great and certainly useful for me. A few rough edge reports as requested ![]()
-
Should it remember my window configuration between swipl sessions? I assume so because there is a “Forget how I arranged windows” option.
-
In a fresh swipl-win I pressed “Forget how I arranged windows” and this appeared on the launching terminal:
[PCE warning: display ->inform: Argument 1 (for):[visual]' expected, foundForgotten. New panes go where the arrangements that come
with the system say, until you arrange some windows yourself.’
in:
[ 5] M (0x62460d512fc0,error) ->display((0x62460d521c20,send_method), 1, for, [visual], Forgotten. New panes go where the arrangements that come
with the system say, until you arrange some windows yourself.)
[ 4] M (0x62460d521c20,send_method) ->error((0x62460d512fc0,error), 1, for, [visual], Forgotten. New panes go where the arrangements that come
with the system say, until you arrange some windows yourself.)
[ 3] M @display/display ->inform((nil), (nil), (nil))
[ 2] M @prolog_ide/prolog_ide ->forget_arrangements()
[ 1] M (0x62460c921180,pane_popup) ->execute((0x62460c7a4480,pane_menu_bar)) -
In PceEmacs you can vertically reduce the size of the menu bar to the point where it disappears and then you can’t get it back.
-
I can open files using emacs/1 but PceEmacs doesn’t show any tabs to allow navigation between them
Thanks. Should all be fixed. PceEmacs now got its own tab row inside the pane. Another major improvement is to restrict transfer of pixels to the actual window to the areas that have been modified. XPCE did do this to minimise the work on maintaining the Cairo window backing stores, but complete windows were transferred to SDL. Now only the damaged areas are transferred.
Of course, some regression is possible …
Should be ok now (as well as a lot of minor and more serious gitches I found today), Slowly bu steadily I think the environment is getting pretty good ![]()








