`(blog ,garaemon)

ポップカルチャーを摂取して、コードを吐き出す機械

emacsからcatkin buildを走らせる

emacs編集中に, ターミナルに移動することなくcatkin buildを走らせられると便利.

(defun ros-catkin-make (dir)
  "Run catkin_make command in DIR."
  (interactive (list default-directory))
  ;; clear compilation buffer first not to occupy memory space.
  (if (get-buffer "*catkin_make*")
      (kill-buffer "*catkin_make*"))
  (let* ((default-directory dir)
         (compilation-buffer-name-function (lambda (major-mode-name) "*catkin_make*")))
    (compile "catkin bt --no-status"))
  (switch-to-buffer-other-window (get-buffer-create "*catkin_make*"))
  )

具体的には編集中のbufferのディレクトリに対して, catkin build --thisを走らせている.

適当にC-x C-mとかに割り当てる.

(global-set-key (kbd "C-x C-m") 'ros-catkin-make)