如何保存我在 LispBox/Slime 中输入的所有函数?
情况:我在 Emacs 中使用 REPL 时输入了几个函数。 问题:当我只是保存缓冲区时,出现“;评估中止”之类的垃圾。 我想要的是:我在最新版本中输入的所有功能的清晰描述。
我可以这样做吗? 谢谢。
Situation: I entered several functions while working with REPL in Emacs.
Problem: There is junk like "; Evaluation aborted" when I'm simply saving buffer.
What I want: clear descriptions of all the functions I entered in their latest revision.
Can I do that? Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
我不明白。 您是否在 REPL 中输入定义并希望稍后恢复它们? 只需像保存任何其他语言一样保存源文件即可。 使用 Cx 2 将 Emacs 窗口一分为二。 在其中一个 Cx Cf foo.lisp 中打开源文件。 使用 Cc Ck、Cc Cr 和朋友(请参阅 SLIME 菜单)在 REPL 中编译/评估源代码区域。
I don't get it. Are you entering definitions at the REPL and expecting to recover them later? Just save a source file as you would in any other language. Use C-x 2 to split your Emacs window in two. Open a source file in one of them C-x C-f foo.lisp. Use C-c C-k, C-c C-r and friends (see SLIME menu) to compile / evaluate regions of your source code in the REPL.
我过去曾寻找过类似的东西,但一直找不到。 您最好将所有定义写入单独的缓冲区中,并使用 SLIME 的广泛评估/编译功能(Cc Ck 加载整个文件,Cx Ce 评估最后一个表达式,Cc Cr 评估区域等),仅直接进入您不想保存的 REPL 内容。
I've looked for something like this in the past and have been unable to find it. You're best off writing all your definitions in a separate buffer and using SLIME's extensive evaluation/compilation functions (C-c C-k loads an entire file, C-x C-e evaluates the last expression, C-c C-r evaluates a region, etc.), only directly entering into the REPL things you don't want to save.
嗯,
Cx o
或Cx b
到达 SLIME REPL 缓冲区,然后Cx w
或Cx Cs
到达将其保存到文件中。 所有 SLIME/CL 的内容都是读者的评论; 您可以编写一个阅读器 hack 来重新加载文件,将提示视为注释,或者您可以自己浏览文件以捕获要保存的片段。Um,
C-x o
orC-x b
to get to the SLIME REPL buffer, thenC-x w
orC-x C-s
to save it to a file. All the SLIME/CL stuff is a reader comment; you can either write a reader hack to reload the file treating the prompts as comments, or you can go through the file yourself to capture the pieces you want to save.我同意最好的工作流程方法是将代码编写在单独的缓冲区中并在其中进行评估,而不是在 repl 中输入函数。
假设您已经采用了 repl 方式,我想 C. Martin 保存 repl 日志并手动浏览它的解决方案是您唯一的选择。
如果您将函数和变量输入到单独的包中,则可以浏览包中的符号来帮助您决定要保留的内容。
例如,查看 cl-user 包中创建的所有符号:
I agree that the best work flow method is to write your code in a separate buffer and evaluate in that, rather than enter the functions in the repl.
Assuming you have gone the repl way, I guess, C. Martin's solution to save the repl log and manually go through it are your only options.
If you entered the functions and vars into a separate package, you could go through the symbols in the package to help you decide what you want to keep.
E.g. to see all symbols created in the cl-user package: