3
有在.emacs中获得二郎项目路径defun
,我怎么能执行一个shell命令执行以下操作:在emacs中使用钢筋?
cd *~/erlang-project-folder*
make
我用钢筋搭建我的项目,并且有一个Makefile尽一切努力。
我可以通过覆盖erlang-compile-function
来编译,但我对Emacs Lisp不熟悉,请帮忙。
这里是我的.emacs:
(defun erlang-project-dir()
(let* ((src-path (file-name-directory (buffer-file-name)))
(pos (string-match "/src/" src-path)))
(if pos (substring src-path 0 (+ 1 pos)) src-path)))
;; there is an error: wrong type argument: commandp
(defun my-inferior-erlang-compile()
(shell-command.
(concat (concat (concat "cd" erlang-project-dir) "; make"))))
(defvar erlang-compile-function 'my-inferior-erlang-compile)
嗨,@亚历克斯,谢谢。但是'(defvar erlang-compile-function'my-inferior-erlang-compile)'报告“错误的类型参数:commandp,my-inferior-erlang-compile” – goofansu
啊,看起来使用劣erlang编译来编译erlang环境中的缓冲区,而不是执行外部shell命令。我会建议绑定一些键来调用编译函数,例如'(defun my-erlang-mode-hook()(local-set-key [f9]'my-inferior-erlang-compile)) (add- hook'erlang-mode-hook'my-erlang-mode-hook)' –
我编辑了代码,添加了'(interactive)',所以这个命令将被视为命令... –