emacs setup for both clojure and common lisp with slime-fancy (slime-autodoc)

后端 未结 3 510
一向
一向 2020-12-24 09:39

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

相关标签:
3条回答
  • 2020-12-24 09:43

    I've been contemplating on the same problem recently. The issue is that the SLIME in ELPA is trimmed down and is next to useless for Common Lisp. One way you can circumvent the problem is to check out SLIME from CVS from the same date as the checkout was done for the ELPA package and add manually the missing stuff. Someone on #clojure told me he did that and the solution worked. I personally find such a solution pretty ugly, but until someone manages to get the Clojure support into upstream SLIME there won't be a better one.

    Alternatively you can add features to the slime-setup one by one and see what feature exactly is causing the problem with the Clojure evaluation - after all slime-fancy is simply a metafeature that just loads the most popular contrib features.

    Btw you don't need the lines

    (add-to-list 'load-path "~/.elisp/slime/contrib")
    (setq slime-backend "~/.elisp/slime/swank-loader.lisp")
    (require 'slime)
    

    The contrib dir will be added automatically to the load path, the back-end is the default and if you're using 'slime-autoloads you should require slime before that, since this defeats the purpose of the autoload.

    0 讨论(0)
  • 2020-12-24 10:04

    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))))
    

    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)))))
    
    0 讨论(0)
  • 2020-12-24 10:04

    I use sbcl, clozure, and clojure: Getting Emacs, Slime, Common Lisp (SBCL, Clozure), and Clojure to Work Together

    0 讨论(0)
提交回复
热议问题