about summary refs log tree commit diff
path: root/emacs/.emacs.d/wpc/wpc-misc.el
diff options
context:
space:
mode:
authorWilliam Carroll <wpcarro@gmail.com>2020-08-25T13·19+0100
committerWilliam Carroll <wpcarro@gmail.com>2020-08-25T13·19+0100
commit8eed16dc671f49e8ffcf51557b06a65720bd40d7 (patch)
treebb41112bc520b89b25b4965cf75a4530281b7456 /emacs/.emacs.d/wpc/wpc-misc.el
parent21ce27b0ca948ddab2206baf36707d00822e5206 (diff)
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
Diffstat (limited to 'emacs/.emacs.d/wpc/wpc-misc.el')
-rw-r--r--emacs/.emacs.d/wpc/wpc-misc.el8
1 files changed, 5 insertions, 3 deletions
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)))))