X-Git-Url: https://git.hcoop.net/clinton/lisp-on-lines.git/blobdiff_plain/b7657b86f85f575d5776dc6b626b1dc258d1fa47..ec6dde1ef5ec97747c6ebfcc7f35b3d9da75843f:/src/attribute.lisp diff --git a/src/attribute.lisp b/src/attribute.lisp index 210b36d..a229aa3 100644 --- a/src/attribute.lisp +++ b/src/attribute.lisp @@ -69,7 +69,7 @@ (attribute-class :accessor attribute-class :initarg :attribute-class - :initform 'standard-attribute) + :initform 'standard-attribute) (keyword :layered-accessor attribute-keyword :initarg :keyword @@ -134,6 +134,12 @@ :layered t :special t))) +(define-layered-method attribute-active-p :around (attribute) + (let ((active? (call-next-method))) + (if (eq :when active?) + (not (null (attribute-value attribute))) + active?))) + (define-layered-method attribute-label-formatter :around (attribute) (or (slot-value attribute 'label-formatter) (attribute-value (find-attribute (attribute-description attribute) 'label-formatter)) @@ -284,7 +290,9 @@ (with-function-access (slot-value-using-class class attribute property)) (funcall fn layer (attribute-description attribute))) - (funcall fn layer (attribute-description attribute)))))) + (handler-case (funcall fn layer (attribute-description attribute)) + (error () + (warn "Error calling ~A" fn))))))) @@ -319,7 +327,7 @@ (defmacro with-attributes (names description &body body) `(let ,(loop for name in names collect (list name `(find-attribute ,description ',name))) - ,@body))q + ,@body))