emacs设置为clojure和普通lisp与slime-fancy(slime-autodoc) [英] emacs setup for both clojure and common lisp with slime-fancy (slime-autodoc)
问题描述
我为clojure和common lisp设置了emacs,但是我也想为普通lisp添加(slime-setup'(slime-fancy))。如果我把这行添加到init.el,clojure将不工作:它给我repl,但它在我运行任何代码后挂起。
I set up emacs for both clojure and common lisp, but I want also (slime-setup '(slime-fancy)) for common lisp. If I add that line to init.el, clojure won't work: it gives me repl, but it hangs after I run any code.
对于clojure:
- 我设置了clojure模式,slime,slime-repl via ELPA
- 我在项目目录中运行$ lein swank
- 然后Mx slime-connect to hack clojure
对于常见的lisp,我把它放在init.el中的ELPA代码之后:
For common lisp I place this after ELPA code in init.el:
(add-to-list 'load-path "~/.elisp/slime")
(require 'slime)
(add-to-list 'slime-lisp-implementations '(sbcl ("/opt/local/bin/sbcl") :coding-system utf-8-unix))
;; (slime-setup '(slime-fancy))
所以如果我取消注释最后一行,clojure会破碎。但是slime-fancy是一个非常重要的meta包,用于破解常见的lisp。
So if I uncomment the last line, clojure will be broken. But slime-fancy a very important meta package for hacking common lisp.
有一种方法可以将它们设置为工作时不更改配置并在需要切换语言时重新启动?
Is there a way to set them both up to work without changing configuration and restarting when I need to switch languages?
我发现slime-autodoc加载了slime-fancy是挂起的原因。
I found that slime-autodoc loaded with slime-fancy is the cause of hangs.
(slime-setup '(slime-fancy))
(setq slime-use-autodoc-mode nil)
此配置允许运行常见的lisp和clojure SLIME。甚至同时。但是没有slime-autodoc。
This configuration lets run both common lisp and clojure SLIMEs. Even simultaneously. But without slime-autodoc.
我还发现我使用CVS版本的SLIME,因为我手动做(加载到列表的load-path .elisp / slime)。这不解决问题。也许有一个版本从一些魔术日期与clojure工作?这里有一个人说CVS版本适合他: http:// www .youtube.com / watch?v = lf_xI3fZdIg& feature = player_detailpage#t = 221s
I also found I'm using the CVS version of SLIME since I manually do (add-to-list 'load-path "~/.elisp/slime") after ELPA code. That does not solve the problem. Maybe there is a version from some magic date which works with clojure? Here a guy says CVS version works for him: http://www.youtube.com/watch?v=lf_xI3fZdIg&feature=player_detailpage#t=221s
推荐答案
解。 (使用钩子)
这是丑陋但很方便。
Here is a solution. (using hooks)
That is ugly but quite convenient.
(add-hook 'slime-connected-hook
(lambda ()
(if (string= (slime-lisp-implementation-type) "Clojure")
(setq slime-use-autodoc-mode nil)
(setq slime-use-autodoc-mode t))
))
(add-hook 'slime-mode-hook
(lambda ()
(if (eq major-mode 'clojure-mode)
(slime-autodoc-mode 0)
(slime-autodoc-mode 1))))
更新
如果 slime-repl
buffer,尝试以下代码:
Update
If the problem still exists on the slime-repl
buffer, try the following code:
(add-hook 'slime-repl-mode-hook
(lambda ()
(if (string= (slime-lisp-implementation-type) "Clojure")
(progn (setq slime-use-autodoc-mode nil)
(slime-autodoc-mode 0))
(progn (setq slime-use-autodoc-mode t)
(slime-autodoc-mode 1)))))
这篇关于emacs设置为clojure和普通lisp与slime-fancy(slime-autodoc)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!