       (lambda (arg0 arg1)
         (ke/notify (format "Compilation is over ['%s']" (ke/trim-string arg1)))))
 
+(defun ke/pwd ()
+  (cond
+   ((eq major-mode 'dired-mode) (dired-current-directory))
+   ((eq major-mode 'eshell-mode) (eshell/pwd))
+   (t (file-name-directory buffer-file-name))))
+
 (cl-defun ke/compile (argument &key (parallel-jobs 2) (silent t) (alternative-compiler nil) (pre-make nil))
   "KE Compilation System, calls 'compile without cluttering the default values"
   (interactive "sTarget: ")
   (ke/with-compilation-path
-   (let* ((full-path (ke/find-where-to-compile (if (eq major-mode 'dired-mode)
-                                                   (dired-current-directory)
-                                                 (file-name-directory buffer-file-name))))
+   (let* ((full-path (ke/find-where-to-compile (ke/pwd)))
           (compile-command (concat pre-make " make -C \""
                                    full-path
                                    "\" "

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

(require 'cc-mode)

;; Compilation
(ke/bind-key-to-dired-and-c-map ke/default-prefix "k" 'ke/compile)

;; Set the bear command
(defun ke/generate-bear-command ()
  "Return a compatible bear command for the buffer"
  (let* ((full-path (ke/find-where-to-compile (ke/pwd))))
    (concat ke/bear-path " -o " full-path "/compile_commands.json -- ")))

(defmacro ke/create-compilation-function (argument)
