下面的函数将app.js缓冲区内容发送到 * nodejs * repl缓冲区,该缓冲区有效。唯一的问题是当它第二次执行时它不会以新的nodejs进程开始。
(defun execute_js_stuff ()
(interactive)
(progn
(save-buffer)
(let ((nodejs_project_dir (node_js_project_path
(file-name-directory (buffer-file-name)))))
(if nodejs_project_dir
(with-current-buffer (find-buffer-visiting (concat nodejs_project_dir "app.js"))
(comint-simple-send (get-process "nodejs") (buffer-string)))))))
因此添加了一些代码来删除进程缓冲区,然后重新启动它。但它不起作用。即创建了nodejs进程缓冲区,但app.js缓冲区的内容未发送到nodejs缓冲区。任何可能出错的想法。
(defun execute_js_stuff ()
(interactive)
(progn
(save-buffer)
(let ((nodejs_project_dir (node_js_project_path
(file-name-directory (buffer-file-name)))))
(if nodejs_project_dir
(with-current-buffer (find-buffer-visiting (concat nodejs_project_dir "app.js"))
(if (get-process "nodejs")
(progn (delete-process (get-process "nodejs"))
(kill-buffer "*nodejs*")))
(nodejs-repl)
(comint-simple-send (get-process "nodejs") (buffer-string)))))))