about summary refs log tree commit diff
diff options
context:
space:
mode:
authorWilliam Carroll <wpcarro@gmail.com>2022-11-25T06·35-0800
committerwpcarro <wpcarro@gmail.com>2022-11-25T16·51+0000
commitfb7f461cff099c7eb742f50fec72d8d73191bc06 (patch)
tree329f0bd70f67beb0d886145577eed86f1a641191
parent355e08cf3bd8d1ef63baeb178dc51b82004a6216 (diff)
feat(wpcarro/emacs): Package macros.el r/5320
Drop unnecessary dependencies and move to pkgs directory.

Change-Id: I88badf2202ea443571f3b92758819047cc6be458
Reviewed-on: https://cl.tvl.fyi/c/depot/+/7398
Reviewed-by: wpcarro <wpcarro@gmail.com>
Tested-by: BuildkiteCI
-rw-r--r--users/wpcarro/emacs/default.nix1
-rw-r--r--users/wpcarro/emacs/pkgs/macros/default.nix10
-rw-r--r--users/wpcarro/emacs/pkgs/macros/macros.el (renamed from users/wpcarro/emacs/.emacs.d/wpc/macros.el)20
3 files changed, 12 insertions, 19 deletions
diff --git a/users/wpcarro/emacs/default.nix b/users/wpcarro/emacs/default.nix
index 19014dd6460f..c83934d6f063 100644
--- a/users/wpcarro/emacs/default.nix
+++ b/users/wpcarro/emacs/default.nix
@@ -47,6 +47,7 @@ let
       bookmark
       cycle
       list
+      macros
       maybe
       set
       string
diff --git a/users/wpcarro/emacs/pkgs/macros/default.nix b/users/wpcarro/emacs/pkgs/macros/default.nix
new file mode 100644
index 000000000000..d2811ed39fc6
--- /dev/null
+++ b/users/wpcarro/emacs/pkgs/macros/default.nix
@@ -0,0 +1,10 @@
+{ pkgs, depot, ... }:
+
+pkgs.callPackage
+  ({ emacsPackages }:
+  emacsPackages.trivialBuild {
+    pname = "macros";
+    version = "1.0.0";
+    src = ./macros.el;
+  })
+{ }
diff --git a/users/wpcarro/emacs/.emacs.d/wpc/macros.el b/users/wpcarro/emacs/pkgs/macros/macros.el
index 32c9b59dcd50..3642686eeb4b 100644
--- a/users/wpcarro/emacs/.emacs.d/wpc/macros.el
+++ b/users/wpcarro/emacs/pkgs/macros/macros.el
@@ -7,20 +7,9 @@
 ;;; Commentary:
 ;; This file contains helpful variables that I use in my ELisp development.
 
-;; TODO: Consider a macro solution for mimmicking OCaml's auto resolution of
-;; dependencies using `load-path' and friends.
-
 ;;; Code:
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;; Dependencies
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
-(require 'f)
-(require 'string)
-(require 'symbol)
-
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; Library
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
@@ -42,13 +31,6 @@ Usage: (macros-add-hook-before-save 'reason-mode-hook #'refmt-before-save)"
              (lambda ()
                (add-hook 'before-save-hook ,f))))
 
-;; TODO: Privatize?
-(defun macros--namespace ()
-  "Return the namespace for a function based on the filename."
-  (->> (buffer-file-name)
-       f-filename
-       f-base))
-
 (defmacro macros-comment (&rest _)
   "Empty comment s-expresion where `BODY' is ignored."
   `nil)
@@ -56,7 +38,7 @@ Usage: (macros-add-hook-before-save 'reason-mode-hook #'refmt-before-save)"
 (defmacro macros-support-file-extension (ext mode)
   "Register MODE to automatically load with files ending with EXT extension.
 Usage: (macros-support-file-extension \"pb\" protobuf-mode)"
-  (let ((extension (string-format "\\.%s\\'" ext)))
+  (let ((extension (format "\\.%s\\'" ext)))
     `(add-to-list 'auto-mode-alist '(,extension . ,mode))))
 
 (provide 'macros)