From dbb7415d3ee201e8439ba3ad9011a13d6afa09a8 Mon Sep 17 00:00:00 2001 From: Sameer Rahmani Date: Thu, 1 Jun 2023 00:25:05 +0100 Subject: [PATCH] Add the ->cube macro as a shortcut for single package cubes --- core/cubes/editor.el | 12 ++++++++++++ core/cubes/meson.el | 2 -- core/fg42/build/docs.el | 2 +- core/fg42/cube.el | 12 ++++++++++++ 4 files changed, 25 insertions(+), 3 deletions(-) diff --git a/core/cubes/editor.el b/core/cubes/editor.el index 1bc8325..108da04 100644 --- a/core/cubes/editor.el +++ b/core/cubes/editor.el @@ -51,6 +51,18 @@ For more info checkout [[https://github.com/gregsexton/origami.el]]" (global-origami-mode t))) +(->cube helpful + "Helpful is an alternative to the built-in Emacs help that provides much more contextual information." + :init + (require 'helpful) + :config + (global-set-key (kbd "C-h f") #'helpful-callable) + (global-set-key (kbd "C-h v") #'helpful-variable) + (global-set-key (kbd "C-h k") #'helpful-key) + (global-set-key (kbd "C-h x") #'helpful-command) + (global-set-key (kbd "C-c C-d") #'helpful-at-point)) + + (defcube fg42/pinentry-cube "Pinentry cube with setup the =pinentry= program to be used within FG42." (:title "Pinentry cube" diff --git a/core/cubes/meson.el b/core/cubes/meson.el index 7cc8b3e..c0f57e6 100644 --- a/core/cubes/meson.el +++ b/core/cubes/meson.el @@ -33,8 +33,6 @@ For more info checkout [[https://github.com/wentasah/meson-mode]]" :flag mesonbuild :flag-default t) (fpkg/use meson-mode - :bind - (("C-c TAB" . origami-toggle-node)) :config (progn (when-flag company diff --git a/core/fg42/build/docs.el b/core/fg42/build/docs.el index 466af56..23c028f 100644 --- a/core/fg42/build/docs.el +++ b/core/fg42/build/docs.el @@ -44,7 +44,7 @@ (defun fg42/build-docs-for-cube (build-dir cube) - "Build the given CUBE's doc in BUILD-DIR" + "Build the given CUBE's doc in BUILD-DIR." (let* ((cubes-dir (expand-file-name "site/cubes/" build-dir)) (props (symbol-plist cube)) (docs (plist-get props :docs)) diff --git a/core/fg42/cube.el b/core/fg42/cube.el index bfb97e7..5256a27 100644 --- a/core/fg42/cube.el +++ b/core/fg42/cube.el @@ -165,5 +165,17 @@ it is to use `fg42/after-cubes' macro.") ,@body))) +(defmacro ->cube (pkg docs &rest body) + "A wrapper to create a cube that use only a PKG. +It passes the BODY to `fpkg/use'." + (declare (indent defun) (doc-string 2)) + `(defcube ,(intern (format "fg42/%s-cube" pkg)) + ,docs + (:title ,(format "%s cube" pkg) + :flag pkg + :flag-default t) + (fpkg/use ,pkg ,@body))) + + (provide 'fg42/cube) ;;; cube.el ends here