minor formal improvements: use eql, print-unreadable-object, string in put with newlines

This commit is contained in:
Helmut Merz 2024-08-01 17:48:13 +02:00
parent 2111c7313a
commit dafce6f2d2
4 changed files with 12 additions and 9 deletions

View file

@ -18,5 +18,6 @@
(make-instance 'message :head head :data data :sender sender)) (make-instance 'message :head head :data data :sender sender))
(defmethod print-object ((msg message) stream) (defmethod print-object ((msg message) stream)
(format stream "<message ~s ~s <data ~s>>" (print-unreadable-object (msg stream :type t :identity t)
(shape:head msg) (sender msg) (shape:data msg))) (format stream "~s ~s <data ~s>"
(shape:head msg) (sender msg) (shape:data msg))))

View file

@ -56,16 +56,16 @@
(defun save (track) (defun save (track)
;(let ((cont ... ;(let ((cont ...
; (if (eq force-insert :always) (insert track) ; (if (eql force-insert :always) (insert track)
(let* ((*build-track-data* #'identity) ; keep hash-table for comparison (let* ((*build-track-data* #'identity) ; keep hash-table for comparison
(new-data (alx:plist-hash-table (shape:data track))) (new-data (alx:plist-hash-table (shape:data track)))
(cont (container track)) (cont (container track))
(found (query-last cont (shape:head-plist track))) (found (query-last cont (shape:head-plist track)))
(force-insert (force-insert-when cont))) (force-insert (force-insert-when cont)))
(if (or (null found) (eq force-insert :always)) (if (or (null found) (eql force-insert :always))
(insert track new-data) (insert track new-data)
(unless (equalp (shape:data found) new-data) (unless (equalp (shape:data found) new-data)
(if (eq force-insert :changed) (if (eql force-insert :changed)
(insert track new-data) (insert track new-data)
(update track new-data)))))) (update track new-data))))))
@ -112,10 +112,10 @@
(destructuring-bind (f v &optional op) spec (destructuring-bind (f v &optional op) spec
(unless v (unless v
(setf v "")) (setf v ""))
(when (eq f :time-stamp) (when (eql f :time-stamp)
(setf f :timestamp)) (setf f :timestamp))
(unless op (unless op
(setf op (if (eq f :timestamp) :>= :=))) (setf op (if (eql f :timestamp) :>= :=)))
(when (symbolp v) (when (symbolp v)
(setf v (string-downcase v))) (setf v (string-downcase v)))
(push (list op f v) crit))) (push (list op f v) crit)))

View file

@ -41,7 +41,9 @@
(dom:a '(:href "https://example.com" (dom:a '(:href "https://example.com"
:title "Demo" :class (:demo-link :plain)) :title "Demo" :class (:demo-link :plain))
"Link to example.com")) "Link to example.com"))
"<a href=\"https://example.com\" title=\"Demo\" class=\"demo-link plain\">Link to example.com</a>")) (format nil
"<a href=\"https://example.com\" title=\"Demo\" ~
class=\"demo-link plain\">Link to example.com</a>")))
(deftest test-server-config (server) (deftest test-server-config (server)
(== (parse-integer (server:port (core:config server))) 8899)) (== (parse-integer (server:port (core:config server))) 8899))

View file

@ -127,7 +127,7 @@
(put-char #\Space) (put-char #\Space)
(when val (when val
(put-string (string-downcase key)) (put-string (string-downcase key))
(when (not (eq val t)) (unless (eql val t)
(put-string "=\"") (put-string "=\"")
(put-string (attr-str key val)) (put-string (attr-str key val))
(put-char #\"))))) (put-char #\")))))