我在http://v.youku.com/v_show/id_XNDQ4NDY0NjM2.html上观看Jim Weirich关于使用Emacs中的JavaScript的Y组合器的演讲之一。
(我认为演示文稿与他在RubyConf 2012上使用Ruby而不是javascript .. http://confreaks.com/videos/1287-rubyconf2012-y-not-adventures-in-functional-programming给出的内容非常相似)
我注意到一件事,他正在通过“ C-c v”快捷方式从Emacs(通过node.js,通过显示一些错误msgs)在Emacs中评估缓冲区中的JS,并将输出返回到另一个缓冲区中。
我想知道是否有一个简单的说明(在深入介绍comint / call-process之前)如何在Windows的最新Emacs上进行安装...我进行了搜索,但到目前为止没有成功。顺便说一句,我确实安装了node.exe,并且可以按照“ setting-up-emacs-as-a-javascript-editing-有趣的营利环境”(对不起,不能发布2个以上的链接...)
谢谢,
/布鲁因
最佳答案
我定义了以下函数及其键映射。到目前为止,它仍然有效。
(defun node-js-eval-region-or-buffer ()
"Evaluate the current buffer (or region if mark-active),
and return the result into another buffer,
which is to be shown in a window."
(interactive)
(let ((debug-on-error t) (start 1) (end 1))
(cond
(mark-active
(setq start (point))
(setq end (mark)))
(t
(setq start (point-min))
(setq end (point-max))))
(call-process-region
start end ; seems the order does not matter
"node" ; node.js
nil ; don't delete region
"node.js" ; output buffer
nil) ; no redisply during output
(message "Region or buffer evaluated!")
(setq deactivate-mark t))) ; deactive the region, regardless
(define-key global-map (kbd "C-c v") 'node-js-eval-region-or-buffer)
我还有点事情要做:如何自动拆分屏幕以显示输出缓冲区?我想应该不会太困难...
顺便说一句,我为Windows安装了Git和Node.js,并将“ node.exe”复制到Git的“ / bin”目录(安装过程中已添加到PATH环境中)。