feat(wpcarro/emacs): Package macros.el

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
This commit is contained in:
William Carroll 2022-11-24 22:35:29 -08:00 committed by wpcarro
parent 355e08cf3b
commit fb7f461cff
3 changed files with 12 additions and 19 deletions

View file

@ -47,6 +47,7 @@ let
bookmark
cycle
list
macros
maybe
set
string

View file

@ -0,0 +1,10 @@
{ pkgs, depot, ... }:
pkgs.callPackage
({ emacsPackages }:
emacsPackages.trivialBuild {
pname = "macros";
version = "1.0.0";
src = ./macros.el;
})
{ }

View file

@ -7,19 +7,8 @@
;;; 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)