anchor.diff:    "Returns the category whose id is id (a number)."
     (gethash id *id->category*))
   
  +(defun name->category (name)
  +  "Returns the category whose name (assumed to be properly **canonized**) is name."
  +  (gethash name *name->category*))
  +
   (defun canonize-category-name (name)
  -  (typecase name
  -    (string (intern name *package*))
  -    (symbol (if (eq (symbol-package name) (find-package :keyword))
  -		(intern (symbol-name name) *package*)
  -		name))
  -    (t (error 'bad-category-type-error :name name))))
  +  (let ((use-name 
  +	 (typecase name
  +	   (string (intern name *package*))
  +	   (symbol (if (eq (symbol-package name) (find-package :keyword))
  +		       (intern (symbol-name name) *package*)
  +		       name))
  +	   (t (error 'bad-category-type-error :name name)))))
  +    (when (not (or (name->category use-name)
  +		   (logical-connective-p use-name)))
  +      (error 'simple-category-not-found-error :name name))
  +    use-name))
   
   (defun canonize-category-specification (specification)
     (labels ((doit (x)
  
positive.code: 
  (defun handle-message (id message &rest args)
    (declare (dynamic-extent args))
    (dolist (sender (log5-senders (log-manager)))
      ;; check for new category and fix things up
      (when (>= id (length (active-categories sender)))
        ;;?? how pricy is this?
        (update-active-categories sender id))
      (when (= (aref (active-categories sender) id) 1)
        (funcall (handle-message-fn sender) id sender
  	       (if args (apply #'format nil message args) message)))))
  
  (defun update-active-categories (sender max-id)
    (let ((current-max-id (length (active-categories sender)))
  	(new-array (adjust-array (active-categories sender) (1+ max-id))))
      (loop for index from current-max-id to max-id do
  	 (setf (aref new-array index)
  	       (if (sender-responds-to-category-p
  		    (category-spec sender) 
  		    (id->category index)) 1 0)))
      (setf (slot-value (first (log5:senders)) 'active-categories)
  	  new-array)
      sender))
  
  
  #|
  
negative.code: 
  (defcategory :fatal)
  (defcategory :error)
  (defcategory :error+ (or :error :fatal))
  (defcategory :warn)
  (defcategory :warn+ (or :warn :error+))
  (defcategory :info)
  (defcategory :info+ (or :info :warn+))
  (defcategory :trace)
  (defcategory :trace+ (or :trace :info+))
  (defcategory :dribble)
  (defcategory :dribble+ (or :dribble :trace+))
  
  #|
  (defoutput message ...)
  