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

Common lisp 如何在Slime中使用cl annot(在Lucerne中定义另一个视图),common-lisp,slime,Common Lisp,Slime,如何编译使用注释的函数 用例: 使用它定义路线: @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 vi

如何编译使用注释的函数

用例:

使用它定义路线:

@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
,但我只得到


变量@ROUTE未绑定。
[未绑定变量类型的条件]

我确实在开始时编写了
(annot:enable annot syntax)

所以这是一个阻碍点:/我们如何使用cl annot定义新东西

谢谢

附言:

编辑:有关文件结构的详细信息:我与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)))
(包中:cl用户)
(D)lucerne图书包装
(:用法:cl
:卢塞恩
:cl箭头
:str)
(:导出:应用程序)
(:文档“主要lucerne图书代码”)
(包装:卢塞恩图书)
(annot:启用annot语法)
;;; 应用程序
(defapp应用程序)
:中间件((clack.middleware.static:
:root(asdf:系统相对路径名:lucerne books#p“assets/”)
:路径“/静态/”))
;;; 模板
(djula:添加模板目录
(asdf:系统相对路径名:lucerne books#p“templates/”)
(defparameter+index+(djula:compiletemplate*“index.html”))
;;; 意见
@路线应用程序“/”;;首先创建:它可以工作
(defview索引()
(渲染模板(+索引+)
:foo“you”))
@路线应用程序“/重新设置”;;此视图无法工作,无法访问
(defview索引()
(渲染模板(+索引+)
:foo“rst”))
@路由应用程序“/以下/:用户名”;;这个也不是
(defview用户跟踪(用户名)
(let((用户用户名))
(渲染模板(+索引+)
:foo user)))

我在一个穴居人项目中发现了一个不同的符号。它不会出现在cl annot的文档上,但它可以工作:

(syntax:use-syntax :annot)

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

我不认识Lucrene,但最近我使用了cl-annot,没有问题。是否已按照文档中的说明在文件开头插入“(annot:enable annot syntax)”?你能提供更多关于你的文件结构的信息吗?是的,我启用了annot语法。我编辑了我的问题,提供了关于我的代码和文件结构的更多信息。它与我在穴居人项目中找到的
(语法:use syntax:annot)
一起工作。别跟我说为什么!很高兴听到你找到了解决办法!