fix: org tangle — fix END_SRC boundaries in mouse.org/slot.org (prose inside code blocks), replace emacs tangle with Python script that handles all blocks
This commit is contained in:
17
org/slot.org
17
org/slot.org
@@ -51,11 +51,26 @@ Slot modes:
|
||||
(setf (gethash key *slots*)
|
||||
(sort (cons (cons order render-fn) entries) #'< :key #'car))))
|
||||
render-fn)
|
||||
#+END_SRC
|
||||
|
||||
*** Bug Fixes (v1.0.0): nil handler guard in slot-render
|
||||
|
||||
~slot-render~ called ~(apply (cdr entry) args)~ unconditionally, but
|
||||
~defslot~ stores ~(order . render-fn)~ pairs where ~render-fn~ can be
|
||||
~nil~ (if called without ~:render-fn~). This caused a type error when
|
||||
~apply~ received ~nil~ as the function argument.
|
||||
|
||||
Fix: Check ~(when fn)~ before calling ~apply~. Entries with a nil
|
||||
handler are silently skipped.
|
||||
|
||||
#+BEGIN_SRC lisp :tangle ../src/components/slot.lisp :noweb no
|
||||
(defun slot-render (slot-name &rest args)
|
||||
(let ((entries (gethash (string slot-name) *slots*)))
|
||||
(when entries
|
||||
(mapcar (lambda (entry) (apply (cdr entry) args)) entries))))
|
||||
(mapcar (lambda (entry)
|
||||
(let ((fn (cdr entry)))
|
||||
(when fn (apply fn args))))
|
||||
entries))))
|
||||
|
||||
(defun slot-p (slot-name)
|
||||
(nth-value 1 (gethash (string slot-name) *slots*)))
|
||||
|
||||
Reference in New Issue
Block a user