Index: /trunk/ccl/lib/macros.lisp
===================================================================
--- /trunk/ccl/lib/macros.lisp	(revision 337)
+++ /trunk/ccl/lib/macros.lisp	(revision 338)
@@ -252,5 +252,5 @@
                                      `(',condition ,fn))
                                    (list `',condition
-                                         `(require-type ,handler 'function)))))
+                                         `,handler))))
                            clauses))
         (cluster (gensym)))    
@@ -1707,5 +1707,5 @@
   (let ((method-combination '(standard))
         (generic-function-class 'standard-generic-function)
-        options methods option-keywords method-class)
+        options declarations methods option-keywords method-class)
     (flet ((bad-option (o)
              (signal-program-error "Bad option: ~s to ~s." o 'defgeneric)))
@@ -1715,5 +1715,6 @@
           (if (eq keyword :method)
             (push `(,defmethod ,function-name ,@(%cdr o)) methods)
-            (cond ((memq keyword (prog1 option-keywords (push keyword option-keywords)))
+            (cond ((and (not (eq keyword 'declare))
+			(memq keyword (prog1 option-keywords (push keyword option-keywords))))		   
                    (signal-program-error "Duplicate option: ~s to ~s" keyword 'defgeneric))
                   ((eq keyword :method-name)    ; used by generic-flet
@@ -1729,5 +1730,5 @@
                    (setq generic-function-class (%cadr o)))
                   ((eq keyword 'declare)
-                   (push (list :declare (cdr o)) options))
+		   (push (cadr o) declarations))
                   ((eq keyword :argument-precedence-order)
                    (dolist (arg (cdr o))
@@ -1747,4 +1748,6 @@
       (dolist (m methods)
         (push `(:method-class ,method-class) (cddr m))))
+    (when declarations
+      (setq options `((:declarations ,declarations ,@options))))
     (values method-combination generic-function-class options methods)))
 
@@ -2573,9 +2576,9 @@
 
 (defmacro with-terminal-input (&body body)
-  (let* ((old-owner (gensym)))
-    `(let* ((,old-owner (%request-terminal-input)))
+  (let* ((got-it (gensym)))
+    `(let* ((,got-it (%request-terminal-input)))
       (unwind-protect
 	   (progn ,@body)
-	(%restore-terminal-input ,old-owner)))))
+	(if ,got-it (%restore-terminal-input))))))
 
 (defmacro do-unexhausted-lisp-threads ((thread) &body body)
