LINUX.ORG.RU

История изменений

Исправление theNamelessOne, (текущая версия) :

Коду не хватает dash.el и f.el.

(defun find-dot-env ()
  (let ((dir (locate-dominating-file default-directory ".env")))
    (and dir (expand-file-name ".env" dir))))

(defun find-python ()
  (let ((dot-env (find-dot-env)))
    (if dot-env
        (concat dot-env "/bin/python")
      "python")))

(defun my-compile ()
  (interactive)
  (basic-save-buffer)
  (compile (concat (find-python) " " buffer-file-name)))

Исходная версия theNamelessOne, :

1) + 2) combined

Коду не хватает dash.el и f.el.

(defun find-dot-env ()
  (let ((dir (locate-dominating-file default-directory ".env")))
    (and dir (expand-file-name ".env" dir))))

(defun find-python ()
  (let ((dot-env (find-dot-env)))
    (if dot-env
        (concat dot-env "/bin/python")
      "python")))

(defun my-compile ()
  (interactive)
  (compile (concat (find-python) " " buffer-file-name)))