From 8eed16dc671f49e8ffcf51557b06a65720bd40d7 Mon Sep 17 00:00:00 2001 From: William Carroll Date: Tue, 25 Aug 2020 14:19:19 +0100 Subject: 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 --- emacs/.emacs.d/wpc/wpc-misc.el | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'emacs/.emacs.d/wpc/wpc-misc.el') diff --git a/emacs/.emacs.d/wpc/wpc-misc.el b/emacs/.emacs.d/wpc/wpc-misc.el index 5b21ec410892..897f0e56eb12 100644 --- a/emacs/.emacs.d/wpc/wpc-misc.el +++ b/emacs/.emacs.d/wpc/wpc-misc.el @@ -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))))) -- cgit 1.4.1