From 884343deb4c9c7837356b27968c1e594d8730d49 Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Fri, 12 Mar 2021 17:32:13 -0600 Subject: Add `:set', `:local', `:require' keywords to `acdw/pkg' --- init.el | 51 ++++++++++++++++++++------------------------------- lisp/acdw.el | 27 ++++++++++++++++++++------- 2 files changed, 40 insertions(+), 38 deletions(-) diff --git a/init.el b/init.el index 6940b6c..c4d8664 100644 --- a/init.el +++ b/init.el @@ -199,7 +199,7 @@ (icomplete-with-buffer-completion-tables t) (icomplete-in-buffer t))) (acdw/pkg orderless - :now ((acdw/set '((completion-styles (orderless)))))) + :set '((completion-styles (orderless)))) (acdw/pkg icomplete-vertical :binds (("" icomplete-forward-completions :map icomplete-minibuffer-map) @@ -247,15 +247,15 @@ ("M-y" consult-yank-pop) (" a" consult-apropos) ("C-h a" consult-apropos)) - :now ((autoload 'consult-register-preview "consult") - (acdw/set '((register-preview-delay 0) - (register-preview-function #'consult-register-preview))))) + :now ((autoload 'consult-register-preview "consult")) + :set '((register-preview-delay 0) + (register-preview-function #'consult-register-preview))) ;; Marginalia (acdw/pkg marginalia - :now ((acdw/set '((marginalia-annotators (marginalia-annotators-heavy - marginalia-annotators-light)))) - (marginalia-mode +1))) + :set '((marginalia-annotators (marginalia-annotators-heavy + marginalia-annotators-light))) + :now ((marginalia-mode +1))) ;; Imenu (when (require 'imenu) @@ -268,36 +268,25 @@ :binds (("C-/" undo-fu-only-undo) ("C-?" undo-fu-only-redo))) (acdw/pkg undo-fu-session - :now ((acdw/set `((undo-fu-session-incompatible-files ("/COMMIT_EDITMSG\\'" - "/git-rebase-todo\\'")) - (undo-fu-session-directory ,(acdw/in-dir "undo/" t))))) + :set `((undo-fu-session-incompatible-files ("/COMMIT_EDITMSG\\'" + "/git-rebase-todo\\'")) + (undo-fu-session-directory ,(acdw/in-dir "undo/" t))) :then ((global-undo-fu-session-mode +1))) ;; Modus themes (acdw/pkg (modus-themes :host gitlab :repo "protesilaos/modus-themes") - :now ((acdw/set `((modus-themes-slanted-constructs t) - (modus-themes-bold-constructs t) - (modus-themes-region 'bg-only) - (modus-themes-org-blocks 'grayscale) - (modus-themes-headings ((1 . section) - (t . no-color))) - (modus-themes-scale-headings nil) - (modus-themes-mode-line nil))) - (acdw/sunrise-sunset #'modus-themes-load-operandi - #'modus-themes-load-vivendi)) - :then - ((dolist (face '(modus-theme-heading-1 - modus-theme-heading-2 - modus-theme-heading-3 - modus-theme-heading-4 - modus-theme-heading-5 - modus-theme-heading-6 - modus-theme-heading-7 - modus-theme-heading-8)) - (acdw/set-face face - `((t (:inherit (fixed-pitch bold)))))))) + :set `((modus-themes-slanted-constructs t) + (modus-themes-bold-constructs t) + (modus-themes-region 'bg-only) + (modus-themes-org-blocks 'grayscale) + (modus-themes-headings ((1 . section) + (t . no-color))) + (modus-themes-scale-headings nil) + (modus-themes-mode-line nil)) + :now ((acdw/sunrise-sunset #'modus-themes-load-operandi + #'modus-themes-load-vivendi))) ;;; Mode line diff --git a/lisp/acdw.el b/lisp/acdw.el index 6641e9b..002f8f6 100644 --- a/lisp/acdw.el +++ b/lisp/acdw.el @@ -191,13 +191,21 @@ KEYMAP can be nil." ARGS can include the following keywords: -:now FORMS .. run forms immediately. - Good for settings and auxiliary functions. -:then FORMS .. run forms after loading PACKAGE, using `with-eval-after-load'. -:binds BINDS .. run `acdw/bind-after-map' on BINDS. -:hooks HOOKS .. run `acdw/hooks-after' on HOOKS." +:local BOOL .. if BOOL is non-nil, don't run `straight-use-package' on + PACKAGE. Good for using `acdw/pkg' on local features. +:require BOOL .. if BOOL is non-nil, run `require' on PACKAGE before anything. +:now FORMS .. run FORMS immediately. +:then FORMS .. run FORMS after loading PACKAGE, using `with-eval-after-load'. +:set SETTINGS .. pass SETTINGS to `acdw/set', right after `:now' forms. + SETTINGS should be properly quoted, just like they'd be passed + to the function. +:binds BINDS .. run `acdw/bind-after-map' on BINDS. +:hooks HOOKS .. run `acdw/hooks' on HOOKS." (declare (indent 1)) - (let ((now-forms (plist-get args :now)) + (let ((local-pkg (plist-get args :local)) + (require-pkg (plist-get args :require)) + (now-forms (plist-get args :now)) + (settings (plist-get args :set)) (binds (plist-get args :binds)) (hooks (plist-get args :hooks)) (then-forms (plist-get args :then)) @@ -212,9 +220,14 @@ ARGS can include the following keywords: (when binds (push `(acdw/bind-after-map ,(symbol-name requirement) nil ,binds) final-form)) + (when settings + (push `(acdw/set ,settings) final-form)) (when now-forms (push `(progn ,@now-forms) final-form)) - (push `(straight-use-package ',package) final-form) + (unless local-pkg + (push `(straight-use-package ',package) final-form)) + (when require-pkg + (push `(require ',requirement) final-form)) `(progn ,@final-form))) -- cgit 1.4.1-21-gabe81