paredit花括号匹配在swank-clojure repl [英] paredit curly brace matching in swank-clojure repl
问题描述
我在Windows 7上使用emacs 24,并已安装了技术的clojure模式以及paredit 23 beta版。我从我的leiningen项目加载源文件,并得到一个复制使用clojure-jack-in。问题是,虽然paredit在Clojure模式和repl中启用,但大括号在repl只在源文件中不匹配。
I am using emacs 24 on Windows 7 and have installed technomancy's clojure-mode along with paredit 23 beta. I load the source file from my leiningen project and get a repl using clojure-jack-in. The problem is that while paredit is enabled in both Clojure mode and the repl, curly braces are not matched in the repl only in source files.
如何获得它
推荐答案
我添加了以下到我的.emacs文件,我没有自己发明它,它是我在网上发现的一个片段 - 但我不记得哪里):
I added the following to my .emacs file, that does the trick for me (I did not invent this myself, it's a snippet I found somewhere online - but I can't remember where):
(defun setup-slime-repl-paredit ()
(define-key slime-repl-mode-map
(kbd "DEL") 'paredit-backward-delete)
(define-key slime-repl-mode-map
(kbd "{") 'paredit-open-curly)
(define-key slime-repl-mode-map
(kbd "}") 'paredit-close-curly)
(modify-syntax-entry ?\{ "(}")
(modify-syntax-entry ?\} "){")
(modify-syntax-entry ?\[ "(]")
(modify-syntax-entry ?\] ")[")
(modify-syntax-entry ?~ "' ")
(modify-syntax-entry ?, " ")
(modify-syntax-entry ?^ "'")
(modify-syntax-entry ?= "'"))
(add-hook 'slime-repl-mode-hook 'setup-slime-repl-paredit)
(add-hook 'slime-repl-mode-hook 'enable-paredit-mode)
这篇关于paredit花括号匹配在swank-clojure repl的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!