NoteCards visited a website for the first time

Success!

My WebCard prototype made NoteCards visit a site on the World-Wide Web for the first time. Think of it as a wormhole that connects the old world of hypertext with the new world of the modern web. WebCard, a NoteCards extension for visiting websites, is my RetroChallenge 2024 project.

This is my Linux desktop just after NoteCards visited a website for the very first time:

NoteCards and the Firefox window of the first website visited by NoteCards via WebCard.

The Table of Contents window near the bottom left of the screen is a filebox of a NoteCards hypertext. Under “NOTE CARDS” the filebox container card lists a link icon, a clickable area that leads to the indicated card “Medley Interlisp Project”. This card of type Web inherits from the type Text and holds a URL to visit.

When I clicked on “Medley Interlisp Project”, WebCard opened the corresponding card — blank in the screenshot — next to the Table of Contents. Then WebCard commanded Firefox to visit the URL https://interlisp.org stored in the card. The window of Firefox, already running, came to the foreground and displayed the website in a new tab.

This milestone comes after fixing a bug in the Web card constructor. To put my core idea to the test I deferred some non essential refinements and went straight for the website visiting functionality.

How does the functionality work? The NoteCards API provides a hook to override the operation of traversing links to specific types of card. To this effect WebCard sets an alternate function as the value of the LinkIconLeftButtonFn property of the symbol Web that names the type. NoteCards calls the alternate function when a clicked link has a Web card as the destination.

WebCard's alternate function is WCD.TraverseWebLink. It fetches the URL from a card, displays the card, and opens the URL in the system browser.

The screenshot shows both the Web card, next to the Table of Contents, and the code of WCD.TraverseWebLink in the Lisp editor at the top center. The comment, however, is out of date after fixing a series of issues.

What went wrong? A combination of misunderstandings and incomplete information made WebCard generate argument type errors, as I wasn't sure about the arguments of WCD.TraverseWebLink. On top of this, I called the internal function NC.TraverseLink that implements the default link traversal but I ended up not needing anyway.

Reading the sources of a few NoteCards functions cleared all doubts. To fix the issues I updated the code of WCD.TraverseWebLink but not the comment as I was eager for a test run.

The WebCard prototype is crude, but it works and validats my strategy of overriding the link traversal behavior.

An alternative I initially considered is to advise the NoteCards API functions for opening and displaying cards. However, unlike overriding link traversal which the API fully supports, advising is a fragile kludge that works around the API.

Now that the core feature of WebCard is in place I can continue the development.

WebCard is far from complete. There's still work to do to override editing Web cards, extend Web card construction, deal with input validation and error handling, check for visited URLs, and customize the bitmap of Web link icons. WebCard needs documentation and demo notefiles too.

#WebCard #Interlisp #Lisp

Discuss... Email | Reply @amoroso@fosstodon.org