在emacs中运行苹果酒(Running cider

编程入门 行业动态 更新时间:2024-10-15 10:13:31
emacs中运行苹果酒(Running cider-jack-in in emacs)

我想学习一些Clojure,我试图从Emacs运行REPL,但我无法让它工作。

我用lein创建了一个基本项目。 我在Emacs中打开生成的文件core.clj ,当我尝试从它运行REPL时(通过运行cider-jack-in ),我只是收到消息:

Symbol's function definition is void: nil

我已经切换了错误调试,并且回溯(几个最后一行)是:

Debugger entered--Lisp error: (void-function nil) nil(#<buffer core.clj>) #[257 " !\203\207\300\207" [exclude predicate] 3 "\n\n(fn ELT)"](#<buffer core.clj>) seq-map(#[257 " !\203\207\300\207" [exclude predicate] 3 "\n\n(fn ELT)"] (#<buffer core.clj> #<buffer *Minibuf-1*> #<buffer *Warnings*> #<buffer *GNU Emacs*> #<buffer *scratch*> #<buffer *Minibuf-0*> #<buffer *Messages*> #<buffer *code-conversion-work*> #<buffer *Echo Area 0*> #<buffer *Echo Area 1*>)) seq-filter(#[257 "r\211q\210\300\301!)\207" [derived-mode-p cider-repl-mode] 3 "\n\n(fn BUFFER)"] (#<buffer core.clj> #<buffer *Minibuf-1*> #<buffer *Warnings*> #<buffer *GNU Emacs*> #<buffer *scratch*> #<buffer *Minibuf-0*> #<buffer *Messages*> #<buffer *code-conversion-work*> #<buffer *Echo Area 0*> #<buffer *Echo Area 1*>)) cider-repl-buffers() cider-find-reusable-repl-buffer(nil "~/Development/languages/clojure/playground/test1/") cider-jack-in(nil)

当我在终端运行lein run时,代码运行正常。 此外,当我在终端中运行lein repl时,REPL正常运行,并显示以下信息:

nREPL server started on port 62741 on host 127.0.0.1 - nrepl://127.0.0.1:62741 REPL-y 0.3.7, nREPL 0.2.12 Clojure 1.8.0 Java HotSpot(TM) 64-Bit Server VM 1.8.0_45-b14

Lein的Cider版本为0.14.0,而Emacs的版本为0.15.0。

任何人都可以帮我弄清楚我错过的那部分设置,或者我做错了什么?

谢谢您的帮助!

编辑:Bellow是Emacs init文件的内容,删除了注释:

(require 'package) (add-to-list 'package-archives '("marmalade" . "http://marmalade-repo.org/packages/") t) (add-to-list 'package-archives '("tromey" . "http://tromey.com/elpa/") t) (add-to-list 'package-archives '("melpa" . "http://melpa.milkbox.net/packages/") t) (package-initialize) (when (not package-archive-contents) (package-refresh-contents)) (defvar ido-cur-item nil) (defvar ido-default-item nil) (defvar ido-cur-list nil) (defvar predicate nil) (defvar inherit-input-method nil) (defvar my-packages '(paredit clojure-mode clojure-mode-extra-font-locking cider ido-ubiquitous smex projectile rainbow-delimiters tagedit magit)) (if (eq system-type 'darwin) (add-to-list 'my-packages 'exec-path-from-shell)) (dolist (p my-packages) (when (not (package-installed-p p)) (package-install p))) (add-to-list 'load-path "~/.emacs.d/vendor") (add-to-list 'load-path "~/.emacs.d/customizations") (load "shell-integration.el") (load "navigation.el") (load "ui.el") (load "editing.el") (load "misc.el") (load "elisp-editing.el") (load "setup-clojure.el") (load "setup-js.el")

I would like to learn some Clojure, and I'm trying to run REPL from Emacs, but I cannot get it to work.

I have created a basic project with lein. I open the generated file core.clj in Emacs, and when I try to run the REPL from it (by running the cider-jack-in), I just get the message:

Symbol's function definition is void: nil

I have toggled the debug-on-error, and the backtrace (several last lines) is:

Debugger entered--Lisp error: (void-function nil) nil(#<buffer core.clj>) #[257 " !\203\207\300\207" [exclude predicate] 3 "\n\n(fn ELT)"](#<buffer core.clj>) seq-map(#[257 " !\203\207\300\207" [exclude predicate] 3 "\n\n(fn ELT)"] (#<buffer core.clj> #<buffer *Minibuf-1*> #<buffer *Warnings*> #<buffer *GNU Emacs*> #<buffer *scratch*> #<buffer *Minibuf-0*> #<buffer *Messages*> #<buffer *code-conversion-work*> #<buffer *Echo Area 0*> #<buffer *Echo Area 1*>)) seq-filter(#[257 "r\211q\210\300\301!)\207" [derived-mode-p cider-repl-mode] 3 "\n\n(fn BUFFER)"] (#<buffer core.clj> #<buffer *Minibuf-1*> #<buffer *Warnings*> #<buffer *GNU Emacs*> #<buffer *scratch*> #<buffer *Minibuf-0*> #<buffer *Messages*> #<buffer *code-conversion-work*> #<buffer *Echo Area 0*> #<buffer *Echo Area 1*>)) cider-repl-buffers() cider-find-reusable-repl-buffer(nil "~/Development/languages/clojure/playground/test1/") cider-jack-in(nil)

When I run lein run in the terminal, the code runs properly. Also, when I run lein repl in the terminal, the REPL runs properly with the following info:

nREPL server started on port 62741 on host 127.0.0.1 - nrepl://127.0.0.1:62741 REPL-y 0.3.7, nREPL 0.2.12 Clojure 1.8.0 Java HotSpot(TM) 64-Bit Server VM 1.8.0_45-b14

Lein has Cider version 0.14.0, while Emacs has downloaded version 0.15.0.

Could anyone help me figure out which part of the setup I'm missing, or what I'm doing wrong?

Thanks for the help!

EDIT: Bellow is the contents of Emacs init file, with comments removed:

(require 'package) (add-to-list 'package-archives '("marmalade" . "http://marmalade-repo.org/packages/") t) (add-to-list 'package-archives '("tromey" . "http://tromey.com/elpa/") t) (add-to-list 'package-archives '("melpa" . "http://melpa.milkbox.net/packages/") t) (package-initialize) (when (not package-archive-contents) (package-refresh-contents)) (defvar ido-cur-item nil) (defvar ido-default-item nil) (defvar ido-cur-list nil) (defvar predicate nil) (defvar inherit-input-method nil) (defvar my-packages '(paredit clojure-mode clojure-mode-extra-font-locking cider ido-ubiquitous smex projectile rainbow-delimiters tagedit magit)) (if (eq system-type 'darwin) (add-to-list 'my-packages 'exec-path-from-shell)) (dolist (p my-packages) (when (not (package-installed-p p)) (package-install p))) (add-to-list 'load-path "~/.emacs.d/vendor") (add-to-list 'load-path "~/.emacs.d/customizations") (load "shell-integration.el") (load "navigation.el") (load "ui.el") (load "editing.el") (load "misc.el") (load "elisp-editing.el") (load "setup-clojure.el") (load "setup-js.el")

最满意答案

删除~/.emacs.d目录并改为安装spacemacs

git clone https://github.com/syl20bnr/spacemacs ~/.emacs.d

使用新的spacemacs ~/.emacs.d目录运行Emacs后,您只需打开一个Clojure文件,就可以在Clojure层中加载spacemacs。

更多细节可以在spacemacs.org和本教程中找到有关spacemacs的clojure开发https://practicalli.github.io/spacemacs/

Remove your ~/.emacs.d directory and install spacemacs instead

git clone https://github.com/syl20bnr/spacemacs ~/.emacs.d

Once you run Emacs with the new spacemacs ~/.emacs.d directory, you can simply open up a Clojure file and spacemacs will load in the Clojure layer for you.

More details can be found at spacemacs.org and in this tutorial on clojure development with spacemacs https://practicalli.github.io/spacemacs/

更多推荐

本文发布于:2023-08-07 02:16:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1459436.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:苹果酒   emacs   cider   Running

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!