Slime inspector customization

Gitsis Christos cgitsis at gmail.com
Sat Jan 14 22:44:58 UTC 2017


Hello,

Here follows Common Lisp code, using a datastore library named
bknr.datastore

    (ql:quickload :bknr.datastore)

    (defclass userdata (bknr.datastore:store-object)
      ((email :initarg :email
     :index-type bknr.indices:unique-index
     :index-values all-users)
       (name :initarg :name))
      (:metaclass bknr.datastore:persistent-class))

    (let ((object-subsystem (make-instance
'bknr.datastore:store-object-subsystem)))
      (make-instance 'bknr.datastore:store
    :directory *default-pathname-defaults*
                     :subsystems (list object-subsystem)))

    (make-instance 'userdata :email "m at b.com" :name "Maria")
    (make-instance 'userdata :email "k at g.com" :name "Katerina")

    (setf (slot-value (first (all-users)) 'name) "Elena")
    ; Attempt to modify persistent slot NAME of #<USERDATA ID: 0> outside
of a transaction
    ;   [Condition of type
BKNR.DATASTORE::PERSISTENT-SLOT-MODIFIED-OUTSIDE-OF-TRANSACTION]

    (bknr.datastore:with-transaction ()
      (setf (slot-value (first (all-users)) 'name) "Elena"))
    ; runs successfully, the above wrap in with-transaction () is necessary

I use the Slime inspector to view the datastore, so in the minibuffer after
C-c C-I Inspect value (evaluated):
I input
    (all-users)

I can see the data but not edit it in the slime inspector, because the same
condition is thrown as above.

Can the slime inspector be customized in a way that it wraps calls to setf
inside transactions?

PS: if you run the above code, a directory named "current" will be created
in your lisp's working directory. It saves the datastore on disk.

Thank you,
Christos Gitsis
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/slime-devel/attachments/20170115/3141fddd/attachment.html>


More information about the slime-devel mailing list