Replace calls to (getenv "BRIEFCASE") with constants/briefcase

I would prefer to define constants/briefcase in terms of `(getenv "BRIEFCASE")`
and assert that `(f-exists? (getenv "BRIEFCASE"))`, in one location:
constants.el
This commit is contained in:
William Carroll 2020-08-25 14:19:19 +01:00
parent 21ce27b0ca
commit 8eed16dc67
4 changed files with 17 additions and 10 deletions

View file

@ -13,6 +13,7 @@
(require 'project)
(require 'f)
(require 'dash)
(require 'constants)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Configuration
@ -180,10 +181,11 @@
;; trim whitespace on save
(add-hook 'before-save-hook #'delete-trailing-whitespace)
;; call `git secret hide` after saving ~/briefcase/secrets.json
;; call `git secret hide` after saving secrets.json
(add-hook 'after-save-hook
(lambda ()
(when (f-equal? (buffer-file-name) "~/briefcase/secrets.json")
(when (f-equal? (buffer-file-name)
(f-join constants/briefcase "secrets.json"))
(shell-command "git secret hide"))))
;; use tabs instead of spaces
@ -207,7 +209,7 @@
(defun project-find-function--briefcase (dir)
"Find the nearest default.nix file; otherwise, terminate at the .git
directory."
(when (s-starts-with? (getenv "BRIEFCASE") (f-expand dir))
(when (s-starts-with? constants/briefcase (f-expand dir))
(if (f-exists? (f-join dir "default.nix"))
(cons 'transient dir)
(project-find-function--briefcase (f-parent dir)))))