简体   繁体   English

如何在emacs中添加缩进方案(REPL)?

[英]How to add indentation an inferior scheme (REPL) in emacs?

I'm using Chicken-scheme.I use Mx run-scheme to start a scheme repl, and then I use things like Cc Cl to test my work. 我正在使用Chicken-scheme。我使用Mx run-scheme来启动一个方案repl,然后我使用像Cc Cl这样的东西来测试我的工作。

However, this is an indentation nightmare. 然而,这是一个缩进的噩梦。 Things generally look like this: 事情通常如下:

> (+ 1 
(* 2
3)
4)

instead of the desired: 而不是所期望的:

> (+ 1
     (* 2
        3)
     4)

How can I easily fix this? 我怎样才能轻松解决这个问题? I know I can start a chicken repl with geiser, but that breaks keybindings and I'd really just prefer to not make stuff more complicated than it is. 我知道我可以用geiser开始一个鸡的repl ,但这打破了键绑定,我真的只是不想让事情变得更复杂。 I just want it to correctly indent when I press enter, just like in my non-repl buffer, that's all. 当我按下回车时,我只是想让它正确缩进,就像我的non-repl缓冲区一样,就是这样。

I'd just like the simplest possible solution to get some nice indentation, like is standard for lisp. 我只是想用最简单的解决方案来获得一些很好的缩进,就像是lisp的标准。 I'd like to add that my buffer in which I edit the file is totally fine, it's just the repl that doesn't work. 我想补充一点,我编辑文件的缓冲区完全正常,它只是不起作用的repl

Bind RET to RET绑定到

(defun comint-send-input-indent ()
  (interactive)
  (let ((parens (or (car (syntax-ppss)) 0)))
    (if (zerop parens)
        (comint-send-input)
      (newline-and-indent))))

As found here 这里找到

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM