本文介绍了如何得到抑制^ M字符在我ClojureBox(EmacsW32)REPL连接到lein swank的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从我的安装连接到swank服务器。也就是说 lein swank 从我的项目目录,然后 Mx slime-connect 从EmacsW32。



然而,当我这样做,我看到在REPL( ^ M )的DOS行结尾。即

  user> (doc map)
------------------------- M
clojure.core / map ^ M
([f coll] [f c1 c2] [f c1 c2 c3] [f c1 c2 c3& colls])^ M
返回由将f应用于
集合的结果组成的延迟序列的每个coll的第一项,随后将f应用于每个coll中的第二项的集合
,直到任一个coll是
exhausted。其他coll中的任何剩余项目将被忽略。函数
f应该接受colls参数。^ M
nil

用户> (printlnfoo)
foo ^ M

做平台编码,但我有麻烦了解如何抑制它们。我在EmacsW32菜单中戳了一下,尝试使用java命令行系统属性(在lein.bat中) -Dfile.encoding = ISO-8859-1 p>

我还发现了关于在缓冲区中进行全局查找/替换^ M的其他问题 - 但我想过滤REPL输出。



我也注意到 * inferior-lisp * 缓冲区中的以下内容:



(do(.. java.net.InetAddress getLocalHost getHostAddress)nil)(swank.swank / start-serverc:/Users/noahz/AppData/Local/Temp/slime.4912:encodingiso-latin -1-unix)

解决方案



 (defun hide-eol()
不要在包含UNIX和DOS行结尾的文件中显示^ M
(交互)
(setq buffer-display-table)
(aset buffer-display-table?\ ^ M [])

我需要时用Mx hide-eol调用它。



信用是由于个人未知 - 我从某处复制了这个函数,但是我从一个地方复制了这个函数不记得哪里。


I am connecting to a swank server from my ClojureBox install. I.e. lein swank from my project directory and then M-x slime-connect from EmacsW32.

However, when I do this I see the DOS line-endings everywhere in the REPL (^M). I.e.

user> (doc map)
-------------------------^M
clojure.core/map^M
([f coll] [f c1 c2] [f c1 c2 c3] [f c1 c2 c3 & colls])^M
  Returns a lazy sequence consisting of the result of applying f to the
  set of first items of each coll, followed by applying f to the set
  of second items in each coll, until any one of the colls is
  exhausted.  Any remaining items in other colls are ignored. Function
  f should accept number-of-colls arguments.^M
nil 

user> (println "foo")
foo^M

I'm aware that this has to do with platform encoding, but I'm having trouble figuring out how to suppress them. I poked around in the EmacsW32 menus and tried the java command line system property (in lein.bat) -Dfile.encoding=ISO-8859-1 to no avail.

I've also found other questions about doing global find/replace of ^M within buffers - but I want to filter REPL output.

I also noticed the following in the *inferior-lisp* buffer:

(do (.. java.net.InetAddress getLocalHost getHostAddress) nil)(swank.swank/start-server "c:/Users/noahz/AppData/Local/Temp/slime.4912" :encoding "iso-latin-1-unix")

解决方案

I have this in my .emacs:

(defun hide-eol ()
  "Do not show ^M in files containing mixed UNIX and DOS line endings."
  (interactive)
  (setq buffer-display-table (make-display-table))
  (aset buffer-display-table ?\^M []))

I just call it with M-x hide-eol when required. You could bind a key, or put it in a hook of some sort if you prefer.

Credit is due to persons unknown - I copied this function from somewhere, but I don't remember where.

这篇关于如何得到抑制^ M字符在我ClojureBox(EmacsW32)REPL连接到lein swank的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-22 18:58