anchor.diff:  (defmethod notebook-id ((book notebook))
     (file-namestring (file-name book)))
   
  +(defmethod default-package ((book notebook))
  +  (format nil "(defpackage ~s (:use :cl :fact-base :cl-notebook))" (notebook-name book)))
  +
   (defmethod notebook-name ((book notebook))
     (caddar (lookup book :b :notebook-name)))
  +
  +(defmethod notebook-package-spec ((book notebook))
  +  (let ((default (default-package book)))
  +    (handler-case
  +	(or (read-from-string (caddar (lookup book :b :notebook-package))) default)
  +      (error (e)
  +	(declare (ignore e))
  +	(read-from-string default)))))
  +
  +(defmethod notebook-package! ((book notebook))
  +  (let ((spec (notebook-package-spec book)))
  +    (or (find-package (second spec)) (eval spec))))
  +
  +(defmethod repackage-notebook! ((book notebook) (new-package string))
  +  (let ((package-form (read-from-string new-package))
  +	(package-fact (first (lookup book :b :notebook-package)))
  +	(old-name (package-name (namespace book))))
  +    (handler-case
  +	(progn (setf (namespace book) (rename-package (namespace book) (second package-form)))
  +	       (eval package-form)
  +	       (if package-fact
  +		   (change! book package-fact (list (first package-fact) :notebook-package new-package))
  +		   (insert-new! book :notebook-package new-package)))
  +      (error (e)
  +	(declare (ignore e))
  +	(setf (namespace book) (rename-package (namespace book) old-name))))))
   
   (defmethod rename-notebook! ((book notebook) (new-name string))
     "Takes a book and a new name.
  
positive.code:       (loop for entry = (fact-base::read-entry! s) while entry
  	 do (incf (fact-base::entry-count book))
  	 do (fact-base::apply-entry! book entry)))
      (register-notebook! book)))
  
  (defmethod kill! ((book notebook))
  
negative.code:   (let* ((name-fact (first (lookup book :b :notebook-name)))
  	 (same? (equal (third name-fact) new-name)))
      (unless same?
        (change! book name-fact (list (first name-fact) :notebook-name new-name))
        (unless (lookup book :b :package-edited?)
  	(repackage-notebook! book (default-package book))))
      (values book (not same?))))
  
  ;;;;;;;;;; Notebooks table and related functions
  