I set up my Emacs for Clojure using the instructions at Clojure's web site. I used the first option in setting up the inferior-lisp-program
variable, basically "java clojure.main".
我使用Clojure网站上的说明设置了我的Emacs。我使用了第一个选项来设置inferir -lisp-program变量,基本上是“java clojures .main”。
With this setup, C-c C-z works in getting me to the Clojure REPL. However, when I'm editing a file and I type C-c C-l to load the file into the REPL, Emacs always switches buffer from the code window to the REPL window. This is very irritating. This happens even when I have two windows veritically split, with code on the left and the REPL on the right. I end up with two mirrored REPL windows.
通过这个设置,C-c -z可以帮助我找到Clojure REPL。但是,当我编辑一个文件,并键入C-c C-l将文件加载到REPL时,Emacs总是将缓冲区从代码窗口切换到REPL窗口。这是非常刺激的。即使我有两个窗口以验证的方式拆分,代码在左边,REPL在右边,也会发生这种情况。我最终得到了两个镜像的REPL窗口。
I remember Clojure Box, which is Emacs + Clojure on Windows, does this right, so I know it's a setup issue.
我记得Clojure Box在Windows上是Emacs + Clojure,它做得对,所以我知道这是一个设置问题。
How do I get Emacs to just switch to the window on the right?
如何让Emacs切换到右边的窗口?
4 个解决方案
#1
1
I use C-c C-k
to compile the current buffer. Then the result of that compilation will be available to you in whatever buffer the REPL is running in. Emacs will not switch any buffers around: you're simply compiling the buffer.
我使用C-c -k编译当前缓冲区。然后,编译的结果将在REPL正在运行的任何缓冲区中对您可用。Emacs不会切换任何缓冲区:您只是在编译缓冲区。
#2
1
In clojure-mode v 1.7.1, which I think is the most recent, C-c C-l
is bound to clojure-load-file'
, which has a hard-coded (switch-to-lisp t)
at the end of it. In other words, there is no way to prevent it from switching to lisp without redefining switch-to-lisp
to check a variable to see whether it should actually invoke.
在clojure-mode v 1.7.1中,我认为是最近的一个例子,C-c -l被绑定到clojure-load-file' '中,它的末尾有一个硬编码(切换到lisp t)。换句话说,如果不重新定义从切换到lisp来检查变量是否应该实际调用,就无法阻止它切换到lisp。
That said, clojure-load-file
seems a bit heavy-handed in most cases. My usual workflow involves setting the region to the whole buffer and invoking lisp-eval-region
with C-c C-r
. This function accepts an option and-go
parameter that indicates whether or not it should switch to the inferior-lisp process buffer or not after invocation.
也就是说,clojure- loadfile在大多数情况下都显得有些笨拙。我通常的工作流程包括将区域设置为整个缓冲区并使用C-c -r调用lisp-eval-region。该函数接受一个选项和go参数,该参数指示是否应该在调用后切换到推论-lisp进程缓冲区。
As I continue working, I usually redefine a functions and evaluate them as I go with lisp-eval-last-sexp
which I invoke with C-c C-e
, which also accepts the optional and-go
flag.
当我继续工作时,我通常会重新定义一个函数,并在使用lisp-eval-last-sexp时对其进行评估。
#3
0
I'm using SLIME with version 20100404, and this doesn't happen to me, not with C-c C-l
nor with C-c C-k
. Maybe you're using a different slime.el version? Use M-x find-library <RET> slime <RET>
and look for its version in the top comments, to check this out.
我正在使用SLIME与20100404版本,这并没有发生在我身上,不是与C-c -l,也不是与C-c -k。也许你用的是不同的黏液。el版本吗?使用M-x查找库
#4
0
In inf-lisp.el you can see that it adds "* inferior-lisp *" to the list of same-buffer windows:
在inf-lisp。您可以看到,它在相同缓冲窗口列表中添加了“* inferir -lisp *”:
(add-hook 'same-window-buffer-names "*inferior-lisp*")
To remove it from this list, you can put in your .emacs:
要从这个列表中删除它,您可以在。emacs中:
(setq same-window-buffer-names (delete "*inferior-lisp*" same-window-buffer-names))
#1
1
I use C-c C-k
to compile the current buffer. Then the result of that compilation will be available to you in whatever buffer the REPL is running in. Emacs will not switch any buffers around: you're simply compiling the buffer.
我使用C-c -k编译当前缓冲区。然后,编译的结果将在REPL正在运行的任何缓冲区中对您可用。Emacs不会切换任何缓冲区:您只是在编译缓冲区。
#2
1
In clojure-mode v 1.7.1, which I think is the most recent, C-c C-l
is bound to clojure-load-file'
, which has a hard-coded (switch-to-lisp t)
at the end of it. In other words, there is no way to prevent it from switching to lisp without redefining switch-to-lisp
to check a variable to see whether it should actually invoke.
在clojure-mode v 1.7.1中,我认为是最近的一个例子,C-c -l被绑定到clojure-load-file' '中,它的末尾有一个硬编码(切换到lisp t)。换句话说,如果不重新定义从切换到lisp来检查变量是否应该实际调用,就无法阻止它切换到lisp。
That said, clojure-load-file
seems a bit heavy-handed in most cases. My usual workflow involves setting the region to the whole buffer and invoking lisp-eval-region
with C-c C-r
. This function accepts an option and-go
parameter that indicates whether or not it should switch to the inferior-lisp process buffer or not after invocation.
也就是说,clojure- loadfile在大多数情况下都显得有些笨拙。我通常的工作流程包括将区域设置为整个缓冲区并使用C-c -r调用lisp-eval-region。该函数接受一个选项和go参数,该参数指示是否应该在调用后切换到推论-lisp进程缓冲区。
As I continue working, I usually redefine a functions and evaluate them as I go with lisp-eval-last-sexp
which I invoke with C-c C-e
, which also accepts the optional and-go
flag.
当我继续工作时,我通常会重新定义一个函数,并在使用lisp-eval-last-sexp时对其进行评估。
#3
0
I'm using SLIME with version 20100404, and this doesn't happen to me, not with C-c C-l
nor with C-c C-k
. Maybe you're using a different slime.el version? Use M-x find-library <RET> slime <RET>
and look for its version in the top comments, to check this out.
我正在使用SLIME与20100404版本,这并没有发生在我身上,不是与C-c -l,也不是与C-c -k。也许你用的是不同的黏液。el版本吗?使用M-x查找库
#4
0
In inf-lisp.el you can see that it adds "* inferior-lisp *" to the list of same-buffer windows:
在inf-lisp。您可以看到,它在相同缓冲窗口列表中添加了“* inferir -lisp *”:
(add-hook 'same-window-buffer-names "*inferior-lisp*")
To remove it from this list, you can put in your .emacs:
要从这个列表中删除它,您可以在。emacs中:
(setq same-window-buffer-names (delete "*inferior-lisp*" same-window-buffer-names))