Clojure中的Emacs自动缩进 - 像CL一样吗?

时间:2011-12-28 23:59:56

标签: emacs clojure common-lisp auto-indent

Emacs以下列方式自动缩进Clojure代码:

(defn foo [x]
  (if (= 0 x)
    0
    1))

我更喜欢它是否像Scheme和CL那样:

(defn foo [x]
  (if (= 0 x)
      0
      1))

如何更改我的.el文件以实现此目的?

2 个答案:

答案 0 :(得分:3)

我没有真正测试过这个,但似乎有效(在clojure模式下):

(put 'if 'clojure-indent-function 3)

答案 1 :(得分:1)

因为我不能在评论中做代码块:

Elisp没有缩进你提到的任何一种方式:

(if (test-p foo)
    bar
  baz)

Common-lisp-mode也是这样缩进的。方案模式将它们排成一行。