[英]Node REPL in Emacs printing my input
我在节点REPL中设置一些细节时遇到麻烦:
每当我在提示符下键入命令时,在从REPL获得真实输出之前,都会重印此命令。 例如:
var n = 1; var n = 1; 未定义
我试图使用balajis回购中的一些代码https://github.com/startup-class/dotfiles/blob/master/.emacs.d/js-comint.el ,但是后来我的Mx run-js命令不起作用。
这是我的初始化文件(我尚未编辑js-comint.el):
(normal-erase-is-backspace-mode 1)
(add-to-list 'load-path "~/.emacs.d/")
(add-to-list 'load-path "~/.emacs.d/auto-complete/")
; Load the default configuration
(require 'auto-complete-config)
; Make sure we can find the dictionaries
(add-to-list 'ac-dictionary-directories "~/.emacs.d/auto-complete/dict")
; Use dictionaries by default
(setq-default ac-sources (add-to-list 'ac-sources 'ac-source-dictionary))
(global-auto-complete-mode t)
; Start auto-completion after 2 characters of a word
(setq ac-auto-start 2)
; case sensitivity is important when finding matches
(setq ac-ignore-case nil)
(add-to-list 'load-path "~/.emacs.d/yasnippet/")
(require 'yasnippet)
(yas-global-mode 1)
;; Load the snippet files themselves
(yas/load-directory "~/.emacs.d/yasnippet/snippets/text-mode/javascript-mode/")
;; Let's have snippets in the auto-complete dropdown
(add-to-list 'ac-sources 'ac-source-yasnippet)
(add-to-list 'auto-mode-alist (cons (rx ".js" eos) 'js2-mode))
(require 'js-comint)
(setq inferior-js-program-command "/usr/bin/java org.mozilla.javascript.tools.shell.Main")
(setq inferior-js-program-command "node")
(setq inferior-js-mode-hook
(lambda ()
;; We like nice colors
(ansi-color-for-comint-mode-on)
;; Deal with some prompt nonsense
(add-to-list
'comint-preoutput-filter-functions
(lambda (output)
(replace-regexp-in-string "\033\\[[0-9]+[GKCJ]" "" output)))))
(add-hook 'js2-mode-hook '(lambda ()
(local-set-key "\C-x\C-e" 'eval-last-sexp)
(local-set-key "\C-cb" 'js-send-buffer)
(local-set-key "\C-c\C-b" 'js-send-buffer-and-go)
(local-set-key "\C-cl" 'js-load-file-and-go)
(local-set-key "\C-c!" 'run-js)
(local-set-key "\C-c\C-r" 'js-send-region)
(local-set-key "\C-c\C-j" 'js-send-line)
(local-set-key "\C-c\C-u" 'whitespace-clean-and-compile)
))
这应该解决它:
(add-hook 'inferior-js-mode-hook
(lambda ()
(setq comint-process-echoes t)))
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.