+(when (featurep 'xemacs)
+ (defadvice byte-optimize-apply (before use-mapcan (form) activate)
+ "Replace (apply 'nconc (mapcar ...)) with (mapcan ...)."
+ (let ((last (nth (1- (length form)) form)))
+ (when (and (eq last (third form))
+ (consp last)
+ (eq 'mapcar (car last))
+ (equal (nth 1 form) ''nconc))
+ (setq form (cons 'mapcan (cdr last)))))))
+