【发布时间】:2014-06-12 15:58:43
【问题描述】:
我正在尝试编写一个 emacs 函数,它将在当前目录中运行 make,切换到另一个目录并运行 make link,同时将文本输出到名为 make-output的新缓冲区>(原创,嗯?)。完成后,我想移动到 make-output 缓冲区的 end,以便查看编译是否成功。这是我目前所拥有的:
(defun remake-libefp-interface()
"Will run make in the current directory, change to the NWChem src directory and relink the binary."
(interactive)
(defvar T_pwd (getenv "PWD"))
(defvar T_top (concat (getenv "NWCHEM_TOP") "/src"))
(defvar cmd (concat "make; cd " T_top "; make link;cd " T_pwd))
(with-output-to-temp-buffer "*make-output*"
(shell-command cmd "*make-output*")
(pop-to-buffer "*make-output*")
(end-of-buffer)))
这可以正确重新编译,但在 make-output 的 beginninng 处转储我。我也试过用(goto-char (point-max))替换(end-of-buffer),但这也让我一开始就离开了。
【问题讨论】:
-
(compile (concat "make; cd " T_top "; make link;cd " T_pwd))会做你想做的事吗? -
是的。这与
(setq compliation-scroll-output t)结合使用可以更好地完成我想要完成的工作,因为它是彩色编码的。谢谢你的提示。我将 Drew 的回复标记为答案,因为它在技术上回答了我提出的问题,但您的回复更有助于实现我想要的。 -
在程序中,不要使用命令(缓冲区结束),这可能会减慢它的速度。使用 (goto-char (point-max))