Import Oort Gnus v0.09.
[elisp/gnus.git-] / lisp / dgnushack.el
index 1554658..0f4041f 100644 (file)
             (if (funcall pred (car seq2) (car seq1))
                 (push (pop seq2) res)
               (push (pop seq1) res)))
-          (coerce (nconc (nreverse res) seq1 seq2) type)))))
+          (let ((x (nconc (nreverse res) seq1 seq2)))
+            (cond ((eq type 'list) (if (listp x) x (append x nil)))
+                  ((eq type 'vector) (if (vectorp x) x (vconcat x)))
+                  ((eq type 'string) (if (stringp x) x (concat x)))
+                  ((eq type 'array) (if (arrayp x) x (vconcat x)))
+                  ((and (eq type 'character) (stringp x) (= (length x) 1))
+                   (aref x 0))
+                  ((and (eq type 'character) (symbolp x)) 
+                   (aref (symbol-name x) 0))
+                  ((eq type 'float) (float x))
+                  ((typep x type) x)
+                  (t (error "Can't coerce %s to type %s" x type))))))))
 
   (define-compiler-macro copy-list (&whole form list)
     (if (and (fboundp 'copy-list)