如何在 Slime 中使用 cl-annot(在 Lucerne 中定义另一个视图)

How to use cl-annot in Slime (to define another view in Lucerne)

如何编译使用 cl-annot 注释的函数?

用例:

Lucerne 用它来定义路由:

@route app "/profile/:username"
(defview profile (username)
  (let* ((user (utweet.models:find-user username))
         ;; The user's timeline
         (user-tweets (utweet.models:user-tweets user))
         ;; Is the user viewing his own profile?
         (is-self (string= (lucerne-auth:get-userid)
                           username)))
    (render-template (+profile+)
                     :user user
                     :tweets (display-tweets user-tweets)
                     :is-self is-self)))

我让它在一个视图中工作。但是写第二个并用 C-c-c 编译它是行不通的。我为 emacs 安装了 slime-annot.el,但我只得到

The variable @ROUTE is unbound. [Condition of type UNBOUND-VARIABLE]

我确实在开头写了 (annot:enable-annot-syntax)

所以这是一个阻塞点:/我们如何使用 cl-annot 定义新内容?

谢谢

ps: related issue

编辑:关于文件结构的更多信息:我用 Lucerne 的项目创建者创建了一个项目,这是我的主文件的开头:

(in-package :cl-user)
(defpackage lucerne-books
  (:use :cl
        :lucerne
        :cl-arrows
        :str)
  (:export :app)
  (:documentation "Main lucerne-books code."))
(in-package :lucerne-books)
(annot:enable-annot-syntax)

;;; App

(defapp app
  :middlewares ((clack.middleware.static:<clack-middleware-static>
                 :root (asdf:system-relative-pathname :lucerne-books #p"assets/")
                 :path "/static/")))

;;; Templates

(djula:add-template-directory
 (asdf:system-relative-pathname :lucerne-books #p"templates/"))

(defparameter +index+ (djula:compile-template* "index.html"))

;;; Views

@route app "/" ;; first created: it works
(defview index ()
  (render-template (+index+)
                   :foo "you"))

@route app "/rst" ;; this view won't work, not accessible
(defview index ()
  (render-template (+index+)
                   :foo "rst"))

@route app "/following/:username"  ;; this one neither
(defview user-following (username)
  (let ((user username))
    (render-template (+index+)
                     :foo user)))

我在 Caveman 项目中发现了不同的表示法。它没有出现在 cl-annot 的文档中,但它有效:

(syntax:use-syntax :annot)

我现在可以 C-c C-c 新路线。