v0.8.0: tangle to XDG (~/.local/share/cl-tty/), remove stale memex .lisp files

This commit is contained in:
2026-05-18 13:04:10 -04:00
parent e3415cee73
commit af572d5a8c
67 changed files with 518 additions and 6301 deletions

View File

@@ -50,7 +50,7 @@ same slot with conflicting mode specifications.
The package provides the public API and exports all slot system symbols.
Clients :use this package or refer to symbols qualified.
#+BEGIN_SRC lisp :tangle ../src/components/slot-package.lisp
#+BEGIN_SRC lisp :tangle ~/.local/share/cl-tty/src/components/slot-package.lisp
(defpackage :cl-tty.slot
(:use :cl)
(:export
@@ -73,7 +73,7 @@ case-insensitive lookup via ~equal~). Each value is a plist:
The ~:test #'equal~ ensures that ~:sidebar~ and ~"sidebar"~ map to the
same key.
#+BEGIN_SRC lisp :tangle ../src/components/slot.lisp
#+BEGIN_SRC lisp :tangle ~/.local/share/cl-tty/src/components/slot.lisp
(in-package :cl-tty.slot)
(defvar *slots* (make-hash-table :test 'equal)
@@ -97,7 +97,7 @@ The mode parameter is validated on first call via ~assert~ and then
frozen for subsequent calls. This prevents a later registration from
changing the slot's semantics out from under earlier registrations.
#+BEGIN_SRC lisp :tangle ../src/components/slot.lisp
#+BEGIN_SRC lisp :tangle ~/.local/share/cl-tty/src/components/slot.lisp
(defun defslot (name &key (order 0) render-fn (mode :stack))
(let* ((key (string name))
(slot (gethash key *slots*)))
@@ -143,7 +143,7 @@ changing the slot's semantics out from under earlier registrations.
Returns ~nil~ if the slot has no registrations or if the handler is nil.
#+BEGIN_SRC lisp :tangle ../src/components/slot.lisp
#+BEGIN_SRC lisp :tangle ~/.local/share/cl-tty/src/components/slot.lisp
(defun slot-render (slot-name &rest args)
(let ((slot (gethash (string slot-name) *slots*)))
(when slot
@@ -169,7 +169,7 @@ Uses ~nth-value 1~ of ~gethash~ which returns ~t~ if the key is
present (even if the value is ~nil~) or ~nil~ if absent. This is the
canonical Common Lisp idiom for testing hash-table membership.
#+BEGIN_SRC lisp :tangle ../src/components/slot.lisp
#+BEGIN_SRC lisp :tangle ~/.local/share/cl-tty/src/components/slot.lisp
(defun slot-p (slot-name)
(nth-value 1 (gethash (string slot-name) *slots*)))
#+END_SRC
@@ -180,7 +180,7 @@ Calls ~remhash~ to delete the slot's entry from the hash table
entirely. After this call ~slot-p~ returns false and ~slot-render~
returns nil for the given slot name.
#+BEGIN_SRC lisp :tangle ../src/components/slot.lisp
#+BEGIN_SRC lisp :tangle ~/.local/share/cl-tty/src/components/slot.lisp
(defun clear-slot (slot-name)
(remhash (string slot-name) *slots*))
#+END_SRC
@@ -191,7 +191,7 @@ Iterates over all hash keys in ~*slots*~ and returns them as a list.
Only slots that have been registered (i.e. have at least one entry)
appear in the result.
#+BEGIN_SRC lisp :tangle ../src/components/slot.lisp
#+BEGIN_SRC lisp :tangle ~/.local/share/cl-tty/src/components/slot.lisp
(defun list-slots ()
(loop for key being the hash-keys of *slots* collect key))
#+END_SRC
@@ -203,7 +203,7 @@ including mode-specific behavior.
*** Test Package and Suite
#+BEGIN_SRC lisp :tangle ../tests/slot-tests.lisp
#+BEGIN_SRC lisp :tangle ~/.local/share/cl-tty/tests/slot-tests.lisp
(defpackage :cl-tty-slot-test (:use :cl :cl-tty.slot :fiveam))
(in-package :cl-tty-slot-test)
@@ -213,7 +213,7 @@ including mode-specific behavior.
*** defslot-register: Registering a slot makes it visible
#+BEGIN_SRC lisp :tangle ../tests/slot-tests.lisp
#+BEGIN_SRC lisp :tangle ~/.local/share/cl-tty/tests/slot-tests.lisp
(def-test defslot-register ()
(clear-slot :test-slot)
(defslot :test-slot :order 1 :render-fn (lambda () "hello"))
@@ -225,7 +225,7 @@ including mode-specific behavior.
Verifies that ~:stack~ mode preserves multiple registrations and calls
them in ascending order sequence.
#+BEGIN_SRC lisp :tangle ../tests/slot-tests.lisp
#+BEGIN_SRC lisp :tangle ~/.local/share/cl-tty/tests/slot-tests.lisp
(def-test slot-render-calls ()
(clear-slot :test-slot)
(defslot :test-slot :order 1 :render-fn (lambda () "a"))
@@ -235,7 +235,7 @@ them in ascending order sequence.
*** slot-render-empty: Unregistered slot returns nil
#+BEGIN_SRC lisp :tangle ../tests/slot-tests.lisp
#+BEGIN_SRC lisp :tangle ~/.local/share/cl-tty/tests/slot-tests.lisp
(def-test slot-render-empty ()
(clear-slot :ghost)
(is-false (slot-render :ghost)))
@@ -243,7 +243,7 @@ them in ascending order sequence.
*** clear-slot-removes: Clearing a slot makes it absent
#+BEGIN_SRC lisp :tangle ../tests/slot-tests.lisp
#+BEGIN_SRC lisp :tangle ~/.local/share/cl-tty/tests/slot-tests.lisp
(def-test clear-slot-removes ()
(clear-slot :test-slot)
(defslot :test-slot :order 1 :render-fn (lambda () "x"))
@@ -256,7 +256,7 @@ them in ascending order sequence.
Verifies that ~:stack~ mode (default) accumulates entries across
multiple ~defslot~ calls.
#+BEGIN_SRC lisp :tangle ../tests/slot-tests.lisp
#+BEGIN_SRC lisp :tangle ~/.local/share/cl-tty/tests/slot-tests.lisp
(def-test stack-mode-multiple-entries ()
(clear-slot :stack-test)
(defslot :stack-test :order 1 :render-fn (lambda () "first"))
@@ -270,7 +270,7 @@ multiple ~defslot~ calls.
Verifies that ~:replace~ mode discards previous entries on each new
~defslot~ call.
#+BEGIN_SRC lisp :tangle ../tests/slot-tests.lisp
#+BEGIN_SRC lisp :tangle ~/.local/share/cl-tty/tests/slot-tests.lisp
(def-test replace-mode-last-wins ()
(clear-slot :replace-test)
(defslot :replace-test :mode :replace :order 1 :render-fn (lambda () "old"))
@@ -282,7 +282,7 @@ Verifies that ~:replace~ mode discards previous entries on each new
Verifies that ~:single-winner~ mode ignores subsequent registrations.
#+BEGIN_SRC lisp :tangle ../tests/slot-tests.lisp
#+BEGIN_SRC lisp :tangle ~/.local/share/cl-tty/tests/slot-tests.lisp
(def-test single-winner-mode-first-wins ()
(clear-slot :winner-test)
(defslot :winner-test :mode :single-winner :order 1
@@ -297,7 +297,7 @@ Verifies that ~:single-winner~ mode ignores subsequent registrations.
Verifies that clearing a slot removes the mode lock, so a subsequent
~defslot~ can set a new mode.
#+BEGIN_SRC lisp :tangle ../tests/slot-tests.lisp
#+BEGIN_SRC lisp :tangle ~/.local/share/cl-tty/tests/slot-tests.lisp
(def-test clear-slot-removes-mode ()
(clear-slot :mode-test)
(defslot :mode-test :mode :replace :render-fn (lambda () "only"))