- (when package
- (format stream "~&(in-package \"~A\")~%~%" (or lisp-package package)))
- (when documentation
- (write-protobuf-documentation type documentation stream :indentation indentation))
- (format stream "~&(proto:define-proto ~(~A~)" (or class name))
- (if (or package lisp-package imports optimize options documentation)
- (format stream "~% (")
- (format stream " ("))
- (let ((spaces ""))
- (when package
- (format stream "~A:package ~A" spaces package)
- (when (or lisp-package imports optimize options documentation)
- (terpri stream))
- (setq spaces " "))
- (when lisp-package
- (format stream "~A:lisp-package ~A" spaces lisp-package)
- (when (or imports optimize options documentation)
- (terpri stream))
- (setq spaces " "))
- (when imports
- (cond ((= (length imports) 1)
- (format stream "~A:import \"~A\"" spaces (car imports)))
- (t
- (format stream "~A:import (~{\"~A\"~^ ~})" spaces imports)))
- (when (or optimize options documentation)
- (terpri stream))
- (setq spaces " "))
- (when optimize
- (format stream "~A:optimize ~(~S~)" spaces optimize)
- (when (or options documentation)
- (terpri stream))
- (setq spaces " "))
- (when options
- (format stream "~A:options (~{~@/protobuf-option/~^ ~})" spaces options)
- (when documentation
- (terpri stream))
- (setq spaces " "))
+ (let ((lisp-pkg (and lisp-package
+ (or (null package) (not (string-equal lisp-package package))))))
+ (when (or lisp-pkg package)
+ (format stream "~&(in-package \"~A\")~%~%" (or lisp-pkg package)))