Customizing XPCE tools

I’ve asked before about extending the xpce tools and got the answer:

I’ve done my best over a day to read the docs, browse source, and get something very basic working. All I want to do to start is use pce_extend_class/1 to extend prolog_navigator to add some keybindings. And do this in .config/swi-prolog/init.pl.

I can’t even get a debug statement out confirming that anything is happening.

  :- pce_extend_class(prolog_navigator).

  % can I do this while extending? I couldn't find any details in the docs, nor examples in the source
  initialise(S, _) :->
    send(@prolog, write_term, initializing, [nl(true)]).

Thanks for any help.

1 Like

Hi, I don’t think you’ll get any replies for XPCE- related matters. Not from Jan anyways. But who knows…let’s wait and see…

I fully appreciate that my access to SWI-Prolog is a result of Jan’s efforts and charity.
I’m not owed anything.

I just wanted to see if anyone could offer direction.

@Marco are you suggesting there is a lack of interest/expertise in utilizing and extending XPCE and the existing XPCE tooling?

I do see in PRs that there is a lack of activity from 3rd parties (and lack of activity in general). I’m not suggesting I’d choose to build the next new shiny thing in XPCE, but I’d hope to be able to augment the many useful tools that are there.

1 Like

Extending classes can only be used to add new methods to a class. You’ll have to subclass prolog_navigator. Then you still have a problem as the tools will create a new instance of the original class.

If the key bindings make sense to other user, editing the file and send a PR is probably the simplest way t get your keybindings :slight_smile:

Be aware that xpce is old, mostly unmaintained code.

2 Likes

You see? You got your reply. I don’t know why but I had the feeling that your post would go unanswered…but I was wrong. Good for you

I am a such a weird person that I have studied the Xpce :slight_smile: and I appreciate it.

If you want to extend Navigator you’ll have to study how Xpce uses classes and subclasses to add functionality, you’ll need to understand object-oriented programming basics.

You can see the class you need to extend here. Run these in swipl with a GUI.
edit('c:/program files/swipl/xpce/prolog/lib/trace/browse.pl').

There is no better manual for Xpce than this, this is very thorough. Use also the Swipl>Help>Xpce Manual>Tools … these visual tools are good and documentation is good.
Xpce User Guide

FAQ of Xpce is here: (really old one!)
www_open_url('c:/program files/swipl/xpce/man/faq/faq.html').

Also there is the case that professor Anjewierden has passed away, I believe he was the original main developer of Xpce.

3 Likes