                                                 (file-name-directory buffer-file-name)))))
     (concat ke/bear-path " -o " full-path "/compile_commands.json -- ")))
 
-
-(defmacro ke/create-function (argument)
+(defmacro ke/create-compilation-function (argument)
   `(defun ,(intern (concat "ke/compile-" argument)) (&optional prefix)
      "KE Compilation System, calls 'compile without cluttering the default values"
      (interactive "P")

  (interactive "sEnvironment: " ke/opinel-environment)
  (setq ke/opinel-environment environment))

(cl-defun ke/run-opinel-command (command &optional (ask-for-filter t))
  "Run an opinel command using the stored ke/opinel-environment or
   asking for one if it is not set"
  (interactive "sCommand: ")
  (if ask-for-filter (setq ke/opinel-filter (read-from-minibuffer "Filter: " ke/opinel-filter)))
  (let* ((ke/project-root (concat (car (ke/find-root-dir (file-name-directory buffer-file-name) ".bzr")) "/../"))
         (ke/opinel-bin (concat ke/project-root "ke-opinel/src/opinel"))
         (buffer (get-buffer-create ke/opinel-buffer-name)))
    (if (eq nil ke/opinel-environment)
        (setq ke/opinel-environment (read-from-minibuffer "Environment name: ")))
    (with-current-buffer buffer
      (async-shell-command (format "%s %s --env=%s %s"
                                   ke/opinel-bin
                                   (if (not (string-empty-p ke/opinel-filter)) (format "-g role:%s" ke/opinel-filter) "")
                                   ke/opinel-environment
                                   command) buffer)
      (read-only-mode))))

(defun ke/run-opinel-remote-command (command)
  "Convenient wrapper to run cmd -- command"
  (interactive "sCommand: ")
  (ke/run-opinel-command (format "cmd -- %s" command)))

(defun ke/opinel-get-services-status ()
  (interactive)

  `(define-key dired-mode-map (concat ,prefix ,key) ,symbol)
  `(define-key c-mode-base-map (concat ,prefix ,key) ,symbol))

(ke/create-compilation-function "clean")
(ke/create-compilation-function "all")
(ke/create-compilation-function "check")
(ke/create-compilation-function "deb-main-deploy")

(require 'cc-mode)

