如何清除苹果酒模式中的REPL? [英] How to clear the REPL in cider-mode?

查看:254
本文介绍了如何清除苹果酒模式中的REPL?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不清楚REPL的文本输出;我的意思是清理REPL中的所有评估结果结果。在开发过程中,反复 Cc Cq Cc Mj 效率很低。






更新



可能是我的一些不好的调试行为。我不知道其他人如何使用CIDER开发编程,但我真的需要上述功能。我猜其他开发者也遇到了同样的问题。



例如,在clojure prog单元的顶部,我使用 declare 声明一个函数 foo ,由另一个函数 bar foo bar 之后实现。然后,我 C-c C-k 等,并且进度顺利。后来我偶尔删除了 foo 的前向声明。发生什么事进度顺利。 <强>真?然后,我承诺我的全部工作,并高兴地终止CIDER REPL会议。



早上的灾难:符号 foo 发现!



这是我的故事。所以没有人遇到类似的问题?

解决方案

尝试(刷新)

https://github.com/clojure/tools。命名空间#重新加载代码使用



似乎没有删除在用户中声明的var 命名空间,我输入到REPL中,但是它的作用是:


...卸载(删除)改变的命名空间清除任何旧的
定义。


我们通常将其他一些有用的东西添加到用户命名空间,因此在启动时加载到REPL中:

  ns用户
(:require [clojure.tools.namespace.repl:refer [refresh]]
[clojure.repl:refer [doc source]]
[clojure.pprint:refer [pprint pp]]
[midje.repl:as midje]
[clojure.stacktrace:as st])

要保持代码与主源和测试源分开,请将其放在< project root> /dev/user.clj 中的文件中,然后将以下内容添加到您的lein project.clj 文件:

  :profiles {:dev {:source-paths [dev]}} 






(ps虽然这不是你想要回答的问题,对于那些看到这个答案并想要清除苹果汁REPL中的文字的人来说,它是 Cc Mo https://github.com/clojure-emacs/cider


I am not meaning cleaning up the text output of REPL; I mean cleaning up all evaluated results in REPL. During developing, repeatedly C-c C-q and C-c M-j is low efficiency.


UPDATE

There may be some bad debug behaviour of mine. I am not sure how other people develop progs with CIDER, but I really need the functionality mentioned above. I guess other developers also encounter same problems as mine.

For example, at the top of a clojure prog unit, I use declare to declare a function foo, which is used by another function bar, and foo is implemented after bar. Then, I C-c C-k, etc, and the prog goes well. Later, I removed the forward declaration of foo occasionally. What does happen? The prog still goes well. REALLY? Then, I commit my whole job and terminate the CIDER REPL session happily.

Disaster on morning: Symbol foo not found!

That's my story. So, nobody has ever encountered similar problems?

解决方案

Try the (refresh) function in the clojure.tools.namespace.repl namespace:

The refresh function will scan all the directories on the classpath for Clojure source files, read their ns declarations, build a graph of their dependencies, and load them in dependency order.

https://github.com/clojure/tools.namespace#reloading-code-usage

It doesn't seem to remove the vars declared in the user namespace, which I've typed into the REPL, but it does:

...unload (remove) the namespaces that changed to clear out any old definitions.

We generally add that plus a few other useful things to the user namespace, so it's loaded into the REPL on startup:

(ns user
  (:require [clojure.tools.namespace.repl :refer [refresh]]
            [clojure.repl :refer [doc source]]
            [clojure.pprint :refer [pprint pp]]
            [midje.repl :as midje]
            [clojure.stacktrace :as st]))

To keep that code separate from your main and test sources, put that in a file at <project root>/dev/user.clj, then add the following to your lein project.clj file:

:profiles {:dev {:source-paths ["dev"]}}


(p.s. although it's not the question you want answered, for those seeing this answer and wanting to clear the text in the Cider REPL, it's C-c M-o (https://github.com/clojure-emacs/cider)

这篇关于如何清除苹果酒模式中的REPL?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆