0

I am putting together a modification of a library that contains an existing cl-defstruct definition, and I am having problems redefining it after its initial evaluation.

Q:  How can I replace the old definition with the new one? [It would be nice if I could wrap it in something so that eval-buffer, eval-region, and/or require will be sufficient to force its re-definition.]

BEFORE:

(cl-defstruct
  (undo-tree-node
   (:type vector)   ; create unnamed struct
   (:constructor nil)
   (:constructor undo-tree-make-node
                 (previous undo
      &optional redo
                  &aux
                  (timestamp (current-time))
                  (branch 0)))
   (:constructor undo-tree-make-node-backwards
                 (next-node undo
      &optional redo
                  &aux
                  (next (list next-node))
                  (timestamp (current-time))
                  (branch 0)))
   (:copier nil))
  previous next undo redo timestamp branch meta-data)

AFTER:  Adding the word count at the very end.

(cl-defstruct
  (undo-tree-node
   (:type vector)   ; create unnamed struct
   (:constructor nil)
   (:constructor undo-tree-make-node
                 (previous undo
      &optional redo
                  &aux
                  (timestamp (current-time))
                  (branch 0)))
   (:constructor undo-tree-make-node-backwards
                 (next-node undo
      &optional redo
                  &aux
                  (next (list next-node))
                  (timestamp (current-time))
                  (branch 0)))
   (:copier nil))
  previous next undo redo timestamp branch meta-data count)
lawlist
  • 19,106
  • 5
  • 38
  • 120
  • AFAIK there's no need to do anything special, it just works, same as for defun. If it doesn't, please report it as a bug. – Stefan Apr 26 '17 at 14:49
  • @Stefan -- Thank you. Hmmmm.... Perhaps something else in the same library is being set (when the library loads) that is dependent upon the initial definition and that something also needs to be redefined. I'll work on tracking it down. – lawlist Apr 26 '17 at 14:55
  • 2
    cl-defstruct creates a bunch of inlined functions, redefining updates those definitions but not their call sites. – npostavs Apr 26 '17 at 15:15

0 Answers0